:root {
    --bg: #ffffff;
    --fg: var(--color-text-primary, #000000);
    --dim: var(--color-text-muted, #e0e0e0);

    /* Spacing & borders */
    --m_thin: 1px;
    --m_border: 2px;
    --m_half: 5px;
    --m1: 10px;
    --m2: 20px;

    /* Derived spacing (built only from the primitives above) */
    --m_2: calc(var(--m_thin) + var(--m_thin));
    --m_4: calc(var(--m_half) - var(--m_thin));
    --m_6: calc(var(--m_half) + var(--m_thin));
    --m_8: calc(var(--m1) - var(--m_border));
    --m_12: calc(var(--m1) + var(--m_border));
    --m_15: calc(var(--m1) + var(--m_half));
    --m_18: calc(var(--m2) - var(--m_2));
    --m_24: calc(var(--m2) + var(--m_half) - var(--m_thin));
    --m_25: calc(var(--m2) + var(--m_half));
    --m_30: calc(var(--m2) + var(--m1));
    --m_40: calc(var(--m2) + var(--m2));

    --touch-target: 44px;

    /* Typography */
    --font_family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    --fs_base: 12px;
    --fs_xs: 10px;
    --fs_md: 15px;
    --fs_lg: 1.1em;
    --fs_sm: 0.8em;
    --fs_xxs: 0.72em;
    --fs_micro: 0.68em;
    --fs_display: clamp(18px, 4.2vw, 28px);
    --fs_clock: 12px;

    --fw_base: 700;
    --fw_strong: 900;
    --fw_semibold: 800;

    --ls_base: 0.1em;
    --ls_badge: 0.08em;
    --ls_xwide: 0.12em;
    --ls_tight: 0.02em;
    --lh_tight: 1.15;
    --lh_solid: 1;
    --lh_clock: var(--m_40);

    /* TYPE TOKENS (Display28, H2-20, Body16, Meta13, Caption11) */
    --type-display: 28px;
    --type-display-lh: 1.2;
    --type-h2: 20px;
    --type-h2-lh: 1.25;
    --type-body: 16px;
    --type-body-lh: 1.25;
    --type-meta: 13px;
    --type-meta-lh: 1.3;
    --type-caption: 11px;
    --type-caption-lh: 1.3;

    /* COLOR TOKENS (WCAG AA Contrast on white) */
    --color-text-primary: #111111;
    --color-text-secondary: #6b6b6b;
    --color-text-muted: #9b9b9b;
    --color-text-disabled: #bfbfbf;
    --color-surface: #ffffff;
    --color-overlay: #000000;
    --color-danger: #E23A3A;
    --accent: #000000;
    --focus-outline: rgba(0,0,0,0.12);

    /* SPACING TOKENS (8px baseline grid) */
    --space-4: 4px;
    --space-8: 8px;
    --space-12: 12px;
    --space-16: 16px;
    --space-24: 24px;
    --space-32: 32px;
    --space-48: 48px;

    /* RADIUS TOKENS */
    --radius-sharp: 4px;
    --radius-card: 6px;
    --radius-pill: 9999px;

    /* ELEVATION/SHADOW TOKENS */
    --elevation-none: none;
    --elevation-1: 1px solid rgba(0, 0, 0, 0.08), 2px 4px 8px rgba(0, 0, 0, 0.06);
    --elevation-2: 0 6px 16px rgba(0, 0, 0, 0.12);

    /* MOTION TOKENS */
    --motion-instant: 0ms;
    --motion-quick: 120ms;
    --motion-normal: 200ms;
    --motion-slow: 300ms;
    --motion-easing: cubic-bezier(0.4, 0, 0.2, 1);

    /* Semantic colors (only used via var() in rules) */
    --cat_wealth_bg: #eb9e21;
    --cat_network_bg: #8d0741;
    --cat_health_bg: #1ba22f;
    --cat_system_bg: #0d129d;
    --cat_fg: #ffffff;
    --warn_bg: #000000;
    --warn_fg: #ffffff;
    --danger_bg: #ff0000;
    --danger_fg: #ffffff;

    --backdrop_bg: rgba(0, 0, 0, 0.5);
    --progress_track_bg: rgba(127, 127, 127, 0.25);
    --progress_track_border: rgba(127, 127, 127, 0.35);
}
* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}
body {
    background: var(--bg);
    color: var(--fg);
    font-family: var(--font_family);
    margin: 0;
    padding: var(--m_40);
    padding-bottom: calc(var(--m_40) + 84px);
    text-transform: uppercase;
    font-size: var(--fs_base);
    font-weight: var(--fw_base);
    letter-spacing: var(--ls_base);
}

.col-12 > div {
    margin-bottom: var(--m1);
}

button:focus-visible,
[role="button"]:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: var(--m_border) solid var(--fg);
    outline-offset: var(--m_half);
}

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

body[data-discreet="true"] .item-label,
body[data-discreet="true"] .item-meta {
    color: transparent;
    text-shadow: 0 0 6px var(--fg);
}

body[data-discreet="true"] .discreet-reveal {
    color: var(--fg);
    text-shadow: none;
}

::selection {
    color: var(--bg);
    background: var(--fg);
}

