/* ============================================================
   OptiStore ERP — Design System & Styles
   Tone: Industrial-Utilitarian meets Medical Precision
   Palette: Deep Navy + Cyan Accent + Warm Amber alerts
   Font: Outfit (UI) + JetBrains Mono (data/numbers)
   ============================================================ */

/* ── CSS Variables ─────────────────────────────────────────── */
:root {
  /* Core palette */
  --bg-base:       #0A0F1E;
  --bg-surface:    #111827;
  --bg-elevated:   #1A2235;
  --bg-card:       #1E2A3D;
  --bg-input:      #0F1929;

  /* Borders */
  --border:        #2A3A52;
  --border-light:  #1E2E44;
  --border-focus:  #00D4FF;

  /* Text */
  --text-primary:  #F0F4FF;
  --text-secondary:#8A9BB5;
  --text-muted:    #4A5A72;
  --text-inverse:  #0A0F1E;

  /* Accent */
  --cyan:          #00D4FF;
  --cyan-dim:      #00A8CC;
  --cyan-glow:     rgba(0, 212, 255, 0.15);
  --purple:        #7B2FFF;
  --purple-dim:    #5A1FCC;

  /* Status colors */
  --green:         #00E5A0;
  --green-dim:     #00B87D;
  --green-bg:      rgba(0, 229, 160, 0.1);
  --amber:         #FFB020;
  --amber-dim:     #CC8A00;
  --amber-bg:      rgba(255, 176, 32, 0.1);
  --red:           #FF4757;
  --red-dim:       #CC2233;
  --red-bg:        rgba(255, 71, 87, 0.1);
  --blue:          #3B82F6;
  --blue-bg:       rgba(59, 130, 246, 0.1);
  --teal:          #14B8A6;
  --teal-bg:       rgba(20, 184, 166, 0.1);

  /* Gradients */
  --grad-cyan:     linear-gradient(135deg, #00D4FF, #7B2FFF);
  --grad-green:    linear-gradient(135deg, #00E5A0, #00A8CC);
  --grad-amber:    linear-gradient(135deg, #FFB020, #FF6B35);
  --grad-red:      linear-gradient(135deg, #FF4757, #FF2D55);

  /* Spacing */
  --space-xs:      4px;
  --space-sm:      8px;
  --space-md:      16px;
  --space-lg:      24px;
  --space-xl:      32px;
  --space-2xl:     48px;

  /* Radius */
  --radius-sm:     8px;
  --radius-md:     12px;
  --radius-lg:     16px;
  --radius-xl:     20px;
  --radius-full:   9999px;

  /* Shadows */
  --shadow-sm:     0 2px 8px rgba(0,0,0,0.3);
  --shadow-md:     0 4px 16px rgba(0,0,0,0.4);
  --shadow-lg:     0 8px 32px rgba(0,0,0,0.5);
  --shadow-cyan:   0 0 20px rgba(0, 212, 255, 0.2);

  /* Typography */
  --font-ui:       'Outfit', sans-serif;
  --font-mono:     'JetBrains Mono', monospace;

  /* Layout */
  --header-h:      56px;
  --nav-h:         68px;
  --safe-bottom:   env(safe-area-inset-bottom, 0px);
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-ui);
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
button { font-family: var(--font-ui); cursor: pointer; border: none; background: none; }
input, select, textarea { font-family: var(--font-ui); }
a { color: var(--cyan); text-decoration: none; }
img { max-width: 100%; }
.hidden { display: none !important; }

/* ── Splash Screen ─────────────────────────────────────────── */
.splash {
  position: fixed; inset: 0; z-index: 9999;
  background: var(--bg-base);
  display: flex; align-items: center; justify-content: center;
}
.splash-inner { text-align: center; }
.splash-logo {
  width: 80px; height: 80px;
  margin: 0 auto var(--space-md);
  animation: splashPulse 1.5s ease-in-out infinite;
}
.splash-logo svg { width: 80px; height: 80px; }
.splash-title {
  font-size: 2rem; font-weight: 800;
  background: var(--grad-cyan); -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.splash-sub { color: var(--text-secondary); margin-top: 4px; font-size: 0.9rem; }
.splash-loader {
  width: 160px; height: 3px;
  background: var(--bg-elevated);
  border-radius: var(--radius-full);
  margin: var(--space-lg) auto 0;
  overflow: hidden;
}
.splash-bar {
  height: 100%; width: 0;
  background: var(--grad-cyan);
  border-radius: var(--radius-full);
  animation: splashLoad 1.8s ease-out forwards;
}
@keyframes splashPulse { 0%,100%{transform:scale(1)} 50%{transform:scale(1.05)} }
@keyframes splashLoad { 0%{width:0} 100%{width:100%} }

/* ── App Shell ─────────────────────────────────────────────── */
.app {
  display: flex; flex-direction: column;
  min-height: 100dvh;
  max-width: 480px;
  margin: 0 auto;
  position: relative;
}

/* ── Header ────────────────────────────────────────────────── */
.app-header {
  position: sticky; top: 0; z-index: 100;
  height: var(--header-h);
  background: rgba(10, 15, 30, 0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-light);
  display: flex; align-items: center;
  padding: 0 var(--space-md);
  gap: var(--space-sm);
}
.header-back {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  transition: background 0.15s;
  flex-shrink: 0;
}
.header-back:hover { background: var(--bg-elevated); }
.header-logo {
  display: flex; align-items: center; gap: var(--space-sm);
  flex: 1; cursor: pointer;
}
.header-title {
  font-size: 1.1rem; font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.header-actions { display: flex; gap: var(--space-xs); }
.header-btn {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  transition: all 0.15s;
  position: relative;
}
.header-btn:hover { color: var(--text-primary); background: var(--bg-elevated); }
.notif-badge {
  position: absolute; top: 4px; right: 4px;
  min-width: 16px; height: 16px;
  background: var(--red);
  border-radius: var(--radius-full);
  font-size: 0.6rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  padding: 0 3px;
  color: white;
}

/* ── Page Container ────────────────────────────────────────── */
.page-container {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding-bottom: calc(var(--nav-h) + var(--safe-bottom) + 8px);
  scroll-behavior: smooth;
}
.page { display: none; }
.page.active { display: block; animation: pageIn 0.2s ease-out; }
@keyframes pageIn { from{opacity:0;transform:translateY(8px)} to{opacity:1;transform:translateY(0)} }
.page-content { padding: var(--space-md); }

/* ── Bottom Nav ────────────────────────────────────────────── */
.bottom-nav {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 480px;
  height: calc(var(--nav-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: rgba(17, 24, 39, 0.97);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--border-light);
  display: flex; align-items: center;
  z-index: 100;
}
.nav-item {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 3px; padding: 8px 4px;
  color: var(--text-muted);
  font-size: 0.65rem; font-weight: 500;
  transition: color 0.15s;
  position: relative;
}
.nav-item.active { color: var(--cyan); }
.nav-item.active .nav-icon { stroke: var(--cyan); }
.nav-icon { width: 22px; height: 22px; stroke: currentColor; transition: stroke 0.15s; }
.nav-center { flex: 0 0 72px; }
.nav-center-btn {
  width: 52px; height: 52px;
  background: var(--grad-cyan);
  border-radius: var(--radius-full);
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-cyan);
  margin-bottom: 2px;
  transition: transform 0.15s, box-shadow 0.15s;
}
.nav-center-btn:active { transform: scale(0.93); }
.nav-center-btn .nav-icon { stroke: white; width: 24px; height: 24px; }
.nav-center.active .nav-center-btn { box-shadow: 0 0 28px rgba(0,212,255,0.5); }

/* ── More Drawer ───────────────────────────────────────────── */
.more-drawer {
  position: fixed; bottom: calc(var(--nav-h) + var(--safe-bottom));
  left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 480px;
  background: var(--bg-elevated);
  border-top: 1px solid var(--border);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  z-index: 99;
  animation: drawerUp 0.2s ease-out;
}
@keyframes drawerUp { from{transform:translateX(-50%) translateY(100%)} to{transform:translateX(-50%) translateY(0)} }
.more-drawer-inner { padding: var(--space-md); display: flex; gap: var(--space-sm); }
.more-item {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; gap: var(--space-sm);
  padding: var(--space-md) var(--space-sm);
  background: var(--bg-card);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.8rem; font-weight: 500;
  transition: all 0.15s;
}
.more-item:hover { color: var(--cyan); background: var(--bg-elevated); }

/* ── Dashboard ─────────────────────────────────────────────── */
.dashboard-greeting { margin-bottom: var(--space-lg); }
.dashboard-greeting h2 { font-size: 1.5rem; font-weight: 700; }
.dashboard-greeting p { color: var(--text-secondary); font-size: 0.85rem; margin-top: 2px; }

.stats-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: var(--space-sm); margin-bottom: var(--space-lg);
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
  position: relative; overflow: hidden;
  transition: transform 0.15s;
}
.stat-card:active { transform: scale(0.97); }
.stat-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
}
.stat-blue::before { background: var(--blue); }
.stat-green::before { background: var(--green); }
.stat-orange::before { background: var(--amber); }
.stat-red::before { background: var(--red); }
.stat-purple::before { background: var(--purple); }
.stat-teal::before { background: var(--teal); }
.stat-icon { font-size: 1.4rem; margin-bottom: var(--space-xs); }
.stat-val {
  font-size: 1.5rem; font-weight: 800;
  font-family: var(--font-mono);
  color: var(--text-primary);
}
.stat-label { font-size: 0.72rem; color: var(--text-secondary); margin-top: 2px; font-weight: 500; }

.quick-actions { margin-bottom: var(--space-lg); }
.section-title {
  font-size: 0.8rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: var(--space-md);
}
.qa-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-sm); }
.qa-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: var(--space-md) var(--space-sm);
  display: flex; flex-direction: column;
  align-items: center; gap: var(--space-xs);
  color: var(--text-secondary);
  font-size: 0.75rem; font-weight: 500;
  transition: all 0.15s;
}
.qa-btn:hover, .qa-btn:active { background: var(--bg-elevated); color: var(--cyan); border-color: var(--cyan); }
.qa-icon { font-size: 1.4rem; }

.alerts-section { display: flex; flex-direction: column; gap: var(--space-sm); }
.alert-card {
  display: flex; align-items: center; gap: var(--space-md);
  padding: var(--space-md);
  border-radius: var(--radius-md);
  border: 1px solid;
  font-size: 0.85rem;
}
.alert-card.alert-red { background: var(--red-bg); border-color: rgba(255,71,87,0.3); color: var(--red); }
.alert-card.alert-amber { background: var(--amber-bg); border-color: rgba(255,176,32,0.3); color: var(--amber); }
.alert-card.alert-blue { background: var(--blue-bg); border-color: rgba(59,130,246,0.3); color: var(--blue); }

/* ── Search Bar ────────────────────────────────────────────── */
.search-bar {
  display: flex; align-items: center; gap: var(--space-sm);
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0 var(--space-md);
  margin-bottom: var(--space-md);
  transition: border-color 0.15s;
}
.search-bar:focus-within { border-color: var(--border-focus); }
.search-bar svg { color: var(--text-muted); flex-shrink: 0; }
.search-bar input {
  flex: 1; background: none; border: none; outline: none;
  color: var(--text-primary); font-size: 0.9rem;
  padding: 12px 0;
}
.search-bar input::placeholder { color: var(--text-muted); }

/* ── List Items ────────────────────────────────────────────── */
.list-container { display: flex; flex-direction: column; gap: var(--space-sm); }
.list-item {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
  display: flex; align-items: center; gap: var(--space-md);
  transition: all 0.15s;
  cursor: pointer;
}
.list-item:hover { border-color: var(--border-focus); background: var(--bg-elevated); }
.list-item:active { transform: scale(0.99); }
.list-avatar {
  width: 44px; height: 44px; border-radius: var(--radius-full);
  background: var(--grad-cyan);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; font-weight: 700; color: white;
  flex-shrink: 0;
}
.list-info { flex: 1; min-width: 0; }
.list-name { font-size: 0.95rem; font-weight: 600; color: var(--text-primary); }
.list-sub { font-size: 0.78rem; color: var(--text-secondary); margin-top: 2px; }
.list-meta { text-align: right; flex-shrink: 0; }
.list-badge {
  display: inline-flex; align-items: center;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  font-size: 0.7rem; font-weight: 600;
}
.badge-green { background: var(--green-bg); color: var(--green); }
.badge-amber { background: var(--amber-bg); color: var(--amber); }
.badge-red { background: var(--red-bg); color: var(--red); }
.badge-blue { background: var(--blue-bg); color: var(--blue); }
.badge-purple { background: rgba(123,47,255,0.15); color: var(--purple); }
.badge-teal { background: var(--teal-bg); color: var(--teal); }
.badge-gray { background: rgba(138,155,181,0.15); color: var(--text-secondary); }

/* ── FAB ───────────────────────────────────────────────────── */
.fab {
  position: fixed; bottom: calc(var(--nav-h) + var(--safe-bottom) + 16px);
  right: 16px;
  width: 56px; height: 56px;
  background: var(--grad-cyan);
  border-radius: var(--radius-full);
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-cyan), var(--shadow-lg);
  z-index: 90;
  transition: transform 0.15s, box-shadow 0.15s;
  color: white;
}
.fab:active { transform: scale(0.92); }
.fab svg { width: 24px; height: 24px; stroke: white; }

