/* The Plane Stock — styles */
:root {
  --navy: #12263F;
  --navy-2: #1B3557;
  --navy-3: #2A4A73;
  --amber: #F2A33A;
  --amber-soft: #FDF1DE;
  --bg: #F5F3EE;
  --card: #FFFFFF;
  --line: #E6E1D6;
  --line-2: #EFEBE3;
  --ink: #17202B;
  --ink-2: #4B5563;
  --ink-3: #8A8F98;
  --focus: #2F6FDE;

  --ok: #1F8A4C;      --ok-bg: #E5F4EB;
  --warn: #A86500;    --warn-bg: #FDF0D9;
  --bad: #C2362B;     --bad-bg: #FBE6E3;
  --muted-bg: #EEF0F3;

  --chart: #2A4A73;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(18, 38, 63, .06), 0 4px 16px rgba(18, 38, 63, .05);
  --sidebar: 248px;
  font-family: 'Manrope', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); }
body { font-size: 15px; line-height: 1.45; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--navy-3); }
.boot { display: grid; place-items: center; height: 100vh; color: var(--ink-3); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.num { font-variant-numeric: tabular-nums; }

/* ---------- login ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-brand {
  background: radial-gradient(1200px 600px at -10% 110%, #24456F 0%, transparent 60%), var(--navy);
  color: #fff; padding: 56px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden;
}
.auth-brand .runway { position: absolute; right: -60px; bottom: 80px; width: 520px; opacity: .14; }
.auth-brand h1 { font-size: 44px; line-height: 1.05; margin: 0 0 14px; letter-spacing: -.02em; font-weight: 800; }
.auth-brand p { color: #C9D4E3; max-width: 420px; margin: 0; font-size: 16px; }
.brand-row { display: flex; align-items: center; gap: 12px; font-weight: 800; letter-spacing: .02em; }
.brand-row .logo { width: 40px; height: 40px; }
.auth-feats { display: flex; gap: 22px; flex-wrap: wrap; color: #C9D4E3; font-size: 13px; }
.auth-feats span::before { content: '●'; color: var(--amber); margin-right: 8px; font-size: 9px; vertical-align: 2px; }
.auth-form { display: grid; place-items: center; padding: 32px 20px; }
.auth-card { width: 100%; max-width: 380px; }
.auth-card h2 { font-size: 26px; margin: 0 0 6px; letter-spacing: -.01em; }
.auth-card .sub { color: var(--ink-2); margin: 0 0 26px; }
.field { display: grid; gap: 6px; margin-bottom: 16px; }
.field label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.input, .select, .textarea {
  width: 100%; padding: 11px 13px; border: 1.5px solid var(--line); border-radius: 10px; background: #fff;
  transition: border-color .15s, box-shadow .15s; outline: none;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--focus); box-shadow: 0 0 0 3px rgba(47, 111, 222, .15); }
.textarea { min-height: 120px; resize: vertical; line-height: 1.5; }
.pw-wrap { position: relative; }
.pw-wrap button { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: none; color: var(--ink-3); cursor: pointer; padding: 6px 8px; font-size: 12px; font-weight: 700; }
.form-error { background: var(--bad-bg); color: var(--bad); border-radius: 10px; padding: 10px 12px; font-size: 14px; margin-bottom: 14px; }
.hint { color: var(--ink-3); font-size: 13px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1.5px solid transparent;
  border-radius: 10px; padding: 10px 16px; font-weight: 700; cursor: pointer; background: var(--navy); color: #fff;
  transition: transform .05s, background .15s, opacity .15s; white-space: nowrap; text-decoration: none; font-size: 14px;
}
.btn:hover { background: var(--navy-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.block { width: 100%; padding: 13px; font-size: 15px; }
.btn.amber { background: var(--amber); color: var(--navy); }
.btn.amber:hover { background: #E8952A; }
.btn.ghost { background: #fff; color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { background: var(--line-2); }
.btn.danger { background: #fff; color: var(--bad); border-color: #F0C9C4; }
.btn.sm { padding: 6px 11px; font-size: 13px; border-radius: 8px; }
.btn svg { width: 17px; height: 17px; flex: none; }
.icon-btn { border: 1.5px solid var(--line); background: #fff; border-radius: 10px; width: 40px; height: 40px; display: grid; place-items: center; cursor: pointer; color: var(--ink-2); }
.icon-btn:hover { background: var(--line-2); }
.icon-btn svg { width: 18px; height: 18px; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar {
  background: var(--navy); color: #DCE4EF; padding: 22px 14px; position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 6px;
}
.sidebar .brand-row { color: #fff; padding: 2px 10px 22px; font-size: 16px; }
.sidebar .brand-row small { display: block; font-weight: 600; color: #8FA3BD; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
.nav-sec { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: #7D91AB; padding: 14px 12px 6px; font-weight: 700; }
.nav a {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: #DCE4EF;
  text-decoration: none; font-weight: 600; font-size: 14.5px; position: relative;
}
.nav a svg { width: 19px; height: 19px; opacity: .85; }
.nav a:hover { background: rgba(255, 255, 255, .06); }
.nav a.active { background: rgba(242, 163, 58, .14); color: #fff; }
.nav a.active::before { content: ''; position: absolute; left: -14px; top: 9px; bottom: 9px; width: 4px; border-radius: 0 4px 4px 0; background: var(--amber); }
.nav a.active svg { color: var(--amber); opacity: 1; }
.sidebar .spacer { flex: 1; }
.me-card { display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: 12px; background: rgba(255, 255, 255, .06); }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--amber); color: var(--navy); display: grid; place-items: center; font-weight: 800; font-size: 14px; flex: none; }
.me-card .who { flex: 1; min-width: 0; }
.me-card .who b { display: block; color: #fff; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-card .who span { font-size: 12px; color: #8FA3BD; }
.logout { border: 0; background: rgba(255, 255, 255, .08); color: #fff; border-radius: 9px; padding: 8px 10px; cursor: pointer; display: flex; gap: 6px; align-items: center; font-weight: 700; font-size: 12.5px; }
.logout:hover { background: rgba(194, 54, 43, .55); }
.logout svg { width: 15px; height: 15px; }

.main { min-width: 0; padding: 26px 32px 120px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.topbar h1 { margin: 0; font-size: 26px; letter-spacing: -.02em; font-weight: 800; }
.topbar .crumb { color: var(--ink-3); font-size: 13px; font-weight: 600; margin-bottom: 2px; }
.topbar-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.mobile-head { display: none; }

.datebar { display: flex; align-items: center; gap: 6px; background: #fff; border: 1.5px solid var(--line); border-radius: 12px; padding: 4px; }
.datebar button { border: 0; background: none; width: 34px; height: 34px; border-radius: 8px; cursor: pointer; color: var(--ink-2); display: grid; place-items: center; }
.datebar button:hover { background: var(--line-2); }
.datebar button svg { width: 16px; height: 16px; }
.datebar input { border: 0; outline: none; font-weight: 700; padding: 6px 4px; background: none; width: 150px; }
.datebar .today { width: auto; padding: 0 10px; font-weight: 700; font-size: 13px; }

/* ---------- cards ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--line-2); }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--line-2); }
.card-h h3 { margin: 0; font-size: 16px; display: flex; align-items: center; gap: 10px; }
.card-b { padding: 18px 20px; }
.grid { display: grid; gap: 18px; }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3-2 { grid-template-columns: 3fr 2fr; }

.stat { padding: 18px 20px; display: flex; flex-direction: column; gap: 6px; }
.stat .label { color: var(--ink-2); font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.stat .label .dot { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; }
.stat .label .dot svg { width: 17px; height: 17px; }
.stat .value { font-size: 30px; font-weight: 800; letter-spacing: -.02em; }
.stat .value small { font-size: 15px; color: var(--ink-3); font-weight: 700; }
.stat .meta { font-size: 13px; color: var(--ink-3); }
.bar-track { height: 6px; border-radius: 6px; background: var(--line-2); overflow: hidden; }
.bar-track i { display: block; height: 100%; background: var(--navy-3); border-radius: 6px; }

/* status pills */
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px 3px 7px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.pill svg { width: 13px; height: 13px; }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.near { background: var(--warn-bg); color: var(--warn); }
.pill.low, .pill.out { background: var(--bad-bg); color: var(--bad); }
.pill.none { background: var(--muted-bg); color: var(--ink-3); }
.pill.role-admin { background: var(--amber-soft); color: #8A5400; }
.pill.role-staff { background: var(--muted-bg); color: var(--ink-2); }

.restock-list { list-style: none; margin: 0; padding: 0; }
.restock-list li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.restock-list li:last-child { border-bottom: 0; }
.restock-list .nm { font-weight: 600; }
.restock-list .sub { font-size: 12.5px; color: var(--ink-3); }
.empty { color: var(--ink-3); text-align: center; padding: 26px 10px; font-size: 14px; }
.empty b { display: block; color: var(--ink-2); font-size: 15px; margin-bottom: 4px; }

.note-box { background: var(--amber-soft); border-radius: 12px; padding: 14px 16px; white-space: pre-wrap; font-size: 14px; color: #4B3A1A; }
.note-box .by { display: block; margin-top: 8px; font-size: 12px; color: #8A6A30; font-weight: 600; }

/* ---------- toolbar / chips ---------- */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.search { position: relative; flex: 1; min-width: 200px; max-width: 340px; }
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--ink-3); }
.search input { padding-left: 38px; }
.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; margin-bottom: 14px; }
.chip {
  border: 1.5px solid var(--line); background: #fff; border-radius: 999px; padding: 7px 13px; font-weight: 700; font-size: 13px;
  cursor: pointer; white-space: nowrap; color: var(--ink-2); display: inline-flex; gap: 7px; align-items: center;
}
.chip .c { background: var(--line-2); border-radius: 999px; padding: 0 7px; font-size: 11.5px; }
.chip.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.chip.on .c { background: rgba(255, 255, 255, .18); }
.toggle { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--ink-2); cursor: pointer; user-select: none; }
.toggle input { width: 17px; height: 17px; accent-color: var(--navy); }
.seg { display: inline-flex; background: #fff; border: 1.5px solid var(--line); border-radius: 11px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: none; padding: 7px 14px; border-radius: 8px; font-weight: 700; font-size: 13.5px; color: var(--ink-2); cursor: pointer; }
.seg button.on { background: var(--navy); color: #fff; }

/* ---------- stock table ---------- */
.progress-line { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--ink-2); font-weight: 600; }
.progress-line .bar-track { width: 140px; }
.stock-table { width: 100%; border-collapse: separate; border-spacing: 0; }
.stock-table th {
  text-align: left; font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); font-weight: 700;
  padding: 10px 10px; background: #FBFAF7; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 2;
}
.stock-table th.r, .stock-table td.r { text-align: right; }
.stock-table td { padding: 8px 10px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.stock-table tr.cat td { background: #F8F6F1; font-weight: 800; font-size: 12.5px; letter-spacing: .04em; text-transform: uppercase; color: var(--navy-3); padding: 9px 12px; }
.stock-table tr.row:hover td { background: #FCFBF8; }
.stock-table tr.row.dirty td:first-child { box-shadow: inset 3px 0 0 var(--amber); }
.item-name { font-weight: 700; }
.item-sub { font-size: 12px; color: var(--ink-3); font-weight: 600; }
.unit-tag { display: inline-block; background: var(--muted-bg); color: var(--ink-2); border-radius: 6px; padding: 2px 7px; font-size: 12px; font-weight: 700; }
.cell-in {
  width: 92px; padding: 8px 10px; border: 1.5px solid var(--line); border-radius: 9px; text-align: right; outline: none;
  font-variant-numeric: tabular-nums; font-weight: 600; background: #fff;
}
.cell-in:focus { border-color: var(--focus); box-shadow: 0 0 0 3px rgba(47, 111, 222, .15); }
.cell-in.carried { background: #F4F7FB; color: var(--navy-3); border-style: dashed; }
.cell-in.rem { border-color: #C9D4E3; }
.used { font-weight: 800; font-variant-numeric: tabular-nums; }
.used.neg { color: var(--warn); }
.warn-ico { color: var(--warn); display: inline-flex; vertical-align: -3px; margin-left: 4px; cursor: help; }
.warn-ico svg { width: 15px; height: 15px; }
.table-wrap { overflow-x: auto; border-radius: var(--radius); }

.savebar {
  position: fixed; left: var(--sidebar); right: 0; bottom: 0; z-index: 20; padding: 12px 32px calc(12px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, .92); backdrop-filter: blur(8px); border-top: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; gap: 12px; transform: translateY(110%); transition: transform .2s;
}
.savebar.show { transform: none; }
.savebar .msg { font-weight: 700; display: flex; align-items: center; gap: 8px; }
.savebar .msg::before { content: ''; width: 9px; height: 9px; border-radius: 50%; background: var(--ok); }
.savebar:not(.dirty) .msg { color: var(--ink-3); font-weight: 600; }
.savebar.dirty .msg::before { background: var(--amber); }
.saved-meta { font-size: 12.5px; color: var(--ink-3); font-weight: 600; }

/* ---------- sales ---------- */
.menu-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.menu-card { background: #fff; border: 1.5px solid var(--line-2); border-radius: 12px; padding: 12px 12px 12px 14px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.menu-card.has { border-color: #C9D4E3; background: #FBFCFE; }
.menu-card .nm { font-weight: 700; font-size: 14px; line-height: 1.25; }
.stepper { display: flex; align-items: center; border: 1.5px solid var(--line); border-radius: 10px; overflow: hidden; flex: none; background: #fff; }
.stepper button { border: 0; background: none; width: 34px; height: 36px; font-size: 18px; font-weight: 700; cursor: pointer; color: var(--navy-3); }
.stepper button:hover { background: var(--line-2); }
.stepper input { width: 48px; border: 0; text-align: center; font-weight: 800; outline: none; font-variant-numeric: tabular-nums; height: 36px; border-left: 1px solid var(--line-2); border-right: 1px solid var(--line-2); }
.cat-head { display: flex; align-items: baseline; justify-content: space-between; margin: 22px 2px 10px; }
.cat-head h4 { margin: 0; font-size: 15px; }
.cat-head span { color: var(--ink-3); font-size: 13px; font-weight: 700; }

/* ---------- charts ---------- */
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .grid-l { stroke: var(--line-2); stroke-width: 1; }
.chart .axis-t { fill: var(--ink-3); font-size: 11px; font-weight: 600; }
.chart .bar { fill: var(--chart); }
.chart .bar.empty { fill: var(--line-2); }
.chart .hit:hover + .bar, .chart .bar.hl { fill: var(--navy); }
.chart .hit { fill: transparent; cursor: default; }
.chart-tip {
  position: absolute; pointer-events: none; background: var(--navy); color: #fff; padding: 7px 10px; border-radius: 8px;
  font-size: 12.5px; font-weight: 600; white-space: nowrap; transform: translate(-50%, -110%); opacity: 0; transition: opacity .1s; z-index: 5;
}
.chart-tip b { font-size: 14px; }
.hbar { display: grid; grid-template-columns: minmax(0, 1fr) 2fr auto; gap: 10px; align-items: center; padding: 6px 0; font-size: 13.5px; }
.hbar .nm { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbar .tr { height: 10px; background: var(--line-2); border-radius: 0 5px 5px 0; }
.hbar .tr i { display: block; height: 100%; background: var(--chart); border-radius: 0 5px 5px 0; min-width: 2px; }
.hbar .v { font-weight: 800; font-variant-numeric: tabular-nums; min-width: 28px; text-align: right; }

/* ---------- reports ---------- */
.report-controls { display: grid; grid-template-columns: auto auto 1fr auto; gap: 14px; align-items: end; }
.report-controls .field { margin: 0; }
.report-paper { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 34px 38px; border: 1px solid var(--line-2); }
.rp-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; border-bottom: 3px solid var(--navy); padding-bottom: 14px; margin-bottom: 18px; }
.rp-head h2 { margin: 0; font-size: 22px; letter-spacing: -.01em; }
.rp-head .period { color: var(--ink-2); font-weight: 700; margin-top: 4px; }
.rp-head .brand-row { color: var(--navy); font-size: 14px; }
.rp-section { margin-bottom: 30px; }
.rp-section h3 { font-size: 17px; margin: 0 0 10px; display: flex; align-items: center; gap: 10px; }
.rp-summary { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.rp-summary div { background: #F8F6F1; border-radius: 10px; padding: 9px 14px; font-size: 13px; color: var(--ink-2); font-weight: 600; }
.rp-summary b { display: block; font-size: 19px; color: var(--ink); font-weight: 800; }
.rp-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.rp-table th { background: var(--navy); color: #fff; text-align: left; padding: 8px 10px; font-size: 12px; letter-spacing: .03em; text-transform: uppercase; }
.rp-table td { padding: 7px 10px; border-bottom: 1px solid var(--line-2); }
.rp-table th.r, .rp-table td.r { text-align: right; }
.rp-table tr.cat td { background: #F1EEE6; font-weight: 800; color: var(--navy-3); font-size: 12.5px; text-transform: uppercase; letter-spacing: .04em; }
.rp-table tr.total td { font-weight: 800; border-top: 2px solid var(--navy); }
.rp-note h3 { font-size: 16px; margin: 0 0 8px; }
.rp-note .textarea { min-height: 150px; background: #FFFDF8; }
.rp-note .print-note { display: none; white-space: pre-wrap; }
.rp-foot { margin-top: 18px; padding-top: 12px; border-top: 1px solid var(--line); color: var(--ink-3); font-size: 12px; display: flex; justify-content: space-between; }
.export-bar { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- settings ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1.5px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs button { border: 0; background: none; padding: 10px 14px; font-weight: 700; color: var(--ink-3); cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -1.5px; white-space: nowrap; }
.tabs button.on { color: var(--navy); border-bottom-color: var(--amber); }
.list-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.list-table th { text-align: left; font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); padding: 10px 12px; border-bottom: 1px solid var(--line); }
.list-table td { padding: 10px 12px; border-bottom: 1px solid var(--line-2); }
.list-table tr.off td { color: var(--ink-3); }
.list-table tr.off .item-name { text-decoration: line-through; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }

/* ---------- modal + toast ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(18, 38, 63, .45); display: grid; place-items: center; z-index: 50; padding: 16px; animation: fade .15s; }
.modal { background: #fff; border-radius: 16px; width: 100%; max-width: 440px; box-shadow: 0 20px 60px rgba(0, 0, 0, .25); max-height: 90vh; overflow: auto; }
.modal-h { padding: 18px 22px 0; }
.modal-h h3 { margin: 0; font-size: 18px; }
.modal-h p { margin: 6px 0 0; color: var(--ink-2); font-size: 14px; }
.modal-b { padding: 18px 22px; }
.modal-f { padding: 0 22px 20px; display: flex; justify-content: flex-end; gap: 8px; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@keyframes fade { from { opacity: 0; } }
#toast { visibility: hidden; position: fixed; top: 18px; left: 50%; transform: translate(-50%, -150%); background: var(--navy); color: #fff; padding: 11px 18px; border-radius: 12px; font-weight: 700; z-index: 60; transition: transform .25s; box-shadow: var(--shadow); max-width: calc(100vw - 32px); }
#toast.show { transform: translate(-50%, 0); visibility: visible; }
#toast.bad { background: var(--bad); }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-3-2 { grid-template-columns: 1fr; }
  .report-controls { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 860px) {
  :root { --sidebar: 0px; }
  .auth { grid-template-columns: 1fr; }
  .auth-brand { padding: 28px 22px; min-height: 0; gap: 20px; }
  .auth-brand h1 { font-size: 30px; }
  .auth-feats, .auth-brand .runway { display: none; }
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; top: auto; bottom: 0; left: 0; right: 0; height: auto; flex-direction: row; padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    z-index: 30; gap: 0; border-top: 1px solid rgba(255, 255, 255, .08);
  }
  .sidebar .brand-row, .sidebar .nav-sec, .sidebar .spacer, .sidebar .me-card { display: none; }
  .nav { display: contents; }
  .nav a { flex: 1; flex-direction: column; gap: 3px; font-size: 10.5px; padding: 7px 2px; text-align: center; }
  .nav a.active::before { display: none; }
  .nav a .lbl-long { display: none; }
  .main { padding: 0 16px 150px; }
  .mobile-head { display: flex; align-items: center; justify-content: space-between; background: var(--navy); color: #fff; margin: 0 -16px 18px; padding: 12px 16px; position: sticky; top: 0; z-index: 25; }
  .mobile-head .brand-row { font-size: 15px; }
  .mobile-head .brand-row .logo { width: 30px; height: 30px; }
  .g-2 { grid-template-columns: 1fr; }
  .g-4 { gap: 10px; }
  .stat { padding: 14px; }
  .stat .value { font-size: 24px; }
  .topbar h1 { font-size: 22px; }
  .savebar { left: 0; bottom: 62px; padding: 10px 16px; }
  .savebar .msg { display: none; }
  .savebar > div:last-child { width: 100%; justify-content: flex-end; }
  .report-controls { grid-template-columns: 1fr; }
  .report-paper { padding: 20px 16px; }
  .rp-head { flex-direction: column; }
  .search { max-width: none; }

  /* stock table becomes cards */
  .stock-table thead { display: none; }
  .stock-table, .stock-table tbody { display: block; }
  .stock-table tr.cat { display: block; }
  .stock-table tr.cat td { display: block; border-radius: 8px; margin-top: 10px; }
  .stock-table tr.row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 10px; padding: 12px; border-bottom: 1px solid var(--line-2); }
  .stock-table tr.row td { padding: 0; border: 0; }
  .stock-table tr.row td.c-name { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
  .stock-table tr.row td[data-l] { display: grid; gap: 3px; }
  .stock-table tr.row td[data-l]::before { content: attr(data-l); font-size: 11px; font-weight: 700; color: var(--ink-3); text-transform: uppercase; letter-spacing: .05em; text-align: left; }
  .stock-table tr.row td.c-unit, .stock-table tr.row td.c-status { display: none; }
  .stock-table tr.row td.c-used { text-align: left; }
  .cell-in { width: 100%; padding: 11px 12px; font-size: 16px; }
  .stock-table .m-status { display: inline-flex !important; }
}
.m-status { display: none !important; }

/* ---------- print ---------- */
@media print {
  @page { size: A4; margin: 14mm; }
  body { background: #fff; }
  .sidebar, .topbar, .mobile-head, .report-controls-card, .export-bar, .savebar, #toast, .no-print { display: none !important; }
  .shell { display: block; }
  .main { padding: 0; }
  .report-paper { box-shadow: none; border: 0; padding: 0; }
  .rp-note .textarea { display: none; }
  .rp-note .print-note { display: block; }
  .rp-table th { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .rp-table tr.cat td, .rp-summary div { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .rp-section { break-inside: auto; }
  .rp-table tr { break-inside: avoid; }
}