#menuBox .alarm-item {
    margin-bottom: var(--m1);
}

#menuBox button {
    margin-bottom: var(--m1);
}

.grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: var(--m2);
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
}

.quick-capture {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--m_6);
}

.quick-capture input {
    margin-bottom: 0;
}
.col-4 {
    grid-column: span 3;
}
.col-8 {
    grid-column: span 9;
}
.col-12 {
    grid-column: span 12;
}
.alarm-item {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 0;
    border-bottom: 0px solid var(--dim);
    gap: var(--m1);
}

.col-4.alarm-item {
    gap: 0;
    flex-direction: column;
    justify-content: flex-start;
    gap: var(--m1);
}

.alarm-item > :last-child {
    text-align: right;
}

.plan-card .alarm-item > :last-child {
    text-align: left;
}

.ticker {
    display: inline-block;
    min-width: 4em;
}

.menu-btn {
    padding: 0;
    margin: 0;
    border: var(--m_border) solid var(--fg);
    background: transparent;
    color: var(--fg);
    display: grid;
    place-content: center;
    border: 0;
    width: 25px;
    height: 25px;
}

.menu-btn:active {
    background: var(--fg);
    color: var(--bg);
}

.menu-lines {
    display: block;
    width: 25px;
    height: 25px;
    background:
        linear-gradient(currentColor, currentColor) 0 0 / 100% var(--m_half),
        linear-gradient(currentColor, currentColor) 0 50% / 100% var(--m_half),
        linear-gradient(currentColor, currentColor) 0 100% / 100% var(--m_half);
    background-repeat: no-repeat;
}

.col-8 .alarm-item {
    margin-right: var(--m1);
}
.editable {
    cursor: pointer;
}
.border-top {
    border-top: var(--m_half) solid var(--fg);
    padding-top: var(--m1);
    margin-top: var(--m1);
}
#troubleshootModal div, #troubleshootModal button {
    margin-bottom: var(--m1);
}

.onboarding-cta {
    border: var(--m_border) solid var(--fg);
    padding: var(--m_12);
    margin-bottom: var(--m1);
}

.onboarding-cta.onboarding-cta--lite {
    border-width: 1px;
    padding: var(--m_8);
    opacity: 0.9;
}

.onboarding-cta.onboarding-cta--lite .onboarding-text {
    font-size: var(--fs_sm);
    opacity: 0.85;
    margin-bottom: var(--m_8);
}

.onboarding-text {
    margin-bottom: var(--m1);
}

.onboarding-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--m1);
}

.onboarding-actions button {
    width: 100%;
    margin-bottom: 0;
}

input:not([type="checkbox"]),
textarea,
select,
button {
    border: 0;
    border-bottom: 2px solid var(--fg);
    border-radius: 0;
    width: 100%;
    padding: var(--m_15) 0;
    font-family: inherit;
    font-size: var(--fs_base);
    font-weight: 700;
    background: transparent;
    color: var(--fg);
    margin-bottom: var(--m1);
    outline: none;
    transition: all 0.1s ease;
}

textarea {
    border: 2px solid var(--fg);
    padding: var(--m_half);
}

select {
    border-width: 1px;
    padding: 5px 0;
    border-top: 1px solid;
}

input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 30px;
    height: 30px;
    min-width: 30px;
    min-height: 30px;
    max-width: 30px;
    max-height: 30px;
    padding: 0;
    margin: 0;
    border: 2px solid var(--fg);
    border-radius: 0;
    background: var(--bg);
    display: grid;
    place-content: center;
    cursor: pointer;
}

.todo-check {
    width: 30px;
    height: 30px;
    display: grid;
    place-content: center;
    flex: none;
    cursor: pointer;
}

input[type="checkbox"]::after {
    content: "";
    width: var(--m2);
    height: var(--m2);
    background: transparent;
}

input[type="checkbox"]:checked::after {
    background: var(--fg);
}

.todo-left {
    display: flex;
    align-items: flex-start;
    gap: var(--m_12);
    min-width: 0;
}

.task-row {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: start;
    gap: var(--m1);
}

.item-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: var(--m_2);
    flex: none;
}

.item-label {
    letter-spacing: 0.03em;
    line-height: 1.38;
}

.item-meta {
    font-weight: var(--fw_strong);
    letter-spacing: var(--ls_badge);
    opacity: 0.78;
    white-space: nowrap;
    font-size: var(--fs_sm);
}

.meta-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 var(--m_8);
    border: 1px solid var(--fg);
    background: var(--fg);
    color: var(--bg);
    font-weight: var(--fw_strong);
    font-size: var(--fs_xs);
    letter-spacing: var(--ls_badge);
    opacity: 0.75;
}

.meta-badge--wealth {
    background: var(--cat_wealth_bg);
    color: var(--cat_fg);
    border-color: transparent;
}

.meta-badge--network {
    background: var(--cat_network_bg);
    color: var(--cat_fg);
    border-color: transparent;
}

.meta-badge--health {
    background: var(--cat_health_bg);
    color: var(--cat_fg);
    border-color: transparent;
}

.meta-badge--system {
    background: var(--cat_system_bg);
    color: var(--cat_fg);
    border-color: transparent;
}

