/* ============================================================
   DAWA PHARMACY MANAGEMENT SYSTEM
   Classic Enterprise Business UI
   Inspired by: Bloomberg Terminal × Classic Banking Software
   Fonts: Libre Baskerville (headings) + Source Sans 3 (body)
   Palette: Deep Navy · Warm Ivory · Brass Gold · Forest Green
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Libre+Baskerville:ital,wght@0,400;0,700;1,400&family=Source+Sans+3:wght@300;400;500;600;700&family=Source+Code+Pro:wght@400;600&display=swap');

/* ── DESIGN TOKENS ─────────────────────────────────────── */
:root {
  /* Core Palette */
  --navy:        #0d1b2a;
  --navy-mid:    #162232;
  --navy-light:  #1e3048;
  --navy-border: #253d58;
  --gold:        #b8860b;
  --gold-light:  #d4a017;
  --gold-pale:   #f5e6c0;
  --cream:       #faf8f3;
  --cream-dark:  #f0ece0;
  --white:       #ffffff;
  --forest:      #1a5c38;
  --forest-light:#237a4b;
  --forest-pale: #e8f5ee;
  --crimson:     #8b1a1a;
  --crimson-pale:#fdeaea;
  --amber:       #8b5e0a;
  --amber-pale:  #fff3d6;
  --slate:       #4a5568;
  --slate-light: #718096;
  --slate-pale:  #edf2f7;

  /* Semantic */
  --bg:          var(--cream);
  --bg-alt:      var(--cream-dark);
  --surface:     var(--white);
  --border:      #d8d0c0;
  --border-dark: #b8a888;
  --text-primary:   #1a1a1a;
  --text-secondary: var(--slate);
  --text-muted:     #8a8070;
  --text-inverse:   rgba(255,255,255,0.92);
  --text-inv-muted: rgba(255,255,255,0.52);

  /* Sidebar */
  --sidebar-w:    260px;
  --sidebar-bg:   var(--navy);
  --sidebar-mid:  var(--navy-mid);

  /* Typography */
  --font-heading: 'Libre Baskerville', Georgia, 'Times New Roman', serif;
  --font-body:    'Source Sans 3', 'Segoe UI', Helvetica, sans-serif;
  --font-mono:    'Source Code Pro', 'Courier New', monospace;

  /* Elevation */
  --shadow-sm:  0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.05);
  --shadow:     0 2px 8px rgba(0,0,0,0.09), 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md:  0 4px 16px rgba(0,0,0,0.11), 0 2px 6px rgba(0,0,0,0.07);
  --shadow-lg:  0 8px 32px rgba(0,0,0,0.14), 0 4px 12px rgba(0,0,0,0.08);

  /* Radius */
  --r-sm:  3px;
  --r:     5px;
  --r-md:  7px;
  --r-lg:  10px;

  /* Transitions */
  --t:    all 0.18s ease;
  --t-slow: all 0.32s ease;
}

/* ── RESET ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; scroll-behavior: smooth; -webkit-font-smoothing: antialiased; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}
a { color: var(--forest); text-decoration: none; transition: var(--t); }
a:hover { color: var(--forest-light); }
img { max-width: 100%; }
button { font-family: var(--font-body); }
input, select, textarea { font-family: var(--font-body); }

/* ── SCROLLBAR ──────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--cream-dark); }
::-webkit-scrollbar-thumb { background: var(--border-dark); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--slate-light); }

/* ── APP SHELL ──────────────────────────────────────────── */
.app-wrap { display: flex; min-height: 100vh; }

