:root {
  color-scheme: light;
  --bg: #f8f6f1;
  --surface: #fffefa;
  --ink: #24231f;
  --muted: #77736a;
  --line: #e5e0d6;
  --accent: #df5b3f;
  --accent-soft: #f8ded6;
  --oneoff: #397c98;
  --oneoff-soft: #dcecf2;
  --green: #507866;
  --shadow: 0 14px 40px rgba(56, 45, 30, .14);
  font-family: "Hiragino Sans", "Yu Gothic UI", system-ui, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100dvh; background: var(--bg); color: var(--ink); }
button, input, select { font: inherit; }
button { color: inherit; }
.app-shell { width: min(100%, 560px); min-height: 100dvh; margin: 0 auto; padding: env(safe-area-inset-top) 18px calc(104px + env(safe-area-inset-bottom)); }
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 24px 2px 18px; }
.eyebrow { margin: 0 0 5px; color: var(--accent); font: 700 10px/1.2 system-ui; letter-spacing: .16em; }
h1 { margin: 0; font-size: 26px; letter-spacing: -.04em; }
.icon-button, .close-button { border: 0; background: transparent; min-width: 44px; min-height: 44px; border-radius: 50%; font-weight: 800; font-size: 21px; }
.icon-button:active, .close-button:active { background: var(--line); }
.tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; padding: 5px; background: #ece8df; border-radius: 16px; position: sticky; top: max(8px, env(safe-area-inset-top)); z-index: 5; }
.tab { min-height: 48px; border: 0; border-radius: 12px; background: transparent; color: var(--muted); font-weight: 700; }
.tab.is-active { background: var(--surface); color: var(--ink); box-shadow: 0 2px 9px rgba(50,40,25,.08); }
.count { display: inline-grid; place-items: center; min-width: 23px; height: 23px; margin-left: 5px; padding: 0 6px; background: var(--line); border-radius: 99px; font-size: 12px; }
.tab.is-active .count { color: white; background: var(--accent); }
body.oneoff-mode .tab[data-tab="oneoff"].is-active { color: #174f67; background: #f5fbfd; }
body.oneoff-mode .tab[data-tab="oneoff"].is-active .count { background: var(--oneoff); }
.list { padding-top: 22px; }
.category-block { margin-bottom: 24px; }
.category-title { display: flex; align-items: center; gap: 9px; margin: 0 4px 9px; font-size: 13px; color: var(--muted); }
.category-title::after { content: ""; height: 1px; flex: 1; background: var(--line); }
.subcategory-title { margin: 16px 10px 6px; font-size: 12px; color: var(--green); }
.item { display: flex; align-items: center; gap: 13px; width: 100%; min-height: 58px; padding: 8px 8px 8px 12px; border: 1px solid var(--line); border-bottom-width: 0; background: var(--surface); }
.item:first-of-type, .subcategory-title + .item { border-radius: 14px 14px 0 0; }
.item:last-child { border-bottom-width: 1px; border-radius: 0 0 14px 14px; }
.item:only-of-type { border-radius: 14px; border-bottom-width: 1px; }
.check { appearance: none; flex: 0 0 25px; width: 25px; height: 25px; margin: 0; border: 2px solid #bbb5aa; border-radius: 8px; display: grid; place-items: center; }
.check:checked { background: var(--green); border-color: var(--green); }
.check:checked::after { content: "✓"; color: white; font-size: 16px; font-weight: 900; }
.item-name { flex: 1; text-align: left; border: 0; background: transparent; min-height: 40px; padding: 0; font-weight: 650; }
.done .item-name { color: var(--muted); text-decoration: line-through; text-decoration-color: #aaa49a; }
.oneoff-section-title { margin: 4px 4px 10px; font-size: 13px; color: var(--muted); }
.oneoff-divider { display: flex; align-items: center; gap: 12px; margin: 26px 4px 12px; color: var(--muted); font-size: 12px; font-weight: 800; }
.oneoff-divider::before, .oneoff-divider::after { content: ""; height: 1px; flex: 1; background: var(--line); }
.oneoff-complete-header { display: flex; align-items: center; gap: 12px; margin: 26px 4px 12px; }
.oneoff-complete-header::before { content: ""; height: 1px; flex: 1; background: var(--line); }
.oneoff-complete-title { color: var(--muted); font-size: 12px; font-weight: 800; }
.clear-completed { min-height: 42px; padding: 0 12px; border: 1px solid #deb8ae; border-radius: 11px; background: #fff8f6; color: #a44332; font-size: 12px; font-weight: 800; }
.clear-completed:active { background: var(--accent-soft); }
.oneoff-completed .item-name { color: var(--muted); text-decoration: line-through; text-decoration-color: #aaa49a; }
.delete-oneoff { flex: 0 0 44px; width: 44px; height: 44px; border: 0; border-radius: 12px; background: transparent; color: #9d675b; font-size: 25px; line-height: 1; }
.delete-oneoff:active { background: var(--accent-soft); }
.edit-mark { color: #aaa49a; font-size: 19px; padding-right: 6px; }
.empty { text-align: center; padding: 80px 24px; color: var(--muted); }
.empty-mark { display: grid; place-items: center; width: 62px; height: 62px; margin: 0 auto 17px; border: 2px dashed #c9c2b6; border-radius: 20px; font-size: 27px; }
.empty strong { display: block; margin-bottom: 7px; color: var(--ink); font-size: 17px; }
.empty p { margin: 0; font-size: 13px; line-height: 1.7; }
.add-button { position: fixed; z-index: 8; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%); display: flex; align-items: center; justify-content: center; gap: 7px; min-width: 174px; min-height: 56px; border: 0; border-radius: 18px; background: var(--accent); color: white; box-shadow: 0 9px 24px rgba(191,67,42,.28); font-weight: 800; }
.add-button span:first-child { font-size: 24px; line-height: 0; }
body.oneoff-mode .add-button { background: var(--oneoff); box-shadow: 0 9px 24px rgba(38, 105, 132, .28); }
body.oneoff-mode #oneoffDialog .button.primary { background: var(--oneoff); }
body.oneoff-mode #oneoffDialog input:focus { border-color: var(--oneoff); outline: 2px solid var(--oneoff-soft); }
dialog { color: var(--ink); }
dialog::backdrop { background: rgba(31, 28, 23, .45); backdrop-filter: blur(2px); }
.sheet { width: min(100%, 560px); max-width: none; margin: auto auto 0; padding: 0; border: 0; border-radius: 24px 24px 0 0; background: var(--surface); box-shadow: var(--shadow); }
.sheet form, .sheet-panel { padding: 8px 20px calc(24px + env(safe-area-inset-bottom)); }
.sheet-tall { height: min(88dvh, 760px); }
.sheet-tall .sheet-panel { height: 100%; overflow-y: auto; }
.sheet-handle { width: 42px; height: 5px; margin: 4px auto 10px; background: #d4cec4; border-radius: 99px; }
.sheet-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 17px; }
.sheet h2, .modal h2 { margin: 0; font-size: 20px; }
label { display: grid; gap: 7px; margin-bottom: 15px; color: var(--muted); font-size: 12px; font-weight: 700; }
input[type="text"], input:not([type]), select { width: 100%; min-height: 50px; padding: 0 13px; border: 1px solid var(--line); border-radius: 12px; background: white; color: var(--ink); font-size: 16px; }
.field-help { margin: -3px 1px 16px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }
.button { min-height: 48px; padding: 0 20px; border: 0; border-radius: 12px; font-weight: 800; }
.button.primary { flex: 1; background: var(--accent); color: white; }
.button.secondary { background: #eeebe5; }
.hidden { display: none !important; }
.manage-section { padding: 14px 0 24px; border-top: 1px solid var(--line); }
.manage-section h3 { margin: 0; font-size: 15px; }
.section-heading { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.text-button { min-height: 40px; border: 0; background: transparent; color: var(--accent); font-weight: 800; }
.category-manage-block { margin-bottom: 10px; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: white; }
.manage-row { display: flex; align-items: center; min-height: 51px; padding: 0 8px 0 14px; border-bottom: 1px solid var(--line); }
.manage-row:last-child { border-bottom: 0; }
.manage-row.sub { padding-left: 32px; color: var(--muted); font-size: 14px; }
.manage-row strong, .manage-row span:first-child { flex: 1; }
.mini-button { min-width: 38px; min-height: 38px; border: 0; background: transparent; color: var(--muted); }
.add-sub-row { width: 100%; min-height: 42px; border: 0; background: #faf8f4; color: var(--green); font-size: 13px; font-weight: 700; }
.data-actions { margin-top: 12px; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.menu-row { display: flex; align-items: center; justify-content: space-between; width: 100%; min-height: 55px; padding: 0 14px; border: 0; border-bottom: 1px solid var(--line); background: white; text-align: left; font-weight: 650; }
.menu-row:last-child { border: 0; }
.menu-row span:last-of-type { color: var(--muted); font-size: 11px; }
.file-row { margin: 0; color: var(--ink); font-size: 14px; }
.file-row input { display: none; }
.modal { width: min(calc(100% - 36px), 420px); border: 0; border-radius: 20px; padding: 22px; background: var(--surface); box-shadow: var(--shadow); }
.modal h2 { margin-bottom: 20px; }
.toast { visibility: hidden; opacity: 0; position: fixed; z-index: 30; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom)); transform: translate(-50%, 12px); width: max-content; max-width: calc(100% - 36px); padding: 12px 17px; border-radius: 12px; background: #302e29; color: white; font-size: 13px; text-align: center; transition: .2s; }
.toast.show { visibility: visible; opacity: 1; transform: translate(-50%, 0); }
@media (min-width: 700px) { body { background: #e9e4da; } .app-shell { background: var(--bg); box-shadow: 0 0 50px rgba(40,30,15,.12); } }
@media (max-width: 390px) { .tab { padding-inline: 4px; font-size: 12px; } .count { min-width: 20px; height: 20px; margin-left: 2px; padding: 0 5px; } }
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }
