/* ═════════════════════════════════════════════
   PharmSync ERP — Styles
   Layout: Top navigation + 3-column dispensing
═════════════════════════════════════════════ */

:root {
  --navy:        #1a3a6c;
  --navy-dark:   #0f2547;
  --primary:     #2563eb;
  --primary-hover: #1d4ed8;
  --tab-bg:      #e8eef7;
  --tab-active:  #1a3a6c;
  --success:     #16a34a;
  --warning:     #d97706;
  --danger:      #dc2626;
  --orange:      #e86c2c;
  --bg:          #f0f4f9;
  --panel:       #ffffff;
  --border:      #dce3ef;
  --text:        #1e293b;
  --text-muted:  #64748b;
  --muted:       #64748b;
  --radius:      12px;
}

/* ── Login Screen ─────────────────────────── */
html, body { height: 100%; }

.login-screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, #0f2547 0%, #1a3a6c 45%, #2563eb 100%);
  z-index: 9999;
  font-family: 'Segoe UI', Arial, sans-serif;
}
.login-screen.hidden { display: none !important; }

.login-card {
  background: #ffffff;
  border-radius: 20px;
  padding: 2.75rem 2.5rem 2.5rem;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.35);
}

.login-brand {
  text-align: center;
  margin-bottom: 2rem;
}
.login-icon {
  width: 64px;
  height: 64px;
  background: linear-gradient(135deg, #1a3a6c, #2563eb);
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
  box-shadow: 0 8px 20px rgba(37,99,235,0.4);
}
.login-icon svg {
  width: 32px; height: 32px;
  stroke: white; stroke-width: 2; fill: none; display: block;
}
.login-brand h1 {
  font-size: 1.75rem;
  font-weight: 700;
  color: #1a3a6c;
  margin-bottom: 0.25rem;
  letter-spacing: -0.5px;
}
.login-brand p {
  color: #64748b;
  font-size: 0.875rem;
}

.login-field {
  margin-bottom: 1.1rem;
}
.login-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: #374151;
  margin-bottom: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.login-input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1.5px solid #dce3ef;
  border-radius: 10px;
  font-size: 0.95rem;
  color: #1e293b;
  background: #f8fafc;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}
.login-input:focus {
  border-color: #2563eb;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
}

.login-error {
  background: #fef2f2;
  border: 1.5px solid #fecaca;
  color: #dc2626;
  border-radius: 8px;
  padding: 0.65rem 0.9rem;
  font-size: 0.85rem;
  margin-bottom: 1rem;
  font-weight: 500;
}
.login-error.hidden { display: none; }

.login-btn {
  width: 100%;
  padding: 0.85rem;
  background: linear-gradient(135deg, #1a3a6c, #2563eb);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 0.5rem;
  letter-spacing: 0.3px;
  transition: opacity 0.2s, transform 0.1s;
}
.login-btn:hover  { opacity: 0.92; }
.login-btn:active { transform: scale(0.98); }
.login-btn:disabled { opacity: 0.6; cursor: not-allowed; }

.topbar-username {
  font-size: 0.85rem;
  font-weight: 600;
  color: rgba(255,255,255,0.9);
  padding: 0.25rem 0.75rem;
  background: rgba(255,255,255,0.12);
  border-radius: 20px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Segoe UI', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}

/* ══════════════════════════════════════
   SVG ICON SIZING (Lucide)
══════════════════════════════════════ */
svg { display: block; fill: none; }
.brand-icon svg        { width: 36px; height: 36px; stroke: white; stroke-width: 2; }
.icon-btn svg          { width: 26px; height: 26px; stroke: currentColor; stroke-width: 1.75; }
.tab-item svg          { width: 18px; height: 18px; stroke: currentColor; stroke-width: 1.75; flex-shrink: 0; }
.tab-btn svg           { width: 14px; height: 14px; stroke: currentColor; stroke-width: 2; }
.qa-icon svg           { width: 32px; height: 32px; stroke: var(--primary); stroke-width: 1.5; }
.left-action-btn svg   { width: 15px; height: 15px; stroke: currentColor; stroke-width: 2; flex-shrink: 0; }
.bottom-btn svg        { width: 16px; height: 16px; stroke: currentColor; stroke-width: 2; }
.pay-btn svg           { width: 15px; height: 15px; stroke: currentColor; stroke-width: 2; }
.alerts-header svg     { width: 14px; height: 14px; stroke: currentColor; stroke-width: 2; }
.patient-avatar svg    { width: 26px; height: 26px; stroke: var(--muted); stroke-width: 1.5; }
.placeholder-icon svg  { width: 56px; height: 56px; stroke: var(--muted); stroke-width: 1.5; }

/* ══════════════════════════════════════
   APP WRAPPER
══════════════════════════════════════ */
.app-wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ══════════════════════════════════════
   TOP HEADER BAR
══════════════════════════════════════ */
.topbar {
  background: var(--navy);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  height: 56px;
  flex-shrink: 0;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-icon {
  font-size: 22px;
  line-height: 1;
}

.brand-name {
  font-size: 20px;
  font-weight: 800;
  color: white;
  letter-spacing: -0.4px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 4px;
}

.icon-btn {
  background: none;
  border: none;
  color: rgba(255,255,255,0.8);
  font-size: 18px;
  width: 38px; height: 38px;
  border-radius: 8px;
  cursor: pointer;
  display: grid; place-items: center;
  position: relative;
  transition: background 0.15s;
}

.icon-btn:hover { background: rgba(255,255,255,0.12); color: white; }

.notif-dot {
  position: absolute;
  top: 4px; right: 4px;
  background: #ef4444;
  color: white;
  font-size: 9px;
  font-weight: 800;
  border-radius: 999px;
  padding: 1px 4px;
  min-width: 16px;
  text-align: center;
}

/* ══════════════════════════════════════
   TAB NAVIGATION
══════════════════════════════════════ */
.tab-nav {
  background: var(--tab-bg);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 12px 20px;
  border-bottom: 2px solid var(--border);
  flex-shrink: 0;
  overflow-x: auto;
}

.tab-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 22px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: transparent;
  font-size: 15px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}

.tab-item:hover {
  background: rgba(37,99,235,0.08);
  color: var(--primary);
  border-color: rgba(37,99,235,0.2);
}

.tab-item.active {
  background: var(--tab-active);
  color: white;
  border-color: var(--tab-active);
}

/* ══════════════════════════════════════
   MAIN CONTENT
══════════════════════════════════════ */
.main-content {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

/* ══════════════════════════════════════
   MODULE SECTIONS
══════════════════════════════════════ */
.module { display: none; }
.module.active { display: block; }

/* ══════════════════════════════════════
   DISPENSING — HOME VIEW
══════════════════════════════════════ */
#dispense-home { padding: 0; }

.hero-banner {
  width: 100%;
  height: 180px;
  background: linear-gradient(135deg, var(--navy) 0%, #2563eb 60%, #1e40af 100%);
  display: flex;
  align-items: flex-end;
  padding: 24px 28px;
  position: relative;
  overflow: hidden;
}

.hero-banner::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 200 200"><circle cx="160" cy="40" r="80" fill="rgba(255,255,255,0.04)"/><circle cx="20" cy="160" r="100" fill="rgba(255,255,255,0.03)"/></svg>') no-repeat center/cover;
}

.hero-overlay {
  position: relative;
  z-index: 1;
}

.hero-overlay h2 {
  font-size: 28px;
  font-weight: 800;
  color: white;
  margin-bottom: 6px;
}

.hero-overlay p {
  font-size: 14px;
  color: rgba(255,255,255,0.75);
}

.section-header-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 20px 8px;
  flex-wrap: wrap;
}

.section-heading {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  flex: 1;
}

/* ── Quick Actions Grid ── */
.quick-actions-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
  padding: 8px 20px 16px;
}

.qa-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 18px 10px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.15s;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  text-align: center;
}

.qa-card:hover {
  border-color: var(--primary);
  background: #eff6ff;
  box-shadow: 0 4px 14px rgba(37,99,235,0.12);
  transform: translateY(-2px);
}

.qa-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 44px;
}
.qa-label { font-size: 12px; font-weight: 600; color: var(--muted); line-height: 1.3; }

/* ── Prescriptions Panel ── */
.prescriptions-panel {
  margin: 0 20px 20px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.panel-header-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}

.panel-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  flex: 1;
}

