/* Tanavya design system.
   Direction: Minimalism / Swiss. Calm, high-contrast, generous whitespace, one accent (orange) used sparingly.
   Brand anchors from the Tanavya logo: #164E8A primary blue, #0B2A5B navy, #F58220 orange accent, #22C55E success, #F5F8FC background, #172B4D text.
   The accent tokens keep their old --c-teal names so existing components pick up the new colour.
   Type: Atkinson Hyperlegible (designed for legibility), Devanagari falls back to the system font. */

@font-face { font-family: "Atkinson Hyperlegible"; font-weight: 400; font-style: normal; font-display: swap;
  src: url("../vendor/fonts/atkinson-400.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Atkinson Hyperlegible"; font-weight: 400; font-style: normal; font-display: swap;
  src: url("../vendor/fonts/atkinson-400-ext.woff2") format("woff2"); unicode-range: U+0100-02AF, U+1E00-1EFF, U+20A0-20AB, U+20AD-20CF, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Atkinson Hyperlegible"; font-weight: 700; font-style: normal; font-display: swap;
  src: url("../vendor/fonts/atkinson-700.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Atkinson Hyperlegible"; font-weight: 700; font-style: normal; font-display: swap;
  src: url("../vendor/fonts/atkinson-700-ext.woff2") format("woff2"); unicode-range: U+0100-02AF, U+1E00-1EFF, U+20A0-20AB, U+20AD-20CF, U+2C60-2C7F, U+A720-A7FF; }

:root {
  /* brand */
  --c-primary: #164E8A;
  --c-primary-600: #123f70;
  --c-primary-700: #0f3560;
  --c-primary-50: #eaf1f9;
  --c-primary-100: #d6e4f3;
  --c-teal: #F58220;            /* logo orange: decoration only, 2.6:1 on white */
  --c-navy: #0B2A5B;
  --c-teal-700: #B45309;       /* text-safe orange: 5.0:1 on white */
  --c-success: #22C55E;
  --c-success-700: #15803d;    /* text-safe green: 5.0:1 on white */
  --c-danger: #c62828;
  --c-warning-bg: #fff4d6;
  --c-warning-text: #7a4b00;

  /* neutrals tinted toward the brand hue */
  --c-bg: #F5F8FC;
  --c-surface: #FFFFFF;
  --c-surface-2: #EEF3F9;
  --c-border: #dbe4ef;
  --c-text: #172B4D;
  --c-text-muted: #51617d;     /* 6.0:1 on white */

  /* space (4px base) */
  --sp-1: .25rem; --sp-2: .5rem; --sp-3: .75rem; --sp-4: 1rem; --sp-6: 1.5rem; --sp-8: 2rem; --sp-12: 3rem;

  /* radius */
  --r-sm: 6px; --r-md: 10px; --r-lg: 16px;

  /* layered, brand-tinted shadows (never pure black) */
  --sh: 218 45% 20%;
  --shadow-sm: 0 1px 2px hsl(var(--sh) / .06), 0 2px 4px hsl(var(--sh) / .04);
  --shadow-md: 0 1px 2px hsl(var(--sh) / .06), 0 4px 8px hsl(var(--sh) / .05), 0 8px 16px hsl(var(--sh) / .04);
  --shadow-lg: 0 2px 4px hsl(var(--sh) / .05), 0 8px 16px hsl(var(--sh) / .06), 0 16px 32px hsl(var(--sh) / .05);

  /* motion tokens */
  --dur-fast: 150ms; --dur-base: 220ms; --dur-slow: 360ms;
  --ease-out: cubic-bezier(.22, 1, .36, 1);

  /* focus ring: 3:1 against both white and the primary blue */
  --ring: 0 0 0 2px #fff, 0 0 0 4px #0b6ad1;

  /* bootstrap bridge */
  --bs-primary: #164E8A; --bs-primary-rgb: 22, 78, 138;
  --bs-link-color: #164E8A; --bs-link-hover-color: #0f3560;
  --bs-body-color: var(--c-text); --bs-body-bg: var(--c-bg);
  --bs-body-font-family: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Devanagari", sans-serif;
  --bs-border-color: var(--c-border);
  --bs-secondary-color: var(--c-text-muted);
  --bs-success: var(--c-success-700); --bs-success-rgb: 21, 128, 61;
  --bs-border-radius: var(--r-md);
}

html { -webkit-text-size-adjust: 100%; }
body { background: var(--c-bg); color: var(--c-text); font-size: 1rem; line-height: 1.55; font-variant-numeric: tabular-nums; }
h1, h2, h3, .h1, .h2, .h3, .h4, .h5, .h6 { letter-spacing: -.01em; line-height: 1.2; text-wrap: balance; }
p, .form-text { text-wrap: pretty; }
a { text-underline-offset: 2px; }
.text-muted, .small.text-muted, .form-text { color: var(--c-text-muted) !important; }
.text-primary { color: var(--c-primary) !important; }
.text-teal { color: var(--c-teal-700) !important; }
.bg-app { background: var(--c-bg); min-height: 100vh; }

/* ---------- Accessibility ---------- */
:focus { outline: none; }
:focus-visible { outline: none; box-shadow: var(--ring) !important; border-radius: var(--r-sm); }
.btn:focus-visible, .form-control:focus-visible, .form-select:focus-visible, .page-link:focus-visible { box-shadow: var(--ring) !important; }
.skip-link { position: absolute; left: var(--sp-4); top: -48px; z-index: 2000; background: var(--c-primary); color: #fff; padding: var(--sp-2) var(--sp-4); border-radius: var(--r-sm); transition: top var(--dur-fast) var(--ease-out); }
.skip-link:focus { top: var(--sp-2); color: #fff; }
.visually-hidden-focusable:not(:focus):not(:focus-within) { position: absolute !important; }

/* ---------- Buttons ---------- */
.btn { --bs-btn-border-radius: var(--r-md); --bs-btn-font-weight: 700; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  transition: background-color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out); cursor: pointer; }
.btn-sm { min-height: 36px; --bs-btn-padding-x: .75rem; }
.btn:active:not(:disabled) { transform: scale(.98); }
.btn:disabled, .btn.disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { --bs-btn-bg: var(--c-primary); --bs-btn-border-color: var(--c-primary); --bs-btn-hover-bg: var(--c-primary-600); --bs-btn-hover-border-color: var(--c-primary-600);
  --bs-btn-active-bg: var(--c-primary-700); --bs-btn-active-border-color: var(--c-primary-700); --bs-btn-disabled-bg: var(--c-primary); --bs-btn-disabled-border-color: var(--c-primary);
  box-shadow: var(--shadow-sm); }
.btn-primary:hover:not(:disabled) { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-outline-primary { --bs-btn-color: var(--c-primary); --bs-btn-border-color: var(--c-primary); --bs-btn-hover-bg: var(--c-primary); --bs-btn-hover-border-color: var(--c-primary); --bs-btn-active-bg: var(--c-primary-700); }
.btn-outline-secondary { --bs-btn-color: #3b4a66; --bs-btn-border-color: #b9c5d6; --bs-btn-hover-bg: var(--c-surface-2); --bs-btn-hover-color: var(--c-text); --bs-btn-hover-border-color: #9aa9be; }
.btn-teal { background: var(--c-teal-700); border-color: var(--c-teal-700); color: #fff; }
.btn-teal:hover:not(:disabled) { background: #096665; border-color: #096665; color: #fff; transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-link { min-height: 0; }
.btn[disabled] .fa-spin, .btn.loading::before { display: inline-block; }

/* ---------- Forms ---------- */
.form-control, .form-select { min-height: 44px; border-color: #b9c5d6; border-radius: var(--r-md); transition: border-color var(--dur-fast), box-shadow var(--dur-fast); }
.form-control:hover, .form-select:hover { border-color: #8b9bb3; }
.form-control:focus, .form-select:focus { border-color: var(--c-primary); box-shadow: var(--ring); }
.form-control-sm, .form-select-sm { min-height: 36px; }
.form-label { color: var(--c-text); margin-bottom: var(--sp-1); }
.form-check-input { width: 1.2em; height: 1.2em; cursor: pointer; }
.form-check-input:checked { background-color: var(--c-primary); border-color: var(--c-primary); }
.is-invalid, .form-control.is-invalid { border-color: var(--c-danger); }
.invalid-feedback { color: var(--c-danger); font-weight: 700; font-size: .875rem; }

/* ---------- Surfaces ---------- */
.card { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); }
.card-header { background: var(--c-surface) !important; border-bottom: 1px solid var(--c-border); border-radius: var(--r-lg) var(--r-lg) 0 0 !important; padding: var(--sp-3) var(--sp-4); }
.card-body { padding: var(--sp-6); }
a > .card, .card.is-link { transition: transform var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-out), border-color var(--dur-base); }
a:hover > .card, .card.is-link:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: #c3d2e4; }
.stat-card .stat-value { font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2rem); font-weight: 700; color: var(--c-primary); line-height: 1.1; letter-spacing: -.02em; }
.stat-card .stat-label { color: var(--c-text-muted); font-size: .875rem; margin-bottom: var(--sp-1); hyphens: none; overflow-wrap: normal; }
.pending-card { background: var(--c-surface); border: 1px dashed #c3d0e0; border-radius: var(--r-lg); padding: var(--sp-4); color: var(--c-text-muted); }
.badge-soft { background: var(--c-primary-50); color: var(--c-primary-700); font-weight: 700; border: 1px solid var(--c-primary-100); }
.badge { font-weight: 700; letter-spacing: .01em; }
.alert { border-radius: var(--r-md); border-width: 1px; }
.alert-success { background: #e8f7ee; border-color: #b6e3c6; color: #14532d; }
.alert-danger { background: #fdecec; border-color: #f4bcbc; color: #7f1d1d; }
.alert-warning { background: var(--c-warning-bg); border-color: #f0d68a; color: var(--c-warning-text); }
.alert-info { background: #e8f2fb; border-color: #bcd5ee; color: #123f70; }

/* ---------- Tables ---------- */
.table { --bs-table-bg: transparent; margin-bottom: 0; }
.table > thead > tr > th { font-size: .8125rem; text-transform: uppercase; letter-spacing: .06em; color: var(--c-text-muted); font-weight: 700; background: var(--c-surface-2); border-bottom: 1px solid var(--c-border); white-space: nowrap; }
.table > :not(caption) > * > * { padding: .85rem 1rem; }
.table-hover > tbody > tr:hover > * { background: var(--c-primary-50); }
.table > tbody > tr > td { border-color: #eaf0f7; vertical-align: middle; }
.table-responsive { border-radius: var(--r-lg); }

/* ---------- Brand + auth ---------- */
.brand-mark { width: 52px; height: 52px; border-radius: 14px; display: inline-flex; align-items: center; justify-content: center; font-size: 1.5rem; color: #fff; background: linear-gradient(135deg, var(--c-primary), var(--c-navy)); box-shadow: var(--shadow-md); }
.brand-mark.sm { width: 34px; height: 34px; font-size: 1rem; border-radius: 10px; box-shadow: none; }
.auth-wrap { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: var(--sp-6) var(--sp-4); background:
  radial-gradient(60rem 30rem at 100% -10%, rgba(245, 130, 32, .10), transparent 60%), radial-gradient(50rem 28rem at -10% 110%, rgba(22, 78, 138, .10), transparent 60%), var(--c-bg); }
.auth-card { width: 100%; max-width: 460px; background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r-lg); padding: var(--sp-8); box-shadow: var(--shadow-lg); }

/* ---------- App shell ---------- */
.app-shell { display: flex; min-height: 100dvh; }
.sidebar { width: 252px; flex: 0 0 252px; background: var(--c-primary); color: #dbe7f5; display: flex; flex-direction: column; padding: var(--sp-4) var(--sp-3); position: sticky; top: 0; height: 100dvh; overflow-y: auto; }
.sidebar-brand { display: flex; align-items: center; gap: var(--sp-3); color: #fff; padding: var(--sp-1) var(--sp-2) var(--sp-4); border-bottom: 1px solid rgba(255, 255, 255, .14); font-size: 1.0625rem; }
.sidebar .nav-link { color: #e3edf8; border-radius: var(--r-md); padding: .65rem .8rem; display: flex; gap: var(--sp-3); align-items: center; min-height: 44px; position: relative; transition: background-color var(--dur-fast) var(--ease-out), color var(--dur-fast); }
.sidebar .nav-link i { width: 1.25rem; text-align: center; opacity: .9; }
.sidebar .nav-link:hover { background: rgba(255, 255, 255, .10); color: #fff; }
.sidebar .nav-link.active { background: #fff; color: var(--c-primary); font-weight: 700; box-shadow: var(--shadow-sm); }
.sidebar .nav-link.active i { color: var(--c-teal-700); opacity: 1; }
.sidebar .nav-link:focus-visible { box-shadow: 0 0 0 2px var(--c-primary), 0 0 0 4px #fff !important; }
.sidebar-foot { margin-top: auto; color: rgba(255, 255, 255, .72); padding: var(--sp-3) var(--sp-2) 0; font-size: .8125rem; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { background: rgba(255, 255, 255, .92); backdrop-filter: saturate(140%) blur(10px); border-bottom: 1px solid var(--c-border); padding: var(--sp-2) var(--sp-6); display: flex; align-items: center; gap: var(--sp-3); position: sticky; top: 0; z-index: 20; min-height: 60px; }
@supports not (backdrop-filter: blur(1px)) { .topbar { background: #fff; } }
.content { padding: var(--sp-6); max-width: 1280px; width: 100%; padding-bottom: var(--sp-12); }
.page-enter { animation: pageIn var(--dur-slow) var(--ease-out) both; }
@keyframes pageIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.scrim { display: none; }

/* ---------- Mobile bottom navigation ---------- */
.bottom-nav { display: none; }

/* ---------- Steps (onboarding) ---------- */
.step-list .step { display: flex; gap: var(--sp-3); align-items: center; padding: var(--sp-3) 0; border-bottom: 1px solid #eaf0f7; }
.step-list .step:last-child { border-bottom: 0; }
.step-dot { width: 30px; height: 30px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: .8rem; font-weight: 700; background: var(--c-surface-2); color: var(--c-text-muted); flex: 0 0 30px; border: 1px solid var(--c-border); }
.step-dot.done { background: var(--c-success-700); color: #fff; border-color: var(--c-success-700); }
.step-dot.skip { background: var(--c-warning-bg); color: var(--c-warning-text); border-color: #f0d68a; }

.pagination { --bs-pagination-active-bg: var(--c-primary); --bs-pagination-active-border-color: var(--c-primary); --bs-pagination-color: var(--c-primary); }
.list-group-item-action { min-height: 44px; }
dt { color: var(--c-text-muted); font-weight: 400; }
dd { font-weight: 400; }
code { color: var(--c-primary-700); background: var(--c-primary-50); padding: .1rem .35rem; border-radius: 4px; }

/* ---------- Responsive ---------- */
@media (max-width: 991.98px) {
  .sidebar { position: fixed; left: 0; top: 0; z-index: 1040; transform: translateX(-105%); visibility: hidden; transition: transform var(--dur-base) var(--ease-out), visibility 0s linear var(--dur-base); box-shadow: var(--shadow-lg); width: min(84vw, 300px); }
  .sidebar.open { transform: none; visibility: visible; transition: transform var(--dur-base) var(--ease-out); }
  .scrim.open { display: block; position: fixed; inset: 0; background: rgba(15, 30, 56, .5); z-index: 1030; animation: fadeIn var(--dur-base) both; }
  .topbar { padding: var(--sp-2) var(--sp-4); }
  .content { padding: var(--sp-4); padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
  .card-body { padding: var(--sp-4); }
  .auth-card { padding: var(--sp-6); }
  .bottom-nav { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 1020; background: rgba(255, 255, 255, .96); backdrop-filter: blur(10px); border-top: 1px solid var(--c-border);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); box-shadow: 0 -4px 16px hsl(var(--sh) / .06); }
  .bottom-nav a, .bottom-nav button { flex: 1 1 0; min-width: 0; min-height: 52px; font-size: .6875rem !important; overflow: hidden; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: .75rem; color: var(--c-text-muted); text-decoration: none; border: 0; background: none; border-radius: var(--r-md); }
  .bottom-nav i { font-size: 1.15rem; } .bottom-nav span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .bottom-nav .active { color: var(--c-primary); font-weight: 700; }
  .bottom-nav .active i { color: var(--c-teal-700); }
  .table > :not(caption) > * > * { padding: .7rem .75rem; }
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }


/* ---------- WhatsApp inbox ---------- */
.conv-list { max-height: calc(100dvh - 320px); overflow-y: auto; }
.conv-list .list-group-item.active { background: var(--c-primary-50); color: var(--c-text); border-color: var(--c-border); border-left: 4px solid var(--c-primary); }
.thread { background: #e9eff6; padding: var(--sp-4); height: min(58dvh, 560px); overflow-y: auto; display: flex; flex-direction: column; gap: var(--sp-2); }
.thread-date { text-align: center; margin: var(--sp-2) 0; }
.thread-date span { background: #fff; border: 1px solid var(--c-border); color: var(--c-text-muted); font-size: .75rem; padding: 2px 10px; border-radius: 999px; }
.bubble { max-width: min(82%, 520px); padding: .5rem .75rem; border-radius: 14px; box-shadow: var(--shadow-sm); word-wrap: break-word; overflow-wrap: anywhere; }
.bubble.in { align-self: flex-start; background: #fff; border-top-left-radius: 4px; }
.bubble.out { align-self: flex-end; background: #d9f2ef; border-top-right-radius: 4px; }
.bubble.system { background: #fff4d6; }
.bubble .who { font-size: .75rem; font-weight: 700; color: var(--c-teal-700); }
.bubble .txt { white-space: pre-wrap; }
.bubble .meta { font-size: .7rem; color: var(--c-text-muted); text-align: right; margin-top: 2px; }
.bubble .tick.st-read { color: #0b6ad1; }
.bubble .tick.st-failed { color: var(--c-danger); }
.chat-img { max-width: 100%; max-height: 260px; border-radius: 8px; display: block; }
.thread-card { overflow: hidden; }
@media (max-width: 991.98px) { .thread { height: 52dvh; } .conv-list { max-height: none; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  .btn:hover, a:hover > .card { transform: none !important; }
}
@media print { .sidebar, .topbar, .bottom-nav, .scrim { display: none !important; } .content { padding: 0; } }


/* =====================================================================
   Professional polish layer
   ===================================================================== */
:root {
  --c-info-bg: #e6f0fa; --c-info-text: #0f3f73;
  --c-ok-bg: #e5f6ec; --c-ok-text: #14532d;
  --c-warn-bg: #fff1cc; --c-warn-text: #6b4200;
  --c-bad-bg: #fdeaea; --c-bad-text: #8a1c1c;
  --c-teal-bg: #FFF1E3; --c-teal-text: #9A3F06;
  --c-muted-bg: #eceff4; --c-muted-text: #475569;
}

/* ---- Sidebar: grouped navigation ---- */
.sidebar { padding-bottom: var(--sp-3); }
.side-nav { margin-top: var(--sp-3); display: flex; flex-direction: column; gap: var(--sp-4); }
.nav-group-label { font-size: .6875rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: rgba(255, 255, 255, .72); padding: 0 var(--sp-3) var(--sp-1); }
.nav-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.sidebar .nav-link.active::before { content: ""; position: absolute; left: -12px; top: 10px; bottom: 10px; width: 4px; border-radius: 0 4px 4px 0; background: var(--c-teal); }
.nav-badge { margin-left: auto; min-width: 22px; padding: 1px 7px; border-radius: 999px; background: #ffd166; color: #4a3000; font-size: .75rem; font-weight: 700; text-align: center; }
.sidebar-foot { border-top: 1px solid rgba(255, 255, 255, .14); margin-top: auto; padding-top: var(--sp-3); }

/* ---- Topbar: breadcrumb + account menu ---- */
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; align-items: center; margin: 0; padding: 0; font-size: .9375rem; color: var(--c-text-muted); }
.crumbs li:not([aria-current])::after { content: "/"; margin: 0 .5rem; color: #9aa9be; }
.crumbs li[aria-current] { color: var(--c-text); font-weight: 700; }
.user-btn { display: inline-flex; align-items: center; gap: .6rem; min-height: 44px; padding: 4px 10px 4px 4px; border: 1px solid transparent; border-radius: 999px; background: transparent; color: var(--c-text); cursor: pointer; transition: background-color var(--dur-fast), border-color var(--dur-fast); }
.user-btn:hover, .user-btn[aria-expanded="true"] { background: var(--c-surface-2); border-color: var(--c-border); }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: .8125rem; font-weight: 700; color: #fff; background: linear-gradient(135deg, var(--c-primary), var(--c-navy)); flex: 0 0 34px; }
.user-meta { flex-direction: column; align-items: flex-start; line-height: 1.15; text-align: left; }
.user-name { font-weight: 700; font-size: .9375rem; }
.user-role { font-size: .75rem; color: var(--c-text-muted); }
.dropdown-menu { border-color: var(--c-border); border-radius: var(--r-md); box-shadow: var(--shadow-lg); padding: var(--sp-2); }
.dropdown-item { min-height: 44px; display: flex; align-items: center; gap: .6rem; border-radius: var(--r-sm); }
.dropdown-item:hover { background: var(--c-primary-50); }
.dropdown-header { color: var(--c-text); font-weight: 700; white-space: normal; }

/* ---- Page header ---- */
.page-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: var(--sp-3) var(--sp-4); margin-bottom: var(--sp-6); }
.page-title { font-size: clamp(1.375rem, 1.15rem + 1vw, 1.75rem); font-weight: 700; letter-spacing: -.02em; margin: 0; }
.page-sub { margin: .25rem 0 0; color: var(--c-text-muted); max-width: 60ch; }
.page-actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.count-pill { display: inline-block; vertical-align: middle; margin-left: .35rem; padding: 2px 10px; border-radius: 999px; background: var(--c-primary-50); color: var(--c-primary-700); border: 1px solid var(--c-primary-100); font-size: .875rem; font-weight: 700; letter-spacing: 0; }
.content h1.h4 { font-size: clamp(1.375rem, 1.15rem + 1vw, 1.75rem); font-weight: 700; letter-spacing: -.02em; }

/* ---- Status chips (colour + icon + text) ---- */
.chip { display: inline-flex; align-items: center; gap: .4rem; padding: .25rem .65rem; border-radius: 999px; font-size: .8125rem; font-weight: 700; line-height: 1.2; white-space: nowrap; border: 1px solid transparent; }
.chip i { font-size: .72rem; }
.chip-info { background: var(--c-info-bg); color: var(--c-info-text); border-color: #c4dbf1; }
.chip-ok { background: var(--c-ok-bg); color: var(--c-ok-text); border-color: #b9e2c9; }
.chip-warn { background: var(--c-warn-bg); color: var(--c-warn-text); border-color: #f0d68a; }
.chip-bad { background: var(--c-bad-bg); color: var(--c-bad-text); border-color: #f2c0c0; }
.chip-teal { background: var(--c-teal-bg); color: var(--c-teal-text); border-color: #FBD3A9; }
.chip-muted { background: var(--c-muted-bg); color: var(--c-muted-text); border-color: #d5dbe5; }

/* ---- KPI cards ---- */
.kpi { display: grid; grid-template-columns: auto 1fr; grid-template-areas: "icon value" "label label" "note note"; align-items: center; column-gap: var(--sp-3); row-gap: 2px; height: 100%; padding: var(--sp-4); background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); text-decoration: none; color: var(--c-text); transition: transform var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-out), border-color var(--dur-base); }
.kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: #c3d2e4; color: var(--c-text); }
.kpi-icon { grid-area: icon; width: 40px; height: 40px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; font-size: 1rem; }
.kpi-value { grid-area: value; font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2rem); font-weight: 700; line-height: 1; letter-spacing: -.02em; }
.kpi-label { grid-area: label; margin-top: var(--sp-2); font-size: .875rem; color: var(--c-text-muted); }
.kpi-note { grid-area: note; font-size: .8125rem; color: var(--c-ok-text); font-weight: 700; }
.kpi-blue .kpi-icon { background: var(--c-info-bg); color: var(--c-info-text); }
.kpi-teal .kpi-icon { background: var(--c-teal-bg); color: var(--c-teal-text); }
.kpi-green .kpi-icon { background: var(--c-ok-bg); color: var(--c-ok-text); }
.kpi-amber .kpi-icon { background: var(--c-warn-bg); color: var(--c-warn-text); }
.kpi-rose .kpi-icon { background: var(--c-bad-bg); color: var(--c-bad-text); }

/* ---- Setup banner, schedule, plan ---- */
.setup-banner { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-4); padding: var(--sp-4) var(--sp-6); margin-bottom: var(--sp-6); border-radius: var(--r-lg); color: #fff; background: linear-gradient(120deg, var(--c-navy) 0%, var(--c-primary) 60%, #1E5BB8 100%); box-shadow: var(--shadow-md); }
.setup-banner .progress { height: 8px; background: rgba(255, 255, 255, .28); border-radius: 999px; max-width: 420px; }
.setup-banner .progress-bar { background: #fff; border-radius: 999px; }
.schedule { list-style: none; margin: 0; padding: 0; }
.schedule li { display: flex; align-items: center; gap: var(--sp-4); padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid #eaf0f7; }
.schedule li:last-child { border-bottom: 0; }
.sched-time { flex: 0 0 76px; font-weight: 700; color: var(--c-primary); }
.sched-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.sched-patient { font-weight: 700; overflow-wrap: anywhere; }
.sched-doctor { font-size: .875rem; color: var(--c-text-muted); }
.plan-name { font-size: 1.25rem; font-weight: 700; color: var(--c-primary); }
.plan-facts div { display: flex; justify-content: space-between; padding: var(--sp-2) 0; border-top: 1px solid #eaf0f7; }
.roadmap summary { cursor: pointer; font-weight: 700; color: var(--c-text-muted); padding: var(--sp-2) 0; min-height: 44px; display: flex; align-items: center; }
.roadmap summary:hover { color: var(--c-text); }

/* ---- Empty states ---- */
.empty-state { display: flex; flex-direction: column; align-items: center; text-align: center; gap: var(--sp-2); padding: var(--sp-8) var(--sp-4); }
.empty-icon { width: 56px; height: 56px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 1.35rem; background: var(--c-primary-50); color: var(--c-primary); }
.empty-title { font-weight: 700; font-size: 1.0625rem; }
.empty-text { color: var(--c-text-muted); margin: 0 0 var(--sp-2); max-width: 44ch; }

/* ---- Tables, cards, forms ---- */
.card-header h2, .card-header .h6 { font-size: 1rem; font-weight: 700; }
.table > tbody > tr:last-child > td { border-bottom: 0; }
.table-hover > tbody > tr { transition: background-color var(--dur-fast); }
.table a:not(.btn) { font-weight: 700; text-decoration: none; }
.table a:not(.btn):hover { text-decoration: underline; }
.form-label { font-weight: 700; font-size: .9375rem; }
.form-text { font-size: .875rem; }
.form-control::placeholder { color: #6b7a93; }
.form-control.is-invalid, .form-select.is-invalid { background-image: none; padding-right: .75rem; }
.alert { display: flex; gap: .6rem; align-items: flex-start; }
.btn-light { color: var(--c-primary-700); font-weight: 700; }

/* ---- Auth: split layout ---- */
.auth-split { min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1fr); }
.auth-aside { display: none; }
.auth-main { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: var(--sp-6) var(--sp-4); background: var(--c-bg); }
.auth-main .auth-card { box-shadow: var(--shadow-lg); }
.auth-logo { display: flex; align-items: center; justify-content: center; gap: var(--sp-3); margin-bottom: var(--sp-6); font-size: 1.125rem; }
.auth-card h2 { font-weight: 700; letter-spacing: -.01em; }
@media (min-width: 992px) {
  .auth-split { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); }
  .auth-aside { display: flex; align-items: center; padding: var(--sp-12); color: #fff; background: radial-gradient(40rem 24rem at 0% 0%, rgba(245, 130, 32, .45), transparent 60%), linear-gradient(160deg, #164E8A 0%, #0B2A5B 100%); }
  .auth-aside-inner { max-width: 440px; }
  .auth-hero { font-size: clamp(1.5rem, 1rem + 1.4vw, 2.1rem); font-weight: 700; line-height: 1.2; margin: var(--sp-6) 0; letter-spacing: -.02em; }
  .auth-points { list-style: none; padding: 0; margin: 0 0 var(--sp-8); display: flex; flex-direction: column; gap: var(--sp-3); }
  .auth-points li { display: flex; gap: var(--sp-3); align-items: center; color: rgba(255, 255, 255, .92); }
  .auth-points i { width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; border-radius: 10px; background: rgba(255, 255, 255, .14); flex: 0 0 36px; }
  .auth-aside-foot { color: rgba(255, 255, 255, .72); font-size: .875rem; margin: 0; }
  .auth-logo { display: none; }
}

@media (max-width: 575.98px) {
  .page-actions { width: 100%; } .page-actions .btn { flex: 1 1 auto; }
  .sched-time { flex-basis: 64px; }
  .schedule li { flex-wrap: wrap; }
}

/* ---------- Sub navigation (tabs as links) and auto-reply console ---------- */
.subtabs { display: flex; gap: var(--sp-1); overflow-x: auto; border-bottom: 1px solid var(--c-border); margin-bottom: var(--sp-6); scrollbar-width: thin; }
.subtabs a { padding: .7rem 1rem; min-height: 44px; display: inline-flex; align-items: center; white-space: nowrap; color: var(--c-text-muted); text-decoration: none; font-weight: 700; border-bottom: 3px solid transparent; margin-bottom: -1px; }
.subtabs a:hover { color: var(--c-text); }
.subtabs a.active { color: var(--c-primary); border-bottom-color: var(--c-primary); }
.console-reply { background: #d9f2ef; border-radius: 14px; border-top-right-radius: 4px; padding: .6rem .8rem; white-space: pre-wrap; overflow-wrap: anywhere; margin-bottom: var(--sp-2); }
.console-facts { display: grid; grid-template-columns: max-content 1fr; gap: .25rem var(--sp-4); font-size: .9375rem; margin: 0; }
.console-facts dt { font-weight: 700; color: var(--c-text); } .console-facts dd { margin: 0; overflow-wrap: anywhere; }


/* ---------- Bell, notifications, automation rules ---------- */
.icon-btn { position: relative; width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; color: var(--c-text-muted); text-decoration: none; transition: background-color var(--dur-fast), color var(--dur-fast); }
.icon-btn:hover, .icon-btn.active { background: var(--c-surface-2); color: var(--c-primary); }
.icon-badge { position: absolute; top: 4px; right: 2px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--c-danger); color: #fff; font-size: .6875rem; font-weight: 700; line-height: 18px; text-align: center; box-shadow: 0 0 0 2px #fff; }
.notif-list { list-style: none; margin: 0; padding: 0; }
.notif-list li + li { border-top: 1px solid #eaf0f7; }
.notif-list a { display: flex; gap: var(--sp-3); align-items: flex-start; padding: var(--sp-3) var(--sp-4); color: var(--c-text); text-decoration: none; min-height: 56px; transition: background-color var(--dur-fast); }
.notif-list a:hover { background: var(--c-primary-50); }
.notif-list li.unread a { background: #f4f8fd; }
.notif-list li.unread .notif-title::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--c-primary); margin-right: .5rem; vertical-align: middle; }
.notif-icon, .rule-icon { width: 36px; height: 36px; flex: 0 0 36px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; background: var(--c-primary-50); color: var(--c-primary); }
.notif-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.notif-title { font-weight: 700; overflow-wrap: anywhere; }
.notif-text { font-size: .9375rem; color: var(--c-text-muted); }
.notif-time { font-size: .8125rem; color: var(--c-text-muted); white-space: nowrap; }
.rule-list { list-style: none; margin: 0; padding: 0; }
.rule { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-3) var(--sp-4); flex-wrap: wrap; }
.rule + .rule { border-top: 1px solid #eaf0f7; }
.rule-main { flex: 1 1 240px; min-width: 0; }
.rule-name { font-weight: 700; text-decoration: none; }
.rule-name:hover { text-decoration: underline; }
.rule-meta { font-size: .875rem; color: var(--c-text-muted); }
.step-num { display: inline-flex; width: 24px; height: 24px; border-radius: 50%; align-items: center; justify-content: center; background: var(--c-primary); color: #fff; font-size: .75rem; margin-right: .4rem; }
.sticky-side { position: sticky; top: 80px; }
fieldset legend.form-label { font-size: .9375rem; font-weight: 700; float: none; margin-bottom: var(--sp-2); }
@media (max-width: 1199.98px) { .sticky-side { position: static; } }
@media (max-width: 575.98px) { .notif-list a { flex-wrap: wrap; } .notif-time { width: 100%; padding-left: 48px; } }


/* ---------- Marketing: connection, funnel, chart, growth score ---------- */
.connect-card { border-style: dashed; }
.connect-icon { width: 56px; height: 56px; border-radius: 16px; display: inline-flex; align-items: center; justify-content: center; font-size: 1.6rem; background: var(--c-info-bg); color: var(--c-primary); }
.conn-bar { display: flex; flex-wrap: wrap; gap: var(--sp-3) var(--sp-4); align-items: center; padding: var(--sp-3) var(--sp-4); background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); }
.funnel { list-style: none; margin: 0 0 var(--sp-3); padding: 0; display: flex; flex-direction: column; gap: var(--sp-4); }
.funnel-row { display: flex; justify-content: space-between; align-items: baseline; gap: var(--sp-2); }
.funnel-row strong { font-size: 1.25rem; }
.funnel-bar, .part-bar { height: 10px; border-radius: 999px; background: var(--c-surface-2); overflow: hidden; margin: 6px 0 2px; }
.funnel-bar span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--c-primary), var(--c-teal)); }
.chart { margin: 0; }
.chart-title { font-weight: 700; margin-bottom: var(--sp-2); display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--sp-2); }
.chart-sum { font-weight: 400; color: var(--c-text-muted); font-size: .875rem; }
.chart svg { width: 100%; height: auto; display: block; }
.chart-grid { stroke: #e3eaf3; stroke-width: 1; }
.chart-axis { fill: #51617d; font-size: 12px; }
.chart-val { fill: var(--c-text); font-size: 12px; font-weight: 700; }
.chart-bar { fill: var(--c-primary); transition: fill var(--dur-fast); }
.chart g:hover .chart-bar { fill: var(--c-teal-700); }
.score-ring { width: 160px; height: 160px; }
.ring-bg { fill: none; stroke: var(--c-surface-2); stroke-width: 12; }
.ring-fg { fill: none; stroke: var(--c-primary); stroke-width: 12; stroke-linecap: round; transition: stroke-dashoffset var(--dur-slow) var(--ease-out); }
.score-good .ring-fg { stroke: var(--c-success-700); } .score-fair .ring-fg { stroke: #b7791f; } .score-low .ring-fg { stroke: var(--c-danger); }
.ring-num { font-size: 30px; font-weight: 700; fill: var(--c-text); }
.parts { list-style: none; margin: 0; padding: 0; }
.parts li { padding: var(--sp-4); }
.parts li + li { border-top: 1px solid #eaf0f7; }
.part-head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--sp-2); }
.part-val { font-size: 1.25rem; font-weight: 700; }
.part-bar span { display: block; height: 100%; border-radius: 999px; background: #9aa9be; }
.part-bar span.good { background: var(--c-success-700); } .part-bar span.fair { background: #b7791f; } .part-bar span.low { background: var(--c-danger); }


/* ---------- QR codes ---------- */
.qr-types { display: grid; gap: var(--sp-2); }
.qr-type { display: flex; gap: var(--sp-3); align-items: center; padding: var(--sp-3); border: 1px solid var(--c-border); border-radius: var(--r-md); cursor: pointer; transition: border-color var(--dur-fast), background-color var(--dur-fast); }
.qr-type:hover { border-color: #9aa9be; }
.qr-type:has(input:checked) { border-color: var(--c-primary); background: var(--c-primary-50); box-shadow: inset 0 0 0 1px var(--c-primary); }
.qr-type:has(input:focus-visible) { box-shadow: var(--ring); }
.qr-type input { width: 1.1rem; height: 1.1rem; flex: 0 0 auto; accent-color: var(--c-primary); }
.qr-type.is-disabled { opacity: .6; cursor: not-allowed; }
.qr-type-icon { width: 36px; height: 36px; flex: 0 0 36px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; background: var(--c-surface-2); color: var(--c-primary); }
.qr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: var(--sp-3); }
.qr-card { display: flex; flex-direction: column; background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r-lg); padding: var(--sp-3); text-decoration: none; color: var(--c-text); box-shadow: var(--shadow-sm); transition: transform var(--dur-base) var(--ease-out), box-shadow var(--dur-base); }
.qr-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); color: var(--c-text); }
.qr-card img { width: 100%; height: auto; border-radius: var(--r-sm); background: #fff; }
.qr-card-body { display: flex; flex-direction: column; gap: 2px; padding-top: var(--sp-2); }
.qr-preview { width: 100%; max-width: 360px; height: auto; border-radius: var(--r-md); border: 1px solid var(--c-border); }
.dl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: var(--sp-2); }
.dl-btn { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-3); min-height: 56px; border: 1px solid var(--c-border); border-radius: var(--r-md); text-decoration: none; color: var(--c-text); transition: border-color var(--dur-fast), background-color var(--dur-fast); }
.dl-btn:hover { border-color: var(--c-primary); background: var(--c-primary-50); color: var(--c-text); }
.dl-btn i { font-size: 1.35rem; color: var(--c-primary); }
.dl-btn span { display: flex; flex-direction: column; font-weight: 700; line-height: 1.2; }
.dl-btn small { font-weight: 400; color: var(--c-text-muted); }

/* ---------- Public clinic page ---------- */
.pub { min-height: 100dvh; display: flex; flex-direction: column; background: var(--c-bg); }
.pub-wrap { width: 100%; max-width: 560px; margin: 0 auto; padding: 0 var(--sp-4); }
.pub-hero { background: radial-gradient(30rem 16rem at 100% 0%, rgba(245, 130, 32, .45), transparent 60%), linear-gradient(160deg, #164E8A, #0B2A5B); color: #fff; padding: var(--sp-8) 0 var(--sp-12); }
.pub-hero-sm { padding: var(--sp-6) 0 var(--sp-8); }
.pub-name { font-size: clamp(1.5rem, 1.2rem + 1.5vw, 2rem); font-weight: 700; margin: var(--sp-3) 0 var(--sp-1); letter-spacing: -.02em; }
.pub-headline { opacity: .92; margin: 0 0 var(--sp-3); }
.pub-open { display: inline-flex; align-items: center; gap: .4rem; padding: .3rem .75rem; border-radius: 999px; background: rgba(255, 255, 255, .16); font-weight: 700; font-size: .875rem; }
.pub-open.is-open { background: #e5f6ec; color: #14532d; }
.pub-back { color: #fff; text-decoration: none; font-weight: 700; display: inline-flex; gap: .4rem; align-items: center; min-height: 44px; }
.pub-back:hover { color: #fff; text-decoration: underline; }
.pub-body { margin-top: calc(-1 * var(--sp-8)); padding-bottom: var(--sp-8); flex: 1; }
.pub-actions { display: grid; gap: var(--sp-2); margin-bottom: var(--sp-4); }
.pub-btn { display: flex; align-items: center; gap: var(--sp-3); min-height: 56px; padding: var(--sp-3) var(--sp-4); background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); text-decoration: none; color: var(--c-text); font-weight: 700; transition: transform var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast); }
.pub-btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); color: var(--c-text); }
.pub-btn i { font-size: 1.25rem; width: 1.5rem; text-align: center; color: var(--c-primary); }
.pub-btn-wa { background: #128C4B; border-color: #128C4B; color: #fff; }
.pub-btn-wa i, .pub-btn-wa:hover { color: #fff; }
.pub-card { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r-lg); padding: var(--sp-4); margin-bottom: var(--sp-3); box-shadow: var(--shadow-sm); }
.pub-card h2 { font-size: 1rem; font-weight: 700; margin-bottom: var(--sp-2); display: flex; gap: .5rem; align-items: center; }
.pub-card h2 i { color: var(--c-teal-700); }
.pub-pre { white-space: pre-line; }
.pub-docs { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--sp-3); }
.pub-docs li { display: flex; gap: var(--sp-3); align-items: center; }
.pub-note { font-size: .875rem; color: var(--c-text-muted); text-align: center; margin-top: var(--sp-4); }
.pub-foot { text-align: center; font-size: .8125rem; color: #fff; background: var(--c-primary); padding: var(--sp-3); }


/* ---------- Plans ---------- */
.plan-card.is-current { border-color: var(--c-primary); box-shadow: 0 0 0 1px var(--c-primary), var(--shadow-sm); }
.plan-price { font-size: 1.75rem; font-weight: 700; color: var(--c-primary); letter-spacing: -.02em; }
.plan-price span { font-size: 1rem; color: var(--c-text-muted); font-weight: 400; }
.plan-feats { list-style: none; padding: 0; margin: 0 0 var(--sp-4); display: grid; gap: var(--sp-1); }
.plan-feats i { color: var(--c-success-700); margin-right: .35rem; }


/* ---------- Chart.js charts ---------- */
.chart-canvas { position: relative; height: 260px; }
.chart-wrap.is-enhanced .chart-fallback svg, .chart-wrap.is-enhanced .chart-fallback figcaption { display: none; }
.chart-wrap > .chart-title { margin-bottom: var(--sp-3); }
@media (max-width: 575.98px) { .chart-canvas { height: 220px; } }
@media print { .chart-wrap.is-enhanced .chart-fallback svg { display: block; } .chart-canvas { display: none; } }

/* ---------- Role dashboards ---------- */
.next-card { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-4); padding: var(--sp-4) var(--sp-6); border-radius: var(--r-lg); color: #fff; background: linear-gradient(120deg, var(--c-navy) 0%, var(--c-primary) 60%, #1E5BB8 100%); box-shadow: var(--shadow-md); }
.next-card .chip { background: rgba(255, 255, 255, .92); }
.next-name { font-size: 1.35rem; font-weight: 700; letter-spacing: -.01em; }
.btn-outline-light { --bs-btn-color: #fff; --bs-btn-border-color: rgba(255, 255, 255, .7); --bs-btn-hover-bg: rgba(255, 255, 255, .15); --bs-btn-hover-color: #fff; --bs-btn-hover-border-color: #fff; }
.queue { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--sp-3); }
.queue-col { background: var(--c-surface-2); border: 1px solid var(--c-border); border-radius: var(--r-lg); padding: var(--sp-2); min-height: 120px; }
.queue-head { font-weight: 700; padding: var(--sp-2); display: flex; align-items: center; gap: .5rem; }
.queue-head .count-pill { margin-left: auto; }
.queue-item { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r-md); padding: var(--sp-3); margin-bottom: var(--sp-2); box-shadow: var(--shadow-sm); }
.queue-item a { text-decoration: none; overflow-wrap: anywhere; }
@media (max-width: 1199.98px) { .queue { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 575.98px) { .queue { grid-template-columns: minmax(0, 1fr); } }


/* ---------- Calendar ---------- */
.cal-toolbar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-3); }
.cal-nav, .cal-controls { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); }
.cal-icon { width: 44px; padding: 0; }
.cal-range { font-size: 1.25rem; font-weight: 700; margin: 0 0 0 var(--sp-2); letter-spacing: -.01em; }
.cal-controls .form-select { min-width: 180px; }
.seg { display: inline-flex; padding: 3px; background: var(--c-surface-2); border: 1px solid var(--c-border); border-radius: var(--r-md); }
.seg a { min-height: 38px; display: inline-flex; align-items: center; padding: 0 var(--sp-4); border-radius: 8px; font-weight: 700; color: var(--c-text-muted); text-decoration: none; transition: background-color var(--dur-fast), color var(--dur-fast); }
.seg a:hover { color: var(--c-text); }
.seg a.active { background: var(--c-surface); color: var(--c-primary); box-shadow: var(--shadow-sm); }
.cal-summary { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-4); padding: var(--sp-2) 0 var(--sp-4); font-size: .9375rem; color: var(--c-text-muted); }
.cal-summary strong { color: var(--c-text); }
.cal-summary span[class^="dot-"]::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: .4rem; vertical-align: middle; }
.dot-info::before { background: #2563eb; } .dot-warn::before { background: #d97706; } .dot-ok::before { background: var(--c-success-700); } .dot-bad::before { background: var(--c-danger); }
.cal-legend { display: flex; flex-wrap: wrap; gap: var(--sp-3); }

/* Doctor colours: dark enough for text on their tinted background. */
.c0 { --dc: #164E8A; --dbg: #eaf1f9; } .c1 { --dc: #0b7f7e; --dbg: #e3f6f5; } .c2 { --dc: #6d28d9; --dbg: #f1ebfd; }
.c3 { --dc: #b45309; --dbg: #fdf3e6; } .c4 { --dc: #be185d; --dbg: #fcebf3; } .c5 { --dc: #15803d; --dbg: #e8f6ed; }
.leg { display: inline-flex; align-items: center; gap: .4rem; font-size: .875rem; font-weight: 700; color: var(--c-text); }
.leg::before { content: ""; width: 10px; height: 10px; border-radius: 3px; background: var(--dc); }

/* Event card */
.cal-event { display: grid; grid-template-columns: auto 1fr; gap: 0 var(--sp-2); align-items: baseline; padding: 6px 8px 6px 10px; margin-bottom: 6px; border-radius: 8px;
  background: var(--dbg); border-left: 4px solid var(--dc); color: var(--c-text); text-decoration: none; font-size: .875rem; line-height: 1.3;
  transition: transform var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast); }
.cal-event:hover { color: var(--c-text); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.cal-event .cal-time { font-weight: 700; color: var(--dc); white-space: nowrap; }
.cal-event .cal-name { font-weight: 700; overflow-wrap: anywhere; }
.cal-event .cal-doc { grid-column: 2; color: var(--c-text-muted); font-size: .8125rem; }
.cal-event .cal-status { grid-column: 1 / -1; margin-top: 4px; }
.cal-event .chip { font-size: .75rem; padding: .15rem .5rem; }
.cal-event.st-pending_confirmation, .cal-event.st-new { background: repeating-linear-gradient(135deg, var(--dbg), var(--dbg) 8px, #fff 8px, #fff 12px); }
.cal-event.is-off { opacity: .6; background: var(--c-surface-2); border-left-color: #9aa9be; }
.cal-event.is-off .cal-name { text-decoration: line-through; }

/* Week: seven columns side by side */
.cal-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: var(--sp-2); align-items: stretch; }
.cal-col { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r-lg); display: flex; flex-direction: column; min-height: 320px; box-shadow: var(--shadow-sm); min-width: 0; }
.cal-col.is-past { background: #fafcfe; }
.cal-col.is-today { border-color: var(--c-primary); box-shadow: 0 0 0 1px var(--c-primary), var(--shadow-sm); }
.cal-col-head { display: flex; justify-content: space-between; align-items: center; padding: var(--sp-2) var(--sp-3); border-bottom: 1px solid #eaf0f7; }
.cal-col-date { display: flex; align-items: center; gap: .5rem; text-decoration: none; color: var(--c-text); min-height: 40px; }
.cal-dow { font-size: .8125rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--c-text-muted); }
.cal-num { font-size: 1.25rem; font-weight: 700; width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; }
.is-today .cal-num { background: var(--c-primary); color: #fff; }
.is-today .cal-dow { color: var(--c-primary); }
.cal-col-head .count-pill { margin: 0; }
.cal-col-body { padding: var(--sp-2); flex: 1; display: flex; flex-direction: column; }
.cal-col .cal-event { grid-template-columns: 1fr; }
.cal-col .cal-event .cal-doc { grid-column: 1; }
.cal-free { color: var(--c-text-muted); font-size: .875rem; text-align: center; margin: var(--sp-4) 0 var(--sp-2); }
.cal-book { margin-top: auto; display: flex; align-items: center; justify-content: center; gap: .4rem; min-height: 40px; border: 1px dashed #b9c5d6; border-radius: 8px; color: var(--c-text-muted); text-decoration: none; font-size: .875rem; font-weight: 700; opacity: 0; transition: opacity var(--dur-fast), border-color var(--dur-fast), color var(--dur-fast); }
.cal-col:hover .cal-book, .cal-book:focus-visible, .cal-col.is-empty .cal-book { opacity: 1; }
.cal-book:hover { border-color: var(--c-primary); color: var(--c-primary); }

/* Day: hours down the side, one column per doctor */
.cal-day { overflow: hidden; }
.cal-day-head, .cal-hour { display: grid; grid-template-columns: 72px repeat(var(--cols), minmax(0, 1fr)); }
.cal-day-head { border-bottom: 1px solid var(--c-border); background: var(--c-surface-2); }
.cal-day-col-head { padding: var(--sp-3); border-left: 1px solid var(--c-border); }
.cal-hour { border-bottom: 1px solid #eaf0f7; min-height: 64px; }
.cal-hour:last-child { border-bottom: 0; }
.cal-gutter { padding: var(--sp-2); font-size: .8125rem; font-weight: 700; color: var(--c-text-muted); text-align: right; }
.cal-slot { border-left: 1px solid #eaf0f7; padding: 6px; min-width: 0; }
.cal-add { display: flex; align-items: center; justify-content: center; height: 100%; min-height: 48px; color: #9aa9be; border-radius: 8px; opacity: 0; text-decoration: none; transition: opacity var(--dur-fast), background-color var(--dur-fast); }
.cal-slot:hover .cal-add, .cal-add:focus-visible { opacity: 1; background: var(--c-primary-50); color: var(--c-primary); }

/* Month */
.cal-month { overflow: hidden; }
.cal-month-head, .cal-month-row { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-month-head div { padding: var(--sp-2); text-align: center; font-size: .8125rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--c-text-muted); background: var(--c-surface-2); border-bottom: 1px solid var(--c-border); }
.cal-cell { min-height: 118px; padding: 6px; border-right: 1px solid #eaf0f7; border-bottom: 1px solid #eaf0f7; min-width: 0; }
.cal-month-row .cal-cell:last-child { border-right: 0; }
.cal-cell.is-out { background: #f8fafc; }
.cal-cell.is-out .cal-cell-num { color: #8592a8; }
.cal-cell-num { display: inline-flex; width: 30px; height: 30px; align-items: center; justify-content: center; border-radius: 50%; font-weight: 700; color: var(--c-text); text-decoration: none; margin-bottom: 4px; }
.cal-cell-num:hover { background: var(--c-primary-50); }
.cal-cell.is-today .cal-cell-num { background: var(--c-primary); color: #fff; }
.cal-cell .cal-event { padding: 2px 6px; margin-bottom: 3px; font-size: .78rem; border-left-width: 3px; white-space: nowrap; overflow: hidden; }
.cal-cell .cal-event .cal-name { overflow: hidden; text-overflow: ellipsis; overflow-wrap: normal; }
.cal-more { font-size: .78rem; font-weight: 700; text-decoration: none; padding-left: 4px; }
.cal-dots { display: none; }

@media (max-width: 1199.98px) {
  .cal-week { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 991.98px) {
  /* Phones and tablets: an agenda, one day after another; empty days shrink to one line. */
  .cal-week { grid-template-columns: minmax(0, 1fr); }
  .cal-col { min-height: 0; }
  .cal-col.is-empty .cal-col-body { flex-direction: row; justify-content: space-between; align-items: center; padding: 0 var(--sp-3) var(--sp-2); }
  .cal-col.is-empty .cal-free { margin: 0; }
  .cal-col.is-empty .cal-book { margin: 0; padding: 0 var(--sp-3); }
  .cal-book { opacity: 1; margin-top: var(--sp-1); }
  .cal-col .cal-event { grid-template-columns: auto 1fr; }
  .cal-col .cal-event .cal-doc { grid-column: 2; }
  .cal-range { font-size: 1.0625rem; margin-left: 0; width: 100%; order: 5; }
  .cal-controls { width: 100%; }
  .cal-controls .form-select { flex: 1; min-width: 0; }
  .cal-cell { min-height: 64px; padding: 4px; }
  .cal-cell .cal-event, .cal-cell .cal-more { display: none; }
  .cal-dots { display: flex; gap: 3px; flex-wrap: wrap; padding-left: 4px; }
  .cal-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--dc); }
  .cal-legend { width: 100%; }
}
@media (max-width: 575.98px) {
  .cal-day { overflow-x: auto; }
  .cal-day-head, .cal-hour { grid-template-columns: 52px repeat(var(--cols), minmax(150px, 1fr)); }
}

.cal-event .chip { white-space: normal; max-width: 100%; }

@media (max-width: 991.98px) {
  .cal-col.is-empty { flex-direction: row; align-items: center; }
  .cal-col.is-empty .cal-col-head { border-bottom: 0; flex: 0 0 auto; }
  .cal-col.is-empty .cal-col-body { flex: 1; padding: 0 var(--sp-3) 0 0; }
  .cal-col.is-empty.is-past .cal-book { display: none; }
  .cal-controls #calDoctor { flex: 1; min-width: 0; }
  .cal-nav { width: 100%; }
  .cal-summary { gap: var(--sp-1) var(--sp-3); font-size: .875rem; }
}


/* =====================================================================
   Motion layer
   Restrained, purposeful motion for a clinical tool: it shows where things came from and confirms actions.
   Only transform and opacity are animated. Everything is off under prefers-reduced-motion (see below).
   ===================================================================== */
:root {
  --dur-instant: 80ms;
  --dur-enter: 420ms;
  --ease-in: cubic-bezier(.32, 0, .67, 0);
  --ease-spring: cubic-bezier(.34, 1.4, .64, 1);
  --stagger: 50ms;
}

/* Page to page: a quick cross-fade where the browser supports View Transitions; the sidebar and top bar stay put. */
@view-transition { navigation: auto; }
::view-transition-old(root) { animation: 120ms var(--ease-in) both vtOut; }
::view-transition-new(root) { animation: 220ms var(--ease-out) both vtIn; }
.sidebar { view-transition-name: app-sidebar; }
.topbar { view-transition-name: app-topbar; }
@keyframes vtOut { to { opacity: 0; } }
@keyframes vtIn { from { opacity: 0; } }

/* The old whole-page fade is replaced by the staggered reveal below. */
.page-enter { animation: none; }

/* Staggered reveal: app.js marks the first blocks of each page with .reveal and an index (--i). */
.motion-ok .reveal { animation: rise var(--dur-enter) var(--ease-out) both; animation-delay: calc(var(--i, 0) * var(--stagger)); }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }

/* Bars grow from the left instead of appearing at full width. */
.motion-ok .setup-banner .progress-bar, .motion-ok .funnel-bar span, .motion-ok .part-bar span {
  transform-origin: left center; animation: growX 700ms var(--ease-out) both; animation-delay: 150ms;
}
@keyframes growX { from { transform: scaleX(0); } to { transform: scaleX(1); } }

/* KPI cards: the icon answers the pointer. */
.kpi-icon { transition: transform var(--dur-base) var(--ease-spring); }
.kpi:hover .kpi-icon { transform: scale(1.08) rotate(-4deg); }
.kpi-value { font-variant-numeric: tabular-nums; }

/* Buttons: press feedback and a built-in busy spinner while a form submits. */
.btn:active:not(:disabled) { transform: scale(.97); transition-duration: var(--dur-instant); }
.btn[aria-busy="true"] { position: relative; color: transparent !important; pointer-events: none; }
.btn[aria-busy="true"] > * { visibility: hidden; }
.btn[aria-busy="true"]::after { content: ""; position: absolute; left: 50%; top: 50%; width: 1.1em; height: 1.1em; margin: -.55em 0 0 -.55em;
  border: 2px solid currentColor; border-color: var(--spin, #fff) transparent var(--spin, #fff) var(--spin, #fff); border-radius: 50%; animation: spin .7s linear infinite; }
.btn-outline-primary[aria-busy="true"], .btn-outline-secondary[aria-busy="true"], .btn-light[aria-busy="true"], .btn-link[aria-busy="true"] { --spin: var(--c-primary); }
@keyframes spin { to { transform: rotate(360deg); } }

/* Sidebar: the active marker slides in; links nudge on hover. */
.motion-ok .sidebar .nav-link.active::before { animation: markIn var(--dur-slow) var(--ease-spring) both; }
@keyframes markIn { from { transform: scaleY(0); } to { transform: scaleY(1); } }
.sidebar .nav-link i { transition: transform var(--dur-fast) var(--ease-out); }
.sidebar .nav-link:hover i { transform: translateX(2px); }

/* Notification and inbox badges pop in once. */
.motion-ok .icon-badge, .motion-ok .nav-badge { animation: pop 500ms var(--ease-spring) both; animation-delay: 300ms; }
@keyframes pop { from { transform: scale(0); } to { transform: scale(1); } }
.icon-btn:hover .fa-bell { animation: ring 600ms var(--ease-out); transform-origin: 50% 10%; }
@keyframes ring { 0%, 100% { transform: rotate(0); } 20% { transform: rotate(14deg); } 40% { transform: rotate(-12deg); } 60% { transform: rotate(8deg); } 80% { transform: rotate(-4deg); } }

/* Alerts slide in from above; success messages leave the same way after a few seconds. */
.motion-ok .content > .alert, .motion-ok .content .alert[role="alert"] { animation: drop 320ms var(--ease-out) both; }
@keyframes drop { from { opacity: 0; transform: translateY(-8px); } }
.alert.is-leaving { opacity: 0; transform: translateY(-6px); transition: opacity 260ms var(--ease-in), transform 260ms var(--ease-in); }

/* Dropdown menu scales out from its button. */
.dropdown-menu.show { animation: menuIn 160ms var(--ease-out) both; transform-origin: top right; }
@keyframes menuIn { from { opacity: 0; transform: scale(.96) translateY(-4px); } to { opacity: 1; transform: none; } }

/* Lists and tables: rows slide in when a page opens (first rows only, set by app.js). */
.motion-ok tr.reveal, .motion-ok li.reveal { animation-duration: 320ms; }

/* Chat: new messages pop in at their side. */
.bubble.is-new.in { animation: bubbleIn 280ms var(--ease-out) both; transform-origin: left bottom; }
.bubble.is-new.out { animation: bubbleIn 280ms var(--ease-out) both; transform-origin: right bottom; }
@keyframes bubbleIn { from { opacity: 0; transform: scale(.92) translateY(6px); } }

/* Calendar: appointments arrive one after another within each day. */
.motion-ok .cal-col-body .cal-event, .motion-ok .cal-slot .cal-event { animation: rise 340ms var(--ease-out) both; animation-delay: calc(120ms + var(--j, 0) * 40ms); }

/* Growth score ring draws itself (JS sets the start offset). */
.ring-fg { transition: stroke-dashoffset 1100ms var(--ease-out); }

/* Public clinic page: a slow, subtle movement in the header colour. */
.motion-ok .pub-hero { background-size: 140% 140%; animation: drift 18s ease-in-out infinite alternate; }
@keyframes drift { from { background-position: 0% 0%; } to { background-position: 100% 100%; } }
.pub-btn i { transition: transform var(--dur-base) var(--ease-spring); }
.pub-btn:hover i { transform: scale(1.12); }

/* Empty states breathe in rather than snap. */
.motion-ok .empty-icon { animation: pop 520ms var(--ease-spring) both; animation-delay: 120ms; }

@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(root), ::view-transition-new(root) { animation: none; }
  .motion-ok .reveal, .motion-ok .pub-hero, .bubble.is-new { animation: none !important; }
  .kpi:hover .kpi-icon, .sidebar .nav-link:hover i, .pub-btn:hover i { transform: none; }
  .btn[aria-busy="true"]::after { animation-duration: 1.6s !important; animation-iteration-count: infinite !important; }
}
@media print { .reveal { animation: none !important; opacity: 1 !important; transform: none !important; } }

.motion-done .reveal, .motion-done .cal-event, .motion-done .empty-icon, .motion-done .setup-banner .progress-bar, .motion-done .funnel-bar span, .motion-done .part-bar span { animation: none !important; }


/* ---------- Add-ons ---------- */
.addon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--sp-3); }
.addon { display: flex; flex-direction: column; background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r-lg); padding: var(--sp-4); box-shadow: var(--shadow-sm); scroll-margin-top: 90px; transition: box-shadow var(--dur-base), border-color var(--dur-base); }
.addon:hover { box-shadow: var(--shadow-md); }
.addon:target { border-color: var(--c-primary); box-shadow: 0 0 0 2px var(--c-primary), var(--shadow-md); }
.addon.is-on { background: linear-gradient(180deg, #f3faf6, var(--c-surface) 70%); border-color: #b9e2c9; }
.addon-head { display: flex; gap: var(--sp-3); align-items: flex-start; margin-bottom: var(--sp-2); }
.addon-icon { width: 44px; height: 44px; flex: 0 0 44px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; font-size: 1.15rem; background: var(--c-primary-50); color: var(--c-primary); }
.addon-icon.lg { width: 72px; height: 72px; font-size: 1.8rem; border-radius: 20px; }
.addon-name { font-size: 1.0625rem; font-weight: 700; margin: 0; }
.addon-price { font-weight: 700; color: var(--c-primary); }
.addon-price span { font-weight: 400; color: var(--c-text-muted); font-size: .875rem; }
.addon-desc { color: var(--c-text-muted); font-size: .9375rem; flex: 1; }
.addon-buy { margin-top: auto; }
.addon-order summary { list-style: none; }
.addon-order summary::-webkit-details-marker { display: none; }
.locked { max-width: 560px; margin: 8vh auto; text-align: center; }


/* ---------- Public online booking ---------- */
.pub-steps { list-style: none; display: flex; flex-wrap: wrap; gap: var(--sp-2); padding: 0; margin: var(--sp-2) 0 0; font-size: .8125rem; font-weight: 700; }
.pub-steps li { padding: .25rem .7rem; border-radius: 999px; background: rgba(255, 255, 255, .14); color: rgba(255, 255, 255, .9); }
.pub-steps li.now { background: #fff; color: var(--c-primary); }
.pub-steps li.done::before { content: "\2713\00a0"; }
.pub-pick { gap: var(--sp-2); }
.pub-choice { display: flex; align-items: center; gap: var(--sp-3); margin: 0; width: 100%; text-decoration: none; color: var(--c-text); min-height: 64px; transition: transform var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast); }
.pub-choice:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); color: var(--c-text); }
.pub-day { font-size: .9375rem; font-weight: 700; margin: var(--sp-3) 0 var(--sp-2); }
.pub-slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: var(--sp-2); }
.pub-slot { display: flex; align-items: center; justify-content: center; min-height: 44px; border: 1px solid var(--c-border); border-radius: var(--r-md); font-weight: 700; text-decoration: none; color: var(--c-primary); background: var(--c-surface); font-variant-numeric: tabular-nums; transition: background var(--dur-fast), border-color var(--dur-fast); }
.pub-slot:hover, .pub-slot:focus-visible { background: var(--c-primary-50); border-color: var(--c-primary); color: var(--c-primary); }
.pub-summary { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; background: var(--c-primary-50); border-radius: var(--r-md); padding: var(--sp-3); }
.pub-hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.pub-btn-primary { background: var(--c-primary); border-color: var(--c-primary); color: #fff; }
.pub-btn-primary i, .pub-btn-primary:hover { color: #fff; }


/* ---------- Self check-in kiosk (tablet, large touch targets) ---------- */
.kiosk { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; background: radial-gradient(40rem 22rem at 100% 0%, rgba(245, 130, 32, .25), transparent 60%), var(--c-bg); padding: var(--sp-4); }
.kiosk-head { width: 100%; max-width: 720px; display: flex; gap: var(--sp-3); align-items: center; padding: var(--sp-3) 0 var(--sp-4); font-size: 1.125rem; }
.kiosk-card { width: 100%; max-width: 720px; background: var(--c-surface); border: 1px solid var(--c-border); border-radius: 24px; box-shadow: var(--shadow-md); padding: clamp(1.5rem, 4vw, 3rem); }
.kiosk-title { font-size: clamp(1.5rem, 1.2rem + 1.4vw, 2.25rem); font-weight: 700; letter-spacing: -.02em; margin-bottom: var(--sp-4); }
.kiosk-label { font-size: 1.125rem; font-weight: 700; }
.kiosk-input { font-size: 2rem; letter-spacing: .08em; min-height: 72px; text-align: center; font-variant-numeric: tabular-nums; margin-bottom: var(--sp-4); }
.kiosk-btn { width: 100%; min-height: 64px; font-size: 1.25rem; font-weight: 700; display: flex; align-items: center; justify-content: center; gap: .5rem; }
.kiosk-note { color: var(--c-text-muted); text-align: center; margin: var(--sp-4) 0 0; }
.kiosk-visits { list-style: none; padding: 0; margin: 0 0 var(--sp-4); display: grid; gap: var(--sp-3); }
.kiosk-visit { width: 100%; display: flex; align-items: center; gap: var(--sp-3); justify-content: space-between; text-align: left; min-height: 88px; padding: var(--sp-4); background: var(--c-surface); border: 2px solid var(--c-border); border-radius: 18px; font-size: 1.125rem; transition: border-color var(--dur-fast), transform var(--dur-fast) var(--ease-out); }
.kiosk-visit:hover, .kiosk-visit:focus-visible { border-color: var(--c-primary); transform: translateY(-1px); }
.kiosk-go { color: var(--c-primary); font-weight: 700; white-space: nowrap; }
.kiosk-done { text-align: center; }
.kiosk-ok { font-size: 3.5rem; color: var(--c-ok-text); margin-bottom: var(--sp-3); }
.kiosk-sub { font-size: 1.125rem; color: var(--c-text-muted); margin: 0; }
.kiosk-num { font-size: clamp(5rem, 4rem + 6vw, 9rem); font-weight: 800; line-height: 1; color: var(--c-primary); margin: var(--sp-3) 0 var(--sp-4); font-variant-numeric: tabular-nums; }
.kiosk-done .kiosk-btn { margin-top: var(--sp-6); }
.kiosk-foot { margin-top: auto; padding-top: var(--sp-6); font-size: .8125rem; color: var(--c-text-muted); }
.queue-no { display: inline-flex; align-items: center; justify-content: center; min-width: 2.25rem; height: 2.25rem; border-radius: 10px; background: var(--c-primary-50); color: var(--c-primary); font-weight: 800; font-variant-numeric: tabular-nums; }
.motion-ok .kiosk-num { animation: pop 420ms var(--ease-out) both; }

/* ---------- Prescription branding ---------- */
.rx-logo-prev { display: inline-flex; padding: var(--sp-2); border: 1px dashed var(--c-border); border-radius: var(--r-md); background: #fff; }
.rx-logo-prev img { max-height: 64px; max-width: 220px; }
.rx-sig-prev { display: block; max-height: 48px; max-width: 180px; margin-top: var(--sp-2); background: #fff; border: 1px dashed var(--c-border); border-radius: var(--r-sm); padding: 2px; }
.rx-swatches { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.rx-swatch { display: inline-flex; align-items: center; gap: .45rem; min-height: 44px; padding: .35rem .75rem; border: 1px solid var(--c-border); border-radius: 999px; cursor: pointer; font-size: .875rem; }
.rx-swatch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.rx-swatch span { width: 1.1rem; height: 1.1rem; border-radius: 50%; background: var(--sw); box-shadow: inset 0 0 0 1px rgba(0,0,0,.15); }
.rx-swatch:has(input:checked) { border-color: var(--c-primary); box-shadow: 0 0 0 2px var(--c-primary-50); font-weight: 700; }
.rx-swatch:has(input:focus-visible) { outline: 2px solid var(--c-primary); outline-offset: 2px; }

/* ---------- Campaigns ---------- */
.aud-count { font-weight: 700; color: var(--c-primary); background: var(--c-primary-50); border-radius: var(--r-md); padding: var(--sp-2) var(--sp-3); }
.camp-bar { height: 10px; border-radius: 999px; background: var(--c-surface-2, #eef2f7); overflow: hidden; }
.camp-bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--c-primary), var(--c-teal, #F58220)); border-radius: inherit; transform-origin: left; }
.motion-ok .camp-bar span { animation: growX 700ms var(--ease-out) both; }
.tpl-preview { white-space: pre-line; background: #e7f6ec; border-radius: 12px 12px 12px 4px; padding: var(--sp-3); font-size: .9375rem; }

/* ---------- Referrals ---------- */
.subtabs-sm { border-bottom: 0; margin-bottom: 0; }
.subtabs-sm a { min-height: 36px; padding: .35rem .7rem; font-size: .875rem; }
.ref-head { display: flex; flex-direction: column; gap: 2px; border-bottom: 2px solid var(--c-primary); padding-bottom: var(--sp-2); }
.ref-clinic { font-size: 1.125rem; color: var(--c-primary); }
.ref-details { white-space: normal; font-weight: 600; }
.partner-edit summary { list-style: none; }
.partner-edit summary::-webkit-details-marker { display: none; }
.partner-edit[open] { flex-basis: 100%; }
@media print { .no-print, .flash-stack, .alert { display: none !important; } .ref-slip { border: 0; box-shadow: none; } .col-xl-7 { width: 100% !important; } }
.tabular { font-variant-numeric: tabular-nums; }
.import-review { background: var(--c-primary-50); border-radius: var(--r-md); padding: var(--sp-4); }

/* Tanavya product logo */
.brand-logo { width: 56px; height: 56px; border-radius: 14px; display: inline-flex; align-items: center; justify-content: center; background: #fff; box-shadow: var(--shadow-md); flex: none; }
.brand-logo.sm { width: 36px; height: 36px; border-radius: 10px; box-shadow: 0 0 0 1px rgba(11,42,91,.08); }
.brand-text { display: inline-flex; flex-direction: column; line-height: 1.1; }
.brand-text small { font-size: .7rem; font-weight: 500; letter-spacing: .04em; opacity: .7; }

/* Links are never underlined (owner's choice). They stay recognisable by colour and weight, and keyboard focus still shows a ring. */
a, a:hover, a:focus, a:focus-visible, a:active { text-decoration: none !important; }

/* =====================================================================
   Theme 2 (matches the public website): Plus Jakarta Sans, logo blue for actions, navy ink for headings,
   soft tinted background, white surfaces with 20px radius and light layered shadows, a light sidebar with
   pill-shaped active items, and a floating top bar. Overrides the tokens above, so every screen follows it.
   ===================================================================== */
@font-face { font-family: "Plus Jakarta Sans"; font-style: normal; font-weight: 400; font-display: swap; src: url("../vendor/fonts/plus-jakarta-sans-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Plus Jakarta Sans"; font-style: normal; font-weight: 500; font-display: swap; src: url("../vendor/fonts/plus-jakarta-sans-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Plus Jakarta Sans"; font-style: normal; font-weight: 600; font-display: swap; src: url("../vendor/fonts/plus-jakarta-sans-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Plus Jakarta Sans"; font-style: normal; font-weight: 700; font-display: swap; src: url("../vendor/fonts/plus-jakarta-sans-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Plus Jakarta Sans"; font-style: normal; font-weight: 800; font-display: swap; src: url("../vendor/fonts/plus-jakarta-sans-latin-800-normal.woff2") format("woff2"); }

:root {
  --c-primary: #1A5BB5;          /* logo blue, 6.6:1 with white */
  --c-primary-600: #164E9C;
  --c-primary-700: #134A96;
  --c-primary-50: #EEF4FD;
  --c-primary-100: #DCE8FB;
  --c-ink: #0B1B3A;
  --c-text: #2B3650;             /* 11:1 on white */
  --c-text-muted: #5B6478;       /* 5.9:1 on white */
  --c-bg: #F6F8FB;
  --c-surface-2: #F1F4F9;
  --c-border: #E6E9F0;
  --c-border-strong: #D5DCE7;
  --r-sm: 8px; --r-md: 12px; --r-lg: 20px;
  --shadow-sm: 0 1px 2px rgba(11, 27, 58, .05), 0 2px 6px rgba(11, 27, 58, .04);
  --shadow-md: 0 1px 2px rgba(11, 27, 58, .05), 0 6px 16px rgba(11, 27, 58, .06), 0 16px 32px rgba(11, 27, 58, .05);
  --shadow-lg: 0 2px 4px rgba(11, 27, 58, .05), 0 12px 28px rgba(11, 27, 58, .08), 0 32px 64px rgba(11, 27, 58, .08);
  --ring: 0 0 0 2px #fff, 0 0 0 4px #1A5BB5;
  --bs-primary: #1A5BB5; --bs-primary-rgb: 26, 91, 181;
  --bs-link-color: #1A5BB5; --bs-link-color-rgb: 26, 91, 181; --bs-link-hover-color: #134A96; --bs-link-hover-color-rgb: 19, 74, 150;
  --bs-body-font-family: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Devanagari", sans-serif;
  --bs-body-color: var(--c-text); --bs-body-bg: var(--c-bg);
  --bs-border-color: var(--c-border);
  --bs-border-radius: 12px;
}
body { font-family: var(--bs-body-font-family); -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 { color: var(--c-ink); font-weight: 700; letter-spacing: -.015em; }
a { color: var(--c-primary); font-weight: 600; }
a:hover { color: var(--c-primary-700); }
strong, b { font-weight: 700; }

/* buttons */
.btn { --bs-btn-border-radius: 12px; --bs-btn-font-weight: 600; letter-spacing: -.005em; }
.btn-primary { box-shadow: 0 1px 0 rgba(255, 255, 255, .22) inset, 0 6px 14px rgba(26, 91, 181, .24); }
.btn-primary:hover:not(:disabled) { box-shadow: 0 1px 0 rgba(255, 255, 255, .22) inset, 0 10px 20px rgba(26, 91, 181, .3); }
.btn-outline-secondary { --bs-btn-color: var(--c-ink); --bs-btn-border-color: var(--c-border-strong); --bs-btn-bg: #fff; --bs-btn-hover-bg: var(--c-surface-2); --bs-btn-hover-color: var(--c-ink);
  --bs-btn-hover-border-color: #c3cddc; --bs-btn-active-bg: #E9EEF5; --bs-btn-active-color: var(--c-ink); --bs-btn-active-border-color: #c3cddc; box-shadow: var(--shadow-sm); }
.btn-outline-primary { --bs-btn-bg: #fff; }
.btn-light { --bs-btn-bg: #fff; --bs-btn-border-color: var(--c-border); color: var(--c-ink); box-shadow: var(--shadow-sm); }
.btn-light:hover { --bs-btn-hover-bg: var(--c-surface-2); color: var(--c-ink); }
.btn-teal { background: var(--c-ink); border-color: var(--c-ink); }
.btn-teal:hover:not(:disabled) { background: #1B2D52; border-color: #1B2D52; }

/* forms */
.form-control, .form-select { border-color: var(--c-border-strong); border-radius: 12px; background-color: #fff; }
.form-control:hover, .form-select:hover { border-color: #b8c3d4; }
.form-control:focus, .form-select:focus { border-color: var(--c-primary); box-shadow: 0 0 0 4px rgba(26, 91, 181, .14); }
.form-label { font-weight: 600; color: var(--c-ink); }
.form-check-input { border-color: #b8c3d4; }
.form-switch .form-check-input { width: 2.4em; }

/* surfaces */
.card { border-color: var(--c-border); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); }
.card-header { background: #fff !important; border-bottom-color: var(--c-border); border-radius: var(--r-lg) var(--r-lg) 0 0 !important; padding: 1rem 1.5rem; }
.card-header h2, .card-header .h6 { color: var(--c-ink); font-weight: 700; }
.card-footer { background: #fff; border-top-color: var(--c-border); border-radius: 0 0 var(--r-lg) var(--r-lg) !important; }
a:hover > .card, .card.is-link:hover { border-color: #cfd9ea; box-shadow: var(--shadow-md); }
.alert { border-radius: 14px; }
.alert-info { background: var(--c-primary-50); border-color: var(--c-primary-100); color: #123F80; }
.list-group { --bs-list-group-border-color: var(--c-border); --bs-list-group-border-radius: 16px; }
.list-group-item.active { background: var(--c-primary-50); color: var(--c-ink); border-color: var(--c-border); }
.dropdown-menu { border-color: var(--c-border); border-radius: 14px; box-shadow: var(--shadow-lg); }
.dropdown-item { border-radius: 10px; font-weight: 500; }
.dropdown-item:hover, .dropdown-item:focus { background: var(--c-surface-2); color: var(--c-ink); }
.modal-content { border: 0; border-radius: var(--r-lg); box-shadow: var(--shadow-lg); }
.modal-header, .modal-footer { border-color: var(--c-border); }
.nav-tabs { --bs-nav-tabs-border-color: var(--c-border); --bs-nav-tabs-link-active-color: var(--c-primary); }
.nav-pills { --bs-nav-pills-border-radius: 10px; --bs-nav-pills-link-active-bg: var(--c-primary); }
.progress { background: #E9EEF5; border-radius: 999px; }
.progress-bar { background: var(--c-primary); border-radius: 999px; }
.badge-soft, .count-pill { background: var(--c-primary-50); color: var(--c-primary-700); border-color: var(--c-primary-100); }
code { color: var(--c-primary-700); background: var(--c-primary-50); }
.pagination { --bs-pagination-border-radius: 10px; --bs-pagination-border-color: var(--c-border); }

/* tables: quieter header, more air */
.table > thead > tr > th { background: var(--c-surface-2); color: var(--c-text-muted); font-size: .75rem; letter-spacing: .07em; border-bottom-color: var(--c-border); }
.table > tbody > tr > td { border-color: #EEF1F6; }
.table-hover > tbody > tr:hover > * { background: #F7FAFE; }
.table a:not(.btn):hover { text-decoration: none; }

/* page header */
.page-head { margin-bottom: 1.75rem; }
.page-title, .content h1.h4 { color: var(--c-ink); font-weight: 800; letter-spacing: -.03em; font-size: clamp(1.5rem, 1.2rem + 1.1vw, 2rem); }
.page-sub { color: var(--c-text-muted); }

/* KPI tiles */
.kpi { border-radius: var(--r-lg); border-color: var(--c-border); padding: 1.15rem 1.25rem; }
.kpi:hover { border-color: #cfd9ea; box-shadow: var(--shadow-md); }
.kpi-icon { width: 44px; height: 44px; border-radius: 12px; font-size: 1.05rem; }
.kpi-value { color: var(--c-ink); font-weight: 800; letter-spacing: -.03em; }
.kpi-blue .kpi-icon { background: var(--c-primary-50); color: var(--c-primary); }
.kpi-teal .kpi-icon { background: #FFF4EA; color: #B45309; }
.stat-card .stat-value { color: var(--c-ink); font-weight: 800; }

/* chips: softer, borderless */
.chip { border-color: transparent; font-weight: 600; }
.chip-info { background: var(--c-primary-50); color: #123F80; }

/* empty states */
.empty-icon { width: 64px; height: 64px; border-radius: 18px; background: var(--c-primary-50); color: var(--c-primary); }
.empty-title { color: var(--c-ink); }

/* sub navigation: segmented pills */
.subtabs { gap: 4px; padding: 4px; background: #fff; border: 1px solid var(--c-border); border-radius: 14px; width: fit-content; max-width: 100%; box-shadow: var(--shadow-sm); }
.subtabs a { min-height: 40px; padding: .45rem 1rem; border-radius: 10px; border-bottom: 0; margin-bottom: 0; font-weight: 600; color: var(--c-text-muted); }
.subtabs a:hover { background: var(--c-surface-2); color: var(--c-ink); }
.subtabs a.active { background: var(--c-primary-50); color: var(--c-primary); }

/* setup banner: light sky card instead of a dark slab */
.setup-banner { color: var(--c-ink); border: 1px solid #D6E5FB; box-shadow: var(--shadow-sm);
  background: radial-gradient(30rem 10rem at 90% 0%, rgba(245, 130, 32, .12), transparent 70%), linear-gradient(120deg, #DCEBFF 0%, #EEF5FF 60%, #FFFFFF 100%); }
.setup-banner .progress { background: rgba(26, 91, 181, .14); }
.setup-banner .progress-bar { background: var(--c-primary); }
.setup-banner .btn-light { --bs-btn-bg: var(--c-ink); --bs-btn-border-color: var(--c-ink); --bs-btn-color: #fff; --bs-btn-hover-bg: #1B2D52; --bs-btn-hover-color: #fff; color: #fff; }

/* ---- App shell: light sidebar ---- */
.app-shell { background: var(--c-bg); }
.sidebar { background: #fff; color: var(--c-text); border-right: 1px solid var(--c-border); padding: 1rem .85rem; width: 264px; flex-basis: 264px; }
.sidebar-brand { color: var(--c-ink); border-bottom: 0; padding: .25rem .5rem 1rem; }
.sidebar-brand .brand-text small { color: var(--c-text-muted); opacity: 1; }
.sidebar .brand-logo.sm { box-shadow: 0 0 0 1px var(--c-border); }
.nav-group-label { color: #6B7488; font-size: .68rem; letter-spacing: .1em; padding: 0 .75rem .35rem; }
.sidebar .nav-link { color: var(--c-text); font-weight: 500; font-size: .94rem; border-radius: 12px; padding: .6rem .75rem; }
.sidebar .nav-link i { color: #8A93A6; opacity: 1; }
.sidebar .nav-link:hover { background: var(--c-surface-2); color: var(--c-ink); }
.sidebar .nav-link:hover i { color: var(--c-ink); }
.sidebar .nav-link.active { background: var(--c-primary-50); color: var(--c-primary); font-weight: 700; box-shadow: none; }
.sidebar .nav-link.active i { color: var(--c-primary); }
.sidebar .nav-link.active::before { left: -14px; background: var(--c-primary); }
.sidebar .nav-link:focus-visible { box-shadow: var(--ring) !important; }
.nav-badge { background: #F58220; color: #2B1600; }
.sidebar-foot { color: var(--c-text-muted); border-top: 1px solid var(--c-border); }

/* ---- Floating top bar ---- */
.topbar { margin: 12px 24px 0; border: 1px solid var(--c-border); border-radius: 18px; background: rgba(255, 255, 255, .88); box-shadow: var(--shadow-sm); top: 12px; padding: .4rem .6rem .4rem 1.1rem; }
.crumbs li[aria-current] { color: var(--c-ink); }
.icon-btn { border-radius: 12px; }
.icon-btn:hover { background: var(--c-surface-2); color: var(--c-ink); }
.user-btn { border-radius: 12px; }
.avatar { background: linear-gradient(135deg, #1A5BB5, #0B1B3A); border-radius: 10px; }
.content { padding: 1.75rem 24px 3rem; max-width: 1320px; }
@media (max-width: 991.98px) {
  .sidebar { box-shadow: var(--shadow-lg); }
  .topbar { margin: 8px 12px 0; top: 8px; }
  .content { padding: 1.25rem 12px calc(84px + env(safe-area-inset-bottom)); }
  .bottom-nav { left: 10px; right: 10px; bottom: calc(8px + env(safe-area-inset-bottom)); border: 1px solid var(--c-border); border-radius: 18px; padding: 6px 4px; box-shadow: var(--shadow-md); }
  .bottom-nav .active { color: var(--c-primary); }
  .bottom-nav .active i { color: var(--c-primary); }
}

/* ---- Inbox ---- */
.thread { background: #EEF2F7; }
.bubble { border-radius: 16px; }
.bubble.out { background: #DCF8C6; }
.conv-list .list-group-item.active { border-left-color: var(--c-primary); }

/* ---- Sign in, sign up and password pages: sky panel like the website ---- */
.auth-main { background: var(--c-bg); }
.auth-card { border-radius: 24px; border-color: var(--c-border); box-shadow: var(--shadow-lg); padding: 2.25rem; }
.auth-card h2 { color: var(--c-ink); font-weight: 800; letter-spacing: -.03em; font-size: 1.6rem; }
@media (max-width: 991.98px) {
  .auth-main { background: radial-gradient(30rem 12rem at 20% 0%, rgba(255, 255, 255, .9), transparent 70%), linear-gradient(180deg, #D6E8FF 0%, #EEF5FF 40%, var(--c-bg) 100%); }
  .auth-card { padding: 1.5rem; }
}
@media (min-width: 992px) {
  .auth-aside { position: relative; color: var(--c-ink); overflow: hidden;
    background: radial-gradient(38rem 14rem at 18% 18%, rgba(255, 255, 255, .95), transparent 70%), radial-gradient(34rem 12rem at 82% 70%, rgba(255, 255, 255, .8), transparent 70%),
      radial-gradient(28rem 16rem at 95% 95%, rgba(245, 130, 32, .14), transparent 70%), linear-gradient(180deg, #C4DCFF 0%, #DDEBFF 45%, #F2F7FF 100%); }
  .auth-hero { color: var(--c-ink); font-weight: 800; letter-spacing: -.035em; font-size: clamp(1.9rem, 1.2rem + 1.8vw, 2.7rem); line-height: 1.08; }
  .auth-points li { color: var(--c-text); font-weight: 500; }
  .auth-points i { background: #fff; color: var(--c-primary); box-shadow: var(--shadow-sm); border-radius: 12px; }
  .auth-points li:nth-child(2) i { color: #128C7E; }
  .auth-points li:nth-child(3) i { color: #B45309; }
  .auth-aside-foot { color: var(--c-text-muted); }
  .auth-aside .brand-logo { box-shadow: var(--shadow-md); }
}
