/* inboxwatch - dashboard styles.
   Light theme only. This is an operations dashboard: data first, decoration
   never. No external assets of any kind. */

:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --ink: #1b1f24;
  --ink-2: #3c424a;
  --muted: #6b7280;
  --line: #dfe3e8;
  --line-2: #eceff2;
  --accent: #1b4fd8;
  --ok-bg: #e6f4ea; --ok-ink: #12603a; --ok-line: #b7dfc6;
  --warn-bg: #fdf3d8; --warn-ink: #7a5300; --warn-line: #f0dca6;
  --fail-bg: #fdeaea; --fail-ink: #9b1c1c; --fail-line: #f3c2c2;
  --mute-bg: #eef0f3; --mute-ink: #4b5563; --mute-line: #dfe3e8;
  --radius: 8px;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
  overflow-wrap: break-word;
}

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }

.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace; }
.num  { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

.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;
}

.skip {
  position: absolute; left: -9999px; top: 0; background: var(--surface);
  padding: 10px 14px; z-index: 100; border: 2px solid var(--accent);
}
.skip:focus { left: 8px; top: 8px; }

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

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 3px;
}

/* ---- Chrome ---------------------------------------------------------- */

.topbar { background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar-inner {
  display: flex; align-items: center; gap: 24px;
  min-height: 56px; flex-wrap: wrap;
}
.brand { font-weight: 700; letter-spacing: -0.01em; text-decoration: none; color: var(--ink); }
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a {
  padding: 6px 10px; border-radius: 6px; text-decoration: none;
  color: var(--ink-2); font-size: 14px;
}
.nav a:hover { background: var(--line-2); }
.nav a.on { background: var(--line-2); color: var(--ink); font-weight: 600; }

.foot {
  margin: 40px 0 24px; padding-top: 16px;
  color: var(--muted); font-size: 13px;
}

main { padding: 24px 16px 0; }

h1 { font-size: 22px; margin: 0 0 16px; letter-spacing: -0.01em; }
h2 { font-size: 17px; margin: 0 0 10px; }
h3 { font-size: 15px; margin: 0 0 6px; }

.lead { color: var(--ink-2); margin: 0 0 16px; max-width: 72ch; }
.hint { color: var(--muted); font-size: 13px; margin: 6px 0 0; max-width: 66ch; }

.panel {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px; margin-bottom: 20px;
}
.panel.narrow { max-width: 720px; }

.banner { padding: 12px 0; font-size: 14px; border-bottom: 1px solid transparent; }
.banner > div { max-width: 1180px; margin: 0 auto; padding: 0 16px; }
.banner-fail { background: var(--fail-bg); color: var(--fail-ink); border-bottom-color: var(--fail-line); }
.banner-warn { background: var(--warn-bg); color: var(--warn-ink); border-bottom-color: var(--warn-line); }
.panel .banner { border-radius: 6px; border: 1px solid; padding: 12px; margin-bottom: 16px; }

.crumbs { font-size: 13px; color: var(--muted); margin-bottom: 12px; }
.crumbs a { text-decoration: none; }

/* ---- Status pills ---------------------------------------------------- */

.pill {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  font-size: 12px; font-weight: 600; line-height: 1.6;
  border: 1px solid; white-space: nowrap;
}
.pill-lg { font-size: 13px; padding: 4px 12px; }
.pill-ok   { background: var(--ok-bg);   color: var(--ok-ink);   border-color: var(--ok-line); }
.pill-warn { background: var(--warn-bg); color: var(--warn-ink); border-color: var(--warn-line); }
.pill-fail { background: var(--fail-bg); color: var(--fail-ink); border-color: var(--fail-line); }
.pill-mute { background: var(--mute-bg); color: var(--mute-ink); border-color: var(--mute-line); }

.tag {
  display: inline-block; font-size: 11px; padding: 1px 6px; border-radius: 4px;
  background: var(--mute-bg); color: var(--mute-ink); border: 1px solid var(--mute-line);
  margin-left: 4px; vertical-align: middle;
}

/* ---- Buttons --------------------------------------------------------- */

.btn {
  display: inline-block; padding: 8px 14px; border-radius: 6px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font-size: 14px; font-weight: 600; cursor: pointer; text-decoration: none;
  line-height: 1.4;
}
.btn:hover { background: var(--line-2); }
.btn-small { padding: 5px 10px; font-size: 13px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: #163fae; }
.btn-quiet { background: transparent; color: var(--ink-2); }
.btn[disabled] { opacity: .55; cursor: default; }

/* ---- Counts + filters ------------------------------------------------ */

.counts {
  display: flex; gap: 20px; flex-wrap: wrap;
  padding-bottom: 14px; margin-bottom: 14px; border-bottom: 1px solid var(--line-2);
  font-size: 14px; color: var(--ink-2);
}
.counts .num { font-size: 18px; color: var(--ink); margin-right: 4px; }

.filters {
  display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap;
  margin-bottom: 16px;
}
.filters .field { margin: 0; }

/* ---- Forms ----------------------------------------------------------- */

.form { max-width: 620px; }
.form-inline { max-width: none; display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.form-inline .field { flex: 1 1 220px; margin-bottom: 0; }

.field { margin-bottom: 18px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; }
.field input[type=text], .field input[type=email], .field input[type=url], .field select {
  width: 100%; padding: 8px 10px; font-size: 14px; font-family: inherit;
  border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--ink);
}
.field-check { display: grid; grid-template-columns: auto 1fr; gap: 4px 8px; align-items: start; }
.field-check input { margin-top: 4px; }
.field-check label { margin: 0; font-weight: 600; }
.field-check .hint { grid-column: 2; }

.form-actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.form-msg { font-size: 13px; }
.form-msg.ok { color: var(--ok-ink); }
.form-msg.err { color: var(--fail-ink); }

/* ---- Tables ---------------------------------------------------------- */

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

table.grid { width: 100%; border-collapse: collapse; font-size: 14px; }
table.grid th, table.grid td {
  text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line-2);
  vertical-align: middle;
}
table.grid thead th {
  font-size: 12px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); border-bottom: 1px solid var(--line); white-space: nowrap;
}
table.grid tbody tr:hover { background: #fafbfc; }
table.grid td.num, table.grid td[data-label="Last scanned"] { font-variant-numeric: tabular-nums; }
.cell-note { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; }

.empty {
  border: 1px dashed var(--line); border-radius: var(--radius);
  padding: 24px; text-align: center; color: var(--ink-2); background: #fcfcfd;
}
.empty h3 { margin-bottom: 4px; }
.empty p { margin: 0 0 8px; font-size: 14px; }

/* ---- Domain detail --------------------------------------------------- */

.detail-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 16px; flex-wrap: wrap; margin-bottom: 20px;
}
.detail-head h1 { margin-bottom: 4px; font-size: 20px; }
.detail-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.finding {
  border: 1px solid var(--line); border-left-width: 4px;
  border-radius: 6px; padding: 16px; margin-bottom: 14px; background: #fcfcfd;
}
.finding-fail { border-left-color: #c53030; }
.finding-warning { border-left-color: #c78a00; }
.finding-info { border-left-color: #2f855a; }
.finding-head { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; margin-bottom: 8px; }
.finding-head h3 { margin: 0; font-size: 15px; }
.finding-why { color: var(--ink-2); margin: 0 0 12px; max-width: 78ch; font-size: 14px; }

.fix { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 12px; }
.fix-title { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 8px; }
.fix-grid { display: grid; grid-template-columns: 68px 1fr; gap: 6px 12px; margin: 0; font-size: 13px; }
.fix-grid dt { color: var(--muted); }
.fix-grid dd { margin: 0; min-width: 0; }
.fix-value {
  background: var(--mute-bg); border: 1px solid var(--line); border-radius: 4px;
  padding: 8px; word-break: break-all; margin-bottom: 6px; font-size: 13px;
}
.fix-note { color: var(--ink-2); font-size: 13px; margin: 10px 0 0; }

.record { border-top: 1px solid var(--line-2); padding: 14px 0; }
.record:first-of-type { border-top: 0; padding-top: 0; }
.record-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.record-label { font-weight: 700; font-size: 14px; min-width: 72px; }
pre.raw {
  background: var(--mute-bg); border: 1px solid var(--line); border-radius: 4px;
  padding: 10px; margin: 0; overflow-x: auto; font-size: 13px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre-wrap; word-break: break-all;
}

.spf-total { font-size: 15px; margin: 0 0 14px; }
.spf-total .num { font-size: 18px; }
.spf-total.over { color: var(--fail-ink); font-weight: 600; }

ul.spf-tree { list-style: none; margin: 0; padding-left: 18px; border-left: 2px solid var(--line-2); }
ul.spf-tree-root { padding-left: 0; border-left: 0; }
ul.spf-tree li { padding: 6px 0 6px 10px; }
.spf-term { font-size: 13px; font-weight: 600; }
.spf-cost { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.spf-note { font-size: 12px; color: var(--warn-ink); margin-top: 3px; }
.spf-record { font-size: 12px; color: var(--muted); margin-top: 3px; word-break: break-all; }

ol.timeline { list-style: none; margin: 0; padding: 0; }
ol.timeline li { border-top: 1px solid var(--line-2); padding: 14px 0; }
ol.timeline li:first-child { border-top: 0; padding-top: 0; }
.timeline-when { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.timeline-what { font-size: 14px; }
.diff { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 8px; }
.diff-label { font-size: 12px; color: var(--muted); margin-bottom: 3px; }

.kv { display: grid; grid-template-columns: 140px 1fr; gap: 8px 16px; margin: 0; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-all; }

.checklist { list-style: none; padding: 0; margin: 0 0 20px; }
.checklist li { padding: 6px 0; display: flex; gap: 10px; align-items: center; }
.steps { padding-left: 20px; color: var(--ink-2); max-width: 72ch; }
.steps li { margin-bottom: 8px; }

code {
  background: var(--mute-bg); border: 1px solid var(--line); border-radius: 3px;
  padding: 1px 5px; font-size: 13px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* ---- Responsive: tables become cards, page never scrolls sideways ----- */

@media (max-width: 760px) {
  main { padding-top: 16px; }
  .panel { padding: 16px; }
  .diff { grid-template-columns: 1fr; }
  .kv, .fix-grid { grid-template-columns: 1fr; gap: 2px; }
  .kv dt, .fix-grid dt { margin-top: 8px; }

  .table-wrap { overflow-x: visible; }
  table.grid, table.grid tbody, table.grid tr, table.grid td { display: block; width: 100%; }
  table.grid thead { display: none; }
  table.grid tr {
    border: 1px solid var(--line); border-radius: 6px;
    padding: 10px; margin-bottom: 10px; background: var(--surface);
  }
  table.grid td { border: 0; padding: 5px 0; display: grid; grid-template-columns: 108px 1fr; gap: 10px; }
  table.grid td::before {
    content: attr(data-label); color: var(--muted); font-size: 12px;
    text-transform: uppercase; letter-spacing: .04em;
  }
  table.grid td.actions { display: flex; padding-top: 10px; }
  table.grid td.actions::before { content: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

.selector-box { border-top: 1px solid var(--line-2); margin-top: 6px; padding-top: 16px; }
.selector-box h3 { margin-bottom: 6px; }
.selector-box .form-inline { margin-top: 10px; align-items: flex-start; }
.selector-box .field { max-width: 320px; }