/* ── Forms ─────────────────────────────────────────────────── */
.form-group { margin-bottom: var(--space-md); }
.form-label {
  display: block;
  font-size: 0.78rem; font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase; letter-spacing: 0.05em;
  margin-bottom: var(--space-xs);
}
.form-label .required { color: var(--red); margin-left: 2px; }
.form-input, .form-select, .form-textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.9rem;
  padding: 12px var(--space-md);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  -webkit-appearance: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--cyan-glow);
}
.form-input::placeholder { color: var(--text-muted); }
.form-select { 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='%238A9BB5' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }
.form-select option { background: var(--bg-elevated); }
.form-textarea { resize: vertical; min-height: 80px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-sm); }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: var(--space-sm); }
.form-hint { font-size: 0.72rem; color: var(--text-muted); margin-top: 4px; }
.form-error { font-size: 0.72rem; color: var(--red); margin-top: 4px; }

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: var(--space-sm);
  padding: 12px var(--space-lg);
  border-radius: var(--radius-md);
  font-size: 0.9rem; font-weight: 600;
  transition: all 0.15s;
  cursor: pointer; border: none;
  white-space: nowrap;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: var(--grad-cyan); color: white;
  box-shadow: var(--shadow-cyan);
}
.btn-primary:hover { box-shadow: 0 0 28px rgba(0,212,255,0.35); }
.btn-secondary {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-primary);
}
.btn-secondary:hover { border-color: var(--border-focus); }
.btn-danger { background: var(--red-bg); border: 1px solid rgba(255,71,87,0.3); color: var(--red); }
.btn-danger:hover { background: var(--red); color: white; }
.btn-success { background: var(--green-bg); border: 1px solid rgba(0,229,160,0.3); color: var(--green); }
.btn-success:hover { background: var(--green); color: var(--text-inverse); }
.btn-ghost { color: var(--text-secondary); }
.btn-ghost:hover { color: var(--text-primary); background: var(--bg-elevated); }
.btn-sm { padding: 8px var(--space-md); font-size: 0.8rem; }
.btn-lg { padding: 16px var(--space-xl); font-size: 1rem; }
.btn-full { width: 100%; }
.btn-icon { padding: 10px; border-radius: var(--radius-sm); }
.btn svg { width: 16px; height: 16px; }

