/* ============================================================
   FIX-12: единый слой токенов Kraft Navy (без переопределений).
   FIX-06: --text-muted поднят до AA на крафт-фоне.
   FIX-07: --warning — янтарь, медь #b87333 осталась только
           акцентом (линия «сегодня», eyebrow, фокус).
   ============================================================ */
:root {
  --bg-canvas: #fbf8f2;
  --bg-surface: #fffdf8;
  --bg-subtle: #f2e8d5;
  --text-primary: #0e1b2a;
  --text-secondary: #2a3b4c;
  --text-muted: #4e5d6c;
  --text-disabled: #a9a196;
  --border-subtle: #e8e2d6;
  --border-default: #d8d2c4;
  --border-strong: #bdb4a4;
  --brand-blue: #12304d;
  --brand-blue-hover: #0b1f33;
  --brand-blue-active: #081726;
  --brand-blue-soft: #e7edf3;
  --accent-orange: #b87333;
  --accent-orange-soft: #f7e8d8;
  --success: #3f6b57;
  --success-soft: #eaf1ec;
  --warning: #b45309;
  --warning-soft: #f7ecd9;
  --danger: #b42318;
  --danger-soft: #fef3f2;
  --info: #2f5d8a;
  --info-soft: #eaf0f6;
  --focus: #b87333;
  --line-ok: #c9d8cf;
  --line-warn: #e8c9a8;
  --line-danger: #f3c6c2;
  --line-info: #c9d8e6;
  --line-accent: #fed7aa;
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-pill: 999px;
  --shadow-xs: 0 1px 2px rgba(14, 27, 42, 0.04);
  --shadow-sm: 0 2px 6px rgba(14, 27, 42, 0.06);
  --shadow-md: 0 8px 24px rgba(14, 27, 42, 0.08);
  --shadow-lg: 0 16px 40px rgba(14, 27, 42, 0.12);
  --mono: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
  --sans: "Golos Text", "Inter Tight", "Helvetica Neue", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--sans);
  color: var(--text-primary);
  background: var(--bg-canvas);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.muted { color: var(--text-muted); font-size: 12px; }

.icon {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: 0 0 auto;
}
.icon.ok { color: var(--success); }
.icon.no { color: var(--danger); }

.app { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
  width: 260px;
  background: var(--bg-surface);
  border-right: 1px solid var(--border-default);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 30;
  flex: 0 0 auto;
}
.sidebar-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  padding: 20px 16px 16px;
  border-bottom: 1px solid var(--border-subtle);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark { width: 40px; height: 40px; flex: 0 0 auto; }
.brand-text { min-width: 0; }
.brand-name { font-size: 20px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.1; }
.brand-name span { color: var(--brand-blue); }
.brand-sub { margin-top: 3px; font-size: 9px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); white-space: nowrap; }

.nav { flex: 1; overflow-y: auto; padding: 10px 8px 16px; }
.nav-label {
  padding: 12px 10px 6px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}
.nav-label-bottom { margin-top: 12px; }
.nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  margin-bottom: 2px;
}
.nav-item:hover { background: var(--bg-subtle); color: var(--text-primary); }
.nav-item.active { background: var(--brand-blue-soft); color: var(--brand-blue); font-weight: 600; }
.nav-item .icon { width: 18px; height: 18px; }
.nav-logout:hover { background: var(--danger-soft); color: var(--danger); }

.sidebar-foot { border-top: 1px solid var(--border-subtle); padding: 12px 8px; }
.user-mini { display: flex; align-items: center; gap: 10px; padding: 8px 10px 12px; }
.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--brand-blue-soft);
  color: var(--brand-blue);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  border: 0;
  flex: 0 0 auto;
}
.user-mini-text { min-width: 0; }
.user-mini-name { font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-mini-role { font-size: 10px; color: var(--text-muted); }

/* Main / topbar */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 64px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-default);
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.menu-btn { display: none; }
.breadcrumbs { font-size: 13px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prototype-badge {
  font-family: var(--mono);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-orange);
  background: var(--accent-orange-soft);
  border: 1px solid var(--line-accent);
  border-radius: var(--radius-pill);
  padding: 3px 7px;
  white-space: nowrap;
}
.topbar-center { flex: 1; max-width: 520px; }
.search-wrap { position: relative; }
.search-icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--text-muted); }
.search-input {
  width: 100%;
  height: 40px;
  border: 1px solid var(--border-default);
  border-radius: 8px;
  background: var(--bg-subtle);
  padding: 0 12px 0 34px;
  font-size: 13px;
  color: var(--text-primary);
}
.search-input:focus { outline: 2px solid var(--focus); outline-offset: 1px; border-color: var(--brand-blue); background: var(--bg-surface); }
.topbar-right { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.project-select {
  height: 40px;
  border: 1px solid var(--border-default);
  border-radius: 8px;
  background: var(--bg-surface);
  padding: 0 10px;
  font-size: 13px;
  color: var(--text-primary);
  max-width: 190px;
}
.icon-btn {
  width: 40px;
  height: 40px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.icon-btn:hover { background: var(--bg-subtle); color: var(--text-primary); }
.dot { position: absolute; top: 8px; right: 8px; width: 6px; height: 6px; border-radius: 50%; background: var(--danger); }
.avatar-btn { cursor: pointer; }

/* Content */
.content { padding: 24px; max-width: 1440px; width: 100%; margin: 0 auto; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.page-title { margin: 0; font-size: 32px; line-height: 1.12; letter-spacing: -0.03em; }
.page-sub { margin: 6px 0 0; font-size: 13px; line-height: 1.45; color: var(--text-secondary); max-width: 720px; }
.page-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: flex-end; }

/* Buttons */
.btn {
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  background: transparent;
  white-space: nowrap;
}
.btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.btn-primary { background: var(--brand-blue); color: #fff; }
.btn-primary:hover { background: var(--brand-blue-hover); }
.btn-secondary { background: var(--bg-surface); border-color: var(--border-default); }
.btn-secondary:hover { background: var(--bg-subtle); }
.btn-ghost { background: transparent; }
.btn-ghost:hover { background: var(--bg-subtle); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-sm { min-height: 36px; padding: 0 10px; font-size: 12px; }
.btn-block { width: 100%; }
.btn-icon { width: 36px; height: 36px; min-height: 36px; padding: 0; }
.btn .icon { width: 16px; height: 16px; }

/* Inputs */
.input, .select {
  height: 40px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  padding: 0 10px;
  font-size: 13px;
  color: var(--text-primary);
}
.input:focus, .select:focus { outline: 2px solid var(--focus); outline-offset: 1px; border-color: var(--brand-blue); }
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px; }
.field .input { width: 100%; }

/* Cards */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 18px;
  box-shadow: var(--shadow-xs);
}
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-title { margin: 0; font-size: 17px; line-height: 1.25; letter-spacing: -0.01em; }
.card-sub { margin: 4px 0 0; font-size: 12px; line-height: 1.4; color: var(--text-secondary); }
.card-body { min-width: 0; }

/* KPI */
.kpi-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpi { background: var(--bg-surface); border: 1px solid var(--border-default); border-radius: var(--radius-md); padding: 14px 16px; box-shadow: var(--shadow-xs); }
.kpi-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-muted); }
.kpi-value { margin-top: 6px; font-size: 28px; line-height: 1.1; font-weight: 700; letter-spacing: -0.03em; }
.kpi-delta { margin-top: 4px; font-size: 11px; color: var(--text-secondary); }
.kpi-delta.good { color: var(--success); }
.kpi-delta.bad { color: var(--danger); }

