/* Отличия рабочего приложения от макета: окно на всю страницу, ссылки вместо кнопок навигации. */
html, body { margin: 0; }
body.erp { min-height: 100vh; background: var(--erp-bg); }
.erp .erp-window { min-height: 100vh; border: 0; border-radius: 0; }
.erp .erp-login { min-height: 100vh; }
.erp a.erp-brand { color: var(--erp-text); text-decoration: none; }
.erp a.erp-navitem { color: inherit; text-decoration: none; }
.erp a.erp-navitem:focus-visible, .erp .erp-button:focus-visible { outline: 2px solid var(--erp-accent); outline-offset: 2px; }
.erp a.erp-button { text-decoration: none; color: inherit; }
.erp a.erp-button.primary { color: var(--erp-panel); }
.erp .erp-navitem svg { width: 16px; height: 16px; flex: none; }
.erp .erp-inline { display: inline; margin: 0 0 0 8px; }
.erp .erp-small-button { padding: 4px 10px; min-height: 28px; font-size: 12px; cursor: pointer; }
.erp .erp-loginbox form .erp-button { cursor: pointer; }

/* Окна поверх всей страницы (в макете — внутри окна прототипа). */
.erp .erp-modalcover { position: fixed; z-index: 50; overflow-y: auto; }
.erp .erp-modal { max-height: none; }
.erp .erp-modal .erp-panelhead { margin-bottom: 12px; }
.erp .erp-modalfooter { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin-top: 16px; }

/* Ошибки полей и формы. */
.erp .erp-error { color: var(--erp-danger); font-size: 12px; }
.erp .erp-field.has-error input, .erp .erp-field.has-error select, .erp .erp-field.has-error textarea,
.erp .erp-field.has-error .erp-entitybutton { border-color: var(--erp-danger); }

/* Выбор сущности. */
.erp .erp-picker { min-width: 0; }
.erp .erp-pickerline { flex-wrap: nowrap; }
.erp .erp-pickerline .erp-entitybutton { flex: 1; justify-content: space-between; min-width: 0; text-align: left; }
.erp .erp-pickerlist { display: grid; border-top: 1px solid var(--erp-border); margin-bottom: 8px; }
.erp .erp-pickerlist .erp-pickerrow { padding: 6px 3px; }
.erp .erp-pickerlabel { min-width: 0; overflow-wrap: anywhere; }
.erp .erp-pickresults { display: grid; max-height: 50vh; overflow-y: auto; margin-top: 10px; }
.erp .erp-pickchoice { cursor: pointer; justify-content: flex-start; }
.erp .erp-pickchoice:hover, .erp .erp-pickchoice:focus-visible { background: var(--erp-active); }

/* Комментарии. */
.erp .erp-commentedit { display: inline; }
.erp .erp-commentedit summary { display: inline-flex; list-style: none; cursor: pointer; }
.erp .erp-commentedit summary::-webkit-details-marker { display: none; }
.erp .erp-commentedit[open] form { display: grid; gap: 8px; margin-top: 8px; }
.erp .erp-commentedit textarea { width: 100%; min-height: 70px; }
.erp .erp-code { white-space: pre-wrap; overflow-wrap: anywhere; background: var(--erp-bg); border: 1px solid var(--erp-border); border-radius: 8px; padding: 12px; font-size: 12px; }
.erp form.erp-panel { display: block; }
.erp button, .erp .erp-link { cursor: pointer; }

/* Группа полей внутри сетки формы: участвует в сетке как обычные поля. */
.erp .erp-fieldgroup { display: contents; }
.erp .erp-fieldgroup[hidden] { display: none; }
.erp .erp-rows { display: grid; gap: 8px; }
.erp .erp-after { margin-top: 16px; }
.erp .erp-quickcreate .erp-fields { margin-bottom: 8px; }
.erp .erp-pairrow.single { grid-template-columns: minmax(0, 1fr) 80px; }
@media (pointer: coarse) { .erp .erp-pairrow.single { grid-template-columns: minmax(0, 1fr) 92px; } }
@media (max-width: 560px) { .erp .erp-pairrow:not(.single) { grid-template-columns: minmax(0, 1fr) 80px; } .erp .erp-pairrow:not(.single) > input[name="extra-value"] { grid-column: 1; } }