/* ── Modal ─────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  display: flex; align-items: flex-end;
  animation: fadeIn 0.15s ease-out;
}
@keyframes fadeIn { from{opacity:0} to{opacity:1} }
.modal {
  width: 100%; max-width: 480px; margin: 0 auto;
  background: var(--bg-elevated);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  border-top: 1px solid var(--border);
  max-height: 92dvh;
  display: flex; flex-direction: column;
  animation: slideUp 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes slideUp { from{transform:translateY(100%)} to{transform:translateY(0)} }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--space-lg) var(--space-lg) var(--space-md);
  border-bottom: 1px solid var(--border-light);
  flex-shrink: 0;
}
.modal-title { font-size: 1.1rem; font-weight: 700; }
.modal-close {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  transition: all 0.15s;
}
.modal-close:hover { color: var(--text-primary); background: var(--bg-card); }
.modal-body {
  flex: 1; overflow-y: auto;
  padding: var(--space-lg);
}
.modal-footer {
  padding: var(--space-md) var(--space-lg);
  border-top: 1px solid var(--border-light);
  display: flex; gap: var(--space-sm);
  flex-shrink: 0;
}
.modal-footer .btn { flex: 1; }

/* ── Toast ─────────────────────────────────────────────────── */
.toast-container {
  position: fixed; top: calc(var(--header-h) + 8px); left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 32px); max-width: 448px;
  z-index: 300;
  display: flex; flex-direction: column; gap: var(--space-sm);
  pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: var(--space-sm);
  padding: 12px var(--space-md);
  border-radius: var(--radius-md);
  font-size: 0.85rem; font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: all;
}
@keyframes toastIn { from{opacity:0;transform:translateY(-12px) scale(0.95)} to{opacity:1;transform:translateY(0) scale(1)} }
.toast-success { background: var(--bg-elevated); border: 1px solid rgba(0,229,160,0.4); color: var(--green); }
.toast-error { background: var(--bg-elevated); border: 1px solid rgba(255,71,87,0.4); color: var(--red); }
.toast-info { background: var(--bg-elevated); border: 1px solid rgba(0,212,255,0.4); color: var(--cyan); }
.toast-warning { background: var(--bg-elevated); border: 1px solid rgba(255,176,32,0.4); color: var(--amber); }

