/* Synagro monitor: one plain stylesheet. No inline styles anywhere (the CSP is default-src 'self').
   Header colour and row fills follow the client's sheets (CLAUDE.md section 7, monitor/vocab.py). */

:root {
  --head: #1F4E5F;
  --head-text: #ffffff;
  --ink: #1d2329;
  --muted: #5b6670;
  --line: #d4dade;
  --bg: #f6f8f9;
  --card: #ffffff;
  --link: #1a5f7a;
  --danger: #a12a2a;
  --ok-bg: #e5f2e5;
  --err-bg: #fbe4e4;
}

* { box-sizing: border-box; }
html { font-size: 15px; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.45;
}
a { color: var(--link); }
h1 { font-size: 1.5rem; margin: 0 0 0.8rem; }
h2 { font-size: 1.15rem; margin: 0 0 0.6rem; }
.muted { color: var(--muted); }
.big { font-size: 1.6rem; font-weight: 600; margin: 0.2rem 0 0.4rem; }

/* --- top bar ---------------------------------------------------------------------------------- */
.topbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 1.4rem;
  padding: 0.6rem 1.2rem; background: var(--head); color: var(--head-text);
}
.topbar a { color: var(--head-text); text-decoration: none; }
.topbar a:hover, .topbar a:focus { text-decoration: underline; }
.brand { font-weight: 700; font-size: 1.05rem; }
.nav { display: flex; flex-wrap: wrap; gap: 1rem; flex: 1; }
.who { display: flex; align-items: center; gap: 0.8rem; font-size: 0.9rem; }
button.linkish {
  background: none; border: 1px solid rgba(255, 255, 255, 0.6); color: var(--head-text);
  padding: 0.15rem 0.6rem; font-size: 0.85rem;
}

.page { max-width: 1400px; margin: 0 auto; padding: 1.2rem; }
.foot { max-width: 1400px; margin: 0 auto; padding: 1rem 1.2rem 2rem; color: var(--muted); font-size: 0.85rem; }

/* --- messages, cards ---------------------------------------------------------------------------- */
.notice, .error { padding: 0.6rem 0.9rem; border-radius: 4px; margin: 0 0 1rem; }
.notice { background: var(--ok-bg); border: 1px solid #b9dcb9; }
.error { background: var(--err-bg); border: 1px solid #e8b4b4; color: #6d1b1b; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1rem; margin-bottom: 1.4rem; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 6px; padding: 1rem 1.2rem; margin-bottom: 1rem; }
.card.narrow { max-width: 520px; }
meter { width: 100%; height: 1rem; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }

/* --- forms -------------------------------------------------------------------------------------- */
form.inline { display: inline-flex; align-items: center; gap: 0.3rem; margin: 0 0.3rem 0.3rem 0; }
.stack { display: flex; flex-direction: column; gap: 0.7rem; max-width: 520px; }
.stack.wide { max-width: 760px; }
.stack label { display: flex; flex-direction: column; gap: 0.2rem; font-weight: 600; font-size: 0.92rem; }
.stack label.check { flex-direction: row; align-items: center; gap: 0.5rem; }
fieldset { border: 1px solid var(--line); border-radius: 6px; padding: 0.8rem 1rem; background: var(--card); }
fieldset .muted { font-weight: normal; margin: 0.2rem 0 0; }
legend { font-weight: 700; padding: 0 0.3rem; }
input[type=text], input[type=password], input[type=email], input[type=number], select, textarea {
  font: inherit; padding: 0.35rem 0.5rem; border: 1px solid #b8c1c7; border-radius: 4px; background: #fff;
  font-weight: normal;
}
textarea { width: 100%; }
button, .button {
  font: inherit; cursor: pointer; display: inline-block; text-decoration: none;
  background: var(--head); color: var(--head-text); border: 1px solid var(--head);
  border-radius: 4px; padding: 0.35rem 0.9rem;
}
button:hover, .button:hover { filter: brightness(1.15); }
button.danger { background: var(--danger); border-color: var(--danger); }
details summary { cursor: pointer; color: var(--link); }
td.actions { min-width: 260px; }

/* --- tables --------------------------------------------------------------------------------------- */
.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: 6px; margin-bottom: 1.2rem; }
table.grid { border-collapse: collapse; width: 100%; font-size: 0.9rem; }
table.grid th {
  background: var(--head); color: var(--head-text); font-weight: 700; text-align: left;
  padding: 0.45rem 0.6rem; white-space: nowrap; position: sticky; top: 0;
}
table.grid td { padding: 0.4rem 0.6rem; border-top: 1px solid var(--line); vertical-align: top; }
table.grid tbody tr:hover td { background-color: rgba(31, 78, 95, 0.05); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.row-disabled td { color: var(--muted); }

/* --- run status badges -------------------------------------------------------------------------- */
.badge { display: inline-block; padding: 0.05rem 0.45rem; border-radius: 3px; font-size: 0.8rem; background: #e7ebee; }
.status-queued { background: #e7ebee; }
.status-running { background: #d6e8f5; }
.status-done { background: #C9E7C9; }
.status-partial { background: #FFE0A3; }
.status-failed { background: #F4B6B6; }
.status-cancelled { background: #D9D9D9; }
.status-rejected { background: #E6B0B0; }

/* --- result row marks: monitor/vocab.MARK_FILLS, via the Jinja filter mark_class -------------------- */
tr.mark-new td, .mark-new { background-color: #C9E7C9; }
tr.mark-new-cycle td, .mark-new-cycle { background-color: #C9E7C9; }
tr.mark-already-found td, .mark-already-found { background-color: #D9D9D9; }
tr.mark-review-your-call td, .mark-review-your-call { background-color: #FFE0A3; }

/* The full colour key from the client's sheets (CLAUDE.md section 7). */
.fill-red { background-color: #F4B6B6; }
.fill-duplicate { background-color: #E6B0B0; }
.fill-amber { background-color: #FFE0A3; }
.fill-green { background-color: #C9E7C9; }
.fill-orange { background-color: #F6C9A0; }
.fill-grey { background-color: #D9D9D9; }

@media (max-width: 640px) {
  .page { padding: 0.8rem; }
  .topbar { padding: 0.6rem 0.8rem; }
}
