/* ════════════════════════════════════════════
   DESIGN TOKENS
   ════════════════════════════════════════════ */
:root {
  --brand-primary:   #02385a;
  --brand-secondary: #275d8c;
  --brand-neutral:   #a59fa1;
  --brand-teal:      #048c80;
  --brand-yellow:    #f0e040;

  --radius-sm:   6px;
  --radius:      10px;
  --radius-lg:   14px;
  --radius-xl:   20px;

  --font-display: 'Playfair Display', serif;
  --font-body:    'Alexandria', sans-serif;
  --font-mono:    'DM Mono', monospace;

  --sidebar-w:   220px;
  --topbar-h:    56px;
  --bottombar-h: 60px;

  --transition: all .18s cubic-bezier(.4,0,.2,1);
}

/* ── DARK THEME (default) ── */
[data-theme="dark"] {
  --gold:        #f0e040;
  --gold-lt:     #f5ea70;
  --gold-dk:     #c9ad1a;
  --gold-bg:     rgba(240,224,64,.10);
  --gold-bg2:    rgba(240,224,64,.18);
  --gold-border: rgba(240,224,64,.30);
  --on-gold:     #14140a;

  --bg:           #0f1117;
  --bg2:          #161820;
  --surface:      #1c1e2a;
  --surface2:     #242636;
  --surface3:     #2c2f42;
  --border:       rgba(255,255,255,.07);
  --border2:      rgba(255,255,255,.12);
  --text:         #e8eaf2;
  --text2:        #9096b4;
  --text3:        #555a7a;
  --danger:       #e05252;
  --danger-bg:    rgba(224,82,82,.12);
  --success:      #048c80;
  --success-bg:   rgba(4,140,128,.12);
  --warning:      #f0e040;
  --warning-bg:   rgba(240,224,64,.12);
  --info:         #275d8c;
  --info-bg:      rgba(39,93,140,.12);
  --shadow:       0 4px 24px rgba(0,0,0,.5);
  --shadow-sm:    0 2px 8px rgba(0,0,0,.3);
  --shadow-lg:    0 8px 40px rgba(0,0,0,.6);
}

/* ── LIGHT THEME ── */
[data-theme="light"] {
  --gold:        #02385a;
  --gold-lt:     #275d8c;
  --gold-dk:     #012238;
  --gold-bg:     rgba(2,56,90,.08);
  --gold-bg2:    rgba(2,56,90,.14);
  --gold-border: rgba(2,56,90,.24);
  --on-gold:     #ffffff;

  --bg:           #f0f2f8;
  --bg2:          #e8eaf2;
  --surface:      #ffffff;
  --surface2:     #f4f6fc;
  --surface3:     #ebedf5;
  --border:       rgba(0,0,0,.07);
  --border2:      rgba(0,0,0,.12);
  --text:         #111827;
  --text2:        #4b5568;
  --text3:        #9ca3af;
  --danger:       #dc2626;
  --danger-bg:    rgba(220,38,38,.08);
  --success:      #048c80;
  --success-bg:   rgba(4,140,128,.08);
  --warning:      #8a7a00;
  --warning-bg:   rgba(240,224,64,.15);
  --info:         #02385a;
  --info-bg:      rgba(2,56,90,.08);
  --shadow:       0 4px 24px rgba(0,0,0,.10);
  --shadow-sm:    0 2px 8px rgba(0,0,0,.06);
  --shadow-lg:    0 8px 40px rgba(0,0,0,.14);
}

/* ════════════════════════════════════════════
   RESET & BASE
   ════════════════════════════════════════════ */
*,*::before,*::after { box-sizing:border-box; margin:0; padding:0; }
html { font-size:14px; -webkit-text-size-adjust:100%; text-size-adjust:100%; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
  transition: background .25s, color .25s;
}
button { font-family: var(--font-body); cursor: pointer; border: none; background: none; }
input, select, textarea { font-family: var(--font-body); }
a { color: inherit; text-decoration: none; }
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 4px; }

