/* ============ HARDWARE LEDGER — industrial design system ============ */
:root {
  --bg: #f2efe7;
  --surface: #fffdf7;
  --surface2: #f6f2e9;
  --overlay: #fffef9;
  --ink: #1d232e;
  --ink-soft: #5d6673;
  --ink-faint: #9aa1ac;
  --line: #e2dccd;
  --line-strong: #cfc7b2;
  --char: #171c26;
  --char2: #222937;
  --char3: #2e3648;
  --amber: #f59f00;
  --amber-deep: #d9860a;
  --amber-soft: #fff1d2;
  --red: #d64541;
  --red-deep: #b8332f;
  --red-soft: #fbe7e6;
  --blue: #2f6fed;
  --blue-soft: #e7eefc;
  --green: #2f9e44;
  --green-deep: #26823a;
  --green-soft: #e4f3e8;
  --timber: #a0703c;
  --magenta: #c2255c;
  --teal: #0c8599;
  --violet: #6741d9;
  --scrim: rgba(16, 20, 28, .55);
  --shadow-sm: 0 1px 2px rgba(29, 35, 46, .07), 0 2px 8px rgba(29, 35, 46, .05);
  --shadow-md: 0 4px 14px rgba(29, 35, 46, .12), 0 1px 3px rgba(29, 35, 46, .08);
  --shadow-lg: 0 18px 50px rgba(15, 19, 27, .28);
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 16px;
  --font-display: 'Barlow Condensed', 'Arial Narrow', sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'IBM Plex Mono', 'Consolas', monospace;
  --topbar-h: 62px;
  --hazard: repeating-linear-gradient(-45deg, var(--amber) 0 14px, var(--char) 14px 28px);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  font-size: 14.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
body::before {
  content: '';
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background-image: radial-gradient(rgba(29,35,46,.045) 1px, transparent 1px);
  background-size: 22px 22px;
}
#app { position: relative; z-index: 1; }
::selection { background: var(--amber); color: var(--char); }

/* scrollbars in the artifact's own language */
* { scrollbar-width: thin; scrollbar-color: var(--amber-deep) var(--surface2); }
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: var(--surface2); border-radius: 8px; }
::-webkit-scrollbar-thumb { background: linear-gradient(180deg, var(--amber) 0%, var(--amber-deep) 100%); border-radius: 8px; border: 2px solid var(--surface2); }
::-webkit-scrollbar-thumb:hover { background: var(--char3); border-color: var(--surface2); }
::-webkit-scrollbar-corner { background: var(--surface2); }
.grid-scroll::-webkit-scrollbar-track { background: var(--char2); }
.grid-scroll::-webkit-scrollbar-thumb { border-color: var(--char2); }
.grid-scroll { scrollbar-color: var(--amber) var(--char2); }

h1, h2, h3, .display { font-family: var(--font-display); letter-spacing: .02em; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 14px; color: var(--ink); }
a { color: var(--blue); }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-soft); }
.faint { color: var(--ink-faint); }
.small { font-size: 12.5px; }
.tiny { font-size: 11.5px; }
.bold { font-weight: 700; }
.nowrap { white-space: nowrap; }

