:root {
    color-scheme: light;
    --ink: oklch(22% 0.018 252);
    --ink-soft: oklch(43% 0.018 252);
    --paper: oklch(97.8% 0.006 245);
    --surface: oklch(100% 0.003 245);
    --surface-muted: oklch(94.5% 0.009 245);
    --line: oklch(85% 0.012 245);
    --line-strong: oklch(73% 0.018 245);
    --blue: oklch(50% 0.15 252);
    --blue-soft: oklch(92% 0.035 252);
    --green: oklch(48% 0.13 151);
    --orange: oklch(63% 0.15 58);
    --purple: oklch(54% 0.15 302);
    --red: oklch(55% 0.18 28);
    --space-2xs: 0.25rem;
    --space-xs: 0.5rem;
    --space-sm: 0.75rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;
    --space-3xl: 4rem;
    --radius-sm: 0.375rem;
    --radius-md: 0.625rem;
    --body-font: Aptos, "Helvetica Neue", sans-serif;
    --display-font: Bahnschrift, "DIN Alternate", "Arial Narrow", sans-serif;
}

* {
    box-sizing: border-box;
}

html {
    background: var(--paper);
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    color: var(--ink);
    background: var(--paper);
    font-family: var(--body-font);
    font-size: 1rem;
    line-height: 1.5;
}

button,
input,
textarea {
    font: inherit;
}

button,
a,
input,
textarea {
    -webkit-tap-highlight-color: transparent;
}

button {
    color: inherit;
}

[hidden] {
    display: none !important;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.eyebrow {
    margin: 0;
    color: var(--ink-soft);
    font-family: var(--display-font);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.13em;
}

h1,
h2,
p {
    margin-block: 0;
}

h1,
h2 {
    font-family: var(--display-font);
    font-weight: 650;
    letter-spacing: -0.025em;
}

h1 {
    font-size: 2rem;
    line-height: 1.1;
}

h2 {
    font-size: 1.5rem;
    line-height: 1.2;
}

/* Persistent daily signal */
.status-rail {
    --mode-color: var(--line-strong);
    --mode-tint: var(--surface-muted);
    position: sticky;
    z-index: 30;
    top: 0;
    border-bottom: 1px solid color-mix(in oklch, var(--mode-color) 45%, var(--line));
    background: var(--mode-tint);
}

.status-rail[data-mode="TAI_THAP"] {
    --mode-color: var(--orange);
    --mode-tint: oklch(94% 0.04 67);
}

.status-rail[data-mode="XAO_TRON"] {
    --mode-color: var(--purple);
    --mode-tint: oklch(94% 0.035 302);
}

.status-rail[data-mode="BINH_THUONG"] {
    --mode-color: var(--green);
    --mode-tint: oklch(94% 0.035 151);
}

.status-inner {
    display: grid;
    width: min(100%, 72rem);
    min-height: 5.75rem;
    margin-inline: auto;
    padding: var(--space-md) var(--space-md) var(--space-sm);
    gap: var(--space-sm);
}

.status-topline {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: var(--space-md);
}

.mode-heading {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: var(--space-xs);
}

.mode-signal {
    width: 0.625rem;
    height: 0.625rem;
    border-radius: 50%;
    background: var(--mode-color);
}

.mode-name {
    font-family: var(--display-font);
    font-size: 1.1rem;
    letter-spacing: 0.035em;
}

.core-summary {
    color: color-mix(in oklch, var(--mode-color) 72%, var(--ink));
    font-size: 0.82rem;
    white-space: nowrap;
}

.status-rail[data-core-done="1"] .core-summary {
    color: var(--green);
}

.save-state {
    min-width: 5.8rem;
    color: color-mix(in oklch, var(--mode-color) 68%, var(--ink));
    font-size: 0.76rem;
    font-weight: 650;
    text-align: right;
}

.save-state.is-saving {
    animation: save-pulse 1.1s ease-in-out infinite alternate;
}

.save-state.is-error {
    color: var(--red);
}

.core-requirements {
    display: grid;
    gap: var(--space-xs) var(--space-lg);
}

.core-requirement {
    display: grid;
    grid-template-columns: minmax(5rem, auto) minmax(0, 1fr) auto;
    align-items: baseline;
    padding-top: var(--space-xs);
    border-top: 1px solid color-mix(in oklch, var(--mode-color) 24%, var(--line));
    gap: var(--space-xs);
    color: var(--ink-soft);
    font-size: 0.76rem;
}

.core-requirement > span:first-child {
    color: var(--ink);
    font-weight: 700;
}

.core-requirement strong {
    color: var(--red);
    font-size: 0.74rem;
    text-align: right;
    white-space: nowrap;
}

.core-requirement strong[data-done="1"] {
    color: var(--green);
}

.core-branch-list {
    display: grid;
    grid-column: 1 / -1;
    gap: 0.18rem;
    padding-left: calc(5rem + var(--space-xs));
    color: var(--ink-soft);
    line-height: 1.35;
}

/* Main form */
.app-page {
    padding-bottom: calc(5.5rem + env(safe-area-inset-bottom));
}

.app-shell {
    width: min(100%, 72rem);
    margin-inline: auto;
    padding: var(--space-lg) var(--space-md) var(--space-3xl);
}

.page-meta {
    display: flex;
    align-items: end;
    justify-content: space-between;
    margin-bottom: var(--space-lg);
    gap: var(--space-md);
}

.page-meta > div {
    display: grid;
    gap: var(--space-2xs);
}

.page-actions {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

.quiet-link {
    display: inline-grid;
    min-height: 2.75rem;
    padding-inline: var(--space-sm);
    place-items: center;
    color: var(--blue);
    font-size: 0.85rem;
    font-weight: 700;
    text-decoration: none;
}

.quiet-button,
.secondary-button,
.clear-override,
.primary-button {
    min-height: 2.75rem;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    background: transparent;
    font-weight: 650;
    cursor: pointer;
    transition: background-color 120ms ease, border-color 120ms ease, transform 120ms ease;
}

.quiet-button {
    padding-inline: var(--space-sm);
    border-color: transparent;
    color: var(--ink-soft);
    font-size: 0.85rem;
}

.secondary-button {
    width: 100%;
    padding-inline: var(--space-md);
    background: color-mix(in oklch, var(--surface) 76%, var(--blue-soft));
}

.quiet-button:active,
.secondary-button:active,
.clear-override:active,
.primary-button:active {
    transform: translateY(1px);
}

.morning-panel {
    display: grid;
    padding: var(--space-lg);
    border: 1px solid color-mix(in oklch, var(--blue) 30%, var(--line));
    border-radius: var(--radius-md);
    background: var(--surface);
    gap: var(--space-lg);
}

.section-heading {
    display: flex;
    align-items: flex-start;
    gap: var(--space-sm);
}

.section-heading > div {
    display: grid;
    gap: var(--space-2xs);
}

.section-index {
    display: grid;
    place-items: center;
    width: 2rem;
    height: 2rem;
    border: 1px solid var(--line-strong);
    border-radius: 50%;
    color: var(--ink-soft);
    font-family: var(--display-font);
    font-size: 0.72rem;
    font-weight: 700;
}

.time-grid,
.metric-grid,
.study-layout {
    display: grid;
    gap: var(--space-md);
}

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

.field-group {
    display: grid;
    min-width: 0;
    gap: var(--space-xs);
}

.field-label {
    color: var(--ink-soft);
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.015em;
}

.text-input {
    width: 100%;
    min-width: 0;
    min-height: 3rem;
    padding: 0.7rem 0.75rem;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    outline: none;
    color: var(--ink);
    background: var(--surface);
    font-size: 1rem;
    line-height: 1.45;
    transition: border-color 120ms ease, background-color 120ms ease;
}

.text-input:hover {
    border-color: color-mix(in oklch, var(--blue) 45%, var(--line-strong));
}

.text-input:focus-visible,
button:focus-visible,
a:focus-visible,
.status-choice input:focus-visible + span,
.check-control input:focus-visible + .check-box {
    outline: 3px solid color-mix(in oklch, var(--blue) 52%, transparent);
    outline-offset: 2px;
}

.time-input {
    font-family: var(--display-font);
    font-size: 1.15rem;
    font-variant-numeric: tabular-nums;
}

.unit-input {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    overflow: hidden;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    background: var(--surface);
}

.unit-input:focus-within {
    outline: 3px solid color-mix(in oklch, var(--blue) 52%, transparent);
    outline-offset: 2px;
}

.unit-input .text-input {
    border: 0;
    border-radius: 0;
}

.unit-input .text-input:focus-visible {
    outline: none;
}

.unit-input > span {
    min-width: 3.4rem;
    padding-inline: var(--space-sm);
    color: var(--ink-soft);
    font-size: 0.82rem;
    font-weight: 650;
    text-align: right;
}

.manual-reveal,
.symptom-reveal {
    display: grid;
    gap: var(--space-sm);
}

.manual-reveal {
    padding: var(--space-md);
    border: 1px solid var(--blue);
    border-radius: var(--radius-sm);
    background: var(--blue-soft);
}

.override-note {
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: color-mix(in oklch, var(--blue) 72%, var(--ink));
    font-size: 0.8rem;
    font-weight: 650;
}

.clear-override {
    width: 2.75rem;
    padding: 0;
    border-color: transparent;
    font-size: 1rem;
}

.status-fieldset {
    display: grid;
    min-width: 0;
    padding: 0;
    border: 0;
    gap: var(--space-xs);
}

.status-options {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--space-xs);
}

.status-choice {
    position: relative;
    min-width: 0;
    cursor: pointer;
}

.status-choice input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.status-choice span {
    display: grid;
    place-items: center;
    min-height: 3.25rem;
    padding-inline: var(--space-xs);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    color: var(--ink-soft);
    background: var(--surface);
    font-family: var(--display-font);
    font-size: 0.8rem;
    font-weight: 700;
}

.status-choice input:checked + span {
    border-color: var(--ink);
    color: var(--surface);
    background: var(--ink);
}

.status-choice--sick input:checked + span {
    border-color: var(--red);
    background: var(--red);
}

.status-choice--event input:checked + span {
    border-color: var(--purple);
    background: var(--purple);
}

.status-guardrail {
    max-width: 38rem;
    color: var(--ink-soft);
    font-size: 0.76rem;
    line-height: 1.4;
}

.field-error,
.form-error {
    color: var(--red);
    font-size: 0.84rem;
    font-weight: 650;
}

.day-section {
    display: grid;
    padding-block: var(--space-2xl);
    border-bottom: 1px solid var(--line);
    gap: var(--space-lg);
    container-type: inline-size;
}

.compact-heading {
    align-items: center;
}

.compact-heading h2 {
    font-size: 1.25rem;
}

.check-control {
    display: flex;
    align-items: center;
    min-height: 3rem;
    gap: var(--space-sm);
    color: var(--ink);
    font-size: 0.9rem;
    font-weight: 650;
    cursor: pointer;
}

.check-control input {
    position: absolute;
    opacity: 0;
}

.check-box {
    display: grid;
    flex: 0 0 1.5rem;
    width: 1.5rem;
    height: 1.5rem;
    place-items: center;
    border: 1px solid var(--line-strong);
    border-radius: 0.25rem;
    background: var(--surface);
}

.check-control input:checked + .check-box {
    border-color: var(--blue);
    background: var(--blue);
}

.check-control input:checked + .check-box::after {
    color: var(--surface);
    content: "✓";
    font-size: 0.95rem;
    font-weight: 800;
    line-height: 1;
}

.german-field {
    gap: var(--space-sm);
}

.german-field > label {
    display: grid;
    gap: var(--space-xs);
}

.german-checks {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-xs) var(--space-sm);
}

