/* MedPortal - shared stylesheet. RTL-first, responsive, no framework dependency. */

/* Bond (bugfix - explicit user report, "توی فایرفاکس ظاهر منو به هم ریخته
   ولی توی کروم عالیه... فایرفاکس رو از ایران باز می‌کنم و کروم رو از هلند"):
   this was never a Firefox-vs-Chrome rendering bug - both engines render
   identically once they have the same font. It was Vazirmatn failing to
   load at all from an Iranian network path (fonts.googleapis.com/
   fonts.gstatic.com access from Iran is unreliable - well documented,
   unrelated to this site), silently falling back to the stack's next font
   (Tahoma/Segoe UI), which has different character widths/line-height than
   Vazirmatn - exactly the kind of mismatch that breaks a width-constrained,
   single-line sidebar label. Self-hosting removes the external dependency
   entirely so this can never again depend on which country a visitor's
   network happens to reach Google from - every other page on the site that
   also used the Google Fonts <link> (removed from includes/header.php)
   benefits the same way, not just the sidebar.
   Files are the exact same 3 subsets (arabic/latin-ext/latin) Google itself
   was already serving for this family/weight range - same bytes, same
   unicode-range split, only the source moved, so nothing about how the
   font actually renders changes for anyone who could already reach it. */
@font-face {
  font-family: 'Vazirmatn';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('../fonts/vazirmatn-arabic.woff2') format('woff2');
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC, U+102E0-102FB, U+10E60-10E7E, U+10EC2-10EC4, U+10EFC-10EFF, U+1EE00-1EE03, U+1EE05-1EE1F, U+1EE21-1EE22, U+1EE24, U+1EE27, U+1EE29-1EE32, U+1EE34-1EE37, U+1EE39, U+1EE3B, U+1EE42, U+1EE47, U+1EE49, U+1EE4B, U+1EE4D-1EE4F, U+1EE51-1EE52, U+1EE54, U+1EE57, U+1EE59, U+1EE5B, U+1EE5D, U+1EE5F, U+1EE61-1EE62, U+1EE64, U+1EE67-1EE6A, U+1EE6C-1EE72, U+1EE74-1EE77, U+1EE79-1EE7C, U+1EE7E, U+1EE80-1EE89, U+1EE8B-1EE9B, U+1EEA1-1EEA3, U+1EEA5-1EEA9, U+1EEAB-1EEBB, U+1EEF0-1EEF1;
}
@font-face {
  font-family: 'Vazirmatn';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('../fonts/vazirmatn-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Vazirmatn';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('../fonts/vazirmatn-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --color-bg: #f4f6f9;
  --color-surface: #ffffff;
  --color-border: #e2e7ee;
  --color-text: #1f2937;
  --color-muted: #667085;
  --color-primary: #0f766e;
  --color-primary-dark: #0b5a54;
  --color-primary-soft: #e6f4f2;
  --color-accent: #2563eb;
  --color-danger: #dc2626;
  --color-danger-soft: #fdecec;
  --color-warning: #b45309;
  --color-warning-soft: #fef3e2;
  --color-success: #15803d;
  --color-success-soft: #e8f7ec;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow-md: 0 4px 10px rgba(16, 24, 40, .08);
}

/* ---- Dark mode (bond: explicit user decision - a per-account choice, see includes/theme.php) ----
   Every color used across the site is a token defined here; the dark palette
   only needs to redefine these same tokens, RTL layout/spacing/every other
   rule is untouched. Selector is html[data-theme="dark"] (header.php stamps
   data-theme on <html> from the user's own saved preference) - never a
   prefers-color-scheme media query, since the choice is explicit and
   account-level, not inferred from the OS. */
:root[data-theme="dark"] {
  --color-bg: #10161a;
  --color-surface: #1a2228;
  --color-border: #2b3640;
  --color-text: #e7edf0;
  --color-muted: #8fa0aa;
  /* Bond: --color-primary stays dark/saturated enough that white button text
     (.btn, .steps-step-number, etc.) reads well on it; --color-primary-dark is
     used far more often as TEXT sitting on a soft/dark surface (stat tiles,
     badges, links) than as a background, so it goes the other way - brighter,
     for legibility there - accepting a slightly softer .btn:hover contrast
     as the reasonable tradeoff. */
  --color-primary: #0d9488;
  --color-primary-dark: #2dd4bf;
  --color-primary-soft: #163330;
  --color-accent: #3b82f6;
  --color-danger: #f87171;
  --color-danger-soft: #3a1a1c;
  --color-warning: #fbbf24;
  --color-warning-soft: #3a2c10;
  --color-success: #4ade80;
  --color-success-soft: #14301f;
  --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 1px 3px rgba(0, 0, 0, .4);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, .5);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: 'Vazirmatn', Tahoma, 'Segoe UI', sans-serif;
  font-size: 15px;
  line-height: 1.7;
  overflow-x: hidden; /* guards against any accidental horizontal scroll, in every direction/language */
}

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---- Topbar ---- */
.topbar {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar-brand { display: flex; align-items: center; gap: .5rem; margin-inline-end: auto; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 9px;
  object-fit: cover; display: block; flex-shrink: 0;
}
.brand-name { font-weight: 700; font-size: 1.05rem; }
.brand-sub { color: var(--color-muted); font-size: .85rem; padding-inline-start: .5rem; border-inline-start: 1px solid var(--color-border); }
.topbar-nav { display: flex; gap: .25rem; }
.topbar-nav a {
  padding: .5rem .9rem; border-radius: 8px; color: var(--color-muted); text-decoration: none; font-weight: 500;
}
.topbar-nav a.active, .topbar-nav a:hover { background: var(--color-primary-soft); color: var(--color-primary-dark); }
.topbar-user { display: flex; align-items: center; gap: .75rem; margin-inline-start: auto; }
.user-name { font-weight: 600; color: var(--color-muted); }

.lang-switch { display: flex; gap: .35rem; font-size: .8rem; }
.lang-switch a {
  color: var(--color-muted); text-decoration: none; padding: .2rem .45rem; border-radius: 6px; font-weight: 600;
}
.lang-switch a.active, .lang-switch a:hover { background: var(--color-primary-soft); color: var(--color-primary-dark); }

/* ---- Mobile navigation (hamburger + vertical drawer) ---- */
.primary-nav { display: flex; align-items: center; gap: 1.5rem; flex: 1; flex-wrap: wrap; min-width: 0; }

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4px;
  width: 42px;
  height: 42px;
  min-width: 44px;
  min-height: 44px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-surface);
  cursor: pointer;
  padding: 0;
  margin-inline-start: auto;
  flex-shrink: 0;
}
.nav-toggle:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }
.nav-toggle-bar {
  display: block; width: 18px; height: 2px; border-radius: 2px;
  background: var(--color-text); transition: transform .2s ease, opacity .2s ease;
}
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

