:root {
  --bg: #fff8e7;
  --surface: #ffffff;
  --soft: #fffaf0;
  --text: #392d18;
  --muted: #74664c;
  --primary: #a86f00;
  --primary-dark: #704600;
  --line: #eadfbe;
  --accent: #d69a1f;
  --danger: #d94c4c;
  --blue: #2563eb;
  --shadow: 0 18px 48px rgba(112, 76, 10, 0.11);
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body { margin: 0; min-width: 320px; min-height: 100vh; color: var(--text); background: radial-gradient(circle at 5% 0%, #fff4d9 0, transparent 28rem), var(--bg); font-family: Manrope, Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
button { font: inherit; }
button:focus-visible { outline: 3px solid rgba(168, 111, 0, 0.3); outline-offset: 2px; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(28px, 8vw, 36px); line-height: 1.05; letter-spacing: -0.02em; }
h2 { font-size: 23px; line-height: 1.15; }

.app-shell { width: min(100%, 480px); min-height: 100vh; margin: 0 auto; padding: max(12px, env(safe-area-inset-top)) 18px calc(104px + env(safe-area-inset-bottom)); position: relative; }
.eyebrow { color: var(--primary); font-size: 12px; line-height: 1.2; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 8px; }
.eyebrow.light { color: #d6f6e7; }
.pill { display: inline-flex; align-items: center; min-height: 30px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: rgba(255,255,255,.86); font-size: 11px; font-weight: 800; white-space: nowrap; }
.pill.success { color: var(--primary-dark); border-color: #e7cf93; background: #fff4cc; }

.primary, .secondary { width: 100%; min-height: 56px; border-radius: 18px; border: 0; padding: 13px 18px; font-weight: 800; cursor: pointer; transition: .16s ease; }
.primary { color: white; background: linear-gradient(135deg, #bd7d00, #8c5900); box-shadow: 0 12px 24px rgba(141,90,0,.2); }
.primary:hover { background: var(--primary-dark); }
.primary:active { transform: translateY(1px); }
.primary:disabled { cursor: not-allowed; opacity: .42; box-shadow: none; }
.secondary { margin-top: 10px; color: #684a11; background: #fff4cc; border: 1px solid #e6ce90; }
.icon-button, .text-button { border: 0; background: transparent; color: var(--text); cursor: pointer; }
.icon-button { width: 42px; height: 42px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.72); font-size: 21px; }
.text-button { color: var(--muted); font-size: 13px; font-weight: 800; }

.welcome-photo { height: 455px; margin: 0 -4px; border-radius: 30px; overflow: hidden; position: relative; box-shadow: var(--shadow); background: #dbe7df; }
.welcome-photo img { width: 100%; height: 100%; object-fit: cover; object-position: 48% 50%; }
.photo-shade { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(9,29,22,.08) 30%, rgba(9,29,22,.84) 100%); }
.welcome-brand { position: absolute; top: 16px; left: 16px; right: 16px; display: flex; align-items: center; gap: 9px; color: #fff; }
.welcome-brand .pill { margin-left: auto; color: #fff; border-color: rgba(255,255,255,.26); background: rgba(255,255,255,.14); backdrop-filter: blur(8px); }
.brand-mark { display: grid; place-items: center; width: 36px; height: 36px; border: 1px solid rgba(255,255,255,.3); border-radius: 12px; background: rgba(255,255,255,.16); font-weight: 900; }
.welcome-copy { position: absolute; left: 18px; right: 18px; bottom: 22px; color: #fff; }
.welcome-copy h1 { max-width: 340px; font-size: 35px; }
.welcome-copy > p:last-child { margin-top: 12px; color: rgba(255,255,255,.82); font-size: 14px; line-height: 1.48; font-weight: 600; }
.welcome-points { display: grid; gap: 10px; margin: 18px 0; }
.welcome-points article { display: flex; align-items: flex-start; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 19px; background: rgba(255,255,255,.78); }
.welcome-points article > span { flex: 0 0 30px; display: grid; place-items: center; height: 30px; border-radius: 10px; color: var(--primary); background: #fff0bd; font-size: 11px; font-weight: 900; }
.welcome-points b { display: block; margin-bottom: 3px; font-size: 14px; }
.welcome-points p { color: var(--muted); font-size: 12px; line-height: 1.4; font-weight: 600; }

/* Стартовый экран VitaKey по утверждаемому макету Андрея. */
body:has(.golden-welcome) { background: #fff8e7; }
body:has(.golden-welcome) .app-shell { width: min(100%, 1060px); }
.golden-welcome { --gold: #a86f00; --gold-dark: #6f4700; --gold-soft: #fff1bd; display: grid; gap: 18px; }
.golden-header { display: grid; grid-template-columns: 82px 1fr auto; align-items: center; gap: 18px; padding: 16px 18px; border: 1px solid #ead39b; border-radius: 28px; background: linear-gradient(135deg, #fff8dc, #fff); box-shadow: 0 16px 42px rgba(112, 76, 10, .11); }
.golden-header img { width: 82px; height: 82px; object-fit: cover; border-radius: 22px; box-shadow: 0 10px 26px rgba(120, 79, 4, .2); }
.golden-header .eyebrow { color: var(--gold); }
.golden-header h1 { color: #4a3308; }
.golden-header .pill { border-color: #e7cf93; color: var(--gold-dark); background: #fff8dc; }
.golden-hero { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(300px, .95fr); grid-template-areas: "doctor copy"; align-items: stretch; gap: 18px; transition: grid-template-columns .24s ease; }
.doctor-visual { grid-area: doctor; min-height: 520px; overflow: hidden; border: 1px solid #dbc78f; border-radius: 32px; background: #234c48; box-shadow: 0 18px 48px rgba(82, 58, 11, .15); }
.doctor-visual img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 50%; display: block; }
.golden-main-copy { grid-area: copy; display: flex; flex-direction: column; justify-content: flex-end; min-height: 520px; padding: 38px; border: 1px solid #ead39b; border-radius: 32px; background: radial-gradient(circle at 90% 0%, #fff0b4 0, transparent 16rem), #fffdf8; box-shadow: 0 18px 48px rgba(82, 58, 11, .09); }
.golden-main-copy::before { content: "Персональная программа"; margin-bottom: 18px; color: var(--gold); font-size: 12px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.golden-main-copy .lead { max-width: 420px; color: #392d18; font-size: clamp(26px, 4vw, 42px); line-height: 1.12; font-weight: 900; letter-spacing: -.025em; }
.golden-actions { display: grid; gap: 10px; margin-top: 34px; }
.gold-primary { background: linear-gradient(135deg, #bd7d00, #8c5900); box-shadow: 0 14px 28px rgba(141, 90, 0, .24); }
.gold-primary:hover { background: #704600; }
.gold-secondary { margin: 0; color: var(--gold-dark); border-color: #e6ce90; background: #fff4cc; }
.details-panel { grid-area: details; display: none; align-content: center; padding: 34px; border: 1px solid #ead39b; border-radius: 32px; background: #fffdf8; box-shadow: 0 18px 48px rgba(82, 58, 11, .09); }
.details-panel .eyebrow { color: var(--gold); }
.details-panel h2 { margin-bottom: 16px; color: #392d18; font-size: 29px; }
.details-panel > p:not(.eyebrow) { color: #71634a; font-size: 14px; line-height: 1.65; font-weight: 650; }
.details-panel .details-note { margin-top: 20px; padding: 13px; border-radius: 14px; color: #6e5624; background: #fff3ce; font-size: 11px; }
.golden-welcome.details-open .golden-hero { grid-template-columns: minmax(280px, .9fr) minmax(340px, 1.1fr); grid-template-areas: "details doctor" "copy doctor"; }
.golden-welcome.details-open .details-panel { display: grid; min-height: 312px; }
.golden-welcome.details-open .golden-main-copy { min-height: auto; padding: 28px 34px; }
.golden-welcome.details-open .golden-main-copy .lead { font-size: 24px; }
.golden-welcome.details-open .golden-main-copy::before { display: none; }
.golden-welcome.details-open .doctor-visual { min-height: 650px; }
.golden-faq { padding: 28px; border: 1px solid #ead39b; border-radius: 30px; background: rgba(255,255,255,.88); box-shadow: 0 16px 42px rgba(112, 76, 10, .08); }
.golden-faq h2 { margin-bottom: 16px; color: #4a3308; }
.golden-faq details { border-top: 1px solid #eadfbe; }
.golden-faq details:last-child { border-bottom: 1px solid #eadfbe; }
.golden-faq summary { position: relative; padding: 18px 42px 18px 0; color: #4a3a1a; font-size: 15px; font-weight: 850; cursor: pointer; list-style: none; }
.golden-faq summary::-webkit-details-marker { display: none; }
.golden-faq summary::after { content: "↓"; position: absolute; right: 10px; top: 16px; color: var(--gold); font-size: 21px; transition: transform .18s ease; }
.golden-faq details[open] summary::after { transform: rotate(180deg); }
.golden-faq details p { padding: 0 42px 18px 0; color: #74664c; font-size: 13px; line-height: 1.55; font-weight: 600; }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 4px 0 22px; }
.topbar .avatar { display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 15px; color: #fff; background: var(--primary); font-weight: 900; cursor: pointer; }
.brand-inline, .question-count { font-size: 13px; font-weight: 900; }
.status-card, .dose-card, .intro-card, .question-card, .result-card, .history-card { border: 1px solid var(--line); border-radius: 28px; background: rgba(255,255,255,.9); box-shadow: var(--shadow); }
.status-card { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px; }
.status-card h2 { margin: 12px 0 6px; }
.status-card p { color: var(--muted); font-size: 13px; }
.day-ring { flex: 0 0 74px; display: grid; place-items: center; height: 74px; border: 8px solid #f1dfae; border-top-color: var(--primary); border-radius: 50%; }
.day-ring strong { font-size: 22px; line-height: 1; }
.day-ring span { color: var(--muted); font-size: 10px; font-weight: 800; }
.dose-card { margin-top: 14px; padding: 18px; }
.card-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.medicine-icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 15px; color: var(--primary); background: #fff0bd; font-size: 24px; }
.dose-row { display: grid; grid-template-columns: 52px 1fr auto; align-items: center; gap: 12px; padding: 14px 0; border-top: 1px solid var(--line); }
.dose-row .time { color: var(--primary-dark); font-size: 12px; font-weight: 900; }
.dose-row b { font-size: 15px; }
.dose-row p { margin-top: 3px; color: var(--muted); font-size: 11px; }
.tag { color: var(--muted); font-size: 10px; font-weight: 800; }
.notice { margin-top: 8px; padding: 12px; border-radius: 14px; color: #735b20; background: #fff7df; font-size: 11px; line-height: 1.45; font-weight: 700; }
.mini-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 14px 0; }
.mini-grid article { min-height: 120px; padding: 14px; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); }
.mini-grid span, .mini-grid small { display: block; color: var(--muted); font-size: 10px; font-weight: 700; }
.mini-grid strong { display: block; margin: 12px 0 6px; font-size: 19px; }
.disclaimer { margin: 18px 6px 0; color: var(--muted); font-size: 10px; line-height: 1.5; text-align: center; font-weight: 600; }
.daily-recommendation { margin-top: 10px; overflow: hidden; border: 1px solid #d8c48c; border-radius: 30px; background: #fff; box-shadow: var(--shadow); }
.daily-recommendation > img { display: block; width: 100%; height: 330px; object-fit: cover; object-position: 50% 35%; background: #234c48; }
.recommendation-copy { padding: 22px; }
.recommendation-copy h2 { margin-bottom: 14px; font-size: 29px; }
.recommendation-copy > p:not(.eyebrow) { margin-top: 10px; color: var(--muted); font-size: 14px; line-height: 1.55; }
.recommendation-copy > p b { color: var(--text); }
.compact-recommendation .primary { margin-top: 18px; }
.missed-recommendation { background: #fff8f2; }
.missed-recommendation > img { filter: saturate(.8); }

.intro-card { padding: 24px 18px 18px; text-align: center; }
.intro-card h1 { margin: 8px auto 12px; max-width: 320px; }
.intro-card > p:not(.eyebrow) { color: var(--muted); font-size: 14px; line-height: 1.5; }
.test-symbol { display: grid; place-items: center; width: 74px; height: 74px; margin: 0 auto 22px; border-radius: 24px; color: #fff; background: linear-gradient(145deg, #c88a12, var(--primary-dark)); font-size: 34px; font-weight: 900; }
.test-symbol.small { flex: 0 0 44px; width: 44px; height: 44px; margin: 0; border-radius: 15px; font-size: 20px; }
.test-meta { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 22px 0; }
.test-meta span { padding: 12px 6px; border-radius: 16px; color: var(--muted); background: var(--soft); font-size: 10px; font-weight: 700; }
.test-meta b { display: block; margin-bottom: 4px; color: var(--text); font-size: 18px; }
.unscheduled-form { display: grid; gap: 12px; margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); text-align: left; }
.unscheduled-form label { display: grid; gap: 8px; font-size: 12px; font-weight: 800; }
.unscheduled-form textarea { width: 100%; padding: 13px; border: 1px solid var(--line); border-radius: 14px; color: var(--text); background: #fffdf8; font: inherit; resize: vertical; }
.progress { height: 7px; margin: -8px 0 18px; border-radius: 99px; overflow: hidden; background: #dfe8e1; }
.progress span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--primary-dark), #d69a1f); transition: width .2s ease; }
.question-card { padding: 18px; box-shadow: none; }
.question-card h1 { margin-bottom: 18px; }
.answers { display: grid; gap: 9px; }
.answer { display: flex; align-items: flex-start; gap: 11px; width: 100%; min-height: 62px; padding: 13px; border: 1px solid var(--line); border-radius: 17px; color: var(--text); background: #fff; text-align: left; font-size: 13px; line-height: 1.38; font-weight: 700; cursor: pointer; }
.answer:hover { border-color: #dabd70; }
.answer.selected { border-color: var(--primary); background: #fff6d9; box-shadow: inset 0 0 0 1px var(--primary); }
.radio { flex: 0 0 20px; height: 20px; margin-top: 1px; border: 2px solid #b8c7be; border-radius: 50%; background: #fff; }
.answer.selected .radio { border: 6px solid var(--primary); }
.sticky-action { position: sticky; bottom: 12px; margin-top: 14px; }

.result-card { position: relative; min-height: 490px; padding: 18px 18px 20px 178px; overflow: hidden; }
.score-line { display: flex; align-items: baseline; gap: 8px; margin-bottom: 18px; }
.score-line strong { font-size: 44px; }
.score-line span { color: var(--muted); font-size: 12px; font-weight: 800; }
.result-card > p { margin-top: 22px; color: var(--muted); font-size: 13px; line-height: 1.55; font-weight: 600; }
.health-meter { position: absolute; left: 56px; top: 82px; width: 74px; height: 355px; border: 7px solid #14202f; border-radius: 5px 5px 42px 42px; overflow: hidden; background: #f7fbff; }
.health-meter::after { content: ""; position: absolute; inset: 0; z-index: 2; background: repeating-linear-gradient(to top, transparent 0, transparent calc(15.71% - 1px), rgba(20,32,47,.28) calc(15.71% - 1px), rgba(20,32,47,.28) 15.71%); }
.liquid { position: absolute; left: 0; right: 0; bottom: 0; background: linear-gradient(to top, #173c2a, #2f7a50 48%, #d4aa2a); transition: height .6s ease; }
.health-meter i { position: absolute; left: -8px; right: -8px; height: 3px; z-index: 3; background: var(--accent); }
.scale-labels { display: flex; flex-direction: column; justify-content: space-between; height: 355px; font-size: 11px; font-weight: 800; }
.next-card { display: flex; align-items: center; gap: 12px; margin: 14px 0; padding: 14px; border: 1px solid var(--line); border-radius: 19px; background: #fff; }
.next-card p { margin-top: 3px; color: var(--muted); font-size: 11px; }

.center-state { display: grid; place-items: center; align-content: center; gap: 16px; min-height: 70vh; text-align: center; }
.center-state p { max-width: 360px; color: var(--muted); line-height: 1.5; }
.loader { width: 52px; height: 52px; border: 6px solid #f0dfaf; border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.auth-card { max-width: 500px; margin: 8vh auto 0; padding: 28px; border: 1px solid var(--line); border-radius: 30px; background: rgba(255,255,255,.94); box-shadow: var(--shadow); }
.auth-card h1 { margin-bottom: 12px; }
.form-hint, .privacy-note { color: var(--muted); font-size: 12px; line-height: 1.5; }
.privacy-note { margin-top: 18px; text-align: center; }
.auth-card form, .day-editor form { display: grid; gap: 14px; margin-top: 24px; }
.auth-card label, .day-editor label { display: grid; gap: 7px; color: var(--text); font-size: 12px; font-weight: 800; }
.auth-card input, .day-editor input, .day-editor textarea { width: 100%; border: 1px solid var(--line); border-radius: 14px; padding: 13px 14px; color: var(--text); background: #fffdf8; font: inherit; }
.auth-card input:focus, .day-editor input:focus, .day-editor textarea:focus { outline: 3px solid rgba(168,111,0,.16); border-color: var(--primary); }
.form-error { margin-top: 14px; padding: 11px 13px; border-radius: 12px; color: #8a2020; background: #fff0f0; font-size: 12px; font-weight: 700; }
.notice-card { margin-top: 14px; padding: 20px; border: 1px dashed #d7b45f; border-radius: 24px; background: #fff8dc; }
.notice-card p { margin-top: 8px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.notice-card .primary { margin-top: 16px; }
.early-card { border-style: solid; background: #fff6d9; }
.missed-card { border-color: #dfb7a8; background: #fff2ed; }
.schedule-card { display: grid; gap: 14px; margin-top: 14px; padding: 18px; border: 1px solid var(--line); border-radius: 24px; background: #fff; }
.schedule-card > div > p:last-child, .schedule-note { color: var(--muted); font-size: 11px; line-height: 1.5; }
.schedule-card form { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 10px; }
.schedule-card label { display: grid; gap: 6px; font-size: 11px; font-weight: 800; }
.schedule-card input { min-height: 44px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 13px; background: #fffdf8; font: inherit; }
.schedule-card .compact { width: auto; min-height: 44px; margin: 0; }
.settings-card { display: grid; gap: 20px; padding: 22px; border: 1px solid var(--line); border-radius: 28px; background: #fff; box-shadow: var(--shadow); }
.settings-card > div > p:last-child { margin-top: 8px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.settings-card form { display: grid; gap: 12px; }
.settings-card label { display: grid; gap: 7px; font-size: 12px; font-weight: 800; }
.settings-card input { min-height: 48px; padding: 10px 13px; border: 1px solid var(--line); border-radius: 14px; color: var(--text); background: #fffdf8; font: inherit; }
.settings-note { display: grid; gap: 7px; padding: 15px; border-radius: 17px; background: var(--soft); }
.settings-note span { color: var(--muted); font-size: 11px; line-height: 1.4; }
.logout-button { margin-top: 16px; }
.questionnaire { display: grid; gap: 16px; }
.questionnaire section { padding: 20px; border: 1px solid var(--line); border-radius: 24px; background: #fff; box-shadow: 0 10px 28px rgba(112,76,10,.06); }
.questionnaire h2 { margin-bottom: 16px; }
.step-label { margin-bottom: 6px; color: var(--primary); font-size: 10px; font-weight: 900; text-transform: uppercase; letter-spacing: .07em; }
.section-hint { margin: -8px 0 14px; color: var(--muted); font-size: 11px; }
.questionnaire > section > label { display: grid; gap: 7px; margin-top: 14px; font-size: 12px; font-weight: 800; }
.questionnaire input[type="text"], .questionnaire input[type="number"], .questionnaire input[type="time"], .questionnaire section > label > input, .questionnaire textarea { width: 100%; min-height: 46px; padding: 11px 13px; border: 1px solid var(--line); border-radius: 13px; color: var(--text); background: #fffdf8; font: inherit; }
.questionnaire textarea { resize: vertical; }
.questionnaire fieldset { display: grid; gap: 8px; margin: 14px 0 0; padding: 0; border: 0; }
.questionnaire legend { margin-bottom: 9px; font-size: 12px; font-weight: 900; }
.choice { display: grid; grid-template-columns: 22px 1fr; align-items: start; gap: 10px; padding: 11px; border: 1px solid var(--line); border-radius: 14px; background: #fffdf8; font-size: 12px; line-height: 1.35; cursor: pointer; }
.choice:has(input:checked) { border-color: #c79b35; background: #fff4cc; }
.choice input { width: 19px; height: 19px; margin: 0; accent-color: var(--primary); }

body:has(.doctor-header) .app-shell { width: min(calc(100% - 24px), 1100px); }
.doctor-header { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin: 4px 0 24px; }
.doctor-header > div { flex: 1; }
.doctor-header .compact { width: auto; min-height: 44px; margin: 0; padding-inline: 20px; }
.doctor-summary, .patient-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.doctor-summary article, .patient-facts article { padding: 18px; border: 1px solid var(--line); border-radius: 20px; background: #fff; }
.doctor-summary span, .patient-facts span { display: block; color: var(--muted); font-size: 11px; font-weight: 700; }
.doctor-summary strong, .patient-facts strong { display: block; margin-top: 9px; font-size: 20px; }
.invitation-manager { margin-bottom: 18px; padding: 20px; border: 1px solid var(--line); border-radius: 28px; background: #fff; }
.invitation-form { display: grid; grid-template-columns: 1fr 1.25fr 1fr auto; align-items: end; gap: 10px; margin: 14px 0; }
.invitation-form label { display: grid; gap: 7px; margin: 0; color: var(--muted); font-size: 11px; font-weight: 800; }
.invitation-form input { width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 13px; color: var(--text); background: #fffdf8; font: inherit; }
.invitation-form button { margin: 0; white-space: nowrap; }
.created-invitation { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 12px; margin: 14px 0; padding: 14px; border: 1px solid #b9d7bd; border-radius: 16px; color: #285b31; background: #edf9ef; font-size: 11px; }
.created-invitation code { padding: 8px 10px; border-radius: 9px; color: var(--primary-dark); background: #fff; font-size: 13px; font-weight: 900; }
.created-invitation button { margin: 0; }
.invitation-list { display: grid; gap: 8px; margin-top: 14px; }
.invitation-list article { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 16px; background: #fffdf8; }
.invitation-list b, .invitation-list span, .invitation-list small { display: block; }
.invitation-list b { font-size: 13px; }
.invitation-list div > span { margin-top: 4px; font-size: 11px; overflow-wrap: anywhere; }
.invitation-list small { margin-top: 4px; color: var(--muted); font-size: 10px; }
.invitation-list button { margin: 0; }
.invitation-status { padding: 7px 9px; border-radius: 999px; font-size: 10px; font-weight: 900; white-space: nowrap; }
.invitation-status.active { color: #285b31; background: #e2f4e5; }
.invitation-status.used { color: #28536b; background: #e5f2f8; }
.invitation-status.expired, .invitation-status.deactivated { color: #6c5b40; background: #eee8dc; }
.secondary.danger { color: #8c2d23; border-color: #dfb3ad; }
.patient-list { display: grid; gap: 10px; }
.patient-list > button { display: grid; grid-template-columns: 48px 1fr auto; align-items: center; gap: 13px; width: 100%; padding: 14px; border: 1px solid var(--line); border-radius: 20px; color: var(--text); background: #fff; text-align: left; cursor: pointer; }
.patient-list > button:hover { border-color: #d4b35e; background: #fffaf0; }
.patient-avatar { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 16px; color: #fff; background: var(--primary); font-weight: 900; }
.patient-list b, .patient-list small { display: block; }
.patient-list small { margin-top: 5px; color: var(--muted); font-size: 11px; }
.patient-list i { color: var(--primary); font-size: 22px; font-style: normal; }
.patient-facts { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.patient-facts strong { font-size: 15px; overflow-wrap: anywhere; }
.admin-warning { margin-bottom: 18px; padding: 14px 16px; border: 1px solid #e4c66f; border-radius: 16px; color: #654b13; background: #fff4cc; font-size: 12px; line-height: 1.5; font-weight: 700; }
.admin-success { margin-bottom: 18px; padding: 14px 16px; border: 1px solid #b9d7bd; border-radius: 16px; color: #285b31; background: #edf9ef; font-size: 12px; line-height: 1.5; font-weight: 700; }
.event-log { margin-bottom: 18px; padding: 18px; border: 1px solid var(--line); border-radius: 24px; background: #fff; }
.event-log article { display: flex; justify-content: space-between; gap: 14px; padding: 11px 0; border-top: 1px solid var(--line); }
.event-log article b { font-size: 12px; }
.event-log article small { color: var(--muted); font-size: 10px; white-space: nowrap; }
.doctor-tests { margin-bottom: 18px; padding: 20px; border: 1px solid var(--line); border-radius: 28px; background: #fff; }
.profile-summary { margin-bottom: 18px; padding: 20px; border: 1px solid var(--line); border-radius: 28px; background: #fff; }
.profile-summary dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; overflow: hidden; margin: 0; border: 1px solid var(--line); border-radius: 16px; background: var(--line); }
.profile-summary dl > div { padding: 12px; background: #fff; }
.profile-summary dt { color: var(--muted); font-size: 10px; font-weight: 800; }
.profile-summary dd { margin: 5px 0 0; font-size: 12px; line-height: 1.4; overflow-wrap: anywhere; }
.table-scroll, .course-matrix-wrap { overflow-x: auto; overscroll-behavior-inline: contain; border: 1px solid var(--line); border-radius: 16px; }
.tests-table, .course-matrix { border-collapse: separate; border-spacing: 0; width: max-content; min-width: 100%; background: #fff; font-size: 11px; }
.tests-table th, .tests-table td, .course-matrix th, .course-matrix td { padding: 10px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); text-align: center; white-space: nowrap; }
.tests-table th, .course-matrix th { position: sticky; left: 0; z-index: 2; color: var(--primary-dark); background: #fff5d5; font-weight: 900; }
.tests-table thead th { position: sticky; top: 0; left: auto; z-index: 1; }
.tests-table thead th:first-child { left: 0; z-index: 3; }
.tests-table .reason-cell { max-width: 250px; overflow: hidden; text-align: left; text-overflow: ellipsis; }
.question-key { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 14px; margin-top: 14px; }
.question-key span { color: var(--muted); font-size: 10px; }
.question-key b { color: var(--text); }
.course-admin { padding: 20px; border: 1px solid var(--line); border-radius: 28px; background: rgba(255,255,255,.9); box-shadow: var(--shadow); }
.course-start-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; margin: 2px 0 14px; }
.course-start-form label { flex: 0 1 240px; margin: 0; }
.course-start-form button { margin: 0; }
.table-help { margin: -4px 0 12px; color: var(--muted); font-size: 11px; }
.course-matrix th { min-width: 88px; text-align: left; }
.course-matrix td { min-width: 58px; height: 46px; }
.course-matrix td.current { background: #fff4c8; font-weight: 900; }
.course-matrix .matrix-treatment th { background: #fff0bd; }
.course-matrix .matrix-treatment td { background: #fffbef; }
.course-matrix .matrix-total th { color: #fff; background: var(--primary-dark); }
.course-matrix .matrix-total td { background: #f1f8f2; }
.course-matrix .matrix-plan th { min-width: 112px; }
.course-matrix .matrix-plan td { max-width: 92px; overflow: hidden; color: #7a4f00; background: #fff8df; text-overflow: ellipsis; }
.course-date-warning { margin: 0 0 12px; }
.course-matrix button { width: 38px; min-height: 30px; border: 1px solid #d6b967; border-radius: 9px; color: var(--primary-dark); background: #fff8e3; font-size: 11px; font-weight: 900; cursor: pointer; }
.course-matrix button:hover { background: #ffeaa6; }
.test-mark { display: inline-grid; place-items: center; width: 31px; height: 25px; border-radius: 8px; color: #fff; background: #2f7a50; font-weight: 900; }
.test-mark.unscheduled { background: #b16f00; }
.modal-backdrop { position: fixed; z-index: 50; inset: 0; display: grid; place-items: center; padding: 18px; background: rgba(40,30,12,.55); backdrop-filter: blur(4px); }
.day-editor { width: min(100%, 430px); padding: 24px; border-radius: 26px; background: #fffdf8; box-shadow: 0 24px 70px rgba(0,0,0,.25); }

.history-card { padding: 18px; }
.bars { display: flex; align-items: flex-end; justify-content: center; gap: 12px; height: 190px; padding: 28px 8px 8px; border-bottom: 1px solid var(--line); background: linear-gradient(to bottom, rgba(168,111,0,.06), transparent); }
.bar-wrap { flex: 1; max-width: 38px; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px; }
.bar { width: 100%; border-radius: 9px 9px 4px 4px; background: linear-gradient(180deg, #e1b044, var(--primary-dark)); }
.bar-wrap small { font-size: 10px; font-weight: 800; }
.empty { padding: 28px 12px; text-align: center; }
.empty p { margin-top: 6px; color: var(--muted); font-size: 12px; }
.history-list { display: grid; gap: 9px; margin: 14px 0; }
.history-list article { display: flex; align-items: center; gap: 12px; padding: 13px; border: 1px solid var(--line); border-radius: 18px; background: #fff; }
.history-score { flex: 0 0 44px; display: grid; place-items: center; height: 44px; border-radius: 14px; color: #fff; background: var(--primary); font-weight: 900; }
.history-list b { font-size: 13px; }
.history-list p { margin-top: 4px; color: var(--muted); font-size: 10px; }
.history-list small { display: block; margin-top: 4px; color: #8b5b05; font-size: 10px; }

.bottom-nav { position: fixed; z-index: 20; left: 50%; bottom: max(10px, env(safe-area-inset-bottom)); transform: translateX(-50%); display: grid; grid-template-columns: repeat(4, 1fr); width: min(calc(100% - 24px), 440px); min-height: 70px; padding: 7px; border: 1px solid rgba(234,223,190,.94); border-radius: 23px; background: rgba(255,253,248,.92); box-shadow: 0 14px 40px rgba(112,76,10,.18); backdrop-filter: blur(15px); }
.bottom-nav button { border: 0; border-radius: 17px; color: var(--muted); background: transparent; font-size: 10px; font-weight: 800; cursor: pointer; }
.bottom-nav button span { display: block; margin-bottom: 3px; font-size: 20px; }
.bottom-nav button.active { color: var(--primary-dark); background: #fff0bd; }

@media (min-width: 700px) {
  body { padding: 24px 0; }
  .app-shell { min-height: 880px; border: 1px solid rgba(112,76,10,.1); border-radius: 36px; background: rgba(255,248,231,.94); box-shadow: var(--shadow); }
}

@media (max-width: 760px) {
  .golden-header { grid-template-columns: 64px 1fr; padding: 13px; border-radius: 23px; }
  .golden-header img { width: 64px; height: 64px; border-radius: 17px; }
  .golden-header .pill { display: none; }
  .golden-header h1 { font-size: 28px; }
  .golden-hero, .golden-welcome.details-open .golden-hero { grid-template-columns: 1fr; grid-template-areas: "doctor" "copy" "details"; }
  .doctor-visual, .golden-welcome.details-open .doctor-visual { min-height: 430px; }
  .golden-main-copy, .golden-welcome.details-open .golden-main-copy { min-height: auto; padding: 26px 22px; }
  .golden-main-copy .lead, .golden-welcome.details-open .golden-main-copy .lead { font-size: 27px; }
  .details-panel, .golden-welcome.details-open .details-panel { min-height: auto; padding: 26px 22px; }
  .golden-faq { padding: 22px 18px; }
  .patient-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .invitation-form { grid-template-columns: 1fr; }
  .created-invitation { grid-template-columns: 1fr; }
  .invitation-list article { grid-template-columns: 1fr auto; }
  .invitation-list article button { grid-column: 1 / -1; width: 100%; }
  .doctor-header h1 { font-size: 25px; }
  .question-key { grid-template-columns: 1fr; }
  .profile-summary dl { grid-template-columns: 1fr; }
}

@media (max-width: 370px) {
  .app-shell { padding-inline: 13px; }
  .welcome-photo { height: 420px; }
  .dose-row { grid-template-columns: 45px 1fr; }
  .dose-row .tag { grid-column: 2; }
  .result-card { padding-left: 148px; }
  .health-meter { left: 42px; width: 66px; }
}
