/* Aurikal app: sign-in and dashboard. Builds on the tokens in styles.css. */

[hidden] { display: none !important; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.fine { font-size: 13px; color: var(--muted); }
.empty { color: var(--muted); padding: 16px 4px; list-style: none; }

/* ---- Sign-in ---------------------------------------------------------------- */

.login-body {
  min-height: 100vh; min-height: 100dvh;
  background: radial-gradient(900px 480px at 85% -10%, var(--blush), transparent 60%), var(--tint);
}
.login-wrap {
  min-height: 100vh; min-height: 100dvh; display: grid; place-items: center;
  padding-block: max(32px, env(safe-area-inset-top, 0px)) max(32px, env(safe-area-inset-bottom, 0px));
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.login-card {
  width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 24px; padding: 36px 32px; display: grid; gap: 24px; box-shadow: var(--shadow);
}
.login-head { display: grid; gap: 8px; }
.login-head h1 { font-size: 30px; color: var(--ink); }
.login-head p { color: var(--muted); }
.login-head a { color: var(--ink); }
.login-error {
  background: var(--blush); color: var(--rose-strong); border-radius: 12px;
  padding: 12px 14px; font-size: 15px; font-weight: 500;
}
.sso { display: grid; gap: 12px; }
.sso-btn {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  border: 1.5px solid var(--line); border-radius: 14px; padding: 14px 18px;
  font: 600 16px var(--f-body); color: var(--text); text-decoration: none; background: var(--bg);
  transition: border-color .15s ease, transform .15s ease;
}
.sso-btn:hover { border-color: var(--ink); transform: translateY(-1px); }
.sso-btn svg { width: 22px; height: 22px; flex: none; }
.sso-dev { border-style: dashed; color: var(--muted); }
.login-note { font-size: 14px; color: var(--muted); }
.login-fine { font-size: 13px; color: var(--muted); }
.login-ok {
  background: color-mix(in srgb, #2E7D4F 12%, var(--surface)); color: #1F5E3A; border-radius: 12px;
  padding: 12px 14px; font-size: 15px; font-weight: 500;
}
.login-view { display: grid; gap: 20px; }
.login-form, .login-more { display: grid; gap: 16px; }
.login-form .btn { width: 100%; justify-content: center; }
.login-form .field input { width: 100%; }
.login-links { font-size: 14px; color: var(--muted); text-align: center; }
.login-links a { color: var(--ink); }
.or-divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; }
.or-divider::before, .or-divider::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.enroll-steps { display: grid; gap: 12px; padding-left: 20px; font-size: 15px; }
.qr-img { display: block; width: 200px; height: 200px; margin: 12px auto 4px; background: #FFFFFF; border-radius: 12px; border: 1px solid var(--line); }
.enroll-key { font-size: 14px; color: var(--muted); margin-top: 6px; }
.enroll-key summary { cursor: pointer; color: var(--ink); }
.enroll-key code { font: 500 14px var(--f-mono); color: var(--ink); word-break: break-all; }
.recovery-codes {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 16px; list-style: none; padding: 16px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 14px; font: 500 16px var(--f-mono); color: var(--ink);
}
.login-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.check { display: grid; grid-template-columns: 20px 1fr; gap: 10px; font-size: 14px; line-height: 1.45; cursor: pointer; }
.check input { width: 18px; height: 18px; margin-top: 2px; accent-color: #13315C; }

/* ---- App header ------------------------------------------------------------- */

.app-body { background: var(--tint); min-height: 100vh; min-height: 100dvh; }
.app-header {
  position: sticky; top: 0; z-index: 40; background: var(--surface);
  border-bottom: 1px solid var(--line); padding-top: env(safe-area-inset-top, 0px);
}
.app-header-inner {
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap; min-height: 68px; padding-block: 10px;
  padding-left: max(20px, env(safe-area-inset-left, 0px));
  padding-right: max(20px, env(safe-area-inset-right, 0px));
}
.specialty-picker { display: flex; align-items: center; gap: 10px; flex: 1 1 320px; min-width: 0; max-width: 520px; }
.specialty-picker label { font: 500 11px var(--f-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
select {
  font: 500 15px var(--f-body); color: var(--text); background-color: var(--bg);
  border: 1.5px solid var(--line); border-radius: 12px; padding: 10px 36px 10px 12px; min-width: 0;
  appearance: none; -webkit-appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='%2356627C' stroke-width='2' stroke-linecap='round' d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 18px;
}
select:focus { border-color: var(--ink); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--rose) 35%, transparent); }
.specialty-picker select { flex: 1; width: 100%; font-weight: 600; color: var(--ink); }
.user-menu { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.user-name { font-size: 14px; color: var(--muted); max-width: 22ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.offline-banner {
  background: #7A4B00; color: #FFFFFF; font-size: 14px; text-align: center; padding: 8px 16px;
}

/* ---- Layout ----------------------------------------------------------------- */

.app-shell {
  display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 24px; align-items: start;
  max-width: 1440px; margin: 0 auto; padding-block: 28px 48px;
  padding-left: max(20px, env(safe-area-inset-left, 0px));
  padding-right: max(20px, env(safe-area-inset-right, 0px));
}
.app-main { min-width: 0; }
.view-head { display: grid; gap: 18px; margin-bottom: 22px; }
.view-head h1 { font-size: clamp(26px, 3.4vw, 36px); color: var(--ink); }
.view-sub { color: var(--muted); max-width: 70ch; margin-top: 6px; }
.view-sub-alert { color: var(--rose-strong); font-weight: 600; }
.lang-tools { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.provider-lang { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); }

.search {
  display: flex; align-items: center; gap: 8px; background: var(--surface);
  border: 1.5px solid var(--line); border-radius: 12px; padding: 0 12px; flex: 1 1 280px; max-width: 460px;
}
.search:focus-within { border-color: var(--ink); }
.search svg { width: 18px; height: 18px; color: var(--muted); flex: none; }
.search input { border: 0; outline: none; background: transparent; font: 15px var(--f-body); color: var(--text); padding: 11px 0; width: 100%; min-width: 0; }

/* ---- Language grid ---------------------------------------------------------- */

.lang-grid {
  list-style: none; margin: 0 0 16px; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px;
}
.lang-card {
  width: 100%; height: 100%; text-align: left; cursor: pointer; font: inherit; color: inherit;
  background: var(--surface); border: 1.5px solid var(--line); border-radius: 16px;
  padding: 16px; display: grid; gap: 4px; align-content: start;
  transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease;
}
.lang-card:hover { border-color: var(--rose); transform: translateY(-2px); box-shadow: 0 12px 28px -18px rgba(19, 49, 92, .45); }
.lang-flags { display: flex; gap: 6px; min-height: 21px; margin-bottom: 6px; }
.lang-flags img { width: 28px; height: 21px; border-radius: 3px; object-fit: cover; box-shadow: 0 0 0 1px rgba(19, 49, 92, .14); }
.lang-native { font: 600 22px/1.25 var(--f-display); color: var(--ink); letter-spacing: -.01em; overflow-wrap: anywhere; }
.lang-native[dir="rtl"] { text-align: right; }
.lang-name { font-weight: 600; font-size: 15px; }
.lang-region { font-size: 13px; color: var(--muted); }
.lang-meter { display: block; height: 4px; background: var(--tint); border-radius: 4px; margin-top: 10px; overflow: hidden; }
.lang-meter i { display: block; height: 100%; background: var(--rose); border-radius: 4px; }
.lang-count { font: 400 12px var(--f-mono); color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---- Session ---------------------------------------------------------------- */

.session-head { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; }
.session-title h1 { font-size: clamp(24px, 3vw, 32px); color: var(--ink); }
.icon-btn {
  width: 44px; height: 44px; flex: none; border-radius: 12px; border: 1.5px solid var(--line);
  background: var(--surface); color: var(--text); display: grid; place-items: center; cursor: pointer;
}
.icon-btn:hover { border-color: var(--ink); }
.icon-btn svg { width: 22px; height: 22px; }

.talk-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.talk {
  border: 0; border-radius: 22px; padding: 26px 20px; cursor: pointer; font: inherit;
  display: grid; justify-items: center; gap: 4px; text-align: center; min-height: 190px; align-content: center;
  transition: transform .12s ease, box-shadow .2s ease, opacity .2s ease;
}
.talk svg { width: 40px; height: 40px; margin-bottom: 6px; }
.talk-who { font: 500 12px var(--f-mono); letter-spacing: .1em; text-transform: uppercase; opacity: .85; }
.talk-lang { font: 700 26px/1.2 var(--f-display); letter-spacing: -.02em; }
.talk-hint { font-size: 14px; opacity: .85; }
.talk-row-one { grid-template-columns: 1fr; }
.talk-auto { background: #13315C; color: #FFFFFF; }
.talk-auto .talk-who { text-transform: none; letter-spacing: 0; font: 500 14px var(--f-body); opacity: .8; }
.talk-auto .talk-hint { font-size: 16px; font-weight: 600; opacity: .95; }
.talk-clinician { background: #13315C; color: #FFFFFF; }
.talk-patient { background: #EF6F6C; color: #FFFFFF; }
.talk:hover:not(:disabled) { transform: translateY(-2px); }
.talk:disabled { opacity: .45; cursor: not-allowed; }
.talk.is-recording { box-shadow: 0 0 0 6px color-mix(in srgb, var(--mint) 70%, transparent); animation: rec 1.4s ease-in-out infinite; }
@keyframes rec { 50% { box-shadow: 0 0 0 12px color-mix(in srgb, var(--mint) 25%, transparent); } }

.session-status { margin: 14px 2px; font-size: 15px; color: var(--muted); min-height: 1.5em; }
.session-status.live { color: var(--mint); font-weight: 600; }
.session-status.error { color: var(--rose-strong); font-weight: 600; }

.type-row { display: flex; gap: 10px; margin-bottom: 20px; flex-wrap: wrap; }
.type-row input {
  flex: 1 1 240px; min-width: 0; font: 16px var(--f-body); color: var(--text); background: var(--surface);
  border: 1.5px solid var(--line); border-radius: 12px; padding: 11px 14px;
}
.type-row input:focus { border-color: var(--ink); outline: none; }

.feed { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 12px; }
.turn { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 16px 18px; display: grid; gap: 8px; border-left: 5px solid var(--ink); }
.turn-patient { border-left-color: var(--rose); }
.turn-error, .turn-unclear { border-left-color: var(--muted); }
.turn-meta { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font: 500 11px var(--f-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.turn-original { color: var(--muted); font-size: 15px; }
.turn-translation-row { display: flex; gap: 12px; align-items: flex-start; }
.turn-translation { flex: 1; min-width: 0; font: 600 20px/1.4 var(--f-display); color: var(--text); letter-spacing: -.01em; }
.turn-unclear .turn-translation { font: 500 15px var(--f-body); color: var(--muted); }
.pending { color: var(--muted); font: italic 400 15px var(--f-body); }
.play-btn { width: 40px; height: 40px; }

/* ---- Reference panel -------------------------------------------------------- */

.ref {
  position: sticky; top: calc(84px + env(safe-area-inset-top, 0px));
  background: var(--surface); border: 1px solid var(--line); border-radius: 20px;
  padding: 20px; display: grid; gap: 14px; max-height: calc(100vh - 110px); grid-template-rows: auto auto auto 1fr auto;
}
.ref-head { display: grid; gap: 6px; }
.ref-head h2 { font-size: 20px; color: var(--ink); }
.ref-desc { font-size: 14px; color: var(--muted); }
.tabs { display: flex; gap: 4px; background: var(--tint); border-radius: 12px; padding: 4px; }
.tabs button {
  flex: 1; border: 0; background: transparent; font: 600 13px var(--f-body); color: var(--muted);
  padding: 8px 4px; border-radius: 9px; cursor: pointer;
}
.tabs button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(19, 49, 92, .15); }
.search-sm { max-width: none; flex: none; }
.search-sm input { padding: 8px 0; font-size: 14px; }
.ref-list { list-style: none; margin: 0; padding: 0 4px 0 0; overflow-y: auto; min-height: 0; display: grid; gap: 0; align-content: start; }
.ref-list li { padding: 11px 2px; border-bottom: 1px solid var(--line); display: grid; gap: 3px; font-size: 14px; }
.ref-list li:last-child { border-bottom: 0; }
.ref-list b { font-weight: 600; color: var(--text); }
.ref-list em { font-style: normal; font-weight: 400; color: var(--muted); }
.ref-list span { color: var(--muted); }
.chip {
  justify-self: start; font: 500 11px var(--f-mono); color: var(--ink) !important; background: var(--tint);
  border-radius: 6px; padding: 2px 7px;
}
.ref-list .phrase { grid-template-columns: 1fr auto; align-items: center; gap: 10px; }
.ref-list .phrase span { color: var(--text); }
.say-btn {
  border: 1.5px solid var(--line); background: var(--bg); color: var(--ink); font: 600 13px var(--f-body);
  border-radius: 999px; padding: 6px 12px; cursor: pointer; white-space: nowrap;
}
.say-btn:hover { border-color: var(--rose); }
.ref-fine { margin: 0; }

/* ---- Responsive ------------------------------------------------------------- */

@media (max-width: 1080px) {
  .app-shell { grid-template-columns: 1fr; }
  .ref { position: static; max-height: none; grid-template-rows: none; }
  .ref-list { max-height: 420px; }
}
@media (max-width: 640px) {
  .app-header-inner { gap: 10px; }
  .specialty-picker { order: 3; flex-basis: 100%; max-width: none; }
  .user-name { display: none; }
  .talk-row { grid-template-columns: 1fr; }
  .talk { min-height: 130px; padding: 18px; }
  .lang-grid { grid-template-columns: 1fr 1fr; }
  .lang-native { font-size: 19px; }
  .login-card { padding: 28px 22px; }
}

/* ---- Navigation, BAA banner ------------------------------------------------- */

.mode-nav { display: flex; gap: 4px; background: var(--tint); border-radius: 12px; padding: 4px; }
.mode-nav a {
  text-decoration: none; font: 600 14px var(--f-body); color: var(--muted);
  padding: 8px 14px; border-radius: 9px; white-space: nowrap;
}
.mode-nav a:hover { color: var(--text); }
.mode-nav a[aria-current="page"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(19, 49, 92, .15); }

.baa-banner {
  display: flex; align-items: center; justify-content: center; gap: 16px; flex-wrap: wrap;
  background: #13315C; color: #FFFFFF; font-size: 15px; padding-block: 12px;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.baa-banner p { max-width: 80ch; }
.btn-light { background: #FFFFFF; color: #13315C; }
.trial-banner {
  display: flex; align-items: center; justify-content: center; gap: 16px; flex-wrap: wrap;
  background: #7A4B00; color: #FFFFFF; padding: 12px 20px; font-size: 15px;
}
.trial-banner.is-ended { background: #8C1D18; }
.trial-banner p { max-width: 80ch; margin: 0; }
.role-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.role-row h2 { margin: 0 0 4px; }
.role-warn { margin-top: 14px; border: 1.5px solid #B3261E; background: color-mix(in srgb, #B3261E 8%, var(--surface)); border-radius: 14px; padding: 14px 16px; display: grid; gap: 8px; }
.role-warn p { margin: 0; }
.role-warn-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-light:hover { background: #FDE8E6; }

/* ---- Notes and scribe ------------------------------------------------------- */

.feed-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.feed-head h2 { font-size: 18px; color: var(--ink); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }

.scribe-controls { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.rec-btn {
  display: inline-flex; align-items: center; gap: 12px; border: 0; cursor: pointer;
  background: #13315C; color: #FFFFFF; font: 600 17px var(--f-body); padding: 16px 24px; border-radius: 999px;
}
.rec-dot { width: 14px; height: 14px; border-radius: 50%; background: #EF6F6C; }
.rec-time { font: 500 14px var(--f-mono); opacity: .8; font-variant-numeric: tabular-nums; }
.rec-btn.is-recording { background: #B3261E; }
.rec-btn.is-recording .rec-dot { background: #FFFFFF; animation: blink 1s steps(2, start) infinite; }
@keyframes blink { to { visibility: hidden; } }
.upload-btn { cursor: pointer; }

#view-scribe { display: grid; gap: 16px; }
#view-scribe[hidden] { display: none; }
#view-scribe .view-head { margin-bottom: 0; }
.field textarea, .transcript-box, .note-box {
  width: 100%; font: 15px/1.55 var(--f-body); color: var(--text); background: var(--surface);
  border: 1.5px solid var(--line); border-radius: 14px; padding: 14px 16px; resize: vertical;
}
.note-box { font-family: var(--f-mono); font-size: 14px; line-height: 1.6; }
.transcript-box:focus, .note-box:focus { border-color: var(--ink); outline: none; }
.note-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.note-options select { width: 100%; }
.note-out { display: grid; gap: 10px; }
.note-out-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.note-out-head h2, .note-out-head h3 { font-size: 18px; color: var(--ink); }
.note-warning { font-size: 14px; color: #7A4B00; background: #FFF4DB; border-radius: 10px; padding: 8px 12px; }

.note-dialog {
  border: 0; border-radius: 22px; padding: 0; width: min(760px, calc(100vw - 32px));
  max-height: calc(100dvh - 48px); background: var(--surface); color: var(--text); box-shadow: var(--shadow);
}
.note-dialog::backdrop { background: rgba(13, 20, 34, .55); }
.note-dialog-inner { padding: 24px; display: grid; gap: 16px; }

/* ---- Legal pages ------------------------------------------------------------ */

.legal-page {
  max-width: 900px; margin: 0 auto; display: grid; gap: 18px; padding-block: 48px;
  padding-left: max(20px, env(safe-area-inset-left, 0px)); padding-right: max(20px, env(safe-area-inset-right, 0px));
}
.legal-page h1 { font-size: 34px; color: var(--ink); }
.legal-page .brand { color: var(--ink); font-weight: 600; text-decoration: none; }
.legal-table { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
.legal-table table { border-collapse: collapse; width: 100%; min-width: 560px; font-size: 15px; }
.legal-table th, .legal-table td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.legal-table th { font: 500 11px var(--f-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }

@media (max-width: 860px) {
  .mode-nav { order: 2; }
}
@media (max-width: 640px) {
  .mode-nav { flex: 1 1 100%; order: 4; }
  .mode-nav a { flex: 1; text-align: center; }
}
#view-scribe > .btn { justify-self: start; }
.note-dialog-inner > .btn { justify-self: start; }

/* ---- Op report, profile, NPI picker ----------------------------------------- */

.stack-view { display: grid; gap: 18px; }
.stack-view .view-head { margin-bottom: 0; }
.panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 22px;
  display: grid; gap: 14px; min-width: 0;
}
.panel h2 { font-size: 18px; color: var(--ink); }
.panel > .btn { justify-self: start; }
.case-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.field input[type="date"], .field input:not([type]), .field input[type="text"] {
  font: 15px var(--f-body); color: var(--text); background: var(--bg);
  border: 1.5px solid var(--line); border-radius: 12px; padding: 10px 12px; width: 100%;
}
.field select { width: 100%; }

.npi-picker { display: grid; gap: 8px; border-top: 1px solid var(--line); padding-top: 14px; }
.npi-field-inline.npi-picker { border-top: 0; padding-top: 0; }
.npi-label { font-size: 14px; font-weight: 600; }
.npi-search { display: flex; gap: 8px; flex-wrap: wrap; }
.npi-search input {
  flex: 1 1 160px; min-width: 0; font: 15px var(--f-body); color: var(--text); background: var(--bg);
  border: 1.5px solid var(--line); border-radius: 12px; padding: 9px 12px;
}
.npi-search .state-input { flex: 0 0 150px; }
.npi-search .zip-input { flex: 0 0 90px; min-width: 0; }
.npi-selected, .npi-results li {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
  background: var(--tint); border-radius: 12px; padding: 10px 14px;
}
.npi-selected > div:first-child, .npi-results li > div { display: grid; gap: 2px; min-width: 0; }
.npi-results { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; max-height: 320px; overflow-y: auto; }
.npi-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.assists, .assistants { display: grid; gap: 4px; }
.assist-row { display: grid; grid-template-columns: minmax(0, 1fr) 240px auto; gap: 12px; align-items: end; }
.assist-role { padding-bottom: 2px; }
.assist-remove { margin-bottom: 4px; }

.table-wrap { overflow-x: auto; position: relative; }
table.codes { border-collapse: collapse; width: 100%; min-width: 640px; font-size: 14px; }
table.codes th, table.codes td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.codes th { font: 500 11px var(--f-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
table.codes .num { text-align: right; font-variant-numeric: tabular-nums; }
.code-cell { font-family: var(--f-mono); white-space: nowrap; }
.code-why { display: block; color: var(--muted); font-size: 13px; margin-top: 4px; }
.code-why q { font-style: italic; }
.code-ok { color: var(--ok, #1D7F4E); font-weight: 600; font-size: 13px; }
.code-bad { color: var(--rose-strong); font-weight: 600; font-size: 13px; }
.code-check { color: #7A4B00; font-size: 13px; }
.codes-h { font-size: 15px; color: var(--ink); margin-top: 6px; }
.verify-list { margin: 0; padding-left: 20px; display: grid; gap: 4px; font-size: 14px; }
.ncci-list li.ncci-error::marker { color: #B3261E; }
.ncci-list li.ncci-warn::marker { color: #7A4B00; }
tr.ncci-flag td.code-cell b { text-decoration: underline wavy #7A4B00; text-underline-offset: 3px; }
.op-output { display: grid; gap: 18px; }

.npi-search-row { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; }
.npi-search-row .field { flex: 0 1 260px; }
.prof-id { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; align-items: flex-start; }
.prof-id h2 { font-size: 24px; }
.prof-id p { color: var(--muted); }
.badge { font: 600 12px var(--f-body); border-radius: 999px; padding: 6px 12px; white-space: nowrap; }
.badge-ok { background: #E3F4EC; color: #1D7F4E; }
.badge-warn { background: #FFF4DB; color: #7A4B00; }
.check-inline { display: flex; gap: 8px; align-items: center; font-size: 14px; color: var(--muted); }
.tpl-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.tpl-list > li { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: grid; gap: 10px; }
.tpl-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: center; }
.tpl-edit { display: grid; gap: 8px; }
.tpl-title { font: 600 15px var(--f-body); color: var(--text); background: var(--bg); border: 1.5px solid var(--line); border-radius: 10px; padding: 8px 12px; }

@media (max-width: 720px) {
  .assist-row { grid-template-columns: 1fr; }
}
.panel > *, .stack-view > * { min-width: 0; }
@media (max-width: 640px) {
  .mode-nav { overflow-x: auto; scrollbar-width: none; }
  .mode-nav a { padding: 8px 10px; font-size: 13px; flex: 1 0 auto; }
}
#prof-linked { display: grid; gap: 18px; }
.panel .session-status:empty { display: none; }
table.codes .btn-sm { white-space: nowrap; }

/* ---- Verification ----------------------------------------------------------- */
.badge-bad { background: #FDE8E6; color: #B3261E; }
.license-line { font-size: 14px; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.license-line .lic-ok { color: #1D7F4E; font-weight: 600; }
.license-line .lic-bad { color: var(--rose-strong); font-weight: 600; }
.license-line .lic-na { color: var(--muted); font-weight: 600; }
.license-warn { display: block; flex-basis: 100%; color: #7A4B00; font-size: 13px; }
.attest { font-size: 14px; border-radius: 10px; padding: 8px 12px; }
.attest-verified { background: #E3F4EC; color: #1D7F4E; }
.attest-self_attested, .attest-not_verified { background: #FFF4DB; color: #7A4B00; }
.org-table td { font-size: 13px; }
.org-table .row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.org-table .reject-note { font: 13px var(--f-body); border: 1.5px solid var(--line); border-radius: 8px; padding: 6px 8px; width: 100%; margin-top: 6px; background: var(--bg); color: var(--text); }
.status-pill { font: 600 12px var(--f-body); border-radius: 999px; padding: 3px 10px; white-space: nowrap; }
.status-approved { background: #E3F4EC; color: #1D7F4E; }
.status-pending, .status-self_attested { background: #FFF4DB; color: #7A4B00; }
.status-rejected { background: #FDE8E6; color: #B3261E; }

/* ---- Calls, practice phone, staff ------------------------------------------- */
.locked-note { background: #FFF4DB; color: #7A4B00; border-radius: 14px; padding: 14px 16px; font-size: 15px; }
.locked-note a { color: inherit; font-weight: 600; }
.is-locked .scribe-controls, .is-locked #scribe-generate, .is-locked #op-generate, .is-locked .scribe-controls + .session-status { opacity: .45; pointer-events: none; }
.call-panel { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 16px 18px; margin-bottom: 16px; }
.call-panel.on-call { border-color: var(--mint); box-shadow: 0 0 0 2px color-mix(in srgb, var(--mint) 35%, transparent); }
.call-row { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) auto; gap: 12px; align-items: end; }
.call-row input { font: 16px var(--f-body); color: var(--text); background: var(--bg); border: 1.5px solid var(--line); border-radius: 12px; padding: 10px 12px; width: 100%; }
.call-row select { width: 100%; }
.call-panel .session-status { margin: 10px 2px 0; }
.btn-danger { background: #B3261E !important; color: #FFFFFF !important; }
#call-unavailable { margin: 0 0 14px; }
.phone-line { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.phone-number { font: 600 20px var(--f-display); color: var(--ink); font-variant-numeric: tabular-nums; }
.phone-code { display: grid; gap: 8px; background: var(--tint); border-radius: 12px; padding: 14px 16px; font-size: 15px; }
.code-digits { font: 700 34px var(--f-mono); letter-spacing: .2em; color: var(--ink); }
.link-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.link-list > li { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: center; background: var(--tint); border-radius: 12px; padding: 10px 14px; }
.link-list > li > div:first-child { display: grid; gap: 2px; min-width: 0; }
.link-list > li.fine { display: block; background: none; padding: 4px 0; }
@media (max-width: 720px) { .call-row { grid-template-columns: 1fr; } .call-btn { justify-self: start; } }
.call-panel .session-status:empty { display: none; }
.code-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.code-input { font: 700 26px var(--f-mono); letter-spacing: .3em; width: 9.5em; max-width: 100%; text-align: center; color: var(--ink); background: var(--bg); border: 1.5px solid var(--line); border-radius: 12px; padding: 8px 10px; }
.code-input:focus { border-color: var(--ink); outline: none; }

/* ---- Legal documents (privacy, terms) --------------------------------------- */
.legal-doc { max-width: 780px; gap: 14px; }
.legal-doc h1 { margin-top: 8px; }
.legal-doc h2 { font-size: 21px; color: var(--ink); margin-top: 18px; }
.legal-doc h3 { font-size: 16px; color: var(--text); margin-top: 6px; }
.legal-doc p, .legal-doc li { font-size: 16px; line-height: 1.65; color: var(--text); }
.legal-doc ul { margin: 0; padding-left: 22px; display: grid; gap: 6px; }
.legal-doc a { color: var(--ink); }
.legal-meta { font: 500 13px var(--f-mono); color: var(--muted) !important; }
.legal-links { margin-top: 18px; }
.nowrap { white-space: nowrap; }
.footer-links a, .login-fine a { color: inherit; }

/* Identity verification (profile) */
.id-methods { display: grid; gap: 16px; margin-top: 12px; }
.id-method { display: grid; gap: 8px; justify-items: start; }
.id-method .check { justify-self: stretch; }
.sso-doximity, .dox-btn { color: #0A66C2; }

/* ---- Scribe templates ----------------------------------------------------------- */
.note-options .tpl-field { grid-column: 1 / -1; }
.patient-fields { display: grid; gap: 6px; align-content: start; }
.patient-fields .patient-row-label { font-weight: 600; font-size: 14px; }
#hist-status:empty { display: none; }
.patient-fields .patient-row { flex-wrap: nowrap; }
.patient-row .age-input { width: 90px; flex: none; }
.patient-row select { width: auto; flex: 0 1 140px; min-width: 0; }
.tpl-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.tpl-row select { flex: 1 1 260px; min-width: 0; }
.patient-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 10px 0; }
.patient-row-label { font-weight: 600; font-size: 14px; }
.patient-fields .patient-row { margin: 0; }
.age-input { width: 84px; font: 500 15px var(--f-body); color: var(--text); background: var(--bg); border: 1.5px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.age-input:focus { border-color: var(--ink); outline: none; }
.tpl-dialog { width: min(760px, calc(100vw - 32px)); }
.tpl-lib-filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 4px 0 12px; }
.tpl-lib-filters .search { flex: 1 1 260px; max-width: none; }
.tpl-lib-filters select { flex: 0 1 220px; }
.tpl-lib-list { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 8px; max-height: min(56vh, 520px); overflow-y: auto; }
.tpl-lib-list > li { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: var(--surface); }
.tpl-lib-list > li > div { display: grid; gap: 3px; min-width: 0; }
.tpl-lib-list details summary { cursor: pointer; font-size: 13px; color: var(--muted); }
.tpl-lib-list .btn { flex: none; }
.tpl-lib-list .empty { justify-content: center; color: var(--muted); }

/* ---- Visit history ---------------------------------------------------------------- */
.hist-bar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 8px; }
.hist-bar .fine { flex: 1 1 260px; }
.hist-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.hist-list .empty { color: var(--muted); padding: 16px 4px; }
.hist-row { width: 100%; display: flex; align-items: center; gap: 14px; text-align: left; font: inherit; color: var(--text); cursor: pointer;
  background: var(--surface); border: 1.5px solid var(--line); border-radius: 16px; padding: 12px 16px; }
.hist-row:hover { border-color: var(--ink); }
.hist-flag { display: grid; justify-items: center; gap: 2px; flex: none; width: 64px; }
.hist-flag img { width: 36px; height: 27px; border-radius: 4px; box-shadow: 0 0 0 1px rgba(19, 49, 92, .14); object-fit: cover; }
.hist-icon { width: 26px; height: 26px; color: var(--muted); }
.hist-lang { font-size: 12px; color: var(--muted); max-width: 64px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hist-text-col { display: grid; gap: 3px; min-width: 0; }
.hist-text-col b { font-weight: 600; line-height: 1.35; }
.hist-text-col .muted { color: var(--muted); font-weight: 500; }
.hist-detail { display: grid; gap: 14px; }
.hist-detail-head { display: flex; gap: 14px; align-items: flex-start; }
.hist-detail-head h2 { font-size: 20px; color: var(--ink); line-height: 1.3; }
.hist-transcript summary { cursor: pointer; font-weight: 600; margin-bottom: 8px; }
.hist-text { white-space: pre-wrap; font: 14px/1.5 var(--f-body); background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 12px; max-height: 420px; overflow: auto; }
.hist-delete { justify-self: start; color: #B3261E; }
.hist-row .badge { flex: none; margin-left: auto; }
.hist-row.needs-note { border-color: #B26B00; }
.panel-inset { border: 1px solid var(--line); border-radius: 14px; padding: 14px; display: grid; gap: 12px; background: var(--bg); }
.panel-inset h3, .note-editor h3 { font-size: 16px; color: var(--ink); margin: 0; }
.note-editor { display: grid; gap: 12px; }
.note-section { display: grid; gap: 6px; border-left: 3px solid var(--line); padding-left: 12px; }
.note-section h4 { margin: 0; font-size: 15px; color: var(--ink); }
.section-box { min-height: 0; font-family: var(--f-body); }
.section-add { display: flex; gap: 8px; flex-wrap: wrap; }
.section-add-input { flex: 1 1 220px; min-width: 0; font: 15px var(--f-body); color: var(--text); background: var(--bg); border: 1.5px solid var(--line); border-radius: 12px; padding: 8px 12px; }
.section-add-input:focus { border-color: var(--ink); outline: none; }
.section-mic { display: inline-flex; align-items: center; gap: 6px; }
.section-mic svg { width: 16px; height: 16px; }
.section-mic.is-recording { background: #B3261E; color: #FFFFFF; border-color: #B3261E; }
.section-status:empty { display: none; }
#session-history-note a { color: var(--ink); }

/* ---- Locations, signature, fax, live draft ------------------------------------------ */
.loc-add > summary { list-style: none; display: inline-flex; cursor: pointer; }
.loc-add > summary::-webkit-details-marker { display: none; }
.loc-form { display: grid; gap: 12px; margin-top: 12px; border: 1px solid var(--line); border-radius: 14px; padding: 14px; background: var(--bg); }
.loc-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.loc-row > .field, .loc-row > input:first-child { flex: 1 1 200px; min-width: 0; }
.loc-row input, .loc-npi input, .loc-form .field input, #fax-form .field input {
  font: 15px var(--f-body); color: var(--text); background: var(--surface); border: 1.5px solid var(--line); border-radius: 12px; padding: 10px 12px; width: 100%; }
.loc-row .loc-state { width: 76px; flex: none; }
.loc-npi { display: grid; gap: 6px; }
.loc-npi label { font-weight: 600; font-size: 14px; }
.loc-address-field { position: relative; }
.addr-suggest { list-style: none; margin: 4px 0 0; padding: 4px; position: absolute; z-index: 5; left: 0; right: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); }
.addr-suggest button { width: 100%; text-align: left; display: grid; gap: 2px; background: none; border: 0; padding: 8px 10px; border-radius: 8px; cursor: pointer; font: inherit; color: var(--text); }
.addr-suggest button:hover { background: var(--tint); }
.addr-suggest small { color: var(--muted); }
.sig-draw { display: grid; gap: 8px; margin: 8px 0; }
#sig-canvas { width: 100%; max-width: 600px; height: auto; aspect-ratio: 600 / 160; background: #FFFFFF; border: 1.5px dashed var(--line); border-radius: 12px; touch-action: none; cursor: crosshair; }
.sig-image { max-width: 220px; max-height: 70px; background: #FFFFFF; border-radius: 6px; padding: 4px; }
.fax-list { margin-top: 4px; }
.rough { border: 1px dashed var(--line); border-radius: 14px; padding: 10px 14px; background: var(--surface); }
.rough summary { cursor: pointer; font-weight: 600; }
.rough-text { white-space: pre-wrap; font: 13.5px/1.5 var(--f-body); color: var(--muted); max-height: 320px; overflow: auto; margin: 8px 0; }

/* ---- Sign-up: provider or staff, NPI search ---------------------------------- */
.role-pick { border: 0; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.role-pick legend { font-weight: 600; font-size: 14px; margin-bottom: 8px; padding: 0; }
.role-card { display: flex; gap: 10px; align-items: flex-start; border: 1.5px solid var(--line); border-radius: 14px; padding: 12px 14px; cursor: pointer; background: var(--bg); }
.role-card input { margin-top: 3px; accent-color: var(--ink); }
.role-card span { display: grid; gap: 3px; }
.role-card small { font-size: 13px; color: var(--muted); line-height: 1.35; }
.role-card:has(input:checked) { border-color: var(--ink); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ink) 15%, transparent); }
.npi-signup { display: grid; gap: 10px; border: 1px solid var(--line); border-radius: 14px; padding: 14px; background: var(--tint); }
.npi-signup-h { display: grid; gap: 2px; font-size: 15px; margin: 0; }
.npi-signup-h span { font-size: 13px; color: var(--muted); }
.npi-signup-row { grid-template-columns: minmax(0, 1fr) 120px auto; align-items: end; gap: 10px; }
.login-form .npi-signup-row .btn, .login-form .npi-picked .btn { width: auto; flex: none; }
.login-form .npi-signup ul.npi-results { padding: 0; margin: 8px 0 0; }
.login-form .npi-signup ul.npi-results > li { display: block; padding: 0; border: 0; background: none; }
.npi-results { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; max-height: 260px; overflow-y: auto; }
.npi-results button { width: 100%; text-align: left; font: inherit; color: var(--text); background: var(--surface); border: 1.5px solid var(--line); border-radius: 12px; padding: 10px 12px; cursor: pointer; display: grid; gap: 2px; }
.npi-results button:hover { border-color: var(--ink); }
.npi-results small, .npi-picked span { font-size: 13px; color: var(--muted); }
.npi-picked { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--surface); border: 1.5px solid var(--ink); border-radius: 12px; padding: 10px 12px; }
.npi-picked > div { display: grid; gap: 2px; min-width: 0; }
@media (max-width: 480px) {
  .role-pick { grid-template-columns: 1fr; }
  .npi-signup-row { grid-template-columns: 1fr 1fr; }
  .login-form .npi-signup-row .btn { grid-column: span 2; width: 100%; }
}

.signup-staff #identity-panel { display: none !important; }
.prof-provider-toggle { margin: 0 0 4px; }

/* ---- Touch Mode --------------------------------------------------------------
   Big, easy-to-tap layout for tablets and touch screens: all languages as large tiles plus a
   Scribe button; menus, search and the reference panel are tucked away. */

.touch-toggle { display: inline-flex; align-items: center; gap: 8px; }
.touch-toggle svg { width: 18px; height: 18px; flex: none; }
.touch-toggle[aria-pressed="true"] { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }
body:not(.touch-mode) .touch-only { display: none !important; }

.touch-mode .mode-nav, .touch-mode .specialty-picker, .touch-mode .user-name, .touch-mode #sign-out,
.touch-mode .ref, .touch-mode #view-languages .view-sub, .touch-mode #view-languages .search,
.touch-mode #view-languages > .fine, .touch-mode .type-row { display: none !important; }
.touch-mode .app-shell { grid-template-columns: 1fr; max-width: 1280px; padding-block: 20px 40px; }
.touch-mode .touch-toggle { min-height: 52px; padding: 12px 20px; font-size: 16px; }
.touch-mode .touch-toggle svg { width: 22px; height: 22px; }
.touch-mode button, .touch-mode a { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }

/* Languages */
.touch-mode .view-head { margin-bottom: 16px; gap: 12px; }
.touch-mode .provider-lang { font-size: 16px; }
.touch-mode .provider-lang select { font-size: 18px; min-height: 56px; padding: 12px 44px 12px 16px; }
.touch-mode .touch-scribe {
  display: flex; align-items: center; gap: 20px; min-height: 116px; padding: 22px 28px; margin-bottom: 16px;
  border-radius: 22px; background: #0F6E63; color: #FFFFFF; text-decoration: none;
  transition: transform .12s ease, box-shadow .2s ease;
}
.touch-mode .touch-scribe:active { transform: scale(.985); }
.touch-mode .touch-scribe svg { width: 52px; height: 52px; flex: none; }
.touch-scribe-text { display: grid; gap: 4px; }
.touch-scribe-text b { font: 700 clamp(26px, 3.2vw, 34px)/1.15 var(--f-display); letter-spacing: -.02em; }
.touch-scribe-text span { font-size: 17px; opacity: .92; }
.touch-mode .lang-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }
.touch-mode .lang-card { min-height: 112px; padding: 18px 20px; align-content: center; gap: 6px; border-width: 2px; border-radius: 20px; }
.touch-mode .lang-card:active { transform: scale(.97); border-color: var(--rose); background: var(--blush); }
.touch-mode .lang-native { font-size: 28px; }
.touch-mode .lang-flags { gap: 8px; min-height: 30px; margin-bottom: 4px; }
.touch-mode .lang-flags img { width: 40px; height: 30px; border-radius: 4px; }
.touch-mode .lang-name { font-size: 16px; color: var(--muted); }
.touch-mode .lang-region, .touch-mode .lang-meter, .touch-mode .lang-count { display: none; }

/* Interpreter session */
.touch-mode #back, .touch-mode .touch-back {
  display: inline-flex; align-items: center; gap: 6px; width: auto; height: 60px; padding: 0 22px 0 14px;
  font: 600 17px var(--f-body); color: var(--text); text-decoration: none;
}
.touch-mode #back svg, .touch-mode .touch-back svg { width: 26px; height: 26px; }
.touch-mode .talk-row { gap: 18px; }
.touch-mode .talk { min-height: min(46vh, 440px); border-radius: 28px; }
.touch-mode .talk:active:not(:disabled) { transform: scale(.985); }
.touch-mode .talk svg { width: 64px; height: 64px; }
.touch-mode .talk-who { font-size: 14px; }
.touch-mode .talk-lang { font-size: clamp(30px, 4vw, 44px); }
.touch-mode .talk-hint { font-size: 18px; }
.touch-mode #view-session .session-status { font-size: 18px; text-align: center; }
.touch-mode #session-note-open { min-height: 56px; padding: 14px 22px; font-size: 16px; }

/* Scribe */
.touch-mode .touch-back { justify-self: start; }
.touch-mode .rec-btn { min-height: 88px; padding: 24px 40px; font-size: 22px; }
.touch-mode .rec-dot { width: 20px; height: 20px; }
.touch-mode .rec-time { font-size: 18px; }
.touch-mode .scribe-controls .btn, .touch-mode #scribe-generate { min-height: 60px; padding: 14px 24px; font-size: 17px; }
.touch-mode #scribe-status { font-size: 17px; }

@media (max-width: 640px) {
  .touch-mode .touch-toggle { min-height: 48px; padding: 10px 14px; }
  .touch-mode .lang-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .touch-mode .lang-card { min-height: 96px; padding: 14px 16px; }
  .touch-mode .lang-native { font-size: 23px; }
  .touch-mode .touch-scribe { min-height: 96px; padding: 18px 20px; gap: 14px; }
  .touch-mode .touch-scribe svg { width: 40px; height: 40px; }
  .touch-mode .talk { min-height: 30vh; }
  .touch-mode .rec-btn { width: 100%; justify-content: center; }
}

/* Conflicting details to pick (A.choices) */
.choices { display: grid; gap: 8px; }
.choices:empty { display: none; }
.choices .choice { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; padding: 10px 12px; border-radius: 12px; background: #FFF4DB; color: #7A4B00; font-size: 14px; }
.choices .choice-label { flex: 1 1 100%; }
.choices .choice-label q { color: inherit; }
.choices .choice-btn { background: #fff; color: #5C3900; border: 1px solid #E8C77A; min-height: 36px; }
.choices .choice-btn:hover, .choices .choice-btn:focus-visible { background: #FFE7B0; }
.choices .choice-suggest { background: #E8F1FB; color: #1F4A78; }
.choices .choice-suggest .choice-btn { color: #1F4A78; border-color: #A9C6E8; }
.choices .choice-suggest .choice-btn:hover, .choices .choice-suggest .choice-btn:focus-visible { background: #D3E4F7; }
.choices .choice-suggest .choice-skip { background: transparent; border-style: dashed; }
.note-section.has-choice .section-box { border-color: #E8C77A; }
#op-choices { margin-top: 10px; }

/* Location note header */
.loc-header { border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px 12px; margin: 4px 0 12px; display: grid; gap: 8px; min-width: 0; }
.loc-header legend { padding: 0 6px; font-weight: 600; font-size: 14px; }
.loc-header textarea { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; width: 100%; }
.loc-header-preview { margin: 0; padding: 10px 12px; border-radius: 10px; background: var(--tint, #f6f7f9); white-space: pre-wrap; word-break: break-word; font: 13px/1.5 var(--f-body, sans-serif); }
.linklike { background: none; border: 0; padding: 0; color: inherit; text-decoration: underline; cursor: pointer; font: inherit; }

/* Referring provider */
.ref-field .tpl-row { align-items: center; }
.ref-current { flex: 1 1 auto; min-width: 0; display: flex; flex-wrap: wrap; gap: 2px 8px; align-items: baseline; }
#ref-dialog .loc-form { margin-top: 10px; }

/* NPI searches: one name box, a state menu, an optional ZIP */
.loc-row select.loc-state { width: 150px; flex: none; }
.loc-row .loc-zip { width: 96px; flex: none; }
.npi-search select, .loc-row select { font: 15px var(--f-body); color: var(--text); background: var(--surface); border: 1.5px solid var(--line); border-radius: 12px; padding: 9px 10px; min-width: 0; }

/* ICD-10-CM diagnoses (diagnoses.js) */
.dx-panel { min-width: 0; display: grid; gap: 8px; border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; background: var(--surface); margin: 6px 0 14px; }
.dx-panel h4 { margin: 0; font-size: 15px; color: var(--ink); }
.dx-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; counter-reset: dx; }
.dx-item { min-width: 0; border: 1.5px solid var(--line); border-radius: 12px; padding: 10px 12px; display: grid; gap: 8px; background: var(--bg); counter-increment: dx; }
.dx-item.dx-primary { border-color: var(--ink); }
.dx-item.dx-warn { border-color: #E8C77A; background: #FFFBF0; }
.dx-main { display: grid; gap: 3px; min-width: 0; }
.dx-top { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.dx-top::before { content: counter(dx) "."; color: var(--muted); font-size: 14px; }
.dx-item.in-group { counter-increment: none; margin-left: 18px; border-left: 3px solid var(--ink); }
.dx-item.in-group .dx-top::before { content: "•"; }
.dx-group-head { counter-increment: dx; display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.dx-group-head::before { content: counter(dx) "."; color: var(--muted); font-size: 14px; }
.dx-group-name { flex: 1 1 auto; min-width: 0; font: 600 15px var(--f-body); color: var(--ink); background: transparent; border: 1.5px dashed var(--line); border-radius: 10px; padding: 6px 10px; }
.dx-row { display: flex; gap: 8px; align-items: flex-start; }
.dx-handle { flex: none; width: 32px; min-height: 40px; border: 0; border-radius: 8px; background: var(--tint); color: var(--muted); font-size: 18px; cursor: grab; touch-action: none; }
.dx-handle:active { cursor: grabbing; }
.dx-dragging { opacity: 0.35; }
.dx-ghost { position: fixed; z-index: 50; pointer-events: none; box-shadow: var(--shadow); opacity: 0.95; background: var(--surface); }
.dx-drop-before { box-shadow: 0 -3px 0 0 var(--ink); }
.dx-drop-after { box-shadow: 0 3px 0 0 var(--ink); }
.dx-drop-group { outline: 2px dashed var(--ink); outline-offset: 2px; background: var(--tint); }
.dx-code { font: 600 13px ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--tint); color: var(--ink); border-radius: 8px; padding: 2px 7px; white-space: nowrap; }
.dx-evidence { font-style: italic; }
.dx-alert { font-size: 13px; color: #7A4B00; font-weight: 600; }
.dx-hint { font-size: 13px; color: #1F4A78; }
.dx-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.dx-search { position: relative; display: grid; gap: 6px; }
.dx-search input { font: 15px var(--f-body); color: var(--text); background: var(--bg); border: 1.5px solid var(--line); border-radius: 12px; padding: 10px 12px; width: 100%; }
.dx-results { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; max-height: 300px; overflow-y: auto; }
.dx-results button { width: 100%; text-align: left; display: flex; gap: 8px; align-items: baseline; font: 14px var(--f-body); color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; cursor: pointer; }
.dx-results button:hover, .dx-results button:focus-visible { border-color: var(--ink); }
.dx-results .empty { font-size: 13px; color: var(--muted); padding: 4px 2px; }
.note-section.managed .section-box { background: var(--tint); }

/* Final note preview */
.preview-dialog .note-dialog-inner { max-width: 760px; }
.preview-page { background: #fff; color: #141414; border: 1px solid var(--line); border-radius: 10px; padding: 24px 26px; font: 15px/1.55 var(--f-body); box-shadow: var(--shadow); max-height: 62vh; overflow-y: auto; }
.preview-page h3 { font-size: 15px; margin: 16px 0 4px; color: #141414; }
.preview-page h3:first-child { margin-top: 0; }
.preview-page p { margin: 0 0 6px; }
.preview-page ul, .preview-page ol { margin: 0 0 6px; padding-left: 22px; }
.preview-letterhead { font-weight: 700; font-size: 17px; }
.preview-headerline { color: #555; font-size: 13px; margin: 0 !important; }
.preview-headerline:last-of-type { margin-bottom: 12px !important; }
.preview-page .sig-image { max-height: 70px; display: block; margin: 4px 0; }
.preview-alert { background: #FFF4DB; color: #7A4B00; border-radius: 10px; padding: 10px 12px; font-size: 14px; }
.preview-checklist { font-size: 14px; border: 1px dashed var(--line); border-radius: 10px; padding: 8px 12px; }
.preview-checklist summary { cursor: pointer; font-weight: 600; }
@media (max-width: 480px) { .preview-page { padding: 16px; } }

/* Billing codes */
.bill-panel { display: grid; gap: 8px; border-top: 1px solid var(--line); padding-top: 12px; margin-top: 6px; }
.bill-panel h4 { margin: 0; font-size: 15px; color: var(--ink); }
.bill-list .dx-item { counter-increment: none; }
.bill-list .dx-top::before { content: none; }
.bill-mods, .bill-dx { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.mod-chip { display: inline-flex; align-items: center; gap: 4px; background: var(--tint); color: var(--ink); border-radius: 999px; padding: 3px 4px 3px 10px; font: 600 13px var(--f-body); }
.mod-chip small { font-weight: 400; color: var(--muted); max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mod-chip button { border: 0; background: none; color: var(--muted); font-size: 16px; line-height: 1; padding: 2px 6px; cursor: pointer; border-radius: 999px; }
.mod-chip.mod-bad { background: #FDE8E6; color: #B3261E; }
.bill-mods select { font: 13px var(--f-body); border: 1.5px dashed var(--line); border-radius: 999px; padding: 4px 8px; background: var(--surface); color: var(--text); width: 132px; min-width: 0; }
.bill-units { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; color: var(--muted); }
.bill-units input { width: 56px; font: 14px var(--f-body); border: 1.5px solid var(--line); border-radius: 8px; padding: 3px 6px; }
.dx-chip { font: 600 12px ui-monospace, SFMono-Regular, Menlo, monospace; border: 1.5px solid var(--line); background: var(--surface); color: var(--muted); border-radius: 8px; padding: 4px 8px; cursor: pointer; }
.dx-chip[aria-pressed="true"] { border-color: var(--ink); background: var(--ink); color: #fff; }
.bill-add { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.bill-add label { font-size: 14px; font-weight: 600; }
.bill-add input { width: 130px; font: 15px var(--f-body); border: 1.5px solid var(--line); border-radius: 10px; padding: 8px 10px; text-transform: uppercase; }

/* Optional sections bar */
.sec-bar { border: 1px solid var(--line); border-radius: 14px; padding: 10px 14px 12px; margin: 4px 0 12px; display: grid; gap: 8px; min-width: 0; }
.sec-bar legend { padding: 0 6px; font-weight: 600; font-size: 14px; }
.sec-toggles { display: flex; flex-wrap: wrap; gap: 8px; }
.sec-toggle { display: flex; align-items: flex-start; gap: 8px; border: 1.5px solid var(--line); border-radius: 12px; padding: 8px 12px; cursor: pointer; background: var(--bg); font-size: 14px; flex: 1 1 200px; }
.sec-toggle:has(input:checked) { border-color: var(--ink); }
.sec-toggle input { width: 18px; height: 18px; margin-top: 1px; accent-color: #13315C; flex: none; }
.sec-toggle span { display: grid; gap: 1px; font-weight: 600; }
.sec-toggle small { font-weight: 400; color: var(--muted); font-size: 12px; }

/* E&M: assessment and plan per diagnosis */
.dx-ap { display: grid; gap: 6px; width: 100%; }
.dx-ap label { display: grid; gap: 3px; font-size: 13px; font-weight: 600; color: var(--muted); }
.dx-ap textarea { font: 14px/1.45 var(--f-body); color: var(--text); background: var(--surface); border: 1.5px solid var(--line); border-radius: 10px; padding: 8px 10px; width: 100%; resize: vertical; }
.dx-group-head { flex-wrap: wrap; }
.dx-general { display: grid; gap: 4px; counter-increment: dx; border: 1.5px dashed var(--line); border-radius: 12px; padding: 10px 12px; }
.dx-general::before { content: none; }
.sec-toggle.required { opacity: 0.85; cursor: default; }

/* Bundled codes */
.bundle-badge { font-size: 11px; padding: 3px 8px; white-space: normal; }
.bundle-not-billable { background: #EEF0F3; color: #3D4654; }
.bundle-needs-modifier { background: #FFF4DB; color: #7A4B00; }
.bundle-unbundled { background: #E3F4EC; color: #1D7F4E; }
.bill-item.bill-bundled { background: var(--tint); }
.code-cell .bundle-badge { display: inline-block; margin-top: 4px; }

/* Proposed groups */
.dx-proposals { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.dx-proposal { display: grid; gap: 8px; border: 1.5px dashed var(--ink); border-radius: 12px; padding: 10px 12px; background: var(--tint); }
.dx-proposal > div:first-child { display: grid; gap: 2px; min-width: 0; }

/* ==== Provider UX pass ======================================================== */

/* Full width where the specialty reference doesn't help. */
body[data-view="view-history"] .app-shell, body[data-view="view-profile"] .app-shell, body[data-view="view-opnote"] .app-shell { grid-template-columns: minmax(0, 1fr); max-width: 1040px; }
body[data-view="view-history"] .ref, body[data-view="view-profile"] .ref, body[data-view="view-opnote"] .ref { display: none; }

/* Nav badge: notes waiting for a signature. */
.nav-badge { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; margin-left: 6px; border-radius: 999px; background: var(--accent, #E05A47); color: #fff; font: 700 11px var(--f-body); vertical-align: 1px; }
.baa-link { text-decoration: none; }

/* Numbered steps */
.step-h { display: flex; align-items: center; gap: 10px; font-size: 18px; color: var(--ink); margin: 18px 0 10px; }
.step-n { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 999px; background: var(--ink); color: #fff; font: 700 13px var(--f-body); flex: none; }
.scribe-setup { margin: 4px 0 6px; }
.scribe-setup .step-h { margin-top: 0; }
.btn-lg { font-size: 17px; padding: 14px 26px; }

/* Compact header on phones: one row for brand and account, the specialty, then all five tabs. */
@media (max-width: 640px) {
  .app-header-inner { row-gap: 8px; }
  .user-menu { gap: 6px; }
  .user-menu .btn { padding: 6px 10px; font-size: 13px; }
  .touch-toggle span { display: none; }
  .mode-nav { overflow: visible; }
  .mode-nav a { flex: 1 1 0; min-width: 0; padding: 8px 2px; font-size: 12.5px; text-align: center; white-space: nowrap; }
  .nav-badge { margin-left: 3px; min-width: 16px; height: 16px; font-size: 10px; }
  .trial-banner, .baa-banner { padding: 8px 14px; gap: 8px; font-size: 13px; flex-direction: row; flex-wrap: nowrap; text-align: left; justify-content: space-between; }
  .trial-banner p, .baa-banner p { flex: 1 1 auto; min-width: 0; }
  .trial-banner .btn, .baa-banner .btn { padding: 6px 10px; font-size: 12.5px; flex: none; }
  .view-sub { font-size: 15px; }
}

/* Menus (details/summary): Sections, Rewrite, Suggest, More, the visit's ⋯ */
.tool-menu { position: relative; }
.tool-menu > summary { list-style: none; cursor: pointer; font: 600 13px var(--f-body); color: var(--ink); border: 1.5px solid var(--line); border-radius: 999px; padding: 6px 12px; background: var(--surface); user-select: none; white-space: nowrap; }
.tool-menu > summary::-webkit-details-marker { display: none; }
.tool-menu > summary::after { content: " ▾"; font-size: 11px; color: var(--muted); }
.tool-menu[open] > summary { border-color: var(--ink); }
.visit-menu > summary { font-size: 18px; line-height: 1; padding: 6px 12px 10px; }
.visit-menu > summary::after { content: none; }
.menu-pop { position: absolute; z-index: 30; top: calc(100% + 6px); left: 0; min-width: 200px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 6px; display: grid; gap: 2px; }
.menu-pop.menu-right { left: auto; right: 0; }
.menu-pop.wide { width: min(560px, calc(100vw - 32px)); padding: 12px; }
.menu-pop > button { text-align: left; font: 14px var(--f-body); color: var(--text); background: none; border: 0; border-radius: 8px; padding: 9px 10px; cursor: pointer; }
.menu-pop > button:hover, .menu-pop > button:focus-visible { background: var(--tint); }
.menu-pop > button.danger, .danger-link { color: #B3261E; }
.menu-pop .sec-bar { border: 0; padding: 0; margin: 0; }
.menu-pop .panel-inset { margin: 0; border: 0; padding: 0; background: none; }
.tool-row { display: flex; gap: 8px; flex-wrap: wrap; }
.dx-more > summary { font-size: 17px; line-height: 1; padding: 5px 11px 9px; }
.dx-more > summary::after { content: none; }

/* Visit header and facts */
.hist-detail-head { align-items: flex-start; }
.hist-d-title { flex: 1 1 auto; min-width: 0; }
.hist-d-title h2 { font-size: clamp(18px, 2.4vw, 22px); line-height: 1.3; }
.visit-facts { display: flex; flex-wrap: wrap; gap: 10px 24px; align-items: center; margin: 10px 0 4px; }
.visit-facts .patient-row { margin: 0; }
.ref-slot .ref-field { margin: 0; }
.ref-slot:empty { display: none; }
.rewrite-warn { font-size: 13px; color: #7A4B00; background: #FFF4DB; border-radius: 8px; padding: 8px 10px; margin: 0; }

/* Before you sign */
.review { border: 1.5px solid var(--ink); border-radius: 14px; padding: 12px 14px; margin: 6px 0 14px; background: var(--surface); }
.review h3 { margin: 0 0 6px; font-size: 15px; color: var(--ink); }
.review-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 14px; }
.review-list > li { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding-left: 18px; position: relative; }
.review-list > li::before { content: ""; position: absolute; left: 2px; top: .55em; width: 9px; height: 9px; border-radius: 999px; background: var(--muted); }
.review-list > li.review-block::before { background: #B3261E; }
.review-list > li.review-todo::before { background: #E0A100; }
.review-list > li.review-info::before { background: #8A94A6; }
.review-list > li.review-verify { display: grid; }
.review-list > li.review-verify::before { background: #1F4A78; }
.review-list ul { margin: 2px 0 0; padding-left: 18px; color: var(--text); }
.flash { animation: flash 1.6s ease-out; }
@keyframes flash { 0%, 30% { box-shadow: 0 0 0 4px color-mix(in srgb, #E0A100 55%, transparent); } 100% { box-shadow: none; } }

/* Note sections */
.step-head { align-items: center; margin-top: 4px; }
.step-head .step-h { margin: 0; }
.note-warning { font-size: 13px; padding: 8px 12px; }
.note-section { margin-bottom: 14px; }
.note-section .fine-h { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.note-section.note-header .section-box { font-size: 13px; color: var(--muted); background: var(--tint); }
.section-add-toggle { font-size: 13px; color: var(--muted); justify-self: start; padding: 2px 0; text-decoration: none; }
.section-add-toggle:hover { color: var(--ink); text-decoration: underline; }
.managed-preview { margin: 0; padding: 10px 12px; border-radius: 10px; background: var(--tint); font: 13px/1.5 var(--f-body); white-space: pre-wrap; word-break: break-word; }
.note-section.dx-slot { border-left: 0; padding-left: 0; }
.note-section.dx-slot .dx-panel { margin: 0; }

/* Sign and send */
.sign-block { display: grid; gap: 10px; margin-bottom: 8px; }

/* Bottom action bar while a note is open */
.action-bar { position: sticky; bottom: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin-top: 16px; padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px)); background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(8px); border: 1px solid var(--line); border-radius: 16px 16px 0 0; box-shadow: 0 -6px 18px rgba(19, 49, 92, .08); }
.ab-status { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; min-width: 0; font-weight: 600; font-size: 15px; }
.ab-status .ab-todo { color: #7A4B00; }
.ab-status .ab-ready { color: #1D7F4E; }
.ab-status .ab-signed { color: #1D7F4E; }
.ab-status .fine { font-weight: 400; }
.ab-buttons { display: flex; gap: 8px; }
.ab-buttons .btn { min-width: 96px; }
#hist-final:disabled { opacity: 1; background: #1D7F4E; border-color: #1D7F4E; }
@media (max-width: 640px) {
  .action-bar { margin-inline: -16px; border-radius: 0; padding-inline: 16px; }
  .ab-buttons { flex: 1 1 100%; }
  .ab-buttons .btn { flex: 1; }
}

/* Visits list: filters and status */
.hist-filters { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 12px; }
.hist-filters .filter-chip { font: 600 14px var(--f-body); color: var(--muted); background: var(--surface); border: 1.5px solid var(--line); border-radius: 999px; padding: 7px 14px; cursor: pointer; }
.hist-filters .filter-chip[aria-pressed="true"] { color: #fff; background: var(--ink); border-color: var(--ink); }
.chip-n { font-weight: 400; opacity: .8; margin-left: 2px; }
.badge-todo { background: #E8F1FB; color: #1F4A78; }
.hist-row .badge { flex: none; white-space: nowrap; }
.hist-bar { margin-top: 18px; padding-top: 12px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; }
.hist-bar .fine { flex: 1 1 320px; }
.danger-link { font-size: 13px; }
.in-visit .view-head { display: none; }
.visit-facts .patient-row { flex-wrap: nowrap; }
.visit-facts .patient-row select { width: auto; min-width: 110px; }
.visit-facts .ref-field { display: grid; gap: 2px; }
@media (max-width: 640px) {
  .hist-detail-head { display: grid; grid-template-columns: auto auto 1fr auto; align-items: center; gap: 8px 10px; }
  .hist-detail-head .hist-d-title { grid-column: 1 / -1; grid-row: 2; }
  .hist-detail-head .visit-menu { grid-column: 4; grid-row: 1; justify-self: end; }
  .hist-d-title h2 { font-size: 19px; }
  .hist-flag { flex-direction: row; gap: 6px; }
}
@media (max-width: 640px) {
  .hist-row { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 12px; row-gap: 6px; padding: 12px; }
  .hist-row .hist-flag { width: 48px; grid-row: span 2; align-self: start; }
  .hist-row .badge { grid-column: 2; justify-self: start; }
  .hist-text-col b { font-size: 15px; }
}

/* Profile quick links */
.prof-jump { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; }
.prof-jump button { font: 600 13px var(--f-body); color: var(--ink); background: var(--surface); border: 1.5px solid var(--line); border-radius: 999px; padding: 6px 12px; cursor: pointer; }
.prof-jump button:hover { border-color: var(--ink); }
#view-profile .panel, #prof-linked { scroll-margin-top: 16px; }

/* Section heading line: the heading, + Add and the microphone */
.sec-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 36px; }
.sec-head h4 { margin: 0; min-width: 0; }
.sec-tools { display: flex; align-items: center; gap: 6px; flex: none; }
.sec-btn { font: 600 13px var(--f-body); color: var(--ink); background: var(--surface); border: 1.5px solid var(--line); border-radius: 999px; padding: 6px 11px; cursor: pointer; white-space: nowrap; }
.sec-btn:hover, .sec-btn[aria-expanded="true"] { border-color: var(--ink); }
.section-box.autosize, .dx-ap textarea.autosize, #hist-pt-text.autosize { resize: none; overflow: hidden; }
#hist-pt-text { font-family: var(--f-body); font-size: 15px; line-height: 1.5; }
details.note-section > summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: flex-start; gap: 10px; }
details.note-section > summary::-webkit-details-marker { display: none; }
details.note-section > summary::after { content: "Show ▾"; margin-left: auto; flex: none; font: 600 12px var(--f-body); color: var(--muted); }
details.note-section[open] > summary::after { content: "Hide ▴"; }
details.note-section > summary h4 { flex: none; }
.sec-peek { flex: 1 1 auto; min-width: 0; font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
details.note-section[open] .sec-peek { visibility: hidden; }
details.note-section[open] > summary { margin-bottom: 6px; }
.section-mic-quick { width: 36px; height: 36px; flex: none; }
.section-mic-quick svg { width: 18px; height: 18px; }
.section-mic-quick.is-recording { background: #E05A47; border-color: #E05A47; color: #fff; animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px color-mix(in srgb, #E05A47 25%, transparent); } }

/* The patient's visit summary */
.pt-summary { display: grid; gap: 8px; border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; background: var(--surface); }
.pt-summary h3 { margin: 0; font-size: 15px; color: var(--ink); }
.pt-lang select { font: 14px var(--f-body); border: 1.5px solid var(--line); border-radius: 10px; padding: 6px 8px; max-width: 200px; }
/* On phones the larger menus (Sections, Rewrite) open as a sheet from the bottom of the screen. */
@media (max-width: 640px) {
  .menu-pop.wide { position: fixed; left: 12px; right: 12px; top: auto; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); width: auto; max-height: 72vh; overflow-y: auto; z-index: 60; box-shadow: 0 -8px 30px rgba(19, 49, 92, .25); }
  .sec-toggle { flex-basis: 100%; }
}
.pt-summary .note-out-head { flex-wrap: wrap; gap: 8px; }

/* ==== Note editor: compact, document-like editing ============================== */

/* Scrolling to something lands below the app's sticky header (its height is measured by app.js). */
html { scroll-padding-top: calc(var(--sticky-top, 72px) + 8px); }

/* Long one-line content (the jump bar, folded previews) must never widen the page. */
.hist-detail, .note-editor, .note-section { grid-template-columns: minmax(0, 1fr); }
.note-jump, details.note-section > summary { min-width: 0; }

/* Jump bar: every part of the note one tap away, stuck to the top of the screen. */
.note-jump { position: sticky; top: var(--sticky-top, 0px); z-index: 25; display: flex; align-items: center; gap: 8px;
  margin: -6px -22px 0; padding: 7px 22px; background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); transition: opacity .15s, transform .15s; }
.jump-back { width: 34px; height: 34px; border-radius: 10px; }
.jump-back svg { width: 18px; height: 18px; }
.jump-list { display: flex; gap: 6px; overflow-x: auto; flex: 1 1 auto; min-width: 0; scrollbar-width: none; padding: 2px 0; }
.jump-list::-webkit-scrollbar { display: none; }
.jump-chip { position: relative; flex: none; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 600 13px var(--f-body); color: var(--muted);
  background: var(--tint); border: 1.5px solid transparent; border-radius: 999px; padding: 6px 12px; cursor: pointer; }
.jump-chip:hover { border-color: var(--line); color: var(--ink); }
.jump-chip[aria-current] { background: var(--ink); color: var(--surface); }
.jump-chip.needs::after { content: ""; position: absolute; top: 4px; right: 4px; width: 7px; height: 7px; border-radius: 50%; background: #E0A100; }
.jump-n { margin-left: 5px; font-weight: 400; opacity: .75; }
.note-section, #hist-dx, #hist-step-bill, #hist-step-sign, #hist-review, .dx-item { scroll-margin-top: 52px; }
.dx-item, .note-section { scroll-margin-bottom: 96px; }

/* Before you sign: Close only shows when it's a sheet (phones). */
.review-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.review-close { display: none; font-size: 14px; }
.ab-review { font: inherit; color: inherit; background: none; border: 0; padding: 0; text-align: left; cursor: pointer; }
.ab-review:disabled { cursor: default; }

/* Diagnoses: the code is the "change" button; ⋯ in the corner; one line of detail. */
.dx-row > .dx-main { flex: 1 1 auto; }
.dx-row > .dx-more { flex: none; margin-left: auto; }
.dx-code-btn { border: 1.5px solid transparent; cursor: pointer; }
.dx-code-btn::after { content: " ▾"; font-size: 10px; color: var(--muted); }
.dx-code-btn:hover, .dx-code-btn:focus-visible { border-color: var(--ink); }
.dx-desc { line-height: 1.4; }
.dx-ap .ap-row { display: grid; grid-template-columns: 84px minmax(0, 1fr); gap: 8px; align-items: start; font-weight: 600; }
.dx-ap .ap-l { padding-top: 9px; font-size: 13px; color: var(--muted); }
.ap-short { display: none; }
.bill-item { position: relative; padding-right: 52px; }
.bill-item > .dx-actions { position: absolute; top: 8px; right: 8px; }

@media (max-width: 640px) {
  /* In an open visit the app's header scrolls away; the jump bar (with Back) takes its place. */
  body.in-visit[data-view="view-history"] .app-header { position: static; }
  body.in-visit[data-view="view-history"] .app-shell { padding-top: 12px; }

  /* The open visit uses the phone's full width. */
  #view-history.in-visit .hist-detail { margin-inline: -20px; border-radius: 0; border-inline: 0; padding: 12px 12px 16px; gap: 8px; }
  .note-jump { margin: -4px -12px 0; padding: 6px 12px; }
  .hist-d-title h2 { font-size: 17px; line-height: 1.3; }
  #hist-d-meta { font-size: 12.5px; }
  .visit-facts { gap: 6px 16px; margin: 0; }
  .visit-facts .ref-field { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; }
  .visit-facts .ref-field .tpl-row { flex: 1 1 auto; }
  .hist-transcript > summary { padding-block: 4px; }
  .note-editor { gap: 8px; }
  .step-h { font-size: 16px; margin: 14px 0 6px; }
  .step-n { width: 22px; height: 22px; font-size: 12px; }
  .note-warning { font-size: 12.5px; padding: 6px 10px; line-height: 1.4; }

  /* Sections read like the note: the heading line holds the tools, the text runs edge to edge. */
  .note-section { margin: 0; padding: 4px 0 10px; border-left: 0; border-bottom: 1px solid var(--line); gap: 4px; }
  .sec-head { min-height: 34px; }
  .sec-head h4, details.note-section > summary h4 { font-size: 12.5px; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; color: var(--ink); }
  .sec-btn { padding: 5px 10px; }
  .section-mic-quick { width: 34px; height: 34px; border-radius: 10px; }
  .section-mic-quick svg { width: 17px; height: 17px; }
  /* 16px text: iPhones zoom the page into anything smaller when it's tapped. */
  .section-box, .note-section.note-header .section-box { font-size: 16px; line-height: 1.45; padding: 6px 8px; border-radius: 8px; border-color: transparent; background: var(--tint); }
  .note-section.note-header .section-box { font-size: 16px; }
  .section-box:focus { background: var(--surface); border-color: var(--ink); }
  .section-add-input, .dx-search input, .dx-change-q, .bill-add input, #hist-pt-text, .dx-group-name { font-size: 16px; }
  .section-add { gap: 6px; }
  .section-status:empty { display: none; }
  .note-section.dx-slot { border-bottom: 0; padding: 0; }

  /* Diagnoses: tighter cards, A and P labels beside the text. */
  .dx-panel { border: 0; padding: 4px 0 0; background: none; margin: 0; gap: 6px; }
  .dx-list { gap: 6px; }
  .dx-item { padding: 8px 8px 8px 6px; gap: 6px; border-radius: 10px; }
  .dx-item.in-group { margin-left: 10px; }
  .dx-row { gap: 4px; }
  .dx-handle { width: 26px; min-height: 34px; font-size: 16px; background: none; }
  .dx-main { gap: 2px; }
  .dx-top { gap: 4px 6px; font-size: 15px; }
  .dx-top b { line-height: 1.3; }
  .dx-top .badge { padding: 3px 8px; font-size: 11px; }
  .dx-desc, .dx-hint, .dx-alert { font-size: 12.5px; }
  .dx-more > summary { padding: 4px 10px 8px; }
  .dx-actions { padding-left: 30px; gap: 6px; }
  .dx-actions .btn-sm, .dx-group-head .btn-sm { padding: 6px 11px; font-size: 13px; min-height: 0; }
  .dx-panel h4 { font-size: 12.5px; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; }
  .dx-ap { padding-left: 2px; gap: 4px; }
  .dx-ap .ap-row { grid-template-columns: 16px minmax(0, 1fr); gap: 6px; }
  .dx-ap .ap-l { padding-top: 8px; font: 700 13px var(--f-body); color: var(--ink); }
  .ap-full { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .ap-short { display: inline; }
  .dx-ap textarea { font-size: 16px; line-height: 1.45; padding: 6px 8px; border-color: transparent; background: var(--tint); border-radius: 8px; }
  .dx-ap textarea:focus { background: var(--surface); border-color: var(--ink); outline: none; }
  .dx-general { padding: 8px; }
  .dx-general > .fine { display: none; }
  .dx-group-head { gap: 6px; }

  /* Billing: the same tighter cards. */
  .bill-panel { padding-top: 8px; margin-top: 0; gap: 6px; }
  .bill-panel > .fine { font-size: 12.5px; }
  .bill-item { padding: 8px 46px 8px 10px; gap: 6px; }
  .bill-item > .dx-actions { top: 6px; right: 6px; padding: 0; }
  .bill-mods select { width: 118px; font-size: 16px; }
  .bill-units input { font-size: 16px; width: 52px; }

  /* Bottom bar: one row. Its status opens the review list as a sheet. */
  .action-bar { margin-inline: -20px; flex-wrap: nowrap; gap: 8px; padding: 8px 12px calc(8px + env(safe-area-inset-bottom, 0px)); margin-top: 8px; }
  .ab-status { flex: 1 1 auto; display: grid; gap: 0; font-size: 14px; min-width: 0; }
  .ab-status .ab-review { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .ab-status .ab-review:not(:disabled)::after { content: " ▴"; font-size: 11px; }
  .ab-status .ab-review[aria-expanded="true"]::after { content: " ▾"; }
  .ab-wide, #hist-ab-next { display: none; }
  #hist-save-state { font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .ab-buttons { flex: none; }
  .ab-buttons .btn { flex: none; min-width: 0; padding: 10px 14px; }
  #hist-review:not(.as-sheet) { display: none; }
  #hist-review.as-sheet { position: fixed; left: 8px; right: 8px; bottom: calc(var(--ab-h, 60px) + 8px); z-index: 61; margin: 0; max-height: 60vh; overflow-y: auto; box-shadow: 0 -8px 30px rgba(19, 49, 92, .25); }
  #hist-review.as-sheet .review-close { display: inline; }

  /* While typing, the bars step aside for the keyboard. */
  body.is-typing .action-bar { opacity: 0; transform: translateY(100%); pointer-events: none; }
  body.is-typing .note-jump { opacity: 0; transform: translateY(-100%); pointer-events: none; }
}

/* Template suggestions and learning progress */
.lib-reason { display: block; font-size: 12.5px; color: var(--muted); }
.lib-reason.billed { color: #1D7F4E; font-weight: 600; }
.lib-why { margin: 0; }
.learn-row { display: grid; gap: 2px; }
.learn-row .fine { margin: 0 0 0 26px; }

/* ==== Phones: + / − folding, and editing that's left to a computer ============= */
.sec-fold, .phone-only, .fold-all, .bill-units-ro { display: none; }
div.note-section > .sec-head > .sec-peek, #hist-dx-peek, #hist-bill-peek { display: none; }
@media (max-width: 640px) {
  .sec-fold { display: inline-grid; place-items: center; width: 30px; height: 30px; flex: none; padding: 0; cursor: pointer;
    border: 1.5px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink); font: 700 17px/1 var(--f-body); }
  .sec-fold:hover { border-color: var(--ink); }
  .fold-all { display: inline-block; }
  .phone-only { display: block; }
  .bill-units-ro { display: inline; font-size: 13px; color: var(--muted); }
  /* A folded section is its heading line and the start of its text. */
  div.note-section.folded > .sec-head > .sec-peek, #hist-dx.folded #hist-dx-peek, #hist-step-bill.folded #hist-bill-peek {
    display: block; flex: 1 1 auto; min-width: 0; font: 400 13px var(--f-body); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-transform: none; letter-spacing: 0; }
  div.note-section.folded > :not(.sec-head) { display: none !important; }
  div.note-section.folded .sec-tools { display: none; }
  div.note-section.folded { padding-bottom: 4px; }
  .sec-head h4 { flex: none; }
  #hist-dx .note-out-head { gap: 8px; }
  #hist-dx .note-out-head h4 { flex: none; }
  #hist-dx .note-out-head .sec-fold { margin-left: auto; }
  #hist-dx.folded > :not(.note-out-head) { display: none !important; }
  #hist-step-bill .step-h .sec-fold { margin-left: auto; }
  #hist-step-bill.folded > .bill-panel { display: none; }
  /* The folded letterhead and billing summary use the same + / −. */
  details.note-section > summary::after { content: "+"; display: inline-grid; place-items: center; width: 30px; height: 30px; flex: none;
    border: 1.5px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink); font: 700 17px/1 var(--f-body); }
  details.note-section[open] > summary::after { content: "−"; }

  /* Left to a computer: regrouping and reordering, re-suggesting, rewriting, and billing edits. */
  #hist-rewrite, .dx-suggest-menu, .dx-handle, .menu-pop [data-dx="group-up"], .menu-pop [data-dx="ungroup"], .menu-pop [data-dx="up"], .menu-pop [data-dx="down"],
  [data-dx-ungroup-all], .bill-add, .bill-item > .dx-actions, .bill-mods select, .mod-chip button, .bill-units, .dx-chip[aria-pressed="false"] { display: none !important; }
  .dx-chip { pointer-events: none; }
  .bill-item { padding-right: 10px; }
  .dx-item { padding-left: 10px; }
}

/* Touch Mode: no specialty name above the page titles (it's set on the Profile page). */
.touch-mode #specialty-eyebrow, .touch-mode #session-specialty, .touch-mode #scribe-specialty, .touch-mode #op-specialty { display: none !important; }
#specialty-panel .specialty-picker { max-width: 520px; }
.rec-recovered { background: #1F4A78; }
.rec-recovered a, .rec-recovered .linklike { color: #FFFFFF; font-weight: 600; margin-left: 8px; }
.dx-panel { grid-template-columns: minmax(0, 1fr); }
.dx-panel > .note-out-head, #hist-step-bill .step-h { min-width: 0; }

/* A group's codes, folded under its name */
.dx-group-toggle { flex-basis: 100%; justify-self: start; text-align: left; font: 600 13px var(--f-body); color: var(--ink); background: var(--tint); border: 1.5px solid transparent; border-radius: 999px; padding: 5px 12px; cursor: pointer; }
.dx-group-toggle:hover, .dx-group-toggle[aria-expanded="true"] { border-color: var(--line); }
.dx-group-toggle.has-warn::after { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #E0A100; margin-left: 6px; vertical-align: 1px; }

/* Finding the patient's language from speech */
.detect-lang { display: grid; gap: 8px; justify-items: start; margin: 0 0 18px; padding: 14px 16px; border: 1.5px dashed var(--line); border-radius: 16px; background: var(--surface); }
.detect-btn { display: inline-flex; align-items: center; gap: 10px; }
.detect-btn svg { width: 20px; height: 20px; }
.detect-btn.is-recording { background: #B3261E; border-color: #B3261E; animation: pulse 1.2s ease-in-out infinite; }
.detect-lang .fine { margin: 0; }
.detect-ask { margin: 0; font-size: 15px; color: var(--ink); line-height: 1.6; }
.detect-result { display: grid; gap: 8px; width: 100%; }
.detect-result p { margin: 0; }
.detect-pick { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.detect-pick b { font-size: 20px; color: var(--ink); }
.detect-alts { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.touch-mode .detect-btn { min-height: 64px; font-size: 19px; padding: 16px 26px; }

/* The session may be in the wrong language */
.lang-switch { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin: 8px 0; padding: 10px 14px; border-radius: 12px; background: #FFF4DB; color: #5C3900; font-weight: 600; }
.lang-switch-actions { display: flex; gap: 8px; }

/* Forms of address (Vietnamese) */
.address-table { min-width: 560px; }
.address-table input { width: 100%; min-width: 0; font: inherit; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface, #fff); color: inherit; }
.address-table input[type="number"] { width: 72px; }
.address-table td { vertical-align: middle; }
.address-hint { font-size: 13px; color: var(--muted); white-space: nowrap; }
.address-hint b { color: var(--ink); font-weight: 600; }
.address-table td:first-child { white-space: nowrap; }

/* Beta mode (test accounts) */
.beta-banner { margin: 0 0 14px; padding: 10px 14px; border-radius: 10px; background: #FFF4D6; color: #6A4300; border: 1px solid #F0D48A; font-size: 14px; line-height: 1.45; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .beta-banner { background: #3A2C10; color: #F1C46B; border-color: #5A4418; } }

/* Admin console (admin.aurikal.ai) */
.admin-body { background: var(--bg, #F4F6FA); min-height: 100vh; }
.admin-top { display: flex; align-items: center; gap: 12px; padding: 14px 20px; background: var(--surface, #fff); border-bottom: 1px solid var(--line); }
.admin-top b { font-family: var(--f-display, inherit); color: var(--ink); }
.admin-who { margin-left: auto; color: var(--muted); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.admin-main { max-width: 1040px; margin: 0 auto; padding: 20px 16px 48px; display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
.admin-invite { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); align-items: end; }
.admin-link { margin-top: 14px; padding: 12px; border-radius: 10px; background: var(--tint); }
.admin-link p { margin: 0 0 8px; }
.admin-link-row { display: flex; gap: 8px; flex-wrap: wrap; }
.admin-link-row input { flex: 1 1 260px; min-width: 0; font: 13px var(--f-mono, monospace); padding: 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface, #fff); color: inherit; }
.admin-table { min-width: 720px; }
.admin-actions { white-space: nowrap; text-align: right; }
.admin-actions .btn + .btn { margin-left: 6px; }
.badge.admin-pending, .badge.admin-active { background: var(--good-bg, #E3F4EC); color: var(--good, #1D7F4E); }
.badge.admin-expired, .badge.admin-revoked, .badge.admin-disabled { background: var(--line); color: var(--muted); }
.badge.admin-accepted { background: var(--tint); color: var(--ink); }
.beta-banner { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.beta-banner span { flex: 1 1 260px; min-width: 0; }
.beta-banner.beta-paused { background: var(--tint); color: var(--ink); border-color: var(--line); }