.meta-badge--uncategorized,
.meta-badge--uncat {
    background: var(--fg);
    color: var(--bg);
    border: 1px solid var(--fg);
}

/* Schedule chips for reminders: higher contrast and tappable */
.schedule-chip {
    display: inline-block;
    padding: 6px 10px;
    background: var(--fg);
    color: var(--bg);
    border-radius: 8px;
    font-size: var(--fs_sm);
    font-weight: var(--fw_strong);
    letter-spacing: var(--ls_badge);
    border: 0;
    cursor: pointer;
    opacity: 1;
}
.schedule-chip[aria-pressed="true"] {
    background: var(--accent);
    color: var(--bg);
}
.schedule-chip:focus {
    outline: 3px solid var(--focus-outline);
    outline-offset: 2px;
}

.todo-complete-flash {
    animation: todo-complete-flash 180ms ease-out;
}

@keyframes todo-complete-flash {
    0% {
        background: var(--fg);
        color: var(--bg);
    }
    100% {
        background: transparent;
        color: inherit;
    }
}

.cat-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: var(--m_18);
    padding: 0 var(--m_8);
    border: 1px solid var(--fg);
    background: var(--fg);
    color: var(--bg);
    font-weight: var(--fw_strong);
    font-size: var(--fs_xs);
    letter-spacing: var(--ls_badge);
    flex: none;
}

.cat-badge--wealth {
    background: var(--cat_wealth_bg);
    color: var(--cat_fg);
    border-color: transparent;
}

.cat-badge--network {
    background: var(--cat_network_bg);
    color: var(--cat_fg);
    border-color: transparent;
}

.cat-badge--health {
    background: var(--cat_health_bg);
    color: var(--cat_fg);
    border-color: transparent;
}

.cat-badge--system {
    background: var(--cat_system_bg);
    color: var(--cat_fg);
    border-color: transparent;
}

.cat-badge--uncat,
.cat-badge--uncategorized {
    background: var(--fg);
    color: var(--bg);
    border: 1px solid var(--fg);
    opacity: 0.6;
}

.plan-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: var(--m_18);
    padding: 0 var(--m_8);
    border: var(--m_border) solid var(--fg);
    background: var(--bg);
    color: var(--fg);
    font-weight: var(--fw_strong);
    font-size: var(--fs_xs);
    letter-spacing: var(--ls_badge);
    opacity: 0.7;
    flex: none;
}

.today-category-warn {
    padding: var(--m1);
    margin-bottom: var(--m1);
    color: var(--bg);
    background: var(--fg);
    font-weight: var(--fw_strong);
    letter-spacing: var(--ls_badge);
    white-space: pre-wrap;
}

.todo-done {
    opacity: 0.35;
    text-decoration: line-through;
}

.priority-toggles {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--m1);
    margin-bottom: var(--m1);
}

.toggle-btn {
    border: var(--m_border) solid var(--fg);
    background: transparent;
    color: var(--fg);
    padding: var(--m_12) 0;
    min-height: var(--touch-target);
    margin-bottom: 0;
}

.toggle-btn[aria-pressed="true"] {
    background: var(--fg);
    color: var(--bg);
}

.secondary[aria-expanded="true"] {
    background: var(--fg);
    color: var(--bg);
}

.quick-presets-label {
    margin-top: var(--m1);
    margin-bottom: var(--m1);
}

.quick-presets-label[role="button"] {
    display: grid;
    align-items: center;
    min-height: var(--touch-target);
    border-bottom: 2px solid var(--fg);
    padding: var(--m_15) 0;
    cursor: pointer;
}

.quick-presets-label[role="button"][aria-expanded="true"] {
    background: var(--fg);
    color: var(--bg);
}

.todo-inactive {
    opacity: 0.35;
}

.section-label {
    font-weight: var(--fw_strong);
    margin-bottom: var(--m_6);
}

.rem-section-title {
    font-weight: var(--fw_strong);
    opacity: 0.85;
    margin-bottom: var(--m1);
    margin-top: var(--m2);
    display: flex;
    flex-direction: column;
    gap: var(--m_half);
}
button {
    cursor: pointer;
    background: var(--fg);
    color: var(--bg);
    border: 0;
    margin-bottom: 0;
}

button.secondary {
    background: transparent;
    color: var(--fg);
    padding: var(--m_half);
    border: var(--m_border) solid var(--fg);
}

button.secondary:active {
    background: var(--fg);
    color: var(--bg);
}

.get-it-done-row {
    margin-bottom: var(--m1);
}

.get-it-done-box {
    border: var(--m_border) solid var(--fg);
    padding: var(--m_12);
    margin-bottom: var(--m1);
}

.get-it-done-title {
    font-weight: var(--fw_strong);
    margin-bottom: var(--m_8);
}

.get-it-done-status {
    font-size: var(--fs_sm);
    opacity: 0.85;
    white-space: pre-wrap;
    margin-bottom: var(--m1);
}

.get-it-done-upsell {
    display: flex;
    justify-content: flex-start;
    margin-bottom: var(--m1);
}

.get-it-done-upsell button {
    width: auto;
    padding-left: var(--m_12);
    padding-right: var(--m_12);
}

