/* ============================================================
   Metro Eye Point — Design System
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;1,9..40,300&family=DM+Mono:wght@300;400&display=swap');

:root {
  --bg: #0a0a0a;
  --bg2: #111111;
  --bg3: #191919;
  --bg4: #222222;
  --border: #2a2a2a;
  --border2: #333333;
  --text: #f5f5f7;
  --text2: #a1a1a6;
  --text3: #636366;
  --gold: #d4a94c;
  --gold-dim: #b8922e;
  --gold-light: rgba(212,169,76,0.12);
  --gold-glow: rgba(212,169,76,0.25);
  --blue: #0a84ff;
  --green: #30d158;
  --red: #ff453a;
  --orange: #ff9f0a;
  --purple: #bf5af2;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --shadow: 0 2px 20px rgba(0,0,0,0.5);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.6);
  --nav-w: 240px;
  --header-h: 60px;
  --transition: 0.2s cubic-bezier(0.4,0,0.2,1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; -webkit-font-smoothing: antialiased; }
body { font-family: 'DM Sans', -apple-system, sans-serif; background: var(--bg); color: var(--text); line-height: 1.6; min-height: 100vh; }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg2); }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }

/* ============================================================ LAYOUT */
.app-layout { display: flex; min-height: 100vh; }

/* ============================================================ SIDEBAR */
.sidebar {
  width: var(--nav-w);
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform var(--transition);
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding-bottom: env(safe-area-inset-bottom, 16px);
}

.sidebar-close-btn {
  display: none;
  position: absolute;
  top: 14px; right: 14px;
  z-index: 10;
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: 8px;
  color: var(--text2);
  width: 34px; height: 34px;
  font-size: 15px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  transition: color var(--transition), background var(--transition);
  flex-shrink: 0;
}
.sidebar-close-btn:hover { color: var(--red); background: rgba(255,69,58,0.1); }

/* Logo */
.sidebar-logo {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.sidebar-logo .logo-text { font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text); line-height: 1.3; }
.sidebar-logo .logo-sub  { font-size: 10px; color: var(--text3); letter-spacing: 0.05em; text-transform: uppercase; }

/* Nav */
.nav-section { padding: 8px 0; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.nav-section-label { font-size: 10px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text3); padding: 8px 20px 4px; }
.nav-link { display: flex; align-items: center; gap: 10px; padding: 9px 20px; color: var(--text2); text-decoration: none; font-size: 14px; font-weight: 400; transition: color var(--transition), background var(--transition); position: relative; }
.nav-link:hover { color: var(--text); background: var(--bg3); }
.nav-link.active { color: var(--gold); background: var(--gold-light); }
.nav-link.active::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--gold); border-radius: 0 2px 2px 0; }
.nav-link .nav-icon { width: 18px; font-size: 13px; text-align: center; flex-shrink: 0; opacity: 0.8; }

.sidebar-footer { margin-top: auto; padding: 16px 20px; border-top: 1px solid var(--border); flex-shrink: 0; }
.user-chip { display: flex; align-items: center; gap: 10px; }
.user-avatar { width: 32px; height: 32px; border-radius: 50%; background: linear-gradient(135deg, var(--gold-light), var(--gold-glow)); border: 1px solid var(--gold); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; color: var(--gold); flex-shrink: 0; }
.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 13px; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 11px; color: var(--text3); }
.logout-btn { color: var(--text3); text-decoration: none; font-size: 16px; transition: color var(--transition); }
.logout-btn:hover { color: var(--red); }

/* ============================================================ MAIN CONTENT */
.main-content { margin-left: var(--nav-w); flex: 1; display: flex; flex-direction: column; min-width: 0; }

.top-bar { height: var(--header-h); background: var(--bg2); border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; padding: 0 24px; position: sticky; top: 0; z-index: 50; }
.top-bar-left { display: flex; align-items: center; gap: 16px; }
.mobile-toggle { display: none; background: none; border: none; color: var(--text2); font-size: 18px; cursor: pointer; padding: 4px; }
.page-title { font-size: 16px; font-weight: 600; color: var(--text); letter-spacing: -0.01em; }
.breadcrumb { font-size: 12px; color: var(--text3); }
.top-bar-right { display: flex; align-items: center; gap: 12px; }
.store-badge { background: var(--gold-light); border: 1px solid var(--gold-dim); color: var(--gold); font-size: 11px; font-weight: 600; padding: 3px 10px; border-radius: 20px; letter-spacing: 0.05em; text-transform: uppercase; }
.page-content { padding: 24px; flex: 1; }

