/* ==========================================================================
   HMS design system - layered on top of Bootstrap 5.3 (vendored, no CDN).
   Palette: clinical teal primary, deep navy sidebar, slate neutrals.
   All colours meet WCAG AA contrast for their text.
   ========================================================================== */
:root {
  --hms-primary: #0f766e;
  --hms-primary-hover: #115e59;
  --hms-primary-soft: #e6f4f2;
  --hms-primary-ring: rgba(15, 118, 110, .25);

  --hms-sidebar-bg: #0b1f2a;
  --hms-sidebar-text: #b6c2cf;
  --hms-sidebar-muted: #8ba2b4;  /* 4.5:1 on the sidebar background */
  --hms-sidebar-active-bg: rgba(45, 212, 191, .12);
  --hms-sidebar-active-text: #5eead4;

  --hms-bg: #f4f6f8;
  --hms-surface: #ffffff;
  --hms-border: #e3e8ee;
  --hms-text: #0f172a;
  --hms-muted: #64748b;
  --hms-radius: .75rem;
  --hms-shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 1px 3px rgba(15, 23, 42, .06);
  --hms-sidebar-w: 248px;
  --hms-topbar-h: 60px;

  /* Bootstrap overrides */
  --bs-body-font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --bs-body-color: var(--hms-text);
  --bs-body-bg: var(--hms-bg);
  --bs-border-color: var(--hms-border);
  --bs-primary: var(--hms-primary);
  --bs-primary-rgb: 15, 118, 110;
  --bs-link-color: var(--hms-primary);
  --bs-link-color-rgb: 15, 118, 110;
  --bs-link-hover-color: var(--hms-primary-hover);
  --bs-link-hover-color-rgb: 17, 94, 89;
  --bs-focus-ring-color: var(--hms-primary-ring);
}

