/* ---------- Шрифты ---------- */
@font-face { font-family: "Geist"; src: url("/fonts/Geist-Variable.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Geist Mono"; src: url("/fonts/GeistMono-Variable.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Alumni Sans"; src: url("/fonts/AlumniSans-cyrillic.woff2") format("woff2"); font-weight: 100 900; font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Alumni Sans"; src: url("/fonts/AlumniSans-latin.woff2") format("woff2"); font-weight: 100 900; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

/* ---------- Темы ----------
   По бренд-гайду Coffee Nostra 1.1: Bone/Paper — основа, Ink/Night — текст и тёмные поверхности,
   Oxblood — только CTA, выгода и одна крупная плоскость. Без градиентов и радужных категорий.
   Ошибки — отдельный системный цвет, не Oxblood. Углы 6px, кнопки капсулой. */
:root {
  --bone: #f2efe8; --paper: #fcfbf7; --ink: #141414; --night: #0b0b0b; --stone: #b9b2a6;
  --oxblood: #7a1825; --oxblood-deep: #5d101a;
  --bg: var(--bone); --panel: var(--paper); --panel-2: #ebe7de; --line: #d8d3c9;
  --text: var(--ink); --text-2: #4f4d49; --muted: #6c6963;
  --accent: var(--oxblood); --accent-2: var(--oxblood); --accent-deep: var(--oxblood-deep);
  --accent-soft: rgba(122, 24, 37, .07); --on-accent: var(--bone);
  --bar-dim: var(--stone);
  --s-new: var(--ink); --s-thinking: #8a857c; --s-client: var(--oxblood); --s-rejected: #d8d3c9;
  --good: var(--ink); --danger: #c4320a;
  --edge: 0 0 0 1px var(--line);
  --shadow: 0 12px 28px -18px rgba(20, 20, 20, .35);
  --r-lg: 6px; --r-md: 6px;
  --ease: cubic-bezier(.32, .72, 0, 1);
  --font: "Geist", "Golos Text", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --display: "Alumni Sans", "Geist", sans-serif;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: var(--night); --panel: var(--ink); --panel-2: #1e1d1b; --line: #2c2a27;
  --text: var(--bone); --text-2: #c2bcb1; --muted: #948e84;
  --accent: var(--oxblood); --accent-2: #d36a77; --accent-deep: var(--oxblood-deep);
  --accent-soft: rgba(211, 106, 119, .12); --on-accent: var(--bone);
  --bar-dim: #5b5751;
  --s-new: var(--bone); --s-thinking: #8f897f; --s-client: #c4505f; --s-rejected: #3f3c38;
  --good: var(--bone); --danger: #f0743f;
  --edge: 0 0 0 1px var(--line);
  --shadow: 0 12px 28px -16px rgba(0, 0, 0, .7);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased; font-feature-settings: "ss01" on; }
button, input, textarea, select { font: inherit; color: inherit; }
a { color: inherit; }
h1, h2 { text-wrap: balance; }
svg.i { width: 20px; height: 20px; flex: none; fill: currentColor; }
.skip { position: absolute; left: -9999px; top: 8px; z-index: 50; background: var(--panel); padding: 8px 14px; border-radius: var(--r-md); }
.skip:focus { left: 8px; }

/* ---------- Каркас ---------- */
.shell { display: flex; min-height: 100dvh; }
.sidebar { display: none; }
.main { flex: 1; min-width: 0; padding: 0 16px calc(100px + env(safe-area-inset-bottom)); }
.topbar { display: flex; align-items: center; gap: 10px; padding: calc(14px + env(safe-area-inset-top)) 0 14px; }
.topbar h1 { margin: 0; font-size: 24px; font-weight: 700; letter-spacing: -.02em; flex: 1; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .hello { display: block; font-size: 13px; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.topbar .search { display: none; }
.iconbtn { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: var(--panel);
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer; color: var(--text-2); text-decoration: none; flex: none; }
.iconbtn:hover { color: var(--text); }

/* Нижнее меню на телефоне */
.tabbar { position: fixed; left: 12px; right: 12px; bottom: calc(10px + env(safe-area-inset-bottom)); z-index: 10;
  display: flex; align-items: center; justify-content: space-around; padding: 8px; border-radius: var(--r-lg);
  background: color-mix(in srgb, var(--panel) 88%, transparent); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--line); box-shadow: var(--shadow); }
.tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0;
  font-size: 11px; color: var(--muted); text-decoration: none; border-radius: var(--r-md); }
.tabbar a.on { color: var(--accent-2); }
.tabbar .add { flex: none; width: 52px; height: 52px; border-radius: 50%; background: var(--accent); color: var(--on-accent);
  display: flex; align-items: center; justify-content: center; margin: 0 6px; box-shadow: var(--shadow); }
.tabbar .add svg.i { width: 26px; height: 26px; stroke-width: 2.2; }

@media (min-width: 900px) {
  .shell { padding: 16px; gap: 16px; }
  .sidebar { display: flex; flex-direction: column; width: 232px; flex: none; position: sticky; top: 16px;
    height: calc(100dvh - 32px); background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 20px 14px; }
  .nav-title { font-size: 12px; color: var(--muted); padding: 6px 10px; }
  .sidebar nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px;
    text-decoration: none; color: var(--text-2); font-weight: 500; margin-bottom: 2px; }
  .sidebar nav a:hover { background: var(--panel-2); color: var(--text); }
  .sidebar nav a.on { background: var(--accent-soft); color: var(--text); }
  .sidebar nav a.on svg.i { color: var(--accent-2); }
  .sidebar nav a .n { margin-left: auto; font-size: 12px; color: var(--muted); }
  .sidebar .spacer { flex: 1; }
  .sidebar .theme { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; border: 0;
    background: var(--panel-2); color: var(--text-2); cursor: pointer; width: 100%; text-align: left; }
  .main { padding: 0 8px 40px; }
  .topbar { padding-top: 6px; }
  .topbar h1 { font-size: 28px; }
  .topbar .search { display: block; width: 300px; }
  .topbar .theme-m { display: none; }
  .tabbar { display: none; }
}

/* ---------- Общие элементы ---------- */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px; }
.panel h2 { margin: 0; font-size: 16px; font-weight: 600; }
.panel .head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.panel .head h2 { flex: 1; }
.panel .head .link { font-size: 13px; color: var(--accent-2); text-decoration: none; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 16px; border-radius: var(--r-md);
  border: 1px solid var(--line); background: var(--panel-2); cursor: pointer; text-decoration: none; color: var(--text);
  font-weight: 600; font-size: 15px; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--danger); }
