/* Мини-CRM — по брендбуку S-Platform / Smart Order AI (brand/BRAND.md):
   Cloud #F5F3EF — фон, Ink #0E0F11 — текст и выбранное, Terracotta #C2511E — ТОЛЬКО действие (главная кнопка) и марка,
   Amber #E8763F — тёплые подсветки. Шрифты: Space Grotesk — интерфейс (у него нет кириллицы → кириллица Manrope, как на лендинге),
   JetBrains Mono — данные, подписи, метаданные (мелко, капсом). Статусы компании — смысловые цвета, отдельно от акцента:
   не начали — серый, в работе — жёлтый, пилот — синий, в проде — зелёный, стоп — красный. */
:root {
  --bg: #F5F3EF; --panel: #FFFFFF; --sunk: #ECE8E1; --head: #FAF8F5; --hover: #F3F0EB;
  --line: #E2DDD5; --line2: #EEEAE4; --field: #D8D2C8;
  --ink: #0E0F11; --ink2: #2B2D31; --muted: #6B6760;
  --acc: #C2511E; --acc-d: #A4441A; --acc-soft: #F7E4D9; --amber: #E8763F;
  --sel-soft: #E8E4DD;
  --red: #B42318; --red-dot: #D92D20; --red-soft: #FDE8E7;
  --s-new: #57534D; --s-new-dot: #A39E95; --s-new-soft: #EEEBE5;
  --s-work: #8A5A00; --s-work-dot: #E0A100; --s-work-soft: #FCF0CF;
  --s-pilot: #1E4FA8; --s-pilot-dot: #2F6FDB; --s-pilot-soft: #E4ECFB;
  --s-prod: #146C43; --s-prod-dot: #22A55B; --s-prod-soft: #DFF2E6;
  --s-stop: var(--red); --s-stop-dot: var(--red-dot); --s-stop-soft: var(--red-soft);
  --shadow: 0 10px 30px rgba(14, 15, 17, .12); --r: 10px;
  --ui: 'Space Grotesk', 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 13.5px/1.45 var(--ui); -webkit-font-smoothing: antialiased; }
