:root {
  color-scheme: dark;
  --background: #0a0c11;
  --surface: #12161f;
  --raised: #171d28;
  --line: #272e3b;
  --text: #f5f7fc;
  --muted: #a8b3c6;
  --blue: #7aabff;
  --primary: #265bd7;
  --primary-hover: #2c67eb;
  --danger: #ff8d92;
  --danger-bg: #32171e;
  --green: #73ddb2;
  --radius: 14px;
  --top: max(env(safe-area-inset-top, 0px), var(--tg-content-safe-area-inset-top, 0px), var(--tg-safe-area-inset-top, 0px));
  --bottom: max(env(safe-area-inset-bottom, 0px), var(--tg-content-safe-area-inset-bottom, 0px), var(--tg-safe-area-inset-bottom, 0px));
  --left: max(env(safe-area-inset-left, 0px), var(--tg-content-safe-area-inset-left, 0px), var(--tg-safe-area-inset-left, 0px));
  --right: max(env(safe-area-inset-right, 0px), var(--tg-content-safe-area-inset-right, 0px), var(--tg-safe-area-inset-right, 0px));
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--background);
  color: var(--text);
  accent-color: var(--blue);
  scrollbar-color: var(--line) var(--background);
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-width: 0; }
button, input, select { font: inherit; }
button, select { color: inherit; }
button { cursor: pointer; touch-action: manipulation; }
button:disabled { cursor: default; opacity: .5; }
button, a, input, select { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }
::selection { background: #2859b9; color: white; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 2.2rem; font-weight: 770; line-height: 1.08; letter-spacing: -.035em; overflow-wrap: anywhere; }
h2 { font-size: 1.16rem; font-weight: 720; letter-spacing: -.02em; line-height: 1.25; }
h3 { font-size: 1rem; line-height: 1.25; }
svg { display: block; flex-shrink: 0; }
time, .number, progress, .figure { font-variant-numeric: tabular-nums; }

.skip-link { position: fixed; top: 6px; left: 6px; transform: translateY(-200%); padding: 10px; z-index: 5; color: white; background: var(--primary); }
.skip-link:focus { transform: none; }
.shell { min-height: 100dvh; padding: var(--top) var(--right) var(--bottom) var(--left); }
.sidebar { display: none; }
.workspace { min-width: 0; width: 100%; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 58px; padding: 10px 18px; border-bottom: 1px solid var(--line); }
.brand, .topbar-location { display: inline-flex; align-items: center; gap: 10px; }
.brand-mark { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: var(--primary); color: white; }
.brand-name { font-weight: 750; letter-spacing: -.022em; white-space: nowrap; }
.topbar-location { display: none; font-size: .92rem; color: var(--muted); }
.role { min-width: 0; max-width: 195px; min-height: 38px; position: relative; display: flex; align-items: center; }
.role select { appearance: none; width: 100%; border: 1px solid #304367; border-radius: 9px; padding: 7px 29px 7px 11px; background: #172642; color: #b5ceff; cursor: pointer; font-weight: 650; font-size: .87rem; }
.role svg { position: absolute; right: 9px; pointer-events: none; color: #a2c0ff; }
.role-label { color: var(--muted); font-size: .88rem; }

.content { max-width: 1200px; margin: 0 auto; padding: 22px 18px 86px; outline: none; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.page-title { min-width: 0; }
.page-title p { color: var(--muted); margin-top: 6px; }
.back { display: inline-flex; align-items: center; gap: 4px; min-height: 39px; padding: 0 9px 0 0; margin: -4px 0 6px; color: var(--muted); border: 0; background: transparent; }
.back:hover { color: var(--text); }
.grid, .columns { display: grid; gap: 16px; align-items: start; }
.section { display: grid; gap: 10px; min-width: 0; }
.section + .section { margin-top: 2px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); min-width: 0; }
.panel-pad { padding: 16px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 16px 0; }
.panel-title { display: flex; align-items: center; gap: 9px; font-weight: 690; }
.panel-title svg { color: var(--blue); }
.muted { color: var(--muted); }
.small { font-size: .87rem; }
.tiny { font-size: .79rem; }
.positive { color: var(--green); }
.negative { color: var(--danger); }
.text-blue { color: var(--blue); }
.stack { display: grid; gap: 12px; min-width: 0; }
.rows { display: grid; gap: 8px; }
.row { display: flex; align-items: center; gap: 12px; min-width: 0; padding: 11px 14px; min-height: 50px; }
.row + .row { border-top: 1px solid var(--line); }
.row-main { flex: 1; min-width: 0; text-align: left; overflow-wrap: anywhere; }
.row-title { color: var(--text); display: block; font-weight: 690; }
.row-sub { color: var(--muted); display: block; line-height: 1.28; font-size: .87rem; margin-top: 2px; }
.row-end { margin-left: auto; flex-shrink: 0; }
.row-link { width: 100%; color: inherit; text-align: left; }
.row-link.panel:hover, .action-row:hover, .table-link:hover { background: var(--raised); }
.row-link:active, .action-row:active, .btn:active { filter: brightness(.94); }
.row-link .chevron { color: var(--muted); }
.table-link, .action-row { width: 100%; background: none; border: 0; text-align: left; color: inherit; }
.table-link:first-child, .action-row:first-child { border-radius: var(--radius) var(--radius) 0 0; }
.table-link:last-child, .action-row:last-child { border-radius: 0 0 var(--radius) var(--radius); }
.table-link:only-child, .action-row:only-child { border-radius: var(--radius); }
.symbol { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; flex: 0 0 40px; color: #a7c6fc; background: #1a2840; }
.symbol.neutral { color: #ccd6e6; background: #202734; }
.symbol.alert { color: #ffc6ca; background: #56222b; }
.avatar { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; flex: 0 0 38px; color: #b9d1ff; background: #203358; font-weight: 750; }
.pill { display: inline-flex; width: fit-content; align-items: center; gap: 5px; border-radius: 6px; background: #222c3d; color: #bdcce3; font-size: .79rem; padding: 3px 7px; font-weight: 650; white-space: nowrap; }
.pill.warn { color: #ffc2c5; background: #58202a; }
.pill.ok { color: #9deac9; background: #19352d; }
.pill.info { color: #bdd3ff; background: #203760; }
.badge { display: inline-flex; width: fit-content; align-items: center; gap: 6px; padding: 4px 8px; border-radius: 7px; color: #b9cff6; background: #23385d; font-weight: 650; font-size: .83rem; }
.warning { background: var(--danger-bg); border-color: #642d37; }
.warning .row-title { color: #fff2f3; }
.warning .row-sub { color: #ffc2c5; }
.warning.row-link:hover { background: #3d1a22; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent; border-radius: 10px; min-height: 46px; padding: 9px 15px; font-weight: 680; color: white; text-align: center; }
.btn.primary { background: var(--primary); }
.btn.primary:hover { background: var(--primary-hover); }
.btn.secondary { background: var(--surface); border-color: var(--line); color: var(--text); }
.btn.secondary:hover { background: var(--raised); }
.btn.outline { background: transparent; border-color: #36537f; color: #c2d7fb; }
.btn.outline:hover { background: #152136; }
.btn.danger { background: #772b38; }
.btn.danger:hover { background: #912f40; }
.btn.full { width: 100%; }
.btn.small-btn { min-height: 36px; padding: 5px 9px; font-size: .83rem; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.actions > .btn { flex: 1 1 auto; }
.page-head > .btn { display: none; }
.mobile-action { display: flex; }

.hero { padding: 18px; border: 1px solid #3c67c8; border-radius: var(--radius); background: linear-gradient(130deg, #214783, #233e7f 75%); color: #f6f9ff; }
.hero .muted { color: #c5d7fb; }
.hero .panel-title svg { color: #c0d5ff; }
.hero .row { padding-inline: 0; }
.hero .row + .row, .hero .result-stat + .result-stat { border-color: #6c89be; }
.result { display: flex; gap: 0; margin: 12px 0 14px; }
.result-stat { display: flex; flex: 1; flex-direction: column; padding-right: 12px; }
.result-stat + .result-stat { border-left: 1px solid; padding-left: 16px; }
.number { font-size: 1.75rem; line-height: 1.05; font-weight: 780; letter-spacing: -.035em; }
.figure { font-size: 2.6rem; line-height: 1.04; font-weight: 780; letter-spacing: -.04em; }
.result-foot { display: flex; align-items: center; gap: 8px; border-top: 1px solid #6785bb; padding-top: 12px; color: #e1ebff; }
.result-foot .row-end { color: white; font-size: 1.05rem; }
.metric-pair { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
.metric { display: flex; align-items: center; gap: 10px; padding: 13px; }
.metric svg { color: #a5c6ff; }
.metric .number { font-size: 1.45rem; }
.metric .muted { margin-top: 3px; }
.metric-main { min-width: 0; }
.summary { display: grid; gap: 6px; }
.summary-note { color: var(--muted); }
.timer-panel { display: grid; justify-items: center; gap: 7px; padding: 22px 15px; text-align: center; }
.timer-panel time { font-size: 3.15rem; line-height: 1.02; letter-spacing: -.04em; font-weight: 800; }
.timer-panel.warning time { color: #fff1f1; }
.status-dot { border-radius: 50%; width: 7px; height: 7px; flex: 0 0 7px; background: currentColor; }
.live-status { display: inline-flex; align-items: center; gap: 7px; color: var(--green); }

.progress-block { padding: 12px 14px; display: grid; gap: 7px; }
.progress-block + .progress-block { border-top: 1px solid var(--line); }
.progress-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.progress-head strong { font-size: .94rem; }
progress { display: block; width: 100%; height: 7px; border: 0; border-radius: 20px; overflow: hidden; background: #2a3447; }
progress::-webkit-progress-bar { background: #2a3447; }
progress::-webkit-progress-value { background: #4d89f8; border-radius: 20px; }
progress::-moz-progress-bar { background: #4d89f8; border-radius: 20px; }
.history-time { color: var(--muted); font-weight: 650; min-width: 42px; white-space: nowrap; }

.filters { display: flex; flex-wrap: wrap; gap: 8px; min-width: 0; }
.control { display: block; width: 100%; min-width: 0; min-height: 43px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px; color: var(--text); background: var(--surface); outline-offset: 1px; }
select.control { cursor: pointer; }
.filters .control { width: auto; max-width: 100%; }
.control::placeholder { color: #a4b0c3; }
.field { display: grid; gap: 7px; }
.field > span { font-weight: 650; }
.field-grid { display: grid; gap: 12px; }
.search-field { position: relative; }
.search-field svg { color: var(--muted); position: absolute; left: 12px; top: 12px; pointer-events: none; }
.search-field input { padding-left: 40px; }
.segment { display: flex; padding: 3px; border: 1px solid var(--line); border-radius: 10px; background: #10141d; }
.segment-btn { flex: 1 1 0; min-width: 0; min-height: 36px; padding: 4px 7px; border: none; border-radius: 7px; background: transparent; color: var(--muted); font-weight: 650; font-size: .89rem; }
.segment-btn:hover { color: var(--text); }
.segment-btn[aria-pressed="true"] { background: #21488a; color: #ecf3ff; }
.stepper { display: grid; grid-template-columns: 38px minmax(26px,auto) 38px; border-radius: 9px; overflow: hidden; background: #0d1119; align-items: center; text-align: center; }
.stepper button { border: 0; height: 39px; display: grid; place-items: center; background: #243048; }
.stepper button:hover { background: #2c3f62; }
.stepper button:focus-visible { outline-offset: -3px; }
.product .symbol { width: 58px; height: 58px; flex-basis: 58px; }
.note { padding: 10px 12px; background: #192945; color: #c5d9ff; border-radius: 8px; display: flex; align-items: center; gap: 8px; }
.order-end { display: grid; gap: 12px; }
.chart { padding: 15px 15px 12px; }
.chart-plot { display: grid; grid-template-columns: repeat(auto-fit, minmax(24px, 1fr)); align-items: end; gap: 10px; height: 135px; padding: 13px 0 0; }
.chart-bar { height: 100%; display: grid; grid-template-rows: minmax(0,1fr) 18px; align-items: end; text-align: center; gap: 5px; color: var(--muted); font-size: .77rem; }
.chart-bar > span { display: block; height: var(--bar-height); border-radius: 4px 4px 0 0; background: #3874ea; border-bottom: 1px solid #6d9af4; }
.chart-bar:last-child > span { background: #5b91ff; }
.chart-bar > time { white-space: nowrap; }
.empty { padding: 21px 16px; display: grid; gap: 8px; justify-items: start; }
.empty > svg { color: var(--blue); }
.empty p { color: var(--muted); }
.loading { min-height: 132px; }
.loading::before { content: ''; display: block; width: 50%; height: 16px; margin: 14px 0; border-radius: 5px; background: var(--raised); }
.loading::after { content: ''; display: block; width: 78%; height: 11px; border-radius: 5px; background: var(--raised); }
.inline-error { color: #ffc1c5; border: 1px solid #743744; background: var(--danger-bg); padding: 12px; border-radius: 9px; }
.toast { position: fixed; z-index: 3; bottom: calc(77px + var(--bottom)); left: max(16px,var(--left)); right: max(16px,var(--right)); margin-inline: auto; max-width: 420px; padding: 12px 15px; background: #1d2f4d; border: 1px solid #405884; color: #e8f1ff; border-radius: 10px; box-shadow: 0 8px 28px #0006; }
.toast[data-error="true"] { border-color: #85414b; background: #411e27; color: #ffe2e4; }
.toast:empty { display: none; }

.bottom-nav { display: flex; justify-content: space-around; position: fixed; inset: auto var(--right) 0 var(--left); z-index: 2; gap: 3px; padding: 5px 7px calc(6px + var(--bottom)); background: #10141d; border-top: 1px solid var(--line); }
.nav-item { color: #b0bed2; border: 0; text-decoration: none; background: transparent; display: flex; flex: 1 1 0; flex-direction: column; align-items: center; justify-content: center; min-width: 0; min-height: 48px; padding: 4px 2px; border-radius: 9px; gap: 3px; font-weight: 650; font-size: .72rem; }
.nav-item:hover { background: #192437; }
.nav-item[aria-current="page"] { background: #1d345f; color: #c2d8ff; }
.nav-item[aria-current="page"] svg { color: #86b2ff; }

@media (min-width: 580px) {
  .content { padding-inline: 26px; }
  .field-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .topbar { padding-inline: 26px; }
}
@media (min-width: 760px) {
  .columns { grid-template-columns: minmax(0,1.3fr) minmax(0,1fr); gap: 18px; }
  .columns.equal { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .topbar { min-height: 65px; }
  .content { padding-top: 29px; }
  .page-head > .btn { display: inline-flex; }
  .mobile-action { display: none; }
}
@media (min-width: 930px) {
  .shell { display: grid; grid-template-columns: 216px minmax(0,1fr); }
  .sidebar { display: flex; align-self: start; height: calc(100dvh - var(--top) - var(--bottom)); position: sticky; top: var(--top); flex-direction: column; gap: 30px; padding: 20px 15px 17px; border-right: 1px solid var(--line); background: #10141d; }
  .sidebar .brand { margin-left: 5px; }
  .sidebar nav { display: grid; gap: 5px; }
  .sidebar-foot { margin-top: auto; display: flex; gap: 9px; align-items: center; }
  .sidebar-foot .avatar { width: 32px; height: 32px; flex-basis: 32px; }
  .sidebar .nav-item { flex-direction: row; justify-content: flex-start; padding: 8px 12px; gap: 11px; font-size: .95rem; min-height: 45px; text-align: left; }
  .topbar .brand { display: none; }
  .topbar-location { display: flex; }
  .bottom-nav { display: none; }
  .content { padding-bottom: 34px; }
  .toast { bottom: calc(25px + var(--bottom)); }
}
@media (min-width: 1120px) {
  .shell { grid-template-columns: 232px minmax(0,1fr); }
  .content { padding: 34px 34px 42px; }
  .topbar { padding-inline: 34px; }
  .columns { gap: 22px; }
  .grid, .stack { gap: 16px; }
}
@media (max-width: 360px) {
  .content, .topbar { padding-inline: 12px; }
  .row { gap: 8px; padding-inline: 10px; }
  .role { max-width: 172px; }
  .role select { font-size: .78rem; padding-left: 8px; padding-right: 21px; }
  .role svg { right: 6px; }
  .metric { gap: 7px; padding-inline: 9px; }
}
@media (prefers-reduced-motion: no-preference) {
  button, .nav-item, select { transition: background-color 140ms ease-out, color 140ms ease-out, border-color 140ms ease-out; }
}

.desktop-goals { display: none; }
.overdue-note { font-weight: 650; padding-top: 1px; }
.warning .table-link:hover { background: #3d1a22; }
.warning .table-link .symbol { background: #56222b; color: #ffc6ca; }
.form-panel { max-width: 650px; }
.field-stock { grid-template-columns: minmax(0,1fr) minmax(74px,110px); align-items: center; }
.field-stock small { display: block; font-weight: 400; }
.product-panel .product { padding: 0 0 12px; }
.product-panel .product .row-sub { color: var(--text); font-size: 1rem; font-weight: 650; margin-top: 4px; }
.product-panel .note { flex-wrap: wrap; }
.action-row[aria-pressed="true"] { background: #1b2b48; }
.catalog-grid { display: grid; gap: 12px; }
.catalog-details { padding: 0 14px 14px; }
.ingredients { list-style: none; display: grid; gap: 5px; padding: 0; margin: 0; }
.ingredients li { display: flex; justify-content: space-between; gap: 12px; }
.ingredients li strong { flex-shrink: 0; }
.chart-plot { display: flex; gap: 4px; }
.chart-bar { flex: 1; min-width: 0; color: #4d89f8; }
.chart-bar > svg { display: block; min-height: 0; }
.chart-bar > time { color: var(--muted); }
.chart-bar:last-child { color: #84acfa; }
.table-labels { display: flex; justify-content: space-between; padding-inline: 10px; gap: 8px; }
.team-number { font-size: 1.1rem; }
.overview-total .figure { margin-top: 4px; }
@media (min-width: 650px) {
  .catalog-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (min-width: 760px) {
  .desktop-goals { display: block; }
  .shift-columns { grid-template-columns: minmax(0,1.7fr) minmax(0,1fr); }
  .shift-summary { grid-column: 2; grid-row: 1; }
  .shift-orders { grid-column: 1; grid-row: 1; }
  .chart-plot { gap: 6px; }
}
[hidden] { display: none !important; }
.timer-panel [data-order-clock] { display: grid; gap: 8px; justify-items: center; }
.timer-panel [data-order-clock][hidden] + .pill { padding: 8px 12px; font-size: .95rem; }
