:root {
  --bg: #f3f8fc; --surface: #ffffff; --text: #0b2540; --muted: #4a6580;
  --primary: #0a5fb4; --accent: #1ea7e1; --border: #d4e3f1; --danger: #b3261e; --ok: #1b7a3d;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #06182b; --surface: #0c2744; --text: #e6f1fb; --muted: #9bb7d1;
    --primary: #4aa3ee; --accent: #38bdf8; --border: #17406a; --danger: #ff8a80; --ok: #7ddc9a;
  }
}
* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--text); line-height: 1.5; }
.top { background: linear-gradient(135deg, #063d7a 0%, #0a5fb4 55%, #1ea7e1 100%); color: #fff;
  padding: 14px 20px; display: flex; justify-content: space-between; align-items: center; }
.top a { color: #fff; text-decoration: none; font-weight: 700; font-size: 1.2rem; }
.top nav a { font-size: .95rem; font-weight: 600; margin-left: 16px; }
main { max-width: 460px; margin: 32px auto; padding: 0 20px 48px; }
main.wide { max-width: 640px; }
h1 { font-size: 1.5rem; color: var(--primary); margin: 0 0 16px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 20px; }
form p { margin: 0 0 14px; }
label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 4px; }
input[type=text], input[type=password], input[type=email], input[type=datetime-local], textarea, select {
  width: 100%; font: inherit; padding: 9px 11px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--bg); color: var(--text); }
input:focus, textarea:focus { outline: 2px solid var(--accent); border-color: var(--accent); }
button, .btn { font: inherit; font-weight: 600; background: var(--primary); color: #fff; border: 0;
  border-radius: 8px; padding: 9px 18px; cursor: pointer; text-decoration: none; display: inline-block; }
button.link { background: none; color: var(--primary); padding: 0; font-weight: 600; }
.helptext, .hint { color: var(--muted); font-size: .8rem; display: block; margin-top: 3px; }
.helptext ul { margin: 4px 0 0 18px; padding: 0; }
.errorlist { list-style: none; margin: 4px 0; padding: 0; color: var(--danger); font-size: .88rem; }
.msg { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; background: var(--surface);
  border: 1px solid var(--ok); color: var(--ok); }
.small { font-size: .9rem; color: var(--muted); margin-top: 14px; }
a { color: var(--primary); }

/* Fishing reports */
.report-card { display: block; background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 12px 16px; margin: 10px 0; text-decoration: none; color: inherit; }
.report-card:hover, .report-card:focus-visible { border-color: var(--accent); outline: none; }
.report-meta { color: var(--primary); font-size: .92rem; margin-bottom: 4px; }
.report-snippet { color: var(--muted); font-size: .92rem; overflow-wrap: anywhere; }
.report-text p { margin: 0 0 .8em; overflow-wrap: anywhere; }
.report-text p:last-child { margin-bottom: 0; }
dl.cond { display: grid; grid-template-columns: max-content 1fr; gap: 4px 18px; margin: 0; }
dl.cond dt { color: var(--muted); font-size: .9rem; }
dl.cond dd { margin: 0; font-weight: 600; }
#char-count.over { color: var(--danger); font-weight: 700; }
form.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin: 12px 0; }
form.filters label { font-size: .85rem; color: var(--muted); font-weight: 600; }
form.filters select { min-width: 190px; margin-top: 4px; }
.pager { display: flex; gap: 18px; align-items: center; margin: 16px 0; }
form.reassign { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
form.reassign label { margin: 0; }
form.reassign select { width: auto; min-width: 200px; }
button.danger { background: var(--danger); color: #fff; }
.cancel { margin-left: 14px; }
.actions { margin-top: 18px; }
.actions .small { margin-left: 14px; }

/* Hourly history page */
main.xwide { max-width: 980px; }
main.full { max-width: 1280px; }  /* the rules table, so it fits without scrolling on a desktop screen */
.back { margin-top: 0; }
form.range-pick { display: flex; align-items: center; gap: 8px; margin: 4px 0 10px; }
form.range-pick select { width: auto; min-width: 130px; margin: 0; }
.muted { color: var(--muted); font-size: .85em; }
.chart-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px 16px 6px; margin: 14px 0; }
.chart-card h2 { font-size: 1rem; margin: 0 0 4px; color: var(--primary); }
.chart-card .unit { font-weight: 400; color: var(--muted); font-size: .85rem; }
.legend { display: flex; gap: 16px; font-size: .85rem; color: var(--muted); margin-bottom: 2px; }
.legend b { color: var(--text); }
.swatch { display: inline-block; width: 14px; height: 4px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }
.swatch.line-1 { background: var(--primary); }
.swatch.line-2 { background: var(--accent); }
.chart { width: 100%; height: auto; display: block; }
.chart .line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .line-1 { stroke: var(--primary); }
.chart .line-2 { stroke: var(--accent); }
.chart .dashed { stroke-dasharray: 6 4; }
.swatch.dashed { background: repeating-linear-gradient(90deg, var(--accent) 0 4px, transparent 4px 7px); }
.chart .grid { stroke: var(--border); stroke-dasharray: 3 3; }
.chart .axis-line, .chart .tick { stroke: var(--muted); stroke-width: 1; }
.chart .axis-text { fill: var(--muted); font-size: 11px; }
.table-h { font-size: 1.05rem; color: var(--primary); margin: 22px 0 8px; }
.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; overflow-x: auto; }
table.hist { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.hist th { text-align: left; color: var(--muted); font-size: .75rem; text-transform: uppercase; padding: 8px 10px; white-space: nowrap; }
table.hist td { padding: 6px 10px; border-top: 1px solid var(--border); white-space: nowrap; }
.other { line-height: 1.8; }

/* agent rules page (admin) */
.rules-table td { white-space: normal; vertical-align: top; }
.rules-table select { width: auto; }  /* as wide as the longest choice, no wider */
.rules-table td:nth-child(3) { min-width: 280px; }
.rules-table td:nth-child(6) { min-width: 160px; }
.rules-table textarea { width: 100%; min-height: 0; }
.rules-table td.c { text-align: center; }
.agent-text { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; white-space: pre-wrap; font-size: .9rem; overflow-x: auto; }
.badge { display: inline-block; background: var(--accent); color: #04223d; font-size: .75rem; font-weight: 700; padding: 2px 9px; border-radius: 999px; vertical-align: middle; margin-left: 8px; }
.forecast-text { font-size: 1.02rem; line-height: 1.6; }
.prompt-form textarea { width: 100%; }
.prompt-box { width: 100%; font-family: ui-monospace, Consolas, monospace; font-size: .8rem; }
