:root {
  color-scheme: dark;
  --bg: #000000;
  --surface: #171717;
  --surface-2: #212121;
  --surface-3: #2f2f2f;
  --sidebar: #000000;
  --text: #f5f5f5;
  --muted: #a3a3a3;
  --muted-2: #737373;
  --line: #2a2a2a;
  --line-strong: #454545;
  --accent: #f4f4f4;
  --accent-hover: #ffffff;
  --accent-text: #f59e0b;
  --accent-soft: rgba(249, 115, 22, .13);
  --danger: #fb7185;
  --danger-soft: rgba(251, 113, 133, .12);
  --success: #4ade80;
  --success-soft: rgba(74, 222, 128, .11);
  --warning: #fbbf24;
  --warning-soft: rgba(251, 191, 36, .11);
  --info: #60a5fa;
  --info-soft: rgba(96, 165, 250, .11);
  --radius: 14px;
  --radius-sm: 10px;
  --nav-width: 272px;
  --shadow: 0 18px 50px rgba(0, 0, 0, .22);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-height: 100%; background: var(--bg); scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; color: var(--text); background: var(--bg); line-height: 1.48; font-size: 14px; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 2px; }

.layout { min-height: 100vh; display: grid; grid-template-columns: var(--nav-width) minmax(0, 1fr); }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 40; width: var(--nav-width); height: 100vh; display: flex; flex-direction: column; padding: 10px; color: var(--text); background: var(--sidebar); border-right: 1px solid #202020; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 11px; min-height: 56px; padding: 8px 10px; border-radius: 12px; }
.brand:hover { background: var(--surface-2); }
.brand-spark { width: 32px; height: 32px; flex: 0 0 auto; overflow: hidden; border-radius: 9px; background: #050505; border: 1px solid var(--line); }
.brand-spark img { width: 100%; height: 100%; object-fit: cover; object-position: 19% center; }
.brand-word { display: block; font-size: 19px; font-weight: 610; letter-spacing: -.045em; }
.nav { display: grid; gap: 2px; margin-top: 8px; }
.nav-section { padding: 17px 10px 6px; color: #686868; font-size: 10px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; }
.nav a { position: relative; display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 8px 10px; border-radius: 9px; color: #c8c8c8; font-size: 13px; font-weight: 510; }
.nav a:hover { color: #fff; background: #1d1d1d; }
.nav a.active { color: #fff; background: #292929; }
.nav a.active::before { content: ""; position: absolute; left: 0; width: 3px; height: 18px; border-radius: 0 3px 3px 0; background: var(--accent-text); }
.nav-icon { width: 22px; height: 22px; display: grid; place-items: center; flex: 0 0 auto; color: #aaa; font-size: 15px; opacity: .86; }
.nav a.active .nav-icon, .nav a:hover .nav-icon { color: #fff; opacity: 1; }
.sidebar-spacer { flex: 1 1 auto; min-height: 16px; }
.sidebar-footer { margin-top: 14px; padding: 13px 10px 8px; border-top: 1px solid #252525; color: #686868; font-size: 11px; line-height: 1.55; }
.sidebar-footer strong { color: #aaa; font-weight: 550; }
.sidebar-scrim { display: none; }

.main { grid-column: 2; min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 25; min-height: 68px; padding: 9px 24px; display: flex; justify-content: space-between; align-items: center; gap: 18px; background: rgba(0, 0, 0, .9); border-bottom: 1px solid rgba(42, 42, 42, .9); backdrop-filter: blur(18px); }
.top-context { display: flex; align-items: center; gap: 11px; min-width: 0; }
.top-title { min-width: 0; }
.topbar h1 { margin: 0; overflow: hidden; color: #f3f3f3; font-size: 15px; font-weight: 620; letter-spacing: -.01em; text-overflow: ellipsis; white-space: nowrap; }
.top-title small { display: block; color: var(--muted-2); font-size: 10px; }
.mobile-menu { display: none; width: 40px; height: 40px; padding: 0; border: 0; border-radius: 9px; color: var(--text); background: transparent; font-size: 21px; }
.mobile-menu:hover { background: var(--surface-2); }
.command-trigger { min-width: 190px; min-height: 38px; padding: 7px 8px 7px 12px; display: flex; align-items: center; justify-content: space-between; gap: 16px; border: 1px solid var(--line); border-radius: 10px; color: var(--muted); background: #161616; font-size: 12px; }
.command-trigger:hover { color: var(--text); border-color: var(--line-strong); background: #1b1b1b; }
.command-trigger kbd { padding: 2px 6px; border: 1px solid #3a3a3a; border-radius: 6px; color: #8b8b8b; background: #222; font: 10px ui-monospace, SFMono-Regular, Menlo, monospace; }
.top-actions { display: flex; align-items: center; gap: 8px; min-width: 0; }
.header-finance { display: flex; align-items: stretch; gap: 4px; }
.finance-chip { min-width: 118px; padding: 6px 9px; display: flex; flex-direction: column; gap: 1px; border: 1px solid transparent; border-radius: 9px; }
.finance-chip:hover { border-color: var(--line); background: var(--surface); }
.finance-chip span { color: #777; font-size: 9px; font-weight: 650; letter-spacing: .035em; text-transform: uppercase; white-space: nowrap; }
.finance-chip strong { color: #ddd; font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.user-chip { width: 34px; height: 34px; display: grid; place-items: center; overflow: hidden; border: 1px solid var(--line); border-radius: 50%; color: #ddd; background: var(--surface-2); font-size: 11px; text-transform: uppercase; }
.top-logout { width: 34px; height: 34px; padding: 0; display: grid; place-items: center; border: 0; border-radius: 9px; color: #777; background: transparent; }
.top-logout:hover { color: var(--text); background: var(--surface-2); }

.content { width: min(100%, 1280px); margin: 0 auto; padding: 28px 30px 72px; }
.page-head, .page-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 22px; margin-bottom: 22px; }
.page-head h2, .page-heading h1 { margin: 0 0 6px; color: #f7f7f7; font-size: clamp(22px, 2.2vw, 30px); line-height: 1.18; letter-spacing: -.035em; }
.page-head p, .page-heading p { max-width: 820px; margin: 0; color: var(--muted); font-size: 13px; }
.eyebrow, .section-kicker { margin: 0 0 6px !important; color: var(--accent-text); font-size: 10px !important; font-weight: 750; letter-spacing: .11em; text-transform: uppercase; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }

.btn, .button { min-height: 42px; padding: 8px 15px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--accent); border-radius: 10px; color: #111; background: var(--accent); font-size: 13px; font-weight: 630; transition: background .15s, border-color .15s, transform .15s; }
.btn:hover, .button:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn:active, .button:active { transform: translateY(1px); }
.btn.secondary, .button:not(.primary) { color: #ddd; background: var(--surface); border-color: var(--line); }
.btn.secondary:hover, .button:not(.primary):hover { color: #fff; background: var(--surface-2); border-color: var(--line-strong); }
.btn.danger { background: #be3144; border-color: #be3144; }
.btn.warning { color: #1c1605; background: var(--warning); border-color: var(--warning); }
.btn.small { min-height: 34px; padding: 5px 10px; font-size: 11px; }
.btn.ghost { color: var(--muted); background: transparent; border-color: var(--line); }
.btn:disabled, .button:disabled { cursor: not-allowed; opacity: .42; transform: none; }

.cards, .kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; align-items: stretch; }
.kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpi-grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpi-grid.five { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.card, .kpi { min-width: 0; padding: 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: 0 1px 0 rgba(255, 255, 255, .025); }
.cards > .card, .kpi-grid > .card, .kpi-grid > .kpi, .grid-2 > .card, .grid-2 > section, .grid-3 > .card, .grid-3 > section { height: 100%; }
.card.compact { padding: 14px; }
.card.focus { border-color: rgba(249, 115, 22, .38); background: linear-gradient(145deg, var(--surface), var(--accent-soft)); }
.metric-label, .kpi > span { display: block; color: #858585; font-size: 10px; font-weight: 720; letter-spacing: .07em; text-transform: uppercase; }
.metric-value, .kpi > strong { display: block; margin-top: 9px; color: #fafafa; font-size: clamp(22px, 2.2vw, 29px); font-weight: 650; line-height: 1.1; letter-spacing: -.035em; font-variant-numeric: tabular-nums; }
.metric-sub, .kpi > small { display: block; margin-top: 8px; color: var(--muted); font-size: 11px; line-height: 1.45; }
.kpi.warning { border-color: rgba(251, 191, 36, .34); background: linear-gradient(145deg, var(--surface), var(--warning-soft)); }
.kpi.positive { border-color: rgba(74, 222, 128, .28); background: linear-gradient(145deg, var(--surface), var(--success-soft)); }
.positive { color: var(--success) !important; }
.negative { color: var(--danger) !important; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; align-items: stretch; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; align-items: stretch; }
.stack, .stack-form { display: grid; gap: 15px; }
.section-title, .card-head { display: flex; justify-content: space-between; align-items: center; gap: 15px; margin: 0 0 15px; }
.section-title h3, .card-head h2 { margin: 0; color: #eee; font-size: 14px; font-weight: 640; letter-spacing: -.01em; }
.section-title small, .card-head p { margin: 2px 0 0; color: var(--muted); font-size: 11px; }

.table-card { padding: 0; overflow: hidden; margin-bottom: 14px; }
.card-head { padding: 17px 18px; margin: 0; border-bottom: 1px solid var(--line); }
.table-wrap, .table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 11px; background: #0d0d0d; }
.table-card .table-scroll { border: 0; border-radius: 0; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th { color: #777; background: #171717; font-size: 9px; font-weight: 720; letter-spacing: .075em; text-align: left; text-transform: uppercase; white-space: nowrap; }
th, td { padding: 12px 13px; border-bottom: 1px solid #292929; vertical-align: top; }
tr:last-child td { border-bottom: 0; }
tbody tr { transition: background .12s; }
tbody tr:hover { background: #1b1b1b; }
td a:not(.btn):not(.button) { color: #eee; }
td a:not(.btn):not(.button):hover { color: var(--accent-text); }
.table-card td small { display: block; margin-top: 4px; color: var(--muted); }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.muted { color: var(--muted); }
.strong { font-weight: 650; }
.badge { min-height: 24px; padding: 3px 8px; display: inline-flex; align-items: center; border: 1px solid #383838; border-radius: 999px; color: #aaa; background: #242424; font-size: 10px; font-weight: 670; white-space: nowrap; }
.badge.success { color: var(--success); background: var(--success-soft); border-color: rgba(74, 222, 128, .24); }
.badge.danger { color: var(--danger); background: var(--danger-soft); border-color: rgba(251, 113, 133, .24); }
.badge.warning { color: var(--warning); background: var(--warning-soft); border-color: rgba(251, 191, 36, .24); }
.badge.info { color: var(--info); background: var(--info-soft); border-color: rgba(96, 165, 250, .24); }
.badge.muted { color: #888; background: #222; }

.form-card { max-width: 1120px; }
.form-card.wide-form { max-width: none; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field { display: grid; align-content: start; gap: 6px; min-width: 0; }
.field.full, .full-field { grid-column: 1 / -1; }
label { color: #b0b0b0; font-size: 11px; font-weight: 640; }
input, select, textarea { width: 100%; min-height: 44px; padding: 9px 11px; border: 1px solid #3a3a3a; border-radius: 9px; color: #f1f1f1; background: #111; outline: none; }
input::placeholder, textarea::placeholder { color: #626262; }
select { color-scheme: dark; }
input:hover, select:hover, textarea:hover { border-color: #505050; }
input:focus, select:focus, textarea:focus { border-color: var(--accent-text); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { min-height: 94px; resize: vertical; }
.help { color: #777; font-size: 10px; }
.checkbox { min-height: 44px; display: flex; align-items: center; gap: 9px; }
.checkbox input { width: 18px; height: 18px; min-height: 0; accent-color: var(--accent); }
.check-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 14px; }
.check-grid .checkbox { min-height: 48px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.form-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 19px; padding-top: 17px; border-top: 1px solid var(--line); }
.dynamic-list { display: grid; gap: 9px; }
.dynamic-row { display: grid; grid-template-columns: minmax(240px, 1fr) minmax(130px, .35fr) 42px; gap: 8px; align-items: end; }
.dynamic-row.output { grid-template-columns: minmax(220px, 1fr) minmax(220px, .8fr) minmax(105px, .3fr) 42px; }
.dynamic-row.labor { grid-template-columns: minmax(160px, .8fr) minmax(180px, 1fr) minmax(100px, .35fr) minmax(105px, .35fr) 42px; }
.dynamic-row.order { grid-template-columns: minmax(240px, 1fr) minmax(105px, .3fr) minmax(125px, .35fr) 42px; }
.dynamic-row.purchase-row { grid-template-columns: minmax(260px, 1.25fr) minmax(210px, .8fr) minmax(210px, .8fr) 42px; padding: 13px; border: 1px solid var(--line); border-radius: 11px; background: #0d0d0d; }
.remove-row { width: 42px; height: 44px; border: 1px solid var(--line); border-radius: 9px; color: var(--danger); background: #1b1b1b; }
.remove-row:hover { border-color: rgba(251, 113, 133, .5); background: var(--danger-soft); }

.flash-wrap { display: grid; gap: 8px; margin-bottom: 16px; }
.flash { padding: 12px 14px; border: 1px solid; border-radius: 10px; font-size: 12px; }
.flash.success { color: #9af0b5; background: var(--success-soft); border-color: rgba(74, 222, 128, .28); }
.flash.danger { color: #fda4af; background: var(--danger-soft); border-color: rgba(251, 113, 133, .28); }
.flash.warning { color: #fcd96a; background: var(--warning-soft); border-color: rgba(251, 191, 36, .28); }
.callout { padding: 14px; border: 1px solid #343434; border-radius: 10px; color: #bebebe; background: #1c1c1c; font-size: 12px; }
.callout.warning { color: #ebcf72; background: var(--warning-soft); border-color: rgba(251, 191, 36, .25); }
.callout.danger { color: #f7a5b0; background: var(--danger-soft); border-color: rgba(251, 113, 133, .25); }
.kpi-list { display: grid; gap: 10px; }
.kpi-row { display: flex; justify-content: space-between; gap: 20px; padding-bottom: 10px; border-bottom: 1px solid #292929; }
.kpi-row:last-child { padding-bottom: 0; border-bottom: 0; }
.kpi-row span:first-child { color: var(--muted); }
.kpi-row strong { text-align: right; font-variant-numeric: tabular-nums; }
.progress { height: 7px; overflow: hidden; border-radius: 999px; background: #292929; }
.progress > span { display: block; min-width: 2px; height: 100%; border-radius: inherit; background: var(--accent-text); }
.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 15px; }
.tab { min-height: 36px; padding: 7px 11px; display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 9px; color: #aaa; background: var(--surface); font-size: 11px; font-weight: 620; }
.tab:hover { color: #fff; border-color: var(--line-strong); }
.tab.active { color: #fff; background: var(--accent-soft); border-color: rgba(249, 115, 22, .48); }
.details { margin: 0; display: grid; grid-template-columns: minmax(150px, .6fr) 1fr; gap: 9px 16px; font-size: 12px; }
.details dt { color: var(--muted); }
.details dd { margin: 0; font-weight: 620; }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 11px; }
.empty { padding: 36px 20px; color: #707070; text-align: center; }
hr { margin: 20px 0; border: 0; border-top: 1px solid var(--line); }
.sum-chip { padding: 8px 11px; border: 1px solid var(--line); border-radius: 999px; color: #bbb; background: var(--surface-2); font-size: 11px; white-space: nowrap; }
.lot-picker { display: grid; }
.lot-row { padding: 13px 18px; display: grid; grid-template-columns: minmax(260px, 1fr) minmax(130px, .22fr); gap: 14px; align-items: center; border-bottom: 1px solid var(--line); }
.lot-row.thaw-row { grid-template-columns: minmax(280px, 1.25fr) minmax(190px, .55fr) minmax(210px, .65fr); align-items: start; }
.lot-row:last-child { border-bottom: 0; }
.lot-row small { display: block; margin-top: 4px; color: var(--muted); }
.lot-row input { text-align: right; }
.cost-details { min-width: 245px; }
.cost-details summary { cursor: pointer; color: #eee; font-weight: 650; white-space: nowrap; }
.cost-details[open] summary { margin-bottom: 8px; color: var(--accent-text); }
.cost-details > div { padding: 4px 0; display: flex; justify-content: space-between; gap: 18px; border-bottom: 1px solid #292929; color: var(--muted); font-size: 10px; }
.cost-details > div:last-child { border-bottom: 0; }
.cost-details strong { color: #ddd; white-space: nowrap; }
.chart-grid { margin-bottom: 16px; }
.metric-chart { min-height: 250px; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: #0b0b0b; }
.metric-chart svg { width: 100%; height: auto; display: block; }
.chart-axis { stroke: #3a3a3a; stroke-width: 1; }
.chart-bar { fill: #d7d7d7; opacity: .78; }
.chart-bar.future { opacity: .08; }
.chart-profit-line { fill: none; stroke: var(--success); stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; }
.chart-profit { fill: var(--success); stroke: #0b0b0b; stroke-width: 1.5; }
.chart-profit.negative { fill: var(--danger); }
.chart-label { fill: #727272; font-size: 9px; text-anchor: middle; }
.chart-legend { margin-top: 10px; display: flex; gap: 18px; color: var(--muted); font-size: 10px; }
.chart-legend span { display: flex; align-items: center; gap: 6px; }
.chart-legend i { width: 9px; height: 9px; border-radius: 2px; background: #d7d7d7; }
.chart-legend i.profit { border-radius: 50%; background: var(--success); }
.share-row { display: grid; gap: 7px; margin: 0 0 14px; }
.share-row > div:first-child { display: flex; justify-content: space-between; gap: 14px; font-size: 12px; }
.share-track { height: 7px; overflow: hidden; border-radius: 999px; background: #2a2a2a; }
.share-track i { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.share-track.cost i { background: #888; }

.action-head { align-items: center; }
.today-line { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; color: var(--muted); font-size: 12px; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 4px var(--success-soft); }
.day-chip { min-height: 34px; padding: 6px 10px; display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 9px; color: var(--muted); background: var(--surface); font-size: 10px; white-space: nowrap; }
.day-chip.ready { color: var(--success); border-color: rgba(74, 222, 128, .28); }
.day-chip.open { color: var(--warning); border-color: rgba(251, 191, 36, .30); }
.day-chip.closed .live-dot { background: var(--muted-2); box-shadow: 0 0 0 4px rgba(115, 115, 115, .11); }
.day-control { margin-bottom: 16px; padding: 15px 17px; display: flex; justify-content: space-between; align-items: center; gap: 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.day-control.ready { border-color: rgba(74, 222, 128, .26); background: linear-gradient(145deg, var(--surface), var(--success-soft)); }
.day-control.waiting { border-color: rgba(251, 191, 36, .30); background: linear-gradient(145deg, var(--surface), var(--warning-soft)); }
.day-control strong, .day-control small { display: block; }
.day-control strong { margin: 3px 0; font-size: 14px; }
.day-control small { color: var(--muted); font-size: 11px; }
.day-control-kicker { color: var(--accent-text); font-size: 9px; font-weight: 750; letter-spacing: .09em; text-transform: uppercase; }
.setup-card { margin-bottom: 16px; padding: 18px; display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 22px; border: 1px solid rgba(251, 191, 36, .25); border-radius: var(--radius); background: linear-gradient(130deg, var(--surface), var(--warning-soft)); }
.setup-card h3 { margin: 4px 0; font-size: 16px; }
.setup-card p { margin: 0; color: var(--muted); font-size: 12px; }
.setup-kicker { color: var(--warning); font-size: 9px; font-weight: 760; letter-spacing: .1em; text-transform: uppercase; }
.setup-checks { display: grid; grid-template-columns: repeat(2, minmax(125px, 1fr)); gap: 6px; }
.setup-checks span { padding: 7px 9px; border: 1px solid #46402c; border-radius: 8px; color: #d4b95f; background: rgba(0, 0, 0, .2); font-size: 10px; font-weight: 650; }
.setup-checks span.done { color: var(--success); border-color: rgba(74, 222, 128, .25); background: var(--success-soft); }
.quick-actions { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.quick-action { min-height: 104px; padding: 15px; display: flex; flex-direction: column; justify-content: space-between; gap: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); transition: border-color .15s, background .15s, transform .15s; }
.quick-action:hover { transform: translateY(-1px); border-color: rgba(249, 115, 22, .52); background: #1c1c1c; }
.quick-action.primary { color: #111; border-color: var(--accent); background: var(--accent); }
.quick-action.primary:hover { border-color: var(--accent-hover); background: var(--accent-hover); }
.quick-action-top { display: flex; justify-content: space-between; align-items: center; }
.quick-action-icon { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 9px; color: #eee; background: #292929; font-size: 15px; }
.quick-action.primary .quick-action-icon { color: #111; background: rgba(0, 0, 0, .12); }
.quick-action-arrow { color: #777; font-size: 18px; }
.quick-action.primary .quick-action-arrow { color: rgba(0, 0, 0, .58); }
.quick-action strong { display: block; font-size: 14px; font-weight: 640; }
.quick-action small { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; }
.quick-action.primary small { color: rgba(0, 0, 0, .62); }
.quick-action.locked, .action-tile.locked { opacity: .48; filter: saturate(.45); }
.quick-action.locked:hover, .action-tile.locked:hover { transform: none; border-color: var(--line); }
.queue-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 22px; }
.queue-card { min-height: 88px; padding: 14px; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 11px; border: 1px solid var(--line); border-radius: 12px; background: #0d0d0d; }
.queue-card:hover { border-color: var(--line-strong); background: var(--surface); }
.queue-count { min-width: 38px; height: 38px; padding: 0 8px; display: grid; place-items: center; border-radius: 10px; color: #fff; background: var(--surface-3); font-size: 16px; font-weight: 670; font-variant-numeric: tabular-nums; }
.queue-card.attention .queue-count { color: var(--warning); background: var(--warning-soft); }
.queue-card.ready .queue-count { color: var(--success); background: var(--success-soft); }
.queue-card strong, .queue-card small { display: block; }
.queue-card strong { font-size: 12px; }
.queue-card small { margin-top: 2px; color: var(--muted); font-size: 10px; }
.queue-arrow { color: #6b6b6b; }
.action-section-head { margin: 0 0 10px; display: flex; justify-content: space-between; align-items: end; gap: 16px; }
.action-section-head h3 { margin: 0; font-size: 14px; }
.action-section-head span { color: var(--muted); font-size: 10px; }
.action-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; }
.action-tile { min-height: 78px; padding: 13px; display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; align-items: center; gap: 11px; border: 1px solid var(--line); border-radius: 12px; background: #111111; transition: border-color .15s, background .15s; }
.action-tile:hover { border-color: #4b4b4b; background: #1d1d1d; }
.action-tile.primary, .action-tile.attention, .action-tile.close-day { border-color: var(--line); background: #111111; }
.action-icon { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 9px; background: #252525; font-size: 16px; filter: grayscale(.45); }
.action-tile strong, .action-tile small { display: block; }
.action-tile strong { margin-bottom: 2px; font-size: 12px; font-weight: 630; }
.action-tile small { color: var(--muted); font-size: 10px; }
.action-tile > b { color: #666; font-size: 15px; }
.action-status { margin-top: 14px; overflow: hidden; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--line); }
.action-status > div { padding: 16px; background: #0d0d0d; }
.action-status span, .action-status strong, .action-status small { display: block; }
.action-status span { color: #777; font-size: 9px; font-weight: 720; letter-spacing: .07em; text-transform: uppercase; }
.action-status strong { margin: 6px 0 2px; font-size: 18px; font-weight: 650; }
.action-status small { color: var(--muted); font-size: 10px; }

.command-palette { position: fixed; inset: 0; z-index: 100; display: none; place-items: start center; padding: min(16vh, 120px) 18px 20px; background: rgba(0, 0, 0, .68); backdrop-filter: blur(5px); }
.command-palette.open { display: grid; }
.command-box { width: min(620px, 100%); overflow: hidden; border: 1px solid #424242; border-radius: 16px; background: #181818; box-shadow: 0 25px 80px rgba(0, 0, 0, .55); }
.command-search { padding: 12px; border-bottom: 1px solid var(--line); }
.command-search input { min-height: 48px; padding-left: 14px; border: 0; background: #111; font-size: 14px; }
.command-results { max-height: min(58vh, 480px); padding: 7px; overflow-y: auto; }
.command-results a { min-height: 45px; padding: 8px 10px; display: flex; align-items: center; justify-content: space-between; gap: 14px; border-radius: 9px; color: #d5d5d5; font-size: 12px; }
.command-results a:hover, .command-results a.selected { color: #fff; background: #292929; }
.command-results a span:last-child { color: #666; font-size: 10px; }
.command-empty { display: none; padding: 25px; color: var(--muted); text-align: center; font-size: 12px; }
.command-hint { padding: 9px 12px; border-top: 1px solid var(--line); color: #666; font-size: 9px; }

.mobile-nav { display: none; }
.login-page { min-height: 100vh; padding: 20px; display: grid; place-items: center; background: #000; }
.login-card { width: min(390px, 100%); padding: 28px; border: 1px solid #282828; border-radius: 17px; background: #121212; box-shadow: var(--shadow); }
.login-card .btn { width: 100%; margin-top: 3px; }

.guide-flow { margin-bottom: 16px; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.guide-flow a { min-height: 92px; padding: 13px; display: grid; align-content: space-between; border: 1px solid var(--line); border-radius: 12px; background: #0d0d0d; }
.guide-flow a:hover { border-color: var(--line-strong); background: var(--surface); }
.guide-flow span { width: 25px; height: 25px; display: grid; place-items: center; border-radius: 8px; color: #111; background: #f4f4f4; font-size: 10px; font-weight: 750; }
.guide-flow strong, .guide-flow small { display: block; }
.guide-flow strong { margin-top: 13px; font-size: 12px; }
.guide-flow small { color: var(--muted); font-size: 9px; }
.guide-grid { display: grid; gap: 12px; }
.guide-section { display: grid; grid-template-columns: 54px minmax(0, 1fr); gap: 16px; scroll-margin-top: 90px; }
.guide-number { color: #5e5e5e; font-size: 19px; font-weight: 620; letter-spacing: -.04em; }
.guide-section h3 { margin: 0 0 8px; font-size: 17px; }
.guide-section p { margin: 0 0 10px; color: #b1b1b1; font-size: 12px; }
.guide-section ul { margin: 9px 0; padding-left: 18px; color: #a9a9a9; font-size: 12px; }
.guide-links { display: flex; flex-wrap: wrap; gap: 8px 15px; margin-top: 12px; }
.guide-links a { color: var(--accent-text); font-size: 11px; font-weight: 620; }
.guide-terms { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; overflow: hidden; border: 1px solid var(--line); border-radius: 11px; background: var(--line); }
.guide-terms div { padding: 14px; background: #0d0d0d; }
.guide-terms strong, .guide-terms span { display: block; }
.guide-terms strong { margin-bottom: 5px; font-size: 11px; }
.guide-terms span { color: var(--muted); font-size: 10px; line-height: 1.5; }

@media (max-width: 1280px) {
  .command-trigger { min-width: 38px; width: 38px; padding: 0; justify-content: center; }
  .command-trigger > span { display: none; }
  .command-trigger kbd { border: 0; background: transparent; font-size: 0; }
  .command-trigger kbd::after { content: "⌕"; color: #aaa; font: 19px system-ui; }
  .header-finance { max-width: 46vw; overflow-x: auto; scrollbar-width: none; }
  .cards, .kpi-grid.four, .kpi-grid.five { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .quick-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .guide-flow { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 920px) {
  .layout { display: block; }
  .main { min-width: 0; }
  .sidebar { transform: translateX(-105%); transition: transform .2s ease; box-shadow: 18px 0 55px rgba(0, 0, 0, .5); }
  body.sidebar-open { overflow: hidden; }
  body.sidebar-open .sidebar { transform: translateX(0); }
  .sidebar-scrim { position: fixed; inset: 0; z-index: 35; background: rgba(0, 0, 0, .58); }
  body.sidebar-open .sidebar-scrim { display: block; }
  .mobile-menu { display: grid; place-items: center; }
  .top-title small { display: none; }
  .topbar { padding: 9px 14px; }
  .content { padding: 22px 16px 88px; }
  .header-finance { max-width: calc(100vw - 150px); }
  .finance-chip { min-width: 112px; }
  .user-chip, .top-logout { display: none; }
  .page-head, .page-heading { flex-direction: column; align-items: stretch; }
  .grid-2, .grid-3, .form-grid, .form-grid.cols-3, .check-grid { grid-template-columns: 1fr; }
  .guide-terms { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .field.full, .full-field { grid-column: auto; }
  .setup-card { grid-template-columns: 1fr; }
  .action-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .queue-grid { grid-template-columns: 1fr; }
  .dynamic-row, .dynamic-row.output, .dynamic-row.labor, .dynamic-row.order, .dynamic-row.purchase-row { grid-template-columns: 1fr 1fr 42px; }
  .dynamic-row.labor > :nth-child(2), .dynamic-row.order > :first-child { grid-column: 1 / 3; }
  .dynamic-row.purchase-row > :first-child { grid-column: 1 / 3; }
  .lot-row.thaw-row { grid-template-columns: 1fr 1fr; }
  .lot-row.thaw-row > span { grid-column: 1 / -1; }
  .mobile-nav { position: fixed; inset: auto 10px 10px; z-index: 30; height: 62px; padding: 5px; display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid #363636; border-radius: 15px; background: rgba(23, 23, 23, .95); box-shadow: 0 14px 40px rgba(0, 0, 0, .45); backdrop-filter: blur(18px); }
  .mobile-nav a { display: grid; place-items: center; align-content: center; gap: 2px; border-radius: 10px; color: #777; font-size: 9px; }
  .mobile-nav a span { font-size: 16px; filter: grayscale(1); }
  .mobile-nav a.active { color: #fff; background: #2a2a2a; }
  .mobile-nav a.active span { filter: grayscale(0); }
}

@media (max-width: 600px) {
  .topbar { min-height: 62px; }
  .top-title, .command-trigger { display: none; }
  .header-finance { max-width: calc(100vw - 84px); }
  .finance-chip { min-width: 105px; }
  .page-head h2, .page-heading h1 { font-size: 23px; }
  .cards, .kpi-grid, .kpi-grid.four, .kpi-grid.five, .quick-actions, .action-grid { grid-template-columns: 1fr; }
  .guide-flow, .guide-terms { grid-template-columns: 1fr; }
  .guide-section { grid-template-columns: 1fr; gap: 7px; }
  .quick-action { min-height: 92px; }
  .action-status { grid-template-columns: 1fr; }
  .dynamic-row, .dynamic-row.output, .dynamic-row.labor, .dynamic-row.order, .dynamic-row.purchase-row { grid-template-columns: 1fr 42px; }
  .dynamic-row > *:not(.remove-row) { grid-column: 1; }
  .dynamic-row .remove-row { grid-column: 2; grid-row: 1; }
  .lot-row { grid-template-columns: 1fr; }
  .lot-row.thaw-row { grid-template-columns: 1fr; }
  .lot-row.thaw-row > span { grid-column: auto; }
  .lot-row input { text-align: left; }
  .details { grid-template-columns: 1fr; gap: 2px; }
  .details dd { margin-bottom: 8px; }
  .card { padding: 15px; }
  th, td { padding: 11px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
