:root {
    --bg: #f6f9fc;
    --surface: #ffffff;
    --surface-soft: #f4f8fc;
    --surface-pink: #fff1f7;
    --ink: #07172d;
    --muted: #344766;
    --soft-text: #5c6f88;
    --line: #d9e3ef;
    --line-strong: #b7c8dc;
    --brand-pink-bright: #ff438c;
    --brand-pink: #d91f70;
    --brand-pink-dark: #b01358;
    --brand-blue: #009aff;
    --brand-blue-dark: #006fba;
    --navy: #031a33;
    --success: #087038;
    --warning-bg: #ffe34d;
    --warning-text: #1646a3;
    --danger: #b42345;
    --shadow: 0 16px 44px rgba(13, 34, 61, 0.10);
    --shadow-soft: 0 8px 26px rgba(13, 34, 61, 0.08);
    --radius: 8px;
    --sidebar: 148px;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
    box-sizing: border-box;
}

html {
    background: var(--bg);
}

body {
    margin: 0;
    background: radial-gradient(circle at 25% 0%, rgba(0, 154, 255, 0.08), transparent 28%), var(--bg);
    color: var(--ink);
    font-size: 17px;
    line-height: 1.55;
    letter-spacing: 0;
}

button,
input,
select,
textarea {
    font: inherit;
}

button {
    cursor: pointer;
}

img {
    max-width: 100%;
}

.hidden {
    display: none !important;
}

.muted {
    color: var(--soft-text);
}

.small {
    font-size: 14px;
    line-height: 1.45;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 74px;
    padding: 12px clamp(18px, 4vw, 42px);
    border-bottom: 1px solid rgba(217, 227, 239, 0.86);
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(18px);
}

body.is-authenticated .topbar {
    position: fixed;
    top: 0;
    right: 0;
    left: 0;
    min-height: 56px;
    padding-block: 8px;
    padding-inline-start: calc(var(--sidebar) + 22px);
    border-bottom-color: transparent;
    background: linear-gradient(180deg, rgba(246, 249, 252, 0.96), rgba(246, 249, 252, 0.72));
}

body.is-authenticated .brand {
    display: none;
}

.brand,
.nav-brand {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
}

.app-logo {
    width: clamp(150px, 15vw, 210px);
    height: auto;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-inline-start: auto;
}

.shell {
    width: min(100%, 1520px);
    margin: 0 auto;
    padding: clamp(18px, 3vw, 34px);
}

body.is-authenticated .shell {
    width: 100%;
    max-width: none;
    padding: 18px 20px 28px;
}

.language-prompt {
    position: fixed;
    inset: 0;
    z-index: 120;
    display: grid;
    place-items: center;
    padding: 16px;
    background: rgba(3, 26, 51, 0.45);
}

.language-card {
    display: grid;
    gap: 14px;
    width: min(100%, 460px);
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.language-card h2,
.language-card p {
    margin: 0;
}

.language-actions {
    display: grid;
    gap: 8px;
}

.language-option {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 48px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--ink);
    font-weight: 650;
}

.language-option input {
    flex: 0 0 auto;
    width: 20px;
    height: 20px;
    min-height: auto;
    accent-color: var(--brand-pink);
}

.auth-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(320px, 440px);
    gap: clamp(22px, 5vw, 72px);
    align-items: center;
    min-height: calc(100vh - 112px);
}

.intro-panel h1 {
    max-width: 780px;
    margin: 0;
    color: var(--ink);
    font-size: clamp(42px, 7vw, 76px);
    font-weight: 760;
    line-height: 1.04;
    letter-spacing: 0;
}

.intro-panel p {
    max-width: 650px;
    color: var(--muted);
    font-size: 20px;
}

.eyebrow {
    margin: 0 0 8px;
    color: var(--brand-pink-dark);
    font-size: 13px;
    font-weight: 760;
    text-transform: uppercase;
}

.notice {
    display: grid;
    gap: 5px;
    max-width: 690px;
    margin-top: 28px;
    padding: 16px 18px;
    border: 1px solid #ffd1e4;
    border-inline-start: 4px solid var(--brand-pink);
    border-radius: var(--radius);
    background: var(--surface-pink);
    color: var(--ink);
}

.auth-card,
.panel,
.metric,
.price-card,
.question-card,
.progress-card,
.module-card,
.learn-card {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.96);
    box-shadow: var(--shadow-soft);
}

.auth-card {
    display: grid;
    gap: 14px;
    padding: 22px;
}

