/* Vital Scan platform — design system.
   Self-contained: no dependency on the legacy styles.css.
   Drop this on any platform page (auth, dashboards, consult) and you get a
   consistent UI. The legacy /scan.html page still uses styles.css.

   Tokens follow the "Clinical Modernism" Stitch design system:
   Manrope for prose, Inter for data, soft tonal layers, 16px bento radius,
   conic-gradient scan ring, glass overlays for floating chrome. */

/* ---------- web fonts ---------- */
@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&family=Inter:wght@400;500;600;700&display=swap');

/* ---------- reset + tokens ---------- */
*,*::before,*::after{box-sizing:border-box}
html,body{margin:0;padding:0}
html{-webkit-text-size-adjust:100%}

:root{
  /* brand */
  --vs-primary:    #0a2e57;   /* primary-container in Stitch (deep navy CTA) */
  --vs-primary-2:  #0d3b66;
  --vs-primary-3:  #144d80;
  --vs-accent:     #1b9aaa;   /* tertiary teal — interactive */
  --vs-accent-2:   #62d9c8;   /* mint */
  --vs-accent-3:   #9be7e7;   /* mint glow — used for active/scan state */

  /* surfaces — cool-tinted tonal layers from Stitch */
  --vs-bg:         #f6f9ff;   /* base canvas (cool blue-white) */
  --vs-bg-2:       #ecf5ff;   /* surface-container-low */
  --vs-bg-3:       #e1f0ff;   /* surface-container */
  --vs-surface:    #ffffff;   /* level-1 cards */
  --vs-surface-2:  #fafcfd;
  --vs-line:       #e3eaf1;
  --vs-line-2:     #c4c6d0;   /* outline-variant */

  /* ink */
  --vs-ink:        #051d2d;   /* on-surface (deeper for contrast) */
  --vs-ink-2:      #1c4159;
  --vs-muted:      #5b7184;
  --vs-muted-2:    #8898a8;

  /* status */
  --vs-ok:         #15a467;
  --vs-warn:       #d04a2e;
  --vs-pending:    #b07b00;
  --vs-info:       #1b9aaa;
  --vs-error:      #ba1a1a;

  /* shape — bento language: 16px containers, 12px interactive, pill badges */
  --vs-radius:     16px;
  --vs-radius-sm:  12px;
  --vs-radius-xs:  8px;
  --vs-radius-btn: 12px;
  --vs-shadow-1:   0 1px 2px rgba(10,46,87,.04), 0 4px 12px rgba(10,46,87,.04);
  --vs-shadow-2:   0 12px 32px rgba(10,46,87,.06);
  --vs-shadow-3:   0 12px 40px rgba(10,46,87,.18);

  /* spacing rhythm (8px unit) */
  --vs-bento-gap:  16px;
  --vs-card-pad:   24px;
  --vs-gutter:     24px;

  /* type — Manrope for prose, Inter for data */
  --vs-font:       Manrope, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --vs-font-data:  Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

body{
  font: 15px/1.55 var(--vs-font);
  color: var(--vs-ink);
  background: var(--vs-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a{color: var(--vs-accent); text-decoration: none}
a:hover{color: var(--vs-primary-3); text-decoration: underline}
h1,h2,h3,h4,h5,h6{font-family: var(--vs-font); color: var(--vs-primary); font-weight: 700; letter-spacing: -.01em}
h1{font-size: 32px; line-height: 1.2; letter-spacing: -.02em; font-weight: 700}
h2{font-size: 24px; line-height: 1.3; font-weight: 600}
h3{font-size: 18px; line-height: 1.4; font-weight: 600}
code{font: 12px/1.4 ui-monospace,SFMono-Regular,Menlo,Consolas,monospace; background: var(--vs-bg-2); padding: 2px 6px; border-radius: 5px; color: var(--vs-primary-2)}

/* Tabular numerals on every numeric reading so values don't jitter when
   the rPPG engine streams updates mid-call. Also forces Inter for data. */
.tnum, .num, .metric .value, .vital-display,
.kpi-value, time, .vs-num{
  font-family: var(--vs-font-data);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}

/* ---------- app shell ---------- */
.app{min-height: 100vh; display: flex; flex-direction: column; background: var(--vs-bg)}

.app-header{
  /* Polished medical glass — Stitch overlay pattern */
  background: rgba(255,255,255,.78);
  backdrop-filter: blur(12px) saturate(140%);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
  border-bottom: 1px solid var(--vs-line);
  padding: 0 24px;
  height: 64px;
  display: flex; align-items: center; gap: 18px;
  position: sticky; top: 0; z-index: 50;
  box-shadow: 0 1px 0 rgba(10,46,87,.04);
}
.app-brand{
  display: flex; align-items: center; gap: 10px;
  font-weight: 700; font-size: 17px;
  color: var(--vs-primary);
  letter-spacing: -.015em; flex-shrink: 0;
  text-decoration: none;
}
.app-brand:hover{text-decoration: none; color: var(--vs-primary)}
.app-brand .brand-mark{
  width: 32px; height: 32px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--vs-primary) 0%, var(--vs-primary-3) 100%);
  display: flex; align-items: center; justify-content: center;
  position: relative;
  box-shadow: 0 2px 6px rgba(13,59,102,.25);
}
.app-brand .brand-pulse{
  width: 10px; height: 10px; border-radius: 50%;
  background: linear-gradient(135deg, var(--vs-accent-2), var(--vs-accent-3));
  box-shadow: 0 0 0 0 rgba(98,217,200,.6);
  animation: brand-pulse 2.4s ease-in-out infinite;
}
@keyframes brand-pulse{0%,100%{box-shadow:0 0 0 0 rgba(98,217,200,.6)}50%{box-shadow:0 0 0 8px rgba(98,217,200,0)}}
.app-brand .brand-text{font-weight: 600}
.app-brand .brand-text b{font-weight: 800; color: var(--vs-accent)}

.nav-toggle{
  display: none; background: transparent; border: 0;
  font-size: 20px; color: var(--vs-primary); cursor: pointer;
  padding: 4px 8px; margin-left: auto;
}
.app-nav{
  display: flex; gap: 4px;
  align-items: center; flex: 1;
}
.app-nav a{
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--vs-muted-2);
  padding: 9px 14px;
  border-radius: 9px;
  font-weight: 500; font-size: 13.5px;
  text-decoration: none;
  transition: all .14s ease;
}
.app-nav a .nav-ic{font-size: 14px; line-height: 1}
.app-nav a:hover{background: var(--vs-bg); color: var(--vs-primary-2); text-decoration: none}
.app-nav a.active{
  background: linear-gradient(135deg, rgba(27,154,170,.12), rgba(98,217,200,.08));
  color: var(--vs-primary); font-weight: 700;
  box-shadow: 0 1px 0 rgba(27,154,170,.18) inset, 0 0 0 1px rgba(27,154,170,.18) inset;
}

.app-actions{
  display: flex; align-items: center; gap: 10px;
  flex-shrink: 0; position: relative;
}

