/* =========================================================
   Цех Заявки — дизайн-система
   Тёплая бумага, графит и один сигнальный акцент — оранжевый, как разметка в цеху.
   Цвета только через токены: светлая и тёмная темы меняют их целиком.
   ========================================================= */
:root {
  --font: 'Onest', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: ui-monospace, 'Cascadia Mono', 'SFMono-Regular', Consolas, monospace;

  --bg: #f3f2ee;
  --panel: #ffffff;
  --panel-2: #f9f8f5;
  --sunken: #ebe9e3;
  --hover: #f4f3ef;
  --line: #e2dfd7;
  --line-2: #cfcbc1;
  --ink: #18191b;
  --ink-2: #3e4147;
  --ink-3: #6a6d74;
  --ink-4: #9b9da2;

  --accent: #d4470c;
  --accent-hover: #bb3d09;
  --accent-ink: #ffffff;
  --accent-soft: #fdece3;
  --accent-text: #b23a08;
  --focus: rgba(212, 71, 12, .28);

  --dark-btn: #1f2023;
  --dark-btn-hover: #34363a;
  --dark-btn-ink: #ffffff;

  --red: #c0302b;   --red-soft: #fbe9e6;   --red-line: #f0c3bd;
  --amber: #9a5b06; --amber-soft: #f9eedb;
  --green: #1a7a4c; --green-soft: #e2f2e9;
  --blue: #2259c7;  --blue-soft: #e6eefb;
  --violet: #6a40c9; --violet-soft: #efe9fb;
  --teal: #0c6f80;  --teal-soft: #dff1f3;
  --indigo: #3f4bb8; --indigo-soft: #e8eafa;
  --slate: #555b66; --slate-soft: #ebecee;
  --wa: #1c9d55;

  --r-xs: 4px; --r-s: 6px; --r: 8px; --r-l: 12px;
  --sh-pop: 0 14px 40px rgba(24, 25, 27, .18), 0 2px 8px rgba(24, 25, 27, .08);
  --sh-sheet: 0 -8px 32px rgba(24, 25, 27, .16);
  --top: 56px;
  --side: 228px;
  --tabbar: 62px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111213;
  --panel: #18191b;
  --panel-2: #1c1d20;
  --sunken: #0c0d0e;
  --hover: #202124;
  --line: #2a2b2f;
  --line-2: #3a3c41;
  --ink: #ecebe8;
  --ink-2: #c6c5c1;
  --ink-3: #94959a;
  --ink-4: #66686d;

  --accent: #ff7a3d;
  --accent-hover: #ff905e;
  --accent-ink: #1b0b02;
  --accent-soft: #33190c;
  --accent-text: #ff9d70;
  --focus: rgba(255, 122, 61, .35);

  --dark-btn: #ecebe8;
  --dark-btn-hover: #ffffff;
  --dark-btn-ink: #18191b;

  --red: #ff7b72;   --red-soft: #321a19;   --red-line: #5c2a27;
  --amber: #e7a948; --amber-soft: #2e2312;
  --green: #4fc98a; --green-soft: #132a1f;
  --blue: #7aa7ff;  --blue-soft: #16223a;
  --violet: #b89cff; --violet-soft: #241c3a;
  --teal: #5fc8d8;  --teal-soft: #102a2e;
  --indigo: #9aa4ff; --indigo-soft: #1c1f3a;
  --slate: #a8adb7; --slate-soft: #232529;
  --wa: #3ccf7d;
  --sh-pop: 0 14px 40px rgba(0, 0, 0, .55), 0 2px 8px rgba(0, 0, 0, .4);
  --sh-sheet: 0 -8px 32px rgba(0, 0, 0, .5);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font: 14px/1.45 var(--font); color: var(--ink); background: var(--bg);
  -webkit-font-smoothing: antialiased; font-variant-numeric: tabular-nums; overflow-x: hidden;
}
@media (max-width: 720px) { body { font-size: 15px; } }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: default; }
input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 22px; line-height: 1.2; font-weight: 600; letter-spacing: -.015em; }
h2 { font-size: 15px; line-height: 1.3; font-weight: 600; }
h3 { font-size: 14px; font-weight: 600; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ic { flex: none; display: block; }
.muted { color: var(--ink-3); }
.small { font-size: 12.5px; }
.num { font-size: 12px; font-weight: 500; color: var(--ink-3); white-space: nowrap; }
.label { font-size: 11px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-3); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.link { color: var(--accent-text); background: none; border: 0; padding: 0; font-weight: 500; display: inline-flex; align-items: center; gap: 4px; }
.link:hover { text-decoration: underline; }
.nowrap { white-space: nowrap; }
.red { color: var(--red); }
.grow { flex: 1; min-width: 0; }
[hidden] { display: none !important; }

/* ---------- кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px;
  border-radius: var(--r); border: 1px solid var(--line-2); background: var(--panel); color: var(--ink);
  font-weight: 500; font-size: 13.5px; white-space: nowrap; transition: background .12s, border-color .12s, color .12s;
  -webkit-tap-highlight-color: transparent; position: relative;
}
.btn:hover { background: var(--hover); border-color: var(--ink-4); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-dark { background: var(--dark-btn); border-color: var(--dark-btn); color: var(--dark-btn-ink); font-weight: 600; }
.btn-dark:hover { background: var(--dark-btn-hover); border-color: var(--dark-btn-hover); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--hover); border-color: transparent; }
.btn-danger { color: var(--red); }
.btn-danger:hover { border-color: var(--red); background: var(--red-soft); }
.btn-wa { color: var(--wa); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; gap: 5px; border-radius: var(--r-s); }
.btn-lg { height: 44px; padding: 0 20px; font-size: 15px; }
.btn-block { width: 100%; }
.btn-icon { width: 36px; padding: 0; }
.btn-icon.btn-sm { width: 30px; }
.btn[aria-busy="true"] { color: transparent !important; pointer-events: none; }
.btn[aria-busy="true"]::after {
  content: ''; position: absolute; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--ink-3); border-right-color: transparent; animation: spin .7s linear infinite;
}
.btn-primary[aria-busy="true"]::after, .btn-dark[aria-busy="true"]::after { border-color: currentColor; border-color: var(--accent-ink); border-right-color: transparent; }
@keyframes spin { to { transform: rotate(360deg); } }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- поля ---------- */
.input, .select, .textarea {
  width: 100%; height: 38px; padding: 0 11px; border: 1px solid var(--line-2); border-radius: var(--r);
  background: var(--panel); color: var(--ink); transition: border-color .12s, box-shadow .12s;
}
.textarea { height: auto; min-height: 76px; padding: 9px 11px; resize: vertical; line-height: 1.45; }
.select { padding-right: 30px; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }
.input:hover, .select:hover, .textarea:hover { border-color: var(--ink-4); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus); }
.input::placeholder, .textarea::placeholder { color: var(--ink-4); }
.input.is-err, .select.is-err, .textarea.is-err { border-color: var(--red); }
@media (max-width: 720px) { .input, .select { height: 44px; font-size: 16px; } .textarea { font-size: 16px; } }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > span { font-size: 12.5px; font-weight: 500; color: var(--ink-2); }
.field small { color: var(--ink-3); font-size: 12px; }
.fields { display: grid; gap: 12px; }
.fields-2 { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
@media (max-width: 560px) { .fields-2 { grid-template-columns: 1fr; } }
.form-err { color: var(--red); font-size: 13px; background: var(--red-soft); border: 1px solid var(--red-line); border-radius: var(--r); padding: 8px 11px; }
.form-err:empty { display: none; }
.check { display: flex; align-items: flex-start; gap: 9px; font-size: 13.5px; cursor: pointer; }
.check input { width: 17px; height: 17px; margin: 1px 0 0; accent-color: var(--accent); flex: none; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  height: 32px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--panel);
  font-size: 13px; font-weight: 500; display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2);
}
.chip:hover { border-color: var(--ink-3); color: var(--ink); }
.chip.is-on { background: var(--dark-btn); border-color: var(--dark-btn); color: var(--dark-btn-ink); }
.seg { display: inline-flex; background: var(--sunken); border-radius: var(--r); padding: 3px; gap: 2px; max-width: 100%; overflow-x: auto; }
.seg button { height: 30px; padding: 0 12px; border: 0; background: none; border-radius: var(--r-s); font-size: 13px; font-weight: 500; color: var(--ink-3); white-space: nowrap; }
.seg button:hover { color: var(--ink); }
.seg button.is-on { background: var(--panel); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .08), 0 0 0 1px var(--line); }

