/* Layout: one column. A header, a filter panel, then a full-width spot log styled like a station logbook. */
:root {
  --bg: #f5f7f6;
  --panel: #ffffff;
  --fg: #16201d;
  --muted: #5d6b66;
  --line: #dde4e1;
  --accent: #0b7a64;
  --accent-ink: #ffffff;
  --new: #e3f4ee;
  --ok: #1f9d55;
  --warn: #c27c0e;
  --bad: #c53030;
  --font-ui: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-data: ui-monospace, "Cascadia Mono", Consolas, "SFMono-Regular", Menlo, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1513; --panel: #151d1a; --fg: #e3ebe8; --muted: #8fa19a; --line: #24302c;
    --accent: #35c9a3; --accent-ink: #06231b; --new: #173a2f;
    --ok: #3ccf7e; --warn: #e3a338; --bad: #f06a6a;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1513; --panel: #151d1a; --fg: #e3ebe8; --muted: #8fa19a; --line: #24302c;
  --accent: #35c9a3; --accent-ink: #06231b; --new: #173a2f;
  --ok: #3ccf7e; --warn: #e3a338; --bad: #f06a6a;
  color-scheme: dark;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 16px clamp(16px, 3vw, 32px);
  background: var(--bg);
  color: var(--fg);
  font: 14px/1.45 var(--font-ui);
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 1400px;
  margin-inline: auto;
}

.top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
h1 {
  margin: 0;
  font: 700 1.5rem/1.1 var(--font-data);
  letter-spacing: 0.02em;
  text-wrap: balance;
}
h1 span { color: var(--accent); font-weight: 600; }
.sub { margin: 4px 0 0; color: var(--muted); }

.status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  font-size: 0.85rem;
  color: var(--muted);
}
.status .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--warn); }
.status[data-state="up"] .dot { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 25%, transparent); }
.status[data-state="down"] .dot { background: var(--bad); }

.filters {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.filter-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.label {
  width: 3.5rem;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.chips { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; flex: 1; }
.chip {
  font: 500 0.85rem var(--font-data);
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: transparent;
  color: var(--fg);
  cursor: pointer;
}
.chip:hover { border-color: var(--accent); }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.chip:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

#call-filter {
  flex: 1;
  min-width: 0;
  max-width: 320px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
  color: var(--fg);
  font: 0.9rem var(--font-data);
  text-transform: uppercase;
}
.count { margin-left: auto; color: var(--muted); font-size: 0.85rem; font-variant-numeric: tabular-nums; }

.table-wrap {
  overflow-x: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.spots { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.spots th {
  position: sticky;
  top: 0;
  background: var(--panel);
  text-align: left;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.spots td { padding: 7px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; vertical-align: baseline; }
.spots tbody tr:last-child td { border-bottom: 0; }
.spots tbody tr:hover td { background: color-mix(in srgb, var(--accent) 6%, transparent); }

.t-time, .t-freq, .t-dx, .t-spotter, .t-band { font-family: var(--font-data); }
td.t-freq { text-align: right; font-weight: 600; }
th.t-freq { text-align: right; }
td.t-time { color: var(--muted); }
td.t-dx a { color: var(--fg); font-weight: 700; text-decoration: none; }
td.t-dx a:hover { color: var(--accent); text-decoration: underline; }
td.t-spotter { color: var(--muted); }
td.t-comment { white-space: normal; min-width: 14rem; color: var(--fg); }

.mode {
  display: inline-block;
  min-width: 3.4em;
  text-align: center;
  padding: 1px 6px;
  border-radius: 4px;
  font: 600 0.75rem var(--font-data);
  border: 1px solid var(--line);
  color: var(--muted);
}
.mode[data-mode="CW"] { color: var(--accent); border-color: var(--accent); }
.mode[data-mode="SSB"] { color: var(--warn); border-color: var(--warn); }

tr.fresh td { animation: fresh 4s ease-out; }
@keyframes fresh { from { background: var(--new); } to { background: transparent; } }
@media (prefers-reduced-motion: reduce) { tr.fresh td { animation: none; } }

.empty { margin: 0; padding: 28px 16px; text-align: center; color: var(--muted); }
[hidden] { display: none !important; }

.foot { color: var(--muted); font-size: 0.8rem; }
.foot code { font-family: var(--font-data); }

@media (max-width: 640px) {
  .t-spotter, .t-band { display: none; }
  .label { width: auto; }
}