.german-checks .check-control {
    align-items: start;
    font-size: 0.82rem;
    line-height: 1.35;
}

.auto-grow {
    min-height: 5.5rem;
    overflow: hidden;
    resize: none;
}

.notes-section {
    border-bottom: 0;
}

.notes-input {
    min-height: 9rem;
}

.future-notice {
    padding: var(--space-md);
    border: 1px solid color-mix(in oklch, var(--blue) 32%, var(--line));
    border-radius: var(--radius-sm);
    color: color-mix(in oklch, var(--blue) 72%, var(--ink));
    background: var(--blue-soft);
    font-size: 0.88rem;
    font-weight: 650;
    line-height: 1.5;
}

/* Mobile navigation */
.bottom-nav {
    position: fixed;
    z-index: 40;
    right: 0;
    bottom: 0;
    left: 0;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    min-height: calc(4.5rem + env(safe-area-inset-bottom));
    padding: 0.35rem max(var(--space-xs), env(safe-area-inset-right)) env(safe-area-inset-bottom) max(var(--space-xs), env(safe-area-inset-left));
    border-top: 1px solid var(--line);
    background: color-mix(in oklch, var(--surface) 96%, transparent);
}

.nav-item {
    display: grid;
    min-width: 0;
    min-height: 3.75rem;
    place-content: center;
    justify-items: center;
    gap: 0.15rem;
    border-radius: var(--radius-sm);
    color: var(--ink-soft);
    font-size: 0.72rem;
    font-weight: 650;
    text-decoration: none;
}

.nav-item svg {
    width: 1.35rem;
    height: 1.35rem;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
}

.nav-item.is-active {
    color: var(--blue);
    background: var(--blue-soft);
}

.nav-item.is-pending {
    opacity: 0.55;
}

/* Suggested day allocation */
.schedule-shell {
    width: min(100%, 52rem);
}

.schedule-header {
    align-items: end;
}

.schedule-date-label {
    margin-top: var(--space-xs);
    color: var(--ink-soft);
    font-size: 0.84rem;
    font-weight: 650;
}