/* ════════════════════════════════════════════
   LOGIN SCREEN
   ════════════════════════════════════════════ */
#login-screen {
  position: fixed; inset: 0; z-index: 1000;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  padding: 1.5rem;
}
#login-screen::before {
  content: '';
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(ellipse 60% 50% at 80% 20%, rgba(2,56,90,.12) 0%, transparent 60%),
    radial-gradient(ellipse 50% 60% at 15% 75%, rgba(4,140,128,.07) 0%, transparent 60%);
}
.login-wrap {
  width: 100%; max-width: 360px;
  position: relative; z-index: 2;
}
.login-brand {
  text-align: center; margin-bottom: 2.5rem;
}
.login-logo-mark {
  width: 56px; height: 56px; border-radius: 14px;
  background: linear-gradient(135deg, var(--gold-lt), var(--gold-dk));
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 1rem;
  font-family: var(--font-display); font-size: 22px; font-weight: 700; color: var(--on-gold);
  box-shadow: 0 4px 20px var(--gold-border);
}
.login-brand h1 {
  font-family: var(--font-display); font-size: 22px; font-weight: 800;
  color: var(--gold); letter-spacing: .02em;
}
.login-brand p {
  font-size: 11px; color: var(--text3);
  letter-spacing: .12em; text-transform: uppercase; margin-top: 3px;
}
.login-card {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow);
  position: relative; z-index: 3;
}
.pin-label {
  font-size: 11px; font-weight: 600; letter-spacing: .1em;
  text-transform: uppercase; color: var(--text3); margin-bottom: .6rem;
  text-align: center;
}
.pin-display {
  display: flex; justify-content: center; gap: 10px;
  margin-bottom: 1.25rem;
}
.pin-dot {
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--surface3); border: 2px solid var(--border2);
  transition: var(--transition);
}
.pin-dot.filled { background: var(--gold); border-color: var(--gold); transform: scale(1.1); }
.pin-dot.error  { background: var(--danger); border-color: var(--danger); animation: shake .35s ease; }
@keyframes shake {
  0%,100% { transform: translateX(0); }
  20%,60%  { transform: translateX(-5px); }
  40%,80%  { transform: translateX(5px); }
}
.pin-keypad {
  display: grid; grid-template-columns: repeat(3,1fr); gap: 8px;
}
.pin-key {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 8px;
  font-family: var(--font-mono); font-size: 18px; font-weight: 500;
  color: var(--text); text-align: center;
  transition: var(--transition); -webkit-user-select: none; user-select: none;
}
.pin-key:hover  { background: var(--surface3); border-color: var(--gold); color: var(--gold); }
.pin-key:active { transform: scale(.94); }
.pin-key.del    { font-size: 13px; color: var(--text2); font-family: var(--font-body); }
.pin-key.enter  {
  grid-column: span 3; background: var(--gold);
  color: var(--on-gold); font-family: var(--font-body); font-size: 13px;
  font-weight: 700; letter-spacing: .04em; padding: 13px;
  border-color: var(--gold);
}
.pin-key.enter:hover { background: var(--gold-lt); }
.pin-error {
  text-align: center; font-size: 12px; color: var(--danger);
  margin-top: .6rem; min-height: 18px;
}
.login-theme-toggle {
  text-align: center; margin-top: 1.25rem;
}

/* ════════════════════════════════════════════
   APP SHELL
   ════════════════════════════════════════════ */
#app-shell { display: none; min-height: 100vh; }
#app-shell.visible { display: flex; }

