:root {
  --bg: #0f1115; --panel: #171a21; --panel2: #1e222b; --line: #2a2f3a;
  --fg: #e6e8ee; --muted: #8b93a3; --accent: #4f8cff; --ok: #3ccf7a; --warn: #f5b740; --bad: #ff5d5d;
  --estate: #c084fc; --home: #34d399; --money: #fbbf24; --health: #f87171; --work: #60a5fa; --drone: #22d3ee; --personal: #a3a3a3;
  --pad: 14px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--fg); font: 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
body { padding-bottom: 40px; }
button, input, select, textarea { font: inherit; color: inherit; }
header { position: sticky; top: 0; background: var(--bg); padding: calc(env(safe-area-inset-top) + 10px) var(--pad) 6px; z-index: 5; border-bottom: 1px solid var(--line); }
.caprow { display: flex; gap: 8px; }
#capin { flex: 1; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; font-size: 17px; outline: none; }
#capin:focus { border-color: var(--accent); }
#capbtn { width: 46px; border: 0; border-radius: 12px; background: var(--accent); color: #fff; font-size: 20px; font-weight: 700; }
.capmeta { display: flex; justify-content: space-between; align-items: center; min-height: 22px; padding: 4px 4px 0; font-size: 13px; color: var(--muted); }
.preview { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.toggle { display: flex; align-items: center; gap: 4px; }
.toggle input { accent-color: var(--accent); }
nav { display: flex; gap: 4px; margin-top: 8px; overflow-x: auto; }
nav button { flex: 1 0 auto; background: none; border: 0; border-radius: 8px; padding: 8px 5px; color: var(--muted); white-space: nowrap; font-size: 15px; }
nav button.on { background: var(--panel2); color: var(--fg); font-weight: 600; }
nav b { background: var(--accent); color: #fff; border-radius: 10px; padding: 0 6px; font-size: 12px; margin-left: 2px; }
nav b:empty { display: none; }
#filters { display: flex; gap: 6px; overflow-x: auto; padding: 8px 0 4px; scrollbar-width: none; }
#filters::-webkit-scrollbar { display: none; }
.chip { border: 1px solid var(--line); background: none; border-radius: 20px; padding: 3px 10px; font-size: 13px; color: var(--muted); white-space: nowrap; }
.chip.on { color: #fff; border-color: transparent; background: var(--c, var(--accent)); }
main { padding: 6px var(--pad); }
h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 16px 0 6px; display: flex; justify-content: space-between; }
h2.bad { color: var(--bad); }
h2 span { font-weight: 400; }
.task { display: flex; gap: 10px; align-items: flex-start; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-bottom: 6px; }
.task.done .title { text-decoration: line-through; color: var(--muted); }
.task.p1 { border-left: 3px solid var(--warn); }
.task.p2 { border-left: 3px solid var(--bad); }
.check { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--muted); background: none; flex: none; margin-top: 1px; }
.task.done .check { background: var(--ok); border-color: var(--ok); }
.body { flex: 1; min-width: 0; }
.title { word-wrap: break-word; }
.meta { display: flex; flex-wrap: wrap; gap: 6px; font-size: 12px; color: var(--muted); margin-top: 3px; }
.meta .late { color: var(--bad); }
.pill { border-radius: 6px; padding: 0 6px; color: #000; font-weight: 600; background: var(--c, var(--personal)); }
.empty { color: var(--muted); text-align: center; padding: 30px 0; }
.note { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-bottom: 6px; }
.note .meta { margin-top: 6px; }
.note button { background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 3px 8px; font-size: 12px; }
.sheet { position: fixed; inset: 0; z-index: 10; }
.sheet.hidden { display: none; }
.sheetbg { position: absolute; inset: 0; background: rgba(0,0,0,.6); }
.sheetbody { position: absolute; left: 0; right: 0; bottom: 0; background: var(--panel); border-radius: 16px 16px 0 0; padding: 16px var(--pad) calc(env(safe-area-inset-bottom) + 16px); max-height: 92vh; overflow-y: auto; }
.sheetbody input, .sheetbody select, .sheetbody textarea { width: 100%; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 9px 10px; margin-bottom: 8px; }
.sheetbody input[name=title] { font-size: 17px; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
.grid label { font-size: 12px; color: var(--muted); }
.sheetbtns { display: flex; gap: 8px; margin-top: 6px; }
.sheetbtns button { border: 1px solid var(--line); background: var(--panel2); border-radius: 10px; padding: 10px 16px; }
.sheetbtns .primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.sheetbtns .danger { color: var(--bad); }
.spacer { flex: 1; }
#toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--panel2); border: 1px solid var(--line); padding: 8px 14px; border-radius: 10px; opacity: 0; transition: opacity .2s; pointer-events: none; z-index: 20; }
#toast.show { opacity: 1; }
/* six-tab shell */
.hidden { display: none !important; }
#subtabs { margin-top: 4px; }
#subtabs button { font-size: 14px; padding: 5px 4px; }
.empty.big { padding: 48px 0 24px; font-size: 18px; color: var(--fg); }
.empty.small { padding: 10px 0; font-size: 14px; }
.next { margin-top: 10px; font-size: 15px; color: var(--muted); }
.next b { color: var(--fg); font-weight: 600; }
.tag { font-size: 12px; background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 1px 7px; color: var(--muted); margin-left: 4px; vertical-align: middle; }
.daybar { display: flex; align-items: center; gap: 8px; margin: 10px 0 8px; }
.daybar > button { width: 40px; height: 36px; border: 1px solid var(--line); background: var(--panel); border-radius: 10px; font-size: 20px; }
.daybar > button:disabled { opacity: .3; }
.daytitle { flex: 1; text-align: center; font-weight: 600; }
/* brief */
.brief { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 4px 16px 12px; line-height: 1.5; overflow-wrap: anywhere; }
.brief h1 { font-size: 20px; margin: 14px 0 6px; }
.brief h2 { font-size: 13px; margin: 18px 0 6px; color: var(--accent); display: block; }
.brief h3 { font-size: 15px; margin: 12px 0 4px; }
.brief ul, .brief ol { padding-left: 20px; margin: 4px 0; }
.brief li { margin: 3px 0; }
.brief a { color: var(--accent); }
.brief table { border-collapse: collapse; font-size: 14px; width: 100%; }
.brief td, .brief th { border-bottom: 1px solid var(--line); padding: 4px 6px; text-align: left; }
.brief code { background: var(--panel2); border-radius: 4px; padding: 0 4px; }
.brief blockquote { margin: 6px 0; padding-left: 10px; border-left: 3px solid var(--line); color: var(--muted); }
/* email */
details.block { margin-bottom: 4px; }
details.block summary { list-style: none; cursor: pointer; }
details.block summary::-webkit-details-marker { display: none; }
details.block summary h2::before { content: '▾ '; }
details.block:not([open]) summary h2::before { content: '▸ '; }
.mail { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-bottom: 6px; }
.mailbody { display: block; color: inherit; text-decoration: none; }
.mailtop { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; color: var(--muted); }
.from { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.age { flex: none; }
.subj { font-weight: 600; overflow-wrap: anywhere; }
.sum { font-size: 14px; color: var(--muted); margin-top: 2px; }
.badge { border-radius: 6px; padding: 1px 7px; font-size: 12px; background: var(--panel2); border: 1px solid var(--line); color: var(--muted); text-decoration: none; }
.badge.bad { background: var(--bad); border-color: var(--bad); color: #fff; }
.badge.ok { background: var(--ok); border-color: var(--ok); color: #000; font-weight: 600; }
.mail .meta { align-items: center; margin-top: 6px; }
.mail button, .more { background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 3px 10px; font-size: 13px; }
.more { width: 100%; padding: 8px; color: var(--muted); margin-bottom: 6px; }
/* calendar */
.allday { margin-bottom: 8px; }
.hours { border-top: 1px solid var(--line); }
.hour { display: flex; gap: 10px; border-bottom: 1px solid var(--line); min-height: 34px; padding: 4px 0; }
.hour.free { min-height: 26px; }
.hour.nowh .hl { color: var(--accent); font-weight: 700; }
.hl { width: 44px; flex: none; font-size: 12px; color: var(--muted); padding-top: 4px; text-align: right; }
.hitems { flex: 1; min-width: 0; }
.hitems .task { margin: 2px 0; padding: 6px 10px; }
.event { display: flex; flex-wrap: wrap; gap: 2px 8px; background: var(--panel2); border-left: 3px solid var(--accent); border-radius: 8px; padding: 6px 10px; margin: 2px 0 6px; font-size: 14px; }
.event.src-dcs { border-left-color: var(--work); }
.event.src-google { border-left-color: var(--estate); }
.etime { color: var(--muted); font-size: 13px; }
.etitle { font-weight: 600; }
.eloc { width: 100%; color: var(--muted); font-size: 12px; }
@media (min-width: 700px) { body { max-width: 640px; margin: 0 auto; } }