@media (max-width: 800px) {
  .nav-toggle { display: flex; }

  .primary-nav {
    display: none;
    position: fixed;
    inset-inline: 0;
    top: 0;
    bottom: 0;
    z-index: 9; /* stays below .topbar (z-index 10), so the header - and the toggle button itself - remains visible/tappable to close the menu */
    background: var(--color-surface);
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 4.75rem 1.25rem 1.5rem;
    overflow-y: auto;
    transition: transform .2s ease;
  }
  .primary-nav.is-open { display: flex; }

  .topbar-nav { flex-direction: column; gap: .25rem; width: 100%; }
  .topbar-nav a { display: block; padding: .9rem 1rem; font-size: 1rem; min-height: 44px; }

  .topbar-user {
    flex-direction: column; align-items: stretch; gap: .75rem;
    margin-inline-start: 0; margin-top: 1.25rem; padding-top: 1.25rem;
    border-top: 1px solid var(--color-border); width: 100%;
  }
  .topbar-user .btn, .topbar-user .btn-ghost { width: 100%; }
  .lang-switch { justify-content: center; }
}

/* ---- Sidebar (bond - sidebar redesign: replaces the horizontal panel nav
   with a vertical one; the public/logged-out topbar above is untouched).
   Direction (RTL fa/ar docking the sidebar to the right, LTR en docking it
   to the left) comes from exactly ONE place: <html dir="rtl|ltr"> (set by
   includes/header.php from the page's own $lang). Every rule below uses CSS
   logical properties (inset-inline-*, border-inline-*, padding-inline-*) or
   relies on flexbox's own documented RTL/LTR auto-reversal (already used
   elsewhere in this file, see the .week-template comment above) - nothing
   here hard-codes "left"/"right", so no per-language variant of this CSS
   exists or is ever needed. */
:root {
  --sidebar-width: 264px;
  --sidebar-collapsed-width: 68px;
  --topbar-height: 64px;
}

.topbar { min-height: var(--topbar-height); }
.topbar--panel { gap: 1rem; }

.sidebar-toggle, .sidebar-collapse-toggle {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4px;
  width: 42px; height: 42px; min-width: 44px; min-height: 44px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-surface);
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
}
.sidebar-toggle, .sidebar-collapse-toggle { display: none; } /* each is shown only within its own breakpoint below - on full desktop neither applies (sidebar is always fully expanded there, nothing to pin) */
.sidebar-toggle:focus-visible, .sidebar-collapse-toggle:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }

.panel-body {
  display: flex;
  align-items: flex-start;
}

.sidebar {
  flex: 0 0 var(--sidebar-width);
  width: var(--sidebar-width);
  position: sticky;
  top: var(--topbar-height);
  align-self: flex-start;
  height: calc(100vh - var(--topbar-height));
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--color-surface);
  border-inline-end: 1px solid var(--color-border);
  padding: .75rem .5rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 2px;
  transition: width .18s ease;
}
.app-shell--panel .app-main { flex: 1 1 0; min-width: 0; }

.sidebar-collapse-toggle { align-self: flex-end; margin-bottom: .5rem; }
.sidebar-collapse-icon {
  display: block; width: 16px; height: 2px; border-radius: 2px; background: var(--color-text); position: relative;
}
.sidebar-collapse-icon::before, .sidebar-collapse-icon::after {
  content: ""; position: absolute; inset-inline-start: 0; width: 16px; height: 2px; border-radius: 2px; background: var(--color-text);
}
.sidebar-collapse-icon::before { top: -5px; }
.sidebar-collapse-icon::after { top: 5px; }