.segmented {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    padding: 5px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface-soft);
}

.segment {
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--muted);
    padding: 10px;
    font-weight: 700;
}

.segment.active {
    background: var(--brand-pink);
    color: #fff;
    box-shadow: 0 8px 20px rgba(255, 67, 140, 0.24);
}

.form,
.stack {
    display: grid;
    gap: 14px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    padding: 18px;
}

label {
    display: grid;
    gap: 7px;
    color: var(--ink);
    font-weight: 650;
}

input,
select,
textarea {
    width: 100%;
    min-height: 48px;
    padding: 11px 12px;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    background: #fff;
    color: var(--ink);
}

textarea {
    min-height: 112px;
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible,
a:focus-visible {
    outline: 3px solid rgba(0, 154, 255, 0.30);
    outline-offset: 2px;
}

.primary,
.secondary,
.ghost,
.link-button {
    min-height: 44px;
    border-radius: 8px;
    padding: 10px 16px;
    border: 1px solid transparent;
    font-weight: 730;
}

.primary {
    background: var(--brand-pink);
    color: #fff;
    border-color: var(--brand-pink);
    box-shadow: 0 12px 24px rgba(255, 67, 140, 0.24);
}

.primary.relief {
    background: var(--brand-pink);
    border-color: var(--brand-pink-dark);
}

.secondary {
    background: #fff;
    color: var(--brand-blue-dark);
    border-color: #b8daf6;
}

.secondary.success {
    background: var(--success);
    color: #fff;
    border-color: var(--success);
}

.ghost,
.link-button {
    background: transparent;
    color: var(--brand-blue-dark);
    border-color: transparent;
}

.wide {
    width: 100%;
}

.compact {
    min-height: 40px;
    width: auto;
}

.google-auth {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 50px;
    padding: 10px 14px;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    background: #fff;
    color: var(--ink);
    font-weight: 720;
    text-decoration: none;
}

.google-auth::before {
    content: "G";
    display: inline-grid;
    place-items: center;
    width: 28px;
    height: 28px;
    margin-inline-end: 10px;
    border-radius: 50%;
    color: var(--brand-blue-dark);
    background: #eaf6ff;
    font-weight: 760;
}

.divider {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--soft-text);
    font-size: 15px;
}

.divider::before,
.divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--line);
}

.app-layout {
    display: grid;
    grid-template-columns: var(--sidebar) minmax(0, 1fr);
    gap: 18px;
    align-items: start;
    min-height: calc(100vh - 34px);
    padding-top: 58px;
}

.side-nav {
    position: sticky;
    top: 0;
    min-height: calc(100vh - 36px);
    display: grid;
    grid-template-rows: auto auto 1fr;
    gap: 16px;
    padding: 18px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.96);
    box-shadow: var(--shadow-soft);
}

.nav-brand img {
    width: 122px;
    height: auto;
}

.nav-primary,
.nav-secondary {
    display: grid;
    gap: 8px;
}

.nav-secondary {
    align-content: end;
}

.nav-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 9px;
    min-height: 42px;
    padding: 9px 10px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
    text-align: start;
    font-size: 14px;
    font-weight: 680;
}

.nav-item::before {
    content: "";
    display: inline-grid;
    place-items: center;
    flex: 0 0 20px;
    width: 20px;
    height: 20px;
    border: 1.8px solid currentColor;
    border-radius: 6px;
    color: currentColor;
}

.nav-item[data-icon="home"]::before { border-radius: 50% 50% 6px 6px; }
.nav-item[data-icon="path"]::before { border-radius: 50%; box-shadow: inset 0 0 0 5px #fff; background: currentColor; }
.nav-item[data-icon="progress"]::before { border-radius: 2px; border-top: 0; transform: skew(-6deg); }
.nav-item[data-icon="learn"]::before { border-radius: 2px 7px 7px 2px; }
.nav-item[data-icon="profile"]::before { border-radius: 50%; }

.nav-item.active {
    background: var(--surface-pink);
    color: var(--brand-pink-dark);
}

.workspace {
    min-width: 0;
}

.view {
    display: none;
}

.view.active {
    display: grid;
    gap: 18px;
}

.view-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 20px;
    min-height: 48px;
}

.view-heading h2 {
    margin: 0;
    color: var(--ink);
    font-size: clamp(28px, 3vw, 40px);
    font-weight: 760;
    line-height: 1.12;
}

.status-bar {
    min-height: 24px;
    color: var(--brand-blue-dark);
    font-weight: 700;
}

