:root{
  --navy:#001438;
  --navy-2:#001b47;
  --navy-soft:#0a2456;
  --blue:#0049f8;
  --blue-dark:#0038c4;
  --cyan:#00a0fe;
  --bg:#f5f7fc;
  --card:#ffffff;
  --border:#e6eaf3;
  --text:#001438;
  --text-muted:#6b7690;
  --success:#16a34a;
  --success-bg:#e9f9ef;
  --danger:#dc2626;
  --danger-bg:#fdecec;
  --warn:#d97706;
  --radius-lg:18px;
  --radius-md:12px;
  --radius-sm:8px;
  --shadow-sm:0 2px 8px rgba(0,20,56,0.06);
  --shadow-md:0 8px 28px rgba(0,20,56,0.10);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Inter", Arial, sans-serif;
}

*,*::before,*::after{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family:var(--font);
  background:var(--bg);
  color:var(--text);
  -webkit-font-smoothing:antialiased;
}
#app{ min-height:100vh; }
img{ max-width:100%; display:block; }
button{ font-family:inherit; cursor:pointer; }
input,select,textarea{ font-family:inherit; }
a{ color:inherit; text-decoration:none; }

/* ---------- Layout helpers ---------- */
.container{ max-width:1180px; margin:0 auto; padding:0 24px; }
.center-screen{
  min-height:100vh; display:flex; align-items:center; justify-content:center;
  padding:24px; background:var(--bg);
}
.auth-card{
  width:100%; max-width:420px; background:var(--card); border-radius:var(--radius-lg);
  box-shadow:var(--shadow-md); padding:36px 32px; border:1px solid var(--border);
}
.auth-logo{ display:flex; align-items:center; gap:10px; justify-content:center; margin-bottom:22px; }
.auth-logo img{ width:36px; height:36px; border-radius:9px; }
.auth-logo span{ font-size:19px; font-weight:800; color:var(--navy); letter-spacing:-0.02em; }
.auth-title{ font-size:22px; font-weight:800; margin:0 0 6px; text-align:center; color:var(--navy); }
.auth-sub{ font-size:14px; color:var(--text-muted); text-align:center; margin:0 0 26px; }