/* ============================================================ CARDS */
.card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.card-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.card-title { font-size: 14px; font-weight: 600; color: var(--text); letter-spacing: -0.01em; }
.card-body { padding: 20px; }

/* ============================================================ STAT CARDS */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; position: relative; overflow: hidden; transition: border-color var(--transition), transform var(--transition); }
.stat-card:hover { border-color: var(--border2); transform: translateY(-1px); }
.stat-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px; background: linear-gradient(90deg, var(--gold), transparent); opacity: 0; transition: opacity var(--transition); }
.stat-card:hover::before { opacity: 1; }
.stat-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text3); margin-bottom: 8px; }
.stat-value { font-size: 26px; font-weight: 600; color: var(--text); letter-spacing: -0.02em; line-height: 1; margin-bottom: 6px; font-variant-numeric: tabular-nums; }
.stat-value.gold { color: var(--gold); }
.stat-value.green { color: var(--green); }
.stat-value.red { color: var(--red); }
.stat-value.blue { color: var(--blue); }
.stat-sub { font-size: 11px; color: var(--text3); }
.fin-kpi { font-size: clamp(14px, 1.6vw, 22px) !important; word-break: break-all; }
.stat-icon { position: absolute; top: 16px; right: 16px; font-size: 20px; opacity: 0.15; }

/* ============================================================ REPORT HUB CARDS */
.report-hub-card { cursor: pointer; }
.report-hub-card:hover { transform: translateY(-3px) !important; }
.report-hub-icon { font-size: 28px; margin-bottom: 12px; }
.report-hub-icon-sales    { color: var(--gold); }
.report-hub-icon-stock    { color: var(--blue); }
.report-hub-icon-purchase { color: var(--orange); }
.report-hub-icon-transfer { color: var(--purple); }
.report-hub-icon-promo    { color: var(--red); }
.report-hub-icon-master   { color: var(--green); }
.report-hub-title { font-size: 15px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.report-hub-desc  { font-size: 12px; color: var(--text3); margin-top: 4px; line-height: 1.5; }
.report-hub-badges { margin-top: 10px; display: flex; gap: 4px; flex-wrap: wrap; }
.master-report-card { border-color: var(--gold-dim) !important; background: var(--gold-light) !important; }

/* ============================================================ GRID */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

/* ============================================================ TABLES */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
thead tr { background: var(--bg3); border-bottom: 1px solid var(--border); }
th { padding: 10px 14px; text-align: left; font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text3); white-space: nowrap; }
td { padding: 11px 14px; color: var(--text2); border-bottom: 1px solid var(--border); }
tr:last-child td { border-bottom: none; }
tbody tr { transition: background var(--transition); }
tbody tr:hover { background: var(--bg3); }
td .strong { color: var(--text); font-weight: 500; }
td .mono { font-family: 'DM Mono', monospace; font-size: 12px; color: var(--gold); }

/* Sort arrows */
.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
.sortable:hover { color: var(--gold); }
.sort-arrow { display: inline-flex; flex-direction: column; gap: 1px; margin-left: 4px; vertical-align: middle; opacity: 0.35; transition: opacity 0.15s; }
.sortable:hover .sort-arrow { opacity: 0.7; }
.sort-arrow.asc  .sa-up   { opacity: 1; color: var(--gold); }
.sort-arrow.desc .sa-down { opacity: 1; color: var(--gold); }
.sa-up, .sa-down { font-size: 8px; line-height: 1; display: block; }

/* ============================================================ FORMS */
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.form-row { display: flex; gap: 16px; flex-wrap: wrap; }
.form-group { display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 180px; }
.form-group.full { flex: 0 0 100%; min-width: 100%; }
.form-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text3); }
.form-control {
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 9px 12px;
  font-size: 14px;
  font-family: inherit;
  width: 100%;
  transition: border-color var(--transition), box-shadow var(--transition);
  -webkit-appearance: none;
  appearance: none;
}
.form-control:focus { outline: none; border-color: var(--gold-dim); box-shadow: 0 0 0 3px var(--gold-light); }
.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='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23636366' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
  cursor: pointer;
}
.form-hint { font-size: 11px; color: var(--text3); }

