:root {
    --bg: #171311;
    --bg-soft: #241c18;
    --bg-raised: #30251f;
    --card: #f8f5ef;
    --card-secondary: #efe8dd;
    --text: #17151b;
    --text-light: #f7f2ea;
    --muted: #77727a;
    --muted-light: #c4bcb3;
    --gold: #c99a48;
    --gold-light: #e5bf73;
    --danger: #9e3042;
    --deadline: #456883;
    --blue: #587ca8;
    --success: #59785f;
    --border: rgba(255, 255, 255, .12);
    --dark-border: rgba(23, 21, 27, .12);
    --shadow: 0 24px 70px rgba(0, 0, 0, .24);
    --radius: 24px;
    --radius-sm: 14px;
    --nav-height: 78px;
    color-scheme: dark;
}

* { box-sizing: border-box; }
html { min-height: 100%; scroll-behavior: smooth; }
body {
    min-height: 100%;
    margin: 0;
    background:
        radial-gradient(circle at 85% -10%, rgba(201, 154, 72, .14), transparent 34rem),
        var(--bg);
    color: var(--text-light);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

body::before {
    position: fixed;
    inset: 0;
    z-index: -1;
    background-image: linear-gradient(rgba(255, 255, 255, .012) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .012) 1px, transparent 1px);
    background-size: 32px 32px;
    content: "";
    pointer-events: none;
}

img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button, select { cursor: pointer; }
button { color: inherit; }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 {
    margin-bottom: .45rem;
    font-family: Georgia, "Times New Roman", serif;
    font-weight: 600;
    letter-spacing: -.025em;
    line-height: 1.12;
}
h1 { font-size: clamp(2rem, 10vw, 3.4rem); }
h2 { font-size: clamp(1.35rem, 6vw, 2rem); }
h3 { font-size: 1.15rem; }
:focus-visible { outline: 3px solid var(--gold-light); outline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
[hidden] { display: none !important; }

.app-shell { position: relative; isolation: isolate; width: min(100%, 1040px); min-height: 100vh; margin: 0 auto; }
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 68px;
    padding: 6px 12px 5px 14px;
    border-bottom: 1px solid var(--border);
}
.brand { display: flex; min-width: 0; flex: 1 1 auto; align-items: center; align-self: stretch; padding: 1px 0; overflow: visible; gap: 9px; }
.brand .brand-logo { display: block; width: auto; height: 42px; max-width: none; flex: 0 0 auto; object-fit: contain; object-position: center; }
.brand-copy { display: grid; min-width: 0; flex: 1 1 auto; align-content: center; overflow: visible; gap: 2px; }
.brand-title, .brand-subtitle { display: block; overflow: visible; text-overflow: clip; white-space: normal; }
.brand-title { color: var(--text-light); font-family: Georgia, "Times New Roman", serif; font-size: 16px; font-weight: 600; letter-spacing: .005em; line-height: 1.04; }
.brand-subtitle { color: rgba(247, 242, 234, .78); font-size: 12px; font-weight: 500; letter-spacing: .025em; line-height: 1.06; }
.header-actions { display: flex; flex: 0 0 44px; align-items: center; justify-content: flex-end; }
.icon-button {
    position: relative;
    display: inline-grid;
    width: 44px;
    height: 44px;
    padding: 0;
    place-items: center;
    border: 1px solid transparent;
    border-radius: 50%;
    background: transparent;
}
.icon-button:hover { border-color: var(--border); background: rgba(255, 255, 255, .06); }
.icon-button svg { width: 21px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.7; }
.icon-button span[aria-hidden] { font-size: 2rem; font-weight: 200; line-height: 1; }
.icon-button.light { border-color: var(--dark-border); color: var(--text); }
.notification-button svg { width: 19px; height: 19px; }
.notification-dot { position: absolute; top: 8px; right: 8px; width: 7px; height: 7px; border: 2px solid var(--bg); border-radius: 50%; background: var(--gold-light); }

