:root {
  --bg: #0d0f13; --panel: #161920; --panel2: #1d2129; --line: #343a47; --text: #e3e7ef; --muted: #aab2c3;
  --accent: #f2b84b; --on-accent: #1a1204; --good: #6fd39a; --fair: #f2b84b; --bad: #ef7b7b;
  --spark: #4fc3b5; --spark-fill: rgba(79,195,181,.22); --radius: 12px;
}
body.night {
  --bg: #080000; --panel: #130404; --panel2: #1c0707; --line: #3a1010; --text: #ff6a5c; --muted: #c0504a;
  --accent: #ff8a70; --on-accent: #200404; --good: #d06040; --fair: #c05030; --bad: #ff4030;
  --spark: #ff5a4a; --spark-fill: rgba(255,60,40,.22);
}
body.day {
  --bg: #f1f3f6; --panel: #ffffff; --panel2: #f3f5f8; --line: #c9d0db; --text: #1b1f27; --muted: #4d586a;
  --accent: #a85a05; --on-accent: #ffffff; --good: #14733f; --fair: #9a5b00; --bad: #b3261e;
  --spark: #0f7a6e; --spark-fill: rgba(15,122,110,.18);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg);
  color: var(--text); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding-bottom: env(safe-area-inset-bottom);
}
.top { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 16px; position: sticky; top: 0; z-index: 5;
  background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 8px; }
