:root {
  color-scheme: light;
  --navy: #073466;
  --navy-deep: #06284f;
  --bg: #edf2fa;
  --panel: #fff;
  --text: #101e38;
  --muted: #455774;
  --line: #d6e0ee;
  --blue: #075bb7;
  --orange: #e95000;
  --alt: #edf3fb;
  --danger: #a42536;
  --shadow: 0 3px 12px #17375e12, 0 1px 2px #16375e13;
  --sidebar: 15rem;
  --bar: 4.25rem;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #101a2b;
  --panel: #18263b;
  --text: #f1f5fd;
  --muted: #bac9df;
  --line: #324966;
  --blue: #85c4ff;
  --orange: #ff9f64;
  --alt: #213550;
  --danger: #ffb7c0;
  --shadow: 0 3px 12px #0003;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; color: var(--text); background: var(--bg); font: .9375rem/1.48 system-ui, -apple-system, sans-serif; }
h1, h2, h3 { line-height: 1.18; letter-spacing: -.025em; }
h1 { margin: 0 0 1.15rem; font-size: clamp(1.6rem, 3vw, 2.15rem); }
h2 { margin: 0 0 .65rem; font-size: 1.12rem; }
p { margin: .5rem 0; }
a { color: var(--blue); }
svg { width: 1.28rem; height: 1.28rem; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.topbar { display: flex; gap: .85rem; align-items: center; padding: .55rem clamp(.85rem, 2.5vw, 1.75rem); }
.theme { margin-left: auto; display: flex; align-items: center; gap: .45rem; }
.theme select { min-height: 2.4rem; }
#identity { max-width: 14rem; margin: 0; font-size: .82rem; font-weight: 650; overflow-wrap: anywhere; }
.mobile-brand, .menu-toggle, #mobile-nav { display: none; }
body:has(#app:not([hidden])) .topbar {
  position: sticky; z-index: 6; top: 0; height: var(--bar); margin-left: var(--sidebar);
  background: var(--panel); border-bottom: 1px solid var(--line);
}
.toolbar-title { font-size: 1.3rem; font-weight: 800; }
body:has(#app:not([hidden])) main { margin-left: var(--sidebar); padding: clamp(.85rem, 2vw, 1.7rem); }
#workspace-menu {
  position: fixed; z-index: 8; inset: 0 auto 0 0; width: var(--sidebar); padding: 1rem .75rem;
  color: #fff; background: linear-gradient(150deg, #0a427c, var(--navy-deep) 72%); overflow-y: auto;
}
.sidebar-brand, .mobile-brand { align-items: center; gap: .65rem; line-height: 1.15; }
.sidebar-brand { display: flex; padding: .25rem .4rem 1.2rem; font-weight: 750; }
.sidebar-brand strong { max-width: 10rem; padding-left: .65rem; border-left: 1px solid #ffffff59; }
#nav { display: grid; gap: .2rem; }
#nav a { display: flex; align-items: center; gap: .7rem; min-height: 2.54rem; padding: .43rem .65rem; border-radius: .55rem; color: #edf6ff; text-decoration: none; font-size: .91rem; font-weight: 620; }
#nav a:hover { background: #ffffff18; }
#nav a[aria-current] { background: linear-gradient(105deg, #ad3a00, #c74500); color: #fff; }
#page { max-width: 110rem; margin: auto; }
section, dialog { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: .85rem; padding: clamp(1rem, 2.2vw, 1.55rem); min-width: 0; box-shadow: var(--shadow); }
#page[data-page="dashboard"] { padding: 0; background: none; border: 0; box-shadow: none; }
#page[data-page="dashboard"] > h1 { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.dashboard { display: grid; gap: .85rem; }
.greeting h2 { margin: 0; font-size: 1.55rem; }
.greeting p { margin: .2rem 0 0; color: var(--muted); font-size: .88rem; }
.metric-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: .7rem; }
.metric { display: flex; align-items: center; gap: .68rem; background: var(--panel); padding: .85rem; border: 1px solid var(--line); border-radius: .78rem; box-shadow: var(--shadow); min-width: 0; }
.metric > div { min-width: 0; }
.metric > div span { display: block; font-size: .8rem; line-height: 1.25; color: var(--muted); }
.metric strong { display: block; margin-top: .13rem; font-size: clamp(1.25rem, 2.4vw, 1.8rem); line-height: 1.08; letter-spacing: -.04em; overflow-wrap: anywhere; }
.metric-icon { display: grid; place-items: center; width: 2.65rem; height: 2.65rem; flex: none; border-radius: .65rem; color: #fff; background: linear-gradient(145deg,#3e9af0,#0756b5); }
.metric-green .metric-icon { background: linear-gradient(145deg,#28a851,#087b3c); }
.metric-purple .metric-icon { background: linear-gradient(145deg,#9970e4,#6840ba); }
.metric-gold .metric-icon { background: linear-gradient(145deg,#de8b00,#ad5900); }
.quick-panel { padding: .85rem 1rem; }
.quick-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(5.65rem,1fr)); gap: .5rem; }
.quick-grid a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .35rem; min-height: 4rem; padding: .38rem .2rem; border: 1px solid var(--line); border-radius: .65rem; color: var(--text); background: var(--panel); text-align: center; text-decoration: none; font-weight: 650; font-size: .73rem; line-height: 1.2; }
.quick-grid a:hover { background: var(--alt); }
.quick-grid svg { color: var(--blue); width: 1.55rem; height: 1.55rem; }
.quick-grid [data-action="IN"] svg { color: #098544; }
.quick-grid [data-action="OUT"] svg { color: var(--orange); }
.quick-grid [data-action="labels"] svg { color: #9260de; }
.dashboard-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: .75rem; }
.dashboard-panel { padding: .9rem 1rem; }
.panel-heading { display: flex; justify-content: space-between; align-items: start; gap: .5rem; }
.panel-link { flex: none; font-size: .79rem; font-weight: 700; text-decoration: none; }
.stock-overview { display: flex; justify-content: space-evenly; align-items: center; gap: 1rem; min-height: 9rem; }
.stock-ring { flex: none; display: grid; place-items: center; width: 7.55rem; aspect-ratio: 1; border-radius: 50%; background: var(--alt); }
.stock-ring div { display: grid; align-content: center; justify-items: center; width: 72%; height: 72%; border-radius: 50%; background: var(--panel); }
.stock-ring strong { font-size: 1.12rem; }
.stock-ring small { font-size: .68rem; color: var(--muted); }
.stock-overview ul { list-style: none; padding: 0; margin: 0; display: grid; gap: .5rem; }
.stock-overview li { display: grid; grid-template-columns: .65rem 1fr auto; align-items: center; gap: .4rem; font-size: .81rem; }
.stock-overview li span { width: .55rem; aspect-ratio: 1; border-radius: .14rem; }
.stock-count { display: inline-block; background: var(--alt); color: var(--danger); min-width: 2rem; border-radius: 1rem; text-align: center; font-weight: 750; }
.stock-trend { display: grid; grid-template-columns: repeat(7,minmax(0,1fr)); gap: .5rem; min-height: 9rem; padding-top: .3rem; }
.trend-column { display: grid; grid-template-rows: auto 5.1rem auto; justify-items: center; gap: .22rem; color: var(--muted); font-size: .78rem; }
.trend-bar { align-self: end; width: min(66%,2rem); height: max(2px,var(--share)); border-radius: .35rem .35rem 0 0; background: linear-gradient(#2994f2,#0b5db6); }
.stock-alert { display: flex; align-items: center; gap: .6rem; padding: .72rem .85rem; background: var(--panel); border: 1px solid var(--line); color: var(--text); box-shadow: var(--shadow); border-radius: .75rem; text-decoration: none; font-size: .85rem; }
.stock-alert svg { color: #c48100; }
.stock-alert span { flex: 1; }
.stock-alert strong { display: block; }
.stock-alert b { padding: .2rem .5rem; border-radius: 1rem; background: var(--alt); color: var(--danger); white-space: nowrap; }
.auth-brand { display: none; }
body:not(:has(#app:not([hidden]))) {
  min-height: 100dvh; overflow-x: clip;
  background: radial-gradient(ellipse at 64% 35%,var(--panel) 6%,var(--bg) 72%);
}
body:not(:has(#app:not([hidden])))::before, body:not(:has(#app:not([hidden])))::after {
  content: ""; position: fixed; z-index: -1; pointer-events: none; width: clamp(19rem,45vw,44rem); height: clamp(11rem,25vw,25rem); border-radius: 4rem; transform: rotate(32deg);
}
body:not(:has(#app:not([hidden])))::before { left: -13%; bottom: -19%; background: linear-gradient(115deg,#064e9d 12%,#1386e5 61%,#51b84e 62%,#51b84e 83%,#ffd20c 84%); }
body:not(:has(#app:not([hidden])))::after { top: -22%; right: -12%; background: linear-gradient(110deg,#ff7d0a,#f95600 75%,#ffcc00 76%); }
body:not(:has(#app:not([hidden]))) .topbar { position: absolute; z-index: 1; inset: .3rem 0 auto; justify-content: end; }
body:not(:has(#app:not([hidden]))) .topbar :is(#identity,.toolbar-title) { display: none; }
body:not(:has(#app:not([hidden]))) main { min-height: 100dvh; position: relative; display: grid; grid-template-columns: minmax(0,1fr) minmax(0,27rem); align-content: center; align-items: center; gap: clamp(2rem,6vw,6rem); max-width: 70rem; margin: auto; padding: 5rem clamp(1.25rem,6vw,4rem); }
body:not(:has(#app:not([hidden]))) .auth-brand { display: grid; justify-items: center; text-align: center; gap: .85rem; }
.auth-lockup { display: flex; align-items: center; gap: 1.2rem; text-align: left; }
.auth-lockup img { width: clamp(4rem,8vw,6.25rem); height: auto; }
.auth-lockup strong { max-width: 13rem; border-left: 1px solid var(--line); padding-left: 1.2rem; font-size: clamp(1.7rem,3.6vw,2.65rem); line-height: 1.02; letter-spacing: -.045em; }
.auth-brand p { color: var(--muted); font-weight: 600; }
.auth-brand p span { padding: 0 .32rem; }
.auth { width: 100%; padding: clamp(1.2rem,4vw,2.15rem); border-radius: 1rem; box-shadow: 0 10px 28px #0b356820; }
.auth h1 { margin-bottom: .25rem; }
.auth-intro { color: var(--muted); margin: 0 0 1.2rem; }
.auth input { min-height: 2.9rem; }
.auth #reset-link { justify-self: end; padding: .15rem 0; background: transparent; color: var(--blue); font-weight: 650; font-size: .8rem; }
.auth .login-submit { justify-self: stretch; background: linear-gradient(100deg,#ba3b00,#c74500); border: 0; min-height: 2.95rem; }
.login-submit span { padding-left: .4rem; }
body:not(:has(#app:not([hidden]))) #notice { grid-column: 1 / -1; margin: 0; }
form, .stack { display: grid; grid-template-columns: minmax(0,1fr); gap: .85rem; }
form > button, form > .actions { justify-self: start; }
label { display: grid; gap: .28rem; font-weight: 650; }
input, select, button, textarea { font: inherit; border: 1px solid var(--line); border-radius: .52rem; padding: .53rem .66rem; min-width: 0; max-width: 100%; }
input, select, textarea { background: var(--panel); color: var(--text); }
input[type="checkbox"] { margin: 0; width: 1.12rem; height: 1.12rem; accent-color: #1260b5; }
button { cursor: pointer; color: #fff; background: #b54105; border-color: transparent; font-weight: 720; }
button.secondary { background: var(--alt); color: var(--text); }
button:disabled { opacity: .55; cursor: progress; }
:focus-visible { outline: 3px solid #287dd9; outline-offset: 2px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%,13rem),1fr)); gap: .75rem; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: .55rem; }
.checkbox { display: flex; align-items: center; gap: .45rem; font-weight: 500; }
fieldset { margin: 0; border: 1px solid var(--line); border-radius: .65rem; min-width: 0; padding: .85rem; }
legend { padding: 0 .3rem; font-weight: 720; }
.scroller { overflow-x: auto; max-width: 100%; }
table { width: 100%; border-collapse: collapse; font-size: .88rem; }
th, td { padding: .62rem; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: var(--alt); }
td input[type="number"] { width: 6.5rem; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: .7rem; padding: .9rem; overflow-wrap: anywhere; }
.card h2, .card h3 { margin: 0 0 .45rem; }
.card ul { padding-left: 1.3rem; }
.muted { color: var(--muted); }
.low, [data-error="true"] { color: var(--danger); font-weight: 650; }
#notice { background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow); padding: .65rem .9rem; border-radius: .55rem; margin: 0 auto .8rem; max-width: 110rem; }
video { display: block; background: #000; width: min(70vw,28rem); margin-bottom: .75rem; }
.summary { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: space-between; align-items: start; }
@media (max-width: 960px) {
  :root { --sidebar: 12rem; }
  .metric-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 720px) {
  body:has(#app:not([hidden])) .topbar { margin: 0; background: linear-gradient(105deg,#064583,var(--navy-deep)); border: 0; color: #fff; gap: .48rem; }
  body:has(#app:not([hidden])) main { margin: 0; padding: .85rem .8rem calc(5.2rem + env(safe-area-inset-bottom)); }
  .toolbar-title, #identity { display: none; }
  #workspace-menu { display: none; inset: var(--bar) auto calc(4rem + env(safe-area-inset-bottom)) 0; width: min(82vw,17rem); box-shadow: 8px 8px 25px #0004; }
  .menu-open #workspace-menu { display: block; }
  .sidebar-brand { display: none; }
  .mobile-brand { display: flex; min-width: 0; flex: 1; font-size: .85rem; }
  body:not(:has(#app:not([hidden]))) .mobile-brand { display: none; }
  .menu-toggle { display: inline-grid; place-items: center; width: 2.65rem; min-height: 2.75rem; padding: 0; background: transparent; color: #fff; font-size: 1.3rem; }
  body:not(:has(#app:not([hidden]))) .menu-toggle { display: none; }
  .theme { font-size: 0; }
  .theme select, #logout { font-size: .77rem; padding-inline: .37rem; }
  #mobile-nav { display: flex; position: fixed; inset: auto 0 0; z-index: 7; background: var(--panel); border-top: 1px solid var(--line); padding: .35rem .45rem calc(.35rem + env(safe-area-inset-bottom)); box-shadow: 0 -4px 15px #12375d12; }
  #mobile-nav :is(a,button) { flex: 1; min-height: 3.22rem; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .16rem; border: 0; padding: .18rem; border-radius: .68rem; text-decoration: none; background: transparent; color: var(--text); font-size: .71rem; font-weight: 650; }
  #mobile-nav :is([aria-current],[aria-expanded="true"]) { background: #075bb7; color: #fff; }
  .metric { padding: .72rem .54rem; gap: .47rem; }
  .metric-icon { width: 2.17rem; height: 2.17rem; border-radius: .5rem; }
  .metric strong { font-size: 1.35rem; }
  :root:not([data-theme="dark"]) .metric-blue { background: #e1f0fc; }
  :root:not([data-theme="dark"]) .metric-green { background: #e1f5e8; }
  :root:not([data-theme="dark"]) .metric-purple { background: #efe6fd; }
  :root:not([data-theme="dark"]) .metric-gold { background: #fff1ce; }
  .quick-panel { padding: 0; background: none; border: 0; box-shadow: none; }
  .quick-grid { grid-template-columns: repeat(4,minmax(0,1fr)); }
  .quick-grid a { min-height: 4.3rem; }
  .dashboard-grid { grid-template-columns: minmax(0,1fr); }
  body:not(:has(#app:not([hidden]))) main { grid-template-columns: minmax(0,1fr); gap: 1.05rem; padding: 4.3rem 1.05rem 5.5rem; max-width: 30rem; }
  .auth-lockup { flex-direction: column; gap: .65rem; text-align: center; }
  .auth-lockup img { width: 5.55rem; }
  .auth-lockup strong { max-width: none; padding: 0; border: 0; font-size: clamp(1.42rem,6vw,1.85rem); }
  body:not(:has(#app:not([hidden]))) .auth-brand { gap: .2rem; }
  body:not(:has(#app:not([hidden])))::before { bottom: -10%; left: -57%; width: 140vw; transform: rotate(35deg); background: linear-gradient(105deg,#ff7900 39%,#ff5600 40%,#ff5600 61%,transparent 62%); }
  body:not(:has(#app:not([hidden])))::after { top: -7%; right: -48%; width: 102vw; height: 10rem; transform: rotate(47deg); background: linear-gradient(90deg,#1384e2,#074d9f 64%,#62cc54 65%); }
}
@media print {
  body.printing .topbar, body.printing main > :not(#print-area) { display: none !important; }
  body.printing main { padding: 0 !important; margin: 0 !important; }
  body.printing #print-area { display: grid !important; grid-template-columns: repeat(3,1fr); gap: 4mm; color: #000; }
  .label { color: #000; background: #fff; border: 1px solid #999; padding: 3mm; text-align: center; break-inside: avoid; overflow-wrap: anywhere; }
  .label img { display: block; width: 25mm; margin: auto; }
}
.auth-field { display: flex; align-items: center; gap: .55rem; border: 1px solid var(--line); border-radius: .58rem; padding-inline: .73rem; color: var(--muted); }
.auth-field:focus-within { border-color: var(--blue); box-shadow: 0 0 0 2px color-mix(in srgb,var(--blue) 22%,transparent); }
.auth-field > input { width: 100%; padding-inline: 0; border: 0; background: transparent; outline: none; }
.password-field { display: grid; gap: .28rem; }
#password-toggle { display: grid; place-items: center; background: transparent; color: var(--muted); padding: .32rem; margin-right: -.37rem; }
#password-toggle[aria-pressed="true"] { color: var(--blue); background: var(--alt); }