/* ══════════════════════════════════════
   DISPENSING — 3-COLUMN WORKSPACE
══════════════════════════════════════ */
#dispense-workspace { display: flex; flex-direction: column; height: calc(100vh - 132px); }

.workspace-nav-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 16px;
  background: white;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.workspace-rx-label {
  font-size: 14px;
  font-weight: 700;
  color: var(--primary);
}

.dispense-3col {
  display: grid;
  grid-template-columns: 230px 1fr 270px;
  gap: 0;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* ── LEFT: Patient Info ── */
.dispense-col-left {
  background: var(--panel);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.col-header {
  background: var(--navy);
  color: white;
  font-size: 13px;
  font-weight: 700;
  padding: 10px 14px;
  flex-shrink: 0;
}

.patient-avatar-section {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px;
  border-bottom: 1px solid var(--border);
}

.patient-avatar {
  width: 44px; height: 44px;
  background: #e0e7ef;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 22px;
  flex-shrink: 0;
}

.patient-name-big { font-weight: 700; font-size: 14px; }
.patient-sub { font-size: 11px; color: var(--muted); margin-top: 2px; }

.patient-info-rows { padding: 10px 14px; border-bottom: 1px solid var(--border); }

.info-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  padding: 4px 0;
}

.info-lbl { color: var(--muted); font-weight: 600; }

.alerts-header {
  background: #fff7ed;
  color: var(--orange);
  font-size: 12px;
  font-weight: 700;
  padding: 6px 14px;
  border-top: 1px solid #fed7aa;
  border-bottom: 1px solid #fed7aa;
}

.alert-tag {
  font-size: 11px;
  padding: 6px 14px;
  font-weight: 600;
  border-bottom: 1px solid var(--border);
}

.alert-tag.allergy { color: #991b1b; background: #fef2f2; }
.alert-tag.chronic { color: #166534; background: #f0fdf4; }

.left-actions {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: auto;
}

.left-action-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
  cursor: pointer;
  transition: all 0.15s;
  text-align: left;
}

.left-action-btn:hover { background: var(--primary); color: white; border-color: var(--primary); }

/* ── CENTER: Prescription Details ── */
.dispense-col-center {
  background: #fafbfc;
  overflow-y: auto;
  padding: 16px 18px;
  border-right: 1px solid var(--border);
}

.col-header { display: flex; align-items: center; gap: 10px; }

.rx-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  margin: 12px 0;
  font-size: 13px;
}

.prescribed-items-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 8px;
}

.prescribed-items-list {
  background: white;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 14px;
}

.prescribed-item-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.prescribed-item-row:last-child { border-bottom: none; }

.item-num {
  width: 22px; height: 22px;
  background: var(--primary);
  color: white;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
  display: grid; place-items: center;
  flex-shrink: 0;
}

.item-name { flex: 1; font-weight: 600; }
.item-dosage { font-size: 11px; color: var(--muted); }

.dispensing-sub-header {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--navy);
  margin: 14px 0 8px;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--primary);
}

.dispense-items-list {
  background: white;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 14px;
}

.dispense-item-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.dispense-item-row:last-child { border-bottom: none; }

.interaction-alert {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  color: #c2410c;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 12px;
}

.interaction-alert svg { width: 16px; height: 16px; stroke: currentColor; stroke-width: 2; flex-shrink: 0; }

.center-actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

.btn-approve {
  background: #166534;
  color: white;
  border-color: #166534;
  flex: 1;
}

.btn-approve:hover { background: #15803d; border-color: #15803d; }

.btn-dispense {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  flex: 1;
}

.btn-dispense:hover { background: var(--primary-hover); }

/* ── RIGHT: Medical Aid + Payment ── */
.dispense-col-right {
  background: var(--panel);
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.right-panel-box {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.right-box-title {
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.ma-scheme-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  font-weight: 700;
  font-size: 13px;
}

.badge-approved {
  background: #dcfce7;
  color: #166534;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
}

.ma-detail-rows { padding: 0 14px 10px; }

.ma-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  padding: 5px 0;
  border-bottom: 1px solid var(--border);
}

.ma-row:last-child { border-bottom: none; }
.highlight-row { font-weight: 700; color: var(--primary); }

.right-box-btns {
  display: flex;
  gap: 6px;
  padding: 10px 14px;
  border-top: 1px solid var(--border);
}

.btn-claim {
  flex: 1;
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.btn-claim:hover { background: var(--primary-hover); }

.btn-outline {
  flex: 1;
  background: white;
  border: 1px solid var(--border);
  color: var(--muted);
}

.mt-8 { margin-top: 0; } /* gap handles spacing */

.payment-summary-rows { padding: 8px 14px; }

.pay-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  padding: 5px 0;
  border-bottom: 1px solid var(--border);
}

.pay-row:last-child { border-bottom: none; }
.pay-row.highlight-row { font-weight: 700; color: var(--navy); }

.payment-method-btns {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
  padding: 10px 14px;
  border-top: 1px solid var(--border);
}

.pay-method-btn {
  padding: 8px 4px;
  border-radius: 8px;
  border: 2px solid var(--border);
  background: white;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;
}

.pay-method-btn:hover, .pay-method-btn.selected {
  border-color: var(--primary);
  background: #eff6ff;
  color: var(--primary);
}

.btn-process-payment {
  display: block;
  width: calc(100% - 28px);
  margin: 0 14px 6px;
  padding: 10px;
  background: var(--orange);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s;
}

.btn-process-payment:hover { background: #d35f21; }

.btn-print-labels {
  display: block;
  width: calc(100% - 28px);
  margin: 0 14px 14px;
  padding: 10px;
  background: var(--success);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s;
}

.btn-print-labels:hover { background: #15803d; }

/* ── Bottom Action Bar ── */
.bottom-action-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--navy-dark);
  flex-shrink: 0;
}

.bottom-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.25);
  background: transparent;
  color: rgba(255,255,255,0.85);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.bottom-btn:hover { background: rgba(255,255,255,0.12); color: white; border-color: rgba(255,255,255,0.5); }

/* ── Status Bar ── */
.status-bar {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 6px 16px;
  background: #1e293b;
  color: rgba(255,255,255,0.7);
  font-size: 12px;
  flex-shrink: 0;
}

.status-bar strong { color: white; }

#status-time { margin-left: auto; }

/* ══════════════════════════════════════
   PAGE HEADER (non-dispensing modules)
══════════════════════════════════════ */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 20px 14px;
  gap: 12px;
}

.page-header h2 {
  font-size: 20px;
  font-weight: 700;
}

.header-actions { display: flex; gap: 8px; }

/* ══════════════════════════════════════
   PANELS
══════════════════════════════════════ */
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}

/* ══════════════════════════════════════
   BUTTONS
══════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: white;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  transition: all 0.15s;
  white-space: nowrap;
}

.btn svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 2; flex-shrink: 0; }

.btn:hover { background: #f1f5f9; }

.btn-primary {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }

.btn-success { background: var(--success); color: white; border-color: var(--success); }
.btn-danger  { background: var(--danger);  color: white; border-color: var(--danger); }

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: 8px;
}

.btn-icon {
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 8px;
  width: 28px; height: 28px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 700;
}

/* ══════════════════════════════════════
   FORMS
══════════════════════════════════════ */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fafbfc;
  font-size: 13px;
  color: var(--text);
}

.form-input {
  width: 100%;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fafbfc;
  font-size: 13px;
  color: var(--text);
  box-sizing: border-box;
}

.field.full { grid-column: 1 / -1; }

.input-sm {
  width: 100%;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 12px;
}

.search-bar { margin-bottom: 14px; }

.search-bar input {
  width: 100%;
  max-width: 480px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  font-size: 13px;
  background: white;
}

/* ══════════════════════════════════════
   TABLES
══════════════════════════════════════ */
.data-table { width: 100%; border-collapse: collapse; }

.data-table th {
  text-align: left;
  padding: 10px 12px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  border-bottom: 2px solid var(--border);
  background: #f8fafc;
}

.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.data-table tr:hover td { background: #f8fafc; }

/* Prescriptions queue table inside panel */
#prescription-queue table { width: 100%; border-collapse: collapse; }

#prescription-queue th {
  text-align: left;
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  border-bottom: 2px solid var(--border);
  background: #f8fafc;
}

#prescription-queue td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

#prescription-queue tr:hover td { background: #f8fafc; }

.patient-name-link {
  color: var(--primary);
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}

.patient-name-link:hover { text-decoration: underline; }

