/* Графит и оранжевый, как у фирменного стиля Макса. Тема одна, тёмная. */

@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  src: url("/fonts/manrope-cyrillic-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  src: url("/fonts/manrope-latin-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --bg: #1d1e22;
  --surface: #25262b;
  --surface-2: #2d2e34;
  --surface-3: #36373e;
  --sunken: #202125;
  --line: rgb(255 255 255 / .07);
  --line-2: rgb(255 255 255 / .12);
  --ink: #f3f3f4;
  --ink-2: #b4b6bd;
  --ink-3: #7c7f88;
  --on-accent: #1d130d;
  --accent: #ff7a30;
  --grad: linear-gradient(100deg, #ff513b 0%, #ff7a30 52%, #ffad45 100%);
  --ok: #4cc38a;
  --warn: #f5b544;
  --bad: #f0716a;
  --ease: cubic-bezier(.16, 1, .3, 1);
  /* Шкала движения из базы transitions.dev (Память/скиллы/дизайн/анимация). */
  --duration-stagger: 40ms;
  --duration-quick: 150ms;
  --duration-fast: 250ms;
  --duration-slow: 400ms;
  --duration-very-slow: 500ms;
  --ease-smooth-out: cubic-bezier(.22, 1, .36, 1);
  --ease-bounce: cubic-bezier(.34, 1.36, .64, 1);
  --font: "Manrope", "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(900px 420px at 88% -8%, rgb(255 122 48 / .11), transparent 70%),
    radial-gradient(700px 380px at -5% 0%, rgb(255 255 255 / .035), transparent 70%),
    var(--bg);
  background-attachment: fixed;
  font: 450 14px/1.45 var(--font);
  font-feature-settings: "tnum" 0;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  scrollbar-color: rgb(255 255 255 / .16) transparent;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::selection { background: rgb(255 122 48 / .35); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgb(255 255 255 / .12); border-radius: 999px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: rgb(255 255 255 / .22); }

svg.i {
  width: 16px; height: 16px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
}

/* ---------- загрузка и вход ---------- */
.boot { min-height: 100dvh; display: grid; place-items: center; }
.boot-mark, .brand-mark {
  width: 30px; height: 30px; border-radius: 9px; flex: none;
  background: url("/icon.svg") center / cover;
}
.boot-mark { width: 52px; height: 52px; border-radius: 15px; animation: breathe 1.4s ease-in-out infinite; }
@keyframes breathe { 50% { opacity: .45; transform: scale(.96); } }

.login { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.login-card {
  width: min(390px, 100%);
  background: var(--surface); border: 1px solid var(--line-2); border-radius: 26px;
  box-shadow: 0 40px 90px -40px rgb(255 122 48 / .28), 0 20px 50px -20px rgb(0 0 0 / .6);
  padding: 32px; display: grid; gap: 14px;
}
.login-card .brand-mark { width: 48px; height: 48px; border-radius: 14px; }
.login-card h1 { margin: 8px 0 0; font-size: 26px; font-weight: 700; letter-spacing: -.02em; }
.login-card p { margin: -8px 0 8px; color: var(--ink-3); }
.field { display: grid; gap: 7px; font-weight: 600; font-size: 12.5px; color: var(--ink-2); }
.input {
  height: 44px; padding: 0 14px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface-2); outline: none; font-size: 15px; color: var(--ink);
  transition: border-color .15s, background .15s;
}
.input:focus { border-color: rgb(255 122 48 / .7); background: var(--surface-3); }
.form-error { color: var(--bad); font-size: 13px; }

/* ---------- кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 15px; border-radius: 999px;
  border: 1px solid var(--line-2); background: var(--surface-2); color: var(--ink);
  font-weight: 600; font-size: 13.5px; text-decoration: none; white-space: nowrap;
  transition: background .18s var(--ease), border-color .18s, color .18s, transform .18s var(--ease);
}
.btn:hover { background: var(--surface-3); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: default; transform: none; }
.btn-primary { background: var(--grad) border-box; border-color: transparent; color: var(--on-accent); }
.btn-primary:hover { background: var(--grad) border-box; filter: brightness(1.06); }
.btn-block { width: 100%; height: 46px; font-size: 15px; }
.btn-soft { background: transparent; }
.btn-ghost { border-color: transparent; background: transparent; color: var(--ink-3); }
.btn-ghost:hover { background: var(--surface-2); color: var(--ink-2); }
.btn.is-on {
  color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, transparent);
  background: color-mix(in srgb, var(--ok) 11%, var(--surface-2));
}
.round-btn, .icon-btn {
  position: relative; width: 38px; height: 38px; display: inline-grid; place-items: center; flex: none;
  border-radius: 50%; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink-2);
  transition: background .18s, color .18s, transform .18s var(--ease);
}
.round-btn:hover, .icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.round-btn:active, .icon-btn:active { transform: scale(.94); }
.round-btn svg.i, .icon-btn svg.i { width: 18px; height: 18px; }
.round-btn.is-on { background: var(--ink); color: var(--bg); border-color: transparent; }
.bell-n {
  position: absolute; top: -4px; right: -5px; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 999px; background: var(--grad) border-box; color: var(--on-accent);
  font-size: 10.5px; font-weight: 800; display: grid; place-items: center; font-variant-numeric: tabular-nums;
  box-shadow: 0 0 0 2px var(--bg);
}
.install-btn { height: 38px; padding: 0 14px; color: var(--accent); background: var(--surface); }
.install-btn svg.i { width: 16px; height: 16px; }

/* ---------- каркас ---------- */
.shell { height: 100dvh; display: grid; grid-template-rows: auto minmax(0, 1fr); grid-template-columns: minmax(0, 1fr); }

.topbar {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px;
  padding: 16px 28px 10px; max-width: 1640px; width: 100%; margin: 0 auto;
}
.logo {
  justify-self: start; display: inline-flex; align-items: center; gap: 10px;
  height: 42px; padding: 0 16px 0 6px; border-radius: 999px; border: 1px solid var(--line-2);
  font-size: 15px; letter-spacing: -.01em;
}
.views {
  position: relative; display: flex; padding: 4px; border-radius: 999px;
  background: rgb(255 255 255 / .04); border: 1px solid var(--line);
}
.views-list { position: relative; z-index: 1; display: flex; gap: 2px; }
/* Подложка активного раздела: переезжает между кнопками. */
.view-pill {
  position: absolute; top: 4px; left: 0; height: 34px; width: 0; border-radius: 999px;
  background: var(--ink); box-shadow: 0 6px 18px -8px rgb(0 0 0 / .6);
}
.view-pill.ready { transition: transform var(--duration-slow) var(--ease-smooth-out), width var(--duration-slow) var(--ease-smooth-out); }
.view {
  display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 16px;
  border: 0; border-radius: 999px; background: transparent; color: var(--ink-2);
  font-size: 13.5px; font-weight: 600; white-space: nowrap;
  transition: background .2s var(--ease), color .2s;
}
.view:hover { color: var(--ink); }
.view .n { font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.view.is-active { color: #18191c; }
.view.is-active .n { color: #6b6e76; }

.top-actions { justify-self: end; display: flex; align-items: center; gap: 8px; }
.sync {
  display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px;
  border-radius: 999px; background: var(--surface); border: 1px solid var(--line);
  font-size: 12.5px; color: var(--ink-2); white-space: nowrap;
}
.sync i { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-3); }
.sync.ok i { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 22%, transparent); }
.sync.warn i { background: var(--warn); }
.sync.bad i { background: var(--bad); }

.page {
  display: grid; grid-template-rows: auto minmax(0, 1fr); gap: 20px; min-height: 0;
  padding: 10px 28px 24px; max-width: 1640px; width: 100%; margin: 0 auto;
}

/* ---------- заголовок и полоса этапов ---------- */
.hero { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 18px 28px; }
.hero-title { grid-column: 1 / -1; display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap; }
.hero h1 { margin: 0; font-size: 44px; line-height: 1; font-weight: 650; letter-spacing: -.035em; }
.hero-sub { color: var(--ink-3); font-size: 14px; }

.pipeline { display: flex; gap: 6px; min-width: 0; }
.seg {
  min-width: 96px; display: grid; gap: 8px; padding: 0; border: 0; background: none; text-align: left;
  transition: transform .2s var(--ease);
}
.seg:hover { transform: translateY(-2px); }
.seg-label {
  display: flex; align-items: baseline; gap: 6px; padding-left: 2px;
  font-size: 12.5px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.seg-label b { color: var(--ink); font-weight: 700; font-variant-numeric: tabular-nums; }
.seg-bar {
  height: 42px; border-radius: 999px; display: flex; align-items: center; padding: 0 16px;
  font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; border: 1px solid transparent;
}
.seg.dark .seg-bar { background: #121316; color: var(--ink); border-color: var(--line); }
.seg.accent .seg-bar { background: var(--grad) border-box; color: var(--on-accent); }
.seg.light .seg-bar { background: #e7e7ea; color: #1d1e22; }
.seg.striped .seg-bar {
  color: var(--ink-2); border-color: var(--line-2);
  background: repeating-linear-gradient(-45deg, rgb(255 255 255 / .13) 0 5px, transparent 5px 11px);
}
.seg.outline .seg-bar { color: var(--ink-2); border: 1.5px solid var(--line-2); }
.seg.is-on .seg-bar { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent); }

.quick { display: flex; gap: 8px; }
.pill {
  display: inline-flex; align-items: center; gap: 9px; height: 42px; padding: 0 8px 0 16px;
  border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface);
  font-size: 13.5px; font-weight: 600; color: var(--ink); white-space: nowrap;
  transition: background .18s, transform .18s var(--ease);
}
.pill:hover { background: var(--surface-2); }
.pill:active { transform: scale(.97); }
.pill .n {
  min-width: 26px; height: 26px; padding: 0 8px; border-radius: 999px; display: grid; place-items: center;
  background: var(--surface-3); font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums;
}
.pill.hot .n { background: color-mix(in srgb, var(--bad) 22%, transparent); color: var(--bad); }
.pill.is-on { background: var(--ink); color: #18191c; border-color: transparent; }
.pill.is-on .n { background: #18191c; color: var(--ink); }

/* ---------- доска с таблицей ---------- */
.board {
  display: flex; flex-direction: column; min-height: 0;
  background: linear-gradient(180deg, rgb(255 255 255 / .025), transparent 120px), var(--surface);
  border: 1px solid var(--line); border-radius: 28px; padding: 10px;
  box-shadow: 0 30px 60px -40px rgb(0 0 0 / .7);
}
.toolbar { display: flex; align-items: center; gap: 10px; padding: 6px 6px 12px; flex-wrap: wrap; }
.tool-filters { display: flex; align-items: center; gap: 6px; }
.drop {
  display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 12px 0 15px;
  border-radius: 999px; border: 1px solid var(--line); background: var(--surface-2);
  color: var(--ink-2); font-size: 13px; font-weight: 600; white-space: nowrap; max-width: 220px;
  transition: background .18s, color .18s, border-color .18s, transform .2s var(--ease-smooth-out);
}
.drop:hover { color: var(--ink); background: var(--surface-3); }
.drop svg.i { width: 14px; height: 14px; color: var(--ink-3); }
.drop[aria-expanded="true"] svg.i { transform: rotate(180deg); }
.drop.is-on { color: var(--ink); border-color: rgb(255 122 48 / .45); }
.drop .n {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; display: grid; place-items: center;
  background: var(--grad) border-box; color: var(--on-accent); font-size: 11px; font-weight: 800;
}
.reset {
  display: inline-flex; align-items: center; gap: 5px; height: 36px; padding: 0 10px;
  border: 0; background: none; color: var(--ink-3); font-size: 13px; font-weight: 600;
}
.reset:hover { color: var(--ink); }
.reset svg.i { width: 14px; height: 14px; }

.search { position: relative; flex: 1; min-width: 200px; max-width: 440px; }
.search svg.i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--ink-3); }
.search input {
  width: 100%; height: 38px; padding: 0 14px 0 40px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface-2); outline: none;
  transition: border-color .15s, background .15s;
}
.search input::placeholder { color: var(--ink-3); }
.search input:focus { border-color: rgb(255 122 48 / .6); background: var(--surface-3); }
#export { margin-left: auto; }

.table {
  --cols: 136px minmax(180px, 1.4fr) minmax(160px, 1.2fr) minmax(110px, .8fr) 100px 108px 148px 150px;
  flex: 1; min-height: 0; overflow: auto; border-radius: 20px; background: var(--sunken);
  border: 1px solid var(--line); padding: 0 8px;
}
.thead, .row {
  display: grid; grid-template-columns: var(--cols); column-gap: 12px; align-items: center;
}
.thead {
  position: sticky; top: 0; z-index: 2; padding: 0 14px; height: 48px;
  background: var(--sunken); border-bottom: 1px dashed var(--line-2); margin: 0 -8px; padding-inline: 22px;
}
.th {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0; min-width: 0;
  border: 0; background: none; color: var(--ink-3); font-size: 12.5px; font-weight: 600; white-space: nowrap;
}
.th:hover, .th.is-sorted { color: var(--ink); }
.th svg.i { width: 13px; height: 13px; opacity: .7; }
.th.num { justify-content: flex-end; }

.row {
  width: 100%; min-height: 62px; margin: 3px 0; padding: 6px 14px;
  border: 0; border-radius: 16px; background: transparent; color: var(--ink); text-align: left;
  position: relative; isolation: isolate;
  transition: background .18s var(--ease), color .25s var(--ease-smooth-out), transform .18s var(--ease);
}
.row + .row { box-shadow: 0 -1px 0 var(--line); }
.row:hover { background: rgb(255 255 255 / .04); }
.row:hover + .row, .row.is-selected + .row { box-shadow: none; }
.row:active { transform: scale(.996); }
.td { min-width: 0; display: flex; align-items: center; gap: 11px; }
.td.num { justify-content: flex-end; font-variant-numeric: tabular-nums; font-weight: 600; }
.two { display: grid; gap: 3px; min-width: 0; }
.td small, .two small { font-size: 12px; color: var(--ink-3); }
.ell { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.muted { color: var(--ink-3); }

.c-num { display: grid; grid-template-columns: 8px auto; column-gap: 9px; align-content: center; }
.c-num b { font-weight: 600; font-size: 13.5px; letter-spacing: .01em; font-variant-numeric: tabular-nums; }
.c-num small { grid-column: 2; white-space: nowrap; }
.unread-dot { grid-row: 1 / span 2; width: 8px; height: 8px; border-radius: 50%; background: var(--grad) border-box; visibility: hidden; }
.row.is-unread .unread-dot { visibility: visible; }
.row.is-unread .c-num b, .row.is-unread .c-client .ell:first-child { font-weight: 750; }

.ava {
  width: 34px; height: 34px; border-radius: 11px; flex: none; display: grid; place-items: center;
  font-size: 12px; font-weight: 800; color: var(--c);
  background: color-mix(in srgb, var(--c) 18%, transparent);
}
.c-client .ell:first-child, .c-car .ell { font-weight: 600; }
.plate {
  justify-self: start; padding: 1px 7px; border: 1px solid var(--line-2); border-radius: 6px;
  font-size: 11.5px !important; color: var(--ink-2) !important; letter-spacing: .05em; font-variant-numeric: tabular-nums;
}
.c-insurer { color: var(--ink-2); }
.fr { color: var(--warn); }

.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; width: fit-content;
  border-radius: 999px; background: var(--surface-2); color: var(--ink-2);
  font-size: 12.5px; font-weight: 600; white-space: nowrap;
}
.chip svg.i { width: 13px; height: 13px; }
.chip.warn { background: color-mix(in srgb, var(--warn) 15%, transparent); color: var(--warn); }
.chip.bad { background: color-mix(in srgb, var(--bad) 16%, transparent); color: var(--bad); }
.nocall { font-size: 11.5px !important; color: var(--ink-3); }

.status, .badge {
  display: inline-flex; align-items: center; gap: 7px; height: 28px; padding: 0 12px; width: fit-content; flex: none;
  border-radius: 999px; font-size: 12.5px; font-weight: 700; white-space: nowrap;
  color: color-mix(in srgb, var(--c) 82%, #fff);
  background: color-mix(in srgb, var(--c) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--c) 26%, transparent);
}
.status i { width: 7px; height: 7px; border-radius: 50%; background: var(--c); flex: none; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--c); }
.badge.lg { height: 32px; padding: 0 14px; font-size: 13px; }

/* Открытая заявка подсвечивается фирменным градиентом. */
/* Градиент лежит на подложке и плавно проявляется, а не включается скачком. */
.row::before {
  content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; pointer-events: none;
  background: var(--grad) border-box; opacity: 0; transform: scaleX(.97);
  transition: opacity var(--duration-fast) var(--ease-smooth-out), transform var(--duration-slow) var(--ease-smooth-out);
}
.row.is-selected::before { opacity: 1; transform: none; }
.row.is-selected { color: var(--on-accent); box-shadow: 0 14px 30px -18px rgb(255 110 50 / .7); }
.row.is-selected:hover { background: transparent; }
.row.is-selected small, .row.is-selected .muted, .row.is-selected .c-insurer, .row.is-selected .nocall { color: rgb(29 19 13 / .66) !important; }
.row.is-selected .plate { border-color: rgb(29 19 13 / .3); }
.row.is-selected .fr { color: inherit; }
.row.is-selected .unread-dot { background: var(--on-accent); }
.row.is-selected .ava { background: rgb(29 19 13 / .14); color: var(--on-accent); }
.row.is-selected .chip, .row.is-selected .status { background: rgb(29 19 13 / .12); border-color: rgb(29 19 13 / .16); color: var(--on-accent); }
.row.is-selected .status i { background: var(--on-accent); }

.m-meta { display: none; }

.row.skeleton { display: flex; gap: 18px; pointer-events: none; }
.row.skeleton span {
  height: 14px; border-radius: 7px; flex: 1;
  background: linear-gradient(90deg, var(--surface) 0%, var(--surface-2) 50%, var(--surface) 100%) 0 0 / 200% 100%;
  animation: shimmer 1.3s linear infinite;
}
.row.skeleton span:first-child { flex: .5; }
@keyframes shimmer { to { background-position: -200% 0; } }

.table-foot { padding: 14px 14px 16px; color: var(--ink-3); font-size: 12.5px; }
.empty { display: grid; justify-items: center; gap: 8px; padding: 70px 20px; text-align: center; color: var(--ink-3); }
.empty b { color: var(--ink); font-size: 16px; font-weight: 700; }
.empty .btn { margin-top: 8px; }

/* ---------- выпадающее меню ---------- */
.menu {
  position: fixed; z-index: 60; max-height: min(60vh, 460px); overflow-y: auto;
  background: #2a2b31; border: 1px solid var(--line-2); border-radius: 18px; padding: 6px;
  box-shadow: 0 24px 60px -16px rgb(0 0 0 / .7); animation: pop .18s var(--ease);
}
@keyframes pop { from { opacity: 0; transform: translateY(-6px) scale(.98); } }
.opt {
  display: flex; align-items: center; gap: 10px; width: 100%; height: 40px; padding: 0 10px;
  border: 0; border-radius: 12px; background: transparent; color: var(--ink-2); text-align: left;
  font-size: 13.5px; font-weight: 600; white-space: nowrap;
}
.opt:hover { background: var(--surface-3); color: var(--ink); }
.opt.is-on { color: var(--ink); }
.opt .check {
  width: 20px; height: 20px; border-radius: 7px; border: 1.5px solid var(--line-2); flex: none;
  display: grid; place-items: center; color: var(--on-accent);
}
.opt.is-on .check { background: var(--grad) border-box; border-color: transparent; }
.opt .check svg.i { width: 13px; height: 13px; stroke-width: 2.6; }
.opt .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c); flex: none; }
.opt .n { margin-left: auto; padding-left: 16px; color: var(--ink-3); font-size: 12.5px; font-variant-numeric: tabular-nums; }

