:root {
  --bg1: #cfe4ff; --bg2: #e9dcff; --bg3: #ffe3ea; --ink: #131722; --muted: #5d6578; --card: rgba(255,255,255,.58);
  --line: rgba(20,30,60,.12); --accent: #5f6cf5; --field: rgba(255,255,255,.75); --shadow: 0 8px 30px rgba(40,50,90,.12);
  --blue:#2f7bf6; --teal:#17a6b8; --green:#2ea85a; --orange:#f08a24; --pink:#e8528f; --purple:#9a5be6; --indigo:#5b5fe0; --red:#e2483d; --yellow:#d9a400;
}
@media (prefers-color-scheme: dark) {
  :root { --bg1:#0d1433; --bg2:#231447; --bg3:#3a1036; --ink:#f1f3fa; --muted:#a3abc2; --card: rgba(30,34,58,.55);
    --line: rgba(255,255,255,.12); --field: rgba(255,255,255,.08); --shadow: 0 8px 30px rgba(0,0,0,.35); }
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { font: 15px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; color: var(--ink);
  background: radial-gradient(1200px 800px at 0% 0%, var(--bg1), transparent 60%), radial-gradient(1000px 700px at 100% 10%, var(--bg3), transparent 60%), linear-gradient(160deg, var(--bg2), var(--bg1));
  background-attachment: fixed; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
#bar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 14px; padding: 10px 16px;
  background: var(--card); backdrop-filter: blur(22px) saturate(1.6); -webkit-backdrop-filter: blur(22px) saturate(1.6); border-bottom: 1px solid var(--line); }
.brand { font-weight: 800; letter-spacing: -.01em; }
#nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; scrollbar-width: none; }
#nav a { padding: 6px 12px; border-radius: 999px; color: var(--muted); font-weight: 600; white-space: nowrap; }
#nav a.on { background: var(--accent); color: #fff; }
#status { font-size: 12px; color: var(--muted); white-space: nowrap; }
#view { max-width: 1100px; margin: 0 auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 22px; padding: 14px; box-shadow: var(--shadow);
  backdrop-filter: blur(22px) saturate(1.6); -webkit-backdrop-filter: blur(22px) saturate(1.6); }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.row.top { align-items: flex-start; }