body { font-size: .9375rem; -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4 { font-weight: 650; letter-spacing: -.01em; }
a { text-decoration: none; }
.icon { width: 1.1em; height: 1.1em; flex-shrink: 0; vertical-align: -.15em;
        stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-lg { width: 2rem; height: 2rem; }
.hms-skip:focus { position: fixed; top: .6rem; left: .6rem; z-index: 2000; padding: .6rem 1rem;
                  border-radius: .5rem; background: var(--hms-primary); color: #fff; font-weight: 600; }

/* Buttons ------------------------------------------------------------------ */
.btn { --bs-btn-font-weight: 550; border-radius: .5rem; display: inline-flex; align-items: center; gap: .4rem; }
.btn-primary {
  --bs-btn-bg: var(--hms-primary); --bs-btn-border-color: var(--hms-primary);
  --bs-btn-hover-bg: var(--hms-primary-hover); --bs-btn-hover-border-color: var(--hms-primary-hover);
  --bs-btn-active-bg: var(--hms-primary-hover); --bs-btn-active-border-color: var(--hms-primary-hover);
  --bs-btn-disabled-bg: var(--hms-primary); --bs-btn-disabled-border-color: var(--hms-primary);
  --bs-btn-focus-shadow-rgb: 15, 118, 110;
}
.btn-outline-primary {
  --bs-btn-color: var(--hms-primary); --bs-btn-border-color: var(--hms-primary);
  --bs-btn-hover-bg: var(--hms-primary); --bs-btn-hover-border-color: var(--hms-primary);
  --bs-btn-active-bg: var(--hms-primary-hover); --bs-btn-focus-shadow-rgb: 15, 118, 110;
}
.btn-icon { --bs-btn-padding-x: .45rem; --bs-btn-padding-y: .3rem; color: var(--hms-muted);
            border: 1px solid transparent; background: transparent; }
.btn-icon:hover { background: #eef2f6; color: var(--hms-text); }
.btn-icon.danger:hover { background: #fee2e2; color: #b91c1c; }
.btn-icon.warn:hover { background: #fef3c7; color: #92400e; }
.form-control:focus, .form-select:focus { border-color: var(--hms-primary); box-shadow: 0 0 0 .2rem var(--hms-primary-ring); }

/* App shell ------------------------------------------------------------------ */
.hms-sidebar {
  width: var(--hms-sidebar-w); background: var(--hms-sidebar-bg); color: var(--hms-sidebar-text);
  --bs-offcanvas-width: var(--hms-sidebar-w); --bs-offcanvas-bg: var(--hms-sidebar-bg);
}
@media (min-width: 992px) {
  .hms-sidebar { position: fixed; inset: 0 auto 0 0; z-index: 1030; display: flex; flex-direction: column; }
  .hms-main { margin-left: var(--hms-sidebar-w); }
}
.hms-brand { display: flex; align-items: center; gap: .6rem; height: var(--hms-topbar-h); padding: 0 1.25rem;
             color: #fff; font-weight: 700; font-size: 1.05rem; border-bottom: 1px solid rgba(255,255,255,.06); }
.hms-brand a:hover { color: #fff; }
.hms-brand-mark { display: grid; place-items: center; width: 32px; height: 32px; border-radius: .5rem;
                  background: linear-gradient(135deg, #14b8a6, #0f766e); color: #fff; }
.hms-nav { padding: .75rem .75rem 1.5rem; overflow-y: auto; flex: 1; }
.hms-nav-section { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
                   color: var(--hms-sidebar-muted); padding: 1rem .75rem .4rem; }
.hms-nav-item { display: flex; align-items: center; gap: .25rem; border-radius: .5rem; }
.hms-nav-link { flex: 1; display: flex; align-items: center; gap: .7rem; padding: .5rem .75rem; border-radius: .5rem;
                color: var(--hms-sidebar-text); font-weight: 500; transition: background-color .12s, color .12s; }
.hms-nav-link:hover { color: #fff; background: rgba(255,255,255,.05); }
.hms-nav-item.active .hms-nav-link { color: var(--hms-sidebar-active-text); background: var(--hms-sidebar-active-bg); }
.hms-nav-add { display: grid; place-items: center; width: 28px; height: 28px; border-radius: .4rem;
               color: var(--hms-sidebar-muted); opacity: 0; transition: opacity .12s, background-color .12s; }
.hms-nav-item:hover .hms-nav-add, .hms-nav-add:focus-visible { opacity: 1; }
.hms-nav-add:hover { color: #fff; background: rgba(255,255,255,.08); }
@media (hover: none) { .hms-nav-add { opacity: 1; } }

.hms-topbar { position: sticky; top: 0; z-index: 1020; height: var(--hms-topbar-h); display: flex; align-items: center;
              gap: .75rem; padding: 0 1.5rem; background: rgba(255,255,255,.9); backdrop-filter: saturate(180%) blur(8px);
              border-bottom: 1px solid var(--hms-border); }
.hms-content { padding: 1.5rem; max-width: 1400px; }
@media (max-width: 575.98px) { .hms-content { padding: 1rem; } .hms-topbar { padding: 0 1rem; } }

.hms-avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; background: var(--hms-primary-soft);
              color: var(--hms-primary); display: inline-grid; place-items: center; font-weight: 700; font-size: .8rem; }
.hms-live { display: inline-flex; align-items: center; gap: .4rem; font-size: .78rem; font-weight: 600; padding: .25rem .6rem;
            border-radius: 999px; background: #f1f5f9; color: #475569; }
.hms-live::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #94a3b8; }
.hms-live.is-live { background: #dcfce7; color: #166534; }
.hms-live.is-live::before { background: #22c55e; box-shadow: 0 0 0 0 rgba(34,197,94,.6); animation: hms-pulse 2s infinite; }
@keyframes hms-pulse { 70% { box-shadow: 0 0 0 6px rgba(34,197,94,0); } 100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); } }
@media (prefers-reduced-motion: reduce) { .hms-live.is-live::before { animation: none; } }
/* Everything else that moves: hover lifts, the new-item flash, the nav edge fades. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important;
                           transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* Page header / cards ------------------------------------------------------------- */
.hms-page-header { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; }
.hms-page-header h1 { font-size: 1.5rem; margin: 0; }
.hms-page-header p { margin: .25rem 0 0; color: var(--hms-muted); }
.hms-card { background: var(--hms-surface); border: 1px solid var(--hms-border); border-radius: var(--hms-radius); box-shadow: var(--hms-shadow); }
.hms-card-header { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .9rem 1.1rem;
                   border-bottom: 1px solid var(--hms-border); font-weight: 600; }
.hms-card-body { padding: 1.1rem; }

.hms-stat { display: flex; align-items: center; gap: 1rem; padding: 1.1rem; }
.hms-stat-icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: .65rem; font-size: 1.25rem; }
.hms-stat-value { font-size: 1.6rem; font-weight: 700; line-height: 1.1; }
.hms-stat-label { color: var(--hms-muted); font-size: .85rem; }
.tone-teal   { background: #e6f4f2; color: #0f766e; }
.tone-blue   { background: #e0ecff; color: #1d4ed8; }
.tone-amber  { background: #fef3c7; color: #b45309; }
.tone-violet { background: #ede9fe; color: #6d28d9; }
.tone-danger { background: #fee2e2; color: #b91c1c; }

/* Toolbar: tabs + search ------------------------------------------------------ */
.hms-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem;
               padding: .75rem 1.1rem; border-bottom: 1px solid var(--hms-border); }
.hms-tabs { display: flex; gap: .25rem; overflow-x: auto; scrollbar-width: none; margin: 0; padding: 0; list-style: none; }
.hms-tabs::-webkit-scrollbar { display: none; }
.hms-tab { display: inline-flex; align-items: center; gap: .4rem; padding: .4rem .75rem; border-radius: .5rem;
           color: var(--hms-muted); font-weight: 550; white-space: nowrap; }
.hms-tab:hover { background: #f1f5f9; color: var(--hms-text); }
.hms-tab.active { background: var(--hms-primary-soft); color: var(--hms-primary); }
.hms-tab .count { font-size: .72rem; padding: .05rem .45rem; border-radius: 999px; background: #e2e8f0; color: #334155; }
.hms-tab.active .count { background: var(--hms-primary); color: #fff; }
.hms-search { position: relative; min-width: 220px; flex: 0 1 280px; }
.hms-search .icon { position: absolute; left: .7rem; top: 50%; transform: translateY(-50%); color: var(--hms-muted); }
.hms-search input { padding-left: 2.1rem; border-radius: .5rem; }
.hms-toolbar-right { display: flex; align-items: center; gap: .5rem; flex: 0 1 auto; flex-wrap: wrap;
                     justify-content: flex-end; }

/* Per-column filters ------------------------------------------------------------ */
.hms-filter-toggle { display: inline-flex; align-items: center; gap: .4rem; padding: .4rem .7rem; border-radius: .5rem;
                     border: 1px solid var(--hms-border); background: #fff; color: var(--hms-muted);
                     font-size: .84rem; font-weight: 550; line-height: 1.2; white-space: nowrap;
                     transition: background .12s ease, color .12s ease, border-color .12s ease; }
.hms-filter-toggle:hover { background: #f1f5f9; color: var(--hms-text); }
.hms-filter-toggle[aria-expanded="true"], .hms-filter-toggle.has-filters {
  border-color: var(--hms-primary); background: var(--hms-primary-soft); color: var(--hms-primary); }
.hms-filter-toggle .icon { width: 1rem; height: 1rem; }
.hms-filter-toggle .count { font-size: .72rem; padding: .05rem .4rem; border-radius: 999px;
                            background: var(--hms-primary); color: #fff; }
.hms-filter-toggle .count[hidden] { display: none; }
.hms-filters { flex: 1 1 100%; display: grid; gap: .6rem .9rem; margin-top: .35rem; padding: .85rem .95rem;
               border: 1px solid var(--hms-border); border-radius: .65rem; background: #f8fafc;
               grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); align-items: end; }
.hms-filters[hidden] { display: none; }
.hms-filter { display: flex; flex-direction: column; gap: .25rem; min-width: 0; }
.hms-filter-label { font-size: .7rem; font-weight: 650; letter-spacing: .03em; text-transform: uppercase;
                    color: var(--hms-muted); }
.hms-filter.active .hms-filter-label { color: var(--hms-primary); }
.hms-filter.active input, .hms-filter.active select { border-color: var(--hms-primary); background: #fff; }
.hms-filter input, .hms-filter select { border-radius: .45rem; min-width: 0; }
.hms-filter-range { display: flex; align-items: center; gap: .3rem; }
.hms-filter-range .sep { color: var(--hms-muted); font-size: .8rem; }
.hms-filter-range input { flex: 1 1 0; }
.hms-filter-clear { grid-column: 1 / -1; justify-self: start; display: inline-flex; align-items: center; gap: .35rem;
                    padding: .3rem .6rem; border: 0; border-radius: .45rem; background: transparent;
                    color: var(--hms-muted); font-size: .8rem; font-weight: 550; }
.hms-filter-clear:hover { background: #e2e8f0; color: var(--hms-text); }
.hms-filter-clear[hidden] { display: none; }
@media (max-width: 575.98px) { .hms-toolbar-right { flex: 1 1 100%; } .hms-filter-toggle { flex: 0 0 auto; } }

/* Tables ------------------------------------------------------------------------- */
.hms-table { margin: 0; --bs-table-bg: transparent; --bs-table-hover-bg: #f8fafc; }
.hms-table > thead th { position: sticky; top: 0; background: #f8fafc; color: var(--hms-muted); font-size: .75rem;
                        text-transform: uppercase; letter-spacing: .05em; font-weight: 650; padding: .7rem 1.1rem;
                        border-bottom: 1px solid var(--hms-border); white-space: nowrap; }
.hms-table > tbody td { padding: .7rem 1.1rem; vertical-align: middle; border-color: #eef2f6; }
.hms-table > tbody tr:last-child td { border-bottom: 0; }
.hms-table .cell-main { font-weight: 600; }
.hms-table .cell-sub { color: var(--hms-muted); font-size: .82rem; }
.hms-table .actions { text-align: right; white-space: nowrap; width: 1%; }
.hms-empty { text-align: center; color: var(--hms-muted); padding: 3rem 1rem !important; }
.hms-card-footer { padding: .75rem 1.1rem; border-top: 1px solid var(--hms-border); display: flex; align-items: center;
                   justify-content: space-between; gap: .75rem; color: var(--hms-muted); font-size: .85rem; flex-wrap: wrap; }
.pagination { --bs-pagination-active-bg: var(--hms-primary); --bs-pagination-active-border-color: var(--hms-primary);
              --bs-pagination-color: var(--hms-text); --bs-pagination-focus-box-shadow: 0 0 0 .2rem var(--hms-primary-ring); margin: 0; }
code.code { font-size: .82rem; font-weight: 700; color: #0f172a; background: #f1f5f9; padding: .15rem .45rem; border-radius: .35rem; letter-spacing: .04em; }

/* Status pills --------------------------------------------------------------------- */
.pill { display: inline-flex; align-items: center; gap: .35rem; font-size: .75rem; font-weight: 650; padding: .2rem .6rem;
        border-radius: 999px; white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill-open      { background: #dcfce7; color: #166534; }
.pill-booked    { background: #fef3c7; color: #92400e; }
.pill-completed { background: #dbeafe; color: #1e40af; }
.pill-cancelled { background: #f1f5f9; color: #475569; }
.pill-past      { background: #f1f5f9; color: #475569; }
.pill-pending   { background: #ede9fe; color: #5b21b6; }
.pill-declined  { background: #fee2e2; color: #991b1b; }
.chip { display: inline-block; font-size: .72rem; font-weight: 600; padding: .1rem .5rem; border-radius: .35rem;
        background: #f1f5f9; color: #475569; text-transform: uppercase; letter-spacing: .04em; }
.chip-ussd { background: #ede9fe; color: #5b21b6; }
.chip-api  { background: #e0f2fe; color: #075985; }

/* Forms / auth --------------------------------------------------------------------- */
.hms-form-card { max-width: 720px; }
.hms-auth { min-height: 100vh; display: grid; place-items: center; padding: 2rem 1rem;
            background: radial-gradient(1200px 600px at 10% -10%, #ccfbf1 0, transparent 60%), var(--hms-bg); }
.hms-auth-card { width: 100%; max-width: 420px; }
.hms-auth .hms-brand { color: var(--hms-text); border: 0; justify-content: center; padding: 0 0 1.25rem; height: auto; }
.asteriskField { color: #dc2626; margin-left: .15rem; }

/* Live feed & toasts --------------------------------------------------------------- */
.hms-feed { list-style: none; margin: 0; padding: 0; max-height: 420px; overflow-y: auto; }
.hms-feed li { display: flex; gap: .75rem; padding: .75rem 1.1rem; border-bottom: 1px solid #eef2f6; font-size: .875rem; }
.hms-feed li:last-child { border-bottom: 0; }
.hms-feed .dot { flex-shrink: 0; width: 8px; height: 8px; margin-top: .45rem; border-radius: 50%; background: var(--hms-primary); }
.hms-feed .time { color: var(--hms-muted); font-size: .75rem; }
.hms-feed .new { animation: hms-flash 1.5s ease-out; }
@keyframes hms-flash { from { background: #ecfdf5; } to { background: transparent; } }
.toast { border: 1px solid var(--hms-border); box-shadow: 0 10px 30px rgba(15, 23, 42, .12); border-radius: var(--hms-radius); }
.alert { border-radius: var(--hms-radius); }
.hms-flash { position: relative; overflow: hidden; }
.hms-flash-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; transform-origin: left center;
                 background: currentColor; opacity: .3; }

/* Waiting room: per-doctor lanes and the "call next" prompt --------------------- */
.hms-callout { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; justify-content: space-between;
               padding: .85rem 1.1rem; margin-bottom: 1rem; border: 1px solid var(--hms-primary);
               border-radius: var(--hms-radius); background: var(--hms-primary-soft); }
.hms-lane + .hms-lane { border-top: 1px solid var(--hms-border); }
.hms-lane-head { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem;
                 padding: .6rem 1.1rem; background: #f8fafc; border-bottom: 1px solid var(--hms-border); }
.hms-lane .hms-table > thead th { top: 0; }

/* Time grid: the pair of start/end dropdowns and their duration hint ------------ */
.hms-time-hint { margin-top: .3rem; font-size: .8rem; font-weight: 550; color: var(--hms-primary); min-height: 1.2em; }
.hms-time-hint:empty { display: none; }

/* Patient Bank timeline --------------------------------------------------------- */
.hms-timeline { list-style: none; margin: 0; padding: .5rem 1.1rem 1rem; position: relative; }
.hms-timeline::before { content: ""; position: absolute; left: calc(1.1rem + 13px); top: 1rem; bottom: 1rem;
                        width: 2px; background: var(--hms-border); }
.hms-timeline-item { display: flex; gap: .85rem; padding: .7rem 0; position: relative; }
.hms-timeline-mark { flex: 0 0 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
                     background: var(--hms-primary-soft); color: var(--hms-primary);
                     box-shadow: 0 0 0 4px #fff; z-index: 1; }
.hms-timeline-mark .icon { width: .95rem; height: .95rem; }
.hms-timeline-body { flex: 1 1 auto; min-width: 0; }
@media (max-width: 575.98px) { .hms-timeline::before { display: none; } }

/* Records assistant ------------------------------------------------------------- */
.hms-assistant-mark { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
                      background: var(--hms-primary-soft); color: var(--hms-primary); flex: 0 0 auto; }
.hms-assistant-mark.sm { width: 24px; height: 24px; }
.hms-assistant-mark.lg { width: 44px; height: 44px; margin-bottom: .6rem; }
.hms-assistant-mark .icon { width: .95rem; height: .95rem; }
.hms-assistant-mark.lg .icon { width: 1.4rem; height: 1.4rem; }

.hms-chat { display: flex; flex-direction: column; gap: .9rem; padding: 1.1rem;
            height: clamp(18rem, 48vh, 30rem); overflow-y: auto; scrollbar-width: thin;
            overscroll-behavior: contain; }
.hms-chat-intro { text-align: center; margin: auto; max-width: 26rem; color: var(--hms-muted); }
.hms-chat-intro .hms-assistant-mark { margin-inline: auto; }

.hms-chat-turn { display: flex; gap: .55rem; align-items: flex-start; max-width: min(40rem, 92%); }
.hms-chat-turn.patient { align-self: flex-end; }
.hms-chat-turn.patient .hms-chat-col { align-items: flex-end; }
.hms-chat-col { display: flex; flex-direction: column; gap: .3rem; min-width: 0; }

.hms-chat-bubble { padding: .65rem .9rem; border-radius: .9rem; background: #f1f5f9; line-height: 1.5;
                   overflow-wrap: anywhere; }
.hms-chat-turn.patient .hms-chat-bubble { background: var(--hms-primary); color: #fff;
                                          border-bottom-right-radius: .25rem; }
.hms-chat-turn.assistant .hms-chat-bubble { border-bottom-left-radius: .25rem; }
.hms-chat-bubble.declined { background: #fffbeb; border: 1px solid #fde68a; }
.hms-chat-bubble.emergency { background: #fef2f2; border: 1px solid #fecaca; color: #7f1d1d; }
.hms-chat-bubble.muted { background: #f8fafc; border: 1px dashed var(--hms-border); color: var(--hms-muted); }
.hms-chat-flag { display: flex; align-items: center; gap: .35rem; font-size: .75rem; font-weight: 650;
                 text-transform: uppercase; letter-spacing: .03em; margin-bottom: .35rem; opacity: .85; }
.hms-chat-flag .icon { width: .9rem; height: .9rem; }
.hms-chat-time { font-size: .7rem; color: var(--hms-muted); }

.hms-chat-sources { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; margin-top: .15rem; }
.hms-source { display: inline-flex; align-items: center; gap: .4rem; padding: .3rem .55rem; max-width: 17rem;
              border: 1px solid var(--hms-border); border-radius: .5rem; background: #fff;
              font-size: .78rem; color: var(--hms-text); }
.hms-source:hover { border-color: var(--hms-primary); background: var(--hms-primary-soft); }
.hms-source .icon { width: .9rem; height: .9rem; color: var(--hms-muted); flex: 0 0 auto; }
.hms-source .cell-sub { font-size: .68rem; }

.hms-typing { display: inline-flex; gap: .22rem; align-items: center; padding: .15rem 0; }
.hms-typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--hms-muted);
                animation: hms-typing 1.1s infinite ease-in-out; }
.hms-typing i:nth-child(2) { animation-delay: .15s; }
.hms-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes hms-typing { 0%, 60%, 100% { opacity: .25; transform: translateY(0); }
                        30% { opacity: 1; transform: translateY(-3px); } }

.hms-chat-suggestions { display: flex; flex-wrap: wrap; gap: .4rem; padding: 0 1.1rem .85rem; }
.hms-chip { padding: .35rem .7rem; border: 1px solid var(--hms-border); border-radius: 999px; background: #fff;
            font-size: .8rem; color: var(--hms-muted); }
.hms-chip:hover { border-color: var(--hms-primary); color: var(--hms-primary); background: var(--hms-primary-soft); }

.hms-chat-escalate { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center;
                     justify-content: space-between; padding: .8rem 1.1rem; background: #fffbeb;
                     border-top: 1px solid #fde68a; border-bottom: 1px solid #fde68a; }
.hms-chat-composer { display: flex; gap: .5rem; padding: .85rem 1.1rem;
                     border-top: 1px solid var(--hms-border); }
.hms-chat-composer input { flex: 1 1 auto; border-radius: .6rem; }
.hms-chat-composer .btn { min-width: 5.5rem; justify-content: center; }

.hms-can-list { list-style: none; margin: 0; padding: .4rem 0; }
.hms-can-list li { display: flex; gap: .55rem; align-items: flex-start; padding: .35rem 1.1rem; font-size: .86rem; }
.hms-can-list .icon { width: 1rem; height: 1rem; flex: 0 0 auto; margin-top: .12rem; }
.hms-can-list li.yes .icon { color: #1baf7a; }
.hms-can-list li.no { color: var(--hms-muted); }
.hms-can-list li.no .icon { color: #b91c1c; }

.hms-privacy { display: flex; gap: .75rem; align-items: flex-start; }
.hms-privacy > .icon { width: 1.4rem; height: 1.4rem; color: var(--hms-primary); flex: 0 0 auto; }

/* Patient questions queue --------------------------------------------------------- */
.hms-queue-meter { display: flex; gap: .6rem; align-items: center; padding: .6rem 1rem;
                   border: 1px solid #fde68a; border-radius: var(--hms-radius); background: #fffbeb; }
.hms-queue-count { font-size: 1.6rem; font-weight: 700; line-height: 1; color: #92400e; }
.hms-qa-list { list-style: none; margin: 0; padding: 0; }
.hms-qa { display: flex; gap: .85rem; padding: 1rem 1.1rem; border-bottom: 1px solid var(--hms-border); }
.hms-qa:last-child { border-bottom: 0; }
.hms-qa.waiting { background: #fffdf5; }
.hms-qa-body { flex: 1 1 auto; min-width: 0; }
.hms-qa-meta { display: flex; flex-wrap: wrap; gap: .45rem; align-items: center; margin-bottom: .45rem; }
.hms-qa-question { margin: 0 0 .6rem; padding: .55rem .8rem; border-left: 3px solid var(--hms-border);
                   background: #f8fafc; border-radius: 0 .5rem .5rem 0; font-size: .95rem; }
.hms-qa-answer { display: flex; gap: .55rem; align-items: flex-start; padding: .6rem .8rem;
                 background: #ecfdf5; border-radius: .5rem; }
.hms-qa-answer > .icon { width: 1rem; height: 1rem; color: #1baf7a; flex: 0 0 auto; margin-top: .2rem; }
.hms-qa-reply textarea { border-radius: .5rem; }
.hms-qa-actions { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .5rem; }
.hms-qa-empty { padding: 3rem 1.5rem; text-align: center; color: var(--hms-muted); }
.hms-qa-empty .icon { color: #1baf7a; margin-bottom: .6rem; }
@media (max-width: 575.98px) {
  .hms-qa { flex-direction: column; gap: .5rem; }
  .hms-qa-meta .ms-auto { margin-left: 0 !important; }
}

a.hms-stat { transition: transform .12s, box-shadow .12s; }
a.hms-stat:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(15, 23, 42, .08); }
.bar-ussd { background: #7c3aed; } .bar-web { background: var(--hms-primary); } .bar-api { background: #0284c7; }
.hms-auth .hms-card-body h1 { margin-bottom: .75rem; }

/* Bootstrap's .offcanvas-lg forces a transparent background at >= lg. Keep the sidebar dark. */
@media (min-width: 992px) {
  .hms-sidebar.offcanvas-lg { background-color: var(--hms-sidebar-bg) !important; }
  .hms-sidebar .offcanvas-body, .hms-sidebar.offcanvas-lg { overflow: hidden; }
}
.hms-nav-item { position: relative; }
.hms-nav-add { position: absolute; right: .35rem; top: 50%; transform: translateY(-50%); }
.hms-nav-link { padding-right: 2.25rem; }
.hms-brand a { color: #fff; }
@media (max-width: 575.98px) { .hms-search { flex: 1 1 100%; min-width: 0; } .hms-page-header .btn { width: 100%; justify-content: center; } }

/* Top bar brand (mobile) + larger avatar + busy lists */
.hms-topbar-brand { display: inline-flex; align-items: center; gap: .5rem; font-weight: 700; color: var(--hms-text); }
.hms-topbar-brand .hms-brand-mark { width: 28px; height: 28px; }
.hms-avatar-lg { width: 88px; height: 88px; font-size: 1.75rem; }
[data-hms-list][aria-busy="true"] .table-responsive { opacity: .55; transition: opacity .15s; }
.hms-search input::-webkit-search-cancel-button { cursor: pointer; }

/* Profile */
.hms-profile-head { display: flex; align-items: center; gap: 1.25rem; flex-wrap: wrap; }
.hms-profile-photo { position: relative; }
.hms-profile-photo .hms-avatar-lg { display: grid; }
.hms-profile-dl { display: grid; grid-template-columns: max-content 1fr; gap: .5rem 1.5rem; margin: 0; }
.hms-profile-dl dt { color: var(--hms-muted); font-weight: 500; }
.hms-profile-dl dd { margin: 0; }
.btn-icon.ok:hover { background: #dcfce7; color: #166534; }

/* Doctor directory */
.hms-avatar-md { width: 48px; height: 48px; font-size: 1rem; }
.hms-doctor-card { display: flex; flex-direction: column; gap: 1rem; padding: 1.1rem; height: 100%;
                   transition: transform .12s, box-shadow .12s, border-color .12s; }
.hms-doctor-card:hover { transform: translateY(-2px); border-color: var(--hms-primary); box-shadow: 0 8px 24px rgba(15, 23, 42, .08); }
.hms-doctor-card-foot { display: flex; align-items: center; justify-content: space-between; gap: .5rem; flex-wrap: wrap;
                        padding-top: .75rem; border-top: 1px solid var(--hms-border); font-size: .85rem; margin-top: auto; }
.min-w-0 { min-width: 0; }
.hms-prose p:last-child { margin-bottom: 0; }
.hms-ticket { display: inline-block; font-weight: 800; letter-spacing: .04em; padding: .15rem .5rem; border-radius: .4rem; background: var(--hms-sidebar-bg); color: #fff; font-variant-numeric: tabular-nums; }
.hms-ticket-lg { font-size: 1.6rem; padding: .35rem .8rem; }

/* ---- Sidebar scrolling -------------------------------------------------------------
   The menu scrolls on shorter screens. Browsers draw very different native scrollbars
   (Safari/Chrome "always show" draws a light 15px strip that ignores colour hints), so
   the menu has NO native scrollbar: it scrolls with wheel/trackpad/keyboard/touch and
   soft fades at the top/bottom edge show when there is more menu to see. */
.hms-sidebar { height: 100vh; height: 100dvh; }
.hms-nav-wrap { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.hms-nav {
  flex: 1; min-height: 0;
  overflow-x: hidden; overflow-y: auto;
  overscroll-behavior: contain;       /* scrolling the menu never scrolls the page */
  scrollbar-width: none;              /* Firefox, Chrome 121+, Safari 18.2+ */
  -ms-overflow-style: none;
}
.hms-nav::-webkit-scrollbar { display: none; width: 0; height: 0; }   /* older Safari/Chrome */
.hms-nav-wrap::before, .hms-nav-wrap::after {
  content: ""; position: absolute; left: 0; right: 0; height: 28px; pointer-events: none;
  opacity: 0; transition: opacity .15s; z-index: 1;
}
.hms-nav-wrap::before { top: 0; background: linear-gradient(var(--hms-sidebar-bg), transparent); }
.hms-nav-wrap::after { bottom: 0; background: linear-gradient(transparent, var(--hms-sidebar-bg)); }
.hms-nav-wrap.more-above::before, .hms-nav-wrap.more-below::after { opacity: 1; }

/* Custom sidebar scrollbar (see base.html): thin dark track, light thumb. */
.hms-nav-scrollbar { position: absolute; top: 6px; bottom: 6px; right: 3px; width: 6px; z-index: 2;
                     border-radius: 3px; background: rgba(255, 255, 255, .04); cursor: pointer;
                     transition: width .12s, background-color .12s; }
.hms-nav-scrollbar[hidden] { display: none; }
.hms-nav-thumb { width: 100%; border-radius: 3px; background: rgba(255, 255, 255, .22);
                 transition: background-color .12s; cursor: grab; touch-action: none; will-change: transform; }
.hms-nav-wrap:hover .hms-nav-thumb { background: rgba(255, 255, 255, .32); }
.hms-nav-scrollbar:hover, .hms-nav-wrap.dragging .hms-nav-scrollbar { width: 8px; background: rgba(255, 255, 255, .08); }
.hms-nav-scrollbar:hover .hms-nav-thumb, .hms-nav-wrap.dragging .hms-nav-thumb { background: rgba(94, 234, 212, .55); }
.hms-nav-wrap.dragging { user-select: none; }
.hms-nav-wrap.dragging .hms-nav-thumb { cursor: grabbing; }
/* Denser menu so more of it fits before scrolling, with room on the right for the
   custom scrollbar. This was two rules and the shorthand silently reset the first. */
.hms-nav { padding: .5rem 1rem 1rem .75rem; }
.hms-nav-section { padding: .85rem .75rem .3rem; }
.hms-nav-link { padding-top: .42rem; padding-bottom: .42rem; }
@media (max-height: 760px) {
  .hms-nav-section { padding-top: .6rem; }
  .hms-nav-link { padding-top: .32rem; padding-bottom: .32rem; }
}

/* Page scrollbar: match the neutral palette instead of the default heavy grey. */
html { scrollbar-color: #c3cbd5 transparent; }
.hms-feed { scrollbar-width: thin; scrollbar-color: #d5dbe2 transparent; }
