/* ==========================================================================
   FT Global Portfolio — Pharma B2C Commerce & Fulfilment Platform
   Design system (prototype)
   ========================================================================== */
:root {
  --brand: #0e63ad;          /* FTSPL enterprise blue (Accounts portal design system) */
  --brand-600: #0b4f8a;
  --brand-50: #f1f7fd;
  --brand-100: #e3f0fb;
  --accent: #1177cc;
  --accent-50: #e3f0fb;
  --violet: #6d4ae0;         /* integration / API points */
  --violet-50: #f1edfd;
  --amber: #b76e00;          /* demo / simulated data */
  --amber-50: #fff6e5;
  --ok: #15803d; --ok-50: #e9f7ee;
  --warn: #b45309; --warn-50: #fff4e0;
  --bad: #c62828; --bad-50: #fdecec;
  --info: #1d63b8; --info-50: #e8f1fb;
  --muted-50: #f1f3f6;

  --bg: #f6f8fa;
  --surface: #ffffff;
  --surface-2: #f6f8fa;
  --border: #d9e1e8;
  --border-strong: #b3c1cd;
  --line-soft: #eef2f6;
  --text: #16263a;
  --text-2: #5b7186;
  --text-3: #8296a9;

  --radius: 10px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow: 0 1px 3px rgba(16, 24, 40, .06), 0 6px 16px rgba(16, 24, 40, .05);
  --shadow-lg: 0 12px 40px rgba(16, 24, 40, .16);
  --topbar-h: 60px;
  --sidebar-w: 248px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { background: var(--bg); color: var(--text); font-family: var(--font); font-size: 14px; }
body { margin: 0; -webkit-font-smoothing: antialiased; }
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-600); }
h1, h2, h3, h4, h5, h6 { color: var(--text); font-weight: 700; letter-spacing: -.01em; }
.text-2 { color: var(--text-2) !important; }
.text-3 { color: var(--text-3) !important; }
.fw-600 { font-weight: 600; }
.mono { font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }
.small-xs { font-size: 11.5px; }
.nowrap { white-space: nowrap; }
.cursor-pointer { cursor: pointer; }
.tabular { font-variant-numeric: tabular-nums; }