.schedule-date-form {
    display: flex;
}

.schedule-date-input {
    width: 9.6rem;
    min-height: 2.75rem;
    padding-block: 0.45rem;
}

.schedule-principle {
    display: grid;
    gap: 0.2rem;
    padding: var(--space-md);
    border: 1px solid color-mix(in oklch, var(--blue) 28%, var(--line));
    border-radius: var(--radius-sm);
    background: var(--blue-soft);
    font-size: 0.9rem;
}

.schedule-principle span {
    color: var(--ink-soft);
}

.schedule-reminder {
    padding: var(--space-sm) var(--space-md);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    color: var(--ink-soft);
    background: var(--surface);
    font-size: 0.86rem;
    font-weight: 650;
}

.schedule-list {
    display: grid;
    gap: var(--space-sm);
}

.schedule-block {
    position: relative;
    display: grid;
    grid-template-columns: 7.2rem minmax(0, 1fr) 2rem;
    width: 100%;
    min-height: 5.25rem;
    overflow: hidden;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-md);
    text-align: left;
    cursor: pointer;
}

.schedule-block--incomplete {
    background: linear-gradient(
        90deg,
        var(--surface-muted) 0 var(--fill),
        var(--surface) var(--fill) 100%
    );
    box-shadow: 0 0.3rem 1rem color-mix(in oklch, var(--ink) 9%, transparent);
}

.schedule-block--complete,
.schedule-block--not_required {
    border-color: var(--line);
    color: var(--ink-soft);
    background: var(--surface-muted);
    box-shadow: none;
}

.schedule-block:focus-visible {
    outline: 3px solid color-mix(in oklch, var(--blue) 42%, transparent);
    outline-offset: 2px;
}

.schedule-block:disabled {
    cursor: not-allowed;
    opacity: 0.65;
}

.schedule-block__time {
    color: var(--ink-soft);
    font-family: var(--display-font);
    font-size: 0.78rem;
    font-weight: 650;
    letter-spacing: 0.025em;
}

.schedule-block__body {
    display: grid;
    min-width: 0;
    gap: 0.22rem;
}

.schedule-block__body strong {
    font-size: 1rem;
}

.schedule-block__body span {
    color: var(--ink-soft);
    font-size: 0.82rem;
}

.schedule-block--incomplete .schedule-block__body strong {
    color: var(--ink);
    font-weight: 750;
}

.schedule-block__check {
    color: var(--green);
    font-size: 1.25rem;
    font-weight: 800;
    text-align: center;
}

.schedule-block__action {
    color: var(--blue);
    font-size: 1.6rem;
    line-height: 1;
    text-align: center;
}

.schedule-dialog {
    width: min(calc(100% - 2rem), 30rem);
    padding: 0;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-md);
    color: var(--ink);
    background: var(--surface);
    box-shadow: 0 1.25rem 3rem color-mix(in oklch, var(--ink) 24%, transparent);
}

.schedule-dialog::backdrop {
    background: color-mix(in oklch, var(--ink) 42%, transparent);
}

.schedule-dialog__body {
    display: grid;
    gap: var(--space-lg);
    padding: var(--space-lg);
}

.schedule-dialog__time {
    margin-bottom: var(--space-xs);
    color: var(--ink-soft);
    font-family: var(--display-font);
    font-size: 0.78rem;
    font-weight: 700;
}

.schedule-dialog__message {
    color: var(--ink-soft);
}

.schedule-dialog__check {
    min-height: 3.5rem;
    padding: var(--space-sm);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
}

.schedule-dialog__actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: var(--space-sm);
}

.primary-link {
    display: inline-flex;
    min-height: 2.75rem;
    align-items: center;
    justify-content: center;
    padding: 0.65rem 1rem;
    border-radius: var(--radius-sm);
    color: var(--surface);
    background: var(--blue);
    font-weight: 700;
    text-decoration: none;
}

@media (max-width: 36rem) {
    .schedule-header {
        align-items: start;
    }

    .schedule-header .page-actions {
        width: 100%;
        justify-content: space-between;
    }

    .schedule-block {
        grid-template-columns: minmax(0, 1fr) 1.75rem;
        gap: var(--space-xs) var(--space-sm);
    }

    .schedule-block__time {
        grid-column: 1 / -1;
    }

    .schedule-dialog {
        margin-bottom: max(1rem, env(safe-area-inset-bottom));
    }
}

/* Login */
.login-page {
    display: grid;
    min-height: 100svh;
    place-items: center;
    padding: var(--space-lg);
}

.login-shell {
    display: grid;
    width: min(100%, 26rem);
    gap: var(--space-md);
}

.login-mark {
    display: flex;
    width: 3rem;
    height: 2rem;
    align-items: end;
    gap: 0.25rem;
}

.login-mark span {
    width: 0.5rem;
    background: var(--blue);
}

.login-mark span:nth-child(1) {
    height: 45%;
}

.login-mark span:nth-child(2) {
    height: 75%;
}

.login-mark span:nth-child(3) {
    height: 100%;
}

.login-shell h1 {
    margin-top: var(--space-xs);
    font-size: 2.5rem;
}

.login-intro {
    max-width: 28ch;
    color: var(--ink-soft);
}

.login-form {
    display: grid;
    margin-top: var(--space-lg);
    gap: var(--space-sm);
}

/* Reading screens: rules and history */
.reading-page {
    background: var(--surface);
}

.reading-page .app-shell {
    padding-top: var(--space-xl);
}

.page-meta--reading {
    padding-bottom: var(--space-lg);
    border-bottom: 1px solid var(--line);
}

.reading-heading {
    display: grid;
    gap: var(--space-xs);
}

.reading-heading--compact h2 {
    font-size: 1.25rem;
}

.pinned-rules {
    display: grid;
    padding-block: var(--space-xl) var(--space-2xl);
    gap: var(--space-lg);
}

.pinned-rule-grid {
    display: grid;
    gap: var(--space-md);
}

.rule-card {
    display: grid;
    min-width: 0;
    gap: var(--space-md);
}

.rule-card--pinned {
    padding: var(--space-lg);
    border: 1px solid color-mix(in oklch, var(--blue) 42%, var(--line));
    border-radius: var(--radius-md);
    background: color-mix(in oklch, var(--blue-soft) 38%, var(--surface));
}

