:root {
  color-scheme: light;
  --paper: #f4f4ed;
  --surface: #fffef9;
  --ink: #183e31;
  --muted: #566a5d;
  --line: #c9d2c4;
  --accent: #244f3b;
  --error: #8a3528;
  --focus: #2466ae;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
button, input, select { font: inherit; }
button { min-height: 44px; padding: 0.5rem 0.875rem; color: inherit; cursor: pointer; border: 1px solid var(--line); border-radius: 0; background: var(--surface); }
button:disabled { cursor: wait; opacity: 0.6; }
input, select { min-height: 48px; min-width: 0; padding: 0.625rem 0.75rem; border: 1px solid #738673; border-radius: 0; color: var(--ink); background: var(--surface); }
input::placeholder { color: var(--muted); opacity: 1; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(1.625rem, 4vw, 2rem); font-weight: 650; letter-spacing: -0.045em; }
h2 { font-size: 1rem; font-weight: 650; }
h3 { font-size: 0.9375rem; font-weight: 650; }

.shell { max-width: 48rem; margin: 0 auto; padding: max(1.5rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right)) max(2rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left)); }
.masthead { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0.375rem 1rem; margin-bottom: 1.25rem; }
.account { display: flex; align-items: center; gap: 0.5rem; font-size: 0.875rem; }
.text-button { border-color: transparent; background: transparent; padding-inline: 0.625rem; }
.text-button:hover { background: #e5ebdf; }
.primary { background: var(--accent); border-color: var(--accent); color: #fffef9; font-weight: 600; }
.primary:hover { background: #173a2b; }
.login-form { display: grid; gap: 0.5rem; max-width: 24rem; margin-top: 1.25rem; }
.login-form label:not(:first-child) { margin-top: 0.75rem; }
.login-form .primary { justify-self: start; margin-top: 0.75rem; min-width: 7rem; }
.notice { padding: 0.875rem 0; color: var(--muted); }
.notice.is-error, .action-note.is-error { color: var(--error); }
.list-state { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.5rem; font-size: 0.875rem; color: var(--muted); }
#sync-status[data-state="conflict"], #sync-status[data-state="error"] { color: var(--error); }
.add-form { display: flex; gap: 0.5rem; }
.add-field { flex: 1; min-width: 0; position: relative; }
.add-field input { width: 100%; }
.add-form button { min-width: 4.5rem; }
.item-options { position: absolute; z-index: 2; top: calc(100% - 1px); inset-inline: 0; max-height: min(18rem, 40dvh); overflow-y: auto; margin: 0; padding: 0; list-style: none; border: 1px solid #738673; background: var(--surface); box-shadow: 0 4px 0 #183e3120; }
.item-options li { display: flex; align-items: center; min-height: 48px; padding: 0.625rem 0.75rem; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; cursor: pointer; }
.item-options li:last-child { border-bottom: 0; }
.item-options li:hover, .item-options li[aria-selected="true"] { background: #e5ebdf; }
.action-note { min-height: 1.5rem; padding-top: 0.375rem; font-size: 0.875rem; color: var(--muted); overflow-wrap: anywhere; }
.undo-bar { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; margin: 0.375rem 0 1rem; padding: 0.125rem 0.5rem 0.125rem 0.75rem; border-left: 3px solid var(--accent); background: #e7ede1; font-size: 0.875rem; }
.undo-bar span { min-width: 0; overflow-wrap: anywhere; }
.section-heading { display: flex; align-items: baseline; gap: 0.625rem; padding-top: 0.875rem; padding-bottom: 0.5rem; }
.count { font-size: 0.875rem; font-variant-numeric: tabular-nums; color: var(--muted); }
.items { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.item { border-bottom: 1px solid var(--line); }
.item-main { display: flex; align-items: center; min-height: 58px; gap: 0.125rem; }
.check-hit { display: grid; place-items: center; align-self: stretch; min-width: 48px; min-height: 48px; cursor: pointer; }
.check-hit input { appearance: auto; width: 22px; height: 22px; min-height: 0; margin: 0; accent-color: var(--accent); }
.item-text { flex: 1; min-width: 0; align-self: stretch; border: 0; padding: 0.875rem 0.5rem; background: transparent; text-align: left; overflow-wrap: anywhere; line-height: 1.4; }
.item-text:hover { background: #e9eee3; }
.item.is-completed .item-text { color: var(--muted); text-decoration: line-through; text-decoration-color: #93a291; }
.pending-mark { width: 1.5rem; padding-right: 0.5rem; text-align: center; color: var(--muted); font-size: 0.75rem; }
.item-edit { display: grid; gap: 0.5rem; padding: 0.75rem 0.25rem 0.875rem 3rem; }
.item-edit input { width: 100%; }
.edit-actions { display: flex; flex-wrap: wrap; gap: 0.375rem; }
.edit-actions button { padding-inline: 0.75rem; }
.delete-button { margin-left: auto; color: var(--error); background: transparent; border-color: transparent; }
.draft-note { font-size: 0.8125rem; color: var(--error); }
.add-again { margin-top: 1.5rem; }
.again-list { list-style: none; margin: 0.5rem 0 0; padding: 0; }
.again-list li { display: flex; align-items: center; gap: 0.75rem; padding: 0.375rem 0; }
.again-list button { min-width: 6rem; max-width: 55%; text-align: left; overflow-wrap: anywhere; }
.again-reason { flex: 1; min-width: 0; font-size: 0.8125rem; color: var(--muted); overflow-wrap: anywhere; }
.completed { margin-top: 1.75rem; }
.completed summary { display: flex; align-items: center; gap: 0.625rem; min-height: 48px; cursor: pointer; padding: 0.5rem 0; font-weight: 600; list-style: none; }
.completed summary::-webkit-details-marker { display: none; }
.completed summary::before { content: "+"; font-size: 1.125rem; width: 1rem; font-weight: 400; }
.completed[open] summary::before { content: "−"; }
.empty { color: var(--muted); padding: 0.875rem 0; }
.saved-at { margin-top: 1.25rem; font-size: 0.8125rem; color: var(--muted); }
.conflicts { margin-top: 0.75rem; margin-bottom: 1rem; }
.conflict { border: 1px solid #ac9471; padding: 0.875rem; margin-top: 0.625rem; background: #faf3e5; }
.conflict p { font-size: 0.875rem; overflow-wrap: anywhere; }
.conflict label { display: block; font-size: 0.8125rem; color: var(--muted); margin-top: 0.75rem; margin-bottom: 0.25rem; }
.conflict input { width: 100%; }
.conflict-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.75rem; }
dialog { max-width: min(28rem, calc(100vw - 2rem)); padding: 1.25rem; border: 1px solid var(--line); border-radius: 0; color: var(--ink); background: var(--surface); }
dialog::backdrop { background: #183e315c; }
dialog p { margin-top: 0.625rem; }
.dialog-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1rem; }
.delete-confirm { color: var(--error); border-color: #b68b7d; }
.account-dialog { width: 28rem; max-height: calc(100dvh - 2rem); overflow-y: auto; }
.dialog-heading, .device-heading { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.device-heading { padding-top: 0.5rem; padding-bottom: 0; }
.device-status { color: var(--muted); font-size: 0.875rem; }
.device-status.is-error { color: var(--error); }
.device-list { margin: 0.75rem 0 0; padding: 0; list-style: none; }
.device-list li { display: flex; align-items: center; justify-content: space-between; gap: 0.625rem; border-top: 1px solid var(--line); padding: 0.75rem 0; }
.device-info { min-width: 0; }
.device-name { font-size: 0.9375rem; overflow-wrap: anywhere; }
.device-detail { font-size: 0.75rem; color: var(--muted); }
.device-agent summary { min-height: 44px; display: flex; align-items: center; font-size: 0.8125rem; color: var(--muted); cursor: pointer; }
.device-agent summary::before { content: "+"; padding-right: 0.5rem; }
.device-agent[open] summary::before { content: "−"; }
.device-agent p { margin: 0; overflow-wrap: anywhere; }
.device-list button { flex-shrink: 0; padding-inline: 0.625rem; }
.account-actions { margin-top: 0.75rem; border-top: 1px solid var(--line); padding-top: 1rem; }
.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
@media (min-width: 768px) { .shell { padding-top: 3rem; } .masthead { margin-bottom: 1.75rem; } }
@media (max-width: 350px) { .shell { padding-inline: 0.75rem; } .item-edit { padding-left: 0.5rem; } }
@media (forced-colors: active) { .check-hit input { forced-color-adjust: auto; } button { border-color: ButtonText; } }
