@font-face {
  font-family: "Golos Text";
  src: url("/fonts/golos-text-cyrillic-wght-normal.woff2") format("woff2");
  font-weight: 400 900;
  font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Golos Text";
  src: url("/fonts/golos-text-latin-wght-normal.woff2") format("woff2");
  font-weight: 400 900;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+2000-206F, U+20AC, U+20BD, U+2122, U+2191, U+2193, U+2212;
}

:root {
  /* Цвета логотипа: яркий синий и тёмно-синий. Нейтральная шкала подкрашена тем же синим. */
  --ink: #0B1F3F;
  --text-2: #42516A;
  --muted: #56647C;
  --bg: #F4F6FA;
  --surface: #FFFFFF;
  --raised: #E8EEF7;
  --line: rgba(11, 31, 63, .16);
  --line-soft: rgba(11, 31, 63, .08);
  --edge: #E3E8F0; /* граница панелей и меню */
  --brand: #0A6CD6;
  --brand-bright: #0A84F0;
  --brand-deep: #06306B;
  --brand-soft: #E1EEFD;
  /* Смысловые цвета: только для состояний и шкалы загрузки */
  --amber: #E8A200;
  --amber-soft: #FCF1D6;
  --amber-ink: #8A5A00;
  --red: #DC2626;
  --red-soft: #FBE6E3;
  --red-ink: #B91C1C; /* красный текст на светлой подложке */
  --green: #0F6B32;
  --green-soft: #DFF1E6;
  --r-control: 10px;
  --r-panel: 16px;
  --tabs-h: 60px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  font-family: "Golos Text", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 20px;
  color: var(--ink);
  -webkit-text-size-adjust: 100%;
}

b, strong { font-weight: 500; }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); }
html.dialog-open { overflow: hidden; overscroll-behavior: none; }
html.dialog-open body { position: fixed; left: 0; right: 0; width: 100%; overflow: hidden; }
h1, h2, h3, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--brand); }
[hidden] { display: none !important; }
.grow { flex: 1 1 auto; min-width: 0; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.ic { flex: none; }

/* ---------- кнопки и поля ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 40px; padding: 0 16px; border-radius: var(--r-control);
  border: 1px solid var(--line); background: var(--surface); font-weight: 500; text-decoration: none; color: var(--ink);
  white-space: nowrap;
}
.btn:hover { border-color: var(--line); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-deep); border-color: var(--brand-deep); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--line-soft); }
.btn.danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn.danger-ghost { background: transparent; border-color: transparent; color: var(--red); }
.btn.danger-ghost:hover { background: var(--red-soft); }
.btn.small { min-height: 32px; padding: 0 12px; font-size: 13px; }
.btn.big { min-height: 48px; width: 100%; font-size: 15px; }
.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: var(--r-control);
  background: transparent; color: var(--muted); position: relative; flex: none;
}
.icon-btn:hover { background: var(--line-soft); color: var(--ink); }
.link { border: 0; background: none; padding: 0; color: var(--brand); text-decoration: underline; text-align: left; }

input, select, textarea {
  width: 100%; min-height: 40px; padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--r-control);
  background: var(--surface);
}
/* 16px в полях на телефоне: iOS не увеличивает страницу при вводе */
@media (max-width: 760px) { input, select, textarea { font-size: 16px; } }
textarea { resize: vertical; min-height: 64px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: -1px; border-color: var(--brand); }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; min-height: 0; padding: 0; accent-color: var(--brand); }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
fieldset:disabled input, fieldset:disabled .sel-btn, fieldset:disabled textarea { background: var(--bg); color: var(--ink); opacity: 1; }