/* ============================================================ BUTTONS */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 9px 18px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 500; font-family: inherit; letter-spacing: 0.02em; cursor: pointer; border: 1px solid transparent; text-decoration: none; transition: all var(--transition); white-space: nowrap; -webkit-tap-highlight-color: transparent; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary  { background: var(--blue);  color: #fff; border-color: var(--blue); }
.btn-primary:hover { background: #0077e6; }
.btn-gold     { background: var(--gold);  color: #000; border-color: var(--gold); font-weight: 600; }
.btn-gold:hover { background: #c49440; }
.btn-danger   { background: var(--red);   color: #fff; border-color: var(--red); }
.btn-danger:hover { background: #e03d33; }
.btn-success  { background: var(--green); color: #000; border-color: var(--green); font-weight: 600; }
.btn-success:hover { background: #25b84a; }
.btn-outline  { background: transparent; border-color: var(--border2); color: var(--text2); }
.btn-outline:hover { border-color: var(--text3); color: var(--text); background: var(--bg3); }
.btn-ghost    { background: transparent; border-color: transparent; color: var(--text3); }
.btn-ghost:hover { color: var(--text); background: var(--bg3); }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }
.btn-icon { padding: 8px; border-radius: var(--radius-sm); }

/* ============================================================ BADGES */
.badge { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 20px; font-size: 11px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }
.badge-green  { background: rgba(48,209,88,0.12);  color: var(--green); }
.badge-red    { background: rgba(255,69,58,0.12);  color: var(--red); }
.badge-orange { background: rgba(255,159,10,0.12); color: var(--orange); }
.badge-gold   { background: var(--gold-light);     color: var(--gold); }
.badge-blue   { background: rgba(10,132,255,0.12); color: var(--blue); }
.badge-gray   { background: var(--bg4);            color: var(--text3); }
.badge-purple { background: rgba(191,90,242,0.12); color: var(--purple); }

/* ============================================================ ALERTS */
.alert { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 20px; border-radius: 8px; font-size: 13px; font-weight: 500; letter-spacing: 0.01em; margin-bottom: 0; animation: slideDown 0.25s ease; box-shadow: 0 2px 12px rgba(0,0,0,0.12); }
@keyframes slideDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }
.alert-success { background: rgba(48,209,88,0.1);  border: 1px solid rgba(48,209,88,0.2);  color: #30d158; }
.alert-danger  { background: rgba(255,69,58,0.1);  border: 1px solid rgba(255,69,58,0.2);  color: #ff453a; }
.alert-warning { background: rgba(255,159,10,0.1); border: 1px solid rgba(255,159,10,0.2); color: #ff9f0a; }
.alert-info    { background: rgba(10,132,255,0.1); border: 1px solid rgba(10,132,255,0.2); color: #0a84ff; }
.alert-close   { margin-left: auto; background: none; border: none; color: currentColor; cursor: pointer; opacity: 0.6; font-size: 16px; line-height: 1; flex-shrink: 0; }

/* ============================================================ DIVIDER */
.divider { border: none; border-top: 1px solid var(--border); margin: 16px 0; }

/* ============================================================ PAGINATION */
.pagination { display: flex; align-items: center; gap: 4px; justify-content: center; padding: 16px 0; }
.page-btn { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: var(--radius-sm); font-size: 13px; text-decoration: none; color: var(--text2); border: 1px solid transparent; transition: all var(--transition); }
.page-btn:hover { background: var(--bg3); color: var(--text); }
.page-btn.active { background: var(--gold); color: #000; font-weight: 600; }
.page-btn.disabled { opacity: 0.3; pointer-events: none; }
.page-jump-wrap { display:inline-flex;align-items:center;gap:5px;margin-left:8px;font-size:12px;color:var(--text3); }
.page-jump-wrap input { width:52px;padding:3px 6px;border-radius:var(--radius-sm);border:1px solid var(--border2);background:var(--bg3);color:var(--text);font-size:12px;text-align:center; }
.page-jump-wrap input:focus { outline:none;border-color:var(--gold); }

/* Sub-links under a parent nav item */
.nav-sub-link { padding-left:40px !important; font-size:12.5px; }
.nav-sub-link .nav-icon { font-size:11px; width:16px; }

/* ============================================================ MODALS */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.7); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 20px; opacity: 0; visibility: hidden; transition: opacity 0.25s, visibility 0.25s; }
.modal-overlay.open { opacity: 1; visibility: visible; }
.modal { background: var(--bg2); border: 1px solid var(--border2); border-radius: var(--radius-lg); width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto; transform: translateY(12px) scale(0.98); transition: transform 0.25s; }
.modal-overlay.open .modal { transform: translateY(0) scale(1); }
.modal-lg { max-width: 760px; }
.modal-xl { max-width: 960px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.modal-title { font-size: 15px; font-weight: 600; }
.modal-close { background: none; border: none; color: var(--text3); font-size: 20px; cursor: pointer; transition: color var(--transition); line-height: 1; }
.modal-close:hover { color: var(--text); }
.modal-body { padding: 20px; }
.modal-footer { padding: 16px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }

/* ============================================================ POS */
.pos-layout { display: grid; grid-template-columns: 1fr 380px; gap: 16px; height: calc(100vh - var(--header-h) - 48px); }
.pos-cart { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius-lg); display: flex; flex-direction: column; overflow: hidden; }
.pos-panel { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius-lg); display: flex; flex-direction: column; overflow: visible; }
.pos-search-bar { padding: 14px 16px; border-bottom: 1px solid var(--border); display: flex; gap: 8px; align-items: center; }
.pos-search-bar input { flex: 1; background: var(--bg3); border: 1px solid var(--border2); border-radius: var(--radius-sm); color: var(--text); padding: 9px 12px 9px 36px; font-size: 14px; font-family: inherit; }
.pos-search-bar input:focus { outline: none; border-color: var(--gold-dim); }
.search-wrap { position: relative; flex: 1; }
.search-icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--text3); font-size: 14px; }
.cart-items { flex: 1; overflow-y: auto; padding: 8px; }
.cart-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--radius-sm); border: 1px solid var(--border); margin-bottom: 8px; background: var(--bg3); animation: fadeIn 0.15s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
.cart-item-info { flex: 1; min-width: 0; }
.cart-item-name  { font-size: 13px; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cart-item-code  { font-size: 11px; color: var(--text3); font-family: 'DM Mono', monospace; }
.cart-item-price { font-size: 13px; font-weight: 600; color: var(--gold); text-align: right; }
.cart-item-promo { font-size: 11px; color: var(--green); }
.qty-control { display: flex; align-items: center; gap: 4px; }
.qty-btn { width: 26px; height: 26px; border-radius: 6px; border: 1px solid var(--border2); background: var(--bg4); color: var(--text); font-size: 14px; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: background var(--transition); }
.qty-btn:hover { background: var(--border2); }
.qty-display { width: 32px; text-align: center; font-size: 13px; font-weight: 600; color: var(--text); background: none; border: none; font-family: 'DM Mono', monospace; }
.remove-btn { width: 26px; height: 26px; border-radius: 6px; border: 1px solid transparent; background: transparent; color: var(--text3); cursor: pointer; font-size: 14px; display: flex; align-items: center; justify-content: center; transition: all var(--transition); }
.remove-btn:hover { color: var(--red); background: rgba(255,69,58,0.1); }
.cart-totals { padding: 12px 16px; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.total-row { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--text2); padding: 3px 0; }
.total-row.grand { font-size: 18px; font-weight: 700; color: var(--gold); padding-top: 8px; margin-top: 4px; border-top: 1px solid var(--border); }
.cart-actions { padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; }

/* ============================================================ INVOICE PRINT */
@media print {
  body { background: #fff !important; color: #000 !important; }
  .no-print { display: none !important; }
  .invoice-wrap { box-shadow: none !important; margin: 0 !important; }
}
.invoice-wrap { max-width: 680px; margin: 0 auto; background: #fff; color: #111; font-family: 'DM Sans', sans-serif; padding: 48px; }
.invoice-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 40px; padding-bottom: 24px; border-bottom: 2px solid #111; }
.invoice-brand { font-size: 20px; font-weight: 700; letter-spacing: 0.15em; text-transform: uppercase; }
.invoice-brand-sub { font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: #666; margin-top: 4px; }
.invoice-meta { text-align: right; }
.invoice-no { font-size: 22px; font-weight: 700; letter-spacing: 0.05em; font-family: 'DM Mono', monospace; }
.invoice-date { font-size: 12px; color: #666; margin-top: 4px; }
.invoice-party { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-bottom: 32px; }
.invoice-party-label { font-size: 10px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: #999; margin-bottom: 6px; }
.invoice-party-name { font-size: 15px; font-weight: 600; }
.invoice-party-sub { font-size: 13px; color: #555; margin-top: 2px; }
.invoice-table { width: 100%; border-collapse: collapse; margin-bottom: 24px; }
.invoice-table th { border-bottom: 1px solid #111; padding: 8px 0; text-align: left; font-size: 10px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: #333; }
.invoice-table td { border-bottom: 1px solid #eee; padding: 10px 0; font-size: 13px; color: #333; vertical-align: top; }
.invoice-table td:last-child, .invoice-table th:last-child { text-align: right; }
.invoice-totals { width: 100%; max-width: 280px; margin-left: auto; margin-bottom: 32px; }
.invoice-total-row { display: flex; justify-content: space-between; padding: 5px 0; font-size: 13px; color: #555; }
.invoice-total-row.final { border-top: 2px solid #111; font-size: 16px; font-weight: 700; color: #111; padding-top: 10px; margin-top: 6px; }
.invoice-footer { border-top: 1px solid #ddd; padding-top: 16px; font-size: 11px; color: #999; text-align: center; letter-spacing: 0.04em; }
.item-promo { font-size: 8px; color: #555; letter-spacing: 0.03em; margin-top: 2px; }   /* ← ADD THIS LINE */

/* ============================================================ SEARCH DROPDOWN */
.search-dropdown { position: absolute; top: calc(100% + 4px); left: 0; right: 0; background: var(--bg2); border: 1px solid var(--border2); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); z-index: 200; max-height: 280px; overflow-y: auto; }
.dropdown-item { padding: 10px 14px; cursor: pointer; border-bottom: 1px solid var(--border); transition: background var(--transition); }
.dropdown-item:last-child { border-bottom: none; }
.dropdown-item:hover { background: var(--bg3); }
.dropdown-item .item-name  { font-size: 13px; color: var(--text); }
.dropdown-item .item-meta  { font-size: 11px; color: var(--text3); margin-top: 2px; }
.dropdown-item .item-price { font-size: 13px; font-weight: 600; color: var(--gold); }
.dropdown-item .item-stock { font-size: 11px; color: var(--text3); }

/* ============================================================ UTILITIES */
.text-gold   { color: var(--gold); }
.text-green  { color: var(--green); }
.text-red    { color: var(--red); }
.text-orange { color: var(--orange); }
.text-muted  { color: var(--text3); }
.text-sm     { font-size: 12px; }
.text-xs     { font-size: 11px; }
.text-right  { text-align: right; }
.text-center { text-align: center; }
.mono        { font-family: 'DM Mono', monospace; }
.fw-600      { font-weight: 600; }
.fw-700      { font-weight: 700; }
.strong      { color: var(--text); font-weight: 500; }
.mt-auto     { margin-top: auto; }
.mb-16       { margin-bottom: 16px; }
.mb-24       { margin-bottom: 24px; }
.gap-8       { gap: 8px; }
.flex        { display: flex; }
.flex-wrap   { flex-wrap: wrap; }
.align-center    { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-end     { justify-content: flex-end; }
.hidden      { display: none !important; }

/* ============================================================ EMPTY STATE */
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 60px 20px; text-align: center; }
.empty-icon  { font-size: 40px; margin-bottom: 12px; opacity: 0.3; }
.empty-title { font-size: 15px; font-weight: 600; color: var(--text2); margin-bottom: 6px; }
.empty-sub   { font-size: 13px; color: var(--text3); }

/* ============================================================ SPINNER */
.spinner { width: 20px; height: 20px; border: 2px solid var(--border2); border-top-color: var(--gold); border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================ STATUS DOTS */
.status-dot { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; }
.status-dot::before { content: ''; width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.status-pending::before  { background: var(--orange); }
.status-approved::before { background: var(--green); }
.status-rejected::before { background: var(--red); }

/* ============================================================ BARCODE */
.barcode-text { font-family: 'DM Mono', monospace; font-size: 12px; color: var(--gold); letter-spacing: 0.05em; }

/* ============================================================ TRANSFER STOCK WARNING */
.stock-warning { color: var(--red); font-size: 11px; margin-top: 3px; display: none; }
.stock-warning.visible { display: block; }
.stock-ok { color: var(--green); font-size: 11px; margin-top: 3px; }

/* ============================================================ PROMO MECHANIC */
.mechanic-fields { display: none; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px; background: var(--bg3); margin-top: 8px; gap: 16px; flex-wrap: wrap; }
.mechanic-fields.active { display: flex; }

/* ============================================================ RETURN STYLES */
.return-status-pending  { color: var(--orange); }
.return-status-approved { color: var(--green); }
.return-status-rejected { color: var(--red); }

/* ============================================================ FLASH BAR */
.flash-bar { position: sticky; top: var(--header-h); z-index: 90; padding: 0 24px; pointer-events: none; }
.flash-bar .alert { pointer-events: auto; margin-top: 8px; }

/* ============================================================ THEME TOGGLE */
.theme-toggle { width: 44px; height: 24px; background: var(--bg4); border: 1px solid var(--border2); border-radius: 12px; cursor: pointer; position: relative; transition: background 0.3s, border-color 0.3s; flex-shrink: 0; padding: 0; }
.theme-toggle::after { content: ''; position: absolute; left: 3px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; border-radius: 50%; background: var(--text3); transition: left 0.25s cubic-bezier(0.4,0,0.2,1), background 0.3s; }
[data-theme="light"] .theme-toggle { background: var(--gold-light); border-color: var(--gold-dim); }
[data-theme="light"] .theme-toggle::after { left: calc(100% - 19px); background: var(--gold-dim); }
.theme-toggle-wrap { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--text3); }
.theme-toggle-icon { font-size: 13px; transition: color 0.3s; }

/* ============================================================ PROMO BANNER */
.promo-banner-wrap { position: fixed; bottom: 28px; right: 28px; z-index: 500; animation: bannerFloat 3s ease-in-out infinite; }
@keyframes bannerFloat { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
.promo-banner-close { position: absolute; top: -8px; right: -8px; width: 22px; height: 22px; background: var(--bg4); border: 1px solid var(--border2); border-radius: 50%; font-size: 12px; cursor: pointer; display: flex; align-items: center; justify-content: center; color: var(--text3); transition: color 0.15s; }
.promo-banner-close:hover { color: var(--red); }

/* ============================================================ SALE SUCCESS */
.sale-modal-box { background: var(--bg2); border: 1px solid var(--border2); border-radius: 16px; padding: 32px 28px; max-width: 400px; width: 92%; text-align: center; animation: popIn 0.25s cubic-bezier(0.34,1.56,0.64,1); box-shadow: 0 20px 60px rgba(0,0,0,0.5); }

/* ============================================================
   LANDING / LOGIN
   ============================================================ */
.landing-hero { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; background: #0a0a0a; text-align: center; padding: 40px 20px; position: relative; overflow: hidden; }
.landing-hero::before { content: ''; position: absolute; top: -200px; left: 50%; transform: translateX(-50%); width: 600px; height: 600px; background: radial-gradient(circle, rgba(212,169,76,0.08) 0%, transparent 70%); pointer-events: none; }
.landing-logo  { font-size: 11px; letter-spacing: 0.3em; text-transform: uppercase; color: var(--gold); margin-bottom: 48px; }
.landing-title { font-size: clamp(36px, 8vw, 72px); font-weight: 300; letter-spacing: -0.02em; line-height: 1.05; color: var(--text); margin-bottom: 20px; }
.landing-title strong { font-weight: 700; background: linear-gradient(135deg, var(--gold), #f0d080); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.landing-sub    { font-size: 17px; color: var(--text3); max-width: 480px; line-height: 1.7; margin-bottom: 48px; }
.landing-divider{ width: 40px; height: 1px; background: var(--gold); margin: 0 auto 48px; }
.login-page  { min-height: 100vh; display: flex; align-items: stretch; }
.login-left  { flex: 1; background: var(--bg2); border-right: 1px solid var(--border); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 60px 40px; position: relative; overflow: hidden; }
.login-left::before { content: ''; position: absolute; bottom: -100px; right: -100px; width: 400px; height: 400px; background: radial-gradient(circle, rgba(212,169,76,0.06) 0%, transparent 70%); }
.login-right { width: 440px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; padding: 40px; background: var(--bg); }
.login-box   { width: 100%; max-width: 360px; }
.login-brand   { font-size: 10px; letter-spacing: 0.3em; text-transform: uppercase; color: var(--gold); margin-bottom: 32px; }
.login-heading { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 8px; }
.login-sub     { font-size: 14px; color: var(--text3); margin-bottom: 32px; }

/* ============================================================
   SIDEBAR OVERLAY (mobile)
   ============================================================ */
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.6); z-index: 99; }
.sidebar-overlay.open { display: block; }

/* ============================================================
   LIGHT THEME
   ============================================================ */
[data-theme="light"] {
  --bg:       #f7f4ef;
  --bg2:      #ffffff;
  --bg3:      #f0ece4;
  --bg4:      #e8e2d8;
  --border:   #e2dbd0;
  --border2:  #d4cdc1;
  --text:     #1a1714;
  --text2:    #4a453f;
  --text3:    #8a8178;
  --gold:        #b07d2a;
  --gold-dim:    #96691e;
  --gold-light:  rgba(176,125,42,0.10);
  --gold-glow:   rgba(176,125,42,0.20);
  --blue:    #1a6ef5;
  --green:   #1a8a3a;
  --red:     #d93025;
  --orange:  #c46a00;
  --purple:  #7c3aed;
  --shadow:    0 2px 16px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
}

/* Scrollbar light */
[data-theme="light"] ::-webkit-scrollbar-track { background: var(--bg3); }
[data-theme="light"] ::-webkit-scrollbar-thumb { background: var(--border2); }

/* Sidebar stays DARK in light mode so logo is always visible */
[data-theme="light"] .sidebar {
  background: #1a1714;
  border-right-color: #2a2520;
}
[data-theme="light"] .sidebar .nav-section-label { color: #7a7470; }
[data-theme="light"] .sidebar .nav-section { border-bottom-color: #2a2520; }
[data-theme="light"] .sidebar .nav-link   { color: #b0a898; }
[data-theme="light"] .sidebar .nav-link:hover  { color: #f5f0e8; background: rgba(255,255,255,0.06); }
[data-theme="light"] .sidebar .nav-link.active { color: var(--gold); background: rgba(176,125,42,0.15); }
[data-theme="light"] .sidebar .user-name  { color: #f5f0e8; }
[data-theme="light"] .sidebar .user-role  { color: #7a7470; }
[data-theme="light"] .sidebar .logo-text  { color: var(--gold); }
[data-theme="light"] .sidebar .logo-sub   { color: #7a7470; }
[data-theme="light"] .sidebar .sidebar-footer { border-top-color: #2a2520; }
[data-theme="light"] .sidebar .theme-toggle-wrap span { color: #7a7470; }
[data-theme="light"] .sidebar-close-btn { background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.12); color: #b0a898; }
[data-theme="light"] .sidebar-close-btn:hover { color: var(--red); }
[data-theme="light"] .user-avatar { border-color: var(--gold); color: var(--gold); background: var(--gold-light); }
[data-theme="light"] .logout-btn { color: #7a7470; }

/* Top bar light */
[data-theme="light"] .top-bar { background: var(--bg2); border-bottom-color: var(--border); box-shadow: 0 1px 8px rgba(0,0,0,0.05); }

/* Cards light */
[data-theme="light"] .card, [data-theme="light"] .stat-card, [data-theme="light"] .chart-card,
[data-theme="light"] .pos-panel, [data-theme="light"] .pos-cart { background: var(--bg2); border-color: var(--border); box-shadow: 0 1px 8px rgba(0,0,0,0.05); }

/* Tables light */
[data-theme="light"] thead tr { background: var(--bg3); }
[data-theme="light"] tbody tr:hover { background: var(--bg3); }
[data-theme="light"] td { border-bottom-color: var(--border); }
[data-theme="light"] .table-wrap { border-color: var(--border); }

/* Forms light */
[data-theme="light"] .form-control { background: var(--bg3); border-color: var(--border2); color: var(--text); }
[data-theme="light"] .form-control:focus { border-color: var(--gold-dim); box-shadow: 0 0 0 3px var(--gold-light); }
[data-theme="light"] .form-control::placeholder { color: var(--text3); }

/* ── LIGHT MODE SELECT FIX — the key fix for dropdown appearance ── */
[data-theme="light"] select,
[data-theme="light"] select.form-control {
  -webkit-appearance: none !important;
  appearance: none !important;
  background-color: var(--bg3) !important;
  color: var(--text) !important;
  border-color: var(--border2) !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%234a453f' d='M6 8L1 3h10z'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 12px center !important;
  padding-right: 32px !important;
}
[data-theme="light"] select option,
[data-theme="light"] select.form-control option {
  background-color: #f0ece4;
  color: #1a1714;
}

/* Buttons light */
[data-theme="light"] .btn-outline { border-color: var(--border2); color: var(--text2); }
[data-theme="light"] .btn-outline:hover { background: var(--bg3); color: var(--text); }
[data-theme="light"] .btn-ghost:hover { background: var(--bg3); color: var(--text); }

/* Dropdowns light */
[data-theme="light"] .search-dropdown { background: var(--bg2) !important; border-color: var(--border2) !important; box-shadow: 0 8px 24px rgba(0,0,0,0.12) !important; }
[data-theme="light"] .dropdown-item:hover { background: var(--bg3) !important; }

/* Cart items light */
[data-theme="light"] .cart-item  { background: var(--bg3); border-color: var(--border); }
[data-theme="light"] .qty-btn    { background: var(--bg4); border-color: var(--border2); }
[data-theme="light"] .qty-btn:hover { background: var(--border2); }

/* Modal light */
[data-theme="light"] .modal { background: var(--bg2); border-color: var(--border2); }

/* Alerts light */
[data-theme="light"] .alert-success { background:rgba(26,138,58,0.08);border-color:rgba(26,138,58,0.2);color:#1a8a3a; }
[data-theme="light"] .alert-danger  { background:rgba(217,48,37,0.08);border-color:rgba(217,48,37,0.2);color:#d93025; }
[data-theme="light"] .alert-warning { background:rgba(196,106,0,0.08);border-color:rgba(196,106,0,0.2);color:#c46a00; }
[data-theme="light"] .alert-info    { background:rgba(26,110,245,0.08);border-color:rgba(26,110,245,0.2);color:#1a6ef5; }

/* Badges light */
[data-theme="light"] .badge-gray { background: var(--bg4); color: var(--text3); }
[data-theme="light"] .badge-gold { background: var(--gold-light); color: var(--gold-dim); }

/* Store badge light */
[data-theme="light"] .store-badge { background: var(--gold-light); border-color: var(--gold-dim); color: var(--gold-dim); }

/* Pagination light */
[data-theme="light"] .page-btn { color: var(--text2); }
[data-theme="light"] .page-btn:hover { background: var(--bg3); color: var(--text); }

/* Report hub light */
[data-theme="light"] .report-hub-title { color: var(--text); }
[data-theme="light"] .master-report-card { border-color: var(--gold-dim) !important; background: var(--gold-light) !important; }

/* Login page light */
[data-theme="light"] .login-page { background: var(--bg); }
[data-theme="light"] .login-left {
  background: linear-gradient(150deg, #1a2340 0%, #131b30 55%, #0e1424 100%);
  border-right-color: rgba(255,255,255,0.06);
}
[data-theme="light"] .login-right { background: var(--bg2); }

/* Spinner light */
[data-theme="light"] .spinner { border-color: var(--border2); border-top-color: var(--gold-dim); }

/* Sale modal light */
[data-theme="light"] .sale-modal-box { background: #fff; box-shadow: 0 20px 60px rgba(0,0,0,0.15); }

/* ============================================================
   MOBILE / PWA — Full app-like experience
   ============================================================ */
@media (max-width: 768px) {
  :root { --nav-w: 270px; }

  /* Lock body when sidebar open */
  body.sidebar-open { overflow: hidden; position: fixed; width: 100%; }

  /* Sidebar: full-height overlay */
  .sidebar {
    transform: translateX(-100%);
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: var(--nav-w);
    z-index: 200;
    padding-top: env(safe-area-inset-top, 0);
    padding-bottom: env(safe-area-inset-bottom, 16px);
    max-height: 100dvh;
    max-height: 100vh;
  }
  .sidebar.open { transform: translateX(0); box-shadow: 4px 0 30px rgba(0,0,0,0.5); }

  /* Show close button on mobile */
  .sidebar-close-btn { display: flex; }

  /* Give room for close btn */
  .sidebar-logo { padding-right: 52px; }

  /* Overlay */
  .sidebar-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.65); z-index: 199; display: none; backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); }
  .sidebar-overlay.open { display: block; }

  /* Main */
  .main-content { margin-left: 0; width: 100%; }

  /* Top bar safe area */
  .top-bar {
    padding-top: env(safe-area-inset-top, 0);
    height: calc(var(--header-h) + env(safe-area-inset-top, 0));
  }

  /* Content bottom safe area */
  .page-content {
    padding: 16px;
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0));
  }

  /* Show hamburger */
  .mobile-toggle { display: flex; }

  /* Bigger touch targets on nav */
  .nav-link { padding: 11px 16px; font-size: 15px; }
  .nav-link .nav-icon { width: 20px; font-size: 15px; }
  .nav-section-label { padding: 6px 16px 3px; }

  /* POS responsive */
  .pos-layout { grid-template-columns: 1fr; height: auto; }
  .pos-cart { order: -1; }

  /* Grids */
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 12px; }

  /* Forms */
  .form-row { flex-direction: column; }

  /* Tables */
  .table-wrap { font-size: 12px; }
  th, td { padding: 9px 10px; }

  /* Invoice */
  .invoice-wrap { padding: 24px 16px; }
  .invoice-party { grid-template-columns: 1fr; }

  /* Login */
  .login-left { display: none; }
  .login-right { width: 100%; }
  .login-box { max-width: 400px; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .top-bar { padding: 0 16px; }
  .stat-value { font-size: 22px; }
  .btn { padding: 8px 14px; font-size: 13px; }
  .card-body { padding: 14px; }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .pos-layout { grid-template-columns: 1fr; height: auto; }
  .pos-cart { order: -1; }
}

/* ── Sortable table column arrows ── */
th.sortable { cursor: pointer; user-select: none; }
.sort-arrow { display: inline-flex; flex-direction: column; margin-left: 5px; font-size: 9px; line-height: 1; color: var(--text3); vertical-align: middle; }
.sort-arrow .sa-up,
.sort-arrow .sa-down { opacity: 0.25; }
.sort-arrow.asc  .sa-up   { opacity: 1; color: var(--gold); }
.sort-arrow.asc  .sa-down { opacity: 0.25; }
.sort-arrow.desc .sa-down { opacity: 1; color: var(--gold); }
.sort-arrow.desc .sa-up   { opacity: 0.25; }
