/* ==========================================================================
   N Care Plus — E-Pharmacy Admin Panel
   Single stylesheet for every page. Bootstrap 5 does the heavy lifting;
   this file holds the brand theme + reusable admin components.
   ========================================================================== */

:root {
  --sidebar-bg: #0F1B2D;
  --sidebar-active: #18376F;
  --sidebar-hover: rgba(255, 255, 255, .06);
  --sidebar-text: #A3AEC2;
  --primary: #2457D6;
  --primary-dark: #1B45AE;
  --primary-soft: #EAF0FD;
  --page-bg: #F5F7FB;
  --white: #FFFFFF;
  --text: #172033;
  --text-muted: #64748B;
  --border: #E2E8F0;
  --success: #16A34A;
  --success-soft: #E8F7EE;
  --warning: #D99A00;
  --warning-soft: #FFF6DB;
  --danger: #DC3545;
  --danger-soft: #FDECEE;
  --purple: #7C3AED;
  --purple-soft: #F1EAFE;
  --info: #0891B2;
  --info-soft: #E3F6FA;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 2px 8px rgba(16, 24, 40, .04);
  --sidebar-width: 250px;
  --header-height: 68px;

  /* Bootstrap theme overrides */
  --bs-primary: var(--primary);
  --bs-primary-rgb: 36, 87, 214;
  --bs-body-color: var(--text);
  --bs-body-bg: var(--page-bg);
  --bs-border-color: var(--border);
  --bs-body-font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --bs-body-font-size: .9rem;
}

body { background: var(--page-bg); color: var(--text); }
a { color: var(--primary); text-decoration: none; }