.get-it-done-step-row {
    display: flex;
    align-items: center;
    gap: var(--m1);
}

.get-it-done-step-index {
    min-width: var(--m_18);
    opacity: 0.6;
}

.get-it-done-step-row input.get-it-done-step {
    flex: 1;
    margin-bottom: var(--m1);
}

.get-it-done-dismiss {
    width: 2em;
    min-width: 2em;
    max-width: 2em;
    height: 2em;
    margin-bottom: var(--m1);
    padding: 0;
    border-width: var(--m_border);
    font-size: var(--fs_lg);
    line-height: var(--lh_solid);
}
button:active {
    background: var(--bg);
    color: var(--fg);
}

.cancel-button {
    margin-top: var(--m1);
}

.close-modal-button {
    position: absolute;
    right: var(--m2);
    top: var(--m2);
    width: var(--touch-target);
    height: var(--touch-target);
    background-color: var(--fg);
    color: var(--bg);
    /* Use mask-image so the icon color follows the background-color (theme-aware).
       The SVG uses solid black for the mask; background-color paints the icon. */
    -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'><g transform='rotate(45 10 10)'><rect x='0' y='8' width='20' height='4' fill='%23000000'/><rect x='8' y='0' width='4' height='20' fill='%23000000'/></g></svg>");
    mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'><g transform='rotate(45 10 10)'><rect x='0' y='8' width='20' height='4' fill='%23000000'/><rect x='8' y='0' width='4' height='20' fill='%23000000'/></g></svg>");
    -webkit-mask-size: 50%;
    mask-size: 50%;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: center center;
    mask-position: center center;
}

.add-btn {
    background: var(--fg);
    color: var(--bg);
    width: 36px; /* visual size */
    height: 36px; /* visual size */
    display: flex;
    justify-content: center;
    align-items: center;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20'><rect x='0' y='8' width='20' height='4' fill='%23ffffff'/><rect x='8' y='0' width='4' height='20' fill='%23ffffff'/></svg>");
    background-size: 50%;
    background-repeat: no-repeat;
    background-position: center center;
    /* Ensure hit target meets 44x44 guideline without changing visual size */
    padding: 6px;
    box-sizing: content-box;
}

.primary-add-btn {
    position: fixed;
    right: var(--m2);
    bottom: var(--m2);
    width: 60px;
    height: 60px;
    padding: 0 16px;
    margin: 0;
    border-radius: 30px;
    background: var(
    --fg);
    color: var(
    --bg);
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20'><rect x='0' y='8' width='20' height='4' fill='%23ffffff'/><rect x='8' y='0' width='4' height='20' fill='%23ffffff'/></svg>");
    background-repeat: no-repeat;
    background-position: center center;
    background-size: 50%;
    font-weight: var(
    --fw_strong);
    letter-spacing: var(
    --ls_badge);
    z-index: 50;
    /* Expand hit area via additional padding while keeping visual size */
    box-shadow: 0 0 0 4px transparent;
}

.primary-add-btn:active {
    transform: scale(0.99);
}

.add-btn.icon-intake {
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24'><path fill='%23ffffff' d='M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8l-6-6m2 16H8v-2h8v2m0-4H8v-2h8v2m-3-5V3.5L18.5 9H13z'/></svg>");
}

.add-btn.icon-mic {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="20 18 36 38"><path fill="%23ffffff" d="M38 19a6 6 0 0 1 6 6v13a6 6 0 0 1-12 0V25a6 6 0 0 1 6-6zm2 38h-4v-6.035c-7.265-.513-13-6.57-13-13.965v-1h4c0 6.075 4.925 11 11 11s11-4.925 11-11h4v1c0 7.396-5.735 13.452-13 13.965V57z"/></svg>');
}

.add-btn.icon-mic.is-processing {
    background-image: none !important;
    position: relative;
}

.add-btn.icon-mic.is-processing::before {
    content: '';
    width: 1em;
    height: 1em;
    border-radius: 50%;
    display: block;
    border: 2px solid var(--bg);
    opacity: 0.35;
}

.add-btn.icon-mic.is-processing::after {
    content: '';
    width: 1em;
    height: 1em;
    border-radius: 50%;
    border: 2px solid var(--bg);
    border-top-color: transparent;
    animation: spin 0.8s linear infinite;
}

.empty-state {
    margin-bottom: var(--m1);
}

.plan-proto-status {
    font-size: var(--fs_sm);
    opacity: 0.85;
    white-space: pre-wrap;
}

.plan-proto-box {
    border: var(--m_border) solid var(--fg);
}

.plan-proto-row {
    width: 100%;
}

.plan-proto-title {
    font-weight: var(--fw_strong);
    margin-bottom: var(--m_8);
}

.plan-proto-progress {
    display: grid;
    gap: var(--m_8);
    margin-top: var(--m_8);
}

.progress-row {
    display: grid;
    grid-template-columns: 70px 1fr 60px;
    align-items: center;
    gap: var(--m1);
}

.progress-track {
    height: 4px;
    background: var(--progress_track_bg);
    border: var(--m_thin) solid var(--progress_track_border);
}

.progress-fill {
    height: 100%;
    background: var(--fg);
    width: 0%;
}