/* ---------- Buttons ---------- */
.btn{
  display:inline-flex; align-items:center; justify-content:center; gap:8px;
  border:none; border-radius:var(--radius-md); font-weight:700; font-size:15px;
  padding:13px 20px; transition:transform .08s ease, box-shadow .15s ease, background .15s ease;
}
.btn:active{ transform:scale(0.98); }
.btn-block{ width:100%; }
.btn-primary{ background:var(--blue); color:#fff; box-shadow:0 6px 16px rgba(0,73,248,0.28); }
.btn-primary:hover{ background:var(--blue-dark); }
.btn-dark{ background:var(--navy); color:#fff; }
.btn-ghost{ background:transparent; color:var(--navy); border:1.5px solid var(--border); }
.btn-ghost:hover{ border-color:var(--blue); color:var(--blue); }
.btn-danger{ background:var(--danger-bg); color:var(--danger); }
.btn-sm{ padding:8px 14px; font-size:13px; border-radius:var(--radius-sm); }
.btn-icon{ padding:9px; border-radius:var(--radius-sm); background:var(--bg); color:var(--navy); }
.btn:disabled{ opacity:.5; cursor:not-allowed; }

/* ---------- Form ---------- */
.field{ margin-bottom:16px; }
.field label{ display:block; font-size:13px; font-weight:700; color:var(--navy); margin-bottom:6px; }
.field input, .field select, .field textarea{
  width:100%; padding:12px 14px; border-radius:var(--radius-md); border:1.5px solid var(--border);
  font-size:15px; background:#fbfcfe; color:var(--text); outline:none; transition:border-color .12s;
}
.field input:focus, .field select:focus, .field textarea:focus{ border-color:var(--blue); background:#fff; }
.field-hint{ font-size:12px; color:var(--text-muted); margin-top:5px; }
.error-msg{ background:var(--danger-bg); color:var(--danger); font-size:13px; font-weight:600; padding:10px 12px; border-radius:var(--radius-sm); margin-bottom:14px; }
.link-btn{ background:none; border:none; color:var(--blue); font-weight:700; font-size:14px; cursor:pointer; padding:0; }

/* PIN pad */
.pin-display{ display:flex; gap:10px; justify-content:center; margin-bottom:22px; }
.pin-dot{ width:16px; height:16px; border-radius:50%; border:2px solid var(--border); background:#fff; }
.pin-dot.filled{ background:var(--blue); border-color:var(--blue); }
.pinpad{ display:grid; grid-template-columns:repeat(3,1fr); gap:10px; }
.pinpad button{
  padding:16px 0; border-radius:var(--radius-md); border:1.5px solid var(--border);
  background:#fbfcfe; font-size:19px; font-weight:700; color:var(--navy);
}
.pinpad button:active{ background:var(--bg); }
.pinpad button.wide{ grid-column:span 1; }

/* ---------- App shell (post-login) ---------- */
.shell{ display:flex; min-height:100vh; }
.sidebar{
  width:230px; flex-shrink:0; background:var(--navy); color:#cfd8ee;
  display:flex; flex-direction:column; padding:20px 14px; position:sticky; top:0; height:100vh;
}
.sidebar-logo{ display:flex; align-items:center; gap:10px; padding:8px 10px 22px; }
.sidebar-logo img{ width:30px; height:30px; border-radius:8px; }
.sidebar-logo span{ color:#fff; font-weight:800; font-size:16px; }
.nav-item{
  display:flex; align-items:center; gap:12px; padding:11px 14px; border-radius:10px;
  font-size:14px; font-weight:600; color:#a9b6d6; margin-bottom:3px;
}
.nav-item svg{ width:18px; height:18px; flex-shrink:0; }
.nav-item:hover{ background:rgba(255,255,255,0.06); color:#fff; }
.nav-item.active{ background:var(--blue); color:#fff; }
.sidebar-footer{ margin-top:auto; padding-top:14px; border-top:1px solid rgba(255,255,255,0.08); }
.worker-chip{ display:flex; align-items:center; gap:10px; padding:8px 10px; border-radius:10px; }
.worker-avatar{ width:34px; height:34px; border-radius:50%; background:var(--blue); color:#fff; display:flex; align-items:center; justify-content:center; font-weight:800; font-size:13px; flex-shrink:0; }
.worker-meta{ overflow:hidden; }
.worker-meta .name{ font-size:13px; font-weight:700; color:#fff; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.worker-meta .role{ font-size:11px; color:#8492b8; }

.main{ flex:1; min-width:0; padding:26px 30px 60px; }
.topbar{ display:flex; align-items:center; justify-content:space-between; margin-bottom:22px; gap:16px; flex-wrap:wrap; }
.page-title{ font-size:22px; font-weight:800; color:var(--navy); margin:0; }
.page-sub{ font-size:13.5px; color:var(--text-muted); margin:3px 0 0; }
.offline-pill{ display:inline-flex; align-items:center; gap:6px; font-size:12px; font-weight:700; padding:6px 12px; border-radius:20px; }
.offline-pill.online{ background:var(--success-bg); color:var(--success); }
.offline-pill.offline{ background:#fff4e0; color:var(--warn); }
.dot{ width:7px; height:7px; border-radius:50%; background:currentColor; }

/* Cards */
.card{ background:var(--card); border:1px solid var(--border); border-radius:var(--radius-lg); box-shadow:var(--shadow-sm); }
.card-pad{ padding:20px 22px; }
.stat-grid{ display:grid; grid-template-columns:repeat(auto-fit,minmax(190px,1fr)); gap:16px; margin-bottom:22px; }
.stat-card{ background:var(--card); border:1px solid var(--border); border-radius:var(--radius-lg); padding:18px 20px; box-shadow:var(--shadow-sm); }
.stat-label{ font-size:12.5px; color:var(--text-muted); font-weight:700; text-transform:uppercase; letter-spacing:.04em; margin-bottom:8px; }
.stat-value{ font-size:24px; font-weight:800; color:var(--navy); }
.stat-note{ font-size:12px; color:var(--success); font-weight:700; margin-top:6px; }

/* ---------- POS / Sales screen ---------- */
.pos-layout{ display:grid; grid-template-columns:1fr 380px; gap:20px; align-items:start; }
.cat-tabs{ display:flex; gap:8px; overflow-x:auto; padding-bottom:14px; margin-bottom:6px; }
.cat-tab{ flex-shrink:0; padding:9px 18px; border-radius:24px; font-size:13.5px; font-weight:700; background:#fff; border:1.5px solid var(--border); color:var(--navy); }
.cat-tab.active{ background:var(--navy); border-color:var(--navy); color:#fff; }
.item-grid{ display:grid; grid-template-columns:repeat(auto-fill,minmax(140px,1fr)); gap:12px; }
.item-tile{ background:#fff; border:1.5px solid var(--border); border-radius:var(--radius-md); padding:14px 12px; text-align:left; transition:border-color .1s, transform .08s; }
.item-tile:active{ transform:scale(0.97); }
.item-tile:hover{ border-color:var(--blue); }
.item-tile .name{ font-size:14px; font-weight:700; color:var(--navy); margin-bottom:6px; line-height:1.25; min-height:36px; }
.item-tile .price{ font-size:13.5px; font-weight:700; color:var(--blue); }
.empty-note{ color:var(--text-muted); font-size:14px; padding:30px 10px; text-align:center; }

.cart-panel{ background:#fff; border:1px solid var(--border); border-radius:var(--radius-lg); box-shadow:var(--shadow-md); display:flex; flex-direction:column; position:sticky; top:20px; max-height:calc(100vh - 40px); }
.cart-head{ padding:18px 20px 12px; border-bottom:1px solid var(--border); display:flex; justify-content:space-between; align-items:center; }
.cart-head h3{ margin:0; font-size:16px; color:var(--navy); }
.cart-items{ flex:1; overflow-y:auto; padding:10px 16px; min-height:80px; }
.cart-row{ display:flex; align-items:center; gap:10px; padding:10px 4px; border-bottom:1px dashed var(--border); }
.cart-row:last-child{ border-bottom:none; }
.cart-row .info{ flex:1; min-width:0; }
.cart-row .info .n{ font-size:13.5px; font-weight:700; color:var(--navy); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.cart-row .info .p{ font-size:12px; color:var(--text-muted); }
.qty-ctrl{ display:flex; align-items:center; gap:8px; }
.qty-ctrl button{ width:26px; height:26px; border-radius:7px; border:1px solid var(--border); background:var(--bg); font-weight:800; color:var(--navy); }
.qty-ctrl span{ font-size:13.5px; font-weight:700; min-width:16px; text-align:center; }
.cart-line-total{ font-size:13.5px; font-weight:800; color:var(--navy); width:64px; text-align:right; }
.cart-summary{ padding:16px 20px; border-top:1px solid var(--border); }
.sum-row{ display:flex; justify-content:space-between; font-size:14px; margin-bottom:8px; color:var(--text-muted); }
.sum-row.total{ font-size:18px; font-weight:800; color:var(--navy); margin:10px 0 16px; }
.paid-input{ display:flex; align-items:center; border:1.5px solid var(--border); border-radius:var(--radius-md); overflow:hidden; margin-bottom:10px; }
.paid-input span{ padding:0 12px; color:var(--text-muted); font-weight:700; background:#fbfcfe; align-self:stretch; display:flex; align-items:center; border-right:1.5px solid var(--border); }
.paid-input input{ border:none; flex:1; padding:12px; font-size:16px; font-weight:700; outline:none; }
.change-box{ background:var(--success-bg); border-radius:var(--radius-md); padding:12px 14px; display:flex; justify-content:space-between; align-items:center; margin-bottom:14px; }
.change-box .lbl{ font-size:13px; font-weight:700; color:var(--success); }
.change-box .val{ font-size:19px; font-weight:800; color:var(--success); }
.change-box.negative{ background:var(--danger-bg); }
.change-box.negative .lbl, .change-box.negative .val{ color:var(--danger); }
.pm-btn.active{ background:var(--navy); border-color:var(--navy); color:#fff; }

/* ---------- Table ---------- */
.table-wrap{ overflow-x:auto; }
table.data-table{ width:100%; border-collapse:collapse; font-size:14px; }
.data-table th{ text-align:left; font-size:12px; text-transform:uppercase; letter-spacing:.04em; color:var(--text-muted); padding:12px 14px; border-bottom:1.5px solid var(--border); }
.data-table td{ padding:13px 14px; border-bottom:1px solid var(--border); color:var(--text); }
.data-table tr:last-child td{ border-bottom:none; }
.pill{ display:inline-block; padding:4px 10px; border-radius:20px; font-size:11.5px; font-weight:700; }
.pill.blue{ background:#e8effe; color:var(--blue); }
.pill.green{ background:var(--success-bg); color:var(--success); }
.row-actions{ display:flex; gap:6px; }

/* ---------- Modal ---------- */
.modal-overlay{ position:fixed; inset:0; background:rgba(0,20,56,0.45); display:flex; align-items:center; justify-content:center; padding:20px; z-index:100; }
.modal{ background:#fff; border-radius:var(--radius-lg); width:100%; max-width:440px; padding:26px; box-shadow:var(--shadow-md); max-height:90vh; overflow-y:auto; }
.modal h3{ margin:0 0 4px; font-size:18px; color:var(--navy); }
.modal .modal-sub{ font-size:13px; color:var(--text-muted); margin:0 0 18px; }
.modal-actions{ display:flex; gap:10px; margin-top:6px; }
.modal-actions .btn{ flex:1; }

/* Toast */
.toast{ position:fixed; bottom:24px; left:50%; transform:translateX(-50%); background:var(--navy); color:#fff; padding:13px 22px; border-radius:12px; font-size:14px; font-weight:600; box-shadow:var(--shadow-md); z-index:200; animation:toastIn .2s ease; }
@keyframes toastIn{ from{ opacity:0; transform:translate(-50%,10px); } to{ opacity:1; transform:translate(-50%,0); } }

/* Empty state */
.empty-state{ text-align:center; padding:50px 20px; color:var(--text-muted); }
.empty-state h4{ color:var(--navy); margin:14px 0 6px; }

/* Category section header w/ head+child */
.cat-block{ margin-bottom:26px; }
.cat-block-head{ display:flex; justify-content:space-between; align-items:center; margin-bottom:10px; }
.cat-block-head h4{ margin:0; font-size:15px; color:var(--navy); }
.child-grid{ display:grid; grid-template-columns:repeat(auto-fill,minmax(200px,1fr)); gap:10px; }
.child-card{ background:#fff; border:1px solid var(--border); border-radius:var(--radius-md); padding:12px 14px; display:flex; justify-content:space-between; align-items:center; }
.child-card .n{ font-size:13.5px; font-weight:700; color:var(--navy); }
.child-card .p{ font-size:12.5px; color:var(--blue); font-weight:700; }

/* Landing page */
.landing-nav{ display:flex; justify-content:space-between; align-items:center; padding:20px 0; }
.landing-hero{ text-align:center; padding:70px 0 50px; }
.landing-hero h1{ font-size:42px; font-weight:900; color:var(--navy); max-width:680px; margin:0 auto 18px; line-height:1.15; letter-spacing:-0.02em; }
.landing-hero p{ font-size:17px; color:var(--text-muted); max-width:520px; margin:0 auto 30px; }
.hero-actions{ display:flex; gap:12px; justify-content:center; }
.feature-grid{ display:grid; grid-template-columns:repeat(auto-fit,minmax(220px,1fr)); gap:18px; padding:40px 0 70px; }
.feature-card{ background:#fff; border:1px solid var(--border); border-radius:var(--radius-lg); padding:24px; }
.feature-card .ic{ width:42px; height:42px; border-radius:11px; background:#e8effe; color:var(--blue); display:flex; align-items:center; justify-content:center; margin-bottom:14px; }
.feature-card h4{ margin:0 0 6px; color:var(--navy); font-size:15.5px; }
.feature-card p{ margin:0; font-size:13.5px; color:var(--text-muted); line-height:1.5; }

/* Responsive */
@media (max-width: 980px){
  .pos-layout{ grid-template-columns:1fr; }
  .cart-panel{ position:static; max-height:none; }
}
@media (max-width: 760px){
  .sidebar{ width:78px; }
  .sidebar-logo span, .nav-item span, .worker-meta{ display:none; }
  .sidebar-logo, .nav-item{ justify-content:center; }
  .worker-chip{ justify-content:center; }
  .main{ padding:18px 14px 50px; }
}
@media (prefers-reduced-motion: reduce){
  *{ animation:none !important; transition:none !important; }
}
:focus-visible{ outline:2.5px solid var(--cyan); outline-offset:2px; }

/* ---------- Dark theme (Appearance setting) ---------- */
body[data-theme="dark"]{
  --bg:#0a1128;
  --card:#111c3d;
  --border:#22305c;
  --text:#e8ecf7;
  --text-muted:#93a0c4;
  --success-bg:#0f2e1e;
  --danger-bg:#3a1414;
}
body[data-theme="dark"] .field input,
body[data-theme="dark"] .field select,
body[data-theme="dark"] .field textarea{ background:#0d1631; color:var(--text); border-color:var(--border); }
body[data-theme="dark"] .item-tile,
body[data-theme="dark"] .child-card,
body[data-theme="dark"] .cat-tab,
body[data-theme="dark"] .cart-panel,
body[data-theme="dark"] .stat-card{ background:var(--card); }
body[data-theme="dark"] .cat-tab{ color:var(--text); }
body[data-theme="dark"] .auth-card{ background:var(--card); }