/* ---------- Buttons & form controls ---------- */
.btn { border-radius: 8px; font-weight: 500; font-size: .875rem; padding: .5rem 1rem; }
.btn-sm { padding: .3rem .65rem; font-size: .8rem; }
.btn-primary { background: var(--primary); border-color: var(--primary); }
.btn-primary:hover, .btn-primary:focus { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-outline-primary { color: var(--primary); border-color: var(--primary); }
.btn-outline-primary:hover { background: var(--primary); border-color: var(--primary); }
.btn-light-outline { background: var(--white); border: 1px solid var(--border); color: var(--text); }
.btn-light-outline:hover { background: #F1F4F9; border-color: #D5DCE6; }
.form-control, .form-select { border-radius: 8px; border-color: var(--border); font-size: .875rem; padding: .5rem .8rem; }
.form-control:focus, .form-select:focus { border-color: var(--primary); box-shadow: 0 0 0 .2rem rgba(36, 87, 214, .12); }
.form-label { font-size: .8rem; font-weight: 600; color: var(--text); margin-bottom: .35rem; }

/* ---------- Sidebar ---------- */
.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 1040;
  width: var(--sidebar-width); background: var(--sidebar-bg);
  display: flex; flex-direction: column; transition: transform .25s ease;
}
.sidebar-brand { display: flex; align-items: center; gap: .75rem; padding: 1.1rem 1.25rem; border-bottom: 1px solid rgba(255, 255, 255, .06); }
.sidebar-logo {
  width: 40px; height: 40px; border-radius: 10px; background: var(--white);
  display: grid; place-items: center; overflow: hidden; flex-shrink: 0;
}
.sidebar-logo img { width: 100%; height: 100%; object-fit: cover; }
.sidebar-brand-name { color: var(--white); font-weight: 700; font-size: 1.05rem; line-height: 1.2; }
.sidebar-brand-sub { color: var(--sidebar-text); font-size: .66rem; font-weight: 600; letter-spacing: .09em; }
.sidebar-menu { flex: 1; overflow-y: auto; padding: 1rem .85rem; list-style: none; margin: 0; }
.sidebar-menu::-webkit-scrollbar { width: 4px; }
.sidebar-menu::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .12); border-radius: 4px; }
.sidebar-label { color: #5F6B82; font-size: .66rem; font-weight: 700; letter-spacing: .1em; padding: .9rem .75rem .4rem; }
.sidebar-link {
  position: relative; display: flex; align-items: center; gap: .75rem;
  padding: .62rem .85rem; margin-bottom: 2px; border-radius: 8px;
  color: var(--sidebar-text); font-size: .875rem; font-weight: 500;
  transition: background .15s, color .15s;
}
.sidebar-link i { font-size: 1.05rem; width: 20px; text-align: center; }
.sidebar-link:focus { outline: none; box-shadow: none; }
.sidebar-link:focus-visible { outline: 2px solid #4C7DF0; outline-offset: -2px; }
.sidebar-link:hover { background: var(--sidebar-hover); color: var(--white); }
.sidebar-link.active { background: var(--sidebar-active); color: var(--white); }
.sidebar-link.active { font-weight: 600; }
.sidebar-toggle .toggle-arrow { margin-left: auto; font-size: .75rem; width: auto; transition: transform .2s; }
.sidebar-toggle:not(.collapsed) .toggle-arrow { transform: rotate(180deg); }
.sidebar-toggle:not(.collapsed) { color: var(--white); }
.sidebar-submenu { margin: 2px 0 6px 1.6rem; padding-left: .6rem; border-left: 1px solid rgba(255, 255, 255, .1); }
.sidebar-submenu .sidebar-link { padding: .5rem .75rem; font-size: .84rem; }
.sidebar-footer { padding: .85rem; border-top: 1px solid rgba(255, 255, 255, .06); }
.sidebar-footer .sidebar-link:hover { color: #FF8A95; }
.sidebar-backdrop { display: none; position: fixed; inset: 0; background: rgba(15, 27, 45, .45); z-index: 1035; }

/* ---------- Header ---------- */
.top-header {
  position: sticky; top: 0; z-index: 1020; height: var(--header-height);
  background: var(--white); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; padding: 0 1.75rem;
}
.header-left { display: flex; align-items: center; gap: .9rem; min-width: 0; }
.header-title { font-size: 1.1rem; font-weight: 700; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 9px; border: 1px solid var(--border);
  background: var(--white); color: var(--text-muted); display: grid; place-items: center;
  position: relative; font-size: 1.05rem; flex-shrink: 0;
}
.icon-btn:hover { background: #F1F4F9; color: var(--text); }
.icon-btn .dot { position: absolute; top: 7px; right: 8px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); border: 2px solid var(--white); }
.header-right { display: flex; align-items: center; gap: .75rem; }
.user-menu { display: flex; align-items: center; gap: .65rem; padding: .3rem .85rem .3rem .3rem; border-radius: 12px; border: 1px solid var(--border); background: var(--white); color: var(--text); }
.user-menu:hover { background: #F1F4F9; }
.user-avatar {
  width: 36px; height: 36px; border-radius: 50%; background: var(--primary-soft); color: var(--primary);
  display: grid; place-items: center; font-weight: 600; font-size: .85rem;
}
.user-avatar { overflow: hidden; }
.user-avatar img { width: 100%; height: 100%; object-fit: cover; }
.user-name { font-weight: 600; font-size: .875rem; line-height: 1.2; text-align: left; }
.user-role { font-size: .74rem; color: var(--text-muted); text-align: left; }

/* ---------- Main layout ---------- */
.main-wrapper { margin-left: var(--sidebar-width); min-height: 100vh; display: flex; flex-direction: column; }
.main-content { flex: 1; padding: 1.75rem; }
.site-footer {
  padding: 1rem 1.75rem; border-top: 1px solid var(--border); background: var(--white);
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: .5rem;
  font-size: .8rem; color: var(--text-muted);
}

/* ---------- Page header ---------- */
.page-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.page-title { font-size: 1.5rem; font-weight: 700; margin: 0 0 .25rem; }
.page-description { color: var(--text-muted); margin: 0; }
.page-actions { display: flex; gap: .5rem; flex-wrap: wrap; }

/* ---------- Cards ---------- */
.data-card, .table-card, .form-card {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.data-card, .form-card { padding: 1.25rem; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: .75rem; flex-wrap: wrap; margin-bottom: 1rem; }
.card-title { font-size: 1rem; font-weight: 700; margin: 0; }
.card-subtitle { font-size: .8rem; color: var(--text-muted); margin: 0; }
.table-card .card-head { padding: 1.1rem 1.25rem 0; }
.table-toolbar { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; padding: 1.1rem 1.25rem; }
.table-toolbar .result-count { margin-left: auto; font-size: .8rem; color: var(--text-muted); }
.table-toolbar .search-box { flex: 0 1 260px; min-width: 200px; position: relative; }
.search-box i { position: absolute; left: .8rem; top: 50%; transform: translateY(-50%); color: var(--text-muted); }
.search-box .form-control { padding-left: 2.2rem; }
.table-toolbar .form-select { width: auto; min-width: 150px; }
.table-footer { display: flex; justify-content: space-between; align-items: center; gap: .75rem; flex-wrap: wrap; padding: .9rem 1.25rem; border-top: 1px solid var(--border); font-size: .8rem; color: var(--text-muted); }
.table-tabs { display: flex; gap: .25rem; padding: 0 1.25rem; overflow-x: auto; white-space: nowrap; }
.table-tabs button, .table-tabs a {
  border: 1px solid transparent; border-bottom: 0; border-radius: 10px 10px 0 0; background: none;
  padding: .7rem 1.1rem; font-size: .875rem; font-weight: 600; color: #94A3B8; text-decoration: none;
  display: inline-flex; align-items: center; gap: .45rem;
}
.table-tabs button:hover, .table-tabs a:hover { color: var(--text); }
.table-tabs button.active, .table-tabs a.active { color: var(--primary); background: var(--white); border-color: var(--border); box-shadow: inset 0 2px 0 var(--primary); }
.table-tabs .tab-count { background: #EEF1F5; color: var(--text-muted); border-radius: 10px; padding: .05rem .45rem; font-size: .72rem; }
.table-tabs button.active .tab-count, .table-tabs a.active .tab-count { background: var(--primary-soft); color: var(--primary); }
.table-tabs.tabs-underline { border-bottom: 1px solid var(--border); background: #F8FAFC; padding-top: .35rem; }
.table-tabs.tabs-underline button { border: 0; border-radius: 0; background: none; box-shadow: none; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.table-tabs.tabs-underline button.active { color: #1E40AF; border-bottom-color: #1E40AF; background: none; box-shadow: none; }
.pagination { margin: 0; }
.page-link { color: var(--text); border-color: var(--border); font-size: .8rem; }
.active > .page-link { background: var(--primary); border-color: var(--primary); }

/* ---------- Stat cards ---------- */
.stat-card {
  background: var(--white); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 1.25rem; height: 100%;
}
.stat-card .stat-icon { margin-bottom: .9rem; }
.stat-label { font-size: .8rem; color: var(--text-muted); font-weight: 500; margin-bottom: .35rem; }
.stat-value { font-size: 1.6rem; font-weight: 700; line-height: 1.2; margin: 0; }
.stat-note { font-size: .74rem; color: var(--text-muted); margin-top: .35rem; }
.stat-note .up { color: var(--success); font-weight: 600; }
.stat-note .down { color: var(--danger); font-weight: 600; }
.stat-icon { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; font-size: 1.25rem; flex-shrink: 0; }
.icon-blue { background: var(--primary-soft); color: var(--primary); }
.icon-green { background: var(--success-soft); color: var(--success); }
.icon-amber { background: var(--warning-soft); color: var(--warning); }
.icon-red { background: var(--danger-soft); color: var(--danger); }
.icon-purple { background: var(--purple-soft); color: var(--purple); }
.icon-orange { background: #FFEDE3; color: #EA580C; }
.icon-cyan { background: var(--info-soft); color: var(--info); }
.stat-card.warning-card { border-color: #F5C2C7; background: #FFF8F8; }

/* ---------- Tables ---------- */
.table { margin: 0; font-size: .85rem; }
.table > :not(caption) > * > * { padding: .8rem 1rem; vertical-align: middle; border-color: var(--border); }
.table thead th {
  background: #172033; color: var(--white); border-color: #172033 !important; font-size: .72rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .04em; white-space: nowrap;
}
.table tbody tr:hover > * { background: #FAFBFD; }
.table > :not(caption) > * > * { padding: 1rem; }
.table td { white-space: nowrap; }
.table-card .table-responsive { border-radius: 0 0 var(--radius) var(--radius); }
.id-text { font-weight: 600; color: var(--primary); }
.muted { color: var(--text-muted); }
.small-muted { color: var(--text-muted); font-size: .76rem; }

.profile-cell { display: flex; align-items: center; gap: .65rem; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 600; font-size: .78rem; flex-shrink: 0; background: var(--primary-soft); color: var(--primary);
}
.avatar.green { background: var(--success-soft); color: var(--success); }
.avatar.amber { background: var(--warning-soft); color: #A87700; }
.avatar.purple { background: var(--purple-soft); color: var(--purple); }
.avatar.red { background: var(--danger-soft); color: var(--danger); }
.profile-name { font-weight: 600; line-height: 1.25; }

.product-image {
  width: 42px; height: 42px; border-radius: 8px; border: 1px solid var(--border);
  background: #F8FAFC; display: grid; place-items: center; font-size: 1.2rem; color: var(--primary); flex-shrink: 0;
}

/* ---------- Status badges ---------- */
.status-badge {
  display: inline-flex; align-items: center; gap: .35rem; padding: .28rem .65rem;
  border-radius: 20px; font-size: .74rem; font-weight: 600; white-space: nowrap;
}
.status-badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-active { background: var(--success-soft); color: var(--success); }
.status-pending { background: var(--warning-soft); color: #A87700; }
.status-blocked { background: var(--danger-soft); color: var(--danger); }
.status-info { background: var(--primary-soft); color: var(--primary); }
.status-purple { background: var(--purple-soft); color: var(--purple); }
.status-urgent { background: #DC3545; color: #FFFFFF; }
.status-cyan { background: var(--info-soft); color: var(--info); }
.status-orange { background: #FFEDE3; color: #EA580C; }
.status-neutral { background: #EEF1F5; color: var(--text-muted); }
.type-tag { display: inline-block; padding: .18rem .5rem; border-radius: 6px; font-size: .72rem; font-weight: 600; background: #EEF1F5; color: var(--text-muted); }
.type-tag.rx { background: var(--purple-soft); color: var(--purple); }

/* ---------- Action buttons ---------- */
.action-group { display: flex; gap: .35rem; }
.action-btn {
  width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--border); background: var(--white);
  color: var(--text-muted); display: inline-grid; place-items: center; font-size: .9rem; padding: 0;
}
.action-btn:hover { opacity: .85; }
.action-btn.view { background: #1F2633; border-color: #1F2633; color: var(--white); }
.action-btn.edit { background: var(--warning); border-color: var(--warning); color: var(--white); }
.action-btn.success { background: var(--success); border-color: var(--success); color: var(--white); }
.action-btn.danger { background: var(--danger); border-color: var(--danger); color: var(--white); }
.action-btn.primary { background: var(--primary); border-color: var(--primary); color: var(--white); }

/* ---------- Charts (pure CSS, static demo data) ---------- */
.bar-chart { display: flex; align-items: flex-end; gap: 10px; height: 220px; padding: 0 .25rem; border-bottom: 1px solid var(--border);
  background-image: linear-gradient(to top, var(--border) 1px, transparent 1px); background-size: 100% 25%; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.bar { width: 100%; max-width: 30px; background: var(--primary); border-radius: 4px 4px 0 0; transition: opacity .15s; cursor: default; }
.bar:hover { opacity: .8; }
.bar.green { background: var(--success); }
.bar.purple { background: var(--purple); }
.bar-labels { display: flex; gap: 10px; padding: .45rem .25rem 0; }
.bar-labels span { flex: 1; text-align: center; font-size: .72rem; color: var(--text-muted); }
.hbar-row { margin-bottom: .9rem; }
.hbar-row:last-child { margin-bottom: 0; }
.hbar-top { display: flex; justify-content: space-between; font-size: .8rem; margin-bottom: .3rem; }
.hbar-track { height: 8px; background: #EEF1F5; border-radius: 4px; overflow: hidden; }
.hbar-fill { height: 100%; background: var(--primary); border-radius: 4px; }
.hbar-fill.green { background: var(--success); }
.hbar-fill.purple { background: var(--purple); }
.chart-total { font-size: 1.35rem; font-weight: 700; }

/* ---------- Upload box & generated details ---------- */
.upload-box {
  border: 2px dashed #C9D4E5; border-radius: var(--radius); background: #F8FAFC;
  padding: 2rem 1rem; text-align: center; cursor: pointer; transition: border-color .15s, background .15s;
}
.upload-box:hover, .upload-box.dragover { border-color: var(--primary); background: var(--primary-soft); }
.upload-box .upload-icon { width: 56px; height: 56px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; font-size: 1.5rem; margin: 0 auto .75rem; }
.upload-preview { border: 1px solid var(--border); border-radius: var(--radius); padding: .75rem; display: flex; align-items: center; gap: .9rem; background: var(--white); }
.upload-preview img { width: 90px; height: 90px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); }
.generated-box { border: 1px solid #CFE0FB; background: #F6F9FF; border-radius: var(--radius); padding: 1rem; }
.detail-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: .75rem 1rem; }
.detail-item .label { font-size: .72rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.detail-item .value { font-weight: 600; }

/* ---------- Plan cards ---------- */
.plan-card { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.5rem; height: 100%; display: flex; flex-direction: column; }
.plan-card.featured { border: 2px solid var(--primary); }
.plan-price { font-size: 1.9rem; font-weight: 700; }
.plan-price small { font-size: .85rem; color: var(--text-muted); font-weight: 500; }
.plan-features { list-style: none; padding: 0; margin: 1rem 0; flex: 1; }
.plan-features li { padding: .35rem 0; font-size: .85rem; display: flex; gap: .5rem; }
.plan-features i { color: var(--success); }
.plan-meta { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; background: #F8FAFC; border-radius: 8px; padding: .75rem; font-size: .8rem; margin-bottom: 1rem; }

/* ---------- Timeline (order tracking) ---------- */
.track-steps { display: flex; justify-content: space-between; position: relative; }
.track-step { flex: 1; text-align: center; position: relative; }
.track-step::before { content: ""; position: absolute; top: 17px; left: -50%; width: 100%; height: 3px; background: var(--border); z-index: 0; }
.track-step:first-child::before { display: none; }
.track-step.done::before { background: var(--success); }
.track-dot { width: 36px; height: 36px; border-radius: 50%; background: var(--white); border: 3px solid var(--border); color: var(--text-muted); display: grid; place-items: center; margin: 0 auto .5rem; position: relative; z-index: 1; }
.track-step.done .track-dot { background: var(--success); border-color: var(--success); color: var(--white); }
.track-step.current .track-dot { border-color: var(--primary); color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }
.track-name { font-size: .8rem; font-weight: 600; }
.track-time { font-size: .7rem; color: var(--text-muted); }

/* ---------- Scan checklist (delivery) ---------- */
.scan-card { border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; height: 100%; background: var(--white); }
.scan-item { display: flex; justify-content: space-between; align-items: center; gap: .5rem; padding: .6rem .75rem; border: 1px solid var(--border); border-radius: 8px; margin-bottom: .5rem; font-size: .85rem; }
.scan-item.scanned { border-color: #BDE5CB; background: var(--success-soft); }
.scan-item .scan-state { font-weight: 600; font-size: .78rem; color: var(--text-muted); white-space: nowrap; }
.scan-item.scanned .scan-state { color: var(--success); }
.verify-banner { border-radius: 8px; padding: .65rem .85rem; font-size: .85rem; font-weight: 600; display: flex; align-items: center; gap: .5rem; margin: .75rem 0; }
.verify-banner.ok { background: var(--success-soft); color: var(--success); }
.verify-banner.wait { background: var(--warning-soft); color: #A87700; }
.flow-step { display: flex; gap: .75rem; align-items: flex-start; }
.flow-num { width: 28px; height: 28px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); font-weight: 700; font-size: .8rem; display: grid; place-items: center; flex-shrink: 0; }

/* ---------- Misc ---------- */
.quick-card { display: flex; align-items: center; gap: .9rem; padding: 1.1rem; background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); height: 100%; color: var(--text); transition: border-color .15s, transform .15s; }
.quick-card:hover { border-color: var(--primary); transform: translateY(-2px); color: var(--text); }
.report-card { text-align: left; }
.settings-row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .85rem 0; border-bottom: 1px solid var(--border); }
.settings-row:last-child { border-bottom: 0; }
.nav-tabs { border-bottom: 1px solid var(--border); gap: .25rem; }
.nav-tabs .nav-link { color: var(--text-muted); font-weight: 500; font-size: .875rem; border: 0; border-bottom: 2px solid transparent; }
.nav-tabs .nav-link.active { color: var(--primary); border-bottom-color: var(--primary); background: none; }
.prescription-preview { border: 1px solid var(--border); border-radius: var(--radius); background: #F8FAFC; min-height: 280px; padding: 1.25rem; font-size: .85rem; }
.modal-content { border: 0; border-radius: var(--radius); }
/* Order details modal */
.section-label { font-size: .78rem; font-weight: 700; color: #94A3B8; text-transform: uppercase; letter-spacing: .04em; margin-bottom: .6rem; }
.order-stepper { display: flex; align-items: center; }
.order-step { display: flex; align-items: center; gap: .5rem; flex: 1; font-size: .85rem; font-weight: 600; color: #94A3B8; white-space: nowrap; }
.order-step:last-child { flex: 0; }
.order-step:not(:last-child)::after { content: ""; flex: 1; height: 2px; background: var(--border); margin: 0 .75rem; min-width: 16px; }
.step-num { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--border); background: #F1F4F9; display: grid; place-items: center; font-size: .8rem; flex-shrink: 0; }
.order-step.current, .order-step.done { color: var(--text); }
.order-step.current .step-num, .order-step.done .step-num { background: var(--primary); border-color: var(--primary); color: var(--white); }
.order-step.done:not(:last-child)::after { background: var(--primary); }
.order-totals > div { display: flex; justify-content: space-between; padding: .3rem 0; font-size: .875rem; color: var(--text-muted); }
.order-totals .total { color: var(--text); font-weight: 700; font-size: .95rem; }
@media (max-width: 575.98px) { .order-step .step-name { display: none; } }
@media print {
  body * { visibility: hidden; }
  .modal.show .print-area, .modal.show .print-area * { visibility: visible; }
  .modal.show .print-area { position: absolute; inset: 0; box-shadow: none; }
  .modal.show .print-area .modal-footer, .modal.show .print-area .btn-close { display: none; }
}
.rx-file {border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.rx-file-preview { background: #F1F4F9; min-height: 320px; display: grid; place-items: center; font-size: 2.2rem; color: #94A3B8; }
.rx-file-meta { display: flex; justify-content: space-between; flex-wrap: wrap; gap: .5rem; padding: .75rem 1rem; font-size: .8rem; color: var(--text-muted); border-top: 1px solid var(--border); }
.rx-medicine { background: #F1F4F9; border-radius: 10px; padding: .55rem .8rem; font-size: .85rem; margin-bottom: .5rem; display: flex; align-items: center; gap: .5rem; }
.confirm-dialog { max-width: 420px; }
.confirm-dialog .modal-content { border-radius: 16px; }
.confirm-icon { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; font-size: 1.4rem; margin: 0 auto 1rem; }
.confirm-icon.success { background: var(--success-soft); color: var(--success); }
.confirm-icon.danger { background: var(--danger-soft); color: var(--danger); }
.confirm-title { font-size: 1.05rem; font-weight: 700; margin: 0; }
.btn-success { background: var(--success); border-color: var(--success); }
.modal-header, .modal-footer { border-color: var(--border); }
.offcanvas-header { border-bottom: 1px solid var(--border); }

/* ---------- Responsive ---------- */
@media (max-width: 991.98px) {
  .sidebar { transform: translateX(-100%); }
  body.sidebar-open .sidebar { transform: translateX(0); }
  body.sidebar-open .sidebar-backdrop { display: block; }
  .main-wrapper { margin-left: 0; }
  .top-header { padding: 0 1rem; }
  .main-content { padding: 1.25rem 1rem; }
}
@media (min-width: 992px) {
  /* Desktop: hamburger collapses the sidebar */
  body.sidebar-collapsed .sidebar { transform: translateX(-100%); }
  body.sidebar-collapsed .main-wrapper { margin-left: 0; }
  .main-wrapper { transition: margin-left .25s ease; }
}
@media (max-width: 575.98px) {
  .user-info { display: none; }
  .page-title { font-size: 1.3rem; }
  .page-actions, .page-actions .btn { width: 100%; }
  .page-actions .btn { flex: 1; }
  .table-toolbar .form-select { flex: 1; }
  .detail-list { grid-template-columns: 1fr; }
  .track-name { font-size: .68rem; }
  .track-time { display: none; }
  .site-footer { padding: 1rem; justify-content: center; text-align: center; }
}

/* Card with tab panes (e.g. Marketing): tabs on top, each pane has its own toolbar + table */
.tabbed-card { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.tabbed-card .table-tabs.tabs-underline { border-radius: var(--radius) var(--radius) 0 0; }
.coupon-code { display: inline-block; background: var(--primary-soft); color: var(--primary); font-weight: 700; font-size: .75rem; letter-spacing: .03em; padding: .3rem .65rem; border-radius: 20px; }

/* ---------- Reports: period switch, page tabs, charts ---------- */
.segmented { display: inline-flex; background: #EEF1F6; border-radius: 10px; padding: 4px; gap: 2px; flex-wrap: wrap; }
.segmented button { border: 0; background: none; padding: .45rem .85rem; border-radius: 8px; font-size: .84rem; font-weight: 600; color: var(--text-muted); }
.segmented button:hover { color: var(--text); }
.segmented button.active { background: var(--white); color: var(--primary); box-shadow: 0 1px 3px rgba(16, 24, 40, .08); }
.table-tabs.page-tabs { padding: 0; border-bottom: 1px solid var(--border); margin-bottom: 1.25rem; }
.table-tabs.page-tabs button { margin-bottom: -1px; }
.table-tabs.page-tabs button.active { background: var(--white); }

.chart-card { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); height: 100%; }
.chart-card-head { padding: 1.1rem 1.25rem; border-bottom: 1px solid var(--border); }
.chart-card-head .card-subtitle { margin-top: .2rem; }
.chart-card-body { padding: 1.1rem 1.25rem; }
.chart-svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart-svg .grid { stroke: #EEF1F5; stroke-width: 1; }
.chart-svg .axis-label { fill: #94A3B8; font-size: 11px; }
.chart-svg .area { fill: #2a78d6; opacity: .12; }
.chart-svg .line { fill: none; stroke: #2a78d6; stroke-width: 2; stroke-linejoin: round; }
.chart-svg .bar-mark { fill: #2a78d6; }
.chart-svg .crosshair { stroke: #94A3B8; stroke-width: 1; stroke-dasharray: 3 3; opacity: 0; }
.chart-svg .dot { fill: #2a78d6; stroke: var(--white); stroke-width: 2; opacity: 0; }
.chart-svg .hover-col:hover .crosshair, .chart-svg .hover-col:hover .dot { opacity: 1; }
.chart-svg .hover-col:hover .bar-mark { opacity: .8; }
.donut-wrap { display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap; }
.donut-svg { width: 190px; height: 190px; flex-shrink: 0; }
.donut-seg { cursor: pointer; transition: stroke-width .15s; }
.donut-seg:hover { stroke-width: 30; }
.donut-value { font-size: 22px; font-weight: 700; fill: var(--text); }
.donut-label { font-size: 11px; fill: var(--text-muted); }
.chart-legend { list-style: none; padding: 0; margin: 0; flex: 1; min-width: 220px; }
.chart-legend li { display: flex; align-items: center; gap: .6rem; padding: .3rem 0; font-size: .85rem; }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.legend-name { flex: 1; font-weight: 500; }
.legend-value { font-weight: 600; }
.legend-pct { width: 40px; text-align: right; color: var(--text-muted); }
.rank-row { display: flex; align-items: center; gap: .75rem; padding: .4rem 0; font-size: .85rem; cursor: default; }
.rank-name { width: 38%; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank-track { flex: 1; height: 12px; }
.rank-fill { display: block; height: 100%; background: #2a78d6; border-radius: 0 4px 4px 0; }
.rank-row:hover .rank-fill { opacity: .8; }
.rank-value { width: 48px; font-weight: 600; }
.chart-tooltip { position: fixed; z-index: 2000; pointer-events: none; background: #172033; color: var(--white); font-size: .78rem; font-weight: 500; padding: .4rem .6rem; border-radius: 6px; opacity: 0; transition: opacity .1s; white-space: nowrap; }
.chart-tooltip.show { opacity: 1; }

/* ---------- Toast messages (bottom-right) ---------- */
.toast-stack { position: fixed; right: 24px; bottom: 24px; z-index: 2100; display: flex; flex-direction: column; gap: .6rem; max-width: calc(100vw - 32px); }
.app-toast {
  display: flex; align-items: center; gap: .75rem; min-width: 280px; max-width: 420px;
  background: var(--white); border: 1px solid var(--border); border-left: 4px solid var(--success);
  border-radius: 12px; box-shadow: 0 8px 24px rgba(16, 24, 40, .12); padding: .85rem 1rem;
  font-size: .9rem; font-weight: 500; color: var(--text);
  animation: toast-in .25s ease-out; transition: opacity .3s, transform .3s;
}
.app-toast.hiding { opacity: 0; transform: translateY(8px); }
.app-toast-icon { font-size: 1.2rem; flex-shrink: 0; }
.app-toast-text { flex: 1; }
.app-toast-close { border: 0; background: none; color: var(--text-muted); padding: 0 .15rem; font-size: .85rem; }
.app-toast-close:hover { color: var(--text); }
.app-toast-success { border-left-color: var(--success); }
.app-toast-success .app-toast-icon { color: var(--success); }
.app-toast-danger { border-left-color: var(--danger); }
.app-toast-danger .app-toast-icon { color: var(--danger); }
.app-toast-warning { border-left-color: var(--warning); }
.app-toast-warning .app-toast-icon { color: var(--warning); }
.app-toast-info { border-left-color: var(--primary); }
.app-toast-info .app-toast-icon { color: var(--primary); }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@media (max-width: 575.98px) { .toast-stack { left: 16px; right: 16px; bottom: 16px; } .app-toast { min-width: 0; max-width: none; } }
.site-footer { font-size: .875rem; padding: 1.1rem 1.75rem; }
.footer-brand { color: #1E4FB8; font-weight: 700; }
.footer-brand:hover { color: var(--primary-dark); }
.bc-brand { text-decoration: none; }
.bc-brand .bc-bright { color: #0a58ca; }
.bc-brand .bc-code { color: #dc2626; }
.bc-brand:hover { opacity: .85; }

/* ---------- Admin login ---------- */
.login-page { background: var(--page-bg); min-height: 100vh; }
.login-shell { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); min-height: 100vh; }

.login-brand {
  background: radial-gradient(circle at 20% 0%, #1E3A6E 0%, var(--sidebar-bg) 55%);
  color: #fff; padding: 2.5rem 3rem; display: flex; flex-direction: column; justify-content: space-between; gap: 2rem;
}
.login-brand-top { display: flex; align-items: center; gap: .75rem; }
.login-brand-title { font-size: 1.9rem; font-weight: 700; line-height: 1.25; max-width: 24rem; margin-bottom: 1.5rem; }
.login-brand-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .9rem; }
.login-brand-list li { display: flex; align-items: center; gap: .75rem; color: #C9D3E4; font-size: .95rem; }
.login-brand-list i {
  width: 2.1rem; height: 2.1rem; border-radius: 10px; display: grid; place-items: center;
  background: rgba(255, 255, 255, .08); color: #fff; flex-shrink: 0;
}
.login-brand-foot { color: var(--sidebar-text); font-size: .8rem; }

.login-form-wrap { display: flex; align-items: center; justify-content: center; padding: 2rem 1rem; }
.login-card {
  width: 100%; max-width: 420px; background: var(--white); border: 1px solid var(--border);
  border-radius: 16px; box-shadow: var(--shadow); padding: 2.25rem 2rem;
}
.login-mobile-brand { display: none; align-items: center; gap: .6rem; font-weight: 700; margin-bottom: 1.5rem; }
.login-title { font-size: 1.5rem; font-weight: 700; margin-bottom: .25rem; color: var(--text); }
.login-subtitle { color: var(--text-muted); margin-bottom: 1.5rem; }
.login-card .form-label { font-weight: 600; font-size: .85rem; }

.login-input { position: relative; }
.login-input > i { position: absolute; left: .85rem; top: 50%; transform: translateY(-50%); color: var(--text-muted); pointer-events: none; }
.login-input .form-control { padding: .65rem .9rem .65rem 2.4rem; border-radius: 10px; border-color: var(--border); }
.login-input .form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.login-eye {
  position: absolute; right: .4rem; top: 50%; transform: translateY(-50%);
  border: 0; background: none; color: var(--text-muted); padding: .35rem .5rem;
}
.login-input:has(.login-eye) .form-control { padding-right: 2.6rem; }
.login-submit { padding: .7rem; border-radius: 10px; font-weight: 600; }
.login-help { text-align: center; color: var(--text-muted); font-size: .82rem; margin: 1.25rem 0 0; }

.login-alert { display: flex; align-items: center; gap: .55rem; padding: .7rem .9rem; border-radius: 10px; font-size: .88rem; margin-bottom: 1rem; }
.login-alert-danger { background: var(--danger-soft); color: var(--danger); }
.login-alert-success, .login-alert-info { background: var(--success-soft); color: var(--success); }

@media (max-width: 991.98px) {
  .login-shell { grid-template-columns: 1fr; }
  .login-brand { display: none; }
  .login-mobile-brand { display: flex; }
}
@media (max-width: 575.98px) {
  .login-card { padding: 1.75rem 1.25rem; }
}

/* Scrollable modals whose header/body/footer are wrapped in a <form>:
   let the form take the modal's height so .modal-body scrolls and the footer stays visible */
.modal-dialog-scrollable .modal-content > form {
  display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; overflow: hidden;
}