/* ============ buttons ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  background: linear-gradient(180deg, #ffb627 0%, var(--amber) 55%, var(--amber-deep) 100%);
  color: var(--char); border: 1px solid var(--amber-deep);
  font-weight: 700; font-size: 13.5px; letter-spacing: .01em;
  padding: 9px 16px; border-radius: var(--r-sm);
  box-shadow: 0 2px 0 rgba(146, 90, 4, .45), var(--shadow-sm);
  transition: transform .12s ease, box-shadow .12s ease, filter .12s ease;
  text-decoration: none; white-space: nowrap;
}
.btn:hover { filter: brightness(1.06); transform: translateY(-1px); box-shadow: 0 3px 0 rgba(146,90,4,.45), var(--shadow-md); }
.btn:active { transform: translateY(1px); box-shadow: 0 0 0 rgba(0,0,0,0); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; filter: grayscale(.3); }
.btn-dark { background: linear-gradient(180deg, var(--char3), var(--char)); color: #ffd57a; border-color: #0c0f15; box-shadow: 0 2px 0 #05070a, var(--shadow-sm); }
.btn-dark:hover { box-shadow: 0 3px 0 #05070a, var(--shadow-md); }
.btn-ghost { background: var(--surface); color: var(--ink); border: 1px solid var(--line-strong); box-shadow: var(--shadow-sm); font-weight: 600; }
.btn-ghost:hover { background: var(--surface2); }
.btn-danger { background: linear-gradient(180deg, #e35b57, var(--red) 60%, var(--red-deep)); color: #fff; border-color: var(--red-deep); box-shadow: 0 2px 0 rgba(122,29,26,.5), var(--shadow-sm); }
.btn-green { background: linear-gradient(180deg, #43b95c, var(--green) 60%, var(--green-deep)); color: #fff; border-color: var(--green-deep); box-shadow: 0 2px 0 rgba(23,94,39,.5), var(--shadow-sm); }
.btn-sm { padding: 5px 10px; font-size: 12.5px; border-radius: 5px; }
.btn-icon { padding: 7px; width: 34px; height: 34px; }
.btn-icon.btn-sm { width: 28px; height: 28px; padding: 4px; }
.btn .spin { width: 14px; height: 14px; border: 2px solid rgba(23,28,38,.3); border-top-color: var(--char); border-radius: 50%; animation: rot .7s linear infinite; }
@keyframes rot { to { transform: rotate(360deg); } }
:focus-visible { outline: 3px solid rgba(245, 159, 0, .65); outline-offset: 2px; border-radius: 4px; }

/* ============ forms ============ */
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.field label { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-soft); }
.field input, .field select, .field textarea {
  background: var(--surface); border: 1.5px solid var(--line-strong); border-radius: var(--r-sm);
  padding: 9px 12px; transition: border-color .15s, box-shadow .15s; width: 100%;
}
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--amber); box-shadow: 0 0 0 3px rgba(245,159,0,.22); }
.field .hint { font-size: 12px; color: var(--ink-soft); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-error { background: var(--red-soft); border: 1px solid #efb4b1; color: var(--red-deep); border-radius: var(--r-sm); padding: 9px 12px; font-size: 13px; font-weight: 600; margin-bottom: 12px; display: none; }
.form-error.show { display: block; animation: shake .4s ease; }
@keyframes shake { 0%,100%{transform:translateX(0)} 20%{transform:translateX(-7px)} 40%{transform:translateX(6px)} 60%{transform:translateX(-4px)} 80%{transform:translateX(3px)} }
.stepper { display: flex; align-items: stretch; gap: 0; }
.stepper input { border-radius: 0; text-align: center; font-family: var(--font-mono); font-weight: 600; }
.stepper button { width: 42px; background: var(--char); color: var(--amber); border: 1.5px solid var(--char); font-size: 18px; font-weight: 700; }
.stepper button:first-child { border-radius: var(--r-sm) 0 0 var(--r-sm); }
.stepper button:last-child { border-radius: 0 var(--r-sm) var(--r-sm) 0; }
.stepper button:hover { background: var(--char3); }
select.inline, input.inline { background: var(--surface); border: 1.5px solid var(--line-strong); border-radius: var(--r-sm); padding: 7px 10px; font-size: 13px; font-weight: 600; }
select.inline:focus, input.inline:focus { outline: none; border-color: var(--amber); box-shadow: 0 0 0 3px rgba(245,159,0,.2); }

/* ============ badges & chips ============ */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; padding: 3px 9px; border-radius: 99px; border: 1px solid transparent; }
.badge-ok { background: var(--green-soft); color: var(--green-deep); border-color: #bfe3c8; }
.badge-low { background: var(--amber-soft); color: #9a6206; border-color: #f0d493; }
.badge-out { background: var(--red-soft); color: var(--red-deep); border-color: #efb4b1; }
.badge-admin { background: var(--char); color: var(--amber); border-color: var(--char); }
.badge-member { background: var(--blue-soft); color: #1d4fb8; border-color: #c3d4f7; }
.badge-demo { background: #efe9fb; color: var(--violet); border-color: #d8c9f5; }
.badge-off { background: #eceae4; color: var(--ink-soft); border-color: var(--line-strong); }
.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 99px; padding: 4px 12px; font-size: 12.5px; font-weight: 600; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }

/* ============ cards ============ */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow-sm); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.card-head h3 { font-size: 19px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; display: flex; align-items: center; gap: 9px; }
.card-body { padding: 16px 18px; }

/* ============ boot / splash ============ */
.splash { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; background: var(--char); color: #fff; }
.splash .logo-mark { width: 74px; height: 74px; }
.splash .loadbar { width: 180px; height: 6px; border-radius: 4px; background: var(--char3); overflow: hidden; }
.splash .loadbar i { display: block; height: 100%; width: 45%; background: var(--hazard); background-size: 28px 28px; animation: slide 1.1s ease-in-out infinite; border-radius: 4px; }
@keyframes slide { 0% { transform: translateX(-110%);} 100% { transform: translateX(320%);} }

/* ============ auth screens ============ */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: minmax(380px, 46%) 1fr; }
.auth-brand {
  background: var(--char); color: #f4efe4; position: relative; overflow: hidden;
  display: flex; flex-direction: column; justify-content: center; padding: 56px 52px;
}
.auth-brand::before { content: ''; position: absolute; inset: 0; background-image: linear-gradient(rgba(255,255,255,.05) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.05) 1px, transparent 1px); background-size: 30px 30px; }
.auth-brand::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 12px; background: var(--hazard); }
.auth-brand .glow { position: absolute; width: 480px; height: 480px; border-radius: 50%; background: radial-gradient(circle, rgba(245,159,0,.22), transparent 65%); top: -140px; right: -140px; animation: drift 9s ease-in-out infinite alternate; }
@keyframes drift { from { transform: translate(0,0);} to { transform: translate(-50px, 60px);} }
.auth-brand > * { position: relative; }
.auth-brand .brandline { display: flex; align-items: center; gap: 14px; margin-bottom: 34px; }
.auth-brand .logo-mark { width: 58px; height: 58px; }
.auth-brand h1 { font-size: clamp(40px, 4.6vw, 62px); line-height: .95; font-weight: 700; text-transform: uppercase; }
.auth-brand h1 em { font-style: normal; color: var(--amber); }
.auth-brand .tag { margin-top: 14px; font-size: 15.5px; color: #c8cdd8; max-width: 420px; }
.auth-feats { margin-top: 34px; display: flex; flex-direction: column; gap: 13px; }
.auth-feats div { display: flex; gap: 11px; align-items: flex-start; font-size: 13.5px; color: #d7dbe4; }
.auth-feats svg { flex: none; margin-top: 1px; color: var(--amber); }
.auth-side { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.auth-card { width: 100%; max-width: 430px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); overflow: hidden; animation: rise .5s ease both; }
.auth-card .stripe { height: 8px; background: var(--hazard); }
.auth-card .inner { padding: 30px 32px 32px; }
.auth-card h2 { font-size: 30px; text-transform: uppercase; letter-spacing: .03em; margin-bottom: 4px; }
.auth-card .sub { color: var(--ink-soft); font-size: 13.5px; margin-bottom: 22px; }
.auth-note { margin-top: 16px; padding: 11px 13px; background: var(--blue-soft); border: 1px solid #c3d4f7; border-radius: var(--r-sm); font-size: 12.5px; color: #1d4fb8; display: flex; gap: 8px; }
.auth-note svg { flex: none; margin-top: 1px; }
@keyframes rise { from { opacity: 0; transform: translateY(18px);} to { opacity: 1; transform: translateY(0);} }

/* ============ app chrome ============ */
.topbar { position: fixed; top: 0; left: 0; right: 0; height: var(--topbar-h); background: var(--char); color: #fff; display: flex; align-items: center; gap: 14px; padding: 0 18px; z-index: 60; box-shadow: 0 2px 12px rgba(10,13,19,.35); }
.topbar::after { content: ''; position: absolute; left: 0; right: 0; bottom: -5px; height: 5px; background: var(--hazard); }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand .logo-mark { width: 36px; height: 36px; flex: none; }
.brand .bt { line-height: 1.05; min-width: 0; }
.brand .bt b { font-family: var(--font-display); font-size: 19px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
.brand .bt span { font-size: 10px; letter-spacing: .22em; text-transform: uppercase; color: var(--amber); font-weight: 700; }
.mainnav { display: flex; gap: 4px; margin-left: 10px; flex: 1; }
.mainnav button { display: flex; align-items: center; gap: 7px; background: transparent; border: none; color: #b9c0cd; font-weight: 600; font-size: 13.5px; padding: 8px 13px; border-radius: 7px; transition: background .15s, color .15s; }
.mainnav button:hover { background: var(--char2); color: #fff; }
.mainnav button.active { background: var(--amber); color: var(--char); font-weight: 800; box-shadow: inset 0 -2px 0 rgba(0,0,0,.25); }
.top-right { display: flex; align-items: center; gap: 9px; margin-left: auto; }
.bellbtn { position: relative; background: var(--char2); border: 1px solid var(--char3); color: #e8ebf1; width: 38px; height: 38px; border-radius: 9px; display: flex; align-items: center; justify-content: center; }
.bellbtn:hover { background: var(--char3); }
.bellbtn .bcount { position: absolute; top: -6px; right: -6px; background: var(--red); color: #fff; font-size: 10.5px; font-weight: 800; min-width: 19px; height: 19px; border-radius: 99px; display: flex; align-items: center; justify-content: center; padding: 0 5px; border: 2px solid var(--char); }
.bellbtn.pulse { animation: bellpulse 1s ease 3; }
@keyframes bellpulse { 0%,100% { box-shadow: 0 0 0 0 rgba(214,69,65,.6);} 50% { box-shadow: 0 0 0 9px rgba(214,69,65,0);} }
.userchip { display: flex; align-items: center; gap: 9px; background: var(--char2); border: 1px solid var(--char3); border-radius: 9px; padding: 5px 11px 5px 6px; }
.userchip .av { width: 28px; height: 28px; border-radius: 7px; background: linear-gradient(135deg, var(--amber), var(--timber)); color: var(--char); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 12.5px; flex: none; }
.userchip .un { line-height: 1.1; }
.userchip .un b { font-size: 12.5px; display: block; max-width: 130px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.userchip .un span { font-size: 10px; text-transform: uppercase; letter-spacing: .1em; color: var(--amber); font-weight: 700; }
.logoutbtn { background: transparent; border: 1px solid var(--char3); color: #b9c0cd; width: 38px; height: 38px; border-radius: 9px; display: flex; align-items: center; justify-content: center; }
.logoutbtn:hover { color: #ff9b97; border-color: var(--red); background: rgba(214,69,65,.12); }
.page { max-width: 1460px; margin: 0 auto; padding: calc(var(--topbar-h) + 26px) 22px 60px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h2 { font-size: 34px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; line-height: 1; display: flex; align-items: center; gap: 11px; }
.page-head h2 svg { color: var(--amber-deep); }
.page-head .ph-sub { color: var(--ink-soft); font-size: 13px; margin-top: 5px; }
.head-actions { display: flex; gap: 9px; flex-wrap: wrap; align-items: center; }

.bottomnav { display: none; }
.reveal { animation: rise .45s ease both; }
.reveal-1 { animation-delay: .05s; } .reveal-2 { animation-delay: .12s; } .reveal-3 { animation-delay: .19s; } .reveal-4 { animation-delay: .26s; } .reveal-5 { animation-delay: .33s; }

/* ============ toolbar ============ */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .grow { flex: 1; }
.searchbox { position: relative; min-width: 200px; }
.searchbox svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--ink-faint); pointer-events: none; }
.searchbox input { padding-left: 34px; width: 100%; }
.seg { display: inline-flex; background: var(--char); border-radius: 8px; padding: 3px; gap: 3px; }
.seg button { border: none; background: transparent; color: #b9c0cd; font-weight: 700; font-size: 12.5px; padding: 6px 14px; border-radius: 6px; letter-spacing: .03em; }
.seg button.active { background: var(--amber); color: var(--char); }

/* ============ THE GRID (Excel-style sales book) ============ */
.grid-card { border-radius: var(--r-md); overflow: hidden; border: 1px solid var(--char3); box-shadow: var(--shadow-md); }
.grid-scroll { overflow: auto; max-height: min(66vh, 720px); background: var(--surface); position: relative; }
table.book { border-collapse: separate; border-spacing: 0; width: max-content; min-width: 100%; }
table.book th, table.book td { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 0; }
table.book thead th { position: sticky; top: 0; z-index: 5; background: var(--char); color: #fff; vertical-align: bottom; }
table.book thead th .ph { padding: 9px 10px 8px; min-width: 128px; max-width: 160px; }
table.book thead th .pname { font-family: var(--font-display); font-size: 15.5px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; line-height: 1.1; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
table.book thead th .pmeta { font-size: 10.5px; color: #98a1b3; margin-top: 3px; font-family: var(--font-mono); }
table.book thead th .pstock { display: inline-flex; align-items: center; gap: 4px; margin-top: 5px; font-size: 10.5px; font-weight: 700; padding: 2px 7px; border-radius: 99px; background: var(--char3); color: #cfd5e0; }
table.book thead th .pstock.low { background: rgba(245,159,0,.2); color: #ffc94d; }
table.book thead th .pstock.out { background: rgba(214,69,65,.25); color: #ff9b97; }
table.book .corner { left: 0; z-index: 8 !important; min-width: 118px; background: var(--char) !important; }
table.book .corner .ph { min-width: 118px; display: flex; flex-direction: column; gap: 2px; justify-content: flex-end; }
table.book .corner b { font-family: var(--font-display); font-size: 16px; text-transform: uppercase; letter-spacing: .05em; color: var(--amber); }
table.book .corner span { font-size: 10.5px; color: #98a1b3; }
table.book tbody th.daycell { position: sticky; left: 0; z-index: 4; background: var(--surface2); text-align: left; padding: 7px 12px; min-width: 118px; border-right: 2px solid var(--line-strong); }
table.book tbody th.daycell .dow { font-family: var(--font-display); font-weight: 700; font-size: 16px; text-transform: uppercase; letter-spacing: .04em; line-height: 1; }
table.book tbody th.daycell .dnum { font-size: 11.5px; color: var(--ink-soft); font-family: var(--font-mono); }
table.book tbody tr.today th.daycell { background: var(--amber-soft); box-shadow: inset 3px 0 0 var(--amber); }
table.book tbody tr.today th.daycell .dow::after { content: 'TODAY'; font-size: 8.5px; background: var(--amber); color: var(--char); border-radius: 3px; padding: 1px 4px; margin-left: 6px; vertical-align: 2px; letter-spacing: .08em; }
table.book td.cell { text-align: right; font-family: var(--font-mono); font-size: 13px; font-weight: 500; padding: 8px 11px; min-width: 128px; cursor: pointer; transition: box-shadow .1s; position: relative; }
table.book td.cell:hover { box-shadow: inset 0 0 0 2px var(--amber); z-index: 2; }
table.book td.cell .zero { color: #c9c4b4; }
table.book td.cell .cval { position: relative; z-index: 1; }
table.book td.rowtot { text-align: right; font-family: var(--font-mono); font-weight: 600; font-size: 13px; padding: 8px 12px; background: var(--surface2); border-left: 2px solid var(--line-strong); min-width: 110px; position: sticky; right: 0; z-index: 3; }
table.book thead th.rowtot-h { position: sticky; right: 0; z-index: 7 !important; background: var(--char2) !important; }
table.book thead th.rowtot-h .ph { min-width: 110px; }
table.book tfoot th, table.book tfoot td { position: sticky; bottom: 0; z-index: 6; background: var(--char); color: #ffd57a; font-family: var(--font-mono); font-weight: 600; font-size: 13px; padding: 9px 11px; text-align: right; border-top: 2px solid var(--amber); }
table.book tfoot th { left: 0; z-index: 7; text-align: left; font-family: var(--font-display); font-size: 15px; letter-spacing: .08em; color: var(--amber); text-transform: uppercase; background: var(--char); }
table.book tfoot td.grand { background: var(--amber); color: var(--char); font-weight: 700; right: 0; z-index: 7; }
.grid-legend { display: flex; align-items: center; gap: 14px; padding: 9px 14px; background: var(--char2); color: #98a1b3; font-size: 11.5px; flex-wrap: wrap; }
.grid-legend .heat { display: inline-flex; align-items: center; gap: 5px; }
.grid-legend .heat i { width: 13px; height: 13px; border-radius: 3px; display: inline-block; }
.grid-empty { padding: 40px; text-align: center; color: var(--ink-soft); }

/* ============ dashboard ============ */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 16px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 16px 18px 14px; position: relative; overflow: hidden; box-shadow: var(--shadow-sm); }
.kpi::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 4px; background: var(--kc, var(--amber)); }
.kpi .kl { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; color: var(--ink-soft); display: flex; align-items: center; gap: 7px; }
.kpi .kl svg { color: var(--kc, var(--amber-deep)); }
.kpi .kv { font-family: var(--font-display); font-size: 34px; font-weight: 700; line-height: 1.1; margin-top: 7px; letter-spacing: .01em; }
.kpi .kv small { font-size: 17px; color: var(--ink-soft); font-weight: 600; }
.kpi .ks { font-size: 12px; color: var(--ink-soft); margin-top: 3px; }
.kpi.alert-kpi { background: linear-gradient(135deg, #fff6f5, var(--surface)); }
.dash-grid { display: grid; grid-template-columns: 1.35fr 1fr; gap: 14px; align-items: start; }
.dash-col { display: flex; flex-direction: column; gap: 14px; }
.alertlist { display: flex; flex-direction: column; }
.alertrow { display: flex; align-items: center; gap: 12px; padding: 11px 18px; border-bottom: 1px solid var(--line); }
.alertrow:last-child { border-bottom: none; }
.alertrow .ai { width: 34px; height: 34px; border-radius: 8px; display: flex; align-items: center; justify-content: center; flex: none; }
.alertrow .ai.low { background: var(--amber-soft); color: var(--amber-deep); }
.alertrow .ai.out { background: var(--red-soft); color: var(--red); }
.alertrow .at { flex: 1; min-width: 0; }
.alertrow .at b { display: block; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.alertrow .at span { font-size: 12px; color: var(--ink-soft); }
.bars { display: flex; flex-direction: column; gap: 11px; }
.bar-row { display: grid; grid-template-columns: 26px 1fr auto; gap: 10px; align-items: center; }
.bar-row .rank { width: 24px; height: 24px; border-radius: 6px; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 12px; background: var(--surface2); color: var(--ink-soft); border: 1px solid var(--line); }
.bar-row.r1 .rank { background: var(--amber); color: var(--char); border-color: var(--amber-deep); }
.bar-row.r2 .rank { background: #d8dde6; color: var(--char); border-color: #b9c0cd; }
.bar-row.r3 .rank { background: #e5c9a8; color: #6b4a1f; border-color: #cfa878; }
.bar-row .bl { min-width: 0; }
.bar-row .bl b { font-size: 13px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-row .track { height: 9px; background: var(--surface2); border-radius: 5px; margin-top: 4px; overflow: hidden; border: 1px solid var(--line); }
.bar-row .fill { height: 100%; border-radius: 5px; transform-origin: left; animation: grow .8s cubic-bezier(.2,.8,.2,1) both; }
@keyframes grow { from { transform: scaleX(0);} to { transform: scaleX(1);} }
.bar-row .bv { text-align: right; font-family: var(--font-mono); font-size: 12.5px; font-weight: 600; }
.bar-row .bv span { display: block; font-size: 11px; color: var(--ink-soft); font-weight: 500; }
.trend-svg { width: 100%; height: auto; display: block; }
.trend-svg .tbar { animation: growY .7s cubic-bezier(.2,.8,.2,1) both; transform-origin: bottom; transform-box: fill-box; }
@keyframes growY { from { transform: scaleY(0);} to { transform: scaleY(1);} }
.donut-wrap { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.donut-legend { display: flex; flex-direction: column; gap: 7px; flex: 1; min-width: 170px; }
.donut-legend .dl { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.donut-legend .dl b { margin-left: auto; font-family: var(--font-mono); font-size: 12px; }
.activity { display: flex; flex-direction: column; }
.actrow { display: flex; align-items: center; gap: 11px; padding: 9px 18px; border-bottom: 1px solid var(--line); font-size: 13px; }
.actrow:last-child { border: none; }
.actrow .dot { width: 9px; height: 9px; }
.actrow .at { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.actrow .av { font-family: var(--font-mono); font-weight: 600; font-size: 12.5px; }

/* ============ data tables (stock / log / admin) ============ */
.table-wrap { overflow: auto; border-radius: var(--r-md); border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow-sm); max-height: 70vh; }
table.data { border-collapse: separate; border-spacing: 0; width: 100%; min-width: 640px; }
table.data thead th { position: sticky; top: 0; z-index: 3; background: var(--char); color: #d7dbe4; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .09em; text-align: left; padding: 11px 14px; white-space: nowrap; }
table.data tbody td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data tbody tr { transition: background .12s; }
table.data tbody tr:hover { background: var(--amber-soft); }
table.data tbody tr:last-child td { border-bottom: none; }
table.data .num { text-align: right; font-family: var(--font-mono); font-size: 13px; }
table.data th.num { text-align: right; }
table.data .pname b { font-size: 13.5px; }
table.data .pname span { display: block; font-size: 11.5px; color: var(--ink-soft); }
.stockbar { width: 110px; height: 7px; background: var(--surface2); border: 1px solid var(--line); border-radius: 5px; overflow: hidden; margin-top: 4px; }
.stockbar i { display: block; height: 100%; border-radius: 4px; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.empty-state { padding: 46px 20px; text-align: center; color: var(--ink-soft); }
.empty-state svg { color: var(--line-strong); margin-bottom: 10px; }
.empty-state b { display: block; font-family: var(--font-display); font-size: 21px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink); margin-bottom: 4px; }

/* ============ admin tabs ============ */
.tabs { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.tabs button { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1.5px solid var(--line-strong); color: var(--ink-soft); font-weight: 700; font-size: 13px; padding: 9px 16px; border-radius: 8px; }
.tabs button.active { background: var(--char); border-color: var(--char); color: var(--amber); }
.tabs button:hover:not(.active) { border-color: var(--amber); color: var(--ink); }
.member-av { width: 34px; height: 34px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 13px; color: #fff; flex: none; }
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }

/* ============ drawer ============ */
.scrim { position: fixed; inset: 0; background: var(--scrim); backdrop-filter: blur(2px); z-index: 90; animation: fade .2s ease both; }
@keyframes fade { from { opacity: 0;} to { opacity: 1;} }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(420px, 94vw); background: var(--overlay); z-index: 95; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; animation: slidein .28s cubic-bezier(.2,.8,.2,1) both; }
@keyframes slidein { from { transform: translateX(60px); opacity: 0;} to { transform: translateX(0); opacity: 1;} }
.drawer-head { background: var(--char); color: #fff; padding: 16px 20px 14px; position: relative; }
.drawer-head::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: var(--hazard); }
.drawer-head .dh-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.drawer-head h3 { font-size: 23px; text-transform: uppercase; letter-spacing: .03em; line-height: 1.1; }
.drawer-head .dh-sub { color: #98a1b3; font-size: 12.5px; margin-top: 3px; }
.drawer-close { background: var(--char2); border: 1px solid var(--char3); color: #d7dbe4; width: 32px; height: 32px; border-radius: 8px; display: flex; align-items: center; justify-content: center; flex: none; }
.drawer-close:hover { color: #fff; background: var(--char3); }
.drawer-body { flex: 1; overflow-y: auto; padding: 16px 20px 24px; }
.drawer-section { margin-bottom: 18px; }
.drawer-section h4 { font-size: 11.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; color: var(--ink-soft); margin-bottom: 9px; display: flex; align-items: center; gap: 7px; }
.saleitem { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px; margin-bottom: 8px; }
.saleitem .sq { font-family: var(--font-mono); font-weight: 600; font-size: 13.5px; }
.saleitem .sm { flex: 1; min-width: 0; font-size: 12px; color: var(--ink-soft); }
.saleitem .sv { font-family: var(--font-mono); font-weight: 600; font-size: 13px; }
.daytotal { display: flex; justify-content: space-between; align-items: center; background: var(--char); color: #ffd57a; border-radius: 8px; padding: 10px 14px; font-weight: 700; margin-bottom: 14px; }
.daytotal .mono { font-size: 15px; }

/* ============ modal ============ */
.modal { position: fixed; inset: 0; z-index: 95; display: flex; align-items: center; justify-content: center; padding: 20px; pointer-events: none; }
.modal-card { pointer-events: auto; width: 100%; max-width: 480px; max-height: calc(100vh - 40px); overflow-y: auto; background: var(--overlay); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); animation: pop .25s cubic-bezier(.2,.8,.2,1) both; }
@keyframes pop { from { transform: scale(.94) translateY(12px); opacity: 0;} to { transform: scale(1) translateY(0); opacity: 1;} }
.modal-head { padding: 18px 24px 14px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 10px; position: sticky; top: 0; background: var(--overlay); z-index: 2; }
.modal-head h3 { font-size: 24px; text-transform: uppercase; letter-spacing: .03em; display: flex; align-items: center; gap: 10px; }
.modal-head h3 svg { color: var(--amber-deep); }
.modal-body { padding: 20px 24px 24px; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }
.total-preview { background: var(--char); color: #fff; border-radius: 8px; padding: 12px 16px; display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.total-preview .mono { color: #ffd57a; font-size: 18px; font-weight: 600; }
.stock-hint { font-size: 12.5px; margin: -6px 0 12px; display: flex; align-items: center; gap: 6px; }
.stock-hint.bad { color: var(--red-deep); font-weight: 700; }
.stock-hint.good { color: var(--green-deep); }

/* ============ bell dropdown ============ */
.belldrop { position: fixed; top: calc(var(--topbar-h) + 10px); right: 16px; width: min(370px, calc(100vw - 32px)); background: var(--overlay); border-radius: var(--r-md); box-shadow: var(--shadow-lg); border: 1px solid var(--line); z-index: 80; animation: pop .2s ease both; overflow: hidden; }
.belldrop .bd-head { background: var(--char); color: #fff; padding: 12px 16px; display: flex; justify-content: space-between; align-items: center; }
.belldrop .bd-head b { font-family: var(--font-display); font-size: 18px; text-transform: uppercase; letter-spacing: .05em; }
.belldrop .bd-list { max-height: 340px; overflow-y: auto; }

/* ============ toasts ============ */
#toasts { position: fixed; bottom: 20px; right: 20px; z-index: 120; display: flex; flex-direction: column; gap: 9px; max-width: min(390px, calc(100vw - 40px)); }
.toast { background: var(--char); color: #f0f2f6; border-radius: 10px; padding: 12px 15px; display: flex; align-items: center; gap: 11px; box-shadow: var(--shadow-lg); border-left: 5px solid var(--amber); animation: toastin .3s cubic-bezier(.2,.8,.2,1) both; font-size: 13.5px; }
.toast.success { border-left-color: var(--green); }
.toast.error { border-left-color: var(--red); }
.toast.warn { border-left-color: var(--amber); }
.toast.info { border-left-color: var(--blue); }
.toast svg { flex: none; }
.toast.success svg { color: #6fce83; }
.toast.error svg { color: #ff9b97; }
.toast.warn svg { color: #ffc94d; }
.toast.info svg { color: #8fb3f7; }
.toast .tmsg { flex: 1; }
.toast .tundo { background: var(--amber); color: var(--char); border: none; font-weight: 800; font-size: 12px; padding: 5px 11px; border-radius: 6px; letter-spacing: .04em; }
.toast .tundo:hover { filter: brightness(1.1); }
.toast.out { animation: toastout .25s ease both; }
@keyframes toastin { from { transform: translateX(40px); opacity: 0;} to { transform: translateX(0); opacity: 1;} }
@keyframes toastout { to { transform: translateX(50px); opacity: 0;} }

/* ============ misc ============ */
.iconbtn-plain { background: none; border: none; color: var(--ink-faint); padding: 4px; border-radius: 5px; display: inline-flex; }
.iconbtn-plain:hover { color: var(--red); background: var(--red-soft); }
.divider { height: 1px; background: var(--line); margin: 16px 0; }
.statline { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.syncdot { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; color: #98a1b3; }
.syncdot i { width: 7px; height: 7px; border-radius: 50%; background: var(--green); animation: blink 2.4s ease infinite; }
@keyframes blink { 0%,100% { opacity: 1;} 50% { opacity: .35;} }
.offline-banner { background: var(--red); color: #fff; text-align: center; font-size: 12.5px; font-weight: 700; padding: 6px; position: fixed; top: var(--topbar-h); left: 0; right: 0; z-index: 59; }

/* ============ responsive ============ */
@media (max-width: 1150px) {
  .mainnav button { padding: 8px 9px; font-size: 12.5px; gap: 5px; }
  .brand .bt b { max-width: 140px; }
  .userchip .un b { max-width: 90px; }
  .syncdot { display: none; }
}
@media (max-width: 980px) {
  .mainnav button svg { display: none; }
  .mainnav { margin-left: 4px; }
  .topbar { gap: 8px; padding: 0 12px; }
}
@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .dash-grid { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-brand { padding: 36px 28px 42px; min-height: auto; }
  .auth-brand h1 { font-size: 38px; }
  .auth-feats { display: none; }
  .auth-brand .tag { font-size: 13.5px; }
}
@media (max-width: 860px) {
  .mainnav { display: none; }
  .brand .bt b { max-width: 150px; font-size: 17px; }
  .userchip .un { display: none; }
  .userchip { padding: 5px; }
  .page { padding: calc(var(--topbar-h) + 20px) 12px calc(84px + env(safe-area-inset-bottom)); }
  .page-head h2 { font-size: 27px; }
  .bottomnav { display: flex; position: fixed; bottom: 0; left: 0; right: 0; background: var(--char); z-index: 60; padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); box-shadow: 0 -3px 14px rgba(10,13,19,.35); border-top: 3px solid var(--amber); }
  .bottomnav button { flex: 1; background: none; border: none; color: #98a1b3; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 10px; font-weight: 700; padding: 6px 2px; border-radius: 8px; letter-spacing: .03em; }
  .bottomnav button.active { color: var(--amber); background: var(--char2); }
  .bottomnav button.active svg { filter: drop-shadow(0 0 6px rgba(245,159,0,.5)); }
  #toasts { bottom: calc(80px + env(safe-area-inset-bottom)); right: 12px; }
  .kpis { gap: 10px; }
  .kpi .kv { font-size: 27px; }
  .grid-scroll { max-height: 60vh; }
  .field-row { grid-template-columns: 1fr; gap: 0; }
  .modal { padding: 12px; align-items: flex-end; }
  .modal-card { max-height: calc(100vh - 24px); border-radius: var(--r-lg) var(--r-lg) 0 0; }
  .toolbar { gap: 8px; }
  .searchbox { min-width: 140px; flex: 1; }
  table.book td.cell, table.book thead th .ph { min-width: 108px; }
}
@media (max-width: 480px) {
  .kpis { grid-template-columns: 1fr 1fr; }
  .kpi { padding: 12px 13px 11px; }
  .kpi .kv { font-size: 22px; }
  .kpi .ks { font-size: 11px; }
  .head-actions .btn { padding: 8px 12px; font-size: 12.5px; }
  .brand .bt span { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}