.brand h1 { margin: 0; font-size: 1.25rem; letter-spacing: .04em; }
.logo { color: var(--accent); font-size: 1.4rem; }
.top-actions { display: flex; gap: 6px; }
main { max-width: 1100px; margin: 0 auto; padding: 12px; display: grid; gap: 12px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.card h2 { margin: 0 0 8px; font-size: 1.05rem; }
.card h2 small, .card h3 small { color: var(--muted); font-weight: 400; font-size: .8rem; margin-left: 6px; }
.muted { color: var(--muted); margin: 0 0 8px; font-size: .88rem; }
.controls { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
label { display: grid; gap: 4px; font-size: .8rem; color: var(--muted); }
select, input, textarea, button {
  font: inherit; color: var(--text); background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 9px 10px; min-height: 40px;
}
input[type=checkbox] { min-height: 0; width: 18px; height: 18px; accent-color: var(--accent); }
button { cursor: pointer; background: var(--accent); color: var(--on-accent); border: 0; font-weight: 600; }
button.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); font-weight: 500; }
button.wide { width: 100%; margin-top: 8px; }
button.small { min-height: 32px; padding: 4px 10px; font-size: .85rem; }
.summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; font-size: .92rem; }
.kv span:nth-child(odd) { color: var(--muted); }
.big { font-size: 1.5rem; font-weight: 700; }
.pill { display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: .8rem; font-weight: 600; }
.pill.good { background: color-mix(in srgb, var(--good) 25%, transparent); color: var(--good); }
.pill.fair { background: color-mix(in srgb, var(--fair) 25%, transparent); color: var(--fair); }
.pill.bad  { background: color-mix(in srgb, var(--bad) 25%, transparent); color: var(--bad); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-weight: 500; font-size: .8rem; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }
.filters input[type=search] { flex: 1 1 200px; }
.chk { display: flex; flex-direction: row; align-items: center; gap: 6px; color: var(--text); font-size: .9rem; }
#targets { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 10px; }
.t { background: var(--panel2); gap: 6px; border: 1px solid var(--line); border-radius: 10px; padding: 10px; display: grid; gap: 4px; }
.t.seen { opacity: .72; }
.t-head { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.t-head b { font-size: 1.05rem; }
.score { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--muted); font-size: .9rem; }
.t-meta { color: var(--muted); font-size: .92rem; }
.t-facts { display: flex; flex-wrap: wrap; gap: 2px 14px; font-size: .95rem; }
.t-facts i, .t-nums i { font-style: normal; color: var(--muted); margin-right: 3px; }
.t-nums { color: var(--text); font-size: .92rem; }
.spark { width: 100%; height: 56px; display: block; }
.flags { display: flex; flex-wrap: wrap; gap: 4px; }
.flag { font-size: .8rem; padding: 1px 7px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.flag.seenb { color: var(--accent); border-color: var(--accent); }
.t-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 2px; }
#wxStrip { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(18px, 1fr); gap: 2px; align-items: end; height: 84px; }
#wxStrip div { background: var(--spark); border-radius: 3px 3px 0 0; min-height: 3px; position: relative; opacity: .85; }
#wxStrip div span { position: absolute; bottom: -18px; left: 50%; transform: translateX(-50%); font-size: .62rem; color: var(--muted); white-space: nowrap; }
#wxStripCard { padding-bottom: 28px; }
.notes { margin: 24px 0 0; padding-left: 18px; color: var(--fair); font-size: .88rem; }
.row { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.logrow { display: flex; justify-content: space-between; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: .9rem; }
dialog { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; width: min(560px, 94vw); max-height: 90vh; overflow: auto; }
dialog::backdrop { background: rgba(0, 0, 0, .65); }
dialog form { display: grid; gap: 10px; }
dialog h3 { margin: 0; }
.grid8 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.grid8 label { font-size: .72rem; }
.scoperow { display: grid; grid-template-columns: 1fr repeat(5, 62px); gap: 4px; align-items: center; font-size: .8rem; }
.scoperow input { padding: 4px 6px; min-height: 32px; }
.warn { color: var(--fair); font-size: .85rem; }
footer { max-width: 1100px; margin: 0 auto; padding: 8px 16px 32px; color: var(--muted); font-size: .75rem; }
@media (max-width: 600px) {
  .top-actions button { padding: 6px 8px; }
  #targets { grid-template-columns: 1fr; }
  .scoperow { grid-template-columns: 1fr repeat(5, 52px); }
}
fieldset { min-width: 0; border: 1px solid var(--line); border-radius: 10px; margin: 0; padding: 10px; }
legend { color: var(--muted); padding: 0 6px; font-size: .85rem; }
dialog input, dialog select { min-width: 0; width: 100%; }
.grid8 input { padding: 6px; }
dialog .row label { flex: 1 1 110px; }

.head-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.head-row h2 { margin: 0; }
.seg { display: flex; gap: 14px; margin-left: auto; }
.seg label { display: flex; flex-direction: row; align-items: center; gap: 6px; color: var(--text); font-size: .9rem; cursor: pointer; }
.seg input[type=radio] { min-height: 0; width: 18px; height: 18px; accent-color: var(--accent); }

/* compact tonight row */
.tonight { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 0; padding: 0; }
.tonight > div { padding: 12px 14px; border-left: 1px solid var(--line); }
.tonight > div:first-child { border-left: 0; }
@media (max-width: 760px) { .tonight > div { border-left: 0; border-top: 1px solid var(--line); } .tonight > div:first-child { border-top: 0; } }
.tonight h2 { font-size: .95rem; margin: 0 0 4px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tonight .big { font-size: 1.25rem; line-height: 1.2; font-weight: 700; }
.tonight .big small { font-size: .85rem; color: var(--muted); font-weight: 500; margin-left: 4px; }
.line { color: var(--muted); font-size: .92rem; }
.approx { font-size: .75rem; font-weight: 500; color: var(--fair); }
.approx summary { cursor: pointer; display: inline-block; border: 1px solid var(--fair); border-radius: 999px; padding: 0 8px; }
.wstrip { display: flex; align-items: flex-end; gap: 2px; margin-top: 6px; height: 54px; }
.wc { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; min-width: 0; }
.wc em { font-style: normal; font-size: .6rem; color: var(--muted); }
.wc i { display: block; width: 100%; background: var(--spark); border-radius: 2px 2px 0 0; opacity: .85; }
.wc span { font-size: .6rem; color: var(--muted); height: .8rem; }
.tonight .notes { margin: 4px 0 0; padding-left: 16px; font-size: .8rem; }
.planets { padding: 10px 14px; }
.planets summary { cursor: pointer; list-style: none; display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; }
.planets summary::-webkit-details-marker { display: none; }
.planets summary::before { content: '\25B8'; color: var(--muted); }
.planets[open] summary::before { content: '\25BE'; }
.planets .table-wrap { margin-top: 8px; }
.chip { font-size: .82rem; border: 1px solid var(--line); border-radius: 999px; padding: 1px 9px; color: var(--text); }
main { gap: 10px; }
.controls label { min-width: 0; }
.controls select, .controls input { width: 100%; min-width: 0; }

/* readable form controls */
input[type=checkbox], input[type=radio] { appearance: none; -webkit-appearance: none; width: 18px; height: 18px; min-height: 0; padding: 0;
  border: 1.5px solid var(--muted); background: transparent; flex: none; cursor: pointer; }
input[type=checkbox] { border-radius: 4px; }
input[type=radio] { border-radius: 50%; }
input[type=checkbox]:checked { background: var(--accent); border-color: var(--accent); }
input[type=checkbox]:checked::after { content: '\2713'; display: block; color: var(--on-accent); font-size: 13px; line-height: 15px; text-align: center; font-weight: 700; }
input[type=radio]:checked { border-color: var(--accent); background: radial-gradient(circle, var(--accent) 0 45%, transparent 50%); }

.t-coords { color: var(--muted); font-size: .88rem; font-variant-numeric: tabular-nums; }
.btns { display: flex; gap: 6px; }
