/* Склад «Ячейка»: the tokens of antongoncharov.ru (web/app/globals.css), so the demo looks like part of the site. */
@font-face { font-family: "Manrope"; font-weight: 200 800; font-display: swap; src: url("../fonts/manrope-cyrillic-wght-normal.woff2") format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Manrope"; font-weight: 200 800; font-display: swap; src: url("../fonts/manrope-latin-wght-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "JetBrains Mono"; font-weight: 100 800; font-display: swap; src: url("../fonts/jetbrains-mono-cyrillic-wght-normal.woff2") format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "JetBrains Mono"; font-weight: 100 800; font-display: swap; src: url("../fonts/jetbrains-mono-latin-wght-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --bg: #f7f7fb; --surface: #fff; --surface-2: #f0eff8; --fg: #14121f; --muted: #5d5a72;
  --line: rgb(20 18 31 / .1); --accent: #5b3df5; --accent-fg: #fff; --accent-soft: rgb(91 61 245 / .1);
  --success: #12a46b; --warning: #c27a06; --danger: #d33049; --header: rgb(247 247 251 / .72);
  --shadow: 0 1px 2px rgb(20 18 31 / .04), 0 8px 24px -12px rgb(20 18 31 / .12);
  --font: "Manrope", system-ui, sans-serif; --mono: "JetBrains Mono", ui-monospace, monospace;
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: #0c0b14; --surface: #14121f; --surface-2: #1c1a2b; --fg: #ecebf5; --muted: #a29fb8;
  --line: rgb(236 235 245 / .1); --accent: #8570ff; --accent-fg: #0c0b14; --accent-soft: rgb(133 112 255 / .14);
  --success: #3ccf91; --warning: #f2b544; --danger: #ff6b7f; --header: rgb(12 11 20 / .72);
  --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 12px 32px -16px rgb(0 0 0 / .6);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.5; background: var(--bg); color: var(--fg); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
::selection { background: var(--accent); color: var(--accent-fg); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
h1, h2, h3, p { margin: 0; }
.mono { font-family: var(--mono); font-feature-settings: "zero" 0; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
svg.i { width: 18px; height: 18px; flex: none; }
svg.i-sm { width: 15px; height: 15px; flex: none; }

/* Header */
.app-header { position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 12px; height: 56px; padding: 0 16px; border-bottom: 1px solid var(--line); background: var(--header); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); }
.logo { display: block; width: 32px; height: 32px; flex: none; }
.logo svg { display: block; width: 100%; height: 100%; }
.brand { min-width: 0; line-height: 1.25; }
.brand b { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand span { display: block; font-size: 12px; color: var(--muted); white-space: nowrap; }
.header-tools { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.segmented { display: inline-flex; padding: 2px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface-2); }
.segmented button, .segmented a { height: 30px; padding: 0 12px; border: 0; border-radius: 999px; background: transparent; color: var(--muted); font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.segmented button:hover, .segmented a:hover { color: var(--fg); }
.segmented .on { background: var(--surface); color: var(--fg); box-shadow: 0 1px 3px rgb(0 0 0 / .12); }
.pill-link { display: inline-flex; align-items: center; height: 36px; padding: 0 14px; border: 1px solid var(--line); border-radius: 999px; font-size: 14px; font-weight: 600; transition: color .15s, border-color .15s; }
.pill-link:hover { color: var(--accent); border-color: var(--accent); }
.icon-btn { display: grid; place-items: center; width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 999px; background: transparent; color: var(--fg); cursor: pointer; }
.icon-btn:hover { color: var(--accent); border-color: var(--accent); }
.theme-dark-icon { display: none; }
[data-theme="dark"] .theme-dark-icon { display: block; }
[data-theme="dark"] .theme-light-icon { display: none; }
.role-select { display: none; }

/* Shell */
.shell { display: grid; grid-template-columns: 252px minmax(0, 1fr); min-height: calc(100dvh - 56px); }
.sidebar { position: sticky; top: 56px; height: calc(100dvh - 56px); display: flex; flex-direction: column; gap: 18px; padding: 16px 12px; border-right: 1px solid var(--line); overflow-y: auto; }
.workspace { display: flex; align-items: center; gap: 10px; padding: 10px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.workspace .mark { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: linear-gradient(135deg, var(--accent), #8f7bff); color: #fff; font-weight: 800; }
.workspace b { display: block; font-size: 14px; }
.workspace span { display: block; font-size: 12px; color: var(--muted); }
.nav-label { padding: 0 10px 6px; font-family: var(--mono); font-size: 10px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.nav { display: grid; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 12px; height: 40px; padding: 0 10px; border-radius: 12px; color: var(--muted); font-size: 14px; font-weight: 700; transition: background .15s, color .15s; }
.nav a:hover { background: var(--surface-2); color: var(--fg); }
.nav a.on { background: var(--accent-soft); color: var(--accent); }
.nav .count { margin-left: auto; min-width: 22px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--accent); color: var(--accent-fg); font-family: var(--mono); font-size: 11px; font-weight: 700; display: grid; place-items: center; }
.sidebar-foot { margin-top: auto; display: grid; gap: 8px; }
.role-card { padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); font-size: 12.5px; color: var(--muted); }
.role-card b { display: block; color: var(--fg); font-size: 14px; }
.role-card ul { margin: 6px 0 0; padding-left: 16px; }
.mobile-nav { display: none; }
main { width: 100%; max-width: 1240px; margin: 0 auto; padding: 28px 28px 56px; }

/* Page blocks */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 22px; }
.page-head h1 { font-size: 26px; font-weight: 800; letter-spacing: -.02em; line-height: 1.15; }
.page-head p { margin-top: 6px; color: var(--muted); font-size: 14px; max-width: 720px; }
.crumbs { display: flex; gap: 6px; align-items: center; margin-bottom: 6px; font-size: 13px; color: var(--muted); }
.crumbs a:hover { color: var(--accent); }
.stack { display: grid; gap: 16px; }
.grid { display: grid; gap: 16px; }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); align-items: start; }
.kpis { display: grid; gap: 12px; grid-template-columns: repeat(6, minmax(0, 1fr)); margin-bottom: 16px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 18px; box-shadow: var(--shadow); min-width: 0; }
.card.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.card.flush .card-head { padding: 16px 18px 0; }
.card-head h2 { font-size: 15px; font-weight: 800; }
.card-head p { margin-top: 2px; font-size: 12.5px; color: var(--muted); }
.kpi { padding: 14px 16px; }
.kpi .label { font-size: 12px; font-weight: 600; color: var(--muted); }
.kpi .value { margin-top: 4px; font-family: var(--mono); font-size: 22px; font-weight: 600; letter-spacing: -.02em; white-space: nowrap; }
.kpi .hint { margin-top: 2px; font-size: 12px; color: var(--muted); }
.kpi.warn .value { color: var(--warning); }
.kpi.danger .value { color: var(--danger); }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { padding: 10px 12px; font-size: 12px; font-weight: 600; color: var(--muted); text-align: left; white-space: nowrap; border-bottom: 1px solid var(--line); }
td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr.link { cursor: pointer; transition: background .12s; }
tbody tr.link:hover { background: var(--surface-2); }
.num { text-align: right; font-family: var(--mono); white-space: nowrap; }
td .title { font-weight: 700; }
td .title:hover { color: var(--accent); }
.sub { display: block; font-size: 12px; font-weight: 500; color: var(--muted); }
.cell-tag { display: inline-flex; align-items: center; height: 22px; padding: 0 7px; border-radius: 6px; background: var(--surface-2); font-family: var(--mono); font-size: 12px; font-weight: 600; white-space: nowrap; }

/* Badges */
.badge { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; background: var(--surface-2); color: var(--muted); }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.plain::before { display: none; }
.b-accent { background: var(--accent-soft); color: var(--accent); }
.b-success { background: color-mix(in srgb, var(--success) 13%, transparent); color: var(--success); }
.b-warning { background: color-mix(in srgb, var(--warning) 15%, transparent); color: var(--warning); }
.b-danger { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }
.b-solid { background: var(--accent); color: var(--accent-fg); }
.delta { font-family: var(--mono); font-weight: 700; white-space: nowrap; }
.delta.plus { color: var(--success); }
.delta.minus { color: var(--danger); }
.delta.zero { color: var(--muted); }

/* Free stock vs minimum */
.meter { display: flex; align-items: center; gap: 10px; }
.meter-bar { position: relative; width: 84px; height: 6px; border-radius: 999px; background: var(--surface-2); flex: none; }
.meter-bar i { position: absolute; inset: 0 auto 0 0; border-radius: 999px; background: var(--success); }
.meter-bar.low i { background: var(--danger); }
.meter-bar.zero i { background: transparent; }
.meter-bar b { position: absolute; top: -3px; bottom: -3px; width: 2px; border-radius: 2px; background: var(--fg); opacity: .55; }

/* Buttons and forms */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 16px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--fg); font: inherit; font-size: 14px; font-weight: 700; cursor: pointer; white-space: nowrap; transition: border-color .15s, color .15s, opacity .15s, background .15s; }
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn-primary { background: var(--accent); border-color: transparent; color: var(--accent-fg); }
.btn-primary:hover { color: var(--accent-fg); opacity: .9; }
.btn-danger { color: var(--danger); }
.btn-danger:hover { border-color: var(--danger); color: var(--danger); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .45; cursor: not-allowed; pointer-events: none; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
form.inline { display: inline-flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0; }
.field { display: grid; gap: 6px; }
.field > span { font-size: 12.5px; font-weight: 700; color: var(--muted); }
.input, .select { height: 40px; width: 100%; padding: 0 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--fg); font: inherit; font-size: 14px; outline: none; transition: border-color .15s; }
.input:focus, .select:focus { border-color: var(--accent); }
input[type="file"].input { height: auto; padding: 6px; font-size: 13px; color: var(--muted); }
input[type="file"]::file-selector-button { height: 30px; margin-right: 10px; padding: 0 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface-2); color: var(--fg); font: inherit; font-weight: 700; cursor: pointer; }
input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); }
.input.qty { width: 84px; text-align: right; font-family: var(--mono); }
.input.sm, .select.sm { height: 34px; border-radius: 10px; font-size: 13px; }
.search { position: relative; flex: 1; min-width: 220px; }
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search .input { padding-left: 38px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 13px; font-weight: 700; }
.chip:hover { color: var(--fg); }
.chip.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.chip .n { font-family: var(--mono); font-size: 11.5px; opacity: .75; }
.lock-note { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); color: var(--muted); font-size: 13px; }
.note { padding: 12px 14px; border: 1px solid color-mix(in srgb, var(--accent) 28%, transparent); border-radius: 14px; background: var(--accent-soft); font-size: 13px; line-height: 1.55; }
.note .kicker { display: block; margin-bottom: 2px; font-family: var(--mono); font-size: 10px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--accent); }
.note code, .code { font-family: var(--mono); font-size: 12.5px; padding: 1px 5px; border-radius: 5px; background: var(--surface); }

