/* РУБЕЖ · палитра и типографика по brand.md */
:root {
  --bg: #14181D;
  --surface: #1F262E;
  --surface-2: #2A333D;
  --text: #EDE7DC;
  --muted: #9AA5AF;
  --accent: #F26B21;
  --accent-hover: #A94A12;
  --accent-dark: #A94A12;
  --brass: #C9A227;
  --success: #3FA96B;
  --warning: #E0A100;
  --danger: #D9534F;
  --line: #39434E;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 18px 40px rgba(0, 0, 0, .35);
  --font-head: "Arial Narrow", "Roboto Condensed", "Liberation Sans Narrow", "Helvetica Neue", system-ui, sans-serif;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 var(--font-body);
  min-width: 0;
  overflow-x: clip;
}
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; min-width: 0; }
a { color: var(--text); text-decoration: none; }
a:hover { color: var(--accent-hover); }
h1, h2, h3, h4 {
  font-family: var(--font-head);
  font-stretch: condensed;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.12;
  margin: 0 0 .5em;
  overflow-wrap: anywhere;
}
h1 { font-size: clamp(30px, 4vw, 46px); letter-spacing: -0.02em; line-height: 1.05; }
h2 { font-size: clamp(28px, 2.4vw, 30px); }
h3 { font-size: 20px; line-height: 1.3; }
p { margin: 0 0 1em; max-width: 70ch; }
small { font-size: 12px; line-height: 1.4; }
hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
::selection { background: var(--accent-dark); color: var(--text); }

.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 1000;
  background: var(--accent); color: #14181D; padding: 10px 14px; border-radius: 8px;
}
.skip-link:focus { top: 12px; }

