/* HiveStock Admin — internal tool. Same design tokens as the kiosk (charcoal /
   hive yellow / Barlow), desktop-first, function over flourish. */
@font-face { font-family: 'Barlow'; font-style: normal; font-weight: 500; font-display: swap; src: url('/fonts/Barlow-500.woff2') format('woff2'); }
@font-face { font-family: 'Barlow'; font-style: normal; font-weight: 600; font-display: swap; src: url('/fonts/Barlow-600.woff2') format('woff2'); }
@font-face { font-family: 'Barlow'; font-style: normal; font-weight: 700; font-display: swap; src: url('/fonts/Barlow-700.woff2') format('woff2'); }
@font-face { font-family: 'Barlow'; font-style: normal; font-weight: 800; font-display: swap; src: url('/fonts/Barlow-800.woff2') format('woff2'); }

:root {
  --bg: #121417;
  --surface: #1c1f24;
  --surface-2: #23272e;
  --border: #2a2e35;
  --text: #f2f4f7;
  --text-dim: #9aa3ae;
  --accent: #ffc400;
  --accent-ink: #14161a;
  --warn: #ff8a00;
  --danger: #ff4d4f;
  --success: #2ecc71;
  --radius: 8px;
  --font: 'Barlow', 'Segoe UI', system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 15px; }
#app { height: 100vh; height: 100dvh; }
h1, h2, h3 { margin: 0 0 12px; font-weight: 800; }
a { color: var(--accent); }

/* Buttons / inputs */
button { font-family: inherit; font-weight: 700; color: var(--text); background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); min-height: 40px; padding: 0 16px; cursor: pointer; transition: background 60ms, border-color 60ms; }
button:hover { border-color: var(--text-dim); }
button:active { transform: translateY(1px); }
button:disabled { opacity: 0.45; pointer-events: none; }
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn-primary:hover { background: #ffce33; }
.btn-danger { color: var(--danger); border-color: #4a2a2c; }
.btn-sm { min-height: 32px; padding: 0 10px; font-size: 0.9rem; }
label { display: block; font-size: 0.85rem; color: var(--text-dim); font-weight: 600; margin-bottom: 5px; }
input, select, textarea { width: 100%; font-family: inherit; font-size: 0.95rem; color: var(--text); background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 9px 11px; min-height: 40px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }
textarea { min-height: 90px; resize: vertical; }
.field { margin-bottom: 14px; }
.field-row { display: flex; gap: 14px; flex-wrap: wrap; }
.field-row > .field { flex: 1; min-width: 160px; }
.check { display: flex; align-items: center; gap: 10px; min-height: 40px; }
.check input { width: 20px; height: 20px; min-height: 20px; accent-color: var(--accent); }
.check label { margin: 0; color: var(--text); font-weight: 600; }
.muted { color: var(--text-dim); }
.error { color: var(--danger); font-weight: 600; }
.ok { color: var(--success); font-weight: 600; }

/* Login */
.login { height: 100%; display: flex; align-items: center; justify-content: center; }
.login .card { width: min(92vw, 400px); background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 32px; }
.login img { width: 100%; max-width: 320px; display: block; margin: 0 auto 24px; }
.login .msg { min-height: 1.4em; margin-top: 10px; }

/* Shell */
.shell { display: grid; grid-template-columns: 240px 1fr; height: 100%; }
.sidebar { background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; }
.sidebar .brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; font-weight: 800; letter-spacing: 0.1em; }
.sidebar .brand svg { width: 22px; height: 22px; fill: var(--accent); }
.sidebar .brand .mark { color: var(--accent); }
.switcher { padding: 12px 16px; border-bottom: 1px solid var(--border); }
.switcher label { display: block; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-dim); margin-bottom: 5px; }
.switcher select { min-height: 38px; }
.nav { flex: 1; padding: 8px; overflow-y: auto; }
.nav .group { color: var(--text-dim); font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; padding: 14px 12px 6px; }
.nav-item { display: flex; align-items: center; justify-content: space-between; width: 100%; text-align: left; background: transparent; border: none; border-radius: var(--radius); padding: 11px 12px; margin: 2px 0; color: var(--text); font-weight: 600; }
.nav-item:hover { background: var(--surface-2); }
.nav-item.active { background: var(--accent); color: var(--accent-ink); }
.nav-item.disabled { color: var(--text-dim); opacity: 0.55; pointer-events: none; }
.nav-item .soon { font-size: 0.65rem; background: var(--surface-2); color: var(--text-dim); border: 1px solid var(--border); border-radius: 5px; padding: 1px 6px; }
.sidebar .who { border-top: 1px solid var(--border); padding: 14px 16px; }
.sidebar .who .name { font-weight: 700; }
.sidebar .who .role { color: var(--text-dim); font-size: 0.8rem; }
.sidebar .who button { margin-top: 10px; width: 100%; min-height: 36px; }