/* ── SIDEBAR ─────────────────────────────────────────────
   Classic deep-navy sidebar with gold rule accents
   ─────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 200;
  border-right: 1px solid var(--navy-border);
  transition: var(--t-slow);
}
.sidebar::-webkit-scrollbar { width: 3px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: var(--navy-border); }

/* Brand Block */
.sidebar-brand {
  padding: 22px 20px 18px;
  border-bottom: 1px solid var(--navy-border);
  display: flex;
  align-items: center;
  gap: 13px;
  background: var(--navy-mid);
}
.sidebar-brand .brand-logo {
  width: 40px; height: 40px;
  background: var(--gold);
  border-radius: var(--r);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-family: var(--font-heading);
  font-size: 17px;
  font-weight: 700;
  color: var(--navy);
  letter-spacing: -0.5px;
  box-shadow: 0 2px 8px rgba(184,134,11,0.4);
}
.sidebar-brand .brand-text {
  line-height: 1.2;
}
.sidebar-brand .brand-name {
  font-family: var(--font-heading);
  font-size: 16px;
  font-weight: 700;
  color: var(--gold-light);
  letter-spacing: 0.5px;
}
.sidebar-brand .brand-sub {
  font-size: 10px;
  color: var(--text-inv-muted);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-top: 1px;
}

/* Pharmacy Info Block */
.sidebar-pharmacy {
  margin: 0;
  padding: 12px 20px;
  background: rgba(184,134,11,0.08);
  border-bottom: 1px solid var(--navy-border);
}
.ph-label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-inv-muted);
  margin-bottom: 2px;
}
.ph-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--gold-light);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Nav */
.sidebar-nav {
  flex: 1;
  padding: 12px 0 8px;
}
.nav-section-label {
  padding: 10px 20px 4px;
  font-size: 9.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: rgba(255,255,255,0.22);
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 20px;
  color: rgba(255,255,255,0.58);
  font-size: 13px;
  font-weight: 400;
  cursor: pointer;
  transition: var(--t);
  border-left: 3px solid transparent;
  text-decoration: none;
  position: relative;
}
.nav-item:hover {
  background: rgba(255,255,255,0.05);
  color: rgba(255,255,255,0.88);
  border-left-color: rgba(184,134,11,0.4);
}
.nav-item.active {
  background: rgba(184,134,11,0.12);
  color: var(--gold-light);
  border-left-color: var(--gold);
  font-weight: 600;
}
.nav-item .nav-icon {
  width: 16px;
  text-align: center;
  font-size: 12.5px;
  flex-shrink: 0;
  opacity: 0.8;
}
.nav-item.active .nav-icon { opacity: 1; }
.nav-item .nav-badge {
  margin-left: auto;
  background: var(--crimson);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 10px;
}

/* Sidebar Bottom */
.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid var(--navy-border);
  background: var(--navy-mid);
}
.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
}
.user-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), var(--amber));
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-family: var(--font-heading);
  color: var(--navy);
  font-size: 13px;
  flex-shrink: 0;
  border: 2px solid rgba(184,134,11,0.3);
}
.user-meta { flex: 1; min-width: 0; }
.user-name {
  font-size: 12.5px;
  font-weight: 600;
  color: rgba(255,255,255,0.88);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-role {
  font-size: 10.5px;
  color: var(--text-inv-muted);
  text-transform: capitalize;
}
.user-logout {
  width: 28px; height: 28px;
  border-radius: var(--r);
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,0.4);
  cursor: pointer;
  transition: var(--t);
  flex-shrink: 0;
  font-size: 12px;
}
.user-logout:hover {
  background: rgba(139,26,26,0.35);
  border-color: rgba(139,26,26,0.5);
  color: #e88;
}

/* ── MAIN CONTENT ────────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── TOPBAR ──────────────────────────────────────────────── */
.topbar {
  background: var(--surface);
  height: 58px;
  display: flex;
  align-items: center;
  padding: 0 28px;
  gap: 16px;
  border-bottom: 2px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}
.topbar-left { display: flex; align-items: center; gap: 14px; flex: 1; }
.topbar-right { display: flex; align-items: center; gap: 10px; }

.topbar-menu-btn {
  width: 32px; height: 32px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: transparent;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  font-size: 13px;
  transition: var(--t);
}
.topbar-menu-btn:hover { background: var(--bg-alt); }

.page-title {
  font-family: var(--font-heading);
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.2px;
}

