:root {
  --bg: #ffffff;
  --fg: #1d1d1f;
  --muted: #6e6e73;
  --line: #e5e5ea;
  --surface: #f5f5f7;
  --accent: #5d7a00;
  --accent-fg: #ffffff;
  --warn-bg: #fff4d6;
  --warn-fg: #7a4f00;
  --error-bg: #ffe1e0;
  --error-fg: #a1150d;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111113;
    --fg: #f5f5f7;
    --muted: #a1a1a6;
    --line: #2c2c2e;
    --surface: #1c1c1e;
    --accent: #8fb52c;
    --accent-fg: #111113;
    --warn-bg: #3a2c00;
    --warn-fg: #ffd36b;
    --error-bg: #3d0f0c;
    --error-fg: #ff8a80;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 15px/1.4 var(--sans);
  -webkit-text-size-adjust: 100%;
}

/* The bar, the filters and the "N new" pill are one sticky block: nothing below it guesses its height. */
.top {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--bg);
}

.bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: calc(8px + env(safe-area-inset-top)) 16px 8px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.bar h1 { margin: 0; font-size: 17px; font-weight: 600; }
.status { flex: 1; min-width: 0; color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status.live { color: var(--accent); }
.status.warn { color: var(--warn-fg); }
.status.error { color: var(--error-fg); }

button, select, input, .button {
  font: inherit;
  color: inherit;
  border-radius: 8px;
}

.ghost {
  background: none;
  border: 1px solid var(--line);
  padding: 4px 10px;
  cursor: pointer;
}

.button {
  display: inline-block;
  background: var(--accent);
  color: var(--accent-fg);
  padding: 10px 16px;
  text-decoration: none;
  font-weight: 600;
}

.menu { position: relative; }
.menu summary { list-style: none; cursor: pointer; padding: 4px 8px; font-size: 18px; }
.menu summary::-webkit-details-marker { display: none; }
.menu form { position: absolute; right: 0; top: 100%; white-space: nowrap; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 6px; }

.signin, .notice main { padding: 32px 16px; max-width: 32rem; margin: 0 auto; }
.notice h1 { font-size: 20px; }

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 16px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.filters select, .filters input {
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 6px 8px;
  font-size: 16px;   /* iOS zooms the page on focusing a field whose text is smaller */
}

.filters input { flex: 1; min-width: 8rem; }

.chip {
  background: var(--accent);
  color: var(--accent-fg);
  border: 0;
  padding: 4px 10px;
  font-family: var(--mono);
  cursor: pointer;
}

.pill {
  position: absolute;
  left: 50%;
  top: calc(100% + 8px);
  transform: translateX(-50%);
  background: var(--accent);
  color: var(--accent-fg);
  border: 0;
  border-radius: 999px;
  padding: 6px 14px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  cursor: pointer;
}

.rows { list-style: none; margin: 0; padding: 0 0 calc(24px + env(safe-area-inset-bottom)); }

.day {
  padding: 12px 16px 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.row { padding: 6px 16px; border-bottom: 1px solid var(--line); cursor: pointer; overflow-wrap: anywhere; }
.row .head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; }
.time, .id, .meta, .raw { font-family: var(--mono); font-size: 12px; }
.time { color: var(--muted); }
.badge { font-size: 11px; font-weight: 700; padding: 0 6px; border-radius: 4px; background: var(--surface); color: var(--muted); }
.lv-warn .badge { background: var(--warn-bg); color: var(--warn-fg); }
.lv-error .badge { background: var(--error-bg); color: var(--error-fg); }
.lv-debug { opacity: 0.6; }
.lv-raw .text { font-family: var(--mono); font-size: 12px; }
.kind { font-weight: 600; }
.owner { font-family: var(--mono); font-size: 12px; padding: 0 6px; border-radius: 4px; background: var(--surface); color: var(--accent); }
.text { flex-basis: 100%; }
.id { background: none; border: 0; padding: 0; color: var(--muted); text-decoration: underline dotted; cursor: pointer; }
.more-mark { color: var(--muted); font-size: 12px; }

.details { margin-top: 6px; padding: 8px; background: var(--surface); border-radius: 8px; cursor: auto; }
.meta { color: var(--muted); margin-bottom: 4px; }
.raw { margin: 4px 0 0; white-space: pre-wrap; word-break: break-word; }

.empty { padding: 24px 16px; color: var(--muted); }
.more { display: block; margin: 16px auto; }

@media (min-width: 720px) {
  .text { flex-basis: auto; flex: 1; }
}
