:root{color-scheme:dark;--bg:#000;--panel:#191815;--edge:#373024;--ink:#f7f1e5;--muted:#b6ad9d;--accent:#e8b85d;--gold:#e8b85d;--green:#8ed7b3;font:15px system-ui,sans-serif}*{box-sizing:border-box}body{margin:0;background:var(--bg);color:var(--ink)}button,input,select{font:inherit}button{cursor:pointer;color:inherit;border:1px solid var(--edge);background:#24211a;border-radius:9px;padding:10px 14px}button:hover{border-color:var(--accent)}button:disabled{opacity:.45;cursor:not-allowed}button:focus-visible,input:focus-visible,select:focus-visible{outline:2px solid var(--accent);outline-offset:2px}.shell{min-height:100vh;display:grid;grid-template-columns:236px minmax(0,1fr)}.sidebar{background:var(--bg);border-right:1px solid var(--edge);display:flex;flex-direction:column;padding:28px 17px;position:sticky;top:0;height:100vh}.brand,.sidebar-footer{display:flex;align-items:center;gap:12px;font-weight:700}.brand{padding:0 5px;font:22px Georgia,serif}.brand small,.sidebar-footer small{display:block;color:var(--muted);font:11px system-ui;margin-top:4px;letter-spacing:.08em}.avatar{display:grid;place-items:center;background:#352915;border:1px solid #695025;color:#f3ce83;width:43px;height:43px;flex:none;border-radius:12px}.avatar{font-size:12px;border-radius:50%}.sidebar nav{display:grid;gap:5px;margin-top:42px}.nav-label{color:var(--muted);font-size:10px;letter-spacing:.15em;margin:13px 12px 5px}.sidebar button{text-align:left;background:none;border-color:transparent;color:var(--muted);padding:11px 10px}.sidebar button.active{background:#332917;color:#ffdb91;border-color:#624a23}.sidebar i{display:inline-block;width:24px;font-style:normal;color:#e8b85d}.sidebar-footer{margin-top:auto;border-top:1px solid var(--edge);padding-top:18px;font-size:13px}header{height:70px;border-bottom:1px solid var(--edge);display:flex;justify-content:space-between;align-items:center;padding:0 32px;color:var(--muted);gap:10px}header b{margin:0 8px;color:#82765e}header strong{color:var(--ink)}#header-actions,.actions{display:flex;gap:8px;align-items:center;flex-wrap:wrap}.primary{background:var(--gold);border-color:#efc573;color:#1d1508;font-weight:700}.primary:hover{background:#ffd389}main{max-width:1500px;margin:auto;padding:28px 32px 48px}.hero{display:flex;justify-content:space-between;align-items:center;gap:16px;padding:28px;border:1px solid #584323;border-radius:16px;background:radial-gradient(ellipse at 100% 10%,#503b1b 0%,transparent 66%),linear-gradient(115deg,#262015,#1b1812);margin-bottom:22px}.eyebrow{color:#e8b85d;letter-spacing:.15em;font-size:10px;font-weight:700}h1{font:clamp(32px,4vw,48px) Georgia,serif;margin:7px 0}h2{font-size:17px;margin:0 0 8px}p{margin:5px 0;color:var(--muted)}.hero p{color:#d4c5a9}.kpis{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:14px;margin-bottom:18px}.panel{background:var(--panel);border:1px solid var(--edge);border-radius:14px;padding:18px;min-width:0}.metric-icon{display:inline-grid;place-items:center;width:34px;height:34px;border-radius:9px;background:#352916;color:var(--accent);margin-bottom:12px}.metric strong{display:block;font-size:clamp(19px,2.2vw,29px);margin:5px 0;color:#fff}.muted,small{color:var(--muted)}.metric small{font-size:12px}.split{display:grid;grid-template-columns:1.8fr 1fr;gap:16px;margin-bottom:16px}.stack{display:grid;gap:16px}.section-head{display:flex;justify-content:space-between;align-items:center;gap:12px;margin-bottom:12px;flex-wrap:wrap}.section-head h2{margin:0}.pill{display:inline-block;padding:5px 9px;border-radius:20px;background:#352916;color:#f3ce83;font-size:12px;white-space:nowrap}.good{color:var(--green);background:#20342e}.warn{color:#efc594;background:#382b24}.row{display:flex;justify-content:space-between;align-items:center;gap:10px;padding:11px 0;border-bottom:1px solid var(--edge)}.row:last-child{border-bottom:0}.row strong,.row small{display:block}.row small{margin-top:3px}canvas{display:block;width:100%;height:218px;margin-top:12px}.table-wrap{overflow:auto}table{width:100%;border-collapse:collapse;text-align:left;white-space:nowrap}th,td{padding:12px 10px;border-bottom:1px solid var(--edge)}th{color:var(--muted);font-size:12px;font-weight:600}tbody tr:last-child td{border-bottom:0}td button{padding:6px 9px}input,select{background:#141310;color:var(--ink);border:1px solid #49402f;border-radius:8px;padding:10px 12px;width:100%;min-width:0}label{display:grid;gap:6px;color:var(--muted);font-size:13px}.field-grid{display:grid;grid-template-columns:1fr 1fr;gap:12px}.filters{display:flex;gap:8px;flex-wrap:wrap}.filters>*{width:auto;max-width:100%}.page-title{margin-bottom:20px}.cards{display:grid;grid-template-columns:repeat(auto-fit,minmax(155px,1fr));gap:10px;margin-top:12px}.product-card{text-align:left;background:#241f16}.product-card strong,.product-card small{display:block;margin:4px 0}.cart-qty{width:68px;padding:5px}.total{font-size:24px;color:#fff}.empty{padding:18px 0}.subheading{margin-top:20px}dialog{background:#201d17;color:var(--ink);border:1px solid #725729;border-radius:15px;width:min(480px,calc(100% - 28px));padding:23px}dialog::backdrop{background:#000a}dialog footer{display:flex;justify-content:flex-end;gap:8px;margin-top:16px}#form-error{color:#ff9eaf}#toast{position:fixed;bottom:18px;right:18px;background:#33291a;border:1px solid #725729;border-radius:10px;padding:12px;max-width:min(390px,90vw);z-index:3}#toast:empty{display:none}@media(max-width:920px){.shell{grid-template-columns:182px minmax(0,1fr)}.sidebar{padding-inline:10px}main,header{padding-inline:18px}.kpis{grid-template-columns:repeat(2,1fr)}.split{grid-template-columns:1fr}}@media(max-width:620px){.shell{display:block}.sidebar{position:static;height:auto;padding:12px}.sidebar nav{display:flex;overflow:auto;margin-top:10px}.sidebar nav button{white-space:nowrap}.brand{font-size:19px}.nav-label,.sidebar-footer{display:none}header{height:auto;min-height:60px;padding-block:7px}.hero{align-items:flex-start;flex-direction:column;padding:18px}main{padding-inline:12px}.kpis{gap:8px}.panel{padding:12px}.field-grid{grid-template-columns:1fr}}

/* Visual hierarchy for operational screens */
:root {
  --bg: #000;
  --panel: #191815;
  --edge: #373024;
  --gold: #e8b85d;
}
.sidebar button {
  display: flex;
  align-items: center;
  gap: 8px;
}
.sidebar i { width: 19px; flex: 0 0 19px; }
.sidebar button:hover { background: #262117; color: var(--ink); }
.brand { padding: 0; justify-content: center; }
.brand img { display: block; width: 100%; max-width: 200px; height: 126px; object-fit: cover; border-radius: 10px; }
.sidebar nav { margin-top: 18px; overflow: auto; }
header { background: var(--bg); }
.hero {
  background:
    radial-gradient(ellipse at 92% 10%, #503b1b 0%, transparent 65%),
    linear-gradient(118deg, #2b2416, #1b1812);
  min-height: 155px;
}
.panel { box-shadow: 0 8px 22px #08060926; }
.metric { background: linear-gradient(155deg, #231f17, var(--panel) 66%); }
.metric strong { font-variant-numeric: tabular-nums; }
.metric-icon { border: 1px solid #5c4522; }
th { background: #242018; }
td { font-variant-numeric: tabular-nums; }
tbody tr:hover { background: #231f17; }
.search-line { margin-bottom: 12px; }
.payment-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
}
.payment-summary .row {
  border: 1px solid var(--edge);
  background: #231f17;
  border-radius: 10px;
  padding: 12px;
}
.receipt-actions { margin-top: 14px; }
.print-brand { display: none; }
#dialog-content > label { margin-top: 12px; }
#change { color: var(--green); }
@media (max-width: 620px) {
  .sidebar button { flex: none; }
  .brand { justify-content: flex-start; }
  .brand img { max-width: 120px; height: 78px; }
  .sidebar nav { margin-top: 10px; }
  .hero { min-height: auto; }
}
@media print {
  body:has(#dialog[open] .receipt) .shell,
  body:has(#dialog[open] .receipt) #toast,
  body:has(#dialog[open] .receipt) #dialog-content > h2,
  body:has(#dialog[open] .receipt) #dialog footer,
  body:has(#dialog[open] .receipt) .receipt-actions,
  body:has(#dialog[open] .receipt) #form-error { display: none; }
  body:has(#dialog[open] .receipt) {
    color-scheme: light;
    background: #fff;
    color: #000;
  }
  body:has(#dialog[open] .receipt) #dialog {
    position: static;
    width: min(100%, 440px);
    max-width: none;
    max-height: none;
    margin: 0 auto;
    padding: 0;
    border: 0;
    overflow: visible;
    background: #fff;
    color: #000;
  }
  #dialog::backdrop { background: transparent; }
  .receipt .row { border-color: #ccc; break-inside: avoid; }
  .receipt .pill, .receipt small, .receipt p { background: transparent; color: #222; }
  .print-brand { display: block; padding-bottom: 10px; }
}
.panel-spacing { margin-bottom: 16px; }
#dialog-content > p + .field-grid { margin-top: 14px; }
@media (max-height: 760px) and (min-width: 621px) {
  .sidebar nav { margin-top: 24px; overflow: auto; }
}
.wide-dialog { width: min(820px, calc(100% - 28px)); }
.purchase-fields { display: grid; gap: 8px; margin: 12px 0; }
.purchase-line, .installment-line {
  display: grid;
  grid-template-columns: 2fr .8fr 1.15fr auto;
  align-items: end;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--edge);
  border-radius: 9px;
}
.installment-line { grid-template-columns: auto .9fr 1fr 1fr; }
.installment-line strong { align-self: center; }
.purchase-terms { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 620px) {
  .purchase-line, .installment-line, .purchase-terms { grid-template-columns: 1fr 1fr; }
}
.stock-alert-button { border-color: #74563d; background: #30241f; color: #f5cd9d; }
.danger { background: #46232e; color: #ffb6c8; }
.stock-filters { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; margin-bottom: 12px; }
.stock-filters .search-line { flex: 1 1 220px; margin: 0; }
.stock-filters > label { flex: 0 1 205px; }
.scanner-field { margin-bottom: 12px; }
.scanner-field input { border-color: #8c6b34; }
header { height: auto; min-height: 70px; padding-block: 10px; }
#header-actions { justify-content: flex-end; }
#header-actions button { white-space: nowrap; }
@media (max-width: 620px) {
  header { min-height: 60px; }
}

@media (min-width: 621px) and (max-height: 850px) {
  .sidebar { padding-block: 12px; }
  .brand img { max-width: 160px; height: 100px; }
  .sidebar nav { margin-top: 10px; gap: 2px; }
  .sidebar button { padding: 6px 8px; font-size: 13px; }
  .nav-label { margin: 8px 8px 3px; }
  .sidebar-footer { padding-top: 9px; }
  header { min-height: 54px; padding-block: 6px; }
  header > span { min-width: max-content; }
  #header-actions button { padding: 6px 8px; font-size: 13px; }
  .dashboard-view { padding-block: 10px 8px; }
  .dashboard-view .hero { min-height: 0; padding: 12px 16px; margin-bottom: 8px; }
  .dashboard-view h1 { font-size: 31px; margin: 2px 0; }
  .dashboard-view .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin-bottom: 8px; }
  .dashboard-view .panel { padding: 9px; }
  .dashboard-view .metric-icon { width: 24px; height: 24px; margin-bottom: 1px; }
  .dashboard-view .metric p, .dashboard-view .metric small { font-size: 11px; line-height: 1.2; }
  .dashboard-view .metric strong { font-size: clamp(14px, 2.1vw, 25px); }
  .dashboard-view .split { grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); gap: 7px; margin-bottom: 8px; }
  .dashboard-view .section-head { margin-bottom: 5px; gap: 4px; }
  .dashboard-view .section-head h2 { font-size: 14px; }
  .dashboard-view .section-head button { font-size: 11px; padding: 4px 7px; }
  .dashboard-view canvas { height: 110px; margin-top: 4px; }
  .dashboard-view .row { padding: 4px 0; font-size: 11px; }
  .dashboard-view .row small { font-size: 10px; }
  .dashboard-view .row .pill { font-size: 10px; padding: 2px 5px; }
  .dashboard-view .split .panel:nth-child(2) .row:nth-of-type(n+5) { display: none; }
  .dashboard-payables { margin-bottom: 8px; }
  .dashboard-sales th, .dashboard-sales td { padding: 4px; font-size: 11px; white-space: normal; }
  .dashboard-sales td button, .dashboard-sales .pill { padding: 3px 5px; font-size: 10px; }
}
.dashboard-bottom { display: grid; gap: 8px; }
@media (min-width: 621px) {
  .dashboard-bottom.has-payables { grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); }
}
@media (min-width: 621px) and (max-height: 850px) {
  .dashboard-payables { margin-bottom: 0; }
  .dashboard-sales .row button { padding: 3px 5px; font-size: 10px; }
  .dashboard-view .row > div { min-width: 0; }
}
[hidden] { display: none !important; }
.auth-view {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  background: radial-gradient(ellipse at 50% 22%, #392a16, var(--bg) 65%);
  padding: 16px;
}
.auth-card { background: var(--bg); display: grid; width: min(100%, 390px); gap: 15px; padding: 24px; }
.auth-card img { width: min(200px, 100%); height: 136px; object-fit: cover; border-radius: 10px; justify-self: center; }
.auth-card h1 { margin: 0; font-size: 31px; }
#auth-error { margin: 0; color: #ffb6c8; }
#auth-error:empty { display: none; }
.pack-card { padding: 10px; border: 1px solid var(--edge); border-radius: 9px; }
.pack-options { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.pack-options button { padding: 5px 7px; font-size: 12px; }

/* Feather the PNG edges into the matching black surface. */
.brand img, .auth-card img {
  border-radius: 0;
  mask-image:
    linear-gradient(to right, transparent, #000 5px, #000 calc(100% - 5px), transparent),
    linear-gradient(to bottom, transparent, #000 5px, #000 calc(100% - 5px), transparent);
  mask-composite: intersect;
}