/* ── Cards ─────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: var(--space-md);
}
.card-title { font-size: 0.9rem; font-weight: 700; }

/* ── Prescription Table ────────────────────────────────────── */
.rx-table-wrap { overflow-x: auto; margin: var(--space-sm) 0; }
.rx-table {
  width: 100%; border-collapse: collapse;
  font-size: 0.8rem;
}
.rx-table th {
  background: var(--bg-input);
  color: var(--text-muted);
  font-size: 0.7rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.05em;
  padding: 8px 10px; text-align: center;
  border: 1px solid var(--border-light);
}
.rx-table td {
  padding: 8px 10px; text-align: center;
  border: 1px solid var(--border-light);
  font-family: var(--font-mono);
  color: var(--text-primary);
}
.rx-table tr:nth-child(even) td { background: rgba(255,255,255,0.02); }
.rx-eye-label {
  font-weight: 700; font-size: 0.75rem;
  color: var(--cyan); font-family: var(--font-ui);
}
.rx-input {
  width: 100%; background: none; border: none; outline: none;
  color: var(--text-primary); font-family: var(--font-mono);
  font-size: 0.85rem; text-align: center; padding: 4px;
}
.rx-input:focus { background: var(--cyan-glow); border-radius: 4px; }

/* ── Category Chips ────────────────────────────────────────── */
.chip-row {
  display: flex; gap: var(--space-xs);
  overflow-x: auto; padding-bottom: 4px;
  margin-bottom: var(--space-md);
  scrollbar-width: none;
}
.chip-row::-webkit-scrollbar { display: none; }
.chip {
  flex-shrink: 0;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 0.78rem; font-weight: 600;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  transition: all 0.15s;
  cursor: pointer;
}
.chip.active { background: var(--cyan-glow); border-color: var(--cyan); color: var(--cyan); }