.home-hero {
    position: relative;
    min-height: 414px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--navy);
    box-shadow: var(--shadow);
}

.home-hero picture,
.home-hero img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.home-hero img {
    object-fit: cover;
}

.home-hero::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.82) 0%, rgba(255, 255, 255, 0.52) 32%, rgba(255, 255, 255, 0.06) 68%);
}

.home-hero-copy {
    position: relative;
    z-index: 1;
    max-width: 520px;
    padding: 64px 46px;
}

.home-hero-copy h2 {
    margin: 0 0 10px;
    color: var(--ink);
    font-size: clamp(30px, 4vw, 46px);
    line-height: 1.08;
}

.home-hero-copy p {
    max-width: 410px;
    margin: 0;
    color: var(--muted);
    font-size: 19px;
}

.hero-progress {
    position: absolute;
    z-index: 2;
    left: 40px;
    bottom: 28px;
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 18px;
    align-items: center;
    width: min(520px, calc(100% - 80px));
    padding: 18px;
}

.progress-ring {
    --value: 65;
    display: grid;
    place-items: center;
    width: 86px;
    height: 86px;
    border-radius: 50%;
    background:
        radial-gradient(circle at center, #fff 0 57%, transparent 58%),
        conic-gradient(var(--brand-pink-bright) calc(var(--value) * 1%), var(--brand-blue) 0 75%, #e5edf5 0);
}

.progress-ring strong {
    color: var(--ink);
    font-size: 22px;
}

.progress-card h3,
.progress-card p,
.progress-card span {
    margin: 0;
}

.progress-card h3 {
    color: var(--ink);
    font-size: 18px;
}

.progress-card span {
    display: block;
    color: var(--soft-text);
    font-size: 14px;
}

.round-action {
    width: 42px;
    height: 42px;
    border: 0;
    border-radius: 50%;
    background: var(--navy);
    color: #fff;
}

.round-action::before {
    content: "";
    display: block;
    width: 0;
    height: 0;
    margin: auto;
    border-block: 7px solid transparent;
    border-inline-start: 11px solid currentColor;
    transform: translateX(2px);
}

.section-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.section-row h3 {
    margin: 0;
    font-size: 22px;
}

.panel {
    padding: 20px;
}

.panel h3 {
    margin-top: 0;
}

.today-task {
    display: grid;
    gap: 14px;
}

.today-task h3,
.program-head h3,
.program-hero h3 {
    margin: 0;
    font-size: clamp(24px, 3vw, 36px);
    line-height: 1.14;
}

.task-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 14px;
    align-items: center;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: linear-gradient(90deg, #f3faff, #fff);
}

.task-row img {
    width: 62px;
    height: 62px;
    object-fit: contain;
    border-radius: 8px;
    background: var(--navy);
}

.task-row p,
.task-row h4,
.task-row span {
    margin: 0;
}

.task-row p {
    color: var(--brand-pink-dark);
    font-size: 13px;
    font-weight: 760;
}

.task-row h4 {
    color: var(--ink);
    font-size: 18px;
}

.task-row span {
    display: block;
    color: var(--muted);
    font-size: 14px;
}

.practice-list {
    display: grid;
    gap: 8px;
    margin: 0;
    padding-inline-start: 22px;
}

.compact-list {
    color: var(--muted);
}

.program-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(260px, 420px);
    gap: 24px;
    align-items: stretch;
    overflow: hidden;
    min-height: 300px;
    padding: 28px;
    border-radius: var(--radius);
    background: var(--navy);
    color: #fff;
    box-shadow: var(--shadow);
}

.program-hero .eyebrow,
.program-hero p,
.program-hero strong {
    color: #fff;
}

.program-hero p {
    max-width: 620px;
    color: rgba(255, 255, 255, 0.84);
}

.program-hero img {
    width: 100%;
    height: 100%;
    min-height: 250px;
    object-fit: cover;
    border-radius: var(--radius);
}

.modules-panel {
    display: grid;
    gap: 16px;
}

.module-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.module-card {
    display: grid;
    grid-template-columns: 74px minmax(0, 1fr);
    gap: 14px;
    align-items: center;
    padding: 16px;
}

.module-card img {
    width: 74px;
    height: 74px;
    object-fit: contain;
}

.module-card h4,
.module-card p {
    margin: 0;
}

.module-card h4 {
    color: var(--ink);
    font-size: 18px;
}

.module-card p,
.module-card span {
    color: var(--muted);
    font-size: 14px;
}

.linear-progress {
    overflow: hidden;
    height: 5px;
    margin-top: 8px;
    border-radius: 999px;
    background: #dce8f4;
}

.linear-progress span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--brand-pink-bright), var(--brand-blue));
}