/* Breadcrumb style subtitle */
.page-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  padding-left: 14px;
  margin-left: 10px;
  border-left: 1px solid var(--border);
}

.topbar-date {
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg-alt);
  padding: 5px 12px;
  border-radius: var(--r);
  border: 1px solid var(--border);
  font-family: var(--font-mono);
  letter-spacing: 0.3px;
}

.topbar-alert {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--amber-pale);
  border: 1px solid var(--gold);
  color: var(--amber);
  padding: 5px 12px;
  border-radius: var(--r);
  font-size: 11.5px;
  font-weight: 600;
  text-decoration: none;
  transition: var(--t);
}
.topbar-alert:hover { background: var(--gold-pale); color: var(--amber); }

/* ── CONTENT AREA ────────────────────────────────────────── */
.content-area {
  padding: 26px 28px;
  flex: 1;
}

/* Page Header */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.page-header h2 {
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 10px;
}
.page-header h2 .h-icon {
  width: 34px; height: 34px;
  background: var(--navy);
  border-radius: var(--r);
  display: flex; align-items: center; justify-content: center;
  color: var(--gold-light);
  font-size: 14px;
}
.page-header-actions { display: flex; gap: 8px; align-items: center; }

/* ── ALERT / FLASH ───────────────────────────────────────── */
.alert-box {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
  border-radius: var(--r);
  margin-bottom: 18px;
  font-size: 13.5px;
  border-left: 4px solid;
  animation: slideDown .25s ease;
}
@keyframes slideDown { from { opacity:0; transform:translateY(-8px); } to { opacity:1; transform:none; } }
.alert-success { background: var(--forest-pale); border-color: var(--forest); color: var(--forest); }
.alert-error   { background: var(--crimson-pale); border-color: var(--crimson); color: var(--crimson); }
.alert-warning { background: var(--amber-pale); border-color: var(--gold); color: var(--amber); }
.alert-info    { background: #e8f0fe; border-color: #3a63cc; color: #2a4aaa; }

/* ── STAT CARDS ──────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 3px solid var(--border-dark);
  border-radius: var(--r-md);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: flex-start;
  gap: 14px;
  transition: var(--t);
  position: relative;
  overflow: hidden;
}
.stat-card::after {
  content: '';
  position: absolute;
  bottom: 0; right: 0;
  width: 60px; height: 60px;
  border-radius: 50%;
  opacity: 0.04;
  background: currentColor;
  transform: translate(20px, 20px);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-card.green  { border-top-color: var(--forest); }
.stat-card.gold   { border-top-color: var(--gold); }
.stat-card.navy   { border-top-color: var(--navy-light); }
.stat-card.red    { border-top-color: var(--crimson); }
.stat-card.amber  { border-top-color: var(--amber); }
.stat-card.blue   { border-top-color: #2a5fcc; }

.stat-icon {
  width: 42px; height: 42px;
  border-radius: var(--r);
  display: flex; align-items: center; justify-content: center;
  font-size: 17px;
  flex-shrink: 0;
}
.stat-card.green .stat-icon  { background: var(--forest-pale); color: var(--forest); }
.stat-card.gold .stat-icon   { background: var(--gold-pale); color: var(--gold); }
.stat-card.navy .stat-icon   { background: #e8eef6; color: var(--navy-light); }
.stat-card.red .stat-icon    { background: var(--crimson-pale); color: var(--crimson); }
.stat-card.amber .stat-icon  { background: var(--amber-pale); color: var(--amber); }
.stat-card.blue .stat-icon   { background: #e8f0fe; color: #2a5fcc; }

.stat-body { flex: 1; min-width: 0; }
.stat-value {
  font-family: var(--font-heading);
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.15;
  margin-bottom: 3px;
}
.stat-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

/* ── CARDS ───────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  margin-bottom: 20px;
}
.card-header {
  padding: 14px 20px 12px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-alt);
  gap: 12px;
}
.card-title {
  font-family: var(--font-heading);
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-title .ct-icon {
  color: var(--navy);
  font-size: 12px;
}
.card-body { padding: 20px; }

/* ── TABLES ──────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
thead {
  background: var(--navy);
}
thead th {
  padding: 10px 16px;
  text-align: left;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--gold-light);
  white-space: nowrap;
  border-right: 1px solid var(--navy-border);
}
thead th:last-child { border-right: none; }
tbody tr {
  border-bottom: 1px solid var(--cream-dark);
  transition: background .12s;
}
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--gold-pale); }
tbody tr:nth-child(even) { background: rgba(0,0,0,0.015); }
tbody tr:nth-child(even):hover { background: var(--gold-pale); }
tbody td {
  padding: 10px 16px;
  color: var(--text-primary);
  vertical-align: middle;
  border-right: 1px solid rgba(0,0,0,0.04);
}
tbody td:last-child { border-right: none; }
tfoot td {
  padding: 10px 16px;
  font-weight: 700;
  background: var(--bg-alt);
  border-top: 2px solid var(--border);
}

/* ── BADGES ──────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  border-radius: 2px;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}
.badge-success  { background: var(--forest-pale); color: var(--forest); border: 1px solid #b6dfc9; }
.badge-danger   { background: var(--crimson-pale); color: var(--crimson); border: 1px solid #f0bebe; }
.badge-warning  { background: var(--amber-pale); color: var(--amber); border: 1px solid #e8c97a; }
.badge-info     { background: #e8f0fe; color: #2a4aaa; border: 1px solid #b3c6f5; }
.badge-primary  { background: #e8eef6; color: var(--navy-light); border: 1px solid #bad0e8; }
.badge-gold     { background: var(--gold-pale); color: var(--gold); border: 1px solid #dfc070; }
.badge-secondary{ background: var(--slate-pale); color: var(--slate); border: 1px solid #d0d8e4; }
.badge-dark     { background: var(--navy-light); color: var(--gold-light); border: 1px solid var(--navy-border); }

/* ── BUTTONS ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 16px;
  border-radius: var(--r);
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-body);
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--t);
  text-decoration: none;
  white-space: nowrap;
  letter-spacing: 0.2px;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Primary — Navy */
.btn-primary {
  background: var(--navy);
  color: var(--gold-light);
  border-color: var(--navy);
}
.btn-primary:hover:not(:disabled) {
  background: var(--navy-light);
  border-color: var(--navy-light);
  color: var(--gold-light);
  box-shadow: 0 3px 10px rgba(13,27,42,0.3);
}

/* Gold / Accent */
.btn-accent {
  background: var(--gold);
  color: var(--navy);
  border-color: var(--gold);
  font-weight: 700;
}
.btn-accent:hover:not(:disabled) {
  background: var(--gold-light);
  border-color: var(--gold-light);
  box-shadow: 0 3px 10px rgba(184,134,11,0.35);
}

/* Forest / Success */
.btn-success {
  background: var(--forest);
  color: #fff;
  border-color: var(--forest);
}
.btn-success:hover:not(:disabled) {
  background: var(--forest-light);
  border-color: var(--forest-light);
}

/* Danger */
.btn-danger {
  background: var(--crimson);
  color: #fff;
  border-color: var(--crimson);
}
.btn-danger:hover:not(:disabled) {
  background: #a52020;
  box-shadow: 0 3px 10px rgba(139,26,26,0.3);
}

/* Outline */
.btn-outline {
  background: transparent;
  color: var(--navy);
  border-color: var(--border-dark);
}
.btn-outline:hover:not(:disabled) {
  background: var(--bg-alt);
  border-color: var(--navy);
}

/* Ghost */
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}
.btn-ghost:hover:not(:disabled) {
  background: var(--bg-alt);
  color: var(--text-primary);
}