.sidebar-link, .sidebar-group-toggle {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .6rem .75rem;
  border-radius: 8px;
  color: var(--color-text);
  text-decoration: none;
  font: inherit;
  background: none;
  border: none;
  width: 100%;
  text-align: start;
  cursor: pointer;
  min-height: 44px;
}
.sidebar-link:hover, .sidebar-group-toggle:hover { background: var(--color-primary-soft); color: var(--color-primary-dark); }
.sidebar-link.active { background: var(--color-primary-soft); color: var(--color-primary-dark); font-weight: 600; }
.sidebar-icon { flex-shrink: 0; width: 1.3em; text-align: center; }
.sidebar-label {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Collapsible submenu group */
.sidebar-group-children { display: flex; flex-direction: column; gap: 2px; padding-inline-start: 1.1rem; }
.sidebar-group-children[hidden] { display: none; }
.sidebar-chevron {
  flex-shrink: 0;
  display: inline-block;
  width: .9em; height: .9em;
  position: relative;
}
/* Bond (explicit requirement - the arrow must change direction with RTL/LTR,
   not just rotate on expand): base glyph points toward inline-end (where the
   submenu's own text continues), then rotates to point down once expanded -
   the one deliberately direction-aware exception in this whole stylesheet,
   scoped to a single decorative glyph, never a layout position. */
.sidebar-chevron::before {
  content: "\203A"; /* › */
  position: absolute; inset-inline-start: 0; top: 50%;
  transform: translateY(-50%);
  transition: transform .18s ease;
  line-height: 1;
}
:dir(rtl) .sidebar-chevron::before { content: "\2039"; /* ‹ */ }
.sidebar-group-toggle[aria-expanded="true"] .sidebar-chevron::before { transform: translateY(-50%) rotate(90deg); }
:dir(rtl) .sidebar-group-toggle[aria-expanded="true"] .sidebar-chevron::before { transform: translateY(-50%) rotate(-90deg); }

.sidebar-backdrop { display: none; }

/* ---- Tablet: sidebar collapses to icon-only, expands on hover/focus or the pin toggle ---- */
@media (max-width: 1100px) and (min-width: 701px) {
  .sidebar-collapse-toggle { display: flex; }
  .sidebar:not(.is-pinned-open) { width: var(--sidebar-collapsed-width); }
  .sidebar:not(.is-pinned-open) .sidebar-label,
  .sidebar:not(.is-pinned-open) .sidebar-chevron,
  .sidebar:not(.is-pinned-open) .sidebar-group-children {
    opacity: 0;
    position: absolute;
    pointer-events: none;
    width: 0;
    overflow: hidden;
  }
  .sidebar:not(.is-pinned-open):hover,
  .sidebar:not(.is-pinned-open):focus-within {
    width: var(--sidebar-width);
    box-shadow: var(--shadow-md);
    z-index: 11;
  }
  .sidebar:not(.is-pinned-open):hover .sidebar-label,
  .sidebar:not(.is-pinned-open):hover .sidebar-chevron,
  .sidebar:not(.is-pinned-open):focus-within .sidebar-label,
  .sidebar:not(.is-pinned-open):focus-within .sidebar-chevron,
  .sidebar:not(.is-pinned-open):hover .sidebar-group-children:not([hidden]),
  .sidebar:not(.is-pinned-open):focus-within .sidebar-group-children:not([hidden]) {
    opacity: 1;
    position: static;
    pointer-events: auto;
    width: auto;
    overflow: visible;
  }
}

/* ---- Mobile: sidebar becomes an off-canvas drawer ---- */
@media (max-width: 700px) {
  .sidebar-toggle { display: flex; }
  .topbar-brand { margin-inline-end: auto; }
  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    inset-inline-start: -100%;
    height: 100%;
    width: min(85vw, 320px);
    z-index: 21;
    box-shadow: var(--shadow-md);
    transition: inset-inline-start .22s ease;
    padding-top: calc(var(--topbar-height) + .75rem);
  }
  .sidebar.is-open { inset-inline-start: 0; }
  .sidebar-collapse-toggle { display: none; } /* already hidden by default outside the tablet breakpoint - restated here for clarity since mobile also has its own unrelated reasons to never show it */
  .sidebar-backdrop {
    display: block;
    position: fixed; inset: 0;
    background: rgba(15, 23, 42, .45);
    z-index: 20;
  }
  .sidebar-backdrop[hidden] { display: none; }
  .panel-body { display: block; }
  .app-shell--panel .app-main { width: 100%; }
}

/* ---- Main / layout ---- */
.app-main { flex: 1; padding: 1.5rem; max-width: 1100px; width: 100%; margin: 0 auto; }
.app-footer { text-align: center; color: var(--color-muted); font-size: .85rem; padding: 1.25rem; }

.page-header { margin-bottom: 1.25rem; }
.page-header h1 { font-size: 1.4rem; margin: 0 0 .25rem; }
.page-header p { color: var(--color-muted); margin: 0; }

/* ---- Cards / surfaces ---- */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}
.card h2 { font-size: 1.05rem; margin: 0 0 1rem; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; }

.stat-tile { background: var(--color-primary-soft); border-radius: var(--radius); padding: 1rem 1.1rem; }
.stat-tile .stat-value { font-size: 1.6rem; font-weight: 700; color: var(--color-primary-dark); }
.stat-tile .stat-label { color: var(--color-muted); font-size: .85rem; }

/* ---- Auth pages ---- */
.auth-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1.5rem;
  background: radial-gradient(circle at top right, var(--color-primary-soft) 0%, var(--color-bg) 55%);
}
.auth-card {
  width: 100%; max-width: 400px; background: var(--color-surface); border-radius: 16px;
  box-shadow: var(--shadow-md); padding: 2rem; border: 1px solid var(--color-border);
}
.auth-card .brand-mark { width: 64px; height: 64px; margin: 0 auto 1rem; }
.auth-card h1 { text-align: center; font-size: 1.2rem; margin: 0 0 .35rem; }
.auth-card .subtitle { text-align: center; color: var(--color-muted); font-size: .9rem; margin: 0 0 1.5rem; }

/* ---- Forms ---- */
.field { margin-bottom: 1rem; }
.field label { display: block; font-weight: 600; font-size: .88rem; margin-bottom: .4rem; }
.field .hint { color: var(--color-muted); font-size: .8rem; margin-top: .3rem; }
input[type=text], input[type=search], input[type=tel], input[type=number], input[type=password], input[type=date], input[type=time], textarea, select {
  width: 100%; padding: .65rem .8rem; border: 1px solid var(--color-border); border-radius: 9px;
  font-family: inherit; font-size: .95rem; background: var(--color-surface); color: var(--color-text);
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 3px var(--color-primary-soft); }
textarea { resize: vertical; min-height: 90px; }

