:root {                    /* default: Royal — royal blue & gold */
  --bg: #0d1322; --panel: #15203a; --panel2: #1d2b4e; --line: #2b3c66;
  --text: #e9ecf5; --muted: #96a2c4; --accent: #d9b45b;
  --up: #66c98a; --down: #e0716f;
}
html[data-theme="ember"] {
  --bg: #111318; --panel: #191c24; --panel2: #222633; --line: #2a2f3c;
  --text: #eae7e0; --muted: #9298a8; --accent: #e5a558;
  --up: #69c98a; --down: #e0716f;
}
html[data-theme="ice"] {
  --bg: #0d1418; --panel: #141d23; --panel2: #1c2830; --line: #263540;
  --text: #e4ebee; --muted: #8fa3ad; --accent: #56c3dc;
  --up: #69c98a; --down: #e0716f;
}
html[data-theme="nocturne"] {
  --bg: #141020; --panel: #1c1730; --panel2: #262040; --line: #322a52;
  --text: #eae6f2; --muted: #9d94b8; --accent: #a78bda;
  --up: #69c98a; --down: #e0716f;
}
html[data-theme="paper"] { /* light */
  --bg: #f5f2ec; --panel: #fdfbf7; --panel2: #ece6d8; --line: #d8d1c0;
  --text: #29261f; --muted: #7a7468; --accent: #8a6d1d;
  --up: #1a8f4a; --down: #c04543;
}
:root {
  --accent-soft: color-mix(in srgb, var(--accent) 14%, transparent);
  --up-soft: color-mix(in srgb, var(--up) 14%, transparent);
  --down-soft: color-mix(in srgb, var(--down) 14%, transparent);
  --radius: 14px;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Menlo, Consolas, monospace;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { background: var(--bg); }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  max-width: 640px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 14px)
           calc(env(safe-area-inset-right) + 16px)
           calc(env(safe-area-inset-bottom) + 28px)
           calc(env(safe-area-inset-left) + 16px);
  -webkit-tap-highlight-color: transparent;
}
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
.theme-row { margin-top: 26px; display: flex; align-items: center; gap: 12px; justify-content: center; }
.theme-label { color: var(--muted); font-size: 0.75rem; }
.theme-dot { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--line); padding: 0; }
.theme-dot.sel { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.foot-note { color: var(--muted); font-size: 0.72rem; text-align: center; margin-top: 8px; line-height: 1.5; }

/* ---------- Orbit app styles (CSS vars only) ---------- */

/* home header */
.app-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 14px; }
.brand { font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; font-size: 0.85rem; color: var(--accent); }
.count { color: var(--muted); font-size: 0.72rem; }

/* search */
.search {
  width: 100%; font-size: 16px; padding: 11px 13px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  color: var(--text); -webkit-appearance: none; appearance: none;
}
.search::placeholder { color: var(--muted); }
.search:focus { outline: none; border-color: var(--accent); }