/* Flash */
.flash { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; margin-bottom: 18px; border-radius: 14px; font-size: 14px; font-weight: 600; border: 1px solid transparent; }
.flash-ok { background: color-mix(in srgb, var(--success) 11%, var(--surface)); border-color: color-mix(in srgb, var(--success) 30%, transparent); color: var(--success); }
.flash-err { background: color-mix(in srgb, var(--danger) 9%, var(--surface)); border-color: color-mix(in srgb, var(--danger) 30%, transparent); color: var(--danger); }
.flash span { color: var(--fg); font-weight: 500; }

/* Lists */
.list { display: grid; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-top: 1px solid var(--line); }
.list-row:first-child { border-top: 0; padding-top: 0; }
.list-row .grow { flex: 1; min-width: 0; }
.list-row .grow b { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-row .grow span { display: block; font-size: 12.5px; color: var(--muted); }
.task-link:hover b { color: var(--accent); }
.empty { padding: 28px 12px; text-align: center; color: var(--muted); font-size: 14px; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }

/* Order timeline */
.steps { display: flex; gap: 0; margin: 4px 0 2px; }
.step { flex: 1; position: relative; padding-top: 22px; font-size: 12.5px; color: var(--muted); }
.step::before { content: ""; position: absolute; top: 6px; left: 0; right: 0; height: 2px; background: var(--line); }
.step::after { content: ""; position: absolute; top: 0; left: 0; width: 14px; height: 14px; border-radius: 50%; background: var(--surface); border: 2px solid var(--line); }
.step.done::before, .step.done::after { background: var(--accent); border-color: var(--accent); }
.step.current::after { background: var(--surface); border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.step.failed::after { background: var(--danger); border-color: var(--danger); }
.step b { display: block; color: var(--fg); font-size: 13px; }
.step:last-child::before { right: auto; width: 0; }

/* Pick list */
.pick { display: grid; gap: 8px; counter-reset: pick; }
.pick li { list-style: none; display: grid; grid-template-columns: 28px 86px 1fr auto; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; }
.pick li::before { counter-increment: pick; content: counter(pick); display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--surface-2); font-family: var(--mono); font-size: 12px; font-weight: 700; }
.pick ol, ol.pick { margin: 0; padding: 0; }

/* Race */
.race-lanes { display: grid; gap: 12px; margin-top: 6px; }
.lane { display: grid; grid-template-columns: 92px 1fr; align-items: center; gap: 12px; }
.lane-label { font-size: 13px; font-weight: 800; }
.lane-label span { display: block; font-size: 11.5px; font-weight: 600; }
.lane-track { position: relative; height: 30px; border-radius: 9px; background: var(--surface-2); overflow: hidden; }
.lane-track .wait { position: absolute; top: 0; bottom: 0; background: repeating-linear-gradient(-45deg, color-mix(in srgb, var(--warning) 35%, transparent) 0 6px, color-mix(in srgb, var(--warning) 18%, transparent) 6px 12px); }
.lane-track .work { position: absolute; top: 0; bottom: 0; border-radius: 0 9px 9px 0; background: var(--accent); opacity: .85; }
.lane-track .work.fail { background: var(--danger); }
.lane-track em { position: absolute; top: 50%; transform: translateY(-50%); font-style: normal; font-family: var(--mono); font-size: 11.5px; font-weight: 700; color: var(--fg); padding: 0 8px; white-space: nowrap; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -2px; margin-right: 6px; }

/* Pagination */
.pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.pager nav { display: flex; gap: 4px; }
.pager a, .pager span.cur { display: grid; place-items: center; min-width: 32px; height: 32px; padding: 0 8px; border-radius: 9px; font-family: var(--mono); font-weight: 700; }
.pager a:hover { background: var(--surface-2); color: var(--fg); }
.pager span.cur { background: var(--accent); color: var(--accent-fg); }
.pager .off { opacity: .35; pointer-events: none; }

.only-mobile { display: none; }

@media (max-width: 1280px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1100px) {
  .g-main, .g-3 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 1023px) {
  .shell { display: block; }
  .sidebar { display: none; }
  .mobile-nav { position: sticky; top: 56px; z-index: 30; display: flex; gap: 4px; padding: 8px 12px; overflow-x: auto; border-bottom: 1px solid var(--line); background: var(--header); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); scrollbar-width: none; }
  .mobile-nav a { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border-radius: 999px; font-size: 13.5px; font-weight: 700; color: var(--muted); white-space: nowrap; }
  .mobile-nav a.on { background: var(--accent-soft); color: var(--accent); }
  .mobile-nav .count { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--accent); color: var(--accent-fg); font-family: var(--mono); font-size: 10.5px; display: grid; place-items: center; }
  main { padding: 20px 16px 48px; }
  .only-mobile { display: block; }
}
@media (max-width: 760px) {
  .g-2 { grid-template-columns: minmax(0, 1fr); }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi .value { font-size: 19px; }
  .header-tools .segmented, .header-tools .pill-link { display: none; }
  .role-select { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 10px; border: 1px solid var(--line); border-radius: 999px; font-size: 13px; }
  .role-select select { border: 0; background: transparent; color: var(--fg); font: inherit; font-weight: 700; outline: none; }
  .page-head h1 { font-size: 22px; }
  .hide-sm { display: none; }
  .lane { grid-template-columns: 70px 1fr; }
  .pick li { grid-template-columns: 24px 74px 1fr auto; }
}
.only-sm { display: none; }
@media (max-width: 760px) { .only-sm { display: inline; } }