/* Bell */
.bell-btn{
  position: relative;
  width: 38px; height: 38px;
  border: 1px solid var(--vs-line);
  background: var(--vs-surface); border-radius: 10px;
  font-size: 16px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all .14s ease;
}
.bell-btn:hover{background: var(--vs-bg); border-color: var(--vs-line-2)}
.bell-badge{
  position: absolute; top: -4px; right: -4px;
  background: var(--vs-warn); color: white;
  font-size: 10px; font-weight: 800;
  min-width: 18px; height: 18px; border-radius: 9px;
  padding: 0 5px;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--vs-surface);
  letter-spacing: 0;
}

/* User chip */
.user-menu{position: relative}
.user-chip{
  display: flex; align-items: center; gap: 8px;
  background: var(--vs-surface); border: 1px solid var(--vs-line);
  padding: 4px 12px 4px 4px; border-radius: 999px;
  cursor: pointer;
  font: inherit;
  transition: all .14s ease;
}
.user-chip:hover{background: var(--vs-bg); border-color: var(--vs-line-2)}
.user-av{
  width: 30px; height: 30px; border-radius: 50%;
  background: linear-gradient(135deg, var(--vs-accent), var(--vs-accent-2));
  color: white; display: flex; align-items: center; justify-content: center;
  font-size: 11.5px; font-weight: 800; flex-shrink: 0;
  letter-spacing: .3px;
}
.user-av.lg{width: 44px; height: 44px; font-size: 15px}
.user-meta{display: flex; flex-direction: column; align-items: flex-start; line-height: 1.15; max-width: 160px}
.user-name{font-size: 12.5px; font-weight: 700; color: var(--vs-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 160px}
.user-role{font-size: 10.5px; color: var(--vs-muted); text-transform: uppercase; letter-spacing: .5px; font-weight: 600}
.user-caret{color: var(--vs-muted-2); font-size: 10px; margin-left: 2px}

.user-pop{
  position: absolute; top: calc(100% + 8px); right: 0;
  width: 260px;
  background: white; border: 1px solid var(--vs-line);
  border-radius: 12px;
  box-shadow: var(--vs-shadow-3);
  padding: 6px;
  display: none;
  z-index: 100;
}
.user-pop.open{display: block; animation: vs-toast-in .15s ease}
.user-pop-h{
  display: flex; align-items: center; gap: 12px;
  padding: 12px;
  border-bottom: 1px solid var(--vs-line);
  margin-bottom: 6px;
}
.user-pop-name{font-size: 13.5px; font-weight: 700; color: var(--vs-ink); word-break: break-all}
.user-pop-role{font-size: 11px; color: var(--vs-muted); text-transform: uppercase; letter-spacing: .5px; font-weight: 600; margin-top: 2px}
.user-pop-item{
  display: flex; align-items: center; gap: 10px;
  width: 100%;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 13px; color: var(--vs-ink-2);
  cursor: pointer; background: transparent; border: 0;
  font: inherit; text-align: left;
  text-decoration: none;
}
.user-pop-item:hover{background: var(--vs-bg); text-decoration: none; color: var(--vs-primary)}
.user-pop-item.danger{color: var(--vs-warn)}
.user-pop-item.danger:hover{background: #fde2dc; color: var(--vs-warn)}

/* Notification popover */
.notif-pop{
  position: absolute; top: calc(100% + 8px); right: 70px;
  width: 360px; max-width: calc(100vw - 32px);
  background: white; border: 1px solid var(--vs-line);
  border-radius: 12px;
  box-shadow: var(--vs-shadow-3);
  z-index: 100;
}
.notif-pop.hidden{display: none}
.notif-pop-h{
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 16px; border-bottom: 1px solid var(--vs-line);
}
.notif-pop-h h3{margin: 0; font-size: 14px}
.notif-pop-body{max-height: 420px; overflow-y: auto}
.notif-item{
  display: grid; grid-template-columns: 32px 1fr;
  gap: 10px; padding: 12px 16px;
  border-bottom: 1px solid var(--vs-line);
  font-size: 13px;
}
.notif-item:last-child{border-bottom: 0}
.notif-item.unread{background: linear-gradient(90deg, rgba(27,154,170,.06) 0%, transparent 100%)}
.notif-item.unread::before{
  content: ""; position: absolute; left: 6px; margin-top: 5px;
  width: 6px; height: 6px; border-radius: 50%; background: var(--vs-accent);
}
.notif-icon{
  width: 32px; height: 32px; border-radius: 9px;
  background: var(--vs-bg); color: var(--vs-primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
}
.notif-title{font-weight: 700; color: var(--vs-ink); font-size: 13px}
.notif-body{color: var(--vs-muted); font-size: 12px; margin-top: 2px; line-height: 1.45}
.notif-time{color: var(--vs-muted-2); font-size: 11px; margin-top: 4px; font-variant-numeric: tabular-nums}

/* Mobile collapse */
@media (max-width: 880px){
  .app-header{padding: 0 14px; gap: 10px}
  .nav-toggle{display: block; order: 1}
  .app-brand .brand-text{display: none}
  .user-meta{display: none}
  .user-chip{padding: 4px}
  .app-nav{
    position: absolute; top: 64px; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 0;
    background: white; border-bottom: 1px solid var(--vs-line);
    padding: 8px; display: none;
  }
  .app-nav.open{display: flex}
  .app-nav a{padding: 12px 16px; border-radius: 8px}
  .notif-pop{right: 14px; left: 14px; width: auto}
}
.app-main{
  flex: 1; padding: 28px 22px;
  max-width: 1280px; margin: 0 auto; width: 100%;
}
.app-footer{
  background: var(--vs-surface); border-top: 1px solid var(--vs-line);
  padding: 14px 22px; color: var(--vs-muted); text-align: center; font-size: 12px;
}
.page-title{
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  margin: 0 0 22px;
}
.page-title h1{margin: 0}
.page-kicker{
  font-size: 12px; font-weight: 700; color: var(--vs-accent);
  text-transform: uppercase; letter-spacing: .8px; margin-bottom: 4px;
}

/* ---------- card (bento container) ---------- */
.card{
  background: var(--vs-surface);
  border-radius: var(--vs-radius);
  border: 1px solid var(--vs-line);
  box-shadow: var(--vs-shadow-1);
  padding: var(--vs-card-pad);
  margin-bottom: 18px;
  transition: box-shadow .18s ease, transform .18s ease, border-color .18s ease;
}
.card-tight{padding: 16px}
.card h2{margin: 0 0 4px; font-size: 18px}
.card h3{margin: 0 0 6px}
/* Hover-lift variant for clickable bento tiles. Use as `class="card bento"` */
.bento{cursor: default}
.bento:hover{box-shadow: var(--vs-shadow-2); transform: translateY(-2px)}
.card-sub{color: var(--vs-muted); font-size: 13px; margin: 0 0 14px}
.card-actions{margin-top: 14px; display: flex; gap: 8px; flex-wrap: wrap}
.card-link{
  display: block; text-decoration: none; color: inherit;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.card-link:hover{
  text-decoration: none; transform: translateY(-1px);
  box-shadow: var(--vs-shadow-2); border-color: var(--vs-accent);
}

/* ---------- grid (bento rhythm: 16px gap) ---------- */
.grid{display: grid; gap: var(--vs-bento-gap)}
.grid-2{grid-template-columns: repeat(auto-fit,minmax(280px,1fr))}
.grid-3{grid-template-columns: repeat(auto-fit,minmax(220px,1fr))}
.grid-4{grid-template-columns: repeat(auto-fit,minmax(180px,1fr))}
@media (max-width: 640px){
  .app-main{padding: 18px 14px}
  .app-header{padding: 0 14px}
  h1{font-size: 22px}
}

/* ---------- metric tile (vital reading card) ---------- */
.metric{
  background: var(--vs-surface);
  border: 1px solid var(--vs-line);
  border-radius: var(--vs-radius);
  padding: 18px 20px;
  position: relative; overflow: hidden;
  transition: box-shadow .18s ease, transform .18s ease;
}
.metric:hover{box-shadow: var(--vs-shadow-2); transform: translateY(-1px)}
.metric::before{
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: linear-gradient(180deg, var(--vs-accent), var(--vs-accent-2));
}
.metric .label{
  font-family: var(--vs-font-data);
  font-size: 12px; text-transform: uppercase; letter-spacing: .6px;
  color: var(--vs-muted); font-weight: 500;
}
.metric .value{
  font-family: var(--vs-font-data);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
  font-size: 36px; color: var(--vs-primary);
  font-weight: 600; margin-top: 4px; letter-spacing: -.02em;
  line-height: 1.05;
}
.metric .hint{font-size: 12px; color: var(--vs-muted); margin-top: 4px}

/* Hero-sized vital readout (used on scan results / dashboard hero card) */
.vital-display{
  font-family: var(--vs-font-data);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
  font-size: 48px; line-height: 1; font-weight: 600;
  color: var(--vs-primary); letter-spacing: -.02em;
}
.vital-display .unit{
  font-size: 16px; font-weight: 500;
  color: var(--vs-muted); margin-left: 4px; letter-spacing: 0;
}

/* Status dot used on bento tiles (top-right corner) */
.status-dot{
  position: absolute; top: 14px; right: 14px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--vs-ok);
  box-shadow: 0 0 0 4px rgba(21,164,103,.12);
}
.status-dot.warn{background: var(--vs-warn); box-shadow: 0 0 0 4px rgba(208,74,46,.12)}
.status-dot.pending{background: var(--vs-pending); box-shadow: 0 0 0 4px rgba(176,123,0,.12)}

/* ---------- forms (Stitch "Clinical Modernism") ---------- */
form .row{
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fit,minmax(220px,1fr));
  margin-bottom: 16px;
}
form label{
  display: block;
  font-family: var(--vs-font);
  font-size: 13px; color: var(--vs-ink-2); font-weight: 600;
  letter-spacing: -.005em; margin-bottom: 8px;
}
form label .req{color: var(--vs-warn); margin-left: 2px; font-weight: 700}
form input[type=text],form input[type=email],form input[type=tel],form input[type=password],
form input[type=number],form input[type=date],form input[type=datetime-local],form input[type=time],
form input[type=search],form input[type=url],
form input[type=file],form select,form textarea{
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--vs-line);
  border-radius: var(--vs-radius-sm);
  font: 500 14.5px/1.4 var(--vs-font);
  color: var(--vs-ink);
  background: var(--vs-surface);
  transition: border-color .14s ease, box-shadow .14s ease, background .14s ease;
  min-height: 44px;          /* tap-target floor on mobile */
}
/* Tabular numerals for numeric inputs so digits don't jitter */
form input[type=number],form input[type=date],form input[type=datetime-local],form input[type=time]{
  font-family: var(--vs-font-data);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}
form select{
  /* Custom chevron — replaces the OS default arrow with a Lucide-style one */
  appearance: none; -webkit-appearance: none; -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%235b7184' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 16px;
  padding-right: 40px;
}
form textarea{min-height: 96px; resize: vertical; line-height: 1.55; padding: 12px 14px}
form input::placeholder,form textarea::placeholder{color: var(--vs-muted-2); font-weight: 400}
form input:hover:not(:focus):not(:disabled),
form select:hover:not(:focus):not(:disabled),
form textarea:hover:not(:focus):not(:disabled){
  border-color: var(--vs-line-2);
  background: var(--vs-surface);
}
form input:focus,form select:focus,form textarea:focus{
  /* Stitch input focus: teal border + soft mint-glow halo */
  border-color: var(--vs-accent); outline: 0;
  box-shadow: 0 0 0 4px rgba(155,231,231,.45);
  background: var(--vs-surface);
}
form input:disabled,form select:disabled,form textarea:disabled{
  background: var(--vs-bg-2); color: var(--vs-muted);
  cursor: not-allowed; border-color: var(--vs-line);
}
/* Validation states — applied via aria-invalid="true" or .has-error */
form input[aria-invalid="true"], form select[aria-invalid="true"], form textarea[aria-invalid="true"],
form .has-error input, form .has-error select, form .has-error textarea{
  border-color: var(--vs-warn);
  box-shadow: 0 0 0 4px rgba(208,74,46,.14);
}
form input[type=file]{
  padding: 10px 14px; cursor: pointer;
}
form input[type=file]::-webkit-file-upload-button{
  margin-right: 12px; padding: 6px 12px;
  border: 1px solid var(--vs-line); background: var(--vs-bg-2);
  color: var(--vs-ink-2); border-radius: 8px;
  font: 600 12.5px/1 var(--vs-font); cursor: pointer;
}
form .help{color: var(--vs-muted); font-size: 12.5px; margin-top: 6px; line-height: 1.5}
.form-error{color: var(--vs-warn); font-size: 13px; margin-top: 8px; min-height: 18px; font-weight: 500}
.form-ok{color: var(--vs-ok); font-size: 13px; margin-top: 8px; font-weight: 500}

/* Input with leading icon. Markup:
     <div class="input-group">
       <i class="input-ic" data-vsi="search"></i>
       <input type="search" placeholder="Search doctors…">
     </div>
   The wrapper handles spacing; the icon stays vertically centered. */
.input-group{
  position: relative;
  display: block;
}
.input-group > .input-ic{
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  width: 18px; height: 18px;
  color: var(--vs-muted); pointer-events: none;
  display: inline-flex;
}
.input-group > .input-ic + input,
.input-group > .input-ic ~ input,
.input-group > .input-ic ~ select{
  padding-left: 40px;
}
.input-group:focus-within > .input-ic{color: var(--vs-accent)}

/* Trailing-icon button (e.g. show/hide password) inside the input. */
.input-group > .input-btn{
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; background: transparent; cursor: pointer;
  color: var(--vs-muted); border-radius: 8px;
}
.input-group > .input-btn:hover{color: var(--vs-primary); background: var(--vs-bg-2)}
.input-group > .input-btn ~ input{padding-right: 44px}

/* OTP input row — six 1-digit boxes side by side */
.otp-row{
  display: grid; grid-template-columns: repeat(6, 1fr);
  gap: 8px; max-width: 320px;
}
.otp-row input{
  text-align: center;
  font-family: var(--vs-font-data);
  font-variant-numeric: tabular-nums;
  font-size: 22px; font-weight: 600;
  padding: 14px 0 !important;
  letter-spacing: .04em;
}

/* Checkbox / radio — modern square + soft glow on focus */
form input[type=checkbox], form input[type=radio]{
  appearance: none; -webkit-appearance: none;
  width: 18px; height: 18px; min-height: 18px;
  border: 1.5px solid var(--vs-line-2);
  border-radius: 5px;
  background: var(--vs-surface);
  cursor: pointer;
  display: inline-grid; place-content: center;
  transition: all .14s ease;
  vertical-align: middle;
  margin: 0 6px 0 0;
  padding: 0;
}
form input[type=radio]{border-radius: 50%}
form input[type=checkbox]:hover, form input[type=radio]:hover{border-color: var(--vs-accent)}
form input[type=checkbox]:checked, form input[type=radio]:checked{
  background: var(--vs-primary); border-color: var(--vs-primary);
}
form input[type=checkbox]:checked::after{
  content: ""; width: 10px; height: 10px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");
  background-size: contain; background-repeat: no-repeat;
}
form input[type=radio]:checked::after{
  content: ""; width: 8px; height: 8px; border-radius: 50%; background: white;
}
form input[type=checkbox]:focus-visible, form input[type=radio]:focus-visible{
  box-shadow: 0 0 0 4px rgba(155,231,231,.45);
}

/* Inline icon — sized + coloured to match surrounding text */
.icon{
  display: inline-block;
  width: 1em; height: 1em;
  vertical-align: -.125em;
  flex-shrink: 0;
  color: currentColor;
  pointer-events: none;
}
/* Larger sizes — opt-in via class */
.icon-sm{width: 14px; height: 14px}
.icon-md{width: 18px; height: 18px}
.icon-lg{width: 22px; height: 22px}
.icon-xl{width: 28px; height: 28px}
/* Inside buttons icons get a touch more breathing room */
.btn .icon{width: 16px; height: 16px; margin-right: 2px}
.btn-sm .icon{width: 14px; height: 14px}
.btn-lg .icon{width: 18px; height: 18px}
/* Nav icons use the existing .nav-ic envelope */
.nav-ic .icon{width: 16px; height: 16px}
.bell-btn .icon{width: 18px; height: 18px}
.user-caret .icon{width: 12px; height: 12px}
.user-pop-item .icon{width: 16px; height: 16px; margin-right: 2px; color: var(--vs-muted)}
.user-pop-item:hover .icon{color: var(--vs-primary)}
.user-pop-item.danger .icon{color: var(--vs-warn)}

/* ---------- buttons ---------- */
/* Stitch CTA system:
     primary  = navy fill, white ink, 12px radius, no shadow
     accent   = teal-mint gradient (legacy interactive)
     ghost    = outline + teal text */
.btn{
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 11px 18px;
  border: 1px solid transparent; border-radius: var(--vs-radius-btn);
  font: 600 14px/1 var(--vs-font);
  cursor: pointer; text-decoration: none;
  background: var(--vs-bg-2); color: var(--vs-ink);
  transition: all .14s ease;
  white-space: nowrap;
}
.btn:hover{background: #dfe7ee; color: var(--vs-ink); text-decoration: none}
.btn:active{transform: translateY(1px)}
.btn:disabled{opacity: .55; cursor: not-allowed}
.btn-primary{
  background: var(--vs-primary);
  color: white; border-color: transparent;
}
.btn-primary:hover{background: var(--vs-primary-2); color: white; transform: translateY(-1px)}
.btn-accent{
  background: linear-gradient(135deg, var(--vs-accent), var(--vs-accent-2));
  color: white; border-color: transparent;
  box-shadow: 0 1px 0 rgba(255,255,255,.2) inset, 0 4px 12px rgba(27,154,170,.25);
}
.btn-accent:hover{filter: brightness(1.05); color: white; transform: translateY(-1px)}
.btn-dark{background: var(--vs-primary); color: white}
.btn-dark:hover{background: var(--vs-primary-2); color: white}
.btn-danger{background: var(--vs-warn); color: white}
.btn-danger:hover{filter: brightness(1.05); color: white}
.btn-ghost{background: transparent; color: var(--vs-accent); border-color: var(--vs-line-2)}
.btn-ghost:hover{background: var(--vs-bg-2); color: var(--vs-primary); border-color: var(--vs-accent)}
.btn-sm{padding: 7px 12px; font-size: 13px}
.btn-lg{padding: 14px 24px; font-size: 15.5px; font-weight: 600}
.btn-block{display: flex; width: 100%}

/* ---------- tables ---------- */
.table{
  width: 100%; border-collapse: collapse;
  background: var(--vs-surface);
  border-radius: var(--vs-radius); overflow: hidden;
  border: 1px solid var(--vs-line);
  font-size: 13.5px;
}
.table th{
  background: var(--vs-bg);
  color: var(--vs-ink-2);
  text-align: left;
  padding: 11px 14px;
  font-size: 11.5px; letter-spacing: .6px; text-transform: uppercase;
  font-weight: 700;
  border-bottom: 1px solid var(--vs-line);
}
.table td{
  padding: 11px 14px;
  border-bottom: 1px solid var(--vs-line);
  vertical-align: middle;
}
.table tbody tr:hover{background: var(--vs-surface-2)}
.table tbody tr:last-child td{border-bottom: 0}

/* ---------- chip / tag ---------- */
.tag{
  display: inline-block;
  padding: 3px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 700;
  letter-spacing: .4px; text-transform: uppercase;
  line-height: 1.4;
}
.tag-ok{background: #e2f6ed; color: var(--vs-ok)}
.tag-pending{background: #fff3d4; color: var(--vs-pending)}
.tag-warn{background: #fde2dc; color: var(--vs-warn)}
.tag-info{background: #dcecf3; color: var(--vs-accent)}
.tag-mute{background: var(--vs-bg-2); color: var(--vs-muted)}

/* ---------- alerts / toasts ---------- */
.alert{
  padding: 11px 14px;
  border-radius: var(--vs-radius-xs);
  font-size: 13px; margin-bottom: 14px;
  border: 1px solid transparent;
  line-height: 1.5;
}
.alert-info{background: #e6f4f7; color: var(--vs-primary-3); border-color: #cfe6ec}
.alert-ok{background: #e2f6ed; color: #0a7a4d; border-color: #b6e7cd}
.alert-warn{background: #fde2dc; color: #883121; border-color: #f4c2b8}
.alert b{font-weight: 700}

.toast-stack{position: fixed; top: 18px; right: 18px; display: flex; flex-direction: column; gap: 10px; z-index: 1000}
.toast{
  background: white; border-left: 4px solid var(--vs-accent);
  padding: 12px 16px; border-radius: var(--vs-radius-xs);
  box-shadow: var(--vs-shadow-3);
  min-width: 260px; max-width: 360px;
  animation: vs-toast-in .25s ease;
}
.toast.toast-ok{border-left-color: var(--vs-ok)}
.toast.toast-warn{border-left-color: var(--vs-warn)}
.toast .toast-title{font-weight: 700; color: var(--vs-ink); font-size: 13.5px}
.toast .toast-body{color: var(--vs-muted); font-size: 12.5px; margin-top: 3px; line-height: 1.5}
@keyframes vs-toast-in{ from{opacity: 0; transform: translateY(-6px)} }

/* ---------- modal ---------- */
.modal-back{
  position: fixed; inset: 0;
  background: rgba(13,44,59,.55);
  display: none; align-items: center; justify-content: center;
  z-index: 900; padding: 16px;
  backdrop-filter: blur(2px);
}
.modal-back.open{display: flex}
.modal{
  background: white;
  border-radius: var(--vs-radius);
  padding: 24px;
  max-width: 580px; width: 100%; max-height: 92vh; overflow: auto;
  box-shadow: var(--vs-shadow-3);
  animation: vs-toast-in .2s ease;
}
.modal h2{margin: 0 0 12px; font-size: 18px}

/* ---------- AUTH (login / signup) ---------- */
.auth-page{
  min-height: 100vh;
  display: grid; grid-template-columns: 1.1fr 1fr;
  background: var(--vs-bg);
}
.auth-hero{
  padding: 56px 56px 42px;
  display: flex; flex-direction: column; justify-content: center; gap: 18px;
  color: white;
  background:
    radial-gradient(900px 500px at 0% 0%, rgba(98,217,200,.22), rgba(98,217,200,0) 60%),
    radial-gradient(900px 600px at 100% 100%, rgba(11,90,140,.55), rgba(11,90,140,0) 60%),
    linear-gradient(135deg, #06203a 0%, #0d3b66 50%, #144e7e 100%);
  position: relative; overflow: hidden;
}
.auth-hero::before{
  content: ""; position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.04) 1px, transparent 1px);
  background-size: 32px 32px; pointer-events: none; opacity: .35;
}
.auth-hero > *{position: relative; z-index: 1}
.auth-hero .auth-brand{
  display: inline-flex; align-items: center; gap: 10px;
  font-weight: 800; font-size: 18px; letter-spacing: -.01em;
  margin-bottom: 8px;
}
.auth-hero .auth-brand .dot{
  width: 10px; height: 10px; border-radius: 50%;
  background: linear-gradient(135deg, var(--vs-accent-2), var(--vs-accent-3));
  box-shadow: 0 0 0 4px rgba(98,217,200,.18);
}
.auth-hero h1{
  color: white; font-size: 38px; line-height: 1.15;
  letter-spacing: -.025em; margin: 0;
}
.auth-hero h1 .acc{
  background: linear-gradient(90deg, var(--vs-accent-2), var(--vs-accent-3));
  -webkit-background-clip: text; color: transparent; background-clip: text;
}
.auth-hero p{font-size: 15px; line-height: 1.7; color: rgba(255,255,255,.86); max-width: 480px; margin: 0}
.auth-hero .auth-points{
  display: flex; flex-direction: column; gap: 12px; margin-top: 12px;
}
.auth-hero .auth-points li{
  display: flex; align-items: flex-start; gap: 10px;
  list-style: none; font-size: 14px; color: rgba(255,255,255,.92);
}
.auth-hero .auth-points li .ic{
  width: 22px; height: 22px; flex-shrink: 0; border-radius: 6px;
  background: rgba(98,217,200,.2); color: var(--vs-accent-2);
  display: inline-flex; align-items: center; justify-content: center; font-size: 12px;
}
.auth-hero .auth-points{padding: 0; margin: 16px 0}
.auth-hero .auth-foot{margin-top: auto; opacity: .68; font-size: 12.5px; padding-top: 18px}
.auth-hero .auth-foot a{color: var(--vs-accent-3)}

.auth-panel{
  background: var(--vs-surface);
  padding: 56px 48px;
  display: flex; align-items: center; justify-content: center;
  overflow-y: auto;
}
.auth-card{width: 100%; max-width: 400px}
.auth-card h2{font-size: 26px; margin: 0 0 6px; letter-spacing: -.02em}
.auth-card .sub{margin: 0 0 22px; color: var(--vs-muted); font-size: 14px}

.auth-tabs{
  display: flex; gap: 4px;
  background: var(--vs-bg);
  padding: 4px; border-radius: 10px;
  margin-bottom: 22px;
}
.auth-tab{
  flex: 1; text-align: center;
  padding: 9px 6px;
  border-radius: 7px;
  font-size: 13px; font-weight: 600;
  color: var(--vs-muted);
  cursor: pointer; background: transparent; border: 0;
  transition: all .15s ease;
}
.auth-tab:hover{color: var(--vs-ink)}
.auth-tab.active{
  background: white; color: var(--vs-primary);
  box-shadow: 0 1px 3px rgba(0,0,0,.05), 0 4px 14px rgba(13,44,59,.06);
}

.auth-foot-row{
  margin-top: 18px; padding-top: 18px;
  border-top: 1px solid var(--vs-line);
  display: flex; justify-content: space-between; align-items: center;
  font-size: 13px; color: var(--vs-muted); flex-wrap: wrap; gap: 8px;
}

@media (max-width: 880px){
  .auth-page{grid-template-columns: 1fr}
  .auth-hero{padding: 36px 28px}
  .auth-hero h1{font-size: 28px}
  .auth-panel{padding: 32px 22px}
}

/* ---------- doctor card list ---------- */
.doc-list{display: flex; flex-direction: column; gap: 12px}
.doctor-card{
  display: grid; grid-template-columns: 64px 1fr auto;
  gap: 16px; align-items: center;
  padding: 16px 18px;
  background: var(--vs-surface);
  border: 1px solid var(--vs-line);
  border-radius: var(--vs-radius);
  transition: all .15s ease;
}
.doctor-card:hover{box-shadow: var(--vs-shadow-2); border-color: var(--vs-accent); transform: translateY(-1px)}
.doctor-card .doc-avatar{
  width: 64px; height: 64px; border-radius: 50%;
  background: linear-gradient(135deg, var(--vs-accent), var(--vs-accent-2));
  display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 700; font-size: 18px;
  overflow: hidden; letter-spacing: -.02em;
}
.doctor-card .doc-avatar img{width: 100%; height: 100%; object-fit: cover}
.doctor-card .doc-name{font-weight: 700; font-size: 15.5px; color: var(--vs-ink)}
.doctor-card .doc-spec{
  color: var(--vs-accent); font-size: 12.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .4px; margin-top: 2px;
}
.doctor-card .doc-meta{
  color: var(--vs-muted); font-size: 12.5px; margin-top: 6px;
  display: flex; gap: 14px; flex-wrap: wrap;
}
.doctor-card .doc-meta span{display: inline-flex; align-items: center; gap: 4px}

/* ---------- consult room ---------- */
.consult-room{
  display: grid; grid-template-columns: minmax(0,2fr) minmax(0,1.2fr);
  gap: 16px;
}
@media (max-width: 1024px){.consult-room{grid-template-columns: 1fr}}

.video-stage{
  background: #06182a;
  border-radius: var(--vs-radius);
  position: relative; overflow: hidden;
  display: flex; flex-direction: column;
  border: 1px solid #0e2640;
  box-shadow: var(--vs-shadow-2);
}
.video-stage .video-main{
  flex: 1; position: relative;
  background:
    radial-gradient(ellipse at center, #0a2236 0%, #06182a 70%);
  min-height: 320px;
  display: flex; align-items: center; justify-content: center;
}
.video-stage video.remote-video{width: 100%; height: 100%; object-fit: cover; background: #000; min-height: 320px}
.video-stage video.local-video{
  position: absolute; right: 14px; bottom: 14px;
  width: 180px; height: 130px; object-fit: cover;
  border-radius: 12px;
  border: 2px solid rgba(255,255,255,.92);
  box-shadow: 0 8px 28px rgba(0,0,0,.55);
  background: #06182a; z-index: 5;
  transition: opacity .25s ease, transform .25s ease;
}
.video-stage video.local-video.cam-off{opacity: .25}
@media (max-width: 720px){
  .video-stage video.local-video{width: 110px; height: 80px; right: 10px; bottom: 10px}
}

/* Network pill — floats top-right of the video stage */
.video-stage .net-pill{
  position: absolute; top: 12px; right: 12px;
  z-index: 6;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  font: 600 11px/1 var(--vs-font);
  letter-spacing: .3px;
  background: rgba(255,255,255,.1);
  color: white;
  backdrop-filter: blur(8px);
}
.video-stage .net-pill::before{
  content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--vs-pending);
}
.video-stage .net-pill.net-ok::before     {background: var(--vs-accent-2); box-shadow: 0 0 0 4px rgba(98,217,200,.25)}
.video-stage .net-pill.net-pending::before{background: var(--vs-pending);  animation: live-blink 1.4s ease-in-out infinite}
.video-stage .net-pill.net-warn::before   {background: var(--vs-warn);     animation: live-blink 1s ease-in-out infinite}
.video-stage .net-pill.net-fail::before   {background: var(--vs-warn)}
.video-stage .net-pill.net-mute::before   {background: var(--vs-muted-2)}

/* Waiting overlay — patient sees this before doctor starts the meeting.
   Page provides <div id="waiting-overlay" class="waiting-overlay"> */
.waiting-overlay{
  position: absolute; inset: 0;
  z-index: 7;
  display: none;
  align-items: center; justify-content: center;
  flex-direction: column; gap: 14px;
  padding: 24px; text-align: center;
  color: white;
  background:
    radial-gradient(ellipse at center, rgba(13,59,102,.85), rgba(6,24,42,.95));
  backdrop-filter: blur(4px);
}
.waiting-overlay.show{display: flex}
.waiting-overlay .pulse{
  width: 72px; height: 72px; border-radius: 50%;
  background: linear-gradient(135deg, var(--vs-accent), var(--vs-accent-2));
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 0 0 rgba(98,217,200,.6);
  animation: brand-pulse 2s ease-in-out infinite;
}
.waiting-overlay .pulse .icon{width: 28px; height: 28px; color: white}
.waiting-overlay h3{margin: 0; color: white; font-size: 18px; font-weight: 700; letter-spacing: -.01em}
.waiting-overlay p{margin: 0; max-width: 360px; color: rgba(255,255,255,.78); font-size: 13.5px; line-height: 1.6}

/* In-call ribbon — fades pre-call buttons after joining */
.video-stage.is-incall .pre-call{opacity: 0; pointer-events: none; transition: opacity .35s ease}
.video-stage:not(.is-incall) .in-call{opacity: 0; pointer-events: none}
.video-stage .in-call,
.video-stage .pre-call{transition: opacity .25s ease}

/* Pulsing primary button — used on the patient's "Join now" CTA */
.btn-pulse{
  animation: btn-pulse 1.6s ease-in-out infinite;
  box-shadow: 0 0 0 0 rgba(27,154,170,.55);
}
@keyframes btn-pulse{
  0%,100% {box-shadow: 0 0 0 0    rgba(27,154,170,.55)}
  50%     {box-shadow: 0 0 0 14px rgba(27,154,170,0)}
}
.video-stage .scan-overlay{
  position: absolute; inset: 0;
  background: rgba(6,24,42,.92);
  color: white;
  display: none; flex-direction: column;
  align-items: center; justify-content: center;
  z-index: 10; padding: 24px; text-align: center;
}
.video-stage .scan-overlay.show{display: flex}
.video-stage .scan-overlay video{
  width: 240px; height: 320px;
  border-radius: 12px;
  border: 2px solid var(--vs-accent);
  background: black;
}
.video-stage .scan-overlay .scan-progress{
  width: 80%; max-width: 380px; height: 8px;
  background: rgba(255,255,255,.18);
  border-radius: 4px; overflow: hidden; margin-top: 16px;
}
.video-stage .scan-overlay .scan-bar{
  height: 100%;
  background: linear-gradient(90deg, var(--vs-accent), var(--vs-accent-2));
  width: 0%; transition: width .25s;
}
.video-stage .scan-overlay .scan-status{
  font-size: 14px; color: var(--vs-accent-3);
  margin-top: 8px;
}
.video-stage .controls{
  display: flex; gap: 8px; padding: 12px 14px;
  background: linear-gradient(0deg, #06182a, #0a2236);
  flex-wrap: wrap; align-items: center;
  border-top: 1px solid rgba(255,255,255,.06);
}
/* In-call control button — circle/pill mute/cam toggles, with active states */
.video-stage .controls .ctrl-btn{
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 14px; border-radius: 999px;
  background: rgba(255,255,255,.08); color: white;
  border: 1px solid rgba(255,255,255,.12);
  font: 600 13px/1 var(--vs-font); cursor: pointer;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.video-stage .controls .ctrl-btn:hover{background: rgba(255,255,255,.16)}
.video-stage .controls .ctrl-btn .icon{width: 16px; height: 16px}
.video-stage .controls .ctrl-btn.is-muted,
.video-stage .controls .ctrl-btn.is-off{
  background: rgba(208,74,46,.18); border-color: rgba(208,74,46,.45); color: #ffb9aa;
}
.video-stage .controls .ctrl-btn.is-muted .icon,
.video-stage .controls .ctrl-btn.is-off .icon{color: #ffb9aa}
@media (max-width: 720px){
  .video-stage .controls .ctrl-btn .ctrl-lbl{display: none}
  .video-stage .controls .ctrl-btn{padding: 9px 12px}
}

.consult-side{display: flex; flex-direction: column; gap: 12px; min-height: 0}
.consult-side .panel{
  background: white;
  border-radius: var(--vs-radius);
  border: 1px solid var(--vs-line);
  box-shadow: var(--vs-shadow-1);
  overflow: hidden;
  display: flex; flex-direction: column; min-height: 0;
}
.consult-side .panel-head{
  padding: 11px 16px;
  border-bottom: 1px solid var(--vs-line);
  font-weight: 700; font-size: 13px;
  color: var(--vs-primary);
  display: flex; align-items: center; gap: 8px;
  background: var(--vs-bg);
  text-transform: uppercase; letter-spacing: .5px;
}
.consult-side .panel-body{padding: 14px 16px; overflow: auto; flex: 1; font-size: 13.5px; min-height: 0}

.chat-list{display: flex; flex-direction: column; gap: 10px; padding: 4px 2px}
.chat-msg{
  padding: 9px 13px;
  border-radius: 14px 14px 14px 4px;
  background: var(--vs-bg-2);
  max-width: 78%; word-wrap: break-word;
  font-size: 13.5px; line-height: 1.45;
  border: 1px solid var(--vs-line);
  color: var(--vs-ink);
}
.chat-msg.me{
  margin-left: auto;
  border-radius: 14px 14px 4px 14px;
  background: linear-gradient(135deg, var(--vs-accent), var(--vs-accent-2));
  color: white; border-color: transparent;
}
.chat-msg.me .meta{color: rgba(255,255,255,.85)}
.chat-msg .meta{
  font-size: 11px; color: var(--vs-muted); margin-bottom: 3px;
  font-weight: 600; letter-spacing: .2px;
  text-transform: capitalize;
}
.chat-msg .meta time{font-variant-numeric: tabular-nums; font-weight: 500}
.chat-msg .body{font-weight: 400}
.chat-empty{
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 28px 16px; text-align: center;
  color: var(--vs-muted); font-size: 12.5px; line-height: 1.55;
}
.chat-empty .icon{width: 28px; height: 28px; color: var(--vs-muted-2)}
.chat-input{
  display: flex; gap: 8px;
  padding: 10px 14px;
  border-top: 1px solid var(--vs-line);
  background: var(--vs-surface-2);
  align-items: center;
}
.chat-input input{
  flex: 1; padding: 10px 14px;
  border: 1px solid var(--vs-line); border-radius: 999px;
  font: 500 13.5px/1.4 var(--vs-font); background: white;
  min-height: 38px;
  transition: border-color .14s ease, box-shadow .14s ease;
}
.chat-input input:focus{
  outline: 0; border-color: var(--vs-accent);
  box-shadow: 0 0 0 4px rgba(155,231,231,.45);
}
.chat-input .btn{padding: 10px 14px; border-radius: 999px}

/* ---------- prescription editor ---------- */
.rx-grid{display: grid; gap: 8px}
.rx-row{
  display: grid;
  grid-template-columns: 1.4fr .8fr .8fr .8fr .8fr 1fr 30px;
  gap: 6px; align-items: center;
}
.rx-row input,.rx-row select{
  padding: 7px 9px; font-size: 12.5px;
  border: 1px solid var(--vs-line); border-radius: 6px; width: 100%;
  background: white;
}
.rx-row input:focus,.rx-row select:focus{outline: 0; border-color: var(--vs-accent); box-shadow: 0 0 0 2px rgba(27,154,170,.15)}
.rx-row .btn-x{
  background: transparent; border: 0;
  color: var(--vs-warn); cursor: pointer;
  font-size: 18px; line-height: 1;
}
.rx-row .btn-x:hover{color: #a83824}
.rx-section{
  border: 1px solid var(--vs-line);
  border-radius: var(--vs-radius-sm);
  padding: 14px 16px; margin-bottom: 12px;
  background: var(--vs-surface);
}
.rx-section h4{
  margin: 0 0 10px; color: var(--vs-primary);
  font-size: 12.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .6px;
  display: flex; align-items: center; gap: 8px;
}
.rx-section h4::before{
  content: ""; width: 4px; height: 14px;
  background: linear-gradient(180deg, var(--vs-accent), var(--vs-accent-2));
  border-radius: 2px;
}

/* ---------- status banner ---------- */
.status-banner{
  position: fixed; top: 0; left: 0; right: 0;
  padding: 8px 16px;
  background: var(--vs-pending); color: white;
  text-align: center; font-size: 12.5px; font-weight: 600;
  z-index: 100; display: none;
  letter-spacing: .3px;
}
.status-banner.show{display: block}

/* ---------- stage banner (consultation room) ---------- */
.stage-banner{
  display: none;
  align-items: center; gap: 12px;
  background: white;
  border: 1px solid var(--vs-line);
  border-radius: 12px;
  padding: 10px 14px;
  margin-bottom: 14px;
  box-shadow: var(--vs-shadow-1);
}
.stage-banner .stage-pill{
  display: inline-block;
  background: var(--vs-accent); color: white;
  padding: 4px 12px; border-radius: 999px;
  font-size: 11px; font-weight: 700;
  letter-spacing: .5px; text-transform: uppercase;
  white-space: nowrap;
}
.stage-banner .stage-msg{
  flex: 1; color: var(--vs-ink-2); font-size: 13.5px; font-weight: 500;
}
.stage-banner .stage-arrow{
  display: inline-flex; gap: 3px; align-items: center;
  font-size: 11px; color: var(--vs-muted-2); flex-shrink: 0;
}
.stage-banner .stage-arrow span{
  width: 16px; height: 4px; border-radius: 2px;
  background: var(--vs-line);
}
.stage-banner .stage-arrow span.on{background: var(--vs-accent)}

/* ---------- utility ---------- */
.row-flex{display: flex; gap: 10px; align-items: center; flex-wrap: wrap}
.spread{display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap}
.text-center{text-align: center}
.text-right{text-align: right}
.muted{color: var(--vs-muted)}
.text-sm{font-size: 12.5px}
.text-lg{font-size: 15px}
.hidden{display: none !important}
.spacer{flex: 1}
.divider{height: 1px; background: var(--vs-line); margin: 16px 0}
.dim{opacity: .65}

/* ============================================================
   STITCH "Clinical Modernism" upgrade — additive components.
   These add polish without breaking any existing class.
   ============================================================ */

/* Glass overlay — for floating bars, popovers, "active call" pills.
   Never use on primary content blocks (kills readability). */
.glass{
  background: rgba(255,255,255,.80);
  backdrop-filter: blur(12px) saturate(140%);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
  border: 1px solid rgba(255,255,255,.6);
  box-shadow: 0 12px 40px rgba(10,46,87,.10);
}

/* Tonal section — subtle blue-tinted band (uses surface-container-low).
   Good for grouping a row of bento cards inside a hero or gallery. */
.tonal{background: var(--vs-bg-2); border-radius: var(--vs-radius); padding: 24px}
.tonal-deep{background: var(--vs-bg-3); border-radius: var(--vs-radius); padding: 24px}

/* KPI tile — large number + label, no chrome. Use inside a .card or .grid. */
.kpi{
  display: flex; flex-direction: column; gap: 6px;
  padding: 18px 20px;
  background: var(--vs-surface);
  border: 1px solid var(--vs-line);
  border-radius: var(--vs-radius);
  position: relative;
}
.kpi-label{
  font-family: var(--vs-font-data);
  font-size: 12px; color: var(--vs-muted); font-weight: 500;
  letter-spacing: .4px; text-transform: uppercase;
}
.kpi-value{
  font-family: var(--vs-font-data);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
  font-size: 32px; font-weight: 600; color: var(--vs-primary);
  line-height: 1.05; letter-spacing: -.02em;
}
.kpi-trend{font-size: 12px; color: var(--vs-muted); display: inline-flex; gap: 4px; align-items: center}
.kpi-trend.up{color: var(--vs-ok)}
.kpi-trend.down{color: var(--vs-warn)}

/* Scan ring — concentric SVG/CSS rings used on /scan and during in-call
   patient capture. Mark the parent with `.scan-ring` and render the
   progress + pulse rings inside via SVG conic-gradient or stroke-dasharray.

   Minimum DOM:
     <div class="scan-ring">
       <div class="scan-ring-glow"></div>
       <div class="scan-ring-progress" style="--p:42"></div>
       <div class="scan-ring-pulse" style="--bpm:72"></div>
       <div class="scan-ring-readout">
         <div class="vital-display">72<span class="unit">bpm</span></div>
         <div class="muted">heart rate</div>
       </div>
     </div>
*/
.scan-ring{
  position: relative;
  width: 320px; height: 320px;
  margin: 0 auto;
  display: grid; place-items: center;
  isolation: isolate;
}
.scan-ring-glow{
  position: absolute; inset: -10px;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(155,231,231,.55), rgba(155,231,231,0) 70%);
  filter: blur(20px);
  z-index: 0; pointer-events: none;
}
.scan-ring-progress{
  --p: 0;
  position: absolute; inset: 0;
  border-radius: 50%;
  /* Conic gradient navy → teal, masked to a 4px ring */
  background: conic-gradient(
    from -90deg,
    var(--vs-primary) 0deg,
    var(--vs-accent) calc(var(--p) * 3.6deg),
    rgba(227,234,241,.55) calc(var(--p) * 3.6deg) 360deg
  );
  -webkit-mask: radial-gradient(circle, transparent calc(50% - 4px), #000 calc(50% - 4px));
          mask: radial-gradient(circle, transparent calc(50% - 4px), #000 calc(50% - 4px));
  z-index: 1;
}
.scan-ring-pulse{
  --bpm: 72;
  position: absolute; inset: 18px;
  border-radius: 50%;
  border: 2px solid rgba(98,217,200,.35);
  animation: scan-pulse calc(60s / var(--bpm)) ease-in-out infinite;
  z-index: 2;
}
@keyframes scan-pulse{
  0%,100%{transform: scale(1);    box-shadow: 0 0 0 0 rgba(98,217,200,.45)}
  50%    {transform: scale(1.04); box-shadow: 0 0 0 14px rgba(98,217,200,0)}
}
.scan-ring-readout{
  position: relative; z-index: 3;
  text-align: center;
}
.scan-ring-camera{
  /* Optional: face video centered inside the ring */
  position: absolute; inset: 28px;
  border-radius: 50%;
  overflow: hidden; background: #000;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.08);
  z-index: 2;
}
.scan-ring-camera video{width: 100%; height: 100%; object-fit: cover}

/* Sparkline — drop a 60×16 inline SVG/canvas inside.
   The class just sets the colour + size envelope. */
.sparkline{
  display: inline-block;
  width: 60px; height: 16px;
  color: var(--vs-accent);
  vertical-align: middle;
}
.sparkline.warn{color: var(--vs-warn)}
.sparkline.ok{color: var(--vs-ok)}
.sparkline svg, .sparkline path{
  width: 100%; height: 100%; fill: none;
  stroke: currentColor; stroke-width: 1.5;
  stroke-linecap: round; stroke-linejoin: round;
}

/* Pill nav-style chip filter — used on "Find a doctor" filters */
.chip-row{display: flex; gap: 8px; flex-wrap: wrap}
.chip{
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px; border-radius: 999px;
  background: var(--vs-surface); border: 1px solid var(--vs-line);
  font: 500 13px/1 var(--vs-font); color: var(--vs-ink-2);
  cursor: pointer; transition: all .14s ease;
}
.chip:hover{border-color: var(--vs-accent); color: var(--vs-primary)}
.chip.active{
  background: var(--vs-primary); color: white; border-color: var(--vs-primary);
}

/* Floating "Active Consultation" pill — appears on top of any page when
   a call is in progress. Use `class="floating-pill glass"`. */
.floating-pill{
  position: fixed; right: 22px; bottom: 22px;
  display: inline-flex; align-items: center; gap: 10px;
  padding: 10px 16px 10px 12px;
  border-radius: 999px;
  font: 600 13px/1 var(--vs-font); color: var(--vs-primary);
  z-index: 60; cursor: pointer; text-decoration: none;
}
.floating-pill .live-dot{
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--vs-warn);
  animation: live-blink 1.6s ease-in-out infinite;
}
@keyframes live-blink{0%,100%{opacity: 1}50%{opacity: .35}}

/* Skeleton loader — replace text/blocks while async data arrives.
   Use `class="skel"` plus an inline width/height. */
.skel{
  display: inline-block;
  background: linear-gradient(90deg, var(--vs-bg-2) 0%, var(--vs-bg-3) 50%, var(--vs-bg-2) 100%);
  background-size: 200% 100%;
  border-radius: 8px;
  animation: skel-shine 1.4s linear infinite;
  color: transparent !important;
}
@keyframes skel-shine{0%{background-position: 200% 0}100%{background-position: -200% 0}}

/* Tabbed segmented control — slimmer than auth-tabs, for in-page tabs. */
.seg{
  display: inline-flex; padding: 4px;
  background: var(--vs-bg-2); border-radius: 12px;
}
.seg button{
  border: 0; background: transparent; cursor: pointer;
  padding: 8px 16px; border-radius: 8px;
  font: 600 13px/1 var(--vs-font); color: var(--vs-muted);
  transition: all .14s ease;
}
.seg button:hover{color: var(--vs-primary)}
.seg button.active{
  background: var(--vs-surface); color: var(--vs-primary);
  box-shadow: 0 1px 3px rgba(10,46,87,.06), 0 4px 12px rgba(10,46,87,.04);
}

/* Status badge — pill, muted bg + bold ink (Stitch-style). Replaces the
   loud .tag for places where the legacy uppercase look is too shouty. */
.badge{
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px;
  font: 600 12px/1.4 var(--vs-font);
  background: var(--vs-bg-2); color: var(--vs-ink-2);
}
.badge::before{
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: currentColor; opacity: .8;
}
.badge.ok      {background: #d6f5e3; color: #0a7a4d}
.badge.warn    {background: #fde2dc; color: #883121}
.badge.pending {background: #fff3d4; color: #7a5400}
.badge.info    {background: #d6ebff; color: #0d3b66}
.badge.live    {background: var(--vs-primary); color: white}
.badge.live::before{background: var(--vs-accent-3); animation: live-blink 1.6s ease-in-out infinite}