/* Light */
.btn-light {
  background: var(--surface);
  color: var(--text-primary);
  border-color: var(--border);
}
.btn-light:hover:not(:disabled) { background: var(--bg-alt); }

/* Sizes */
.btn-sm   { padding: 5px 11px; font-size: 12px; }
.btn-lg   { padding: 11px 24px; font-size: 14.5px; border-radius: var(--r-md); }
.btn-xs   { padding: 3px 8px; font-size: 11px; }
.btn-icon { width: 32px; height: 32px; padding: 0; border-radius: var(--r); }
.btn-icon.btn-sm { width: 28px; height: 28px; }

/* ── FORMS ───────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 5px;
}
.form-label .req { color: var(--crimson); margin-left: 2px; }
.form-control {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border-dark);
  border-radius: var(--r);
  font-size: 13.5px;
  color: var(--text-primary);
  background: var(--surface);
  font-family: var(--font-body);
  transition: var(--t);
  outline: none;
  appearance: none;
}
.form-control:focus {
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(13,27,42,0.1);
  background: var(--white);
}
.form-control::placeholder { color: #aaa8a0; }
.form-control[readonly] { background: var(--bg-alt); color: var(--text-secondary); cursor: default; }
.form-control[disabled] { background: var(--bg-alt); opacity: 0.6; cursor: not-allowed; }
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 24 24' fill='none' stroke='%23718096' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 32px;
  cursor: pointer;
}
textarea.form-control { resize: vertical; min-height: 80px; }
.form-text  { font-size: 11.5px; color: var(--text-muted); margin-top: 4px; }
.form-error { font-size: 11.5px; color: var(--crimson); margin-top: 4px; }

.form-row   { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }

/* Input group */
.input-group { display: flex; }
.input-group .form-control { border-radius: var(--r) 0 0 var(--r); border-right: none; }
.input-addon {
  padding: 9px 12px;
  background: var(--bg-alt);
  border: 1px solid var(--border-dark);
  border-radius: 0 var(--r) var(--r) 0;
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
  display: flex;
  align-items: center;
}