/* Заказы */
.erp .erp-visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.erp .erp-info.erp-info-one { grid-template-columns: minmax(0, 1fr); gap: 10px; }
.erp .erp-itemactions { margin-top: 12px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.erp .erp-pricelist { margin-bottom: 12px; }
.erp .erp-wideinput { width: 100% !important; }
.erp .erp-problems { margin: 6px 0; padding-left: 20px; }
.erp .erp-summary { position: sticky; top: 16px; }
.erp .erp-inlinefield { display: flex; gap: 8px; align-items: center; }
.erp .erp-between { justify-content: space-between; }
.erp .erp-calday.erp-dim { opacity: .55; }
.erp .erp-calnum a { color: inherit; text-decoration: none; display: inline-block; min-width: 24px; }
.erp .erp-calnum a:hover, .erp .erp-calnum a:focus-visible { color: var(--erp-accent); text-decoration: underline; }
.erp a.erp-calevent { color: inherit; text-decoration: none; }
@media (max-width: 900px) { .erp .erp-summary { position: static; } }
.erp .erp-fields { align-items: start; }
.erp a.erp-tab { text-decoration: none; }
.erp .erp-summary { display: grid; gap: 12px; }

/* Задачи */
.erp .erp-taskcard { cursor: grab; }
.erp .erp-taskcard .erp-kanbanselect { margin-top: 6px; width: 100%; font-size: 11px; padding: 3px 6px; }
.erp .erp-lane { min-height: 120px; }
.erp .erp-graph { height: 520px; width: 100%; border: 1px solid var(--erp-border); border-radius: 8px; background: var(--erp-bg); }
.erp .erp-graphlist ul { margin: 12px 0 0; padding-left: 20px; font-size: 13px; }
.erp .erp-dayrow form { margin: 0; }
@media (max-width: 650px) { .erp .erp-graph { height: 360px; } }

/* Wiki */
.erp .erp-wiki { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 16px; align-items: start; }
.erp .erp-wikilist { position: sticky; top: 16px; display: grid; gap: 10px; max-height: calc(100vh - 32px); overflow: auto; }
.erp .erp-wikinav { display: grid; gap: 2px; }
.erp .erp-wikiitem { display: block; padding: 7px 9px; border-radius: 6px; color: inherit; text-decoration: none; overflow-wrap: anywhere; }
.erp .erp-wikiitem:hover { background: var(--erp-bg); }
.erp .erp-wikiitem.is-active { background: var(--erp-active); color: var(--erp-accent); font-weight: 500; }
.erp .erp-wikicontent { line-height: 1.6; overflow-wrap: anywhere; }
.erp .erp-wikicontent h2, .erp .erp-wikicontent h3, .erp .erp-wikicontent h4 { margin: 18px 0 8px; font-weight: 600; line-height: 1.3; }
.erp .erp-wikicontent h2 { font-size: 22px; }
.erp .erp-wikicontent h3 { font-size: 18px; }
.erp .erp-wikicontent h4 { font-size: 16px; }
.erp .erp-wikieditor h1 { font-size: 22px; font-weight: 600; margin: 18px 0 8px; }
.erp .erp-wikieditor h2 { font-size: 18px; }
.erp .erp-wikieditor h3 { font-size: 16px; }
.erp .erp-wikicontent p { margin: 0 0 10px; }
.erp .erp-wikicontent table { margin: 8px 0; }
.erp .erp-wikicontent td, .erp .erp-wikicontent th { border: 1px solid var(--erp-border); min-width: 60px; vertical-align: top; }
.erp .erp-wikicontent img { max-width: 100%; height: auto; display: block; border-radius: 6px; }
.erp .erp-wikicontent a { color: var(--erp-accent); }
.erp .erp-wikiimage { margin: 10px 0; }
.erp .erp-wikitoolbar { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0 10px; }
.erp .erp-wikitoolbar .erp-button { min-height: 32px; padding: 5px 9px; }
.erp .erp-wikieditor { border: 1px solid var(--erp-border); border-radius: 8px; padding: 12px 14px; min-height: 320px; }
.erp .erp-wikieditor .ProseMirror { outline: none; min-height: 300px; }
.erp .erp-wikieditor .ProseMirror-selectednode img { outline: 2px solid var(--erp-accent); }
.erp .erp-wikieditor .selectedCell { background: var(--erp-active); }
@media (max-width: 900px) { .erp .erp-wiki { grid-template-columns: minmax(0, 1fr); } .erp .erp-wikilist { position: static; max-height: 260px; } }

/* Маршрутные листы */
.erp .erp-routeboard { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 8px; align-items: start; }
.erp .erp-routecol { background: var(--erp-bg); border: 1px solid var(--erp-border); border-radius: 9px; padding: 10px; min-width: 0; }
.erp .erp-routecolhead { display: flex; gap: 6px; align-items: center; margin-bottom: 8px; min-height: 36px; }
.erp .erp-routecolhead h2 { font-size: 14px; margin: 0; }
.erp .erp-routecolhead input { flex: 1; min-width: 0; font-weight: 500; }
.erp .erp-routecards { display: grid; gap: 8px; min-height: 60px; }
.erp .erp-routecard { background: var(--erp-panel); border: 1px solid var(--erp-border); border-left: 4px solid var(--erp-muted); border-radius: 8px; padding: 9px; font-size: 12px; cursor: grab; display: grid; gap: 4px; }
.erp .erp-routecard.courier { border-left-color: #2f7d5b; }
.erp .erp-routecard.transport { border-left-color: #6a4fc2; }
.erp .erp-routecard.is-dragging { opacity: .5; }
.erp .erp-method.courier { color: #2f7d5b; background: color-mix(in srgb, #2f7d5b 12%, transparent); }
.erp .erp-method.transport { color: #6a4fc2; background: color-mix(in srgb, #6a4fc2 12%, transparent); }
.erp .erp-routehead { justify-content: space-between; }
.erp .erp-routeitems { margin: 2px 0; padding-left: 16px; }
.erp .erp-routemeta { flex-wrap: wrap; gap: 4px; }
.erp .erp-routecontrols { display: flex; gap: 4px; align-items: center; }
.erp .erp-routecontrols select { flex: 1; min-width: 0; font-size: 12px; padding: 4px 6px; }
@media (max-width: 650px) { .erp .erp-routeboard { grid-auto-flow: row; grid-auto-columns: auto; overflow: visible; } }
.erp .erp-siteinput { display: flex; gap: 6px; align-items: center; min-width: 0; }
.erp .erp-siteinput input { flex: 1; min-width: 0; }

/* Цвет статуса задачи: серая — новая, синяя — в работе, фиолетовая — на проверке, оранжевая — на паузе,
   зеленая — завершена, красная — отменена. Одна шкала для списка, канбана, «На сегодня», графа и связей. */
.erp .erp-st-new { --st: #6b7280; }
.erp .erp-st-in_progress { --st: #2563eb; }
.erp .erp-st-review { --st: #7c3aed; }
.erp .erp-st-paused { --st: #d97706; }
.erp .erp-st-done { --st: #16a34a; }
.erp .erp-st-cancelled { --st: #dc2626; }
.erp .erp-pill.erp-stpill { color: var(--st); background: color-mix(in srgb, var(--st) 13%, transparent); font-weight: 500; }
.erp .erp-taskcard[class*="erp-st-"] { border-left: 4px solid var(--st); }
.erp .erp-lanehead { display: flex; align-items: center; gap: 6px; }
.erp .erp-stdot { width: 9px; height: 9px; border-radius: 50%; background: var(--st); flex: none; }
.erp .erp-taskcard .erp-stpill { margin-top: 8px; }
.erp .erp-daydot { margin-top: 9px; }