/* ── Inventory Product Card ────────────────────────────────── */
.product-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
  position: relative;
  transition: all 0.15s;
}
.product-card:hover { border-color: var(--border-focus); }
.product-card.low-stock { border-color: rgba(255,71,87,0.4); }
.product-card.low-stock::after {
  content: 'LOW'; position: absolute; top: 10px; right: 10px;
  background: var(--red); color: white;
  font-size: 0.6rem; font-weight: 800;
  padding: 2px 6px; border-radius: var(--radius-full);
}
.product-sku { font-family: var(--font-mono); font-size: 0.7rem; color: var(--text-muted); }
.product-name { font-size: 0.95rem; font-weight: 600; margin: 4px 0; }
.product-brand { font-size: 0.78rem; color: var(--text-secondary); }
.product-prices {
  display: flex; align-items: baseline; gap: var(--space-sm);
  margin-top: var(--space-sm);
}
.product-price { font-size: 1.1rem; font-weight: 700; font-family: var(--font-mono); color: var(--green); }
.product-mrp { font-size: 0.78rem; color: var(--text-muted); text-decoration: line-through; }
.product-stock { font-size: 0.78rem; color: var(--text-secondary); }
.product-actions { display: flex; gap: var(--space-xs); margin-top: var(--space-sm); }