.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; min-width: 0; }
.field > span { font-size: 13px; color: var(--muted); }
.grid2, .grid3 { display: grid; gap: 0 12px; grid-template-columns: 1fr 1fr; }
@media (min-width: 761px) { .grid3 { grid-template-columns: 1fr 1fr 1fr; } }
@media (max-width: 480px) { .grid2, .grid3 { grid-template-columns: 1fr; } }
.hint { font-size: 13px; color: var(--text-2); }
.text { margin-bottom: 12px; max-width: 68ch; }
.form-error { color: var(--red); background: var(--red-soft); padding: 8px 12px; border-radius: var(--r-control); font-size: 13px; }
.notice { background: var(--amber-soft); border-radius: var(--r-control); padding: 12px 12px; margin-bottom: 12px; max-width: 72ch; }
.ok-line { color: var(--green); font-weight: 500; margin-bottom: 8px; }
.btn-line { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- вход ---------- */

.login { min-height: 100dvh; display: grid; place-items: center; padding: 20px; background: var(--bg); }
.login-box { width: min(360px, 100%); background: var(--surface); border-radius: 16px; padding: 32px 24px; box-shadow: 0 8px 24px rgba(0, 0, 0, .06); }
.login-box .login-logo { display: block; width: 200px; height: auto; margin: 0 auto 24px; }
.login-box h1 { font-size: 20px; line-height: 28px; font-weight: 500; margin-bottom: 16px; }
.login-box .form-error { margin-bottom: 12px; }

/* ---------- каркас ---------- */

.shell { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100dvh; background: linear-gradient(to right, var(--surface) 239px, var(--edge) 239px, var(--edge) 240px, transparent 240px); }
.side { background: var(--surface); border-right: 1px solid var(--edge); color: var(--text-2); display: flex; flex-direction: column; gap: 16px; padding: 16px 12px; position: sticky; top: 0; height: 100dvh; }
.brand { display: flex; align-items: center; gap: 8px; padding: 4px 8px 0; font-weight: 600; color: var(--ink); font-size: 16px; min-width: 0; }
.brand span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-search { display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 8px 0 12px; border: 1px solid var(--edge); border-radius: var(--r-control); background: var(--bg); color: var(--muted); text-align: left; }
.side-search:hover { border-color: var(--line); color: var(--ink); }
.side-search kbd { font: inherit; font-size: 12px; padding: 0 6px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); white-space: nowrap; }
.brand img { object-fit: contain; }
/* Меню прокручивается внутри себя: на низком окне пункты не уходят под имя сотрудника */
.side nav { display: flex; flex-direction: column; gap: 16px; flex: 1; min-height: 0; overflow-y: auto; }
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-label { padding: 0 8px 4px; font-size: 12px; color: var(--muted); }
.side nav a { display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 8px; border-radius: var(--r-control); color: inherit; text-decoration: none; }
.side nav a:hover { background: rgba(11, 31, 63, .06); color: var(--ink); }
.side nav a.on { background: var(--brand-soft); color: var(--brand-deep); font-weight: 500; }
.side nav a.on .ic { color: var(--brand); }
.side-user { padding: 8px; border-radius: var(--r-control); display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; position: relative; }
.side-user::before { content: ""; position: absolute; left: 0; right: 0; top: -5px; border-top: 1px solid var(--line-soft); }
.side-user:hover { background: rgba(11, 31, 63, .06); }
.side-user.on { background: var(--brand-soft); }
.side-user-text { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 18px; }
.side-user-text b { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user-text small { color: var(--muted); font-size: 12px; }
.side-user .ic { color: var(--muted); }
.side-user:hover .ic, .side-user.on .ic { color: var(--brand); }

.main-col { min-width: 0; display: flex; flex-direction: column; max-width: 1488px; }
.install-banner { display: flex; align-items: center; gap: 12px; margin: 12px 24px 4px; padding: 12px; border: 1px solid var(--line); border-radius: var(--r-panel); background: var(--surface); }
.install-copy { flex: 1; min-width: 0; }
.install-copy strong { font-weight: 500; }
.install-copy p { margin-top: 4px; font-size: 13px; color: var(--text-2); }
@media (max-width: 760px) {
  .install-banner { display: grid; grid-template-columns: minmax(0, 1fr) 40px; gap: 8px; margin: 12px 12px 0; }
  .install-copy { grid-column: 1; grid-row: 1; }
  .install-banner > .icon-btn { grid-column: 2; grid-row: 1; align-self: start; }
  .install-banner > .btn { grid-column: 1 / -1; white-space: normal; }
}
.top { display: flex; align-items: center; gap: 12px; padding: 16px 24px 6px; }
.top h1 { font-size: 28px; line-height: 32px; font-weight: 600; letter-spacing: -.01em; flex: 1; min-width: 0; }
.top-search { display: none; }
.bell .badge {
  position: absolute; top: 0; right: 0; min-width: 20px; height: 20px; padding: 0 4px; border-radius: 10px;
  background: var(--red); color: #fff; font-size: 12px; font-weight: 600; line-height: 20px; text-align: center;
}
#view { padding: 8px 24px 40px; outline: none; }
.tabs { display: none; }

@media (max-width: 760px) {
  .shell { display: block; background: none; }
  .side { display: none; }
  .top { position: sticky; top: 0; z-index: 5; background: var(--surface); border-bottom: 1px solid var(--line-soft); padding: calc(8px + env(safe-area-inset-top)) 8px 8px 16px; }
  .top h1 { font-size: 18px; line-height: 24px; }
  .top-search { display: inline-grid; }
  #view { padding: 12px 12px calc(var(--tabs-h) + 28px + env(safe-area-inset-bottom)); }
  .tabs {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 6;
    background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
  }
  .tabs a, .tabs button {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; height: var(--tabs-h);
    border: 0; background: none; color: var(--muted); text-decoration: none; font-size: 12px; padding: 0;
  }
  .tabs .on { color: var(--brand); font-weight: 500; }
}
/* На самых узких телефонах пять подписей нижнего меню не помещаются в 12px */
@media (max-width: 340px) { .tabs a, .tabs button { font-size: 11px; } }

/* ---------- панели, строки ---------- */

.bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 16px; }
.bar .sel, .bar input[type=search], .bar input[type=date] { width: auto; min-width: 0; }
.bar input[type=search] { flex: 1 1 180px; max-width: 320px; }
.date-title { font-size: 18px; font-weight: 500; }
.stepper { display: flex; align-items: center; gap: 2px; }

.panel { background: var(--surface); border: 1px solid var(--edge); border-radius: var(--r-panel); padding: 16px; margin-bottom: 16px; }
.panel.flush { padding: 4px 0; }
.panel > h3, .panel-head > h3, .column > h3, .sub > h3 { font-size: 15px; font-weight: 500; margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.panel.alert > h3 { color: var(--red); }
.count { font-size: 12px; font-weight: 400; color: var(--muted); font-variant-numeric: tabular-nums; }
.panel .rows { margin: 0 -16px -8px; }
.panel.flush .rows, .rows.panel.flush { margin: 0; }
.rows.panel.flush { overflow: hidden; }

.row {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--line-soft);
  cursor: pointer; position: relative;
}
.rows > .row:first-child { border-top: 0; }
.row:hover { background: var(--raised); }
.row:focus-visible { outline-offset: -2px; }
.row-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.row-main strong { font-weight: 500; overflow-wrap: anywhere; }
.meta { display: flex; flex-wrap: wrap; gap: 2px 12px; font-size: 13px; color: var(--muted); min-width: 0; }
/* Длинный адрес без пробелов переносится, а не выводит страницу за экран */
.meta > span { min-width: 0; overflow-wrap: anywhere; }
.late-text { color: var(--red); font-weight: 500; }
.row.task.pr-high::before, .row.task.late::before { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 4px; border-radius: 0 4px 3px 0; background: var(--amber); }
.row.task.late::before { background: var(--red); }
.row.visit time { font-weight: 500; font-variant-numeric: tabular-nums; display: flex; flex-direction: column; line-height: 1.2; min-width: 44px; }
.row.visit time small { color: var(--muted); font-weight: 400; }
.row.visit.st-no_show strong, .row.visit.st-cancelled strong { text-decoration: line-through; color: var(--muted); }
.row.inactive { opacity: .6; }
.order-no { font-weight: 500; color: var(--muted); min-width: 44px; font-variant-numeric: tabular-nums; }
.row .sum { font-weight: 500; }
@media (max-width: 760px) {
  .row { flex-wrap: wrap; gap: 6px 8px; padding: 12px 12px; }
  .row-main { flex-basis: calc(100% - 60px); }
  .row.task .row-main, .row.order .row-main { flex-basis: 100%; }
  .row.order .order-no { min-width: 0; }
  .panel { padding: 16px 12px; }
  .panel .rows { margin: 0 -12px -6px; }
}