/* ---------- статусы ---------- */
.st {
  display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: var(--r-xs);
  font-size: 12px; font-weight: 500; white-space: nowrap; background: var(--slate-soft); color: var(--slate);
}
.st::before { content: ''; width: 7px; height: 7px; border-radius: 1.5px; background: currentColor; flex: none; }
.st[data-st="new"] { background: var(--blue-soft); color: var(--blue); }
.st[data-st="contact"] { background: var(--violet-soft); color: var(--violet); }
.st[data-st="clarify"] { background: var(--teal-soft); color: var(--teal); }
.st[data-st="quoted"] { background: var(--indigo-soft); color: var(--indigo); }
.st[data-st="waiting"] { background: var(--amber-soft); color: var(--amber); }
.st[data-st="won"] { background: var(--green-soft); color: var(--green); }
.st[data-st="done"] { background: var(--green-soft); color: var(--green); }
.st[data-st="done"]::before { border-radius: 50%; }
.st[data-st="lost"] { background: var(--slate-soft); color: var(--slate); }
button.st { border: 0; cursor: pointer; }
button.st::after { content: ''; width: 0; height: 0; border: 4px solid transparent; border-top-color: currentColor; margin: 4px 0 0 1px; opacity: .7; }
.st-lg { height: 28px; padding: 0 10px; font-size: 13px; }

.tone-red { --tone: var(--red); --tone-soft: var(--red-soft); }
.tone-blue { --tone: var(--blue); --tone-soft: var(--blue-soft); }
.tone-violet { --tone: var(--violet); --tone-soft: var(--violet-soft); }
.tone-amber { --tone: var(--amber); --tone-soft: var(--amber-soft); }
.tone-slate { --tone: var(--slate); --tone-soft: var(--slate-soft); }
.tone-green { --tone: var(--green); --tone-soft: var(--green-soft); }

.badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: var(--accent-ink); font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; font-style: normal; }
.count { font-size: 12px; font-weight: 600; color: var(--ink-3); background: var(--sunken); border-radius: 999px; padding: 1px 8px; font-variant-numeric: tabular-nums; }

/* ---------- каркас ---------- */
.shell { min-height: 100vh; min-height: 100dvh; }
.topbar {
  position: sticky; top: 0; z-index: 30; height: var(--top); display: flex; align-items: center; gap: 12px;
  padding: 0 16px; background: var(--panel); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; flex: none; }
.brand-mark { width: 28px; height: 28px; flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; min-width: 0; }
.brand-text b { font-size: 15px; font-weight: 700; letter-spacing: -.01em; white-space: nowrap; }
.brand-text b span { font-weight: 500; color: var(--ink-2); }
.brand-text small { font-size: 11.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 160px; }
.top-search { position: relative; flex: 1; max-width: 520px; margin-left: 24px; }
.top-search .input { padding-left: 36px; background: var(--panel-2); height: 36px; }
.top-search > .ic { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--ink-4); pointer-events: none; }
.top-search kbd { position: absolute; right: 9px; top: 50%; transform: translateY(-50%); font: 11px var(--mono); color: var(--ink-4); border: 1px solid var(--line-2); border-radius: 4px; padding: 1px 5px; }
.top-actions { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.icon-btn { position: relative; width: 36px; height: 36px; border-radius: var(--r); border: 0; background: none; display: grid; place-items: center; color: var(--ink-2); }
.icon-btn:hover { background: var(--hover); color: var(--ink); }
.icon-btn .badge { position: absolute; top: 2px; right: 0; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--sunken); color: var(--ink-2); display: grid; place-items: center; font-weight: 600; font-size: 13px; border: 1px solid var(--line); flex: none; }
.avatar-btn { border: 0; background: none; padding: 2px; border-radius: 50%; }
.avatar-btn:hover .avatar { border-color: var(--ink-4); }