/* ── Billing / POS ─────────────────────────────────────────── */
.cart-item {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  margin-bottom: var(--space-sm);
}
.cart-item-name { font-size: 0.9rem; font-weight: 600; }
.cart-item-sku { font-family: var(--font-mono); font-size: 0.7rem; color: var(--text-muted); }
.qty-control {
  display: flex; align-items: center; gap: var(--space-sm);
  background: var(--bg-input);
  border-radius: var(--radius-md);
  padding: 4px;
}
.qty-btn {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-size: 1.1rem; font-weight: 700;
  transition: all 0.1s;
}
.qty-btn:active { background: var(--cyan-glow); color: var(--cyan); }
.qty-val { font-family: var(--font-mono); font-weight: 700; min-width: 28px; text-align: center; }

.bill-summary {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
  margin-top: var(--space-md);
}
.bill-row {
  display: flex; justify-content: space-between;
  padding: 6px 0;
  font-size: 0.85rem;
  border-bottom: 1px solid var(--border-light);
}
.bill-row:last-child { border-bottom: none; }
.bill-row.total {
  font-size: 1.1rem; font-weight: 800;
  color: var(--cyan);
  padding-top: var(--space-sm);
}
.bill-row-label { color: var(--text-secondary); }
.bill-row-val { font-family: var(--font-mono); font-weight: 600; }

.payment-btns { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: var(--space-sm); margin: var(--space-md) 0; }
.payment-btn {
  padding: var(--space-md);
  border-radius: var(--radius-md);
  border: 2px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 0.85rem; font-weight: 600;
  display: flex; flex-direction: column;
  align-items: center; gap: var(--space-xs);
  transition: all 0.15s;
}
.payment-btn.active { border-color: var(--cyan); background: var(--cyan-glow); color: var(--cyan); }
.payment-btn .pay-icon { font-size: 1.4rem; }

/* ── Lab Order Pipeline ────────────────────────────────────── */
.pipeline {
  display: flex; gap: 4px;
  overflow-x: auto; padding-bottom: 4px;
  margin-bottom: var(--space-md);
  scrollbar-width: none;
}
.pipeline::-webkit-scrollbar { display: none; }
.pipeline-step {
  flex-shrink: 0;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  font-size: 0.72rem; font-weight: 700;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
}
.pipeline-step.done { background: var(--green-bg); border-color: rgba(0,229,160,0.4); color: var(--green); }
.pipeline-step.current { background: var(--cyan-glow); border-color: var(--cyan); color: var(--cyan); }

.lab-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
  margin-bottom: var(--space-sm);
  transition: all 0.15s;
}
.lab-card.overdue { border-color: rgba(255,71,87,0.4); }
.lab-status-bar {
  display: flex; gap: 4px; margin-top: var(--space-sm);
}
.lab-status-dot {
  flex: 1; height: 4px; border-radius: 2px;
  background: var(--border);
  transition: background 0.3s;
}
.lab-status-dot.done { background: var(--green); }
.lab-status-dot.current { background: var(--cyan); }

/* ── Reports ───────────────────────────────────────────────── */
.date-range-row {
  display: flex; gap: var(--space-sm);
  margin-bottom: var(--space-md);
  align-items: center;
}
.date-range-row .form-input { flex: 1; }
.report-tabs {
  display: flex; gap: var(--space-xs);
  margin-bottom: var(--space-md);
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 4px;
}
.report-tab {
  flex: 1; padding: 8px;
  border-radius: var(--radius-sm);
  font-size: 0.78rem; font-weight: 600;
  color: var(--text-muted);
  transition: all 0.15s;
}
.report-tab.active { background: var(--bg-elevated); color: var(--cyan); }
.chart-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
  margin-bottom: var(--space-md);
}
.report-table { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
.report-table th {
  background: var(--bg-input); color: var(--text-muted);
  font-size: 0.7rem; font-weight: 700; text-transform: uppercase;
  padding: 8px; text-align: left; border-bottom: 1px solid var(--border);
}
.report-table td { padding: 8px; border-bottom: 1px solid var(--border-light); }
.report-table tr:last-child td { border-bottom: none; }
.report-total-row td { font-weight: 700; color: var(--cyan); background: var(--cyan-glow); }

/* ── Settings ──────────────────────────────────────────────── */
.settings-section { margin-bottom: var(--space-xl); }
.settings-section-title {
  font-size: 0.72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: var(--space-sm);
  padding: 0 var(--space-xs);
}
.settings-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--space-md);
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-xs);
  cursor: pointer;
  transition: all 0.15s;
}
.settings-item:hover { border-color: var(--border-focus); }
.settings-item-left { display: flex; align-items: center; gap: var(--space-md); }
.settings-item-icon {
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
}
.settings-item-label { font-size: 0.9rem; font-weight: 600; }
.settings-item-sub { font-size: 0.75rem; color: var(--text-secondary); margin-top: 1px; }
.settings-chevron { color: var(--text-muted); }