.progress-val {
    text-align: right;
    font-size: var(--fs_sm);
    opacity: 0.85;
}

.today-progress-title.alarm-item
{
    margin-bottom: var(--m1);
    margin-right: 0;
}

/* Weekly progress graph (TODAY → WEEK) */
#weeklyProgressGraph {
    margin-top: var(--m2);
}

#weekReview {
    white-space: pre-wrap;
}

.progress-graph {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: var(--m_8);
    align-items: end;
    padding-top: var(--m_6);
}

.progress-bar-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--m_half);
    min-width: 0;
}

.progress-day-label {
    font-size: var(--fs_xxs);
    opacity: 0.75;
    letter-spacing: var(--ls_xwide);
}

.progress-bar-wrapper {
    border-radius: 10px;
    width: 20px;
    border: var(--m_thin) solid var(--fg);
    background: var(--bg);
    position: relative;
    overflow: hidden;
}

.progress-bar-fill {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 0%;
    display: flex;
    flex-direction: column-reverse; /* stack segments from bottom up */
    width: 100%;
}

.progress-segment {
    width: 100%;
    /* height is set inline based on category share; allow smooth transitions */
    transition: height var(--motion-quick) ease;
}

.progress-ratio-label {
    font-size: var(--fs_micro);
    opacity: 0.85;
    line-height: var(--lh_solid);
    white-space: nowrap;
    display: none;
}

.progress-graph-empty {
    border: var(--m_border) solid var(--fg);
    padding: var(--m1);
    opacity: 0.75;
    font-size: var(--fs_sm);
}

.plan-proto-gate {
    margin-top: var(--m_8);
    padding: var(--m_8);
    border: var(--m_border) solid var(--fg);
    opacity: 0.9;
    font-size: var(--fs_sm);
}

.plan-proto-upsell {
    display: flex;
    align-items: center;
    gap: var(--m1);
    margin: var(--m_6) 0 var(--m1);
}

.plan-proto-upsell-msg {
    flex: 1;
    min-width: 0;
    font-size: var(--fs_sm);
    opacity: 0.85;
    white-space: pre-wrap;
}

.plan-proto-upsell button {
    width: auto;
    padding-left: var(--m_12);
    padding-right: var(--m_12);
    white-space: nowrap;
}

.icon-btn {
    width: 30px;
    min-width: 30px;
    max-width: 30px;
    height: 30px;
    padding: 0;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    font-weight: var(--fw_strong);
    line-height: var(--lh_solid);
}

.icon-btn--ghost {
    background: transparent;
    color: var(--fg);
    border: var(--m_border) solid var(--fg);
}

.task-actions {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--m_8);
}

.plan-action-row {
    display: flex;
    align-items: flex-start;
    gap: var(--m1);
}

.plan-action-meta {
    flex: 1;
    min-width: 0;
}

.plan-action-title {
}

#planProtoGenerateBtn {
    margin: 0;
}

#planBox {
    margin-bottom: var(--m1);
}

.plan-card {
    /* background: var(--fg); */
    /* color: var(--bg); */
    margin-bottom: var(--m1);
}
.plan-card-left {
    display: flex;
    flex-direction: column;
    gap: var(--m1);
    margin-right: var(--m1);
}

.plan-card button {
    margin: 0;
}

.plan-card-meta {
    margin-bottom: var(--m1);
}

#planBox button {
    margin: 0;
}

.slide-wrapper {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    margin-bottom: var(--m1);
}
.slide-wrapper::-webkit-scrollbar {
    display: none;
}
.slide-content {
    min-width: 100%;
    scroll-snap-align: start;
}
.delete-trigger,
.restore-trigger {
    min-width: 100px;
    background: var(--danger_bg);
    color: var(--danger_fg);
    display: flex;
    justify-content: center;
    align-items: center;
    scroll-snap-align: end;
    cursor: pointer;
    font-size: var(--fs_xs);
    border: 0;
}
.restore-trigger {
    background: var(--dim);
    color: var(--fg);
}

@keyframes promoted-flash {
    0% {
        background: var(--fg);
        color: var(--bg);
    }
    60% {
        background: var(--fg);
        color: var(--bg);
    }
    100% {
        background: transparent;
        color: inherit;
    }
}

.flash-promoted {
    animation: promoted-flash 900ms ease-out;
}

/* Current task carousel */
#currentTaskHost {
    margin-bottom: var(--m1);
}

.current-task-carousel.slide-wrapper {
    margin-bottom: 0;
}

.current-task-carousel > .current-task-slide {
    min-width: 100%;
    scroll-snap-align: start;
    margin-right: 10px;
}

.current-task-slide {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    padding: 0;
    font-weight: 900;
    line-height: 1.15;
    font-size: clamp(18px, 4.2vw, 28px);
    margin-bottom: 10px;
}

.current-task-label {
    flex: 1;
    min-width: 0;
    white-space: normal;
    overflow-wrap: anywhere;
    line-height: 1.15;
    margin-bottom: 5px;
}

.current-task-left {
    display: flex;
    flex-direction: row;
    gap: var(--m_15);
    justify-content: flex-start;
    align-items: flex-start;
}