.search-pop { position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-l); box-shadow: var(--sh-pop); padding: 6px; z-index: 40; }
.search-pop a, .search-pop .sp-empty { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r-s); }
.search-pop a:hover, .search-pop a.is-active { background: var(--hover); }
.search-pop .sp-empty { color: var(--ink-3); }
.search-pop .grow b { display: block; font-weight: 500; }
.search-pop .grow small { color: var(--ink-3); font-size: 12px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.layout { display: grid; grid-template-columns: var(--side) 1fr; }
.side { position: sticky; top: var(--top); height: calc(100vh - var(--top)); height: calc(100dvh - var(--top)); padding: 14px 10px; border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 2px; }
.nav-a { position: relative; display: flex; align-items: center; gap: 11px; height: 38px; padding: 0 12px; border-radius: var(--r); color: var(--ink-2); font-weight: 500; }
.nav-a:hover { background: var(--hover); color: var(--ink); }
.nav-a.is-on { background: var(--panel); color: var(--ink); box-shadow: 0 0 0 1px var(--line); font-weight: 600; }
.nav-a.is-on::before { content: ''; position: absolute; left: -10px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.nav-a .count { margin-left: auto; }
.nav-a .count.is-hot { background: var(--accent-soft); color: var(--accent-text); }
.side-foot { margin-top: auto; padding: 12px; font-size: 12px; color: var(--ink-4); }
.main { min-width: 0; }
.tabbar, .fab, .m-only { display: none; }

@media (max-width: 1023px) {
  .layout { display: block; }
  .side, .top-search, .d-only { display: none !important; }
  .m-only { display: flex; }
  .tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    height: calc(var(--tabbar) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
    background: var(--panel); border-top: 1px solid var(--line);
  }
  .tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 10.5px; font-weight: 500; color: var(--ink-3); position: relative; }
  .tabbar a.is-on { color: var(--ink); }
  .tabbar a.is-on::before { content: ''; position: absolute; top: 0; left: 30%; right: 30%; height: 2px; background: var(--accent); border-radius: 0 0 2px 2px; }
  .tabbar .badge { position: absolute; top: 6px; left: calc(50% + 5px); }
  .fab {
    display: grid; place-items: center; position: fixed; right: 16px; bottom: calc(var(--tabbar) + 16px + env(safe-area-inset-bottom)); z-index: 29;
    width: 54px; height: 54px; border-radius: 16px; border: 0; background: var(--accent); color: var(--accent-ink); box-shadow: var(--sh-pop);
  }
  .main { padding-bottom: calc(var(--tabbar) + 84px); }
  .brand-text small { max-width: 130px; }
}

/* мобильный поиск поверх шапки */
.m-search { position: fixed; inset: 0 0 auto 0; z-index: 45; background: var(--panel); padding: 10px 12px; display: flex; gap: 8px; border-bottom: 1px solid var(--line); box-shadow: var(--sh-pop); }
.m-search .top-search { display: block !important; margin: 0; max-width: none; }
.m-search .search-pop { position: fixed; top: 64px; left: 8px; right: 8px; max-height: 60vh; overflow: auto; }

/* ---------- страница ---------- */
.page { max-width: 1240px; margin: 0 auto; padding: 24px 28px 48px; display: flex; flex-direction: column; gap: 18px; }
.page-narrow { max-width: 900px; }
@media (max-width: 720px) { .page { padding: 16px 16px 32px; gap: 14px; } }
.page-h { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.page-h .sub { color: var(--ink-3); font-size: 13px; margin-top: 3px; }
.page-h h1 { display: flex; align-items: center; gap: 10px; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-l); min-width: 0; }
.panel-h { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.panel-h h2 { display: flex; align-items: center; gap: 8px; }
.panel-h .btn-row, .panel-h .link { margin-left: auto; }
.panel-b { padding: 16px; }
.panel-f { padding: 10px 16px; border-top: 1px solid var(--line); display: flex; justify-content: center; }
.panel-f .btn { flex: none; }

/* ---------- обзор ---------- */
.kpis { display: grid; grid-template-columns: repeat(5, 1fr); gap: 0; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-l); overflow: hidden; }
.kpi { all: unset; box-sizing: border-box; padding: 14px 16px 15px; display: flex; flex-direction: column; gap: 4px; cursor: pointer; border-right: 1px solid var(--line); min-width: 0; position: relative; }
.kpi:last-child { border-right: 0; }
.kpi:hover { background: var(--hover); }
.kpi:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.kpi-l { font-size: 12.5px; color: var(--ink-3); font-weight: 500; display: flex; align-items: center; gap: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-l::before { content: ''; width: 7px; height: 7px; border-radius: 1.5px; background: var(--tone, var(--ink-4)); flex: none; }
.kpi-v { font-size: 28px; line-height: 1.1; font-weight: 600; letter-spacing: -.02em; }
.kpi-s { font-size: 12px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi.is-alert .kpi-v { color: var(--red); }
.kpi.is-zero .kpi-v { color: var(--ink-4); }
@media (max-width: 1100px) { .kpis { grid-template-columns: repeat(3, 1fr); } .kpi:nth-child(3) { border-right: 0; } .kpi:nth-child(-n+3) { border-bottom: 1px solid var(--line); } }
@media (max-width: 560px) {
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .kpi { border-right: 1px solid var(--line) !important; border-bottom: 1px solid var(--line); padding: 12px 14px; }
  .kpi:nth-child(2n) { border-right: 0 !important; }
  .kpi:last-child { grid-column: 1 / -1; border-bottom: 0; border-right: 0 !important; }
  .kpi-v { font-size: 24px; }
}

.ov-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
@media (max-width: 1100px) { .ov-grid { grid-template-columns: 1fr; } }
.ov-side { display: flex; flex-direction: column; gap: 18px; }

.att-filter { display: flex; gap: 4px; flex-wrap: wrap; margin-left: auto; }
.att-filter button { height: 26px; padding: 0 9px; border-radius: 999px; border: 1px solid transparent; background: none; font-size: 12px; font-weight: 500; color: var(--ink-3); display: inline-flex; align-items: center; gap: 5px; }
.att-filter button:hover { color: var(--ink); background: var(--hover); }
.att-filter button.is-on { border-color: var(--line-2); color: var(--ink); background: var(--panel-2); }
.att-filter i { font-style: normal; color: var(--ink-4); }

.att-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 16px; padding: 14px 16px 14px 19px; border-bottom: 1px solid var(--line); position: relative; align-items: center; }
.att-row:last-child { border-bottom: 0; }
.att-row::before { content: ''; position: absolute; left: 0; top: 12px; bottom: 12px; width: 3px; border-radius: 0 3px 3px 0; background: var(--tone); }
.att-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.att-name { font-weight: 600; font-size: 14.5px; }
.att-name:hover { text-decoration: underline; }
.att-subj { color: var(--ink-2); margin-top: 2px; }
.att-reason { margin-top: 6px; display: flex; gap: 6px; align-items: baseline; font-size: 13px; }
.att-reason b { color: var(--tone); font-weight: 600; white-space: nowrap; }
.att-meta { margin-top: 4px; font-size: 12.5px; color: var(--ink-3); display: flex; flex-wrap: wrap; gap: 4px 14px; }
.att-meta span { display: inline-flex; align-items: center; gap: 4px; }
.att-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
@media (max-width: 720px) {
  .att-row { grid-template-columns: 1fr; padding: 13px 14px 13px 17px; }
  .att-actions { justify-content: flex-start; }
}

.mini-row { display: flex; gap: 10px; align-items: center; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.mini-row:last-child { border-bottom: 0; }
.mini-row:hover { background: var(--hover); }
.mini-row .grow b { display: block; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-row .grow small { display: block; color: var(--ink-3); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-row .when { font-size: 12px; color: var(--ink-3); white-space: nowrap; text-align: right; }

.setup { padding: 6px 0; }
.setup-i { display: flex; gap: 12px; padding: 10px 16px; align-items: flex-start; }
.setup-i .tick { width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--line-2); display: grid; place-items: center; flex: none; color: transparent; }
.setup-i.is-done .tick { background: var(--green); border-color: var(--green); color: #fff; }
.setup-i.is-done b { color: var(--ink-3); text-decoration: line-through; font-weight: 500; }
.setup-i p { font-size: 12.5px; color: var(--ink-3); margin-top: 1px; }

.ok-state { display: flex; gap: 12px; align-items: center; padding: 22px 16px; color: var(--ink-2); }
.ok-state .ic { color: var(--green); }

/* ---------- пустые состояния, загрузка, ошибки ---------- */
.empty { padding: 40px 20px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty .em-ic { width: 44px; height: 44px; border-radius: 12px; background: var(--sunken); display: grid; place-items: center; color: var(--ink-3); }
.empty h3 { font-size: 15px; }
.empty p { color: var(--ink-3); max-width: 46ch; }
.empty .btn-row { justify-content: center; margin-top: 4px; }
.err-state { border: 1px solid var(--red-line); background: var(--red-soft); color: var(--red); border-radius: var(--r-l); padding: 16px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.err-state p { flex: 1; min-width: 200px; }
.sk { border-radius: 6px; background: linear-gradient(90deg, var(--sunken) 0%, var(--hover) 50%, var(--sunken) 100%); background-size: 200% 100%; animation: sk 1.2s linear infinite; }
@keyframes sk { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .sk { animation: none; } * { transition: none !important; animation-duration: .01ms !important; } }
.sk-rows { padding: 8px 16px; display: flex; flex-direction: column; gap: 14px; }
.sk-row { display: flex; flex-direction: column; gap: 7px; padding: 6px 0; }

/* ---------- список заявок ---------- */
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.toolbar .search { position: relative; flex: 1 1 240px; max-width: 360px; }
.toolbar .search .input { padding-left: 34px; }
.toolbar .search .ic { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--ink-4); pointer-events: none; }
.toolbar .select { width: auto; min-width: 0; flex: 0 1 auto; }
.toolbar .tb-gap { margin-left: auto; display: flex; gap: 8px; align-items: center; }
@media (max-width: 720px) {
  .toolbar .search { max-width: none; flex-basis: 100%; }
  .toolbar .select { flex: 1 1 calc(50% - 4px); }
  .toolbar .tb-gap { margin-left: 0; }
}
.custom-range { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.custom-range .input { width: auto; }
.active-filters { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; font-size: 12.5px; color: var(--ink-3); }

.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 11.5px; font-weight: 600; color: var(--ink-3); letter-spacing: .02em; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--panel-2); position: sticky; top: var(--top); z-index: 2; }
.tbl th:first-child { border-top-left-radius: var(--r-l); }
.tbl th:last-child { border-top-right-radius: var(--r-l); }
.tbl td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr { cursor: pointer; }
.tbl tbody tr:hover td { background: var(--hover); }
.tbl .c-client b { font-weight: 600; display: block; }
.tbl .c-client small, .tbl .c-sub small { display: block; color: var(--ink-3); font-size: 12.5px; }
.tbl .c-sub { max-width: 280px; }
.tbl .c-sub span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tbl .c-next { min-width: 170px; }
.tbl .c-next b { font-weight: 500; display: block; }
.tbl .c-dim { color: var(--ink-3); white-space: nowrap; font-size: 13px; }
.tbl.is-compact td { padding-top: 6px; padding-bottom: 6px; }
.tbl.is-compact .c-client small, .tbl.is-compact .c-sub small, .tbl.is-compact .c-next small { display: none; }
.due { font-size: 12.5px; display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; color: var(--ink-3); }
.due.is-late { color: var(--red); font-weight: 500; }
.due.is-today { color: var(--accent-text); font-weight: 500; }
.no-next { color: var(--ink-4); font-size: 13px; }
.att-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--tone); margin-right: 6px; vertical-align: 1px; }
@media (max-width: 860px) {
  .tbl thead { display: none; }
  .tbl, .tbl tbody, .tbl tr, .tbl td { display: block; }
  .tbl tr { padding: 12px 14px; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 1fr auto; gap: 3px 10px; }
  .tbl tr:last-child { border-bottom: 0; }
  .tbl td { padding: 0; border: 0; }
  .tbl td.c-num { display: none; }
  .tbl td.c-client { grid-column: 1; }
  .tbl td.c-status { grid-column: 2; grid-row: 1; text-align: right; }
  .tbl td.c-sub { grid-column: 1 / -1; max-width: none; }
  .tbl td.c-next { grid-column: 1 / -1; min-width: 0; margin-top: 4px; }
  .tbl td.c-dim { display: none; }
  .tbl td.c-when { display: block; grid-column: 1 / -1; font-size: 12px; }
  .tbl .c-client small { display: inline; margin-left: 6px; }
  .tbl tbody tr:hover td { background: none; }
}

/* ---------- карточка заявки ---------- */
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--ink-3); font-size: 13px; font-weight: 500; align-self: flex-start; }
.back:hover { color: var(--ink); }
.lead-head { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.lead-head .grow { min-width: 240px; }
.lead-head h1 { font-size: 24px; }
.lead-meta { display: flex; gap: 6px 14px; flex-wrap: wrap; color: var(--ink-3); font-size: 13px; margin-top: 6px; align-items: center; }
.lead-subj { font-size: 15px; color: var(--ink-2); margin-top: 4px; }
.lead-head-r { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.qa { display: flex; gap: 6px; flex-wrap: wrap; padding: 10px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-l); }
.qa .sep { width: 1px; background: var(--line); margin: 4px 2px; }
@media (max-width: 720px) {
  .qa { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; border-radius: 0; border-left: 0; border-right: 0; padding: 10px 16px; }
  .qa::-webkit-scrollbar { display: none; }
  .qa .btn { flex: none; }
}

.banner { display: flex; gap: 10px; align-items: flex-start; padding: 11px 14px; border-radius: var(--r-l); border: 1px solid; font-size: 13.5px; }
.banner .ic { margin-top: 1px; }
.banner .grow b { font-weight: 600; }
.banner-red { background: var(--red-soft); border-color: var(--red-line); color: var(--red); }
.banner-amber { background: var(--amber-soft); border-color: transparent; color: var(--amber); }
.banner-blue { background: var(--blue-soft); border-color: transparent; color: var(--blue); }
.banner-slate { background: var(--slate-soft); border-color: transparent; color: var(--ink-2); }
.banner-violet { background: var(--violet-soft); border-color: transparent; color: var(--violet); }
.banner-green { background: var(--green-soft); border-color: transparent; color: var(--green); }
.banner .btn-row { margin-left: auto; }
@media (max-width: 720px) { .banner { flex-wrap: wrap; } .banner .btn-row { margin-left: 30px; } }

.lead-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 18px; align-items: start; }
@media (max-width: 1060px) {
  /* на телефоне: следующее действие → контакты и детали → история */
  .lead-grid { display: flex; flex-direction: column; align-items: stretch; }
  .lead-grid > .lead-col { display: contents; }
  [data-order="1"] { order: 1; }
  .lead-col[data-order="2"] > * { order: 2; }
  [data-order="3"] { order: 3; }
}
.lead-col { display: flex; flex-direction: column; gap: 18px; min-width: 0; }

.next-box { padding: 16px; display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.next-box .ic-box { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; flex: none; background: var(--accent-soft); color: var(--accent-text); }
.next-box.is-late .ic-box { background: var(--red-soft); color: var(--red); }
.next-box.is-none .ic-box { background: var(--sunken); color: var(--ink-3); }
.next-box .grow { min-width: 210px; }
.next-box .grow b { display: block; font-size: 15px; font-weight: 600; }
.next-box .grow small { color: var(--ink-3); font-size: 13px; }
.task-list { border-top: 1px solid var(--line); }
.task-i { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.task-i:last-child { border-bottom: 0; }
.task-i .grow b { font-weight: 500; display: block; }
.tick-btn { width: 22px; height: 22px; border-radius: 6px; border: 1.5px solid var(--line-2); background: var(--panel); display: grid; place-items: center; color: transparent; flex: none; padding: 0; }
.tick-btn:hover { border-color: var(--green); color: var(--green); }
.tick-btn.is-done { background: var(--green); border-color: var(--green); color: #fff; }

.dl { display: grid; grid-template-columns: minmax(96px, auto) 1fr; gap: 9px 14px; margin: 0; font-size: 13.5px; }
.dl dt { color: var(--ink-3); }
.dl dd { margin: 0; min-width: 0; overflow-wrap: anywhere; white-space: pre-line; }
.dl dd a { color: var(--accent-text); }
.side-list { display: flex; flex-direction: column; }
.side-item { display: flex; gap: 10px; align-items: center; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.side-item:last-child { border-bottom: 0; }
.side-item .grow b { font-weight: 500; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-item .grow small { color: var(--ink-3); font-size: 12px; display: block; }
.side-item.is-btn { cursor: pointer; }
.side-item.is-btn:hover { background: var(--hover); }
.calc-sum { font-weight: 600; white-space: nowrap; }
.tag { display: inline-flex; height: 19px; align-items: center; padding: 0 6px; border-radius: 4px; font-size: 11px; font-weight: 600; background: var(--sunken); color: var(--ink-3); white-space: nowrap; }
.tag-amber { background: var(--amber-soft); color: var(--amber); }
.tag-accent { background: var(--accent-soft); color: var(--accent-text); }

.composer { padding: 12px 16px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.composer .textarea { min-height: 44px; }
.composer .btn-row { justify-content: flex-end; }
.timeline { list-style: none; margin: 0; padding: 6px 0; }
.tl-day { padding: 12px 16px 4px; font-size: 11px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-4); }
.tl-i { display: grid; grid-template-columns: 28px 1fr auto; gap: 10px; padding: 8px 16px; align-items: start; }
.tl-ic { width: 28px; height: 28px; border-radius: 8px; background: var(--sunken); color: var(--ink-3); display: grid; place-items: center; }
.tl-i[data-t="status"] .tl-ic, .tl-i[data-t="created"] .tl-ic { background: var(--accent-soft); color: var(--accent-text); }
.tl-i[data-t="contact"] .tl-ic { background: var(--blue-soft); color: var(--blue); }
.tl-i[data-t="task_done"] .tl-ic { background: var(--green-soft); color: var(--green); }
.tl-i[data-t="calc"] .tl-ic { background: var(--indigo-soft); color: var(--indigo); }
.tl-i[data-t="repeat"] .tl-ic { background: var(--amber-soft); color: var(--amber); }
.tl-body { min-width: 0; padding-top: 4px; }
.tl-body .tl-t { font-weight: 500; }
.tl-body .tl-x { color: var(--ink-2); white-space: pre-wrap; overflow-wrap: anywhere; margin-top: 3px; font-size: 13.5px; }
.tl-body .tl-note { margin-top: 5px; background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--r); padding: 8px 10px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13.5px; }
.tl-when { font-size: 12px; color: var(--ink-4); padding-top: 5px; white-space: nowrap; text-align: right; }
.tl-when small { display: block; }

/* ---------- задачи ---------- */
.group-h { display: flex; align-items: center; gap: 8px; padding: 12px 16px 8px; border-bottom: 1px solid var(--line); background: var(--panel-2); }
.group-h:not(:first-child) { border-top: 1px solid var(--line); }
.group-h.is-late h3 { color: var(--red); }
.trow { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); align-items: center; }
.trow:last-child { border-bottom: 0; }
.trow .t-title { font-weight: 500; }
.trow .t-lead { font-size: 13px; color: var(--ink-3); margin-top: 2px; }
.trow .t-lead a:hover { color: var(--ink); text-decoration: underline; }
.trow .t-meta { display: flex; gap: 12px; margin-top: 4px; flex-wrap: wrap; }
.trow .t-actions { display: flex; gap: 6px; }
.trow.is-done .t-title { text-decoration: line-through; color: var(--ink-3); }
@media (max-width: 640px) { .trow { grid-template-columns: auto minmax(0, 1fr); } .trow .t-actions { grid-column: 2; } }

/* ---------- аналитика ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-l); padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; }
.stat .s-l { font-size: 12.5px; color: var(--ink-3); font-weight: 500; }
.stat .s-v { font-size: 26px; font-weight: 600; letter-spacing: -.02em; line-height: 1.15; }
.stat .s-v.is-na { font-size: 15px; color: var(--ink-3); font-weight: 500; padding: 7px 0 4px; }
.stat .s-s { font-size: 12.5px; color: var(--ink-3); }
.bars { display: flex; flex-direction: column; gap: 10px; }
.bar-r { display: grid; grid-template-columns: minmax(110px, 160px) 1fr auto; gap: 12px; align-items: center; font-size: 13px; }
.bar-r .b-l { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-t { height: 10px; background: var(--sunken); border-radius: 3px; overflow: hidden; }
.bar-t i { display: block; height: 100%; background: var(--ink-2); border-radius: 3px; }
.bar-t i.is-acc { background: var(--accent); }
.bar-r .b-v { font-weight: 600; min-width: 64px; text-align: right; white-space: nowrap; }
.bar-r .b-v small { font-weight: 400; color: var(--ink-3); margin-left: 4px; }
.an-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 900px) { .an-grid { grid-template-columns: 1fr; } }
.note-line { font-size: 12.5px; color: var(--ink-3); }

/* ---------- настройки ---------- */
.set-layout { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 24px; align-items: start; }
.set-nav { display: flex; flex-direction: column; gap: 2px; position: sticky; top: calc(var(--top) + 20px); }
.set-nav a { padding: 8px 12px; border-radius: var(--r); color: var(--ink-2); font-weight: 500; }
.set-nav a:hover { background: var(--hover); }
.set-nav a.is-on { background: var(--panel); box-shadow: 0 0 0 1px var(--line); color: var(--ink); }
@media (max-width: 860px) {
  .set-layout { grid-template-columns: 1fr; gap: 14px; }
  .set-nav { position: static; flex-direction: row; overflow-x: auto; scrollbar-width: none; }
  .set-nav a { white-space: nowrap; }
}
.set-sec { display: flex; flex-direction: column; gap: 18px; }
.set-row { display: flex; gap: 12px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.set-row:last-child { border-bottom: 0; }
.set-row .grow b { display: block; font-weight: 500; }
.set-row .grow small { color: var(--ink-3); font-size: 12.5px; display: block; }
.switch { position: relative; width: 38px; height: 22px; flex: none; }
.switch input { opacity: 0; width: 100%; height: 100%; margin: 0; position: absolute; cursor: pointer; z-index: 1; }
.switch i { position: absolute; inset: 0; border-radius: 11px; background: var(--line-2); transition: background .15s; }
.switch i::after { content: ''; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0, 0, 0, .25); }
.switch input:checked + i { background: var(--accent); }
.switch input:checked + i::after { transform: translateX(16px); }
.switch input:focus-visible + i { outline: 2px solid var(--accent); outline-offset: 2px; }
.code { font: 12.5px/1.5 var(--mono); background: var(--sunken); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--ink-2); }
.copy-row { display: flex; gap: 8px; align-items: center; }
.copy-row .input { font-family: var(--mono); font-size: 12.5px; }
.price-tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.price-tbl th { text-align: left; font-weight: 500; color: var(--ink-3); padding: 6px 6px; font-size: 12px; }
.price-tbl td { padding: 4px 6px; }
.price-tbl .input { height: 34px; padding: 0 8px; }
.tbl-wrap { overflow-x: auto; }
.status-on { color: var(--green); font-weight: 600; display: inline-flex; gap: 6px; align-items: center; }

/* ---------- модальные окна ---------- */
.modal-bg { position: fixed; inset: 0; z-index: 60; background: rgba(15, 16, 18, .45); display: flex; align-items: flex-start; justify-content: center; padding: 8vh 16px 16px; overflow-y: auto; animation: fade .15s ease; }
@keyframes fade { from { opacity: 0; } }
.modal { width: 100%; max-width: 520px; background: var(--panel); border-radius: 14px; box-shadow: var(--sh-pop); display: flex; flex-direction: column; animation: rise .18s ease; border: 1px solid var(--line); }
.modal-lg { max-width: 720px; }
@keyframes rise { from { transform: translateY(8px); opacity: 0; } }
.modal-h { display: flex; align-items: flex-start; gap: 10px; padding: 18px 20px 4px; }
.modal-h h2 { font-size: 17px; }
.modal-h p { color: var(--ink-3); font-size: 13px; margin-top: 3px; }
.modal-h .icon-btn { margin: -6px -8px 0 auto; }
.modal-b { padding: 14px 20px; display: flex; flex-direction: column; gap: 14px; }
.modal-f { padding: 12px 20px 18px; display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.modal-sec { display: flex; flex-direction: column; gap: 10px; padding-top: 14px; border-top: 1px dashed var(--line-2); }
.modal-sec > .label { margin-bottom: -2px; }
@media (max-width: 640px) {
  .modal-bg { padding: 0; align-items: flex-end; }
  .modal { max-width: none; border-radius: 16px 16px 0 0; max-height: 92vh; max-height: 92dvh; box-shadow: var(--sh-sheet); animation: sheet .22s ease; }
  .modal-b { overflow-y: auto; }
  .modal-f { padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
  .modal-f .btn { flex: 1; height: 44px; }
  @keyframes sheet { from { transform: translateY(40px); opacity: .4; } }
}

.when-pick { display: flex; flex-direction: column; gap: 8px; }
.when-pick .input { max-width: 240px; }

/* ---------- всплывающие меню ---------- */
.menu { position: fixed; z-index: 70; min-width: 210px; max-width: 300px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-l); box-shadow: var(--sh-pop); padding: 5px; animation: fade .1s ease; max-height: 70vh; overflow-y: auto; }
.menu button, .menu a { width: 100%; display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 0; background: none; border-radius: var(--r-s); text-align: left; font-size: 13.5px; color: var(--ink); }
.menu button:hover, .menu a:hover, .menu button:focus-visible { background: var(--hover); outline: none; }
.menu .is-danger { color: var(--red); }
.menu .is-current { font-weight: 600; }
.menu .m-sep { height: 1px; background: var(--line); margin: 5px 4px; }
.menu .m-head { padding: 8px 10px 6px; }
.menu .m-head b { display: block; }
.menu .m-head small { color: var(--ink-3); font-size: 12px; }
.menu .m-check { margin-left: auto; color: var(--accent-text); }

.notif-pop { position: fixed; z-index: 70; width: 360px; max-width: calc(100vw - 16px); background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-l); box-shadow: var(--sh-pop); overflow: hidden; }
.notif-pop .np-h { display: flex; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.notif-pop .np-list { max-height: 60vh; overflow-y: auto; }
.np-i { display: flex; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); align-items: flex-start; }
.np-i:last-child { border-bottom: 0; }
.np-i:hover { background: var(--hover); }
.np-i .np-ic { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; flex: none; background: var(--blue-soft); color: var(--blue); }
.np-i.is-task .np-ic { background: var(--red-soft); color: var(--red); }
.np-i .grow b { font-weight: 500; display: block; }
.np-i .grow small { color: var(--ink-3); font-size: 12px; display: block; }
.np-i.is-unread .grow b::after { content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); margin-left: 6px; vertical-align: 1px; }

/* ---------- уведомления ---------- */
.toasts { position: fixed; z-index: 80; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; width: 360px; max-width: calc(100vw - 32px); pointer-events: none; }
@media (max-width: 1023px) { .toasts { left: 16px; right: 16px; width: auto; max-width: none; bottom: calc(var(--tabbar) + 12px + env(safe-area-inset-bottom)); } }
.toast { pointer-events: auto; display: flex; gap: 12px; align-items: center; padding: 12px 14px; border-radius: var(--r-l); background: var(--dark-btn); color: var(--dark-btn-ink); box-shadow: var(--sh-pop); animation: rise .2s ease; font-size: 13.5px; }
.toast .grow p { opacity: .75; font-size: 12.5px; margin-top: 1px; }
.toast .t-act { background: none; border: 1px solid currentColor; border-radius: var(--r-s); padding: 5px 10px; font-size: 12.5px; font-weight: 600; color: inherit; opacity: .9; white-space: nowrap; }
.toast.is-err { background: var(--red); color: #fff; }
.toast.is-ok .ic { color: var(--green); }
:root[data-theme="dark"] .toast.is-ok .ic { color: #1a7a4c; }
.toast.out { opacity: 0; transform: translateY(6px); transition: .2s; }

/* ---------- вход ---------- */
.auth { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.auth-side { background: var(--dark-btn); color: var(--dark-btn-ink); padding: 40px 48px; display: flex; flex-direction: column; gap: 28px; position: relative; overflow: hidden; }
:root[data-theme="dark"] .auth-side { background: #1c1d20; color: var(--ink); }
.auth-side .brand-text b span { color: inherit; opacity: .7; }
.auth-side h1 { font-size: clamp(28px, 3.4vw, 42px); line-height: 1.1; letter-spacing: -.025em; max-width: 14ch; margin-top: auto; }
.auth-side p { opacity: .72; max-width: 44ch; font-size: 15px; }
.auth-flow { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0; max-width: 420px; margin-bottom: auto; }
.auth-flow li { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid rgba(127, 127, 127, .25); font-size: 14px; }
.auth-flow li span { font: 600 11px var(--mono); opacity: .55; width: 20px; }
.auth-flow li:last-child { border-bottom: 1px solid rgba(127, 127, 127, .25); }
.auth-side .stripe { position: absolute; right: -60px; top: -60px; width: 220px; height: 220px; border-radius: 50%; border: 28px solid var(--accent); opacity: .9; }
.auth-main { display: flex; align-items: center; justify-content: center; padding: 32px 20px; position: relative; }
.auth-card { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 18px; }
.auth-card h2 { font-size: 22px; }
.auth-card .alt { color: var(--ink-3); font-size: 13.5px; }
.auth-theme { position: absolute; top: 16px; right: 16px; }
.auth-demo { display: flex; flex-direction: column; gap: 6px; padding-top: 16px; border-top: 1px solid var(--line); text-align: center; }
@media (max-width: 860px) {
  .auth { grid-template-columns: 1fr; }
  .auth-side { padding: 22px 20px 26px; gap: 14px; }
  .auth-side h1 { font-size: 26px; margin-top: 8px; }
  .auth-flow, .auth-side .stripe { display: none; }
  .auth-main { align-items: flex-start; padding-top: 28px; }
}

/* ---------- калькулятор в карточке ---------- */
.calc-opts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.calc-opts.is-2 { grid-template-columns: repeat(2, 1fr); }
.calc-opt { text-align: left; padding: 10px 12px; border: 1px solid var(--line-2); border-radius: var(--r); background: var(--panel); }
.calc-opt b { display: block; font-weight: 600; font-size: 13.5px; }
.calc-opt small { color: var(--ink-3); font-size: 12px; }
.calc-opt:hover { border-color: var(--ink-3); }
.calc-opt.is-on { border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus); }
@media (max-width: 520px) { .calc-opts { grid-template-columns: 1fr; } .calc-opts.is-2 { grid-template-columns: 1fr 1fr; } }
.calc-result { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 12px 14px; background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--r); flex-wrap: wrap; }
.calc-result b { font-size: 20px; font-weight: 600; letter-spacing: -.01em; }
.range-row { display: flex; align-items: center; gap: 12px; }
.range-row input[type=range] { flex: 1; accent-color: var(--accent); }
.range-row output { font-weight: 600; min-width: 56px; text-align: right; }
.items-tbl { width: 100%; border-collapse: collapse; }
.items-tbl th { font-size: 12px; font-weight: 500; color: var(--ink-3); text-align: left; padding: 0 4px 6px; }
.items-tbl td { padding: 3px 4px; }
.items-tbl .input { height: 34px; padding: 0 8px; }
.items-tbl .c-qty { width: 76px; }
.items-tbl .c-unit { width: 70px; }
.items-tbl .c-price { width: 120px; }
.items-tbl .c-sum { width: 110px; text-align: right; font-weight: 500; white-space: nowrap; }
@media (max-width: 600px) {
  .items-tbl thead { display: none; }
  .items-tbl tr { display: grid; grid-template-columns: 1fr 1fr 1fr auto; gap: 6px; padding: 8px 0; border-bottom: 1px dashed var(--line-2); }
  .items-tbl td { padding: 0; }
  .items-tbl td.c-name { grid-column: 1 / -1; }
  .items-tbl .c-qty, .items-tbl .c-unit, .items-tbl .c-price { width: auto; }
  .items-tbl .c-sum { grid-column: 1 / 4; text-align: left; }
}
.calc-view dl { margin-top: 4px; }
