/* =======================================================================
   portal.css — Modern Healthcare Design System & Public Patient Portal
   Website: https://healthcare.doel-systems.com/
   Designed for maximum accessibility, medical trustworthiness & responsive simplicity.
   ======================================================================= */

:root {
  /* --- Primary Healthcare Palette --- */
  --health-primary:        #087F8C; /* Healthcare Teal */
  --health-primary-hover:  #066772;
  --health-primary-light:  #EAF7F5; /* Light Mint */
  --health-secondary:      #20A89E; /* Secondary Teal */
  --health-navy:           #123B5D; /* Deep Medical Blue */
  --health-navy-dark:      #0C273E;
  --health-navy-light:     #E8EFF5;
  
  /* --- Backgrounds & Surfaces --- */
  --health-bg:             #F7FAFC; /* Clean Light Ground */
  --health-surface:        #FFFFFF; /* Pure White */
  --health-surface-alt:    #F1F6F9;
  --health-surface-card:   #FFFFFF;
  --health-border:         #DCE5EC;
  --health-border-light:   #E9F0F5;
  --health-border-focus:   #087F8C;

  /* --- Text & Contrast Hierarchy --- */
  --health-text:           #203247; /* Primary High-Contrast Text */
  --health-text-muted:     #65758B; /* Secondary Body Text */
  --health-text-light:     #94A3B8;
  --health-text-inverse:   #FFFFFF;

  /* --- Functional Status Colors --- */
  --health-success:        #21865B;
  --health-success-bg:     #E8F5EE;
  --health-warning:        #D99022;
  --health-warning-bg:     #FEF6E9;
  --health-error:          #C74646;
  --health-error-bg:       #FDEAEA;
  --health-info:           #0284C7;
  --health-info-bg:        #E0F2FE;

  /* --- Backward Compatibility Tokens for App Components --- */
  --pharmacy:              var(--health-primary);
  --pharmacy-deep:         var(--health-navy);
  --ink:                   var(--health-text);
  --ink-muted:             var(--health-text-muted);
  --paper:                 var(--health-bg);
  --surface:               var(--health-surface);
  --surface-alt:           var(--health-surface-alt);
  --tint-green:            var(--health-primary-light);
  --amber:                 var(--health-warning);
  --alert:                 var(--health-error);
  --terracotta:            var(--health-navy);

  /* --- Elevation & Shadows --- */
  --health-shadow-xs:      0 1px 2px rgba(18, 59, 93, 0.05);
  --health-shadow-sm:      0 2px 5px rgba(18, 59, 93, 0.06), 0 1px 2px rgba(18, 59, 93, 0.04);
  --health-shadow-md:      0 6px 16px rgba(18, 59, 93, 0.08);
  --health-shadow-lg:      0 12px 32px rgba(18, 59, 93, 0.12);
  --health-shadow-card:    0 3px 10px rgba(18, 59, 93, 0.05);

  --glass-surface:         var(--health-surface);
  --glass-surface-soft:    var(--health-surface-alt);
  --glass-line:            var(--health-border);
  --glass-blur:            0px;
  --glass-shadow:          var(--health-shadow-sm);
  --glass-shadow-lift:     var(--health-shadow-md);

  /* --- Radii --- */
  --pub-radius-sm:         0.375rem;
  --pub-radius:            0.625rem;
  --pub-radius-lg:         1rem;
  --pub-radius-pill:       9999px;

  /* --- Typography Fallbacks --- */
  /* Hind Siliguri claims only Bangla characters (see fonts.css), so it goes
     first: Bangla text uses it, Latin text still uses Public Sans. */
  --font-display:          "Hind Siliguri", "Public Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-body:             "Hind Siliguri", "Public Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-bn:               "Hind Siliguri", "Noto Sans Bengali", sans-serif;
}

/* =======================================================================
   Dark Mode Support
   ======================================================================= */
@media (prefers-color-scheme: dark) {
  :root:not([data-bs-theme="light"]) {
    --health-bg:             #0B192C;
    --health-surface:        #15263C;
    --health-surface-alt:    #1E324D;
    --health-surface-card:   #15263C;
    --health-border:         #273E5B;
    --health-border-light:   #1E324D;
    --health-text:           #F1F5F9;
    --health-text-muted:     #94A3B8;
    --health-text-light:     #64748B;
    
    --health-primary-light:  rgba(8, 127, 140, 0.22);
    --health-navy:           #38BDF8;
    --health-navy-light:     rgba(56, 189, 248, 0.15);

    --glass-surface:         var(--health-surface);
    --glass-surface-soft:    var(--health-surface-alt);
    --glass-line:            var(--health-border);
    --glass-shadow:          0 4px 12px rgba(0, 0, 0, 0.4);
    --glass-shadow-lift:     0 8px 24px rgba(0, 0, 0, 0.6);
  }
}

:root[data-bs-theme="dark"] {
  --health-bg:             #0B192C;
  --health-surface:        #15263C;
  --health-surface-alt:    #1E324D;
  --health-surface-card:   #15263C;
  --health-border:         #273E5B;
  --health-border-light:   #1E324D;
  --health-text:           #F1F5F9;
  --health-text-muted:     #94A3B8;
  --health-text-light:     #64748B;
  
  --health-primary-light:  rgba(8, 127, 140, 0.22);
  --health-navy:           #38BDF8;
  --health-navy-light:     rgba(56, 189, 248, 0.15);

  --glass-surface:         var(--health-surface);
  --glass-surface-soft:    var(--health-surface-alt);
  --glass-line:            var(--health-border);
  --glass-shadow:          0 4px 12px rgba(0, 0, 0, 0.4);
  --glass-shadow-lift:     0 8px 24px rgba(0, 0, 0, 0.6);
}

/* =======================================================================
   Base Page Structure & Typography
   ======================================================================= */
body.pub-page {
  margin: 0;
  padding: 0;
  font-family: var(--font-body);
  color: var(--health-text);
  background-color: var(--health-bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Bengali font rendering */
:lang(bn) {
  font-family: var(--font-bn), var(--font-body);
  line-height: 1.45;
}

.pub-wrap {
  width: 100%;
  max-width: 76rem;
  margin-inline: auto;
  padding-inline: 1.25rem;
}

/* =======================================================================
   Top Helpline Bar
   ======================================================================= */
:root {
  /* Public site's top strip: the Bangladesh flag green, matched to the
     e-Health Hackathon site. White text on it is about 6.6:1. */
  --pub-topbar-bg: #006A4E;
}
.pub-topbar {
  /* A fixed deep navy, not var(--health-navy): that token is remapped to a
     bright sky blue in dark mode (it is the heading colour there), which
     turned this strip into a light-blue band above a dark header. */
  /* One value to retheme the strip; see --pub-topbar-bg on :root. */
  background-color: var(--pub-topbar-bg);
  color: #FFFFFF;
  font-size: 0.9rem;
  padding: 0.45rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
/* About 38px, the e-Health Hackathon strip's height at 100% scale (48px in a
   screenshot taken at 125% display scaling). */
.pub-topbar > .pub-wrap { min-height: 1.5rem; }
/* The thin vertical rule between the phone and the email. */
.pub-topbar-divider { align-self: center; width: 1px; height: 1.4rem; background: rgba(255, 255, 255, 0.4); }
.pub-topbar a {
  color: #FFFFFF;
  text-decoration: none;
  font-weight: 600;
}
.pub-topbar a:hover {
  text-decoration: underline;
}
.pub-topbar .text-warning { color: #FFFFFF !important; }
/* Bootstrap's text-white-50 is about 3:1 on this green; lift it to a readable 85%. */
.pub-topbar .text-white-50 { color: rgba(255, 255, 255, 0.85) !important; }
/* A light veil instead of the teal pill, which sat too close to the green to read. */
.pub-topbar .pub-topbar-badge { background-color: rgba(255, 255, 255, 0.2); }
.pub-topbar-item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.pub-topbar-badge {
  background-color: var(--health-secondary);
  color: #FFFFFF;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: var(--pub-radius-pill);
  letter-spacing: 0.03em;
}

/* =======================================================================
   Main Header & Navigation Bar
   ======================================================================= */
.pub-header {
  /* Frosted glass: the page shows through a blurred, slightly saturated pane
     as it scrolls under the sticky menu. The fill is the surface colour at
     about two-thirds opacity, so text stays readable in light and dark. */
  background-color: color-mix(in srgb, var(--health-surface) 68%, transparent);
  -webkit-backdrop-filter: blur(16px) saturate(170%);
  backdrop-filter: blur(16px) saturate(170%);
  border-bottom: 1px solid color-mix(in srgb, var(--health-border) 60%, transparent);
  box-shadow: 0 8px 24px -16px rgba(18, 59, 93, 0.35);
  position: sticky;
  top: 0;
  z-index: 1020;
}
/* Without backdrop-filter a see-through bar would just be hard to read. */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .pub-header { background-color: color-mix(in srgb, var(--health-surface) 96%, transparent); }
}

.pub-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 0;
  gap: 1rem;
}

.pub-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--health-navy);
  font-weight: 700;
  font-size: 1.25rem;
  flex-shrink: 0;
}
.pub-brand:hover {
  color: var(--health-primary);
}
.pub-brand img {
  height: 2.25rem;
  width: auto;
}
/* The Afiyah wordmark replaces the emblem and the text name. The artwork is
   wide (about 3.5:1), so it is sized by height and kept clear of the nav. */
.pub-brand img.pub-brand-logo {
  height: 2.6rem;
  width: auto;
}
@media (max-width: 1199.98px) {
  .pub-brand .pub-brand-sub { display: none; }
}
.pub-brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}
.pub-brand-name {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--health-navy);
}
.pub-brand-sub {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--health-primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.pub-nav-links {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.pub-nav-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.85rem;
  border-radius: var(--pub-radius);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--health-text);
  text-decoration: none;
  transition: all 0.15s ease-in-out;
  white-space: nowrap;
}
.pub-nav-link i {
  font-size: 1rem;
  color: var(--health-primary);
}
.pub-nav-link:hover {
  background-color: var(--health-primary-light);
  color: var(--health-primary);
}
.pub-nav-link.active {
  background-color: var(--health-primary);
  color: #FFFFFF;
}
.pub-nav-link.active i {
  color: #FFFFFF;
}

.pub-nav-end {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-shrink: 0;
}

@media (max-width: 991.98px) {
  .pub-nav-links {
    display: none;
  }
}

/* =======================================================================
   Buttons & Action Controls
   ======================================================================= */
.pub-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6rem 1.25rem;
  border: 1px solid transparent;
  border-radius: var(--pub-radius);
  background-color: var(--health-primary);
  color: #FFFFFF !important;
  font-weight: 600;
  font-size: 0.92rem;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.15s ease-in-out;
  box-shadow: var(--health-shadow-xs);
  min-height: 44px;
}
.pub-btn:hover {
  background-color: var(--health-primary-hover);
  color: #FFFFFF !important;
  box-shadow: var(--health-shadow-sm);
  transform: translateY(-1px);
}
.pub-btn:active {
  transform: translateY(0);
}

.pub-btn-navy {
  background-color: var(--health-navy);
}
.pub-btn-navy:hover {
  background-color: var(--health-navy-dark);
}

.pub-btn-outline {
  background-color: transparent;
  border-color: var(--health-primary);
  color: var(--health-primary) !important;
  box-shadow: none;
}
.pub-btn-outline:hover {
  background-color: var(--health-primary-light);
  color: var(--health-primary-hover) !important;
}

.pub-btn-ghost {
  background-color: var(--health-surface);
  border-color: var(--health-border);
  color: var(--health-text) !important;
  box-shadow: none;
}
.pub-btn-ghost:hover {
  background-color: var(--health-surface-alt);
  border-color: var(--health-border-focus);
  color: var(--health-primary) !important;
}

.pub-btn-sm {
  padding: 0.4rem 0.85rem;
  font-size: 0.82rem;
  min-height: 36px;
}

.pub-btn-lg {
  padding: 0.75rem 1.75rem;
  font-size: 1.05rem;
  border-radius: var(--pub-radius-lg);
  min-height: 48px;
}

/* =======================================================================
   Hero Section
   ======================================================================= */
.pub-hero {
  position: relative;
  padding: 3rem 0 3.5rem;
  background: linear-gradient(180deg, var(--health-surface) 0%, var(--health-primary-light) 100%);
  border-bottom: 1px solid var(--health-border);
  text-align: center;
}

.pub-hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background-color: var(--health-surface);
  border: 1px solid var(--health-border);
  padding: 0.35rem 0.9rem;
  border-radius: var(--pub-radius-pill);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--health-primary);
  margin-bottom: 1.25rem;
  box-shadow: var(--health-shadow-xs);
}

.pub-hero-title {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3vw, 2.25rem);
  font-weight: 800;
  line-height: 1.2;
  color: var(--health-navy);
  margin-bottom: 0.5rem;
  letter-spacing: -0.02em;
}

.pub-hero-subtitle {
  font-family: var(--font-bn), var(--font-display);
  font-size: clamp(1rem, 2vw, 1.3rem);
  font-weight: 700;
  /* Bangla's matra needs a looser line than Latin to clear the line above. */
  line-height: 1.5;
  color: var(--health-primary);
  margin-bottom: 0.75rem;
}

.pub-hero-lede {
  max-width: 42rem;
  margin: 0 auto 1.75rem;
  font-size: 1.05rem;
  line-height: 1.6;
  color: var(--health-text-muted);
}

.pub-hero-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 2rem;
}

/* Quick Trust Statistics Bar */
.pub-stats-strip {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.5rem 2.5rem;
  padding-top: 1rem;
  border-top: 1px dashed var(--health-border);
  max-width: 50rem;
  margin: 0 auto;
}
.pub-stat-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-align: left;
}
.pub-stat-icon {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background-color: var(--health-surface);
  color: var(--health-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  box-shadow: var(--health-shadow-xs);
  flex-shrink: 0;
}
.pub-stat-num {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--health-navy);
  line-height: 1;
}
.pub-stat-label {
  font-size: 0.78rem;
  color: var(--health-text-muted);
  font-weight: 600;
}

/* =======================================================================
   Unified Search Card Component
   ======================================================================= */
.pub-searchcard {
  background-color: var(--health-surface);
  border: 1px solid var(--health-border);
  border-radius: var(--pub-radius-lg);
  box-shadow: var(--health-shadow-md);
  padding: 1.75rem;
  position: relative;
  margin-bottom: 2.5rem;
}
/* Only the home page tucks the card up under its hero. Everywhere else the
   card follows a heading block, and pulling it up 2rem laid it over the
   page title's description. */
.pub-searchcard-overlap {
  margin-top: -2rem;
}

/* Search-mode tabs, after a classic web navigation set: flat tabs standing
   on a thick coloured baseline. The selected tab is solid in its own colour
   and stands taller; idle tabs are light and low. The baseline takes the
   selected tab's colour, so the whole bar changes with the mode. */