.current-task-meta {
    font-size: 10px;
    font-weight: 900;
}

input.current-task-done-checkbox {
    margin-top: 2px;
}

.icon-btn.current-task-promote {
    width: 26px;
    min-width: 26px;
    max-width: 26px;
    height: 26px;
}

.current-task-ticker {
    font-size: clamp(18px, 4.2vw, 28px);
    opacity: 1;
}

.current-task-due {
    font-size: 10px;
    opacity: 0.8;
}

.current-task-pill {
    border: 2px solid var(--fg);
    padding: 4px 6px;
    line-height: 1;
    font-size: 10px;
    font-weight: 900;
    margin-right: 5px;
}

.current-task-pill--urgent {
    animation: pulse 1s ease-out infinite;
}

@keyframes pulse {
    0% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
    100% {
        opacity: 1;
    }
}

dialog {
    position: fixed;
    top: 0;
    margin: auto;
    margin-top: 5vw;
    border: 2px solid var(--fg);
    background: var(--bg);
    color: var(--fg);
    padding: var(--touch-target);
    padding-top: 40px;
    width: 90vw;
    max-width: 500px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    border-radius: 0;
}
dialog::backdrop {
    background: var(--backdrop_bg);
}

dialog.fullscreen {
    margin: 0;
    inset: 0;
    width: 100vw;
    max-width: none;
    height: 100vh;
    max-height: none;
    padding: 20px;
    border: 0;
}

dialog[open].listening-modal {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 16px;
}

dialog button {
    margin-bottom: var(--m1);
}
dialog button.secondary {
    padding: var(--m_15);
}

.listening-modal__header {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 10px;
}

.listening-modal__title {
    font-weight: var(--fw_strong);
    font-size: var(--fs_display);
    letter-spacing: var(--ls_xwide);
    text-align: center;
}

.listening-modal__header-spacer {
    width: 1px;
    height: 1px;
}

.listening-modal__center {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    min-height: 260px;
}

.listening-stop-btn {
    width: min(68vw, 220px);
    aspect-ratio: 1 / 1;
    border-radius: 999px;
    background: var(--danger_bg);
    color: var(--danger_fg);
    border: 2px solid var(--danger_bg);
    font-size: 22px;
    font-weight: var(--fw_strong);
    letter-spacing: var(--ls_xwide);
}

.listening-stop-btn:active {
    transform: scale(0.98);
}

.listening-stop-btn:disabled {
    background: var(--progress_track_bg);
    border-color: var(--progress_track_border);
    color: var(--fg);
    opacity: 0.85;
}

.listening-modal__footer {
    display: flex;
    flex-direction: column;
    gap: 8px;
    text-align: center;
}

.listening-modal__status {
    font-size: var(--fs_sm);
    opacity: 0.95;
}

.spinner {
    width: var(--touch-target);
    height: var(--touch-target);
    border: 4px solid var(--fg);
    border-top-color: transparent;
    border-radius: 999px;
    opacity: 0.85;
    animation: spin 1s linear infinite;
}

.listening-modal__center .spinner {
    position: absolute;
    bottom: -10px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

#addMenuDialog {
    margin-top: 30vh;
    padding: 20px;
    width: min(90vw, 320px);
}

#addMenuDialog button {
    margin-bottom: 10px;
}

#addMenuDialog button:last-of-type {
    margin-bottom: 0;
}

.dialog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

#addTimerDetails {
    margin: 0 auto;
    margin-top: 4vw;
    padding: 24px;
    width: min(92vw, 520px);
    max-height: 85vh;
    overflow: auto;
}

#addTimerDetails .modal-title {
    font-weight: 900;
}

#addTimerDetails .icon-btn {
    width: 36px;
    height: 36px;
    padding: 0;
    margin: 0;
    border: 2px solid var(--fg);
    background: var(--fg);
    color: var(--bg);
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20'><g transform='rotate(45 10 10)'><rect x='0' y='8' width='20' height='4' fill='%23ffffff'/><rect x='8' y='0' width='4' height='20' fill='%23ffffff'/></g></svg>");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 55%;
}

#planAddModal .icon-btn {
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20'><g transform='rotate(45 10 10)'><rect x='0' y='8' width='20' height='4' fill='%23000000'/><rect x='8' y='0' width='4' height='20' fill='%23000000'/></g></svg>");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 55%;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.mute-toggle {
    border: 2px solid var(--fg);
    background: transparent;
    color: var(--fg);
    width: 36px;
    height: 36px;
    padding: 0;
    margin-bottom: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    opacity: 0.3;
}

.mute-toggle[aria-pressed="true"] {
    opacity: 1;
    background: var(--fg);
    color: var(--bg);
}

.mute-icon {
    width: 18px;
    height: 18px;
    display: block;
    background-color: currentColor;
    mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24'><path fill='%23000000' d='M16.5 12a4.5 4.5 0 0 0-7.2-3.6L6 11H4v2h2l3.3 2.6a4.5 4.5 0 0 0 7.2-3.6z'/><path fill='%23000000' d='M19 5.4 17.6 4 4 17.6 5.4 19z'/></svg>");
    -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24'><path fill='%23000000' d='M16.5 12a4.5 4.5 0 0 0-7.2-3.6L6 11H4v2h2l3.3 2.6a4.5 4.5 0 0 0 7.2-3.6z'/><path fill='%23000000' d='M19 5.4 17.6 4 4 17.6 5.4 19z'/></svg>");
    mask-repeat: no-repeat;
    -webkit-mask-repeat: no-repeat;
    mask-position: center;
    -webkit-mask-position: center;
    mask-size: contain;
    -webkit-mask-size: contain;
    opacity: 0.9;
}

