:root {
  --bg: #f4f5f7; --card: #fff; --ink: #1b1f24; --muted: #6b7380; --line: #e3e6ea;
  --accent: #2563eb; --accent-ink: #fff; --good: #15803d; --warn: #b45309; --bad: #b91c1c;
  --radius: 10px; --shadow: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.08);
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0f1216; --card: #171b21; --ink: #e6e8eb; --muted: #8b93a0; --line: #262c35;
          --accent: #4f8cff; --good: #4ade80; --warn: #fbbf24; --bad: #f87171; --shadow: none; }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.6rem; margin: .1rem 0 0; letter-spacing: -.01em; }
h2 { font-size: 1.1rem; margin: 0 0 .75rem; display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .9em; }

.top { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .8rem 1.25rem;
       background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; flex-wrap: wrap; }
.brand { font-weight: 700; color: var(--ink); display: flex; align-items: center; gap: .5rem; font-size: 1.05rem; }
.brand:hover { text-decoration: none; }
.dot { width: 12px; height: 12px; border-radius: 4px; background: var(--accent); display: inline-block; }
.top nav { display: flex; gap: 1.1rem; align-items: center; flex-wrap: wrap; }
.top nav a { color: var(--muted); font-weight: 500; }
.top nav a.on { color: var(--ink); }

main { max-width: 1060px; margin: 0 auto; padding: 1.25rem 16px 3rem; }
.foot { text-align: center; color: var(--muted); font-size: .8rem; padding: 1rem; }

.pagehead { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.back { font-size: .9rem; color: var(--muted); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
        padding: 1.1rem 1.25rem; margin-bottom: 1rem; scroll-margin-top: 4.5rem; }
.card.narrow { max-width: 460px; }
.card.empty { text-align: center; color: var(--muted); padding: 2.5rem; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }
.card.board { color: var(--ink); display: block; transition: border-color .15s; }
.card.board:hover { text-decoration: none; border-color: var(--accent); }
.board-top { display: flex; justify-content: space-between; align-items: baseline; }
.board h2 { margin: 0; }
.board p { margin: .2rem 0 .6rem; }
.mini { list-style: none; padding: 0; margin: .6rem 0 0; display: grid; gap: .35rem; font-size: .9rem; }
.mini li { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }

.tabs { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: 1rem; }
.tabs a { padding: .3rem .75rem; border-radius: 999px; background: var(--card); border: 1px solid var(--line); color: var(--muted); font-size: .9rem; }

.muted { color: var(--muted); }
.small { font-size: .85rem; }
.row { display: flex; gap: .5rem; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack { display: grid; gap: .85rem; }
.cols { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .85rem; }
.inline { display: inline; margin: 0; }
.grow { flex: 1 1 260px; }
form.row { margin: .5rem 0; }

label { display: grid; gap: .3rem; font-weight: 500; font-size: .92rem; }
label.check, label.inline-label { display: flex; align-items: center; gap: .45rem; font-weight: 400; }
input, select { font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: .5rem .65rem; min-width: 0; }
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
input[type=checkbox] { width: 1.05rem; height: 1.05rem; accent-color: var(--accent); }
input[type=color] { padding: 2px; width: 44px; height: 38px; }
.row input:not([type=checkbox]):not([type=color]) { flex: 1 1 180px; }
fieldset { border: 1px solid var(--line); border-radius: 8px; padding: .6rem .9rem .8rem; margin: 0; }
legend { font-weight: 600; font-size: .9rem; padding: 0 .3rem; }
.checks { display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; }
details summary { cursor: pointer; color: var(--accent); font-size: .92rem; margin-top: .6rem; }
details.help p { font-size: .9rem; margin: .5rem 0; }

.btn { font: inherit; font-weight: 600; font-size: .92rem; border: 1px solid var(--line); background: var(--card); color: var(--ink);
       padding: .5rem .95rem; border-radius: 8px; cursor: pointer; white-space: nowrap; display: inline-block; }
.btn:hover { border-color: var(--accent); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.choice { margin: .2rem .3rem .2rem 0; font-weight: 500; }
button.link { background: none; border: 0; color: var(--accent); font: inherit; cursor: pointer; padding: 0; }
button.link.danger, .link.danger { color: var(--bad); }

.flash { padding: .7rem 1rem; border-radius: 8px; margin-bottom: 1rem; border: 1px solid; }
.flash.ok { background: color-mix(in srgb, var(--good) 10%, var(--card)); border-color: color-mix(in srgb, var(--good) 35%, transparent); }
.flash.bad { background: color-mix(in srgb, var(--bad) 10%, var(--card)); border-color: color-mix(in srgb, var(--bad) 35%, transparent); }
.flash p { margin: .2rem 0; }

.pill { display: inline-block; font-size: .75rem; font-weight: 600; padding: .1rem .55rem; border-radius: 999px;
        background: var(--bg); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; }
.pill.good { color: var(--good); border-color: color-mix(in srgb, var(--good) 40%, transparent); }
.pill.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, transparent); }
.pill.bad { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, transparent); }
.pill.off { opacity: .6; }