.main { min-width: 0; overflow-y: auto; padding: 26px clamp(18px, 3vw, 40px); }
.main .head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar input, .toolbar select { width: auto; min-width: 160px; }

/* Table */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { color: var(--text-dim); font-weight: 700; font-size: 0.78rem; letter-spacing: 0.04em; text-transform: uppercase; background: var(--surface); position: sticky; top: 0; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface); }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
.tag { display: inline-block; font-size: 0.72rem; font-weight: 700; padding: 2px 7px; border-radius: 5px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-dim); }
.tag.type { color: var(--text); }
.tag.owned { border-color: var(--warn); color: var(--warn); }
.tag.inactive { border-color: var(--danger); color: var(--danger); }
.pill { font-weight: 800; }
.pill.warn { color: var(--warn); }
.pill.out { color: var(--danger); }

/* Card / panel (forms, receipts) */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 22px; max-width: 720px; }
.panel h2 { margin-bottom: 18px; }
.actions { display: flex; gap: 12px; margin-top: 20px; }
.divider { height: 1px; background: var(--border); margin: 18px 0; }

/* Stock-in delivery lines */
.line-card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 16px; margin-bottom: 12px; }
.line-card .line-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 12px; }
.receipt-line { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--border); }

/* Modal overlay */
.overlay { position: fixed; inset: 0; background: rgba(8,9,11,0.72); display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow-y: auto; z-index: 20; }
.overlay .panel { width: min(94vw, 720px); }

/* Reports landing cards */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.report-card { text-align: left; padding: 18px; min-height: 96px; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; background: var(--surface); }
.report-card:hover { border-color: var(--accent); }
.report-card.custom { border-style: dashed; }
.rc-title { font-weight: 800; font-size: 1.1rem; }
.rc-desc { color: var(--text-dim); font-size: 0.9rem; font-weight: 500; }
.chk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 4px 14px; margin-bottom: 8px; }

/* Segmented toggle */
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.seg button { min-height: 36px; border: none; border-radius: 0; background: var(--surface); }
.seg button.active { background: var(--accent); color: var(--accent-ink); }

/* History */
.out-strip { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 14px; padding: 10px 16px; border-radius: 8px; background: var(--surface); border: 1px solid var(--warn); color: var(--warn); font-weight: 600; }
.out-strip.overdue { border-color: var(--danger); color: var(--danger); }
.out-strip strong { font-size: 1.15rem; }
.hlines { display: flex; flex-direction: column; gap: 6px; padding: 6px 0; }
.hline { display: grid; grid-template-columns: 2fr 2fr auto; gap: 12px; align-items: baseline; padding: 6px 10px; background: var(--bg); border-radius: 6px; }
.due { color: var(--warn); font-weight: 600; font-size: 0.9rem; }

/* Count sheet */
.cts { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.ct-group { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; }
.ct-ghead { margin-bottom: 8px; }
.ct-lines { width: 100%; }
.ct-lines td { border-bottom: 1px solid var(--border); padding: 7px 6px; white-space: normal; }
.ct-lines tr:last-child td { border-bottom: none; }
.ct-label { font-weight: 600; }
.ct-sys { color: var(--text-dim); font-size: 0.82rem; text-align: right; width: 5.5em; }
.ct-inp { width: 8.5em; }
.ct-inp input, .ct-inp select { min-height: 34px; padding: 5px 8px; }
/* Blind by default: system quantities are hidden until "Reveal system". */
.cts .blind { opacity: 0; transition: opacity 80ms; }
.cts.revealed .blind { opacity: 1; }

.hidden { display: none !important; }

@media (max-width: 720px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
}