/* ── SIDEBAR ── */
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; bottom: 0;
  z-index: 200;
  transition: transform .22s cubic-bezier(.4,0,.2,1), var(--transition);
}
.sidebar-brand {
  padding: 18px 16px 14px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
  flex-shrink: 0;
}
.sidebar-logo {
  width: 32px; height: 32px; border-radius: 8px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--gold-lt), var(--gold-dk));
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-size: 13px; font-weight: 700; color: var(--on-gold);
}
.sidebar-brand-text h2 {
  font-family: var(--font-display); font-size: 13px; font-weight: 700;
  color: var(--gold); letter-spacing: .04em;
}
.sidebar-brand-text p {
  font-size: 9px; color: var(--text3); letter-spacing: .1em; text-transform: uppercase;
}
.sidebar-nav {
  flex: 1; overflow-y: auto; padding: 8px 8px;
  scrollbar-width: none;
}
.sidebar-nav::-webkit-scrollbar { display: none; }
.nav-section-label {
  font-size: 9px; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--text3);
  padding: 10px 10px 4px; margin-top: 4px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: var(--radius-sm);
  color: var(--text2); font-size: 13px; font-weight: 500;
  cursor: pointer; transition: var(--transition);
  margin-bottom: 1px; position: relative;
}
.nav-item:hover { background: var(--surface2); color: var(--text); }
.nav-item.active {
  background: var(--gold-bg); color: var(--gold);
  box-shadow: inset 3px 0 0 var(--gold);
}
.nav-item .nav-icon {
  width: 16px; height: 16px; flex-shrink: 0; opacity: .7;
}
.nav-item.active .nav-icon { opacity: 1; }
.nav-badge {
  margin-left: auto; background: var(--danger);
  color: #fff; font-size: 9px; font-weight: 700;
  padding: 1px 5px; border-radius: 10px; min-width: 16px; text-align: center;
}
.sidebar-footer {
  padding: 10px 8px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.sidebar-user {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border-radius: var(--radius-sm);
}
.user-avatar {
  width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0;
  background: var(--gold-bg2); border: 1px solid var(--gold-border);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: var(--gold);
}
.user-info { flex: 1; min-width: 0; }
.user-name  { font-size: 11px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role  { font-size: 9px; color: var(--text3); text-transform: uppercase; letter-spacing: .08em; }
.btn-icon-sm {
  width: 28px; height: 28px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--text2); transition: var(--transition); flex-shrink: 0;
}
.btn-icon-sm:hover { background: var(--surface2); color: var(--text); }
.btn-icon-sm svg { width: 14px; height: 14px; }

/* ── MAIN CONTENT ── */
.main-wrap {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex; flex-direction: column;
  min-height: 100vh;
  transition: margin-left .22s cubic-bezier(.4,0,.2,1);
}
.topbar {
  height: var(--topbar-h); flex-shrink: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 1.5rem;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  position: sticky; top: 0; z-index: 100;
}
.topbar-left { display: flex; align-items: center; gap: 10px; }
.topbar-title {
  font-family: var(--font-display); font-size: 15px; font-weight: 700;
  color: var(--text);
}
.topbar-right { display: flex; align-items: center; gap: 6px; }
.page-content {
  flex: 1; padding: 1.5rem;
  width: 100%;
  margin: 0 auto;
}

/* ── BOTTOM NAV (mobile) ── */
.bottom-nav {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 200;
  height: var(--bottombar-h);
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 0 4px;
}
.bottom-nav-inner {
  display: flex; height: 100%;
  align-items: stretch;
}
.bottom-nav-item {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 3px;
  color: var(--text3); font-size: 9px; font-weight: 600;
  letter-spacing: .04em; text-transform: uppercase;
  cursor: pointer; transition: var(--transition);
  border-radius: var(--radius-sm); position: relative;
  padding: 6px 4px;
}
.bottom-nav-item svg { width: 20px; height: 20px; }
.bottom-nav-item.active { color: var(--gold); }
.bottom-nav-item .nav-badge {
  position: absolute; top: 5px; right: calc(50% - 16px);
}
.bottom-nav-more-menu {
  display: none; position: fixed;
  bottom: var(--bottombar-h); left: 0; right: 0;
  background: var(--surface); border-top: 1px solid var(--border);
  padding: 8px; z-index: 300;
  grid-template-columns: repeat(3,1fr); gap: 6px;
}
.bottom-nav-more-menu.open { display: grid; }
.more-item {
  display: flex; flex-direction: column; align-items: center;
  gap: 4px; padding: 10px 8px; border-radius: var(--radius);
  color: var(--text2); font-size: 10px; font-weight: 500;
  cursor: pointer; transition: var(--transition);
}
.more-item:hover { background: var(--surface2); color: var(--text); }
.more-item.active { color: var(--gold); }
.more-item svg { width: 20px; height: 20px; }

/* ── SIDEBAR OVERLAY (mobile) ── */
.sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.5); z-index: 150;
}
.sidebar-overlay.show { display: block; }