/* Tables */
.table-wrap { background: var(--bg-surface); border: 1px solid var(--border-default); border-radius: var(--radius-md); overflow: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 760px; }
.data-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  text-align: left;
  padding: 10px 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border-default);
  white-space: nowrap;
}
.data-table th.sortable { cursor: pointer; user-select: none; }
.data-table th.sortable:hover { color: var(--text-primary); }
.data-table td { padding: 11px 12px; border-bottom: 1px solid var(--border-subtle); color: var(--text-secondary); vertical-align: middle; }
.data-table tbody tr { cursor: pointer; }
.data-table tbody tr:hover td { background: var(--bg-subtle); }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table .num { font-family: var(--mono); font-variant-numeric: tabular-nums; text-align: right; color: var(--text-primary); white-space: nowrap; }
.data-table .strong { color: var(--text-primary); font-weight: 600; }
.row-actions { display: flex; gap: 4px; justify-content: flex-end; }
.row-actions .icon-btn { width: 36px; height: 36px; }
.row-actions .icon { width: 16px; height: 16px; }

/* Pills */
.pill { display: inline-flex; align-items: center; gap: 5px; min-height: 22px; padding: 0 8px; border-radius: var(--radius-pill); font-size: 11px; font-weight: 600; border: 1px solid transparent; white-space: nowrap; }
.pill-success { background: var(--success-soft); color: var(--success); border-color: var(--line-ok); }
.pill-warning { background: var(--warning-soft); color: var(--warning); border-color: var(--line-warn); }
.pill-danger { background: var(--danger-soft); color: var(--danger); border-color: var(--line-danger); }
.pill-info { background: var(--info-soft); color: var(--info); border-color: var(--line-info); }
.pill-neutral { background: var(--bg-subtle); color: var(--text-secondary); border-color: var(--border-default); }

/* Progress */
.progress { height: 6px; min-width: 80px; background: var(--bg-subtle); border-radius: var(--radius-pill); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--brand-blue); border-radius: var(--radius-pill); }
.data-table .progress { display: inline-block; vertical-align: middle; margin-right: 8px; }

/* Filters */
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.search-inline { position: relative; }
.search-inline .icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--text-muted); }
.search-inline .input { padding-left: 32px; min-width: 240px; }
.filters .select { min-width: 150px; }
.filters .spacer { flex: 1; }

/* Tabs */
.tabs { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--border-default); margin-bottom: 16px; }
.tab { border: 0; background: transparent; padding: 10px 12px; font-size: 13px; font-weight: 600; color: var(--text-secondary); border-bottom: 2px solid transparent; white-space: nowrap; }
.tab:hover { color: var(--text-primary); }
.tab.active { color: var(--brand-blue); border-bottom-color: var(--brand-blue); }

/* Gantt */
.gantt-toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.gantt-toolbar .spacer { flex: 1; }
.gantt-scale { display: flex; gap: 2px; padding: 2px; background: var(--bg-subtle); border: 1px solid var(--border-default); border-radius: 8px; }
.gantt-scale button { border: 0; background: transparent; padding: 6px 10px; border-radius: 6px; font-size: 12px; font-weight: 600; color: var(--text-secondary); }
.gantt-scale button.active { background: var(--bg-surface); color: var(--brand-blue); box-shadow: var(--shadow-xs); }
.gantt-shell { background: var(--bg-surface); border: 1px solid var(--border-default); border-radius: var(--radius-md); overflow: hidden; }
.gantt-scroll { max-height: calc(100vh - 330px); overflow: auto; }
.gantt-head { display: grid; grid-template-columns: 420px 1fr; position: sticky; top: 0; z-index: 6; background: var(--bg-subtle); border-bottom: 1px solid var(--border-default); }
.gantt-head-tree { padding: 10px 12px; font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); border-right: 1px solid var(--border-default); }
.gantt-head-timeline { position: relative; overflow: hidden; }
.gantt-months { display: flex; height: 30px; }
.gantt-month { flex: 1; display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 600; color: var(--text-secondary); border-right: 1px solid var(--border-subtle); white-space: nowrap; }
.gantt-days { display: flex; height: 22px; }
/* Недочёт G-3: номер дня шириной с колонку сетки, чтобы не съезжал */
.gantt-day { width: var(--col-width, 48px); flex: 0 0 auto; display: flex; align-items: center; justify-content: center; font-size: 9px; color: var(--text-muted); border-right: 1px solid var(--border-subtle); white-space: nowrap; }
.gantt-row { display: grid; grid-template-columns: 420px 1fr; min-height: 36px; border-bottom: 1px solid var(--border-subtle); }
.gantt-row:hover { background: var(--bg-subtle); }
.gantt-tree-cell { display: flex; align-items: center; gap: 6px; padding: 0 12px; border-right: 1px solid var(--border-subtle); font-size: 13px; white-space: nowrap; overflow: hidden; }
.gantt-tree-cell .gantt-toggle { width: 16px; height: 16px; border: 1px solid var(--border-strong); border-radius: 3px; background: var(--bg-surface); display: inline-flex; align-items: center; justify-content: center; font-size: 10px; line-height: 1; color: var(--text-secondary); flex: 0 0 auto; }
.gantt-tree-cell .gantt-toggle:hover { border-color: var(--text-secondary); }
.gantt-tree-cell .gantt-label { overflow: hidden; text-overflow: ellipsis; }
.gantt-row.level-project .gantt-tree-cell { font-weight: 700; }
.gantt-row.level-object .gantt-tree-cell { font-weight: 600; color: var(--text-secondary); }
.gantt-row.level-section .gantt-tree-cell { font-weight: 600; color: var(--text-primary); }
.gantt-row.level-worktype .gantt-tree-cell { font-weight: 500; color: var(--text-secondary); font-style: italic; }
.gantt-row.level-work .gantt-tree-cell { color: var(--text-primary); }
.gantt-track { position: relative; background-image: linear-gradient(to right, var(--border-subtle) 1px, transparent 1px); background-size: var(--col-width, 48px) 100%; overflow: hidden; }
.gantt-bar { position: absolute; top: 13px; height: 10px; border-radius: 3px; cursor: pointer; overflow: hidden; }
.gantt-bar.status-progress { background: var(--brand-blue); }
.gantt-bar.status-done { background: var(--success); }
.gantt-bar.status-risk { background: var(--warning); }
.gantt-bar.status-overdue { background: var(--danger); }
.gantt-bar-progress { display: block; height: 100%; background: rgba(255, 255, 255, 0.35); }
.gantt-today { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--accent-orange); z-index: 4; pointer-events: none; }
.gantt-today::after { content: "сегодня"; position: absolute; top: 2px; left: 6px; font-family: var(--mono); font-size: 9px; color: var(--accent-orange); white-space: nowrap; }
.gantt-legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 10px; font-size: 11px; color: var(--text-secondary); }
.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: 0 0 auto; }
.status-dot.st-progress { background: var(--brand-blue); }
.status-dot.st-done { background: var(--success); }
.status-dot.st-risk { background: var(--warning); }
.status-dot.st-overdue { background: var(--danger); }