.btn[disabled] { opacity: .5; }
.btn.add-d { display: none; }
@media (min-width: 900px) { .btn.add-d { display: inline-flex; } }
.input { width: 100%; padding: 11px 14px 11px 40px; border-radius: var(--r-md); border: 1px solid var(--line); background: var(--panel); outline: none; }
.input:focus, .form-in:focus { border-color: var(--accent); }
.search { position: relative; }
.search svg.i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 18px; height: 18px; }
.seg { display: inline-flex; background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 3px; }
.seg button, .seg a { border: 0; background: none; padding: 6px 12px; border-radius: 9px; cursor: pointer; color: var(--muted);
  font-size: 13px; font-weight: 600; text-decoration: none; }
.seg .on { background: var(--panel); color: var(--text); box-shadow: 0 1px 4px rgba(0, 0, 0, .2); }
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 3px 10px;
  border-radius: 99px; background: var(--panel-2); color: var(--text-2); white-space: nowrap; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--dot); }
.badge.new { --dot: var(--s-new); } .badge.thinking { --dot: var(--s-thinking); }
.badge.client { --dot: var(--s-client); } .badge.rejected { --dot: var(--s-rejected); }
.chip { font-size: 12px; padding: 3px 9px; border-radius: 99px; background: var(--accent-soft); color: var(--text-2); white-space: nowrap; }
.empty { text-align: center; color: var(--muted); padding: 40px 16px; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(100px + env(safe-area-inset-bottom));
  background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: var(--r-md); z-index: 30; font-weight: 600; }