.learn-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.learn-card {
    display: grid;
    grid-template-rows: 170px minmax(0, 1fr) auto;
    overflow: hidden;
}

.learn-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.learn-card div {
    display: grid;
    gap: 8px;
    padding: 14px;
}

.learn-card h3,
.learn-card p {
    margin: 0;
}

.learn-card h3 {
    font-size: 18px;
    line-height: 1.18;
}

.learn-card p,
.learn-card span {
    color: var(--muted);
    font-size: 14px;
}

.learn-card .link-button {
    justify-self: start;
    margin: 0 14px 14px;
    padding-inline: 0;
}

.metric-grid,
.price-grid,
.score-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.metric,
.price-card,
.question-card {
    padding: 18px;
}

.metric strong {
    display: block;
    color: var(--ink);
    font-size: 34px;
    line-height: 1.12;
}

.split {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
    gap: 16px;
}

.billing-notice,
.billing-explainer {
    border-color: #ead377;
    background: #fff9d9;
}

.billing-notice p,
.billing-explainer p {
    margin: 0;
    color: #123b6d;
}

.assessment-form {
    display: grid;
    gap: 12px;
}

.question-card fieldset {
    margin: 0;
    padding: 0;
    border: 0;
}

.question-card legend {
    margin-bottom: 12px;
    color: var(--ink);
    font-size: 19px;
    font-weight: 730;
}

.option-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
}

.option {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 46px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--ink);
    font-weight: 620;
}

.option input {
    flex: 0 0 auto;
    width: auto;
    min-height: auto;
    inline-size: 20px;
    block-size: 20px;
    accent-color: var(--brand-pink);
}

.range-row {
    display: grid;
    grid-template-columns: 1fr 54px;
    gap: 12px;
    align-items: center;
}

.range-row input[type="range"] {
    padding: 0;
    accent-color: var(--brand-blue);
}

.range-row output {
    color: var(--ink);
    font-size: 28px;
    font-weight: 760;
    text-align: center;
}