/* Dashboard */
.dashboard-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }
.dashboard-grid > * { min-width: 0; }
.dashboard-grid + .dashboard-grid { margin-top: 16px; }
.eyebrow { font-family: var(--mono); font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent-orange); margin-bottom: 8px; }
.owner-banner { background: var(--warning-soft); border-color: var(--line-warn); color: var(--warning); }
.owner-table .data-table { min-width: 720px; }
.owner-money { display: flex; flex-direction: column; gap: 10px; }
.owner-money-row { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; color: var(--text-secondary); }
.owner-money-row strong { color: var(--text-primary); font-family: var(--mono); font-weight: 600; }
.owner-money-total { padding-top: 10px; border-top: 1px solid var(--border-subtle); }
.owner-bar { height: 10px; background: var(--bg-subtle); border-radius: var(--radius-pill); overflow: hidden; margin-top: 6px; }
.owner-bar > span { display: block; height: 100%; background: var(--brand-blue); border-radius: var(--radius-pill); }
.owner-bar-label { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-muted); }
.owner-risk { align-items: flex-start; }
.owner-risk-right { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.owner-risk-right strong { font-family: var(--mono); font-size: 12px; color: var(--danger); }
.owner-decisions { display: flex; flex-direction: column; gap: 10px; }
.owner-decision { display: grid; grid-template-columns: 24px 1fr auto; gap: 10px; align-items: start; padding: 10px 0; border-bottom: 1px solid var(--border-subtle); }
.owner-decision:last-child { border-bottom: 0; }
.owner-decision-num { width: 24px; height: 24px; border-radius: 50%; background: var(--danger-soft); color: var(--danger); display: grid; place-items: center; font-size: 11px; font-weight: 700; }
.owner-decision-impact { margin-top: 4px; font-size: 11px; color: var(--success); }
.owner-milestone-right { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
/* FIX-05: маркетинговый блок «Что даёт система» удалён из разметки и стилей */
.attention-strip { margin-bottom: 16px; padding: 14px 16px; border: 1px solid var(--line-warn); border-radius: var(--radius-md); background: var(--warning-soft); }
.attention-strip-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; font-size: 13px; color: var(--warning); }
.attention-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.attention-item { display: flex; flex-direction: column; gap: 6px; padding: 12px; border: 1px solid var(--line-warn); border-radius: var(--radius-sm); background: rgba(255, 255, 255, 0.7); text-align: left; cursor: pointer; font-family: var(--sans); color: var(--text-primary); }
.attention-item:hover { background: #fff; }
.attention-item-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.attention-item-top strong { font-size: 13px; }
.attention-progress { height: 6px; background: rgba(180, 83, 9, 0.14); border-radius: var(--radius-pill); overflow: hidden; }
.attention-progress > span { display: block; height: 100%; background: var(--warning); border-radius: var(--radius-pill); }
.attention-meta { display: flex; justify-content: space-between; gap: 8px; font-family: var(--mono); font-size: 11px; color: var(--text-muted); }
.project-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.project-card { display: flex; flex-direction: column; gap: 12px; padding: 18px; border: 1px solid var(--border-default); border-radius: var(--radius-md); background: var(--bg-surface); box-shadow: var(--shadow-xs); cursor: pointer; transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease; }
.project-card:hover { border-color: var(--line-info); box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.project-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.project-card-head h3 { margin: 0; font-size: 16px; line-height: 1.25; letter-spacing: -0.02em; }
.project-card-head p { margin: 4px 0 0; font-size: 11px; }
.project-progress { display: flex; align-items: center; gap: 10px; font-family: var(--mono); font-size: 11px; color: var(--text-secondary); }
.project-progress .progress { flex: 1; }
.project-money { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; padding: 10px 0; border-top: 1px solid var(--border-subtle); border-bottom: 1px solid var(--border-subtle); }
.project-money span { display: block; font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); }
.project-money strong { display: block; margin-top: 3px; font-family: var(--mono); font-size: 12px; color: var(--text-primary); }
.project-money .danger { color: var(--danger); }
.project-money .ok { color: var(--success); }
.project-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-family: var(--mono); font-size: 10px; color: var(--text-muted); }
.project-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; }
.project-actions .btn { min-height: 32px; padding: 0 10px; font-size: 11px; }
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.settings-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--border-subtle); }
.settings-row:last-child { border-bottom: 0; }
.settings-row .strong { font-size: 13px; }
.settings-row .muted { font-size: 11px; }
.switch { width: 42px; height: 24px; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--bg-subtle); padding: 2px; cursor: pointer; flex: 0 0 auto; }
.switch span { display: block; width: 18px; height: 18px; border-radius: 50%; background: var(--bg-surface); box-shadow: var(--shadow-xs); transition: transform 0.15s ease; }
.switch.on { background: var(--brand-blue); border-color: var(--brand-blue); }
.switch.on span { transform: translateX(18px); }
.ai-layout { display: grid; grid-template-columns: 1.4fr 0.6fr; gap: 16px; }
.ai-chat-card { display: flex; flex-direction: column; min-height: 520px; }
.ai-chat { flex: 1; display: flex; flex-direction: column; gap: 12px; padding: 4px 0 16px; overflow: auto; max-height: 520px; }
.ai-msg { display: flex; gap: 10px; align-items: flex-start; }
.ai-msg.user { flex-direction: row-reverse; }
.ai-avatar { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--brand-blue-soft); color: var(--brand-blue); font-family: var(--mono); font-size: 9px; font-weight: 700; flex: 0 0 auto; }
.ai-msg.user .ai-avatar { background: var(--success-soft); color: var(--success); }
.ai-bubble { max-width: 78%; padding: 10px 12px; border-radius: 12px; background: var(--bg-subtle); font-size: 13px; line-height: 1.5; color: var(--text-primary); }
.ai-msg.user .ai-bubble { background: var(--brand-blue); color: #fff; }
.ai-input-row { display: flex; gap: 8px; padding-top: 12px; border-top: 1px solid var(--border-subtle); }
.ai-input-row .input { flex: 1; }
.ai-side { align-self: start; }
.ai-suggestions { display: flex; flex-direction: column; gap: 8px; }
.ai-suggestion { text-align: left; padding: 10px 12px; border: 1px solid var(--border-default); border-radius: var(--radius-sm); background: var(--bg-surface); font-family: var(--sans); font-size: 12px; color: var(--text-primary); cursor: pointer; }
.ai-suggestion:hover { border-color: var(--brand-blue); color: var(--brand-blue); }
.ai-note { margin-top: 14px; font-size: 10px; line-height: 1.5; color: var(--text-muted); }
@media (max-width: 900px) { .settings-grid, .ai-layout { grid-template-columns: 1fr; } }
@media (max-width: 1100px) { .project-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .attention-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 700px) { .project-grid, .attention-grid { grid-template-columns: 1fr; } }
.critical-banner { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; margin-bottom: 16px; background: var(--danger-soft); border: 1px solid var(--line-danger); border-radius: var(--radius-md); color: var(--danger); font-size: 13px; }
.critical-banner strong { font-weight: 700; }
.portfolio-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.portfolio-card { background: var(--bg-surface); border: 1px solid var(--border-default); border-radius: var(--radius-md); padding: 14px; cursor: pointer; box-shadow: var(--shadow-xs); }
.portfolio-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.portfolio-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.portfolio-name { font-size: 14px; font-weight: 600; line-height: 1.25; }
.portfolio-meta { margin-top: 6px; font-size: 11px; color: var(--text-muted); }
.portfolio-card .progress { margin-top: 10px; }
.portfolio-foot { display: flex; justify-content: space-between; gap: 8px; margin-top: 6px; font-size: 11px; color: var(--text-secondary); }
.quick-actions { display: flex; flex-direction: column; gap: 8px; }
.quick-actions .btn { justify-content: flex-start; }
.chart { display: flex; align-items: flex-end; gap: 12px; height: 180px; padding: 12px 0 0; }
.chart-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; min-width: 0; }
.chart-bars { display: flex; gap: 4px; align-items: flex-end; height: 100%; width: 100%; justify-content: center; }
.chart-bar { width: 14px; border-radius: 3px 3px 0 0; background: var(--brand-blue); min-height: 2px; }
.chart-bar.fact { background: var(--success); }
.chart-label { font-size: 10px; color: var(--text-muted); white-space: nowrap; }
.status-bar { display: flex; height: 12px; border-radius: var(--radius-pill); overflow: hidden; background: var(--bg-subtle); }
.status-seg { height: 100%; }
.legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 12px; font-size: 12px; color: var(--text-secondary); }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 6px; }
.list { display: flex; flex-direction: column; }
.list-row { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border-subtle); font-size: 13px; }
.list-row:last-child { border-bottom: 0; }
.list-row .muted { color: var(--text-muted); font-size: 11px; }

/* Modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(31, 41, 51, 0.45); display: flex; align-items: center; justify-content: center; padding: 24px; z-index: 100; }
.modal { background: var(--bg-surface); border-radius: var(--radius-lg); width: min(680px, 100%); max-height: 90vh; overflow: auto; box-shadow: var(--shadow-lg); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--border-default); }
.modal-title { margin: 0; font-size: 18px; letter-spacing: -0.02em; }
.modal-body { padding: 20px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 16px 20px; border-top: 1px solid var(--border-default); }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 20px; }
.detail-item .label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); margin-bottom: 3px; }
.detail-item .value { font-size: 13px; color: var(--text-primary); }
.detail-item .value.mono { font-family: var(--mono); }

/* Toast */
.toast-root { position: fixed; right: 24px; bottom: 24px; display: flex; flex-direction: column; gap: 8px; z-index: 200; }
.toast { background: var(--text-primary); color: #fff; padding: 12px 16px; border-radius: 8px; font-size: 13px; box-shadow: var(--shadow-md); max-width: 360px; }
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }

/* Empty */
.empty { padding: 32px; text-align: center; color: var(--text-secondary); }
.empty .icon { width: 32px; height: 32px; color: var(--text-muted); margin-bottom: 8px; }
.empty h3 { margin: 0 0 4px; font-size: 16px; color: var(--text-primary); }
.empty p { margin: 0 0 12px; font-size: 13px; }