table.list { width: 100%; border-collapse: collapse; margin-bottom: .5rem; }
table.list td { padding: .6rem .4rem; border-top: 1px solid var(--line); vertical-align: middle; }
table.list tr:first-child td { border-top: 0; }
table.list tr.disabled td { opacity: .5; }
td.url { color: var(--muted); font-size: .85rem; max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
td.actions { text-align: right; white-space: nowrap; }
td.actions > * + * { margin-left: .9rem; }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: .5rem; }
.token { display: block; padding: .6rem; background: var(--bg); border-radius: 6px; word-break: break-all; cursor: copy; margin: .4rem 0; font-size: .95rem; }
details.pop { display: inline-block; text-align: left; }
details.pop summary { list-style: none; display: inline; margin: 0; }
details.pop[open] form { margin-top: .4rem; }
.danger-zone { border-color: color-mix(in srgb, var(--bad) 35%, var(--line)); }

.reminders { list-style: none; padding: 0; margin: 0; }
.reminders li { display: flex; align-items: center; gap: .75rem; padding: .6rem 0; border-top: 1px solid var(--line); }
.reminders li:first-child { border-top: 0; }
.rtext { flex: 1; display: grid; }
.tick { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--line); background: none; color: transparent; cursor: pointer; font-weight: 700; flex: none; }
.tick:hover { border-color: var(--good); color: var(--good); }
.reminders li.overdue .rtext span { color: var(--bad); }
.reminders li.today .rtext span { color: var(--warn); }
.reminders.done .rtext { text-decoration: line-through; opacity: .65; }

.login { max-width: 380px; margin: 3rem auto; }
.json { overflow: auto; font-size: .8rem; max-height: 500px; }

/* ---------- Preview screen ---------- */
.screen { aspect-ratio: 16 / 9; border-radius: 14px; overflow: hidden; margin-bottom: 1rem; container-type: inline-size;
          border: 8px solid #111; background: #0b0d10; color: #f2f4f7; }
.screen.light { background: #f6f3ee; color: #1d1d1f; }
.s-grid { height: 100%; display: grid; grid-template-columns: 1.1fr 1fr 1fr; grid-template-rows: auto 1fr auto;
          gap: 2.2cqw; padding: 2.6cqw 3cqw; font-size: 1.45cqw; }
.s-clock { grid-column: 1; }
.s-time { font-size: 7.5cqw; font-weight: 300; line-height: 1; letter-spacing: -.02em; }
.s-time small { font-size: .35em; margin-left: .3em; }
.s-date { font-size: 2cqw; opacity: .75; margin-top: .6cqw; }
.s-greet { font-size: 1.6cqw; opacity: .6; margin-top: .4cqw; }
.s-weather { grid-column: 2 / 4; justify-self: end; text-align: right; }
.s-now { display: flex; align-items: center; gap: 1cqw; justify-content: flex-end; }
.s-icon { font-size: 4.5cqw; }
.s-icon.sm { font-size: 2cqw; }
.s-temp { font-size: 6cqw; font-weight: 300; line-height: 1; }
.s-desc, .s-loc { opacity: .7; }
.s-loc { font-size: 1.1cqw; margin-top: .4cqw; }
.s-days { display: flex; gap: 1.6cqw; justify-content: flex-end; margin-top: 1cqw; }
.s-days div { display: grid; justify-items: center; gap: .2cqw; font-size: 1.2cqw; }
.s-days em { opacity: .55; font-style: normal; }
.s-rain { color: #60a5fa; font-size: 1cqw; }
.s-cal { grid-column: 1 / 3; overflow: hidden; }
.s-rem { grid-column: 3; overflow: hidden; }
.screen h3 { font-size: 1.2cqw; text-transform: uppercase; letter-spacing: .12em; opacity: .55; margin: 0 0 .8cqw; font-weight: 600; }
.s-day { font-weight: 600; margin: .9cqw 0 .3cqw; opacity: .85; }
.s-ev { display: flex; gap: .8cqw; align-items: center; padding: .25cqw 0; }
.s-bar { width: .35cqw; align-self: stretch; border-radius: 2px; }
.s-evt { opacity: .6; min-width: 5.5cqw; }
.s-r { padding: .45cqw 0; }
.s-r small { opacity: .55; margin-left: .5cqw; }
.s-r.today { color: #fbbf24; }
.s-r.late { color: #f87171; }
.s-news { grid-column: 1 / 4; border-top: 1px solid rgba(127,127,127,.25); padding-top: 1cqw; display: grid; grid-template-columns: 1fr 1fr; gap: .5cqw 2cqw; font-size: 1.25cqw; }
.s-news div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.s-src { opacity: .5; font-weight: 600; margin-right: .4cqw; }
.s-empty { opacity: .45; }

@media (max-width: 640px) {
  .top { padding: .7rem 16px; }
  td.url { display: none; }
  table.list td { display: block; border-top: 0; padding: .15rem 0; }
  table.list tr { display: block; border-top: 1px solid var(--line); padding: .5rem 0; }
  td.actions { text-align: left; }
  .pagehead .row { flex-wrap: wrap; }
}