/* ---------- header ---------- */
.topbar {
  position: sticky; top: 0; z-index: 60;
  display: flex; align-items: center; gap: 18px;
  padding: 12px clamp(14px, 3vw, 32px);
  background: rgba(20, 24, 29, .94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand img { width: 36px; height: 36px; flex: none; }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-text strong {
  font-family: var(--font-head); font-stretch: condensed;
  font-size: 22px; letter-spacing: .04em; line-height: 1;
}
.brand-text small { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.public-nav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.public-nav a, .nav-panel-btn {
  display: inline-flex; align-items: center; min-height: 40px;
  padding: 8px 12px; border-radius: 8px; border: 0; background: transparent;
  color: var(--muted); cursor: pointer; font-weight: 600; font-size: 14px;
  transition: color 150ms var(--ease), background 150ms var(--ease), transform 150ms var(--ease);
}
.public-nav a:hover, .nav-panel-btn:hover { color: var(--text); background: var(--surface-2); transform: translateY(-2px); }
.public-nav a.active { color: var(--text); background: var(--surface-2); box-shadow: inset 0 -2px 0 var(--accent); }
.nav-panel-btn { color: var(--accent); }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.demo-badge {
  font-size: 11px; letter-spacing: .08em; text-transform: uppercase; font-weight: 700;
  color: var(--accent); border: 1px solid var(--accent-dark); border-radius: 999px; padding: 4px 9px;
}
.role-switch { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; }
.role-switch select {
  background: var(--surface-2); border: 1px solid var(--line); color: var(--text);
  border-radius: 8px; padding: 8px 10px; min-height: 40px; cursor: pointer;
}
.icon-btn {
  position: relative; display: inline-grid; place-items: center;
  width: 42px; height: 42px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); cursor: pointer;
  transition: border-color 150ms var(--ease), transform 150ms var(--ease), background 150ms var(--ease);
}
.icon-btn:hover { border-color: var(--accent); background: var(--surface-2); transform: translateY(-2px); }
.cart-count {
  position: absolute; top: -6px; right: -6px; min-width: 19px; height: 19px; padding: 0 4px;
  display: grid; place-items: center; border-radius: 999px;
  background: var(--accent); color: #14181D; font-size: 11px; font-weight: 800;
}

/* ---------- layout ---------- */
.layout { display: grid; grid-template-columns: minmax(0, 1fr); min-height: 60vh; min-width: 0; }
body.mode-panel .layout { grid-template-columns: 240px minmax(0, 1fr); }
.sidebar { display: none; }
body.mode-panel .sidebar {
  display: block; position: sticky; top: 67px; align-self: start; min-width: 0; max-width: 100%;
  height: calc(100vh - 67px); overflow-y: auto; padding: 18px 12px;
  border-right: 1px solid var(--line); background: linear-gradient(180deg, #1F262E, var(--bg));
}
.side-title {
  font-size: 11px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted); font-weight: 700; padding: 4px 10px 10px;
}
.side-nav { display: flex; flex-direction: column; gap: 3px; }
.side-nav a {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px;
  border-radius: 9px; color: var(--muted); font-size: 14px; font-weight: 600;
  min-height: 42px; border: 1px solid transparent;
  transition: background 150ms var(--ease), color 150ms var(--ease), transform 150ms var(--ease);
}
.side-nav a img { width: 21px; height: 21px; flex: none; opacity: .9; }
.side-nav a:hover { color: var(--text); background: var(--surface-2); transform: translateY(-2px); }
.side-nav a.active { color: var(--text); background: var(--surface); border-color: var(--line); box-shadow: inset 3px 0 0 var(--accent); }
.side-nav a .nav-count {
  margin-left: auto; font-size: 11px; background: var(--accent); color: #14181D;
  border-radius: 999px; padding: 1px 7px; font-weight: 800;
}
.side-nav a .nav-count.warn { background: var(--warning); }
.side-roles { margin-top: 18px; padding: 12px 10px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.main { min-width: 0; max-width: 100%; overflow-x: clip; padding: clamp(16px, 2.4vw, 30px); }
body.mode-public .main { padding: 0; }
.screen { min-width: 0; max-width: 1320px; margin: 0 auto; }
.screen:focus { outline: none; }

/* ---------- animations ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn { from { opacity: 0; transform: scale(.98); } to { opacity: 1; transform: none; } }
@keyframes pulse { 0%, 100% { opacity: .35; } 50% { opacity: .8; } }
@keyframes saved { from { background-color: var(--surface-2); } to { background-color: transparent; } }
.screen.enter > .anim { animation: rise 240ms var(--ease-out) both; }
.screen.enter > .anim:nth-child(2) { animation-delay: 60ms; }
.screen.enter > .anim:nth-child(3) { animation-delay: 120ms; }
.screen.enter > .anim:nth-child(4) { animation-delay: 120ms; }
.saved-flash { animation: saved 600ms var(--ease) both; }
.btn, .icon-btn, .card, .kcard, .side-nav a { will-change: transform; }

/* ---------- typography helpers ---------- */
.eyebrow { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; margin-bottom: 8px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.tiny { font-size: 12px; }
.nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; }
.accent { color: var(--accent); }
.success { color: var(--success); }
.danger { color: var(--danger); }
.warn { color: var(--warning); }
h1 .sub, .subhead { color: var(--muted); font-family: var(--font-body); font-size: 15px; font-weight: 400; letter-spacing: 0; display: block; margin-top: 6px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 16px; border-radius: 9px; border: 1px solid transparent;
  background: var(--accent); color: #14181D; font-weight: 700; font-size: 14px;
  cursor: pointer; transition: transform 150ms var(--ease), background 150ms var(--ease), border-color 150ms var(--ease), opacity 150ms var(--ease);
  max-width: 100%; text-align: center;
}
.btn:hover { background: var(--accent-hover); transform: translateY(-2px); }
.btn:active { background: var(--accent-dark); }
.btn[disabled] { opacity: .45; cursor: not-allowed; transform: none; }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--line); }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--accent); }
.btn-danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn-danger:hover { background: rgba(217, 83, 79, .12); }
.btn-sm { min-height: 36px; padding: 6px 11px; font-size: 13px; }
.link-btn { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 4px 2px; text-decoration: underline; text-underline-offset: 3px; }
.link-btn:hover { color: var(--accent); }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* ---------- cards / grids ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: clamp(14px, 2vw, 20px); min-width: 0;
  transition: border-color 150ms var(--ease), transform 150ms var(--ease);
}
.card:hover { border-color: #39434E; }
.card h3 { margin-bottom: 6px; }
.card-flat { background: transparent; border: 1px solid var(--line); }
.panel-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.panel-title h2, .panel-title h3 { margin: 0; }
.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpi-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpi { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.kpi strong { font-family: var(--font-head); font-stretch: condensed; font-size: clamp(28px, 3vw, 42px); line-height: 1; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.kpi .kpi-label { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; }
.kpi .kpi-note { font-size: 12px; color: var(--muted); }
.kpi.accent-kpi strong { color: var(--accent); }
.stack { display: flex; flex-direction: column; gap: 12px; }

/* ---------- badges / chips ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 600; border: 1px solid var(--line); background: var(--surface-2); color: var(--muted);
  max-width: 100%; overflow-wrap: anywhere;
}
.badge img { width: 15px; height: 15px; }
.badge.success { color: #3FA96B; border-color: rgba(63, 169, 107, .45); background: rgba(63, 169, 107, .12); }
.badge.warn { color: #E0A100; border-color: rgba(224, 161, 0, .5); background: rgba(224, 161, 0, .12); }
.badge.danger { color: #D9534F; border-color: rgba(217, 83, 79, .5); background: rgba(217, 83, 79, .12); }
.badge.brass { color: #C9A227; border-color: rgba(201, 162, 39, .5); background: rgba(201, 162, 39, .12); }
.badge.accent { color: var(--accent); border-color: var(--accent-dark); background: rgba(242, 107, 33, .1); }
.chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 6px;
  background: var(--surface-2); border: 1px solid var(--line); font-size: 12px; color: var(--muted);
}
.chip.vip { color: #C9A227; border-color: rgba(201, 162, 39, .5); }
.chip.urgent { color: #D9534F; border-color: rgba(217, 83, 79, .5); }

/* ---------- tables ---------- */
.table-wrap { width: 100%; overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 640px; }
table.data th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .07em;
  color: var(--muted); font-weight: 700; padding: 11px 12px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
table.data td { padding: 11px 12px; border-bottom: 1px solid rgba(57, 67, 78, .55); vertical-align: middle; }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr { transition: background 150ms var(--ease); cursor: pointer; }
table.data tbody tr:hover { background: var(--surface-2); }
table.data .cell-main { font-weight: 600; }
table.data .actions-cell { white-space: nowrap; }
table.data tr.static-row { cursor: default; }

/* ---------- forms ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span, .field > label { font-size: 13px; font-weight: 600; color: var(--text); }
.field small { color: var(--muted); }
input[type="text"], input[type="tel"], input[type="email"], input[type="search"], input[type="date"], input[type="time"], input[type="number"], input[type="password"], input[type="datetime-local"], select, textarea {
  width: 100%; min-height: 44px; padding: 10px 12px; border-radius: 9px;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--text);
  transition: border-color 150ms var(--ease), background 150ms var(--ease);
}
input:hover, select:hover, textarea:hover { border-color: #39434E; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
textarea { min-height: 96px; resize: vertical; }
input::placeholder, textarea::placeholder { color: #9AA5AF; }
input[type="file"] { padding: 9px; background: var(--surface-2); border: 1px dashed var(--line); border-radius: 9px; min-height: 44px; width: 100%; }
.check { display: flex; align-items: flex-start; gap: 9px; font-size: 13px; color: var(--muted); line-height: 1.45; }
.check input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--accent); flex: none; }
.check a { color: var(--accent); text-decoration: underline; }
.form-note { font-size: 12px; color: var(--muted); }
.form-error { color: var(--danger); font-size: 12px; min-height: 16px; }
.filters {
  display: grid; grid-template-columns: minmax(180px, 1.6fr) repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px; align-items: end; margin-bottom: 14px;
}
.filters .field { gap: 4px; }
.filters .field > span { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.search-wrap { position: relative; }
.search-wrap input { padding-left: 34px; }
.search-wrap::before {
  content: ""; position: absolute; left: 12px; bottom: 14px; width: 13px; height: 13px;
  border: 2px solid var(--muted); border-radius: 50%;
}
.search-wrap::after {
  content: ""; position: absolute; left: 23px; bottom: 10px; width: 6px; height: 2px;
  background: var(--muted); transform: rotate(45deg);
}
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; min-width: 0; }
.toolbar > * { min-width: 0; }
.toolbar .btn-row { flex-wrap: wrap; }
.stock-search { flex: 1 1 220px; max-width: 300px; }
.segmented { display: inline-flex; padding: 3px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 9px; max-width: 100%; flex-wrap: wrap; }
.segmented button {
  border: 0; background: transparent; color: var(--muted); padding: 7px 12px; border-radius: 7px;
  cursor: pointer; font-size: 13px; font-weight: 600; min-height: 36px;
  transition: background 150ms var(--ease), color 150ms var(--ease);
}
.segmented button.active { background: var(--surface); color: var(--text); box-shadow: inset 0 0 0 1px var(--line); }
.segmented button:hover { color: var(--text); }

/* ---------- segmented stage bars ---------- */
.segbar { display: flex; gap: 3px; width: 100%; min-width: 80px; }
.segbar .seg { height: 6px; flex: 1; border-radius: 3px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); }
.segbar .seg.on { background: var(--accent); box-shadow: none; }
.segbar .seg.done { background: var(--success); box-shadow: none; }
.segbar .seg.late { background: var(--danger); box-shadow: none; }
.stage-labels { display: flex; justify-content: space-between; gap: 8px; font-size: 10px; color: var(--muted); margin-top: 5px; letter-spacing: .03em; }

/* ---------- kanban ---------- */
.kanban { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; align-items: start; }
.kcol { background: rgba(31, 38, 46, .55); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; min-height: 220px; min-width: 0; }
.kcol.dragover { border-color: var(--accent); background: rgba(242, 107, 33, .07); }
.kcol-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-bottom: 10px; }
.kcol-head h3 { font-size: 15px; margin: 0; }
.kcol-head .kcount { font-size: 12px; color: var(--muted); }
.kcard {
  background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--line);
  border-radius: 10px; padding: 10px; margin-bottom: 9px; cursor: grab; min-width: 0;
  transition: border-color 150ms var(--ease), transform 150ms var(--ease), opacity 150ms var(--ease);
}
.kcard:hover { border-color: #39434E; transform: translateY(-2px); }
.kcard:active { cursor: grabbing; }
.kcard.dragging { opacity: .45; }
.kcard.urgent { border-left-color: var(--danger); }
.kcard.vip { border-left-color: var(--brass); }
.kcard h4 { margin: 0 0 4px; font-size: 14px; font-family: var(--font-body); font-weight: 700; overflow-wrap: anywhere; }
.kcard .kmeta { display: flex; flex-wrap: wrap; gap: 5px; margin: 6px 0; }
.kcard .kfoot { display: flex; align-items: center; justify-content: space-between; gap: 6px; font-size: 12px; color: var(--muted); }

/* ---------- charts ---------- */
.chart-card { display: flex; flex-direction: column; gap: 8px; }
.chart-wrap { width: 100%; min-height: 190px; }
.chart-wrap canvas { width: 100%; height: 190px; display: block; }
.legend { display: flex; flex-wrap: wrap; gap: 10px; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 5px; }
.bar-list { display: flex; flex-direction: column; gap: 9px; }
.bar-row { display: grid; grid-template-columns: minmax(80px, 1fr) 2.4fr auto; gap: 8px; align-items: center; font-size: 13px; }
.bar-track { height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.bar-fill { height: 100%; background: var(--accent); border-radius: 4px; }
.bar-fill.alt { background: var(--brass); }

/* ---------- calendar ---------- */
.cal-tools { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.cal-scroll { overflow: auto; max-height: 620px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.cal { display: grid; grid-template-columns: 58px repeat(3, minmax(150px, 1fr)); min-width: 560px; }
.cal-corner, .cal-head-cell {
  position: sticky; top: 0; z-index: 5; background: var(--surface-2); border-bottom: 1px solid var(--line);
  padding: 10px 8px; font-size: 12px; font-weight: 700; color: var(--muted);
}
.cal-corner { left: 0; z-index: 7; }
.cal-col { border-left: 1px solid var(--line); position: relative; }
.cal-hours { position: relative; }
.cal-hour { height: 46px; border-bottom: 1px solid rgba(57, 67, 78, .45); font-size: 11px; color: var(--muted); padding: 3px 4px; text-align: right; }
.cal-lane { position: relative; height: 644px; }
.cal-slot {
  position: absolute; left: 5px; right: 5px; border-radius: 7px; padding: 5px 7px;
  background: rgba(242, 107, 33, .16); border: 1px solid var(--accent-dark);
  font-size: 11px; line-height: 1.25; overflow: hidden; cursor: pointer; min-width: 0;
  transition: background 150ms var(--ease), transform 150ms var(--ease);
}
.cal-slot:hover { background: rgba(242, 107, 33, .28); transform: translateY(-1px); }
.cal-slot b { display: block; font-size: 12px; }
.cal-slot.full { background: rgba(154, 165, 175, .14); border-color: var(--line); color: var(--muted); }
.cal-slot.tour { background: rgba(201, 162, 39, .16); border-color: rgba(201, 162, 39, .6); }
.week-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; min-width: 680px; }
.week-day { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 8px; min-width: 0; }
.week-day h4 { margin: 0 0 6px; font-size: 13px; }
.week-slot { display: block; width: 100%; text-align: left; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); border-radius: 6px; padding: 5px 7px; margin-bottom: 5px; font-size: 11px; cursor: pointer; }
.week-slot.full { color: var(--muted); }
.week-wrap { overflow-x: auto; padding-bottom: 4px; }

/* ---------- notifications / feed ---------- */
.feed { display: flex; flex-direction: column; gap: 8px; }
.feed-item {
  display: flex; gap: 10px; align-items: flex-start; padding: 11px 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px; min-width: 0;
  transition: border-color 150ms var(--ease), background 150ms var(--ease);
}
.feed-item.unread { border-left: 3px solid var(--accent); background: rgba(42, 51, 61, .7); }
.feed-item img { width: 20px; height: 20px; flex: none; margin-top: 2px; }
.feed-body { min-width: 0; flex: 1; }
.feed-body p { margin: 0 0 3px; font-size: 14px; max-width: none; }
.feed-meta { display: flex; flex-wrap: wrap; gap: 8px; font-size: 11px; color: var(--muted); }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.switch:last-child { border-bottom: 0; }
.switch .switch-text { min-width: 0; }
.switch .switch-text b { display: block; font-size: 14px; }
.switch .switch-text span { font-size: 12px; color: var(--muted); }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track {
  width: 48px; height: 28px; border-radius: 999px; background: var(--surface-2);
  border: 1px solid var(--line); position: relative; cursor: pointer; flex: none;
  transition: background 150ms var(--ease), border-color 150ms var(--ease);
}
.switch .track::after {
  content: ""; position: absolute; width: 20px; height: 20px; border-radius: 50%;
  background: var(--muted); top: 3px; left: 3px; transition: transform 150ms var(--ease), background 150ms var(--ease);
}
.switch input:checked + .track { background: rgba(242, 107, 33, .25); border-color: var(--accent); }
.switch input:checked + .track::after { transform: translateX(20px); background: var(--accent); }
.switch input:focus-visible + .track { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- documents / photos ---------- */
.version-list { display: flex; flex-direction: column; gap: 8px; }
.version {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 12px;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 9px; min-width: 0;
}
.version .v-num { font-weight: 800; font-size: 13px; color: var(--accent); }
.version .v-file { font-size: 13px; min-width: 0; overflow-wrap: anywhere; flex: 1; }
.version .v-date { font-size: 11px; color: var(--muted); }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.photo-card { background: var(--surface-2); border: 1px solid var(--line); border-radius: 9px; overflow: hidden; min-width: 0; }
.photo-card img { width: 100%; height: 104px; object-fit: cover; }
.photo-card figcaption { padding: 7px 9px; font-size: 11px; color: var(--muted); overflow-wrap: anywhere; }
.empty { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 28px 16px; gap: 8px; }
.empty img { width: 72px; height: 72px; opacity: .85; }
.empty h3 { margin: 0; }
.empty p { margin: 0; color: var(--muted); font-size: 14px; }
.approved-strip { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 10px; border: 1px solid rgba(63, 169, 107, .35); background: rgba(63, 169, 107, .08); border-radius: 8px; font-size: 12px; }
.approved-strip img { width: 16px; height: 16px; }

/* ---------- public / storefront ---------- */
.hero {
  position: relative; overflow: hidden; border-bottom: 1px solid var(--line);
  background: radial-gradient(1200px 500px at 15% -10%, rgba(242, 107, 33, .13), transparent 62%), var(--bg);
}
.hero-inner {
  max-width: 1280px; margin: 0 auto; padding: clamp(26px, 5vw, 64px) clamp(16px, 4vw, 40px) clamp(30px, 4vw, 54px);
  display: grid; grid-template-columns: 1.05fr .95fr; gap: clamp(18px, 3vw, 40px); align-items: center;
}
.hero-copy { position: relative; z-index: 2; min-width: 0; }
.hero-copy h1 { max-width: 16ch; }
.hero-copy .lead { font-size: clamp(15px, 1.4vw, 18px); color: var(--muted); max-width: 46ch; }
.hero-copy .btn-row { margin-top: 18px; }
.hero-media { position: relative; min-width: 0; }
.hero-media img.hero-img {
  width: 100%; aspect-ratio: 16 / 10; object-fit: cover; border-radius: var(--radius);
  border: 1px solid var(--line); box-shadow: var(--shadow);
}
.hero-target { position: absolute; width: 96px; height: 96px; right: -14px; top: -22px; opacity: .5; pointer-events: none; }
.hero-stats { display: flex; flex-wrap: wrap; gap: 18px; margin-top: 22px; }
.hero-stats div { min-width: 90px; }
.hero-stats strong { display: block; font-family: var(--font-head); font-stretch: condensed; font-size: 28px; line-height: 1; }
.hero-stats span { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.public-section { max-width: 1280px; margin: 0 auto; padding: clamp(26px, 4vw, 52px) clamp(16px, 4vw, 40px); }
.public-section + .public-section { border-top: 1px solid var(--line); }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.section-head p { margin: 4px 0 0; color: var(--muted); }
.format-card { overflow: hidden; padding: 0; display: flex; flex-direction: column; }
.format-card img.format-img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-bottom: 1px solid var(--line); }
.format-card .format-body { padding: 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; min-width: 0; }
.format-card .format-top { display: flex; align-items: center; gap: 8px; }
.format-card .format-top img { width: 24px; height: 24px; }
.format-price { display: flex; align-items: baseline; gap: 6px; }
.format-price strong { font-family: var(--font-head); font-stretch: condensed; font-size: 26px; }
.format-card .btn { margin-top: auto; }
.steps { counter-reset: step; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.step { position: relative; padding-left: 44px; }
.step::before {
  counter-increment: step; content: counter(step);
  position: absolute; left: 0; top: 0; width: 30px; height: 30px; border-radius: 50%;
  border: 1px solid var(--accent); color: var(--accent); display: grid; place-items: center;
  font-weight: 800; font-size: 13px;
}
.lead-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; align-items: start; }
.contact-list { display: flex; flex-direction: column; gap: 10px; }
.contact-list div { display: flex; gap: 10px; align-items: baseline; }
.contact-list dt { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; min-width: 84px; }
.contact-list dd { margin: 0; font-size: 15px; }
.public-cta { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.public-cta h2 { margin: 0; font-size: clamp(20px, 2.4vw, 28px); }

/* ---------- cart / checkout ---------- */
.cart-line { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.cart-line:last-child { border-bottom: 0; }
.qty { display: inline-flex; align-items: center; gap: 2px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.qty button { width: 34px; height: 34px; border: 0; background: var(--surface-2); color: var(--text); cursor: pointer; font-weight: 700; }
.qty span { min-width: 26px; text-align: center; font-size: 13px; }
.cart-total { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-top: 12px; }
.cart-total strong { font-family: var(--font-head); font-stretch: condensed; font-size: 28px; }
.summary-rows { display: flex; flex-direction: column; gap: 6px; }
.summary-rows > div { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; }
.summary-rows .total { border-top: 1px solid var(--line); padding-top: 8px; font-weight: 700; }

/* ---------- modal / toast ---------- */
.modal-root[hidden] { display: none; }
.modal-backdrop {
  position: fixed; inset: 0; z-index: 200; background: rgba(8, 10, 13, .72);
  display: flex; align-items: center; justify-content: center; padding: 16px;
  animation: fadeIn 180ms var(--ease) both;
}
.modal {
  width: min(720px, 100%); max-height: min(88vh, 900px); overflow-y: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: var(--shadow); animation: popIn 240ms var(--ease-out) both; min-width: 0;
}
.modal.modal-wide { width: min(960px, 100%); }
.modal.modal-narrow { width: min(480px, 100%); }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 16px 18px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); z-index: 2; }
.modal-head h2 { margin: 0; font-size: 22px; }
.modal-head .close-x { flex: none; }
.modal-body { padding: 18px; min-width: 0; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; padding: 14px 18px; border-top: 1px solid var(--line); position: sticky; bottom: 0; background: var(--surface); }
.toast-root { position: fixed; right: 16px; bottom: 16px; z-index: 300; display: flex; flex-direction: column; gap: 8px; max-width: min(380px, calc(100vw - 32px)); }
.toast {
  background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--accent);
  border-radius: 10px; padding: 11px 13px; box-shadow: var(--shadow); font-size: 13px;
  animation: rise 240ms var(--ease-out) both;
}
.toast.success { border-left-color: var(--success); }
.toast.danger { border-left-color: var(--danger); }
.toast.warn { border-left-color: var(--warning); }
.toast strong { display: block; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 2px; }

/* ---------- misc ---------- */
.notice { border: 1px solid var(--line); border-left: 3px solid var(--accent); background: rgba(42, 51, 61, .6); border-radius: 9px; padding: 12px 14px; font-size: 14px; }
.notice.warn { border-left-color: var(--warning); }
.notice.danger { border-left-color: var(--danger); }
.notice.success { border-left-color: var(--success); }
.denied { text-align: center; padding: 48px 16px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.denied img { width: 64px; height: 64px; opacity: .8; }
.tab-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 12px; font-size: 13px; color: var(--muted); }
.pagination .btn-row { gap: 6px; }
.kv { display: grid; grid-template-columns: minmax(110px, .8fr) 1.2fr; gap: 6px 12px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.bracket-view { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 6px; }
.bracket-round { min-width: 160px; display: flex; flex-direction: column; gap: 8px; justify-content: space-around; }
.bracket-round h4 { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin: 0; }
.bracket-match { border: 1px solid var(--line); background: var(--surface-2); border-radius: 7px; padding: 6px 8px; font-size: 12px; }
.bracket-match span { display: block; }
.bracket-match .winner { color: var(--success); font-weight: 700; }
.divider { border-top: 1px solid var(--line); margin: 16px 0; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skeleton { background: linear-gradient(90deg, var(--surface-2), #2A333D, var(--surface-2)); background-size: 200% 100%; border-radius: 8px; height: 14px; animation: pulse 1200ms ease-in-out infinite; }

.media-band { padding: 28px clamp(16px, 4vw, 40px) 34px; border-top: 1px solid var(--line); background: var(--surface); }
body.mode-panel .media-band { display: none; }
.media-band-inner { max-width: 1320px; margin: 0 auto; }
.media-band-head { margin-bottom: 16px; }
.media-band-head h2 { margin-bottom: 6px; }
.media-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.media-card { margin: 0; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.media-card img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.media-card figcaption { padding: 9px 11px; font-size: 12px; color: var(--muted); }
.media-icons { list-style: none; display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 16px 0 0; padding: 0; font-size: 12px; color: var(--muted); }
.media-icons li { display: inline-flex; align-items: center; gap: 6px; }
.media-icons img { width: 18px; height: 18px; opacity: .85; }

.site-footer {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; flex-wrap: wrap;
  padding: 24px clamp(16px, 4vw, 40px); border-top: 1px solid var(--line); background: #14181D;
  color: var(--muted); font-size: 13px;
}
.site-footer p { margin: 4px 0 0; }
.site-footer strong { color: var(--text); }
.footer-actions { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; font-size: 12px; }
.footer-actions a { color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }

/* ---------- responsive ---------- */
@media (max-width: 1199px) {
  .grid-4, .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  body.mode-panel .layout { grid-template-columns: 210px minmax(0, 1fr); }
  .sidebar { top: 61px; }
}
@media (max-width: 1023px) {
  body.mode-panel .layout { grid-template-columns: minmax(0, 1fr); }
  body.mode-panel .sidebar {
    position: sticky; top: 0; height: auto; max-width: 100%; overflow-x: hidden; border-right: 0; border-bottom: 1px solid var(--line);
    padding: 8px 10px; z-index: 50;
  }
  body.mode-panel .side-title, body.mode-panel .side-roles { display: none; }
  body.mode-panel .side-nav { flex-direction: row; min-width: 0; max-width: 100%; overflow-x: auto; gap: 4px; padding-bottom: 2px; }
  body.mode-panel .side-nav a { white-space: nowrap; flex: none; padding: 8px 10px; }
  body.mode-panel .side-nav a .nav-count { margin-left: 2px; }
  .kanban { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero-inner { grid-template-columns: 1fr; }
  .hero-media { order: -1; }
  .hero-media img.hero-img { aspect-ratio: 16 / 9; }
  .hero-target { width: 72px; height: 72px; }
  .lead-layout { grid-template-columns: 1fr; }
  .steps { grid-template-columns: 1fr; }
}
@media (max-width: 767px) {
  .media-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .topbar { gap: 8px 12px; padding: 10px 14px; }
  .brand-text small { display: none; }
  .public-nav { order: 3; width: 100%; justify-content: space-between; gap: 0; }
  .public-nav a, .nav-panel-btn { padding: 7px 9px; font-size: 13px; }
  .top-actions { gap: 7px; }
  .role-switch > span { display: none; }
  .role-switch select { padding: 7px 8px; font-size: 13px; }
  .main { padding: 14px; }
  .grid-2, .grid-3, .grid-4, .kpi-grid, .form-grid { grid-template-columns: 1fr; }
  .kanban { grid-template-columns: 1fr; }
  .hero-inner, .public-section { padding-left: 16px; padding-right: 16px; }
  .hero-copy h1 { max-width: none; }
  .hero-stats { gap: 12px; }
  .filters { grid-template-columns: 1fr 1fr; }
  .filters .search-wrap { grid-column: 1 / -1; }
  .toolbar { align-items: stretch; }
  .toolbar .segmented { width: 100%; }
  .toolbar .stock-search { flex: 1 1 100%; max-width: none; width: 100%; }
  .cal-scroll { max-height: 520px; }
  .cal { grid-template-columns: 48px repeat(3, minmax(128px, 1fr)); min-width: 480px; }
  .modal { border-radius: 12px; }
  .modal-body { padding: 14px; }
  table.data { min-width: 0; }
  table.data thead { display: none; }
  table.data, table.data tbody, table.data tr, table.data td { display: block; width: 100%; }
  table.data tr { padding: 10px 12px; border-bottom: 1px solid var(--line); }
  table.data td { border: 0; padding: 3px 0; display: grid; grid-template-columns: 104px minmax(0, 1fr); gap: 8px; font-size: 13px; }
  table.data td::before { content: attr(data-label); color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; padding-top: 1px; }
  table.data td.actions-cell { display: flex; flex-wrap: wrap; gap: 6px; padding-top: 7px; }
  table.data td.actions-cell::before { display: none; }
  .version .v-file { flex-basis: 100%; order: 3; }
  .public-cta { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 420px) {
  .media-grid { grid-template-columns: 1fr; }
  .filters { grid-template-columns: 1fr; }
  .hero-stats div { min-width: 74px; }
  .top-actions .demo-badge { display: none; }
  .pagination { flex-direction: column; align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
  .screen.enter > .anim { animation: none !important; opacity: 1 !important; transform: none !important; }
  .skeleton { animation: none !important; opacity: .65; }
  .modal, .modal-backdrop { animation: none !important; }
}

@media print {
  .topbar, .sidebar, .site-footer, .modal-foot, .toolbar, .filters, .toast-root { display: none !important; }
  body { background: #EDE7DC; color: #14181D; }
  .card { border-color: #9AA5AF; }
}

/* ---------- auth + static media rail ---------- */
.auth-wrap { display: flex; justify-content: center; padding: clamp(28px, 6vw, 70px) 16px; }
.auth-card { width: min(460px, 100%); padding: clamp(20px, 3vw, 30px); }
.auth-card img { width: 52px; height: 52px; margin-bottom: 12px; }
.auth-card h1 { font-size: clamp(28px, 4vw, 36px); }
.auth-card .btn-row { margin-top: 14px; }
.media-icons { list-style: none; display: flex; flex-wrap: wrap; gap: 8px 16px; margin: 16px 0 0; padding: 0; color: var(--muted); font-size: 12px; }
.media-icons li { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.media-icons img { width: 20px; height: 20px; flex: none; opacity: .9; }