.mute-toggle[aria-pressed="false"] .mute-icon {
    opacity: 0.4;
}

.mute-toggle[aria-pressed="true"] .mute-icon {
    background-color: currentColor;
}

.hidden {
    display: none;
}

.repeat-constraints {
    margin-bottom: 10px;
}

.repeat-constraints-title {
    font-weight: 900;
    margin-bottom: 10px;
}


.repeat-constraints-group {
    margin-bottom: 10px;
}

.repeat-constraints-group:last-child {
    margin-bottom: 0;
}

.repeat-constraints-label {
    margin-bottom: 10px;
    margin-top: 10px;
}

.repeat-constraints-values {
    display: grid;
    grid-template-columns: repeat(7,1fr);
    gap: 1px;
}
.repeat-constraints-values--months {
    grid-template-columns: repeat(12,1fr);
}

.repeat-constraints-opt {
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
    background: var(--fg);
    padding: 2px;
    justify-content: center;
}

.repeat-constraints-opt input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.repeat-constraints-opt span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    /* padding: 6px 10px; */
    /* border: 2px solid var(--fg); */
    font-weight: 800;
    letter-spacing: 0.02em;
    opacity: 0.55;
}

.repeat-constraints-opt input:checked + span {
    opacity: 1;
    background: var(--fg);
    color: var(--bg);
}

.repeat-constraints-range {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.repeat-constraints-range-opt {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-right: 8px;
}

.repeat-constraints-range-opt span {
    /* opacity: 0.7; */
    font-weight: 800;
}

.repeat-constraints-range-opt select {
    width: auto;
    margin: 0;
}

.reminder-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    margin-top: 10px;
}

.schedule-chip {
    text-align: right;
}

.schedule-constraints span {
    display: block;
}

#timerToggleBtn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: var(--touch-target);
    height: var(--touch-target);
    line-height: var(--touch-target);
    padding: 0;
    margin: 0;
}

.timer-quick-group {
    display: grid;
    gap: 10px;
    margin-bottom: 0;
}

.timer-quick-row {
    display: grid;
    gap: 0;
    margin-bottom: 0;
    grid-template-columns: repeat(5, 1fr);
    border: 2px solid var(--fg);
    border-radius: 14px;
    overflow: hidden;
}

.timer-quick-secondary-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.timer-quick-secondary-row .timer-quick-btn,
.timer-quick-secondary-row .timer-quick-input {
    border: 2px solid var(--fg);
    border-radius: 14px;
    border-bottom: 2px solid var(--fg);
}

.timer-quick-btn {
    width: auto;
    margin-bottom: 0;
    padding: 0;
    min-height: var(--touch-target);
    flex: 1;
}

.timer-quick-row button {
    font-size: var(--m_15);
    border: 0;
    border-right: 1px solid var(--progress_track_border);
}

.timer-quick-row button:last-child {
    border-right: 0;
}

.preset-chip-input {
    text-align: center;
}

.timer-quick-custom {
    flex: 1;
    position: relative;
    min-height: var(--touch-target);
}

.timer-quick-input {
    width: 100%;
    margin-bottom: 0;
    padding: 0;
    border: 0;
    min-height: var(--touch-target);
    background: transparent;
    color: var(--fg);
    text-align: center;
}

.timer-quick-custom > .timer-quick-btn,
.timer-quick-custom > .timer-quick-input {
    position: absolute;
    inset: 0;
}

.timer-quick-swap-hidden {
    display: none;
}

#themeSelect {
    padding: 0;
    border: 0;
    margin: 0;
    height: 14.5px;
}

/* Selected styling (driven by data-minutes on the timer quick group) */
.timer-quick-group[data-minutes="5"] .quick-5,
.timer-quick-group[data-minutes="10"] .quick-10,
.timer-quick-group[data-minutes="15"] .quick-15,
.timer-quick-group[data-minutes="30"] .quick-30,
.timer-quick-group[data-minutes="60"] .quick-60,
.timer-quick-group[data-minutes="later"] .quick-later,
.timer-quick-group[data-minutes="custom"] .quick-custom {
    background: var(--bg);
    color: var(--fg);
}
.active-alarm {
    background: var(--fg) !important;
    color: var(--bg) !important;
    animation: step-blink 0.5s steps(2, start) infinite;
}
@keyframes step-blink {
    to {
        visibility: hidden;
    }
}