.radio-row { display: flex; gap: 1rem; }
.radio-row label { display: flex; align-items: center; gap: .4rem; font-weight: 500; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .65rem 1.1rem; border-radius: 9px; border: none; cursor: pointer;
  font-family: inherit; font-weight: 600; font-size: .92rem; text-decoration: none;
  background: var(--color-primary); color: #fff; transition: background .15s ease;
  /* Bond (explicit user decision): a long Persian label (e.g. doctor/questions.php's
     own composer buttons) must wrap and shrink inside its flex row instead of
     forcing the row - and the page - wider than the viewport on mobile. Flex items
     default to min-width:auto, which alone blocks wrapping regardless of white-space. */
  max-width: 100%; white-space: normal; word-break: break-word; min-width: 0;
}
.btn:hover { background: var(--color-primary-dark); }
.btn-block { width: 100%; }
.btn-secondary { background: var(--color-accent); }
.btn-danger { background: var(--color-danger); }
.btn-ghost { background: transparent; color: var(--color-muted); border: 1px solid var(--color-border); }
.btn-ghost:hover { background: var(--color-bg); color: var(--color-text); }
.btn-sm { padding: .4rem .75rem; font-size: .82rem; }

.alert { padding: .75rem 1rem; border-radius: 9px; margin-bottom: 1rem; font-size: .9rem; }
.alert-error { background: var(--color-danger-soft); color: var(--color-danger); }
.alert-success { background: var(--color-success-soft); color: var(--color-success); }
.alert-warning { background: var(--color-warning-soft); color: var(--color-warning); }
.alert-info { background: var(--color-primary-soft); color: var(--color-primary-dark); }

.text-muted { color: var(--color-muted); }
/* Bond (explicit user decision - MedPortal Echo Client installation guide, doctor/echo-client.php): a plain <ol> is perfectly readable, this just gives a multi-step guide enough breathing room between steps. */
.guide-steps { padding-inline-start: 1.4rem; display: flex; flex-direction: column; gap: .6rem; }

/* Bond (explicit user decision - automatic language-detection feature): the first-visit language suggestion banner, built on the existing .alert-warning visual language above rather than a new style. */
.lang-suggestion-banner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 1rem; }
.lang-suggestion-actions { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; font-size: .85rem; white-space: nowrap; }
.lang-suggestion-actions a { color: inherit; text-decoration: underline; }
.lang-suggestion-close { text-decoration: none !important; font-size: 1.1rem; line-height: 1; padding: 0 .2rem; }

/* ---- Tables / lists ---- */
.list-table { width: 100%; border-collapse: collapse; }
.list-table th, .list-table td { text-align: right; padding: .65rem .5rem; border-bottom: 1px solid var(--color-border); font-size: .9rem; }
.list-table th { color: var(--color-muted); font-weight: 600; font-size: .8rem; }
.list-table tr:last-child td { border-bottom: none; }
.list-table tr:hover td { background: var(--color-bg); }
.empty-row { text-align: center; color: var(--color-muted); padding: 2rem 0; }