.grow { flex: 1; min-width: 0; }
.col { display: flex; flex-direction: column; gap: 8px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.title { font-size: 20px; font-weight: 800; letter-spacing: -.01em; margin: 0; }
h2 { font-size: 16px; margin: 0; }
h3 { font-size: 12.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 0; }
.btn { border: 1px solid var(--line); background: var(--field); border-radius: 999px; padding: 6px 13px; cursor: pointer; font-weight: 600; }
.btn:hover { filter: brightness(1.05); }
.btn.primary { background: var(--accent); color: #fff; border-color: transparent; }
.btn.danger { color: var(--red); }
.btn.icon { padding: 6px 10px; }
.btn:disabled { opacity: .45; cursor: default; }
input[type=text], input[type=time], input[type=number], input[type=date], input[type=datetime-local], input[type=url], select, textarea {
  background: var(--field); border: 1px solid var(--line); border-radius: 11px; padding: 7px 10px; min-width: 0; }
input[type=number] { width: 84px; }
textarea { width: 100%; min-height: 70px; resize: vertical; }
label.field { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 5px 0; }
label.field > span { color: var(--muted); }
label.check { display: flex; align-items: center; gap: 8px; padding: 4px 0; cursor: pointer; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: color-mix(in srgb, var(--c, var(--muted)) 16%, transparent); color: var(--c, var(--muted)); white-space: nowrap; }
.badge { width: 32px; height: 32px; flex: none; border-radius: 10px; display: grid; place-items: center; font-size: 16px;
  background: linear-gradient(145deg, color-mix(in srgb, var(--c) 75%, #fff), var(--c)); }
.badge.big { width: 42px; height: 42px; font-size: 21px; border-radius: 13px; }
.t-blue{--c:var(--blue)} .t-teal{--c:var(--teal)} .t-green{--c:var(--green)} .t-orange{--c:var(--orange)} .t-pink{--c:var(--pink)}
.t-purple{--c:var(--purple)} .t-indigo{--c:var(--indigo)} .t-red{--c:var(--red)} .t-yellow{--c:var(--yellow)}
.block { display: flex; gap: 10px; align-items: flex-start; }
.block .time { width: 48px; text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; flex: none; }
.block .time small { display: block; font-weight: 500; color: var(--muted); font-size: 11.5px; }
.block.past { opacity: .5; }
.block.now { border-color: color-mix(in srgb, var(--c) 60%, transparent); background: color-mix(in srgb, var(--c) 14%, var(--card)); }
.steps { margin-top: 8px; display: flex; flex-direction: column; }
.step { display: flex; align-items: center; gap: 9px; padding: 6px 0; cursor: pointer; border-top: 1px solid var(--line); }
.step.done span.name { text-decoration: line-through; color: var(--muted); }
.step.cur span.name { font-weight: 700; }
.step input { width: 18px; height: 18px; accent-color: var(--green); }
.warn { color: var(--orange); }
progress { width: 100%; height: 8px; accent-color: var(--accent); }
.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill { border: 1px solid var(--line); background: var(--field); border-radius: 999px; padding: 8px 15px; cursor: pointer; font-weight: 650; }
.pill.on { background: var(--accent); color: #fff; border-color: transparent; }
.timer { font-size: 34px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
table { width: 100%; border-collapse: collapse; }
td, th { text-align: left; padding: 6px 4px; border-top: 1px solid var(--line); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.board { display: flex; gap: 12px; align-items: flex-start; overflow-x: auto; padding-bottom: 8px; }
.column { width: 290px; flex: none; }
.column.over { outline: 2px dashed var(--accent); }
.kcard { background: var(--field); border: 1px solid var(--line); border-left: 4px solid var(--c); border-radius: 13px; padding: 9px 10px; cursor: grab; }
.month { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; text-align: center; }
.month .dow { font-size: 11.5px; color: var(--muted); font-weight: 700; }
.month button { border: 0; background: none; padding: 5px 0; border-radius: 12px; cursor: pointer; }
.month button.sel { background: var(--accent); color: #fff; }
.month button.today:not(.sel) { outline: 1.5px solid var(--accent); }
.dots { height: 5px; display: flex; justify-content: center; gap: 2px; }
.dots i { width: 4px; height: 4px; border-radius: 50%; background: var(--teal); }
.dots i.busy { background: var(--indigo); }
.days7 { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.days7 button { border: 1px solid var(--line); background: var(--field); border-radius: 10px; padding: 7px 0; cursor: pointer; font-weight: 700; }
.days7 button.on { background: var(--accent); color: #fff; }
.swatches { display: flex; gap: 7px; flex-wrap: wrap; }
.swatches button { width: 24px; height: 24px; border-radius: 50%; border: 2px solid transparent; background: var(--c); cursor: pointer; }
.swatches button.on { border-color: var(--ink); }
.symbols { display: flex; gap: 6px; flex-wrap: wrap; }
.symbols button { border: 1px solid var(--line); background: var(--field); border-radius: 10px; width: 34px; height: 34px; cursor: pointer; }
.symbols button.on { background: var(--accent); }
dialog { border: 1px solid var(--line); border-radius: 22px; padding: 0; width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 40px);
  background: color-mix(in srgb, var(--bg2) 88%, var(--card)); color: var(--ink); box-shadow: 0 30px 80px rgba(0,0,0,.35); }
dialog::backdrop { background: rgba(10,12,30,.45); backdrop-filter: blur(3px); }
dialog header { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: inherit; z-index: 1; }
dialog .body { padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; overflow: auto; }
.section { border-top: 1px solid var(--line); padding-top: 10px; display: flex; flex-direction: column; gap: 6px; }
#toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); background: #111a; color: #fff; padding: 9px 16px; border-radius: 999px;
  backdrop-filter: blur(10px); opacity: 0; transition: opacity .2s; pointer-events: none; z-index: 20; }
#toast.show { opacity: 1; }
.center { min-height: 60vh; display: grid; place-items: center; text-align: center; }
code.token { display: block; word-break: break-all; padding: 10px; background: var(--field); border-radius: 12px; user-select: all; }
/* Pi dashboard */
body.dash #bar { display: none; }
body.dash #view { max-width: none; height: 100vh; padding: 18px; display: grid; grid-template-columns: 1.1fr 1fr; grid-template-rows: auto 1fr; gap: 16px; }
.dash-clock { font-size: clamp(54px, 11vw, 120px); font-weight: 800; letter-spacing: -.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.dash-next { font-size: clamp(20px, 3.4vw, 34px); font-weight: 750; }
body.dash .pill { font-size: clamp(17px, 2.4vw, 24px); padding: 16px 22px; }
body.dash .timer { font-size: clamp(34px, 6vw, 60px); }
@media (max-width: 700px) {
  #view { padding: 10px; }
  body.dash #view { grid-template-columns: 1fr; height: auto; }
  .brand { display: none; }
}