/* ════════════════════════════════════════════
   MODULE PAGES
   ════════════════════════════════════════════ */
.module-page { display: none; }
.module-page.active { display: block; }

/* ── Page header ── */
.page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  flex-wrap: wrap; gap: 12px; margin-bottom: 1.5rem;
}
.page-header-left h1 {
  font-family: var(--font-display); font-size: 22px; font-weight: 800;
  color: var(--text); letter-spacing: -.01em;
}
.page-header-left p {
  font-size: 12px; color: var(--text3); margin-top: 2px;
}
.page-header-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ── Stat cards ── */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px,1fr)); gap: 10px; margin-bottom: 1.25rem; }
.stat-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px;
  position: relative; overflow: hidden; min-width: 0;
}
.stat-card::before {
  content: ''; position: absolute; top: 0; left: 0;
  width: 3px; height: 100%; background: var(--gold);
}
.stat-card.danger::before  { background: var(--danger); }
.stat-card.success::before { background: var(--success); }
.stat-card.warning::before { background: var(--warning); }
.stat-card.info::before    { background: var(--info); }
.stat-label { font-size: 10px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--text3); margin-bottom: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-value {
  font-family: var(--font-display); font-weight: 800; line-height: 1;
  font-size: 26px; white-space: nowrap; overflow: visible;
  display: block;
}
.stat-value.gold    { color: var(--gold); }
.stat-value.danger  { color: var(--danger); }
.stat-value.success { color: var(--success); }
.stat-value.warning { color: var(--warning); }
.stat-value.info    { color: var(--info); }
.stat-sub { font-size: 10px; color: var(--text3); margin-top: 3px; }