.rule-number {
    display: grid;
    width: 2.25rem;
    height: 2.25rem;
    place-items: center;
    border: 1px solid var(--line-strong);
    border-radius: 50%;
    color: var(--ink-soft);
    font-family: var(--display-font);
    font-size: 0.72rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.rule-statement,
.rule-row-copy {
    display: grid;
    gap: var(--space-sm);
}

.rule-condition,
.rule-action {
    display: grid;
    max-width: 65ch;
    gap: 0.2rem;
    line-height: 1.45;
}

.rule-condition {
    font-size: 1.05rem;
    font-weight: 650;
}

.rule-action {
    color: var(--ink);
}

.rule-condition > span,
.rule-action > span,
.rule-protects > span {
    color: var(--blue);
    font-family: var(--display-font);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.11em;
}

.rule-arrow {
    color: var(--blue);
    font-family: var(--display-font);
    font-size: 1.2rem;
    line-height: 1;
}

.rule-protects {
    display: grid;
    max-width: 65ch;
    gap: 0.2rem;
    color: var(--ink-soft);
    font-size: 0.78rem;
    line-height: 1.45;
}

.rule-protects > span {
    color: var(--ink-soft);
    letter-spacing: 0.06em;
}

.other-rules {
    display: grid;
    gap: var(--space-md);
}

.rule-list {
    display: grid;
    padding: 0;
    margin: 0;
    list-style: none;
}

.rule-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    padding-block: var(--space-lg);
    border-bottom: 1px solid var(--line);
    gap: var(--space-md);
}

.rule-row:first-child {
    border-top: 1px solid var(--line);
}

.rule-row .rule-condition {
    font-size: 0.98rem;
}

.rule-row .rule-action {
    font-size: 0.9rem;
}

.history-shell {
    width: min(100%, 86rem);
}

.advance-declarations {
    display: grid;
    padding-block: var(--space-lg);
    border-block: 1px solid var(--line);
    gap: var(--space-md);
}

.advance-declarations h2 {
    margin-top: 0.2rem;
    font-size: 1.25rem;
}

.future-date-list {
    display: flex;
    padding-bottom: var(--space-xs);
    gap: var(--space-xs);
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scrollbar-width: thin;
}

.future-date-link {
    display: grid;
    flex: 0 0 6.5rem;
    min-height: 3.5rem;
    align-content: center;
    padding: var(--space-xs) var(--space-sm);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    gap: 0.15rem;
    color: var(--ink);
    background: var(--surface);
    text-decoration: none;
}

.future-date-link:hover,
.future-date-link:focus-visible {
    border-color: var(--blue);
    outline: none;
    background: var(--blue-soft);
}

.future-date-link strong {
    color: var(--blue);
    font-family: var(--display-font);
    font-size: 0.9rem;
    font-variant-numeric: tabular-nums;
}

.future-date-link span {
    color: var(--ink-soft);
    font-size: 0.7rem;
}

.history-table-wrap {
    overflow-x: auto;
    overscroll-behavior-inline: contain;
}

.history-table {
    width: 100%;
    min-width: 64rem;
    border-collapse: collapse;
    font-size: 0.84rem;
}

.history-table th {
    padding: var(--space-sm) var(--space-xs);
    border-bottom: 1px solid var(--line-strong);
    color: var(--ink-soft);
    font-family: var(--display-font);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-align: left;
    white-space: nowrap;
}

.history-table td {
    max-width: 14rem;
    padding: var(--space-md) var(--space-xs);
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}

.history-table tbody tr {
    cursor: pointer;
    transition: background-color 120ms ease;
}

.history-table tbody tr:hover,
.history-table tbody tr:focus-visible {
    outline: none;
    background: var(--blue-soft);
}

.history-date {
    color: var(--blue);
    font-family: var(--display-font);
    font-size: 0.92rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    text-decoration: none;
}

.numeric-cell {
    font-variant-numeric: tabular-nums;
}

.mode-chip {
    display: inline-flex;
    min-height: 1.75rem;
    align-items: center;
    padding-inline: var(--space-xs);
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    color: var(--ink-soft);
    background: var(--surface-muted);
    font-size: 0.72rem;
    font-weight: 700;
    white-space: nowrap;
}

.mode-chip[data-mode="TAI_THAP"] {
    border-color: color-mix(in oklch, var(--orange) 44%, var(--line));
    color: color-mix(in oklch, var(--orange) 76%, var(--ink));
    background: oklch(94% 0.04 67);
}

.mode-chip[data-mode="XAO_TRON"] {
    border-color: color-mix(in oklch, var(--purple) 44%, var(--line));
    color: color-mix(in oklch, var(--purple) 76%, var(--ink));
    background: oklch(94% 0.035 302);
}

.mode-chip[data-mode="BINH_THUONG"] {
    border-color: color-mix(in oklch, var(--green) 44%, var(--line));
    color: color-mix(in oklch, var(--green) 76%, var(--ink));
    background: oklch(94% 0.035 151);
}