/* Checkbox */
.form-check {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}
.form-check input[type="checkbox"] {
  width: 15px; height: 15px;
  cursor: pointer;
  accent-color: var(--navy);
}
.form-check label { font-size: 13px; cursor: pointer; }

/* ── MODALS ───────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(13,27,42,0.55);
  backdrop-filter: blur(3px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}
.modal-overlay.active {
  opacity: 1;
  pointer-events: all;
}
.modal {
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(16px) scale(.98);
  transition: transform .22s ease;
  border: 1px solid var(--border);
}
.modal-overlay.active .modal { transform: none; }
.modal-lg  { max-width: 780px; }
.modal-xl  { max-width: 1020px; }

.modal-header {
  padding: 16px 22px 14px;
  border-bottom: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--navy);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
}
.modal-header h3, .modal-title {
  font-family: var(--font-heading);
  font-size: 14px;
  font-weight: 700;
  color: var(--gold-light);
  display: flex;
  align-items: center;
  gap: 8px;
}
.modal-close {
  width: 28px; height: 28px;
  border-radius: var(--r);
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  cursor: pointer;
  color: rgba(255,255,255,0.6);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  transition: var(--t);
}
.modal-close:hover { background: rgba(139,26,26,0.4); color: #fff; border-color: rgba(139,26,26,0.5); }
.modal-body   { padding: 22px; }
.modal-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  background: var(--bg-alt);
  border-radius: 0 0 var(--r-lg) var(--r-lg);
}

/* ── GRIDS ────────────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4,1fr); gap: 14px; }

/* ── UTILITIES ───────────────────────────────────────────── */
.flex         { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-center  { display: flex; align-items: center; justify-content: center; }
.align-center { align-items: center; }
.gap-1 { gap: 4px; } .gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; }
.flex-wrap { flex-wrap: wrap; }
.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; } .mb-3 { margin-bottom: 24px; }
.mt-1 { margin-top: 8px; }    .mt-2 { margin-top: 16px; }    .mt-3 { margin-top: 24px; }
.ml-auto { margin-left: auto; }
.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-muted  { color: var(--text-muted); }
.text-sm     { font-size: 12px; }
.text-xs     { font-size: 11px; }
.text-green  { color: var(--forest); }
.text-red    { color: var(--crimson); }
.text-gold   { color: var(--gold); }
.text-navy   { color: var(--navy); }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.font-mono { font-family: var(--font-mono); }
.font-heading { font-family: var(--font-heading); }
.w-full { width: 100%; }
.hidden { display: none !important; }
.divider { height: 1px; background: var(--border); margin: 14px 0; }

