/* ============================================================
   SajianPOS — Design System
   Hand-crafted, dependency-free. Light + subtle dark support.
   ============================================================ */

:root{
  --bg: #eef1f6;
  --bg-soft: #f6f8fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e6e9f0;
  --border-strong:#d6dbe6;
  --text: #0f172a;
  --text-muted: #64748b;
  --text-soft:#94a3b8;

  --brand: #0d9488;      /* teal */
  --brand-600:#0f766e;
  --brand-50:#effcf9;
  --accent:#6366f1;      /* indigo */
  --emerald:#10b981;
  --emerald-50:#ecfdf5;
  --blue:#3b82f6;
  --blue-50:#eff6ff;
  --amber:#f59e0b;
  --amber-50:#fffbeb;
  --purple:#8b5cf6;
  --purple-50:#f5f3ff;
  --rose:#f43f5e;
  --rose-50:#fff1f2;
  --cyan:#06b6d4;
  --cyan-50:#ecfeff;

  --sidebar-1:#0b1327;
  --sidebar-2:#111c36;
  --sidebar-text:#9fb0cc;
  --sidebar-active:#12b8a6;

  --radius:16px;
  --radius-sm:11px;
  --radius-lg:22px;
  --shadow-sm: 0 1px 2px rgba(15,23,42,.05);
  --shadow: 0 2px 8px rgba(15,23,42,.06), 0 1px 2px rgba(15,23,42,.04);
  --shadow-md: 0 8px 24px rgba(15,23,42,.08);
  --shadow-lg: 0 18px 50px rgba(15,23,42,.14);
  --font: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

*{box-sizing:border-box}
html,body{margin:0;padding:0}
body{
  font-family:var(--font);
  background:var(--bg);
  color:var(--text);
  font-size:14px;
  line-height:1.5;
  -webkit-font-smoothing:antialiased;
}
a{color:inherit;text-decoration:none}
button{font-family:inherit;cursor:pointer}
img{max-width:100%}
::selection{background:var(--brand);color:#fff}

/* Scrollbars */
::-webkit-scrollbar{width:10px;height:10px}
::-webkit-scrollbar-thumb{background:#cbd5e1;border-radius:20px;border:2px solid transparent;background-clip:content-box}
::-webkit-scrollbar-thumb:hover{background:#94a3b8;background-clip:content-box}

/* ---------- Layout shell ---------- */
.app{display:flex;min-height:100vh}
.sidebar{
  width:264px;flex-shrink:0;
  background:linear-gradient(180deg,var(--sidebar-1),var(--sidebar-2));
  color:var(--sidebar-text);
  display:flex;flex-direction:column;
  position:fixed;top:0;left:0;bottom:0;z-index:50;
  transition:transform .28s ease;
}
.sidebar-brand{
  display:flex;align-items:center;gap:12px;
  padding:20px 20px 18px;
}
.brand-logo{
  width:44px;height:44px;border-radius:13px;flex-shrink:0;
  background:linear-gradient(135deg,var(--brand),#0891b2);
  display:grid;place-items:center;font-size:22px;
  box-shadow:0 6px 16px rgba(13,148,136,.4);
}
.brand-name{color:#fff;font-weight:800;font-size:17px;letter-spacing:-.02em;line-height:1.1}
.brand-sub{font-size:10.5px;color:#7b8bab;margin-top:3px;font-weight:500}
.sidebar-nav{flex:1;overflow-y:auto;padding:6px 12px 20px}
.nav-group-label{
  font-size:10px;text-transform:uppercase;letter-spacing:.09em;
  color:#5c6c8c;font-weight:700;padding:16px 12px 7px;
}
.nav-item{
  display:flex;align-items:center;gap:12px;
  padding:10px 12px;border-radius:11px;margin-bottom:2px;
  color:var(--sidebar-text);font-weight:500;font-size:13.5px;
  transition:all .16s;position:relative;
}
.nav-item:hover{background:rgba(255,255,255,.05);color:#e2e8f0}
.nav-item.active{
  background:linear-gradient(90deg,rgba(18,184,166,.22),rgba(18,184,166,.05));
  color:#fff;font-weight:600;
}
.nav-item.active::before{
  content:"";position:absolute;left:-12px;top:50%;transform:translateY(-50%);
  width:4px;height:22px;border-radius:0 4px 4px 0;background:var(--sidebar-active);
}
.nav-item .ico{width:20px;height:20px;flex-shrink:0;opacity:.9}
.nav-item .badge{margin-left:auto;background:var(--rose);color:#fff;font-size:10px;font-weight:700;padding:1px 7px;border-radius:20px}
.sidebar-user{
  margin:12px;padding:12px;border-radius:14px;
  background:rgba(255,255,255,.04);display:flex;align-items:center;gap:11px;
  border:1px solid rgba(255,255,255,.06);
}
.avatar{
  width:38px;height:38px;border-radius:11px;flex-shrink:0;
  display:grid;place-items:center;font-weight:700;color:#fff;font-size:14px;
  background:linear-gradient(135deg,#6366f1,#8b5cf6);
}
.sidebar-user .nm{color:#fff;font-weight:600;font-size:13px;line-height:1.2}
.sidebar-user .rl{font-size:11px;color:#7b8bab}

.main{flex:1;margin-left:264px;min-width:0;display:flex;flex-direction:column}
.topbar{
  background:var(--surface);border-bottom:1px solid var(--border);
  padding:14px 26px;display:flex;align-items:center;gap:18px;
  position:sticky;top:0;z-index:30;
}
.page-title h1{font-size:20px;font-weight:800;letter-spacing:-.02em;margin:0}
.page-title p{font-size:12.5px;color:var(--text-muted);margin:2px 0 0}
.topbar-spacer{flex:1}
.content{padding:24px 26px 40px}

.hamburger{display:none;width:40px;height:40px;border-radius:10px;border:1px solid var(--border);background:#fff;align-items:center;justify-content:center}
.overlay{display:none;position:fixed;inset:0;background:rgba(6,12,26,.5);z-index:45}
.overlay.show{display:block}

/* ---------- Generic components ---------- */
.card{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);box-shadow:var(--shadow)}
.card-pad{padding:20px}
.card-head{display:flex;align-items:center;gap:10px;padding:18px 20px;border-bottom:1px solid var(--border)}
.card-head h3{font-size:15px;font-weight:700;margin:0}
.card-head .sub{font-size:12px;color:var(--text-muted)}
.card-title{font-size:15px;font-weight:700;margin:0 0 2px}

.pill{display:inline-flex;align-items:center;gap:6px;padding:4px 11px;border-radius:20px;font-size:11.5px;font-weight:600;white-space:nowrap}
.pill .dot{width:6px;height:6px;border-radius:50%;background:currentColor}
.pill-emerald{background:var(--emerald-50);color:#047857}
.pill-blue{background:var(--blue-50);color:#1d4ed8}
.pill-amber{background:var(--amber-50);color:#b45309}
.pill-rose{background:var(--rose-50);color:#be123c}
.pill-purple{background:var(--purple-50);color:#6d28d9}
.pill-cyan{background:var(--cyan-50);color:#0e7490}
.pill-slate{background:#f1f5f9;color:#475569}

.chip{display:inline-flex;align-items:center;gap:7px;padding:6px 12px;border-radius:11px;font-size:12px;font-weight:600;border:1px solid var(--border);background:#fff;color:var(--text-muted)}
.chip .dot{width:7px;height:7px;border-radius:50%}

.btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;padding:10px 16px;border-radius:11px;font-weight:600;font-size:13.5px;border:1px solid transparent;transition:all .16s;white-space:nowrap}
.btn-primary{background:var(--brand);color:#fff;box-shadow:0 4px 12px rgba(13,148,136,.28)}
.btn-primary:hover{background:var(--brand-600)}
.btn-dark{background:#0f172a;color:#fff}
.btn-dark:hover{background:#1e293b}
.btn-light{background:#fff;color:var(--text);border-color:var(--border-strong)}
.btn-light:hover{background:var(--surface-2)}
.btn-ghost{background:transparent;color:var(--text-muted)}
.btn-ghost:hover{background:var(--surface-2);color:var(--text)}
.btn-sm{padding:7px 12px;font-size:12.5px;border-radius:9px}
.btn-block{width:100%}
.btn-emerald{background:var(--emerald);color:#fff}
.btn-emerald:hover{filter:brightness(.95)}
.btn:disabled{opacity:.5;cursor:not-allowed}

.icon-chip{width:44px;height:44px;border-radius:13px;display:grid;place-items:center;flex-shrink:0}
.ic-emerald{background:var(--emerald-50);color:#059669}
.ic-blue{background:var(--blue-50);color:#2563eb}
.ic-amber{background:var(--amber-50);color:#d97706}
.ic-rose{background:var(--rose-50);color:#e11d48}
.ic-purple{background:var(--purple-50);color:#7c3aed}
.ic-cyan{background:var(--cyan-50);color:#0891b2}
.ic-slate{background:#f1f5f9;color:#475569}

/* ---------- Grid helpers ---------- */
.grid{display:grid;gap:18px}
.g-1{grid-template-columns:1fr}
.g-2{grid-template-columns:repeat(2,1fr)}
.g-3{grid-template-columns:repeat(3,1fr)}
.g-4{grid-template-columns:repeat(4,1fr)}
.g-6{grid-template-columns:repeat(6,1fr)}
.col-2{grid-column:span 2}
.col-3{grid-column:span 3}
.flex{display:flex}
.items-center{align-items:center}
.items-start{align-items:flex-start}
.justify-between{justify-content:space-between}
.justify-center{justify-content:center}
.justify-end{justify-content:flex-end}
.gap-2{gap:8px}.gap-3{gap:12px}.gap-4{gap:16px}.gap-6{gap:24px}
.wrap{flex-wrap:wrap}
.flex-1{flex:1}
.mt-1{margin-top:6px}.mt-2{margin-top:12px}.mt-3{margin-top:18px}.mt-4{margin-top:24px}
.mb-1{margin-bottom:6px}.mb-2{margin-bottom:12px}.mb-3{margin-bottom:18px}.mb-4{margin-bottom:24px}
.text-center{text-align:center}
.text-right{text-align:right}

/* ---------- Typography helpers ---------- */
.t-xs{font-size:11px}.t-sm{font-size:12.5px}.t-base{font-size:14px}.t-lg{font-size:16px}
.t-muted{color:var(--text-muted)}.t-soft{color:var(--text-soft)}
.t-bold{font-weight:700}.t-semi{font-weight:600}
.t-num{font-size:26px;font-weight:800;letter-spacing:-.03em;line-height:1}
.up{color:var(--emerald)}.down{color:var(--rose)}

/* ---------- Stat tile ---------- */
.stat{padding:18px}
.stat-top{display:flex;align-items:flex-start;justify-content:space-between;gap:10px}
.stat-label{font-size:12.5px;color:var(--text-muted);font-weight:500}
.stat-num{font-size:27px;font-weight:800;letter-spacing:-.03em;margin-top:9px;line-height:1}
.stat-delta{display:inline-flex;align-items:center;gap:4px;font-size:11.5px;font-weight:600;margin-top:8px}
.spark{margin-top:10px;height:34px;width:100%}

/* ---------- Table ---------- */
.table-wrap{overflow-x:auto}
table.tbl{width:100%;border-collapse:collapse;font-size:13px}
.tbl th{
  text-align:left;font-size:11px;text-transform:uppercase;letter-spacing:.05em;
  color:var(--text-soft);font-weight:700;padding:11px 14px;border-bottom:1px solid var(--border);
  white-space:nowrap;
}
.tbl td{padding:12px 14px;border-bottom:1px solid var(--border);vertical-align:middle}
.tbl tr:last-child td{border-bottom:none}
.tbl tbody tr:hover{background:var(--surface-2)}
.tbl .num{font-variant-numeric:tabular-nums;font-weight:600}

/* progress */
.bar{height:7px;border-radius:20px;background:#eef1f6;overflow:hidden}
.bar > span{display:block;height:100%;border-radius:20px;background:var(--emerald)}
.bar.amber > span{background:var(--amber)}
.bar.rose > span{background:var(--rose)}
.bar.blue > span{background:var(--blue)}

/* rank medal */
.rank{width:26px;height:26px;border-radius:8px;display:grid;place-items:center;font-weight:700;font-size:12px;background:#f1f5f9;color:#64748b}
.rank.gold{background:#fef3c7;color:#b45309}
.rank.silver{background:#e2e8f0;color:#475569}
.rank.bronze{background:#fde4d3;color:#b45309}

/* ---------- Bar chart (dashboard) ---------- */
.barchart{display:flex;align-items:flex-end;gap:14px;height:210px;padding-top:20px}
.barchart .col{flex:1;display:flex;flex-direction:column;align-items:center;gap:8px;height:100%;justify-content:flex-end}
.barchart .bval{font-size:11px;font-weight:700;color:var(--text)}
.barchart .bcol{width:70%;max-width:42px;border-radius:8px 8px 0 0;background:linear-gradient(180deg,var(--brand),#0891b2);min-height:4px;transition:height .5s}
.barchart .blabel{font-size:10.5px;color:var(--text-muted);text-align:center;font-weight:500;line-height:1.2}

/* ---------- Donut ---------- */
.donut-wrap{display:flex;align-items:center;gap:22px;flex-wrap:wrap}
.donut{position:relative;width:150px;height:150px;flex-shrink:0}
.donut .center{position:absolute;inset:0;display:grid;place-items:center;text-align:center}
.donut .center .n{font-size:22px;font-weight:800}
.donut .center .l{font-size:10.5px;color:var(--text-muted)}
.legend{display:flex;flex-direction:column;gap:11px;flex:1;min-width:160px}
.legend .row{display:flex;align-items:center;gap:9px;font-size:12.5px}
.legend .sw{width:11px;height:11px;border-radius:4px;flex-shrink:0}
.legend .lname{color:var(--text-muted)}
.legend .lval{margin-left:auto;font-weight:700}

/* ---------- Login ---------- */
.auth-wrap{min-height:100vh;display:grid;grid-template-columns:1.05fr .95fr}
.auth-visual{
  background:linear-gradient(155deg,#0b1327,#0f766e);
  color:#fff;padding:56px;display:flex;flex-direction:column;justify-content:space-between;position:relative;overflow:hidden;
}
.auth-visual::after{content:"";position:absolute;width:420px;height:420px;border-radius:50%;background:radial-gradient(circle,rgba(20,184,166,.35),transparent 70%);bottom:-120px;right:-100px}
.auth-form-side{display:flex;align-items:center;justify-content:center;padding:40px;background:var(--surface)}
.auth-card{width:100%;max-width:410px}
.input{width:100%;padding:12px 14px;border:1px solid var(--border-strong);border-radius:11px;font-size:14px;font-family:inherit;background:#fff;transition:border .15s,box-shadow .15s}
.input:focus{outline:none;border-color:var(--brand);box-shadow:0 0 0 3px rgba(13,148,136,.14)}
.label{display:block;font-size:12.5px;font-weight:600;margin-bottom:7px;color:var(--text)}
.role-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.role-opt{border:1.5px solid var(--border-strong);border-radius:13px;padding:14px;cursor:pointer;transition:all .16s;background:#fff}
.role-opt:hover{border-color:var(--brand);background:var(--brand-50)}
.role-opt.sel{border-color:var(--brand);background:var(--brand-50);box-shadow:0 0 0 3px rgba(13,148,136,.12)}
.role-opt .rt{font-weight:700;font-size:13.5px}
.role-opt .rd{font-size:11.5px;color:var(--text-muted);margin-top:2px}

/* ---------- Storefront ---------- */
.store-nav{background:rgba(255,255,255,.85);backdrop-filter:blur(10px);border-bottom:1px solid var(--border);position:sticky;top:0;z-index:40}
.store-nav-inner{max-width:1200px;margin:0 auto;padding:14px 22px;display:flex;align-items:center;gap:16px}
.store-hero{background:linear-gradient(150deg,#0b1327,#0f766e);color:#fff;position:relative;overflow:hidden}
.store-hero-inner{max-width:1200px;margin:0 auto;padding:60px 22px;position:relative;z-index:2}
.store-hero::after{content:"";position:absolute;width:500px;height:500px;border-radius:50%;background:radial-gradient(circle,rgba(20,184,166,.4),transparent 70%);top:-160px;right:-120px}
.store-main{max-width:1200px;margin:0 auto;padding:26px 22px 80px}
.menu-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:16px}
.menu-card{background:#fff;border:1px solid var(--border);border-radius:var(--radius);overflow:hidden;box-shadow:var(--shadow);transition:transform .18s,box-shadow .18s;display:flex;flex-direction:column}
.menu-card:hover{transform:translateY(-3px);box-shadow:var(--shadow-md)}
.menu-emoji{height:118px;display:grid;place-items:center;font-size:56px;background:linear-gradient(135deg,#f8fafc,#eef2f7)}
.menu-body{padding:14px;display:flex;flex-direction:column;gap:8px;flex:1}
.tag{font-size:10px;font-weight:700;padding:2px 8px;border-radius:20px;background:#f1f5f9;color:#64748b}
.tag.halal{background:var(--emerald-50);color:#047857}
.tag.spicy{background:var(--rose-50);color:#be123c}
.tag.veg{background:#ecfccb;color:#4d7c0f}
.tag.pop{background:var(--amber-50);color:#b45309}

.cart-panel{position:sticky;top:88px}
.cart-line{display:flex;align-items:center;gap:10px;padding:10px 0;border-bottom:1px solid var(--border)}
.qty-btn{width:26px;height:26px;border-radius:8px;border:1px solid var(--border-strong);background:#fff;display:grid;place-items:center;font-weight:700;color:var(--text-muted)}
.qty-btn:hover{background:var(--surface-2)}

/* AI chat */
.ai-fab{position:fixed;bottom:24px;right:24px;z-index:60;width:60px;height:60px;border-radius:50%;background:linear-gradient(135deg,var(--brand),#0891b2);color:#fff;display:grid;place-items:center;font-size:26px;box-shadow:0 10px 30px rgba(13,148,136,.5);border:none}
.ai-panel{position:fixed;bottom:96px;right:24px;z-index:60;width:380px;max-width:calc(100vw - 32px);height:560px;max-height:calc(100vh - 130px);background:#fff;border-radius:20px;box-shadow:var(--shadow-lg);display:none;flex-direction:column;overflow:hidden;border:1px solid var(--border)}
.ai-panel.open{display:flex}
.ai-head{background:linear-gradient(135deg,#0b1327,#0f766e);color:#fff;padding:16px 18px;display:flex;align-items:center;gap:11px}
.ai-body{flex:1;overflow-y:auto;padding:16px;display:flex;flex-direction:column;gap:12px;background:var(--surface-2)}
.ai-msg{max-width:82%;padding:10px 13px;border-radius:14px;font-size:13px;line-height:1.45}
.ai-msg.bot{background:#fff;border:1px solid var(--border);border-bottom-left-radius:4px;align-self:flex-start}
.ai-msg.user{background:var(--brand);color:#fff;border-bottom-right-radius:4px;align-self:flex-end}
.ai-foot{padding:12px;border-top:1px solid var(--border);display:flex;gap:8px;background:#fff}
.ai-chips{display:flex;gap:7px;flex-wrap:wrap;margin-top:2px}
.ai-chip{font-size:11.5px;padding:6px 10px;border-radius:20px;background:var(--brand-50);color:var(--brand-600);border:1px solid #cdeee8;cursor:pointer;font-weight:600}
.ai-chip:hover{background:#d7f1ec}

/* kitchen */
.kds-cols{display:grid;grid-template-columns:repeat(3,1fr);gap:16px;align-items:start}
.kds-col{background:var(--surface-2);border:1px solid var(--border);border-radius:var(--radius);padding:14px;min-height:200px}
.kds-col-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:12px;padding:0 4px}
.kds-card{background:#fff;border:1px solid var(--border);border-radius:13px;padding:13px;margin-bottom:11px;box-shadow:var(--shadow-sm)}
.kds-card.new{border-left:4px solid var(--blue)}
.kds-card.prep{border-left:4px solid var(--amber)}
.kds-card.ready{border-left:4px solid var(--emerald)}

/* toast/flash */
.flash{padding:13px 16px;border-radius:12px;font-size:13.5px;font-weight:600;margin-bottom:18px;display:flex;align-items:center;gap:10px}
.flash-ok{background:var(--emerald-50);color:#047857;border:1px solid #a7f3d0}
.flash-err{background:var(--rose-50);color:#be123c;border:1px solid #fecdd3}

/* lang toggle */
.lang-toggle{display:inline-flex;border:1px solid var(--border);border-radius:9px;overflow:hidden;background:#fff}
.lang-toggle a{padding:6px 11px;font-size:12px;font-weight:600;color:var(--text-muted)}
.lang-toggle a.on{background:var(--brand);color:#fff}

.divider{height:1px;background:var(--border);margin:14px 0}
.dot-sep{color:var(--text-soft)}

/* empty */
.empty{text-align:center;padding:44px 20px;color:var(--text-muted)}
.empty .e-ico{font-size:40px;margin-bottom:10px}

/* Insight box */
.insight{background:linear-gradient(135deg,#f5f3ff,#eef2ff);border:1px solid #e0e7ff;border-radius:14px;padding:16px}
.metric-box{background:var(--surface-2);border:1px solid var(--border);border-radius:13px;padding:14px;text-align:center}
.metric-box .mv{font-size:22px;font-weight:800;letter-spacing:-.02em}
.metric-box .ml{font-size:11px;color:var(--text-muted);margin-top:2px}

/* status footer bar */
.status-bar{display:flex;align-items:center;gap:26px;flex-wrap:wrap;padding:14px 20px;background:#fff;border:1px solid var(--border);border-radius:var(--radius);font-size:12.5px;color:var(--text-muted)}
.status-bar .si{display:flex;align-items:center;gap:8px}
.status-bar .si b{color:var(--text);font-weight:600}

/* ---------- Responsive ---------- */
@media (max-width:1100px){
  .g-4{grid-template-columns:repeat(2,1fr)}
  .g-6{grid-template-columns:repeat(3,1fr)}
  .g-3{grid-template-columns:1fr}
  .menu-grid{grid-template-columns:repeat(2,1fr)}
  .kds-cols{grid-template-columns:1fr}
  .col-2,.col-3{grid-column:auto}
}
@media (max-width:820px){
  .sidebar{transform:translateX(-100%)}
  .sidebar.open{transform:translateX(0)}
  .main{margin-left:0}
  .hamburger{display:inline-flex}
  .g-2,.g-4{grid-template-columns:1fr}
  .g-6{grid-template-columns:repeat(2,1fr)}
  .auth-wrap{grid-template-columns:1fr}
  .auth-visual{display:none}
  .menu-grid{grid-template-columns:1fr 1fr}
  .content{padding:18px 15px 40px}
  .topbar{padding:12px 15px}
  .store-main{padding:20px 15px 80px}
  .hide-sm{display:none !important}
}
@media (max-width:520px){
  .g-6{grid-template-columns:1fr 1fr}
  .menu-grid{grid-template-columns:1fr}
  .ai-panel{right:8px;left:8px;width:auto}
  .role-grid{grid-template-columns:1fr}
}