/* ── Cards ── */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1.25rem;
  margin-bottom: 1rem; box-shadow: var(--shadow-sm);
}
@media (max-width: 768px) {
  .card { padding: .875rem; border-radius: 10px; }
  .modal-head { position: sticky; top: 0; background: var(--surface); z-index: 10; }
  .modal-footer { position: sticky; bottom: 0; background: var(--surface); z-index: 10; border-top: 1px solid var(--border); padding-top: .75rem; }
  #brk-sku-dd > div, #exp-add-sku-dd > div, #leave-staff-dd > div { padding: 12px 14px !important; min-height: 48px; }
  .form-control { font-size: 16px !important; }
  select.form-control { font-size: 16px !important; }
  .admin-tabs { scrollbar-width: none; }
  .admin-tabs::-webkit-scrollbar { display: none; }
  #toast-wrap { bottom: calc(var(--bottombar-h) + 12px) !important; }
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1rem; padding-bottom: .75rem;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap; gap: 8px;
}
.card-title {
  font-family: var(--font-display); font-size: 14px; font-weight: 700;
  color: var(--text); display: flex; align-items: center; gap: 8px;
}

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: var(--radius-sm);
  font-size: 12px; font-weight: 600; letter-spacing: .02em;
  transition: var(--transition); white-space: nowrap; border: 1px solid transparent;
  cursor: pointer; font-family: var(--font-body);
}
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn svg { width: 13px; height: 13px; }
.btn-primary { background: var(--gold); color: var(--on-gold); border-color: var(--gold); }
.btn-primary:hover:not(:disabled) { background: var(--gold-lt); }
.btn-secondary { background: var(--surface2); color: var(--text); border-color: var(--border2); }
.btn-secondary:hover:not(:disabled) { border-color: var(--gold); color: var(--gold); }
.btn-danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn-danger:hover:not(:disabled) { background: var(--danger-bg); }
.btn-success { background: var(--success); color: #fff; border-color: var(--success); }
.btn-warning { background: transparent; color: var(--warning); border-color: var(--warning); }
.btn-warning:hover:not(:disabled) { background: rgba(232,160,48,.15); }
.btn-ghost { background: none; border-color: transparent; color: var(--text2); }
.btn-ghost:hover { color: var(--text); background: var(--surface2); }
.btn-sm { padding: 5px 10px; font-size: 11px; }
.btn-lg { padding: 11px 22px; font-size: 13px; }

/* ── Forms ── */
.form-group { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.form-label {
  font-size: 10px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--text3);
}
.form-label .req { color: var(--gold); margin-left: 2px; }
.form-control {
  background: var(--surface2); border: 1px solid var(--border2);
  border-radius: var(--radius-sm); color: var(--text);
  padding: 9px 12px; font-size: 13px; outline: none;
  transition: var(--transition); width: 100%;
  font-family: var(--font-body);
}
.form-control:focus { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-bg); }
.form-control::placeholder { color: var(--text3); }
select.form-control {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23555a7a' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
  padding-right: 32px; appearance: none;
}
select.form-control option { background: var(--surface2); }
textarea.form-control { resize: vertical; min-height: 80px; }
.form-grid { display: grid; gap: 12px; }
.form-grid.g2 { grid-template-columns: 1fr 1fr; }
.form-grid.g3 { grid-template-columns: 1fr 1fr 1fr; }
.form-full { grid-column: 1/-1; }
.form-hint { font-size: 10px; color: var(--text3); margin-top: 2px; }

/* ── Table ── */
.table-wrap { overflow-x: auto; border-radius: var(--radius-lg); border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
thead { background: var(--surface2); }
th {
  padding: 10px 14px; text-align: left;
  font-size: 10px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--text3);
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
th.r, td.r { text-align: right; }
th.c, td.c { text-align: center; }
td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tbody tr { transition: background .1s; }
tbody tr:hover td { background: var(--surface2); }
.td-mono { font-family: var(--font-mono); font-size: 11px; }
.td-muted { color: var(--text3); font-size: 11px; }

/* ── Badges ── */
.badge {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  font-size: 10px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
}
.badge-gold    { background: var(--gold-bg);    color: var(--gold);    border: 1px solid var(--gold-border); }
.badge-danger  { background: var(--danger-bg);  color: var(--danger);  border: 1px solid rgba(224,82,82,.25); }
.badge-success { background: var(--success-bg); color: var(--success); border: 1px solid rgba(76,175,130,.25); }
.badge-warning { background: var(--warning-bg); color: var(--warning); border: 1px solid rgba(232,160,48,.25); }
.badge-info    { background: var(--info-bg);    color: var(--info);    border: 1px solid rgba(39,93,140,.25); }
.badge-neutral { background: var(--surface2);   color: var(--text2);   border: 1px solid var(--border2); }

/* ── Modal ── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(0,0,0,.65); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  padding: 1rem; opacity: 1; animation: fadeIn .15s ease;
}
.modal-overlay.hidden { display: none; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--surface); border: 1px solid var(--border2);
  border-radius: var(--radius-lg); padding: 1.5rem;
  width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: slideUp .2s ease;
}
@keyframes slideUp { from { transform: translateY(16px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.25rem; padding-bottom: .875rem;
  border-bottom: 1px solid var(--border);
}
.modal-title { font-family: var(--font-display); font-size: 16px; font-weight: 700; }
.modal-close {
  width: 28px; height: 28px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--text3); font-size: 18px; transition: var(--transition);
}
.modal-close:hover { background: var(--surface2); color: var(--text); }
.modal-footer {
  display: flex; gap: 8px; justify-content: flex-end;
  margin-top: 1.25rem; padding-top: .875rem;
  border-top: 1px solid var(--border);
}

/* ── Toast ── */
#toast-wrap {
  position: fixed; top: 1rem; right: 1rem; z-index: 9999;
  display: flex; flex-direction: column; gap: 6px;
  pointer-events: none;
}
.toast {
  background: var(--surface); border: 1px solid var(--border2);
  border-left: 3px solid var(--gold); color: var(--text);
  padding: 10px 14px; border-radius: var(--radius);
  font-size: 12px; min-width: 220px; max-width: 340px;
  box-shadow: var(--shadow); pointer-events: all;
  animation: toastIn .2s ease; line-height: 1.5;
}
.toast.success { border-left-color: var(--success); }
.toast.error   { border-left-color: var(--danger); }
.toast.info    { border-left-color: var(--info); }
@keyframes toastIn { from { opacity: 0; transform: translateX(12px); } to { opacity: 1; transform: none; } }