/* ── EMPTY STATE ─────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 50px 20px;
  color: var(--text-muted);
}
.empty-state .empty-icon {
  font-size: 40px;
  margin-bottom: 14px;
  opacity: 0.25;
  display: block;
}
.empty-state h4 {
  font-family: var(--font-heading);
  font-size: 15px;
  color: var(--text-primary);
  margin-bottom: 6px;
}
.empty-state p { font-size: 13px; }

/* ── SEARCH BOX ──────────────────────────────────────────── */
.search-box { position: relative; }
.search-box .search-icon {
  position: absolute;
  left: 11px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 12px;
  pointer-events: none;
}
.search-box .form-control { padding-left: 32px; }

/* ── TOAST NOTIFICATIONS ─────────────────────────────────── */
.toast-container {
  position: fixed;
  top: 18px; right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 9px;
  pointer-events: none;
}
.toast {
  background: var(--surface);
  border-radius: var(--r-md);
  padding: 12px 16px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 280px;
  max-width: 380px;
  border-left: 4px solid var(--forest);
  font-size: 13px;
  pointer-events: all;
  animation: toastIn .28s ease;
  transition: opacity .3s, transform .3s;
}
.toast-success { border-left-color: var(--forest); }
.toast-error   { border-left-color: var(--crimson); }
.toast-warning { border-left-color: var(--gold); }
.toast-info    { border-left-color: #2a5fcc; }
@keyframes toastIn { from { opacity:0; transform:translateX(100%); } to { opacity:1; transform:none; } }

/* ── PROGRESS ────────────────────────────────────────────── */
.progress-bar {
  height: 7px;
  background: var(--bg-alt);
  border-radius: 3px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.progress-fill {
  height: 100%;
  border-radius: 3px;
  background: var(--navy);
  transition: width .4s ease;
}
.progress-fill.gold   { background: var(--gold); }
.progress-fill.forest { background: var(--forest); }

/* ── TABS ────────────────────────────────────────────────── */
.tab-bar {
  display: flex;
  border-bottom: 2px solid var(--border);
  margin-bottom: 20px;
  gap: 0;
}
.tab-btn {
  padding: 9px 18px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  border: none;
  background: transparent;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: var(--t);
  font-family: var(--font-body);
}
.tab-btn:hover { color: var(--text-primary); }
.tab-btn.active { color: var(--navy); border-bottom-color: var(--gold); }

/* ── LANDING / AUTH PAGES ────────────────────────────────── */
.landing-body {
  background: var(--navy);
  min-height: 100vh;
}

/* Classic header rule on landing */
.landing-body::before {
  content: '';
  display: block;
  height: 4px;
  background: linear-gradient(90deg, var(--gold) 0%, var(--gold-light) 50%, var(--gold) 100%);
}

.landing-nav {
  background: var(--navy-mid);
  border-bottom: 1px solid var(--navy-border);
  padding: 0 48px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.landing-logo {
  display: flex;
  align-items: center;
  gap: 12px;
}
.landing-logo .logo-badge {
  width: 38px; height: 38px;
  background: var(--gold);
  border-radius: var(--r);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-heading);
  font-size: 16px;
  font-weight: 700;
  color: var(--navy);
}
.landing-logo span {
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 700;
  color: var(--gold-light);
  letter-spacing: 1px;
}

/* Hero */
.landing-hero {
  text-align: center;
  padding: 70px 40px 50px;
  max-width: 780px;
  margin: 0 auto;
}
.landing-hero h1 {
  font-family: var(--font-heading);
  font-size: 46px;
  font-weight: 700;
  color: var(--gold-light);
  line-height: 1.12;
  margin-bottom: 18px;
}
.landing-hero h1 em {
  font-style: italic;
  color: var(--white);
}
.landing-hero p {
  font-size: 16px;
  color: rgba(255,255,255,0.6);
  max-width: 520px;
  margin: 0 auto 32px;
  line-height: 1.75;
}
.hero-btns { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }

/* Feature card */
.feature-card {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.1);
  border-top: 3px solid var(--gold);
  border-radius: var(--r-md);
  padding: 24px 22px;
  transition: var(--t);
}
.feature-card:hover {
  background: rgba(255,255,255,0.07);
  border-top-color: var(--gold-light);
  transform: translateY(-3px);
  box-shadow: 0 8px 28px rgba(0,0,0,0.2);
}
.feature-icon {
  width: 44px; height: 44px;
  background: rgba(184,134,11,0.15);
  border: 1px solid rgba(184,134,11,0.3);
  border-radius: var(--r);
  display: flex; align-items: center; justify-content: center;
  color: var(--gold-light);
  font-size: 17px;
  margin-bottom: 14px;
}

/* Pricing */
.pricing-card {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--r-lg);
  padding: 28px 24px;
  text-align: center;
  transition: var(--t);
  position: relative;
}
.pricing-card.featured {
  background: rgba(184,134,11,0.1);
  border-color: var(--gold);
  box-shadow: 0 0 40px rgba(184,134,11,0.2);
}
.plan-name {
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 700;
  color: var(--gold-light);
  margin-bottom: 10px;
}
.plan-price {
  font-family: var(--font-heading);
  font-size: 32px;
  font-weight: 700;
  color: var(--white);
  margin-bottom: 4px;
}
.plan-features {
  list-style: none;
  text-align: left;
  margin: 18px 0 22px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.plan-features li {
  font-size: 13px;
  color: rgba(255,255,255,0.7);
  display: flex;
  align-items: center;
  gap: 8px;
}
.plan-features li::before {
  content: '✓';
  color: var(--gold);
  font-weight: 700;
  font-size: 11px;
  flex-shrink: 0;
}

/* ── LOGIN PAGE ──────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  background: var(--navy);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  /* subtle texture */
  background-image:
    repeating-linear-gradient(
      45deg,
      rgba(255,255,255,0.015) 0px, rgba(255,255,255,0.015) 1px,
      transparent 1px, transparent 8px
    );
}
.login-box {
  background: var(--surface);
  border-radius: var(--r-lg);
  padding: 38px 36px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(184,134,11,0.15);
  border-top: 4px solid var(--gold);
}
.login-brand { text-align: center; margin-bottom: 28px; }
.logo-mark {
  width: 60px; height: 60px;
  background: var(--navy);
  border-radius: var(--r-md);
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-heading);
  font-size: 24px;
  font-weight: 700;
  color: var(--gold-light);
  margin-bottom: 14px;
  box-shadow: 0 4px 16px rgba(13,27,42,0.35);
  letter-spacing: -0.5px;
}
.login-brand h2 {
  font-family: var(--font-heading);
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}
.login-brand p { font-size: 13px; color: var(--text-muted); }

