:root {
    color-scheme: light dark;
    --paper: #fff;
    --ink: #202322;
    --muted: #727773;
    --line: #e9ece9;
    --hover: #f5f7f5;
    --accent: #263b30;
    --on-accent: #fff;
    --error: #aa3029;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-synthesis: none;
    color: var(--ink);
    background: var(--paper);
}

@media (prefers-color-scheme: dark) {
    :root {
        --paper: #171819;
        --ink: #ebeeec;
        --muted: #a0a6a2;
        --line: #303432;
        --hover: #232725;
        --accent: #d9e7dd;
        --on-accent: #1d2a22;
        --error: #ffaaa3;
    }
}

* { box-sizing: border-box; }
body { margin: 0; font-size: 16px; line-height: 1.55; }
button, input, select, textarea { font: inherit; color: inherit; }
button { min-height: 44px; padding: 9px 15px; border: 1px solid var(--line); border-radius: 6px; background: transparent; cursor: pointer; font-size: 14px; }
button:disabled { opacity: .4; cursor: default; }
button:hover:not(:disabled) { background: var(--hover); }
a { color: var(--accent); }
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 27px; line-height: 1.3; font-weight: 500; letter-spacing: -.7px; overflow-wrap: anywhere; }
h1:focus { outline: none; }
h2, h3 { font-size: 16px; font-weight: 500; }
.app-shell { min-height: 100svh; }
.app-header { display: flex; align-items: center; justify-content: space-between; gap: 18px; height: 80px; padding: 0 35px; max-width: 1440px; margin: auto; }
.brand { padding: 0; border: 0; border-radius: 0; font-size: 18px; font-weight: 500; letter-spacing: -.5px; }
.brand:hover:not(:disabled) { background: transparent; }
.header-actions { display: flex; align-items: center; gap: 15px; min-width: 0; }
.icon-button { width: 44px; padding: 10px; display: inline-flex; align-items: center; justify-content: center; border: 0; color: var(--muted); flex-shrink: 0; }
.app-icon { display: inline-block; width: 18px; height: 18px; flex-shrink: 0; background-color: currentColor; -webkit-mask: var(--app-icon) center / contain no-repeat; mask: var(--app-icon) center / contain no-repeat; }
.list-picker, .scope-picker { border: 0; background: transparent; min-height: 44px; padding: 9px 7px; font-size: 14px; max-width: min(240px, 45vw); text-overflow: ellipsis; }
select option { background: var(--paper); color: var(--ink); }
.workspace { width: 100%; max-width: 630px; padding: 38px 34px max(70px, env(safe-area-inset-bottom)); margin: 0 auto; }
.page-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; margin-bottom: 22px; }
.caption { margin-top: 8px; font-size: 14px; color: var(--muted); }
.muted { color: var(--muted); }
.add-button { display: flex; align-items: center; gap: 12px; padding: 13px 0; border: 0; border-radius: 0; color: var(--muted); font-size: 16px; }
.add-button > span { font-size: 22px; font-weight: 400; }
.add-button:hover:not(:disabled) { color: var(--ink); background: transparent; }
.task-section { margin-top: 26px; }
.list-heading { font-size: 14px; color: var(--muted); margin-bottom: 5px; overflow-wrap: anywhere; }
.task-row { display: flex; align-items: flex-start; gap: 7px; border-bottom: 1px solid var(--line); }
.task-check { display: flex; align-items: flex-start; justify-content: flex-start; width: 27px; min-height: 58px; padding-top: 19px; flex-shrink: 0; cursor: pointer; }
.task-check input { appearance: none; width: 20px; height: 20px; flex: 0 0 20px; border: 1.3px solid var(--muted); border-radius: 50%; margin: 0; background: var(--paper); cursor: pointer; display: grid; place-items: center; }
.task-check input:checked { background: var(--accent); border-color: var(--accent); }
.task-check input:checked::after { content: '✓'; color: var(--on-accent); font-size: 13px; }
.task-title { padding: 17px 0; border: 0; border-radius: 0; min-width: 0; flex: 1; text-align: left; font-size: 16px; }
.task-title:hover:not(:disabled) { background: transparent; color: var(--accent); }
.task-title span { display: block; white-space: pre-wrap; overflow-wrap: anywhere; }
.task-title small { display: block; color: var(--muted); font-size: 13px; margin-top: 6px; }
.completed .task-title span { text-decoration: line-through; color: var(--muted); }
.empty { padding: 20px 0; color: var(--muted); font-size: 14px; }
.list-footer { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-top: 28px; }
.scope-picker { color: var(--muted); padding-right: 0; max-width: 100%; font-size: 13px; }
.text-button { border: 0; padding: 9px 0; color: var(--muted); font-size: 14px; text-align: left; }
.text-button:hover:not(:disabled) { background: transparent; color: var(--ink); }
.primary { color: var(--on-accent); background: var(--accent); border-color: var(--accent); }
.primary:hover:not(:disabled) { color: var(--on-accent); background: var(--accent); filter: brightness(.92); }
.back-button { display: inline-flex; align-items: center; gap: 7px; border: 0; padding: 0; color: var(--muted); margin-bottom: 24px; }
.back-button .app-icon { width: 16px; height: 16px; }
.back-button:hover:not(:disabled) { background: transparent; }
.field { display: flex; flex-direction: column; gap: 7px; margin: 21px 0; font-size: 14px; color: var(--muted); }
.field input, .field select, .field textarea { width: 100%; min-width: 0; border: 1px solid var(--line); border-radius: 6px; padding: 10px 11px; background: var(--paper); color: var(--ink); font-size: 16px; }
textarea { resize: vertical; line-height: 1.6; }
.title-editor, .details-editor, .composer > textarea { width: 100%; border: 0; border-radius: 0; padding: 0; background: transparent; resize: vertical; }
.title-editor { font-size: 23px; font-weight: 500; letter-spacing: -.4px; line-height: 1.4; min-height: 66px; field-sizing: content; }
.details-editor { margin: 18px 0 8px; min-height: 80px; field-sizing: content; }
textarea::placeholder { color: var(--muted); }
.composer { padding: 19px 0; border-bottom: 1px solid var(--line); }
.composer > textarea { min-height: 54px; }
.composer .field { margin: 10px 0; }
.actions { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-top: 17px; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 19px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
input[type=checkbox] { accent-color: var(--accent); }
.toggle-row input, .check-label input { width: 18px; height: 18px; flex-shrink: 0; }
.check-label { display: flex; align-items: center; gap: 10px; margin-top: 24px; font-size: 14px; }
.reminder-section { margin-top: 28px; padding-top: 22px; border-top: 1px solid var(--line); }
.reminder-row { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; gap: 10px; font-size: 14px; }
.reminder-row small { display: block; color: var(--muted); font-size: 13px; }
.settings-section { margin-top: 32px; }
.time-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 20px; margin: 6px 0 16px; }
.time-grid .field { margin: 13px 0; }
.quiet-details { margin-top: 24px; font-size: 14px; color: var(--muted); }
.quiet-details summary { min-height: 44px; padding: 10px 0; cursor: pointer; }
.quiet-details p { margin: 8px 0 14px; }
.danger { color: var(--error); }
.logout { margin-top: 30px; padding-top: 18px; border-top: 1px solid var(--line); }
.notice { margin-bottom: 24px; font-size: 14px; color: var(--muted); overflow-wrap: anywhere; }
.error { color: var(--error); }
.detail-link { display: block; overflow-wrap: anywhere; margin: 10px 0; font-size: 14px; }
code { overflow-wrap: anywhere; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.initial-loader { padding: 80px 24px; text-align: center; }
.initial-loader h1 { font-size: 18px; }
.initial-loader p { margin-top: 20px; color: var(--muted); font-size: 14px; }
.login-page { display: grid; align-items: center; min-height: 100svh; padding: 32px 24px; }
.login-content { width: min(100%, 380px); margin: auto; }
.login-content .brand { margin-bottom: 40px; }
.login-content .intro { color: var(--muted); margin: 12px 0 30px; }
.google-button { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 13px 18px; border-radius: 6px; text-decoration: none; background: var(--accent); color: var(--on-accent); }
.google-button svg { width: 22px; height: 22px; background: #fff; border-radius: 50%; padding: 3px; }
.login-content .fine-print { color: var(--muted); font-size: 14px; margin-top: 17px; }
.login-content .message { margin-bottom: 20px; color: var(--muted); font-size: 14px; }
.login-content .message.error { color: var(--error); }
#blazor-error-ui { display: none; position: fixed; bottom: 0; padding: 16px; background: var(--paper); border-top: 1px solid var(--line); width: 100%; z-index: 50; }
@media (max-width: 650px) {
    .app-header { height: 70px; padding: 0 20px; gap: 10px; }
    .header-actions { gap: 4px; }
    .list-picker { max-width: min(180px, 44vw); font-size: 16px; }
    .workspace { padding: 27px 22px max(55px, env(safe-area-inset-bottom)); }
    .task-check { width: 44px; }
    .task-row { gap: 2px; }
}