/* Login */
.login-screen { position: fixed; inset: 0; display: grid; grid-template-columns: 1.1fr 0.9fr; background: var(--bg-canvas); z-index: 300; }
.login-brand { background: var(--text-primary); color: #fff; padding: 48px; display: flex; align-items: center; justify-content: center; position: relative; overflow: hidden; }
.login-brand::after { content: ""; position: absolute; inset: 0; background-image: linear-gradient(to right, rgba(255,255,255,.04) 1px, transparent 1px), linear-gradient(to bottom, rgba(255,255,255,.04) 1px, transparent 1px); background-size: 24px 24px; pointer-events: none; }
.login-brand-inner { position: relative; z-index: 1; max-width: 520px; }
.login-logo { display: flex; align-items: center; gap: 14px; margin-bottom: 32px; }
.login-mark { width: 64px; height: 64px; }
.login-wordmark { font-size: 28px; font-weight: 600; letter-spacing: -0.02em; }
.login-wordmark span { color: var(--accent-orange); }
.login-brand h1 { font-size: 44px; line-height: 1.05; letter-spacing: -0.04em; margin: 0 0 16px; }
.login-brand p { color: #cbd5e1; font-size: 15px; line-height: 1.5; max-width: 420px; }
.login-mini-gantt { margin-top: 32px; border: 1px solid rgba(255,255,255,.15); border-radius: 12px; padding: 16px; position: relative; }
.mini-row { display: flex; align-items: center; gap: 12px; height: 28px; font-size: 11px; color: #cbd5e1; position: relative; }
.mini-row span { width: 70px; }
.mini-row i { position: absolute; height: 8px; border-radius: 3px; background: var(--accent-orange); }
.mini-today { position: absolute; top: 12px; bottom: 12px; left: 62%; width: 2px; background: var(--accent-orange); }
.login-panel { display: flex; align-items: center; justify-content: center; padding: 48px; }
.login-form { width: min(380px, 100%); }
.login-eyebrow { font-family: var(--mono); font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--accent-orange); margin-bottom: 10px; }
.login-form h2 { margin: 0 0 8px; font-size: 28px; letter-spacing: -0.03em; }
.login-hint { margin: 0 0 24px; color: var(--text-secondary); font-size: 13px; }
.login-error { color: var(--danger); font-size: 12px; margin-bottom: 12px; }
.login-foot { margin-top: 16px; font-size: 12px; color: var(--text-secondary); text-align: center; }

/* Responsive */
@media (max-width: 1100px) {
  .kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .dashboard-grid { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .sidebar { position: fixed; left: -280px; transition: left 0.2s ease; }
  .sidebar.open { left: 0; }
  .menu-btn { display: inline-flex; }
  .topbar-center { display: none; }
  .gantt-head, .gantt-row { grid-template-columns: 260px 1fr; }
  .gantt-head-tree { width: 260px; }
  .login-screen { grid-template-columns: 1fr; }
  .login-brand { display: none; }
}
@media (max-width: 640px) {
  .content { padding: 16px; }
  .page-head { flex-direction: column; }
  .page-actions { justify-content: flex-start; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .filters { flex-direction: column; align-items: stretch; }
  .search-inline .input { min-width: 0; width: 100%; }
  .gantt-head, .gantt-row { grid-template-columns: 200px 1fr; }
  .gantt-head-tree { width: 200px; }
  .detail-grid { grid-template-columns: 1fr; }
  .login-panel { padding: 24px; }
}

/* Kraft Navy theme — слой применения (токены консолидированы в :root выше, FIX-12) */
body {
  background: var(--bg-canvas);
  background-image: radial-gradient(circle at 1px 1px, rgba(120, 85, 50, 0.05) 1px, transparent 0);
  background-size: 18px 18px;
}
.sidebar {
  background: linear-gradient(180deg, #0b1f33 0%, #12304d 100%);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}
.sidebar-head { border-bottom-color: rgba(255, 255, 255, 0.1); }
.brand-badge { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 10px; background: #fff; flex: 0 0 auto; }
.brand-mark { width: 30px; height: auto; filter: none; }
.brand-name { color: #fff; }
.brand-name span { color: var(--accent-orange); }
.brand-sub { color: rgba(255, 255, 255, 0.55); }
.nav-label { color: rgba(255, 255, 255, 0.45); }
.nav-item { color: rgba(255, 255, 255, 0.72); }
.nav-item:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.nav-item.active { background: rgba(184, 115, 51, 0.18); color: #fff; }
.nav-item.active .icon { color: var(--accent-orange); }
.sidebar-foot { border-top: 1px solid rgba(255, 255, 255, 0.1); }
.user-mini-name { color: #fff; }
.user-mini-role { color: rgba(255, 255, 255, 0.55); }
.avatar { background: var(--accent-orange); color: #fff; }
.nav-logout { color: rgba(255, 255, 255, 0.6); }
.topbar { background: rgba(251, 248, 242, 0.92); border-bottom-color: var(--border-default); }
.content { background: transparent; }
.owner-banner, .attention-strip { border-color: var(--line-warn); }
.attention-item { border-color: var(--line-warn); background: rgba(255, 253, 248, 0.7); }
.attention-item:hover { background: #fff; }
.attention-progress { background: rgba(184, 115, 51, 0.14); }
.attention-progress > span { background: var(--warning); }
.project-card:hover { border-color: var(--border-strong); }
.critical-banner { background: var(--warning-soft); border-color: var(--line-warn); color: var(--warning); }
.login-brand { background: linear-gradient(135deg, #0b1f33 0%, #12304d 45%, #0b1f33 100%); }
.login-badge { display: inline-flex; align-items: center; justify-content: center; width: 64px; height: 64px; border-radius: 14px; background: #fff; flex: 0 0 auto; }
.login-mark { width: 44px; height: auto; filter: none; }
.login-wordmark { color: #fff; }
.login-wordmark span { color: var(--accent-orange); }
.login-brand p { color: #d8d2c4; }
.login-mini-gantt { border-color: rgba(255, 255, 255, 0.15); }
.mini-row { color: #d8d2c4; }
.mini-row i { background: var(--accent-orange); }
.portfolio-top { flex-wrap: wrap; }
.portfolio-name { min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 900px) {
  .portfolio-grid { grid-template-columns: 1fr; }
}
.today-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.today-card { padding: 18px; border: 1px solid var(--border-default); border-radius: var(--radius-md); background: var(--bg-surface); box-shadow: var(--shadow-xs); }
.today-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.today-card-head h3 { margin: 0; font-size: 16px; line-height: 1.25; letter-spacing: -0.02em; }
.today-card-head p { margin: 4px 0 0; font-size: 11px; }
.today-progress { display: flex; align-items: center; gap: 10px; margin-top: 12px; font-family: var(--mono); font-size: 11px; color: var(--text-secondary); }
.today-progress .progress { flex: 1; }
.today-meta { display: flex; flex-wrap: wrap; gap: 8px 14px; margin-top: 10px; font-size: 11px; color: var(--text-muted); }
.today-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.today-actions .btn { min-height: 36px; padding: 0 10px; font-size: 11px; }
.today-photo-placeholder { display: flex; align-items: center; gap: 8px; margin-top: 12px; padding: 12px; border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); font-size: 12px; color: var(--text-muted); }
@media (max-width: 900px) {
  .today-grid { grid-template-columns: 1fr; }
}
.owner-sales { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.owner-sales-kpi { padding: 12px; border: 1px solid var(--border-subtle); border-radius: var(--radius-sm); background: var(--bg-subtle); }
.owner-sales-kpi strong { display: block; font-family: var(--mono); font-size: 18px; color: var(--text-primary); }
.owner-sales-kpi span { display: block; margin-top: 3px; font-size: 10px; color: var(--text-muted); }
.owner-decision-cost { margin-top: 4px; font-family: var(--mono); font-size: 10px; color: var(--danger); }
@media (max-width: 900px) {
  .owner-sales { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .owner-sales { grid-template-columns: 1fr; }
}
.gantt-bar.critical { box-shadow: 0 0 0 2px var(--danger); }
.gantt-baseline { position: absolute; top: 10px; width: 2px; height: 16px; background: var(--text-muted); opacity: 0.45; }
.legend-line { display: inline-block; width: 10px; height: 2px; background: var(--text-muted); vertical-align: middle; margin-right: 4px; }
.resource-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.resource-card { padding: 18px; border: 1px solid var(--border-default); border-radius: var(--radius-md); background: var(--bg-surface); box-shadow: var(--shadow-xs); }
.resource-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.resource-head h3 { margin: 0; font-size: 16px; line-height: 1.25; letter-spacing: -0.02em; }
.resource-head p { margin: 4px 0 0; font-size: 11px; }
.resource-load { display: flex; align-items: center; gap: 10px; margin-top: 12px; font-family: var(--mono); font-size: 11px; }
.resource-load .progress { flex: 1; }
.progress.overload > span { background: var(--danger); }
.resource-meta { display: flex; flex-wrap: wrap; gap: 8px 14px; margin-top: 10px; font-size: 11px; color: var(--text-muted); }
.resource-actions { display: flex; gap: 6px; margin-top: 14px; }
@media (max-width: 1100px) {
  .resource-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 700px) {
  .resource-grid { grid-template-columns: 1fr; }
}
.scenario-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.scenario-card { text-align: left; padding: 14px; border: 1px solid var(--border-default); border-radius: var(--radius-sm); background: var(--bg-surface); cursor: pointer; font-family: var(--sans); }
.scenario-card strong { display: block; font-size: 13px; }
.scenario-card span { display: block; margin-top: 4px; font-size: 11px; color: var(--text-muted); }
.scenario-card.active { border-color: var(--accent-orange); box-shadow: 0 0 0 2px rgba(184, 115, 51, 0.18); }
.scenario-result { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)) auto; gap: 10px; align-items: end; padding: 14px; border: 1px solid var(--border-subtle); border-radius: var(--radius-sm); background: var(--bg-subtle); }
.scenario-row span { display: block; font-size: 9px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); }
.scenario-row strong { display: block; margin-top: 4px; font-family: var(--mono); font-size: 13px; color: var(--text-primary); }
@media (max-width: 900px) {
  .scenario-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .scenario-result { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .scenario-grid, .scenario-result { grid-template-columns: 1fr; }
}
.icon-btn { position: relative; }
.notif-badge { position: absolute; top: -4px; right: -4px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px; background: var(--danger); color: #fff; font-family: var(--mono); font-size: 9px; display: grid; place-items: center; }
.notification-list { display: flex; flex-direction: column; gap: 2px; }
.notification-row { display: grid; grid-template-columns: 8px 1fr auto; gap: 10px; align-items: start; padding: 12px 8px; border-bottom: 1px solid var(--border-subtle); cursor: pointer; border-radius: var(--radius-sm); }
.notification-row:hover { background: var(--bg-subtle); }
.notification-row:last-child { border-bottom: 0; }
.notification-dot { width: 7px; height: 7px; margin-top: 6px; border-radius: 50%; background: transparent; }
.notification-row.unread .notification-dot { background: var(--accent-orange); }
.notification-row.read { opacity: 0.72; }
.notification-body .strong { font-size: 13px; }
.notification-body .muted { margin-top: 3px; font-size: 11px; }

/* ============================================================
   Волна 2: FIX-10 skeleton, FIX-14 дельты, FIX-15 тач-цели
   ============================================================ */
.skel-block {
  border-radius: var(--radius-md);
  background: linear-gradient(90deg, var(--border-subtle) 25%, var(--bg-subtle) 50%, var(--border-subtle) 75%);
  background-size: 200% 100%;
  animation: skel 1s linear infinite;
  margin-bottom: 16px;
}
@keyframes skel { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.delta-good { color: var(--success); }
.delta-bad { color: var(--danger); }
.delta-flat { color: var(--text-muted); }
@media (pointer: coarse) {
  .today-actions .btn, .resource-actions .btn { min-height: 44px; }
}

/* [RG 3.2.1]: статус РД «На проверке» — медь */
.gantt-bar.status-check { background: var(--accent-orange); }
.status-dot.st-check { background: var(--accent-orange); }

/* CR-02: конфликт зависимостей поставка/РД → СМР */
.gantt-bar.conflict { outline: 2px dashed var(--danger); outline-offset: 2px; }

/* ============================================================
   PREMIUM LAYER v2 — глубина, движение, типографика, детали.
   Добавочный слой: не меняет структуру, только полирует.
   ============================================================ */

:root {
  --ease-out: cubic-bezier(.22,.61,.36,1);
  --ease-spring: cubic-bezier(.2,.8,.2,1);
  --dur-fast: 120ms;
  --dur: 180ms;
  --dur-slow: 320ms;
  --ring: 0 0 0 3px rgba(184,115,51,.28);
  --hairline: inset 0 1px 0 rgba(255,255,255,.75);
  --shadow-card: 0 1px 2px rgba(14,27,42,.04), 0 10px 28px -18px rgba(14,27,42,.22);
  --shadow-lift: 0 2px 4px rgba(14,27,42,.05), 0 18px 40px -20px rgba(14,27,42,.30);
  --navy-900: #0b1a2b;
  --navy-800: #0f2438;
  --copper-400: #c98a4b;
}

/* ---------- фон: тёплая «крафтовая» бумага с мягким светом ---------- */
body {
  background:
    radial-gradient(1200px 600px at 12% -10%, rgba(184,115,51,.10), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, rgba(18,48,77,.08), transparent 55%),
    radial-gradient(700px 700px at 50% 120%, rgba(63,107,87,.07), transparent 60%),
    var(--bg-canvas);
  background-attachment: fixed;
}
::selection { background: rgba(184,115,51,.22); color: var(--text-primary); }

/* ---------- фокус и доступность ---------- */
:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: none;
  box-shadow: var(--ring);
  border-radius: var(--radius-sm);
}
.nav-item:focus-visible, .tab:focus-visible, .btn:focus-visible { box-shadow: var(--ring); }

/* ---------- типографика ---------- */
.page-title {
  font-size: clamp(26px, 2.2vw, 34px);
  letter-spacing: -0.035em;
  font-weight: 700;
}
.page-sub { color: var(--text-secondary); max-width: 78ch; }
.eyebrow {
  text-transform: uppercase;
  letter-spacing: .16em;
  font-size: 10px;
  font-weight: 700;
  color: var(--accent-orange);
}
.card-title { letter-spacing: -0.015em; }
.mono, .num { font-variant-numeric: tabular-nums; }

/* ---------- sidebar: глубокий navy, медный индикатор ---------- */
.sidebar {
  background:
    linear-gradient(180deg, var(--navy-800), var(--navy-900) 55%, #081422);
  border-right: 1px solid rgba(255,255,255,.06);
  box-shadow: 12px 0 40px -30px rgba(0,0,0,.6);
}
.sidebar .nav-label { color: rgba(255,255,255,.42); letter-spacing: .14em; }
.sidebar .nav-item { color: rgba(255,255,255,.74); border-radius: 10px; transition: background var(--dur) var(--ease-out), color var(--dur) var(--ease-out), transform var(--dur-fast) var(--ease-out); }
.sidebar .nav-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.sidebar .nav-item.active {
  background: linear-gradient(90deg, rgba(201,138,75,.20), rgba(255,255,255,.05));
  color: #fff;
  font-weight: 600;
  position: relative;
}
.sidebar .nav-item.active::before {
  content: ""; position: absolute; left: -8px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 22px; border-radius: 3px;
  background: linear-gradient(180deg, var(--copper-400), var(--accent-orange));
  box-shadow: 0 0 14px rgba(201,138,75,.55);
}
.sidebar .brand-name, .sidebar .user-mini-name { color: #fff; }
.sidebar .brand-sub, .sidebar .user-mini-role { color: rgba(255,255,255,.55); }
/* Разделитель уже есть у .sidebar-foot — вторая линия над пользователем не нужна */
.sidebar .user-mini { border-top: 0; }
.sidebar .nav-logout { color: rgba(255,255,255,.55); }

/* ---------- topbar: стекло ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--bg-surface) 78%, transparent);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--border-subtle);
}
.search-input { transition: box-shadow var(--dur) var(--ease-out), background var(--dur) var(--ease-out); }
.search-input:focus { background: var(--bg-surface); box-shadow: var(--ring); }
.search-hint {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  display: inline-flex; gap: 2px; align-items: center;
  font: 600 10px/1 var(--mono); color: var(--text-muted);
  background: var(--bg-subtle); border: 1px solid var(--border-default);
  border-radius: 5px; padding: 3px 5px; pointer-events: none;
}
.prototype-badge { letter-spacing: .12em; text-transform: uppercase; font-size: 9px; opacity: .7; }

/* ---------- карточки и KPI: свет, подъём ---------- */
.card {
  box-shadow: var(--shadow-card), var(--hairline);
  transition: box-shadow var(--dur) var(--ease-out), transform var(--dur) var(--ease-out), border-color var(--dur) var(--ease-out);
}
.card:hover { box-shadow: var(--shadow-lift), var(--hairline); border-color: var(--border-strong); }
.kpi {
  position: relative; overflow: hidden;
  box-shadow: var(--shadow-card), var(--hairline);
  transition: transform var(--dur) var(--ease-out), box-shadow var(--dur) var(--ease-out);
}
.kpi::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 2px;
  background: linear-gradient(90deg, var(--brand-blue), var(--accent-orange) 65%, transparent);
  opacity: .55;
}
.kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift), var(--hairline); }
.kpi-value { font-variant-numeric: tabular-nums; }
.kpi[data-action]:hover::after {
  content: "→"; position: absolute; right: 14px; top: 14px;
  color: var(--accent-orange); font-weight: 700; opacity: .8;
}

/* ---------- кнопки ---------- */
.btn { transition: transform var(--dur-fast) var(--ease-out), box-shadow var(--dur) var(--ease-out), background var(--dur) var(--ease-out), border-color var(--dur) var(--ease-out); }
.btn:active { transform: translateY(1px) scale(.995); }
.btn-primary {
  background: linear-gradient(180deg, #16395c, var(--brand-blue));
  box-shadow: 0 1px 0 rgba(255,255,255,.14) inset, 0 6px 16px -8px rgba(18,48,77,.55);
}
.btn-primary:hover { background: linear-gradient(180deg, #17405f, var(--brand-blue-hover)); }
.btn-secondary { box-shadow: var(--shadow-xs), var(--hairline); }

/* ---------- таблицы ---------- */
.data-table thead th {
  position: sticky; top: 0; z-index: 2;
  background: color-mix(in srgb, var(--bg-surface) 92%, transparent);
  backdrop-filter: blur(6px);
  letter-spacing: .06em;
}
.data-table tbody tr { transition: background var(--dur-fast) var(--ease-out); }
.data-table tbody tr:hover { background: rgba(184,115,51,.055); }
.data-table tbody tr:focus-visible { background: rgba(184,115,51,.08); box-shadow: inset 3px 0 0 var(--accent-orange); }

/* ---------- pill: точка статуса ---------- */
.pill { transition: background var(--dur) var(--ease-out), color var(--dur) var(--ease-out); }

/* ---------- прогресс и графики ---------- */
.progress { overflow: hidden; }
.progress > span {
  background: linear-gradient(90deg, var(--brand-blue), #2f5d8a);
  border-radius: inherit;
  transition: width var(--dur-slow) var(--ease-out);
}
.progress.overload > span { background: linear-gradient(90deg, var(--warning), var(--danger)); }
.chart-bar {
  border-radius: 4px 4px 2px 2px;
  background: linear-gradient(180deg, #24486b, var(--brand-blue));
  transition: height var(--dur-slow) var(--ease-out), filter var(--dur) var(--ease-out);
}
.chart-bar.fact { background: linear-gradient(180deg, #4d8168, var(--success)); }
.chart-col:hover .chart-bar { filter: brightness(1.08); }

/* ---------- модалки ---------- */
.modal-overlay { backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); animation: k8-fade var(--dur) var(--ease-out) both; }
.modal {
  border-radius: 18px;
  border: 1px solid var(--border-default);
  box-shadow: 0 40px 90px -40px rgba(8,20,34,.55), var(--hairline);
  animation: k8-rise var(--dur-slow) var(--ease-spring) both;
}
.modal-head { border-bottom: 1px solid var(--border-subtle); }
.modal-title { letter-spacing: -0.02em; }
.modal-foot { border-top: 1px solid var(--border-subtle); background: linear-gradient(180deg, transparent, rgba(242,232,213,.35)); }

/* ---------- тосты ---------- */
.toast {
  animation: k8-toast-in var(--dur-slow) var(--ease-spring) both;
  box-shadow: var(--shadow-md), var(--hairline);
  border-radius: 12px;
  position: relative; overflow: hidden;
}
.toast::after {
  content: ""; position: absolute; left: 0; bottom: 0; height: 2px; width: 100%;
  background: linear-gradient(90deg, var(--accent-orange), var(--copper-400));
  transform-origin: left; animation: k8-toast-progress 3.2s linear both;
}
.toast.success::after { background: linear-gradient(90deg, var(--success), #6ea88c); }
.toast.danger::after, .toast.error::after { background: linear-gradient(90deg, var(--danger), #e0705f); }

/* ---------- скелетоны ---------- */
.skeleton, .skeleton-row {
  position: relative; overflow: hidden;
  background: linear-gradient(90deg, rgba(216,210,196,.45), rgba(242,232,213,.75), rgba(216,210,196,.45));
  background-size: 200% 100%;
  animation: k8-shimmer 1.25s linear infinite;
  border-radius: var(--radius-sm);
}

/* ---------- пустые состояния ---------- */
.empty { text-align: center; padding: 44px 20px; }
.empty h3 { letter-spacing: -0.01em; }
.empty p { color: var(--text-muted); max-width: 46ch; margin: 6px auto 14px; }

/* ---------- скроллбары ---------- */
* { scrollbar-width: thin; scrollbar-color: rgba(120,110,95,.45) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: linear-gradient(180deg, rgba(120,110,95,.45), rgba(120,110,95,.28)); border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
*::-webkit-scrollbar-thumb:hover { background: rgba(120,110,95,.6); background-clip: padding-box; }

/* ---------- командная палитра ---------- */
.palette-overlay {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(8,20,34,.42);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  display: grid; place-items: start center;
  padding: 12vh 16px 16px;
  animation: k8-fade var(--dur) var(--ease-out) both;
}
.palette {
  width: min(680px, 100%);
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: 16px;
  box-shadow: 0 50px 100px -40px rgba(8,20,34,.6), var(--hairline);
  overflow: hidden;
  animation: k8-rise var(--dur-slow) var(--ease-spring) both;
}
.palette-search { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border-subtle); }
.palette-search input { flex: 1; border: 0; outline: 0; background: transparent; font-size: 15px; color: var(--text-primary); }
.palette-list { max-height: 46vh; overflow: auto; padding: 6px; }
.palette-group { padding: 8px 10px 4px; font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--text-muted); font-weight: 700; }
.palette-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px 10px; border: 0; border-radius: 9px; background: transparent;
  text-align: left; color: var(--text-primary); font-size: 13px;
  transition: background var(--dur-fast) var(--ease-out);
}
.palette-item .icon { width: 16px; height: 16px; color: var(--text-muted); }
.palette-item small { margin-left: auto; color: var(--text-muted); font-size: 11px; }
.palette-item.active, .palette-item:hover { background: rgba(184,115,51,.12); }
.palette-item.active .icon { color: var(--accent-orange); }
.palette-foot { display: flex; gap: 14px; padding: 9px 14px; border-top: 1px solid var(--border-subtle); color: var(--text-muted); font-size: 11px; background: rgba(242,232,213,.35); }
.palette-foot kbd, .search-hint kbd {
  font: 600 10px/1 var(--mono); background: var(--bg-surface);
  border: 1px solid var(--border-default); border-bottom-width: 2px;
  border-radius: 5px; padding: 2px 5px; color: var(--text-secondary);
}

/* ---------- анимации ---------- */
@keyframes k8-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes k8-rise { from { opacity: 0; transform: translateY(10px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes k8-toast-in { from { opacity: 0; transform: translateX(16px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes k8-toast-progress { from { transform: scaleX(1); } to { transform: scaleX(0); } }
@keyframes k8-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@keyframes k8-pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(180,35,24,.35); } 50% { box-shadow: 0 0 0 6px rgba(180,35,24,0); } }
.attention-item { transition: transform var(--dur) var(--ease-out), box-shadow var(--dur) var(--ease-out); }
.attention-item:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); }

/* ---------- уважение к настройкам ОС ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
@media (prefers-contrast: more) {
  :root { --text-muted: #33414f; --border-default: #b3a894; }
}

/* ---------- печать ---------- */
@media print {
  .sidebar, .topbar, .page-actions, .toast-root, .palette-overlay { display: none !important; }
  body { background: #fff; }
  .card, .kpi { box-shadow: none; border-color: #d6d6d6; break-inside: avoid; }
  .content { padding: 0 !important; }
  .data-table thead th { position: static; }
}

/* ---------- узкие экраны ---------- */
@media (max-width: 1100px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .topbar-center { max-width: none; }
}
@media (max-width: 720px) {
  .page-title { font-size: 24px; }
  .modal { border-radius: 14px; }
}

/* поиск: место под хинт ⌘K */
.search-wrap { position: relative; }
.search-input { padding-right: 62px; }

/* sidebar на тёмном фоне: читаемость бренда, аватара и выхода */
.sidebar .brand-badge {
  display: inline-flex; align-items: center; justify-content: center;
  background: #fff; border-radius: 12px; padding: 4px;
  box-shadow: 0 8px 20px -10px rgba(0,0,0,.7);
}
.sidebar .brand-name { color: #fff; }
.sidebar .brand-name span { color: var(--copper-400); }
.sidebar .brand-sub { color: rgba(255,255,255,.5); }
.sidebar .avatar { background: rgba(255,255,255,.14); color: #fff; border: 1px solid rgba(255,255,255,.18); }
.sidebar .nav-logout:hover { background: rgba(180,35,24,.22); color: #ffb4ab; }
.sidebar-head, .sidebar-foot { border-color: rgba(255,255,255,.08); }

/* FIX: точка статуса в дереве Ганта не должна растягиваться во flex-строке */
.gantt-tree-cell .status-dot {
  display: block;
  width: 8px;
  height: 8px;
  min-width: 8px;
  min-height: 8px;
  flex: 0 0 8px;
  align-self: center;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  padding: 0;
  line-height: 0;
  box-sizing: border-box;
}
.gantt-tree-cell .gantt-spacer {
  display: block;
  width: 16px;
  height: 16px;
  min-width: 16px;
  flex: 0 0 16px;
}

/* Списки «вопросов»: единый вид кликабельных строк во всех ролевых шаблонах */
.list-row-side {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  flex: 0 0 auto;
}
.list-row[data-action] {
  cursor: pointer;
  margin: 0 -8px;
  padding: 10px 8px;
  border-radius: 8px;
  transition: background var(--dur-fast) var(--ease-out);
}
.list-row[data-action]:hover { background: var(--bg-subtle); }
.list-row[data-action]:focus-visible { outline: none; box-shadow: var(--ring); }