.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; white-space: nowrap; max-width: 100%; min-width: 0; }
/* Длинное имя обрезается многоточием и не выталкивает соседние элементы за край экрана */
.chip-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.chip.none { color: var(--muted); }
.dot { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; color: #fff; font-size: 12px; font-weight: 600; flex: none; }
.dot.big { width: 36px; height: 36px; font-size: 13px; }

.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; color: var(--text-2); white-space: nowrap; }
.pill::before { content: ""; flex: none; box-sizing: border-box; width: 8px; height: 8px; border-radius: 50%; border: 2px solid var(--muted); }
.pill.ts-in_progress, .pill.os-in_progress, .pill.vs-arrived { color: var(--brand-deep); }
.pill.ts-in_progress::before, .pill.os-in_progress::before, .pill.vs-arrived::before { border: 0; background: var(--brand); }
.pill.ts-done, .pill.os-done, .pill.os-issued, .pill.vs-done { color: var(--green); }
.pill.ts-done::before, .pill.os-done::before, .pill.os-issued::before, .pill.vs-done::before {
  width: 6px; height: 10px; margin: 0 2px 2px; border: solid var(--green); border-width: 0 2px 2px 0; border-radius: 0; transform: rotate(45deg);
}
.pill.os-waiting { color: var(--amber-ink); }
.pill.os-waiting::before { border: 0; border-radius: 2px; background: var(--amber); }
.pill.late, .pill.vs-no_show, .pill.ts-cancelled, .pill.os-cancelled, .pill.vs-cancelled { color: var(--red-ink); }
.pill.late::before, .pill.vs-no_show::before, .pill.ts-cancelled::before, .pill.os-cancelled::before, .pill.vs-cancelled::before {
  width: 10px; height: 2px; border: 0; border-radius: 1px; background: var(--red-ink);
}

.empty { padding: 24px 16px; color: var(--muted); text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.empty.error { color: var(--red); }

/* ---------- шкала загрузки: деление = час ---------- */

.gauge { display: inline-flex; gap: 2px; }
.gauge .seg { display: block; position: relative; background: var(--line); border-radius: 2px; overflow: hidden; }
.gauge .seg b { display: block; position: absolute; left: 0; bottom: 0; background: var(--brand); }
.gauge.h .seg { width: 16px; height: 12px; }
.gauge.h .seg b { height: 100%; }
.gauge.v { flex-direction: column-reverse; width: 100%; max-width: 30px; }
.gauge.v .seg { width: 100%; height: 8px; }
.gauge.v .seg b { width: 100%; }
.gauge.high .seg b { background: var(--amber); }
.gauge.over .seg b, .gauge .seg.over b { background: var(--red); }
.gauge .seg.off { background: transparent; border: 1px dashed var(--line); }
.gauge.h .seg.off { width: 40px; }

.load-today { display: flex; flex-direction: column; }
.load-line { display: grid; grid-template-columns: minmax(120px, 220px) 1fr auto; align-items: center; gap: 12px; padding: 8px 0; color: inherit; text-decoration: none; }
.load-line + .load-line { border-top: 1px solid var(--line-soft); }
@media (max-width: 480px) {
  .load-line { grid-template-columns: 1fr auto; }
  .load-line .gauge { grid-column: 1 / -1; grid-row: 2; }
  .load-line .gauge.h .seg { flex: 1; width: auto; max-width: 28px; }
}

.load-cards { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(min(330px, 100%), 1fr)); }
.load-card { margin: 0; }
.load-card header { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.load-card header > div:first-child { min-width: 0; }
.load-card .pos { display: block; color: var(--muted); padding-left: 32px; overflow-wrap: anywhere; }
.week-sum { flex: none; text-align: right; font-size: 13px; color: var(--muted); }
.week-sum b { font-size: 18px; font-weight: 500; color: var(--ink); }
.week-sum.high b { color: var(--amber-ink); }
.week-sum.over b { color: var(--red); }
.week-sum small { display: block; }
.load-week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; align-items: end; }
.load-cell {
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px; padding: 8px 2px 6px;
  border: 0; border-radius: var(--r-control); background: none; min-height: 132px;
}
.load-cell:hover { background: var(--bg); }
.load-cell.today { background: var(--brand-soft); }
.load-cell b { font-size: 13px; font-variant-numeric: tabular-nums; }
.load-cell b.over { color: var(--red); }
.load-cell small { font-size: 12px; color: var(--muted); }
.load-cell.dayoff small { opacity: .7; }
.load-card footer { margin-top: 8px; padding-top: 12px; border-top: 1px solid var(--line-soft); }
.day-sum { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; font-weight: 500; }

.legend { font-size: 13px; color: var(--muted); display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; margin: 0 0 12px; }
.lg { display: inline-block; width: 14px; height: 10px; border-radius: 2px; margin-left: 8px; }
.lg:first-child { margin-left: 0; }
.lg.seg-ok { background: var(--brand); } .lg.seg-high { background: var(--amber); } .lg.seg-over { background: var(--red); }
.lg.task { background: var(--surface); border: 1px solid var(--line); } .lg.visit { background: var(--amber-soft); border: 1px solid var(--amber); }

/* ---------- доска задач ---------- */

.board { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; align-items: start; }
.column { background: var(--surface); border: 1px solid var(--edge); border-radius: var(--r-panel); padding: 16px 0 4px; }
.column > h3 { padding: 0 16px; }
.seg-tabs { display: none; }
.seg-switch, .seg-tabs { background: var(--raised); border-radius: var(--r-control); padding: 4px; gap: 2px; }
.seg-switch { display: inline-flex; flex-wrap: wrap; max-width: 100%; }
.seg-switch button, .seg-tabs button { border: 0; background: none; border-radius: 4px; padding: 4px 12px; font-size: 13px; line-height: 20px; color: var(--text-2); white-space: nowrap; }
.seg-switch button.on, .seg-tabs button.on { background: var(--surface); color: var(--ink); font-weight: 500; box-shadow: 0 1px 2px rgba(0, 0, 0, .05); }
@media (max-width: 900px) {
  .board { grid-template-columns: 1fr; }
  .column { display: none; }
  .column.on { display: block; }
  .column > h3 { display: none; }
  .seg-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin-bottom: 12px; }
  .seg-tabs button { min-width: 0; padding: 4px; white-space: normal; overflow-wrap: anywhere; }
}

/* ---------- календарь ---------- */