/* ---------- карточка заявки (выезжает справа) ---------- */
.scrim {
  position: fixed; inset: 0; z-index: 30; background: rgb(12 12 14 / .5);
  opacity: 0; pointer-events: none; transition: opacity .28s var(--ease);
}
.has-detail .scrim { opacity: 1; pointer-events: auto; }
.detail {
  position: fixed; z-index: 40; top: 12px; right: 12px; bottom: 12px; width: min(580px, calc(100vw - 24px));
  overflow-y: auto; overscroll-behavior: contain;
  background: var(--surface); border: 1px solid var(--line-2); border-radius: 26px;
  box-shadow: -40px 0 90px -30px rgb(0 0 0 / .7);
  transform: translateX(calc(100% + 30px)); visibility: hidden;
  transition: transform .36s var(--ease), visibility 0s linear .36s;
}
.has-detail .detail { transform: none; visibility: visible; transition: transform .36s var(--ease), visibility 0s; }
.d-empty { height: 100%; display: grid; place-content: center; text-align: center; color: var(--ink-3); padding: 40px; gap: 6px; }
.d-empty b { color: var(--ink-2); font-size: 15px; }

.d-head {
  position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 12px;
  padding: 18px 18px 16px 24px; border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(10px);
}
.d-title { min-width: 0; }
.d-title h2 { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.d-title span { color: var(--ink-3); font-size: 12.5px; }
.d-head .badge { margin-left: auto; }
.d-close { margin-left: 4px; }

.d-section { padding: 20px 24px; border-bottom: 1px solid var(--line); }
.d-section:last-child { border-bottom: 0; }
.d-section h3 { margin: 0 0 14px; font-size: 11.5px; text-transform: uppercase; letter-spacing: .09em; color: var(--ink-3); font-weight: 700; }
.d-car { font-size: 20px; font-weight: 700; letter-spacing: -.02em; margin: 0 0 3px; }
.d-sub { color: var(--ink-2); margin: 0; }
.d-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.called-form {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; margin-top: 12px; padding: 10px 12px;
  border-radius: 16px; background: color-mix(in srgb, var(--ok) 9%, var(--surface-2)); border: 1px solid color-mix(in srgb, var(--ok) 22%, transparent);
}
.called-label { display: inline-flex; align-items: center; gap: 6px; color: var(--ok); font-weight: 700; }
.called-form .input { height: 36px; padding: 0 10px; font-size: 14px; font-variant-numeric: tabular-nums; }
.called-form .btn { height: 36px; }
.called-form .hint { margin: 0 0 0 auto; }

.track { list-style: none; margin: 0; padding: 0; display: grid; }
.step { display: grid; grid-template-columns: 24px 1fr auto; gap: 12px; align-items: start; position: relative; padding-bottom: 16px; }
.step:last-child { padding-bottom: 0; }
.step::before { content: ""; position: absolute; left: 11px; top: 22px; bottom: 0; width: 2px; background: var(--line-2); }
.step:last-child::before { display: none; }
.step .mark {
  width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; position: relative; z-index: 1;
  border: 2px solid var(--line-2); background: var(--surface); color: #16171a;
}
.step .mark svg.i { width: 12px; height: 12px; stroke-width: 2.6; }
.step.done .mark { background: var(--c); border-color: var(--c); }
.step.done::before { background: color-mix(in srgb, var(--c) 45%, var(--line-2)); }
.step.current .mark { border-color: var(--c); box-shadow: 0 0 0 5px color-mix(in srgb, var(--c) 16%, transparent); }
.step.current .mark::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.step.fail .mark { background: var(--bad); border-color: var(--bad); }
.step-label { font-weight: 600; padding-top: 2px; }
.step-note { display: block; font-weight: 450; color: var(--ink-3); font-size: 12.5px; }
.step-date { color: var(--ink-3); font-size: 12.5px; padding-top: 3px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.step.pending .step-label { color: var(--ink-3); font-weight: 500; }

.facts { display: grid; grid-template-columns: 160px minmax(0, 1fr); gap: 10px 16px; margin: 0; }
.facts dt { color: var(--ink-3); font-size: 13px; }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.facts dd.em { font-weight: 700; color: var(--warn); }
.hint { margin: 6px 0 0; color: var(--ink-3); font-size: 12.5px; }
.glass-line { margin: 0 0 14px; font-weight: 600; }
details.raw { margin-top: 14px; }
details.raw summary { cursor: pointer; color: var(--ink-3); font-size: 12.5px; }
details.raw pre {
  margin: 10px 0 0; padding: 12px 14px; border-radius: 14px; background: var(--sunken); border: 1px solid var(--line);
  white-space: pre-wrap; font: 12.5px/1.55 ui-monospace, "Cascadia Mono", Consolas, monospace; color: var(--ink-2);
}
.inline-row { display: flex; gap: 8px; margin-top: 8px; }
.inline-row .input { flex: 1; min-width: 0; height: 40px; font-size: 14px; }

.wo-head { display: flex; align-items: center; gap: 10px; }
.wo-head b { font-size: 15px; font-variant-numeric: tabular-nums; }
.wo-progress { margin: 14px 0 9px; font-weight: 600; font-size: 13px; color: var(--ink-2); }
.works { list-style: none; margin: 0; padding: 0; display: grid; gap: 9px; }
.works li { display: flex; align-items: center; gap: 10px; }
.works li.done { color: var(--ink-2); }
.wk-mark {
  width: 20px; height: 20px; border-radius: 7px; flex: none;
  border: 2px solid var(--line-2); display: grid; place-items: center; color: #16171a;
}
.works li.done .wk-mark { background: var(--ok); border-color: var(--ok); }
.wk-mark svg.i { width: 12px; height: 12px; stroke-width: 2.6; }
.wk-who { display: block; margin: 0; }
.wo-head + .hint + .wo-progress, .works + .wo-progress { margin-top: 18px; }

.comment-form { display: grid; gap: 8px; margin-bottom: 18px; }
.comment-form textarea {
  min-height: 70px; resize: vertical; padding: 12px 14px; border-radius: 14px;
  border: 1px solid var(--line); background: var(--surface-2); outline: none; color: var(--ink);
}
.comment-form textarea:focus { border-color: rgb(255 122 48 / .6); background: var(--surface-3); }
.comment-form .btn { justify-self: end; }

.events { list-style: none; margin: 0; padding: 0; display: grid; gap: 13px; }
.event { display: grid; grid-template-columns: 88px minmax(0, 1fr); gap: 10px; font-size: 13.5px; }
.event time { color: var(--ink-3); font-size: 12.5px; font-variant-numeric: tabular-nums; padding-top: 2px; }
.event .who { color: var(--ink-3); }
.event.comment .txt { margin-top: 3px; background: var(--surface-2); border-radius: 4px 14px 14px 14px; padding: 9px 12px; white-space: pre-wrap; }
.event.onec .txt { background: color-mix(in srgb, var(--accent) 11%, var(--surface-2)); }
.event.system .txt { color: var(--ink-2); }

/* ---------- уведомления ---------- */
.toasts {
  position: fixed; left: 50%; bottom: max(22px, env(safe-area-inset-bottom)); transform: translateX(-50%);
  display: grid; gap: 8px; z-index: 70; width: min(440px, calc(100% - 32px));
}
.toast {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 16px;
  background: #f3f3f4; color: #1a1b1e; font-weight: 600;
  box-shadow: 0 18px 40px -12px rgb(0 0 0 / .6); animation: toast-in var(--duration-very-slow) var(--ease-bounce) both;
}
.toast button { margin-left: auto; height: 30px; padding: 0 12px; border: 0; border-radius: 999px; background: var(--grad) border-box; color: var(--on-accent); font-weight: 700; }
@keyframes rise { from { transform: translateY(10px); opacity: 0; } }


/* ---------- анимации ---------- */
/* Приёмы из базы transitions.dev и фирменных приёмов: рисующаяся галочка (success check),
   переезжающая подложка (tabs sliding), подпрыгивающий значок (notification badge).
   Двигаются только transform, opacity и обводка, без пересчёта раскладки. */

svg.i path[pathLength] { stroke-dasharray: 1; }
@keyframes draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes rise-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { transform: scale(.55); } to { transform: scale(1); } }
@keyframes press-pop { 0% { transform: scale(.94); } 100% { transform: scale(1); } }
@keyframes fill-sweep {
  0% { transform: scaleX(0); opacity: .32; }
  55% { transform: scaleX(1); opacity: .32; }
  100% { transform: scaleX(1); opacity: 0; }
}
@keyframes wipe { from { clip-path: inset(0 100% 0 0 round 999px); } to { clip-path: inset(0 0 0 0 round 999px); } }
@keyframes bump { 0% { transform: scale(.4); } 60% { transform: scale(1.18); } 100% { transform: scale(1); } }
@keyframes toast-in { from { opacity: 0; transform: translateY(14px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes ring {
  0%, 100% { box-shadow: 0 0 0 5px color-mix(in srgb, var(--c) 16%, transparent); }
  50% { box-shadow: 0 0 0 9px color-mix(in srgb, var(--c) 6%, transparent); }
}

/* Кнопки: с мышью чуть приподнимаются при наведении и вдавливаются при нажатии. */
@media (hover: hover) and (pointer: fine) {
  .btn:hover, .pill:hover, .drop:hover, .round-btn:hover { transform: translateY(-1px); }
  .btn:active, .pill:active, .drop:active { transform: translateY(0) scale(.97); }
  .round-btn:active { transform: translateY(0) scale(.94); }
}

/* Оранжевая кнопка: при наведении по ней пробегает блик. */
.btn-primary { position: relative; overflow: hidden; isolation: isolate; }
.btn-primary::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(110deg, transparent 30%, rgb(255 255 255 / .38) 50%, transparent 70%);
  transform: translateX(-120%);
}
@media (hover: hover) and (pointer: fine) {
  .btn-primary:hover::after { transform: translateX(120%); transition: transform .75s var(--ease-smooth-out); }
}

/* Включили отметку: кнопка заливается цветом слева направо, галочка рисуется. */
.btn { position: relative; isolation: isolate; }
.btn.just-on::before {
  content: ""; position: absolute; inset: -1px; z-index: -1; border-radius: inherit; pointer-events: none;
  background: currentColor; transform-origin: left center;
  animation: fill-sweep var(--duration-very-slow) var(--ease-smooth-out) both;
}
.btn.just-on svg.i path,
.called-form.just-on .called-label svg.i path,
.opt.just-on .check svg.i path { animation: draw var(--duration-very-slow) var(--ease-smooth-out) 90ms both; }
.called-form.just-on { animation: rise-in var(--duration-slow) var(--ease-smooth-out) both; }
.pill.just-on { animation: press-pop var(--duration-slow) var(--ease-bounce) both; }
.pill.just-on .n { animation: pop var(--duration-slow) var(--ease-bounce) 60ms both; }
.opt.just-on .check { animation: pop var(--duration-slow) var(--ease-bounce) both; }

/* Новая непрочитанная заявка: значок на колокольчике подпрыгивает. */
.bell-n.bump { animation: bump var(--duration-very-slow) var(--ease-bounce) both; }

/* Полоса этапов при первом показе вырастает слева направо, по очереди. */
.pipeline.enter .seg-bar { animation: wipe .9s var(--ease-smooth-out) both; animation-delay: calc(var(--i, 0) * 90ms + 120ms); }
.pipeline.enter .seg-label { animation: rise-in var(--duration-very-slow) var(--ease-smooth-out) both; animation-delay: calc(var(--i, 0) * 90ms + 60ms); }

/* Список при смене фильтра или сортировки появляется каскадом. */
.table.enter .row:not(.skeleton) { animation: rise-in var(--duration-slow) var(--ease-smooth-out) both; animation-delay: calc(var(--i, 0) * 22ms); }

/* Карточка заявки: разделы поднимаются по очереди, выполненные шаги отмечаются галочками. */
.detail.enter .d-head,
.detail.enter .d-section { animation: rise-in var(--duration-slow) var(--ease-smooth-out) both; animation-delay: calc(var(--i, 0) * 45ms + 90ms); }
.detail.enter .step.done .mark { animation: pop var(--duration-slow) var(--ease-bounce) both; animation-delay: calc(var(--s, 0) * 90ms + 260ms); }
.detail.enter .step.done .mark svg.i path { animation: draw var(--duration-very-slow) var(--ease-smooth-out) both; animation-delay: calc(var(--s, 0) * 90ms + 360ms); }
/* Текущий шаг тихо «дышит», чтобы было видно, где заявка сейчас. */
.step.current .mark { animation: ring 2.6s ease-in-out infinite; }

/* ---------- средние экраны ---------- */
@media (max-width: 1240px) {
  .table { --cols: 128px minmax(170px, 1.4fr) minmax(150px, 1.2fr) 108px 140px 146px; }
  .c-insurer, .c-franchise, .th[data-sort="insurer"], .th[data-sort="franchise"] { display: none; }
  .hero { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 1080px) {
  .sync span { display: none; }
  .sync { width: 38px; padding: 0; justify-content: center; }
}

/* ---------- телефон и узкие экраны ---------- */
@media (max-width: 899px) {
  .shell { height: auto; min-height: 100dvh; display: block; }
  .topbar {
    grid-template-columns: auto 1fr; gap: 12px; padding: 12px 14px 6px;
    padding-top: max(12px, env(safe-area-inset-top));
  }
  .views { grid-column: 1 / -1; grid-row: 2; overflow-x: auto; scrollbar-width: none; justify-self: stretch; }
  .views::-webkit-scrollbar { display: none; }
  .views-list { flex: 1; }
  .view { flex: 1; justify-content: center; }
  .install-btn { width: 38px; padding: 0; }
  .install-btn span { display: none; }
  .page { display: block; padding: 8px 14px calc(28px + env(safe-area-inset-bottom)); }
  .hero { gap: 14px; margin-bottom: 16px; }
  .hero h1 { font-size: 32px; }
  .pipeline { overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
  .pipeline::-webkit-scrollbar, .quick::-webkit-scrollbar, .tool-filters::-webkit-scrollbar { display: none; }
  .seg { min-width: max-content; }
  .seg-bar { height: 38px; padding: 0 12px; }
  .quick { overflow-x: auto; scrollbar-width: none; }
  .pill { height: 38px; }
  .board { padding: 8px; border-radius: 24px; }
  .toolbar { padding: 4px 4px 10px; gap: 8px; }
  .search { order: -1; flex-basis: 100%; max-width: none; }
  .tool-filters { flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
  #export { width: 36px; height: 36px; padding: 0; }
  #export span { display: none; }
  .table { overflow: visible; background: none; border: 0; padding: 0; border-radius: 0; }
  .thead { display: none; }
  .row {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "num stage" "car car" "client client" "meta meta";
    gap: 10px 12px; margin: 0 0 8px; padding: 14px;
    background: var(--surface-2); border: 1px solid var(--line); border-radius: 20px;
  }
  .row + .row { box-shadow: none; }
  .row:hover { background: var(--surface-3); }
  .c-num { grid-area: num; }
  .c-stage { grid-area: stage; justify-content: flex-end; text-align: right; }
  .c-stage .two { justify-items: end; }
  .c-car { grid-area: car; }
  .c-car .ell { font-size: 15.5px; font-weight: 700; }
  .c-client { grid-area: client; }
  .c-insurer, .c-franchise, .c-amount, .c-contact { display: none; }
  .m-meta { grid-area: meta; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; font-size: 12.5px; color: var(--ink-2); }
  .row.is-selected .m-meta { color: var(--on-accent); }
  .detail { inset: 0; width: auto; border-radius: 0; border: 0; transform: translateX(100%); }
  .d-head { padding-top: max(16px, env(safe-area-inset-top)); padding-left: 18px; }
  .d-section { padding: 18px; }
  .facts { grid-template-columns: 1fr; gap: 2px; }
  .facts dd { margin-bottom: 9px; }
  .d-actions .btn { flex: 1 1 auto; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