/* ── Empty state ── */
.empty-state {
  text-align: center; padding: 3rem 1rem; color: var(--text3);
}
.empty-state-icon { font-size: 2.5rem; margin-bottom: .75rem; opacity: .4; }
.empty-state h3   { font-size: 15px; color: var(--text2); margin-bottom: .35rem; }
.empty-state p    { font-size: 12px; }

/* ── Filter bar ── */
.filter-bar {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 12px 14px;
  display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap;
  margin-bottom: 1rem;
}
.filter-bar .form-group { margin-bottom: 0; min-width: 130px; }

/* ── Spinner ── */
.spinner {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--border2); border-top-color: var(--gold);
  animation: spin .65s linear infinite; display: inline-block;
  vertical-align: middle;
}
.spinner-lg { width: 32px; height: 32px; border-width: 3px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Loading overlay ── */
.loading-overlay {
  position: fixed; inset: 0; z-index: 800;
  background: rgba(15,17,23,.7); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center;
}
.loading-overlay.hidden { display: none; }

/* ════════════════════════════════════════════
   DASHBOARD MODULE
   ════════════════════════════════════════════ */
.dash-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px,1fr));
  gap: 12px; margin-bottom: 1.25rem;
}
.dash-module-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1.25rem;
  cursor: pointer; transition: var(--transition);
  display: flex; align-items: flex-start; gap: 14px;
}
.dash-module-card:hover {
  border-color: var(--gold-border); transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.dash-module-icon {
  width: 44px; height: 44px; border-radius: var(--radius); flex-shrink: 0;
  background: var(--gold-bg); border: 1px solid var(--gold-border);
  display: flex; align-items: center; justify-content: center; font-size: 20px;
}
.dash-module-info h3 { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 3px; }
.dash-module-info p  { font-size: 11px; color: var(--text3); line-height: 1.5; }
.dash-module-stats   { display: flex; gap: 10px; margin-top: 8px; flex-wrap: wrap; }
.dash-module-stat    { font-size: 10px; color: var(--text2); }
.dash-module-stat b  { color: var(--text); font-weight: 600; }

/* ════════════════════════════════════════════
   ADMIN MODULE
   ════════════════════════════════════════════ */
.admin-tabs {
  display: flex; gap: 2px; background: var(--surface2);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 3px; margin-bottom: 1.25rem; overflow-x: auto;
  scrollbar-width: none; flex-wrap: nowrap;
}
.admin-tabs::-webkit-scrollbar { display: none; }
.admin-tab {
  flex-shrink: 0; padding: 7px 14px; border-radius: var(--radius-sm);
  font-size: 11px; font-weight: 600; color: var(--text3);
  cursor: pointer; transition: var(--transition); white-space: nowrap;
  letter-spacing: .03em;
}
.admin-tab:hover  { color: var(--text); background: var(--surface); }
.admin-tab.active { background: var(--surface); color: var(--gold); box-shadow: var(--shadow-sm); }
.admin-panel { display: none; }
.admin-panel.active { display: block; }

/* ── PIN list ── */
.pin-list-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 0; border-bottom: 1px solid var(--border);
}
.pin-list-item:last-child { border-bottom: none; }
.pin-shop-code { font-family: var(--font-mono); font-size: 10px; color: var(--text3); width: 40px; flex-shrink: 0; }
.pin-shop-name { flex: 1; font-size: 13px; font-weight: 500; }
.pin-shop-type { font-size: 10px; color: var(--text3); text-transform: uppercase; letter-spacing: .06em; }
.pin-value     { font-family: var(--font-mono); font-size: 14px; letter-spacing: .15em; color: var(--text2); width: 60px; text-align: center; }
.pin-input     { font-family: var(--font-mono); letter-spacing: .12em; text-align: center; width: 90px; }