.page-content { padding: 16px 16px calc(var(--nav-height) + 34px); }
.today-hero { padding: 7px 2px 22px; }
.today-hero p, .page-heading > p, .page-title-row .eyebrow { margin-bottom: 8px; color: var(--muted-light); font-size: .82rem; letter-spacing: .06em; }
.today-hero h1, .page-heading h1 { margin: 0; color: var(--text-light); }
.hero-accent { display: flex; width: min(100%, 295px); align-items: center; margin: 14px 0 18px; gap: 9px; }
.hero-accent span { width: 6px; height: 6px; border-radius: 50%; background: var(--gold-light); box-shadow: 0 0 14px rgba(229, 191, 115, .45); }
.hero-accent i { flex: 1; height: 4px; margin-left: 3px; border-radius: 999px; background: linear-gradient(90deg, var(--gold-light), #f1d28e); }
.page-heading { padding: 10px 2px 23px; }
.page-heading > p:last-child { max-width: 36rem; margin: 8px 0 0; color: var(--muted-light); font-size: .93rem; letter-spacing: 0; }
.page-calendar .page-content { padding-top: 10px; }
.calendar-page-heading { display: flex; min-width: 0; align-items: center; justify-content: space-between; padding: 0 2px 8px; gap: 10px; }
.calendar-page-heading h1 { font-size: clamp(1.75rem, 7.4vw, 2.25rem); letter-spacing: -.025em; }
.calendar-desktop-actions { display: none; }
.calendar-desktop-today { display: none; }
.calendar-desktop-layout { display: contents; }
.page-list .page-content { padding-top: 10px; }
.eyebrow { margin-bottom: 6px; color: #96702f; font-size: .68rem; font-weight: 800; letter-spacing: .15em; text-transform: uppercase; }

.agenda-card, .surface-card, .calendar-card, .day-events-panel, .detail-card, .global-search-form {
    border: 1px solid rgba(255, 255, 255, .45);
    border-radius: var(--radius);
    background: var(--card);
    box-shadow: var(--shadow);
    color: var(--text);
}
.agenda-card { overflow: hidden; }
.section-heading { display: flex; align-items: center; justify-content: space-between; padding: 24px 22px 18px; gap: 16px; }
.section-heading h2 { margin-bottom: 4px; }
.section-heading p:last-child { margin: 0; color: var(--muted); font-size: .85rem; }
.agenda-heading-copy { display: flex; min-width: 0; align-items: center; gap: 13px; }
.agenda-heading-copy > div { min-width: 0; }
.agenda-heading-icon { display: none; flex: 0 0 auto; width: 50px; height: 50px; place-items: center; border-radius: 50%; background: #f4ead7; color: #916515; }
.agenda-heading-icon svg { width: 25px; height: 25px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
.agenda-view-all { display: inline-flex; min-height: 44px; flex: 0 0 auto; align-items: center; color: #6f4b20; font-family: Georgia, "Times New Roman", serif; font-size: .82rem; gap: 5px; }
.agenda-view-all span { font-size: 1.65rem; line-height: 1; }
.small-add-button {
    flex: 0 0 auto;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 50%;
    background: var(--text);
    color: var(--gold-light);
    font-size: 1.7rem;
    line-height: 1;
}
.agenda-list { display: grid; }
.agenda-event {
    position: relative;
    display: grid;
    grid-template-columns: 5px 66px minmax(0, 1fr) 18px;
    min-height: 76px;
    align-items: center;
    padding: 14px 16px 14px 12px;
    border-top: 1px solid var(--dark-border);
    gap: 12px;
    transition: background .18s ease;
}
.agenda-event:hover { background: var(--card-secondary); }
.agenda-event time { color: var(--text); font-size: .78rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.event-marker { width: 5px; height: 31px; border-radius: 999px; background: var(--muted); }
.marker-appointment { background: var(--gold) !important; }
.marker-hearing { background: var(--danger) !important; }
.marker-deadline { background: var(--deadline) !important; }
.marker-call, .marker-task { background: var(--blue) !important; }
.marker-personal { background: #8d8a84 !important; }
.event-copy { display: grid; min-width: 0; gap: 3px; }
.event-copy strong { overflow: hidden; font-family: Georgia, "Times New Roman", serif; font-size: .99rem; text-overflow: ellipsis; white-space: nowrap; }
.event-copy small { overflow: hidden; color: var(--muted); font-size: .77rem; text-overflow: ellipsis; white-space: nowrap; }
.chevron { color: #9a948b; font-size: 1.55rem; }
.agenda-event.is-completed .event-copy strong { text-decoration: line-through; }
.agenda-event.is-completed { opacity: .62; }
.todo-agenda-event { isolation: isolate; }
.todo-card-link { position: absolute; inset: 0; z-index: 1; }
.todo-card-link:focus-visible { outline: 2px solid var(--gold); outline-offset: -3px; }
.todo-event-meta { display: flex; align-items: center; gap: 4px; min-width: 0; }
.todo-move-form { position: relative; z-index: 2; flex: 0 0 auto; margin: 0; }
.todo-completion-form { position: relative; z-index: 2; flex: 0 0 auto; margin: 0; }
.todo-completion-button { min-height: 28px; padding: 3px 2px; border: 0; border-radius: 4px; background: transparent; color: #737687; font-size: .77rem; font-weight: 400; line-height: 1.5; text-decoration: none; cursor: pointer; touch-action: manipulation; }
.todo-completion-button[aria-pressed="true"] { color: #526b57; }
.todo-completion-button:hover, .todo-completion-button:active { background: rgba(150, 112, 47, .08); }
.todo-completion-button:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.todo-completion-button:disabled { opacity: .5; cursor: wait; }
.todo-move-button { display: grid; place-items: center; width: 44px; height: 36px; padding: 0; border: 0; border-radius: 10px; background: transparent; color: #756345; cursor: pointer; touch-action: manipulation; }
.todo-move-button svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; }
.todo-move-button:hover, .todo-move-button:active { background: rgba(150, 112, 47, .12); }
.todo-move-button:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }
.todo-move-button:disabled { opacity: .5; cursor: wait; }
.flash-toast { position: fixed; z-index: 100; left: 50%; bottom: calc(92px + env(safe-area-inset-bottom)); transform: translateX(-50%); width: max-content; max-width: calc(100vw - 32px); margin: 0; padding: 12px 18px; border-radius: 12px; box-shadow: 0 8px 28px rgba(0, 0, 0, .2); font-size: .85rem; }
.todo-toast-stack { position: fixed; z-index: 100; right: max(16px, env(safe-area-inset-right, 0px)); bottom: calc(var(--nav-height) + 14px + env(safe-area-inset-bottom, 0px)); left: max(16px, env(safe-area-inset-left, 0px)); display: grid; width: min(480px, calc(100% - 32px - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px))); max-height: min(40dvh, 276px); overflow-y: auto; margin-inline: auto; padding: 8px; gap: 8px; }
.todo-toast-stack:empty { display: none; }
.todo-toast-stack .todo-action-toast, .flash-toast:has(.todo-undo-form) { position: relative; display: flex; align-items: center; justify-content: space-between; overflow: hidden; margin: 0; padding: 10px 12px 13px; border: 1px solid rgba(201, 154, 72, .65); border-radius: var(--radius-sm); background: var(--bg-soft); box-shadow: 0 4px 12px rgba(0, 0, 0, .3); color: var(--text-light); font-size: .8rem; line-height: 1.4; gap: 12px; }
.todo-toast-stack .todo-action-toast { width: 100%; }
.todo-action-toast > span:not(.todo-toast-progress) { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.todo-action-toast.notice-warning { border-color: var(--gold-light); }
.todo-undo-form { flex: 0 0 auto; margin: 0; }
.todo-undo-form button { min-height: 44px; padding: 6px 10px; border: 1px solid rgba(229, 191, 115, .4); border-radius: 9px; background: rgba(201, 154, 72, .1); color: var(--gold-light); font-size: .8rem; font-weight: 800; white-space: nowrap; cursor: pointer; }
.todo-undo-form button:hover { border-color: var(--gold-light); background: rgba(201, 154, 72, .18); }
.todo-undo-form button:focus-visible { outline-offset: 2px; }
.todo-undo-form button:disabled { opacity: .5; cursor: wait; }
.todo-action-toast { animation: todo-toast-enter 180ms ease-out both; }
.todo-action-toast.is-expiring { animation: todo-toast-exit 180ms ease-in both; }
.todo-action-toast.is-undo-submitting { visibility: hidden; animation: none; }
.todo-toast-progress { position: absolute; right: 0; bottom: 0; left: 0; height: 3px; background: var(--gold-light); transform-origin: left center; pointer-events: none; animation: todo-toast-countdown var(--todo-toast-duration, 6000ms) linear forwards; }
@keyframes todo-toast-enter { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
@keyframes todo-toast-exit { from { opacity: 1; transform: translateY(0); } to { opacity: 0; transform: translateY(4px); } }
@keyframes todo-toast-countdown { from { transform: scaleX(1); } to { transform: scaleX(0); } }

.page-today .app-shell::before {
    position: absolute;
    inset: 0 0 auto;
    z-index: 0;
    height: 500px;
    background:
        linear-gradient(180deg, rgba(18, 12, 10, .38) 0%, rgba(19, 13, 11, .12) 38%, rgba(23, 19, 17, .82) 86%, var(--bg) 100%),
        linear-gradient(90deg, rgba(16, 10, 8, .66) 0%, rgba(16, 10, 8, .18) 58%, rgba(16, 10, 8, .1) 100%),
        url("../images/dikigoriko-grafeio.webp") 67% center / cover no-repeat;
    content: "";
}
.page-today .app-header { position: relative; z-index: 1; border-bottom-color: rgba(255, 255, 255, .16); background: linear-gradient(180deg, rgba(10, 7, 6, .42), transparent); }
.page-today .page-content { position: relative; z-index: 1; padding-top: 0; }
.page-today .today-hero {
    display: flex;
    min-height: 272px;
    flex-direction: column;
    justify-content: flex-end;
    padding: 50px 12px 30px;
}
.page-today .today-hero p { margin-bottom: 0; color: rgba(255, 255, 255, .86); font-family: Georgia, "Times New Roman", serif; font-size: .98rem; letter-spacing: .035em; text-shadow: 0 2px 16px rgba(0, 0, 0, .65); }
.page-today .today-hero h1 { font-size: clamp(2.5rem, 10.5vw, 3.55rem); text-shadow: 0 4px 25px rgba(0, 0, 0, .48); }
.page-today .agenda-card { margin-top: -22px; }
.compact-agenda-card { border-color: rgba(255, 255, 255, .78); box-shadow: 0 30px 75px rgba(0, 0, 0, .38); }
.compact-agenda-list .agenda-event:first-child { border-top: 0; }
.compact-agenda-list .agenda-event,
.page-list .event-groups .agenda-event {
    --event-marker-width: 5px;
    --event-marker-height: 45px;
    --event-grid-gap: 5px;
    --event-time-title-gap: 20px;
    position: relative;
    grid-template-columns: max-content minmax(0, 1fr) 18px;
    overflow: hidden;
    padding-left: 14px;
    column-gap: var(--event-grid-gap);
}
.compact-agenda-list .agenda-event .event-marker,
.page-list .event-groups .agenda-event .event-marker {
    position: absolute;
    top: 50%;
    left: 0;
    width: var(--event-marker-width);
    height: var(--event-marker-height);
    border-radius: 0 999px 999px 0;
    transform: translateY(-50%);
}
.compact-agenda-list .agenda-event .event-copy,
.page-list .event-groups .agenda-event .event-copy {
    margin-left: calc(var(--event-time-title-gap) - var(--event-grid-gap));
}
.event-time-meta { position: relative; display: inline-flex; width: max-content; align-items: center; }
.event-time-meta .postponement-icon { position: absolute; top: 50%; left: calc(100% + 4px); transform: translateY(-50%); }
.postponement-icon { display: inline-flex; width: 12px; height: 12px; flex: 0 0 auto; align-items: center; justify-content: center; color: #9b742f; }
.postponement-icon svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 2; }
.compact-event-indicators { display: inline-flex; align-items: center; gap: 4px; margin-right: 5px; vertical-align: baseline; white-space: nowrap; }
.compact-event-indicators .recurrence-icon { margin-right: 0; }
.compact-agenda-list .agenda-event time, .compact-agenda-list .event-copy strong { color: #171d3a; }
.compact-agenda-list .event-copy strong { font-size: 1.02rem; }
.compact-agenda-list .event-copy small { color: #838697; }
.page-today .empty-state { padding-top: 28px; padding-bottom: 28px; }
.page-today .empty-state p:last-child { margin-bottom: 0; }

.empty-state { padding: 42px 24px; text-align: center; }
.empty-state.compact { padding: 25px 14px; }
.empty-state p { max-width: 30rem; margin: 0 auto 15px; color: var(--muted); }
.empty-icon { margin-bottom: 10px; color: var(--gold); font-size: 2.4rem; }
.text-button { min-height: 44px; padding: 0 12px; border: 0; background: none; color: #7a571f; font-weight: 800; }
.page-empty { margin-top: 18px; }

.quick-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    margin-top: 16px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: rgba(255, 255, 255, .035);
}
.quick-summary div { display: grid; min-width: 0; padding: 16px 8px; text-align: center; }
.quick-summary div + div { border-left: 1px solid var(--border); }
.summary-number { color: var(--gold-light); font-family: Georgia, serif; font-size: 1.45rem; }
.quick-summary div span:last-child { overflow: hidden; color: var(--muted-light); font-size: .68rem; text-overflow: ellipsis; }

.bottom-nav {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 20;
    display: grid;
    grid-template-columns: 1fr 1fr 66px 1fr 1fr;
    height: calc(var(--nav-height) + env(safe-area-inset-bottom));
    padding: 7px max(8px, env(safe-area-inset-right)) env(safe-area-inset-bottom) max(8px, env(safe-area-inset-left));
    border-top: 1px solid var(--border);
    background: rgba(23, 19, 17, .96);
    backdrop-filter: blur(18px);
}
.nav-item { display: grid; min-width: 0; place-items: center; align-content: center; color: #aaa19a; font-size: .62rem; gap: 4px; }
.nav-item svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.6; }
.nav-item.is-active { color: var(--gold-light); }
.add-nav-button {
    position: relative;
    top: -23px;
    display: flex;
    width: 58px;
    height: 58px;
    margin: auto;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 5px solid var(--bg);
    border-radius: 50%;
    background: linear-gradient(145deg, var(--gold-light), var(--gold));
    box-shadow: 0 10px 28px rgba(201, 154, 72, .3);
    color: var(--bg);
    font-family: Arial, sans-serif;
    font-size: 2rem;
    font-weight: 300;
    line-height: 1;
}
.add-nav-button span { display: block; line-height: 1; }

.notice { width: calc(100% - 32px); margin: 14px auto 0; padding: 13px 16px; border-radius: 12px; font-size: .88rem; }
.notice ul { margin: 8px 0 0; padding-left: 20px; }
.notice-success { border: 1px solid rgba(105, 164, 116, .35); background: rgba(89, 120, 95, .18); color: #d5ead8; }
.notice-error { border: 1px solid rgba(158, 48, 66, .35); background: #f9e9ec; color: #741d2c; }
.notice-warning { border: 1px solid rgba(201, 154, 72, .35); background: #fff2d9; color: #72511a; }
.event-form-notice { width: 100%; margin: 0 0 14px; }
.offline-banner { position: sticky; top: 0; z-index: 50; padding: 9px 14px; background: #8b2c3c; color: white; font-size: .78rem; text-align: center; }

.field { display: grid; color: var(--text); font-size: .82rem; font-weight: 700; gap: 7px; }
.field b { color: var(--danger); }
.field input, .field select, .field textarea {
    width: 100%;
    min-height: 48px;
    padding: 11px 13px;
    border: 1px solid #cbc4ba;
    border-radius: 11px;
    background: #fffdfa;
    color: var(--text);
    font-weight: 500;
}
.field textarea { min-height: 90px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--gold); outline: 3px solid rgba(201, 154, 72, .2); }
.stack-form { display: grid; gap: 16px; }
.sheet-dialog .event-form { gap: 12px; }
.event-title-field { margin: 2px 0; }
.event-title-field input { min-height: 50px; padding-top: 12px; padding-bottom: 12px; }
.form-grid { display: grid; gap: 14px; }
.type-segmented { min-width: 0; margin: 0; padding: 0; border: 0; }
.type-segmented legend { margin-bottom: 8px; padding: 0; color: var(--text); font-size: .82rem; font-weight: 700; }
.type-segmented legend b { color: var(--danger); }
.segmented-control { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); width: 100%; padding: 3px; border: 1px solid #cfc5b7; border-radius: 13px; background: #eee8df; gap: 3px; }
.segmented-control label { position: relative; min-width: 0; cursor: pointer; }
.segmented-control input { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); opacity: 0; appearance: none; }
.segmented-control span { display: flex; width: 100%; min-height: 46px; align-items: center; justify-content: center; padding: 7px 2px; border: 1px solid transparent; border-radius: 9px; color: #746d64; font-size: clamp(.68rem, 3.15vw, .8rem); font-weight: 750; line-height: 1.1; text-align: center; white-space: nowrap; transition: background .16s ease, border-color .16s ease, color .16s ease, box-shadow .16s ease; }
.segmented-control input[value="appointment"]:checked + span { border-color: #ae7922; background: linear-gradient(145deg, #d8aa55, #bd8730); box-shadow: 0 5px 14px rgba(174, 121, 34, .24); color: #24180a; font-weight: 850; }
.segmented-control input[value="hearing"]:checked + span { border-color: #702536; background: linear-gradient(145deg, #8f3549, #672030); box-shadow: 0 5px 14px rgba(112, 37, 54, .24); color: #fff3f4; font-weight: 850; }
.segmented-control input[value="deadline"]:checked + span { border-color: var(--deadline); background: linear-gradient(145deg, #688ba5, #41637d); box-shadow: 0 5px 14px rgba(65, 99, 125, .24); color: #f5fbff; font-weight: 850; }
.segmented-control input:focus-visible + span { outline: 3px solid var(--gold-light); outline-offset: 2px; }
.time-choice { min-width: 0; margin: 0; padding: 0; border: 0; }
.time-choice legend { margin-bottom: 8px; padding: 0; color: var(--text); font-size: .82rem; font-weight: 700; }
.quick-time-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; }
.quick-time-chip { min-width: 0; min-height: 42px; padding: 4px 2px; border: 1px solid #cfc5b7; border-radius: 10px; background: #f2ede5; color: #655f58; font-size: clamp(.68rem, 3vw, .78rem); font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1; }
.quick-time-chip:hover { border-color: #b89559; background: #ece2d1; }
.quick-time-chip.is-active { border-color: #a97726; background: #2a211e; box-shadow: inset 0 0 0 1px rgba(229, 191, 115, .18); color: var(--gold-light); }
.custom-time-trigger { grid-column: span 2; }
.custom-time-wrap { display: grid; margin-top: 10px; gap: 7px; }
.custom-time-wrap label { color: var(--muted); font-size: .75rem; font-weight: 700; }
.custom-time-wrap input { width: 100%; min-height: 48px; padding: 11px 13px; border: 1px solid #cbc4ba; border-radius: 11px; background: #fffdfa; color: var(--text); color-scheme: light; }
.custom-time-wrap input:focus { border-color: var(--gold); outline: 3px solid rgba(201, 154, 72, .2); }
.date-input-wrap { position: relative; }
.date-field-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.date-field-row > label { flex: 1 1 auto; min-width: 0; white-space: nowrap; }
.date-field-row .date-input-wrap { width: 210px; max-width: calc(100% - 96px); flex: 0 1 210px; }
.date-input-wrap input { padding-right: 54px; color-scheme: light; }
.date-input-wrap input::-webkit-calendar-picker-indicator { opacity: 0; }
.date-picker-button { position: absolute; top: 2px; right: 2px; display: flex; width: 44px; height: 44px; align-items: center; justify-content: center; padding: 0; border: 0; border-radius: 10px; background: transparent; color: #8b631f; }
.date-picker-button:hover { background: #f4ead7; }
.date-picker-button svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
.optional-fields { border-top: 1px solid var(--dark-border); }
.optional-fields summary { min-height: 44px; padding: 13px 2px 8px; color: #765521; font-size: .8rem; font-weight: 800; cursor: pointer; }
.optional-fields[open] summary { margin-bottom: 12px; }
.postponement-date-field { margin-bottom: 14px; }
.postponement-date-field .field-hint { display: block; margin-top: 5px; color: var(--muted); font-size: .72rem; font-weight: 600; }
.postponement-date-field input:disabled { background: #eee9e1; color: #6f6961; opacity: 1; }
.date-picker-button:disabled { cursor: default; opacity: .45; }
.check-field { display: flex; min-height: 44px; align-items: center; color: var(--text); font-size: .86rem; font-weight: 700; gap: 10px; }
.check-field input { width: 20px; height: 20px; accent-color: var(--gold); }
.button {
    display: inline-flex;
    min-height: 48px;
    align-items: center;
    justify-content: center;
    padding: 11px 20px;
    border: 1px solid transparent;
    border-radius: 12px;
    font-weight: 800;
    text-align: center;
}
.button-primary { background: var(--text); color: var(--text-light); }
.button-primary:hover { background: #322b29; }
.button-secondary { border-color: #bca26f; background: #f3e6cb; color: #573b16; }
.button-ghost { border-color: #cfc7bb; background: transparent; color: var(--text); }
.button-danger { background: var(--danger); color: white; }
.button-danger-outline { border-color: rgba(158, 48, 66, .45); background: transparent; color: #872438; }
.button-full { width: 100%; }
.dialog-actions, .form-actions { display: flex; justify-content: flex-end; gap: 10px; }
.event-form-actions { display: grid; grid-template-columns: minmax(0, 1fr); }
.event-edit-actions { grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); }
.event-form-actions .button { min-width: 0; min-height: 48px; padding-inline: 12px; font-size: .9rem; }

dialog { padding: 0; border: 0; background: transparent; color: var(--text); }
dialog::backdrop { background: rgba(8, 6, 5, .72); backdrop-filter: blur(3px); }
/* Only interactive agenda cards opt out of native long-press selection. Scrolling stays native. */
[data-event-actions-id] { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
.event-draft-banner { display: grid; gap: 8px; padding: 12px; border: 1px solid var(--dark-border); border-radius: 12px; background: var(--card); font-size: .85rem; }
.event-draft-banner[hidden] { display: none; }
.event-draft-banner > div { display: flex; flex-wrap: wrap; gap: 8px; }
.event-draft-banner .button { min-height: 40px; padding: 8px 12px; font-size: .85rem; }
dialog.event-action-sheet { position: fixed; inset: auto 0 0; width: 100%; max-width: 720px; margin: 0 auto; }
.event-action-sheet .dialog-shell { border-radius: 24px 24px 0 0; }
.event-action-sheet h2 { margin: 0 0 16px; padding-bottom: 14px; border-bottom: 1px solid var(--dark-border); font-size: 1.15rem; }
.event-action-options { display: grid; gap: 10px; }
.event-action-options .button { width: 100%; min-height: 48px; }
.event-action-options [hidden] { display: none; }
.sheet-dialog { width: 100%; max-width: 720px; max-height: calc(100vh - 18px); margin: auto auto 0; }
.dialog-shell { overflow: auto; max-height: calc(100vh - 18px); padding: 22px 18px calc(24px + env(safe-area-inset-bottom)); border-radius: 24px 24px 0 0; background: var(--card); box-shadow: var(--shadow); }
.dialog-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 19px; gap: 18px; }
.dialog-header h2 { margin: 0; }
.dialog-header .icon-button { flex: 0 0 auto; color: var(--text); }
.event-dialog-header { align-items: center; margin-bottom: 12px; }
.event-dialog-header .eyebrow { margin: 0; }
.event-dialog-heading { min-width: 0; }
.share-origin { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; line-height: 1.4; }
.sheet-dialog .dialog-shell { padding-top: 16px; }
/* A stable sheet frame keeps expansion and scrolling entirely below the header. */
.sheet-dialog.event-sheet { --event-viewport-height: 100vh; height: calc(var(--event-viewport-height) - 18px); max-height: calc(var(--event-viewport-height) - 18px); overflow: hidden; }
@supports (height: 100dvh) {
    .sheet-dialog.event-sheet { --event-viewport-height: 100dvh; }
}
.sheet-dialog.event-sheet .dialog-shell { display: flex; flex-direction: column; height: 100%; max-height: 100%; min-height: 0; overflow: hidden; padding: 0; }
.event-sheet .event-dialog-header { flex: 0 0 auto; margin: 0; padding: 16px 18px 12px; border-bottom: 1px solid var(--dark-border); background: var(--card); }
.event-dialog-body { flex: 1 1 auto; min-height: 0; min-width: 0; overflow-y: auto; overscroll-behavior: contain; overflow-anchor: none; -webkit-overflow-scrolling: touch; padding: 16px 18px calc(24px + env(safe-area-inset-bottom, 0px)); scroll-padding-block: 16px calc(24px + env(safe-area-inset-bottom, 0px)); }
html.event-modal-open { overflow: hidden; overscroll-behavior: none; scroll-behavior: auto; }
body.event-modal-open { position: fixed; top: var(--event-page-scroll-top); right: 0; left: 0; overflow: hidden; }
@media (max-width: 819px) {
    dialog.sheet-dialog.event-sheet {
        --event-sheet-top-gap: calc(12px + env(safe-area-inset-top, 0px));
        --event-sheet-bottom-gap: 12px;
        position: fixed;
        top: calc(var(--event-viewport-top, 0px) + var(--event-sheet-top-gap));
        right: 0;
        bottom: auto;
        left: 0;
        width: calc(100% - 16px - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px));
        margin: 0 auto;
        height: calc(var(--event-viewport-height) - var(--event-sheet-top-gap) - var(--event-sheet-bottom-gap));
        max-height: calc(var(--event-viewport-height) - var(--event-sheet-top-gap) - var(--event-sheet-bottom-gap));
    }
    .event-sheet .dialog-shell { border-radius: 24px; }
    /* Prevent iOS input-focus zoom from changing the visible viewport. */
    dialog.event-sheet .event-form .field input,
    dialog.event-sheet .event-form .field textarea,
    dialog.event-sheet .event-form .field select,
    .event-sheet .custom-time-wrap input { font-size: 16px; }
}
.compact-dialog { width: calc(100% - 32px); max-width: 520px; margin: auto; }
.compact-dialog .dialog-shell { max-height: min(80vh, 620px); border-radius: 22px; }
.confirm-dialog p:not(.eyebrow) { color: var(--muted); }
.notification-list { display: grid; border-top: 1px solid var(--dark-border); }
.notification-row { display: grid; grid-template-columns: 5px 1fr; min-height: 68px; align-items: center; padding: 12px 3px; border-bottom: 1px solid var(--dark-border); gap: 13px; }
.notification-row span:last-child { display: grid; min-width: 0; gap: 2px; }
.notification-row strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notification-row small { color: var(--muted); }

.page-title-row { display: flex; align-items: flex-start; padding: 8px 0 24px; gap: 12px; }
.page-title-row h1 { margin: 0; font-size: clamp(1.8rem, 8vw, 2.8rem); overflow-wrap: anywhere; }
.detail-back-row { padding: 2px 0 12px; }
.detail-card-header { margin-bottom: 24px; }
.detail-title-row { display: flex; align-items: flex-start; gap: 8px; }
.detail-title-indicators { display: inline-flex; flex: 0 0 auto; align-items: center; margin-top: .5rem; color: var(--muted); gap: 5px; }
.detail-title-indicators .recurrence-icon { margin: 0; color: inherit; font-size: .9rem; line-height: 1; }
.detail-title-indicators .postponement-icon { width: 14px; height: 14px; color: inherit; }
.detail-card-header h1 {
    flex: 1 1 auto;
    min-width: 0;
    margin: 0;
    min-height: 34px;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(1.65rem, 6.8vw, 2.15rem);
    font-weight: 700;
    line-height: 1.18;
    overflow-wrap: anywhere;
    word-break: normal;
}
.detail-card-meta { display: flex; flex-wrap: wrap; align-items: center; margin-top: 8px; color: #77716b; font-size: .7rem; font-weight: 400; line-height: 1.5; gap: 3px 6px; }
.detail-meta-item { display: inline-flex; min-width: 0; align-items: center; gap: 6px; }
.detail-event-type { display: inline-flex; align-items: center; gap: 5px; }
.detail-event-type .event-marker { width: 2px; height: 12px; flex: 0 0 auto; }
.detail-recurrence-summary { margin: 4px 0 0; color: #77716b; font-size: .68rem; font-weight: 400; line-height: 1.5; overflow-wrap: anywhere; }
.back-link { display: flex; width: 44px; height: 44px; flex: 0 0 auto; align-items: center; justify-content: center; padding: 0; border: 1px solid var(--border); border-radius: 50%; }
.back-link svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.9; }
.detail-card { position: relative; isolation: isolate; padding: 22px 18px 24px; }
/* Sibling link and form: the card opens edit, the toggle only submits its form. */
.detail-card-edit-link { position: absolute; inset: 0; z-index: 1; border-radius: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.detail-card-edit-link:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; background: rgba(201, 154, 72, .035); }
.detail-card-edit-link:active { background: rgba(201, 154, 72, .07); }
@media (hover: hover) {
    .detail-card-edit-link:hover { background: rgba(201, 154, 72, .035); }
}
.detail-card-with-toggle .detail-title-row { padding-right: 40px; }
.detail-completion-form { position: absolute; top: 14px; right: 7px; z-index: 2; margin: 0; }
.detail-completion-toggle { display: grid; width: 44px; height: 44px; padding: 0; place-items: center; border: 0; border-radius: 50%; background: transparent; color: var(--muted); touch-action: manipulation; }
.detail-completion-circle { display: grid; width: 22px; height: 22px; place-items: center; border: 1.5px solid currentColor; border-radius: 50%; }
.detail-completion-circle svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; visibility: hidden; }
.detail-completion-toggle[aria-pressed="true"] { color: #3e6745; }
.detail-completion-toggle[aria-pressed="true"] .detail-completion-circle { background: #e2eee4; }
.detail-completion-toggle[aria-pressed="true"] svg { visibility: visible; }
.detail-completion-toggle:focus-visible { outline: 2px solid #96702f; outline-offset: 1px; }
.detail-completion-toggle:active { background: rgba(89, 120, 95, .12); }
@media (hover: hover) {
    .detail-completion-toggle:hover { background: rgba(89, 120, 95, .08); }
}
.status-badge { padding: 5px 10px; border-radius: 999px; background: var(--card-secondary); color: var(--muted); font-size: .72rem; font-weight: 800; }
.status-postponed { background: #f4ead7; color: #765521; }
.status-completed { background: #e2eee4; color: #3e6745; }
.status-cancelled { background: #f1dfe2; color: #872438; }
.detail-list { margin: 0; }
.detail-list > div { display: grid; grid-template-columns: minmax(0, 1fr); margin-top: 18px; gap: 4px; }
.detail-list dt { color: var(--muted); font-size: .66rem; font-weight: 400; line-height: 1.4; }
.detail-list dd { margin: 0; color: var(--text); font-size: .94rem; font-weight: 400; line-height: 1.5; overflow-wrap: anywhere; }
.detail-list .detail-date { margin-top: 0; }
.detail-list .detail-date dd { font-weight: 500; }
.detail-list .detail-time { margin-top: 3px; }
.detail-list .detail-notes { margin-top: 22px; }
.postponement-relations { display: grid; overflow: hidden; margin-top: 10px; border: 1px solid var(--border); border-radius: 12px; background: rgba(255, 255, 255, .035); }
.postponement-relation-link { display: flex; min-height: 42px; align-items: center; justify-content: space-between; padding: 8px 13px; color: var(--muted-light); font-size: .76rem; font-weight: 700; gap: 10px; }
.postponement-relation-link + .postponement-relation-link { border-top: 1px solid var(--border); }
.postponement-relation-link:hover { background: rgba(255, 255, 255, .05); color: var(--text-light); }
.postponement-relation-link span:last-child { color: var(--gold-light); font-size: 1.2rem; line-height: 1; }
.detail-actions { display: flex; justify-content: center; margin-top: 12px; }
.detail-section-icon, .detail-empty-time { display: none; }
@media (max-width: 819px) {
    .detail-actions { margin-top: 32px; }
    /* Mobile event detail only; desktop and other detail views keep their layout. */
    .event-detail-view .detail-back-row { padding-bottom: 16px; }
    .event-detail-view .detail-card { padding: 26px 20px 28px; border-radius: 24px; }
    .event-detail-view .detail-card-header { margin-bottom: 22px; padding-bottom: 18px; border-bottom: 1px solid rgba(86, 72, 52, .14); }
    .event-detail-view .detail-title-row { flex-wrap: wrap; gap: 8px; }
    .event-detail-view .detail-title-indicators { flex-basis: 100%; margin-top: 0; }
    .event-detail-view .detail-card-with-toggle .detail-title-row { padding-right: 44px; }
    .event-detail-view .detail-card-header h1 { color: #171624; font-size: clamp(1.85rem, 8vw, 2.25rem); line-height: 1.15; letter-spacing: -.025em; }
    .event-detail-view .detail-card-meta { margin-top: 15px; min-height: 32px; gap: 5px 8px; font-size: .75rem; color: #79736d; }
    .event-detail-view .detail-event-type { gap: 8px; }
    .event-detail-view .detail-event-type .event-marker { width: 3px; height: 18px; border-radius: 3px; }
    .event-detail-view .todo-move-button { width: 32px; height: 32px; border-radius: 50%; background: #f3e7d1; color: #896735; }
    .event-detail-view .todo-move-button svg { width: 17px; height: 17px; }
    .event-detail-view .detail-recurrence-summary { margin-top: 8px; font-size: .72rem; line-height: 1.6; }
    .event-detail-view .detail-completion-form { top: 22px; right: 12px; }
    .event-detail-view .detail-completion-toggle { color: #8b8587; }
    .event-detail-view .detail-completion-toggle[aria-pressed="true"] { color: #3e6745; }
    .event-detail-view .detail-list > div { position: relative; margin-top: 16px; padding-left: 29px; gap: 3px; }
    .event-detail-view .detail-list .detail-date { margin-top: 0; }
    .event-detail-view .detail-list dt { color: #81786d; font-size: .72rem; line-height: 1.5; }
    .event-detail-view .detail-list dt.sr-only { position: static; width: auto; height: auto; margin: 0; padding: 0; overflow: visible; clip: auto; white-space: normal; }
    .event-detail-view .detail-section-icon { display: block; position: absolute; top: 1px; left: 0; width: 17px; height: 17px; fill: none; stroke: #958978; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
    .event-detail-view .detail-list dd { color: #25232d; font-size: 1rem; line-height: 1.6; }
    .event-detail-view .detail-list .detail-date dd { font-weight: 600; }
    .event-detail-view .detail-desktop-time { display: none; }
    .event-detail-view .detail-empty-time { display: inline; color: #827c74; font-size: .88rem; }
    .event-detail-view .detail-list .detail-notes { margin-top: 18px; padding-top: 16px; border-top: 1px solid rgba(86, 72, 52, .14); gap: 5px; }
    .event-detail-view .detail-notes .detail-section-icon { top: 19px; }
    .event-detail-view .detail-notes dd { line-height: 1.75; }
    .event-detail-view .detail-actions { margin-top: 24px; }
    .event-detail-view .detail-delete-button { min-height: 44px; min-width: 144px; padding: 10px 22px; font-size: .86rem; font-weight: 700; }
}
.surface-card.stack-form { padding: 22px; }

.calendar-card { padding: 12px 12px 14px; }
@media (max-width: 1023px) {
    #calendarCard { touch-action: pan-y pinch-zoom; }
}
.calendar-toolbar { display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; }
.calendar-toolbar h2 { margin: 0; font-size: 1.3rem; text-align: center; }
.chip-link { display: inline-flex; min-height: 36px; align-items: center; padding: 5px 13px; border: 1px solid var(--dark-border); border-radius: 999px; color: #6f4b14; font-size: .75rem; font-weight: 800; }
.calendar-today-link { min-height: 44px; flex: 0 0 auto; justify-content: center; padding: 5px 12px; border-color: rgba(229, 191, 115, .38); background: rgba(201, 154, 72, .1); color: var(--gold-light); white-space: nowrap; }
.calendar-today-link:hover { border-color: var(--gold-light); background: rgba(201, 154, 72, .18); }
.weekday-row, .calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.weekday-row { padding: 4px 0 4px; color: var(--muted); font-size: .64rem; font-weight: 800; text-align: center; }
.calendar-grid { overflow: hidden; transition: height .22s ease; }
.calendar-day, .calendar-blank { min-width: 0; aspect-ratio: 1 / 1.02; }
.calendar-day { display: grid; place-items: center; align-content: center; padding: 2px; border: 0; border-radius: 12px; background: transparent; color: var(--text); gap: 3px; }
.calendar-day:hover, .calendar-day.is-selected { background: var(--card-secondary); }
.calendar-day.is-selected { box-shadow: inset 0 0 0 2px var(--gold), 0 4px 12px rgba(201, 154, 72, .16); color: #583c12; font-weight: 850; }
.calendar-day.is-today > span:first-child { display: grid; width: 26px; height: 26px; place-items: center; border-radius: 50%; background: var(--text); color: var(--gold-light); font-weight: 800; }
.day-indicators { display: flex; height: 5px; justify-content: center; gap: 2px; }
.day-indicators i { width: 4px; height: 4px; border-radius: 50%; }
.day-events-panel { overflow: hidden; margin-top: 15px; }
.selected-day-toggle { display: flex; width: 100%; min-height: 58px; align-items: center; justify-content: space-between; padding: 9px 16px 8px 18px; border: 0; background: transparent; color: var(--text); text-align: left; gap: 14px; transition: background .18s ease; }
.selected-day-toggle:hover { background: var(--card-secondary); }
.selected-day-copy { display: block; min-width: 0; }
.selected-day-title { font-family: Georgia, "Times New Roman", serif; font-size: clamp(1.12rem, 5vw, 1.5rem); font-weight: 600; letter-spacing: -.025em; line-height: 1.12; overflow-wrap: anywhere; }
.selected-day-chevron { display: grid; width: 34px; height: 34px; flex: 0 0 auto; place-items: center; border: 1px solid rgba(201, 154, 72, .28); border-radius: 50%; background: #f4ead7; color: #80591a; transition: transform .22s ease, background .18s ease; }
.selected-day-chevron svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 2; }
.calendar-card.is-week-view { padding-bottom: 12px; }
.calendar-card.is-week-view + .day-events-panel { margin-top: 10px; }
.calendar-card.is-week-view + .day-events-panel .selected-day-chevron { transform: rotate(180deg); }

.inline-search { display: grid; grid-template-columns: 22px 1fr auto; align-items: center; padding: 5px 5px 5px 14px; border: 1px solid var(--border); border-radius: 14px; background: rgba(255, 255, 255, .07); gap: 8px; }
.inline-search svg, .search-input-wrap svg { width: 20px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-width: 1.6; }
.inline-search input { min-width: 0; height: 42px; border: 0; outline: 0; background: transparent; color: var(--text-light); }
.inline-search input::placeholder { color: #9f9690; }
.inline-search button { height: 40px; padding: 0 13px; border: 0; border-radius: 10px; background: var(--gold); color: var(--bg); font-size: .76rem; font-weight: 800; }
.filter-chips { display: flex; overflow-x: auto; margin: 10px -16px 18px; padding: 0 16px 3px; scrollbar-width: none; gap: 6px; }
.filter-chips::-webkit-scrollbar { display: none; }
.filter-chips a { flex: 0 0 auto; min-height: 38px; padding: 7px 11px; border: 1px solid var(--border); border-radius: 999px; color: var(--muted-light); font-size: .72rem; font-weight: 700; }
.filter-chips a.is-active { border-color: var(--gold); background: var(--gold); color: var(--bg); }
.past-results-toggle {
    display: flex;
    min-height: 40px;
    align-items: center;
    justify-content: space-between;
    margin-top: 7px;
    padding: 7px 4px 6px;
    border-bottom: 1px solid rgba(229, 191, 115, .26);
    color: var(--gold-light);
    font-size: .76rem;
    font-weight: 750;
}
.past-results-toggle span:last-child { font-size: 1.25rem; line-height: 1; }
.event-groups, .event-group { display: grid; gap: 12px; }
.event-groups { gap: 24px; }
.page-list .event-group { gap: 8px; }
.page-list .event-groups { gap: 18px; }
.page-list .group-title { padding: 0 3px; }
.page-list .group-title h2 {
    margin: 0;
    color: rgba(247, 242, 234, .68);
    font-size: clamp(.82rem, 3.4vw, .94rem);
    font-weight: 500;
    letter-spacing: .01em;
    line-height: 1.25;
}
.event-group .surface-card { overflow: hidden; }
.past-results-section { display: grid; margin-top: 30px; gap: 15px; }
.past-results-heading { display: flex; align-items: flex-end; justify-content: space-between; padding: 0 3px; }
.past-results-heading .eyebrow { margin-bottom: 3px; color: var(--gold-light); }
.past-results-heading h2 { margin: 0; color: var(--text-light); font-size: 1.42rem; }
.past-results-heading > span { color: var(--muted-light); font-size: .72rem; }

.global-search-form { display: grid; padding: 18px; gap: 13px; }
.search-input-wrap { display: grid; grid-template-columns: 24px 1fr; align-items: center; border: 1px solid #cbc4ba; border-radius: 11px; background: #fffdfa; padding-left: 12px; }
.search-input-wrap input { border: 0; background: transparent; outline: 0; }
.result-count { margin: 18px 3px 10px; color: var(--muted-light); font-size: .8rem; }
.result-count + .surface-card { overflow: hidden; }

.settings-section { margin-bottom: 16px; padding: 20px; }
.settings-heading { display: flex; align-items: center; margin-bottom: 18px; gap: 12px; }
.settings-heading h2 { margin: 0 0 2px; font-size: 1.2rem; }
.settings-heading p { margin: 0; color: var(--muted); font-size: .78rem; }
.settings-icon { display: grid; width: 42px; height: 42px; place-items: center; border-radius: 13px; background: var(--card-secondary); color: #755521; font-size: 1.2rem; }
.settings-links { display: grid; border-top: 1px solid var(--dark-border); }
.settings-links a, .settings-links button { display: flex; width: 100%; min-height: 68px; align-items: center; justify-content: space-between; padding: 10px 2px; border: 0; border-bottom: 1px solid var(--dark-border); background: transparent; color: var(--text); text-align: left; }
.settings-links span { display: grid; gap: 2px; }
.settings-links small { color: var(--muted); }
.settings-links b { color: var(--muted); font-size: 1.5rem; }
.install-message { margin: 12px 0 0; color: var(--muted); font-size: .8rem; }
.error-page { display: grid; min-height: 100vh; place-items: center; padding: 24px; }
.error-page .empty-state { max-width: 520px; border-radius: var(--radius); background: var(--card); color: var(--text); }

@media (min-width: 560px) {
    .page-content { padding-right: 28px; padding-left: 28px; }
    .app-header { min-height: 78px; padding: 12px 28px 11px; }
    .brand { gap: 12px; }
    .brand .brand-logo { width: auto; height: 48px; max-width: none; }
    .brand-title { font-size: 18px; }
    .brand-subtitle { font-size: 13px; }
    .notification-button svg { width: 21px; height: 21px; }
    .two-columns { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .agenda-event { grid-template-columns: 5px 92px minmax(0, 1fr) 20px; padding-right: 22px; padding-left: 18px; }
    .dialog-shell { padding: 28px; }
    .sheet-dialog .dialog-shell { padding-top: 22px; }
    .sheet-dialog { margin: auto; }
    .sheet-dialog .dialog-shell { border-radius: 24px; }
    .sheet-dialog.event-sheet { height: min(850px, calc(var(--event-viewport-height) - 48px)); max-height: min(850px, calc(var(--event-viewport-height) - 48px)); }
    .event-sheet .event-dialog-header { padding: 18px 28px 12px; }
    .event-dialog-body { padding-inline: 28px; }
    .calendar-card { padding: 24px; }
    .weekday-row { padding: 8px 0 5px; }
    .calendar-day, .calendar-blank { aspect-ratio: 1 / 1.08; }
    .calendar-day { gap: 4px; }
    .page-today .today-hero { min-height: 350px; padding: 110px 24px 50px; }
    .page-today .today-hero h1 { font-size: clamp(2.85rem, 12vw, 4rem); }
    .page-today .agenda-card { margin-top: -18px; }
    .page-today .app-shell::before { height: 540px; background-position: 72% center; }
}

@media (min-width: 820px) {
    :root { --nav-height: 76px; }
    .app-shell { padding-bottom: 90px; }
    .app-header { min-height: 84px; margin-top: 20px; border: 1px solid var(--border); border-radius: 18px; background: rgba(36, 28, 24, .78); }
    .brand .brand-logo { width: auto; height: 52px; max-width: none; }
    .brand-title { font-size: 20px; }
    .brand-subtitle { font-size: 14px; }
    .page-content { padding-top: 42px; padding-bottom: 30px; }
    .bottom-nav { right: 50%; bottom: 18px; left: auto; width: min(620px, calc(100% - 32px)); transform: translateX(50%); border: 1px solid var(--border); border-radius: 22px; box-shadow: 0 16px 40px rgba(0, 0, 0, .35); }
    .today-hero { padding-top: 22px; }
    .page-today .app-header { margin-top: 20px; border-color: rgba(255, 255, 255, .2); background: rgba(20, 14, 12, .35); backdrop-filter: blur(8px); }
    .page-today .app-shell::before { top: -20px; height: 590px; border-radius: 0 0 32px 32px; background-position: center 56%; }
    .page-today .page-content { padding-top: 0; }
    .page-today .today-hero { min-height: 360px; padding: 135px 30px 58px; }
    .page-today .agenda-card { margin-top: -30px; }
    .agenda-card { border-radius: 28px; }
    .quick-summary { width: 70%; margin-right: auto; margin-left: auto; }
    .settings-section { padding: 26px; }
}

@media (min-width: 1024px) {
    .bottom-nav { display: none; }
    .page-calendar .app-shell { width: min(100%, 1440px); padding-bottom: 0; }
    .page-calendar .app-shell::before {
        position: absolute;
        inset: 0 0 auto;
        z-index: 0;
        height: clamp(700px, 58vw, 900px);
        overflow: hidden;
        border-radius: 32px;
        background:
            linear-gradient(180deg, rgba(13, 9, 7, .3) 0%, rgba(18, 13, 11, .48) 48%, rgba(23, 19, 17, .94) 100%),
            linear-gradient(90deg, rgba(12, 8, 7, .58) 0%, rgba(12, 8, 7, .2) 54%, rgba(12, 8, 7, .4) 100%),
            url("../images/dikigoriko-grafeio.webp") center 45% / cover no-repeat;
        background-clip: padding-box;
        box-shadow: inset 0 -48px 72px rgba(0, 0, 0, .2);
        clip-path: inset(0 round 32px);
        content: "";
        pointer-events: none;
    }
    .page-calendar .app-header,
    .page-calendar .page-content { position: relative; z-index: 1; }
    .page-calendar .app-header {
        border-color: rgba(255, 255, 255, .2);
        background: linear-gradient(135deg, rgba(20, 14, 12, .66), rgba(34, 25, 21, .42));
        box-shadow: 0 14px 36px rgba(0, 0, 0, .16);
        backdrop-filter: blur(10px);
    }
    .page-calendar .page-content { padding: 30px 28px 42px; }
    .calendar-page-heading { padding: 0 2px 18px; gap: 12px; }
    .calendar-page-heading h1 { flex: 0 0 auto; font-size: 1.95rem; text-shadow: 0 3px 18px rgba(0, 0, 0, .72); }
    .calendar-page-heading .calendar-today-link { display: none; }
    .calendar-desktop-actions { display: flex; min-width: 0; align-items: center; justify-content: flex-end; margin-left: auto; gap: 8px; }
    .calendar-desktop-actions a,
    .calendar-desktop-actions button {
        display: inline-flex;
        min-height: 44px;
        align-items: center;
        justify-content: center;
        padding: 8px 16px;
        border: 1px solid var(--border);
        border-radius: 999px;
        background: rgba(23, 17, 14, .5);
        color: var(--text-light);
        font-size: .8rem;
        font-weight: 750;
        white-space: nowrap;
        backdrop-filter: blur(8px);
    }
    .calendar-desktop-actions a:hover,
    .calendar-desktop-actions button:hover { border-color: var(--gold-light); background: rgba(201, 154, 72, .15); }
    .calendar-desktop-actions .calendar-desktop-add { border-color: var(--gold); background: var(--gold); color: var(--bg); }
    .calendar-desktop-actions .calendar-desktop-add:hover { background: var(--gold-light); color: var(--bg); }
    .calendar-desktop-actions [aria-pressed="true"] { border-color: var(--gold); color: var(--gold-light); }
    .calendar-desktop-layout { display: grid; grid-template-columns: minmax(0, 3fr) minmax(340px, 2fr); align-items: start; margin-top: clamp(105px, 10vw, 165px); gap: 28px; }
    .calendar-desktop-layout .day-events-panel { grid-column: 1; grid-row: 1; min-width: 0; margin-top: 0; }
    .calendar-desktop-layout .desktop-list-panel { grid-column: 1; grid-row: 1; min-width: 0; max-height: calc(100vh - 185px); overflow-y: auto; padding: 0 4px 12px 0; scrollbar-color: #74634d transparent; }
    .calendar-desktop-layout .calendar-card { position: sticky; top: 20px; grid-column: 2; grid-row: 1; min-width: 0; padding: 16px 18px 14px; }
    .calendar-desktop-layout .calendar-toolbar { grid-template-columns: 44px minmax(0, 1fr) 44px; }
    .calendar-desktop-layout .calendar-toolbar h2 { font-size: 1.17rem; }
    .calendar-desktop-today { display: inline-flex; grid-column: 1 / -1; min-height: 40px; align-items: center; justify-self: end; margin-top: 1px; padding: 4px 12px; border: 1px solid var(--dark-border); border-radius: 999px; color: #765521; font-size: .73rem; font-weight: 800; }
    .calendar-desktop-today:hover { border-color: var(--gold); background: var(--card-secondary); }
    .calendar-desktop-layout .calendar-day,
    .calendar-desktop-layout .calendar-blank { height: clamp(44px, 3.2vw, 54px); aspect-ratio: auto; }
    .calendar-desktop-layout .calendar-day { font-size: .9rem; }
    .calendar-desktop-layout .weekday-row { padding: 5px 0 4px; font-size: .68rem; }
    .calendar-desktop-layout .selected-day-toggle { min-height: 72px; padding: 16px 22px; cursor: default; }
    .calendar-desktop-layout .selected-day-toggle:disabled { opacity: 1; }
    .calendar-desktop-layout .selected-day-toggle:hover { background: transparent; }
    .calendar-desktop-layout .selected-day-title { font-size: clamp(1.4rem, 2vw, 1.85rem); }
    .calendar-desktop-layout .selected-day-chevron { display: none; }
    .calendar-desktop-layout .day-events-panel .agenda-event { min-height: 68px; }
    .desktop-list-panel .filter-chips { flex-wrap: wrap; overflow: visible; margin: 10px 0 15px; padding: 0; gap: 7px; }
    .desktop-list-panel .event-group { gap: 8px; }
    .desktop-list-panel .event-groups { gap: 18px; }
    .desktop-list-panel .group-title { padding: 0 3px; }
    .desktop-list-panel .group-title h2 { margin: 0; color: rgba(247, 242, 234, .68); font-size: .9rem; font-weight: 500; line-height: 1.25; }
    .desktop-list-panel .event-group .surface-card { overflow: hidden; }
    .desktop-list-panel .event-groups .agenda-event { --event-marker-width: 5px; --event-marker-height: 45px; --event-grid-gap: 5px; --event-time-title-gap: 20px; grid-template-columns: max-content minmax(0, 1fr) 18px; overflow: hidden; padding-left: 14px; column-gap: var(--event-grid-gap); }
    .desktop-list-panel .event-groups .agenda-event .event-marker { position: absolute; top: 50%; left: 0; width: var(--event-marker-width); height: var(--event-marker-height); border-radius: 0 999px 999px 0; transform: translateY(-50%); }
    .desktop-list-panel .event-groups .agenda-event .event-copy { margin-left: calc(var(--event-time-title-gap) - var(--event-grid-gap)); }
    .desktop-list-error { padding: 20px; border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--muted-light); }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
    .todo-action-toast, .todo-action-toast.is-expiring { animation: none; }
    .todo-toast-progress { animation-timing-function: steps(6, end); }
}