/* ---------- Buttons ---------- */
.btn { border-radius: 10px; font-weight: 600; font-size: 13.5px; padding: .5rem .9rem; }
.btn-sm { font-size: 12.5px; padding: .3rem .6rem; border-radius: 8px; }
.btn-lg { padding: .75rem 1.25rem; font-size: 15px; border-radius: 12px; }
.btn-brand { background: var(--brand); color: #fff; border: 1px solid var(--brand); }
.btn-brand:hover, .btn-brand:focus { background: var(--brand-600); color: #fff; border-color: var(--brand-600); }
.btn-soft { background: var(--brand-50); color: var(--brand); border: 1px solid var(--brand-100); }
.btn-soft:hover { background: var(--brand-100); color: var(--brand-600); }
.btn-ghost { background: var(--surface); color: var(--text); border: 1px solid var(--border-strong); }
.btn-ghost:hover { background: var(--muted-50); color: var(--text); }
.btn-violet { background: var(--violet); color: #fff; border: 1px solid var(--violet); }
.btn-violet:hover { background: #5b3bc7; color: #fff; }
.btn-demo { background: linear-gradient(135deg, #0e63ad, #1177cc); color: #fff; border: 0; box-shadow: 0 6px 18px rgba(42, 120, 214, .35); }
.btn-demo:hover { color: #fff; filter: brightness(1.06); }
.btn-icon { width: 36px; height: 36px; padding: 0; display: inline-flex; align-items: center; justify-content: center; border-radius: 10px; }

/* ---------- Top bar ---------- */
.topbar { position: fixed; top: 0; left: 0; right: 0; height: var(--topbar-h); background: var(--surface); border-bottom: 1px solid var(--border); z-index: 1030; display: flex; align-items: center; padding: 0 16px; gap: 12px; }
.brand-logo { display: flex; align-items: center; gap: 10px; font-weight: 800; color: var(--text); white-space: nowrap; }
.brand-logo .mark { width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(135deg, var(--brand), var(--accent)); display: grid; place-items: center; color: #fff; font-size: 16px; }
.brand-logo .name { line-height: 1.05; font-size: 15px; }
.brand-logo .name small { display: block; font-weight: 500; color: var(--text-3); font-size: 11px; letter-spacing: .02em; }
.demo-pill { display: inline-flex; align-items: center; gap: 6px; background: var(--amber-50); color: var(--amber); border: 1px solid #f3d9a4; border-radius: 999px; padding: 3px 10px; font-size: 11px; font-weight: 800; letter-spacing: .08em; }
.demo-pill .dot { width: 7px; height: 7px; border-radius: 50%; background: #e08a00; animation: pulse 1.6s infinite; }
.secure-pill { display: inline-flex; align-items: center; gap: 6px; color: var(--ok); font-size: 12px; font-weight: 600; background: var(--ok-50); border-radius: 999px; padding: 3px 10px; }
.session-pill { font-size: 12px; color: var(--text-2); background: var(--muted-50); border-radius: 999px; padding: 3px 10px; }
.topbar .role-select { border-radius: 10px; font-weight: 600; font-size: 13px; border-color: var(--border-strong); min-width: 150px; }
.bell { position: relative; }
.bell .count, .nav-count { position: absolute; top: -3px; right: -3px; background: var(--bad); color: #fff; font-size: 10px; font-weight: 700; border-radius: 999px; min-width: 17px; height: 17px; display: grid; place-items: center; padding: 0 4px; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(224, 138, 0, .6); } 70% { box-shadow: 0 0 0 7px rgba(224, 138, 0, 0); } 100% { box-shadow: 0 0 0 0 rgba(224, 138, 0, 0); } }

/* ---------- Sidebar ---------- */
.sidebar { position: fixed; top: var(--topbar-h); bottom: 0; left: 0; width: var(--sidebar-w); background: var(--surface); border-right: 1px solid var(--border); overflow-y: auto; padding: 14px 10px 30px; z-index: 1020; }
.sidebar .section-label { font-size: 10.5px; font-weight: 700; letter-spacing: .1em; color: var(--text-3); text-transform: uppercase; padding: 10px 12px 6px; }
.sidebar .nav-link { display: flex; align-items: center; gap: 11px; color: var(--text-2); border-radius: 10px; padding: 8px 12px; font-weight: 500; font-size: 13.5px; margin-bottom: 1px; position: relative; }
.sidebar .nav-link i { width: 18px; text-align: center; color: var(--text-3); }
.sidebar .nav-link:hover { background: var(--muted-50); color: var(--text); }
.sidebar .nav-link.active { background: var(--brand-50); color: var(--brand); font-weight: 600; }
.sidebar .nav-link.active i { color: var(--brand); }
.sidebar .nav-link .nav-badge { margin-left: auto; font-size: 10.5px; background: var(--bad-50); color: var(--bad); border-radius: 999px; padding: 1px 7px; font-weight: 700; }
.main { padding: calc(var(--topbar-h) + 22px) 26px 40px; min-height: 100vh; }
.with-sidebar .main { margin-left: var(--sidebar-w); }
.sidebar-backdrop { display: none; }

/* ---------- Patient top nav ---------- */
.pnav { display: flex; gap: 2px; margin-left: 12px; }
.pnav a { color: var(--text-2); font-weight: 600; font-size: 13.5px; padding: 8px 12px; border-radius: 10px; position: relative; }
.pnav a.active, .pnav a:hover { color: var(--brand); background: var(--brand-50); }
.bottom-nav { display: none; }
.patient-mode .main { max-width: 1240px; margin: 0 auto; }

/* ---------- Cards ---------- */
.card-x { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-x .card-h { padding: 14px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
.card-x .card-h h6 { margin: 0; font-size: 14.5px; font-weight: 700; }
.card-x .card-b { padding: 18px; }
.card-x.pad { padding: 18px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { font-size: 23px; margin: 0; }
.page-head p { margin: 4px 0 0; color: var(--text-2); }
.crumb { font-size: 12px; color: var(--text-3); font-weight: 600; letter-spacing: .02em; margin-bottom: 4px; text-transform: uppercase; }

/* KPI */
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; height: 100%; box-shadow: var(--shadow-sm); transition: transform .15s, box-shadow .15s; display: block; color: inherit; }
a.kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow); color: inherit; }
.kpi .kpi-top { display: flex; align-items: center; justify-content: space-between; }
.kpi .kpi-label { color: var(--text-2); font-size: 12.5px; font-weight: 600; }
.kpi .kpi-icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-size: 14px; }
.kpi .kpi-value { font-size: 26px; font-weight: 800; margin-top: 8px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi .kpi-sub { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.tone-brand { background: var(--brand-50); color: var(--brand); }
.tone-blue { background: var(--accent-50); color: var(--accent); }
.tone-ok { background: var(--ok-50); color: var(--ok); }
.tone-warn { background: var(--warn-50); color: var(--warn); }
.tone-bad { background: var(--bad-50); color: var(--bad); }
.tone-violet { background: var(--violet-50); color: var(--violet); }
.tone-muted { background: var(--muted-50); color: var(--text-2); }

/* ---------- Status badges ---------- */
.sb { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 700; letter-spacing: .03em; padding: 3px 9px; border-radius: 999px; white-space: nowrap; text-transform: uppercase; }
.sb::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.sb.ok { background: var(--ok-50); color: var(--ok); }
.sb.warn { background: var(--warn-50); color: var(--warn); }
.sb.bad { background: var(--bad-50); color: var(--bad); }
.sb.info { background: var(--info-50); color: var(--info); }
.sb.brand { background: var(--brand-50); color: var(--brand); }
.sb.violet { background: var(--violet-50); color: var(--violet); }
.sb.muted { background: var(--muted-50); color: var(--text-2); }
.sb.live::before { animation: pulse-ok 1.5s infinite; }
@keyframes pulse-ok { 0% { box-shadow: 0 0 0 0 rgba(21, 128, 61, .5); } 70% { box-shadow: 0 0 0 6px rgba(21, 128, 61, 0); } 100% { box-shadow: 0 0 0 0 rgba(21, 128, 61, 0); } }
.rx-flag { display: inline-flex; align-items: center; gap: 4px; font-size: 10.5px; font-weight: 800; color: #b42318; background: #fdecec; border: 1px solid #f7c9c9; border-radius: 6px; padding: 1px 6px; }

/* DEMO vs REAL API markers */
.demo-chip { display: inline-flex; align-items: center; gap: 5px; font-size: 10.5px; font-weight: 700; color: var(--amber); background: var(--amber-50); border: 1px dashed #e7b75a; border-radius: 6px; padding: 2px 7px; letter-spacing: .03em; white-space: nowrap; }
.api-chip { display: inline-flex; align-items: center; gap: 5px; font-size: 10.5px; font-weight: 700; color: var(--violet); background: var(--violet-50); border: 1px dashed #b6a4f3; border-radius: 6px; padding: 2px 7px; font-family: 'JetBrains Mono', monospace; white-space: nowrap; cursor: help; }

/* ---------- Tables ---------- */
.table-x { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.table-x th { background: var(--surface-2); color: var(--text-2); font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; position: sticky; top: 0; z-index: 1; }
.table-x td { padding: 11px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.table-x tbody tr:hover td { background: var(--brand-50); }
.table-x tbody tr:last-child td { border-bottom: 0; }
.table-wrap { overflow: auto; max-width: 100%; }
.table-wrap.tall { max-height: 560px; }
.empty { text-align: center; padding: 36px 16px; color: var(--text-3); }
.empty i { font-size: 28px; display: block; margin-bottom: 8px; opacity: .6; }
.row-actions .btn { margin-right: 3px; }

/* ---------- Forms ---------- */
.form-label { font-weight: 600; font-size: 12.5px; color: var(--text-2); margin-bottom: 5px; }
.form-control, .form-select { border-radius: 10px; border-color: var(--border-strong); font-size: 13.5px; padding: .55rem .75rem; }
.form-control:focus, .form-select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(14, 99, 173, .15); }
.form-control-sm, .form-select-sm { padding: .35rem .6rem; font-size: 12.5px; border-radius: 8px; }
.req::after { content: ' *'; color: var(--bad); }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; }
.filters .f { min-width: 140px; flex: 1 1 140px; max-width: 220px; }
.filters .f label { font-size: 11px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 3px; display: block; }

/* ---------- Stepper ---------- */
.stepper { display: flex; gap: 0; overflow-x: auto; padding: 4px 2px 12px; margin-bottom: 14px; scrollbar-width: none; }
.stepper .st { display: flex; align-items: center; gap: 8px; color: var(--text-3); font-weight: 600; font-size: 12.5px; white-space: nowrap; flex: 1; min-width: max-content; }
.stepper .st .n { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--border-strong); display: grid; place-items: center; font-size: 11.5px; background: var(--surface); }
.stepper .st .ln { flex: 1; height: 2px; background: var(--border); margin: 0 8px; min-width: 16px; }
.stepper .st.done .n { background: var(--brand); color: #fff; border-color: var(--brand); }
.stepper .st.done { color: var(--text-2); }
.stepper .st.done .ln { background: var(--brand); }
.stepper .st.cur .n { border-color: var(--brand); color: var(--brand); box-shadow: 0 0 0 4px var(--brand-50); }
.stepper .st.cur { color: var(--brand); }

/* ---------- Timeline ---------- */
.tl { list-style: none; padding: 0; margin: 0; position: relative; }
.tl li { position: relative; padding: 0 0 18px 38px; }
.tl li::before { content: ''; position: absolute; left: 13px; top: 26px; bottom: 0; width: 2px; background: var(--border); }
.tl li:last-child::before { display: none; }
.tl li.done::before { background: var(--brand); }
.tl .ic { position: absolute; left: 0; top: 0; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; background: var(--surface); border: 2px solid var(--border-strong); color: var(--text-3); }
.tl li.done .ic { background: var(--brand); border-color: var(--brand); color: #fff; }
.tl li.cur .ic { border-color: var(--accent); color: var(--accent); box-shadow: 0 0 0 5px var(--accent-50); animation: pulse-blue 1.6s infinite; }
.tl li.fail .ic { background: var(--bad); border-color: var(--bad); color: #fff; }
@keyframes pulse-blue { 0% { box-shadow: 0 0 0 0 rgba(42, 120, 214, .45); } 70% { box-shadow: 0 0 0 9px rgba(42, 120, 214, 0); } 100% { box-shadow: 0 0 0 0 rgba(42, 120, 214, 0); } }
.tl .t { font-weight: 700; font-size: 13.5px; line-height: 28px; }
.tl li.todo .t { color: var(--text-3); font-weight: 500; }
.tl .m { font-size: 12px; color: var(--text-3); margin-top: -4px; }

/* State machine strip */
.sm-strip { display: flex; overflow-x: auto; gap: 4px; padding-bottom: 6px; }
.sm-strip .s { flex: 0 0 auto; font-size: 10px; font-weight: 700; padding: 5px 8px; border-radius: 6px; background: var(--muted-50); color: var(--text-3); letter-spacing: .02em; }
.sm-strip .s.done { background: var(--brand-50); color: var(--brand); }
.sm-strip .s.cur { background: var(--brand); color: #fff; }
.sm-strip .s.bad { background: var(--bad); color: #fff; }

/* ---------- Launchpad / hero ---------- */
.hero { background: radial-gradient(1200px 400px at 10% -10%, #d9f0f2 0%, transparent 60%), radial-gradient(800px 400px at 100% 0%, #e2ecfb 0%, transparent 60%), #fff; border: 1px solid var(--border); border-radius: 22px; padding: 36px; position: relative; overflow: hidden; }
.hero h1 { font-size: 34px; font-weight: 800; letter-spacing: -.025em; line-height: 1.12; }
.hero .lead { color: var(--text-2); font-size: 16px; max-width: 640px; }
.btn-start { font-size: 17px; font-weight: 800; letter-spacing: .03em; padding: 16px 26px; border-radius: 14px; }
.role-card { border: 1px solid var(--border); background: var(--surface); border-radius: 14px; padding: 16px; cursor: pointer; transition: all .15s; height: 100%; }
.role-card:hover { border-color: var(--brand); box-shadow: var(--shadow); transform: translateY(-2px); }
.role-card .ri { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; font-size: 18px; margin-bottom: 10px; }
.cred { font-family: 'JetBrains Mono', monospace; font-size: 11.5px; background: var(--muted-50); border-radius: 6px; padding: 2px 6px; color: var(--text-2); }
.legend-box { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; font-size: 12.5px; color: var(--text-2); }

/* ---------- Architecture diagram ---------- */
.arch svg { width: 100%; height: auto; display: block; }
.arch .node rect { fill: #fff; stroke: var(--border-strong); stroke-width: 1.5; transition: all .3s; }
.arch .node text { font-family: var(--font); font-size: 12.5px; font-weight: 700; fill: var(--text); text-anchor: middle; dominant-baseline: middle; transition: fill .3s; }
.arch .node .ico { font-family: 'Font Awesome 6 Free'; font-weight: 900; font-size: 12px; fill: var(--brand); }
.arch .node.grp-sys rect { fill: #f7f5ff; stroke: #cfc3f7; }
.arch .node.grp-sys .ico { fill: var(--violet); }
.arch .node.done rect { fill: var(--brand-50); stroke: var(--brand); }
.arch .node.active rect { fill: var(--brand); stroke: var(--brand); filter: drop-shadow(0 4px 10px rgba(14, 99, 173, .45)); }
.arch .node.active text { fill: #fff; }
.arch .edge { fill: none; stroke: #b7c2cf; stroke-width: 1.6; marker-end: url(#arrow); transition: stroke .3s; }
.arch .edge.done { stroke: var(--brand); }
.arch .edge.flow { stroke: var(--accent); stroke-dasharray: 6 5; animation: dash 0.8s linear infinite; }
@keyframes dash { to { stroke-dashoffset: -22; } }

/* ---------- Product cards ---------- */
.p-card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; overflow: hidden; display: flex; flex-direction: column; height: 100%; transition: box-shadow .15s, transform .15s; }
.p-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.p-img { height: 130px; display: grid; place-items: center; position: relative; }
.p-img i { font-size: 44px; color: rgba(255, 255, 255, .95); filter: drop-shadow(0 4px 8px rgba(0, 0, 0, .15)); }
.p-img .p-tags { position: absolute; top: 10px; left: 10px; display: flex; gap: 5px; }
.p-img .ph { position: absolute; bottom: 6px; right: 10px; font-size: 9.5px; color: rgba(255, 255, 255, .85); font-weight: 600; letter-spacing: .05em; }
.p-body { padding: 14px; display: flex; flex-direction: column; flex: 1; }
.p-name { font-weight: 700; font-size: 14.5px; }
.p-meta { font-size: 12px; color: var(--text-3); }
.price { font-weight: 800; font-size: 18px; }
.mrp { text-decoration: line-through; color: var(--text-3); font-size: 12.5px; }
.off { color: var(--ok); font-weight: 700; font-size: 12px; }
.qty { display: inline-flex; align-items: center; border: 1px solid var(--border-strong); border-radius: 10px; overflow: hidden; }
.qty button { border: 0; background: var(--surface); width: 30px; height: 32px; font-weight: 700; color: var(--brand); }
.qty button:hover { background: var(--brand-50); }
.qty input { width: 36px; border: 0; text-align: center; font-weight: 700; font-size: 13px; }
.cat-1 { background: linear-gradient(135deg, #e5484d, #f28b6b); }
.cat-2 { background: linear-gradient(135deg, #1177cc, #62a8f0); }
.cat-3 { background: linear-gradient(135deg, #0e63ad, #2fb3a2); }
.cat-4 { background: linear-gradient(135deg, #6d4ae0, #a18af2); }
.cat-5 { background: linear-gradient(135deg, #d97706, #f5b544); }
.cat-6 { background: linear-gradient(135deg, #0e7490, #38bdf8); }
.cat-7 { background: linear-gradient(135deg, #be185d, #f472b6); }
.cat-8 { background: linear-gradient(135deg, #15803d, #4ade80); }
.cat-9 { background: linear-gradient(135deg, #475569, #94a3b8); }

/* Option cards (delivery / payment) */
.opt { border: 1.5px solid var(--border); border-radius: 14px; padding: 14px 16px; cursor: pointer; background: var(--surface); transition: all .15s; display: block; height: 100%; }
.opt:hover { border-color: var(--brand-100); }
.opt.sel { border-color: var(--brand); background: var(--brand-50); box-shadow: 0 0 0 3px rgba(14, 99, 173, .08); }
.opt.disabled { opacity: .5; pointer-events: none; }
.pay-tabs .nav-link { color: var(--text-2); font-weight: 600; border-radius: 10px; padding: 10px 14px; text-align: left; display: flex; gap: 10px; align-items: center; }
.pay-tabs .nav-link.active { background: var(--brand-50); color: var(--brand); }
.upi-app { border: 1.5px solid var(--border); border-radius: 12px; padding: 12px; text-align: center; cursor: pointer; font-weight: 600; font-size: 12.5px; }
.upi-app.sel { border-color: var(--brand); background: var(--brand-50); }
.upi-app i { font-size: 22px; display: block; margin-bottom: 4px; }

/* Summary */
.sum-row { display: flex; justify-content: space-between; padding: 6px 0; font-size: 13.5px; color: var(--text-2); }
.sum-row b { color: var(--text); font-variant-numeric: tabular-nums; }
.sum-total { border-top: 1px dashed var(--border-strong); margin-top: 8px; padding-top: 12px; font-size: 17px; font-weight: 800; color: var(--text); }

/* Upload */
.dropzone { border: 2px dashed var(--border-strong); border-radius: 16px; padding: 34px 20px; text-align: center; background: var(--surface-2); cursor: pointer; transition: all .15s; }
.dropzone:hover, .dropzone.drag { border-color: var(--brand); background: var(--brand-50); }
.dropzone i { font-size: 36px; color: var(--brand); }
.file-row { display: flex; align-items: center; gap: 12px; border: 1px solid var(--border); border-radius: 12px; padding: 12px; }
.file-ico { width: 44px; height: 44px; border-radius: 10px; display: grid; place-items: center; font-size: 20px; }
.rx-preview { max-height: 360px; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--surface-2); display: grid; place-items: center; }
.rx-preview img { max-width: 100%; max-height: 360px; }
.rx-mock { width: 100%; max-width: 360px; background: var(--surface); border: 1px solid #dfe5ec; padding: 18px; font-family: Georgia, serif; font-size: 12px; color: #334; margin: 14px auto; }
.rx-mock .hdr { border-bottom: 2px solid var(--brand); padding-bottom: 6px; margin-bottom: 8px; font-weight: 700; color: var(--brand); font-family: var(--font); }
.rx-mock .line { height: 7px; background: var(--line-soft); border-radius: 4px; margin: 8px 0; }

/* QR scanner */
.scanner { position: relative; width: 100%; max-width: 320px; aspect-ratio: 1; margin: 0 auto; border-radius: 22px; background: #0f1b2d; overflow: hidden; display: grid; place-items: center; }
.scanner .frame { position: absolute; inset: 14%; border-radius: 14px; }
.scanner .frame::before, .scanner .frame::after { content: ''; position: absolute; width: 36px; height: 36px; border: 4px solid #3ee0c8; }
.scanner .frame::before { top: 0; left: 0; border-right: 0; border-bottom: 0; border-radius: 12px 0 0 0; }
.scanner .frame::after { bottom: 0; right: 0; border-left: 0; border-top: 0; border-radius: 0 0 12px 0; }
.scanner .laser { position: absolute; left: 14%; right: 14%; height: 2px; background: #3ee0c8; box-shadow: 0 0 12px #3ee0c8; top: 14%; animation: laser 2s ease-in-out infinite alternate; }
@keyframes laser { to { top: 86%; } }
.scanner .qr-ghost { opacity: .35; filter: invert(1); }
.scanner.hit .frame::before, .scanner.hit .frame::after { border-color: #4ade80; }
.qr-box { background: var(--surface); padding: 14px; border-radius: 14px; border: 1px solid var(--border); display: inline-block; }
.qr-box img, .qr-box canvas { display: block; }

/* Doctor card */
.doc-card { display: flex; gap: 14px; align-items: center; }
.avatar { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; color: #fff; flex: 0 0 auto; background: linear-gradient(135deg, var(--brand), var(--accent)); }
.avatar.sm { width: 32px; height: 32px; font-size: 12px; }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 6px 12px; font-size: 13px; }
.kv dt { color: var(--text-3); font-weight: 500; }
.kv dd { margin: 0; font-weight: 600; word-break: break-word; }

/* Success */
.success-ring { width: 84px; height: 84px; border-radius: 50%; background: var(--ok-50); display: grid; place-items: center; margin: 0 auto; animation: pop .5s cubic-bezier(.2, 1.4, .4, 1); }
.success-ring i { font-size: 40px; color: var(--ok); }
@keyframes pop { from { transform: scale(.3); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* Map */
.map { height: 380px; border-radius: 14px; overflow: hidden; border: 1px solid var(--border); position: relative; z-index: 0; background: #e8eef3; }
.map-label { position: absolute; z-index: 500; top: 10px; left: 10px; }
.truck-ic { width: 34px; height: 34px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; box-shadow: 0 0 0 5px rgba(42, 120, 214, .25); font-size: 14px; }
.pin-ic { width: 30px; height: 30px; border-radius: 50%; color: #fff; display: grid; place-items: center; font-size: 13px; border: 3px solid #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .3); }

/* JSON viewer */
.json { background: #0f1b2d; color: #d6e2f0; border-radius: 10px; padding: 12px 14px; font-family: 'JetBrains Mono', monospace; font-size: 11.5px; line-height: 1.55; white-space: pre-wrap; word-break: break-word; max-height: 320px; overflow: auto; margin: 0; }
.json .k { color: #8ec5ff; } .json .s { color: #a5e4b6; } .json .n { color: #ffcf8a; } .json .b { color: #f5a3c7; }

/* Event feed */
.feed { max-height: 420px; overflow: auto; }
.feed .ev { display: flex; gap: 10px; padding: 8px 4px; border-bottom: 1px solid var(--line-soft); font-size: 12.5px; animation: slidein .35s ease; }
.feed .ev .tm { color: var(--text-3); font-size: 11px; min-width: 62px; font-variant-numeric: tabular-nums; }
.feed .ev .sys { font-weight: 700; font-size: 10.5px; padding: 1px 6px; border-radius: 5px; height: fit-content; }
@keyframes slidein { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* Integration cards */
.int-card { border: 1px solid var(--border); background: var(--surface); border-radius: 16px; padding: 18px; height: 100%; display: flex; flex-direction: column; }
.int-card .logo { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; font-size: 20px; font-weight: 800; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.chips span { font-size: 11px; background: var(--muted-50); border-radius: 6px; padding: 2px 7px; color: var(--text-2); font-weight: 600; }

/* Kanban */
.kanban { display: grid; grid-template-columns: repeat(5, minmax(220px, 1fr)); gap: 12px; overflow-x: auto; }
.kcol { background: var(--surface-2); border-radius: 14px; padding: 10px; min-height: 260px; }
.kcol h6 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-2); display: flex; justify-content: space-between; margin: 4px 4px 10px; }
.kitem { background: var(--surface); border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; border: 1px solid var(--border); box-shadow: var(--shadow-sm); font-size: 12.5px; animation: slidein .3s; }

/* WhatsApp preview */
.wa { background: #efeae2; border-radius: 16px; padding: 14px; min-height: 320px; max-height: 460px; overflow: auto; }
.wa .hdr { background: #075e54; color: #fff; margin: -14px -14px 12px; padding: 10px 14px; border-radius: 16px 16px 0 0; font-weight: 600; display: flex; gap: 10px; align-items: center; }
.wa .msg { background: var(--surface); border-radius: 0 10px 10px 10px; padding: 8px 10px; margin-bottom: 8px; max-width: 88%; font-size: 12.5px; box-shadow: 0 1px 1px rgba(0, 0, 0, .08); }
.wa .msg .t { font-size: 10px; color: #8696a0; text-align: right; margin-top: 2px; }

/* Label */
.ship-label { border: 2px solid #111; border-radius: 6px; padding: 12px; background: var(--surface); font-size: 12px; max-width: 420px; margin: 0 auto; }
.ship-label .row-l { display: flex; justify-content: space-between; border-bottom: 1px solid #111; padding: 6px 0; gap: 8px; }
.bd-logo { font-weight: 900; color: #2b3990; letter-spacing: -.02em; font-size: 18px; }
.bd-logo span { color: #d71920; }

/* Invoice */
.invoice { background: var(--surface); max-width: 900px; margin: 0 auto; padding: 36px; border: 1px solid var(--border); border-radius: 12px; color: #111; font-size: 12.5px; }
.invoice table { width: 100%; border-collapse: collapse; }
.invoice th, .invoice td { border: 1px solid #d9dee5; padding: 7px 8px; }
.invoice th { background: #f3f6f9; font-size: 11px; text-transform: uppercase; }

/* ---------- Demo simulation overlay ---------- */
.demo-overlay { position: fixed; inset: 0; background: rgba(15, 27, 45, .55); backdrop-filter: blur(4px); z-index: 2000; display: none; padding: 16px; }
.demo-overlay.open { display: block; }
.demo-panel { background: #f5f7fa; border-radius: 20px; height: 100%; max-width: 1500px; margin: 0 auto; display: flex; flex-direction: column; overflow: hidden; box-shadow: var(--shadow-lg); }
.demo-head { background: var(--surface); border-bottom: 1px solid var(--border); padding: 12px 18px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.demo-progress { height: 6px; background: #e6ebf1; }
.demo-progress > div { height: 100%; background: linear-gradient(90deg, var(--brand), var(--accent)); width: 0; transition: width .5s; }
.demo-body { flex: 1; display: grid; grid-template-columns: 290px 1fr 400px; gap: 14px; padding: 14px; overflow: hidden; min-height: 0; }
.demo-col { overflow: auto; min-height: 0; }
.dstep { display: flex; gap: 10px; align-items: center; padding: 7px 10px; border-radius: 10px; font-size: 12.5px; color: var(--text-3); font-weight: 500; }
.dstep .di { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--border-strong); display: grid; place-items: center; font-size: 10px; flex: 0 0 auto; background: var(--surface); }
.dstep.done { color: var(--text); }
.dstep.done .di { background: var(--brand); border-color: var(--brand); color: #fff; }
.dstep.active { background: var(--surface); color: var(--brand); font-weight: 700; box-shadow: var(--shadow-sm); }
.dstep.active .di { border-color: var(--accent); color: var(--accent); animation: pulse-blue 1.4s infinite; }
.dstep.err { background: var(--bad-50); color: var(--bad); }
.dstep.err .di { background: var(--bad); border-color: var(--bad); color: #fff; }
.dstep .dt { margin-left: auto; font-size: 10.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.stage { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; min-height: 100%; padding: 24px; animation: slidein .35s; }
.stage .stage-kicker { font-size: 11px; font-weight: 800; letter-spacing: .12em; color: var(--accent); text-transform: uppercase; }
.stage h3 { font-size: 22px; margin: 4px 0 16px; }
.typing::after { content: '|'; animation: blink 1s infinite; color: var(--brand); }
@keyframes blink { 50% { opacity: 0; } }
.phone { width: 300px; max-width: 100%; border: 10px solid #0f1b2d; border-radius: 34px; background: var(--surface); padding: 14px; margin: 0 auto; min-height: 420px; box-shadow: var(--shadow-lg); }

/* Toasts */
.toast-stack { position: fixed; right: 16px; bottom: 16px; z-index: 3000; display: flex; flex-direction: column; gap: 8px; max-width: 380px; }
.toast-x { background: #0f1b2d; color: #fff; border-radius: 12px; padding: 11px 14px; font-size: 13px; box-shadow: var(--shadow-lg); display: flex; gap: 10px; align-items: flex-start; animation: slidein .25s; }
.toast-x.ok i { color: #4ade80; } .toast-x.bad i { color: #f87171; } .toast-x.warn i { color: #fbbf24; } .toast-x.info i { color: #7cc0ff; }

/* Error card */
.err-card { border: 1px solid #f5c2c2; background: var(--bad-50); border-radius: 14px; padding: 14px 16px; }
.err-card .code { font-family: 'JetBrains Mono', monospace; font-weight: 800; color: var(--bad); }

/* Misc */
.divider { height: 1px; background: var(--border); margin: 16px 0; }
.nav-tabs-x { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; }
.nav-tabs-x a { padding: 10px 14px; font-weight: 600; color: var(--text-2); border-bottom: 2px solid transparent; white-space: nowrap; cursor: pointer; }
.nav-tabs-x a.active { color: var(--brand); border-bottom-color: var(--brand); }
.chart-box { position: relative; height: 260px; }
.chart-box.sm { height: 200px; }
.switch-row { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--line-soft); }
.hub-flow { display: flex; align-items: stretch; gap: 6px; overflow-x: auto; }
.hub-flow .hf { flex: 1; min-width: 110px; text-align: center; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 10px 6px; }
.hub-flow .hf b { display: block; font-size: 22px; }
.hub-flow .arrow { align-self: center; color: var(--text-3); }
.print-only { display: none; }
.modal-content { border-radius: 16px; border: 0; }
.modal-header { border-bottom: 1px solid var(--border); }
.modal-footer { border-top: 1px solid var(--border); }
.bar-mini { height: 6px; border-radius: 4px; background: #e9eef3; overflow: hidden; }
.bar-mini > div { height: 100%; background: var(--brand); border-radius: 4px; }
.progress { border-radius: 8px; }
.progress-bar { background: var(--brand); }

/* ---------- Responsive ---------- */
@media (max-width: 1280px) {
  .demo-body { grid-template-columns: 250px 1fr; }
  .demo-body .demo-right { display: none; }
}
@media (max-width: 991.98px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow-lg); }
  body.sidebar-open .sidebar { transform: none; }
  body.sidebar-open .sidebar-backdrop { display: block; position: fixed; inset: var(--topbar-h) 0 0 0; background: rgba(15, 27, 45, .35); z-index: 1015; }
  .with-sidebar .main { margin-left: 0; }
  .main { padding: calc(var(--topbar-h) + 16px) 16px 90px; }
  .pnav { display: none; }
  .bottom-nav { display: flex; position: fixed; bottom: 0; left: 0; right: 0; background: var(--surface); border-top: 1px solid var(--border); z-index: 1030; padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
  .bottom-nav a { flex: 1; text-align: center; color: var(--text-3); font-size: 10.5px; font-weight: 600; position: relative; padding: 4px 0; }
  .bottom-nav a i { display: block; font-size: 18px; margin-bottom: 2px; }
  .bottom-nav a.active { color: var(--brand); }
  .bottom-nav .nav-count { right: calc(50% - 20px); }
  .hide-md { display: none !important; }
  .demo-body { grid-template-columns: 1fr; overflow: auto; }
  .demo-body .demo-left { max-height: 180px; }
  .hero { padding: 22px; }
  .hero h1 { font-size: 26px; }
  .kanban { grid-template-columns: repeat(5, 240px); }
}
@media (max-width: 575.98px) {
  .topbar { padding: 0 10px; gap: 6px; }
  .brand-logo .name small, .hide-sm { display: none !important; }
  .page-head h1 { font-size: 20px; }
  .kv { grid-template-columns: 110px 1fr; }
  .kpi .kpi-value { font-size: 21px; }
  .demo-overlay { padding: 0; }
  .demo-panel { border-radius: 0; }
  .stage { padding: 16px; }
  .invoice { padding: 16px; }
}

@media print {
  body * { visibility: hidden; }
  .printable, .printable * { visibility: visible; }
  .printable { position: absolute; left: 0; top: 0; width: 100%; border: 0 !important; }
  .no-print { display: none !important; }
}

.table-x a.mono, .table-x .mono.fw-600 { white-space: nowrap; }
.demo-pill, .secure-pill, .session-pill { white-space: nowrap; }
@media (max-width: 991.98px) { .toast-stack { bottom: 84px; left: 12px; right: 12px; max-width: none; } }
@media (max-width: 400px) { .demo-pill { font-size: 9.5px; padding: 2px 7px; letter-spacing: .04em; } }
.feed .ev > .flex-grow-1 { min-width: 0; overflow-wrap: anywhere; }
.feed .ev > .sb { flex: 0 0 auto; align-self: flex-start; }
.demo-right .arch { max-width: 100%; }
.page-head h1 .mono { font-size: inherit; }
.topbar .btn { white-space: nowrap; }
.kv dd .api-chip { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.pnav a { white-space: nowrap; padding: 8px 10px; }
@media (max-width: 1599.98px) { .patient-mode .secure-pill { display: none; } }
@media (max-width: 1399.98px) { .patient-mode .session-pill, .patient-mode .brand-logo .name small { display: none; } .patient-mode .pnav a { padding: 8px 7px; font-size: 13px; } }
@media (max-width: 1199.98px) { .patient-mode .role-select { min-width: 0; width: 120px; } }
@media (max-width: 1279.98px) {
  .patient-mode .pnav { display: none; }
  .patient-mode .bottom-nav { display: flex; position: fixed; bottom: 0; left: 0; right: 0; background: var(--surface); border-top: 1px solid var(--border); z-index: 1030; padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
  .patient-mode .bottom-nav a { flex: 1; text-align: center; color: var(--text-3); font-size: 10.5px; font-weight: 600; position: relative; padding: 4px 0; }
  .patient-mode .bottom-nav a i { display: block; font-size: 18px; margin-bottom: 2px; }
  .patient-mode .bottom-nav a.active { color: var(--brand); }
  .patient-mode .main { padding-bottom: 90px; }
}
@media (max-width: 575.98px) { .legend-box .nowrap { white-space: normal; } }

/* ===== Enterprise shell additions ===== */
.boot { min-height: 60vh; display: grid; place-content: center; text-align: center; }
.gsearch { position: relative; flex: 1 1 360px; max-width: 460px; margin-left: 18px; }
.gsearch i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-3); font-size: 13px; }
.gsearch input { padding-left: 34px; border-radius: 10px; background: var(--muted-50); border-color: transparent; height: 36px; }
.gsearch input:focus { background: var(--surface); }
.hero-card { box-shadow: var(--shadow); }
.step-no { width: 26px; height: 26px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 12px; }
.login-side { background: linear-gradient(160deg, #0d1b2a 0%, #0f2f4f 58%, #0f62ae 130%); min-height: 100%; }
.site-foot { border-top: 1px solid var(--border); margin-top: 28px; padding-top: 24px; }
.site-foot a { text-decoration: none; line-height: 1.9; }
.sb-foot { margin: 18px 12px 0; padding-top: 12px; border-top: 1px solid var(--border); font-size: 11px; color: var(--text-2); }
.scanner video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .2s; }
.scanner.live video { opacity: 1; }
.scanner .scan-idle { color: rgba(255,255,255,.55); text-align: center; z-index: 1; }
.scanner .scan-idle i { font-size: 54px; }
.scanner.live .scan-idle { display: none; }
.scanner .laser { display: none; }
.scanner.live .laser { display: block; }
.scanner .frame, .scanner .laser { z-index: 2; }
@media (max-width: 575.98px) {
  .hero h1 { font-size: 24px; }
  .hero .btn-lg { width: 100%; }
  .page-head > div:last-child { width: 100%; }
  .card-x .card-h { flex-wrap: wrap; }
  .table-x th, .table-x td { padding: 9px 10px; }
  .modal-dialog { margin: .5rem; }
  .filters .f { max-width: none; flex: 1 1 45%; }
}
@media (max-width: 575.98px) {
  .hub-flow { gap: 4px; }
  .hub-flow .hf { min-width: 78px; padding: 8px 4px; }
  .hub-flow .hf .small { font-size: 11px; }
  .gsearch { display: none; }
}
.p-img i { font-size: inherit; filter: none; }
.p-img > i { font-size: 44px; color: rgba(255,255,255,.95); filter: drop-shadow(0 4px 8px rgba(0,0,0,.15)); }
.p-img .p-tags .rx-flag { background: var(--surface); }
@media (max-width: 575.98px) { .p-img { height: 96px !important; } .p-img > i { font-size: 34px; } .price { font-size: 16px; } .p-body { padding: 10px; } .p-body .btn-sm { padding: .3rem .4rem; } .qty button { width: 26px; } .qty input { width: 28px; } }