a { color: var(--ink); text-decoration-color: var(--acc); text-underline-offset: 2px; } a:hover { color: var(--acc-d); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.muted { color: var(--muted); }
.grow { flex: 1; }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--acc); outline-offset: 1px; }
.mono, .t th, .grp, .feed .meta, .vtabs small, .col h3 small, .tabnum { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* кнопки и поля */
.btn { height: 34px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--field); background: var(--panel); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; text-decoration: none; color: var(--ink); font-weight: 500; }
.btn:hover { background: var(--hover); color: var(--ink); }
.btn.pri { background: var(--acc); border-color: var(--acc); color: #fff; font-weight: 600; } .btn.pri:hover { background: var(--acc-d); border-color: var(--acc-d); color: #fff; }
.btn:disabled { opacity: .6; cursor: progress; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--hover); }
.btn.sm { height: 28px; padding: 0 9px; font-size: 12.5px; }
.btn.dng { color: var(--red); border-color: #EBC0BB; } .btn.dng:hover { background: var(--red-soft); color: var(--red); }
.inp, .sel, textarea.inp { height: 34px; border: 1px solid var(--field); border-radius: 8px; padding: 0 10px; background: var(--panel); min-width: 0; }
.inp:focus, .sel:focus { border-color: var(--ink2); outline: none; box-shadow: 0 0 0 3px var(--sel-soft); }
textarea.inp { height: auto; min-height: 70px; padding: 8px 10px; resize: vertical; width: 100%; }
.sel { padding: 0 6px; }
label.fl { display: flex; flex-direction: column; gap: 5px; color: var(--muted); font: 500 10.5px/1.3 var(--mono); text-transform: uppercase; letter-spacing: .05em; }
label.fl .inp, label.fl .sel, label.fl textarea { color: var(--ink); font: 13.5px/1.45 var(--ui); text-transform: none; letter-spacing: 0; }

/* шапка */
.top { position: sticky; top: 0; z-index: 30; display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 8px 18px; min-height: 56px; background: var(--panel); border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: 17px; letter-spacing: .02em; color: var(--ink); text-decoration: none; }
.brand img { width: 24px; height: 24px; display: block; }
.brand:hover { color: var(--ink); }
.tabs { display: flex; flex-wrap: wrap; gap: 2px; }
.tabs a { padding: 7px 12px; border-radius: 8px; color: var(--ink2); text-decoration: none; font-weight: 500; }
.tabs a:hover { background: var(--hover); color: var(--ink); }
.tabs a.on { background: var(--ink); color: #fff; font-weight: 600; }
.search input { height: 34px; width: 240px; max-width: 60vw; border: 1px solid var(--line); border-radius: 8px; padding: 0 10px; background: var(--bg); }
.search input:focus { background: var(--panel); border-color: var(--ink2); outline: none; }
.me { position: relative; }
.menu { position: absolute; right: 0; top: 40px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 6px; min-width: 180px; display: flex; flex-direction: column; z-index: 40; }
.menu button, .menu a { text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: 6px; cursor: pointer; color: var(--ink); text-decoration: none; }
.menu button:hover, .menu a:hover { background: var(--hover); color: var(--ink); }

.view { padding: 14px 18px 40px; display: flex; flex-direction: column; gap: 12px; }
.loading, .empty { padding: 30px; color: var(--muted); text-align: center; }
.bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; }

/* виды-вкладки */
.vtabs { display: flex; flex-wrap: wrap; gap: 2px; border-bottom: 1px solid var(--line); }
.vtabs button { border: 0; background: none; padding: 9px 11px; cursor: pointer; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; display: inline-flex; align-items: center; gap: 6px; }
.vtabs button:hover { color: var(--ink); }
.vtabs button.on { color: var(--ink); border-bottom-color: var(--ink); }
.vtabs button small { color: var(--muted); font-weight: 400; font-size: 11px; }
.chip { height: 30px; border: 1px solid var(--field); background: var(--panel); border-radius: 15px; padding: 0 12px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.chip:hover { background: var(--hover); }
.chip.on { border-color: var(--ink); background: var(--ink); color: #fff; font-weight: 600; }

/* статус компании: точка + плашка */
.dot { width: 10px; height: 10px; border-radius: 5px; display: inline-block; flex: none; }
.dot.new { background: var(--s-new-dot); } .dot.work { background: var(--s-work-dot); } .dot.pilot { background: var(--s-pilot-dot); }
.dot.prod { background: var(--s-prod-dot); } .dot.stop { background: var(--s-stop-dot); }
.st, select.stsel { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 11px; font-size: 12px; font-weight: 600; white-space: nowrap; }
select.stsel { border: 0; padding: 2px 6px; cursor: pointer; }
.st.new, .stsel.new { background: var(--s-new-soft); color: var(--s-new); }
.st.work, .stsel.work { background: var(--s-work-soft); color: var(--s-work); }
.st.pilot, .stsel.pilot { background: var(--s-pilot-soft); color: var(--s-pilot); }
.st.prod, .stsel.prod { background: var(--s-prod-soft); color: var(--s-prod); }
.st.stop, .stsel.stop { background: var(--s-stop-soft); color: var(--s-stop); }
.seg { display: inline-flex; border: 1px solid var(--field); border-radius: 9px; overflow: hidden; background: var(--panel); }
.seg button { border: 0; background: var(--panel); padding: 7px 12px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; color: var(--ink2); }
.seg button:hover { background: var(--hover); }
.seg button + button { border-left: 1px solid var(--field); }
.seg button.on { background: var(--ink); color: #fff; font-weight: 600; }

/* продукты-фишки */
.pc { display: inline-block; padding: 1px 7px; border-radius: 6px; font-size: 11px; font-weight: 600; white-space: nowrap; color: #fff; }
.pcs { display: inline-flex; flex-wrap: wrap; gap: 4px; }

/* таблица */
.tbox { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; min-width: 820px; }
.t th { text-align: left; color: var(--muted); font-size: 10.5px; font-weight: 500; text-transform: uppercase; letter-spacing: .05em; padding: 10px 8px; background: var(--head); border-bottom: 1px solid var(--line); white-space: nowrap; position: sticky; top: 0; cursor: pointer; user-select: none; }
.t th:hover { color: var(--ink); }
.t td { padding: 7px 8px; border-top: 1px solid var(--line2); vertical-align: middle; }
.t tr:hover td { background: #FBFAF7; }
.t td.nm a { font-weight: 600; color: var(--ink); text-decoration: none; } .t td.nm a:hover { color: var(--acc-d); text-decoration: underline; }
.t select.sel { height: 28px; font-size: 12.5px; }
.ava { width: 22px; height: 22px; border-radius: 11px; background: #A39E95; color: #fff; font-size: 10.5px; font-weight: 700; display: inline-grid; place-items: center; flex: none; }
.foot { color: var(--muted); font-size: 12.5px; }

/* воронка */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(220px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 6px; align-items: start; }
.col { background: var(--sunk); border-radius: 12px; padding: 10px; display: flex; flex-direction: column; gap: 8px; min-height: 140px; }
.col.over { outline: 2px dashed var(--acc); }
.col h3 { margin: 0; font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.col h3 small { color: var(--muted); font-weight: 400; font-size: 11px; }
.kc { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 9px 10px; display: flex; flex-direction: column; gap: 5px; cursor: grab; }
.kc:hover { border-color: var(--field); box-shadow: 0 2px 8px rgba(14, 15, 17, .06); }
.kc:active { cursor: grabbing; }
.kc b { font-weight: 600; }
.kc .r { display: flex; align-items: center; gap: 6px; }

/* матрица */
.mx td.c { text-align: center; padding: 4px; }
.mx th span { font-family: var(--mono); text-transform: none; letter-spacing: 0; }
.mx button.cell { width: 30px; height: 26px; border-radius: 13px; border: 1.5px solid var(--field); background: var(--panel); cursor: pointer; font-size: 10px; font-weight: 700; color: #fff; }
.mx button.cell:hover { border-color: var(--ink2); }
.pop { position: fixed; z-index: 60; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 6px; min-width: 190px; display: flex; flex-direction: column; }
.pop button { border: 0; background: none; text-align: left; padding: 7px 9px; border-radius: 6px; cursor: pointer; display: flex; align-items: center; gap: 8px; }
.pop button:hover { background: var(--hover); }

/* задачи */
.tl { display: flex; flex-direction: column; }
.ti { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-top: 1px solid var(--line2); }
.ti:first-child { border-top: 0; }
.ti.done .tt { text-decoration: line-through; color: var(--muted); }
.ti .tt { flex: 1; }
.ti input[type=checkbox] { accent-color: var(--ink); width: 16px; height: 16px; }
.late { color: var(--red); font-weight: 600; font-family: var(--mono); font-size: 12px; }
.ti > span.muted { font-family: var(--mono); font-size: 12px; }
.grp { padding: 8px 12px; font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; background: var(--head); border-top: 1px solid var(--line); }

/* карточка компании */
.card-page { position: fixed; inset: 0; z-index: 50; background: var(--bg); overflow-y: auto; }
.ch { position: sticky; top: 0; z-index: 2; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 18px; background: var(--panel); border-bottom: 1px solid var(--line); }
.ch h1 { margin: 0; font-size: 20px; font-weight: 700; letter-spacing: -.01em; cursor: text; }
.cgrid { display: flex; flex-wrap: wrap; gap: 14px; padding: 14px 18px 40px; align-items: flex-start; }
.cleft { flex: 1 1 260px; max-width: 320px; }
.cmid { flex: 999 1 480px; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.cright { flex: 1 1 280px; max-width: 340px; display: flex; flex-direction: column; gap: 12px; }
.sec { padding: 12px 14px; display: flex; flex-direction: column; gap: 9px; }
.sec h2 { margin: 0; font-size: 14.5px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.sec h2 .grow { flex: 1; }
.kv { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 7px 10px; align-items: center; }
.kv > span { color: var(--muted); font: 500 10.5px/1.3 var(--mono); text-transform: uppercase; letter-spacing: .05em; }
.kv .inp, .kv .sel { width: 100%; height: 30px; }
.next { background: #FDF2EA; border: 1px solid #F1D2BE; }
.feed .it { display: flex; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line2); }
.feed .it:first-of-type { border-top: 0; }
.feed .ic { width: 26px; height: 26px; border-radius: 13px; display: grid; place-items: center; color: #fff; font-size: 11px; font-weight: 700; flex: none; }
.feed .sys { color: var(--muted); }
.feed .meta { color: var(--muted); font-size: 11px; margin-top: 2px; }
.ct { display: flex; gap: 10px; align-items: center; padding: 6px 0; border-top: 1px solid var(--line2); }
.ct:first-of-type { border-top: 0; }
.ct .nm { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.prow { display: flex; align-items: center; gap: 8px; padding: 5px 0; border-top: 1px solid var(--line2); }
.prow .sel { height: 28px; font-size: 12.5px; margin-left: auto; }
details summary { font-weight: 600; }

/* окно, всплывашка */
.dlg { position: fixed; inset: 0; z-index: 70; background: rgba(14, 15, 17, .38); display: grid; place-items: center; padding: 16px; }
.dlg-box { background: var(--panel); border-radius: 14px; box-shadow: var(--shadow); width: min(480px, 100%); max-height: 90vh; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.dlg-box form { display: flex; flex-direction: column; gap: 12px; }
.dlg-box h3 { margin: 0; font-size: 17px; font-weight: 700; }
.dlg-box .acts { display: flex; justify-content: flex-end; gap: 8px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 80; background: var(--ink); color: #fff; padding: 9px 14px; border-radius: 10px; max-width: calc(100vw - 32px); }
.alert { background: var(--red-soft); color: var(--red); padding: 8px 10px; border-radius: 8px; }

/* настройки */
.sgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 14px; align-items: start; }
.srow { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 6px 0; border-top: 1px solid var(--line2); }
.srow:first-of-type { border-top: 0; }
.srow .inp { height: 30px; }
input[type=color] { width: 34px; height: 30px; border: 1px solid var(--field); border-radius: 6px; padding: 2px; background: var(--panel); }
input[type=checkbox] { accent-color: var(--ink); }

/* вход */
.login-body { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: min(360px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 26px 24px 24px; display: flex; flex-direction: column; gap: 12px; box-shadow: var(--shadow); }
.login-mark { display: flex; align-items: center; gap: 10px; }
.login-mark img { width: 36px; height: 36px; display: block; }
.login-card h1 { margin: 0; font-size: 24px; font-weight: 700; line-height: 1; }
.eyebrow { font: 500 10.5px/1.2 var(--mono); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.login-card form { display: flex; flex-direction: column; gap: 12px; }
.login-card label { display: flex; flex-direction: column; gap: 5px; color: var(--muted); font: 500 10.5px/1.3 var(--mono); text-transform: uppercase; letter-spacing: .05em; }
.login-card input { height: 40px; border: 1px solid var(--field); border-radius: 8px; padding: 0 10px; color: var(--ink); font: 14px var(--ui); text-transform: none; letter-spacing: 0; }
.login-card input:focus { border-color: var(--ink2); outline: none; box-shadow: 0 0 0 3px var(--sel-soft); }
.login-card .btn { height: 40px; justify-content: center; }

@media (max-width: 720px) {
  .top { gap: 8px; } .search input { width: 100%; } .search { flex: 1 1 100%; order: 5; }
  .view { padding: 10px 10px 30px; } .cgrid { padding: 10px; }
  .cleft, .cright { max-width: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
