:root {
  color-scheme: light;
  --bg: #f4f6f1;
  --surface: #ffffff;
  --surface-2: #edf1e9;
  --surface-3: #e5ecdf;
  --ink: #1e2c24;
  --muted: #738076;
  --line: #e5eae2;
  --green: #286447;
  --green-dark: #1d5038;
  --green-soft: #e4efe6;
  --lime: #d8e8ac;
  --amber: #a96a24;
  --amber-soft: #fff2df;
  --red: #a34e48;
  --red-soft: #fae9e6;
  --shadow: 0 8px 30px rgba(31, 54, 39, .055);
  --radius-xl: 24px;
  --radius-lg: 18px;
  --radius-md: 14px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--ink); }
body { -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.app-shell { max-width: 760px; min-height: 100dvh; margin: 0 auto; padding-bottom: calc(86px + var(--safe-bottom)); }
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px 12px; position: sticky; top: 0; z-index: 5; background: rgba(244,246,241,.92); backdrop-filter: blur(18px); }
.brand-lockup { display: flex; align-items: center; gap: 11px; }
.brand-mark { width: 34px; height: 34px; border-radius: 12px; background: var(--green); display: flex; align-items: center; justify-content: center; gap: 2px; transform: rotate(-5deg); }
.brand-mark span { display: block; width: 4px; border-radius: 5px; background: #e2edcf; transform: rotate(19deg); }
.brand-mark span:nth-child(1) { height: 12px; margin-top: 5px; }
.brand-mark span:nth-child(2) { height: 19px; }
.brand-mark span:nth-child(3) { height: 14px; margin-top: -4px; }
.brand-name { font-size: 20px; line-height: 1; font-weight: 800; letter-spacing: -.8px; }
.brand-caption { margin-top: 4px; font-size: 10px; color: var(--muted); letter-spacing: .045em; text-transform: uppercase; }
.top-status { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 8px 11px; display: flex; align-items: center; gap: 7px; color: var(--ink); font-size: 11px; font-weight: 700; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #ba7e3b; }
.top-status.work .status-dot { background: #378a5e; }
.top-status.off .status-dot { background: #ba6259; }
.main-content { padding: 8px 18px 22px; }
.bottom-nav { position: fixed; z-index: 10; bottom: 0; left: 50%; transform: translateX(-50%); width: min(100%, 760px); display: grid; grid-template-columns: repeat(4, 1fr); padding: 9px 14px calc(8px + var(--safe-bottom)); background: rgba(255,255,255,.94); backdrop-filter: blur(20px); border-top: 1px solid rgba(225,232,223,.9); }
.nav-item { border: 0; background: transparent; color: #8b968c; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; padding: 4px 2px; font-size: 10px; font-weight: 650; }
.nav-icon { font-size: 22px; line-height: 22px; font-weight: 500; }
.nav-item.is-active { color: var(--green); }
.nav-item.is-active .nav-icon { transform: translateY(-1px); }
.eyebrow { color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .11em; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(25px, 7vw, 34px); line-height: 1.05; letter-spacing: -1.15px; margin: 7px 0 8px; }
h2 { font-size: 19px; letter-spacing: -.45px; margin-bottom: 0; }
h3 { font-size: 14px; letter-spacing: -.15px; margin-bottom: 5px; }
.page-subtitle { color: var(--muted); font-size: 13px; line-height: 1.45; margin: 0; }
.home-hero { background: linear-gradient(132deg, #1e5138 0%, #286a49 62%, #377a53 100%); border-radius: var(--radius-xl); padding: 23px 21px 20px; color: #fff; overflow: hidden; position: relative; box-shadow: 0 14px 34px rgba(32,87,58,.16); }
.home-hero:after { content: ""; position: absolute; width: 210px; height: 210px; border: 1px solid rgba(222,239,209,.16); border-radius: 50%; right: -70px; top: -92px; box-shadow: 0 0 0 22px rgba(222,239,209,.04), 0 0 0 48px rgba(222,239,209,.035); }
.home-hero .eyebrow { color: #bed4bf; }
.home-hero h1 { max-width: 82%; margin-top: 9px; }
.home-hero p { max-width: 84%; color: #d6e6d9; font-size: 13px; line-height: 1.45; margin: 0 0 17px; }
.hero-actions { display: flex; gap: 8px; position: relative; z-index: 1; flex-wrap: wrap; }
.button { border: 0; border-radius: 13px; padding: 12px 15px; font-size: 12px; font-weight: 750; display: inline-flex; align-items: center; justify-content: center; gap: 7px; transition: transform .12s ease, opacity .12s ease; }
.button:active { transform: scale(.98); }
.button-primary { color: #214c36; background: #e6efcf; }
.button-light { color: #fff; background: rgba(255,255,255,.13); border: 1px solid rgba(255,255,255,.2); }
.button-green { background: var(--green); color: #fff; }
.button-soft { background: var(--green-soft); color: var(--green-dark); }
.button-neutral { background: var(--surface-2); color: var(--ink); }
.button-danger { background: var(--red-soft); color: var(--red); }
.button-small { padding: 9px 11px; font-size: 11px; border-radius: 11px; }
.button-block { width: 100%; }
.button:disabled { opacity: .45; cursor: default; }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 24px 2px 11px; }
.section-head .text-link { color: var(--green); background: none; border: 0; font-size: 11px; font-weight: 800; padding: 7px 0; }
.stats-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin-top: 12px; }
.stat-card { border-radius: 17px; padding: 14px 14px 12px; background: var(--surface); border: 1px solid var(--line); }
.stat-top { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 11px; gap: 8px; }
.stat-icon { width: 27px; height: 27px; display: grid; place-items: center; border-radius: 9px; background: var(--surface-2); color: var(--green); font-size: 14px; }
.stat-value { font-size: 27px; font-weight: 800; letter-spacing: -1px; margin-top: 8px; }
.stat-note { color: var(--muted); font-size: 10px; margin-top: 1px; }
.list-stack { display: flex; flex-direction: column; gap: 8px; }
.list-card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 13px 14px; box-shadow: 0 2px 8px rgba(31,54,39,.018); }
.list-card-button { width: 100%; text-align: left; color: inherit; }
.card-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card-main { min-width: 0; flex: 1; }
.card-title { font-size: 13px; font-weight: 750; line-height: 1.35; overflow-wrap: anywhere; }
.card-meta { color: var(--muted); font-size: 11px; line-height: 1.45; margin-top: 4px; }
.card-chevron { color: #a6b1a5; font-size: 19px; padding-left: 4px; }
.card-leading { width: 34px; height: 34px; flex: 0 0 34px; display: grid; place-items: center; background: var(--surface-2); color: var(--green); border-radius: 11px; font-size: 15px; }
.patient-avatar { width: 38px; height: 38px; border-radius: 13px; background: #e7eee3; color: #38634a; display: grid; place-items: center; font-size: 15px; font-weight: 850; flex: 0 0 38px; }
.patient-extra { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.pill { display: inline-flex; align-items: center; gap: 5px; border-radius: 999px; padding: 5px 8px; background: var(--surface-2); color: var(--muted); font-size: 10px; font-weight: 700; }
.pill.green { color: var(--green); background: var(--green-soft); }
.pill.amber { color: var(--amber); background: var(--amber-soft); }
.pill.red { color: var(--red); background: var(--red-soft); }
.empty-state { border: 1px dashed #d8e1d5; border-radius: 17px; padding: 23px 15px; text-align: center; background: rgba(255,255,255,.55); }
.empty-icon { font-size: 25px; margin-bottom: 8px; }
.empty-title { font-size: 13px; font-weight: 750; }
.empty-text { color: var(--muted); font-size: 11px; line-height: 1.5; margin: 5px auto 0; max-width: 260px; }
.page-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin: 5px 2px 17px; }
.search-wrap { position: relative; margin-bottom: 12px; }
.search-wrap input { width: 100%; padding: 13px 14px 13px 40px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); outline: none; color: var(--ink); font-size: 13px; }
.search-icon { position: absolute; left: 14px; top: 11px; color: var(--muted); font-size: 17px; }
.segmented { display: flex; background: var(--surface-2); padding: 4px; border-radius: 13px; gap: 3px; margin-bottom: 13px; }
.segmented button { border: 0; border-radius: 10px; flex: 1; background: transparent; padding: 9px 5px; color: var(--muted); font-weight: 750; font-size: 11px; }
.segmented button.active { background: var(--surface); color: var(--green); box-shadow: 0 2px 7px rgba(35,60,41,.07); }
.profile-head { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-xl); padding: 17px; }
.back-link { border: 0; background: none; color: var(--green); font-size: 12px; font-weight: 800; padding: 4px 0; margin: 0 0 12px; }
.profile-title-row { display: flex; align-items: center; gap: 12px; }
.profile-avatar { width: 50px; height: 50px; border-radius: 16px; font-size: 19px; }
.profile-name { font-size: 19px; line-height: 1.15; letter-spacing: -.45px; margin: 0; overflow-wrap: anywhere; }
.profile-meta { color: var(--muted); font-size: 11px; margin-top: 5px; }
.profile-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 14px; }
.action-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 7px; margin-top: 12px; }
.action-tile { border: 1px solid var(--line); background: var(--surface); border-radius: 14px; padding: 12px 6px 10px; color: var(--green-dark); display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 10px; font-weight: 750; min-height: 69px; }
.action-tile .tile-icon { font-size: 19px; line-height: 20px; }
.data-section { margin-top: 20px; }
.data-section-title { display: flex; justify-content: space-between; align-items: center; padding: 0 2px 9px; }
.data-list { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.data-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 11px 13px; border-bottom: 1px solid var(--line); }
.data-row:last-child { border-bottom: 0; }
.data-label { color: var(--muted); font-size: 11px; }
.data-value { font-size: 11px; text-align: right; font-weight: 700; max-width: 65%; overflow-wrap: anywhere; }
.inline-actions { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 10px; }
.task-time { white-space: nowrap; color: var(--green); font-weight: 800; font-size: 11px; }
.overdue { color: var(--red) !important; }
.more-card { display: flex; align-items: center; gap: 12px; padding: 15px; border: 1px solid var(--line); background: var(--surface); border-radius: 16px; margin-bottom: 8px; }
.more-card .card-leading { width: 38px; height: 38px; flex-basis: 38px; }
.more-card-copy { flex: 1; }
.more-card-copy strong { display: block; font-size: 13px; }
.more-card-copy small { color: var(--muted); font-size: 11px; display: block; margin-top: 3px; }
.modal-backdrop { position: fixed; inset: 0; z-index: 20; background: rgba(17,31,22,.42); display: flex; align-items: flex-end; justify-content: center; padding: 18px 10px calc(10px + var(--safe-bottom)); }
.modal-panel { width: min(100%, 560px); max-height: min(90dvh, 760px); overflow: auto; background: var(--bg); border-radius: 24px; padding: 20px 18px 18px; box-shadow: 0 20px 80px rgba(0,0,0,.24); animation: rise .2s ease-out; }
@keyframes rise { from { transform: translateY(18px); opacity: .7; } to { transform: translateY(0); opacity: 1; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 17px; }
.modal-head h2 { margin: 0; }
.modal-close { width: 32px; height: 32px; border: 0; background: var(--surface-2); color: var(--muted); border-radius: 50%; font-size: 17px; }
.form-field { margin-bottom: 13px; }
.form-field label { display: block; color: var(--muted); font-size: 11px; font-weight: 750; margin-bottom: 6px; }
.form-field input, .form-field select, .form-field textarea { width: 100%; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); padding: 12px 13px; font-size: 13px; outline: none; }
.form-field textarea { min-height: 82px; resize: vertical; }
.form-field input:focus, .form-field select:focus, .form-field textarea:focus { border-color: #8eb49a; box-shadow: 0 0 0 3px rgba(57,125,83,.09); }
.form-hint { color: var(--muted); font-size: 10px; line-height: 1.45; margin-top: 6px; }
.form-actions { display: flex; gap: 8px; margin-top: 17px; }
.form-actions .button { flex: 1; }
.toast-root { position: fixed; z-index: 40; bottom: calc(88px + var(--safe-bottom)); left: 50%; transform: translateX(-50%); width: min(calc(100% - 36px), 460px); display: flex; flex-direction: column; gap: 7px; pointer-events: none; }
.toast { background: #23372b; color: #fff; border-radius: 13px; padding: 12px 14px; font-size: 12px; box-shadow: var(--shadow); animation: fade-in .18s ease-out; }
.toast.error { background: #873f3a; }
@keyframes fade-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.loading-state { min-height: 55vh; display: flex; flex-direction: column; justify-content: center; align-items: center; color: var(--muted); font-size: 12px; }
.loader { width: 28px; height: 28px; border: 3px solid #dbe5d9; border-top-color: var(--green); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.error-screen { text-align: center; padding: 13vh 12px 30px; }
.error-screen .empty-icon { font-size: 36px; }
.error-screen h2 { margin: 10px 0 8px; }
.error-screen p { color: var(--muted); font-size: 12px; line-height: 1.5; max-width: 310px; margin: 0 auto 18px; }
.footer-note { color: var(--muted); text-align: center; font-size: 10px; line-height: 1.5; margin: 19px 9px 0; }
.divider-space { height: 7px; }
@media (min-width: 600px) {
  .main-content { padding-left: 24px; padding-right: 24px; }
  .stats-grid { grid-template-columns: repeat(4, minmax(0,1fr)); }
  .modal-backdrop { align-items: center; }
}

@media (prefers-color-scheme: dark) {
  :root:not(.tg-theme-light) { color-scheme: dark; --bg:#111a14; --surface:#1b281f; --surface-2:#25352a; --surface-3:#2a3b30; --ink:#edf4ee; --muted:#a0afa3; --line:#304136; --green:#79b48d; --green-dark:#c0dfc5; --green-soft:#263e2e; --amber:#e5b574; --amber-soft:#493923; --red:#e59a91; --red-soft:#482b2a; --shadow:0 8px 30px rgba(0,0,0,.22); }
  :root:not(.tg-theme-light) .topbar { background: rgba(17,26,20,.92); }
  :root:not(.tg-theme-light) .bottom-nav { background: rgba(27,40,31,.95); border-top-color: var(--line); }
  :root:not(.tg-theme-light) .home-hero { background: linear-gradient(132deg, #173d2b 0%, #20583b 62%, #2b6544 100%); }
  :root:not(.tg-theme-light) .patient-avatar { background: #2a4030; color: #c0dfc5; }
  :root:not(.tg-theme-light) .brand-mark { background: #377a53; }
  :root:not(.tg-theme-light) .modal-panel { background: var(--bg); }
  :root:not(.tg-theme-light) .empty-state { background: rgba(27,40,31,.5); }
}

:root.tg-theme-dark {
  color-scheme: dark;
  --bg:#111a14; --surface:#1b281f; --surface-2:#25352a; --surface-3:#2a3b30;
  --ink:#edf4ee; --muted:#a0afa3; --line:#304136; --green:#79b48d; --green-dark:#c0dfc5;
  --green-soft:#263e2e; --amber:#e5b574; --amber-soft:#493923; --red:#e59a91;
  --red-soft:#482b2a; --shadow:0 8px 30px rgba(0,0,0,.22);
}
:root.tg-theme-dark .topbar { background: rgba(17,26,20,.92); }
:root.tg-theme-dark .bottom-nav { background: rgba(27,40,31,.95); border-top-color: var(--line); }
:root.tg-theme-dark .home-hero { background: linear-gradient(132deg, #173d2b 0%, #20583b 62%, #2b6544 100%); }
:root.tg-theme-dark .patient-avatar { background: #2a4030; color: #c0dfc5; }
:root.tg-theme-dark .brand-mark { background: #377a53; }
:root.tg-theme-dark .modal-panel { background: var(--bg); }
:root.tg-theme-dark .empty-state { background: rgba(27,40,31,.5); }

/* Medical visual system: cool clinical neutrals with calm teal accents. */
:root {
  --bg: #f2f7fa;
  --surface: #ffffff;
  --surface-2: #eaf2f6;
  --surface-3: #dceaf1;
  --ink: #183342;
  --muted: #6d8491;
  --line: #dce8ee;
  --green: #147f91;
  --accent: #147f91;
  --green-dark: #105c70;
  --green-soft: #e1f1f4;
  --amber: #a96f17;
  --amber-soft: #fff2dc;
  --red: #b64d52;
  --red-soft: #fae8e9;
  --shadow: 0 8px 30px rgba(26, 67, 89, .08);
}
body { background: var(--bg); color: var(--ink); }
.topbar { background: rgba(242,247,250,.94); border-bottom-color: rgba(214,229,236,.92); }
.brand-mark { background: #147f91; box-shadow: 0 5px 13px rgba(20,127,145,.2); }
.brand-mark span { background: #e8f7fa; }
.brand-name { color: #17495b; letter-spacing: -.35px; }
.brand-caption { color: #718995; }
.top-status { background: #e5eef3; color: #57717e; }
.top-status.work { background: #def2ee; color: #197b70; }
.top-status.vacation { background: #fff0d8; color: #9a691b; }
.home-hero { background: linear-gradient(135deg,#12465d 0%,#147b8c 58%,#35a2a5 100%); box-shadow: 0 14px 34px rgba(16,91,111,.16); }
.home-hero .eyebrow { color: #bde1e8; }
.home-hero p { color: #e0f1f4; }
.button-primary { background: #e4f3f3; color: #15596a; }
.button-green { background: var(--green); }
.button-soft { background: var(--green-soft); color: var(--green-dark); }
.bottom-nav { grid-template-columns: repeat(5,1fr); background: rgba(255,255,255,.96); border-top-color: #dce8ee; }
.nav-item { color: #78909c; }
.nav-item.is-active { color: #147f91; }
.card-leading { background: #e7f1f5; }
.patient-avatar { background: #e1eff3; color: #155e70; }
.action-tile { color: #175c70; background: #fff; }
.profile-head { box-shadow: 0 3px 14px rgba(21,70,91,.035); }
.segmented button.active { color: #147f91; }
.search-wrap input:focus, .form-field input:focus, .form-field select:focus, .form-field textarea:focus { border-color: #75b6c2; box-shadow: 0 0 0 3px rgba(20,127,145,.1); }
.clinical-category { margin-top: 8px; }
.clinical-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
.catalog-card { min-height: 92px; display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-start; gap: 5px; padding: 12px; border: 1px solid var(--line); border-radius: 15px; background: var(--surface); color: var(--ink); text-align: left; font-size: 12px; font-weight: 750; line-height: 1.3; }
.catalog-card small { font-size: 10px; font-weight: 550; color: var(--muted); }
.catalog-card.is-disabled { opacity: .58; }
.catalog-mark { width: 25px; height: 25px; display: grid; place-items: center; border-radius: 8px; background: var(--green-soft); color: var(--green); font-size: 16px; }
.survey-prompt { padding: 18px; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); box-shadow: var(--shadow); }
.survey-text { margin: 13px 0 17px; font-size: 15px; font-weight: 700; line-height: 1.55; white-space: normal; }
.survey-options { display: flex; flex-direction: column; gap: 8px; }
.survey-option { width: 100%; min-height: 46px; border: 1px solid #cfe3e9; border-radius: 13px; padding: 12px 14px; background: #f4fafb; color: #155e70; text-align: left; font-size: 13px; font-weight: 750; }
.survey-option:active { background: #e4f2f5; }
.survey-option-back { margin-top: 2px; text-align: center; border-style: dashed; background: var(--surface-2); color: var(--muted); }
.survey-option-back:active { background: var(--surface-3); color: var(--ink); }
.survey-input { margin-top: 15px; padding-top: 13px; border-top: 1px solid var(--line); }
.survey-complete { padding: 16px 4px 2px; text-align: center; }
.survey-complete-icon { width: 42px; height: 42px; margin: 0 auto 10px; display: grid; place-items: center; border-radius: 50%; background: #dcf2ec; color: #168271; font-size: 23px; font-weight: 800; }
.survey-complete strong { display: block; font-size: 14px; }
.survey-complete p { margin: 7px 0 14px; color: var(--muted); font-size: 11px; line-height: 1.45; }
.settings-card { padding: 15px; margin-bottom: 10px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.settings-card h3 { margin-bottom: 12px; }
.settings-card select, .settings-card input[type=time] { width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-2); color: var(--ink); }
.two-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.two-fields label { display:block; margin-bottom:5px; color:var(--muted); font-size:10px; font-weight:700; }
.day-picker { display:grid; grid-template-columns:repeat(7,1fr); gap:5px; margin-top:12px; }
.day-picker label { position:relative; }
.day-picker input { position:absolute; opacity:0; }
.day-picker span { display:grid; place-items:center; min-height:32px; border-radius:9px; background:var(--surface-2); color:var(--muted); font-size:10px; font-weight:800; }
.day-picker input:checked + span { background:var(--green-soft); color:var(--green-dark); box-shadow:inset 0 0 0 1px #b9dce2; }
.setting-toggle { min-height:38px; display:flex; align-items:center; justify-content:space-between; gap:10px; border-top:1px solid var(--line); font-size:11px; color:var(--ink); }
.setting-toggle input { accent-color:var(--green); width:18px; height:18px; }
.check-line { display:flex; align-items:flex-start; gap:8px; color:var(--muted); font-size:11px; line-height:1.4; }
.check-line input { accent-color:var(--green); margin-top:1px; }
.toast { background: #174b5e; }
.toast.error { background: #9b4149; }
.empty-state { border-color: #cddfe7; }
.loading-state .loader { border-color: #dbe9ef; border-top-color: var(--green); }
@media (min-width: 600px) { .clinical-grid { grid-template-columns: repeat(3,minmax(0,1fr)); } }
@media (prefers-color-scheme: dark) {
  :root:not(.tg-theme-light) { --bg:#111e25; --surface:#1a2b34; --surface-2:#243a44; --surface-3:#2d4651; --ink:#eaf4f7; --muted:#a0b7c0; --line:#304a55; --green:#63bdc4; --green-dark:#b7e4e7; --green-soft:#203e46; --amber:#e1b76c; --amber-soft:#453a27; --red:#e18c91; --red-soft:#472d34; --shadow:0 8px 30px rgba(0,0,0,.24); }
  :root:not(.tg-theme-light) .topbar { background:rgba(17,30,37,.94); }
  :root:not(.tg-theme-light) .bottom-nav { background:rgba(26,43,52,.96); }
  :root:not(.tg-theme-light) .home-hero { background:linear-gradient(135deg,#103c50 0%,#145d6d 58%,#247f84 100%); }
  :root:not(.tg-theme-light) .brand-name { color:#d7edf1; }
  :root:not(.tg-theme-light) .brand-mark { background:#147f91; }
  :root:not(.tg-theme-light) .patient-avatar { background:#24414d; color:#b7e4e7; }
  :root:not(.tg-theme-light) .survey-option { background:#203740; border-color:#345966; color:#c8edf0; }
}
:root.tg-theme-dark { --bg:#111e25; --surface:#1a2b34; --surface-2:#243a44; --surface-3:#2d4651; --ink:#eaf4f7; --muted:#a0b7c0; --line:#304a55; --green:#63bdc4; --green-dark:#b7e4e7; --green-soft:#203e46; --amber:#e1b76c; --amber-soft:#453a27; --red:#e18c91; --red-soft:#472d34; --shadow:0 8px 30px rgba(0,0,0,.24); }
:root.tg-theme-dark .topbar { background:rgba(17,30,37,.94); }
:root.tg-theme-dark .bottom-nav { background:rgba(26,43,52,.96); }
:root.tg-theme-dark .home-hero { background:linear-gradient(135deg,#103c50 0%,#145d6d 58%,#247f84 100%); }
:root.tg-theme-dark .brand-name { color:#d7edf1; }
:root.tg-theme-dark .patient-avatar { background:#24414d; color:#b7e4e7; }
:root.tg-theme-dark .survey-option { background:#203740; border-color:#345966; color:#c8edf0; }

/* Clinical workflow controls */
.survey-progress{display:grid;gap:8px;margin:8px 0 14px;color:var(--muted);font-size:12px;font-weight:700}
.progress-track{height:6px;border-radius:99px;background:var(--line);overflow:hidden}
.progress-track i{display:block;height:100%;border-radius:inherit;background:var(--accent,#197c83);transition:width .2s ease}
.data-section .setting-toggle select{max-width:150px;min-width:120px;padding:8px 10px;border:1px solid var(--line);border-radius:10px;background:var(--surface);color:var(--ink);font:inherit}
.data-section .setting-toggle{gap:12px}
.report-patient-list{display:grid;gap:8px}
.notify-group{padding:12px 0;border-top:1px solid var(--line);display:grid;gap:9px}
.notify-group:first-of-type{border-top:0}
.notify-group details{font-size:12px;color:var(--muted)}
.notify-group summary{cursor:pointer;font-weight:700;padding:5px 0}
.notify-step-list{display:grid;gap:8px;margin-top:9px}
.notify-step{display:flex;justify-content:space-between;align-items:center;gap:10px;padding:9px;border-radius:12px;background:var(--surface-2)}
.notify-step strong{font-size:12px}
.summary-time-form{display:grid;gap:7px;padding:10px 0;border-top:1px solid var(--line)}
.summary-time-form label{font-weight:700;font-size:12px;color:var(--ink)}
.summary-time-form input{min-width:0;max-width:120px;padding:8px;border:1px solid var(--line);border-radius:10px;background:var(--surface);color:var(--ink)}
@media(max-width:420px){.notify-step{align-items:flex-start;flex-direction:column}.notify-step .inline-actions{width:100%}}


/* Patient summary modal */
.summary-panel { display:flex; flex-direction:column; max-height:min(88dvh,820px); }
.summary-content { overflow:auto; padding:4px 1px 12px; color:var(--ink); font-size:13px; line-height:1.58; white-space:normal; }
.summary-panel .form-actions { flex-wrap:wrap; }
.summary-panel .form-actions .button { min-width:130px; }

/* UX refresh: concise dashboard, progressive disclosure and mobile-first settings. */
[hidden] { display: none !important; }
:root {
  --bg: #f3f7fa;
  --surface: #ffffff;
  --surface-2: #edf3f7;
  --surface-3: #e1edf3;
  --ink: #173747;
  --muted: #708794;
  --line: #dce7ed;
  --green: #167d8d;
  --green-dark: #105d6d;
  --green-soft: #e2f1f4;
  --shadow: 0 8px 26px rgba(25, 67, 88, .065);
}
.topbar { padding: 12px 18px 9px; }
.brand-name { font-size: 18px; }
.brand-caption { font-size: 9px; }
.main-content { padding-top: 7px; padding-bottom: 28px; }
.home-hero { padding: 19px 18px 17px; border-radius: 21px; }
.home-hero h1 { font-size: clamp(23px, 6vw, 30px); margin-bottom: 6px; }
.home-hero p { margin-bottom: 12px; }
.stats-grid { gap: 8px; margin-top: 10px; }
.stat-card { padding: 12px; border-radius: 15px; }
.stat-value { font-size: 25px; }
.section-head { margin-top: 19px; margin-bottom: 9px; }
.home-quicklinks { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px; margin-top: 16px; }
.quicklink { min-width: 0; border: 1px solid var(--line); border-radius: 14px; padding: 11px 8px; background: var(--surface); color: var(--ink); display: flex; flex-direction: column; align-items: flex-start; gap: 4px; text-align: left; }
.quicklink > span { color: var(--green); font-size: 18px; line-height: 1.1; }
.quicklink strong { font-size: 11px; }
.quicklink small { color: var(--muted); font-size: 9px; line-height: 1.25; }
.bottom-nav { padding-top: 7px; padding-bottom: calc(7px + var(--safe-bottom)); }
.nav-item { min-height: 42px; gap: 2px; font-size: 10px; }
.nav-icon { font-size: 20px; }

/* Dense longitudinal patient details are available on demand. */
.detail-fold { margin-top: 9px; padding: 0 13px; border: 1px solid var(--line); border-radius: 15px; background: var(--surface); overflow: hidden; }
.detail-fold > summary { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 48px; list-style: none; cursor: pointer; color: var(--ink); font-size: 12px; font-weight: 750; }
.detail-fold > summary::-webkit-details-marker { display: none; }
.detail-fold > summary::after { content: "⌄"; color: var(--muted); font-size: 17px; line-height: 1; transition: transform .15s ease; }
.detail-fold[open] > summary::after { transform: rotate(180deg); }
.detail-fold > :not(summary) { padding-bottom: 12px; }
.detail-fold .data-section { margin-top: 0; }
.detail-fold .data-section-title { padding-top: 2px; }
.catalog-fold { padding-left: 14px; padding-right: 14px; }
.catalog-fold > summary { min-height: 51px; }
.catalog-fold .clinical-grid { padding-top: 0; }
.clinical-intro { display: grid; gap: 3px; margin: 0 2px 10px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
.clinical-intro strong { font-size: 13px; }
.clinical-intro span { color: var(--muted); font-size: 11px; line-height: 1.4; }

/* The More area contains only secondary tools, not links duplicated in the main nav. */
.profile-mini-card { display: flex; align-items: center; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.settings-card { padding: 15px; border-radius: 16px; }
.status-settings { margin-top: 10px; }
.settings-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.settings-card-head h3 { margin-bottom: 4px; }
.settings-card-head p { margin-bottom: 0; }
.status-options { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 6px; margin-top: 13px; }
.status-option { min-width: 0; padding: 10px 5px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-2); color: var(--muted); font-size: 10px; font-weight: 750; }
.status-option.selected { border-color: #9ccbd3; background: var(--green-soft); color: var(--green-dark); }
.more-links { display: grid; gap: 8px; margin-top: 13px; }
.more-link { width: 100%; display: flex; align-items: center; gap: 11px; padding: 13px; text-align: left; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 15px; }
.more-link-icon { width: 36px; height: 36px; flex: 0 0 36px; display: grid; place-items: center; border-radius: 11px; color: var(--green); background: var(--green-soft); font-size: 17px; }
.more-link > span:nth-child(2) { flex: 1; min-width: 0; }
.more-link strong { display: block; font-size: 12px; }
.more-link small { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; line-height: 1.3; }
.more-link b { color: #9aabb4; font-size: 20px; font-weight: 500; }

/* Settings: four short tabs instead of one long, scrolling settings wall. */
.settings-tabs { position: sticky; top: 58px; z-index: 4; display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 4px; margin: 0 0 12px; padding: 4px; border: 1px solid var(--line); border-radius: 14px; background: rgba(237,243,247,.96); backdrop-filter: blur(14px); }
.settings-tab { min-width: 0; padding: 10px 4px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font-size: 10px; font-weight: 750; white-space: nowrap; }
.settings-tab.active { background: var(--surface); color: var(--green-dark); box-shadow: 0 2px 7px rgba(22,76,94,.09); }
.settings-panel { display: block; }
.settings-panel[hidden] { display: none !important; }
.settings-card h3 { margin-bottom: 6px; }
.settings-card > .card-meta { line-height: 1.45; margin-bottom: 12px; }
.settings-card select { width: 100%; min-width: 0; }
.time-window { display: grid; grid-template-columns: minmax(0,1fr) 18px minmax(0,1fr); align-items: center; gap: 8px; margin-top: 14px; }
.time-field { min-width: 0; }
.time-field label { display: block; margin-bottom: 5px; color: var(--ink); font-size: 11px; font-weight: 750; }
.time-field input { display: block; width: 100%; min-width: 0; padding: 12px 9px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); color: var(--ink); font-size: 16px; font-weight: 750; }
.time-field small { display: block; margin-top: 4px; color: var(--muted); font-size: 9px; }
.time-separator { padding-top: 8px; text-align: center; color: var(--muted); }
.timezone-note { margin-top: 10px; padding: 8px 10px; border-radius: 10px; background: var(--surface-2); color: var(--muted); font-size: 10px; }
.field-caption { margin-top: 16px; color: var(--ink); font-size: 11px; font-weight: 750; }
.day-picker { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 7px; margin-top: 8px; }
.day-picker label { min-width: 0; }
.day-picker span { min-height: 38px; border: 1px solid var(--line); background: var(--surface-2); font-size: 11px; }
.day-picker input:checked + span { border-color: #a5d0d7; background: var(--green-soft); color: var(--green-dark); box-shadow: none; }
.settings-toggle-list { display: grid; }
.setting-toggle { min-height: 43px; font-size: 12px; }
.setting-toggle input { width: 20px; height: 20px; flex: 0 0 20px; }
.settings-savebar { position: sticky; bottom: calc(73px + var(--safe-bottom)); z-index: 6; display: grid; gap: 6px; margin: 10px -2px 0; padding: 10px 2px 8px; background: linear-gradient(180deg,rgba(243,247,250,0),rgba(243,247,250,.96) 24%); }
.settings-savebar > span { color: var(--muted); text-align: center; font-size: 9px; }
.notify-group { margin-top: 8px; padding: 0; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); overflow: hidden; }
.notify-group > summary { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px; color: var(--ink); list-style: none; }
.notify-group > summary::-webkit-details-marker { display: none; }
.notify-group > summary::after { content: "⌄"; color: var(--muted); }
.notify-summary-meta { color: var(--muted); font-size: 10px; font-weight: 600; text-align: right; }
.notify-group-actions { display: flex; flex-wrap: wrap; gap: 7px; padding: 0 11px 11px; }
.notify-overrides { margin: 0 10px 10px; padding: 9px; border-radius: 10px; background: var(--surface-2); }
.notify-overrides > summary { color: var(--green-dark); font-size: 10px; font-weight: 750; cursor: pointer; }
.notify-step-list { margin-top: 8px; }
.notify-step { align-items: flex-start; background: var(--surface); }
.notify-step-copy { min-width: 0; flex: 1; }
.notify-step .inline-actions { margin-top: 0; }
.notify-step .button { white-space: nowrap; }
.settings-savebar .button { min-height: 45px; }
.summary-time-row { display: grid; grid-template-columns: minmax(0,1fr) auto auto; align-items: center; gap: 7px; padding: 11px 0; border-top: 1px solid var(--line); }
.summary-time-copy { min-width: 0; }
.summary-time-copy strong { display: block; font-size: 11px; line-height: 1.3; }
.summary-time-copy small { display: block; margin-top: 3px; color: var(--muted); font-size: 9px; }
.summary-time-row input { width: 94px; min-width: 0; padding: 9px 7px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); color: var(--ink); font-size: 13px; }
.summary-time-row .button { padding: 9px 8px; font-size: 10px; }
.bot-connection { margin-top: 10px; }

/* Touch and layout polish. */
.button, .nav-item, .settings-tab, .status-option, .more-link, .detail-fold > summary { -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid #70b8c4; outline-offset: 2px; }
.list-card { border-radius: 15px; }
.action-grid { gap: 8px; }
.action-tile { min-height: 67px; }
@media (max-width: 390px) {
  .settings-tab { font-size: 9px; }
  .summary-time-row { grid-template-columns: minmax(0,1fr) auto; }
  .summary-time-copy { grid-column: 1 / -1; }
  .summary-time-row input { width: 100%; }
  .summary-time-row .button { min-width: 68px; }
  .more-link { padding: 11px; }
}
@media (prefers-color-scheme: dark) {
  :root:not(.tg-theme-light) .settings-tabs { background: rgba(36,58,68,.96); }
  :root:not(.tg-theme-light) .settings-savebar { background: linear-gradient(180deg,rgba(17,30,37,0),rgba(17,30,37,.97) 24%); }
}
:root.tg-theme-dark .settings-tabs { background: rgba(36,58,68,.96); }
:root.tg-theme-dark .settings-savebar { background: linear-gradient(180deg,rgba(17,30,37,0),rgba(17,30,37,.97) 24%); }
/* Final mobile corrections: never cover a field with the save action. */
.settings-savebar { position: static; bottom: auto; margin-top: 12px; padding: 8px 0 10px; background: transparent; }
.summary-time-row { grid-template-columns: minmax(0,1fr) auto auto; }
@media (max-width: 390px) {
  .summary-time-row { grid-template-columns: minmax(0,1fr) auto auto; }
  .summary-time-copy { grid-column: 1 / -1; }
  .summary-time-row input { grid-column: 1; width: 100%; }
  .summary-time-row .button { min-width: 64px; }
}
.main-content { padding-bottom: calc(112px + var(--safe-bottom)); }
.modal-head h2 { min-width: 0; font-size: 17px; line-height: 1.25; overflow-wrap: anywhere; }
.modal-head { margin-bottom: 13px; }


/* Dialogs own the mobile viewport while open; the tab bar must not compete with form actions. */
body.modal-open { overflow: hidden; overscroll-behavior: none; }
body.modal-open .bottom-nav { display: none; }
.modal-backdrop { z-index: 100; padding-bottom: calc(16px + var(--safe-bottom)); }
.modal-panel { max-height: calc(100dvh - 32px - var(--safe-bottom)); padding-bottom: calc(18px + var(--safe-bottom)); }


/* Clinical workbench v3 — premium, calm and high-clarity medical workspace. */
:root {
  --bg:#eef5f7; --surface:#ffffff; --surface-2:#f4f8fa; --surface-3:#e6f0f3;
  --ink:#102c3a; --muted:#64808d; --line:#dce8ed;
  --green:#087f83; --green-dark:#075c66; --green-soft:#e1f3f2; --lime:#b9eee0;
  --amber:#a86519; --amber-soft:#fff2df; --red:#b34b57; --red-soft:#fcebed;
  --shadow:0 12px 32px rgba(13,58,76,.075); --radius-xl:25px; --radius-lg:19px; --radius-md:14px;
}
html,body { background:var(--bg); color:var(--ink); }
body { background-image:radial-gradient(ellipse at 95% -7%,rgba(41,164,168,.10),transparent 34%),radial-gradient(ellipse at -9% 28%,rgba(68,135,183,.055),transparent 30%); }
.topbar { background:rgba(238,245,247,.88); border-bottom:1px solid rgba(220,232,237,.62); }
.brand-mark { background:linear-gradient(145deg,#0a727b,#19a1a1); box-shadow:0 7px 17px rgba(8,127,131,.24); border-radius:13px; }
.brand-name { letter-spacing:-.95px; color:#123745; }
.brand-caption { color:#6d8792; }
.top-status { border-color:#d8e7eb; box-shadow:0 3px 10px rgba(13,58,76,.035); }
.main-content { padding-top:12px; }
.home-hero { background:linear-gradient(118deg,#103c50 0%,#0b6570 55%,#149a99 100%); border:1px solid rgba(255,255,255,.12); box-shadow:0 18px 42px rgba(9,83,99,.18); }
.home-hero:after { border-color:rgba(217,255,247,.25); box-shadow:0 0 0 23px rgba(217,255,247,.055),0 0 0 52px rgba(217,255,247,.04); }
.home-hero:before { content:""; position:absolute; width:155px; height:155px; right:15px; bottom:-112px; background:rgba(117,237,219,.18); filter:blur(2px); border-radius:50%; }
.home-hero .eyebrow { color:#a9e0df; }
.home-hero h1 { font-weight:780; letter-spacing:-1.3px; }
.button-green { background:linear-gradient(135deg,#087f83,#0e9a9a); box-shadow:0 5px 14px rgba(8,127,131,.16); }
.button-soft { color:#07656b; background:#e3f3f2; }
.button-primary { color:#0d525c; background:#dff7ef; }
.nav-item.is-active { color:#087f83; }
.nav-item.is-active .nav-icon { background:#e0f3f1; box-shadow:inset 0 0 0 1px rgba(8,127,131,.06); }
.stat-card { border-color:#deeaee; box-shadow:0 5px 16px rgba(13,58,76,.035); }
.stat-value { color:#0e4b5b; }
.patient-avatar { background:linear-gradient(145deg,#dff2f2,#dcebf7); color:#0b6873; }
.pill.green { color:#08746f; background:#e1f5ee; }
.list-card,.profile-head,.settings-card { border-color:#e0eaee; box-shadow:0 5px 18px rgba(13,58,76,.035); }
.detail-fold { border-color:#dfe9ed; box-shadow:0 4px 14px rgba(13,58,76,.025); }
.detail-fold>summary { color:#173b49; }
.detail-fold>summary:after { color:#0b8990; }
.action-tile { border-color:#dbe8ed; background:linear-gradient(180deg,#fff,#f9fcfd); color:#234552; box-shadow:0 4px 12px rgba(13,58,76,.035); }
.tile-icon { background:#e1f3f2; color:#087f83; }
.clinic-fold { margin-top:13px; border:1px solid #cfe3e7; background:linear-gradient(180deg,#fafdfe,#f4fafb); }
.clinic-fold>summary { padding:15px; }
.clinic-summary-title { display:flex; align-items:center; gap:11px; min-width:0; }
.clinic-summary-title>span:last-child { display:grid; gap:3px; }
.clinic-summary-title strong { font-size:14px; color:#123b49; }
.clinic-summary-title small { color:#66838e; font-size:10px; font-weight:550; }
.clinic-summary-icon { display:grid; place-items:center; width:35px; height:35px; border-radius:12px; color:#087f83; background:#dff3ef; font-size:18px; }
.clinic-workbench { padding:0 12px 13px; }
.clinic-quick-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; margin:2px 0 17px; }
.clinic-quick-action { display:flex; align-items:center; gap:9px; min-height:58px; padding:10px; text-align:left; border:1px solid #dce9ed; border-radius:14px; color:#204451; background:#fff; box-shadow:0 3px 10px rgba(13,58,76,.025); }
.clinic-quick-action span { flex:0 0 29px; width:29px; height:29px; display:grid; place-items:center; border-radius:10px; color:#087f83; background:#e5f5f2; font-size:16px; font-weight:800; }
.clinic-quick-action strong { font-size:11px; line-height:1.3; font-weight:720; }
.clinic-quick-wide { grid-column:1/-1; }
.clinic-section-caption { display:grid; gap:3px; margin:7px 2px 8px; }
.clinic-section-caption span { font-size:13px; font-weight:800; color:#163c49; }
.clinic-section-caption small { color:var(--muted); font-size:10px; }
.clinic-category { border:1px solid #e1ebef; border-radius:14px; background:#fff; margin-top:7px; overflow:hidden; }
.clinic-category>summary { display:flex; align-items:center; justify-content:space-between; gap:10px; padding:12px 13px; color:#1b4350; font-size:12px; font-weight:780; cursor:pointer; list-style:none; }
.clinic-category>summary::-webkit-details-marker { display:none; }
.clinic-category>summary:after { content:"＋"; color:#09858a; font-size:16px; margin-left:auto; }
.clinic-category[open]>summary:after { content:"−"; }
.clinic-category .clinical-grid { padding:0 9px 10px; }
.clinical-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:7px; }
.catalog-card { min-width:0; display:grid; grid-template-columns:30px 1fr; grid-template-rows:auto auto; align-items:center; column-gap:8px; text-align:left; padding:10px; min-height:64px; border:1px solid #e0ebef; border-radius:12px; background:#f9fcfd; color:#204451; }
.catalog-mark { grid-row:1/3; width:29px; height:29px; display:grid; place-items:center; border-radius:9px; background:#e2f3f1; color:#087f83; font-size:15px; font-weight:800; }
.catalog-card>span:nth-child(2) { font-size:10px; font-weight:750; line-height:1.25; }
.catalog-card small { color:#718b95; font-size:9px; margin-top:3px; }
.patient-actions { margin-bottom:10px; }
.profile-head { background:linear-gradient(180deg,#fff,#f8fcfd); }
.page-heading h1 { color:#123846; }
.page-heading .eyebrow { color:#16878b; }
.bottom-nav { grid-template-columns:repeat(5,minmax(0,1fr)); background:rgba(250,253,254,.94); border-top-color:#dce8ed; box-shadow:0 -5px 24px rgba(17,54,69,.055); }
.nav-item { color:#77909a; font-size:9px; min-height:45px; }
.nav-icon { display:grid; place-items:center; min-width:31px; min-height:27px; border-radius:10px; font-size:18px; line-height:1; }
.nav-item.is-active .nav-icon { transform:none; }
.nav-item span:last-child i { color:inherit; font-style:normal; font-size:9px; }
.nav-dropdown { position:absolute; bottom:calc(67px + var(--safe-bottom)); left:50%; transform:translateX(-10%); width:min(310px,calc(100vw - 28px)); padding:7px; border:1px solid #dce8ed; border-radius:18px; background:rgba(255,255,255,.98); box-shadow:0 18px 48px rgba(10,48,64,.18); backdrop-filter:blur(18px); }
.nav-dropdown[hidden] { display:none !important; }
.nav-dropdown button { width:100%; display:grid; grid-template-columns:34px 1fr 12px; align-items:center; gap:10px; padding:11px 9px; border:0; border-radius:12px; background:transparent; color:#193e4c; text-align:left; }
.nav-dropdown button+button { border-top:1px solid #edf2f4; }
.nav-dropdown button:active { background:#f0f8f8; }
.nav-dropdown button>span:nth-child(2) { display:grid; gap:3px; }
.nav-dropdown strong { font-size:12px; }
.nav-dropdown small { font-size:9px; color:#718893; line-height:1.35; }
.dropdown-symbol { width:31px; height:31px; display:grid; place-items:center; border-radius:10px; background:#e3f4f1; color:#087f83; font-size:16px; }
.nav-dropdown b { color:#8aa1a8; }
.more-links { margin-top:15px; }
@media(max-width:360px){
  .clinic-quick-grid,.clinical-grid { grid-template-columns:1fr; }
  .clinic-quick-wide { grid-column:auto; }
  .nav-item { font-size:8px; }
  .nav-dropdown { left: auto; right:10px; transform:none; }
}
:root.tg-theme-dark .clinic-fold,:root:not(.tg-theme-light) .clinic-fold { background:linear-gradient(180deg,#162f3b,#172f3a); border-color:#2b4b58; }
:root.tg-theme-dark .clinic-summary-title strong,:root:not(.tg-theme-light) .clinic-summary-title strong { color:#e1f2f5; }
:root.tg-theme-dark .clinic-summary-title small,:root:not(.tg-theme-light) .clinic-summary-title small { color:#9ab4bf; }
:root.tg-theme-dark .clinic-quick-action,:root:not(.tg-theme-light) .clinic-quick-action,:root.tg-theme-dark .clinic-category,:root:not(.tg-theme-light) .clinic-category,:root.tg-theme-dark .nav-dropdown,:root:not(.tg-theme-light) .nav-dropdown { background:#203b48; border-color:#365765; color:#e0edf1; }
:root.tg-theme-dark .catalog-card,:root:not(.tg-theme-light) .catalog-card { background:#1b3541; border-color:#355461; color:#deedf1; }
:root.tg-theme-dark .nav-dropdown button,:root:not(.tg-theme-light) .nav-dropdown button { color:#e3eff3; }
:root.tg-theme-dark .nav-dropdown small,:root:not(.tg-theme-light) .nav-dropdown small { color:#9bb3bd; }

/* -------------------------------------------------------------------------
   Clinician workspace v4 — expressive, calm, high-contrast medical UI.
   Information remains the hero; effects are restrained and functional.
   ------------------------------------------------------------------------- */
:root {
  --bg:#edf4f7;
  --surface:#ffffff;
  --surface-2:#f4f8fb;
  --surface-3:#e7f1f5;
  --ink:#102e3c;
  --muted:#657f8d;
  --line:#d9e6ec;
  --green:#087f83;
  --green-dark:#075c66;
  --green-soft:#e1f4f1;
  --shadow:0 14px 36px rgba(11,49,66,.075);
}
html,body { font-family:Inter,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif; }
body {
  background-color:var(--bg);
  background-image:
    radial-gradient(ellipse at 92% 2%,rgba(30,167,166,.13),transparent 30%),
    radial-gradient(ellipse at 0% 34%,rgba(71,137,184,.08),transparent 28%);
}
.topbar {
  padding:13px 18px 10px;
  background:rgba(240,247,249,.91);
  border-bottom:1px solid rgba(210,228,234,.72);
  backdrop-filter:blur(22px) saturate(145%);
}
.brand-mark {
  position:relative;
  overflow:hidden;
  width:38px;height:38px;
  display:grid;place-items:center;
  border-radius:13px;
  background:linear-gradient(145deg,#0a596a,#0a9695 70%,#4bc2ac);
  box-shadow:0 8px 20px rgba(9,117,125,.24),inset 0 1px 0 rgba(255,255,255,.3);
}
.brand-mark:after { content:"✚"; position:absolute; color:#effffb; font-size:19px; font-weight:800; text-shadow:0 2px 8px rgba(0,0,0,.15); }
.brand-mark span { opacity:0; }
.brand-name { font-size:14px; font-weight:850; letter-spacing:-.65px; color:#123a48; }
.brand-caption { font-size:9px; letter-spacing:.055em; text-transform:uppercase; color:#708995; }
.top-status { background:rgba(255,255,255,.82); border:1px solid #d8e7eb; box-shadow:0 3px 12px rgba(15,62,77,.045); }
.main-content { padding:13px 16px 26px; }
.home-hero {
  min-height:188px;
  padding:25px 22px 21px;
  border-radius:27px;
  background:linear-gradient(118deg,#0b2d42 0%,#0d5365 53%,#07958f 100%);
  box-shadow:0 18px 44px rgba(8,66,85,.21),inset 0 1px 0 rgba(255,255,255,.12);
}
.home-hero:before {
  content:"";position:absolute;right:24px;bottom:-73px;width:190px;height:190px;border-radius:50%;
  background:radial-gradient(circle at 36% 30%,rgba(181,255,231,.34),rgba(91,222,198,.10) 44%,transparent 68%);
  filter:blur(1px);pointer-events:none;
}
.home-hero:after {
  width:230px;height:230px;right:-85px;top:-122px;
  border:1px solid rgba(218,255,249,.27);
  box-shadow:0 0 0 18px rgba(218,255,249,.065),0 0 0 42px rgba(218,255,249,.04),0 0 0 68px rgba(218,255,249,.025);
}
.home-hero .eyebrow { color:#9ee2dc; }
.home-hero h1 { max-width:88%;font-size:clamp(27px,7vw,34px);letter-spacing:-1.35px; }
.home-hero p { max-width:85%;color:#d2eceb;font-size:12px; }
.home-hero .button-primary {
  color:#064e58;background:linear-gradient(135deg,#f0fff8,#c9f5e6);
  box-shadow:0 7px 18px rgba(0,0,0,.12),inset 0 1px 0 rgba(255,255,255,.8);
}
.stats-grid { gap:9px;margin-top:13px; }
.stat-card {
  position:relative;overflow:hidden;min-height:104px;
  padding:13px 14px 12px;border:1px solid #dce8ed;border-radius:19px;
  background:linear-gradient(155deg,#fff 0%,#f8fcfd 100%);
  box-shadow:0 7px 20px rgba(11,57,73,.045);
}
.stat-card:before { content:"";position:absolute;left:0;top:14px;bottom:14px;width:3px;border-radius:0 3px 3px 0;background:linear-gradient(#0a9293,#a4e6d6); }
.stat-top { font-size:10px;font-weight:720; }
.stat-value { color:#0c5967;font-size:30px;line-height:1;letter-spacing:-1.3px;margin-top:11px;font-variant-numeric:tabular-nums; }
.section-head { margin:23px 2px 10px; }
.section-head h2 { font-size:16px;letter-spacing:-.45px;color:#143947; }
.list-card,.profile-head,.settings-card,.detail-fold {
  border-color:#dce8ed;box-shadow:0 6px 19px rgba(11,52,70,.04);
}
.list-card { border-radius:17px; }
.list-card-button { transition:transform .14s ease,border-color .14s ease,box-shadow .14s ease; }
.list-card-button:active { transform:scale(.99);border-color:#9bcacb; }
.profile-head {
  padding:18px;border-radius:23px;
  background:linear-gradient(150deg,#fff 0%,#f6fbfc 100%);
  box-shadow:0 10px 28px rgba(12,55,73,.06);
}
.profile-name { color:#123b49;font-size:21px;letter-spacing:-.7px; }
.profile-avatar { width:52px;height:52px;border-radius:17px;background:linear-gradient(145deg,#d8f2eb,#d9eaf5);box-shadow:inset 0 0 0 1px rgba(9,116,126,.07); }
.patient-actions { grid-template-columns:repeat(3,minmax(0,1fr));gap:9px;margin:13px 0 11px; }
.patient-actions .action-tile {
  min-height:78px;padding:12px 9px;border-radius:17px;
  background:linear-gradient(155deg,#fff,#f5fafb);border-color:#d8e7ec;
  box-shadow:0 5px 15px rgba(11,56,73,.04);
}
.patient-actions .action-tile .tile-icon { width:31px;height:31px;display:grid;place-items:center;border-radius:11px;background:linear-gradient(145deg,#e1f5f0,#e6f0fa);font-size:17px; }
.patient-actions .action-tile { font-size:10px;line-height:1.25; }
.clinic-fold {
  margin-top:12px;border:1px solid #c8e1e5;border-radius:21px;
  background:linear-gradient(150deg,#fbfefe 0%,#eff8f8 100%);
  box-shadow:0 10px 26px rgba(9,97,105,.07);overflow:hidden;
}
.clinic-fold>summary { padding:16px 15px; }
.clinic-fold>summary .pill { color:#08777b;background:#dcf3ee; }
.clinic-summary-icon { width:39px;height:39px;border-radius:13px;background:linear-gradient(145deg,#d7f5eb,#d6eef6);box-shadow:inset 0 0 0 1px rgba(8,127,131,.08); }
.clinic-summary-title strong { font-size:14px;letter-spacing:-.2px; }
.clinic-summary-title small { font-size:10px; }
.clinic-workbench { padding:0 13px 15px; }
.clinic-quick-grid { gap:8px;margin:3px 0 19px; }
.clinic-quick-action {
  min-height:62px;padding:11px 12px;border-radius:15px;
  background:linear-gradient(145deg,#fff,#f7fbfc);border-color:#dce9ed;
  box-shadow:0 4px 12px rgba(13,58,76,.035);
  transition:transform .14s ease,border-color .14s ease;
}
.clinic-quick-action:active { transform:scale(.985);border-color:#8ac7c5; }
.clinic-quick-action span { width:32px;height:32px;flex-basis:32px;border-radius:11px;background:linear-gradient(145deg,#daf4ec,#e0eff7); }
.clinic-quick-action strong { font-size:11px;letter-spacing:-.1px; }
.clinic-section-caption { margin:9px 3px 10px; }
.clinic-section-caption span { font-size:14px;letter-spacing:-.2px; }
.clinic-section-caption small { font-size:10px; }
.clinic-category { border-color:#dce9ed;border-radius:15px;box-shadow:0 3px 10px rgba(12,56,73,.025); }
.clinic-category>summary { min-height:46px;padding:12px 14px;font-size:12px; }
.clinical-grid { gap:8px; }
.catalog-card { min-height:69px;padding:11px;border-radius:13px;transition:transform .14s ease,border-color .14s ease,background .14s ease; }
.catalog-card:active { transform:scale(.985);background:#eff9f7;border-color:#8ac7c5; }
.catalog-card>span:nth-child(2) { font-size:10.5px; }
.detail-fold { border-radius:17px;background:rgba(255,255,255,.84); }
.detail-fold>summary { padding:14px 15px;font-size:12px; }
.page-heading { margin:6px 2px 16px; }
.page-heading h1 { color:#123b49;letter-spacing:-1px;font-size:27px; }
.page-heading .eyebrow { color:#07858a; }
.bottom-nav {
  min-height:68px;grid-template-columns:repeat(5,minmax(0,1fr));
  padding:8px 12px calc(8px + var(--safe-bottom));
  background:rgba(250,253,254,.94);border-top:1px solid rgba(210,228,234,.92);
  box-shadow:0 -10px 30px rgba(9,49,67,.075);backdrop-filter:blur(22px) saturate(150%);
}
.nav-item { position:relative;min-height:46px;gap:4px;font-size:9px;font-weight:760;color:#718995; }
.nav-icon { min-width:33px;min-height:28px;border-radius:11px;transition:background .14s ease,color .14s ease; }
.nav-item.is-active { color:#087f83; }
.nav-item.is-active:before { content:"";position:absolute;top:-8px;left:27%;right:27%;height:2px;border-radius:0 0 3px 3px;background:#0b9994; }
.nav-item.is-active .nav-icon { background:linear-gradient(145deg,#ddf6ef,#e4f1f8);color:#087f83;box-shadow:inset 0 0 0 1px rgba(8,127,131,.05); }
.nav-work-trigger[aria-expanded="true"] .nav-icon { background:#dff4ee;color:#087f83; }
.nav-dropdown {
  left:70%;transform:translateX(-70%);bottom:calc(76px + var(--safe-bottom));
  width:min(320px,calc(100vw - 24px));padding:8px;
  border:1px solid #d6e6eb;border-radius:20px;
  background:rgba(252,255,255,.97);box-shadow:0 22px 54px rgba(9,46,63,.2);
}
.nav-dropdown button { min-height:62px;padding:11px;border-radius:13px; }
.nav-dropdown strong { color:#173e4b;font-size:12px; }
.nav-dropdown small { color:#6d8791;font-size:9.5px; }
.survey-progress { gap:9px;margin:10px 2px 15px;font-size:11px;color:#52717f; }
.progress-track { height:6px;border-radius:99px;background:#dcebee;overflow:hidden; }
.progress-track i { display:block;height:100%;border-radius:inherit;background:linear-gradient(90deg,#0a777f,#27b49e);box-shadow:0 1px 5px rgba(8,127,131,.25); }
.survey-prompt { border-radius:22px;padding:20px 17px;border:1px solid #d8e8ed;background:linear-gradient(160deg,#fff,#f7fbfc);box-shadow:0 12px 30px rgba(12,54,72,.065); }
.survey-text { color:#173d4c;font-size:15px;line-height:1.58;font-weight:690; }
.survey-option { min-height:49px;border-radius:14px;border-color:#d2e5e9;background:linear-gradient(135deg,#f8fcfd,#edf7f7);color:#155c69;box-shadow:0 2px 7px rgba(12,65,78,.025); }
.survey-option:active { background:#e4f5f0;border-color:#8bcac0; }
.modal-backdrop { background:rgba(6,26,37,.48);backdrop-filter:blur(5px); }
.modal-panel { background:linear-gradient(155deg,#fbfefe,#f0f6f8);border:1px solid rgba(255,255,255,.72);box-shadow:0 28px 90px rgba(2,27,40,.32); }
.form-field input,.form-field select,.form-field textarea { border-color:#d6e5ea;background:#fff;border-radius:13px; }
.button-green { background:linear-gradient(135deg,#087c83,#0da095);box-shadow:0 6px 15px rgba(8,127,131,.18); }
.button-soft { background:linear-gradient(135deg,#e3f5ef,#e5f2f7);color:#07636b; }
.button-neutral { border:1px solid #e0eaee;background:#f5f9fa; }
button:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible { outline:2px solid #46aaa7;outline-offset:3px; }
@media(max-width:390px) {
  .main-content { padding-left:13px;padding-right:13px; }
  .home-hero { padding:22px 18px 19px; }
  .home-hero p { max-width:91%; }
  .stat-card { min-height:98px;padding:12px; }
  .patient-actions { gap:7px; }
  .patient-actions .action-tile { min-height:74px;padding:10px 6px; }
  .nav-item { font-size:8.5px; }
}
@media(max-width:350px) {
  .patient-actions { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .patient-actions .action-tile:last-child { grid-column:1/-1; }
  .nav-dropdown { left:auto;right:9px;transform:none; }
}
@media(prefers-color-scheme:dark) {
  :root:not(.tg-theme-light) .clinic-fold { background:linear-gradient(150deg,#172c35,#142831);border-color:#2b555e; }
  :root:not(.tg-theme-light) .clinic-quick-action,:root:not(.tg-theme-light) .clinic-category,:root:not(.tg-theme-light) .catalog-card { background:#1a303a;border-color:#304b55;color:#e0eff1; }
  :root:not(.tg-theme-light) .nav-dropdown { background:rgba(22,40,49,.97);border-color:#36515c; }
  :root:not(.tg-theme-light) .nav-dropdown strong { color:#e3f0f2; }
  :root:not(.tg-theme-light) .nav-dropdown small { color:#9bb1b9; }
  :root:not(.tg-theme-light) .survey-prompt { background:#1a303a;border-color:#304b55; }
  :root:not(.tg-theme-light) .survey-text { color:#e0eff1; }
}
:root.tg-theme-dark .clinic-fold { background:linear-gradient(150deg,#172c35,#142831);border-color:#2b555e; }
:root.tg-theme-dark .clinic-quick-action,:root.tg-theme-dark .clinic-category,:root.tg-theme-dark .catalog-card { background:#1a303a;border-color:#304b55;color:#e0eff1; }
:root.tg-theme-dark .nav-dropdown { background:rgba(22,40,49,.97);border-color:#36515c; }
:root.tg-theme-dark .nav-dropdown strong { color:#e3f0f2; }
:root.tg-theme-dark .nav-dropdown small { color:#9bb1b9; }
:root.tg-theme-dark .survey-prompt { background:#1a303a;border-color:#304b55; }
:root.tg-theme-dark .survey-text { color:#e0eff1; }


/* v5 contrast + viewport hardening. Telegram theme class is authoritative. */
*,*::before,*::after{box-sizing:border-box}
html,body{width:100%;max-width:100%;overflow-x:hidden}
.app-shell{width:100%;max-width:760px;margin-inline:auto;overflow-x:clip}
.main-content,#app{width:100%;max-width:100%;min-width:0}
#app *{min-width:0;overflow-wrap:anywhere}
button,input,select,textarea{max-width:100%;font-family:inherit}
.page-heading{flex-wrap:wrap;min-width:0}
.page-heading>div{min-width:0;flex:1 1 180px}
.data-row{min-width:0;flex-wrap:wrap}
.data-value{max-width:min(64%,100%);overflow-wrap:anywhere}
.card-row,.profile-mini-card,.settings-card-head{min-width:0}
.home-hero-topline{position:relative;z-index:1;display:flex;align-items:center;justify-content:space-between;gap:12px;min-height:40px}
.home-hero-topline .eyebrow{margin:0}
.user-avatar{position:relative;display:grid;place-items:center;overflow:hidden;flex:0 0 auto;border-radius:50%;background:linear-gradient(145deg,#c9eee8,#dbeefa);color:#075f69;font-weight:850;box-shadow:inset 0 0 0 1px rgba(6,99,110,.12)}
.user-avatar span{position:relative;z-index:0}
.user-avatar img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;border-radius:inherit;z-index:1}
.user-avatar-home{width:48px;height:48px;border:2px solid rgba(255,255,255,.72);font-size:15px;box-shadow:0 5px 18px rgba(0,0,0,.16)}
.user-avatar-profile{width:62px;height:62px;font-size:19px}
.profile-user-card{display:flex;align-items:center;gap:14px;padding:16px;border:1px solid var(--line);border-radius:20px;background:var(--surface);box-shadow:var(--shadow);margin:4px 0 13px}
.profile-avatar-note{display:block;color:var(--muted);font-size:10px;margin-top:4px;line-height:1.35}
.overview-grid{display:grid;grid-template-columns:1fr;gap:12px;margin-top:7px}
.overview-card{display:flex;align-items:center;gap:13px;width:100%;min-height:92px;padding:16px;border:1px solid var(--line);border-radius:19px;background:linear-gradient(145deg,var(--surface),var(--surface-2));color:var(--ink);text-align:left;box-shadow:var(--shadow);transition:transform .14s ease,border-color .14s ease}
.overview-card:active{transform:scale(.99);border-color:var(--accent)}
.overview-card-icon{display:grid;place-items:center;width:44px;height:44px;flex:0 0 44px;border-radius:15px;background:var(--green-soft);color:var(--green);font-size:23px}
.overview-card-copy{display:grid;gap:5px;min-width:0;flex:1}
.overview-card-copy strong{color:var(--ink);font-size:14px;line-height:1.3}
.overview-card-copy small{color:var(--muted);font-size:11px;line-height:1.4}
.overview-card-arrow{color:var(--muted);font-size:24px}
.report-section{margin-top:20px;padding:14px;border:1px solid var(--line);border-radius:19px;background:var(--surface);box-shadow:var(--shadow);min-width:0}
.report-section-head{display:flex;align-items:center;gap:10px;min-width:0;margin-bottom:11px}
.report-section-head>span:nth-child(2){display:grid;gap:3px;min-width:0;flex:1}
.report-section-head strong{color:var(--ink);font-size:13px}
.report-section-head small{color:var(--muted);font-size:10px;line-height:1.35}
.report-section-head>b{display:grid;place-items:center;min-width:30px;height:30px;padding:0 8px;border-radius:11px;background:var(--green-soft);color:var(--green-dark);font-size:12px}
.report-section-icon{display:grid;place-items:center;width:34px;height:34px;flex:0 0 34px;border-radius:11px;background:var(--surface-2);color:var(--green);font-size:17px}
.report-fold-list{display:grid;gap:8px}
.report-fold{border:1px solid var(--line);border-radius:14px;background:var(--surface);overflow:hidden;color:var(--ink)}
.report-fold>summary{display:flex;align-items:center;justify-content:space-between;gap:10px;min-height:57px;padding:11px 13px;cursor:pointer;list-style:none;color:var(--ink)}
.report-fold>summary::-webkit-details-marker{display:none}
.report-fold>summary:after{content:"⌄";margin-left:4px;color:var(--muted);font-size:17px;transition:transform .16s ease}
.report-fold[open]>summary:after{transform:rotate(180deg)}
.report-fold-label{display:grid;gap:3px;min-width:0;flex:1}
.report-fold-label strong{color:var(--ink);font-size:12px;line-height:1.3}
.report-fold-label small{color:var(--muted);font-size:10px;line-height:1.3}
.report-fold-content{display:grid;gap:8px;padding:0 10px 10px}
.report-stats .stat-card{min-width:0}
.report-stats .stat-card strong{display:block;color:var(--ink);font-size:26px;line-height:1.1}
.report-stats .stat-card span{display:block;margin-top:5px;color:var(--muted);font-size:10px;line-height:1.3}
/* Light theme: every surface has dark readable copy, including WebView defaults. */
:root:not(.tg-theme-dark){color-scheme:light;--bg:#f2f7fa;--surface:#fff;--surface-2:#eaf2f6;--surface-3:#dceaf1;--ink:#183342;--muted:#607985;--line:#d6e4ea;--green:#147f91;--green-dark:#105c70;--green-soft:#e1f1f4}
:root:not(.tg-theme-dark) body,:root:not(.tg-theme-dark) #app{color:#183342}
:root:not(.tg-theme-dark) .list-card,:root:not(.tg-theme-dark) .stat-card,:root:not(.tg-theme-dark) .detail-fold,:root:not(.tg-theme-dark) .settings-card,:root:not(.tg-theme-dark) .profile-head,:root:not(.tg-theme-dark) .profile-mini-card,:root:not(.tg-theme-dark) .report-section,:root:not(.tg-theme-dark) .report-fold{color:#183342}
:root:not(.tg-theme-dark) .card-title,:root:not(.tg-theme-dark) .data-value,:root:not(.tg-theme-dark) .detail-fold>summary,:root:not(.tg-theme-dark) .report-fold>summary,:root:not(.tg-theme-dark) .overview-card-copy strong{color:#183342}
:root:not(.tg-theme-dark) .catalog-card,:root:not(.tg-theme-dark) .clinic-quick-action{color:#183342}
:root:not(.tg-theme-dark) .form-field input,:root:not(.tg-theme-dark) .form-field select,:root:not(.tg-theme-dark) .form-field textarea,:root:not(.tg-theme-dark) .search-wrap input{background:#fff;color:#183342}
/* Dark theme: avoid light cards with pale/white text and preserve contrast. */
:root.tg-theme-dark{color-scheme:dark;--bg:#111e25;--surface:#1a2b34;--surface-2:#243a44;--surface-3:#2d4651;--ink:#eaf4f7;--muted:#a8bdc5;--line:#304a55;--green:#63bdc4;--green-dark:#b7e4e7;--green-soft:#203e46;--accent:#63bdc4}
:root.tg-theme-dark body,:root.tg-theme-dark #app{background:var(--bg);color:var(--ink)}
:root.tg-theme-dark .list-card,:root.tg-theme-dark .stat-card,:root.tg-theme-dark .detail-fold,:root.tg-theme-dark .settings-card,:root.tg-theme-dark .profile-head,:root.tg-theme-dark .profile-mini-card,:root.tg-theme-dark .report-section,:root.tg-theme-dark .report-fold,:root.tg-theme-dark .overview-card{background:#1a2b34;border-color:#304a55;color:#eaf4f7}
:root.tg-theme-dark .stat-card:before{background:linear-gradient(#299b9f,#63bdc4)}
:root.tg-theme-dark .card-title,:root.tg-theme-dark .data-value,:root.tg-theme-dark h1,:root.tg-theme-dark h2,:root.tg-theme-dark h3,:root.tg-theme-dark .detail-fold>summary,:root.tg-theme-dark .report-fold>summary,:root.tg-theme-dark .overview-card-copy strong,:root.tg-theme-dark .report-section-head strong{color:#eaf4f7}
:root.tg-theme-dark .report-fold-label small,:root.tg-theme-dark .report-section-head small,:root.tg-theme-dark .overview-card-copy small{color:#a8bdc5}
:root.tg-theme-dark .catalog-card,:root.tg-theme-dark .clinic-quick-action,:root.tg-theme-dark .survey-option{background:#203740;border-color:#345966;color:#d9f0f2}
:root.tg-theme-dark .form-field input,:root.tg-theme-dark .form-field select,:root.tg-theme-dark .form-field textarea,:root.tg-theme-dark .search-wrap input{background:#1a2b34;color:#eaf4f7;border-color:#3b5863}
:root.tg-theme-dark .modal-panel{background:#172831;color:#eaf4f7;border-color:#304a55}
:root.tg-theme-dark .user-avatar{background:linear-gradient(145deg,#274d57,#27415a);color:#e1f3f4}
@media(max-width:360px){.home-hero h1{max-width:100%;font-size:25px}.report-section{padding:11px}.report-fold>summary{padding:10px}.user-avatar-home{width:42px;height:42px}}


/* Clinical UX v6 — final contrast and compact-layout guardrails. */
:root:not(.tg-theme-dark) .button-light { background:#165b6b;color:#fff;border-color:#165b6b; }
:root:not(.tg-theme-dark) .topbar { color:#123846; }
:root:not(.tg-theme-dark) .notify-group>summary,
:root:not(.tg-theme-dark) .notify-overrides>summary,
:root:not(.tg-theme-dark) .clinic-category>summary,
:root:not(.tg-theme-dark) .setting-toggle,
:root:not(.tg-theme-dark) .summary-time-copy strong { color:#183342; }
:root:not(.tg-theme-dark) .settings-tab { color:#526d79; }
:root:not(.tg-theme-dark) .settings-tab.active { color:#075c66;background:#fff; }
:root:not(.tg-theme-dark) .status-option { color:#355461; }
:root:not(.tg-theme-dark) .status-option.selected { color:#075c66; }
:root:not(.tg-theme-dark) .day-picker span { color:#355461;background:#eef5f7; }
:root:not(.tg-theme-dark) .survey-prompt { color:#173d4c;background:linear-gradient(160deg,#fff,#f3f9fb);border-color:#d6e5ea; }
:root:not(.tg-theme-dark) .survey-text { color:#173d4c; }
:root:not(.tg-theme-dark) .empty-state { color:#183342; }
:root:not(.tg-theme-dark) .empty-title { color:#183342; }
:root:not(.tg-theme-dark) .empty-text { color:#607985; }
:root:not(.tg-theme-dark) .report-fold-content .list-card { color:#183342;background:#fff; }
:root:not(.tg-theme-dark) .report-fold-content .card-title { color:#183342; }
:root.tg-theme-dark .button-green { background:linear-gradient(135deg,#0b6473,#087e83);color:#fff;box-shadow:0 6px 15px rgba(0,0,0,.2); }
:root.tg-theme-dark .button-primary { color:#073e49;background:#c9f2e7; }
:root.tg-theme-dark .button-light { color:#eaf4f7;background:#294b57;border-color:#41616d; }
:root.tg-theme-dark .settings-tabs { background:#203740;border-color:#38545f; }
:root.tg-theme-dark .settings-tab { color:#b6cbd1; }
:root.tg-theme-dark .settings-tab.active { color:#eaf4f7;background:#31515c; }
:root.tg-theme-dark .settings-savebar>span { color:#a8bdc5; }
:root.tg-theme-dark .notify-group,
:root.tg-theme-dark .notify-step,
:root.tg-theme-dark .notify-overrides { background:#1a2b34;border-color:#304a55;color:#eaf4f7; }
:root.tg-theme-dark .notify-group>summary,
:root.tg-theme-dark .notify-overrides>summary,
:root.tg-theme-dark .clinic-category>summary,
:root.tg-theme-dark .setting-toggle,
:root.tg-theme-dark .summary-time-copy strong { color:#eaf4f7; }
:root.tg-theme-dark .summary-time-row input,
:root.tg-theme-dark .settings-card select,
:root.tg-theme-dark .settings-card input { background:#1a2b34;color:#eaf4f7;border-color:#3b5863; }
:root.tg-theme-dark .day-picker span { color:#d7e9ed;background:#263f49; }
:root.tg-theme-dark .survey-prompt { color:#eaf4f7;background:#1a2b34;border-color:#304a55; }
:root.tg-theme-dark .survey-text { color:#eaf4f7; }
:root.tg-theme-dark .empty-state { color:#eaf4f7;background:#1a2b34;border-color:#38545f; }
:root.tg-theme-dark .empty-title { color:#eaf4f7; }
:root.tg-theme-dark .empty-text { color:#a8bdc5; }
:root.tg-theme-dark .report-fold-content .list-card { color:#eaf4f7;background:#203740; }
:root.tg-theme-dark .report-fold-content .card-title { color:#eaf4f7; }

/* Controls shrink into rows instead of forcing the viewport wider. */
.summary-time-row { grid-template-columns:minmax(0,1fr) minmax(68px,86px) auto auto; }
.summary-time-copy { grid-column:1/-1; }
.summary-time-row input { grid-column:auto; width:100%; }
.summary-time-row .button { min-width:0;padding-inline:7px;white-space:nowrap; }
.notify-group-actions .button { max-width:100%;white-space:normal; }
.notify-step .inline-actions { flex-wrap:wrap;min-width:0; }
.report-section-head,.report-fold>summary,.overview-card,.profile-user-card { min-width:0; }
.report-fold-label { overflow-wrap:anywhere; }
.report-fold-content .list-card { width:100%;min-width:0; }
@media(max-width:390px) {
  .main-content { padding-left:12px;padding-right:12px; }
  .summary-time-row { grid-template-columns:minmax(0,1fr) minmax(70px,1fr); }
  .summary-time-row input { grid-column:1; }
  .summary-time-row .button { grid-row:auto; }
  .settings-tabs { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .settings-tab { min-width:0;padding:9px 5px;font-size:10px; }
  .page-heading h1 { font-size:25px; }
  .profile-user-card { flex-wrap:wrap; }
  .report-section { padding:11px; }
}
@media(max-width:340px) {
  .bottom-nav { padding-inline:5px; }
  .nav-item { font-size:7.5px; }
  .nav-icon { min-width:28px; }
  .summary-time-row { grid-template-columns:minmax(0,1fr) 84px; }
  .summary-time-row .button { font-size:9px;padding-inline:5px; }
  .action-grid.patient-actions { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .action-grid.patient-actions .action-tile:last-child { grid-column:1/-1; }
}

/* v6.1 mobile legibility: enforce dark text on pale surfaces and safe wrapping. */
:root.tg-theme-dark .button-neutral,
:root.tg-theme-dark .button-soft,
:root.tg-theme-dark .action-tile,
:root.tg-theme-dark .clinic-quick-action,
:root.tg-theme-dark .nav-dropdown button,
:root.tg-theme-dark .settings-tab.active,
:root.tg-theme-dark .status-option.selected {
  color:#123e4b !important;
}
:root.tg-theme-dark .button-neutral { background:#e8f2f5;border-color:#d0e3e9; }
:root.tg-theme-dark .button-soft { background:#d9f0ec;border-color:#c4e5df; }
:root.tg-theme-dark .action-tile { background:linear-gradient(155deg,#e9f3f6,#dcebf1);border-color:#c5dce4; }
:root.tg-theme-dark .clinic-quick-action { background:#e5f1f4;border-color:#c8dfe6; }
.button,.action-tile,.clinic-quick-action,.inline-actions,.hero-actions,.form-actions { min-width:0;max-width:100%; }
.button { white-space:normal;text-align:center;line-height:1.25;overflow-wrap:anywhere; }
.inline-actions .button { flex:1 1 145px; }
.action-tile { line-height:1.25;overflow-wrap:anywhere;word-break:normal; }
.action-tile .tile-label,.action-tile span:last-child { max-width:100%;white-space:normal;overflow-wrap:anywhere;text-align:center; }
.profile-head,.profile-title-row,.card-row,.card-main,.modal-panel,.modal-body,.form-actions { min-width:0;max-width:100%; }
.profile-name,.card-title,.profile-meta,.card-meta { overflow-wrap:anywhere;word-break:normal; }
.form-actions .button { min-width:0;white-space:normal; }
@media(max-width:390px){
  .inline-actions .button { flex-basis:100%; }
  .action-grid.patient-actions { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .action-grid.patient-actions .action-tile:last-child { grid-column:1/-1; }
  .action-tile { padding:11px 8px; font-size:11px; }
  .button-small { font-size:12px;padding:10px 12px; }
}

/* Clinical UX v7 — quiet medical dark surfaces, readable task cards, compact actions. */
:root.tg-theme-dark .button-neutral,
:root.tg-theme-dark .button-soft,
:root.tg-theme-dark .button-light,
:root.tg-theme-dark .action-tile,
:root.tg-theme-dark .clinic-quick-action,
:root.tg-theme-dark .catalog-card,
:root.tg-theme-dark .survey-option,
:root.tg-theme-dark .settings-tab.active,
:root.tg-theme-dark .status-option.selected {
  color:#e5f3f5 !important;
  background:#24434e !important;
  border-color:#3c6470 !important;
  box-shadow:0 3px 12px rgba(0,0,0,.14);
}
:root.tg-theme-dark .button-primary,
:root.tg-theme-dark .button-green {
  color:#f2fbfb !important;
  background:linear-gradient(135deg,#087b82,#12636f) !important;
  border-color:#25858b !important;
}
:root.tg-theme-dark .button-danger,
:root.tg-theme-dark .reminder-action-danger { background:#4b3038 !important;color:#ffdfe2 !important;border-color:#75464f !important; }
:root.tg-theme-dark .clinic-fold,
:root.tg-theme-dark .detail-fold,
:root.tg-theme-dark .list-card,
:root.tg-theme-dark .report-section,
:root.tg-theme-dark .digest-task-card,
:root.tg-theme-dark .digest-progress-card { background:#192f39;border-color:#31515d;color:#e6f2f4; }
:root.tg-theme-dark .detail-fold>summary,
:root.tg-theme-dark .clinic-quick-action strong,
:root.tg-theme-dark .catalog-card span,
:root.tg-theme-dark .card-title,
:root.tg-theme-dark .digest-task-card h2 { color:#e6f2f4; }
:root.tg-theme-dark .card-meta,
:root.tg-theme-dark .digest-task-meta { color:#a9c0c7; }
:root.tg-theme-light .button-neutral,
:root.tg-theme-light .button-soft,
:root.tg-theme-light .button-light { color:#164553;background:#e8f2f5;border-color:#d0e2e8; }

.button,.clinic-quick-action,.catalog-card,.action-tile {
  overflow-wrap:normal !important;
  word-break:normal !important;
  hyphens:none;
}
.button { white-space:normal; line-height:1.22; }
.clinic-quick-action strong,.catalog-card>span:not(.catalog-mark),.action-tile { overflow-wrap:normal;word-break:normal; }
.clinic-quick-action { min-height:76px; padding:13px 12px; }
.clinic-quick-action strong { font-size:13px; line-height:1.22; text-align:left; }
.catalog-card { min-width:0; }
.catalog-card>span:not(.catalog-mark) { line-height:1.25; }

.reminder-card { display:flex;flex-direction:column;gap:12px;min-width:0;padding:15px;background:var(--surface);border:1px solid var(--line);border-radius:19px;box-shadow:0 5px 18px rgba(16,55,68,.045); }
.reminder-head { display:grid;grid-template-columns:36px minmax(0,1fr);gap:11px;align-items:start;min-width:0; }
.reminder-icon { width:36px;height:36px;border-radius:12px;display:grid;place-items:center;background:var(--surface-2);color:var(--green);font-size:18px; }
.reminder-copy { min-width:0;width:100%; }
.reminder-copy .card-title { font-size:14px;line-height:1.36;overflow-wrap:break-word;word-break:normal; }
.reminder-copy .card-meta { font-size:11px;margin-top:6px; }
.reminder-footer { display:flex;flex-direction:column;gap:10px;min-width:0; }
.reminder-actions { display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;width:100%;min-width:0; }
.reminder-action { min-width:0;max-width:100%;min-height:40px;padding:9px 10px;border:1px solid #bddbdc;border-radius:12px;background:#e2f2f0;color:#125b66;font-size:12px;font-weight:750;line-height:1.2;text-align:center;white-space:normal;overflow-wrap:break-word;word-break:normal; }
.reminder-actions > :only-child,.reminder-actions > :last-child:nth-child(odd) { grid-column:1/-1; }
.reminder-action { display:flex;align-items:center;justify-content:center; }
.reminder-action-muted { background:var(--surface-2);border-color:var(--line);color:var(--ink); }
.reminder-action-danger { background:#faecec;border-color:#f0d0d2;color:#8f3f48; }
:root.tg-theme-dark .reminder-action { background:#244b56;border-color:#3d6974;color:#e5f5f5; }
:root.tg-theme-dark .reminder-action-muted { background:#243b45;border-color:#3b5964;color:#d7e8eb; }
:root.tg-theme-dark .reminder-action-danger { background:#4b3038;border-color:#75464f;color:#ffdfe2; }
.reminder-card-compact { padding:12px 14px;gap:5px; }
.reminder-card-compact .reminder-head { grid-template-columns:28px minmax(0,1fr);gap:9px; }
.reminder-card-compact .reminder-icon { width:28px;height:28px;font-size:15px; }
.reminder-card-compact .reminder-copy .card-title { font-size:12px; }
.reminder-card-compact .reminder-footer { display:flex;flex-direction:row;justify-content:flex-end; }
.digest-entry { width:100%;display:grid;grid-template-columns:42px minmax(0,1fr) auto;gap:12px;align-items:center;padding:14px;margin:4px 0 16px;border:1px solid #2d858b;border-radius:18px;background:linear-gradient(120deg,#174d59,#1d6670);color:#effafa;text-align:left; }
.digest-entry-icon { display:grid;place-items:center;width:40px;height:40px;border-radius:13px;background:rgba(223,250,245,.14);font-size:22px; }
.digest-entry strong,.digest-entry small { display:block; }
.digest-entry strong { font-size:14px; }
.digest-entry small { margin-top:3px;font-size:11px;color:#c1dfe2; }
.digest-entry b { font-size:23px; }
.digest-progress-card { padding:16px;border:1px solid var(--line);border-radius:17px;background:var(--surface);margin-bottom:12px; }
.digest-progress-top { display:flex;justify-content:space-between;gap:12px;margin-bottom:10px;font-size:13px;color:var(--ink); }
.digest-progress-card .progress-track { height:7px;border-radius:20px;background:var(--surface-2);overflow:hidden; }
.digest-progress-card .progress-track i { display:block;height:100%;border-radius:20px;background:linear-gradient(90deg,#13878c,#56b8ad); }
.digest-task-card { padding:19px;border:1px solid var(--line);border-radius:21px;background:var(--surface);box-shadow:var(--shadow); }
.digest-task-kicker { font-size:10px;letter-spacing:.12em;font-weight:850;color:var(--green);margin-bottom:12px; }
.digest-task-card h2 { margin:0;color:var(--ink);font-size:18px;line-height:1.38;overflow-wrap:break-word; }
.digest-task-meta { margin:10px 0 15px;color:var(--muted);font-size:12px;line-height:1.4; }
.digest-task-actions { margin:12px 0; }
.digest-controls { display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:9px;margin-top:14px; }
.digest-secondary-controls { display:flex;justify-content:space-between;gap:12px;flex-wrap:wrap;margin-top:14px;padding:0 3px; }
.danger-link { color:var(--red) !important; }
@media(max-width:370px){
  .reminder-actions { grid-template-columns:minmax(0,1fr); }
  .reminder-action { min-height:38px; }
  .digest-controls { grid-template-columns:1fr; }
  .clinic-quick-action strong { font-size:12px; }
}
.action-tile span:last-child { overflow-wrap:normal !important;word-break:normal !important;hyphens:none; }
.clinic-quick-action strong { word-break:normal;overflow-wrap:normal;hyphens:none; }
.reminder-card .button,.reminder-card .reminder-action { white-space:normal; }


/* Clinical UX v8 — semantic contrast tokens, task deep-links and subtle medical artwork. */
:root {
  --text-primary: var(--ink);
  --text-secondary: var(--muted);
  --text-accent: var(--green);
  --surface-border: var(--line);
}
:root.tg-theme-dark {
  --text-primary:#eaf5f7;
  --text-secondary:#aec2c9;
  --text-accent:#73d2d1;
  --surface-border:#35525e;
}
:root.tg-theme-light {
  --text-primary:#173b49;
  --text-secondary:#607985;
  --text-accent:#087f83;
  --surface-border:#d6e4ea;
}
/* Headings and captions that previously kept a light-theme hard-coded ink color. */
:root.tg-theme-dark .clinic-section-caption,
:root.tg-theme-dark .clinic-section-caption span,
:root.tg-theme-dark .clinical-intro,
:root.tg-theme-dark .clinical-intro strong,
:root.tg-theme-dark .clinical-intro span,
:root.tg-theme-dark .clinic-workbench,
:root.tg-theme-dark .clinic-workbench h2,
:root.tg-theme-dark .clinic-workbench h3,
:root.tg-theme-dark .data-section-title,
:root.tg-theme-dark .data-section-title h3,
:root.tg-theme-dark .section-head h2,
:root.tg-theme-dark .page-heading h1,
:root.tg-theme-dark .page-heading .eyebrow,
:root.tg-theme-dark .page-subtitle {
  color:var(--text-primary) !important;
}
:root.tg-theme-dark .clinic-section-caption small,
:root.tg-theme-dark .clinical-intro small,
:root.tg-theme-dark .data-section .card-meta,
:root.tg-theme-dark .data-label,
:root.tg-theme-dark .card-meta,
:root.tg-theme-dark .stat-note,
:root.tg-theme-dark .stat-top,
:root.tg-theme-dark .page-subtitle {
  color:var(--text-secondary) !important;
}
:root.tg-theme-dark .clinic-section-caption span { color:#eaf5f7 !important;font-size:14px;letter-spacing:-.2px; }
:root.tg-theme-dark .stat-value { color:#62d0d0 !important;text-shadow:0 0 18px rgba(73,205,200,.10); }
:root.tg-theme-dark .clinic-category>summary { color:#eaf5f7 !important; }
:root.tg-theme-dark .clinic-category>summary .pill { color:#b9d0d5;background:#29434e; }
:root.tg-theme-light .clinic-section-caption span { color:#173b49 !important; }

/* Clickable home task cards: entire card is an accessible, high-contrast target. */
.reminder-card-open { width:100%;display:flex;flex-direction:column;text-align:left;cursor:pointer;color:var(--ink);font:inherit; }
.reminder-card-open:active { transform:scale(.992);border-color:var(--green); }
.reminder-card-open .reminder-footer { flex-direction:row;align-items:center;justify-content:space-between;gap:12px; }
.reminder-open-hint { display:inline-block;margin-left:10px;color:var(--green);font-size:11px;font-weight:800;white-space:nowrap; }
.reminder-focus { border-color:#63c6c4 !important;box-shadow:0 0 0 3px rgba(99,198,196,.2),0 12px 30px rgba(0,0,0,.12) !important;animation:taskFocusPulse 1.3s ease-in-out 1;scroll-margin-top:76px; }
@keyframes taskFocusPulse { 0%,100%{transform:scale(1)} 40%{transform:scale(1.012)} }
:root.tg-theme-dark .reminder-card-open { background:#1a303a;border-color:#355461;color:#eaf5f7; }
:root.tg-theme-dark .reminder-open-hint { color:#7bd9d3; }
:root.tg-theme-dark .reminder-card-open .reminder-icon { background:#28434d;color:#8bdeda; }

/* Subtle 3D-inspired SVG: glass medical instrument, orbit and ambient glow. */
.home-hero { isolation:isolate; }
.home-hero>*:not(.hero-art) { position:relative;z-index:2; }
.hero-art { position:absolute;z-index:0;right:-3px;top:37px;width:min(48%,210px);aspect-ratio:1;pointer-events:none;opacity:.38;filter:drop-shadow(0 18px 24px rgba(0,0,0,.16)); }
.hero-art svg { display:block;width:100%;height:100%;overflow:visible; }
.hero-core { transform-origin:124px 120px;animation:heroFloat 7s ease-in-out infinite; }
.hero-orbit { transform-origin:125px 120px;animation:heroOrbit 25s linear infinite; }
@keyframes heroFloat { 0%,100%{transform:translateY(0) rotate(-2deg)} 50%{transform:translateY(-8px) rotate(2deg)} }
@keyframes heroOrbit { to{transform:rotate(396deg)} }
@media(max-width:390px){.hero-art{right:-23px;top:54px;width:45%;opacity:.34}.home-hero h1,.home-hero p{max-width:90%;}}
@media(prefers-reduced-motion:reduce){.hero-core,.hero-orbit,.reminder-focus{animation:none !important}.reminder-card-open:active{transform:none}}


/* Clinical UX v9 — stable discharge checklist alignment on narrow WebViews. */
.discharge-checklist {
  display:block;
  width:100%;
  max-width:100%;
  min-width:0;
  overflow:hidden;
  box-sizing:border-box;
}
.discharge-check-row {
  display:grid;
  grid-template-columns:minmax(0, 1fr) minmax(124px, 42%);
  align-items:center;
  gap:12px;
  width:100%;
  min-width:0;
  margin:0;
  padding:11px 0;
  box-sizing:border-box;
  border-bottom:1px solid var(--line);
}
.discharge-check-row:last-of-type { border-bottom:0; }
.discharge-check-label {
  display:block;
  min-width:0;
  max-width:100%;
  color:var(--ink);
  line-height:1.35;
  overflow-wrap:anywhere;
  word-break:normal;
}
.discharge-check-select {
  display:block;
  justify-self:stretch;
  width:100%;
  min-width:0;
  max-width:100%;
  margin:0;
  padding:9px 26px 9px 10px;
  box-sizing:border-box;
  border:1px solid var(--line);
  border-radius:11px;
  background:var(--surface-2, var(--surface));
  color:var(--ink);
  font:inherit;
  font-size:13px;
  line-height:1.25;
  text-overflow:ellipsis;
}
.discharge-check-save { width:100%;max-width:100%;min-width:0;white-space:normal; }
:root.tg-theme-dark { color-scheme:dark; }
:root.tg-theme-light { color-scheme:light; }
@media (max-width:380px) {
  .discharge-check-row { grid-template-columns:minmax(0,1fr) minmax(112px,43%);gap:8px;padding:10px 0; }
  .discharge-check-label { font-size:13px; }
  .discharge-check-select { padding:8px 22px 8px 8px;font-size:12px; }
}
@media (max-width:340px) {
  .discharge-check-row { grid-template-columns:minmax(0,1fr) minmax(108px,44%);gap:7px; }
}

/* Clinical UX v10 — deliberate spacing, grouped digest controls and restrained motion. */
.survey-options {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  margin-top: 16px;
}
.survey-options .survey-option {
  display: flex;
  align-items: center;
  min-width: 0;
  width: 100%;
  margin: 0;
}
.survey-option-skip {
  justify-content: center;
  margin-top: 5px !important;
  border-style: dashed;
  background: var(--surface-2) !important;
  color: var(--muted) !important;
  box-shadow: none !important;
}
.survey-option-skip:active {
  color: var(--ink) !important;
  border-style: solid;
}
.survey-prompt {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 0;
}
.survey-prompt .survey-input,
.survey-prompt .survey-complete { margin-top: 17px; }
.survey-patient-note { margin-top: 12px; }

.digest-management {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.digest-management .digest-controls { margin: 0; gap: 10px; }
.digest-management .digest-controls .button { min-width: 0; min-height: 48px; padding: 12px 10px; white-space: normal; }
.digest-next-hint {
  margin: 0;
  padding: 0 2px 2px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}
.digest-bulk-action {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 7px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.digest-bulk-action .button { min-height: 46px; }
.digest-bulk-action small {
  display: block;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
  text-align: center;
}
.digest-management .button-danger {
  color: var(--red);
  background: var(--red-soft);
  border: 1px solid rgba(182,77,82,.24);
}
:root.tg-theme-dark .digest-management {
  background: #192f39;
  border-color: #31515d;
}
:root.tg-theme-dark .digest-management .button-neutral {
  color: #e2f0f3;
  background: #263f49;
  border: 1px solid #3b5964;
}
:root.tg-theme-dark .digest-management .button-primary {
  color: #073e49;
  background: #c9f2e7;
}
:root.tg-theme-dark .digest-management .button-danger {
  color: #ffdfe2;
  background: #4b3038;
  border-color: #75464f;
}

@keyframes surveyStepEnter {
  from { opacity: 0; transform: translateY(13px) scale(.992); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes surveyOptionEnter {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes digestTaskEnter {
  from { opacity: 0; transform: translateY(15px) scale(.99); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes digestProgressFill {
  from { transform: scaleX(.35); transform-origin: left center; }
  to { transform: scaleX(1); transform-origin: left center; }
}
.survey-enter { animation: surveyStepEnter .34s cubic-bezier(.2,.72,.24,1) both; }
.survey-options .survey-option { animation: surveyOptionEnter .3s cubic-bezier(.2,.72,.24,1) both; }
.survey-options .survey-option:nth-child(2) { animation-delay: .045s; }
.survey-options .survey-option:nth-child(3) { animation-delay: .09s; }
.survey-options .survey-option:nth-child(4) { animation-delay: .135s; }
.survey-options .survey-option:nth-child(5) { animation-delay: .18s; }
.digest-enter { animation: digestTaskEnter .34s cubic-bezier(.2,.72,.24,1) both; }
.digest-task-card.digest-enter { animation-delay: .045s; }
.digest-management.digest-enter { animation-delay: .09s; }
.digest-progress-card .progress-track i { transform-origin: left center; animation: digestProgressFill .45s cubic-bezier(.2,.72,.24,1) both; }
@media (max-width: 370px) {
  .digest-management { padding: 11px; gap: 10px; }
  .digest-management .digest-controls { grid-template-columns: minmax(0,1fr) minmax(0,1fr); }
  .digest-management .digest-controls .button { font-size: 11px; }
  .survey-options { gap: 9px; }
}
@media (prefers-reduced-motion: reduce) {
  .survey-enter, .survey-options .survey-option, .digest-enter,
  .digest-progress-card .progress-track i {
    animation: none !important;
    transition: none !important;
  }
}
.survey-progress .progress-track i { animation: digestProgressFill .42s cubic-bezier(.2,.72,.24,1) both; }
@media (max-width: 350px) {
  .digest-management .digest-controls { grid-template-columns: minmax(0,1fr); }
}