.pub-search-tabs {
  --tabs-line: var(--health-primary);
  display: flex;
  align-items: flex-end;
  gap: 0.25rem;
  margin-bottom: 1.4rem;
  border-bottom: 4px solid var(--tabs-line);
  transition: border-color 0.2s;
}
.pub-search-tabs:has(#tab-doctor-btn.active),
.pub-search-tabs:has(#tab-code-btn.active),
.pub-search-tabs:has(#tab-nhid-btn.active) { --tabs-line: #2F7BE0; }
.pub-search-tabs:has(#tab-register-btn.active) { --tabs-line: #3E9B5A; }
.pub-search-tab {
  --tab: var(--health-primary);
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.55rem 1.3rem;
  border-radius: 0.6rem 0.6rem 0 0;
  background: var(--health-surface-alt);
  color: var(--health-text-muted);
  font-weight: 700;
  font-size: 0.9rem;
  line-height: 1.25;
  text-decoration: none;
  transition: background-color 0.15s, color 0.15s, padding 0.15s;
}
.pub-search-tab .bi { color: var(--tab); font-size: 1.05rem; }
#tab-doctor-btn,
#tab-code-btn,
#tab-nhid-btn { --tab: #2F7BE0; }
#tab-register-btn { --tab: #3E9B5A; }
.pub-search-tab:hover { background: color-mix(in srgb, var(--tab) 14%, var(--health-surface)); color: var(--health-text); }
.pub-search-tab.active {
  padding-block: 0.85rem 0.8rem;
  background: var(--tab);
  color: #fff;
  box-shadow: 0 -6px 14px -10px var(--tab);
}
.pub-search-tab.active .bi { color: #fff; }
.pub-search-tab:focus-visible { outline: 3px solid color-mix(in srgb, var(--tab) 55%, transparent); outline-offset: 2px; }
@media (max-width: 575.98px) {
  .pub-search-tab { flex: 1; justify-content: center; padding-inline: 0.6rem; font-size: 0.78rem; text-align: center; }
}

.pub-field-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--health-navy);
  margin-bottom: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
:lang(bn) .pub-field-label {
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.88rem;
}

.pub-searchcard .form-control,
.pub-searchcard .form-select,
.form-control,
.form-select {
  border: 1.5px solid var(--health-border);
  border-radius: var(--pub-radius);
  padding: 0.65rem 0.9rem;
  font-size: 0.95rem;
  color: var(--health-text);
  background-color: var(--health-surface);
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}
.form-control:focus,
.form-select:focus {
  border-color: var(--health-primary);
  box-shadow: 0 0 0 3px var(--health-primary-light);
  outline: none;
}

/* =======================================================================
   Section Styling & Headers
   ======================================================================= */
.pub-section {
  padding: 2rem 0;
}
.pub-section-header {
  margin-bottom: 1.75rem;
}
.pub-section-eyebrow {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--health-primary);
  margin-bottom: 0.25rem;
}
:lang(bn) .pub-section-eyebrow {
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.9rem;
}
.pub-section-title {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3vw, 2.1rem);
  font-weight: 800;
  color: var(--health-navy);
  margin-bottom: 0.5rem;
  letter-spacing: -0.015em;
}
.pub-section-desc {
  font-size: 0.95rem;
  color: var(--health-text-muted);
  max-width: 44rem;
  margin-bottom: 0;
}

/* =======================================================================
   Medical Speciality Directory
   ======================================================================= */
/* Speciality tiles: soft pastel cards, each washed with its own hue, with one
   large glyph in a deeper shade of that hue and the name along the bottom.
   Each speciality carries its own hue (data-tone on the icon, set in
   home.html); one --tone drives the wash, the border, the glyph and the
   hover glow, so adding a tone is one line. The tints are mixed into
   --health-surface, so they stay soft in dark mode too. */
.pub-spec-grid {
  /* Six across: three even rows of the eighteen listed. */
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.9rem;
}
.pub-spec-card {
  --tone: var(--health-primary);
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  aspect-ratio: 1 / 0.74;
  padding: 0.7rem 0.6rem 0.75rem;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--tone) 28%, var(--health-border));
  border-radius: 1rem;
  background: linear-gradient(165deg,
    color-mix(in srgb, var(--tone) 17%, var(--health-surface)) 0%,
    color-mix(in srgb, var(--tone) 7%, var(--health-surface)) 100%);
  color: var(--health-text);
  text-align: center;
  text-decoration: none;
  box-shadow: 0 8px 14px -12px var(--tone);
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}
:is(.pub-spec-card, .pub-dr, .pub-prof, .lp-spec-row):has([data-tone="rose"])   { --tone: #E0426B; }
:is(.pub-spec-card, .pub-dr, .pub-prof, .lp-spec-row):has([data-tone="amber"])  { --tone: #E0A800; --tone-ink: #2a1a00; }
:is(.pub-spec-card, .pub-dr, .pub-prof, .lp-spec-row):has([data-tone="pink"])   { --tone: #D6457A; }
:is(.pub-spec-card, .pub-dr, .pub-prof, .lp-spec-row):has([data-tone="orange"]) { --tone: #E8543A; }
:is(.pub-spec-card, .pub-dr, .pub-prof, .lp-spec-row):has([data-tone="plum"])   { --tone: #7B5EA7; }
:is(.pub-spec-card, .pub-dr, .pub-prof, .lp-spec-row):has([data-tone="violet"]) { --tone: #5B6BC0; }
:is(.pub-spec-card, .pub-dr, .pub-prof, .lp-spec-row):has([data-tone="sky"])    { --tone: #3A93C4; }
:is(.pub-spec-card, .pub-dr, .pub-prof, .lp-spec-row):has([data-tone="teal"])   { --tone: #2FA89F; }
:is(.pub-spec-card, .pub-dr, .pub-prof, .lp-spec-row):has([data-tone="blue"])   { --tone: #2F7BA6; }
:is(.pub-spec-card, .pub-dr, .pub-prof, .lp-spec-row):has([data-tone="lime"])   { --tone: #8DB63C; --tone-ink: #1a2a00; }
:is(.pub-spec-card, .pub-dr, .pub-prof, .lp-spec-row):has([data-tone="indigo"]) { --tone: #6A5ACD; }
:is(.pub-spec-card, .pub-dr, .pub-prof, .lp-spec-row):has([data-tone="cyan"])   { --tone: #1E9DB0; }
:is(.pub-spec-card, .pub-dr, .pub-prof, .lp-spec-row):has([data-tone="green"])  { --tone: #3E9B5A; }
.pub-spec-card:hover {
  transform: translateY(-3px);
  border-color: var(--tone);
  box-shadow: 0 14px 20px -14px var(--tone);
  color: var(--health-text);
}
.pub-spec-card:focus-visible { outline: 3px solid color-mix(in srgb, var(--tone) 60%, transparent); outline-offset: 3px; }
/* The glyph floats free in the upper part of the tile, in a deeper shade of
   the hue so it reads on the pale wash (amber and lime included). */
.pub-spec-icon {
  position: relative;
  display: grid;
  place-items: center;
  flex: 1;
  font-size: 2.6rem;
  line-height: 1;
  color: color-mix(in srgb, var(--tone) 82%, #000);
  filter: drop-shadow(0 4px 4px color-mix(in srgb, var(--tone) 35%, transparent));
  transition: transform 0.2s;
}
.pub-spec-card:hover .pub-spec-icon { transform: scale(1.1) rotate(-4deg); }
/* Glyphs drawn for this page (static/img/specialities.svg) size and tint like the
   icon-font ones: 1em square, filled with the current colour. */
.pub-spec-svg { width: 1em; height: 1em; fill: currentColor; }
.pub-spec-title {
  position: relative;
  /* One line, cut with an ellipsis: a long name ("Gynecologist & Obstetrician")
     would otherwise wrap and make its tile taller than its neighbours. The
     full name is in the title attribute. */
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 800;
  font-size: 0.8rem;
  line-height: 1.2;
  color: var(--health-navy);
}
/* Three small dots under the name, in the card's hue. */
.pub-spec-title::after {
  content: "";
  display: block;
  width: 1.1rem;
  height: 0.24rem;
  margin: 0.3rem auto 0;
  background: radial-gradient(circle, var(--tone) 38%, transparent 42%) 0 0 / 0.37rem 0.24rem repeat-x;
  opacity: 0.7;
}
@media (max-width: 991.98px) {
  .pub-spec-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 575.98px) {
  .pub-spec-grid { grid-template-columns: repeat(2, 1fr); gap: 0.75rem; }
}
@media (prefers-reduced-motion: reduce) {
  .pub-spec-card, .pub-spec-icon { transition: none; }
  .pub-spec-card:hover, .pub-spec-card:hover .pub-spec-icon { transform: none; }
}

/* =======================================================================
   Cards: Hospitals, Doctors & Facilities
   ======================================================================= */
.pub-card {
  background-color: var(--health-surface-card);
  border: 1px solid var(--health-border);
  border-radius: var(--pub-radius-lg);
  padding: 1.35rem;
  box-shadow: var(--health-shadow-card);
  transition: all 0.18s ease-in-out;
  height: 100%;
}
a.pub-card {
  display: block;
  text-decoration: none;
  color: inherit;
}
a.pub-card:hover,
.pub-card-hover:hover {
  border-color: var(--health-primary);
  transform: translateY(-3px);
  box-shadow: var(--health-shadow-md);
}

.pub-card-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--health-navy);
  margin-bottom: 0.25rem;
  line-height: 1.3;
}
.pub-card-sub {
  font-size: 0.85rem;
  color: var(--health-text-muted);
  line-height: 1.45;
}

/* Status Chips & Badges */
.pub-stat-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  border-radius: var(--pub-radius-pill);
  background-color: var(--health-primary-light);
  color: var(--health-primary);
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}
.pub-stat-chip b {
  font-weight: 800;
}

.pub-spec-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.65rem;
  border-radius: var(--pub-radius-pill);
  border: 1px solid var(--health-border);
  background-color: var(--health-surface-alt);
  color: var(--health-text-muted);
  font-size: 0.78rem;
  font-weight: 600;
}

.pub-bmdc {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.55rem;
  border-radius: var(--pub-radius-sm);
  background-color: var(--health-navy-light);
  color: var(--health-navy);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.pub-doctor-photo,
.pub-doctor-initial {
  width: 4rem;
  height: 4rem;
  border-radius: 50%;
  flex-shrink: 0;
  object-fit: cover;
  border: 2px solid var(--health-surface);
  box-shadow: 0 0 0 2px var(--health-border);
}
.pub-doctor-initial {
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--health-primary-light);
  color: var(--health-primary);
  font-size: 1.4rem;
  font-weight: 800;
}

/* =======================================================================
   Booking Wizard & Step Progress Indicator
   ======================================================================= */
.pub-steps {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin: 0 0 2rem;
  padding: 0;
  list-style: none;
  position: relative;
}
.pub-step {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--health-text-muted);
  flex: 1;
  position: relative;
}
.pub-step-dot {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  background-color: var(--health-surface);
  border: 2px solid var(--health-border);
  color: var(--health-text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  font-weight: 700;
  flex-shrink: 0;
  transition: all 0.2s ease-in-out;
}
.pub-step-label {
  white-space: nowrap;
}

.pub-step.is-current {
  color: var(--health-navy);
}
.pub-step.is-current .pub-step-dot {
  background-color: var(--health-primary);
  border-color: var(--health-primary);
  color: #FFFFFF;
  box-shadow: 0 0 0 4px var(--health-primary-light);
}

.pub-step.is-done {
  color: var(--health-success);
}
.pub-step.is-done .pub-step-dot {
  background-color: var(--health-success);
  border-color: var(--health-success);
  color: #FFFFFF;
}
.pub-step-tick {
  display: none;
}
.pub-step.is-done .pub-step-icon {
  display: none;
}
.pub-step.is-done .pub-step-tick {
  display: inline-flex;
}

/* =======================================================================
   Filter Group & Time Slots
   ======================================================================= */
.pub-filtergroup {
  background-color: var(--health-surface);
  border: 1px solid var(--health-border);
  border-radius: var(--pub-radius-lg);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--health-shadow-xs);
  margin-bottom: 1.5rem;
}
.pub-filtergroup-legend {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--health-navy);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.85rem;
}
.pub-filtergroup-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
}
.pub-filtergroup-field {
  flex: 1 1 14rem;
}

/* Month calendar beside the date list on /book. A bookable day is a submit button of the Step 1 form. */
.pub-cal > summary { cursor: pointer; color: var(--health-primary-hover); }
/* Handheld: months stacked, each the full width. From tablet width up: months side by side, wrapping if a third is needed. */
.pub-cal-months { display: flex; flex-direction: column; gap: 1rem; margin-top: 0.75rem; }
.pub-cal-month { width: 100%; border-collapse: separate; border-spacing: 2px; font-size: 0.85rem; }
@media (min-width: 768px) {
  .pub-cal-months { flex-direction: row; flex-wrap: wrap; align-items: flex-start; gap: 1.5rem; }
  .pub-cal-month { width: auto; }
}
.pub-cal-month caption { caption-side: top; text-align: left; font-weight: 700; color: var(--health-navy); padding: 0 0 0.25rem; }
.pub-cal-month th { text-align: center; font-weight: 600; font-size: 0.72rem; color: var(--health-text-muted); width: 2.4rem; }
.pub-cal-month td { text-align: center; padding: 0; }
.pub-cal-day { display: inline-grid; place-items: center; width: 2.4rem; height: 2.4rem; border-radius: var(--pub-radius); border: 1.5px solid transparent; background: transparent; font: inherit; color: var(--health-text-muted); }
.pub-cal-day.is-off { opacity: 0.45; }
button.pub-cal-day { border-color: var(--health-border); background: var(--health-surface); color: var(--health-text); font-weight: 700; cursor: pointer; }
button.pub-cal-day:hover { border-color: var(--health-primary); background: var(--health-primary-light); }
button.pub-cal-day:focus-visible { outline: 3px solid var(--health-primary); outline-offset: 1px; }
button.pub-cal-day.is-selected { background: var(--health-primary-hover); border-color: var(--health-primary-hover); color: var(--health-text-inverse); }

/* Floating booking tray on /book: not glued to the screen edge, it sticks a little above the bottom of the page column,
   rounded and semi-transparent over a blur. Falls back to a solid surface where blur is unsupported. */
.pub-tray {
  position: sticky;
  bottom: max(1rem, env(safe-area-inset-bottom));
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem 1.5rem;
  margin-top: 1.25rem;
  padding: 0.75rem 1.1rem;
  border: 1px solid var(--health-border);
  border-radius: 1.1rem;
  background: var(--health-surface);
  box-shadow: var(--health-shadow-lg);
}
@supports (backdrop-filter: blur(1px)) {
  .pub-tray {
    background: color-mix(in srgb, var(--health-surface) 80%, transparent);
    border-color: color-mix(in srgb, var(--health-border) 70%, transparent);
    -webkit-backdrop-filter: blur(14px) saturate(1.4);
    backdrop-filter: blur(14px) saturate(1.4);
  }
}
.pub-tray-item { display: flex; align-items: center; gap: 0.6rem; min-width: 0; }
.pub-tray-item > .bi {
  flex: none; display: inline-grid; place-items: center; width: 2.1rem; height: 2.1rem; border-radius: 50%;
  background: var(--health-primary-light); color: var(--health-primary-hover); font-size: 1rem;
}
.pub-tray-item strong { display: block; font-size: 0.92rem; color: var(--health-text); line-height: 1.2; }
.pub-tray-go { margin-left: auto; }
.pub-tray-k { display: block; font-size: 0.68rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--health-text-muted); }
@media (max-width: 575.98px) {
  .pub-tray { gap: 0.5rem 1rem; padding: 0.65rem 0.85rem; }
  .pub-tray-go { width: 100%; justify-content: center; }
}
@media print { .pub-tray { display: none; } }

/* Time Slot Grid */
.pub-slotgrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11.5rem, 1fr));
  gap: 0.85rem;
  margin: 1rem 0;
}
.pub-slot {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0.85rem 1rem;
  border: 1.5px solid var(--health-border);
  border-radius: var(--pub-radius);
  background-color: var(--health-surface);
  cursor: pointer;
  transition: all 0.15s ease-in-out;
}
.pub-slot:hover:not(.is-full) {
  border-color: var(--health-primary);
  background-color: var(--health-primary-light);
  transform: translateY(-2px);
  box-shadow: var(--health-shadow-sm);
}
.pub-slot.open {
  border-color: var(--health-border);
}
.pub-slot.filling {
  border-color: var(--health-warning);
}
.pub-slot.is-full {
  opacity: 0.45;
  cursor: not-allowed;
  background-color: var(--health-surface-alt);
  border-style: dashed;
}
.pub-slot.is-full .pub-slot-time {
  text-decoration: line-through;
}

.pub-slot-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}
.pub-slot:has(.pub-slot-input:checked) {
  border-color: var(--health-primary);
  background-color: var(--health-primary-light);
  box-shadow: 0 0 0 2px var(--health-primary);
}
.pub-slot:has(.pub-slot-input:checked) .pub-slot-time {
  color: var(--health-primary-hover);
  font-weight: 800;
}

.pub-slot-time {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--health-navy);
  margin-bottom: 0.2rem;
}
.pub-slot-count {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--health-text-muted);
}
.pub-slot.open .pub-slot-count {
  color: var(--health-success);
}
.pub-slot.filling .pub-slot-count {
  color: var(--health-warning);
}
.pub-slot.is-full .pub-slot-count {
  color: var(--health-error);
}

/* =======================================================================
   Confirmation & Printable OPD Ticket / Slip
   ======================================================================= */
.pub-ticket {
  background-color: var(--health-surface);
  border: 2px solid var(--health-navy);
  border-radius: var(--pub-radius-lg);
  padding: 2rem;
  box-shadow: var(--health-shadow-lg);
  max-width: 44rem;
  margin: 0 auto;
}

.pub-ticket-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 2px solid var(--health-navy);
  padding-bottom: 1.25rem;
  margin-bottom: 1.5rem;
}

.pub-serial-block {
  text-align: center;
  background-color: var(--health-primary-light);
  border: 2px dashed var(--health-primary);
  border-radius: var(--pub-radius);
  padding: 1rem 1.5rem;
}
.pub-serial-label {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--health-primary);
  letter-spacing: 0.05em;
}
.pub-serial {
  font-size: 3rem;
  font-weight: 900;
  line-height: 1;
  color: var(--health-navy);
  font-family: monospace, sans-serif;
}

.pub-tracking {
  display: inline-block;
  font-family: monospace, sans-serif;
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--health-navy);
  background-color: var(--health-navy-light);
  padding: 0.35rem 0.85rem;
  border-radius: var(--pub-radius-sm);
  border: 1px solid rgba(18, 59, 93, 0.15);
}

/* =======================================================================
   Official Footer with Government & Partner Emblems
   ======================================================================= */
