@font-face{font-family:'Golos Text';src:url('/static/fonts/GolosText.ttf') format('truetype');font-weight:400 900;font-style:normal;font-display:swap}
@font-face{font-family:'JetBrains Mono';src:url('/static/fonts/JetBrainsMono.ttf') format('truetype');font-weight:100 800;font-style:normal;font-display:swap}
/* TeleMetry CRM — фирменный стиль: уголь, горчица, слоновая кость. Плоская сетка, прямые углы. */
:root {
  --bg: #141414; --bg-2: #1B1B1A; --bg-3: #232321; --line: #2E2E2B; --line-2: #3A3A36;
  --ink: #F0EEE8; --ink-2: #C4C1B9; --muted: #A5A198; --gold: #A17D00; --gold-2: #C9A227; --gold-ink: #141414;
  --green: #6E9C71; --red: #C8644B; --blue: #5D8DAA; --warn: #D2A23A;
  --row-hover: #1F1F1D; --shadow: 0 18px 60px rgba(0,0,0,.55);
  --font: "Golos Text", "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #F0EEE8; --bg-2: #F7F6F2; --bg-3: #E7E4DC; --line: #DAD6CC; --line-2: #C9C4B8;
  --ink: #141414; --ink-2: #3D3B37; --muted: #727272; --gold: #8C6C00; --gold-2: #A17D00; --gold-ink: #F0EEE8;
  --green: #3F7A45; --red: #A9442D; --blue: #3B6F8F; --warn: #9C7300; --row-hover: #EBE8E0; --shadow: 0 18px 60px rgba(20,20,20,.18);
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--ink); font: 14px/1.45 var(--font); -webkit-font-smoothing: antialiased; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
.mono, .num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.num { text-align: right; white-space: nowrap; }
.muted { color: var(--muted); }
.gold { color: var(--gold-2); }
.red { color: var(--red); }
.green { color: var(--green); }
.hidden { display: none !important; }
.nowrap { white-space: nowrap; }
.sr { position: absolute; left: -9999px; }

