:root {
  --bg: #f2f2f7; --card: #fff; --text: #111; --muted: #6b6b73; --line: #e2e2e8;
  --accent: #0a84ff; --red: #ff3b30; --orange: #ff9500; --green: #34c759;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #000; --card: #1c1c1e; --text: #f2f2f7; --muted: #98989f; --line: #2c2c2e; }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.35 -apple-system, system-ui, "Segoe UI", Roboto, sans-serif; }
body { padding-top: env(safe-area-inset-top); }
button, input, select, textarea { font: inherit; color: inherit; }
#app { max-width: 720px; margin: 0 auto; min-height: 100vh; padding-bottom: calc(84px + env(safe-area-inset-bottom)); }

.top { padding: 14px 16px 6px; display: flex; align-items: center; justify-content: space-between; }
.top h1 { margin: 0; font-size: 28px; }
.top .who { color: var(--muted); font-size: 14px; background: none; border: 0; }
.chips { display: flex; gap: 8px; padding: 6px 16px 10px; overflow-x: auto; }
.chip { border: 0; background: var(--card); padding: 7px 14px; border-radius: 99px; color: var(--muted); white-space: nowrap; }
.chip.on { background: var(--accent); color: #fff; }
.search { margin: 4px 16px 10px; width: calc(100% - 32px); padding: 10px 14px; border-radius: 12px; border: 0; background: var(--card); }

.group { margin: 6px 16px 14px; }
.group h2 { font-size: 13px; text-transform: uppercase; color: var(--muted); margin: 10px 4px 6px; font-weight: 600; }
.group h2.red { color: var(--red); }
.list { background: var(--card); border-radius: 14px; overflow: hidden; }
.row { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
.row .main { flex: 1; min-width: 0; }
.row .title { overflow-wrap: anywhere; }
.row .sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.row .sub.red, .red { color: var(--red); }
.row .sub.orange { color: var(--orange); }
.done .title { text-decoration: line-through; color: var(--muted); }
.check { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--muted); background: none; flex: none; padding: 0; }
.check.on { background: var(--green); border-color: var(--green); position: relative; }
.check.on::after { content: "✓"; color: #fff; position: absolute; inset: 0; font-size: 14px; text-align: center; line-height: 20px; }
.badge { font-size: 12px; padding: 3px 8px; border-radius: 99px; background: var(--bg); color: var(--muted); white-space: nowrap; }
.badge.work { background: #0a84ff22; color: var(--accent); }
.badge.done { background: #34c75922; color: var(--green); }
.empty { text-align: center; color: var(--muted); padding: 40px 20px; }

.card { background: var(--card); border-radius: 14px; margin: 0 16px 10px; padding: 14px; }
.card .name { font-weight: 600; font-size: 17px; display: flex; justify-content: space-between; gap: 8px; }
.card .line { margin-top: 6px; font-size: 14px; }
.card .line b { color: var(--muted); font-weight: 500; }

.tabs { position: fixed; bottom: 0; left: 0; right: 0; display: flex; justify-content: center; background: color-mix(in srgb, var(--card) 92%, transparent); backdrop-filter: blur(14px); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tabs > div { display: flex; width: 100%; max-width: 720px; }
.tab { flex: 1; border: 0; background: none; padding: 9px 0 8px; color: var(--muted); font-size: 11px; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.tab span { font-size: 22px; line-height: 1; }
.tab.on { color: var(--accent); }
.fab { position: fixed; right: 18px; bottom: calc(76px + env(safe-area-inset-bottom)); width: 56px; height: 56px; border-radius: 50%; border: 0; background: var(--accent); color: #fff; font-size: 30px; box-shadow: 0 4px 14px #0004; }

.overlay { position: fixed; inset: 0; background: #0006; z-index: 10; display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--bg); width: 100%; max-width: 720px; max-height: 92vh; overflow-y: auto; border-radius: 18px 18px 0 0; padding: 16px 16px calc(24px + env(safe-area-inset-bottom)); }
.sheet h3 { margin: 0 0 12px; font-size: 20px; }
.sheet .hd { display: flex; justify-content: space-between; align-items: center; }
.field { margin-bottom: 10px; }
.field label { display: block; font-size: 12px; color: var(--muted); margin: 0 4px 4px; text-transform: uppercase; }
.field input, .field select, .field textarea { width: 100%; padding: 11px 12px; border-radius: 10px; border: 0; background: var(--card); min-height: 44px; }
.field textarea { min-height: 70px; resize: vertical; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.btn { border: 0; border-radius: 12px; padding: 13px; background: var(--accent); color: #fff; font-weight: 600; width: 100%; }
.btn.ghost { background: var(--card); color: var(--accent); }
.btn.danger { background: var(--card); color: var(--red); }
.link { background: none; border: 0; color: var(--accent); padding: 6px; }
.note { padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.note small { color: var(--muted); display: block; }
.sec { margin: 18px 0 8px; font-size: 13px; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.addline { display: flex; gap: 8px; }
.addline input { flex: 1; padding: 11px 12px; border-radius: 10px; border: 0; background: var(--card); }
.addline button { width: auto; padding: 0 16px; }

.login { padding: 60px 24px; text-align: center; }
.login h1 { font-size: 32px; margin: 0 0 4px; }
.login p { color: var(--muted); margin: 0 0 24px; }
.login .field { text-align: left; }
.err { color: var(--red); margin: 8px 0; min-height: 20px; }
.toast { position: fixed; left: 50%; bottom: 100px; transform: translateX(-50%); background: #000d; color: #fff; padding: 10px 16px; border-radius: 12px; z-index: 20; }

a.row { color: inherit; text-decoration: none; }
.row[data-folder], .row[data-client], .row[data-task] { cursor: pointer; }
.group.two { margin-top: 0; }