.pub-footer {
  background-color: var(--health-navy-dark);
  color: #CBD5E1;
  padding: 3.5rem 0 2rem;
  margin-top: auto;
  border-top: 3px solid var(--health-primary);
}
.pub-footer a {
  color: #94A3B8;
  text-decoration: none;
  transition: color 0.15s ease-in-out;
}
.pub-footer a:hover {
  color: #FFFFFF;
  text-decoration: underline;
}
.pub-footer-partners {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.5rem 2rem;
  padding-bottom: 2rem;
  margin-bottom: 2rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.pub-partner-logo {
  height: 2.2rem;
  width: auto;
  opacity: 0.85;
  filter: brightness(0) invert(1);
  transition: opacity 0.15s ease;
}
.pub-partner-logo:hover {
  opacity: 1;
}

/* =======================================================================
   Print Styles for Official OPD Ticket
   ======================================================================= */
@media print {
  body {
    background: #FFFFFF !important;
    color: #000000 !important;
  }
  .pub-topbar,
  .pub-header,
  .pub-footer,
  .btn,
  .pub-btn,
  #theme-toggle,
  .no-print {
    display: none !important;
  }
  .pub-ticket {
    border: 2px solid #000000 !important;
    box-shadow: none !important;
    padding: 1.5rem !important;
    max-width: 100% !important;
    margin: 0 !important;
  }
}

/* =======================================================================
   "Hospitals near me" panel (partials/nearby_search.html)

   A panel rather than a button in a row of controls: on a page full of
   filters, a lone ghost button is the thing nobody finds. A tinted block
   with its own icon, a one-line promise about privacy, and the one solid
   button on the card.
   ======================================================================= */
.pub-nearby {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.1rem;
  padding: 1rem 1.25rem;
  border: 2px solid var(--health-primary);
  border-radius: 1.25rem;
  background:
    radial-gradient(circle at 100% 0, color-mix(in srgb, #F2B544 26%, transparent), transparent 55%),
    color-mix(in srgb, var(--health-primary) 9%, var(--health-surface));
  box-shadow: 0 16px 30px -22px var(--health-primary);
  scroll-margin-top: 6rem;
}
.pub-nearby-ic {
  position: relative;
  display: grid;
  place-items: center;
  flex: none;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  background: var(--health-primary);
  color: #fff;
  font-size: 1.35rem;
}
.pub-nearby-ic::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid var(--health-primary);
  opacity: 0;
}
@media (prefers-reduced-motion: no-preference) {
  .pub-nearby-ic::after { animation: pub-nearby-ping 2.4s ease-out infinite; }
  @keyframes pub-nearby-ping {
    0% { transform: scale(1); opacity: 0.7; }
    80%, 100% { transform: scale(1.7); opacity: 0; }
  }
}
.pub-nearby-copy { display: grid; gap: 0.1rem; flex: 1 1 14rem; min-width: 0; }
.pub-nearby-copy b { font-size: 1.05rem; color: var(--health-navy); }
.pub-nearby-copy span { font-size: 0.85rem; color: var(--health-text-muted); }
.pub-nearby-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem 0.9rem; }
.pub-nearby-go[disabled] { opacity: 0.65; cursor: progress; }
.pub-btn-near {
  background: linear-gradient(135deg, #F2B544, #E89B1A);
  border-color: transparent;
  color: #2a1a00;
}
.pub-btn-near:hover { color: #2a1a00; filter: saturate(1.1) brightness(1.03); }
@media (max-width: 575.98px) {
  .pub-nearby-actions, .pub-nearby-go { width: 100%; }
  .pub-nearby-go { justify-content: center; }
}
.pub-nearby-count {
  display: inline-flex;
  margin: 0;
  padding: 0.2rem;
  border: 1.5px solid var(--health-border);
  border-radius: 999px;
  background: var(--health-surface-alt);
}
.pub-nearby-count input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.pub-nearby-count label {
  padding: 0.3rem 0.95rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--health-text-muted);
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s;
}
.pub-nearby-count input:checked + label {
  background: var(--health-primary);
  color: #fff;
}
.pub-nearby-count input:focus-visible + label {
  outline: 3px solid color-mix(in srgb, var(--health-primary) 55%, transparent);
  outline-offset: 2px;
}
.pub-distance-chip {
  background: color-mix(in srgb, #F2B544 22%, var(--health-surface));
  color: var(--health-text);
}
.pub-distance-chip .bi { color: #C98A12; }

/* =======================================================================
   Hero quick actions — one primary, the rest secondary (NHS button rule:
   one primary action per group). "Find a hospital" is the main job; the
   others are outlined so the eye lands once. Compact on tablet and desktop
   (2.4rem, about 38px, to sit with the 39px top strip and the menu); 2.75rem
   (44px) on phones, the minimum comfortable touch target.
   ======================================================================= */
.pub-hero-actions { gap: 0.6rem; }
.pub-act {
  height: 2.4rem;
  /* `.pub-btn` sets a 44px minimum; without this the height above is ignored. */
  min-height: 0;
  padding: 0 1rem;
  gap: 0.4rem;
  border: 0;
  border-radius: var(--bs-border-radius-lg, 0.5rem);
  background: var(--health-surface);
  /* !important: `.pub-btn` forces white text with !important. */
  color: var(--health-navy) !important;
  box-shadow: inset 0 0 0 1.5px var(--health-primary);
  font-size: 0.875rem;
  font-weight: 700;
  transition: background-color 0.15s;
}
.pub-act .bi { font-size: 0.95rem; }
@media (max-width: 767.98px) {
  .pub-act { height: 2.75rem; min-height: 44px; font-size: 0.95rem; }
}
.pub-act:hover {
  background: color-mix(in srgb, var(--health-primary) 10%, var(--health-surface));
  color: var(--health-navy) !important;
}
.pub-act-hospital,
.pub-act-hospital:hover {
  background: var(--health-primary);
  color: #fff !important;
  box-shadow: none;
}
.pub-act-hospital:hover { background: var(--health-primary-hover); }
@media (prefers-reduced-motion: reduce) {
  .pub-act, .pub-act:hover, .pub-act:active { transition: none; transform: none; }
}

/* =======================================================================
   Ribbon step cards (home: "How to Book an Appointment")

   After a numbered infographic: a white card, a coloured ribbon flag that
   overhangs its top-left corner (arrow-ended, with a darker fold beneath),
   a big step number, a coloured keyword, a line of text and a coloured pill
   set into the bottom edge. One --tone per card drives all of it.
   ======================================================================= */
.pub-ribbons {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.75rem 1.5rem;
  margin: 0;
  padding: 0 0 0 0.9rem;
  list-style: none;
}
.pub-ribbon {
  --tone: var(--health-primary);
  --tone-dark: color-mix(in srgb, var(--tone) 70%, #000);
  --tone-ink: #fff;
  position: relative;
  padding-top: 1.3rem;
}
.pub-ribbon[data-tone="rose"]  { --tone: #E0426B; }
.pub-ribbon[data-tone="amber"] { --tone: #F5B301; --tone-ink: #2a1a00; }
.pub-ribbon[data-tone="teal"]  { --tone: #2FA89F; }
.pub-ribbon[data-tone="blue"]  { --tone: #2F7BA6; }
.pub-ribbon-body {
  display: grid;
  justify-items: center;
  gap: 0.2rem;
  height: 100%;
  padding: 2.6rem 1.25rem 2.1rem;
  border-radius: 1.4rem;
  background: var(--health-surface-card);
  border: 1px solid var(--health-border);
  box-shadow: var(--health-shadow-md);
  text-align: center;
}
.pub-ribbon-flag {
  position: absolute;
  top: 0;
  left: -0.9rem;
  right: 1.1rem;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  height: 2.7rem;
  padding: 0 1.6rem 0 0.9rem;
  background: var(--tone);
  color: var(--tone-ink);
  font-weight: 800;
  font-size: 0.95rem;
  white-space: nowrap;
  clip-path: polygon(0 0, calc(100% - 0.9rem) 0, 100% 50%, calc(100% - 0.9rem) 100%, 0 100%);
}
.pub-ribbon-flag .bi { font-size: 1.25rem; }
/* The fold: a small darker triangle tucked under the flag's left end. */
.pub-ribbon::before {
  content: "";
  position: absolute;
  top: 2.7rem;
  left: -0.9rem;
  z-index: 1;
  width: 0.9rem;
  height: 0.6rem;
  background: var(--tone-dark);
  clip-path: polygon(100% 0, 0 0, 100% 100%);
}
.pub-ribbon-num {
  font-family: var(--font-display);
  font-size: 2.6rem;
  font-weight: 800;
  line-height: 1;
  color: var(--health-text);
}
.pub-ribbon-kicker {
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--tone);
}
.pub-ribbon-body p {
  margin: 0.5rem 0 0;
  font-size: 0.85rem;
  line-height: 1.55;
  color: var(--health-text-muted);
}
.pub-ribbon-pill {
  position: absolute;
  bottom: -0.35rem;
  left: 50%;
  width: 4rem;
  height: 0.75rem;
  border-radius: 999px;
  background: var(--tone);
  transform: translateX(-50%);
}
@media (max-width: 991.98px) {
  .pub-ribbons { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 575.98px) {
  .pub-ribbons { grid-template-columns: 1fr; }
}

/* Disabled (inactive) fields: the cascading area selects stay disabled until
   their parent is chosen, and should read as "not yet" rather than as a
   normal empty field. Dimmed text, flat fill, and the label dims with it. */
.form-select:disabled,
.form-control:disabled {
  background-color: var(--health-surface-alt);
  border-color: var(--health-border-light);
  color: var(--health-text-light);
  opacity: 0.75;
  cursor: not-allowed;
  box-shadow: none;
}
.form-select:disabled {
  --bs-form-select-bg-img: none;
}
.row > [class*="col-"]:has(> .form-select:disabled) > .pub-field-label {
  color: var(--health-text-light);
}

/* =======================================================================
   Division cards (home: "Find Hospitals by Division")

   After a horizontal infographic card: white body, a coloured tab hanging
   from the top-left edge that carries the card's figure (here the facility
   count), a coloured band down the right edge, and an icon set off from
   the text by a hairline. Tones are assigned by position in the (stable,
   alphabetical) division list, in a fixed order.
   ======================================================================= */
.pub-divs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.75rem 1.25rem;
  padding-top: 0.9rem;
}
.pub-div-card {
  --tone: var(--health-primary);
  --tone-ink: #fff;
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 0 1rem;
  padding: 1.75rem 1.75rem 1.1rem 1.1rem;
  border: 1px solid var(--health-border);
  border-radius: 1rem 1.1rem 1.1rem 1rem;
  background: var(--health-surface-card);
  box-shadow: var(--health-shadow-md);
  color: var(--health-text);
  text-decoration: none;
  transition: transform 0.18s, box-shadow 0.18s;
}
.pub-div-card:nth-child(8n+1) { --tone: #2FA89F; }
.pub-div-card:nth-child(8n+2) { --tone: #F28C28; }
.pub-div-card:nth-child(8n+3) { --tone: #E8543A; }
.pub-div-card:nth-child(8n+4) { --tone: #7B5EA7; }
.pub-div-card:nth-child(8n+5) { --tone: #2F7BA6; }
.pub-div-card:nth-child(8n+6) { --tone: #3E9B5A; }
.pub-div-card:nth-child(8n+7) { --tone: #D6457A; }
.pub-div-card:nth-child(8n+8) { --tone: #E0A800; --tone-ink: #2a1a00; }
.pub-div-card:hover { transform: translateY(-3px); box-shadow: 0 18px 28px -18px var(--tone); color: var(--health-text); }
.pub-div-card:focus-visible { outline: 3px solid color-mix(in srgb, var(--tone) 60%, transparent); outline-offset: 3px; }
/* The band down the right edge. */
.pub-div-card::after {
  content: "";
  position: absolute;
  inset: 0 0 0 auto;
  width: 0.8rem;
  border-radius: 0 1.1rem 1.1rem 0;
  background: var(--tone);
}
/* The tab that hangs from the top-left, rounded at its lower edge. */
.pub-div-tab {
  position: absolute;
  top: -0.9rem;
  left: 1.1rem;
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  padding: 0.2rem 0.8rem 0.4rem;
  border-radius: 0.6rem 0.6rem 1rem 1rem;
  background: var(--tone);
  color: var(--tone-ink);
}
.pub-div-tab small { font-size: 0.62rem; font-weight: 700; letter-spacing: 0.04em; }
.pub-div-tab b { font-family: var(--font-display); font-size: 0.95rem; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.pub-div-ic {
  padding-right: 1rem;
  border-right: 1px solid var(--health-border);
  font-size: 1.7rem;
  line-height: 1;
  color: var(--tone);
}
.pub-div-text { display: grid; gap: 0.15rem; min-width: 0; }
.pub-div-name { font-size: 1.05rem; font-weight: 800; color: var(--health-navy); }
.pub-div-go { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.78rem; font-weight: 600; color: var(--health-text-muted); }
@media (max-width: 991.98px) {
  .pub-divs { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 575.98px) {
  .pub-divs { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .pub-div-card, .pub-div-card:hover { transition: none; transform: none; }
}

/* =======================================================================
   Search-card controls, one size
   Every control in the home search card shares a 2.6rem height, so the
   inputs, the selects and the buttons beside them line up and none of them
   outweighs the rest of the page.
   ======================================================================= */
.pub-searchcard .pub-btn {
  height: 2.6rem;
  min-height: 2.6rem;
  padding: 0 1.15rem;
  border-radius: 0.8rem;
  font-size: 0.9rem;
  font-weight: 700;
}
.pub-searchcard .pub-btn .bi { font-size: 1rem; }
.pub-searchcard .form-control,
.pub-searchcard .form-select,
.pub-searchcard .input-group-text {
  min-height: 2.6rem;
  font-size: 0.92rem;
}
.pub-searchcard .form-control,
.pub-searchcard .form-select { padding-block: 0.4rem; }

/* The near-me panel, trimmed to match. */
.pub-nearby { padding: 0.75rem 1rem; gap: 0.6rem 0.9rem; border-width: 1.5px; border-radius: 1rem; }
/* Breathing room before the search field that follows the panel. */
.pub-nearby { margin-bottom: 1.1rem; }
.pub-nearby-ic { width: 2.4rem; height: 2.4rem; font-size: 1.1rem; }
.pub-nearby-copy b { font-size: 0.95rem; }
.pub-nearby-copy span { font-size: 0.8rem; }
.pub-nearby-count label { padding: 0.2rem 0.8rem; font-size: 0.8rem; }

/* Icon / prefix boxes beside inputs. Several templates mark them
   `bg-white` or `bg-light`, which Bootstrap applies with !important, so in
   dark mode they stayed bright white. Override on the theme tokens instead
   (the !important is needed to beat those utilities). */
.pub-page .input-group-text {
  background-color: var(--health-surface) !important;
  border-color: var(--health-border);
  color: var(--health-text-muted) !important;
}
.pub-page .input-group-text .bi { color: var(--health-secondary); }

/* =======================================================================
   Booking lookup page (/booking/) — same theme as the home page: a compact
   hero, the search-card with a tab bar for the two routes, and found
   bookings as cards with the serial hanging from the top-left.
   ======================================================================= */
.pub-hero-compact { padding: 2rem 0 3.25rem; }
.pub-hero-compact .pub-hero-lede { margin-bottom: 0; }
.pub-lookup-wrap { max-width: 52rem; margin-inline: auto; }
.pub-lookup-wrap [hidden] { display: none !important; }

/* Codes are read off a slip or a screen character by character. */
.pub-searchcard input[autocomplete="one-time-code"],
.pub-searchcard input[autocapitalize="characters"] {
  font-family: var(--font-mono, ui-monospace, Consolas, monospace);
  letter-spacing: 0.2em;
  text-transform: uppercase;
}
.pub-searchcard input[autocomplete="one-time-code"]::placeholder,
.pub-searchcard input[autocapitalize="characters"]::placeholder { letter-spacing: 0.1em; }

.pub-otp {
  padding: 1rem 1.1rem;
  border: 1.5px dashed var(--health-primary);
  border-radius: 1rem;
  background:
    radial-gradient(circle at 100% 0, color-mix(in srgb, #F2B544 20%, transparent), transparent 50%),
    color-mix(in srgb, var(--health-primary) 8%, var(--health-surface));
}
.pub-otp .bi-shield-check { color: var(--health-primary); }

/* ---- Found bookings: the OPD ticket, one per booking ---- */
.pub-bk-list { margin-top: 1.75rem; }
.pub-bk-list .pub-opd { max-width: 42rem; margin: 0 auto 1.25rem; }

/* =======================================================================
   Doctor cards (/find-a-doctor/)

   Built to be scanned in long lists, so they are small: a slim banner in the
   speciality's colour carries the name, the avatar overlaps its lower edge,
   and the rest is one row of facts, one line for the chamber and two
   buttons — about 190px tall, four across on a wide screen. Colour comes
   from the doctor's speciality (the shared :has([data-tone]) map in the
   speciality tiles section), so a cardiologist is rose on every page.
   ======================================================================= */
.pub-dr {
  --tone: #2FA89F;
  --tone-ink: #fff;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--health-border);
  border-radius: 0.95rem;
  background: var(--health-surface-card);
  box-shadow: var(--health-shadow-sm);
  transition: transform 0.18s, box-shadow 0.18s;
}
.pub-dr:hover { transform: translateY(-2px); box-shadow: 0 14px 22px -16px var(--tone); }
.pub-dr-grid { --bs-gutter-x: 1.1rem; --bs-gutter-y: 1.1rem; }
.pub-dr-banner {
  min-height: 3.5rem;
  padding: 0.55rem 0.8rem 1.85rem;
  text-align: center;
  background:
    radial-gradient(circle at 85% 0%, rgba(255, 255, 255, 0.28), transparent 55%),
    linear-gradient(135deg, color-mix(in srgb, var(--tone) 88%, #fff), color-mix(in srgb, var(--tone) 82%, #000));
  color: var(--tone-ink);
}
.pub-dr-name {
  margin: 0;
  overflow: hidden;
  font-family: var(--font-display);
  font-size: 0.88rem;
  font-weight: 800;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pub-dr-name a { color: var(--tone-ink) !important; text-decoration: none; }
.pub-dr-spec {
  overflow: hidden;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
  opacity: 0.92;
}
.pub-dr-avatar { display: grid; place-items: center; margin-top: -1.5rem; position: relative; }
.pub-dr-avatar .pub-doctor-photo,
.pub-dr-avatar .pub-doctor-initial {
  width: 3rem;
  height: 3rem;
  border: 2px solid var(--health-surface-card);
  box-shadow: 0 4px 10px -5px var(--tone);
}
.pub-dr-avatar .pub-doctor-initial {
  background: color-mix(in srgb, var(--tone) 16%, var(--health-surface));
  color: color-mix(in srgb, var(--tone) 80%, #000);
  font-size: 1.05rem;
}
.pub-dr-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.3rem 0.8rem 0.75rem;
  text-align: center;
}
.pub-dr-bn { display: none; }
.pub-dr-sub {
  overflow: hidden;
  font-size: 0.68rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--health-text-muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* The facts: one row of glyph + value, labels kept for screen readers. */
.pub-dr-stats {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.9rem;
  margin: 0;
  padding: 0.35rem 0;
  border-block: 1px solid var(--health-border);
}
.pub-dr-stats > div { display: flex; align-items: center; gap: 0.3rem; }
.pub-dr-stats dd {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin: 0;
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--health-text);
}
.pub-dr-stats dd .bi { font-size: 1rem; color: color-mix(in srgb, var(--tone) 82%, #000); }
.pub-dr-stats dt {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.pub-dr-stats .pub-spec-icon { flex: none; display: inline-grid; font-size: 1.15rem; filter: none; }
.pub-dr-stats .pub-spec-icon:hover { transform: none; }
.pub-dr-where {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  font-size: 0.7rem;
  line-height: 1.3;
  color: var(--health-text);
}
.pub-dr-where > .bi { flex: none; color: color-mix(in srgb, var(--tone) 82%, #000); }
.pub-dr-where > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pub-dr-area { display: none; }
.pub-dr-more { font-weight: 700; color: color-mix(in srgb, var(--tone) 78%, #000); text-decoration: none; }
.pub-dr-meta { display: flex; justify-content: center; margin-top: auto; }
.pub-dr-meta .pub-bmdc { padding: 0.1rem 0.45rem; font-size: 0.64rem; }
.pub-dr-actions { display: flex; gap: 0.4rem; }
.pub-dr-actions .pub-btn { height: 1.9rem; min-height: 1.9rem; padding: 0 0.6rem; border-radius: 0.55rem; font-size: 0.74rem; }
.pub-dr-actions .pub-btn .bi { font-size: 0.85rem; }
@media (prefers-reduced-motion: reduce) {
  .pub-dr, .pub-dr:hover { transition: none; transform: none; }
}

/* =======================================================================
   Doctor profile (/find-a-doctor/<id>/)

   After a dashboard profile card: a tinted hero with the name large and the
   photo in a ring, four fact cards, then chambers and background as list
   rows (icon tile, title, small print, pill, action). Everything takes its
   colour from the doctor's speciality via --tone (shared :has([data-tone])
   map in the speciality tiles section).
   ======================================================================= */
.pub-prof {
  --tone: #2FA89F;
  --tone-ink: #fff;
  --tone-deep: color-mix(in srgb, var(--tone) 78%, #000);
}
.pub-prof-hero {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 1.5rem;
  padding: 2rem 2.5rem;
  border: 1px solid color-mix(in srgb, var(--tone) 28%, var(--health-border));
  border-radius: 1.5rem;
  background:
    radial-gradient(circle at 95% 10%, color-mix(in srgb, var(--tone) 22%, transparent), transparent 50%),
    linear-gradient(135deg, color-mix(in srgb, var(--tone) 14%, var(--health-surface)), color-mix(in srgb, var(--tone) 4%, var(--health-surface)));
  box-shadow: var(--health-shadow-md);
}
.pub-prof-kicker {
  margin: 0 0 0.35rem;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--tone-deep);
}
.pub-prof-name {
  margin: 0 0 0.25rem;
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 3.4vw, 2.3rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.015em;
  color: var(--health-navy);
}
.pub-prof-bn { margin: 0 0 0.25rem; font-size: 1rem; font-weight: 700; color: var(--health-primary); }
.pub-prof-degrees { margin: 0 0 0.2rem; font-size: 0.95rem; font-weight: 700; color: var(--health-text); }
.pub-prof-rank { margin: 0 0 0.6rem; font-size: 0.88rem; color: var(--health-text-muted); }
.pub-prof-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem 0.9rem; margin-top: 0.9rem; }
.pub-prof-actions .pub-btn { height: 2.6rem; min-height: 2.6rem; padding: 0 1.2rem; border-radius: 0.8rem; font-size: 0.9rem; }
.pub-prof-status {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--health-text-muted);
}
.pub-prof-dot { width: 0.55rem; height: 0.55rem; border-radius: 50%; background: var(--health-success); box-shadow: 0 0 0 3px color-mix(in srgb, var(--health-success) 25%, transparent); }
.pub-prof-photo {
  display: grid;
  place-items: center;
  width: 13rem;
  height: 13rem;
  overflow: hidden;
  border: 6px solid var(--tone);
  border-radius: 50%;
  background: color-mix(in srgb, var(--tone) 16%, var(--health-surface));
  box-shadow: 0 0 0 7px color-mix(in srgb, var(--tone) 18%, transparent), 0 18px 30px -16px var(--tone);
}
.pub-prof-photo img { width: 100%; height: 100%; object-fit: cover; }
.pub-prof-photo span { font-family: var(--font-display); font-size: 4.6rem; font-weight: 800; color: var(--tone-deep); }

/* ---- fact cards ---- */
.pub-prof-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin: 1.25rem 0 0;
}
.pub-prof-stat {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-width: 0;
  padding: 1rem 1.1rem;
  border: 1px solid var(--health-border);
  border-radius: 1.1rem;
  background: var(--health-surface-card);
  box-shadow: var(--health-shadow-sm);
}
.pub-prof-stat dd { margin: 0; font-family: var(--font-display); font-size: 1.15rem; font-weight: 800; line-height: 1.2; color: var(--health-text); }
.pub-prof-stat dt { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--health-text-muted); }
/* The icon tile, shared by fact cards and list rows. */
.pub-prof-ic,
.pub-prof-stat .pub-spec-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 2.9rem;
  height: 2.9rem;
  border-radius: 0.85rem;
  background: color-mix(in srgb, var(--tone) 15%, var(--health-surface));
  color: var(--tone-deep);
  font-size: 1.35rem;
  filter: none;
}
.pub-prof-stat .pub-spec-icon:hover { transform: none; }

/* ---- blocks and list rows ---- */
.pub-prof-block { margin-top: 2rem; }
.pub-prof-h { margin: 0 0 0.5rem; font-family: var(--font-display); font-size: 1.2rem; font-weight: 800; color: var(--health-navy); }
.pub-prof-about { max-width: 52rem; line-height: 1.65; color: var(--health-text-muted); }
.pub-prof-list { display: grid; gap: 0.75rem; margin: 0; padding: 0; list-style: none; }
.pub-prof-row {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.85rem 1.1rem;
  border: 1px solid var(--health-border);
  border-radius: 1rem;
  background: var(--health-surface-card);
  box-shadow: var(--health-shadow-xs);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.pub-prof-row:hover { border-color: color-mix(in srgb, var(--tone) 55%, var(--health-border)); box-shadow: 0 10px 18px -14px var(--tone); }
.pub-prof-row-main { flex: 1; min-width: 0; }
.pub-prof-row-title { display: block; font-size: 0.98rem; font-weight: 800; color: var(--health-navy); text-decoration: none; }
a.pub-prof-row-title:hover { color: var(--tone-deep); }
.pub-prof-row-sub { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.75rem; margin-top: 0.15rem; font-size: 0.8rem; color: var(--health-text-muted); }
.pub-prof-row-sub .bi { margin-right: 0.3rem; }
.pub-prof-pill {
  display: inline-block;
  padding: 0.12rem 0.6rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--tone) 15%, var(--health-surface));
  color: var(--tone-deep);
  font-size: 0.72rem;
  font-weight: 800;
  white-space: nowrap;
}
.pub-prof-fee { font-size: 0.8rem; font-weight: 700; color: var(--health-text-muted); white-space: nowrap; }
.pub-prof-fee b { margin-left: 0.1rem; font-size: 1rem; color: var(--health-text); }
.pub-prof-row .pub-btn { height: 2.2rem; min-height: 2.2rem; padding: 0 0.9rem; border-radius: 0.7rem; font-size: 0.8rem; }

/* ---- help bar (navy, with the helpline) ---- */
.pub-prof-help {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
  margin-top: 2.25rem;
  padding: 1rem 1.5rem;
  border-radius: 1.25rem;
  background: color-mix(in srgb, #123B5D 78%, #000);
  color: #fff;
}
.pub-prof-help div { display: grid; gap: 0.1rem; }
.pub-prof-help b { font-size: 1rem; }
.pub-prof-help span { font-size: 0.82rem; color: rgba(255, 255, 255, 0.75); }
.pub-prof-call {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1.25rem;
  border-radius: 999px;
  background: #fff;
  color: #123B5D !important;
  font-size: 1.1rem;
  font-weight: 800;
  text-decoration: none;
}
@media (max-width: 991.98px) {
  .pub-prof-stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 575.98px) {
  .pub-prof-hero { grid-template-columns: 1fr; padding: 1.25rem; text-align: center; }
  .pub-prof-photo { order: -1; margin-inline: auto; width: 9.5rem; height: 9.5rem; }
  .pub-prof-actions { justify-content: center; }
  .pub-prof-stats { gap: 0.75rem; }
  .pub-prof-row { flex-wrap: wrap; }
  .pub-prof-row .pub-btn { width: 100%; justify-content: center; }
}
@media (prefers-reduced-motion: reduce) {
  .pub-prof-row { transition: none; }
}

/* Dropdown lists. The select itself takes its colours from the theme, but the
   open list is drawn by the browser from each <option>'s own colours. With a
   transparent select (the language switcher) those came out as the theme's
   light text on the browser's white list in dark mode — invisible. Give the
   options the theme's surface and text explicitly. */
.pub-page select option,
.pub-page select optgroup {
  background-color: var(--health-surface);
  color: var(--health-text);
}
.pub-page select option:checked {
  background-color: color-mix(in srgb, var(--health-primary) 22%, var(--health-surface));
}
.pub-header .form-select {
  color: var(--health-text);
  background-color: transparent;
}

/* =======================================================================
   OPD ticket on the confirmation page (/book/done/)
   A small boarding-pass: facts on the left, QR + tracking code on a stub on
   the right, split by a perforation whose two notches are cut from the page
   background. Collapses to a single column (stub below) on a phone.
   ======================================================================= */
.pub-opd-wrap { max-width: 42rem; margin-inline: auto; padding-top: 1rem; }
.pub-opd-done {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0 0 1rem;
  padding: 0.6rem 0.9rem;
  border-radius: 0.8rem;
  background: color-mix(in srgb, var(--health-success) 12%, var(--health-surface));
  color: var(--health-text);
  font-size: 0.85rem;
}
.pub-opd-done .bi { flex: none; font-size: 1.3rem; color: var(--health-success); }
.pub-opd {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--health-border);
  border-radius: 1.1rem;
  background: var(--health-surface-card);
  box-shadow: var(--health-shadow-md);
}
.pub-opd-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 1rem;
  background: linear-gradient(135deg, var(--health-primary), color-mix(in srgb, var(--health-primary) 70%, #000));
  color: #fff;
}
.pub-opd-emblem { height: 2rem; width: auto; border-radius: 50%; background: #fff; padding: 2px; }
.pub-opd-head-text { display: grid; flex: 1; min-width: 0; line-height: 1.25; }
.pub-opd-head-text b { font-size: 0.95rem; }
.pub-opd-head-text span { overflow: hidden; font-size: 0.75rem; opacity: 0.9; text-overflow: ellipsis; white-space: nowrap; }
.pub-opd-chip-bad { background: rgba(224, 66, 107, 0.9) !important; }
.pub-opd-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}
.pub-opd-body { display: grid; grid-template-columns: 1fr 11.5rem; }
.pub-opd-main { padding: 0.9rem 1.1rem; }
.pub-opd-label { display: block; font-size: 0.64rem; font-weight: 800; letter-spacing: 0.07em; text-transform: uppercase; color: var(--health-text-muted); }
.pub-opd-serial { display: flex; align-items: baseline; gap: 0.75rem; margin-bottom: 0.6rem; }
.pub-opd-no { font-family: var(--font-display); font-size: 3rem; font-weight: 800; line-height: 1; color: var(--health-primary); }
.pub-opd-facts { display: grid; gap: 0.5rem; margin: 0; }
.pub-opd-facts dt { font-size: 0.62rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--health-text-muted); }
.pub-opd-facts dd { margin: 0; font-size: 0.88rem; font-weight: 700; line-height: 1.3; color: var(--health-text); }
.pub-opd-facts .bi { margin-right: 0.3rem; }
.pub-opd-accent { color: var(--health-primary) !important; font-size: 0.8rem !important; }
.pub-opd-muted { color: var(--health-text-muted) !important; font-size: 0.8rem !important; font-weight: 600 !important; }
/* The stub: QR, code, a line of help — behind a perforated edge. */
.pub-opd-stub {
  position: relative;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 0.3rem;
  padding: 0.9rem 0.9rem;
  border-left: 2px dashed var(--health-border);
  text-align: center;
}
.pub-opd-stub::before,
.pub-opd-stub::after {
  content: "";
  position: absolute;
  left: -0.7rem;
  width: 1.2rem;
  height: 1.2rem;
  border-radius: 50%;
  background: var(--health-bg);
  box-shadow: inset 0 0 0 1px var(--health-border);
}
.pub-opd-stub::before { top: -0.6rem; }
.pub-opd-stub::after { bottom: -0.6rem; }
.pub-opd-stub img {
  width: 7.5rem;
  height: 7.5rem;
  border-radius: 0.5rem;
  /* A QR needs a light ground to scan, in dark mode too. */
  background: #fff;
  padding: 0.25rem;
}
.pub-opd-stub .pub-tracking { font-size: 0.95rem; }
.pub-opd-stub small { font-size: 0.66rem; line-height: 1.35; color: var(--health-text-muted); }
.pub-opd-note {
  margin: 0;
  padding: 0.55rem 1.1rem;
  border-top: 1px solid var(--health-border);
  background: var(--health-surface-alt);
  font-size: 0.74rem;
  line-height: 1.4;
  color: var(--health-text-muted);
}
.pub-opd-note .bi { margin-right: 0.35rem; color: var(--health-primary); }
.pub-opd-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; padding: 0.6rem 1.1rem 0.8rem; border-top: 1px solid var(--health-border); }
.pub-opd-actions .d-flex { margin-top: 0 !important; }
.pub-opd-actions .pub-field-label { display: none; }
.pub-opd-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.5rem; margin-top: 1rem; }
@media (max-width: 575.98px) {
  .pub-opd-body { grid-template-columns: 1fr; }
  .pub-opd-stub { border-left: 0; border-top: 2px dashed var(--health-border); }
  .pub-opd-stub::before, .pub-opd-stub::after { top: -0.6rem; bottom: auto; }
  .pub-opd-stub::before { left: -0.6rem; }
  .pub-opd-stub::after { left: auto; right: -0.6rem; }
}
@media print {
  .pub-opd { border: 2px solid #000; box-shadow: none; break-inside: avoid; }
  .pub-opd-done, .pub-opd-links, .pub-opd-actions { display: none !important; }
}

/* =======================================================================
   Patient login pages (/login/mobile/, /login/nhid/)
   One card, two halves: a teal brand panel saying what signing in gets you,
   and the form with a tab bar between the two ways in.
   ======================================================================= */
.pub-login { max-width: 58rem; margin-inline: auto; padding-top: 2.5rem; }
.pub-login-card {
  display: grid;
  grid-template-columns: 0.85fr 1.15fr;
  overflow: hidden;
  border: 1px solid var(--health-border);
  border-radius: 1.5rem;
  background: var(--health-surface-card);
  box-shadow: var(--health-shadow-lg);
}
.pub-login-aside {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  padding: 2rem 1.75rem;
  background:
    radial-gradient(circle at 90% 8%, rgba(242, 181, 68, 0.35), transparent 45%),
    radial-gradient(circle at 5% 100%, rgba(255, 255, 255, 0.16), transparent 50%),
    linear-gradient(160deg, var(--health-primary), color-mix(in srgb, var(--health-primary) 62%, #000));
  color: #fff;
}
.pub-login-badge {
  display: grid;
  place-items: center;
  width: 3.4rem;
  height: 3.4rem;
  border-radius: 1.1rem;
  background: rgba(255, 255, 255, 0.18);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.3);
  font-size: 1.7rem;
}
.pub-login-aside h2 { margin: 0; font-family: var(--font-display); font-size: 1.45rem; font-weight: 800; line-height: 1.25; color: #fff; }
.pub-login-aside ul { display: grid; gap: 0.85rem; margin: auto 0 0; padding: 0; list-style: none; }
.pub-login-aside li { display: flex; align-items: flex-start; gap: 0.7rem; font-size: 0.88rem; line-height: 1.4; color: rgba(255, 255, 255, 0.92); }
.pub-login-aside li .bi { flex: none; margin-top: 0.1rem; font-size: 1.1rem; color: #F2B544; }
.pub-login-main { display: flex; flex-direction: column; padding: 1.75rem 2rem 1.5rem; }
.pub-login-main .pub-search-tabs { margin-bottom: 1.4rem; }
.pub-login-title { margin: 0 0 0.35rem; font-family: var(--font-display); font-size: 1.45rem; font-weight: 800; color: var(--health-navy); }
.pub-login-lede { margin: 0 0 1.25rem; font-size: 0.9rem; line-height: 1.5; color: var(--health-text-muted); }
.pub-login-main .pub-btn { height: 2.7rem; min-height: 2.7rem; border-radius: 0.8rem; font-size: 0.92rem; }
.pub-login-note {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  margin: 0 0 1rem;
  padding: 0.65rem 0.85rem;
  border-radius: 0.8rem;
  background: var(--health-primary-light);
  font-size: 0.8rem;
  line-height: 1.4;
  color: var(--health-text);
}
.pub-login-note .bi { flex: none; margin-top: 0.1rem; color: var(--health-primary); }
.pub-login-foot { margin: auto 0 0; padding-top: 1.25rem; font-size: 0.82rem; text-align: center; color: var(--health-text-muted); }
.pub-login-foot .bi { margin-right: 0.35rem; color: var(--health-primary); }
.pub-login-foot a { font-weight: 700; text-decoration: none; }
@media (max-width: 767.98px) {
  .pub-login { padding-top: 1rem; }
  .pub-login-card { grid-template-columns: 1fr; }
  .pub-login-aside { padding: 1.25rem 1.25rem 1.1rem; gap: 0.8rem; }
  .pub-login-aside ul { display: none; }
  .pub-login-badge { width: 2.7rem; height: 2.7rem; font-size: 1.35rem; }
  .pub-login-aside h2 { font-size: 1.15rem; }
  .pub-login-main { padding: 1.25rem; }
}

/* Bootstrap paints a focused field with --bs-body-bg, which app.css defines as
   the legacy dark brown. On the public pages that turned a focused input into
   a brown hole in a navy card. Keep the field on the theme's surface. */
.pub-page .form-control:focus,
.pub-page .form-select:focus {
  background-color: var(--health-surface);
  color: var(--health-text);
}

/* Login tabs: two equal halves, same height whichever is selected (on the
   search card the selected tab stands taller; here the pair should read as a
   switch, not as a tab and a leftover). */
.pub-login-main .pub-search-tabs { align-items: stretch; }
.pub-login-main .pub-search-tab { flex: 1 1 0; justify-content: center; padding: 0.65rem 1rem; }
.pub-login-main .pub-search-tab.active { padding-block: 0.65rem; }

/* Form controls, one smaller size across the public pages so inputs, selects
   and the buttons beside them match the rest of the theme. */
.pub-page .form-control,
.pub-page .form-select,
.pub-page .input-group-text {
  min-height: 2.4rem;
  padding-block: 0.3rem;
  font-size: 0.88rem;
}
.pub-page .form-control,
.pub-page .form-select { padding-inline: 0.8rem; border-radius: 0.7rem; }
.pub-page .input-group > .form-control,
.pub-page .input-group > .input-group-text { border-radius: 0; }
.pub-page .input-group > :first-child { border-top-left-radius: 0.7rem; border-bottom-left-radius: 0.7rem; }
.pub-page .input-group > :last-child { border-top-right-radius: 0.7rem; border-bottom-right-radius: 0.7rem; }
.pub-searchcard .pub-btn,
.pub-login-main .pub-btn,
.pub-searchcard .pub-btn-sm {
  height: 2.4rem;
  min-height: 2.4rem;
  padding-inline: 1rem;
  font-size: 0.86rem;
}
.pub-login-main .pub-login-title { font-size: 1.3rem; }

/* Compact login card: tighter padding and spacing, smaller type, 2.2rem
   controls — the whole form fits comfortably on one short screen. */
.pub-login { max-width: 50rem; padding-top: 1.5rem; }
.pub-login-card { border-radius: 1.2rem; }
.pub-login-aside { gap: 0.8rem; padding: 1.4rem 1.3rem; }
.pub-login-badge { width: 2.8rem; height: 2.8rem; border-radius: 0.9rem; font-size: 1.4rem; }
.pub-login-aside h2 { font-size: 1.15rem; }
.pub-login-aside ul { gap: 0.6rem; }
.pub-login-aside li { gap: 0.55rem; font-size: 0.8rem; }
.pub-login-main { padding: 1.2rem 1.5rem 1rem; }
.pub-login-main .pub-search-tabs { margin-bottom: 1rem; }
.pub-login-main .pub-search-tab { padding: 0.5rem 0.8rem; font-size: 0.82rem; }
.pub-login-main .pub-search-tab.active { padding-block: 0.5rem; }
.pub-login-main .pub-login-title { margin-bottom: 0.25rem; font-size: 1.15rem; }
.pub-login-lede { margin-bottom: 0.9rem; font-size: 0.82rem; line-height: 1.45; }
.pub-login-main .mb-3 { margin-bottom: 0.7rem !important; }
.pub-login-main .pub-field-label { margin-bottom: 0.25rem; font-size: 0.72rem; }
.pub-login-main .form-control,
.pub-login-main .input-group-text { min-height: 2.2rem; font-size: 0.85rem; }
.pub-login-main .pub-btn { height: 2.2rem; min-height: 2.2rem; font-size: 0.82rem; border-radius: 0.65rem; }
.pub-login-note { margin-bottom: 0.7rem; padding: 0.5rem 0.7rem; font-size: 0.75rem; }
.pub-login-foot { padding-top: 0.8rem; font-size: 0.78rem; }

.pub-login-consent { display: flex; align-items: flex-start; gap: 0.5rem; padding-left: 0; font-size: 0.78rem; line-height: 1.4; color: var(--health-text-muted); }
.pub-login-consent .form-check-input { flex: none; margin: 0.15rem 0 0; float: none; }
.pub-login-main .form-select { min-height: 2.2rem; font-size: 0.85rem; }
.pub-login-main .row.g-2 .pub-field-label { margin-bottom: 0.2rem; }

/* "or" divider and the passkey button on the patient login. */
.pub-login-passkey { margin-top: 0.9rem; }
.pub-login-or { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.7rem; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--health-text-muted); }
.pub-login-or::before, .pub-login-or::after { content: ""; flex: 1; border-top: 1px solid var(--health-border); }

/* Three tabs share the card's width: keep each label on one line. */
.pub-login-main .pub-search-tab { gap: 0.4rem; padding-inline: 0.5rem; font-size: 0.78rem; white-space: nowrap; }
.pub-login-main .pub-search-tab .bi { font-size: 0.95rem; }

/* =======================================================================
   Profile menu (signed-in patient portal topbar)
   One avatar-and-name button opening a menu of who, where, account actions,
   language and logout — in place of a row of separate buttons.
   ======================================================================= */
.pub-profile-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0.65rem 0.25rem 0.3rem;
  border: 1px solid var(--health-border);
  border-radius: 999px;
  background: var(--health-surface);
  color: var(--health-text);
  font-size: 0.85rem;
  font-weight: 700;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.pub-profile-btn:hover,
.pub-profile-btn[aria-expanded="true"] { border-color: var(--health-primary); box-shadow: 0 6px 14px -10px var(--health-primary); }
.pub-profile-avatar {
  display: grid;
  place-items: center;
  flex: none;
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--health-primary), var(--health-secondary));
  color: #fff;
  font-size: 0.85rem;
  font-weight: 800;
}
.pub-profile-avatar-lg { width: 2.6rem; height: 2.6rem; font-size: 1.1rem; }
.pub-profile-name { max-width: 9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pub-profile-caret { font-size: 0.7rem; color: var(--health-text-muted); transition: transform 0.2s; }
.pub-profile-btn[aria-expanded="true"] .pub-profile-caret { transform: rotate(180deg); }
.pub-profile-menu {
  min-width: 15.5rem;
  padding: 0.4rem;
  border: 1px solid var(--health-border);
  border-radius: 1rem;
  background: var(--health-surface);
  box-shadow: var(--health-shadow-lg);
}
.pub-profile-head { display: flex; align-items: center; gap: 0.7rem; padding: 0.5rem 0.6rem 0.35rem; }
.pub-profile-who { font-size: 0.9rem; font-weight: 800; color: var(--health-navy); }
.pub-profile-id { font-size: 0.72rem; color: var(--health-text-muted); }
.pub-profile-menu .dropdown-header { padding: 0.35rem 0.6rem 0.15rem; font-size: 0.66rem; font-weight: 800; letter-spacing: 0.07em; text-transform: uppercase; color: var(--health-text-muted); }
.pub-profile-menu .dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.42rem 0.6rem;
  border-radius: 0.6rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--health-text);
}
.pub-profile-menu .dropdown-item .bi { width: 1.1rem; color: var(--health-primary); text-align: center; }
.pub-profile-menu .dropdown-item:hover,
.pub-profile-menu .dropdown-item:focus { background: var(--health-primary-light); color: var(--health-text); }
.pub-profile-menu .dropdown-item.active { background: color-mix(in srgb, var(--health-primary) 18%, var(--health-surface)); color: var(--health-text); }
.pub-profile-menu .dropdown-divider { margin: 0.3rem 0; border-color: var(--health-border); }
.pub-profile-sub { margin-left: auto; font-size: 0.7rem; font-weight: 600; color: var(--health-text-muted); }
.pub-profile-logout, .pub-profile-logout .bi { color: var(--health-error) !important; }
.pub-profile-langs, .pub-profile-menu form { margin: 0; }

/* =======================================================================
   Patient portal overview (/portal/) — "pp-" classes
   A colourful overview: welcome banner, three number cards, a hospital
   strip and one tile per section of the record. Every coloured element reads
   --tone, set by data-tone from the same palette the public site uses.
   ======================================================================= */
[data-tone="rose"]   { --tone: #E0426B; }
[data-tone="amber"]  { --tone: #E0A800; }
[data-tone="orange"] { --tone: #E8543A; }
[data-tone="violet"] { --tone: #7B5EA7; }
[data-tone="sky"]    { --tone: #3A93C4; }
[data-tone="teal"]   { --tone: #2FA89F; }
[data-tone="blue"]   { --tone: #2F7BA6; }
[data-tone="green"]  { --tone: #3E9B5A; }
[data-tone="coral"]  { --tone: #E8543A; }

.pp-hero {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  flex-wrap: wrap;
  margin-bottom: 1.1rem;
  padding: 1.3rem 1.5rem;
  border-radius: 1.4rem;
  background:
    radial-gradient(circle at 92% 0%, rgba(242, 181, 68, 0.45), transparent 45%),
    radial-gradient(circle at 0% 100%, rgba(255, 255, 255, 0.14), transparent 50%),
    linear-gradient(135deg, var(--health-primary), color-mix(in srgb, var(--health-primary) 60%, #000));
  color: #fff;
  box-shadow: 0 20px 34px -22px var(--health-primary);
}
.pp-avatar {
  display: grid;
  place-items: center;
  flex: none;
  width: 4rem;
  height: 4rem;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.45);
  font-family: var(--font-display);
  font-size: 1.7rem;
  font-weight: 800;
}
.pp-hero-text { flex: 1 1 14rem; min-width: 0; }
.pp-hello { margin: 0; font-size: 0.78rem; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; opacity: 0.85; }
.pp-name { margin: 0.1rem 0 0.5rem; font-family: var(--font-display); font-size: 1.55rem; font-weight: 800; line-height: 1.2; color: #fff; }
.pp-ids { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.pp-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.2rem 0.7rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  font-size: 0.74rem;
  font-weight: 600;
}
.pp-chip .bi { color: #F2B544; }

/* The coloured icon tile used everywhere on this page. */
.pp-ic {
  /* Inherits --tone from the card it sits in (or its own data-tone). */
  display: grid;
  place-items: center;
  flex: none;
  width: 2.8rem;
  height: 2.8rem;
  border-radius: 0.9rem;
  background: linear-gradient(145deg, color-mix(in srgb, var(--tone, var(--health-primary)) 70%, #fff), var(--tone, var(--health-primary)));
  color: #fff;
  font-size: 1.35rem;
  box-shadow: 0 8px 14px -8px var(--tone, var(--health-primary));
}
[data-tone="amber"] > .pp-ic, [data-tone="amber"].pp-ic { color: #2a1a00; }
.pp-ic-lg { width: 3.2rem; height: 3.2rem; font-size: 1.5rem; }

.pp-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: 0.9rem; margin-bottom: 1.1rem; }
.pp-stat {
  --tone: var(--health-primary);
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.9rem 1rem;
  border: 1px solid color-mix(in srgb, var(--tone) 28%, var(--health-border));
  border-radius: 1.1rem;
  background: linear-gradient(160deg, color-mix(in srgb, var(--tone) 14%, var(--health-surface)), color-mix(in srgb, var(--tone) 5%, var(--health-surface)));
}
.pp-stat-num { font-family: var(--font-display); font-size: 1.5rem; font-weight: 800; line-height: 1.1; color: var(--health-text); }
.pp-stat-label { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--health-text-muted); }

.pp-note {
  --tone: #3A93C4;
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  border: 1px solid color-mix(in srgb, var(--tone) 35%, var(--health-border));
  border-left: 5px solid var(--tone);
  border-radius: 0.9rem;
  background: color-mix(in srgb, var(--tone) 10%, var(--health-surface));
  font-size: 0.84rem;
  line-height: 1.45;
  color: var(--health-text);
}
.pp-note > .bi { margin-top: 0.1rem; font-size: 1.15rem; color: var(--tone); }
.pp-note-danger { --tone: #E0426B; }
.pp-note-warn { --tone: #E0A800; }
.pp-note-link { margin-left: 0.4rem; font-weight: 800; color: var(--tone); }

.pp-hospital {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  flex-wrap: wrap;
  margin-bottom: 1.4rem;
  padding: 0.85rem 1.1rem;
  border: 1px solid var(--health-border);
  border-radius: 1.1rem;
  background: var(--health-surface-card);
  box-shadow: var(--health-shadow-sm);
}
.pp-hospital > div:nth-child(2) { flex: 1; }
.pp-hospital-name { font-size: 0.98rem; font-weight: 800; color: var(--health-navy); }
.pp-btn-soft {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.9rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--health-primary) 12%, var(--health-surface));
  color: var(--health-primary) !important;
  font-size: 0.8rem;
  font-weight: 800;
  text-decoration: none;
}
.pp-btn-soft:hover { background: color-mix(in srgb, var(--health-primary) 22%, var(--health-surface)); }

.pp-section-title { margin: 0 0 0.75rem; font-family: var(--font-display); font-size: 1.15rem; font-weight: 800; color: var(--health-navy); }
.pp-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr)); gap: 0.9rem; }
.pp-tile {
  --tone: var(--health-primary);
  position: relative;
  display: grid;
  gap: 0.15rem;
  padding: 1rem;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--tone) 26%, var(--health-border));
  border-radius: 1.1rem;
  background: linear-gradient(165deg, color-mix(in srgb, var(--tone) 13%, var(--health-surface)), color-mix(in srgb, var(--tone) 4%, var(--health-surface)));
  color: var(--health-text) !important;
  text-decoration: none;
  transition: transform 0.18s, box-shadow 0.18s, border-color 0.18s;
}
.pp-tile::after {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  background: var(--tone);
}
.pp-tile:hover { transform: translateY(-3px); border-color: var(--tone); box-shadow: 0 16px 24px -16px var(--tone); }
.pp-tile .pp-ic { margin-bottom: 0.5rem; }
.pp-tile b { font-size: 0.98rem; color: var(--health-navy); }
.pp-tile > span:last-child { font-size: 0.78rem; line-height: 1.35; color: var(--health-text-muted); }
@media (max-width: 767.98px) {
  .pp-stats { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .pp-tile, .pp-tile:hover { transition: none; transform: none; }
}

/* Coloured icons in the portal's section row, one hue per section. */
.pp-nav-ic { margin-right: 0.35rem; font-size: 0.95rem; }
.btn-primary .pp-nav-ic { color: #fff !important; }

/* The tone map again, one step more specific than the classes above that
   declare a default --tone (same specificity would let their later position win). */
.pp-stat[data-tone="rose"], .pp-tile[data-tone="rose"], .pp-ic[data-tone="rose"] { --tone: #E0426B; }
.pp-stat[data-tone="amber"], .pp-tile[data-tone="amber"], .pp-ic[data-tone="amber"] { --tone: #E0A800; }
.pp-stat[data-tone="orange"], .pp-tile[data-tone="orange"], .pp-ic[data-tone="orange"] { --tone: #E8543A; }
.pp-stat[data-tone="violet"], .pp-tile[data-tone="violet"], .pp-ic[data-tone="violet"] { --tone: #7B5EA7; }
.pp-stat[data-tone="sky"], .pp-tile[data-tone="sky"], .pp-ic[data-tone="sky"] { --tone: #3A93C4; }
.pp-stat[data-tone="teal"], .pp-tile[data-tone="teal"], .pp-ic[data-tone="teal"] { --tone: #2FA89F; }
.pp-stat[data-tone="blue"], .pp-tile[data-tone="blue"], .pp-ic[data-tone="blue"] { --tone: #2F7BA6; }
.pp-stat[data-tone="green"], .pp-tile[data-tone="green"], .pp-ic[data-tone="green"] { --tone: #3E9B5A; }
.pp-stat[data-tone="coral"], .pp-tile[data-tone="coral"], .pp-ic[data-tone="coral"] { --tone: #E8543A; }

/* The portal's section row: every button the same height and width rhythm, so
   the Book button lines up with the links beside it, and eight links plus the
   button fit on one line at the page's width. */
.pp-navrow .btn-sm {
  display: inline-flex;
  align-items: center;
  min-height: 2rem;
  padding: 0.25rem 0.45rem;
  font-size: 0.78rem;
  white-space: nowrap;
}
.pp-navrow .pp-nav-ic { margin-right: 0.25rem; font-size: 0.85rem; }
.pp-navrow .container > div { gap: 0.2rem !important; }

/* The Book Appointment button in the section row: the same gold pill as the
   overview banner's, so the site's one primary call to action looks the same
   wherever it appears. Same 2rem height as the links beside it, right-aligned. */
.pp-book-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  height: 2rem;
  padding: 0 0.9rem;
  border-radius: 999px;
  background: linear-gradient(135deg, #F2B544, #E89B1A);
  color: #2a1a00 !important;
  font-size: 0.8rem;
  font-weight: 800;
  white-space: nowrap;
  text-decoration: none;
  box-shadow: 0 8px 14px -9px rgba(232, 155, 26, 0.9);
  transition: transform 0.18s, box-shadow 0.18s;
}
.pp-book-btn:hover { transform: translateY(-1px); box-shadow: 0 12px 18px -10px rgba(232, 155, 26, 0.95); }
@media (prefers-reduced-motion: reduce) { .pp-book-btn, .pp-book-btn:hover { transition: none; transform: none; } }

/* =======================================================================
   Portal section pages (appointments, visits, diagnoses, medical history,
   prescriptions, reports, documents)
   One shape for all seven: a coloured header, then rows with an icon tile,
   text, pills and one action. The wrapper's data-tone is that section's hue —
   the same one its tile has on the overview.
   ======================================================================= */
.pp-page-head {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  margin-bottom: 1.1rem;
  padding: 0.9rem 1.1rem;
  border: 1px solid color-mix(in srgb, var(--tone, var(--health-primary)) 30%, var(--health-border));
  border-radius: 1.2rem;
  background:
    radial-gradient(circle at 96% 0%, color-mix(in srgb, var(--tone, var(--health-primary)) 24%, transparent), transparent 50%),
    linear-gradient(135deg, color-mix(in srgb, var(--tone, var(--health-primary)) 14%, var(--health-surface)), color-mix(in srgb, var(--tone, var(--health-primary)) 4%, var(--health-surface)));
}
.pp-page-title { margin: 0; font-family: var(--font-display); font-size: 1.35rem; font-weight: 800; line-height: 1.2; color: var(--health-navy); }
.pp-page-sub { margin: 0.1rem 0 0; font-size: 0.82rem; color: var(--health-text-muted); }
.pp-count {
  margin-left: auto;
  min-width: 2.2rem;
  padding: 0.2rem 0.7rem;
  border-radius: 999px;
  background: var(--tone, var(--health-primary));
  color: #fff;
  font-size: 0.9rem;
  font-weight: 800;
  text-align: center;
}
[data-tone="amber"] .pp-count { color: #2a1a00; }
.pp-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1rem; }

.pp-list { display: grid; gap: 0.65rem; margin: 0 0 1.4rem; padding: 0; list-style: none; }
.pp-row {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.8rem 1rem;
  border: 1px solid var(--health-border);
  border-left: 5px solid var(--tone, var(--health-primary));
  border-radius: 1rem;
  background: var(--health-surface-card);
  box-shadow: var(--health-shadow-xs);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.pp-row:hover { border-color: color-mix(in srgb, var(--tone, var(--health-primary)) 55%, var(--health-border)); box-shadow: 0 10px 18px -14px var(--tone, var(--health-primary)); }
.pp-row .pp-ic { width: 2.5rem; height: 2.5rem; font-size: 1.2rem; }
.pp-row-main { flex: 1; min-width: 0; }
.pp-row-title { font-size: 0.95rem; font-weight: 800; color: var(--health-navy); }
.pp-row-plain { font-weight: 600; color: var(--health-text); margin-top: 0.15rem; }
.pp-row-sub { margin-top: 0.1rem; font-size: 0.8rem; line-height: 1.4; color: var(--health-text-muted); }
.pp-row-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; flex-shrink: 0; }
.pp-pills { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-top: 0.4rem; }
.pp-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin-left: 0.2rem;
  padding: 0.1rem 0.6rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--tone, var(--health-primary)) 15%, var(--health-surface));
  color: color-mix(in srgb, var(--tone, var(--health-primary)) 62%, #000);
  font-size: 0.72rem;
  font-weight: 800;
  white-space: nowrap;
}
.pp-pills .pp-pill { margin-left: 0; }
/* The pill's text is its tone mixed toward black, which is unreadable on a dark
   surface (a teal chip on navy): mix toward white there instead. */
:root[data-bs-theme="dark"] .pp-pill:not(.pp-pill-danger):not(.pp-pill-warn):not(.pp-pill-muted) {
  color: color-mix(in srgb, var(--tone, var(--health-primary)) 55%, #fff);
}
:root[data-bs-theme="dark"] .pp-btn-line { color: color-mix(in srgb, var(--tone, var(--health-primary)) 55%, #fff) !important; }
@media (prefers-color-scheme: dark) {
  :root:not([data-bs-theme="light"]) .pp-btn-line { color: color-mix(in srgb, var(--tone, var(--health-primary)) 55%, #fff) !important; }
}
@media (prefers-color-scheme: dark) {
  :root:not([data-bs-theme="light"]) .pp-pill:not(.pp-pill-danger):not(.pp-pill-warn):not(.pp-pill-muted) {
    color: color-mix(in srgb, var(--tone, var(--health-primary)) 55%, #fff);
  }
}
.pp-pill-danger { background: color-mix(in srgb, #E0426B 16%, var(--health-surface)); color: #B3274B; }
.pp-pill-warn { background: color-mix(in srgb, #E0A800 20%, var(--health-surface)); color: #8a6500; }
.pp-pill-muted { background: var(--health-surface-alt); color: var(--health-text-muted); }

.pp-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
  height: 2.1rem;
  padding: 0 0.95rem;
  /* White text on the bare accent colour is only about 3:1 on the teal, sky and orange pages; a quarter darker is
     5:1 or better on all of them. Amber keeps its full fill and dark text, below. */
  --pp-fill: color-mix(in srgb, var(--tone, var(--health-primary)) 74%, #000);
  border: 2px solid var(--pp-fill);
  border-radius: 999px;
  background: var(--pp-fill);
  color: #fff !important;
  font-size: 0.8rem;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
  transition: transform 0.15s, box-shadow 0.15s;
}
.pp-btn:hover { transform: translateY(-1px); box-shadow: 0 10px 16px -10px var(--tone, var(--health-primary)); }
[data-tone="amber"] .pp-btn:not(.pp-btn-line) { --pp-fill: var(--tone); color: #2a1a00 !important; }
.pp-btn-line { border-color: var(--tone, var(--health-primary)); background: transparent; color: color-mix(in srgb, var(--tone, var(--health-primary)) 78%, #000) !important; }
.pp-btn-line:hover { background: color-mix(in srgb, var(--tone, var(--health-primary)) 12%, var(--health-surface)); }

.pp-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.7rem;
  padding: 1.6rem 1rem;
  border: 2px dashed color-mix(in srgb, var(--tone, var(--health-primary)) 35%, var(--health-border));
  border-radius: 1rem;
  background: color-mix(in srgb, var(--tone, var(--health-primary)) 5%, var(--health-surface));
  font-size: 0.88rem;
  color: var(--health-text-muted);
  text-align: center;
}
.pp-empty .bi { font-size: 1.5rem; color: var(--tone, var(--health-primary)); }
.pp-empty a { font-weight: 800; color: color-mix(in srgb, var(--tone, var(--health-primary)) 78%, #000); }

.pp-panel-title {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0.4rem 0 0.7rem;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--health-navy);
}
.pp-panel-title .pp-ic { width: 2rem; height: 2rem; border-radius: 0.65rem; font-size: 1rem; }
.pp-page .pp-book-btn { height: 2.2rem; padding: 0 1.1rem; }
@media (max-width: 575.98px) {
  .pp-row { flex-wrap: wrap; }
  .pp-row .pp-btn, .pp-row-actions { width: 100%; }
  .pp-row .pp-btn { justify-content: center; }
}
@media (prefers-reduced-motion: reduce) {
  .pp-row, .pp-btn, .pp-btn:hover { transition: none; transform: none; }
}

/* Avatars that carry a photo, and the profile page. */
.pub-profile-avatar { overflow: hidden; }
.pub-profile-avatar img, .pp-avatar img { width: 100%; height: 100%; object-fit: cover; }
.pp-avatar { overflow: hidden; color: #fff; text-decoration: none; }
.pp-avatar-xl { width: 7rem; height: 7rem; font-size: 2.8rem; background: linear-gradient(135deg, var(--health-primary), var(--health-secondary)); box-shadow: 0 0 0 4px color-mix(in srgb, var(--health-primary) 22%, transparent); }
.pp-profile-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.pp-card { padding: 1.1rem 1.2rem; border: 1px solid var(--health-border); border-radius: 1.1rem; background: var(--health-surface-card); box-shadow: var(--health-shadow-sm); }
.pp-photo-row { display: flex; align-items: flex-start; gap: 1.1rem; flex-wrap: wrap; }
.pp-photo-forms { flex: 1 1 14rem; min-width: 0; }
.pp-help { margin-top: 0.35rem; font-size: 0.76rem; line-height: 1.4; color: var(--health-text-muted); }
.pp-name-readonly { margin: 0 0 0.3rem; font-size: 1.05rem; font-weight: 800; color: var(--health-navy); }
.pp-facts { display: grid; gap: 0.5rem; margin: 1rem 0 0; padding-top: 0.8rem; border-top: 1px solid var(--health-border); }
.pp-facts dt { font-size: 0.66rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--health-text-muted); }
.pp-facts dd { margin: 0; font-size: 0.88rem; font-weight: 700; }
/* A record table (visit history): same card surface, tone and hairlines as the
   rows above, so a list that grows over the years stays scannable. */
.pp-table-wrap { overflow-x: auto; border: 1px solid var(--health-border); border-top: 5px solid var(--tone, var(--health-primary)); border-radius: 1rem; background: var(--health-surface-card); box-shadow: var(--health-shadow-xs); }
.pp-table { width: 100%; border-collapse: collapse; font-size: 0.86rem; color: var(--health-text); }
.pp-table th { padding: 0.7rem 1rem; text-align: left; font-size: 0.68rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--health-text-muted); border-bottom: 1px solid var(--health-border); white-space: nowrap; }
.pp-table td { padding: 0.7rem 1rem; vertical-align: middle; border-bottom: 1px solid var(--health-border); }
.pp-table tbody tr:last-child td { border-bottom: 0; }
.pp-table tbody tr:hover { background: color-mix(in srgb, var(--tone, var(--health-primary)) 7%, var(--health-surface-card)); }
.pp-table-date { font-weight: 800; color: var(--health-navy); white-space: nowrap; }
.pp-table-muted { color: var(--health-text-muted); }
/* Row actions: one line, one small size, so the buttons line up down the column
   however long the neighbouring cells run. */
.pp-table td .pp-row-actions { flex-wrap: nowrap; justify-content: flex-end; gap: 0.35rem; }
.pp-table td .pp-btn { height: 1.75rem; padding: 0 0.7rem; font-size: 0.72rem; gap: 0.3rem; }
.pp-table td.font-monospace, .pp-table td .font-monospace { white-space: nowrap; font-size: 0.78rem; }
.pp-table td:last-child { white-space: nowrap; }
.pp-card-stack { display: grid; gap: 1rem; margin-bottom: 1.4rem; }
.pp-form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 0.9rem 1.1rem; }
.pp-form-grid .pp-form-wide { grid-column: 1 / -1; }
.pp-facts-text dd { font-weight: 500; white-space: pre-wrap; }
.pp-plain-list { display: grid; gap: 0.7rem; margin: 0; padding: 0; list-style: none; }
.pp-plain-list li + li { padding-top: 0.7rem; border-top: 1px solid var(--health-border); }
.pp-profile-grid .pp-card-wide { grid-column: 1 / -1; }
.pp-facts-grid { grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr)); border-top: 0; padding-top: 0; margin-top: 0.4rem; }
.pp-facts-grid .pp-fact-wide { grid-column: 1 / -1; }
@media (max-width: 767.98px) { .pp-profile-grid { grid-template-columns: 1fr; } }

/* The signed-in portal's two bars (account bar + section row) as one sticky
   block, with the same frosted look as the public site's menu. */
.pp-sticky {
  position: sticky;
  top: 0;
  z-index: 1030;
  background-color: color-mix(in srgb, var(--health-surface) 82%, transparent);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  backdrop-filter: blur(14px) saturate(160%);
  box-shadow: 0 8px 22px -18px rgba(18, 59, 93, 0.5);
}
.pp-sticky .app-topbar, .pp-sticky .pp-navrow { background-color: transparent !important; }

/* Appointment count: a linked stat card ("upcoming / total") and a badge on
   the Appointments tile. */
.pp-stat-link { color: inherit; text-decoration: none; transition: transform 0.18s, box-shadow 0.18s; }
.pp-stat-link:hover { transform: translateY(-2px); box-shadow: 0 14px 22px -16px var(--tone, var(--health-primary)); }
.pp-stat-of { font-size: 0.85rem; font-weight: 700; color: var(--health-text-muted); }
.pp-tile-count {
  position: absolute;
  top: 0.9rem;
  right: 0.9rem;
  min-width: 1.7rem;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  background: var(--tone, var(--health-primary));
  color: #fff;
  font-size: 0.78rem;
  font-weight: 800;
  text-align: center;
}
@media (prefers-reduced-motion: reduce) { .pp-stat-link, .pp-stat-link:hover { transition: none; transform: none; } }

/* "Home" in the portal's account bar: back to the public site. */
.pp-home-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  height: 2.2rem;
  padding: 0 0.85rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--health-primary) 12%, var(--health-surface));
  color: var(--health-primary) !important;
  font-size: 0.82rem;
  font-weight: 800;
  text-decoration: none;
  transition: background-color 0.15s;
}
.pp-home-link:hover { background: color-mix(in srgb, var(--health-primary) 22%, var(--health-surface)); }

/* =======================================================================
   Numbered pager (public lists): Previous, 1 2 3 … 40, Next
   ======================================================================= */
.pub-pager { display: grid; justify-items: center; gap: 0.6rem; margin-top: 1.75rem; }
.pub-pager-range { margin: 0; font-size: 0.8rem; font-weight: 600; color: var(--health-text-muted); }
.pub-pager-list { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 0.35rem; margin: 0; padding: 0; list-style: none; }
.pub-pager-link, .pub-pager-gap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  min-width: 2.2rem;
  height: 2.2rem;
  padding: 0 0.6rem;
  border-radius: 0.7rem;
  font-size: 0.85rem;
  font-weight: 700;
  text-decoration: none;
}
.pub-pager-link {
  border: 1.5px solid var(--health-border);
  background: var(--health-surface);
  color: var(--health-text) !important;
  transition: background-color 0.15s, border-color 0.15s, transform 0.15s;
}
a.pub-pager-link:hover { border-color: var(--health-primary); background: var(--health-primary-light); transform: translateY(-1px); }
.pub-pager-link.is-current { border-color: var(--health-primary); background: var(--health-primary); color: #fff !important; box-shadow: 0 8px 14px -9px var(--health-primary); }
.pub-pager-link.is-disabled { opacity: 0.45; cursor: not-allowed; }
.pub-pager-step { padding: 0 0.8rem; }
.pub-pager-gap { min-width: 1.4rem; padding: 0; color: var(--health-text-muted); }
@media (max-width: 575.98px) {
  .pub-pager-link, .pub-pager-gap { min-width: 2rem; height: 2rem; padding: 0 0.4rem; font-size: 0.8rem; }
}
@media (prefers-reduced-motion: reduce) { .pub-pager-link, a.pub-pager-link:hover { transition: none; transform: none; } }

/* A select keeps room on the right for its arrow. The compact-controls rule
   above set a flat horizontal padding and, in doing so, let the language
   switcher's text run under its arrow. */
.pub-page .form-select { padding-right: 2.1rem; }
.pub-page .form-select-sm { padding-right: 1.9rem; }
.pub-header .form-select-sm { padding-left: 0.4rem; min-width: 5.6rem; }

/* The speciality card on a doctor's profile is the wide one: a doctor can hold
   several specialities ("Gynecologist & Obstetrician, Gynaecological
   Oncology"), so it spans two columns and wraps its text instead of cutting it
   off or letting it run out of the card. */
.pub-prof-stats { grid-template-columns: 2fr 1fr 1fr 1fr; }
.pub-prof-stat { overflow: hidden; }
.pub-prof-stat-wide dd { overflow-wrap: anywhere; font-size: 1.02rem; }
@media (max-width: 991.98px) {
  .pub-prof-stats { grid-template-columns: repeat(2, 1fr); }
  .pub-prof-stat-wide { grid-column: 1 / -1; }
}

/* Doctor profile: rating + patients visited */
.pub-prof-trust { grid-template-columns: 1fr 1fr; }
.pub-stars { color: #E0A800; letter-spacing: 0.08em; white-space: nowrap; }
.pub-prof-sub { font-family: var(--font-body, inherit); font-size: 0.74rem; font-weight: 600; color: var(--health-text-muted); }
.pub-prof-none { font-size: 0.95rem !important; font-weight: 700 !important; color: var(--health-text-muted) !important; }
.pub-rate { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.9rem; }
.pub-rate-stars { display: inline-flex; flex-direction: row-reverse; gap: 0.1rem; }
.pub-rate-stars input { position: absolute; opacity: 0; pointer-events: none; }
.pub-rate-stars label { padding: 0.15rem; font-size: 1.6rem; line-height: 1; color: var(--health-border, #c9d3dc); cursor: pointer; transition: color 0.12s; }
.pub-rate-stars label:hover, .pub-rate-stars label:hover ~ label, .pub-rate-stars input:checked ~ label { color: #E0A800; }
.pub-rate-stars input:focus-visible + label { outline: 2px solid #1B7BB0; outline-offset: 2px; border-radius: 0.4rem; }
@media (prefers-reduced-motion: reduce) { .pub-rate-stars label { transition: none; } }

/* The room — the one fact a patient needs on arrival, so it gets a callout. */
.pub-opd-facts .pub-opd-where { padding: 0.5rem 0.7rem; border-radius: 0.6rem; background: color-mix(in srgb, var(--health-primary, #1e5fa8) 10%, transparent); border: 1px dashed color-mix(in srgb, var(--health-primary, #1e5fa8) 45%, transparent); }
.pub-opd-facts .pub-opd-where dd { font-size: 1rem; }

/* =======================================================================
   Contrast pass (Ward Round redesign)

   Measured on the public landing page: muted/label text sat at 2.6–4.5:1 and
   white text on the bright division/step tones at 2.4–4.2:1. Tokens are
   darkened here rather than at their definitions so the pass is one block.
   ======================================================================= */
:root {
  --health-text-muted: #55657A;   /* 4.48 → 5.4 on the page ground */
  --health-text-light: #5F6F83;   /* field labels were 2.56 */
}
:root[data-bs-theme="dark"] { --health-text-light: #8DA0B8; }
@media (prefers-color-scheme: dark) {
  :root:not([data-bs-theme="light"]) { --health-text-light: #8DA0B8; }
}
.pub-topbar-badge { background-color: var(--health-primary-hover); }
/* Teal text on the dark ground measured 3.2:1; the fill teal stays for buttons. */
:root[data-bs-theme="dark"] :is(.pub-brand-sub, .pub-section-eyebrow, .pub-hero-badge, .pub-hero-badge span) { color: #4FC3CF; }
@media (prefers-color-scheme: dark) {
  :root:not([data-bs-theme="light"]) :is(.pub-brand-sub, .pub-section-eyebrow, .pub-hero-badge, .pub-hero-badge span) { color: #4FC3CF; }
}
/* Tones carry white text: each is deep enough for ≥4.5:1. */
.pub-div-card:nth-child(8n+1) { --tone: #137A72; }
.pub-div-card:nth-child(8n+2) { --tone: #B45309; }
.pub-div-card:nth-child(8n+3) { --tone: #B93A26; }
.pub-div-card:nth-child(8n+6) { --tone: #2F7D4F; }
.pub-div-card:nth-child(8n+7) { --tone: #B83265; }
.pub-ribbon[data-tone="rose"] { --tone: #C2345C; }
.pub-ribbon[data-tone="teal"] { --tone: #137A72; }
/* The kicker is text on the card surface, so it takes a darker mix of the tone
   (lighter in dark theme) instead of the fill colour itself. */
.pub-ribbon-kicker { color: color-mix(in srgb, var(--tone) 55%, #0b1b24); }
:root[data-bs-theme="dark"] .pub-ribbon-kicker { color: color-mix(in srgb, var(--tone) 55%, #fff); }
@media (prefers-color-scheme: dark) {
  :root:not([data-bs-theme="light"]) .pub-ribbon-kicker { color: color-mix(in srgb, var(--tone) 55%, #fff); }
}
/* Yellow button: Bootstrap's dark label was overridden to white somewhere upstream. */
.pub-section .btn-warning {
  --bs-btn-color: #2a1a00; --bs-btn-hover-color: #2a1a00; --bs-btn-active-color: #2a1a00;
}
/* `bg-warning` resolves to the brown --amber token here; its label is text-dark. */
.pub-section .badge.bg-warning { --bs-warning-rgb: 245, 179, 1; }
.pub-section .badge.bg-warning { color: #2a1a00 !important; }  /* dark theme turns text-dark light */
.pub-stat-chip { color: var(--health-primary-hover); }
.badge.text-success { color: #176A41 !important; }
/* Dark theme: the teal/green used as text is the fill value and measured 2.6–3.4:1. */
:root[data-bs-theme="dark"] .text-primary,
:root[data-bs-theme="dark"] .pub-stat-chip { color: #4FC3CF !important; }
:root[data-bs-theme="dark"] .pub-slot-count { color: #5FCB94; }
@media (prefers-color-scheme: dark) {
  :root:not([data-bs-theme="light"]) .text-primary,
  :root:not([data-bs-theme="light"]) .pub-stat-chip { color: #4FC3CF !important; }
  :root:not([data-bs-theme="light"]) .pub-slot-count { color: #5FCB94; }
}


/* Compact facility card (hospital directory): about half the height of a full card,
   so four fit across and a page of results needs far less scrolling. */
.pub-card-compact { padding: 0.7rem 0.8rem; border-radius: 0.8rem; }
.pub-card-compact .pub-doctor-photo,
.pub-card-compact .pub-doctor-initial { width: 2.4rem; height: 2.4rem; font-size: 1.05rem; }
.pub-card-compact .pub-card-title { font-size: 0.8rem; line-height: 1.25; }
.pub-card-compact .pub-card-sub { font-size: 0.74rem; line-height: 1.35; }
.pub-card-compact .pub-stat-chip,
.pub-card-compact .pub-spec-chip { padding: 0.12rem 0.5rem; font-size: 0.7rem; }
.pub-card-compact .pub-btn-sm { min-height: 30px; padding: 0.25rem 0.7rem; font-size: 0.76rem; }

/* The status rail (see the staff app): a 5px bar on the card's left edge that carries
   availability. The status is also written on the card, so colour is never the only signal. */
.pub-rail { position: relative; padding-left: 1.1rem; }
.pub-rail::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 5px; border-radius: 0.8rem 0 0 0.8rem; background: var(--line); }
.pub-rail-available::before { background: var(--bs-success); }
.pub-rail-busy::before { background: var(--amber); }

/* ---- Public ambulance page: map and frosted-glass cards ------------------------------
   Reviewed as design/ambulance-cards-draft.html. The glass needs something behind it, so
   the results sit on a soft pastel field. Text colours are chosen for 4.5:1 on the tints
   in both themes; availability is always written as well as coloured. */
.amb-glass {
  --g-ink: #12262B; --g-muted: #3F5560; --g-glass: rgba(255,255,255,.55); --g-edge: rgba(255,255,255,.85);
  --g-chip: rgba(255,255,255,.92); --g-pill: var(--health-primary-hover); --g-pill-ink: #fff; --g-tile: #2A3F8F;
  --g-ok: #1F7A4D; --g-wait: #8A5A00; --g-off: #5B6B72;
  --g-basic: rgba(190,205,255,.55); --g-advanced: rgba(255,200,190,.6); --g-neonatal: rgba(222,200,255,.6);
  --g-transport: rgba(200,240,205,.6); --g-freezer: rgba(205,225,240,.65); --g-water: rgba(190,236,235,.65);
  padding: 1rem; border-radius: 1.4rem;
  background:
    radial-gradient(40rem 24rem at 0% 0%, #c9d3f0, transparent 60%),
    radial-gradient(40rem 24rem at 100% 0%, #cfe9e8, transparent 60%),
    radial-gradient(40rem 24rem at 60% 100%, #d8f0dc, transparent 60%), #e4eef0;
}
[data-bs-theme="dark"] .amb-glass {
  --g-ink: #EAF2F3; --g-muted: #B7C8CC; --g-glass: rgba(20,32,38,.55); --g-edge: rgba(255,255,255,.16);
  --g-chip: rgba(255,255,255,.12); --g-pill: var(--health-secondary); --g-pill-ink: #0C273E; --g-tile: #D6DEFF;
  --g-ok: #66D19E; --g-wait: #F2C14E; --g-off: #A9BABE;
  --g-basic: rgba(80,100,190,.35); --g-advanced: rgba(190,80,65,.35); --g-neonatal: rgba(130,90,200,.35);
  --g-transport: rgba(60,150,90,.35); --g-freezer: rgba(90,130,160,.38); --g-water: rgba(40,150,150,.38);
  background:
    radial-gradient(40rem 24rem at 0% 0%, #1a2340, transparent 60%),
    radial-gradient(40rem 24rem at 100% 0%, #12302f, transparent 60%),
    radial-gradient(40rem 24rem at 60% 100%, #16301f, transparent 60%), #101a1d;
}
.amb-card-glass {
  --tint: var(--g-basic); display: flex; flex-direction: column; gap: .55rem; height: 100%; min-height: 14rem;
  padding: 1rem 1.05rem 1.05rem; border-radius: 1.3rem; color: var(--g-ink);
  background: linear-gradient(160deg, var(--tint), var(--g-glass) 75%); border: 1px solid var(--g-edge);
  box-shadow: 0 8px 26px rgba(30,50,80,.12), inset 0 1px 0 rgba(255,255,255,.5);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); transition: transform .15s ease, box-shadow .15s ease;
}
.amb-card-glass:hover { transform: translateY(-2px); box-shadow: 0 12px 32px rgba(30,50,80,.18), inset 0 1px 0 rgba(255,255,255,.5); }
.amb-card-glass[data-kind="advanced"] { --tint: var(--g-advanced); }
.amb-card-glass[data-kind="neonatal"] { --tint: var(--g-neonatal); }
.amb-card-glass[data-kind="transport"] { --tint: var(--g-transport); }
.amb-card-glass[data-kind="freezer"] { --tint: var(--g-freezer); }
.amb-card-glass[data-kind="water"] { --tint: var(--g-water); }
.amb-card-glass.is-off { filter: saturate(.6); }
.amb-card-top { display: flex; align-items: center; gap: .5rem; }
.amb-card-tile, .amb-card-status { height: 2.5rem; border-radius: .8rem; background: var(--g-chip); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.amb-card-tile { width: 2.5rem; display: grid; place-items: center; font-size: 1.2rem; color: var(--g-tile); }
.amb-card-status { display: inline-flex; align-items: center; gap: .4rem; padding: 0 .8rem; font-size: .8rem; font-weight: 600; }
.amb-card-dot { width: .6rem; height: .6rem; border-radius: 50%; background: var(--g-off); }
.amb-card-status-available .amb-card-dot { background: var(--g-ok); }
.amb-card-status-busy .amb-card-dot { background: var(--g-wait); }
.amb-card-title { margin: .45rem 0 0; font-size: 1rem; line-height: 1.2; font-weight: 700; }
.amb-card-desc { margin: 0; color: var(--g-muted); font-size: .85rem; line-height: 1.4; }
.amb-card-verified { margin: 0; display: inline-flex; align-items: center; gap: .3rem; color: var(--g-ok); font-size: .78rem; font-weight: 700; }
.amb-card-chips { display: flex; flex-wrap: wrap; gap: .3rem; }
.amb-card-chips span { --pc: var(--health-navy); display: inline-flex; align-items: center; gap: .25rem; padding: .08rem .5rem; border: 1px solid var(--pc); border-radius: 1rem; background: var(--g-chip); color: var(--pc); font-size: .68rem; font-weight: 600; line-height: 1.5; }
.amb-card-chips span .bi { font-size: .7rem; }
/* Brand family only (portal --health-* tokens); the words and icons tell the three apart, colour is a light cue. */
.amb-card-chips span[data-chip="24h"] { --pc: var(--health-navy); }
.amb-card-chips span[data-chip="oxygen"] { --pc: var(--health-primary-hover); }
.amb-card-chips span[data-chip="ventilator"] { --pc: color-mix(in srgb, var(--health-secondary) 65%, #000); }
[data-bs-theme="dark"] .amb-card-chips span { color: var(--g-ink); border-color: color-mix(in srgb, var(--pc) 45%, #fff); }
.amb-card-foot { margin-top: auto; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem; }
.amb-card-dist { display: inline-flex; align-items: center; gap: .3rem; font-size: .78rem; color: var(--g-muted); }
.amb-card-call { display: inline-flex; align-items: center; gap: .35rem; margin-left: auto; padding: .28rem .75rem; border-radius: 2rem; background: var(--g-pill); color: var(--g-pill-ink); font-size: .78rem; font-weight: 600; text-decoration: none; font-variant-numeric: tabular-nums; }
.amb-card-num { font-family: var(--font-mono); }
.amb-card-call:hover { color: var(--g-pill-ink); opacity: .9; }
.amb-card-alt { align-self: flex-end; color: var(--g-muted); font-size: .78rem; font-variant-numeric: tabular-nums; }
@media (prefers-reduced-motion: reduce) { .amb-card-glass { transition: none; } .amb-card-glass:hover { transform: none; } }
@media (prefers-reduced-transparency: reduce) { .amb-card-glass { -webkit-backdrop-filter: none; backdrop-filter: none; background: var(--tint); } }

/* A long public form (ambulance registration): three fields to a row and tighter chrome, so it
   fits a short screen like the compact login card does. Control size stays readable. */
.pub-searchcard-compact { padding: 1.1rem 1.25rem; margin-bottom: 1.5rem; }
.pub-searchcard-compact .pub-field-label { margin-bottom: 0.2rem; font-size: 0.74rem; }
:lang(bn) .pub-searchcard-compact .pub-field-label { font-size: 0.82rem; }
.pub-searchcard-compact .form-control,
.pub-searchcard-compact .form-select { min-height: 2.3rem; }
.pub-searchcard-compact textarea.form-control { min-height: 2.3rem; resize: vertical; }

/* Filters for a list that lasts a lifetime (documents, reports): a search row, category chips with counts, and a
   divider row per year in the table. Tokens only, so light and dark both work. */
.pp-filter { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: end; margin: 0 0 0.8rem; }
.pp-filter .form-control, .pp-filter .form-select {
  height: 2.1rem; padding: 0 0.9rem; border: 1px solid var(--health-border); border-radius: 999px;
  background-color: var(--health-surface-card); color: var(--health-text); font-size: 0.85rem;
}
.pp-filter .form-control:focus, .pp-filter .form-select:focus { border-color: var(--health-navy); box-shadow: none; }
.pp-filter-grow { flex: 1 1 14rem; }
.pp-filter .form-select { min-width: 8.5rem; }
.pp-source { white-space: nowrap; }
.pp-chiprow { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0 0 1rem; padding: 0; list-style: none; }
.pp-chiplink {
  display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.3rem 0.8rem;
  border: 1px solid var(--health-border); border-radius: 999px; background: var(--health-surface-card);
  color: var(--health-text); font-size: 0.82rem; font-weight: 700; text-decoration: none;
}
.pp-chiplink:hover { border-color: var(--health-navy); color: var(--health-text); }
.pp-chiplink.is-active { border-color: var(--health-navy); background: var(--health-navy-light); color: var(--health-navy); }
.pp-chipcount { font-weight: 800; color: var(--health-text-muted); }
.pp-chiplink.is-active .pp-chipcount { color: var(--health-navy); }
.pp-table .pp-year-row th { padding: 0.45rem 1rem; background: var(--health-navy-light); color: var(--health-navy); font-size: 0.8rem; letter-spacing: 0.04em; }

/* The time picker on the booking page: a few days, each a short list of radio rows. A full session stays visible
   and disabled, so a patient can see what they missed. Tokens only. */
.pp-slot-day { margin: 1rem 0 0.4rem; font-size: 0.7rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--health-text-muted); }
.pp-slot-list { display: grid; gap: 0.4rem; }
.pp-slot {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.7rem; margin: 0; padding: 0.6rem 0.9rem;
  border: 1px solid var(--health-border); border-radius: 0.8rem; background: var(--health-surface-card);
  color: var(--health-text); font-size: 0.88rem; cursor: pointer;
}
.pp-slot:hover { border-color: var(--tone, var(--health-primary)); }
.pp-slot:has(input:checked) { border-color: var(--tone, var(--health-primary)); background: color-mix(in srgb, var(--tone, var(--health-primary)) 10%, var(--health-surface-card)); }
.pp-slot:has(input:focus-visible) { outline: 2px solid var(--tone, var(--health-primary)); outline-offset: 2px; }
.pp-slot.is-full { opacity: 0.65; cursor: not-allowed; }

/* The AI explanation page: what is about to happen in three steps, what is and is not sent, and the answer laid out
   so the urgent part comes first and the rest can be skimmed. Tokens only; status is always a word as well as a colour. */
.pp-steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: 0.6rem; margin: 0 0 1rem; padding: 0; list-style: none; counter-reset: step; }
.pp-steps li { counter-increment: step; display: flex; gap: 0.6rem; align-items: flex-start; padding: 0.6rem 0.8rem; border: 1px solid var(--health-border); border-radius: 0.8rem; background: var(--health-surface-card); font-size: 0.84rem; }
.pp-steps li::before { content: counter(step); flex: 0 0 1.5rem; height: 1.5rem; display: grid; place-items: center; border-radius: 50%; background: var(--health-navy-light); color: var(--health-navy); font-weight: 800; font-size: 0.78rem; }
.pp-steps li.is-here { border-color: var(--health-navy); }
.pp-sent { margin: 0; padding: 0; list-style: none; display: grid; gap: 0.4rem; }
.pp-sent li { display: flex; gap: 0.55rem; align-items: flex-start; font-size: 0.88rem; }
.pp-sent .bi { margin-top: 0.15rem; flex: 0 0 auto; }
.pp-sent-yes .bi { color: var(--health-navy); }
.pp-sent-no { color: var(--health-text-muted); }
.pp-subject { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 0.7rem; margin: 0 0 1rem; padding: 0.7rem 1rem; border: 1px solid var(--health-border); border-radius: 0.9rem; background: var(--health-surface-card); }
.pp-subject-title { font-weight: 800; color: var(--health-navy); }
.pp-answer-lead { font-size: 1.02rem; line-height: 1.55; }
.pp-two { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 1rem; }
.pp-two ul { margin: 0; padding-left: 1.1rem; display: grid; gap: 0.4rem; }
.pp-glossary { margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 0.6rem 1.2rem; }
.pp-glossary dt { font-weight: 800; color: var(--health-navy); }
.pp-glossary dd { margin: 0 0 0.2rem; color: var(--health-text); font-size: 0.88rem; }

/* An icon-only action (download, edit, delete) beside the text ones: a square pill, with a title and aria-label on the link. */
.pp-btn-icon { width: 2.1rem; padding: 0; justify-content: center; }
.pp-table td .pp-btn.pp-btn-icon { width: 1.75rem; height: 1.75rem; padding: 0; }

/* A serious issue from the AI check: a heavy left edge in the alert colour plus its own heading, so it is never colour alone. */
.pp-serious { border-left: 5px solid #E0426B; }
.pp-serious-title { margin: 0 0 0.3rem; font-size: 1rem; font-weight: 800; color: var(--health-text); }

/* The portal uses the whole width of the screen. The side padding grows with the screen (a phone keeps a small gutter, a
   large monitor a roomy one) instead of the page sitting in a fixed column; the top bar and the nav row share it so
   their edges line up with the content. Forms and prose keep their own narrower max-width where reading needs it. */
.pp-shell { width: 100%; margin-inline: auto; padding-inline: clamp(0.75rem, 3vw, 3rem); }
.pp-sticky .app-topbar.px-3 { padding-left: clamp(0.75rem, 3vw, 3rem) !important; padding-right: clamp(0.75rem, 3vw, 3rem) !important; }

/* A scrolling table container must be positioned: the visually-hidden "Actions" header label inside it is absolutely
   positioned, and without a positioned ancestor it escapes the container's clipping and widens the whole page on a
   phone (a sideways scroll bar on Reports, Documents and Devices). */
.pp-table-wrap, .table-responsive { position: relative; }

/* ======================================================================================================================
   Compact scale. The portal's components were roomy (a 145 px tile, a 136 px welcome banner, a 331 px nav block on a
   phone). This tightens padding, gaps, radii and icon tiles across every portal page so more fits on screen and the pages
   look sharper. Text sizes are left alone, so nothing gets harder to read; only the boxes around it get smaller.
   ====================================================================================================================== */
.pp-shell.py-4 { padding-block: 0.9rem !important; }
.pp-sticky .app-topbar { padding-block: 0.3rem; }
.pp-sticky .app-topbar .pp-home-link, .pp-sticky .app-topbar .btn-icon { height: 1.9rem; }

/* The section row: tighter, and on a phone one swipeable line instead of a block of wrapped buttons. */
.pp-navrow .pp-shell.py-2 { padding-block: 0.3rem !important; }
.pp-navrow .btn-sm { min-height: 1.7rem; padding: 0.15rem 0.45rem; font-size: 0.76rem; }
.pp-book-btn { height: 1.75rem; padding: 0 0.75rem; font-size: 0.76rem; }
@media (max-width: 767.98px) {
  .pp-navrow .pp-shell { align-items: center !important; }
  .pp-navrow .pp-shell > .d-flex { flex-wrap: nowrap !important; overflow-x: auto; scrollbar-width: thin; padding-bottom: 0.1rem; }
  .pp-navrow .btn-sm { flex: none; }
  .pp-book-btn .bi { margin-right: 0 !important; }
}

/* Icon tiles. */
.pp-ic { width: 2.2rem; height: 2.2rem; border-radius: 0.65rem; font-size: 1.05rem; box-shadow: 0 5px 9px -6px var(--tone, var(--health-primary)); }
.pp-ic-lg { width: 2.4rem; height: 2.4rem; font-size: 1.2rem; }
.pp-row .pp-ic { width: 2rem; height: 2rem; font-size: 1rem; }
.pp-panel-title .pp-ic { width: 1.7rem; height: 1.7rem; border-radius: 0.5rem; font-size: 0.85rem; }

/* Welcome banner. */
.pp-hero { gap: 0.75rem; margin-bottom: 0.75rem; padding: 0.7rem 1rem; border-radius: 1rem; box-shadow: 0 12px 22px -18px var(--health-primary); }
.pp-avatar { width: 2.75rem; height: 2.75rem; font-size: 1.2rem; }
.pp-hello { font-size: 0.68rem; }
.pp-name { margin: 0 0 0.25rem; font-size: 1.2rem; }
.pp-chip { padding: 0.1rem 0.55rem; }

/* The three numbers. */
.pp-stats { grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: 0.6rem; margin-bottom: 0.75rem; }
.pp-stat { gap: 0.55rem; padding: 0.5rem 0.7rem; border-radius: 0.8rem; }
.pp-stat-num { font-size: 1.2rem; }
.pp-stat-label { font-size: 0.68rem; }
@media (max-width: 767.98px) { .pp-stats { grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr)); } }

/* Section tiles: icon beside the title instead of above it, so a tile is about half as tall. */
.pp-tiles { grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); gap: 0.55rem; }
.pp-tile { grid-template-columns: auto 1fr; column-gap: 0.6rem; row-gap: 0; align-items: center; padding: 0.6rem 0.7rem; border-radius: 0.85rem; }
.pp-tile::after { height: 3px; }
.pp-tile .pp-ic { grid-row: 1 / span 2; margin: 0; }
.pp-tile b { grid-column: 2; align-self: end; font-size: 0.9rem; }
.pp-tile > span:last-child { grid-column: 2; align-self: start; font-size: 0.74rem; line-height: 1.3; }
.pp-tile:hover { transform: translateY(-2px); }
.pp-tile-count { top: 0.4rem; right: 0.5rem; min-width: 1.35rem; padding: 0 0.4rem; font-size: 0.7rem; }

/* Notes, page headers, hospital strip, cards. */
.pp-note { gap: 0.5rem; margin-bottom: 0.6rem; padding: 0.45rem 0.7rem; border-left-width: 4px; border-radius: 0.7rem; font-size: 0.8rem; }
.pp-note > .bi { font-size: 1rem; }
.pp-page-head { gap: 0.65rem; margin-bottom: 0.75rem; padding: 0.5rem 0.8rem; border-radius: 0.9rem; }
.pp-page-title { font-size: 1.1rem; }
.pp-page-sub { font-size: 0.78rem; }
.pp-count { min-width: 1.8rem; padding: 0.1rem 0.55rem; font-size: 0.8rem; }
.pp-hospital { gap: 0.6rem; margin-bottom: 0.9rem; padding: 0.5rem 0.8rem; border-radius: 0.8rem; }
.pp-card { padding: 0.75rem 0.9rem; border-radius: 0.9rem; }
.pp-card-stack { gap: 0.7rem; margin-bottom: 1rem; }
.pp-panel-title { margin: 0.3rem 0 0.5rem; font-size: 0.98rem; }
.pp-section-title { margin-bottom: 0.5rem; font-size: 1rem; }
.pp-list { gap: 0.45rem; margin-bottom: 1rem; }
.pp-row { gap: 0.65rem; padding: 0.55rem 0.8rem; border-radius: 0.85rem; }
.pp-empty { padding: 1rem; }

/* Buttons, pills, chips, filters, tables. */
.pp-btn { height: 1.85rem; padding: 0 0.8rem; gap: 0.3rem; font-size: 0.76rem; }
.pp-btn-icon { width: 1.85rem; }
.pp-table td .pp-btn { height: 1.55rem; padding: 0 0.55rem; font-size: 0.7rem; }
.pp-table td .pp-btn.pp-btn-icon { width: 1.55rem; height: 1.55rem; padding: 0; }
.pp-pill { padding: 0.05rem 0.5rem; }
.pp-chiplink { padding: 0.2rem 0.65rem; font-size: 0.76rem; }
.pp-chiprow { gap: 0.3rem; margin-bottom: 0.7rem; }
.pp-filter { gap: 0.45rem; margin-bottom: 0.6rem; }
.pp-filter .form-control, .pp-filter .form-select { height: 1.85rem; font-size: 0.8rem; }
.pp-table-wrap { border-top-width: 4px; border-radius: 0.85rem; }
.pp-table th { padding: 0.45rem 0.75rem; font-size: 0.64rem; }
.pp-table td { padding: 0.45rem 0.75rem; font-size: 0.82rem; }
.pp-table .pp-year-row th { padding: 0.3rem 0.75rem; }

/* The AI page. */
.pp-steps { gap: 0.45rem; margin-bottom: 0.75rem; }
.pp-steps li { padding: 0.45rem 0.65rem; }
.pp-subject { margin-bottom: 0.75rem; padding: 0.5rem 0.8rem; }

/* ======================================================================================================================
   Connected devices on the patient's own page. The panel is shared with the staff screen, so its markup uses the staff
   classes (ov-card, sky-table, Bootstrap buttons and badges); inside .pp-page they wear the portal theme instead:
   tone-topped cards, portal tables, pill buttons. The staff page has no .pp-page, so it is untouched.
   ====================================================================================================================== */
.pp-page { --pp-danger: #B3274B; }
[data-bs-theme="dark"] .pp-page { --pp-danger: #FF8FA8; }
.pp-page .ov-card.card { overflow: hidden; border: 1px solid var(--health-border); border-top: 4px solid var(--tone, var(--health-primary)); border-radius: 0.9rem; background: var(--health-surface-card); box-shadow: var(--health-shadow-xs); }
.pp-page .ov-card > .card-header { padding: 0.5rem 0.9rem; border-bottom: 1px solid var(--health-border); background: color-mix(in srgb, var(--tone, var(--health-primary)) 8%, var(--health-surface-card)); font-family: var(--font-display); font-size: 0.95rem; font-weight: 800; color: var(--health-navy); }
.pp-page .ov-card > .card-body { padding: 0.8rem 0.9rem; }
.pp-page .ov-card .form-label { font-size: 0.74rem; font-weight: 800; color: var(--health-text-muted); }
.pp-page .ov-card .form-control, .pp-page .ov-card .form-select { min-height: 1.85rem; border-color: var(--health-border); border-radius: 0.6rem; background-color: var(--health-surface); font-size: 0.82rem; color: var(--health-text); }
.pp-page .ov-card .form-control:focus, .pp-page .ov-card .form-select:focus { border-color: var(--tone, var(--health-primary)); box-shadow: 0 0 0 0.18rem color-mix(in srgb, var(--tone, var(--health-primary)) 22%, transparent); }
.pp-page .ov-card .form-check-input:checked { border-color: var(--tone, var(--health-primary)); background-color: var(--tone, var(--health-primary)); }
.pp-page .ov-card .form-check-label { color: var(--health-text); }
.pp-page .ov-card .form-text { font-size: 0.74rem; color: var(--health-text-muted); }

.pp-page .sky-table { --bs-table-bg: transparent; --bs-table-color: var(--health-text); --bs-table-border-color: var(--health-border); font-size: 0.82rem; }
.pp-page .sky-table th { padding: 0.45rem 0.75rem; border-bottom: 1px solid var(--health-border); background: transparent; font-size: 0.64rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; white-space: nowrap; color: var(--health-text-muted); }
.pp-page .sky-table td { padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--health-border); background: transparent; color: var(--health-text); }
.pp-page .sky-table tbody tr:last-child td { border-bottom: 0; }
.pp-page .sky-table tbody tr:hover td { background: color-mix(in srgb, var(--tone, var(--health-primary)) 7%, var(--health-surface-card)); }
.pp-page .sky-table .text-body-secondary, .pp-page .sky-table .text-muted { color: var(--health-text-muted) !important; }

/* Pill buttons, the same shapes as .pp-btn. */
.pp-page .ov-card .btn { --pp-fill: color-mix(in srgb, var(--tone, var(--health-primary)) 74%, #000); display: inline-flex; align-items: center; justify-content: center; gap: 0.25rem; min-height: 1.7rem; padding: 0.15rem 0.7rem; border: 2px solid var(--pp-fill); border-radius: 999px; font-size: 0.74rem; font-weight: 800; line-height: 1.2; }
.pp-page .ov-card .btn .bi { margin-right: 0 !important; }
.pp-page .ov-card .btn-primary { background: var(--pp-fill); color: #fff; }
.pp-page .ov-card .btn-primary:hover { background: color-mix(in srgb, var(--pp-fill) 88%, #000); border-color: color-mix(in srgb, var(--pp-fill) 88%, #000); color: #fff; }
.pp-page .ov-card .btn-outline-secondary { border-color: var(--tone, var(--health-primary)); background: transparent; color: color-mix(in srgb, var(--tone, var(--health-primary)) 78%, #000); }
[data-bs-theme="dark"] .pp-page .ov-card .btn-outline-secondary { color: color-mix(in srgb, var(--tone, var(--health-primary)) 60%, #fff); }
.pp-page .ov-card .btn-outline-secondary:hover { background: color-mix(in srgb, var(--tone, var(--health-primary)) 12%, var(--health-surface)); color: inherit; }
.pp-page .ov-card .btn-outline-danger { border-color: var(--pp-danger); background: transparent; color: var(--pp-danger); }
.pp-page .ov-card .btn-outline-danger:hover { background: color-mix(in srgb, var(--pp-danger) 14%, var(--health-surface)); color: var(--pp-danger); }

/* Status badges as portal pills. */
.pp-page .ov-card .badge { padding: 0.15rem 0.55rem; border: 0 !important; border-radius: 999px; font-size: 0.7rem; font-weight: 800; }
.pp-page .ov-card .badge.text-bg-light { background: var(--health-surface-alt) !important; color: var(--health-text-muted) !important; }
.pp-page .ov-card .badge.text-bg-success { background: color-mix(in srgb, #3E9B5A 18%, var(--health-surface)) !important; color: #1F6B3A !important; }
.pp-page .ov-card .badge.text-bg-warning { background: color-mix(in srgb, #E0A800 20%, var(--health-surface)) !important; color: #8a6500 !important; }
.pp-page .ov-card .badge.text-bg-danger { background: color-mix(in srgb, #E0426B 16%, var(--health-surface)) !important; color: #B3274B !important; }
[data-bs-theme="dark"] .pp-page .ov-card .badge.text-bg-success { color: #8EE0A8 !important; }
[data-bs-theme="dark"] .pp-page .ov-card .badge.text-bg-warning { color: #F2CD62 !important; }
[data-bs-theme="dark"] .pp-page .ov-card .badge.text-bg-danger { color: #FF8FA8 !important; }

/* The one-time key banner. */
.pp-page .alert-success { margin-bottom: 0.9rem; padding: 0.7rem 0.9rem; border: 1px solid color-mix(in srgb, #3E9B5A 40%, var(--health-border)); border-left: 4px solid #3E9B5A; border-radius: 0.8rem; background: color-mix(in srgb, #3E9B5A 8%, var(--health-surface)); color: var(--health-text); }
.pp-page .alert-success pre { background: var(--health-surface-alt) !important; color: var(--health-text); }

/* Contrast fixes found by scanning every portal page in both themes: small text on a tint needs a darker (light theme) or
   lighter (dark theme) shade of the accent than the bare accent colour gives. */
.pp-btn-soft, .pp-home-link { color: color-mix(in srgb, var(--health-primary) 74%, #000) !important; }
:root[data-bs-theme="dark"] .pp-btn-soft, :root[data-bs-theme="dark"] .pp-home-link { color: color-mix(in srgb, var(--health-primary) 55%, #fff) !important; }
.pp-tile-count { background: color-mix(in srgb, var(--tone, var(--health-primary)) 72%, #000); }
[data-tone="amber"] .pp-btn-line { color: #7A5A00 !important; }
:root[data-bs-theme="dark"] [data-tone="amber"] .pp-btn-line { color: #F2CD62 !important; }
.pp-page .ov-card .btn-primary { --pp-fill: color-mix(in srgb, var(--tone, var(--health-primary)) 62%, #000); }

/* Breadcrumb on every portal page: the staff trail's markup, in the portal's colours. */
.pp-crumbs { margin: 0 0 0.55rem; font-size: 0.76rem; }
.pp-crumbs li { color: var(--health-text-muted); }
.pp-crumbs a { padding: 0.1rem 0.3rem; color: var(--health-text-muted); }
.pp-crumbs a:hover { background: color-mix(in srgb, var(--health-primary) 12%, var(--health-surface)); color: color-mix(in srgb, var(--health-primary) 74%, #000); }
:root[data-bs-theme="dark"] .pp-crumbs a:hover { color: color-mix(in srgb, var(--health-primary) 55%, #fff); }
.pp-crumbs li.is-current { color: var(--health-navy); font-weight: 700; }

/* Connected devices: both columns tighter. Smaller gaps, long help cards fold away, lists scroll instead of growing. */
.pp-page .dev-grid { --bs-gutter-x: 0.75rem; --bs-gutter-y: 0.75rem; }
.pp-page .dev-grid .ov-card { margin-bottom: 0.75rem !important; }
.pp-page .dev-grid .col-lg-8 > .ov-card:last-child, .pp-page .dev-grid .col-lg-4 > .ov-card:last-child { margin-bottom: 0 !important; }
.pp-page .dev-grid .sky-table th, .pp-page .dev-grid .sky-table td { padding: 0.35rem 0.6rem; }
.pp-page .dev-log { max-height: 15rem; overflow-y: auto; }
.pp-page .dev-grid .list-group-item { padding: 0.3rem 0.9rem; background: transparent; border-color: var(--health-border); color: var(--health-text); }
.pp-page .dev-grid details > summary.card-header { cursor: pointer; list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.pp-page .dev-grid details > summary.card-header::-webkit-details-marker { display: none; }
.pp-page .dev-grid details > summary.card-header::after { content: "\F282"; font-family: "bootstrap-icons"; font-size: 0.75rem; transition: transform 0.15s; }
.pp-page .dev-grid details[open] > summary.card-header::after { transform: rotate(180deg); }
.pp-page .dev-metrics { display: flex; flex-wrap: wrap; gap: 0.3rem; padding: 0.6rem 0.9rem; margin: 0; list-style: none; }
.pp-page .dev-metrics li { padding: 0.1rem 0.5rem; border: 1px solid var(--health-border); border-radius: 999px; background: var(--health-surface-alt); font-size: 0.72rem; color: var(--health-text); }
.pp-page .dev-metrics li span { color: var(--health-text-muted); }
.pp-page .dev-grid .ov-card form .mb-3 { margin-bottom: 0.5rem !important; }
.pp-page .dev-grid .ov-card .form-control, .pp-page .dev-grid .ov-card .form-select { padding: 0.2rem 0.6rem; min-height: 0; height: auto; font-size: 0.8rem; line-height: 1.4; }
.pp-page .dev-grid .ov-card .form-check { margin-bottom: 0.1rem; min-height: 0; }
.pp-page .dev-grid .ov-card .form-check-label, .pp-page .dev-grid .ov-card .form-text { font-size: 0.78rem; }
.pp-page .dev-grid .ov-card .card-body { font-size: 0.82rem; }
.pp-page .dev-grid .ov-card .card-body p { margin-bottom: 0.4rem; }
.pp-page .dev-pic { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 2.3rem; height: 2.3rem; border-radius: 0.6rem; background: color-mix(in srgb, var(--tone, var(--health-primary)) 14%, var(--health-surface)); color: color-mix(in srgb, var(--tone, var(--health-primary)) 75%, #000); font-size: 1.15rem; }
[data-bs-theme="dark"] .pp-page .dev-pic { color: color-mix(in srgb, var(--tone, var(--health-primary)) 55%, #fff); }
.pp-page tr.text-body-secondary .dev-pic { opacity: 0.55; }

/* Appointments: a lifetime of rows. Four small count tiles that filter, and a one-line-per-row table. */
.pp-table-compact { font-size: 0.8rem; }
.pp-table-compact th { padding: 0.4rem 0.7rem; }
.pp-table-compact td { padding: 0.3rem 0.7rem; }
.pp-table-compact .pp-cell-clip { max-width: 18rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pp-table-compact .pp-row-actions { gap: 0.25rem; flex-wrap: nowrap; }
.pp-table-compact .pp-row-actions .pp-btn { padding: 0.2rem 0.45rem; min-height: 0; }
.pp-table-compact .pp-pill { padding: 0.05rem 0.5rem; font-size: 0.68rem; }

/* Appointment counts inside the hero bar (they filter the list below it). */
.pp-head-counts { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0.35rem; margin-left: auto; }
.pp-head-counts a { display: inline-flex; align-items: baseline; gap: 0.3rem; padding: 0.2rem 0.65rem; border: 1px solid color-mix(in srgb, var(--tone, var(--health-primary)) 30%, var(--health-border)); border-radius: 999px; background: var(--health-surface); font-size: 0.74rem; font-weight: 700; color: var(--health-text-muted); text-decoration: none; white-space: nowrap; }
.pp-head-counts a b { font-family: var(--font-display); font-size: 0.95rem; font-weight: 800; color: var(--health-text); }
.pp-head-counts a:hover, .pp-head-counts a[aria-current] { border-color: var(--tone, var(--health-primary)); background: color-mix(in srgb, var(--tone, var(--health-primary)) 12%, var(--health-surface)); }
@media (max-width: 767px) { .pp-page-head:has(.pp-head-counts) { flex-wrap: wrap; } .pp-head-counts { flex: 1 1 100%; justify-content: flex-start; margin-left: 0; } }

/* "Find an ambulance" on the overview: the same small pill field as the list filters, not a full-size input. */
.pp-find-input { width: 100%; max-width: 22rem; height: 1.85rem; padding: 0 0.9rem; border: 1px solid var(--health-border); border-radius: 999px; background-color: var(--health-surface-card); color: var(--health-text); font-size: 0.8rem; }
.pp-find-input:focus { border-color: var(--tone, var(--health-primary)); box-shadow: 0 0 0 0.18rem color-mix(in srgb, var(--tone, var(--health-primary)) 22%, transparent); }

/* Portal forms: compact by default, the same scale as the list filters and the Update filters above.
   Every form inside .pp-page (profile, guardian, details, upload, booking, ...) gets this without any per-page CSS, so a
   new portal form that uses plain Bootstrap classes already matches. :where() keeps the specificity low, so the filter
   pills, the card forms and the Bangla label size above still win where they set their own. Do not add -lg sizes. */
:where(.pp-page) .form-control, :where(.pp-page) .form-select { min-height: 1.85rem; padding: 0.25rem 0.65rem; border-color: var(--health-border); border-radius: 0.6rem; background-color: var(--health-surface); color: var(--health-text); font-size: 0.82rem; line-height: 1.4; }
:where(.pp-page) .form-select { padding-right: 2rem; }
:where(.pp-page) textarea.form-control { min-height: 4.2rem; }
:where(.pp-page) .form-control:focus, :where(.pp-page) .form-select:focus { border-color: var(--health-primary); box-shadow: 0 0 0 0.18rem color-mix(in srgb, var(--health-primary) 22%, transparent); }
:where(.pp-page) .form-check-input { width: 1rem; height: 1rem; margin-top: 0.2rem; }
:where(.pp-page) .form-check-input:checked { border-color: var(--health-primary); background-color: var(--health-primary); }
:where(.pp-page) .form-check-label { font-size: 0.82rem; color: var(--health-text); }
:where(.pp-page) .form-text { font-size: 0.74rem; }
:where(.pp-page) .pub-field-label { margin-bottom: 0.2rem; font-size: 0.72rem; letter-spacing: 0.05em; }
/* Dark theme: --health-surface and the card colour are the same blue, so a field on a card vanished into it. A field
   sits one step darker than the card (the page colour), keeping its border, so it reads as an inset box. Filter pills sit
   on the page, not a card, so they keep their own card-coloured fill. */
:root[data-bs-theme="dark"] .pp-page :is(.pp-card, .ov-card) .form-control,
:root[data-bs-theme="dark"] .pp-page :is(.pp-card, .ov-card) .form-select { background-color: var(--health-bg); }
@media (prefers-color-scheme: dark) {
  :root:not([data-bs-theme="light"]) .pp-page :is(.pp-card, .ov-card) .form-control,
  :root:not([data-bs-theme="light"]) .pp-page :is(.pp-card, .ov-card) .form-select { background-color: var(--health-bg); }
}

/* OTP code entry: one box per digit (static/js/otp-boxes.js). */
.otp-boxes { display: flex; justify-content: center; gap: .5rem; }
.otp-box { width: 2.75rem; height: 3.25rem; padding: 0; text-align: center; font-size: 1.35rem; font-weight: 600; font-variant-numeric: tabular-nums; }
@media (max-width: 360px) { .otp-box { width: 2.35rem; height: 3rem; } .otp-boxes { gap: .35rem; } }