/* ════════════════════════════════════════════
   RESPONSIVE
   ════════════════════════════════════════════ */
@media (max-width: 768px) {
  /* Layout */
  .sidebar   { transform: translateX(-100%); bottom: var(--bottombar-h); }
  .sidebar.open { transform: translateX(0); }
  .main-wrap { margin-left: 0; padding-bottom: var(--bottombar-h); }
  .bottom-nav { display: block; }
  .page-content { padding: .75rem; }
  .topbar { padding: 0 .75rem; }

  /* Grids */
  .form-grid.g2, .form-grid.g3 { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .dash-grid { grid-template-columns: 1fr; }
  .section-grid, .grid2 { grid-template-columns: 1fr !important; }

  /* Modals — full screen on mobile */
  .modal-overlay { align-items: flex-end; padding: 0; }
  .modal {
    max-width: 100% !important;
    width: 100% !important;
    border-radius: 16px 16px 0 0;
    max-height: 92vh;
    overflow-y: auto;
  }

  /* Tables — horizontal scroll with momentum */
  .card { padding: .75rem; }
  table { font-size: 11px; }
  th, td { padding: 6px 6px !important; }
  div[style*="overflow-x:auto"] { -webkit-overflow-scrolling: touch; }

  /* Buttons — larger touch targets */
  .btn { min-height: 40px; padding: 8px 14px; }
  .btn-sm { min-height: 36px; }
  .pin-key { height: 64px !important; font-size: 22px !important; }

  /* Filter bar — stack on mobile */
  .filter-bar { flex-direction: column; gap: 8px; }
  .filter-bar .form-group { width: 100%; }

  /* Page headers */
  .page-header { flex-direction: column; align-items: flex-start; gap: 8px; }
  .page-header-actions { flex-wrap: wrap; width: 100%; }
  .page-header-actions .btn { flex: 1; min-width: 0; text-align: center; }

  /* Admin tabs — scrollable horizontal */
  .admin-tabs { overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; padding-bottom: 4px; }
  .admin-tab { white-space: nowrap; }

  /* Breakage form — better on mobile */
  #brk-report .form-group { margin-bottom: .75rem; }

  /* FOC items — stack columns */
  #foc-items-list > div { grid-template-columns: 1fr 1fr !important; }

  /* Org chart — single column */
  #staff-org-body > div > div[style*="grid"] { grid-template-columns: 1fr !important; }

  /* Hide less important table columns on mobile */
  .hide-mobile { display: none !important; }

  /* Stat values — slightly smaller */
  .stat-value { font-size: 22px !important; }

  /* Leave calendar — horizontal scroll */
  #lcal-body { overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* OOS table */
  #stk-oos-body { overflow-x: auto; -webkit-overflow-scrolling: touch; }
}

@media (max-width: 480px) {
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .kpi-grid { flex-direction: column; }
  #foc-items-list > div { grid-template-columns: 1fr !important; }
  .modal { max-height: 96vh; }
  .page-content { padding: .5rem; }
}

@media (max-width: 400px) {
  .stat-grid { grid-template-columns: 1fr; }
  .pin-list-item { flex-wrap: wrap; }
  .pin-key { height: 56px !important; }
}