/* ══════════════════════════════════════
   STATUS BADGES
══════════════════════════════════════ */
.status-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}

.status-badge.captured     { background: #fef3c7; color: #92400e; }
.status-badge.ready        { background: #dbeafe; color: #1e40af; }
.status-badge.dispensed    { background: #dcfce7; color: #166534; }
.status-badge.cancelled    { background: #fee2e2; color: #991b1b; }
.status-badge.approved     { background: #d1fae5; color: #065f46; }

.badge { display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.badge-green  { background: #dcfce7; color: #166534; }
.badge-yellow { background: #fef3c7; color: #92400e; }
.badge-red    { background: #fee2e2; color: #991b1b; }
.badge-blue   { background: #dbeafe; color: #1e40af; }
.badge-grey   { background: #f1f5f9; color: #475569; }

/* ══════════════════════════════════════
   POS LAYOUT
══════════════════════════════════════ */
.pos-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 18px;
  padding: 0 20px 20px;
}

.pos-items-panel, .pos-payment-panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}

.product-results { margin-bottom: 12px; max-height: 180px; overflow-y: auto; }

.product-result-item {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  font-size: 13px;
}

.product-result-item:hover { background: #eff6ff; }

.summary-box {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 14px;
}

.summary-row { display: flex; justify-content: space-between; padding: 6px 0; font-size: 13px; }
.total-row { border-top: 1px solid var(--border); padding-top: 10px; font-weight: 700; font-size: 15px; }

.payment-methods {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}

.pay-btn { display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%; }

.payment-result {
  background: #dcfce7;
  color: #166534;
  border-radius: 10px;
  padding: 12px;
  font-size: 13px;
  font-weight: 600;
}

/* ══════════════════════════════════════
   MEDICAL AID LAYOUT
══════════════════════════════════════ */
.ma-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  padding: 0 20px 20px;
}

.result-box {
  background: #0f172a;
  color: #e2e8f0;
  padding: 14px;
  border-radius: 12px;
  margin-top: 12px;
  font-size: 12px;
  min-height: 100px;
  overflow: auto;
}

/* ══════════════════════════════════════
   STOCK TABS
══════════════════════════════════════ */
.tabs-row { display: flex; gap: 8px; margin: 0 20px 14px; flex-wrap: wrap; }

.tab-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: white;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  transition: all 0.15s;
}

.tab-btn.active { background: var(--primary); color: white; border-color: var(--primary); }
#stock-tab-content { padding: 0 20px 20px; }

/* ══════════════════════════════════════
   PATIENT CARDS
══════════════════════════════════════ */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; padding: 0 20px 20px; }

.patient-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  transition: box-shadow 0.15s;
}

.patient-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.08); border-color: var(--primary); }
.patient-card-name { font-weight: 700; font-size: 15px; margin-bottom: 4px; }
.patient-card-meta { font-size: 12px; color: var(--muted); line-height: 1.8; }

/* ══════════════════════════════════════
   MODALS
══════════════════════════════════════ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-overlay.hidden { display: none; }

.modal {
  background: white;
  border-radius: 18px;
  padding: 24px;
  width: 90%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

.modal-wide { max-width: 780px; }

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}

.modal-header h3 { font-size: 18px; font-weight: 700; }

.modal-close {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--muted);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

/* ══════════════════════════════════════
   TOAST
══════════════════════════════════════ */
.toast {
  position: fixed;
  bottom: 24px; right: 24px;
  background: #0f172a;
  color: white;
  padding: 14px 20px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  z-index: 9999;
  box-shadow: 0 8px 30px rgba(0,0,0,0.25);
  transition: opacity 0.3s;
}

.toast.hidden { display: none; }
.toast.success { background: #166534; }
.toast.error   { background: #991b1b; }

/* ══════════════════════════════════════
   MODULE PLACEHOLDER
══════════════════════════════════════ */
.module-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 400px;
  gap: 16px;
}

.placeholder-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 80px;
}

/* ══════════════════════════════════════
   MISC
══════════════════════════════════════ */
.hidden { display: none !important; }
.empty-state { color: var(--muted); text-align: center; padding: 32px 16px; font-size: 13px; }
.divider { height: 1px; background: var(--border); margin: 16px 0; }
pre { white-space: pre-wrap; word-break: break-all; }

/* ══════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════ */
@media (max-width: 1100px) {
  .quick-actions-grid { grid-template-columns: repeat(3, 1fr); }
  .dispense-3col { grid-template-columns: 200px 1fr 240px; }
}

@media (max-width: 800px) {
  .quick-actions-grid { grid-template-columns: repeat(2, 1fr); }
  .dispense-3col { grid-template-columns: 1fr; }
  .dispense-col-left, .dispense-col-right { display: none; }
  .pos-layout, .ma-layout { grid-template-columns: 1fr; }
}


/* ══════════════════════════════════════
   SVG — WIZARD & NEW ELEMENTS
══════════════════════════════════════ */
.smart-dispense-bar svg  { width: 16px; height: 16px; stroke: currentColor; stroke-width: 2; }
.mode-btn svg            { width: 15px; height: 15px; stroke: currentColor; stroke-width: 2; }
.btn-start-encounter svg { width: 18px; height: 18px; stroke: currentColor; stroke-width: 2; }
.wiz-header svg          { width: 14px; height: 14px; stroke: currentColor; stroke-width: 2; }
.wiz-panel-title svg     { width: 18px; height: 18px; stroke: var(--primary); stroke-width: 2; }
.wiz-cancel-btn svg      { width: 15px; height: 15px; stroke: currentColor; stroke-width: 2; }
.wiz-footer svg          { width: 15px; height: 15px; stroke: currentColor; stroke-width: 2; }
.wiz-basket-title svg    { width: 16px; height: 16px; stroke: currentColor; stroke-width: 2; }
.red-flag-alert svg      { width: 20px; height: 20px; stroke: #dc2626; stroke-width: 2; flex-shrink:0; }
.patient-card-wiz .patient-avatar svg { width: 26px; height: 26px; stroke: var(--muted); stroke-width: 1.5; }
.wiz-icd-results svg     { width: 12px; height: 12px; stroke: currentColor; stroke-width: 2; }
.wiz-complete-layout svg { width: 15px; height: 15px; stroke: currentColor; stroke-width: 2; }
.btn-send-to-pos svg     { width: 18px; height: 18px; stroke: currentColor; stroke-width: 2; }
.panel-title svg         { width: 15px; height: 15px; stroke: var(--muted); stroke-width: 2; display:inline-block; vertical-align:middle; }
.dispensary-queue-panel .panel-title svg { stroke: var(--primary); }
.encounter-row svg       { width: 13px; height: 13px; stroke: currentColor; stroke-width: 2; }

/* ══════════════════════════════════════
   SMART DISPENSING BAR
══════════════════════════════════════ */
.smart-dispense-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  background: linear-gradient(135deg, var(--navy) 0%, #1e4d8c 100%);
  color: white;
  padding: 14px 20px;
  flex-wrap: wrap;
}

.smart-dispense-left {
  flex: 1;
  min-width: 160px;
}

.smart-dispense-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 2px;
}

.smart-dispense-sub {
  font-size: 12px;
  opacity: 0.75;
}

.mode-selector {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.mode-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  border: 2px solid rgba(255,255,255,0.3);
  background: transparent;
  color: rgba(255,255,255,0.75);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.mode-btn:hover {
  background: rgba(255,255,255,0.15);
  color: white;
  border-color: rgba(255,255,255,0.5);
}

.mode-btn.active {
  background: white;
  color: var(--navy);
  border-color: white;
}

.btn-start-encounter {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 22px;
  background: var(--orange);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}

.btn-start-encounter:hover { background: #d05c20; }

/* ══════════════════════════════════════
   ENCOUNTER QUEUE ROW
══════════════════════════════════════ */
.encounter-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  transition: background 0.12s;
}
.encounter-row:last-child { border-bottom: none; }
.encounter-row:hover { background: #f8faff; }
.encounter-row-patient { font-weight: 600; flex: 1; }
.encounter-row-meta { color: var(--muted); font-size: 12px; }
.encounter-mode-badge {
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}
.mode-otc { background: #dbeafe; color: #1d4ed8; }
.mode-prescription { background: #fef9c3; color: #92400e; }
.mode-repeat { background: #dcfce7; color: #166534; }
.enc-resume-btn {
  background: var(--primary);
  color: white;
  border: none;
  padding: 5px 14px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.enc-resume-btn:hover { background: var(--primary-hover); }

/* Dispensary POS queue */
.dispensary-enc-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.dispensary-enc-row:last-child { border-bottom: none; }
.dispensary-load-btn {
  background: var(--success);
  color: white;
  border: none;
  padding: 6px 16px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

/* ══════════════════════════════════════
   ENCOUNTER WIZARD
══════════════════════════════════════ */
#encounter-wizard {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 112px);  /* full height minus topbar + tab nav */
  background: var(--bg);
}

.wiz-header {
  background: var(--navy);
  color: white;
  flex-shrink: 0;
}

.wiz-title-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.15);
}

.wiz-cancel-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.25);
  color: white;
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.12s;
}
.wiz-cancel-btn:hover { background: rgba(255,0,0,0.25); }

.wiz-enc-num {
  font-size: 15px;
  font-weight: 700;
  margin-right: 4px;
}

.wiz-mode-badge {
  background: var(--orange);
  color: white;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.wiz-patient-label {
  flex: 1;
  font-size: 13px;
  opacity: 0.85;
}

/* Step progress bar */
.wiz-steps-bar {
  display: flex;
  padding: 0 18px;
}

.wiz-step-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 600;
  color: rgba(255,255,255,0.5);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: all 0.15s;
  white-space: nowrap;
  user-select: none;
}

.wiz-step-item.active {
  color: white;
  border-bottom-color: var(--orange);
}

.wiz-step-item.done {
  color: rgba(255,255,255,0.7);
}

.wiz-step-num {
  width: 20px; height: 20px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  font-size: 11px;
  display: grid; place-items: center;
  font-weight: 800;
}

.wiz-step-item.active .wiz-step-num {
  background: var(--orange);
  color: white;
}

.wiz-step-item.done .wiz-step-num {
  background: var(--success);
  color: white;
}

/* Wizard body */
.wiz-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 20px;
}

.wiz-panel { display: none; }
.wiz-panel.active { display: block; }

.wiz-panel-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 17px;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 14px;
}

.wiz-panel-desc {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 16px;
}

/* 2-column layout inside wizard */
.wiz-2col {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 18px;
}

.wiz-col-main { min-width: 0; }
.wiz-col-side { min-width: 0; }

/* Wizard search results */
.wiz-search-results {
  margin-top: 8px;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
  max-height: 320px;
  overflow-y: auto;
}

.wiz-patient-result {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: white;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.1s;
}
.wiz-patient-result:hover { background: #f0f4ff; }
.wiz-patient-result-name { font-weight: 600; font-size: 14px; }
.wiz-patient-result-sub { font-size: 12px; color: var(--muted); }

/* Patient card in wizard side */
.patient-card-wiz {
  background: white;
  border-radius: var(--radius);
  border: 2px solid var(--primary);
  padding: 16px;
}

.patient-card-header {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 12px;
}

.patient-card-name { font-size: 16px; font-weight: 700; }
.patient-card-sub { font-size: 12px; color: var(--muted); }

.patient-card-rows {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  margin-bottom: 10px;
}
.patient-card-rows > div {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  border-bottom: 1px solid var(--border);
}
.patient-card-rows span { color: var(--muted); }

.patient-allergy-tag {
  background: #fee2e2;
  color: #dc2626;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 6px;
  margin-bottom: 10px;
}

.wiz-history-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}
.wiz-pt-history-list { font-size: 12px; color: var(--muted); }

.wiz-divider {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--border);
  margin: 14px 0 10px;
}

/* Quick register form */
.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 10px;
}

/* ICD-10 search results */
.wiz-icd-results {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
  max-height: 340px;
  overflow-y: auto;
}

.icd-suggestion-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  cursor: pointer;
  transition: all 0.12s;
  display: flex;
  align-items: center;
  gap: 10px;
}
.icd-suggestion-card:hover {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(37,99,235,0.12);
}
.icd-card-code {
  font-size: 13px;
  font-weight: 800;
  color: var(--primary);
  min-width: 52px;
}
.icd-card-desc {
  flex: 1;
  font-size: 13px;
}
.icd-card-cat {
  font-size: 11px;
  color: var(--muted);
}
.icd-badges {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  margin-top: 4px;
}
.icd-badge {
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
}
.icd-badge.pharmacy  { background: #dbeafe; color: #1d4ed8; }
.icd-badge.pharmacist { background: #f3e8ff; color: #7e22ce; }
.icd-badge.patient   { background: #dcfce7; color: #166534; }

/* Selected diagnoses list */
.wiz-selected-block {
  background: white;
  border-radius: var(--radius);
  padding: 14px;
  border: 1px solid var(--border);
}
.wiz-selected-title {
  font-weight: 700;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  margin-bottom: 10px;
}
.wiz-selected-items {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.selected-icd-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 13px;
}
.selected-icd-chip-code { font-weight: 700; color: var(--primary); margin-right: 6px; }
.selected-icd-chip-desc { flex: 1; font-size: 12px; }
.selected-icd-remove {
  background: none;
  border: none;
  cursor: pointer;
  color: #dc2626;
  font-size: 16px;
  line-height: 1;
  padding: 0 3px;
}

/* Repeat patient history */
.wiz-repeat-section { margin-top: 16px; }
.repeat-icd-btn {
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12px;
  cursor: pointer;
  margin-bottom: 5px;
  width: 100%;
  text-align: left;
  transition: background 0.1s;
}
.repeat-icd-btn:hover { background: #eff6ff; border-color: var(--primary); }

/* ══════════════════════════════════════
   CLINICAL ASSESSMENT
══════════════════════════════════════ */
.assessment-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 14px;
}

.assess-question label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 5px;
}

.assess-flags {
  grid-column: 1 / -1;
}

.flag-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 24px;
}

.flag-checks label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
}

.red-flag-alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: #fee2e2;
  border: 1px solid #dc2626;
  border-radius: 10px;
  padding: 12px 16px;
  color: #7f1d1d;
  font-size: 13px;
  margin-top: 16px;
}