/* ---------- каркас ---------- */
.app { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.side { border-right: 1px solid var(--line); background: var(--bg); position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; overflow-y: auto; }
.brand { padding: 22px 22px 18px; border-bottom: 1px solid var(--line); }
.wordmark { font-weight: 800; letter-spacing: .06em; font-size: 22px; line-height: .92; }
.wordmark .t { color: var(--gold); display: block; }
.wordmark .m { color: var(--muted); display: block; padding-left: 18px; }
.brand .product { margin-top: 10px; font: 11px/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.nav { padding: 10px 0 20px; flex: 1; }
.nav h6 { margin: 18px 22px 6px; font: 10px/1 var(--mono); letter-spacing: .16em; text-transform: uppercase; color: var(--muted); font-weight: 500; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 9px 22px; text-decoration: none; color: var(--ink-2); border-left: 2px solid transparent; }
.nav a:hover { background: var(--row-hover); color: var(--ink); }
.nav a.on { color: var(--ink); border-left-color: var(--gold); background: var(--bg-2); }
.nav a svg { width: 17px; height: 17px; flex: none; opacity: .85; }
.nav .badge { margin-left: auto; }
.side-foot { border-top: 1px solid var(--line); padding: 14px 22px; display: flex; align-items: center; gap: 10px; }
.avatar { width: 32px; height: 32px; display: grid; place-items: center; background: var(--bg-3); border: 1px solid var(--line-2); font: 600 12px/1 var(--mono); flex: none; }
.side-foot .who { min-width: 0; flex: 1; }
.side-foot .who b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-foot .who span { font-size: 12px; color: var(--muted); }

.main { min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 20; background: var(--bg); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; padding: 10px 28px; height: 58px; }
.top .burger { display: none; }
.gsearch { flex: 1; max-width: 520px; position: relative; }
.gsearch input { width: 100%; height: 38px; padding: 0 12px 0 36px; background: var(--bg-2); border: 1px solid var(--line); }
.gsearch svg { position: absolute; left: 11px; top: 11px; width: 16px; height: 16px; color: var(--muted); }
.gsearch .kbd { position: absolute; right: 10px; top: 9px; font: 11px/18px var(--mono); color: var(--muted); border: 1px solid var(--line-2); padding: 0 5px; }
.top .spacer { flex: 1; }
.iconbtn { width: 38px; height: 38px; display: grid; place-items: center; background: transparent; border: 1px solid transparent; cursor: pointer; position: relative; color: var(--ink-2); }
.iconbtn:hover { border-color: var(--line); color: var(--ink); }
.iconbtn svg { width: 18px; height: 18px; }
.iconbtn .dot { position: absolute; top: 6px; right: 6px; min-width: 16px; height: 16px; padding: 0 4px; background: var(--gold); color: var(--gold-ink); font: 600 10px/16px var(--mono); }
.content { padding: 26px 28px 60px; max-width: 1480px; width: 100%; }

/* ---------- заголовки страниц ---------- */
.ph { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.ph h1 { margin: 0; font-size: 28px; line-height: 1.1; font-weight: 700; letter-spacing: -.01em; }
.ph .sub { color: var(--muted); margin-top: 6px; }
.ph .eyebrow { font: 11px/1 var(--mono); letter-spacing: .16em; text-transform: uppercase; color: var(--gold-2); margin-bottom: 10px; }
.ph .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- кнопки и поля ---------- */
.btn { height: 36px; padding: 0 14px; border: 1px solid var(--line-2); background: var(--bg-2); cursor: pointer; display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.btn:hover { border-color: var(--ink-2); }
.btn svg { width: 16px; height: 16px; }
a.btn { text-decoration: none; color: inherit; }
.eyebrow { font: 11px/1 var(--mono); letter-spacing: .16em; text-transform: uppercase; color: var(--gold-2); }
.btn.primary { background: var(--gold); border-color: var(--gold); color: var(--gold-ink); font-weight: 600; }
.btn.primary:hover { background: var(--gold-2); border-color: var(--gold-2); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.ghost:hover { color: var(--ink); border-color: var(--line); }
.btn.danger { color: var(--red); }
.btn.sm { height: 28px; padding: 0 10px; font-size: 13px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
input.in, select.in, textarea.in { height: 36px; padding: 0 10px; background: var(--bg-2); border: 1px solid var(--line); width: 100%; outline: none; }
textarea.in { height: auto; padding: 9px 10px; resize: vertical; min-height: 84px; }
input.in:focus, select.in:focus, textarea.in:focus, .gsearch input:focus { border-color: var(--gold); outline: none; }
label.f { display: block; }
label.f > span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 5px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px 14px; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.check input { accent-color: var(--gold); width: 16px; height: 16px; }

/* ---------- фильтры ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; align-items: center; }
.filters .in { width: auto; min-width: 150px; }
.filters .search { flex: 1 1 260px; max-width: 380px; }
.filters form .in { width: 100%; min-width: 0; }
table.t td.name { min-width: 240px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { height: 30px; padding: 0 11px; border: 1px solid var(--line); background: transparent; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); font-size: 13px; }
.chip:hover { border-color: var(--line-2); color: var(--ink); }
.chip.on { border-color: var(--gold); color: var(--ink); background: color-mix(in srgb, var(--gold) 14%, transparent); }
.chip .n { font: 11px var(--mono); color: var(--muted); }

/* ---------- таблицы ---------- */
.tablewrap { border: 1px solid var(--line); overflow-x: auto; background: var(--bg); }
table.t { width: 100%; border-collapse: collapse; }
table.t th { text-align: left; font: 500 11px/1 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); padding: 12px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--bg); position: sticky; top: 0; }
table.t th.sortable { cursor: pointer; }
table.t th.sortable:hover { color: var(--ink); }
table.t th .arr { color: var(--gold-2); }
table.t td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t tbody tr.click { cursor: pointer; }
table.t tbody tr.click:hover td { background: var(--row-hover); }
table.t td.name b { font-weight: 600; }
table.t td.name .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.pager { display: flex; align-items: center; gap: 10px; padding: 12px 2px; color: var(--muted); font-size: 13px; }
.pager .spacer { flex: 1; }
.empty { padding: 48px 20px; text-align: center; color: var(--muted); }
.empty b { display: block; color: var(--ink); font-size: 16px; margin-bottom: 6px; }

/* ---------- метки ---------- */
.pill { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; font-size: 12px; border: 1px solid var(--line-2); white-space: nowrap; }
.pill i { width: 7px; height: 7px; display: inline-block; flex: none; }
.role { font: 10px/18px var(--mono); letter-spacing: .08em; text-transform: uppercase; padding: 0 6px; border: 1px solid var(--line-2); color: var(--ink-2); margin-right: 4px; white-space: nowrap; display: inline-block; }
.role.carrier { color: var(--blue); border-color: color-mix(in srgb, var(--blue) 45%, transparent); }
.role.supplier { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 45%, transparent); }
.tag { font-size: 11px; padding: 1px 6px; background: color-mix(in srgb, var(--gold) 18%, transparent); color: var(--gold-2); margin-left: 6px; white-space: nowrap; }
.tag.bad { background: color-mix(in srgb, var(--red) 16%, transparent); color: var(--red); }
.badge { font: 600 11px/18px var(--mono); min-width: 20px; height: 18px; padding: 0 6px; background: var(--gold); color: var(--gold-ink); text-align: center; }
.lock { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: 12px; }
.lock svg { width: 13px; height: 13px; }
.fresh { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.fresh i { width: 7px; height: 7px; display: inline-block; }

/* ---------- карточки статистики ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--line); margin-bottom: 22px; }
.kpi { padding: 18px 20px; border-right: 1px solid var(--line); min-width: 0; }
.kpi:last-child { border-right: 0; }
.kpi .l { font: 11px/1 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.kpi .v { font: 600 30px/1.1 var(--mono); margin-top: 12px; letter-spacing: -.02em; }
.kpi .v small { font-size: 14px; color: var(--muted); font-weight: 400; margin-left: 4px; }
.kpi .d { font-size: 12px; margin-top: 8px; color: var(--muted); }
.panel { border: 1px solid var(--line); margin-bottom: 22px; background: var(--bg); }
.panel > header { display: flex; align-items: baseline; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.panel > header h3 { margin: 0; font-size: 15px; font-weight: 600; }
.panel > header .muted { font-size: 12px; }
.panel > header .act { margin-left: auto; }
.panel .body { padding: 16px 18px; }
.cols { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 22px; }
.cols3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 12px; padding: 11px 18px; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.list li.click { cursor: pointer; }
.list li.click:hover { background: var(--row-hover); }
.list li .grow { flex: 1; min-width: 0; }
.list li .grow b { font-weight: 600; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list li .grow span { font-size: 12px; color: var(--muted); }
.bars { display: flex; align-items: flex-end; gap: 6px; height: 170px; padding-top: 10px; }
.bars .b { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; min-width: 0; }
.bars .b .col { width: 100%; background: var(--line-2); position: relative; min-height: 2px; }
.bars .b.cur .col { background: var(--gold); }
.bars .b .x { font: 10px/1 var(--mono); color: var(--muted); }
.bars .b .y { font: 10px/1 var(--mono); color: var(--ink-2); }
.stack { display: flex; height: 12px; margin: 6px 0 14px; }
.stack span { display: block; height: 100%; }
.legend { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 16px; font-size: 13px; }
.legend div { display: flex; align-items: center; gap: 8px; }
.legend i { width: 9px; height: 9px; display: inline-block; flex: none; }
.legend .n { margin-left: auto; font-family: var(--mono); color: var(--ink-2); }
.meter { height: 4px; background: var(--line); margin-top: 6px; }
.meter i { display: block; height: 100%; background: var(--gold); }

/* ---------- выезжающая карточка ---------- */
.scrim { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 40; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(820px, 100vw); background: var(--bg); border-left: 1px solid var(--line-2); z-index: 41; display: flex; flex-direction: column; box-shadow: var(--shadow); animation: slide .18s ease-out; }
@keyframes slide { from { transform: translateX(24px); opacity: .4; } to { transform: none; opacity: 1; } }
.drawer > header { padding: 20px 24px 0; border-bottom: 1px solid var(--line); }
.drawer .title { display: flex; align-items: flex-start; gap: 14px; }
.drawer .title h2 { margin: 0; font-size: 22px; line-height: 1.2; flex: 1; }
.drawer .title .meta { color: var(--muted); font-size: 13px; margin-top: 6px; }
.drawer .quick { display: flex; flex-wrap: wrap; gap: 10px; margin: 16px 0; align-items: center; }
.drawer .quick .in { width: auto; height: 32px; }
.tabs { display: flex; gap: 0; margin-top: 4px; overflow-x: auto; }
.tabs button { background: none; border: 0; border-bottom: 2px solid transparent; padding: 10px 14px; cursor: pointer; color: var(--ink-2); white-space: nowrap; display: inline-flex; gap: 6px; align-items: center; }
.tabs button.on { border-bottom-color: var(--gold); color: var(--ink); }
.tabs button .n { font: 11px var(--mono); color: var(--muted); }
.tabs button svg { width: 13px; height: 13px; }
.drawer .scroll { flex: 1; overflow-y: auto; padding: 22px 24px 40px; }
.facts { display: grid; grid-template-columns: 170px 1fr; border-top: 1px solid var(--line); }
.facts > div { padding: 10px 0; border-bottom: 1px solid var(--line); }
.facts > div:nth-child(odd) { color: var(--muted); font-size: 13px; padding-right: 12px; }
.facts .edit { width: 100%; }
.section-h { font: 11px/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin: 26px 0 10px; display: flex; align-items: center; gap: 10px; }
.section-h::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.locked { border: 1px dashed var(--line-2); padding: 26px; text-align: center; }
.locked svg { width: 26px; height: 26px; color: var(--gold-2); }
.locked h4 { margin: 10px 0 6px; font-size: 16px; }
.locked p { margin: 0 auto 14px; color: var(--muted); max-width: 420px; }
.contact { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 12px 0; border-bottom: 1px solid var(--line); align-items: center; }
.contact b { font-weight: 600; }
.contact .pos { color: var(--muted); font-size: 13px; }
.contact .phone { font-family: var(--mono); text-decoration: none; color: var(--gold-2); }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { display: grid; grid-template-columns: 34px 1fr; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.timeline .who { font-size: 12px; color: var(--muted); margin-bottom: 3px; }
.timeline .txt { white-space: pre-wrap; word-break: break-word; }
.timeline .ico { width: 30px; height: 30px; display: grid; place-items: center; border: 1px solid var(--line-2); font: 600 10px/1 var(--mono); color: var(--muted); }
.timeline .ico.call { color: var(--green); border-color: color-mix(in srgb, var(--green) 50%, transparent); }
.timeline .ico.imp { color: var(--muted); border-style: dashed; }
.composer { border: 1px solid var(--line); padding: 12px; margin-bottom: 18px; background: var(--bg-2); }
.composer textarea { border: 0; background: transparent; padding: 0; min-height: 60px; }
.composer textarea:focus { border: 0; }
.composer .row { display: flex; gap: 8px; align-items: center; margin-top: 8px; flex-wrap: wrap; }
.econ { border: 1px solid color-mix(in srgb, var(--gold) 40%, var(--line)); padding: 16px; background: color-mix(in srgb, var(--gold) 6%, transparent); }

/* ---------- модальные окна, тосты ---------- */
.modal { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; background: rgba(0,0,0,.55); padding: 16px; }
.modal .box { background: var(--bg); border: 1px solid var(--line-2); width: min(520px, 100%); box-shadow: var(--shadow); max-height: 90vh; overflow-y: auto; }
.modal .box header { padding: 18px 20px; border-bottom: 1px solid var(--line); font-weight: 600; font-size: 16px; }
.modal .box .body { padding: 18px 20px; display: grid; gap: 12px; }
.modal .box footer { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; }
.toasts { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 80; display: grid; gap: 8px; }
.toast { background: var(--ink); color: var(--bg); padding: 10px 16px; font-size: 13px; box-shadow: var(--shadow); }
.toast.err { background: var(--red); color: #fff; }
.pop { position: absolute; right: 0; top: 44px; width: 360px; background: var(--bg); border: 1px solid var(--line-2); box-shadow: var(--shadow); z-index: 30; max-height: 70vh; overflow-y: auto; }
.pop .item { padding: 12px 14px; border-bottom: 1px solid var(--line); font-size: 13px; cursor: pointer; }
.pop .item:hover { background: var(--row-hover); }
.pop .item.unread { border-left: 2px solid var(--gold); }
.pop .item time { display: block; color: var(--muted); font-size: 11px; margin-top: 3px; }

/* ---------- вход ---------- */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login .art { border-right: 1px solid var(--line); padding: 48px; display: flex; flex-direction: column; justify-content: space-between; background:
  linear-gradient(var(--line) 1px, transparent 1px) 0 0 / 100% 64px, linear-gradient(90deg, var(--line) 1px, transparent 1px) 0 0 / 64px 100%; }
.login .art .wordmark { font-size: 44px; }
.login .art .claim { font-size: 34px; line-height: 1.15; font-weight: 700; max-width: 560px; }
.login .art .claim em { font-style: normal; color: var(--gold-2); }
.login .art .facts2 { display: flex; gap: 36px; font: 12px var(--mono); color: var(--muted); }
.login .art .facts2 b { display: block; color: var(--ink); font-size: 22px; margin-bottom: 4px; }
.login form { align-self: center; justify-self: center; width: min(380px, 90vw); display: grid; gap: 14px; }
.login form h2 { margin: 0 0 6px; font-size: 24px; }
.login .err { color: var(--red); font-size: 13px; min-height: 18px; }

.kpis.k3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpis.k3 .kpi .v { font-size: 20px; }
/* ---------- демо ---------- */
.demo-pick { align-self: center; justify-self: center; width: min(460px, 92vw); display: grid; gap: 10px; padding-block: 32px; }
.demo-pick h2 { margin: 0; font-size: 26px; }
.persona { display: flex; gap: 14px; align-items: flex-start; text-align: left; padding: 14px 16px; border: 1px solid var(--line-2); background: var(--bg-2); cursor: pointer; color: var(--ink); }
.persona:hover, .persona:focus-visible { border-color: var(--gold); outline: none; }
.persona > span:last-child { display: grid; gap: 2px; min-width: 0; }
.persona small { color: var(--ink-2); font-size: 12px; line-height: 1.4; }

/* ---------- живой поиск и подсказки ---------- */
.gsearch .gpop { left: 0; right: auto; width: min(460px, 92vw); top: 44px; }
.pop .item b { font-weight: 600; }
.picker { position: relative; }
.picker .pop { left: 0; right: 0; width: auto; top: 62px; }
/* ---------- первый вход ---------- */
.gate { align-self: center; justify-self: center; width: min(440px, 92vw); padding-block: 32px; }
.gate-form { display: grid; gap: 14px; }
.gate h2 { margin: 0; font-size: 24px; text-wrap: balance; }
.key { font-size: 18px; letter-spacing: .08em; word-break: break-all; color: var(--gold-2); margin: 4px 0; }
.codes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; padding: 14px; border: 1px dashed var(--gold); background: color-mix(in srgb, var(--gold) 6%, transparent); }
.codes span { font-size: 15px; letter-spacing: .06em; }
/* ---------- доска заявок ---------- */
.board { display: grid; grid-template-columns: repeat(6, minmax(176px, 1fr)); gap: 12px; overflow-x: auto; padding-bottom: 8px; align-items: start; }
.col { background: var(--bg-2); border: 1px solid var(--line); min-height: 220px; display: flex; flex-direction: column; }
.col.over { border-color: var(--gold); background: color-mix(in srgb, var(--gold) 8%, var(--bg-2)); }
.col > header { display: flex; align-items: center; gap: 8px; padding: 11px 12px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--bg-2); font-size: 13px; }
.col > header i { width: 8px; height: 8px; display: inline-block; flex: none; }
.col .cards { display: grid; gap: 8px; padding: 10px; }
.dcard { background: var(--bg); border: 1px solid var(--line-2); padding: 11px 12px; display: grid; gap: 5px; cursor: pointer; min-width: 0; }
.dcard:hover { border-color: var(--ink-2); }
.dcard.stuck { border-left: 3px solid var(--red); }
.dcard.drag { opacity: .45; }
.dcard b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dcard .dtop, .dcard .dfoot { display: flex; align-items: center; gap: 6px; font-size: 12px; }
.dcard .tag { margin-left: 0; display: inline-flex; align-items: center; gap: 3px; }
.dcard .tag svg { width: 11px; height: 11px; }
.avatar.sm { width: 22px; height: 22px; font-size: 9px; }
.meter.big { height: 8px; }
/* ---------- шаги заявки ---------- */
.stepper { list-style: none; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 0; margin: 16px 0 6px; padding: 0; }
.stepper li { position: relative; }
.stepper li::before { content: ""; position: absolute; top: 7px; left: 0; right: 0; height: 2px; background: var(--line-2); }
.stepper li.done::before, .stepper li.cur::before { background: var(--gold); }
.stepper button { position: relative; background: none; border: 0; padding: 0 4px 0 0; display: grid; gap: 6px; justify-items: start; cursor: pointer; color: var(--muted); font-size: 12px; text-align: left; width: 100%; }
.stepper button[disabled] { cursor: default; }
.stepper .dot { width: 16px; height: 16px; border: 2px solid var(--line-2); background: var(--bg); }
.stepper li.done .dot { background: var(--gold); border-color: var(--gold); }
.stepper li.cur .dot { border-color: var(--gold); box-shadow: 0 0 0 3px color-mix(in srgb, var(--gold) 30%, transparent); }
.stepper li.cur button { color: var(--ink); font-weight: 600; }
.stepper li.done button { color: var(--ink-2); }
.stepper button:not([disabled]):hover { color: var(--ink); }
.calc { display: flex; gap: 14px; flex-wrap: wrap; align-items: baseline; padding: 10px 12px; border: 1px solid var(--line); background: var(--bg-2); min-height: 20px; }
.calc:empty { display: none; }
.weigh { display: inline-flex; gap: 4px; justify-content: flex-end; }
.weigh .in { width: 84px; height: 28px; padding: 0 6px; }
.funnel { display: grid; gap: 10px; }
.funnel > div { display: grid; grid-template-columns: 90px 1fr 30px; gap: 10px; align-items: center; font-size: 13px; }
.funnel .meter { margin: 0; height: 8px; }
/* ---------- дубли ---------- */
.duplist { display: grid; gap: 12px; }
.dpair { border: 1px solid var(--line); padding: 14px; display: grid; gap: 10px; }
.dwhy { display: flex; gap: 6px; align-items: center; }
.dwhy .tag { margin-left: 0; }
.dsides { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.dside { border: 1px solid var(--line-2); padding: 12px; min-width: 0; }
@media (max-width: 860px) {
  .board { grid-template-columns: repeat(6, 82vw); scroll-snap-type: x mandatory; }
  .col { scroll-snap-align: start; }
  .stepper { grid-template-columns: repeat(3, minmax(0, 1fr)); row-gap: 12px; }
  .dsides { grid-template-columns: 1fr; }
  .codes { grid-template-columns: 1fr 1fr; }
}
/* ---------- адаптив ---------- */
@media (max-width: 1100px) {
  .cols, .cols3 { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi:nth-child(2) { border-right: 0; }
  .kpi:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
}
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 50; width: 260px; left: 0; transform: translateX(-100%); transition: transform .18s; box-shadow: var(--shadow); }
  .side.open { transform: none; }
  .top { padding: 10px 16px; }
  .top .burger { display: grid; }
  .gsearch .kbd { display: none; }
  .content { padding: 18px 16px 60px; }
  .ph h1 { font-size: 24px; }
  .drawer { width: 100vw; }
  .drawer > header, .drawer .scroll { padding-left: 16px; padding-right: 16px; }
  .facts { grid-template-columns: 120px 1fr; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .login { grid-template-columns: 1fr; }
  .login .art { display: none; }
  .hide-m { display: none; }
  .filters .in { min-width: 0; flex: 1 1 140px; }
  .kpi .v { font-size: 24px; }
  .kpis.k3 { grid-template-columns: 1fr; }
  .kpis.k3 .kpi { border-right: 0; border-bottom: 1px solid var(--line); }
  .kpis.k3 .kpi:last-child { border-bottom: 0; }
}

/* ---------- рабочие экраны и быстрые действия ---------- */
button:focus-visible, a:focus-visible, summary:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--gold-2); outline-offset: 3px; }
[hidden] { display: none !important; }
.work-heading { margin-bottom: 26px; align-items: center; }
.work-heading h1 { font-size: 30px; }
.work-heading .sub { max-width: 620px; line-height: 1.6; }
.work-heading .actions { gap: 10px; }
.btn { border-radius: 5px; }
.btn.primary { min-height: 38px; }
.btn.sm.primary { min-height: 30px; }
.chip { text-decoration: none; border-radius: 4px; }
.chip svg { width: 15px; height: 15px; }
.chip i { width: 7px; height: 7px; display: inline-block; border-radius: 2px; }
.day-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 24px; }
.metric { display: flex; flex-direction: column; padding: 19px 18px 15px; border: 1px solid var(--line-2); border-radius: 7px; background: var(--bg-2); text-decoration: none; min-width: 0; transition: border-color .15s; }
.metric:hover { border-color: var(--gold-2); }
.metric-label { font-size: 13px; font-weight: 500; color: var(--ink-2); }
.metric strong { font: 600 clamp(23px, 2.4vw, 32px)/1.3 var(--mono); margin-block: 10px 14px; overflow-wrap: anywhere; }
.metric.urgent strong { color: var(--gold-2); }
.metric-hint { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12px; line-height: 1.4; color: var(--muted); margin-top: auto; }
.metric-hint > span { color: var(--gold-2); font-size: 17px; }
.work-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(290px, 1fr); gap: 20px; align-items: start; }
.work-grid > * { min-width: 0; }
.work-panel { border-radius: 7px; }
.work-panel > header { align-items: center; justify-content: space-between; padding: 17px 18px; gap: 10px; }
.work-panel header h3 { font-size: 16px; line-height: 1.35; }
.work-panel header p { margin: 5px 0 0; font-size: 12px; color: var(--muted); line-height: 1.5; }
.work-panel header > .btn { flex-shrink: 0; }
.work-list { list-style: none; margin: 0; padding: 0; }
.work-list > li { display: flex; gap: 10px; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.work-list > li:last-child { border-bottom: 0; }
.work-list > li:hover { background: var(--row-hover); }
.work-item { flex: 1 1 170px; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 0; color: var(--ink); text-align: left; border: 0; background: none; }
button.work-item { cursor: pointer; }
.work-item b { font-size: 14px; line-height: 1.45; overflow-wrap: anywhere; }
.work-item > span { color: var(--muted); font-size: 12px; line-height: 1.45; }
.work-list .pill { white-space: normal; height: auto; padding: 4px 7px; font-size: 11px; }
.attention { color: var(--red); border-color: color-mix(in srgb, var(--red) 45%, transparent); }
.quiet { display: grid; gap: 6px; padding: 21px 18px; color: var(--muted); font-size: 13px; line-height: 1.55; }
.quiet b { color: var(--ink-2); font-weight: 500; }
.plan-summary strong, .decision-summary strong { font: 600 28px/1.2 var(--mono); }
.plan-summary p, .decision-summary p { color: var(--muted); font-size: 13px; }
.plan-summary .meter { margin-top: 15px; }
.attention-strip { display: flex; align-items: center; gap: 14px; text-decoration: none; padding: 16px 18px; border: 1px solid color-mix(in srgb, var(--gold) 60%, var(--line)); background: color-mix(in srgb, var(--gold) 7%, var(--bg)); border-radius: 6px; margin-bottom: 22px; }
.attention-strip > svg { width: 24px; height: 24px; color: var(--gold-2); flex: none; }
.attention-strip > span:first-of-type { flex: 1; }
.attention-strip small { display: block; margin-top: 5px; color: var(--muted); }
.attention-strip > span:last-child { color: var(--gold-2); font-size: 13px; }
.text-button { background: none; border: 0; color: var(--ink); padding: 0; font: inherit; font-weight: 600; text-align: left; cursor: pointer; }
.text-button:hover { color: var(--gold-2); }
.weight-queue .weigh { margin-left: auto; }
.weight-queue .weigh .in { width: 85px; }
.work-table { border: 0; border-radius: 0 0 7px 7px; }
.work-table td:first-child { min-width: 190px; }
.work-table td:nth-child(2) { min-width: 200px; }
.work-table a { text-decoration-color: var(--line-2); text-underline-offset: 4px; }
.work-table .meter { max-width: 220px; margin-top: 8px; }
.sub { line-height: 1.5; }
.panel .empty { padding: 24px 18px; font-size: 13px; line-height: 1.55; }
.panel .empty b { font-size: 14px; }

/* ---------- фильтры и управляемые колонки ---------- */
.company-search { display: flex; align-items: start; gap: 14px; margin-bottom: 14px; }
.company-search .search { display: flex; flex: 1; gap: 8px; max-width: 600px; }
.company-search .column-chooser { margin-left: auto; }
.quick-filters { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.quick-filters .chip { display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 12px; }
.filter-divider { width: 1px; height: 22px; background: var(--line-2); margin: 0 3px; }
.advanced-filters { border: 1px solid var(--line); border-radius: 5px; margin-bottom: 18px; background: var(--bg-2); }
.advanced-filters > summary { padding: 11px 14px; cursor: pointer; color: var(--ink-2); font-size: 13px; }
.advanced-filters .filters { padding: 0 14px 14px; margin: 0; }
.filter-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.filter-fields label { min-width: 0; }
.filter-fields select.in { min-width: 0; width: 100%; }
.column-chooser { position: relative; flex: none; z-index: 15; }
.column-chooser > summary { cursor: pointer; list-style: none; }
.column-chooser > summary::-webkit-details-marker { display: none; }
.column-options { position: absolute; right: 0; top: calc(100% + 8px); width: 240px; padding: 10px; display: grid; gap: 2px; border: 1px solid var(--line-2); background: var(--bg-2); box-shadow: var(--shadow); border-radius: 6px; }
.column-options label { padding: 7px; font-size: 13px; }
.table-caption { display: flex; justify-content: space-between; gap: 12px; margin: 0 0 9px; font-size: 12px; color: var(--muted); }
.data-grid { max-height: 66vh; overflow: auto; border-radius: 5px; scrollbar-color: var(--line-2) var(--bg); }
.data-grid table.t { width: 100%; border-collapse: separate; border-spacing: 0; }
.data-grid table.t th { position: sticky; top: 0; z-index: 3; background: var(--bg-2); font: 500 12px/1.4 var(--font); text-transform: none; letter-spacing: 0; padding: 12px; white-space: nowrap; }
.data-grid table.t td { padding: 10px 12px; font-size: 13px; line-height: 1.4; }
.data-grid td:first-child, .data-grid th:first-child { position: sticky; left: 0; z-index: 2; min-width: 215px; max-width: 300px; background: var(--bg); border-right: 1px solid var(--line); }
.data-grid th:first-child { z-index: 4 !important; background: var(--bg-2) !important; }
.data-grid tbody tr:hover td { background: var(--row-hover); }
.data-grid td[data-col="owner"] { min-width: 130px; max-width: 165px; }
.data-grid td[data-col="next"] { min-width: 135px; }
.data-grid td.name b { font-size: 14px; }
.data-grid td .sub { font-size: 12px; color: var(--muted); margin-top: 4px; }
.data-grid .sub.red { color: var(--red); }
.shipment-grid td[data-col="route"], .shipment-grid td[data-col="carrier"] { min-width: 160px; max-width: 230px; overflow-wrap: anywhere; }
.shipment-grid td[data-col="product"] { min-width: 140px; max-width: 180px; }
.shipment-grid .weight-state { display: block; max-width: 105px; white-space: normal; font: 12px/1.4 var(--font); }
.route-line { line-height: 1.4; }
.shipment-filters .search { display: flex; flex: 1 1 280px; gap: 8px; }
.shipment-filters > select { flex: 1 1 160px; min-width: 0; max-width: 240px; }
.date-range { display: inline-flex; gap: 8px; align-items: center; font-size: 13px; color: var(--muted); }
.date-range .in { width: 150px; height: 32px; }
.filter-context { margin-bottom: 14px; font-size: 13px; color: var(--gold-2); }
.compact-kpis .kpi { padding: 14px 16px; }
.compact-kpis .kpi .v { font-size: 26px; }
.compact-kpis .kpi .l { font: 500 13px/1.4 var(--font); text-transform: none; letter-spacing: 0; }

/* ---------- карточка клиента ---------- */
.drawer header .quick { gap: 8px; }
.drawer .card-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.next-contact { gap: 8px; font-size: 12px; color: var(--ink-2); flex-wrap: wrap; }
.next-contact input.in { width: 150px; }
.aliases { font-size: 12px; color: var(--muted); margin-top: 7px; }
.aliases summary { cursor: pointer; }
.aliases > div { padding-top: 5px; }
.card-essentials { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; padding: 16px; background: var(--bg-2); border: 1px solid var(--line-2); border-radius: 6px; margin-bottom: 20px; }
.card-essentials > div { display: flex; flex-direction: column; gap: 7px; min-width: 0; font-size: 13px; }
.mini-label { font-size: 12px; color: var(--muted); }
.contact-phone { display: inline-flex; gap: 7px; align-items: center; font-size: 16px; font-weight: 600; text-decoration: none; }
.contact-phone svg { width: 17px; height: 17px; color: var(--gold-2); flex: none; }
.last-contact-note { overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; color: var(--ink-2); line-height: 1.5; }
.card-essentials + .kpis .kpi { padding: 14px; }
.drawer .scroll .section-h { font-size: 12px; letter-spacing: .04em; }
.drawer .composer .row { gap: 9px; }

@media (max-width: 1200px) {
  .work-grid { grid-template-columns: minmax(0, 1.3fr) minmax(280px, 1fr); }
  .day-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric { padding: 15px 16px 12px; }
  .metric strong { margin-block: 7px 10px; }
}
@media (max-width: 1000px) {
  .work-grid { grid-template-columns: 1fr; }
  .work-grid > div > .work-panel:last-child { margin-bottom: 0; }
  .work-grid > div { margin-bottom: 20px; }
}
@media (max-width: 600px) {
  .work-heading h1 { font-size: 25px; }
  .work-heading .actions { margin-left: 0; width: 100%; }
  .work-heading .btn { font-size: 12px; padding: 0 10px; }
  .day-metrics { gap: 8px; }
  .metric { padding: 13px 12px; }
  .metric-label { font-size: 12px; }
  .metric-hint { font-size: 11px; }
  .metric strong { font-size: 25px; }
  .work-list > li { padding: 13px 14px; }
  .work-panel > header { padding: 14px; }
  .work-panel > header h3 { font-size: 15px; }
  .attention-strip { flex-wrap: wrap; padding: 13px; }
  .company-search { flex-wrap: wrap; gap: 10px; }
  .company-search .search { flex-basis: 100%; }
  .company-search .column-chooser { margin-left: 0; }
  .company-search .column-options { right: auto; left: 0; }
  .quick-filters { gap: 6px; }
  .quick-filters .chip { font-size: 12px; padding: 0 9px; }
  .filter-divider { display: none; }
  .table-caption > span:last-child { display: none; }
  .data-grid td:first-child, .data-grid th:first-child { min-width: 155px; max-width: 180px; }
  .data-grid table.t td, .data-grid table.t th { padding: 10px; }
  .data-grid table.t td.name b { font-size: 13px; }
  .top { gap: 6px; }
  .top > .spacer { display: none; }
  .top .gsearch { min-width: 80px; }
  .top > .chip { max-width: 142px; white-space: normal; font-size: 11px; height: auto; min-height: 34px; padding: 5px 8px; }
  .top .iconbtn { width: 32px; flex: none; }
  .card-essentials { grid-template-columns: 1fr; gap: 14px; }
  .card-actions .btn { font-size: 12px; }
  .drawer > header { padding: 15px 16px 0; }
  .drawer .quick .chip { font-size: 11px; }
  .drawer .quick .next-contact { width: 100%; }
  .drawer .quick .next-contact input { margin-left: auto; }
  .drawer .tabs { margin-top: 12px; }
  .drawer .card-actions { margin-top: 10px; }
  .drawer > header h2 { font-size: 21px; }
}

/* Step 1: welcome and secure sign-in; existing CRM layout is preserved. */
.wordmark .agro-trade { padding-left: 3.05em; font-size: .72em; letter-spacing: .06em; }
.auth-screen { min-height:100dvh; background:#141414; color:#f0eee8; position:relative; overflow:hidden; --ink:#f0eee8; --muted:#a5a198; --line:#343431; --gold:#a17d00; --gold-2:#c9a227; --gold-ink:#141414; }
.auth-header { padding:40px 5vw; display:flex; justify-content:space-between; align-items:start; }
.agro-brand { font-weight:800; font-size:46px; line-height:.95; letter-spacing:.06em; width:max-content; }
.agro-brand span { display:block; color:#c9a227; }
.agro-brand span+span { color:#a5a198; font-size:.72em; padding-left:3.05em; padding-top:5px; }
.auth-languages { display:flex; align-items:center; gap:9px; color:#78776e; }
.auth-languages button { color:#a5a198; border:0; background:none; cursor:pointer; padding:7px; font:500 12px var(--mono); }
.auth-languages [aria-pressed="true"] { color:#d6b343; }
.auth-welcome { padding:clamp(60px,12vh,150px) 10vw 120px; transition:opacity .25s; }
.auth-welcome .eyebrow { color:#c9a227; }
.auth-welcome h1 { font-size:clamp(36px,5vw,72px); line-height:1.12; letter-spacing:-.035em; margin:26px 0; }
.auth-welcome h1 span { color:#c9a227; }
.auth-welcome p { font-size:18px; color:#a5a198; margin-bottom:40px; }
.auth-continue { min-width:235px; justify-content:space-between; height:54px; font-size:16px; }
.auth-footer { position:absolute; bottom:25px; left:5vw; color:#7b796f; font:11px var(--mono); }
.auth-panel { position:fixed; right:0; top:0; bottom:0; width:min(510px,100vw); background:#1b1b19; border-left:1px solid #343431; z-index:42; transform:translateX(100%); transition:transform .3s ease; overflow:auto; visibility:hidden; }
.is-open .auth-panel { transform:translateX(0); visibility:visible; }
.is-open .auth-welcome { opacity:.35; }
.auth-panel-body { min-height:100%; padding:100px 45px 50px; display:flex; flex-direction:column; justify-content:center; }
.auth-panel h2 { font-size:28px; line-height:1.2; margin:18px 0; }
.auth-panel p { line-height:1.55; }
.auth-close { position:absolute; right:24px; top:22px; color:#c4c1b9; background:none; border:1px solid #44443f; width:36px; height:36px; font-size:25px; cursor:pointer; }
.auth-shade { position:fixed; inset:0; background:#0004; z-index:41; }
.auth-form { display:grid; gap:18px; margin-top:18px; }
.auth-form .btn { min-height:46px; justify-content:center; }
.auth-screen input.in { background:#141414; color:#f0eee8; border-color:#44443f; min-height:46px; }
.auth-screen .err { color:#f2977e; min-height:18px; font-size:13px; }
.auth-help { font-size:12px; }
.auth-qr { display:block; width:232px; height:232px; padding:12px; background:white; margin:18px auto; }
.auth-screen .key { font-size:14px; overflow-wrap:anywhere; }
.auth-screen .codes { grid-template-columns:1fr 1fr; }
.auth-screen :focus-visible { outline:2px solid #d6b343; outline-offset:4px; }
.auth-header .auth-languages { position:relative; z-index:43; }
@media(max-width:600px) { .auth-header {padding:25px;} .agro-brand {font-size:36px;} .auth-panel-body {padding:110px 26px 40px;} .auth-welcome {padding:110px 26px 130px;} .auth-panel {width:100vw;} .auth-header .auth-languages {position:fixed;right:70px;top:26px;} .auth-screen.is-open .agro-brand {visibility:hidden;} }
@media(prefers-reduced-motion:reduce) { .auth-panel, .auth-welcome {transition:none;} }

/* Stage 2: keep the reference's dense, flat corporate composition. */
.app {grid-template-columns:250px minmax(0,1fr);}
.main {min-width:0;}
.content {max-width:1800px;padding:30px 32px 64px;}
.brand {padding:25px 22px;}
.brand .wordmark {font-size:28px;}
.powered {display:block;color:var(--muted);font-size:10px;margin-top:12px;letter-spacing:.02em;}
.side-foot .who {text-decoration:none;}
.side-foot .who b {white-space:normal;overflow:visible;line-height:1.4;}
.side-foot .who span {font-size:11px;white-space:normal;}
.nav a {padding-block:11px;min-height:44px;}
.top {gap:12px;}
.internal-languages .auth-languages {gap:2px;}
.internal-languages .auth-languages button {font-size:11px;color:var(--muted);}
.internal-languages .auth-languages [aria-pressed="true"] {color:var(--gold-2);}
.reference-kpis {grid-template-columns:repeat(4,minmax(0,1fr));margin-bottom:25px;}
.reference-kpis .kpi {display:block;text-decoration:none;min-width:0;padding:20px 22px;}
.reference-kpis .kpi:hover {background:var(--bg-2);}
.reference-kpis .l {font-size:11px;letter-spacing:.08em;line-height:1.5;}
.reference-kpis .v {font-size:36px;margin:12px 0;}
.reference-kpis .d {line-height:1.6;font-size:12px;}
.reference-grid {grid-template-columns:minmax(0,1.6fr) minmax(300px,1fr);}
.work-heading h1 {font-size:32px;}
.work-panel,.panel,.metric,.btn,.advanced-filters,.data-grid {border-radius:0;}
.metric {background:var(--bg);}
.work-panel header h3 {font-size:17px;}
.work-panel header p {font-size:12px;}
.work-list .work-item b {font-size:15px;white-space:normal;overflow:visible;text-overflow:clip;}
.work-list .work-item > span {font-size:13px;}
.reference-calls > li {padding:17px 20px;flex-wrap:nowrap;}
.reference-calls > li > .mono {flex:none;font-size:13px;}
.task-link {display:flex;justify-content:space-between;gap:16px;align-items:center;padding:13px 0;text-decoration:none;border-bottom:1px solid var(--line);line-height:1.5;}
.task-link:last-child {border:0;}
.task-link:hover {color:var(--gold-2);}
.task-link b {font-family:var(--mono);}
.tool-links {display:flex;flex-wrap:wrap;gap:10px;}
.user-note {white-space:pre-wrap;overflow-wrap:anywhere;}
.tablewrap {max-width:100%;overflow:auto;}
table.t td.name b, .deal .who, .kanban .name {white-space:normal;overflow:visible;text-overflow:clip;overflow-wrap:anywhere;}
.kcol {min-width:230px;}
.pop {max-height:min(65vh,520px);overflow:auto;max-width:calc(100vw - 32px);}
.toasts {max-width:min(420px,calc(100vw - 32px));pointer-events:none;bottom:20px;}
.toast {line-height:1.5;font-size:13px;}
.pill {line-height:1.5;}
@media(min-width:1201px){.day-metrics{grid-template-columns:repeat(4,minmax(0,1fr));}}
@media(min-width:1051px) and (max-width:1400px){.content{padding:25px 24px 60px;}.reference-kpis .kpi{padding:17px 15px;}.reference-kpis .v{font-size:31px;}.work-grid,.reference-grid{grid-template-columns:minmax(0,1.45fr) minmax(280px,1fr);}.gsearch{max-width:430px;}}
@media(min-width:1051px) and (max-width:1200px){.day-metrics{grid-template-columns:repeat(4,minmax(0,1fr));gap:0;}.metric{padding:15px 12px;}.metric-label{font-size:12px;}.work-heading h1{font-size:28px;}}
@media(max-width:1050px){.reference-grid{grid-template-columns:1fr;}.reference-kpis{grid-template-columns:repeat(2,minmax(0,1fr));}.reference-kpis .kpi{border-bottom:1px solid var(--line);}.content{padding:22px 20px 60px;}}
@media(max-width:860px){.app{grid-template-columns:minmax(0,1fr);}.internal-languages .auth-languages{position:static;}.top{padding:10px 12px;gap:5px;}.top .gsearch{min-width:0;}.top .gsearch input{font-size:12px;}.top .spacer{display:none;}.top .iconbtn{width:32px;flex-shrink:0;}.work-heading h1{font-size:26px;}}
@media(max-width:600px){.internal-languages .auth-languages{position:static;}.reference-calls>li{flex-wrap:wrap;}.reference-kpis .kpi{padding:15px;}.reference-kpis .v{font-size:29px;}}

.auth-account {display:grid;gap:5px;padding:12px 0;border-bottom:1px solid var(--line);}.auth-account .mono {font-size:12px;color:var(--gold-2);}
.auth-welcome .auth-continue {margin-top:26px;}

/* Stage 3B: existing dense layout, clearer controls and bounded responsive content. */
.brand .product { text-transform: none; line-height: 1.5; overflow-wrap: anywhere; }
.active-filters { display:flex; flex-wrap:wrap; gap:6px; margin:0 0 12px; }
.active-filters:empty { display:none; }
.active-filters .chip { height:auto; min-height:30px; white-space:normal; text-align:left; }
.quick-type { min-width:180px; }
.company-meta { display:grid !important; grid-template-columns:minmax(0,1fr) minmax(0,1fr); align-items:start !important; }
.company-meta .f { min-width:0; }
.company-meta .f .in { width:100% !important; }
.company-meta .next-contact { grid-column:1/-1; display:flex; flex-wrap:wrap; gap:10px; }
.identity-tags { display:flex; gap:5px; flex-wrap:wrap; margin-top:10px; }
.drawer .title h2,.work-item b,.t td b,.t td,.timeline .txt,.facts>div { overflow-wrap:anywhere; }
.t .num { overflow-wrap:normal; }
.t [data-col=role] { min-width:112px; }
.form-error { color:var(--red); padding:10px 12px; border:1px solid var(--red); margin:8px 0; font-size:13px; }
[aria-invalid=true] { border-color:var(--red) !important; }
.extra-fields,.logistics-details { border-top:1px solid var(--line); padding-top:12px; margin-top:12px; }
.extra-fields summary,.logistics-details summary { cursor:pointer; font-weight:600; margin-bottom:12px; }
.extra-fields small { line-height:1.5; }
[hidden] { display:none !important; }
.contact-card { display:block; border:1px solid var(--line); margin-bottom:12px; padding:14px; }
.contact-card header { display:flex; justify-content:space-between; gap:12px; align-items:start; }
.contact-card dl,.deal-summary dl { display:grid; grid-template-columns:minmax(100px,1fr) minmax(0,2fr); gap:8px 16px; margin:12px 0 0; font-size:13px; }
.contact-card dt,.deal-summary dt { color:var(--muted); }
.contact-card dd,.deal-summary dd { margin:0; overflow-wrap:anywhere; }
.contact-note { white-space:pre-wrap; }
.deal-summary { margin-bottom:16px; padding-bottom:14px; border-bottom:1px solid var(--line); }
.call-action { display:flex; flex-direction:column; gap:6px; align-items:flex-end; flex:none; }
.devices header { align-items:start; gap:12px; flex-wrap:wrap; }
.devices header h3 { margin:0; }
.devices header .sub { margin:6px 0 0; font-size:12px; }
.device-list li { display:flex; gap:12px; align-items:flex-start; }
.device-list li>svg { width:20px; height:20px; flex:0 0 20px; margin-top:3px; }
.device-list .grow { min-width:0; }
.device-list .grow span { white-space:normal; overflow-wrap:anywhere; line-height:1.6; }
.funnel>div { grid-template-columns:minmax(120px,1.5fr) minmax(60px,3fr) minmax(24px,auto); }
.funnel>div>span { overflow-wrap:anywhere; }
.work-heading .metric,.day-metrics .metric { min-width:0; }
.metric .metric-value { overflow-wrap:anywhere; }
.day-metrics .metric strong { font-size:clamp(20px,2.6vw,32px); line-height:1.15; }
.kpi .v { overflow-wrap:anywhere; }
.board .col>header { flex-wrap:wrap; min-height:46px; gap:6px; }
.board .col>header b { overflow-wrap:anywhere; }
.dcard h4,.dcard .dprod { white-space:normal; overflow-wrap:anywhere; }
.stepper { flex-wrap:wrap; row-gap:12px; }
.stepper li { min-width:90px; }
.stepper button { white-space:normal; }
.modal .box { max-height:calc(100dvh - 32px); }
.modal .body { overflow:auto; }
@media(max-width:700px) {
 .brand .product { letter-spacing:.08em; }
 .company-meta { grid-template-columns:minmax(0,1fr); }
 .drawer>header { max-height:56dvh; overflow-y:auto; flex-shrink:0; }
 .drawer .quick .next-contact { width:auto; }
 .drawer .card-actions .btn { white-space:normal; height:auto; min-height:34px; }
 .contact-card dl,.deal-summary dl { grid-template-columns:minmax(80px,1fr) minmax(0,1.7fr); gap:8px; }
 .device-list li { flex-wrap:wrap; }
 .device-list .grow { flex:1 1 180px; }
 .device-list .btn { margin-left:32px; }
 .funnel>div { grid-template-columns:minmax(112px,1.5fr) minmax(40px,2fr) 24px; gap:8px; }
 .reference-calls li { flex-wrap:wrap; }
 .reference-calls .work-item { flex:1 1 160px; }
 .call-action { flex-direction:row; align-items:center; justify-content:space-between; flex:1 1 100%; }
 .cols,.cols3,.grid3 { grid-template-columns:minmax(0,1fr); }
 .ph .actions { width:100%; margin-left:0; }
}
.brand .product { letter-spacing:.06em; white-space:nowrap; font-size:11px; }
.reference-calls .work-item>span { display:-webkit-box; -webkit-box-orient:vertical; -webkit-line-clamp:2; overflow:hidden; }
.dcard>b { white-space:normal; overflow:visible; text-overflow:clip; overflow-wrap:anywhere; }
.dcard>.muted { overflow-wrap:anywhere; }
.pick-res button.item { width:100%; display:block; text-align:left; background:transparent; border:0; color:inherit; cursor:pointer; }
.stepper { grid-template-columns:repeat(3,minmax(0,1fr)); gap:10px 0; }
@media(min-width:900px) { .stepper { grid-template-columns:repeat(6,minmax(0,1fr)); } }
@media(max-width:700px) { .stepper li { min-width:0; } .brand .product { letter-spacing:.06em; } }
.metric-hint svg { width:18px; height:18px; flex:none; }
/* Existing drawers and panels carry the complete role handoff, without a separate design. */
.workflow-section {margin-top:18px;}
.workflow-section>header {gap:12px;flex-wrap:wrap;}
.workflow-section .body {padding:16px;}
.workflow-section .work-list>li {align-items:flex-start;}
.workflow-steps {display:flex;gap:10px;flex-wrap:wrap;margin:12px 0;font-size:12px;color:var(--muted);}
.rule-label {font-size:12px;padding:10px 12px;border:1px solid var(--line);color:var(--muted);line-height:1.5;}
.trip-card {display:block !important;}
.trip-card .work-item {margin-bottom:10px;}
.trip-actions {display:flex;flex-wrap:wrap;gap:6px;}
.identity-warning:empty {display:none;}
.identity-warning {border:1px solid var(--gold);padding:12px;margin-bottom:12px;font-size:13px;}
.identity-warning>div {display:grid;gap:6px;margin:8px 0;}
.identity-warning small {color:var(--muted);}
.role-company {border-bottom:1px solid var(--line);padding:12px 0;}
.role-company h3 {font-size:14px;margin:0 0 8px;}
.role-company p {white-space:pre-wrap;overflow-wrap:anywhere;margin:4px 0 10px;}
.environment-banner {background:color-mix(in srgb,var(--gold) 12%,var(--bg));border-bottom:1px solid var(--line);color:var(--gold-2);font-size:12px;padding:9px 28px;}
.demo-mark {font-size:11px;color:var(--gold-2);margin:0 12px;}
@media(max-width:700px){.workflow-section .work-list>li {padding:12px;}.workflow-section .grid2 {grid-template-columns:1fr;}.environment-banner {padding:9px 16px;}.auth-header {flex-wrap:wrap;}}

/* Pilot polish: clear read-only statuses, separate permission levels and concise help. */
a.kpi, .kpi a { text-decoration:none; color:inherit; }
a.kpi:hover { background:var(--bg-2); }
a.kpi:focus-visible, .dcard:focus-visible { outline:2px solid var(--gold); outline-offset:-2px; }
.board { grid-template-columns:repeat(6,minmax(180px,1fr)); }
.dcard { gap:8px; line-height:1.45; text-decoration:none; }
.dcard .dtop, .dcard .dfoot { flex-wrap:wrap; row-gap:7px; }
.purchase-controls { display:grid; gap:14px; min-width:180px; max-width:360px; }
.purchase-statuses { display:grid; gap:6px; color:var(--ink-2); font-size:12px; }
.purchase-status { display:flex; align-items:baseline; gap:7px; }
.purchase-status::before { content:'•'; color:var(--gold); }
.purchase-actions { display:flex; flex-wrap:wrap; gap:8px; }
.purchase-actions:empty { display:none; }
.contact-permissions { margin-top:20px; padding:14px 16px; background:var(--bg-2); border-left:2px solid var(--gold); }
.contact-permissions h4 { margin:0 0 12px; }
.permission-grid { display:grid; grid-template-columns:minmax(120px,1fr) 2fr; gap:8px 20px; margin:0; font-size:13px; }
.permission-grid dt { color:var(--muted); }.permission-grid dd { margin:0; }
.workflow-rules { display:grid; gap:18px; }
.workflow-rules fieldset { border:1px solid var(--line); padding:16px; margin:0; min-width:0; }
.workflow-rules legend { color:var(--gold); padding:0 8px; font-size:13px; }
.rule-field { display:grid; align-content:start; gap:8px; min-width:0; }
.rule-field-title { display:flex; align-items:start; gap:8px; font-size:13px; }
.rule-field-title>span { flex:1; }
.rule-hint { position:relative; flex:none; }
.rule-hint summary { list-style:none; width:22px; height:22px; display:grid; place-items:center; border:1px solid var(--gold); color:var(--gold); border-radius:50%; cursor:pointer; font-size:13px; }
.rule-hint summary::-webkit-details-marker { display:none; }
.rule-hint summary:focus-visible { outline:2px solid var(--gold); outline-offset:3px; }
.rule-hint p { position:absolute; right:0; top:20px; width:min(320px,70vw); z-index:5; padding:14px; background:var(--bg-2); border:1px solid var(--line-2); box-shadow:var(--shadow); color:var(--ink); line-height:1.6; font-size:13px; }
.rules-warning { padding:12px; border-left:2px solid var(--gold); background:var(--bg-2); font-size:13px; line-height:1.6; }
@media(max-width:860px){.board{grid-template-columns:repeat(6,minmax(210px,82vw));}.purchase-controls{min-width:0;max-width:none;width:100%;}.permission-grid{grid-template-columns:1fr;gap:5px;}.permission-grid dd{margin-bottom:8px;}}

.purchase-actions .btn.ghost { border:1px solid var(--line-2); background:var(--bg-2); }
.purchase-actions .btn.ghost:hover { border-color:var(--gold); }
.workflow-steps>span { display:inline-flex; align-items:center; gap:5px; white-space:nowrap; }
.workflow-steps svg { width:17px; height:17px; flex:none; }
.contact-grant-form { display:flex; align-items:center; flex-wrap:wrap; gap:10px; margin-top:12px; }
.contact-grant-form select { flex:1 1 200px; min-width:0; }

/* Agreed deal stage rail, variant A. One rail; state is read from the real stage. */
.deal-progress {display:grid;grid-template-columns:repeat(6,minmax(0,1fr));list-style:none;margin:18px 0 16px;padding:0;isolation:isolate;}
.deal-progress>li {position:relative;display:grid;grid-template-rows:20px auto;justify-items:center;gap:9px;padding:26px 3px 0;text-align:center;min-width:0;}
.deal-progress>li::before {content:'';position:absolute;top:35px;height:2px;left:0;width:100%;background:var(--line-2);z-index:-1;}
.deal-progress>li:first-child::before {left:50%;width:50%;}
.deal-progress>li:last-child::before {width:50%;}
.deal-progress>li.is-done::before {background:var(--green);}
.deal-progress>li.is-current::before {background:linear-gradient(to right,var(--green) 50%,var(--line-2) 50%);}
.deal-progress>li.is-current:first-child::before {background:var(--line-2);}
.progress-node {width:20px;height:20px;display:grid;place-items:center;border:2px solid var(--line-2);background:var(--bg);border-radius:50%;font-size:12px;line-height:1;color:var(--muted);}
.is-done>.progress-node {border-color:var(--green);background:var(--green);color:var(--bg);font-weight:700;}
.is-current>.progress-node {border-color:var(--gold);background:var(--gold);box-shadow:0 0 0 4px color-mix(in srgb,var(--gold) 12%,transparent);}
.progress-label {font-size:12px;line-height:1.4;overflow-wrap:anywhere;color:var(--muted);}
.is-done>.progress-label {color:var(--green);}.is-current>.progress-label {color:var(--gold);font-weight:600;}
.progress-truck {position:absolute;top:0;left:50%;transform:translateX(-50%);height:19px;color:var(--gold);}
.progress-truck svg {width:22px;height:19px;}
.trip-actions {display:flex;flex-wrap:wrap;gap:8px;align-items:flex-start;}
@media(max-width:600px){.deal-progress>li{padding-left:2px;padding-right:2px;}.progress-label{font-size:10px;}.progress-node{width:16px;height:16px;font-size:10px;margin-top:2px;}.deal-progress{margin-inline:-8px;}}

.codes {grid-template-columns:repeat(auto-fit,minmax(min(100%,190px),1fr));}.codes span {overflow-wrap:anywhere;}

.procurement-summary p {margin:0 0 12px;font-size:13px;}.logistics-brief {display:grid;gap:18px;}.logistics-brief article+article{border-top:1px solid var(--line);padding-top:14px;}.logistics-brief h4{margin:0 0 12px;}.logistics-brief dd{overflow-wrap:anywhere;}

.purchase-registry .t {min-width:920px;table-layout:fixed;}
.purchase-registry th:nth-child(1){width:95px;}.purchase-registry th:nth-child(2){width:190px;}.purchase-registry th:nth-child(3){width:175px;}.purchase-registry th:nth-child(4){width:85px;}.purchase-registry th:nth-child(5){width:165px;}.purchase-registry th:nth-child(6){width:110px;}.purchase-registry th:nth-child(7){width:120px;}
.purchase-registry td:first-child,.purchase-registry td:nth-child(6){white-space:nowrap;overflow-wrap:normal;}
.registry-scroll-hint{font-size:12px;display:none;}@media(max-width:1000px){.registry-scroll-hint{display:block;}}
.registry-details {
  display: grid;
  grid-template-columns: minmax(9rem, 1fr) minmax(0, 2fr);
  gap: .6rem 1rem;
}
.registry-details dd {
  margin: 0;
  overflow-wrap: anywhere;
}
.registry-details dt { color: var(--muted); }
.legal-notes .user-note { white-space: pre-wrap; overflow-wrap: anywhere; }
.legal-guidance {
  grid-column: 1 / -1;
  min-width: 0;
  padding: .8rem 1rem;
  border: 1px solid var(--border, #45403a);
  border-radius: .55rem;
}
.legal-guidance .legal-contract { margin-bottom: .8rem; }
.legal-contract [data-contract-status] { color: var(--muted); }
.legal-guidance .legal-notes { margin-top: .35rem; }
@media (max-width: 520px) {
  .registry-details { grid-template-columns: 1fr; }
  .registry-details dd { margin-bottom: .65rem; }
}