.output-preview {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.core-cell span {
    display: grid;
    width: 1.75rem;
    height: 1.75rem;
    place-items: center;
    border-radius: 50%;
    color: var(--surface);
    background: var(--green);
    font-weight: 800;
}

.empty-state {
    display: grid;
    width: min(100%, 28rem);
    padding-block: var(--space-3xl);
    gap: var(--space-md);
}

.empty-state-link {
    display: inline-grid;
    width: fit-content;
    min-width: 10rem;
    place-items: center;
    color: var(--ink);
    text-decoration: none;
}

.login-input {
    min-height: 3.5rem;
    font-size: 1.125rem;
}

.primary-button {
    min-height: 3.5rem;
    margin-top: var(--space-xs);
    border-color: var(--blue);
    color: var(--surface);
    background: var(--blue);
}

@container (min-width: 38rem) {
    .metric-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .metric-grid--three {
        align-items: end;
    }

    .study-layout {
        grid-template-columns: minmax(10rem, 0.34fr) minmax(0, 1fr);
        align-items: start;
    }
}

@media (min-width: 48rem) {
    .status-inner {
        padding-inline: var(--space-xl);
    }

    .core-requirements {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .app-shell {
        padding: var(--space-xl) var(--space-xl) 6rem;
    }

    .morning-panel {
        grid-template-columns: minmax(10rem, 0.58fr) minmax(18rem, 1fr);
        align-items: start;
        padding: var(--space-xl);
        column-gap: var(--space-2xl);
    }

    .morning-panel .section-heading {
        grid-row: 1 / span 5;
    }

    .manual-toggle {
        width: fit-content;
    }

    .day-section {
        grid-template-columns: minmax(10rem, 0.58fr) minmax(18rem, 1fr);
        column-gap: var(--space-2xl);
    }

    .day-section > :not(.section-heading) {
        grid-column: 2;
    }

    .day-section > .section-heading {
        grid-row: 1 / span 2;
    }

    .bottom-nav {
        right: var(--space-xl);
        bottom: var(--space-md);
        left: 50%;
        width: min(31rem, calc(100% - 2rem));
        min-height: 4.25rem;
        padding: 0.3rem;
        border: 1px solid var(--line);
        border-radius: var(--radius-md);
        transform: translateX(-50%);
    }

    .pinned-rule-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .rule-card--pinned {
        grid-template-rows: auto 1fr auto;
    }

    .rules-shell {
        width: min(100%, 76rem);
    }
}

@media (max-width: 47.99rem) {
    .history-table-wrap {
        overflow: visible;
    }

    .history-table,
    .history-table tbody {
        display: block;
        min-width: 0;
    }

    .history-table thead {
        display: none;
    }

    .history-table tbody {
        border-top: 1px solid var(--line);
    }

    .history-table tr {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        padding-block: var(--space-md);
        border-bottom: 1px solid var(--line);
        gap: var(--space-sm) var(--space-md);
    }

    .history-table td {
        display: grid;
        max-width: none;
        padding: 0;
        border: 0;
        gap: 0.1rem;
    }

    .history-table td::before {
        color: var(--ink-soft);
        content: attr(data-label);
        font-family: var(--display-font);
        font-size: 0.64rem;
        font-weight: 700;
        letter-spacing: 0.06em;
    }

    .history-table td:nth-child(4),
    .history-table td:nth-child(6) {
        grid-column: 1 / -1;
    }

    .history-table td:nth-child(7) {
        align-content: start;
    }

    .output-preview {
        max-width: 100%;
    }
}

@media (max-width: 22rem) {
    .status-inner,
    .app-shell {
        padding-inline: var(--space-sm);
    }

    .morning-panel {
        padding: var(--space-md);
    }

    .mode-name {
        font-size: 0.96rem;
    }

    .status-options {
        grid-template-columns: 1fr;
    }

    .german-checks {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 30rem) {
    .status-topline {
        grid-template-columns: minmax(0, 1fr) auto;
        gap: var(--space-xs);
    }

    .core-summary {
        grid-row: 2;
        grid-column: 1 / -1;
    }

    .save-state {
        grid-row: 1;
        grid-column: 2;
        max-width: 9.5rem;
        line-height: 1.25;
        white-space: normal;
    }

    .core-branch-list {
        padding-left: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}

@keyframes save-pulse {
    from { opacity: 0.48; }
    to { opacity: 1; }
}

/* UI refresh — approved Tiimo-inspired palette with Structured-style typography. */
@font-face {
    font-family: "Inter Variable";
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url("inter-latin-ext-wght-normal.woff2") format("woff2-variations");
}

:root {
    --ink: #262725;
    --ink-soft: #6f716c;
    --paper: #f3f2ed;
    --surface: #fffefa;
    --surface-muted: #f6f5f0;
    --line: rgb(41 42 39 / 10%);
    --line-strong: rgb(41 42 39 / 16%);
    --blue: #4f75aa;
    --blue-soft: #dce9ff;
    --green: #27785b;
    --orange: #a27322;
    --purple: #6858d9;
    --red: #b65345;
    --lilac: #e2ddff;
    --lilac-soft: #f1efff;
    --mint: #dff3e7;
    --peach: #f8ded3;
    --yellow: #f6e6a8;
    --body-font: "Inter Variable", Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --display-font: var(--body-font);
    --shadow: 0 18px 54px rgb(50 48 43 / 8%);
    --shadow-soft: 0 8px 26px rgb(50 48 43 / 6%);
}

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

body {
    min-width: 20rem;
    background:
        radial-gradient(circle at 94% 5%, rgb(213 207 255 / 42%), transparent 24rem),
        radial-gradient(circle at 22% 92%, rgb(255 222 194 / 28%), transparent 28rem),
        var(--paper);
    font-family: var(--body-font);
    font-size: 16px;
    line-height: 1.5;
}

.app-page {
    min-height: 100vh;
    padding-bottom: 0;
}

.app-shell {
    width: auto;
    max-width: 1500px;
    margin: 0 auto 0 258px;
    padding: 34px clamp(28px, 4vw, 68px) 64px;
}

.page-meta {
    align-items: flex-end;
    margin-bottom: 26px;
}

.date-line,
.login-kicker {
    margin: 0 0 7px;
    color: var(--ink-soft);
    font-size: 14px;
    font-weight: 520;
    letter-spacing: 0;
    text-transform: none;
}

.page-meta h1 {
    margin: 0;
    font-size: clamp(36px, 3.6vw, 56px);
    font-weight: 720;
    letter-spacing: -0.055em;
    line-height: 0.98;
}

.heading-copy {
    max-width: 44rem;
    margin: 12px 0 0;
    color: var(--ink-soft);
    font-size: 16px;
    line-height: 1.5;
}

.quiet-button,
.quiet-link,
.secondary-button,
.primary-link,
.primary-button {
    min-height: 44px;
    border-radius: 13px;
    font-size: 14px;
    font-weight: 650;
    letter-spacing: 0;
}

.quiet-button,
.quiet-link,
.secondary-button {
    border: 1px solid var(--line-strong);
    background: rgb(255 255 255 / 68%);
    color: var(--ink-soft);
    box-shadow: var(--shadow-soft);
}

.primary-button,
.primary-link {
    border: 0;
    background: var(--ink);
    color: white;
}

/* Navigation: rail on desktop, segmented control on tablet, bottom bar on mobile. */
.bottom-nav {
    position: fixed;
    z-index: 50;
    inset: 18px auto 18px 18px;
    display: flex;
    width: 222px;
    height: auto;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 6px;
    padding: 108px 16px 16px;
    border: 1px solid rgb(255 255 255 / 84%);
    border-radius: 28px;
    background: rgb(255 254 250 / 82%);
    box-shadow: var(--shadow);
    backdrop-filter: blur(20px);
}

.bottom-nav::before {
    position: absolute;
    top: 20px;
    left: 16px;
    display: grid;
    width: 40px;
    height: 40px;
    place-items: center;
    border-radius: 14px;
    background: var(--lilac);
    color: #4f43ad;
    content: "30";
    font-size: 14px;
    font-weight: 750;
}

.bottom-nav::after {
    position: absolute;
    top: 22px;
    left: 68px;
    color: var(--ink);
    content: "Hệ mục tiêu\A 30 tháng";
    font-size: 16px;
    font-weight: 720;
    line-height: 1.4;
    white-space: pre;
}

.nav-item {
    display: grid;
    width: 100%;
    min-height: 48px;
    grid-template-columns: 34px 1fr;
    align-items: center;
    justify-content: stretch;
    gap: 9px;
    padding: 6px 12px 6px 7px;
    border-radius: 15px;
    color: var(--ink-soft);
    font-size: 16px;
    font-weight: 580;
    text-align: left;
}

.nav-item svg {
    width: 32px;
    height: 32px;
    padding: 8px;
    border-radius: 11px;
    background: rgb(41 42 39 / 4%);
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
}

.nav-item.is-active {
    background: var(--lilac);
    color: #4f43ad;
}

.nav-item.is-active svg {
    background: rgb(255 255 255 / 62%);
}

/* Daily status and form. */
.status-rail {
    position: relative;
    z-index: 1;
    top: auto;
    margin: 0 0 18px;
    overflow: hidden;
    border: 1px solid rgb(104 88 217 / 10%);
    border-radius: 26px;
    background: linear-gradient(135deg, #f8e7ae, #f7dcc4 62%, #e8e3ff);
    box-shadow: var(--shadow-soft);
}

.status-inner {
    width: auto;
    min-height: 0;
    padding: 22px 26px;
    gap: 16px;
}

.status-topline {
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 16px;
}

.mode-name {
    font-size: 16px;
    letter-spacing: 0;
}

.core-summary,
.save-state {
    font-size: 14px;
}

.core-requirements {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.core-requirement {
    min-width: 0;
    grid-template-columns: 1fr auto;
    padding: 12px 14px;
    border: 1px solid rgb(255 255 255 / 70%);
    border-radius: 16px;
    background: rgb(255 255 255 / 58%);
    color: var(--ink-soft);
    font-size: 14px;
    line-height: 1.35;
}

.core-requirement > span:nth-child(2) {
    grid-column: 1 / -1;
    overflow: hidden;
    text-overflow: ellipsis;
}

.core-requirement strong {
    grid-row: 1;
    grid-column: 2;
    font-size: 14px;
}

.core-branch-list {
    grid-column: 1 / -1;
    padding-left: 0;
    font-size: 14px;
}

#todayForm {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.morning-panel,
.day-section,
.advance-declarations,
.history-table-wrap,
.schedule-list,
.pinned-rules,
.other-rules {
    border: 1px solid rgb(255 255 255 / 86%);
    border-radius: 26px;
    background: rgb(255 254 250 / 86%);
    box-shadow: var(--shadow-soft);
}

.morning-panel,
.day-section {
    margin: 0;
    padding: clamp(22px, 2.4vw, 32px);
}

.morning-panel,
#todayForm > .day-section[aria-labelledby="studyHeading"],
#todayForm > .day-section[aria-labelledby="workHeading"],
#todayForm > .day-section[aria-labelledby="otherHeading"],
#todayForm > .notes-section,
#todayForm > .future-notice {
    grid-column: 1 / -1;
}

.section-heading {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr);
    align-items: center;
    margin-bottom: 0;
    gap: 14px;
}

.section-heading h2 {
    font-size: 22px;
    font-weight: 690;
    letter-spacing: -0.035em;
}

.section-index {
    display: grid;
    width: 44px;
    height: 44px;
    place-items: center;
    border-radius: 15px;
    background: var(--lilac-soft);
    color: #4f43ad;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0;
}

.section-icon--sleep { background: var(--blue-soft); color: #406aa2; font-size: 20px; }
.section-icon--core { background: var(--mint); color: var(--green); font-size: 20px; }
.section-icon--english { background: var(--lilac-soft); }
.section-icon--german { background: #eef4ff; color: #4f75aa; }
.section-icon--work { background: #fdf0ea; color: #9a5844; }
.section-icon--other { background: #fff8dc; color: #9c7621; font-size: 20px; }
.section-icon--notes { background: #edf7f1; color: var(--green); font-size: 18px; }

.time-grid,
.study-layout,
.metric-grid {
    gap: 14px;
}

.field-group {
    gap: 8px;
}

.field-label,
.status-fieldset legend {
    color: #555952;
    font-size: 14px;
    font-weight: 640;
    letter-spacing: 0;
}

.text-input,
.unit-input,
.schedule-date-input {
    min-height: 50px;
    border: 1px solid var(--line-strong);
    border-radius: 13px;
    background: rgb(255 255 255 / 78%);
    color: var(--ink);
    font-size: 16px;
}

.text-input:focus,
.unit-input:focus-within {
    border-color: rgb(104 88 217 / 55%);
    box-shadow: 0 0 0 4px rgb(104 88 217 / 8%);
}

.unit-input .text-input {
    border: 0;
    box-shadow: none;
}

.unit-input > span,
.override-note,
.status-guardrail,
.field-error,
.form-error {
    font-size: 14px;
}

.status-options {
    gap: 6px;
    padding: 5px;
    border: 0;
    border-radius: 15px;
    background: #efeee9;
}

.status-choice {
    min-height: 44px;
    border: 0;
    border-radius: 11px;
    background: transparent;
    font-size: 16px;
}

.status-choice:has(input:checked) {
    background: var(--surface);
    color: #4f43ad;
    box-shadow: 0 3px 10px rgb(50 48 43 / 8%);
}

.check-control {
    min-height: 50px;
    border-radius: 13px;
    background: var(--surface-muted);
    font-size: 16px;
}

.future-notice,
.schedule-reminder {
    margin: 0;
    padding: 16px 18px;
    border: 1px solid rgb(215 108 84 / 10%);
    border-radius: 18px;
    background: #fff3ed;
    color: #805d52;
    font-size: 14px;
}

/* Schedule. */
.schedule-shell {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    align-items: start;
    gap: 18px;
}

.schedule-header,
.week-strip {
    grid-column: 1 / -1;
}

.schedule-header {
    margin-bottom: 0;
}

.schedule-date-label {
    color: var(--ink-soft);
    font-size: 14px;
}

.schedule-date-input {
    min-width: 165px;
    box-shadow: var(--shadow-soft);
}

.week-strip {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 8px;
    margin: 0;
}

.week-strip a {
    display: flex;
    min-height: 64px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    border: 1px solid rgb(255 255 255 / 78%);
    border-radius: 17px;
    background: rgb(255 254 250 / 66%);
    color: var(--ink-soft);
    text-decoration: none;
}

.week-strip a strong { font-size: 16px; }
.week-strip a span { font-size: 14px; }
.week-strip a.is-active { border-color: rgb(104 88 217 / 15%); background: var(--lilac); color: #4f43ad; box-shadow: var(--shadow-soft); }

.schedule-list {
    position: relative;
    grid-row: 3 / span 8;
    padding: 20px 24px;
    overflow: hidden;
}

.schedule-principle {
    grid-column: 2;
    margin: 0;
    padding: 24px;
    border: 0;
    border-radius: 26px;
    background: var(--mint);
    box-shadow: var(--shadow-soft);
}

.schedule-principle strong {
    font-size: 20px;
    letter-spacing: -0.025em;
}

.schedule-principle span,
.schedule-reminder {
    font-size: 14px;
    line-height: 1.55;
}

.schedule-shell > .schedule-reminder {
    grid-column: 2;
}

.schedule-block {
    min-height: 76px;
    grid-template-columns: 92px minmax(0, 1fr) 38px;
    margin: 0;
    padding: 10px 10px;
    border: 0;
    border-bottom: 1px solid var(--line);
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.schedule-block:last-child { border-bottom: 0; }
.schedule-block--incomplete,
.schedule-block--partial { background: transparent; }
.schedule-block--not_required { opacity: 0.48; }
.schedule-block--partial { margin-block: 2px; border-radius: 16px; background: var(--lilac-soft); }
.schedule-block--complete { background: rgb(223 243 231 / 55%); }
.schedule-block__time { font-size: 14px; font-weight: 680; }
.schedule-block__body strong { font-size: 16px; }
.schedule-block__body span { color: var(--ink-soft); font-size: 14px; }
.schedule-block__action,
.schedule-block__check { width: 34px; height: 34px; border-radius: 11px; font-size: 16px; }

.schedule-dialog {
    border: 0;
    border-radius: 24px;
    background: var(--surface);
    box-shadow: 0 24px 80px rgb(40 38 34 / 24%);
}

.schedule-dialog__time,
.schedule-dialog__message,
.schedule-dialog__check,
.schedule-dialog__actions { font-size: 14px; }

/* History. */
.metric-bento {
    display: grid;
    grid-template-columns: 1.25fr 1fr 1fr;
    gap: 14px;
    margin-bottom: 16px;
}

.metric-card {
    position: relative;
    display: flex;
    min-height: 154px;
    flex-direction: column;
    overflow: hidden;
    padding: 22px;
    border: 1px solid rgb(255 255 255 / 68%);
    border-radius: 24px;
    box-shadow: var(--shadow-soft);
}

.metric-card::after {
    position: absolute;
    right: -35px;
    bottom: -55px;
    width: 150px;
    height: 150px;
    border: 22px solid rgb(255 255 255 / 30%);
    border-radius: 50%;
    content: "";
}

.metric-card--mint { background: var(--mint); }
.metric-card--lilac { background: var(--lilac); }
.metric-card--peach { background: var(--peach); }
.metric-card > span { color: var(--ink-soft); font-size: 14px; }
.metric-card > strong { margin-top: 13px; font-size: 34px; font-weight: 710; letter-spacing: -0.05em; }
.metric-card strong small { color: var(--ink-soft); font-size: 14px; font-weight: 540; letter-spacing: 0; }
.metric-card p { position: relative; z-index: 1; margin: auto 0 0; color: var(--ink-soft); font-size: 14px; }

.advance-declarations {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 16px;
    padding: 22px 24px;
}

.advance-declarations h2 { font-size: 20px; }
.advance-declarations > div:first-child p { margin-top: 5px; color: var(--ink-soft); font-size: 14px; }
.future-date-list { gap: 7px; overflow-x: auto; }
.future-date-link { min-width: 52px; min-height: 58px; border-radius: 13px; background: #f8f7f2; font-size: 14px; }
.future-date-link strong { font-size: 16px; }
.future-date-link span { font-size: 14px; }

.history-table-wrap { overflow: hidden; }
.history-table { min-width: 980px; }
.history-table thead { background: rgb(243 242 237 / 72%); }
.history-table th { color: var(--ink-soft); font-size: 14px; font-weight: 650; }
.history-table td { height: 70px; font-size: 16px; }
.history-table tbody tr:hover { background: rgb(255 255 255 / 64%); }
.history-date { color: var(--purple); font-size: 16px; font-weight: 680; }
.mode-chip { padding: 5px 8px; border-radius: 999px; font-size: 14px; }
.output-preview { font-size: 16px; }

/* Rules remain available as an unlinked reference page. */
.rules-shell .eyebrow,
.reading-heading .eyebrow { font-size: 14px; letter-spacing: 0.04em; }
.pinned-rules,
.other-rules { padding: 24px; }
.rule-card,
.rule-row { border-radius: 18px; font-size: 16px; }
.rule-number,
.rule-condition span,
.rule-action span,
.rule-protects span { font-size: 14px; }

/* Login. */
.login-page {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 24px;
}

.login-shell {
    width: min(100%, 470px);
    padding: clamp(28px, 5vw, 48px);
    border: 1px solid rgb(255 255 255 / 88%);
    border-radius: 30px;
    background: rgb(255 254 250 / 86%);
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
}

.login-mark {
    width: 52px;
    height: 52px;
    margin-bottom: 24px;
    border-radius: 17px;
    background: var(--lilac);
}

.login-shell h1 {
    font-size: clamp(36px, 8vw, 48px);
    font-weight: 720;
    letter-spacing: -0.055em;
}

.login-intro { margin-top: 12px; color: var(--ink-soft); font-size: 16px; }
.login-form { margin-top: 28px; gap: 12px; }
.login-input { font-size: 16px; }
.login-form .primary-button { margin-top: 8px; min-height: 52px; font-size: 16px; }

/* Keep the smallest interface copy readable across every layout. */
.bottom-nav { transform: none; }
.eyebrow,
.empty-state .eyebrow { font-size: 14px; }
.status-choice span { font-size: 16px; }
.empty-state p { font-size: 16px; }

@media (max-width: 1239px) {
    .bottom-nav { width: 80px; padding-inline: 12px; }
    .bottom-nav::after,
    .nav-item span { display: none; }
    .bottom-nav::before { left: 19px; }
    .nav-item { grid-template-columns: 1fr; padding-inline: 5px; }
    .nav-item svg { margin: 0 auto; }
    .app-shell { margin-left: 116px; padding-inline: 28px; }
    .schedule-shell { grid-template-columns: minmax(0, 1fr) 285px; }
    .core-requirements { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .day-section { grid-template-columns: 1fr; }
    .day-section > .section-heading,
    .day-section > :not(.section-heading) { grid-column: 1; }
    .day-section > .section-heading { grid-row: auto; }
}

@media (max-width: 899px) {
    .app-page { padding-bottom: 0; }
    .app-shell,
    .reading-page .app-shell { margin-left: 0; padding: 168px 24px 64px; }
    .bottom-nav {
        inset: 86px auto auto 24px;
        width: auto;
        height: 54px;
        flex-direction: row;
        padding: 5px;
        border-radius: 16px;
    }
    .bottom-nav::before,
    .bottom-nav::after { display: none; }
    .nav-item { width: auto; min-width: 92px; min-height: 42px; grid-template-columns: auto 1fr; padding: 0 14px; font-size: 14px; }
    .nav-item span { display: inline; }
    .nav-item svg { width: 26px; height: 26px; padding: 6px; }
    #todayForm { grid-template-columns: 1fr; }
    #todayForm > .day-section,
    .morning-panel,
    #todayForm > .future-notice { grid-column: 1; }
    .schedule-shell { grid-template-columns: 1fr 1fr; }
    .schedule-header,
    .week-strip,
    .schedule-list { grid-column: 1 / -1; }
    .schedule-list { grid-row: auto; }
    .schedule-principle,
    .schedule-shell > .schedule-reminder { grid-column: auto; }
    .metric-bento { grid-template-columns: 1.2fr 1fr 1fr; }
    .history-table-wrap { overflow-x: auto; }
}

@media (max-width: 599px) {
    .app-shell,
    .reading-page .app-shell { padding: 20px 13px 108px; }
    .page-meta { align-items: flex-start; gap: 12px; margin-bottom: 20px; }
    .page-meta h1 { font-size: 34px; }
    .heading-copy { margin-top: 9px; font-size: 16px; }
    .page-actions { flex-direction: column; align-items: flex-end; }
    .quiet-button,
    .quiet-link { min-height: 40px; padding-inline: 10px; }
    .bottom-nav {
        inset: auto 10px 10px;
        display: grid;
        width: auto;
        height: auto;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 4px;
        overflow: hidden;
        padding: 5px;
        border-radius: 19px;
        background: rgb(255 254 250 / 90%);
    }
    .nav-item { display: flex; width: 100%; min-width: 0; max-width: 100%; min-height: 58px; flex-direction: column; gap: 2px; overflow: hidden; padding: 4px; border-radius: 14px; font-size: clamp(11px, 3.5vw, 14px); text-align: center; }
    .nav-item span { max-width: 100%; overflow: hidden; white-space: nowrap; }
    .nav-item svg { width: 25px; height: 25px; padding: 5px; background: transparent; }
    .status-inner { padding: 18px 16px; }
    .status-topline { grid-template-columns: minmax(0, 1fr) auto; }
    .mode-heading { grid-row: 1; grid-column: 1; }
    .core-summary { grid-row: 2; grid-column: 1; }
    .save-state { grid-row: 1 / span 2; grid-column: 2; align-self: center; max-width: 128px; text-align: right; }
    .core-requirements { grid-template-columns: 1fr; }
    .morning-panel,
    .day-section { padding: 20px 16px; border-radius: 22px; }
    .section-heading { grid-template-columns: 40px 1fr; gap: 11px; }
    .section-index { width: 40px; height: 40px; border-radius: 14px; }
    .time-grid,
    .study-layout,
    .metric-grid,
    .metric-grid--three { grid-template-columns: 1fr; }
    .status-options { grid-template-columns: 1fr; }
    .schedule-shell { display: grid; grid-template-columns: 1fr; padding-top: 20px; }
    .schedule-header,
    .week-strip,
    .schedule-list,
    .schedule-principle,
    .schedule-shell > .schedule-reminder { grid-column: 1; }
    .schedule-date-form { align-items: flex-end; flex-direction: column; }
    .schedule-date-input { min-width: 142px; }
    .week-strip { display: flex; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
    .week-strip::-webkit-scrollbar { display: none; }
    .week-strip a { min-width: 64px; }
    .schedule-list { padding: 13px 12px; border-radius: 22px; }
    .schedule-block { min-height: 80px; grid-template-columns: minmax(0, 1fr) 34px; gap: 8px 12px; padding: 16px; }
    .schedule-block__time { grid-row: 1; grid-column: 1 / -1; }
    .schedule-block__body { grid-row: 2; grid-column: 1; }
    .schedule-block__action,
    .schedule-block__check { grid-row: 2; grid-column: 2; }
    .schedule-principle { border-radius: 22px; }
    .metric-bento { grid-template-columns: 1fr 1fr; }
    .metric-card { min-height: 140px; padding: 18px; border-radius: 21px; }
    .metric-card:first-child { grid-column: 1 / -1; }
    .advance-declarations { align-items: flex-start; flex-direction: column; padding: 18px 15px; border-radius: 22px; }
    .future-date-list { width: 100%; }
    .history-table { min-width: 0; }
    .history-table thead { display: none; }
    .history-table tbody { display: block; }
    .history-table tr { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 18px; padding: 20px 15px; }
    .history-table td { display: grid; height: auto; min-height: 0; padding: 0; border: 0; gap: 4px; }
    .history-table td::before { color: var(--ink-soft); content: attr(data-label); font-size: 14px; font-weight: 650; letter-spacing: 0; }
    .history-table td:nth-child(1),
    .history-table td:nth-child(6) { grid-column: 1 / -1; }
    .history-table td:nth-child(2) { display: none; }
    .output-preview { max-width: 100%; white-space: normal; }
    .login-page { padding: 13px; }
    .login-shell { border-radius: 24px; }
}

/* Office routine controls. */
.status-rail {
    --mode-color: var(--purple);
}

.week-summary {
    color: var(--ink-soft);
    font-size: 14px;
    font-weight: 650;
    white-space: nowrap;
}

.duration-input,
.clock-split {
    display: grid;
    min-width: 0;
    min-height: 50px;
    grid-template-columns: minmax(2.5rem, 1fr) auto minmax(2.5rem, 1fr) auto;
    align-items: center;
    overflow: hidden;
    border: 1px solid var(--line-strong);
    border-radius: 13px;
    background: rgb(255 255 255 / 78%);
}

.duration-input:focus-within,
.clock-split:focus-within {
    border-color: rgb(104 88 217 / 55%);
    box-shadow: 0 0 0 4px rgb(104 88 217 / 8%);
}

.duration-input .text-input,
.clock-split .text-input {
    min-height: 48px;
    padding-inline: 8px;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    font-variant-numeric: tabular-nums;
    text-align: center;
    appearance: textfield;
}

.duration-input .text-input::-webkit-inner-spin-button,
.duration-input .text-input::-webkit-outer-spin-button,
.clock-split .text-input::-webkit-inner-spin-button,
.clock-split .text-input::-webkit-outer-spin-button {
    margin: 0;
    appearance: none;
}

.duration-input > span,
.clock-split > span {
    padding-right: 7px;
    color: var(--ink-soft);
    font-size: 14px;
    font-weight: 600;
}

.clock-split {
    grid-template-columns: minmax(4rem, 1fr) auto minmax(4rem, 1fr);
}

.clock-split > span {
    padding: 0;
    font-size: 18px;
}

.clock-native {
    display: none;
}

.language-layout {
    display: grid;
    gap: 14px;
}

#todayForm > .day-section[aria-labelledby="englishHeading"],
#todayForm > .day-section[aria-labelledby="germanHeading"] {
    grid-template-columns: 1fr;
}

#todayForm > .day-section[aria-labelledby="englishHeading"] > *,
#todayForm > .day-section[aria-labelledby="germanHeading"] > * {
    grid-row: auto;
    grid-column: 1;
}

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

.check-control {
    padding-inline: 12px;
}

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

.field-note {
    color: var(--ink-soft);
    font-size: 14px;
}

.morning-actions {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.morning-actions .manual-toggle {
    width: auto;
}

.morning-actions .field-note {
    margin: 0;
}

@media (pointer: coarse) {
    .clock-split {
        display: none;
    }

    .clock-native {
        display: block;
    }
}

@media (max-width: 599px) {
    .bottom-nav {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

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

    .core-summary {
        grid-row: auto;
        grid-column: 1;
    }

    .week-summary {
        grid-row: 2;
        grid-column: 1;
    }

    .save-state {
        grid-row: 1 / span 2;
        grid-column: 2;
    }

    .metric-grid--two {
        grid-template-columns: 1fr;
    }

    .check-row {
        grid-template-columns: minmax(0, 0.82fr) minmax(0, 1.18fr);
        gap: 8px;
    }

    .check-row .check-control {
        min-width: 0;
        padding-inline: 9px;
        gap: 7px;
        font-size: 14px;
        white-space: nowrap;
    }

    .check-row .check-box {
        flex-basis: 22px;
        width: 22px;
        height: 22px;
    }
}