/* ── HORIZONTAL RULE ─────────────────────────────────────── */
.section-rule {
  border: none;
  border-top: 1px solid var(--border);
  margin: 20px 0;
}
.gold-rule {
  border: none;
  height: 2px;
  background: linear-gradient(90deg, var(--gold) 0%, transparent 100%);
  margin: 16px 0;
  opacity: 0.4;
}

/* ── POS LAYOUT ──────────────────────────────────────────── */
.pos-layout {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 16px;
  height: calc(100vh - 116px);
  min-height: 500px;
}
.pos-products { overflow-y: auto; padding-right: 2px; }
.pos-cart {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.pos-cart-header {
  background: var(--navy);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.pos-cart-header .cart-title {
  font-family: var(--font-heading);
  font-size: 13px;
  font-weight: 700;
  color: var(--gold-light);
  display: flex;
  align-items: center;
  gap: 8px;
}
.cart-items { flex: 1; overflow-y: auto; padding: 10px; }
.cart-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  margin-bottom: 6px;
  background: var(--bg);
  transition: var(--t);
}
.cart-item:hover { border-color: var(--gold); background: var(--gold-pale); }
.cart-item-name {
  flex: 1;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.3;
  min-width: 0;
}
.cart-item-price {
  font-size: 11.5px;
  color: var(--text-muted);
}
.qty-control { display: flex; align-items: center; gap: 4px; }
.qty-btn {
  width: 22px; height: 22px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border-dark);
  background: var(--surface);
  cursor: pointer;
  font-size: 12px;
  display: flex; align-items: center; justify-content: center;
  transition: var(--t);
  color: var(--text-primary);
}
.qty-btn:hover { background: var(--navy); color: var(--gold-light); border-color: var(--navy); }
.qty-input {
  width: 36px;
  text-align: center;
  border: 1px solid var(--border-dark);
  border-radius: var(--r-sm);
  padding: 2px 4px;
  font-size: 12.5px;
  font-family: var(--font-mono);
  color: var(--text-primary);
  background: var(--white);
}
.cart-total-section {
  padding: 14px 16px;
  border-top: 2px solid var(--border);
  background: var(--bg-alt);
}
.total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  padding: 3px 0;
  color: var(--text-primary);
}
.total-row.grand {
  font-family: var(--font-heading);
  font-size: 17px;
  font-weight: 700;
  color: var(--navy);
  padding: 8px 0 6px;
  border-top: 1px solid var(--border);
  margin-top: 4px;
}
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
  gap: 10px;
}
.product-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 14px;
  cursor: pointer;
  transition: var(--t);
  user-select: none;
  position: relative;
  overflow: hidden;
}
.product-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--border-dark);
  transition: var(--t);
}
.product-card:hover {
  border-color: var(--gold);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.product-card:hover::before { background: var(--gold); }
.product-card .prod-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 5px;
  line-height: 1.3;
}
.product-card .prod-price {
  font-family: var(--font-heading);
  font-size: 14px;
  font-weight: 700;
  color: var(--forest);
}
.product-card .prod-stock {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 3px;
  font-family: var(--font-mono);
}

