/* Minimal classless-ish styling. Everything is readable at default browser
   sizes; one font stack, one accent color, sensible spacing, no framework. */

:root {
  --fg: #111;
  --muted: #666;
  --bg: #fafafa;
  --line: #ddd;
  --accent: #0645ad;
  --ok: #2a7a2a;
  --warn: #a64500;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

body {
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--fg);
  background: var(--bg);
  margin: 0;
  line-height: 1.5;
}

header {
  border-bottom: 1px solid var(--line);
  padding: 1rem 1.5rem;
  display: flex;
  gap: 2rem;
  align-items: baseline;
  flex-wrap: wrap;
}

header h1 { margin: 0; font-size: 1.25rem; }
header h1 a { color: inherit; text-decoration: none; }

nav { display: flex; gap: 1.25rem; flex: 1; }

.user { display: flex; gap: 0.75rem; align-items: center; font-size: 0.9rem; }
.user-email { color: var(--muted); }
.logout-form { margin: 0; }
.logout-form button { padding: 0.25rem 0.6rem; font-size: 0.85rem; }

.login { max-width: 32rem; }
.login p { margin-bottom: 1rem; }

a.button {
  display: inline-block;
  padding: 0.55rem 1rem;
  background: var(--accent);
  color: white;
  border-radius: 3px;
  text-decoration: none;
}
a.button:hover { text-decoration: none; opacity: 0.9; }

td.actions { display: flex; gap: 0.5rem; }
td.actions form { margin: 0; }
button.danger { color: #a22; border-color: #d77; }
button.danger:hover { background: #fce; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

main {
  max-width: 64rem;
  margin: 0 auto;
  padding: 1.5rem;
}

section { margin-bottom: 2.5rem; }
section h2 { font-size: 1.1rem; margin: 0 0 0.75rem; }

dl {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.25rem 1rem;
  margin: 0;
}
dt { color: var(--muted); }
dd { margin: 0; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
th, td {
  text-align: left;
  padding: 0.4rem 0.6rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
th { font-weight: 600; color: var(--muted); }

form p { margin: 0 0 1rem; }
label { display: block; font-size: 0.9rem; color: var(--muted); margin-bottom: 0.25rem; }
input, textarea {
  width: 100%;
  font: inherit;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: white;
}
textarea { font-family: var(--mono); font-size: 0.9rem; resize: vertical; }
button {
  font: inherit;
  padding: 0.45rem 0.9rem;
  border: 1px solid var(--line);
  background: white;
  border-radius: 3px;
  cursor: pointer;
}
button:hover { background: #f0f0f0; }

pre {
  background: white;
  border: 1px solid var(--line);
  padding: 0.75rem 1rem;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 0.85rem;
  white-space: pre-wrap;
}

code { font-family: var(--mono); font-size: 0.9em; }

.flash {
  background: #eaf6ea;
  border: 1px solid #b7dfb7;
  color: var(--ok);
  padding: 0.4rem 0.75rem;
  border-radius: 3px;
  display: inline-block;
}

.hint { color: var(--muted); font-size: 0.9rem; }

.ok { color: var(--ok); }
.warn { color: var(--warn); }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

select {
  width: 100%;
  font: inherit;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: white;
}

details summary {
  cursor: pointer;
  color: var(--muted);
  padding: 0.25rem 0;
  user-select: none;
}
details[open] summary { margin-bottom: 0.5rem; }

.new-account { max-width: 36rem; }
.new-account form p .hint { display: block; margin-top: 0.25rem; }
.errors {
  background: #fdebea;
  border: 1px solid #f5b7b1;
  color: #922;
  padding: 0.6rem 0.9rem;
  border-radius: 3px;
  margin-bottom: 1.5rem;
}
.errors ul { margin: 0.25rem 0 0 1.25rem; padding: 0; }

/* Live feed --------------------------------------------------------- */

.muted { color: var(--muted); font-size: 0.85rem; font-weight: normal; margin-left: 0.5rem; }

.live-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.live-empty {
  color: var(--muted);
  font-style: italic;
  padding: 0.75rem;
  border: 1px dashed var(--line);
  border-radius: 3px;
  background: white;
}

.live-item {
  background: white;
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 0.5rem 0.7rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  column-gap: 0.5rem;
  row-gap: 0.15rem;
  min-width: 0;
  overflow: hidden;
}

.live-item.important { border-left: 3px solid var(--warn); background: #fff8f2; }

.live-title {
  grid-column: 1;
  grid-row: 1;
  font-weight: 500;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.live-title a { color: inherit; }

.live-score {
  grid-column: 2;
  grid-row: 1;
  align-self: start;
  font-family: var(--mono);
  font-size: 0.78rem;
  padding: 0.05rem 0.4rem;
  border-radius: 3px;
  color: var(--muted);
}
.live-score.band-none     { color: var(--muted); }
.live-score.band-very-low { background: #e2e2e2; color: #555; }
.live-score.band-low      { background: #ffe28a; color: #6b4900; }
.live-score.band-mid      { background: #ffae5e; color: #5a2400; }
.live-score.band-high     { background: #6abf72; color: #0e3a14; font-weight: 600; }

.live-meta {
  grid-column: 1 / 3;
  grid-row: 2;
  color: var(--muted);
  font-size: 0.78rem;
  font-family: var(--mono);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.live-scroll {
  position: relative;
  height: 60vh;
  overflow-y: auto;
  padding-right: 0.75rem;          /* keep content out from under the macOS overlay scrollbar */
  scrollbar-gutter: stable;        /* on Linux/Win, also reserve gutter space */
}
.live-scroll .live-list { gap: 0.4rem; }

.live-pause {
  margin-left: 0.5rem;
  font-size: 0.8rem;
  padding: 0.15rem 0.6rem;
  border: 1px solid var(--line);
  background: white;
  cursor: pointer;
}
.live-pause.active { background: var(--line); }

.live-jump {
  position: sticky;
  bottom: 0.5rem;
  display: block;
  margin: 0.5rem auto 0;
  padding: 0.2rem 0.7rem;
  font-size: 0.8rem;
  border: 1px solid var(--muted);
  background: white;
  cursor: pointer;
}
.live-jump[hidden] { display: none; }

.live-cols {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0.75rem;
}
@media (max-width: 800px) { .live-cols { grid-template-columns: minmax(0, 1fr); } }

.live-col { min-width: 0; }

.live-col-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  color: #555;
  font-weight: 500;
  padding: 0.25rem 0.1rem;
}
.live-col-head input[type="number"] {
  width: 4.5rem;
  font: inherit;
  padding: 0.05rem 0.25rem;
}
.col-rate { color: var(--muted); font-family: var(--mono); font-size: 0.8rem; }