.avatar { width: 40px; height: 40px; border-radius: 13px; display: flex; align-items: center; justify-content: center;
  font-weight: 700; flex: none; color: #fff; font-size: 15px; }

/* ---------- Дашборд ---------- */
.grid { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
.grid > *, .detail > *, .kpis > * { min-width: 0; }
.kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.kpi { padding: 16px; }
.kpi .t { display: flex; align-items: center; gap: 8px; color: var(--text-2); font-size: 13px; font-weight: 500; }
.kpi .t .ic { width: 30px; height: 30px; border-radius: 10px; background: var(--accent-soft); color: var(--accent-2);
  display: flex; align-items: center; justify-content: center; }
.kpi .t .ic svg.i { width: 17px; height: 17px; }
.kpi .v { font-size: clamp(22px, 6.5vw, 30px); font-weight: 700; letter-spacing: -.03em; margin-top: 10px; line-height: 1.1; }
.kpi .v small { font-size: 16px; color: var(--muted); font-weight: 600; }
.kpi .d { font-size: 12px; color: var(--muted); margin-top: 4px; }
.kpi .d b { color: var(--good); font-weight: 600; }
.kpi.hero .t, .kpi.hero .d { color: rgba(255, 255, 255, .78); }
.kpi.hero .t .ic { background: rgba(255, 255, 255, .16); color: #fff; }
.kpi.hero .d b { color: #fff; }
@media (min-width: 900px) {
  .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
  .row-2 { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 14px; }
}

.chart { position: relative; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart .grid-l { stroke: var(--line); stroke-width: 1; }
.chart .ax { fill: var(--muted); font-size: 11px; }
.tip { position: absolute; pointer-events: none; z-index: 5; background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 12px; padding: 8px 12px; font-size: 12px; color: var(--text-2); box-shadow: var(--shadow);
  white-space: nowrap; transform: translate(-50%, calc(-100% - 12px)); }
.tip b { display: block; font-size: 15px; color: var(--text); }

.donut-wrap { display: flex; align-items: center; gap: 18px; }
.donut-wrap .chart { width: 150px; flex: none; }
.legend { flex: 1; display: grid; gap: 10px; }
.legend .li { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--text-2); }
.legend .li i { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.legend .li span { flex: 1; }
.legend .li b { color: var(--text); font-weight: 600; }
.legend .li em { font-style: normal; color: var(--muted); width: 38px; text-align: right; font-size: 13px; }

.bars { display: grid; gap: 14px; }
.bar .lbl { display: flex; justify-content: space-between; font-size: 14px; color: var(--text-2); margin-bottom: 6px; }
.bar .lbl b { color: var(--text); }
.bar .track { height: 10px; border-radius: 99px; background: var(--panel-2); overflow: hidden; }
.bar .fill { height: 100%; border-radius: 99px; background: var(--accent); min-width: 4px; }

.recent { display: grid; gap: 4px; }
.recent a { display: flex; align-items: center; gap: 12px; padding: 8px; margin: 0 -8px; border-radius: var(--r-md); text-decoration: none; }
.recent a:hover { background: var(--panel-2); }
.recent .nm { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recent .sb { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recent .tx { flex: 1; min-width: 0; }

/* ---------- Список контактов ---------- */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .search { flex: 1; min-width: 200px; }
.rows { display: grid; gap: 8px; }
.rowc { display: grid; grid-template-columns: auto 1fr auto; gap: 4px 12px; align-items: center; padding: 14px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 18px; text-decoration: none; }
.rowc:hover { border-color: var(--muted); }
.rowc .nm { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rowc .sb { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rowc .ph, .rowc .pr { display: none; }
.rowc .chips { grid-column: 2 / 4; display: flex; gap: 6px; flex-wrap: wrap; }
.rowc .chips:empty { display: none; }
.thead { display: none; }
@media (min-width: 900px) {
  .rows { gap: 0; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
  .thead, .rowc { display: grid; grid-template-columns: 44px minmax(180px, 1.4fr) 1fr 1.2fr 120px; gap: 14px; }
  .thead { padding: 14px 18px; font-size: 13px; color: var(--muted);
    border-bottom: 1px solid var(--line); }
  .rowc { border: 0; border-radius: 0; border-bottom: 1px solid var(--line); padding: 12px 18px; }
  .rowc:last-child { border-bottom: 0; }
  .rowc:hover { background: var(--panel-2); }
  .rowc .ph { display: block; color: var(--text-2); font-size: 14px; }
  .rowc .chips { grid-column: auto; }
  .rowc .chips:empty { display: block; }
  .rowc .st { justify-self: start; }
}

/* ---------- Карточка и форма ---------- */
.detail { display: grid; gap: 14px; max-width: 760px; grid-template-columns: minmax(0, 1fr); }
.hero-card { display: flex; gap: 16px; align-items: center; }
.hero-card .avatar { width: 58px; height: 58px; border-radius: 18px; font-size: 22px; }
.hero-card h2 { margin: 0 0 6px; font-size: 22px; }
.fields { display: grid; gap: 16px; }
@media (min-width: 600px) { .fields { grid-template-columns: 1fr 1fr; } .fields .wide { grid-column: 1 / 3; } }
.field .label { font-size: 13px; color: var(--muted); margin-bottom: 2px; }
.field .value { white-space: pre-wrap; word-break: break-word; }
.field .value a { color: var(--accent-2); }
.actions { display: flex; gap: 10px; flex-wrap: wrap; }
.actions .btn { flex: 1 1 150px; }
form.panel { max-width: 760px; }
form label.l { display: block; margin-top: 14px; font-size: 13px; color: var(--text-2); font-weight: 500; }
form label.l:first-child { margin-top: 0; }
.form-in { width: 100%; margin-top: 6px; padding: 12px 14px; border-radius: var(--r-md); border: 1px solid var(--line);
  background: var(--panel-2); color: var(--text); outline: none; }
textarea.form-in { min-height: 100px; resize: vertical; }
.checks { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.checks label { display: inline-flex; gap: 8px; align-items: center; padding: 10px 14px; border: 1px solid var(--line);
  border-radius: var(--r-md); background: var(--panel-2); cursor: pointer; }
.checks label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.checks input { accent-color: var(--accent); }
.statuses { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 6px; }
.statuses label { text-align: center; padding: 10px 2px; border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--panel-2); cursor: pointer; font-size: 14px; }
.statuses input { display: none; }
.statuses label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); font-weight: 700; }
.error { color: var(--danger); margin-top: 12px; }
.login { max-width: 360px; margin: 18vh auto 0; padding: 0 16px; }

/* ---------- Задачи ---------- */
.warn { color: var(--danger) !important; font-weight: 600; }
.today { color: var(--accent-2); font-weight: 600; }
.rowc .sb svg.i { width: 13px; height: 13px; vertical-align: -2px; margin-right: 4px; }
.sidebar nav a .n.hot { background: var(--danger); color: #fff; padding: 0 7px; border-radius: 99px; font-weight: 700; }
.tabbar a { position: relative; }
.tabbar .dotn { position: absolute; top: 0; left: calc(50% + 6px); background: var(--danger); color: #fff; font-size: 10px;
  font-weight: 700; min-width: 16px; height: 16px; border-radius: 99px; display: flex; align-items: center; justify-content: center; padding: 0 4px; }
.cnt { font-size: 13px; color: var(--text-2); background: var(--panel-2); padding: 3px 10px; border-radius: 99px; font-weight: 600; }
.hint { margin: 8px 0 12px; font-size: 13px; color: var(--muted); }
.empty.sm { padding: 18px 8px; font-size: 14px; }
.tasks { display: grid; gap: 4px; }
.task { display: flex; align-items: center; gap: 10px; padding: 8px; margin: 0 -8px; border-radius: var(--r-md); }
.task:hover { background: var(--panel-2); }
.task .tx { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; text-decoration: none; }
.task .nm, .drow .nm, .prod .nm { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.task .sb, .drow .sb, .prod .sb { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.task.late .when { color: var(--danger); font-weight: 600; }
.task.now .when { color: var(--accent-2); font-weight: 600; }
.task .ta { display: flex; gap: 6px; flex: none; }
.iconbtn.sm { width: 36px; height: 36px; }
.iconbtn.sm svg.i { width: 17px; height: 17px; }
.iconbtn.ok { color: var(--good); }
.iconbtn[disabled] { opacity: .35; cursor: default; }

/* ---------- Карточка: следующий шаг ---------- */
.next { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: var(--r-md); background: var(--accent-soft); }
.next .ic { width: 40px; height: 40px; border-radius: 12px; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; flex: none; }
.next.late { background: color-mix(in srgb, var(--danger) 14%, transparent); }
.next.late .ic { background: var(--danger); }
.next.late .sb { color: var(--danger); font-weight: 600; }
.next .nm { font-weight: 700; }
.next .sb { font-size: 14px; color: var(--text-2); }
.quick { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.quick .btn { flex: 1 1 auto; padding: 9px 12px; font-size: 14px; }
.quick select { margin-top: 0; }
.muted { color: var(--muted); font-size: 14px; }
.two { display: grid; grid-template-columns: 1.3fr 1fr; gap: 10px; }

/* ---------- Поставки ---------- */
.dlist { display: grid; gap: 2px; }
.drow { display: flex; align-items: center; gap: 12px; padding: 10px 8px; margin: 0 -8px; border-radius: var(--r-md); text-decoration: none; }
.drow:hover { background: var(--panel-2); }
.drow .tx { flex: 1; min-width: 0; }
.drow .sum { white-space: nowrap; }
.drow .dd { width: 44px; height: 44px; border-radius: 13px; background: var(--panel-2); display: flex; flex-direction: column;
  align-items: center; justify-content: center; flex: none; line-height: 1.05; }
.drow .dd b { font-size: 17px; }
.drow .dd span { font-size: 11px; color: var(--muted); }
.month { display: flex; align-items: center; gap: 12px; }
.month .tx { flex: 1; text-align: center; min-width: 0; }
.month .nm { color: var(--text-2); font-weight: 600; }
.month .big { font-size: 30px; font-weight: 700; letter-spacing: -.03em; }
.month .sb { font-size: 13px; color: var(--muted); }
.items { display: grid; gap: 8px; margin-top: 6px; }
.itm { display: grid; grid-template-columns: 80px 1fr 1fr; gap: 8px; align-items: end; }
.itm .pn { font-weight: 600; padding-bottom: 12px; }
.itm label span { font-size: 12px; color: var(--muted); }
.itm .form-in { margin-top: 2px; }
.total { margin-top: 14px; font-size: 16px; color: var(--text-2); text-align: right; }
.total b { color: var(--text); font-size: 20px; }
a.bar { display: block; text-decoration: none; }
.prod { display: grid; gap: 10px; }
.prod .pr { display: flex; align-items: center; gap: 12px; }
.prod .tx { flex: 1; min-width: 0; }
.prod .pi { width: 40px; height: 40px; border-radius: 13px; display: flex; align-items: center; justify-content: center; flex: none; color: #fff; }
.prod .pi.coffee { background: #7c4a2d; } .prod .pi.tea { background: #2f7d4f; } .prod .pi.syrups { background: #b4386b; }

/* ---------- Статистика ---------- */
.seg { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.seg button { white-space: nowrap; flex: none; }
.panel .head { flex-wrap: wrap; row-gap: 10px; }
.panel .head h2 { min-width: 50%; }
.ptable { display: grid; font-size: 14px; }
.ptable > div { display: grid; grid-template-columns: 1.1fr .8fr .8fr 1fr .8fr 1.3fr; gap: 6px; padding: 9px 0; border-bottom: 1px solid var(--line); align-items: center; }
.ptable > div:last-child { border-bottom: 0; }
.ptable span:not(:first-child) { text-align: right; }
.ptable .pr0 { font-size: 12px; color: var(--muted); }
.ptable .pr1 span:first-child { font-weight: 600; }
.ptable .pr1 span:last-child { font-weight: 700; }
@media (max-width: 520px) {
  .ptable > div { grid-template-columns: 1fr .7fr .7fr .8fr; }
  .ptable span:nth-child(5), .ptable span:nth-child(3) { display: none; }
}
.stab { display: grid; }
.stab .sh { display: none; }
.stab .sr { display: grid; grid-template-columns: auto 1fr auto; grid-template-areas: "a n s" "a d d"; gap: 2px 12px; align-items: center;
  padding: 10px 8px; margin: 0 -8px; border-radius: var(--r-md); text-decoration: none; }
.stab .sr:hover { background: var(--panel-2); }
.stab .sr .avatar { grid-area: a; }
.stab .sr .nm { grid-area: n; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stab .sr b { grid-area: s; white-space: nowrap; }
.stab .sr span[data-l] { display: none; }
.stab .sr .sd { grid-area: d; font-size: 13px; color: var(--muted); }
@media (min-width: 900px) { .stab .sr .sd { display: none; } }
@media (min-width: 900px) {
  .stab .sh, .stab .sr { display: grid; grid-template-columns: 44px minmax(160px, 1.6fr) repeat(4, .8fr) 1fr; grid-template-areas: none; gap: 12px; align-items: center; }
  .stab .sh { font-size: 13px; color: var(--muted); padding: 0 0 10px; border-bottom: 1px solid var(--line); }
  .stab .sh span:nth-child(n+3) { text-align: right; }
  .stab .sr { margin: 0; border-radius: 0; padding: 10px 0; border-bottom: 1px solid var(--line); }
  .stab .sr:last-child { border-bottom: 0; }
  .stab .sr .avatar, .stab .sr .nm, .stab .sr b { grid-area: auto; }
  .stab .sr span[data-l] { display: block; text-align: right; color: var(--text-2); }
  .stab .sr span[data-l] i { display: none; }
  .stab .sr b { text-align: right; }
}
.tasks, .dlist, .bars, .prod, .stab, .rows, .recent { grid-template-columns: minmax(0, 1fr); }
.tasks > *, .dlist > *, .bars > *, .prod > *, .stab > *, .rows > * { min-width: 0; }


/* ---------- Доводка: поверхности, цифры, состояния ---------- */
.panel, .sidebar, .rows, .rowc { border-color: transparent; box-shadow: var(--edge); }
@media (min-width: 900px) { .rows .rowc { box-shadow: none; border-bottom-color: var(--line); } }
.panel h2 { font-weight: 600; letter-spacing: -.01em; }
.topbar h1 { font-weight: 600; letter-spacing: -.035em; }
.main { max-width: 1440px; }
.kpi .v, .month .big { font-weight: 600; letter-spacing: -.04em; }
.kpi .v, .sum, .ptable, .stab, .legend, .bars b, .prod b, .month .big, .total b, .cnt, .rowc .ph, .drow .dd, .chart .ax, .tip b, .sidebar .n {
  font-variant-numeric: tabular-nums; }
.chart .ax { font-family: "Geist Mono", ui-monospace, monospace; font-size: 10.5px; }

/* Аватары: приглушённый оттенок вместо ярких заливок */
.avatar { background: hsl(var(--h, 30) 22% 88%); color: hsl(var(--h, 30) 35% 28%); font-weight: 600; letter-spacing: -.02em; }
:root[data-theme="dark"] .avatar { background: hsl(var(--h, 30) 14% 18%); color: hsl(var(--h, 30) 40% 80%); }
.prod .pi { background: var(--panel-2) !important; color: var(--text-2); }

/* Переходы, нажатие, фокус */
.btn, .iconbtn, .rowc, .task, .drow, .recent a, .stab .sr, .seg button, .seg a, .sidebar nav a, .tabbar a, .checks label, .statuses label, .theme, a.bar {
  transition: background-color .2s var(--ease), border-color .2s var(--ease), color .2s var(--ease), transform .2s var(--ease), box-shadow .2s var(--ease); }
.btn:active, .iconbtn:active, .seg button:active, .checks label:active, .statuses label:active, .tabbar a:active, .theme:active { transform: scale(.97); }
.rowc:active, .task:active, .drow:active, .stab .sr:active { transform: scale(.995); }
.btn.primary:hover { filter: none; background: var(--accent-2); border-color: var(--accent-2); }

:focus { outline: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 10px; }
.form-in:focus-visible, .input:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.btn.danger.armed { background: var(--danger); border-color: var(--danger); color: #fff; }
.form-in[aria-invalid="true"] { border-color: var(--danger); }
.ferr { color: var(--danger); font-size: 13px; margin-top: 6px; }

/* Пустые состояния */
.blank { display: grid; justify-items: center; gap: 6px; text-align: center; padding: 40px 20px; }
.blank .bi { width: 52px; height: 52px; border-radius: var(--r-md); background: var(--accent-soft); color: var(--accent-2);
  display: flex; align-items: center; justify-content: center; margin-bottom: 6px; }
.blank .bi svg.i { width: 24px; height: 24px; }
.blank b { font-size: 16px; font-weight: 600; }
.blank p { margin: 0 0 10px; color: var(--muted); max-width: 42ch; font-size: 14px; text-wrap: pretty; }

/* Скелетон при загрузке */
.sk { background: var(--panel-2); animation: sk 1.2s var(--ease) infinite alternate; border-radius: var(--r-lg); }
@keyframes sk { from { opacity: 1; } to { opacity: .45; } }
.sk-grid { display: grid; gap: 14px; }
.sk-grid .sk-row { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 900px) { .sk-grid .sk-row { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

/* Плавное появление при переходе между экранами */
.enter .grid > *, .enter .detail > *, .enter form.panel, .enter .toolbar, .enter .rows {
  animation: rise .5s var(--ease) both; }
.enter .grid > *:nth-child(2), .enter .detail > *:nth-child(2) { animation-delay: .04s; }
.enter .grid > *:nth-child(3), .enter .detail > *:nth-child(3) { animation-delay: .08s; }
.enter .grid > *:nth-child(4), .enter .detail > *:nth-child(4) { animation-delay: .12s; }
.enter .grid > *:nth-child(n+5), .enter .detail > *:nth-child(n+5) { animation-delay: .16s; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}


/* ---------- Фирменный стиль Coffee Nostra ---------- */
html, body { letter-spacing: -.01em; }
.btn, .tabbar .add, .seg, .seg button, .seg a, .badge, .chip, .cnt, .iconbtn { border-radius: 999px; }
.btn.primary:hover { background: var(--accent-deep); border-color: var(--accent-deep); }
.btn, .tabbar a, .iconbtn { min-height: 44px; }
.iconbtn.sm { min-height: 36px; }

/* Display (Alumni Sans) — только короткие заголовки страниц и крупные цифры */
.topbar h1, .kpi .v, .month .big { font-family: var(--display); text-transform: uppercase; font-weight: 820; letter-spacing: -.01em; }
.topbar h1 { font-size: 48px; line-height: .8; padding-top: 4px; }
@media (min-width: 900px) { .topbar h1 { font-size: 64px; } }
.topbar .hello { font-family: var(--font); text-transform: none; font-size: 13px; letter-spacing: .02em; margin-bottom: 8px; font-weight: 560; line-height: 1.25; }
.kpi .v { font-size: clamp(44px, 12vw, 60px); line-height: .8; margin-top: 14px; }
.kpi .v small { font-family: var(--display); font-size: .5em; }
.month .big { font-size: 60px; line-height: .84; margin: 4px 0; }

/* Heading и caption (Geist) */
.panel h2, .hero-card h2, .blank b { font-family: var(--font); font-weight: 720; letter-spacing: -.035em; line-height: 1.02; text-transform: none; }
.hero-card h2 { font-size: 24px; }
.kpi .t, .field .label, .thead, .ptable .pr0, .stab .sh, .nav-title, .legend .li, .bar .lbl span, .itm label span {
  font-weight: 560; letter-spacing: .02em; line-height: 1.25; }

/* Логотип: официальный SVG-wordmark. Охранное поле = просвет буквы O (~19% высоты знака) */
.logo { display: block; width: 136px; padding: 6px 8px 26px; text-decoration: none; }
.logo img { display: block; width: 100%; height: auto; }
.logo .wm-dark { display: none; }
[data-theme="dark"] .logo .wm-light { display: none; }
[data-theme="dark"] .logo .wm-dark { display: block; }
.login .logo { width: 200px; margin: 0 auto; padding: 0 0 32px; }

/* Одна крупная Oxblood-плоскость — выручка месяца */
.kpi.hero { background: var(--accent) !important; color: var(--on-accent); }
.kpi.hero::after { content: none; }
.kpi.hero .t, .kpi.hero .d { color: rgba(242, 239, 232, .78); }
.kpi.hero .t .ic { background: rgba(242, 239, 232, .14); color: var(--on-accent); }
.kpi.hero .d b { color: var(--on-accent); }

/* Навигация и переключатели — Ink, не Oxblood */
.sidebar nav a.on, .seg .on { background: var(--text); color: var(--bg); box-shadow: none; }
.sidebar nav a.on svg.i, .sidebar nav a.on .n { color: var(--bg); }
.sidebar nav a .n.hot { background: var(--danger); color: #fff; }
.tabbar a.on { color: var(--text); font-weight: 600; }
.kpi .t .ic, .prod .pi { background: var(--panel-2); color: var(--text); }
.next { background: var(--panel-2); }
.next .ic, .blank .bi { background: var(--text); color: var(--bg); }
.next.late { background: color-mix(in srgb, var(--danger) 10%, var(--panel)); }
.next.late .ic { background: var(--danger); color: #fff; }
.panel .head .link, .field .value a { color: var(--accent-2); }
.today { color: var(--text); }
.task.now .when { color: var(--text); }
.iconbtn.ok { color: var(--text); }

/* Аватары нейтральные: без цветовой радуги */
.avatar, :root[data-theme="dark"] .avatar { background: var(--panel-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--line); }
.avatar, .prod .pi, .drow .dd, .kpi .t .ic, .blank .bi { border-radius: 6px; }
.bar .track { border-radius: 0; height: 6px; background: var(--panel-2); }
.bar .fill { border-radius: 0; }
:root[data-theme="dark"] .rows .rowc, :root[data-theme="dark"] .rows { box-shadow: none; }
@media (min-width: 900px) { .rows { box-shadow: var(--edge); } }