/* ── VOUCHER / RECEIPT PRINT ──────────────────────────────── */
.voucher-print {
  max-width: 720px;
  margin: 0 auto;
  background: var(--white);
  padding: 40px;
  font-family: var(--font-body);
}
.voucher-header-bar {
  background: var(--navy);
  color: var(--gold-light);
  padding: 16px 24px;
  margin: -40px -40px 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.voucher-header-bar h2 {
  font-family: var(--font-heading);
  font-size: 18px;
}

/* ── RESPONSIVE ──────────────────────────────────────────── */
@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform .28s ease;
    z-index: 500;
  }
  .sidebar.open { transform: none; box-shadow: 8px 0 32px rgba(0,0,0,0.3); }
  .main-content { margin-left: 0; }
  .topbar-menu-btn { display: flex; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .grid-4 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 768px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .content-area { padding: 16px; }
  .topbar { padding: 0 16px; }
  .pos-layout { grid-template-columns: 1fr; height: auto; }
  .landing-hero h1 { font-size: 30px; }
  .landing-nav { padding: 0 20px; }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .login-box { padding: 28px 20px; }
}

/* ── PRINT ───────────────────────────────────────────────── */
@media print {
  .sidebar, .topbar, .no-print, .modal-overlay, .toast-container { display: none !important; }
  .main-content { margin-left: 0 !important; }
  .content-area { padding: 0 !important; }
  body { background: white; }
  .card { box-shadow: none !important; border: 1px solid #ccc !important; }
}
