/* Duet: a dark room with a violet cast. Two person colours; gold is the only bright thing, and it means "both free".
   Phone: header + bottom tabs. Desktop (≥1024px): sidebar + toolbar per view, content fills the width. */
:root {
  color-scheme: dark;
  --bg: #120f14;
  --panel: #1a161f;
  --panel-2: #221d28;
  --panel-3: #2a2431;
  --line: #2e2836;
  --line-2: #3a3343;
  --text: #ece9e1;
  --muted: #9a92a1;
  --dim: #675f70;
  --gold: #f2c66b;
  --gold-2: #f8d78a;
  --gold-ink: #221a08;
  --red: #e0604f;
  --teal: #5fc8d3; --rose: #ef8fa8; --sky: #7fb2ff; --lime: #a7d55c; --violet: #b48bf2; --coral: #ff9a6a;
  --me: var(--teal); --them: var(--rose);
  --radius: 16px;
  --pad: 16px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --tabs-h: 62px;
  --side-w: 248px;
  --shadow: 0 1px 0 rgba(255,255,255,.03) inset, 0 8px 24px rgba(0,0,0,.25);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
html { touch-action: manipulation; -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 15px; line-height: 1.45; -webkit-font-smoothing: antialiased;
  min-height: 100vh; min-height: 100dvh;
  padding-bottom: calc(var(--tabs-h) + 24px + var(--safe-b));
}
a { color: var(--gold-2); text-decoration: none; }
button { font: inherit; color: inherit; }
input, select, textarea { font: inherit; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.015em; }
h1 { font-size: 26px; }
h2 { font-size: 16px; color: var(--muted); font-weight: 500; }
.num { font-variant-numeric: tabular-nums; }
:focus-visible { outline: 2px solid var(--gold-2); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
[hidden] { display: none !important; }
svg { display: block; }

/* Person colours */
.c-teal { --p: var(--teal); } .c-rose { --p: var(--rose); } .c-sky { --p: var(--sky); } .c-lime { --p: var(--lime); } .c-violet { --p: var(--violet); } .c-coral { --p: var(--coral); } .c-gold { --p: var(--gold); }

/* Phone header */
.top { display: flex; align-items: center; gap: 14px; padding: calc(12px + env(safe-area-inset-top, 0px)) var(--pad) 10px; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; background: rgba(18,15,20,.9); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
@media (display-mode: standalone) { .top { padding-top: calc(26px + env(safe-area-inset-top, 0px)); } html { min-height: calc(100% + env(safe-area-inset-top, 0px)); } }
.brand { color: var(--text); font-weight: 700; font-size: 18px; letter-spacing: 0.01em; margin-right: auto; display: inline-flex; align-items: center; gap: 8px; }
.brand-ico { width: 22px; height: 22px; color: var(--gold); flex: none; }
.hdr-actions { display: flex; gap: 8px; align-items: center; }
.hdr-actions a { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--gold); color: var(--gold-2); font-weight: 700; font-size: 17px; line-height: 1; }
.hdr-actions a:hover { background: rgba(242,198,107,.12); }

/* Sidebar (desktop only) */
.side { display: none; }

/* Content */
.view { max-width: 760px; margin: 0 auto; padding: 10px var(--pad) 0; }
.toolbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; margin: 4px 0 16px; flex-wrap: wrap; }
.toolbar h1 { font-size: 24px; line-height: 1.15; }
.toolbar .sub { color: var(--muted); font-size: 14px; margin-top: 2px; }
.toolbar .acts { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.section { margin-top: 24px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 10px; gap: 12px; }
.section-head .link { font-size: 14px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.card.pad { padding: 14px 16px; }
.empty { color: var(--muted); padding: 24px 16px; text-align: center; }
.hint { color: var(--dim); font-size: 13px; }
.err { color: var(--red); font-size: 14px; }
.err:empty { display: none; }
.mono { font-family: ui-monospace, Menlo, monospace; font-size: 13px; color: var(--gold-2); word-break: break-all; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 16px; border-radius: 11px; border: 1px solid var(--line-2); background: var(--panel-2); cursor: pointer; font-weight: 500; min-height: 42px; -webkit-tap-highlight-color: transparent; transition: background .12s, border-color .12s; }
.btn:hover { background: var(--panel-3); border-color: #4a4254; }
.btn.primary { background: var(--gold); color: var(--gold-ink); border-color: var(--gold); font-weight: 600; }
.btn.primary:hover { background: var(--gold-2); border-color: var(--gold-2); }
.btn.danger { color: var(--red); }
.btn.ghost { background: none; border-color: transparent; }
.btn.ghost:hover { background: var(--panel-2); border-color: transparent; }
.btn.small { padding: 6px 12px; min-height: 34px; font-size: 14px; border-radius: 9px; }
.btn.wide { width: 100%; }
.btn svg { width: 16px; height: 16px; }
.btn:disabled { opacity: .5; cursor: default; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row.end { justify-content: flex-end; }
.row.between { justify-content: space-between; }
.row.nowrap { flex-wrap: nowrap; }
.spacer { flex: 1; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--gold-2); font-size: 14px; cursor: pointer; }
.linkbtn.muted { color: var(--muted); }

/* Phone tabs */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; display: flex; justify-content: space-around; background: rgba(18,15,20,.92); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--line); padding: 6px 0 calc(6px + var(--safe-b)); }
.tabs a { display: flex; flex-direction: column; align-items: center; gap: 3px; color: var(--dim); font-size: 11px; width: 72px; padding: 4px 0; border-radius: 10px; }
.tabs a svg { width: 22px; height: 22px; }
.tabs a.on { color: var(--gold-2); }
.tabs:empty { display: none; }

/* People legend */
.legend { display: flex; gap: 14px; align-items: center; color: var(--muted); font-size: 13px; margin: 0 0 12px; flex-wrap: wrap; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; background: var(--p, var(--gold)); }
.legend .both i { background: var(--gold); }
.av { width: 20px; height: 20px; border-radius: 50%; background: var(--p); color: #141018; font-size: 10px; font-weight: 700; display: grid; place-items: center; flex: none; font-style: normal; }

/* Next up */
.nextup { display: flex; align-items: center; gap: 16px; background: linear-gradient(135deg, rgba(242,198,107,.18), rgba(242,198,107,.05) 60%, transparent); border: 1px solid rgba(242,198,107,.4); border-radius: var(--radius); padding: 14px 18px; margin-bottom: 14px; color: var(--text); box-shadow: var(--shadow); }
.nextup .count { text-align: center; min-width: 64px; }
.nextup .count b { display: block; font-size: 32px; line-height: 1; color: var(--gold-2); font-weight: 700; letter-spacing: -.02em; }
.nextup .count span { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.nextup .main { flex: 1; min-width: 0; }
.nextup .kick { color: var(--gold); font-size: 11.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.nextup .t { font-weight: 600; font-size: 17px; }
.nextup .s { color: var(--muted); font-size: 13.5px; }

/* Filter chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1px solid var(--line-2); background: var(--panel); color: var(--muted); border-radius: 999px; padding: 7px 13px; font-size: 14px; cursor: pointer; min-height: 36px; display: inline-flex; align-items: center; gap: 6px; -webkit-tap-highlight-color: transparent; transition: background .12s, border-color .12s, color .12s; }
.chip:hover { border-color: #4a4254; color: var(--text); }
.chip.on { background: rgba(242,198,107,.14); border-color: var(--gold); color: var(--text); }
.chip small { color: var(--dim); font-size: 12px; }
.chip.on small { color: var(--gold-2); }
.filters { margin: 0 0 12px; }
.filters .chips { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; -ms-overflow-style: none; scrollbar-width: none; }
.filters .chips::-webkit-scrollbar { display: none; }
.filters .chip { white-space: nowrap; }

/* Us: day rows with lanes */
.days { display: grid; gap: 10px; }
.dayrow { display: grid; grid-template-columns: 56px 1fr; gap: 12px; padding: 14px 14px 14px 12px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); align-items: start; }
.dayrow.today { border-color: rgba(242,198,107,.35); }
.dayrow .when { text-align: center; padding-top: 2px; }
.dayrow .when b { display: block; font-size: 24px; font-weight: 700; line-height: 1; letter-spacing: -.02em; }
.dayrow .when span { display: block; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; margin-top: 4px; }
.dayrow .when em { display: inline-block; font-style: normal; font-size: 10px; font-weight: 700; color: var(--gold-ink); background: var(--gold); border-radius: 999px; padding: 1px 7px; margin-top: 5px; letter-spacing: .06em; }
.dayrow.weekend .when b { color: var(--gold-2); }
.dayrow .body { min-width: 0; }
.lanes { position: relative; display: grid; gap: 5px; }
.lane { display: grid; grid-template-columns: 20px 1fr; align-items: center; gap: 8px; }
.lane .trk { position: relative; height: 12px; border-radius: 4px; background: var(--panel-2); overflow: hidden; }
.lane .trk::before { content: ""; position: absolute; inset: 0; background-image: repeating-linear-gradient(to right, var(--line-2) 0 1px, transparent 1px var(--tick, 25%)); opacity: .9; }
.lane .blk { position: absolute; top: 0; height: 100%; border-radius: 3px; background: var(--p); opacity: .92; }
.lane .blk.ours { background: var(--gold); }
.overs { position: absolute; left: 28px; right: 0; top: 0; bottom: 0; pointer-events: none; }
.overs .fw { position: absolute; top: -3px; bottom: -3px; background: rgba(242,198,107,.12); border: 1px solid rgba(242,198,107,.55); border-radius: 6px; }
.overs .past { position: absolute; left: 0; top: -3px; bottom: -3px; background: rgba(18,15,20,.55); border-radius: 6px 0 0 6px; }
.overs .nowmark { position: absolute; top: -5px; bottom: -5px; width: 2px; background: var(--gold-2); border-radius: 1px; }
.ticks { display: flex; justify-content: space-between; color: var(--dim); font-size: 10px; margin: 5px 0 0 28px; font-variant-numeric: tabular-nums; }
.wins { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; align-items: center; }
.winbtn { display: inline-flex; align-items: center; gap: 9px; padding: 6px 12px 6px 7px; border-radius: 10px; background: rgba(242,198,107,.08); border: 1px solid rgba(242,198,107,.32); color: var(--text); font-size: 14px; cursor: pointer; min-height: 36px; -webkit-tap-highlight-color: transparent; transition: background .12s, border-color .12s; }
.winbtn:hover { background: rgba(242,198,107,.16); border-color: rgba(242,198,107,.6); }
.winbtn .plus { width: 20px; height: 20px; border-radius: 50%; background: var(--gold); color: var(--gold-ink); display: grid; place-items: center; font-weight: 700; font-size: 15px; line-height: 1; flex: none; }
.winbtn b { font-weight: 600; font-variant-numeric: tabular-nums; }
.winbtn small { color: var(--muted); font-size: 12.5px; }
.winbtn.whole { background: var(--gold); color: var(--gold-ink); border-color: var(--gold); font-weight: 600; }
.winbtn.whole .plus { background: var(--gold-ink); color: var(--gold); }
.winbtn.whole small { color: rgba(34,26,8,.7); }
.none { color: var(--dim); font-size: 13px; }
.planline { display: flex; gap: 8px; align-items: center; font-size: 13.5px; color: var(--gold-2); margin-top: 8px; }
.planline svg { width: 14px; height: 14px; flex: none; }
.planline .t { color: var(--text); font-weight: 500; }
.planline .s { color: var(--muted); }
.more { text-align: center; padding: 16px; }

/* Setup card */
.setup { margin: 0 0 14px; display: grid; }
.setup .steps-grid { display: grid; grid-template-columns: 1fr; }
.setup .step { display: flex; gap: 12px; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.setup .step:last-child { border-bottom: 0; }
.setup .n { width: 26px; height: 26px; border-radius: 50%; border: 1.5px solid var(--dim); display: grid; place-items: center; color: var(--muted); font-size: 12px; font-weight: 600; flex: none; }
.setup .n svg { width: 14px; height: 14px; }
.setup .step.done .n { background: var(--gold); border-color: var(--gold); color: var(--gold-ink); }
.setup .step.done .t { color: var(--muted); text-decoration: line-through; }
.setup .t { flex: 1; min-width: 0; font-weight: 500; }
.setup .t small { display: block; color: var(--dim); font-size: 12.5px; font-weight: 400; }
.setup .step .btn { flex: none; }
.setup .foot { display: flex; justify-content: flex-end; padding: 8px 14px; border-top: 1px solid var(--line); }
@media (max-width: 480px) { .setup .step { flex-wrap: wrap; } .setup .step .btn { margin-left: 38px; } }

/* Week / Day grid */
.strip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin: 0 0 12px; }
.strip a { display: grid; justify-items: center; gap: 2px; padding: 8px 0 6px; border-radius: 12px; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; border: 1px solid transparent; }
.strip a b { font-size: 18px; color: var(--text); font-weight: 600; text-transform: none; }
.strip a.on { background: var(--panel); border-color: var(--line); }
.strip a.today b { color: var(--gold-2); }
.strip a .dots { display: flex; gap: 3px; height: 5px; }
.strip a .dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--p, var(--gold)); display: block; }
.navgroup { display: inline-flex; align-items: center; gap: 2px; background: var(--panel); border: 1px solid var(--line-2); border-radius: 11px; padding: 2px; }
.navgroup button { background: none; border: 0; color: var(--muted); min-height: 34px; padding: 0 10px; border-radius: 9px; cursor: pointer; font-size: 14px; }
.navgroup button:hover { background: var(--panel-2); color: var(--text); }
.navgroup button.arrow { font-size: 20px; line-height: 1; width: 34px; padding: 0; }
.grid { display: grid; grid-template-columns: 48px repeat(var(--cols, 1), minmax(0, 1fr)); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.grid .corner { border-bottom: 1px solid var(--line); }
.grid.single .col { border-left: 1px solid var(--line); }
.grid .dh { padding: 10px 4px; text-align: center; border-bottom: 1px solid var(--line); border-left: 1px solid var(--line); color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
.grid .dh b { display: block; color: var(--text); font-size: 18px; text-transform: none; letter-spacing: 0; margin-top: 2px; }
.grid .dh.today b { color: var(--gold-2); }
.grid .dh a { color: inherit; display: block; }
.grid .allday { grid-column: 2 / -1; display: grid; grid-template-columns: repeat(var(--cols, 1), minmax(0, 1fr)); border-bottom: 1px solid var(--line); min-height: 0; }
.grid .allday .cell { padding: 4px; border-left: 1px solid var(--line); display: grid; gap: 3px; align-content: start; }
.grid .adlbl { color: var(--dim); font-size: 10px; padding: 6px 6px; text-align: right; border-bottom: 1px solid var(--line); }
.grid .hours { position: relative; }
.grid .hours .hr { height: var(--hh, 48px); color: var(--dim); font-size: 10.5px; text-align: right; padding: 0 8px 0 0; transform: translateY(-6px); font-variant-numeric: tabular-nums; }
.grid .col { position: relative; border-left: 1px solid var(--line); height: calc(var(--hh, 48px) * var(--hours, 17)); background-image: repeating-linear-gradient(to bottom, var(--line) 0 1px, transparent 1px var(--hh, 48px)); background-position: 0 -1px; }
.grid .col.today { background-color: rgba(242,198,107,.03); }
.ev { position: absolute; left: 3px; right: 3px; border-radius: 7px; padding: 3px 7px; font-size: 12.5px; line-height: 1.25; overflow: hidden; color: var(--text); background: color-mix(in srgb, var(--p) 24%, var(--panel)); border-left: 3px solid var(--p); cursor: default; box-shadow: 0 1px 2px rgba(0,0,0,.25); }
.ev.them { left: 50%; }
.ev.me { right: 50%; }
.ev.me.alone, .ev.them.alone { left: 3px; right: 3px; }
.ev.ours { left: 3px; right: 3px; background: color-mix(in srgb, var(--gold) 28%, var(--panel)); border-left-color: var(--gold); color: var(--text); cursor: pointer; z-index: 2; }
.ev.editable { cursor: pointer; }
.ev.hidden { color: var(--muted); font-style: italic; }
.ev.notbusy, .ad.notbusy { opacity: .55; border-left-style: dashed; }
.ev .l { color: var(--muted); font-size: 11px; }
.ev.pattern { background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--p) 11%, var(--panel)) 0 7px, color-mix(in srgb, var(--p) 5%, var(--panel)) 7px 12px); color: var(--muted); border-left-color: color-mix(in srgb, var(--p) 60%, var(--panel)); box-shadow: none; opacity: .8; }
.ad { border-radius: 6px; padding: 2px 7px; font-size: 11.5px; background: color-mix(in srgb, var(--p) 24%, var(--panel)); border-left: 3px solid var(--p); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ad.ours { background: color-mix(in srgb, var(--gold) 28%, var(--panel)); border-left-color: var(--gold); cursor: pointer; }
.ad.editable { cursor: pointer; }
.freeband { position: absolute; left: 2px; right: 2px; background: rgba(242,198,107,.1); border: 1px dashed rgba(242,198,107,.35); cursor: pointer; z-index: 1; border-radius: 6px; transition: background .12s; }
.freeband:hover { background: rgba(242,198,107,.2); }
.freeband span { position: absolute; right: 6px; top: 4px; color: var(--gold); font-size: 10.5px; font-weight: 600; letter-spacing: .04em; }
.nowline { position: absolute; left: 0; right: 0; height: 2px; background: var(--gold-2); z-index: 3; pointer-events: none; }
.nowline::before { content: ""; position: absolute; left: -4px; top: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--gold-2); }
.daylist { display: grid; gap: 8px; margin-top: 12px; }
.daylist .item { display: flex; gap: 12px; align-items: center; padding: 10px 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; }
.daylist .item i { width: 4px; height: 36px; border-radius: 2px; background: var(--p, var(--gold)); flex: none; display: block; }
.daylist .item .t { font-weight: 500; }
.daylist .item .s { color: var(--muted); font-size: 13px; }

/* Ideas */
.idea { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.idea:last-child { border-bottom: 0; }
.idea .tick { width: 28px; height: 28px; border-radius: 50%; border: 1.5px solid var(--dim); display: grid; place-items: center; flex: none; color: var(--gold-ink); cursor: pointer; background: none; padding: 0; margin-top: 2px; -webkit-tap-highlight-color: transparent; }
.idea .tick svg { width: 15px; height: 15px; }
.idea.done .tick { background: var(--gold); border-color: var(--gold); }
.idea .main { flex: 1; min-width: 0; cursor: pointer; }
.idea .t { font-weight: 500; }
.idea.done .t { color: var(--muted); }
.idea .meta { display: flex; flex-wrap: wrap; gap: 6px 10px; color: var(--muted); font-size: 12.5px; margin-top: 3px; align-items: center; }
.idea .meta .by { color: var(--p, var(--muted)); }
.idea .meta .tag { background: var(--panel-2); border-radius: 999px; padding: 1px 8px; font-size: 11.5px; }
.idea .meta .planned { color: var(--gold-2); }
.idea .meta a.ext { color: var(--gold-2); display: inline-flex; align-items: center; gap: 4px; }
.idea .meta a.ext svg { width: 12px; height: 12px; }
.idea .thumb { width: 54px; height: 54px; border-radius: 10px; object-fit: cover; flex: none; border: 1px solid var(--line); }
.idea .go { flex: none; }
.pinbtn { background: none; border: 0; padding: 4px; color: var(--dim); cursor: pointer; }
.pinbtn.on { color: var(--gold-2); }
.pinbtn svg { width: 18px; height: 18px; display: block; }
.costdots { color: var(--muted); letter-spacing: 1px; }
.taglabel { color: var(--dim); font-size: 11.5px; text-transform: uppercase; letter-spacing: .1em; font-weight: 700; margin: 0 0 6px 4px; }
.ideagrid { display: grid; gap: 14px; }
.memories { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.memory { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; cursor: pointer; }
.memory img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; }
.memory .nophoto { aspect-ratio: 4 / 3; display: grid; place-items: center; color: var(--dim); background: var(--panel-2); }
.memory .nophoto svg { width: 28px; height: 28px; }
.memory .cap { padding: 8px 10px; }
.memory .cap b { display: block; font-size: 14px; font-weight: 600; }
.memory .cap span { color: var(--muted); font-size: 12px; }
.quick { display: flex; gap: 8px; margin-bottom: 16px; }
.quick .f { flex: 1; }
.monthlabel { color: var(--gold); font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; margin: 18px 0 8px 4px; }

/* Forms */
.form { display: grid; gap: 16px; }
.form .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: stretch; }
.form .grid2 > .f { grid-template-rows: 1fr auto; align-content: end; }
@media (max-width: 420px) { .form .grid2.stack { grid-template-columns: 1fr; } }
label.f, div.f { display: grid; gap: 6px; font-size: 13px; color: var(--muted); align-content: start; }
label.f > span, div.f > span { padding-left: 2px; }
.f input, .f select, .f textarea { -webkit-appearance: none; appearance: none; margin: 0; width: 100%; height: 44px; line-height: 22px; background: var(--bg); color: var(--text); border: 1px solid var(--line-2); border-radius: 11px; padding: 0 12px; font-size: 16px; display: block; }
.f input[type="time"], .f input[type="date"] { display: flex; align-items: center; }
.f textarea { height: auto; min-height: 90px; padding: 11px 12px; resize: vertical; }
.f input:focus, .f select:focus, .f textarea:focus { border-color: var(--gold); outline: none; box-shadow: 0 0 0 3px rgba(242,198,107,.15); }
.f input::placeholder { color: var(--dim); }
.f select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%239a92a1' stroke-width='1.8'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }
.seg { display: flex; background: var(--bg); border: 1px solid var(--line-2); border-radius: 11px; padding: 3px; gap: 3px; }
.seg button { flex: 1; border: 0; background: none; border-radius: 8px; padding: 8px 10px; color: var(--muted); font-size: 14px; cursor: pointer; min-height: 36px; white-space: nowrap; }
.seg button.on { background: var(--panel-2); color: var(--text); font-weight: 600; }
.seg.gold button.on { background: var(--gold); color: var(--gold-ink); }
.seg.compact { display: inline-flex; }
.seg.compact button { flex: none; }
.check { display: flex; align-items: center; gap: 10px; font-size: 15px; color: var(--text); cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--gold); margin: 0; flex: none; }
.check small { display: block; color: var(--dim); font-size: 12.5px; }
.confirm { background: rgba(224,96,79,.1); border: 1px solid rgba(224,96,79,.4); border-radius: 12px; padding: 12px 14px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.page-head { display: flex; align-items: center; gap: 12px; margin: 6px 0 18px; }
.page-head .back { color: var(--muted); font-size: 14px; }
.page-head h1 { font-size: 22px; }
.actions { margin-top: 28px; }
.swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.swatch { width: 34px; height: 34px; border-radius: 50%; background: var(--p); border: 3px solid transparent; cursor: pointer; padding: 0; }
.swatch.on { border-color: var(--text); }
.upload { display: block; border: 1px dashed var(--line-2); border-radius: 12px; padding: 14px; text-align: center; color: var(--muted); cursor: pointer; font-size: 14px; }
.upload input { display: none; }
.pwmeter { margin: -8px 0 0; }
.pwbar { display: flex; gap: 4px; margin: 6px 0 4px; }
.pwbar span { flex: 1; height: 4px; border-radius: 2px; background: var(--line); }
.pwlabel { font-size: 12px; color: var(--dim); }
.pwmeter[data-level="1"] .pwbar span:nth-child(1) { background: var(--red); }
.pwmeter[data-level="2"] .pwbar span:nth-child(-n+2) { background: var(--gold); }
.pwmeter[data-level="3"] .pwbar span { background: var(--teal); }
details > summary { list-style: none; cursor: pointer; }
details > summary::-webkit-details-marker { display: none; }
details > summary::before { content: "›"; display: inline-block; margin-right: 6px; transition: transform .15s; }
details[open] > summary::before { transform: rotate(90deg); }

/* Sheet (plan / entry editor): an in-page panel, never a browser pop-up */
.scrim { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 20; display: grid; align-items: end; justify-items: center; }
.sheet { width: 100%; max-width: 560px; background: var(--panel); border: 1px solid var(--line-2); border-bottom: 0; border-radius: 22px 22px 0 0; padding: 14px 18px calc(18px + var(--safe-b)); max-height: 92dvh; overflow-y: auto; box-shadow: 0 -18px 50px rgba(0,0,0,.45); animation: up .22s ease; }
@keyframes up { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet .grab { width: 40px; height: 4px; border-radius: 2px; background: var(--line-2); margin: 0 auto 12px; }
.sheet h3 { font-size: 19px; margin-bottom: 4px; }
.sheet .sub { color: var(--muted); font-size: 14px; margin: 0 0 14px; }
.sheet .form { gap: 14px; }
.ideapick { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; -ms-overflow-style: none; scrollbar-width: none; }
.ideapick::-webkit-scrollbar { display: none; }
.ideapick .chip { white-space: nowrap; flex: none; }

/* Settings */
.settings .section { margin-top: 28px; padding-top: 16px; border-top: 1px solid var(--line); }
.settings .section:first-of-type { border-top: 0; padding-top: 0; margin-top: 0; }
.settings .section-head { margin-bottom: 12px; }
.settings .section-head h2 { color: var(--gold); font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.settings .version { margin-top: 36px; }
.feed { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.feed:last-child { border-bottom: 0; }
.feed .ico { width: 36px; height: 36px; border-radius: 10px; background: var(--panel-2); display: grid; place-items: center; color: var(--p, var(--muted)); flex: none; }
.feed .ico svg { width: 18px; height: 18px; }
.feed .main { flex: 1; min-width: 0; }
.feed .t { font-weight: 500; }
.feed .s { color: var(--muted); font-size: 13px; }
.feed .s.bad { color: var(--red); }
.feed .opts { display: grid; gap: 8px; margin-top: 10px; }
.pattern { display: flex; gap: 12px; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.pattern:last-child { border-bottom: 0; }
.pattern .main { flex: 1; min-width: 0; }
.pattern .t { font-weight: 500; }
.pattern .s { color: var(--muted); font-size: 13px; }
.pattern.off { opacity: .55; }
.people { display: flex; gap: 10px; flex-wrap: wrap; }
.person { display: inline-flex; align-items: center; gap: 8px; background: var(--panel-2); border-radius: 999px; padding: 5px 12px 5px 5px; }
.person i { width: 26px; height: 26px; border-radius: 50%; background: var(--p); display: grid; place-items: center; color: #141018; font-weight: 700; font-size: 12px; font-style: normal; }

/* Login + welcome */
.login { max-width: 360px; margin: 10vh auto 0; text-align: center; }
.login .mark { width: 72px; height: 72px; margin: 0 auto 18px; border-radius: 22px; background: linear-gradient(160deg, #241d2b, #16121a); border: 1px solid var(--line); display: grid; place-items: center; color: var(--gold-2); }
.login .mark svg { width: 44px; height: 44px; }
.login p { color: var(--muted); }
body.splash-on .top, body.splash-on .side { display: none; }
body.splash-on { padding-bottom: 0; background: radial-gradient(ellipse at 50% 12%, #261c2e 0%, var(--bg) 60%) fixed; }
body.splash-on .view { margin-left: 0 !important; max-width: none; }
.splash { max-width: 440px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; padding: calc(48px + env(safe-area-inset-top, 0px)) 8px calc(24px + var(--safe-b)); }
.splash-mark { width: 84px; height: 84px; border-radius: 22px; background: var(--panel); border: 1px solid var(--line); display: grid; place-items: center; margin: 0 auto; color: var(--gold); }
.splash-mark svg { width: 54px; height: 54px; }
.splash-kick { text-align: center; color: var(--gold); font-size: 12.5px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; margin-top: 18px; }
.splash h1 { text-align: center; font-size: 34px; font-weight: 700; margin-top: 8px; }
.splash h1 span { color: var(--gold); }
.splash-lead { text-align: center; color: var(--muted); font-size: 16px; line-height: 1.45; margin: 10px 8px 0; }
.splash-list { list-style: none; padding: 0; margin: 26px 0 24px; display: grid; gap: 10px; }
.splash-list li { display: flex; gap: 14px; align-items: flex-start; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 13px 14px; }
.splash-ico { width: 36px; height: 36px; border-radius: 10px; background: var(--panel-2); display: grid; place-items: center; flex: none; color: var(--gold-2); }
.splash-ico svg { width: 19px; height: 19px; }
.splash-list b { display: block; font-size: 15.5px; font-weight: 600; }
.splash-list small { display: block; color: var(--muted); font-size: 13.5px; line-height: 1.35; margin-top: 2px; }
.splash-go { margin-top: auto; width: 100%; min-height: 54px; font-size: 17px; font-weight: 700; border-radius: 14px; }
.splash-foot { text-align: center; color: var(--dim); font-size: 13px; margin: 12px 0 0; }

/* Guide */
.lead { font-size: 17px; line-height: 1.5; color: var(--text); max-width: 680px; margin: -6px 0 18px; }
.toc { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin-bottom: 8px; }
.toc a { display: flex; align-items: center; gap: 8px; padding: 9px 11px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); color: var(--text); font-size: 14px; line-height: 1.2; }
.toc .ico { width: 18px; height: 18px; flex: none; color: var(--gold-2); }
.toc .ico svg { width: 100%; height: 100%; display: block; }
.gsec { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px 6px; margin-top: 14px; max-width: 760px; scroll-margin-top: 12px; }
.ghead { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.gico { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; flex: none; background: rgba(242,198,107,.14); color: var(--gold-2); border: 1px solid rgba(242,198,107,.3); }
.gico svg { width: 21px; height: 21px; }
.gico.vtag { font-size: 12px; font-weight: 700; width: auto; padding: 0 10px; }
.ghead h3 { font-size: 18px; font-weight: 600; color: var(--text); }
.gbody p, .changes { margin: 0 0 10px; color: #d3cdd8; line-height: 1.55; }
.gbody b { color: var(--text); }
.changes { padding-left: 20px; }
.changes li { margin-bottom: 5px; }
.version { color: var(--dim); font-size: 13px; text-align: center; margin: 28px 0 0; }
.version a { color: var(--muted); }
.steps { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 4px 0 12px; }
@media (max-width: 560px) { .steps { grid-template-columns: 1fr; } }
.step-box { background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.step-box > b { display: block; color: var(--text); margin-bottom: 6px; }
.step-box ol { margin: 0; padding-left: 20px; color: #d3cdd8; line-height: 1.5; }

/* Toast */
.toast { position: fixed; left: 50%; bottom: calc(var(--tabs-h) + 14px + var(--safe-b)); transform: translateX(-50%) translateY(20px); background: #2c2433; color: var(--text); padding: 10px 16px; border-radius: 999px; font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 30; white-space: nowrap; max-width: calc(100vw - 32px); overflow: hidden; text-overflow: ellipsis; box-shadow: 0 8px 24px rgba(0,0,0,.4); }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- Desktop: sidebar app shell ---------- */
@media (min-width: 1024px) {
  body { padding-bottom: 48px; }
  .top, .tabs { display: none; }
  .side { display: flex; flex-direction: column; gap: 22px; position: fixed; left: 0; top: 0; bottom: 0; width: var(--side-w); background: var(--panel); border-right: 1px solid var(--line); padding: 22px 14px 18px; overflow-y: auto; z-index: 6; }
  .side .brand { font-size: 20px; padding: 0 8px; margin: 0; }
  .side .brand-ico { width: 24px; height: 24px; }
  .side nav { display: grid; gap: 2px; }
  .side nav a { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 10px; color: var(--muted); font-weight: 500; font-size: 15px; }
  .side nav a svg { width: 18px; height: 18px; }
  .side nav a:hover { background: var(--panel-2); color: var(--text); }
  .side nav a.on { background: rgba(242,198,107,.12); color: var(--text); }
  .side nav a.on svg { color: var(--gold-2); }
  .side .sl { color: var(--dim); font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; padding: 0 12px; margin-bottom: 8px; }
  .side .people { display: grid; gap: 6px; padding: 0 6px; }
  .side .people > div { display: flex; align-items: center; gap: 9px; font-size: 14px; color: var(--text); }
  .side .people .av { width: 22px; height: 22px; font-size: 11px; }
  .side .people .both .av { background: var(--gold); }
  .side .people small { color: var(--dim); margin-left: auto; font-size: 12px; }
  .mini { padding: 0 4px; }
  .mini .mh { display: flex; align-items: center; justify-content: space-between; padding: 0 6px; margin-bottom: 6px; font-weight: 600; font-size: 14px; }
  .mini .mh button { background: none; border: 0; color: var(--muted); font-size: 18px; cursor: pointer; width: 26px; height: 26px; border-radius: 50%; line-height: 1; }
  .mini .mh button:hover { background: var(--panel-2); color: var(--text); }
  .mini .mg { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
  .mini .wd { text-align: center; color: var(--dim); font-size: 10px; text-transform: uppercase; padding: 2px 0 4px; }
  .mini a.d { display: grid; place-items: center; aspect-ratio: 1; border-radius: 50%; font-size: 12px; color: var(--muted); position: relative; font-variant-numeric: tabular-nums; }
  .mini a.d:hover { background: var(--panel-2); color: var(--text); }
  .mini a.d.out { color: var(--line-2); }
  .mini a.d.today { color: var(--gold-2); font-weight: 700; }
  .mini a.d.sel { background: var(--panel-3); color: var(--text); }
  .mini a.d.has::after { content: ""; position: absolute; bottom: 3px; width: 4px; height: 4px; border-radius: 50%; background: var(--gold); }
  .side .foot { margin-top: auto; display: grid; gap: 8px; }
  .side .foot .guide { display: flex; justify-content: center; color: var(--dim); font-size: 13px; }

  .view { margin-left: var(--side-w); max-width: none; padding: 30px 40px 0; }
  .view > * { max-width: 1280px; }
  .toolbar { margin: 0 0 22px; }
  .toolbar h1 { font-size: 30px; }
  .toolbar .sub { font-size: 15px; }
  .two { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 28px; align-items: start; }
  .two > * { min-width: 0; }
  .sticky { position: sticky; top: 30px; }
  .dayrow { grid-template-columns: 72px 1fr; padding: 16px 20px 16px 16px; gap: 16px; }
  .dayrow .when b { font-size: 28px; }
  .lane .trk { height: 14px; }
  .ticks { font-size: 11px; }
  .setup .steps-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .setup .step { flex-direction: column; align-items: flex-start; border-bottom: 0; border-right: 1px solid var(--line); padding: 14px 16px; gap: 8px; }
  .setup .step:last-child { border-right: 0; }
  .setup .step .btn { margin-top: auto; margin-left: 0; }
  .form, .page-head, .login { max-width: 680px; }
  .settings { max-width: 820px; }
  .toast { left: auto; right: 28px; bottom: 28px; transform: translateY(20px); }
  .toast.show { transform: none; }
  .scrim { align-items: center; }
  .sheet { border-radius: 22px; border-bottom: 1px solid var(--line-2); max-height: 86vh; }
  .ideagrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .quick { max-width: 640px; }
}
@media (min-width: 1440px) { .view { padding: 36px 56px 0; } }
body.bare .side { display: none; }
body.bare .view { margin-left: 0 !important; max-width: 760px; }