/* ── Developer Panel ───────────────────────────────────────── */
.dev-panel {
  background: var(--bg-base);
  border: 1px solid var(--purple);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
  margin-top: var(--space-md);
}
.dev-panel-title {
  font-family: var(--font-mono);
  font-size: 0.8rem; color: var(--purple);
  margin-bottom: var(--space-md);
  display: flex; align-items: center; gap: var(--space-sm);
}
.dev-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-sm); }
.dev-btn {
  padding: var(--space-sm) var(--space-md);
  background: rgba(123,47,255,0.1);
  border: 1px solid rgba(123,47,255,0.3);
  border-radius: var(--radius-sm);
  color: var(--purple);
  font-family: var(--font-mono);
  font-size: 0.75rem; font-weight: 600;
  transition: all 0.15s;
}
.dev-btn:hover { background: rgba(123,47,255,0.2); }

/* ── Invoice Print ─────────────────────────────────────────── */
@media print {
  body { background: white; color: black; font-family: 'Courier New', monospace; }
  .no-print { display: none !important; }
  .invoice { max-width: 80mm; margin: 0 auto; font-size: 11px; }
  .invoice-header { text-align: center; border-bottom: 1px dashed #000; padding-bottom: 8px; margin-bottom: 8px; }
  .invoice-store-name { font-size: 14px; font-weight: bold; }
  .invoice-table { width: 100%; border-collapse: collapse; }
  .invoice-table th, .invoice-table td { padding: 3px 4px; font-size: 10px; }
  .invoice-table th { border-bottom: 1px solid #000; }
  .invoice-divider { border-top: 1px dashed #000; margin: 6px 0; }
  .invoice-total { font-weight: bold; font-size: 13px; }
  .invoice-footer { text-align: center; margin-top: 8px; font-size: 10px; }
}

/* ── Utility ───────────────────────────────────────────────── */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-mono { font-family: var(--font-mono); }
.text-cyan { color: var(--cyan); }
.text-green { color: var(--green); }
.text-red { color: var(--red); }
.text-amber { color: var(--amber); }
.text-muted { color: var(--text-secondary); }
.text-sm { font-size: 0.8rem; }
.text-xs { font-size: 0.72rem; }
.fw-bold { font-weight: 700; }
.fw-800 { font-weight: 800; }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.w-full { width: 100%; }
.divider { height: 1px; background: var(--border-light); margin: var(--space-md) 0; }
.empty-state {
  text-align: center; padding: var(--space-2xl) var(--space-lg);
  color: var(--text-muted);
}
.empty-state-icon { font-size: 3rem; margin-bottom: var(--space-md); opacity: 0.5; }
.empty-state-text { font-size: 0.9rem; }
.spinner {
  width: 24px; height: 24px;
  border: 2px solid var(--border);
  border-top-color: var(--cyan);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: var(--space-md);
}
.page-header-title { font-size: 1.2rem; font-weight: 800; }
.app-footer {
  text-align: center;
  font-size: 0.65rem;
  color: var(--text-muted);
  padding: 4px;
  position: fixed;
  bottom: calc(var(--nav-h) + var(--safe-bottom));
  left: 0; right: 0;
  pointer-events: none;
  z-index: 89;
}

/* ── Scrollbar ─────────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── Responsive tweaks ─────────────────────────────────────── */
@media (min-width: 480px) {
  .app { border-left: 1px solid var(--border-light); border-right: 1px solid var(--border-light); }
}