.score-pill {
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: linear-gradient(180deg, #fff, #f8fbfe);
}

.score-pill strong {
    display: block;
    color: var(--ink);
    font-size: 20px;
}

.score-pill span {
    display: block;
    margin-top: 7px;
    color: var(--muted);
    font-size: 15px;
    line-height: 1.45;
}

.compact-options {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.plan-summary {
    display: grid;
    gap: 16px;
}

.plan-summary section,
.result-details .stack {
    display: grid;
    gap: 8px;
}

.plan-summary h4 {
    margin: 0;
    color: var(--brand-blue-dark);
    font-size: 17px;
}

.plan-summary p {
    margin: 0;
}

.week-list {
    display: grid;
    gap: 10px;
    margin: 0;
    padding-inline-start: 24px;
}

.week-list li span {
    display: block;
    margin-top: 3px;
    color: var(--muted);
}

.safety-result.warning {
    border-color: #e5c22f;
    background: var(--warning-bg);
    color: var(--warning-text);
}

.safety-result.warning p {
    margin: 0;
    font-weight: 420;
}

.result-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.result-actions button {
    flex: 1 1 240px;
}

.result-details summary {
    cursor: pointer;
    color: var(--brand-blue-dark);
    font-size: 20px;
    font-weight: 730;
}

.program-result-intro {
    border-color: #ffd1e4;
    background: var(--surface-pink);
}

.sticky-actions {
    position: sticky;
    bottom: 16px;
    z-index: 10;
    display: flex;
    justify-content: end;
    gap: 10px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(16px);
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 11px 10px;
    border-bottom: 1px solid var(--line);
    text-align: start;
}

.table th {
    color: var(--muted);
    font-size: 14px;
}

.chat-panel {
    display: grid;
    gap: 10px;
    max-height: 430px;
    overflow: auto;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
}

.bubble {
    max-width: 76%;
    padding: 12px 14px;
    border-radius: 8px;
    background: #eef6ff;
    color: var(--ink);
}

.bubble.mine {
    justify-self: end;
    background: var(--surface-pink);
}

.composer {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
}

.full {
    grid-column: 1 / -1;
}

.badge {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 3px 9px;
    border-radius: 999px;
    background: #eaf6ff;
    color: var(--brand-blue-dark);
    font-size: 14px;
    font-weight: 760;
}

.danger {
    color: var(--danger);
}

.ok {
    color: var(--success);
}

.dangerous-symptoms-banner {
    position: fixed;
    inset-inline: 0;
    bottom: 0;
    z-index: 80;
    padding: 5px clamp(8px, 2vw, 18px);
    border-top: 1px solid #d6ad00;
    background: var(--warning-bg);
    color: var(--warning-text);
    font-size: 14px;
    font-weight: 400;
    line-height: 1.18;
    text-align: center;
    overflow-y: auto;
    scrollbar-width: thin;
    box-shadow: 0 -8px 18px rgba(45, 39, 12, 0.12);
}

.continue-relief-cta {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 75;
    max-width: min(430px, calc(100vw - 32px));
    min-height: 56px;
    padding: 13px 20px;
    border: 1px solid var(--brand-pink-dark);
    border-radius: 8px;
    background: var(--brand-pink);
    color: #fff;
    box-shadow: 0 16px 36px rgba(255, 67, 140, 0.30);
    font-size: 17px;
    font-weight: 760;
}

body.has-dangerous-symptoms {
    padding-bottom: 44px;
}

body.has-continue-relief {
    padding-bottom: 92px;
}

html[dir="rtl"] .nav-item,
html[dir="rtl"] .table th,
html[dir="rtl"] .table td {
    text-align: right;
}

html[dir="rtl"] .home-hero::after {
    background: linear-gradient(270deg, rgba(255, 255, 255, 0.82) 0%, rgba(255, 255, 255, 0.52) 32%, rgba(255, 255, 255, 0.06) 68%);
}

html[dir="rtl"] .hero-progress {
    right: 40px;
    left: auto;
}

@media (max-width: 1180px) {
    .module-grid,
    .learn-grid,
    .score-grid,
    .metric-grid,
    .price-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 920px) {
    :root {
        --sidebar: 0px;
    }

    body.is-authenticated .topbar {
        display: none;
    }

    body.is-authenticated .brand {
        display: none;
    }

    .auth-grid,
    .app-layout,
    .split,
    .program-hero {
        grid-template-columns: 1fr;
    }

    .app-layout {
        padding-top: 0;
        padding-bottom: 96px;
    }

    .side-nav {
        position: fixed;
        top: auto;
        right: 8px;
        bottom: 8px;
        left: 8px;
        z-index: 70;
        width: auto;
        height: auto;
        min-height: 0;
        display: flex;
        grid-template-rows: none;
        align-items: center;
        gap: 5px;
        overflow-x: auto;
        padding: 6px;
        border-radius: 8px;
        scrollbar-width: thin;
    }

    .nav-brand {
        display: none;
    }

    .nav-primary,
    .nav-secondary {
        display: flex;
        flex: 0 0 auto;
        gap: 5px;
    }

    .nav-primary {
        width: 100%;
        justify-content: space-between;
    }

    .nav-secondary {
        display: none;
    }

    .nav-item {
        flex: 1 1 0;
        min-width: 0;
        min-height: 54px;
        flex-direction: column;
        justify-content: center;
        gap: 3px;
        padding: 5px 3px;
        font-size: clamp(8px, 2.45vw, 10px);
        line-height: 1.05;
        text-transform: uppercase;
        text-align: center;
    }

    .nav-item::before {
        flex-basis: 20px;
        width: 20px;
        height: 20px;
    }

    .nav-item span {
        display: block;
        width: 100%;
        white-space: nowrap;
    }

    .continue-relief-cta {
        right: 12px;
        bottom: 92px;
        left: 12px;
        width: auto;
        max-width: none;
        text-align: center;
    }

    .dangerous-symptoms-banner {
        bottom: 74px;
    }

    body.has-dangerous-symptoms {
        padding-bottom: 126px;
    }

    body.has-continue-relief {
        padding-bottom: 170px;
    }

    .form-grid,
    .option-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    body {
        background: #fff;
        font-size: 18px;
        line-height: 1.6;
    }

    .topbar {
        display: none;
    }

    .app-logo {
        width: min(150px, 46vw);
    }

    .topbar-actions {
        gap: 6px;
    }

    .compact {
        min-height: 42px;
        max-width: 112px;
        font-size: 16px;
    }

    .shell,
    body.is-authenticated .shell {
        padding: 8px;
    }

    .language-prompt {
        padding: 8px;
    }

    .language-card {
        padding: 16px;
        box-shadow: var(--shadow-soft);
    }

    .language-option {
        min-height: 52px;
        padding: 10px;
        font-size: 18px;
    }

    .auth-grid {
        align-items: start;
        gap: 12px;
        min-height: 100svh;
    }

    .intro-panel {
        display: grid;
        gap: 8px;
    }

    .intro-panel h1 {
        font-size: 31px;
        line-height: 1.08;
    }

    .intro-panel p {
        margin: 0;
        font-size: 18px;
        line-height: 1.38;
    }

    .notice {
        margin-top: 2px;
        padding: 10px;
        font-size: 14px;
        line-height: 1.35;
    }

    .auth-card,
    .panel,
    .metric,
    .price-card,
    .question-card,
    .progress-card,
    .module-card,
    .learn-card {
        box-shadow: none;
    }

    .auth-card {
        padding: 14px;
    }

    .segment,
    .primary,
    .secondary,
    .ghost,
    .google-auth {
        min-height: 52px;
        font-size: 17px;
    }

    input,
    select,
    textarea {
        min-height: 50px;
        padding: 10px;
        font-size: 18px;
    }

    .view.active {
        gap: 12px;
    }

    .view-heading {
        min-height: auto;
        align-items: start;
        flex-direction: column;
        gap: 2px;
        padding-inline: 2px;
    }

    .view-heading h2 {
        font-size: 28px;
    }

    .home-hero {
        min-height: 470px;
    }

    .home-hero::after {
        background: linear-gradient(180deg, rgba(255, 255, 255, 0.94) 0%, rgba(255, 255, 255, 0.66) 36%, rgba(255, 255, 255, 0.08) 62%);
    }

    .home-hero-copy {
        padding: 24px 20px;
    }

    .home-hero-copy h2 {
        max-width: 280px;
        font-size: 26px;
    }

    .home-hero-copy p {
        max-width: 280px;
        font-size: 16px;
    }

    .hero-progress {
        right: 12px;
        bottom: 12px;
        left: 12px;
        width: auto;
        grid-template-columns: auto 1fr auto;
        padding: 13px;
    }

    html[dir="rtl"] .hero-progress {
        right: 12px;
        left: 12px;
    }

    .progress-ring {
        width: 72px;
        height: 72px;
    }

    .progress-ring strong {
        font-size: 19px;
    }

    .panel {
        padding: 15px;
    }

    .task-row {
        grid-template-columns: auto minmax(0, 1fr);
    }

    .task-row .secondary,
    .task-row .badge {
        grid-column: 1 / -1;
        width: 100%;
    }

    .module-grid,
    .learn-grid,
    .score-grid,
    .metric-grid,
    .price-grid {
        grid-template-columns: 1fr;
    }

    .program-hero {
        min-height: auto;
        padding: 18px;
    }

    .program-hero img {
        min-height: 210px;
    }

    .module-card {
        grid-template-columns: 64px minmax(0, 1fr);
        padding: 13px;
    }

    .module-card img {
        width: 64px;
        height: 64px;
    }

    .learn-card {
        grid-template-rows: 150px minmax(0, 1fr) auto;
    }

    .option {
        min-height: 54px;
        padding: 10px 12px;
        font-size: 18px;
        line-height: 1.35;
    }

    .option input {
        inline-size: 22px;
        block-size: 22px;
    }

    .table {
        min-width: 680px;
    }

    .panel,
    .price-card,
    .question-card,
    #documentsList,
    #checkinHistory {
        overflow-x: auto;
    }

    .composer {
        grid-template-columns: 1fr;
    }

    .sticky-actions {
        bottom: 88px;
        justify-content: stretch;
    }

    .sticky-actions button {
        flex: 1;
    }

    .dangerous-symptoms-banner {
        padding: 5px 7px;
        max-height: 44px;
        padding: 3px 6px;
        font-size: 11px;
        line-height: 1.05;
    }

    .continue-relief-cta {
        right: 8px;
        left: 8px;
        bottom: 94px;
        max-width: none;
        min-height: 58px;
        padding: 12px;
        font-size: 17px;
        line-height: 1.25;
    }
}

@media (prefers-reduced-motion: no-preference) {
    .view.active,
    .home-hero,
    .panel,
    .module-card,
    .learn-card {
        animation: rise 180ms ease-out;
    }

    @keyframes rise {
        from { transform: translateY(6px); }
        to { transform: translateY(0); }
    }
}