/* sections + cards */
.sect-label { color: var(--muted); font-size: 0.7rem; letter-spacing: 0.16em; text-transform: uppercase; margin: 18px 2px 8px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 8px; cursor: pointer; }
.card.archived { opacity: 0.72; }
.card-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.name { font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.since { color: var(--muted); font-size: 0.75rem; flex: none; }
.meta { color: var(--muted); font-size: 0.8rem; margin-top: 3px; }
.note-line { color: var(--muted); font-size: 0.82rem; margin-top: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ping cards */
.ping-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 8px; flex-wrap: wrap; }
.ping-date { color: var(--accent); font-size: 0.85rem; font-weight: 500; }
.ping-date.late { color: var(--down); }
.ping-actions { display: flex; gap: 8px; flex: none; }
.act { background: var(--panel2); border: 1px solid var(--line); border-radius: 999px; padding: 6px 13px; font-size: 0.8rem; color: var(--accent); }
.act:active { background: var(--accent-soft); }

/* empty + info lines */
.empty { border: 1px dashed var(--line); border-radius: var(--radius); padding: 24px 16px; text-align: center; color: var(--muted); font-size: 0.88rem; margin-top: 12px; }
.info-line { color: var(--muted); font-size: 0.84rem; text-align: center; margin: 16px 0 4px; }

/* floating add button */
.fab {
  position: fixed;
  right: max(calc(env(safe-area-inset-right) + 16px), calc(50vw - 304px));
  bottom: calc(env(safe-area-inset-bottom) + 20px);
  width: 54px; height: 54px; border-radius: 50%;
  background: var(--accent); color: var(--bg);
  font-size: 28px; font-weight: 600; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 22px color-mix(in srgb, var(--bg) 55%, transparent);
}
.home { padding-bottom: 76px; } /* keep scroll-end content clear of the fab */

/* home foot */
.home-foot { margin-top: 26px; }
.foot-links { display: flex; justify-content: center; gap: 20px; }
.foot-link { color: var(--muted); font-size: 0.8rem; text-decoration: underline; text-underline-offset: 3px; }
.import-msg { color: var(--muted); font-size: 0.78rem; text-align: center; margin-top: 10px; }
.import-msg.bad { color: var(--down); }
.hidden-file { display: none; }

/* bars (form/detail) */
.bar { display: flex; align-items: center; gap: 6px; margin-bottom: 14px; }
.back { color: var(--muted); font-size: 1.35rem; line-height: 1; padding: 6px 12px 6px 2px; }
.bar-title { font-weight: 600; }
.bar-spacer { flex: 1; }
.bar-act { color: var(--accent); font-size: 0.9rem; padding: 6px 2px; }

/* form fields */
.lbl { display: block; color: var(--muted); font-size: 0.7rem; letter-spacing: 0.14em; text-transform: uppercase; margin: 18px 2px 7px; }
.field {
  width: 100%; font-size: 16px; padding: 11px 13px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  color: var(--text); -webkit-appearance: none; appearance: none;
}
.field:focus { outline: none; border-color: var(--accent); }
.field.err { border-color: var(--down); }
.field::placeholder { color: var(--muted); }
textarea.field { resize: vertical; min-height: 88px; font-family: inherit; line-height: 1.45; }
input.field[type="date"] { min-height: 46px; }
.chips { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.chip { background: var(--panel2); border: 1px solid var(--line); border-radius: 999px; padding: 7px 14px; font-size: 0.8rem; color: var(--text); }
.chip.sel { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.btn { background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; font-size: 0.9rem; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--bg); font-weight: 600; }
.btn.big { width: 100%; padding: 14px; border-radius: 12px; font-size: 1rem; margin-top: 26px; }
.btn.acc { border-color: var(--accent); color: var(--accent); background: none; flex: none; font-size: 0.85rem; }

/* detail */
.d-name { font-size: 1.35rem; font-weight: 600; margin-top: 2px; overflow-wrap: anywhere; }
.d-meta { color: var(--muted); font-size: 0.85rem; margin-top: 4px; }
.d-note { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin-top: 14px; white-space: pre-wrap; font-size: 0.92rem; line-height: 1.5; overflow-wrap: anywhere; }
.d-note.none { color: var(--muted); }
.ping-panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin-top: 10px; display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.ping-panel .chips { margin-top: 0; }
.log-row { display: flex; gap: 8px; }
.log-row .field { flex: 1; min-width: 0; }
.touches { margin-top: 6px; }
.touch-item { display: flex; gap: 12px; align-items: baseline; padding: 9px 2px; border-bottom: 1px solid var(--line); font-size: 0.86rem; }
.touch-item:last-child { border-bottom: none; }
.t-date { color: var(--muted); font-size: 0.74rem; flex: none; min-width: 58px; }
.t-note { min-width: 0; overflow-wrap: anywhere; }
.t-note.none { color: var(--muted); }
.more-btn { color: var(--accent); font-size: 0.8rem; padding: 9px 2px; }
.d-actions { display: flex; align-items: center; gap: 18px; margin-top: 26px; }
.link-btn { color: var(--muted); font-size: 0.88rem; text-decoration: underline; text-underline-offset: 3px; }
.del-btn { color: var(--down); font-size: 0.88rem; margin-left: auto; }
.del-btn.armed { font-weight: 600; }