/* Bond (explicit user decision, fixes a reported bug): a wide .list-table (many
   columns, e.g. an admin list with inline action buttons) must scroll inside its
   OWN container on a narrow screen - never the page itself (see html/body's own
   overflow-x: hidden guard above; a table wide enough to need scrolling must
   never be the thing that breaks that guard). Wrap <table class="list-table">
   in <div class="table-scroll"> wherever a table may realistically outgrow a
   phone's width. */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* Bond (explicit user request - "هر جا لیست بیماران و پزشکان و ... در پنل وب
   داریم امکان جستجو هم فراهم باشد"): the small instant-filter search box
   placed above a .list-table - see assets/js/app.js's own data-table-search
   handler for the filtering behavior itself. max-width keeps it from
   stretching edge-to-edge on a wide desktop list. */
.list-search { margin-bottom: .75rem; max-width: 22rem; }
@media (max-width: 600px) {
  .list-table th, .list-table td { padding: .5rem .4rem; font-size: .85rem; }
  /* A row's own action buttons (e.g. several inline <form>s) stack instead of forcing the row/column wider. */
  .list-table td form { display: block !important; margin: .3rem 0; }
  .list-table td form:first-child { margin-top: 0; }
}

.badge { display: inline-block; padding: .2rem .6rem; border-radius: 999px; font-size: .78rem; font-weight: 600; }
.badge-neutral { background: var(--color-border); color: var(--color-muted); }
.badge-primary { background: var(--color-primary-soft); color: var(--color-primary-dark); }
.badge-success { background: var(--color-success-soft); color: var(--color-success); }
.badge-warning { background: var(--color-warning-soft); color: var(--color-warning); }
.badge-danger { background: var(--color-danger-soft); color: var(--color-danger); }

.section-divider { border: none; border-top: 1px solid var(--color-border); margin: 1.25rem 0; }

.two-col { display: grid; grid-template-columns: 2fr 1fr; gap: 1.25rem; align-items: start; }
@media (max-width: 800px) {
  .two-col { grid-template-columns: 1fr; }
  .topbar { padding: .65rem 1rem; }
  .brand-sub { display: none; }
  .app-main { padding: 1rem; }
}

.timeline-item { padding: .85rem 0; border-bottom: 1px dashed var(--color-border); }
.timeline-item:last-child { border-bottom: none; }
.timeline-item .meta { color: var(--color-muted); font-size: .78rem; margin-top: .25rem; }

.otp-digits { display: flex; gap: .5rem; direction: ltr; }
.otp-digits input { text-align: center; letter-spacing: .2em; font-size: 1.1rem; }

/* ---- Record share (public, one-time link) ---- */
.record-share-block { padding: 1rem 0; border-bottom: 1px solid var(--color-border); }
.record-share-block:last-of-type { border-bottom: none; }
.record-share-block h3 { margin: 0 0 .5rem; font-size: 1rem; color: var(--color-primary-dark); }
.record-share-block ul { margin: 0; padding-inline-start: 1.25rem; }
.record-share-block li { margin-bottom: .35rem; }
.record-share-ai { background: var(--color-primary-soft); border-radius: var(--radius); padding: 1rem; border-bottom: none; }
.record-share-cta {
  margin-top: 1.5rem; padding: 1.25rem; text-align: center; background: var(--color-bg);
  border-radius: var(--radius); border: 1px dashed var(--color-border);
}
.record-share-cta h3 { margin: 0 0 .4rem; }
.record-share-cta p { color: var(--color-muted); margin: 0 0 .9rem; font-size: .9rem; }

/* ---- Admin dashboard charts (plain server-rendered SVG/HTML, no JS) ---- */
.bar-chart { display: flex; flex-direction: column; gap: .6rem; }
.bar-chart-row { display: grid; grid-template-columns: 8rem 1fr 6rem; align-items: center; gap: .6rem; }
.bar-chart-label { font-size: .85rem; color: var(--color-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-chart-track { background: var(--color-bg); border-radius: 999px; height: 10px; overflow: hidden; }
.bar-chart-fill { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--color-primary), var(--color-accent)); }
.bar-chart-value { font-size: .82rem; color: var(--color-muted); font-weight: 600; text-align: left; direction: ltr; }

.line-chart { width: 100%; height: auto; display: block; }
.line-chart-axis { stroke: var(--color-border); stroke-width: 1; }
.line-chart-line { fill: none; stroke: var(--color-primary); stroke-width: 2.5; }
.line-chart-dot { fill: var(--color-primary-dark); }
.line-chart-labels { display: flex; justify-content: space-between; color: var(--color-muted); font-size: .75rem; margin-top: .35rem; }
.line-chart-value-label { fill: var(--color-text); font-size: 11px; font-weight: 600; }
.line-chart-axis-label { fill: var(--color-muted); font-size: 10px; }
.line-chart-dot-danger { fill: var(--color-danger, #d33); }
.line-chart-value-label-danger { fill: var(--color-danger, #d33); font-weight: 700; }
.line-chart-danger-line { stroke: var(--color-danger, #d33); stroke-width: 1.5; stroke-dasharray: 5 4; }
.line-chart-danger-label { fill: var(--color-danger, #d33); font-size: 10px; font-weight: 600; }
.line-chart-danger-notice { color: var(--color-danger, #d33); font-size: .82rem; font-weight: 600; margin-top: .5rem; }

/* Bond (explicit user decision - "هر دو نمودار سیستولیک و دیاستولیک ... با رنگ‌های
   متفاوتی"): a second, visually distinct series (currently only blood pressure's
   diastolic line) drawn alongside the primary (systolic) one - accent (blue) for
   the line/dots/labels, warning (amber) for its own danger threshold/points, kept
   deliberately different from the primary series' teal/red pair so the two never
   get confused at a glance. Source order matters here: each -b rule must come
   after its non-b counterpart above so it wins the cascade on the shared property. */
.line-chart-line-b { stroke: var(--color-accent); }
.line-chart-dot-b { fill: var(--color-accent); }
.line-chart-value-label-b { fill: var(--color-accent); }
.line-chart-dot-b-danger { fill: var(--color-warning, #b45309); }
.line-chart-value-label-b-danger { fill: var(--color-warning, #b45309); font-weight: 700; }
.line-chart-danger-line-b { stroke: var(--color-warning, #b45309); stroke-width: 1.5; stroke-dasharray: 5 4; }
.line-chart-danger-label-b { fill: var(--color-warning, #b45309); font-size: 10px; font-weight: 600; }
.line-chart-legend { display: flex; gap: 1rem; font-size: .78rem; color: var(--color-muted); margin-top: .4rem; }
.line-chart-legend-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-inline-end: .3rem; vertical-align: middle; }

/* Bond (explicit user decision - "فراموش کردم"): patient-reported missed doses under a Care Plan task. */
.care-plan-missed { margin-top: .5rem; font-size: .82rem; color: var(--color-warning, #b45309); }
.care-plan-missed summary { cursor: pointer; font-weight: 600; }
.care-plan-missed ul { margin: .35rem 0 0; padding-inline-start: 1.25rem; }
.care-plan-missed li { margin: .15rem 0; }

.money-figure { font-weight: 700; color: var(--color-primary-dark); }

/* ---- Public landing page (index.php) ---- */
.hero {
  padding: 2.5rem 1.5rem; text-align: center; border-radius: var(--radius); margin-bottom: .5rem;
  background: radial-gradient(circle at top, var(--color-primary-soft) 0%, var(--color-bg) 65%);
}
.hero h1 { font-size: 1.75rem; margin: 0 0 .75rem; line-height: 1.5; }
.hero p { color: var(--color-muted); font-size: 1.02rem; max-width: 640px; margin: 0 auto 1.75rem; }
.hero-cta { display: flex; gap: .75rem; justify-content: center; flex-wrap: wrap; }
.hero-cta .btn, .hero-cta .btn-ghost { min-width: 180px; }

.hero-video { margin: 2rem auto 0; max-width: 560px; }
.hero-video video {
  width: 100%; border-radius: var(--radius); box-shadow: var(--shadow-md);
  background: #000; display: block;
}

.landing-section { padding: 2.5rem 0; }
.landing-section-header { text-align: center; margin-bottom: 1.75rem; }
.landing-section-header h2 { font-size: 1.35rem; margin: 0 0 .5rem; }
.landing-section-header p { color: var(--color-muted); margin: 0; }
.landing-section-shaded {
  background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius);
  padding: 2rem 1.5rem;
}

.value-card { text-align: center; }
.value-card .value-icon { font-size: 1.7rem; margin-bottom: .6rem; }
.value-card h3 { font-size: 1rem; margin: 0 0 .4rem; }
.value-card p { color: var(--color-muted); font-size: .88rem; margin: 0; }

.steps-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1.25rem; }
.steps-step { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); padding: 1.1rem; }
.steps-step-number {
  display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px;
  border-radius: 50%; background: var(--color-primary); color: #fff; font-weight: 700; margin-bottom: .6rem; font-size: .9rem;
}
.steps-step p { color: var(--color-text); font-size: .88rem; margin: 0; }

.audience-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .75rem 1.5rem; }
.audience-list li { padding-inline-start: 1.6rem; position: relative; color: var(--color-text); font-size: .92rem; }
.audience-list li::before { content: "✓"; position: absolute; inset-inline-start: 0; color: var(--color-primary); font-weight: 700; }

/* Bond (explicit user decision - "بزرگ‌ترین مزیت مدپورتال"): the patient meets the
   doctor's OWN branded bot, never the MedPortal name - this gets its own prominent
   section on the landing page, not just one card among many. */
.signature-section .signature-grid {
  display: grid; grid-template-columns: 1.1fr 1fr; gap: 2.5rem; align-items: center;
}
.signature-eyebrow {
  display: inline-block; font-size: .75rem; font-weight: 700; letter-spacing: .03em;
  color: var(--color-warning); background: var(--color-warning-soft); padding: .3rem .8rem;
  border-radius: 999px; margin-bottom: .9rem;
}
.signature-copy h2 { font-size: 1.5rem; margin: 0 0 .75rem; line-height: 1.5; }
.signature-copy > p { color: var(--color-muted); font-size: .95rem; margin: 0 0 1.25rem; }
.signature-mock {
  background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius);
  padding: 1.25rem; box-shadow: var(--shadow-md);
}
.signature-mock-header {
  display: flex; align-items: center; gap: .7rem; padding-bottom: .9rem; margin-bottom: .9rem;
  border-bottom: 1px solid var(--color-border);
}
.signature-mock-avatar {
  width: 42px; height: 42px; border-radius: 50%; flex-shrink: 0; font-size: 1.15rem;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
}
.signature-mock-name { font-weight: 600; font-size: .92rem; }
.signature-mock-status { font-size: .76rem; color: var(--color-success); display: flex; align-items: center; gap: .35rem; margin-top: .15rem; }
.signature-mock-status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--color-success); display: inline-block; }
.signature-mock-bubble {
  background: var(--color-primary-soft); border-radius: var(--radius) var(--radius) var(--radius) 4px;
  padding: .75rem 1rem; font-size: .86rem; color: var(--color-text); max-width: 92%;
}
@media (max-width: 760px) {
  .signature-section .signature-grid { grid-template-columns: 1fr; }
  .signature-mock { order: -1; }
}

.trust-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1.25rem; }
.trust-card { text-align: center; }
.trust-card .trust-icon { font-size: 1.5rem; margin-bottom: .5rem; }

.final-cta {
  text-align: center; padding: 2.5rem 1.5rem; background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
  color: #fff; border-radius: var(--radius); margin: 1rem 0 2.5rem;
}
.final-cta h2 { margin: 0 0 .5rem; font-size: 1.3rem; }
.final-cta p { margin: 0 0 1.5rem; opacity: .92; max-width: 560px; margin-inline: auto; margin-bottom: 1.5rem; }
.final-cta .btn-ghost { background: transparent; border-color: rgba(255,255,255,.6); color: #fff; }
.final-cta .btn-ghost:hover { background: rgba(255,255,255,.15); }
/* Bond: fixed color (not the theme-varying --color-primary-dark) - this button's own background is always solid white regardless of site theme, so its text must stay a readable dark teal on white either way. */
.final-cta .btn { background: #fff; color: #0b5a54; }
.final-cta .btn:hover { background: var(--color-bg); color: var(--color-primary-dark); }

/* ---- Public footer (shown instead of the plain copyright footer when logged out) ---- */
.public-footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1.5rem; margin-bottom: 1.5rem; text-align: start; }
.public-footer-grid h4 { font-size: .8rem; margin: 0 0 .75rem; color: var(--color-muted); text-transform: uppercase; letter-spacing: .03em; }
.public-footer-grid ul { list-style: none; margin: 0; padding: 0; }
.public-footer-grid li { margin-bottom: .55rem; }
.public-footer-grid a { color: var(--color-text); text-decoration: none; font-size: .88rem; }
.public-footer-grid a:hover { color: var(--color-primary); }
.public-footer-grid span { color: var(--color-muted); font-size: .88rem; }
.public-footer-bottom { text-align: center; color: var(--color-muted); font-size: .8rem; border-top: 1px solid var(--color-border); padding-top: 1.25rem; }

@media (max-width: 600px) {
  .hero h1 { font-size: 1.4rem; }
  .hero-cta .btn, .hero-cta .btn-ghost { width: 100%; }
}

/* ---- About (about.php) ---- */
.about-block { max-width: 720px; margin: 0 auto 2.25rem; }
.about-block h2 { font-size: 1.2rem; margin: 0 0 .6rem; }
.about-block p { color: var(--color-text); font-size: .95rem; line-height: 1.9; margin: 0; }

/* ---- Contact (contact.php) ---- */
.contact-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1.25rem; margin: 1.5rem 0 2rem; max-width: 640px; margin-inline: auto; }
.contact-card { text-align: center; }
.contact-card .contact-icon { font-size: 1.6rem; margin-bottom: .5rem; }
.contact-card h3 { margin: 0 0 .35rem; font-size: 1rem; }
.contact-card p { color: var(--color-muted); font-size: .88rem; margin: 0 0 .9rem; }
.contact-note {
  max-width: 640px; margin: 0 auto 2rem; background: var(--color-warning-soft); border: 1px solid var(--color-border);
  border-radius: var(--radius); padding: 1rem 1.25rem; color: var(--color-text); font-size: .88rem; line-height: 1.8;
}

/* ---- FAQ (faq.php) ---- */
.faq-group { max-width: 720px; margin: 0 auto 2.25rem; }
.faq-group h2 { font-size: 1.1rem; margin: 0 0 1rem; color: var(--color-primary-dark); }
.faq-item { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); margin-bottom: .75rem; overflow: hidden; }
.faq-item summary {
  cursor: pointer; padding: 1rem 1.25rem; font-weight: 600; font-size: .92rem; list-style: none;
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: "+"; font-size: 1.3rem; color: var(--color-primary); flex-shrink: 0; line-height: 1; }
.faq-item[open] summary::after { content: "\2212"; }
.faq-item p { margin: 0 1.25rem 1.1rem; color: var(--color-muted); font-size: .88rem; line-height: 1.8; }

/* ---- Public doctor directory (doctors.php) ---- */
.directory-search-form {
  display: flex; gap: .75rem; flex-wrap: wrap; justify-content: center; margin: 0 0 2rem;
}
.directory-search-form input[type="text"] {
  flex: 1 1 220px; max-width: 280px; padding: .65rem .9rem; border-radius: var(--radius);
  border: 1px solid var(--color-border); background: var(--color-surface); color: var(--color-text); font-size: .92rem;
}
.directory-grid { max-width: 960px; margin-inline: auto; }
.directory-avatar {
  width: 64px; height: 64px; max-width: 64px; max-height: 64px; min-width: 64px; min-height: 64px;
  border-radius: 50%; object-fit: cover; margin-bottom: .75rem; border: 1px solid var(--color-border);
  flex-shrink: 0;
}
.directory-avatar-fallback {
  display: flex; align-items: center; justify-content: center; font-size: 1.4rem; font-weight: 700;
  background: var(--color-primary-soft); color: var(--color-primary-dark);
}
.directory-card h3 { margin: 0 0 .3rem; font-size: 1.02rem; }
.directory-specialty { color: var(--color-primary); font-size: .86rem; font-weight: 600; margin: 0 0 .4rem; }
.directory-clinic { color: var(--color-muted); font-size: .86rem; margin: 0 0 .9rem; }
.directory-actions { display: flex; gap: .5rem; flex-wrap: wrap; }

/* ---- Guide (guide.php) ---- */
.guide-tabs { display: flex; gap: .75rem; justify-content: center; margin-bottom: 2rem; flex-wrap: wrap; }
.guide-tabs a {
  padding: .55rem 1.4rem; border-radius: 999px; border: 1px solid var(--color-border); color: var(--color-text);
  text-decoration: none; font-size: .9rem; font-weight: 600;
}
.guide-tabs a:hover { border-color: var(--color-primary); color: var(--color-primary); }
.guide-section { padding: 1rem 0 2.5rem; }
.guide-section.landing-section-shaded { padding: 2rem 1.5rem 2.5rem; }
.guide-section h2 { font-size: 1.3rem; margin: 0 0 .4rem; }
.guide-section > p { color: var(--color-muted); margin: 0 0 1.5rem; }

/* ---- Appointment booking (mobile-first: most traffic here arrives from inside
   the Telegram/Bale in-app browser on a phone) ---- */
.appt-wrap { max-width: 640px; margin: 0 auto; padding: 1.25rem 1rem 2.5rem; }

.appt-doctor-header {
  display: flex; align-items: center; gap: .9rem;
  background: linear-gradient(135deg, var(--color-primary-soft), var(--color-surface));
  border: 1px solid var(--color-border); border-radius: var(--radius);
  padding: 1.1rem 1.25rem; margin-bottom: 1.25rem;
}
.appt-doctor-avatar {
  width: 52px; height: 52px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem; font-weight: 700;
}
.appt-doctor-name { font-size: 1.08rem; font-weight: 700; margin: 0; }
.appt-doctor-specialty { color: var(--color-muted); font-size: .85rem; margin: .15rem 0 0; }

.appt-steps { display: flex; align-items: center; gap: .4rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.appt-step {
  display: flex; align-items: center; gap: .4rem; font-size: .78rem; color: var(--color-muted); font-weight: 600;
}
.appt-step-dot {
  width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: var(--color-border); color: var(--color-muted); font-size: .72rem; flex-shrink: 0;
}
.appt-step.is-done .appt-step-dot { background: var(--color-success); color: #fff; }
.appt-step.is-current .appt-step-dot { background: var(--color-primary); color: #fff; }
.appt-step.is-current { color: var(--color-text); }
.appt-step-sep { width: 16px; height: 1px; background: var(--color-border); }

.option-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: .75rem; }
.option-card {
  display: block; text-align: start; background: var(--color-surface); border: 1.5px solid var(--color-border);
  border-radius: var(--radius); padding: 1rem 1.1rem; cursor: pointer; text-decoration: none; color: inherit;
  transition: border-color .15s, box-shadow .15s;
}
.option-card:hover, .option-card:focus-visible { border-color: var(--color-primary); box-shadow: var(--shadow-md); outline: none; }
.option-card-title { font-weight: 700; font-size: .96rem; margin: 0 0 .3rem; }
.option-card-meta { color: var(--color-muted); font-size: .82rem; margin: 0; }
.option-card-price { color: var(--color-primary-dark); font-weight: 700; font-size: .88rem; margin-top: .5rem; }

.chip-grid { display: flex; flex-wrap: wrap; gap: .5rem; }
.chip {
  display: inline-flex; align-items: center; justify-content: center; min-width: 4.5rem;
  background: var(--color-surface); border: 1.5px solid var(--color-border); border-radius: 10px;
  padding: .6rem .9rem; font-size: .85rem; font-weight: 600; text-decoration: none; color: inherit;
  transition: border-color .15s, background .15s;
}
.chip:hover, .chip:focus-visible { border-color: var(--color-primary); background: var(--color-primary-soft); outline: none; }

.appt-summary-row { display: flex; justify-content: space-between; gap: 1rem; padding: .6rem 0; border-bottom: 1px dashed var(--color-border); font-size: .92rem; }
.appt-summary-row:last-of-type { border-bottom: none; }
.appt-summary-row .label { color: var(--color-muted); }
.appt-summary-row .value { font-weight: 600; text-align: end; }
.appt-summary-price { font-size: 1.15rem; font-weight: 700; color: var(--color-primary-dark); }

.appt-back-link { display: inline-block; margin-bottom: 1rem; color: var(--color-muted); font-size: .85rem; text-decoration: none; }
.appt-back-link:hover { color: var(--color-primary-dark); }

.appt-result-icon { width: 64px; height: 64px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 2rem; margin: 0 auto 1rem; }
.appt-result-icon.success { background: var(--color-success-soft); color: var(--color-success); }
.appt-result-icon.pending { background: var(--color-warning-soft); color: var(--color-warning); }
.appt-result-icon.failure { background: var(--color-danger-soft); color: var(--color-danger); }

@media (max-width: 600px) {
  .appt-doctor-header { padding: .9rem 1rem; }
  .option-grid { grid-template-columns: 1fr; }
  .chip { flex: 1 1 auto; min-width: 4rem; }
}

/* ---- Weekly schedule template (schedule-template.php): mobile-first cards ----
   Bond (explicit user decision): each day is a card containing its Morning/Evening
   shifts also as sub-cards; on mobile everything stacks vertically. At the
   800px breakpoint (same one used site-wide, see .two-col above) each day
   becomes one row: day name first, then the Morning shift, then the Evening
   shift, laid out side by side - DOM order alone gets this right in both
   RTL and LTR since flex-direction:row simply follows the page's own dir. */
.week-template { display: flex; flex-direction: column; gap: 1rem; }
.day-card { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); padding: 1rem 1.1rem; }
.day-card-header { font-weight: 700; font-size: 1rem; margin-bottom: .75rem; color: var(--color-primary-dark); }
.day-card-shifts { display: flex; flex-direction: column; gap: .85rem; }
.shift-card { background: var(--color-bg); border: 1px solid var(--color-border); border-radius: 10px; padding: .85rem .9rem; }
.shift-card-title { font-weight: 600; font-size: .88rem; color: var(--color-muted); margin-bottom: .6rem; }
.shift-card .field { margin-bottom: .6rem; }
.shift-card .field:last-child { margin-bottom: 0; }
.shift-card-row { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.shift-card input[readonly] { background: var(--color-border); color: var(--color-muted); cursor: not-allowed; }

@media (min-width: 800px) {
  .day-card { display: flex; flex-direction: row; align-items: flex-start; gap: 1.25rem; padding: 1rem 1.25rem; }
  .day-card-header { flex: 0 0 6rem; margin-bottom: 0; padding-top: .6rem; }
  .day-card-shifts { flex-direction: row; flex: 1; gap: 1rem; }
  .shift-card { flex: 1; }
}

/* Enamad trust-seal badge (footer.php) - shown on every page. */
.enamad-badge { display: flex; justify-content: center; padding: 1rem 0 .25rem; }
.enamad-badge img { display: block; height: 84px; width: auto; }

/* Light/Dark theme toggle button (header.php, includes/theme.php) */
.theme-toggle-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; min-width: 38px; min-height: 38px;
  border: 1px solid var(--color-border); border-radius: 9px;
  background: var(--color-surface); cursor: pointer; font-size: 1.05rem;
  padding: 0; transition: background .15s ease, border-color .15s ease;
}
.theme-toggle-btn:hover { background: var(--color-primary-soft); border-color: var(--color-primary); }

/* Bond (explicit user decision, Doctor Q&A Workflow): a visible "recording is in
   progress" indicator for the browser voice recorder (doctor/questions.php) - a
   pulsing red dot plus an mm:ss timer, so it's unmistakable the mic is live. */
@keyframes medportal-recording-pulse {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, .55); }
  70% { box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}
.recording-indicator { display: none; align-items: center; gap: .5rem; font-size: .85rem; color: var(--color-danger); font-weight: 600; }
.recording-indicator.is-active { display: inline-flex; }
.recording-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--color-danger); animation: medportal-recording-pulse 1.4s infinite; }

/* Bond (explicit user decision, doctor/questions.php): a card-per-question list,
   replacing a wide multi-column table that never fit a phone screen - one column
   everywhere, so no separate mobile/desktop markup is needed. */
.question-card-list { display: flex; flex-direction: column; gap: .75rem; }
.question-card { display: block; background: var(--color-bg); border: 1px solid var(--color-border); border-radius: var(--radius); padding: .85rem .9rem; text-decoration: none; color: inherit; }
.question-card.is-active { border-color: var(--color-primary); background: var(--color-primary-soft); }
.question-card-top { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: .5rem; }
.question-card-patient { font-weight: 700; font-size: .95rem; margin-bottom: .3rem; }
.question-card-text { font-size: .88rem; color: var(--color-text); margin-bottom: .6rem; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.question-card-meta { display: flex; justify-content: space-between; align-items: center; gap: .5rem; font-size: .82rem; color: var(--color-muted); flex-wrap: wrap; }