@media (prefers-color-scheme: dark) {
    :root {
        --fg: #ffffff; /* Swap: white foreground */
        --bg: #000000; /* Swap: black background */
    }
    /* System theme dark mode icons */
    body[data-theme=""] .add-btn,
    body[data-theme=""] .primary-add-btn {
        background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20'><rect x='0' y='8' width='20' height='4' fill='%23000000'/><rect x='8' y='0' width='4' height='20' fill='%23000000'/></svg>");
    }
    body[data-theme=""] .add-btn.icon-intake {
        background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24'><path fill='%23000000' d='M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8l-6-6m2 16H8v-2h8v2m0-4H8v-2h8v2m-3-5V3.5L18.5 9H13z'/></svg>");
    }
    body[data-theme=""] .add-btn.icon-mic {
        background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="20 18 36 38"><path fill="%23000000" d="M38 19a6 6 0 0 1 6 6v13a6 6 0 0 1-12 0V25a6 6 0 0 1 6-6zm2 38h-4v-6.035c-7.265-.513-13-6.57-13-13.965v-1h4c0 6.075 4.925 11 11 11s11-4.925 11-11h4v1c0 7.396-5.735 13.452-13 13.965V57z"/></svg>');
    }
}
body[data-theme="dark"] {
    --fg: #ffffff;
    --bg: #000000;
}
body[data-theme="dark"] .add-btn,
body[data-theme="dark"] .primary-add-btn {
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20'><rect x='0' y='8' width='20' height='4' fill='%23000000'/><rect x='8' y='0' width='4' height='20' fill='%23000000'/></svg>");
}
body[data-theme="dark"] .add-btn.icon-intake {
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24'><path fill='%23000000' d='M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8l-6-6m2 16H8v-2h8v2m0-4H8v-2h8v2m-3-5V3.5L18.5 9H13z'/></svg>");
}
body[data-theme="dark"] .add-btn.icon-mic {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="20 18 36 38"><path fill="%23000000" d="M38 19a6 6 0 0 1 6 6v13a6 6 0 0 1-12 0V25a6 6 0 0 1 6-6zm2 38h-4v-6.035c-7.265-.513-13-6.57-13-13.965v-1h4c0 6.075 4.925 11 11 11s11-4.925 11-11h4v1c0 7.396-5.735 13.452-13 13.965V57z"/></svg>');
}

body[data-theme="light"] {
    --fg: #000000;
    --bg: #ffffff;
}

body[data-theme="oled"] {
    --fg: #ff8800;
    --bg: #000000;
    --dim: #884400;

    --cat_wealth_bg: #ff8800;
    --cat_network_bg: #ff8800;
    --cat_health_bg: #ff8800;
    --cat_system_bg: #ff8800;
    --cat_fg: #000000;
    --warn_bg: #ff8800;
    --warn_fg: #000000;
    --danger_bg: #ff8800;
    --danger_fg: #000000;
}

body[data-theme="oled"] .add-btn,
body[data-theme="oled"] .primary-add-btn {
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20'><rect x='0' y='8' width='20' height='4' fill='%23000000'/><rect x='8' y='0' width='4' height='20' fill='%23000000'/></svg>");
}
body[data-theme="oled"] .add-btn.icon-intake {
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24'><path fill='%23000000' d='M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8l-6-6m2 16H8v-2h8v2m0-4H8v-2h8v2m-3-5V3.5L18.5 9H13z'/></svg>");
}
body[data-theme="oled"] .add-btn.icon-mic {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="20 18 36 38"><path fill="%23000000" d="M38 19a6 6 0 0 1 6 6v13a6 6 0 0 1-12 0V25a6 6 0 0 1 6-6zm2 38h-4v-6.035c-7.265-.513-13-6.57-13-13.965v-1h4c0 6.075 4.925 11 11 11s11-4.925 11-11h4v1c0 7.396-5.735 13.452-13 13.965V57z"/></svg>');
}

body[data-theme="oled"] .delete-trigger {
    background: var(--fg);
    color: var(--bg);
}

::-webkit-input-placeholder {
    color: var(--fg);
    opacity: 0.5;
}
::-moz-placeholder {
    color: var(--fg);
    opacity: 0.5;
}

.rem-section-title:first-child {
    margin-top: 0;
}

.thin {
    border-width: 2px;
}

#clk {
    position: absolute;
    right: 0px;
    font-size: var(--fs_clock);
}

.plan-card-stat {
    display: flex;
    justify-content: space-between;
}

.icon-btn-low {
    font-size: 12px;
}

.plan-card-tasks,
.plan-action-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.hour-range-row {
    margin-top: 10px;
}

.repeat-constraints-toggle-row {
    margin-bottom: 10px;
}

button#editRemSkipScheduleBtn {
    padding: 5px;
}

.rem-section-title button.icon-btn {
    width: auto;
    min-width: auto;
    max-width: none;
    height: var(--m_18);
    width: 77px;
    position: absolute;
    right: 0px;
    font-size: 10px;
    letter-spacing: var(--ls_badge);
}

span.ticker.item-meta {
    font-size: var(--fs_base);
}

.todo-done span.ticker.item-meta {
    font-size: var(--fs_sm);
}

.plan-card-title {
    font-size: var(--fs_lg);
}

.plan-card .alarm-item {
    margin-right: 0;
}

.backlog-title {
    margin-bottom: var(--m1);
}

.quick-presets {
    margin-bottom: calc(var(--m2) * 2);
}

.today-category-warn-category { 
    cursor: pointer;
}