/* ═════════════════════════════════════════════
   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; }

/* ─── PIN Pad (POS login) ───────────────── */
.pos-pin-dot {
  width: 18px; height: 18px;
  border-radius: 50%;
  border: 2px solid #d1d5db;
  background: transparent;
  transition: background .12s, border-color .12s;
  display: inline-block;
}
.pos-pin-dot.filled { background: #6366f1; border-color: #6366f1; }
.pos-pin-pad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  max-width: 220px;
  margin: 0 auto 4px;
}
.pin-key {
  padding: 14px 10px;
  font-size: 20px;
  font-weight: 600;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  transition: background .1s, transform .08s;
  user-select: none;
}
.pin-key:hover  { background: #f3f4f6; }
.pin-key:active { background: #e5e7eb; transform: scale(0.95); }
.pin-key-clear  { font-size: 16px; color: #ef4444; }
.pin-key-ok     { background: #6366f1; color: #fff; border-color: transparent; font-size: 18px; }
.pin-key-ok:hover { background: #4f46e5; }

/* ─── Compact POS terminal login card ───────────────── */
.pos-terminal-page .login-card {
  max-width: 320px;
  padding: 1.5rem 1.5rem 1.25rem;
  border-radius: 16px;
}
.pos-terminal-page .login-brand { margin-bottom: 1rem; }
.pos-terminal-page .login-brand h1 { font-size: 1.35rem; }
.pos-terminal-page .login-icon {
  width: 48px; height: 48px; border-radius: 14px; margin-bottom: 0.6rem;
}
.pos-terminal-page .login-icon svg { width: 24px; height: 24px; }
.pos-terminal-page .login-field { margin-bottom: 0.75rem; }
.pos-terminal-page .pos-pin-pad { gap: 6px; max-width: 195px; }
.pos-terminal-page .pin-key { padding: 10px 8px; font-size: 17px; border-radius: 8px; }
.pos-terminal-page .login-btn { padding: 0.65rem; font-size: 0.9rem; }

.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;
}

/* Notification / Messages Panel */
.notif-panel {
  position: absolute; top: 42px; right: 0; width: 360px; max-height: 440px;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(0,0,0,.18); z-index: 1000; display: flex; flex-direction: column;
}
.notif-panel.hidden { display: none; }
.notif-panel-header {
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; font-size: 14px;
}
.notif-panel-body { flex: 1; overflow-y: auto; max-height: 340px; }
.notif-panel-footer { padding: 8px 12px; border-top: 1px solid var(--border); }
.notif-item {
  padding: 10px 16px; border-bottom: 1px solid #f1f5f9; cursor: pointer;
  display: flex; gap: 10px; align-items: flex-start; font-size: 13px; transition: background .1s;
}
.notif-item:hover { background: #f8fafc; }
.notif-item.unread { background: #eff6ff; }
.notif-item .notif-icon { flex-shrink: 0; width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-size: 14px; }
.notif-item .notif-icon.warn { background: #fef3c7; color: #d97706; }
.notif-item .notif-icon.danger { background: #fee2e2; color: #dc2626; }
.notif-item .notif-icon.info { background: #dbeafe; color: #2563eb; }
.notif-item .notif-icon.success { background: #dcfce7; color: #16a34a; }
.notif-item .notif-body { flex: 1; }
.notif-item .notif-title { font-weight: 600; font-size: 13px; }
.notif-item .notif-desc { color: var(--muted); font-size: 12px; margin-top: 2px; }
.notif-item .notif-time { color: var(--muted); font-size: 11px; margin-top: 3px; }

/* POS Tools Dropdown */
.pos-tools-dropdown {
  position: absolute; top: 100%; left: 0; z-index: 999; min-width: 200px;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0,0,0,.15); padding: 6px 0;
}
.pos-tools-dropdown.hidden { display: none; }
.pos-tools-dropdown button {
  display: flex; align-items: center; gap: 8px; width: 100%; padding: 10px 16px;
  background: none; border: none; font-size: 13px; cursor: pointer; color: var(--text);
  text-align: left; transition: background .1s;
}
.pos-tools-dropdown button:hover { background: #f1f5f9; }
.pos-tools-dropdown button i { width: 16px; height: 16px; flex-shrink: 0; }

/* ══════════════════════════════════════
   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: 260px minmax(0, 600px) 280px;
  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;
  min-height: 0;
  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;
  min-height: 0;
  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; }

/* ── Script items compact table ── */
.script-table-wrap {
  overflow-x: auto;
  width: 100%;
}

.script-items-tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
  table-layout: fixed;
}

.script-items-tbl thead tr {
  background: var(--navy);
  color: white;
}

.script-items-tbl th {
  padding: 5px 6px;
  text-align: left;
  font-weight: 700;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.script-items-tbl td {
  padding: 5px 6px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.script-items-tbl tbody tr:last-child td { border-bottom: none; }
.script-items-tbl tbody tr:hover { background: #f0f6ff; }

/* Column widths */
.script-items-tbl th:nth-child(1), .script-items-tbl td:nth-child(1) { width: 40px; }  /* Type */
.script-items-tbl th:nth-child(2), .script-items-tbl td:nth-child(2) { width: auto; }  /* Description */
.script-items-tbl th:nth-child(3), .script-items-tbl td:nth-child(3) { width: 44px; }  /* Qty */
.script-items-tbl th:nth-child(4), .script-items-tbl td:nth-child(4) { width: 72px; }  /* SEP */
.script-items-tbl th:nth-child(5), .script-items-tbl td:nth-child(5) { width: 56px; }  /* Disp.Fee */
.script-items-tbl th:nth-child(6), .script-items-tbl td:nth-child(6) { width: 56px; }  /* N/C */
.script-items-tbl th:nth-child(7), .script-items-tbl td:nth-child(7) { width: 36px; }  /* N/D */
.script-items-tbl th:nth-child(8), .script-items-tbl td:nth-child(8) { width: 68px; }  /* Total */

.num-cell { text-align: right; }
.desc-cell { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 0; }

.total-cell { font-weight: 700; color: var(--navy); }

.rx-type-badge {
  display: inline-block;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.03em;
}
.rx-type-badge.rx  { background: #dbeafe; color: #1e40af; }
.rx-type-badge.otc { background: #dcfce7; color: #166534; }

.guide-hint {
  display: block;
  font-size: 9px;
  color: var(--muted);
  font-style: italic;
}

.pack-hint {
  font-size: 9px;
  color: var(--muted);
  margin-left: 2px;
}

.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;
  min-height: 0;
  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; }

/* ── Export / Print buttons ── */
.btn-export {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  background: #f0f4f8;
  color: #1e3a5f;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.btn-export:hover { background: #1e3a5f; color: #fff; border-color: #1e3a5f; }
.btn-export svg   { width: 14px; height: 14px; stroke: currentColor; stroke-width: 2; flex-shrink: 0; }

/* ── GRN Receive Stock Modal ── */
.grn-section-title { font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em; color: var(--muted); margin: 16px 0 8px; }
.grn-items-table td { padding: 4px 6px; vertical-align: middle; }
.grn-items-table th { padding: 6px 6px; }

.grn-product-cell { min-width: 180px; width: 100%; }
.grn-product-search-wrap { position: relative; }
.grn-product-input { width: 100%; font-size: 12px; }
.grn-product-dropdown { position: fixed; z-index: 9999;
  background: #fff; border: 1px solid var(--border); border-radius: 6px;
  box-shadow: 0 4px 24px rgba(0,0,0,.18); max-height: 280px; overflow-y: auto; }
.grn-drop-item { padding: 8px 10px; cursor: pointer; border-bottom: 1px solid var(--border); }
.grn-drop-item:hover { background: #eff6ff; }
.grn-drop-item:last-child { border-bottom: none; }
.grn-drop-add-new { padding: 8px 10px; cursor: pointer; border-top: 1px solid var(--border); background: #f0f9ff; }
.grn-drop-add-new:hover { background: #e0f2fe; }
.grn-drop-name { font-size: 12px; font-weight: 600; color: var(--text); }
.grn-drop-meta { font-size: 11px; color: var(--muted); font-weight: 400; }
.grn-drop-detail { font-size: 11px; color: var(--muted); margin-top: 2px; }
.grn-drop-empty { padding: 10px; font-size: 12px; color: var(--muted); text-align: center; }

.grn-product-selected { display: flex; align-items: center; gap: 6px; padding: 4px 6px;
  background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 6px;
  font-size: 12px; font-weight: 600; color: #1e3a5f; }
.grn-clear-product { background: none; border: none; color: #94a3b8; cursor: pointer;
  font-size: 14px; padding: 0 2px; line-height: 1; }
.grn-clear-product:hover { color: var(--danger); }

.grn-input-sm { font-size: 12px; padding: 5px 7px; width: 100%; box-sizing: border-box; }
.grn-input-num { text-align: right; }
.grn-remove-row { background: none; border: none; color: #cbd5e1; font-size: 18px;
  cursor: pointer; padding: 0 4px; line-height: 1; border-radius: 4px; }
.grn-remove-row:hover { color: var(--danger); background: #fef2f2; }
.grn-add-row-btn { margin-top: 10px; display: inline-flex; align-items: center;
  gap: 6px; font-size: 13px; color: var(--primary); background: none;
  border: 1px dashed var(--primary); border-radius: 6px; padding: 6px 14px; cursor: pointer; }
.grn-add-row-btn:hover { background: #eff6ff; }

/* ── Journal Entry Form ── */
.jnl-hint { padding: 10px 14px; background: #eff6ff; border: 1px solid #bfdbfe;
  border-radius: 8px; font-size: 12px; color: #1e3a5f; line-height: 1.5; }
.jnl-lines-table td { padding: 4px 6px; vertical-align: middle; }
.jnl-lines-table th { padding: 6px 6px; }
.jnl-acct-select { font-size: 12px; }
.jnl-balance { font-size: 12px; color: var(--muted); }
.jnl-add-line-btn { font-size: 12px; color: var(--primary); background: none;
  border: 1px dashed var(--primary); border-radius: 6px; padding: 5px 12px; cursor: pointer; }
.jnl-add-line-btn:hover { background: #eff6ff; }
.jnl-remove-line { background: none; border: none; color: #cbd5e1; font-size: 18px;
  cursor: pointer; padding: 0 4px; line-height: 1; border-radius: 4px; }
.jnl-remove-line:hover { color: var(--danger); background: #fef2f2; }

/* ── 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:disabled, .btn[disabled] { opacity: 0.45; cursor: not-allowed; pointer-events: none; }

.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-purple { background: #ede9fe; color: #5b21b6; }
.badge-orange { background: #ffedd5; color: #9a3412; }
.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; flex-shrink: 0; }

.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; }
/* Stacked modal — sits above another open modal */
.modal-overlay.modal-stacked { z-index: 1100; }

.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-grn  { max-width: 1180px; width: 98vw; max-height: 92vh; display: flex; flex-direction: column; padding: 0; }
.modal-grn .modal-header { padding: 20px 28px 16px; margin-bottom: 0; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.modal-grn .modal-body   { padding: 20px 28px; overflow-y: auto; flex: 1 1 auto; }
.modal-grn .modal-footer { padding: 14px 28px 20px; margin-top: 0; border-top: 1px solid var(--border); flex-shrink: 0; }

/* GRN header grid */
.grn-header-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}
.grn-header-grid .form-group { margin-bottom: 0; }

/* GRN barcode scan row */
.grn-scan-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding: 8px 12px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
}

/* GRN section title */
.grn-section-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .02em;
  color: var(--text-secondary, #475569);
  text-transform: uppercase;
  margin-bottom: 8px;
}

/* GRN items table */
.grn-items-table th, .grn-items-table td { padding: 6px 8px; vertical-align: middle; }
.grn-input-sm  { width: 100%; padding: 4px 6px; font-size: 12px; min-width: 0; }
.grn-input-num { text-align: right; }
.grn-free-qty  { color: #16a34a; font-weight: 600; }
.grn-remove-row {
  background: none; border: none; cursor: pointer; color: #dc2626; font-size: 16px;
  padding: 0 4px; line-height: 1;
}
.grn-remove-row:hover { color: #991b1b; }
.grn-add-row-btn { margin-top: 8px; font-size: 12px; padding: 5px 12px; }

/* GRN product search */
.grn-product-cell { position: relative; min-width: 180px; }
.grn-product-selected {
  display: flex; align-items: center; gap: 4px;
  padding: 4px 6px; background: #eff6ff; border: 1px solid #93c5fd;
  border-radius: 6px;
}
.grn-clear-product {
  background: none; border: none; cursor: pointer;
  font-size: 11px; color: #64748b; margin-left: auto;
  padding: 0 2px;
}

/* GRN summary box */
.grn-summary-box {
  display: flex;
  gap: 0;
  margin-top: 20px;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: #f8fafc;
}
.grn-summary-col { flex: 1; padding: 16px 20px; }
.grn-summary-divider { width: 1px; background: var(--border); flex-shrink: 0; }
.grn-summary-title {
  font-size: 11px; font-weight: 700; letter-spacing: .05em;
  text-transform: uppercase; color: var(--muted); margin-bottom: 10px;
}
.grn-summary-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 4px 0; font-size: 13px; gap: 12px;
}
.grn-summary-total {
  border-top: 1px solid var(--border); margin-top: 6px; padding-top: 8px;
  font-size: 15px;
}
.grn-invoice-total-input {
  width: 130px; text-align: right; padding: 4px 8px;
  font-size: 14px; font-weight: 600;
}

/* GRN variance messages */
.grn-variance-msg {
  font-size: 12px; margin-top: 8px; padding: 6px 10px;
  border-radius: 6px; font-weight: 600;
}
.grn-variance-ok   { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.grn-variance-warn { background: #fef2f2; color: #dc2626; border: 1px solid #fca5a5; }

.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: 210px 1fr 240px; }
  .wiz-s4-top { grid-template-columns: 1fr 1fr 1fr; }
}

@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); }
.enc-reopen-btn { background: #f59e0b; }
.enc-reopen-btn:hover { background: #d97706; }
.enc-barcode-btn {
  background: none;
  border: 1px solid #a5b4fc;
  color: #6366f1;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  line-height: 1;
}
.enc-barcode-btn:hover { background: #ede9fe; }
.enc-delete-btn {
  background: none;
  border: 1px solid #fca5a5;
  color: #ef4444;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  line-height: 1;
}
.enc-delete-btn:hover { background: #fee2e2; }

/* 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;
  flex: 1;
  min-height: 0;
  height: calc(100vh - 112px);  /* full height minus topbar + tab nav */
  max-height: calc(100vh - 112px);
  background: var(--bg);
  overflow: hidden;  /* prevent content pushing footer off-screen */
}

/* When wizard is open, fill main area — no outer page scroll stealing wheel events */
.main-content.wiz-open {
  overflow: hidden !important;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
#module-dispensing.wiz-open {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
#module-dispensing.wiz-open #encounter-wizard:not(.hidden) {
  flex: 1;
  min-height: 0;
  height: auto;
  max-height: none;
}

.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;
  min-height: 0;  /* flex child must shrink */
}

.wiz-panel { display: none; }
.wiz-panel.active { display: block; max-width: 1100px; }
#wiz-step-4.wiz-panel.active { max-width: none; }

.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: 65% 1fr;
  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);
  cursor: pointer;
}
.med-suggestion-card.med-card-selected {
  border-color: var(--primary);
  background: #eff6ff;
  box-shadow: 0 0 0 2px rgba(37,99,235,0.2);
}
.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-bottom-row { display: flex; align-items: center; gap: 8px; margin-top: 3px; flex-wrap: wrap; }
.med-card-price { font-size: 12px; color: var(--success); font-weight: 700; }

/* Stock pills */
.stock-pill { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 10px; font-weight: 700; }
.stock-pill-ok  { background: #dcfce7; color: #166534; }
.stock-pill-low { background: #fef3c7; color: #92400e; }
.stock-pill-out { background: #fee2e2; color: #991b1b; }

/* Sig / directions */
.sig-input-wrap { position: relative; margin-top: 6px; }
.sig-input {
  width: 100%;
  padding: 6px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 13px;
  color: var(--text);
  background: #f8faff;
}
.sig-input:focus {
  outline: none;
  border-color: var(--primary);
  background: white;
  box-shadow: 0 0 0 2px rgba(37,99,235,0.12);
}
.sig-dropdown {
  position: absolute;
  top: calc(100% + 2px);
  left: 0;
  z-index: 200;
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  min-width: 260px;
  max-height: 220px;
  overflow-y: auto;
}
.sig-dropdown.hidden { display: none; }
.sig-drop-item {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 7px 11px;
  cursor: pointer;
  font-size: 12px;
  border-bottom: 1px solid #f1f5f9;
}
.sig-drop-item:last-child { border-bottom: none; }
.sig-drop-item:hover { background: #f0f9ff; }
.sig-drop-item strong { color: var(--primary); min-width: 60px; }
.sig-drop-item span { color: var(--text); flex: 1; }
.sig-drop-cat { color: var(--muted); font-size: 10px; }
.sig-expanded-preview {
  margin-top: 3px;
  font-size: 11px;
  color: #0369a1;
  background: #e0f2fe;
  border-radius: 5px;
  padding: 3px 8px;
  font-style: italic;
}
.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: 14px;
}
.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; }

.btn-print-labels-wiz {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 11px 14px;
  background: var(--panel);
  color: var(--primary);
  border: 2px solid var(--primary);
  border-radius: 10px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  margin-top: 8px;
}
.btn-print-labels-wiz:hover { background: var(--primary); color: white; }
.btn-print-labels-wiz svg { width: 16px; height: 16px; stroke: currentColor; stroke-width: 2; }
.btn-print-dispense-summary {
  border-color: #0f766e;
  color: #0f766e;
}
.btn-print-dispense-summary:hover { background: #0f766e; color: white; }

.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;
  z-index: 10;
}

.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-clickable { cursor: pointer; border-radius: 6px; padding-left: 4px; padding-right: 4px; }
.ptd-hist-clickable:hover { background: #f8fafc; }
.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-clickable { cursor: pointer; border-radius: 6px; padding-left: 4px; padding-right: 4px; }
.ptd-hist-clickable:hover { background: #f8fafc; }
.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
══════════════════════════════════════ */

/* Wide encounter-start modal */
.modal-encounter-start {
  width: min(1100px, 96vw) !important;
  max-width: min(1100px, 96vw) !important;
  max-height: 90vh;
  display: flex !important;
  flex-direction: column;
  overflow: hidden;
  padding: 0 !important;
}
.modal-encounter-start .modal-header { padding: 16px 20px; margin-bottom: 0; flex-shrink: 0; }
.modal-encounter-start .modal-footer { flex-shrink: 0; padding: 14px 20px; border-top: 1px solid var(--border); margin-top: 0; }

/* 3-column layout */
.pdp-3col-layout {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
  padding: 16px 20px;
  overflow-y: auto;
  flex: 1;
}
@media (max-width: 820px) {
  .pdp-3col-layout { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 540px) {
  .pdp-3col-layout { grid-template-columns: 1fr; }
}

.pdp-col { display: flex; flex-direction: column; gap: 0; }
.pdp-col-header {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--primary);
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--primary-light, #e0e7ff);
  display: flex;
  align-items: center;
  gap: 6px;
}
.pdp-col-header svg { width: 13px; height: 13px; }

/* Patient detail rows (Col 1) */
.pdp-detail-list { display: flex; flex-direction: column; gap: 5px; }
.pdp-detail-row {
  display: flex;
  gap: 8px;
  font-size: 13px;
  padding: 4px 0;
  border-bottom: 1px solid #f1f5f9;
}
.pdp-detail-lbl { font-weight: 600; color: var(--muted); min-width: 88px; flex-shrink: 0; }
.pdp-detail-val { color: var(--text); word-break: break-word; }

/* Visit history (Col 3 lower) */
.pdp-visit-row {
  display: flex;
  gap: 8px;
  font-size: 12px;
  padding: 5px 0;
  border-bottom: 1px solid #f1f5f9;
}
.pdp-visit-date { color: var(--muted); white-space: nowrap; min-width: 78px; flex-shrink: 0; }
.pdp-visit-diag { color: var(--text); }

/* Mode pills in popup footer */
.pdp-mode-pills { display: flex; gap: 6px; }
.pdp-mode-pill {
  padding: 5px 14px;
  border: 2px solid var(--border);
  border-radius: 20px;
  background: #fff;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  color: var(--text);
  transition: all .15s;
}
.pdp-mode-pill.active, .pdp-mode-pill:hover {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

/* Old 2-col layout kept for fallback */
.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: 200px; }
.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; }

/* Rx queue action buttons */
.rx-action-cell { display: flex; flex-wrap: wrap; gap: 4px; }
.btn-xs {
  padding: 3px 9px;
  font-size: 11px;
  font-weight: 700;
  border-radius: 5px;
  border: 1px solid var(--border);
  background: #f8fafc;
  cursor: pointer;
  white-space: nowrap;
  line-height: 1.4;
}
.btn-xs:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-xs.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-xs.btn-primary:hover { filter: brightness(1.1); }
.btn-xs.btn-danger-sm { border-color: #e74c3c; color: #e74c3c; }
.btn-xs.btn-danger-sm:hover { background: #e74c3c; color: #fff; }

/* ── MA main/dependent relationship selector ─────────────── */
.pdp-rel-group { margin-top: 10px; }
.pdp-rel-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 6px; }
.pdp-rel-opts { display: flex; gap: 8px; }
.pdp-rel-opt {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border: 2px solid var(--border);
  border-radius: 20px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: all .15s;
  background: #fff;
}
.pdp-rel-opt:has(input:checked) { border-color: var(--primary); background: var(--primary); color: #fff; }
.pdp-rel-opt input { display: none; }

/* MA card rel badge */
.pdp-ma-rel-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 800;
  vertical-align: middle;
  text-transform: uppercase;
}
.badge-main { background: #d1fae5; color: #065f46; }
.badge-dep  { background: #fef3c7; color: #92400e; }

/* ── Doctor search in popup ──────────────────────────────── */
.pdp-doc-search-wrap { position: relative; }
.pdp-doc-input { width: 100%; margin-bottom: 0; }
.pdp-doc-results {
  position: absolute;
  left: 0; right: 0; top: 100%;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0,0,0,.12);
  z-index: 200;
  max-height: 200px;
  overflow-y: auto;
}
.pdp-doc-results:empty { display: none; }

/* Selected doctor card */
.pdp-doc-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  padding: 9px 12px;
  margin-top: 6px;
}
.pdp-doc-card-info { flex: 1; min-width: 0; }
.pdp-doc-name { font-weight: 700; font-size: 13px; }
.pdp-doc-sub { font-size: 11px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Add new doctor inline form */
.pdp-add-doc-btn { margin-top: 8px; color: var(--primary); border-color: var(--primary); }
.pdp-add-doc-form {
  margin-top: 8px;
  padding: 12px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.pdp-add-doc-form .form-row { margin-bottom: 6px; }
.pdp-add-doc-form label { font-size: 11px; font-weight: 700; color: var(--muted); display: block; margin-bottom: 3px; }
.pdp-add-doc-form input { width: 100%; padding: 6px 10px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px; }


/* 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;
  overflow-y: auto;
  min-height: 0;
}

.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); }

/* ── In-app docs/manuals ─────────────────────── */
.docs-quick-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}
.docs-quick-links a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #f8fafc;
  color: var(--navy);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}
.docs-quick-links svg { width: 14px; height: 14px; }
.docs-manual {
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-width: 1100px;
}
.manual-hero,
.manual-section {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  padding: 18px;
}
.manual-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 16px;
  background: linear-gradient(135deg, #f8fafc, #eef2ff);
}
.manual-hero h4,
.manual-section h4 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
  color: var(--navy);
  font-size: 16px;
}
.manual-section h4 svg { width: 18px; height: 18px; }
.manual-hero p {
  margin: 0;
  color: var(--text);
  line-height: 1.6;
  font-size: 13px;
}
.manual-note {
  border: 1px solid #c7d2fe;
  border-radius: 10px;
  background: #eef2ff;
  padding: 12px;
  font-size: 12px;
  line-height: 1.5;
  color: #3730a3;
}
.manual-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}
.manual-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #f8fafc;
  padding: 14px;
}
.manual-card h5 {
  margin: 0 0 8px;
  color: var(--navy);
  font-size: 13px;
}
.manual-card ol,
.manual-card ul,
.manual-section details ol {
  margin: 0;
  padding-left: 18px;
  color: var(--text);
  font-size: 12px;
  line-height: 1.6;
}
.manual-section details {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #f8fafc;
  padding: 12px 14px;
  margin-top: 10px;
}
.manual-section summary {
  cursor: pointer;
  color: var(--navy);
  font-weight: 700;
  font-size: 13px;
}
.manual-section details[open] summary { margin-bottom: 8px; }

@media (max-width: 900px) {
  .manual-hero { grid-template-columns: 1fr; }
}

/* ── 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; }
/* ═══════════════════════════════════════════
   POS FUNCTION BAR — DROPDOWN GROUPS
══════════════════════════════════════════ */

/* Bar container */
.pos-fn-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
  position: relative;
  z-index: 50;
}

/* Each dropdown wrapper */
.pos-dd {
  position: relative;
}

/* The visible trigger button */
.pos-dd-trigger {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  background: transparent;
  border: 1.5px solid transparent;
  cursor: pointer;
  color: var(--text);
  white-space: nowrap;
  transition: background .12s, border-color .12s, color .12s;
  user-select: none;
}

.pos-dd-trigger svg {
  width: 15px;
  height: 15px;
  stroke: currentColor;
  stroke-width: 2;
}

.pos-dd-caret {
  width: 13px !important;
  height: 13px !important;
  opacity: .55;
  transition: transform .15s;
  margin-left: 2px;
}

.pos-dd-trigger:hover {
  background: var(--tab-bg);
  border-color: var(--border);
}

/* Active group trigger (one of its items is selected) */
.pos-dd-trigger.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* Rotate caret when open */
.pos-dd.open .pos-dd-caret {
  transform: rotate(180deg);
}

/* Dropdown menu */
.pos-dd-menu {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 180px;
  background: white;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,.10);
  padding: 4px;
  z-index: 200;
}

.pos-dd.open .pos-dd-menu {
  display: block;
}

/* Individual menu items */
.pos-dd-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 9px 12px;
  border: none;
  border-radius: 7px;
  background: transparent;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  white-space: nowrap;
  transition: background .1s;
}

.pos-dd-item svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  stroke-width: 2;
  opacity: .7;
}

.pos-dd-item:hover {
  background: var(--tab-bg);
}

.pos-dd-item.active {
  background: #eff6ff;
  color: var(--primary);
  font-weight: 700;
}

.pos-dd-item.active svg {
  opacity: 1;
}

/* Active panel label in the bar */
.pos-fn-active-label {
  margin-left: auto;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  padding-right: 4px;
}

/* Panels */
.pos-fn-panel { /* normal flow */ }
.pos-fn-panel.hidden { display: none; }

/* ── Helpers reused across POS panels ── */
.form-stack { display: flex; flex-direction: column; gap: 12px; }
.form-row { display: flex; flex-direction: column; gap: 4px; }
.form-row label { font-size: 12px; font-weight: 600; color: var(--muted); }

/* Accounting summary cards (petty cash) */
.acct-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
}
.acct-card-label { font-size: 11px; color: var(--muted); font-weight: 600; }
.acct-card-value { font-size: 20px; font-weight: 800; margin-top: 2px; }
/* Total-sales KPI cards: navy bg + white text on both owner dashboard and accounting summary */
.acct-cards .acct-card-total,
.acct-kpi-grid .acct-card-total {
  background: var(--navy);
  color: white;
}
.acct-cards .acct-card-total .acct-card-label,
.acct-kpi-grid .acct-card-total .acct-card-label {
  color: rgba(255, 255, 255, 0.65);
}
.acct-cards .acct-card-total .acct-card-value,
.acct-kpi-grid .acct-card-total .acct-card-value {
  color: white;
}

/* ── Accounting reports ── */
.acct-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 8px;
}
.acct-report-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
@media (max-width: 900px) { .acct-report-2col { grid-template-columns: 1fr; } }
.acct-section-title {
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--primary);
  border-bottom: 2px solid var(--primary);
  padding-bottom: 4px;
  margin-bottom: 8px;
}
.acct-bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 120px;
  padding: 4px 0;
}
.acct-bar-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  height: 100%;
  justify-content: flex-end;
  gap: 2px;
}
.acct-bar {
  width: 100%;
  background: var(--primary);
  border-radius: 4px 4px 0 0;
  min-height: 4px;
  transition: height 0.3s;
}
.acct-bar-label { font-size: 9px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; text-align: center; }
.acct-bar-day   { font-size: 9px; font-weight: 600; color: var(--text); white-space: nowrap; }
.acct-report-statement { padding: 0 4px; }

/* Two-column helper panels */
.petty-cash-layout,
.overrides-layout,
.loyalty-layout {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 16px;
  padding: 0 20px 20px;
}
.batch-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 16px;
  padding: 0 20px 20px;
}

/* ═══════════════════════════════════════════════════════════
   COMPOUND / MIX PREPARATION
═══════════════════════════════════════════════════════════ */
.item-cat-badge-COMPOUND { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.basket-item-compound { background: #fafff8; border-left: 3px solid #22c55e; }
.cmpd-ingredients-heading {
  display: flex; justify-content: space-between; align-items: center;
  font-weight: 600; font-size: 13px; margin: 10px 0 6px;
  padding: 6px 0; border-bottom: 1px solid var(--border);
}
.cmpd-ingredient-row { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; }
.cmpd-ingredient-row .cmpd-ing-name { flex: 1; min-width: 0; }
.cmpd-remove-btn { width: 26px; height: 26px; padding: 0; border-radius: 50%; font-size: 16px; flex-shrink: 0; }
.cmpd-note { font-size: 11px; color: var(--muted); margin-top: 10px; padding: 6px 10px; background: #f8fafc; border-radius: 6px; }
.cmpd-ing-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.cmpd-ing-tag { font-size: 10px; background: #dcfce7; color: #166534; border-radius: 20px; padding: 2px 8px; font-weight: 500; }
.btn-compound { background: #d1fae5; color: #065f46; border: 1px solid #6ee7b7; }
.btn-compound:hover { background: #a7f3d0; }
.complete-compound-badge { display: inline-block; font-size: 10px; font-weight: 700; background: #22c55e; color: #fff; border-radius: 4px; padding: 1px 6px; margin-right: 4px; }
.complete-summary-compound { background: #f0fdf4; border-left: 3px solid #22c55e; }

/* Pharmacist indicator — Step 6 */
.wiz-complete-pharmacist {
  display: flex; align-items: center; gap: 8px;
  background: #eff6ff; border: 1px solid #bfdbfe;
  border-radius: 8px; padding: 9px 12px;
  font-size: 13px; color: #1d4ed8; margin-bottom: 8px; margin-top: 4px;
}
.wiz-complete-pharmacist svg { width: 16px; height: 16px; stroke: #1d4ed8; flex-shrink: 0; }

/* ═══════════════════════════════════════════════════════════
   SCRIPT ENTRY WINDOW  (all-in-one dispensing modal)
═══════════════════════════════════════════════════════════ */
#modal-script-entry.modal-overlay {
  padding: 0 !important; align-items: stretch !important; justify-content: stretch !important;
}
.se-window {
  width: 100vw; height: 100vh;
  background: #f0f2f5;
  display: flex; flex-direction: column;
  font-family: 'Segoe UI', Arial, sans-serif; font-size: 12px;
  overflow: hidden; border-radius: 0;
}

/* Title bar */
.se-titlebar {
  background: var(--navy); color: #fff;
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 16px; font-size: 13px; font-weight: 700;
  flex-shrink: 0; user-select: none; gap: 12px;
}
.se-titlebar-left { display: flex; align-items: center; gap: 14px; }
.se-titlebar-script { font-size: 11px; color: #94a3b8; font-weight: 400; }
.se-titlebar-mode { font-size: 10px; font-weight: 700; background: #2563eb; color: #fff; border-radius: 4px; padding: 2px 8px; }
.se-titlebar-close { background: #ef4444; border: none; color: #fff; width: 26px; height: 26px; border-radius: 4px; cursor: pointer; font-size: 18px; line-height: 1; flex-shrink: 0; }

/* Patient strip */
.se-patient-strip {
  background: #fff; border-bottom: 1px solid #d1d5db;
  display: flex; flex-wrap: wrap; gap: 0;
  flex-shrink: 0;
}
.se-pat-block {
  display: grid; grid-template-columns: 80px 1fr;
  gap: 0 6px; align-items: center;
  padding: 5px 14px; font-size: 11.5px;
  border-right: 1px solid #e5e7eb;
}
.se-pat-block:last-child { border-right: none; }
.se-pat-lbl { color: #6b7280; font-weight: 500; white-space: nowrap; }
.se-pat-val { font-weight: 700; color: #111827; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Clinical tabs */
.se-tabs {
  background: #e2e8f0; display: flex; gap: 2px;
  padding: 4px 10px 0; border-bottom: 2px solid #94a3b8;
  flex-shrink: 0; flex-wrap: wrap;
}
.se-tab-btn {
  padding: 5px 14px; font-size: 11px; font-weight: 700;
  background: #cbd5e1; border: 1px solid #94a3b8;
  border-bottom: none; border-radius: 4px 4px 0 0;
  cursor: pointer; color: #374151; position: relative; top: 2px;
  white-space: nowrap; transition: background 0.1s;
}
.se-tab-btn.active { background: #fff; color: #1d4ed8; border-bottom: 2px solid #fff; }
.se-tab-btn:hover:not(.active) { background: #e2e8f0; }
.se-tab-content {
  background: #fff; border-bottom: 2px solid #94a3b8;
  padding: 7px 14px; font-size: 11.5px;
  min-height: 40px; max-height: 110px; overflow-y: auto; flex-shrink: 0;
}
.se-tab-pane { display: none; line-height: 1.6; }
.se-tab-pane.active { display: block; }
.se-clinical-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 4px 16px;
}
.se-clinical-row { display: flex; gap: 6px; }
.se-clinical-label { color: #6b7280; min-width: 120px; font-weight: 600; }
.se-clinical-value { color: #111; }
.se-clinical-pill {
  display: inline-block; background: #fee2e2; color: #991b1b;
  border-radius: 20px; padding: 1px 8px; font-size: 10.5px; font-weight: 600; margin: 1px 2px;
}
.se-clinical-pill-ok { background: #dcfce7; color: #166534; }

/* Drug entry bar */
.se-entry-bar {
  background: #f1f5f9; border-bottom: 2px solid #475569;
  padding: 6px 10px; display: flex; flex-direction: column; gap: 5px; flex-shrink: 0;
}
.se-entry-row { display: flex; align-items: flex-end; gap: 7px; flex-wrap: wrap; }
.se-field { display: flex; flex-direction: column; gap: 2px; }
.se-field label { font-size: 9px; font-weight: 700; text-transform: uppercase; color: #475569; white-space: nowrap; }
.se-field input, .se-field select {
  height: 26px; padding: 0 6px; font-size: 12px;
  border: 1px solid #94a3b8; border-radius: 3px; background: #fff;
}
.se-field input:focus, .se-field select:focus { outline: none; border-color: #2563eb; background: #eff6ff; }
.se-field-drug { flex: 0 0 230px; }
.se-field-sm { flex: 0 0 72px; }
.se-field-md { flex: 0 0 110px; }
.se-field-lg { flex: 0 0 180px; }
.se-drug-wrap { position: relative; }
.se-drug-wrap input { width: 100%; }
.se-drug-results {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 300;
  background: #fff; border: 1px solid #94a3b8;
  max-height: 200px; overflow-y: auto;
  box-shadow: 0 6px 20px rgba(0,0,0,.18);
}
.se-drug-result {
  padding: 5px 10px; cursor: pointer; font-size: 12px;
  border-bottom: 1px solid #f1f5f9;
  display: grid; grid-template-columns: 1fr auto auto; gap: 8px; align-items: center;
}
.se-drug-result:hover, .se-drug-result.highlighted { background: #eff6ff; }
.se-drug-result-name { font-weight: 600; }
.se-drug-result-nappi { color: #9ca3af; font-size: 10px; }
.se-drug-result-price { color: #16a34a; font-weight: 700; font-size: 11px; }
.se-entry-btn {
  height: 26px; padding: 0 10px; font-size: 11px; font-weight: 600;
  border: 1px solid #94a3b8; border-radius: 3px; cursor: pointer;
  background: #e2e8f0; white-space: nowrap; align-self: flex-end;
}
.se-entry-btn:hover { background: #cbd5e1; }
.se-entry-btn-primary {
  height: 28px; padding: 0 16px; font-size: 12px; font-weight: 700;
  border: none; border-radius: 3px; cursor: pointer;
  background: #2563eb; color: #fff; white-space: nowrap; align-self: flex-end;
}
.se-entry-btn-primary:hover { background: #1d4ed8; }
.se-chk-group { display: flex; gap: 12px; align-items: center; padding-bottom: 2px; }
.se-chk-label {
  display: flex; gap: 5px; align-items: center;
  font-size: 11px; font-weight: 700; cursor: pointer; color: #374151;
  white-space: nowrap;
}
.se-chk-label input[type=checkbox] { width: 13px; height: 13px; cursor: pointer; }
.se-entry-sep { width: 1px; background: #94a3b8; align-self: stretch; margin: 0 3px; }

/* Items table */
.se-items-area { flex: 1; overflow: hidden; display: flex; flex-direction: column; background: #fff; }
.se-items-scroll { flex: 1; overflow-y: auto; }
.se-items-table {
  width: 100%; border-collapse: collapse; font-size: 11.5px; table-layout: auto;
}
.se-items-table thead th {
  background: #334155; color: #e2e8f0; font-weight: 700; font-size: 10.5px;
  padding: 4px 7px; text-align: left; border: 1px solid #475569;
  white-space: nowrap; position: sticky; top: 0; z-index: 1;
}
.se-items-table tbody td {
  padding: 3px 7px; border: 1px solid #e5e7eb; vertical-align: middle;
}
.se-items-table tbody tr:hover td { background: #eff6ff; cursor: pointer; }
.se-items-table tbody tr.se-row-selected td { background: #dbeafe !important; }
.se-items-table tbody tr.se-row-noclaim td:first-child { border-left: 3px solid #f97316; }
.se-item-del-btn {
  width: 20px; height: 20px; border: none; background: #fee2e2;
  color: #dc2626; border-radius: 3px; cursor: pointer; font-size: 14px; padding: 0;
}
.se-nc-tick { color: #ef4444; font-weight: 900; }
.se-nd-tick { color: #f59e0b; font-weight: 900; }

/* Footer: toolbar + totals */
.se-footer { background: #1e293b; color: #fff; flex-shrink: 0; }
.se-toolbar {
  display: flex; gap: 3px; padding: 4px 8px;
  border-bottom: 1px solid #334155; flex-wrap: wrap;
}
.se-tb-btn {
  padding: 4px 10px; font-size: 11px; font-weight: 700;
  border: 1px solid #475569; background: #2d3f55;
  color: #e2e8f0; border-radius: 3px; cursor: pointer; white-space: nowrap;
}
.se-tb-btn:hover { background: #3b5070; }
.se-tb-btn-green { background: #166534; border-color: #15803d; color: #fff; }
.se-tb-btn-green:hover { background: #15803d; }
.se-tb-btn-finish { background: #16a34a; border-color: #15803d; color: #fff; padding: 4px 20px; font-size: 12px; }
.se-tb-btn-finish:hover { background: #15803d; }
.se-totals-strip {
  display: flex; gap: 0; padding: 3px 8px; flex-wrap: wrap;
}
.se-total-cell {
  display: flex; flex-direction: column; align-items: center;
  min-width: 76px; gap: 1px; padding: 3px 8px;
  border-right: 1px solid #334155;
}
.se-total-cell:last-child { border-right: none; }
.se-total-cell-lbl { font-size: 9px; color: #94a3b8; font-weight: 500; text-transform: uppercase; white-space: nowrap; }
.se-total-cell-val { font-size: 12px; font-weight: 700; color: #f0f9ff; white-space: nowrap; }
.se-total-cell.claim .se-total-cell-val { color: #34d399; }
.se-total-cell.profit .se-total-cell-val { color: #fbbf24; }

/* ═══════════════════════════════════════════════════════════
   STEP 4 — MEDICATION SELECTION  (3-panel + table layout)
═══════════════════════════════════════════════════════════ */

/* When step 4 is active, kill wiz-body padding so panels use full height */
.wiz-body.wiz-body-medicines {
  padding: 0 !important;
  overflow: hidden !important;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}
#wiz-step-4 { display: none; flex-direction: column; flex: 1; min-height: 0; overflow: hidden; }
#wiz-step-4.wiz-panel.active,
#wiz-step-4.active {
  display: flex !important;
  flex: 1;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

/* Banner + sig templates + 3-column panels — capped so table keeps room to scroll */
.wiz-s4-head {
  flex-shrink: 0;
  max-height: min(44vh, 400px);
  overflow-y: auto;
  overflow-x: hidden;
  border-bottom: 2px solid var(--border, #e2e8f0);
  overscroll-behavior: contain;
}

/* ── Top 3-column row ── */
.wiz-s4-top {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0;
  flex-shrink: 0;
  min-width: 0;
}

/* ── Col 1: Dispense panel ── */
.wiz-s4-dispense {
  border-right: 1px solid var(--border, #e2e8f0);
  padding: 7px 10px 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: #f8fafc;
}
.wiz-s4-col-hdr {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: #64748b;
  margin-bottom: 3px;
}
.wiz-s4-field-row {
  display: flex;
  align-items: center;
  gap: 5px;
}
.wiz-s4-field-row label {
  font-size: 11px;
  color: #64748b;
  width: 72px;
  flex-shrink: 0;
  text-align: right;
}
.wiz-s4-field-row input,
.wiz-s4-field-row select {
  flex: 1;
  height: 22px;
  padding: 0 6px;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  font-size: 12px;
  background: #fff;
  min-width: 0;
}
.wiz-s4-field-row input:focus,
.wiz-s4-field-row select:focus {
  outline: none;
  border-color: var(--primary, #2563eb);
  box-shadow: 0 0 0 2px rgba(37,99,235,.15);
}
.wiz-s4-apply-btn {
  margin-top: 4px;
  padding: 4px 0;
  font-size: 11px;
  font-weight: 600;
  background: var(--primary, #2563eb);
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  width: 100%;
}
.wiz-s4-apply-btn:hover { background: #1d4ed8; }

/* ── Col 2: Search ── */
.wiz-s4-search-col {
  padding: 7px 10px 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow: hidden;
}
.wiz-s4-search-input {
  width: 100%;
  height: 32px;
  border: 1.5px solid #cbd5e1;
  border-radius: 6px;
  padding: 0 10px;
  font-size: 13px;
  box-sizing: border-box;
}
.wiz-s4-search-input:focus {
  outline: none;
  border-color: var(--primary, #2563eb);
  box-shadow: 0 0 0 3px rgba(37,99,235,.15);
}
.wiz-s4-suggestions {
  flex: 1;
  overflow-y: auto;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: #fff;
  max-height: 110px;
}
.wiz-s4-suggestions .med-suggestion-item {
  padding: 5px 10px;
  font-size: 12px;
  cursor: pointer;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.wiz-s4-suggestions .med-suggestion-item:hover { background: #eff6ff; }
.wiz-s4-suggestions .med-suggestion-item:last-child { border-bottom: none; }

/* ── Col 3: Patient profile ── */
.wiz-s4-profile-col {
  border-left: 1px solid var(--border, #e2e8f0);
  padding: 7px 8px 6px;
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
  min-width: 0;
}
.wiz-s4-pt-row {
  display: flex;
  align-items: baseline;
  gap: 4px;
  font-size: 12px;
}
.wiz-s4-pt-row span:first-child {
  color: #94a3b8;
  font-size: 10px;
  width: 66px;
  flex-shrink: 0;
  text-align: right;
  text-transform: uppercase;
  letter-spacing: .03em;
}
.wiz-s4-pt-row span:last-child {
  font-weight: 600;
  color: #1e293b;
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.wiz-s4-edit-pt-btn {
  margin-top: 3px;
  width: 100%;
  padding: 3px 0;
  font-size: 10px;
  font-weight: 600;
  background: #eff6ff;
  color: #2563eb;
  border: 1px solid #bfdbfe;
  border-radius: 4px;
  cursor: pointer;
}
.wiz-s4-edit-pt-btn:hover { background: #dbeafe; }
.wiz-s4-allergy-row span:last-child { color: #dc2626; }
.wiz-s4-pt-divider {
  border: none;
  border-top: 1px solid #e2e8f0;
  margin: 3px 0;
}
.wiz-s4-tariff-badge {
  margin-top: 4px;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: #fff;
  background: #475569;
  border-radius: 3px;
  padding: 2px 6px;
  text-align: center;
}
.wiz-s4-severity {
  font-size: 24px;
  font-weight: 800;
  text-align: center;
  color: #059669;
  line-height: 1;
}
.wiz-s4-dispensed-total {
  font-size: 11px;
  color: #64748b;
  text-align: center;
}
.wiz-s4-dispensed-total strong { color: #2563eb; font-size: 13px; }
.wiz-s4-action-btns {
  display: flex;
  gap: 4px;
  margin-top: auto;
}
.wiz-s4-action-btns .btn-ghost-sm {
  flex: 1;
  font-size: 10px;
  padding: 3px 4px;
  text-align: center;
}

/* ── Items table area ── */
.wiz-s4-table-area {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 160px;
}
.wiz-s4-table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 3px 12px 2px;
  background: #f1f5f9;
  border-bottom: 1px solid #e2e8f0;
  flex-shrink: 0;
  min-height: 0;
}
.wiz-s4-tbl-title {
  font-size: 11px;
  font-weight: 700;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.wiz-s4-table-scroll,
#wiz-basket.wiz-s4-table-scroll {
  flex: 1 1 0;
  overflow-y: auto;
  overflow-x: auto;
  min-height: 120px;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.wiz-s4-table-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding: 5px 14px;
  background: #f8fafc;
  border-top: 2px solid #e2e8f0;
  flex-shrink: 0;
}
.wiz-s4-footer-label { font-size: 11px; color: #64748b; }
.wiz-s4-footer-total { font-size: 18px; font-weight: 800; color: var(--success, #059669); }

/* ── The items table ── */
.wiz-items-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.wiz-items-table thead tr {
  background: #1e293b;
  color: #e2e8f0;
  position: sticky;
  top: 0;
  z-index: 2;
}
.wiz-items-table th {
  padding: 6px 8px;
  text-align: left;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  white-space: nowrap;
}
.wiz-items-table tbody tr { border-bottom: 1px solid #f1f5f9; }
.wiz-items-table tbody tr:nth-child(even) { background: #fafbfc; }
.wiz-items-table tbody tr:hover { background: #eff6ff; }
.wiz-items-table td { padding: 4px 8px; vertical-align: middle; }

/* Column widths */
.wiz-col-num  { width: 28px; text-align: center; color: #94a3b8; font-size: 10px; }
.wiz-col-cat  { width: 40px; text-align: center; }
.wiz-col-name { min-width: 180px; }
.wiz-col-qty  { width: 56px; }
.wiz-col-rpts { width: 38px; text-align: center; }
.wiz-col-sep  { width: 72px; text-align: right; font-size: 11px; color: #6b7280; white-space: nowrap; }
.wiz-col-fee  { width: 72px; text-align: right; white-space: nowrap; }
.wiz-col-amount { width: 72px; text-align: right; font-weight: 600; color: #059669; white-space: nowrap; }
.wiz-col-dir  { min-width: 150px; }
.wiz-col-nc   { width: 30px; text-align: center; }
.wiz-col-nd   { width: 36px; text-align: center; }
.wiz-col-pack { width: 44px; text-align: center; font-size: 10px; color: #94a3b8; }
.wiz-col-del  { width: 52px; text-align: right; white-space: nowrap; }

/* Row states */
.wiz-basket-row-compound { background: #f0fdf4 !important; }
.wiz-basket-row-compound td:first-child { border-left: 3px solid #059669; }
.wiz-row-selected { background: #eff6ff !important; outline: 2px solid #2563eb; outline-offset: -1px; }
.wiz-row-subst td:first-child { border-left: 3px solid #d97706; }
.wiz-row-noclaim { opacity: .7; }

/* Inline inputs inside table */
.wiz-tbl-qty {
  width: 52px;
  height: 24px;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  text-align: center;
  font-size: 12px;
  padding: 0 4px;
}
.wiz-tbl-sig {
  width: 100%;
  height: 24px;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  font-size: 11px;
  padding: 0 5px;
  box-sizing: border-box;
}
.wiz-tbl-qty:focus, .wiz-tbl-sig:focus {
  outline: none;
  border-color: #2563eb;
}
.wiz-tbl-del {
  background: none;
  border: none;
  color: #ef4444;
  cursor: pointer;
  font-size: 16px;
  padding: 0 4px;
  line-height: 1;
}
.wiz-tbl-del:hover { color: #b91c1c; }
.wiz-tbl-act {
  background: none;
  border: 1px solid #cbd5e1;
  border-radius: 3px;
  font-size: 10px;
  padding: 1px 4px;
  cursor: pointer;
  color: #475569;
  margin-right: 2px;
}
.wiz-tbl-act:hover { background: #f1f5f9; }
.wiz-tbl-tick-nc { color: #dc2626; font-size: 12px; }
.wiz-tbl-tick-nd { color: #f59e0b; font-size: 12px; }

.wiz-tbl-name { font-weight: 600; color: #1e293b; font-size: 12px; }
.wiz-tbl-sub  { font-size: 10px; color: #94a3b8; margin-top: 1px; }

/* Inline dispensing fee input inside Fee cell */
.wiz-fee-inline {
  width: 58px;
  height: 22px;
  border: 1px solid #cbd5e1;
  border-radius: 3px;
  font-size: 12px;
  padding: 0 3px;
  text-align: right;
  background: #fffbeb;
}
.wiz-fee-inline:focus { outline: none; border-color: #f59e0b; }

/* ═══════════════════════════════════════════════════════
   POS TERMINAL PAGE  (pos.html)
═══════════════════════════════════════════════════════ */

/* Full-screen body for terminal */
body.pos-terminal-page {
  margin: 0;
  padding: 0;
  height: 100vh;
  overflow: hidden;
  background: var(--bg, #f1f5f9);
  display: flex;
  flex-direction: column;
}

body.pos-terminal-page #app-wrapper {
  flex: 1;
  display: flex !important;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* ── Terminal Header ─── */
.pos-terminal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  height: 52px;
  background: #1e293b;
  color: #fff;
  flex-shrink: 0;
  gap: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
}

.pos-terminal-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: .5px;
  color: #fff;
  flex-shrink: 0;
}

.pos-terminal-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
}

.pos-th-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,.2);
  background: rgba(255,255,255,.08);
  color: #fff;
  font-size: 13px;
  cursor: pointer;
  transition: background .15s;
  white-space: nowrap;
}
.pos-th-btn:hover { background: rgba(255,255,255,.18); }
.pos-th-btn i { width: 14px; height: 14px; }

.pos-th-btn-success { background: rgba(22,163,74,.3); border-color: rgba(22,163,74,.5); }
.pos-th-btn-success:hover { background: rgba(22,163,74,.5); }

.pos-th-btn-danger { background: rgba(220,38,38,.3); border-color: rgba(220,38,38,.5); }
.pos-th-btn-danger:hover { background: rgba(220,38,38,.5); }

.pos-th-btn-ghost { background: transparent; border-color: transparent; }
.pos-th-btn-ghost:hover { background: rgba(255,255,255,.12); }

.pos-th-divider {
  width: 1px;
  height: 28px;
  background: rgba(255,255,255,.2);
  margin: 0 4px;
}

.pos-th-username {
  font-size: 13px;
  color: rgba(255,255,255,.7);
  white-space: nowrap;
}

/* ── Terminal 3-panel body ─── */
.pos-terminal-body {
  display: grid;
  grid-template-columns: 3fr 4fr 3fr;
  gap: 0;
  flex: 1;
  overflow: hidden;
  height: calc(100vh - 52px);
}

.pos-terminal-search-col {
  background: #fff;
  border-right: 1px solid var(--border, #e2e8f0);
  padding: 14px 12px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pos-terminal-basket-col {
  background: var(--bg, #f8fafc);
  overflow-y: auto;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.pos-terminal-payment-col {
  background: #fff;
  border-left: 1px solid var(--border, #e2e8f0);
  padding: 16px 14px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ── Cash Tendered Panel ─── */
.pos-cash-tendered-panel {
  background: #f0fdf4;
  border: 2px solid #16a34a;
  border-radius: 10px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pos-cash-tendered-label {
  font-size: 13px;
  font-weight: 600;
  color: #15803d;
}

.pos-cash-tendered-input {
  font-size: 22px !important;
  text-align: right !important;
  font-weight: 700 !important;
  color: #1e293b !important;
  padding: 10px !important;
  border: 2px solid #16a34a !important;
  border-radius: 6px;
}

.pos-cash-change-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 4px;
  font-size: 14px;
  font-weight: 600;
}

.pos-cash-change-amount {
  font-size: 26px;
  font-weight: 800;
  color: var(--success, #16a34a);
  letter-spacing: .5px;
}



/* ══════════════════════════════════════
   PRODUCT MERGE MODAL
══════════════════════════════════════ */
.merge-dropdown {
  position: absolute;
  left: 0; right: 0;
  top: calc(100% + 2px);
  background: white;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0,0,0,.12);
  z-index: 300;
  max-height: 220px;
  overflow-y: auto;
}
.merge-drop-item {
  padding: 9px 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  transition: background .1s;
}
.merge-drop-item:last-child { border-bottom: none; }
.merge-drop-item:hover { background: #eff6ff; }
.merge-drop-name { font-weight: 600; }
.merge-drop-meta { font-size: 11px; color: var(--muted); margin-top: 2px; }
.merge-card {
  margin-top: 6px;
  padding: 10px 12px;
  background: #f8fafc;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 12px;
}
.merge-card.master { border-color: var(--primary); background: #eff6ff; }
.merge-card.source { border-color: var(--success); background: #f0fdf4; }
.merge-card-name { font-weight: 700; font-size: 13px; margin-bottom: 4px; }
.merge-card-row { display: flex; justify-content: space-between; padding: 2px 0; }
.merge-card-row span { color: var(--muted); }
.merge-field-check {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  background: #f8fafc;
  transition: background .1s, border-color .1s;
}
.merge-field-check:hover { background: #eff6ff; border-color: var(--primary); }
.merge-field-check input { cursor: pointer; }
.merge-field-check.has-diff { border-color: var(--warning, #d97706); background: #fffbeb; }
