:root {
    color-scheme: light;
    --bg: #f3f5fb;
    --card: #ffffff;
    --text: #1c1b1f;
    --muted: #5c5f6a;
    --line: #e4e6ef;
    --primary: #3f4fd8;
    --primary-soft: #e8eaff;
    --danger: #b3261e;
    --star: #e6a100;
    --shadow: 0 10px 30px rgba(28, 27, 31, 0.08);
    font-family: "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
#app { min-height: 100vh; }

.wrap { width: min(880px, 100%); margin: 0 auto; padding: 20px 16px 120px; }
.top { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.top h1 { font-size: 28px; margin: 0; font-weight: 650; flex: 1; }
.icon-btn, .text-btn, .primary, .ghost {
    border: 0; border-radius: 12px; background: transparent; color: var(--primary);
}
.icon-btn { width: 42px; height: 42px; font-size: 20px; }
.primary, .ghost, .text-btn { padding: 10px 16px; }
.primary { background: var(--primary); color: white; }
.ghost { background: white; border: 1px solid var(--line); color: var(--text); }
.primary:disabled, .ghost:disabled { opacity: 0.5; cursor: default; }

.card, .row, .editor, .auth {
    background: var(--card); border-radius: 16px; box-shadow: var(--shadow);
}
.auth { width: min(440px, calc(100% - 32px)); margin: 12vh auto; padding: 28px; }
.auth h1 { margin: 0 0 8px; }
.auth p, .muted { color: var(--muted); }
label { display: block; margin: 14px 0; }
label span { display: block; margin-bottom: 6px; color: var(--muted); font-size: 14px; }
input, textarea, select {
    width: 100%; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: white;
}
textarea { min-height: 90px; resize: vertical; }
.row { display: flex; gap: 8px; align-items: center; padding: 8px 10px; }
.row .grow { flex: 1; min-width: 0; }
.row h2 { margin: 0; font-size: 16px; }
.row p, .meta { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.check { width: 22px; height: 22px; margin: 0 4px; }
.star { color: #b7b9c4; background: none; border: 0; font-size: 22px; }
.star.on { color: var(--star); }
.done-title { text-decoration: line-through; color: var(--muted); }
.important-title { font-weight: 650; }
.overdue { color: var(--danger); }
.section {
    margin: 18px 4px 6px; color: var(--primary); font-weight: 650;
    display: flex; justify-content: space-between;
}
.section button { background: none; border: 0; color: inherit; font-weight: 650; padding: 0; }
.empty { text-align: center; color: var(--muted); padding: 48px 16px; }
.editor { padding: 8px 16px 24px; }
.switch { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; }
.actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; flex-wrap: wrap; }
.file { display: flex; gap: 10px; align-items: center; padding: 8px 0; }
.file a { color: var(--text); text-decoration: none; flex: 1; }
.file small { color: var(--muted); }
.thumb { width: 48px; height: 48px; border-radius: 8px; object-fit: cover; background: var(--primary-soft); }
.badge { min-width: 48px; height: 48px; border-radius: 8px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); font-size: 12px; font-weight: 700; }
.danger { color: var(--danger); background: none; border: 0; }
.error { color: var(--danger); white-space: pre-wrap; }
.preview { background: var(--primary-soft); border-radius: 14px; padding: 12px 14px; margin-top: 12px; }
.nav {
    position: fixed; left: 0; right: 0; bottom: 0; display: flex; background: white;
    border-top: 1px solid var(--line); padding: 6px 12px calc(6px + env(safe-area-inset-bottom));
}
.nav button { flex: 1; border: 0; background: transparent; color: var(--muted); padding: 8px; border-radius: 12px; }
.nav button.on { background: var(--primary-soft); color: var(--primary); }
.fab {
    position: fixed; right: 20px; bottom: 84px; width: 58px; height: 58px; border-radius: 18px;
    border: 0; background: var(--primary); color: white; font-size: 30px; box-shadow: var(--shadow);
}
.scrim { position: fixed; inset: 0; background: rgba(0,0,0,.4); display: flex; align-items: flex-end; z-index: 2; }
.sheet { background: white; width: min(640px, 100%); margin: 0 auto; border-radius: 24px 24px 0 0; padding: 20px 20px 28px; }
.snack {
    position: fixed; left: 16px; right: 16px; bottom: 84px; background: #1c1b1f; color: white;
    border-radius: 14px; padding: 12px 14px; display: flex; justify-content: space-between; align-items: center; gap: 12px;
    z-index: 3;
}
.snack button { background: none; border: 0; color: #c5c8ff; }
.inline { display: flex; gap: 8px; }
.inline > * { flex: 1; }