.cal { background: var(--surface); border: 1px solid var(--edge); border-radius: var(--r-panel); overflow-x: auto; }
.cal-row { display: grid; grid-template-columns: 50px repeat(var(--days), minmax(0, 1fr)); min-width: calc(50px + var(--days) * 104px); }
.cal.one .cal-row { min-width: 0; }
.cal-head { border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); z-index: 2; }
.day-head { border: 0; background: none; padding: 8px 4px; display: flex; align-items: baseline; justify-content: center; gap: 6px; border-left: 1px solid var(--line-soft); }
.day-head small { color: var(--muted); font-size: 13px; }
.day-head b { font-size: 18px; font-weight: 500; }
.day-head.today b { background: var(--brand); color: #fff; border-radius: 50%; min-width: 28px; height: 28px; display: inline-grid; place-items: center; font-size: 15px; }
.cal-due { border-bottom: 1px solid var(--line); }
.gutter { font-size: 12px; color: var(--muted); text-align: right; padding-right: 6px; }
.cal-due .gutter { padding-top: 8px; }
.due-cell { border-left: 1px solid var(--line-soft); padding: 4px 4px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.due-chip, .ev {
  border: 1px solid var(--line); border-left: 4px solid var(--c, var(--muted)); background: var(--surface); border-radius: 6px;
  font-size: 12px; line-height: 1.25; text-align: left; padding: 2px 6px; overflow: hidden; color: var(--ink);
}
.due-chip { white-space: nowrap; text-overflow: ellipsis; }
.due-chip.late, .ev.late { border-color: var(--red); border-left-color: var(--c); background: var(--red-soft); }
.due-chip.done, .ev.done { opacity: .55; text-decoration: line-through; }
.cal-body .gutter .hr { position: relative; }
.cal-body .gutter .hr span { position: absolute; top: -8px; right: 6px; }
.cal-body .gutter .hr:first-child span { top: 0; }
.day-col {
  position: relative; border-left: 1px solid var(--line-soft); cursor: cell;
  background-image: linear-gradient(to bottom, var(--line-soft) 1px, transparent 1px); background-size: 100% 48px;
}
.day-col.today { background-color: var(--bg); }
.ev { position: absolute; display: flex; flex-direction: column; cursor: pointer; z-index: 1; }
.ev small { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.ev span { overflow: hidden; hyphens: auto; font-weight: 500; }
.ev.visit { background: var(--amber-soft); border-color: var(--line); border-left-color: var(--c); }
.ev.visit.st-done, .ev.visit.st-no_show { opacity: .6; }
.now { position: absolute; left: 0; right: 0; height: 2px; background: var(--red); z-index: 2; pointer-events: none; }
.now::before { content: ""; position: absolute; left: -4px; top: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--red); }

.week-strip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-bottom: 8px; }
.week-strip button { border: 0; background: var(--surface); border-radius: var(--r-control); padding: 6px 0; display: flex; flex-direction: column; align-items: center; }
.week-strip small { font-size: 12px; color: var(--muted); }
.week-strip b { font-weight: 500; }
.week-strip .today b { color: var(--brand); }
.week-strip .on { background: var(--brand); color: #fff; }
.week-strip .on small, .week-strip .on b { color: #fff; }

.month { background: var(--surface); border: 1px solid var(--edge); border-radius: var(--r-panel); overflow: hidden; }
.m-head { display: grid; grid-template-columns: repeat(7, 1fr); font-size: 12px; color: var(--muted); text-align: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.m-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.m-cell { border: 0; border-right: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); background: none; min-height: 104px; padding: 6px; text-align: left; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.m-cell:nth-child(7n) { border-right: 0; }
.m-cell:hover { background: var(--raised); }
.m-cell.other b { color: var(--muted); }
.m-cell.today b { background: var(--brand); color: #fff; border-radius: 50%; width: 26px; height: 26px; display: inline-grid; place-items: center; }
.m-items { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.m-chip { display: flex; align-items: center; gap: 4px; font-size: 12px; min-width: 0; }
.m-chip i { width: 7px; height: 7px; border-radius: 50%; background: var(--c); flex: none; }
.m-chip.visit i { border-radius: 2px; }
.m-chip em { font-style: normal; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-more { font-size: 12px; color: var(--muted); }
@media (max-width: 760px) {
  .cal-bar .date-title { order: -1; flex-basis: 100%; }
  .cal.one .cal-head { display: none; }
  .seg-switch button { padding: 6px 8px; }
  .cal-bar .stepper .btn { padding: 0 8px; }
  .m-cell { min-height: 56px; padding: 4px; align-items: center; }
  .m-items { flex-direction: row; flex-wrap: wrap; justify-content: center; gap: 4px; }
  .m-chip em, .m-more { display: none; }
}

/* ---------- отчёты ---------- */

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 16px; margin-bottom: 16px; }
.stat { background: var(--surface); border: 1px solid var(--edge); border-radius: var(--r-panel); padding: 16px 16px; display: flex; flex-direction: column; }
.stat b { font-size: 28px; font-weight: 500; font-variant-numeric: tabular-nums; }
.stat span { font-size: 13px; color: var(--muted); }
.two-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.table-wrap { overflow-x: auto; margin: 0 -16px; padding: 0 16px; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; font-weight: 500; color: var(--muted); font-size: 12px; padding: 6px 12px 6px 0; border-bottom: 1px solid var(--line); vertical-align: bottom; }
.table td { padding: 8px 12px 8px 0; border-bottom: 1px solid var(--line-soft); }
.table tr:last-child td { border-bottom: 0; }
.table td.num, .table th:not(:first-child) { text-align: right; }
.table th.wide-col { text-align: left; min-width: 160px; }
.bar-cell { display: flex; align-items: center; gap: 8px; }
.bar-cell i { height: 10px; border-radius: 2px; background: var(--brand); min-width: 2px; max-width: calc(100% - 30px); }
.bar-cell b { font-variant-numeric: tabular-nums; }

/* ---------- диалоги ---------- */

dialog.dlg { border: 0; padding: 0; border-radius: 16px; width: min(580px, calc(100vw - 32px)); max-height: min(92dvh, 900px); color: var(--ink); background: var(--surface); overflow: hidden; }
dialog.dlg.wide { width: min(880px, calc(100vw - 32px)); }
dialog.dlg::backdrop { background: rgba(6, 26, 58, .45); }
.dlg-box { display: flex; flex-direction: column; min-width: 0; max-height: min(92dvh, 900px); overflow: hidden; }
.dlg-box > header { display: flex; flex: none; align-items: center; gap: 8px; padding: 12px 12px 8px 20px; }
.dlg-box > header h2 { font-size: 18px; font-weight: 500; flex: 1; overflow-wrap: anywhere; }
.dlg-body { padding: 6px 20px 12px; min-width: 0; min-height: 0; overflow-x: hidden; overflow-y: auto; overscroll-behavior: none; touch-action: pan-y pinch-zoom; flex: 1 1 auto; }
.dlg-body input, .dlg-body select, .dlg-body textarea { min-width: 0; max-width: 100%; }
/* Safari задаёт собственную ширину внутреннему редактору даты. Даём дате
   отдельную строку, чтобы она не пересекалась с длительностью и соседними полями. */
.dlg-body .field:has(> input[type="datetime-local"]) { grid-column: 1 / -1; }
.dlg-body input[type="datetime-local"] {
  display: block; appearance: none; -webkit-appearance: none;
  min-inline-size: 0; inline-size: 100%; max-inline-size: 100%;
}
.dlg-body input[type="datetime-local"]::-webkit-date-and-time-value { min-width: 0; text-align: left; }
.dlg-body input[type="datetime-local"]::-webkit-datetime-edit { min-width: 0; padding: 0; }
.dlg-body .grid2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.dlg-body .grid3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 760px) { .dlg-body .grid3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 480px) { .dlg-body .grid2, .dlg-body .grid3 { grid-template-columns: minmax(0, 1fr); } }
.dlg-box > .form-error { margin: 0 20px 8px; }
.dlg-box > footer { display: flex; flex: none; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--line-soft); }
.dlg-box > footer:empty { display: none; }
.confirm-text { font-size: 15px; padding: 6px 0 12px; }
dialog.side-panel { margin: 0 0 0 auto; height: 100dvh; max-height: 100dvh; border-radius: 0; width: min(420px, 100vw); }
dialog.side-panel .dlg-box { max-height: 100dvh; height: 100%; }
@media (max-width: 760px) {
  dialog.dlg, dialog.dlg.wide, dialog.side-panel {
    width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: 16px 16px 0 0; max-height: 94dvh; height: fit-content;
  }
  .dlg-box, dialog.side-panel .dlg-box { max-height: 94dvh; }
  .dlg-box > header { padding-left: 16px; }
  .dlg-body { padding: 6px 16px 12px; }
  .dlg-box > footer { padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); }
  .dlg-box > footer .btn.primary { flex: 1 1 auto; }
}

.view-title { font-size: 18px; font-weight: 500; margin-bottom: 6px; overflow-wrap: anywhere; }
.view-text { white-space: pre-wrap; margin-bottom: 12px; overflow-wrap: anywhere; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; margin: 8px 0; }
.facts dt { color: var(--muted); font-size: 13px; padding-top: 2px; }
.facts dd { margin: 0; overflow-wrap: anywhere; }

.sub { border-top: 1px solid var(--line-soft); padding: 16px 0 12px; }
.items-head, .item-row { display: grid; grid-template-columns: minmax(0, 1fr) 84px 110px 40px; gap: 6px; align-items: center; }
.items-head { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.item-row { margin-bottom: 6px; }
/* Крупная сумма на узком экране уходит на свою строку, а не за край карточки */
.items-foot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; margin-top: 8px; }
.total { margin-left: auto; font-size: 15px; font-variant-numeric: tabular-nums; }
@media (max-width: 560px) {
  .items-head { display: none; }
  .item-row { grid-template-columns: 1fr 1fr 40px; padding-bottom: 8px; border-bottom: 1px solid var(--line-soft); }
  .item-row [name=it_title] { grid-column: 1 / -1; }
}
.mini-task { display: flex; align-items: center; gap: 8px; width: 100%; border: 0; border-top: 1px solid var(--line-soft); background: none; padding: 8px 0; text-align: left; }
.mini-task:first-child { border-top: 0; }
.mini-task:hover { background: var(--raised); }
[data-tasks] { margin-bottom: 8px; }
.dlg-body .rows { margin: 0; }

.checks, .swatches { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.checks legend, .swatches legend { font-size: 13px; color: var(--muted); margin-bottom: 4px; padding: 0; }
.checks label { position: relative; }
.checks input, .swatches input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.checks span { display: grid; place-items: center; width: 40px; height: 36px; border: 1px solid var(--line); border-radius: var(--r-control); font-size: 13px; }
.checks input:checked + span { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 500; }
.checks input:focus-visible + span, .swatches input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }
.swatches label { position: relative; }
.swatches span { display: block; width: 32px; height: 32px; border-radius: 50%; border: 4px solid var(--surface); box-shadow: 0 0 0 1px var(--line); }
.swatches input:checked + span { box-shadow: 0 0 0 2px var(--ink); }
.check-line { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }

.menu { display: flex; flex-direction: column; }
.menu a { display: flex; align-items: center; gap: 12px; padding: 16px 4px; color: var(--ink); text-decoration: none; border-top: 1px solid var(--line-soft); font-size: 15px; }
.menu a:first-child { border-top: 0; }

.notes { display: flex; flex-direction: column; margin: 0 -20px; }
.note { display: flex; flex-direction: column; gap: 2px; text-align: left; border: 0; border-top: 1px solid var(--line-soft); background: none; padding: 12px 20px 12px 28px; position: relative; }
.note:first-child { border-top: 0; }
.note:hover { background: var(--raised); }
.note.new::before { content: ""; position: absolute; left: 10px; top: 18px; width: 8px; height: 8px; border-radius: 50%; background: var(--brand); }
.note strong { font-weight: 500; }
.note span { color: var(--ink); overflow-wrap: anywhere; }
.note small { color: var(--muted); font-size: 12px; }

.me { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; min-width: 0; }
.me .pill { flex: none; }
.me .chip { font-size: 18px; font-weight: 500; }
.pwd, .city { max-width: 360px; }
.pwd .form-error { margin-bottom: 12px; }
.pwd .hint, .city .hint { margin-top: 8px; }
.city { margin-top: 16px; }
.city .field { margin-bottom: 12px; }

/* ---------- всплывающие сообщения ---------- */

#toasts { border: 0; padding: 0; margin: 0; background: transparent; overflow: visible; inset: auto; top: auto; right: auto;
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 20px; z-index: 2147483000; display: flex; flex-direction: column; gap: 8px; align-items: center; width: min(440px, calc(100vw - 24px)); pointer-events: none; }
@media (max-width: 760px) { #toasts { bottom: calc(var(--tabs-h) + 12px + env(safe-area-inset-bottom)); } }
.toast { pointer-events: auto; background: var(--ink); color: #fff; border: 0; border-radius: 8px; padding: 12px 16px; font-size: 13px; text-align: left; max-width: 100%; box-shadow: 0 8px 24px rgba(0, 0, 0, .06); }
.toast.error { background: var(--red); }
.toast.note { border-left: 4px solid var(--amber); }

/* ---------- печать заказ-наряда ---------- */

#print-root { display: none; }
@media print {
  @page { margin: 14mm; }
  html, body { background: #fff; height: auto; }
  #app, #toasts, dialog, dialog::backdrop { display: none !important; }
  #print-root { display: block; font-size: 12pt; color: #000; }
  .sheet-head { display: flex; justify-content: space-between; align-items: baseline; border-bottom: 2px solid #000; padding-bottom: 6pt; margin-bottom: 10pt; font-size: 14pt; }
  .sheet table { width: 100%; border-collapse: collapse; margin-bottom: 10pt; }
  .sheet-facts th { text-align: left; font-weight: 400; color: #444; width: 14%; padding: 3pt 0; }
  .sheet-facts td { width: 36%; padding: 3pt 0; font-weight: 500; }
  .sheet-items th, .sheet-items td { border: 1px solid #000; padding: 4pt 6pt; text-align: left; }
  .sheet-items td:nth-child(n+3), .sheet-items th:nth-child(n+3) { text-align: right; white-space: nowrap; }
  .sheet-items tfoot td { font-weight: 600; }
  .sheet-sign { display: flex; justify-content: space-between; margin-top: 28pt; }
}

@media (prefers-reduced-motion: no-preference) {
  .toast { animation: rise 300ms var(--ease); }
  @keyframes rise { from { opacity: 0; transform: translateY(8px); } }
}

/* ---------- клиент из базы, каталог работ ---------- */

.client-box { background: var(--bg); border-radius: var(--r-control); padding: 12px 12px; margin-bottom: 16px; display: flex; flex-direction: column; gap: 8px; }
.client-box .check-line { margin: 0; }
.client-linked { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; font-weight: 500; }
.client-find { display: flex; flex-direction: column; gap: 8px; }
.client-results:not(:empty) { background: var(--surface); border-radius: var(--r-control); padding: 0 12px; }
.client-cars { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.client-cars:empty { display: none; }
.sel.small { width: auto; max-width: 260px; }
.sel.small .sel-btn { min-height: 32px; padding: 4px 8px 4px 10px; font-size: 13px; }
.items-foot .btn-line { align-items: center; }
.sub > h3 .hint { font-weight: 400; }
.row.service .sum { min-width: 90px; text-align: right; }

.field.span2 { grid-column: span 2; }
@media (max-width: 480px) { .field.span2 { grid-column: auto; } }

/* ---------- кнопка «Позвонить» ---------- */

.phone-line { display: flex; gap: 6px; }
.phone-line input { flex: 1 1 auto; min-width: 0; }
.phone-fact { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }

/* ---------- движение ---------- */

@media (prefers-reduced-motion: no-preference) {
  .btn, .icon-btn, .row, .side nav a, .side-user, .side-search, .sel-btn, .sel-opt, .tabs a, .tabs button, .mini-task, .note, .load-cell, .m-cell, .seg-switch button, .seg-tabs button, .chip-btn, .att, .found, .lane-ev {
    transition: background-color 150ms var(--ease), border-color 150ms var(--ease), color 150ms var(--ease), transform 150ms var(--ease);
  }
  .btn:active:not(:disabled) { transform: scale(.98); }
}

/* В колонках доски строка задачи складывается: название занимает всю ширину, исполнитель и кнопка — под ним */
.column .row { flex-wrap: wrap; gap: 8px 12px; }
.column .row-main { flex-basis: 100%; }
.row-main { min-width: 12ch; }

/* ---------- выпадающие списки ---------- */

.sel { position: relative; display: inline-flex; width: 100%; min-width: 0; vertical-align: middle; }
.sel-native { position: absolute; inset: 0; width: 100%; height: 100%; min-height: 0; padding: 0; margin: 0; border: 0; opacity: 0; pointer-events: none; }
.sel-btn {
  display: flex; align-items: center; gap: 8px; width: 100%; min-width: 0; min-height: 40px; padding: 8px 10px 8px 12px;
  border: 1px solid var(--line); border-radius: var(--r-control); background: var(--surface); color: var(--ink); text-align: left;
  font-size: 15px; line-height: 20px;
}
@media (max-width: 760px) { .sel-btn, .sel-opt { font-size: 16px; } }
.sel-btn:hover:not(:disabled) { border-color: rgba(11, 31, 63, .32); }
.sel-btn:focus-visible, .sel-btn.open { outline: 2px solid var(--brand); outline-offset: -1px; border-color: var(--brand); }
.sel-btn:disabled { cursor: default; }
.sel-btn:disabled .sel-chev { visibility: hidden; }
.sel-val { flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sel-val.placeholder { color: var(--muted); }
.sel-chev { flex: none; color: var(--muted); }
.sel-btn.open .sel-chev { transform: rotate(180deg); color: var(--brand); }
.sel-dot { flex: none; width: 10px; height: 10px; border-radius: 50%; }

.sel-pop {
  position: fixed; inset: auto; margin: 0; z-index: 50; box-sizing: border-box; padding: 4px; overflow-y: auto; overscroll-behavior: contain;
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink);
  box-shadow: 0 12px 32px rgba(6, 26, 58, .16), 0 2px 6px rgba(6, 26, 58, .08);
  font-size: 15px; line-height: 20px;
}
.sel-opt { display: flex; align-items: center; gap: 8px; min-height: 36px; padding: 6px 8px 6px 10px; border-radius: 8px; cursor: pointer; user-select: none; }
@media (max-width: 760px) { .sel-opt { min-height: 44px; } }
.sel-opt.active { background: var(--raised); }
.sel-opt[aria-selected=true] { color: var(--brand-deep); font-weight: 500; }
.sel-opt.placeholder { color: var(--muted); }
.sel-opt[aria-disabled=true] { opacity: .5; cursor: default; }
.sel-text { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.sel-check { flex: none; color: var(--brand); visibility: hidden; }
.sel-opt[aria-selected=true] .sel-check { visibility: visible; }
@media (prefers-reduced-motion: no-preference) {
  .sel-chev { transition: transform 150ms var(--ease); }
  .sel-pop { animation: sel-in 120ms var(--ease); transform-origin: top; }
  .sel-pop.up { transform-origin: bottom; }
  @keyframes sel-in { from { opacity: 0; transform: scaleY(.96); } }
}

/* ---------- календарь на устройстве ---------- */

.cal-sync .sel { max-width: 360px; }
.cal-sync .btn-line { margin-top: 12px; align-items: center; }
.feeds { margin: 12px 0 0; border-top: 1px solid var(--line-soft); }
.feed { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line-soft); }
.feed-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.feed-link { display: flex; gap: 6px; margin-bottom: 12px; }
.feed-link input { flex: 1 1 auto; min-width: 0; font-size: 13px; }
.steps { margin: 0 0 12px; padding-left: 20px; max-width: 64ch; }
.steps li { margin-bottom: 4px; }


/* Фотоотчёт в карточке выезда */
.visit-photos { margin-top: 20px; border-top: 1px solid var(--line-soft); padding-top: 16px; }
.visit-photos h3 { margin: 0 0 8px; }
.visit-photos input[type=file] { width: 100%; min-width: 0; white-space: normal; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 12px; margin: 12px 0; }
.visit-photo { margin: 0; min-width: 0; }
.visit-photo a { display: block; border-radius: 10px; overflow: hidden; }
.visit-photo img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; background: var(--raised); }
.visit-photo button { margin-top: 6px; }


/* ---------- кнопки строки списка: позвонить, навигатор ---------- */

.row-actions { display: flex; gap: 6px; flex: none; }
@media (min-width: 761px) {
  /* На широком экране — значки без подписи (подпись остаётся в aria-label и подсказке) */
  .row-actions .btn { width: 40px; min-height: 40px; padding: 0; }
  .row-actions .btn span { display: none; }
}
@media (min-width: 1100px) {
  /* Мастер, статус и кнопки — в общих колонках у всех строк выездов */
  .row.visit > .chip { flex: 0 0 120px; }
  .row.visit > .pill { flex: 0 0 152px; }
  .row.visit > .row-actions { flex: 0 0 88px; justify-content: flex-end; }
}
@media (min-width: 761px) and (max-width: 1099px) {
  /* Между телефоном и широким экраном колонкам тесно: мастер, статус и кнопки переходят на вторую строку */
  .row.visit { flex-wrap: wrap; row-gap: 8px; }
  .row.visit > .row-main { flex: 1 1 240px; }
  .row.visit > .row-actions:empty { display: none; }
}
@media (max-width: 760px) {
  /* На телефоне — отдельная строка с подписями; если две кнопки не помещаются рядом, вторая уходит ниже */
  .row-actions { flex: 1 0 100%; flex-wrap: wrap; }
  .row-actions:empty { display: none; }
  .row-actions .btn { flex: 1 1 160px; min-width: 0; min-height: 44px; padding: 0 8px; }
  .btn.small, .seg-switch button, .seg-tabs button { min-height: 40px; }
}

/* ---------- кнопки-фильтры ---------- */

.chips { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
.chip-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); color: var(--text-2); font-size: 13px; white-space: nowrap; }
.chip-btn:hover { border-color: rgba(11, 31, 63, .32); color: var(--ink); }
.chip-btn.on { background: var(--ink); border-color: var(--ink); color: #fff; font-weight: 500; }
.bar .chips { flex: 1 1 auto; }
@media (max-width: 760px) {
  .chip-btn { min-height: 40px; }
  /* Длинный ряд фильтров прокручивается внутри себя, страница вбок не едет */
  .chips.scroll { flex: 1 0 100%; flex-wrap: nowrap; overflow-x: auto; margin: 0 -12px; padding: 0 12px 4px; scrollbar-width: none; }
  .chips.scroll::-webkit-scrollbar { display: none; }
}
.panel-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-bottom: 8px; }
.panel-head > h3 { flex: 1 1 auto; margin-bottom: 0; }
.panel-head .legend { margin: 0; }
.day-title { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.bar .day-title { flex: 1 1 200px; }
.day-title .date-title { font-weight: 600; }

/* ---------- «Сегодня»: день по мастерам ---------- */

.day-panel > .hint { margin-top: 12px; }
/* Лента шире телефона прокручивается внутри панели */
.lanes-scroll { overflow-x: auto; margin: 0 -16px; padding: 0 16px; }
.lanes { display: flex; flex-direction: column; gap: 8px; min-width: 600px; }
.lane { display: grid; grid-template-columns: 176px minmax(0, 1fr); gap: 12px; align-items: center; }
.lane-who { display: flex; flex-direction: column; gap: 2px; min-width: 0; color: inherit; text-decoration: none; }
.lane-sum { padding-left: 30px; font-size: 12px; color: var(--muted); }
.lane-sum.high { color: var(--amber-ink); }
.lane-sum.over { color: var(--red-ink); font-weight: 500; }
.lane-hours { display: grid; grid-template-columns: repeat(var(--hours), minmax(0, 1fr)); font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.lane-hours span { padding-left: 4px; white-space: nowrap; overflow: hidden; }
.lane-tracks { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.lane-track {
  position: relative; height: 48px; border-radius: var(--r-control); cursor: cell; background-color: var(--bg);
  background-image: linear-gradient(to right, var(--line-soft) 1px, transparent 1px); background-size: calc(100% / var(--hours)) 100%;
}
.lane-track.tasks { height: 28px; cursor: default; }
.lane-ev {
  position: absolute; top: 4px; bottom: 4px; display: flex; flex-direction: column; justify-content: center; min-width: 0; padding: 0 8px; overflow: hidden;
  border: 1px solid #9CC4F2; border-radius: 8px; background: var(--brand-soft); color: var(--brand-deep); text-align: left; font-size: 12px; line-height: 16px;
}
.lane-ev b { font-size: 13px; font-weight: 500; }
.lane-ev b, .lane-ev small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lane-ev:hover { z-index: 1; border-color: var(--brand); }
.lane-ev.st-arrived { background: var(--brand); border-color: var(--brand); color: #fff; }
.lane-ev.st-done { background: #E9EDF3; border-color: #C9D2E0; color: var(--text-2); }
.lane-ev.st-no_show { background: var(--red-soft); border-color: var(--red-ink); color: var(--red-ink); text-decoration: line-through; }
.lane-ev.task { background: var(--surface); border: 1px dashed var(--muted); color: var(--ink); }
.lane-ev.task.late { border-color: var(--red-ink); color: var(--red-ink); }
.lane-ev.task.st-done { color: var(--muted); text-decoration: line-through; }
.lane-now { position: absolute; top: -2px; bottom: -2px; width: 2px; margin-left: -1px; border-radius: 1px; background: var(--red); pointer-events: none; z-index: 2; }
.lg-item { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.lg-item .lg { margin-left: 0; }
.panel-head .legend { gap: 4px 12px; }
.lg.ev-done { background: #E9EDF3; border: 1px solid #C9D2E0; }
.lg.ev-arrived { background: var(--brand); }
.lg.ev-booked { background: var(--brand-soft); border: 1px solid #9CC4F2; }
.lg.ev-task { background: var(--surface); border: 1px dashed var(--muted); }
@media (max-width: 760px) {
  .lanes-scroll { margin: 0 -12px; padding: 0 12px; }
  .lane { grid-template-columns: 104px minmax(0, 1fr); gap: 8px; }
  .lane-sum { padding-left: 0; }
  .lane-last { display: none; } /* в узкой колонке — только имя, без обрезанной фамилии */
  .lane-track.tasks { height: 48px; }
}

/* ---------- «Сегодня»: требует внимания ---------- */

.count-badge { padding: 0 8px; border-radius: 10px; background: var(--red-soft); color: var(--red-ink); font-size: 12px; font-weight: 500; line-height: 20px; font-variant-numeric: tabular-nums; }
/* Пункты стоят в ряд, пока хватает ширины, и складываются в столбец на узком экране */
.att-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr)); gap: 4px 16px; margin: 0 -8px -8px; }
.att { display: flex; gap: 12px; min-width: 0; padding: 8px; border: 0; border-radius: var(--r-control); background: none; color: inherit; text-align: left; text-decoration: none; }
.att:hover { background: var(--raised); }
.att:focus-visible { outline-offset: -2px; }
/* Срочное — красный круг, остальное — жёлтый квадрат: различаются и формой */
.att-mark { flex: none; width: 8px; height: 8px; margin-top: 6px; border-radius: 50%; background: var(--red); }
.att.warn .att-mark { border-radius: 2px; background: var(--amber); }
.att-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.att-text strong { font-weight: 500; }
.att-text span { font-size: 13px; color: var(--text-2); }
.att-text strong, .att-text span { overflow-wrap: anywhere; }

/* ---------- «Сегодня»: текущий выезд мастера ---------- */

.hero { display: flex; flex-direction: column; gap: 4px; margin-bottom: 16px; padding: 20px; border-radius: 20px; background: var(--brand); color: #fff; }
.hero-when { font-size: 13px; font-weight: 500; }
.hero h2 { font-size: 22px; line-height: 28px; font-weight: 600; }
.hero h2, .hero p { overflow-wrap: anywhere; }
/* Две кнопки рядом, только если обе подписи помещаются целиком; иначе — друг под другом */
.hero-links { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr)); gap: 8px; margin-top: 12px; }
.hero-links .btn { min-width: 0; min-height: 48px; background: transparent; border-color: #fff; color: #fff; }
.hero-links .btn:hover { background: rgba(255, 255, 255, .12); border-color: #fff; }
.btn.hero-main { margin-top: 8px; min-height: 52px; background: #fff; border-color: #fff; color: var(--brand-deep); font-size: 16px; font-weight: 600; }
.hero-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 16px; margin-top: 4px; font-size: 13px; }
.hero-note { display: inline-flex; align-items: center; gap: 6px; }
.hero .link { min-height: 44px; color: #fff; }
.hero :focus-visible { outline-color: #fff; }
@media (max-width: 760px) { .hero { padding: 16px; } }

/* ---------- «Заказ-наряды»: список и панель наряда ---------- */

.split { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; }
.split > .panel { margin-bottom: 0; min-width: 0; }
.split.has-preview { grid-template-columns: minmax(320px, 2fr) minmax(0, 3fr); }
.row.order { flex-direction: column; align-items: stretch; gap: 6px; }
.row.order.on { background: var(--brand-soft); }
.order-line { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.order-line strong { font-weight: 500; min-width: 0; overflow-wrap: anywhere; }
.order-line .order-no, .order-line .sum { flex: none; min-width: 0; }
.order-text { font-size: 13px; color: var(--text-2); overflow-wrap: anywhere; }
.row.order .meta { align-items: center; gap: 4px 12px; }
.row.order .row-actions { flex: none; } /* строка наряда — столбец: кнопки не растягиваются по высоте */
/* Панель видна только на широком экране; звонок и навигатор тогда в ней, в строках списка их нет */
@media (min-width: 1180px) { .order-list .row-actions { display: none; } }
@media (min-width: 761px) and (max-width: 1179px) { .row.order .row-actions { align-self: flex-start; } }
.preview { position: sticky; top: 16px; max-height: calc(100dvh - 32px); overflow-y: auto; padding: 20px; }
.preview-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 16px; }
.preview-head h2 { flex: 1 1 auto; font-size: 22px; line-height: 28px; font-weight: 600; }
.steps-bar { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; margin: 0 0 16px; padding: 0; list-style: none; font-size: 12px; color: var(--muted); }
.steps-bar li { min-width: 0; overflow-wrap: anywhere; }
.steps-bar li::before { content: ""; display: block; height: 6px; margin-bottom: 6px; border-radius: 3px; background: var(--edge); }
.steps-bar .is-past { color: var(--text-2); }
.steps-bar .is-past::before, .steps-bar .is-now::before { background: var(--brand); }
.steps-bar .is-now { color: var(--brand-deep); font-weight: 600; }
.preview-facts { display: flex; flex-direction: column; gap: 12px; margin: 0 0 12px; }
/* Кнопки «Позвонить» и «В навигатор» — одной ширины, друг под другом */
.preview-facts > div:not(.pair) { display: grid; grid-template-columns: minmax(0, 1fr) 200px; column-gap: 12px; align-items: center; }
.preview-facts > div:not(.pair) > .btn { grid-column: 2; grid-row: 1 / span 2; }
.preview-facts dt { grid-column: 1; font-size: 12px; color: var(--muted); }
.preview-facts dd { grid-column: 1; margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.preview-facts .pair { display: flex; flex-wrap: wrap; gap: 8px 32px; }
.preview-facts .pair > span { display: flex; flex-direction: column; min-width: 0; }
.table.works td:first-child { overflow-wrap: anywhere; }
.table.works th { white-space: nowrap; }
.preview-total { display: flex; align-items: baseline; justify-content: flex-end; gap: 16px; margin-top: 8px; padding: 12px 16px; border-radius: 12px; background: var(--bg); color: var(--text-2); }
.preview-total b { font-size: 22px; line-height: 28px; font-weight: 600; color: var(--ink); }

/* ---------- общий поиск ---------- */

@media (min-width: 761px) { dialog.search-dlg { margin-top: 10dvh; } }
.search-results { display: flex; flex-direction: column; gap: 12px; min-height: 120px; margin-top: 12px; }
.search-results h3 { margin-bottom: 4px; font-size: 13px; font-weight: 500; color: var(--muted); }
.found { display: flex; flex-direction: column; justify-content: center; gap: 2px; width: 100%; min-height: 44px; padding: 6px 8px; border: 0; border-radius: 8px; background: none; text-align: left; }
.found:hover, .found:focus-visible { background: var(--raised); }
.found strong { font-weight: 500; }
.found span { font-size: 13px; color: var(--text-2); }
.found strong, .found span { overflow-wrap: anywhere; }