/* ══════════════════════════════════════
   MEDICINE SELECTION
══════════════════════════════════════ */
.wiz-med-layout {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 18px;
}
.wiz-med-left { min-width: 0; }
.wiz-med-right { min-width: 0; }

.wiz-med-suggestions {
  display: flex;
  flex-direction: column;
  gap: 7px;
  max-height: calc(100vh - 340px);
  overflow-y: auto;
  padding-right: 4px;
}

.med-suggestion-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  transition: all 0.12s;
}
.med-suggestion-card:hover {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(37,99,235,0.1);
}
.med-card-left { flex: 1; }
.med-card-name { font-size: 13px; font-weight: 700; color: var(--text); }
.med-card-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.med-card-price { font-size: 12px; color: var(--success); font-weight: 700; }
.med-badges {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-top: 5px;
}
.med-badge {
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
}
.med-badge.first-line { background: #fef3c7; color: #92400e; }
.med-badge.pharmacy  { background: #dbeafe; color: #1d4ed8; }
.med-badge.pharmacist { background: #f3e8ff; color: #7e22ce; }
.med-badge.patient   { background: #dcfce7; color: #166534; }
.med-badge.search    { background: #f1f5f9; color: var(--muted); }
.btn-add-med {
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 7px 14px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  align-self: flex-start;
  transition: background 0.12s;
}
.btn-add-med:hover { background: var(--primary-hover); }

/* Dispensing basket */
.wiz-basket-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 10px;
}
.wiz-basket-count {
  margin-left: auto;
  background: var(--primary);
  color: white;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
}
.wiz-basket {
  background: white;
  border: 1px solid var(--border);
  border-radius: 10px;
  min-height: 120px;
  max-height: calc(100vh - 420px);
  overflow-y: auto;
}
.basket-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.basket-item:last-child { border-bottom: none; }
.basket-item-info { flex: 1; }
.basket-item-name { font-weight: 600; }
.basket-item-sub { font-size: 11px; color: var(--muted); }
.basket-item-right { text-align: right; }
.basket-qty-row {
  display: flex;
  align-items: center;
  gap: 4px;
}
.basket-qty-input {
  width: 50px;
  padding: 3px 6px;
  border: 1px solid var(--border);
  border-radius: 5px;
  font-size: 12px;
  text-align: center;
}
.btn-remove-basket {
  background: none;
  border: none;
  color: #dc2626;
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
}
.wiz-basket-total-row {
  display: flex;
  justify-content: space-between;
  padding: 10px 12px;
  font-weight: 700;
  font-size: 15px;
  background: #f8faff;
  border-radius: 0 0 10px 10px;
  border: 1px solid var(--border);
  border-top: none;
}

/* ══════════════════════════════════════
   SAFETY CHECKS
══════════════════════════════════════ */
#wiz-safety-content {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 700px;
}
.safety-overall {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 6px;
}
.safety-GREEN { background: #dcfce7; color: #166534; border: 1px solid #86efac; }
.safety-AMBER { background: #fef9c3; color: #92400e; border: 1px solid #fde68a; }
.safety-RED   { background: #fee2e2; color: #7f1d1d; border: 1px solid #fca5a5; }

.safety-alert {
  display: flex;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 13px;
  border: 1px solid;
}
.safety-alert-RED   { background: #fee2e2; border-color: #fca5a5; color: #7f1d1d; }
.safety-alert-AMBER { background: #fef9c3; border-color: #fde68a; color: #78350f; }
.safety-alert-GREEN { background: #dcfce7; border-color: #86efac; color: #14532d; }
.safety-alert-msg { font-weight: 700; }
.safety-alert-detail { font-size: 12px; margin-top: 3px; opacity: 0.8; }

/* ══════════════════════════════════════
   COMPLETE STEP
══════════════════════════════════════ */
.wiz-complete-layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 20px;
}
.wiz-complete-right { min-width: 0; }

.complete-section-title {
  font-weight: 700;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  margin-bottom: 12px;
}

.complete-summary-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 9px 12px;
  background: white;
  border-radius: 8px;
  border: 1px solid var(--border);
  margin-bottom: 7px;
  font-size: 13px;
}
.complete-summary-name { font-weight: 600; }
.complete-summary-sub { font-size: 11px; color: var(--muted); margin-top: 2px; }
.complete-summary-price { font-weight: 700; color: var(--navy); text-align: right; }

.complete-total-row {
  display: flex;
  justify-content: space-between;
  padding: 12px 12px;
  font-weight: 800;
  font-size: 16px;
  border-top: 2px solid var(--navy);
  margin-top: 8px;
}

.counselling-checks {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 14px;
}
.counselling-checks label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  cursor: pointer;
}

.complete-payment-type {
  margin-bottom: 14px;
}
.complete-payment-type > label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 7px;
}
.complete-payment-btns {
  display: flex;
  gap: 7px;
}
.pay-type-btn {
  padding: 7px 16px;
  border: 2px solid var(--border);
  background: white;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.12s;
}
.pay-type-btn.active {
  border-color: var(--primary);
  background: #eff6ff;
  color: var(--primary);
}

.btn-send-to-pos {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px;
  background: var(--success);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-send-to-pos:hover { background: #15803d; }

.wiz-complete-success {
  background: #dcfce7;
  border: 1px solid #86efac;
  border-radius: 10px;
  padding: 16px;
  text-align: center;
  color: #166534;
  margin-top: 14px;
}
.complete-sale-num {
  font-size: 22px;
  font-weight: 900;
  margin: 6px 0;
}

/* ══════════════════════════════════════
   WIZARD FOOTER
══════════════════════════════════════ */
.wiz-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: white;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.wiz-step-indicator {
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
}

/* small shared helpers */
.empty-state-sm {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  padding: 16px;
}
.form-row { margin-bottom: 10px; }
.form-row label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 5px;
}
.form-row input, .form-row select, .form-row textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  background: white;
}
.form-row input:focus, .form-row select:focus, .form-row textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
}

/* ══════════════════════════════════════
   ASSESSMENT CARDS (Step 3)
══════════════════════════════════════ */
.assess-cards-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.assess-fullrow { grid-column: 1 / -1; }

.assess-card {
  background: white;
  border: 1.5px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px 18px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.assess-card-q {
  font-weight: 700;
  color: var(--navy);
  font-size: 13px;
  margin-bottom: 11px;
}

.assess-opts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.assess-opt {
  padding: 7px 16px;
  border: 1.5px solid #cbd5e1;
  border-radius: 999px;
  font-size: 12px;
  background: white;
  cursor: pointer;
  font-weight: 500;
  color: #334155;
  transition: all 0.12s;
  line-height: 1;
}
.assess-opt:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: #eff6ff;
}
.assess-opt.selected {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
  font-weight: 700;
}
.assess-opt.sev-mild.selected  { background: var(--success); border-color: var(--success); }
.assess-opt.sev-moderate.selected { background: #f59e0b; border-color: #f59e0b; }
.assess-opt.sev-severe.selected { background: #dc2626; border-color: #dc2626; }
.assess-opt.preg-flag.selected  { background: #9333ea; border-color: #9333ea; }

.assess-text-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.assess-redflag-card { border-color: #fca5a5; background: #fff8f8; }

.redflag-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.redflag-btn {
  padding: 10px 12px;
  border: 1.5px solid #e2e8f0;
  border-radius: 9px;
  text-align: left;
  background: white;
  cursor: pointer;
  font-size: 12px;
  color: #475569;
  font-weight: 500;
  transition: all 0.12s;
  line-height: 1.3;
}
.redflag-btn:hover {
  border-color: #fca5a5;
  background: #fef2f2;
  color: #dc2626;
}
.redflag-btn.flagged {
  background: #fef2f2;
  border-color: #dc2626;
  color: #dc2626;
  font-weight: 800;
  box-shadow: 0 0 0 2px rgba(220,38,38,0.15);
}


/* ASSESSMENT CARDS */
.assess-cards-grid{display:grid;grid-template-columns:1fr 1fr;gap:14px}
.assess-fullrow{grid-column:1/-1}
.assess-card{background:white;border:1.5px solid #e2e8f0;border-radius:12px;padding:16px 18px;box-shadow:0 1px 3px rgba(0,0,0,.05)}
.assess-card-q{font-weight:700;color:var(--navy);font-size:13px;margin-bottom:11px}
.assess-opts{display:flex;flex-wrap:wrap;gap:8px}
.assess-opt{padding:7px 16px;border:1.5px solid #cbd5e1;border-radius:999px;font-size:12px;background:white;cursor:pointer;font-weight:500;color:#334155;transition:all .12s;line-height:1}
.assess-opt:hover{border-color:var(--primary);color:var(--primary);background:#eff6ff}
.assess-opt.selected{background:var(--primary);border-color:var(--primary);color:white;font-weight:700}
.assess-opt.sev-mild.selected{background:var(--success);border-color:var(--success)}
.assess-opt.sev-moderate.selected{background:#f59e0b;border-color:#f59e0b}
.assess-opt.sev-severe.selected{background:#dc2626;border-color:#dc2626}
.assess-opt.preg-flag.selected{background:#9333ea;border-color:#9333ea}
.assess-text-row{display:flex;gap:12px;align-items:flex-start}
.assess-redflag-card{border-color:#fca5a5;background:#fff8f8}
.redflag-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:8px}
.redflag-btn{padding:10px 12px;border:1.5px solid #e2e8f0;border-radius:9px;text-align:left;background:white;cursor:pointer;font-size:12px;color:#475569;font-weight:500;transition:all .12s;line-height:1.3}
.redflag-btn:hover{border-color:#fca5a5;background:#fef2f2;color:#dc2626}
.redflag-btn.flagged{background:#fef2f2;border-color:#dc2626;color:#dc2626;font-weight:800;box-shadow:0 0 0 2px rgba(220,38,38,.15)}

/* ASSESSMENT CARDS */
.assess-cards-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.assess-fullrow { grid-column: 1 / -1; }
.assess-card { background: white; border: 1.5px solid #e2e8f0; border-radius: 12px; padding: 16px 18px; box-shadow: 0 1px 3px rgba(0,0,0,.05); }
.assess-card-q { font-weight: 700; color: var(--navy); font-size: 13px; margin-bottom: 11px; }
.assess-opts { display: flex; flex-wrap: wrap; gap: 8px; }
.assess-opt { padding: 7px 16px; border: 1.5px solid #cbd5e1; border-radius: 999px; font-size: 12px; background: white; cursor: pointer; font-weight: 500; color: #334155; transition: all .12s; line-height: 1; }
.assess-opt:hover { border-color: var(--primary); color: var(--primary); background: #eff6ff; }
.assess-opt.selected { background: var(--primary); border-color: var(--primary); color: white; font-weight: 700; }
.assess-opt.sev-mild.selected { background: var(--success); border-color: var(--success); }
.assess-opt.sev-moderate.selected { background: #f59e0b; border-color: #f59e0b; }
.assess-opt.sev-severe.selected { background: #dc2626; border-color: #dc2626; }
.assess-opt.preg-flag.selected { background: #9333ea; border-color: #9333ea; }
.assess-text-row { display: flex; gap: 12px; align-items: flex-start; }
.assess-redflag-card { border-color: #fca5a5; background: #fff8f8; }
.redflag-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.redflag-btn { padding: 10px 12px; border: 1.5px solid #e2e8f0; border-radius: 9px; text-align: left; background: white; cursor: pointer; font-size: 12px; color: #475569; font-weight: 500; transition: all .12s; line-height: 1.3; }
.redflag-btn:hover { border-color: #fca5a5; background: #fef2f2; color: #dc2626; }
.redflag-btn.flagged { background: #fef2f2; border-color: #dc2626; color: #dc2626; font-weight: 800; box-shadow: 0 0 0 2px rgba(220,38,38,.15); }


/* ======================================
   PATIENT MODULE LAYOUT
====================================== */
.patient-module-layout {
  display: grid;
  grid-template-columns: 1fr 420px;
  gap: 0;
  height: calc(100vh - 160px);
  overflow: hidden;
}
.patient-card-col {
  overflow-y: auto;
  padding: 0 16px 16px 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  align-content: start;
  gap: 12px;
}
.patient-card {
  background: white;
  border: 1.5px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px;
  cursor: pointer;
  transition: all 0.14s;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.patient-card:hover { border-color: var(--primary); box-shadow: 0 2px 8px rgba(37,99,235,.12); transform: translateY(-1px); }
.patient-card.selected { border-color: var(--primary); background: #eff6ff; }
.patient-card-name { font-weight: 700; font-size: 15px; color: var(--navy); margin-bottom: 5px; }
.patient-card-meta { font-size: 12px; color: var(--muted); line-height: 1.7; }

/* Detail panel */
.patient-detail-panel {
  background: white;
  border-left: 1.5px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.pt-detail-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid #e2e8f0;
  flex-shrink: 0;
  background: var(--navy);
  color: white;
}
.pt-detail-avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  display: grid; place-items: center;
  flex-shrink: 0;
}
.pt-detail-avatar svg { width: 22px; height: 22px; stroke: white; }
.pt-detail-name { font-weight: 800; font-size: 16px; }
.pt-detail-sub { font-size: 12px; opacity: 0.75; margin-top: 2px; }

/* Tabs */
.pt-detail-tabs {
  display: flex;
  border-bottom: 1px solid #e2e8f0;
  flex-shrink: 0;
  background: #f8fafc;
}
.pt-tab {
  flex: 1;
  padding: 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all .12s;
}
.pt-tab.active { color: var(--primary); border-bottom-color: var(--primary); background: white; }

/* Tab bodies */
.pt-detail-tab-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 18px;
}
.ptd-section-title {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  margin-bottom: 10px;
}

/* Info grid */
.ptd-info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.ptd-full { grid-column: 1 / -1; }
.ptd-info-row { font-size: 13px; }
.ptd-info-row span { display: block; font-size: 11px; color: var(--muted); font-weight: 600; margin-bottom: 2px; }
.ptd-info-row strong { color: #1e293b; }

.ptd-allergy-banner {
  display: flex; align-items: flex-start; gap: 10px;
  background: #fef2f2; border: 1.5px solid #fca5a5; border-radius: 10px;
  padding: 12px 14px; margin-bottom: 12px; color: #dc2626;
}
.ptd-allergy-banner svg { width: 18px; height: 18px; stroke: #dc2626; flex-shrink: 0; margin-top: 2px; }

/* Medical aid cards */
.ma-card {
  border: 1.5px solid #e2e8f0; border-radius: 10px; padding: 12px 14px; margin-bottom: 10px;
  background: linear-gradient(135deg, #f0f9ff, white);
}
.ma-card-scheme { font-weight: 800; font-size: 14px; color: var(--navy); }
.ma-card-number { font-size: 12px; color: #475569; font-family: monospace; margin-top: 3px; }
.ma-card-plan { font-size: 11px; color: var(--muted); margin-top: 2px; }
.ma-card-badge { font-size: 10px; font-weight: 700; background: var(--success); color: white; padding: 2px 8px; border-radius: 999px; margin-top: 4px; display: inline-block; }

.ptd-add-ma-form { border-top: 1px solid #e2e8f0; padding-top: 14px; margin-top: 10px; }

/* History rows */
.ptd-hist-row {
  padding: 10px 0; border-bottom: 1px solid #f1f5f9;
  font-size: 13px; display: flex; gap: 10px; align-items: flex-start;
}
.ptd-hist-date { font-size: 11px; color: var(--muted); white-space: nowrap; min-width: 70px; }
.ptd-hist-body { flex: 1; }
.ptd-hist-badges { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.ptd-hist-badge { font-size: 10px; background: #e0f2fe; color: #0369a1; border-radius: 999px; padding: 2px 7px; font-weight: 700; }

.modal-section-title {
  font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); padding: 4px 0 8px; border-bottom: 1px solid #e2e8f0; margin-bottom: 10px;
}


/* ======================================
   PATIENT MODULE LAYOUT
====================================== */
.patient-module-layout {
  display: grid;
  grid-template-columns: 1fr 420px;
  gap: 0;
  height: calc(100vh - 160px);
  overflow: hidden;
}
.patient-card-col {
  overflow-y: auto;
  padding: 0 16px 16px 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  align-content: start;
  gap: 12px;
}
.patient-card {
  background: white;
  border: 1.5px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px;
  cursor: pointer;
  transition: all 0.14s;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.patient-card:hover { border-color: var(--primary); box-shadow: 0 2px 8px rgba(37,99,235,.12); transform: translateY(-1px); }
.patient-card.selected { border-color: var(--primary); background: #eff6ff; }
.patient-card-name { font-weight: 700; font-size: 15px; color: var(--navy); margin-bottom: 5px; }
.patient-card-meta { font-size: 12px; color: var(--muted); line-height: 1.7; }

.patient-detail-panel {
  background: white;
  border-left: 1.5px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.pt-detail-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid #e2e8f0;
  flex-shrink: 0;
  background: var(--navy);
  color: white;
}
.pt-detail-avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  display: grid; place-items: center; flex-shrink: 0;
}
.pt-detail-avatar svg { width: 22px; height: 22px; stroke: white; }
.pt-detail-name { font-weight: 800; font-size: 16px; }
.pt-detail-sub { font-size: 12px; opacity: 0.75; margin-top: 2px; }
.pt-detail-tabs { display: flex; border-bottom: 1px solid #e2e8f0; flex-shrink: 0; background: #f8fafc; }
.pt-tab { flex: 1; padding: 10px; font-size: 12px; font-weight: 600; color: var(--muted); background: none; border: none; border-bottom: 2px solid transparent; cursor: pointer; transition: all .12s; }
.pt-tab.active { color: var(--primary); border-bottom-color: var(--primary); background: white; }
.pt-detail-tab-body { flex: 1; overflow-y: auto; padding: 16px 18px; }
.ptd-section-title { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 10px; }
.ptd-info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.ptd-full { grid-column: 1 / -1; }
.ptd-info-row { font-size: 13px; }
.ptd-info-row span { display: block; font-size: 11px; color: var(--muted); font-weight: 600; margin-bottom: 2px; }
.ptd-info-row strong { color: #1e293b; }
.ptd-allergy-banner { display: flex; align-items: flex-start; gap: 10px; background: #fef2f2; border: 1.5px solid #fca5a5; border-radius: 10px; padding: 12px 14px; margin-bottom: 12px; color: #dc2626; }
.ptd-allergy-banner svg { width: 18px; height: 18px; stroke: #dc2626; flex-shrink: 0; margin-top: 2px; }
.ma-card { border: 1.5px solid #e2e8f0; border-radius: 10px; padding: 12px 14px; margin-bottom: 10px; background: linear-gradient(135deg, #f0f9ff, white); }
.ma-card-scheme { font-weight: 800; font-size: 14px; color: var(--navy); }
.ma-card-number { font-size: 12px; color: #475569; font-family: monospace; margin-top: 3px; }
.ma-card-plan { font-size: 11px; color: var(--muted); margin-top: 2px; }
.ma-card-badge { font-size: 10px; font-weight: 700; background: var(--success); color: white; padding: 2px 8px; border-radius: 999px; margin-top: 4px; display: inline-block; }
.ptd-add-ma-form { border-top: 1px solid #e2e8f0; padding-top: 14px; margin-top: 10px; }
.ptd-hist-row { padding: 10px 0; border-bottom: 1px solid #f1f5f9; font-size: 13px; display: flex; gap: 10px; align-items: flex-start; }
.ptd-hist-date { font-size: 11px; color: var(--muted); white-space: nowrap; min-width: 70px; }
.ptd-hist-body { flex: 1; }
.ptd-hist-badges { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.ptd-hist-badge { font-size: 10px; background: #e0f2fe; color: #0369a1; border-radius: 999px; padding: 2px 7px; font-weight: 700; }
.modal-section-title { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 4px 0 8px; border-bottom: 1px solid #e2e8f0; margin-bottom: 10px; }

/* ══════════════════════════════════════
   POS 3-PANEL REDESIGN
══════════════════════════════════════ */
.pos-3panel {
  display: grid;
  grid-template-columns: 280px 1fr 260px;
  gap: 14px;
  padding: 0 20px 20px;
  min-height: 0;
}

.pos-queue-col,
.pos-basket-col,
.pos-payment-col {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pos-col-heading {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
}
.pos-col-heading svg { width: 14px; height: 14px; }

/* Dispensary queue rows */
.pos-queue-list { display: flex; flex-direction: column; gap: 6px; overflow-y: auto; max-height: 320px; }

.pos-queue-row {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 11px;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.pos-queue-row:hover { background: #eff6ff; border-color: var(--primary); }

.pos-queue-patient {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  margin-bottom: 5px;
}
.pos-queue-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--muted);
}
.pos-queue-amount { font-weight: 700; color: var(--navy); font-size: 13px; }
.pos-queue-ma {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  background: #fdf2f8;
  border: 1px solid #fbcfe8;
  border-radius: 999px;
  padding: 1px 7px;
  color: #9d174d;
}
.pos-queue-ma svg { width: 11px; height: 11px; stroke: #9d174d; }

.pos-add-retail { display: flex; flex-direction: column; gap: 6px; }

/* Patient header banner inside basket column */
.pos-patient-header {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  padding: 10px 13px;
}
.pos-ph-left { display: flex; align-items: center; gap: 9px; }
.pos-ph-left svg { width: 20px; height: 20px; stroke: var(--primary); }
.pos-ph-name { font-weight: 700; font-size: 14px; }
.pos-ph-meta { font-size: 12px; color: var(--muted); }
.pos-ph-ma {
  display: flex; align-items: center; gap: 4px;
  font-size: 12px; font-weight: 600; color: #9d174d;
  background: #fdf2f8; border: 1px solid #fbcfe8;
  border-radius: 999px; padding: 2px 9px;
}
.pos-ph-ma svg { width: 13px; height: 13px; stroke: #9d174d; }

.pos-basket-title-row { display: flex; align-items: center; gap: 10px; }

/* MA section in payment column */
.pos-ma-section {
  background: #fdf4ff;
  border: 1px solid #e9d5ff;
  border-radius: 10px;
  padding: 12px;
}
.pos-ma-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.pos-ma-label input[type="checkbox"] { width: 16px; height: 16px; cursor: pointer; }

.pos-pay-btns { display: flex; flex-direction: column; gap: 8px; }
.pos-pay-btns .pay-btn { width: 100%; justify-content: center; }

/* Product type badges */
.product-type-badge {
  font-size: 10px;
  font-weight: 700;
  border-radius: 999px;
  padding: 2px 8px;
  text-transform: uppercase;
  letter-spacing: .04em;
  white-space: nowrap;
}
.badge-shelf        { background: #f1f5f9; color: #475569; }
.badge-otc          { background: #dcfce7; color: #166534; }
.badge-pharmacist_only { background: #fef3c7; color: #92400e; }
.badge-prescription_only { background: #fee2e2; color: #991b1b; }
.badge-dispensed    { background: #e0f2fe; color: #075985; }
.badge-retail       { background: #f0fdf4; color: #166534; }
.badge-mixed        { background: #f5f3ff; color: #6d28d9; }

/* MA payment modal card info */
.ma-pay-card-info {
  background: #fdf4ff;
  border: 1px solid #e9d5ff;
  border-radius: 8px;
  padding: 10px 13px;
  font-weight: 700;
  font-size: 14px;
  color: #6d28d9;
}

/* ══════════════════════════════════════
   PATIENT DISPENSING POPUP MODAL
══════════════════════════════════════ */
.pdp-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  padding: 0 0 12px;
}
.pdp-section-title {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.pdp-section-title svg { width: 14px; height: 14px; }

.pdp-ma-cards { display: flex; flex-direction: column; gap: 8px; }
.pdp-ma-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  padding: 9px 12px;
}
.pdp-ma-card svg { width: 18px; height: 18px; stroke: #16a34a; flex-shrink: 0; margin-top: 2px; }
.pdp-ma-scheme { font-weight: 700; font-size: 13px; }
.pdp-ma-num { font-size: 12px; color: var(--muted); }

.pdp-repeat-list { display: flex; flex-direction: column; gap: 8px; overflow-y: auto; max-height: 260px; }
.pdp-script-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 12px;
}
.pdp-script-name { font-weight: 600; font-size: 13px; }
.pdp-script-sub  { font-size: 12px; color: var(--muted); }
.pdp-script-meta { font-size: 11px; color: var(--muted); text-align: right; display: flex; flex-direction: column; gap: 3px; white-space: nowrap; }

/* Wizard Step 6 MA indicator */
.wiz-complete-ma-section {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fdf4ff;
  border: 1px solid #e9d5ff;
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 13px;
  font-weight: 600;
  color: #7c3aed;
  margin-bottom: 8px;
}
.wiz-complete-ma-section svg { width: 16px; height: 16px; stroke: #7c3aed; flex-shrink: 0; }

/* ─── Quick OTC Button ─────────────────────────────────── */
.btn-quick-otc {
  background: #f59e0b;
  color: white;
  border: none;
  border-radius: 10px;
  padding: 10px 18px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 14px;
  margin-left: 8px;
  transition: background .2s;
}
.btn-quick-otc:hover { background: #d97706; }
.btn-quick-otc svg { width: 16px; height: 16px; }

/* ─── Prescription Panel (Step 1) ──────────────────────── */
.wiz-rx-panel {
  border: 2px solid #bfdbfe;
  border-radius: 12px;
  padding: 18px;
  margin-top: 18px;
  background: #f0f9ff;
}
.wiz-rx-panel-title {
  font-weight: 800;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #1d4ed8;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.wiz-rx-panel-title svg { width: 16px; height: 16px; }
.wiz-rx-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 18px;
}
@media (max-width: 700px) { .wiz-rx-grid { grid-template-columns: 1fr; } }
.rx-source-btns { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.rx-src-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: white;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  transition: background .15s, border-color .15s;
}
.rx-src-btn svg { width: 13px; height: 13px; }
.rx-src-btn.active { background: var(--primary); color: white; border-color: var(--primary); }
.rx-src-btn:hover:not(.active) { background: #f1f5f9; }

/* ─── Prescriber Section ───────────────────────────────── */
.wiz-prescriber-section {
  margin-top: 16px;
  border-top: 1px solid #bfdbfe;
  padding-top: 14px;
}
.wiz-prescriber-heading {
  display: flex;
  align-items: center;
  gap: 7px;
  font-weight: 700;
  font-size: 13px;
  color: #1e40af;
  margin-bottom: 10px;
}
.wiz-prescriber-heading svg { width: 15px; height: 15px; }
.wiz-prescriber-card {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 10px;
  padding: 12px 14px;
  margin-top: 8px;
}
.prescriber-card-body {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.prescriber-icon { width: 20px; height: 20px; stroke: #16a34a; flex-shrink: 0; margin-top: 2px; }
.prescriber-info { flex: 1; min-width: 0; }
.prescriber-name { font-weight: 700; font-size: 14px; }
.prescriber-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.prescriber-valid-badge {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  color: #16a34a;
  background: #dcfce7;
  border-radius: 6px;
  padding: 3px 8px;
  flex-shrink: 0;
}
.prescriber-valid-badge svg { width: 12px; height: 12px; }
.wiz-new-prescriber-form {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  margin-top: 10px;
}

/* ─── Prescription Mode Banner (Step 4) ────────────────── */
.wiz-rx-mode-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 600;
  color: #1d4ed8;
  margin-bottom: 12px;
}
.wiz-rx-mode-banner svg { width: 15px; height: 15px; }

/* ─── Med Search Type Buttons ──────────────────────────── */
.wiz-med-search-type {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.med-srch-type-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px 11px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: white;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  transition: background .15s;
}
.med-srch-type-btn svg { width: 12px; height: 12px; }
.med-srch-type-btn.active { background: var(--primary); color: white; border-color: var(--primary); }
.form-hint { font-size: 11px; color: var(--muted); font-weight: 400; margin-left: 6px; }

/* ─── Basket Item Enhancements ──────────────────────────── */
.item-cat-badge {
  display: inline-flex;
  align-items: center;
  font-size: 10px;
  font-weight: 700;
  border-radius: 5px;
  padding: 1px 7px;
  margin-right: 5px;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.item-cat-badge-DISPENSED  { background: #e0f2fe; color: #0369a1; }
.item-cat-badge-ADDITIONAL { background: #f1f5f9; color: #475569; }
.item-cat-badge-OTC_ADDON  { background: #dcfce7; color: #166534; }
.basket-item-substituted { font-size: 11px; color: #d97706; font-weight: 600; margin-top: 2px; }
.basket-item-substituted-bg { background: #fffbeb; }
.basket-item-rx { font-size: 11px; color: var(--muted); margin-top: 3px; }
.basket-qty-owing { color: var(--danger); font-weight: 700; }
.basket-rx-actions {
  display: flex;
  gap: 5px;
  margin-top: 5px;
}
.btn-rx-action {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border: 1px solid #bfdbfe;
  border-radius: 5px;
  background: #eff6ff;
  color: #1d4ed8;
  cursor: pointer;
  white-space: nowrap;
}
.btn-rx-action:hover { background: #dbeafe; }

/* ─── Substitution Modal ────────────────────────────────── */
.sub-original-banner {
  background: #fef9c3;
  border: 1px solid #fde68a;
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.sub-label { font-size: 11px; font-weight: 700; text-transform: uppercase; color: #92400e; }
.sub-product-name { font-weight: 700; font-size: 14px; flex: 1; }
.sub-qty { font-size: 12px; color: var(--muted); }
.sub-alternatives-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
  margin-bottom: 8px;
}
.sub-alternatives-list { max-height: 260px; overflow-y: auto; }
.sub-alt-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  border-radius: 8px;
  transition: background .12s;
}
.sub-alt-row:hover { background: #f0f9ff; }
.sub-alt-row.selected { background: #dbeafe; border-color: #93c5fd; }
.sub-alt-name { font-weight: 600; flex: 1; font-size: 13px; }
.sub-alt-meta { font-size: 11px; color: var(--muted); }
.sub-alt-price { font-size: 12px; font-weight: 700; color: var(--success); }
.sub-alt-stock { font-size: 11px; font-weight: 600; }
.sub-alt-stock.ok { color: #16a34a; }
.sub-alt-stock.low { color: #dc2626; }

/* ─── Partial Fill Modal ─────────────────────────────────── */
/* (uses standard form-row layout) */

/* ══════════════════════════════════════
   SETTINGS MODULE
══════════════════════════════════════ */
.settings-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 0;
  height: calc(100vh - 120px);
  background: var(--panel);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  margin: 0 18px 18px;
}

.settings-nav {
  background: #f8fafc;
  border-right: 1px solid var(--border);
  padding: 1rem 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.settings-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0.75rem 1.25rem;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.875rem;
  color: var(--text);
  text-align: left;
  border-radius: 0;
  transition: background 0.15s;
}
.settings-nav-item svg { width: 16px; height: 16px; stroke: currentColor; stroke-width: 2; fill: none; flex-shrink: 0; }
.settings-nav-item:hover { background: #e8eef7; }
.settings-nav-item.active { background: #e8eef7; color: var(--navy); font-weight: 600;
  border-left: 3px solid var(--primary); }

.settings-content {
  padding: 1.5rem;
  overflow-y: auto;
}

.settings-panel { display: block; }
.settings-panel.hidden { display: none; }

.settings-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}
.settings-panel-header h3 { font-size: 1.1rem; color: var(--navy); }

/* ── Import UI ─────────────────────── */
.import-guide {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  max-width: 700px;
}

.import-step {
  display: flex;
  gap: 1.25rem;
  align-items: flex-start;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem;
}

.import-step-num {
  width: 32px; height: 32px;
  background: var(--navy);
  color: white;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.9rem; font-weight: 700;
  flex-shrink: 0;
}

.import-step strong { display: block; margin-bottom: 0.35rem; color: var(--navy); }
.import-step p { font-size: 0.85rem; color: var(--muted); margin-bottom: 0.6rem; }
.import-step code {
  background: #e8eef7; color: var(--navy);
  padding: 1px 5px; border-radius: 4px; font-size: 12px;
}

.import-upload-zone {
  border: 2px dashed var(--primary);
  border-radius: 10px;
  padding: 2rem 1.5rem;
  text-align: center;
  background: #f0f4fb;
  cursor: pointer;
  margin-top: 0.75rem;
}
.import-upload-zone svg { width: 36px; height: 36px; stroke: var(--primary); stroke-width: 1.5; margin: 0 auto 0.5rem; }
.import-upload-zone p { font-size: 0.875rem; color: var(--muted); margin-bottom: 0.75rem; }

.import-result { margin-top: 1rem; padding: 0.75rem 1rem; border-radius: 8px; font-size: 0.875rem; display: flex; align-items: center; gap: 8px; }
.import-result svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; flex-shrink: 0; }
.import-result-success { background: #f0fdf4; border: 1px solid #bbf7d0; color: var(--success); }
.import-result-error   { background: #fef2f2; border: 1px solid #fecaca; color: var(--danger); }
.import-progress { display: flex; align-items: center; gap: 8px; color: var(--muted); background: #f8fafc; border: 1px solid var(--border); border-radius: 8px; padding: 0.75rem; }

/* ══════════════════════════════════════
   PRICING MODULE
══════════════════════════════════════ */
.search-input-sm {
  padding: 0.45rem 0.9rem;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 0.875rem;
  outline: none;
  width: 260px;
}
.search-input-sm:focus { border-color: var(--primary); }

/* ══════════════════════════════════════
   COMPANY SETTINGS TAB
══════════════════════════════════════ */
.company-settings-grid { display: flex; flex-direction: column; gap: 24px; }
.company-section { background: #f8fafc; border: 1px solid var(--border); border-radius: 12px; padding: 20px; }
.company-section h4 { font-size: 0.9rem; font-weight: 600; color: var(--navy); margin-bottom: 14px; }
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 18px; }
@media (max-width: 700px) { .form-grid-2 { grid-template-columns: 1fr; } }
.logo-upload-area { display: flex; align-items: center; justify-content: center; min-height: 90px; border: 2px dashed var(--border); border-radius: 10px; background: #fff; padding: 12px; }
.logo-placeholder { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 0.875rem; }
.logo-placeholder svg { width: 22px; height: 22px; }

/* Form group / control — used in settings + modals */
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.form-control {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  background: #fff;
  outline: none;
  transition: border-color 0.15s;
}
.form-control:focus { border-color: var(--primary); }
textarea.form-control { resize: vertical; min-height: 80px; }

/* ══════════════════════════════════════
   POS PRINT BUTTONS
══════════════════════════════════════ */
.pos-print-btns { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.pos-print-btns .btn { flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; }
.pos-print-btns svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 2; }
/* ══════════════════════════════════════
   ACCOUNTING MODULE
══════════════════════════════════════ */
.acct-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(155px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}
.acct-card {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
  transition: box-shadow 0.15s;
}
.acct-card-total {
  background: var(--navy);
  color: white;
}
.acct-card-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}
.acct-card-total .acct-card-label { color: rgba(255, 255, 255, 0.65); }
.acct-card-value {
  font-size: 22px;
  font-weight: 800;
  margin-top: 6px;
  color: var(--text);
}
.acct-card-total .acct-card-value { color: white; }
.form-input-sm {
  padding: 6px 10px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 12px;
  font-family: inherit;
  outline: none;
  background: #fff;
  color: var(--text);
  transition: border-color 0.15s;
}
.form-input-sm:focus { border-color: var(--primary); }
.modal-lg { max-width: 860px; width: 95vw; }
.modal-body { padding: 0 24px 16px; }
.badge-blue { background: #dbeafe; color: #1d4ed8; }