/* RoofQuery test console.

   Same palette as the dashboard and the back office, so it reads as part of the
   same product — but the sidebar is slate rather than blue and there is an
   amber band across the top of every screen. That is deliberate: everything
   here places real orders against a real API, and "which console am I in" must
   be answerable from the corner of your eye.

   A copy of the token block, not an import. This service ships as its own image
   with its own static root, and the whole folder is meant to be deletable. */

:root {
  --primary: #1668B8;
  --primary-dark: #12558F;
  --primary-tint: #E8F1FA;
  --accent: #2FA8E0;

  /* Slate, not the product's blue. */
  --shell: #1F2933;
  --shell-deep: #161D24;

  --text-body: #55606C;
  --text-dark: #1E2530;

  --bg-light: #F1F3F6;
  --bg-white: #ffffff;
  --border: #E2E7ED;
  --border-input: #D3D9E0;

  --green: #27AE60;
  --green-tint: #E9F7EF;
  --amber: #E08A2F;
  --amber-tint: #FDF3E7;
  --red: #C0392B;
  --red-tint: #FBEBEA;
  --grey-tint: #EFF1F4;

  --radius-btn: 10px;
  --radius-card: 12px;

  --font-main: 'Instrument Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-heading: 'Bricolage Grotesque', 'Instrument Sans', system-ui, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font-main);
  font-size: 15px;
  background: var(--bg-light);
  color: var(--text-body);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); }
.hidden { display: none !important; }

/* ── Typography ─────────────────────────────────────────────── */
.h1 { font-family: var(--font-heading); font-size: 28px; font-weight: 800; color: var(--text-dark); letter-spacing: -.02em; margin: 0 0 4px; }
.h2 { font-family: var(--font-heading); font-size: 17px; font-weight: 700; color: var(--text-dark); letter-spacing: -.01em; margin: 0 0 12px; }
.h3 { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .9px; color: var(--text-body); margin: 20px 0 8px; }
.sub { color: var(--text-body); font-size: 13px; margin: 0 0 18px; max-width: 76ch; line-height: 1.55; }
.mono { font-family: var(--mono); font-size: 12.5px; word-break: break-all; color: var(--text-dark); }
.muted { color: var(--text-body); opacity: .85; }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.strong { font-weight: 700; color: var(--text-dark); }

/* ── Layout ─────────────────────────────────────────────────── */
.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 235px; flex-shrink: 0;
  background: var(--shell);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; align-self: flex-start; overflow-y: auto;
}
.brand {
  display: block; font-family: var(--font-heading);
  font-size: 22px; font-weight: 800; color: #fff;
  letter-spacing: -.02em; text-decoration: none; padding: 22px 20px 2px;
}
.brand-tag {
  display: inline-block; margin: 0 20px 16px;
  background: var(--amber); color: #2A1A05;
  font-size: 10px; font-weight: 800; letter-spacing: 1.2px; text-transform: uppercase;
  padding: 3px 8px; border-radius: 5px;
}
.nav-section { font-size: 10px; font-weight: 800; letter-spacing: 1.4px; text-transform: uppercase; color: rgba(255,255,255,.32); padding: 14px 20px 5px; }
.nav-item {
  display: block; padding: 10px 20px; color: rgba(255,255,255,.72);
  font-size: 13.5px; font-weight: 600; cursor: pointer; text-decoration: none;
  border-left: 3px solid transparent; transition: all .15s;
}
.nav-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-item.active { background: rgba(224,138,47,.18); border-left-color: var(--amber); color: #fff; }

.env-badge {
  margin-top: auto; padding: 14px 20px 18px;
  font-family: var(--mono); font-size: 10.5px; line-height: 1.7;
  color: rgba(255,255,255,.5); border-top: 1px solid rgba(255,255,255,.08);
}
.env-badge b { color: rgba(255,255,255,.82); font-weight: 600; }

.main { flex: 1; padding: 28px 32px 60px; min-width: 0; }
.section { display: none; }
.section.active { display: block; }

/* The band that says what this is. */
.rig-note {
  background: var(--amber-tint); border: 1px solid #F0D3A8;
  border-radius: var(--radius-card); padding: 12px 16px; margin-bottom: 22px;
  font-size: 12.5px; color: #7A4E12; line-height: 1.55;
}
.rig-note b { color: #5E3B0D; }

/* ── Cards, grids, rows ─────────────────────────────────────── */
.card { background: var(--bg-white); border: 1px solid var(--border); border-radius: var(--radius-card); padding: 20px; margin-bottom: 18px; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row.between { justify-content: space-between; }
.row.end { justify-content: flex-end; }
.stack { display: flex; flex-direction: column; gap: 4px; }

/* ── Forms ──────────────────────────────────────────────────── */
label { display: block; font-size: 12px; font-weight: 700; color: var(--text-dark); margin: 14px 0 5px; }
input, select, textarea {
  width: 100%; padding: 10px 12px; font-family: var(--font-main); font-size: 14px;
  color: var(--text-dark); background: var(--bg-white);
  border: 1px solid var(--border-input); border-radius: var(--radius-btn); outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(22,104,184,.12); }
textarea { min-height: 78px; resize: vertical; }
input[type="checkbox"] { width: auto; }
.field-note { font-size: 11.5px; color: var(--text-body); margin-top: 4px; }

.btn {
  padding: 10px 16px; font-family: var(--font-main); font-size: 14px; font-weight: 700;
  color: #fff; background: var(--primary); border: none; border-radius: var(--radius-btn);
  cursor: pointer; transition: background .15s;
}
.btn:hover { background: var(--primary-dark); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.secondary { background: var(--bg-white); color: var(--text-dark); border: 1px solid var(--border-input); }
.btn.secondary:hover { background: var(--bg-light); }
.btn.ghost { background: transparent; color: var(--primary); border: none; padding-left: 0; }
.btn.danger { background: var(--red); }
.btn.danger:hover { background: #9E2E22; }
.btn.small { padding: 6px 11px; font-size: 12.5px; }

/* ── Verdict language ───────────────────────────────────────── */
.pill {
  display: inline-block; padding: 3px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 800; letter-spacing: .4px; text-transform: uppercase;
}
.pill.pass { background: var(--green-tint); color: #1B7A43; }
.pill.fail { background: var(--red-tint); color: var(--red); }
.pill.pending, .pill.waiting { background: var(--amber-tint); color: #9A5E14; }
.pill.late { background: var(--amber-tint); color: #9A5E14; }
.pill.none, .pill.unverified { background: var(--grey-tint); color: var(--text-body); }
.pill.ok { background: var(--green-tint); color: #1B7A43; }
.pill.live { background: var(--red-tint); color: var(--red); }
.pill.test { background: var(--primary-tint); color: var(--primary-dark); }

.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 7px; vertical-align: middle; }
.dot.pass, .dot.ok { background: var(--green); }
.dot.fail { background: var(--red); }
.dot.pending, .dot.waiting, .dot.late { background: var(--amber); }
.dot.none { background: #C3CAD3; }

/* ── Tables ─────────────────────────────────────────────────── */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left; font-size: 10.5px; font-weight: 800; text-transform: uppercase;
  letter-spacing: .8px; color: var(--text-body);
  padding: 0 10px 9px; border-bottom: 1px solid var(--border);
}
td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: top; color: var(--text-body); }
tr:last-child td { border-bottom: none; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--bg-light); }
td.tight { white-space: nowrap; }
.table-wrap { overflow-x: auto; }

/* ── Check rows: expected vs actual ─────────────────────────── */
.check {
  display: grid; grid-template-columns: minmax(140px, 1.2fr) 1fr 1fr;
  gap: 12px; padding: 9px 12px; border-bottom: 1px solid var(--border);
  font-size: 12.5px; align-items: start;
}
.check:last-child { border-bottom: none; }
.check.bad { background: var(--red-tint); }
.check .k { font-family: var(--mono); font-size: 12px; color: var(--text-dark); font-weight: 600; word-break: break-all; }
.check .v { font-family: var(--mono); font-size: 11.5px; word-break: break-word; }
.check .v .lbl { display: block; font-family: var(--font-main); font-size: 10px; font-weight: 800; letter-spacing: .7px; text-transform: uppercase; color: var(--text-body); opacity: .75; margin-bottom: 2px; }
.check-note { grid-column: 1 / -1; font-size: 11.5px; color: var(--red); font-weight: 600; }
.check-head {
  display: grid; grid-template-columns: minmax(140px, 1.2fr) 1fr 1fr; gap: 12px;
  padding: 0 12px 8px; font-size: 10px; font-weight: 800; letter-spacing: .8px;
  text-transform: uppercase; color: var(--text-body);
}

/* ── Timeline ───────────────────────────────────────────────── */
.tl { display: flex; flex-direction: column; gap: 0; }
.tl-step { display: grid; grid-template-columns: 22px 1fr auto; gap: 12px; align-items: start; padding: 9px 0; position: relative; }
.tl-step:not(:last-child)::before { content: ''; position: absolute; left: 10px; top: 26px; bottom: -4px; width: 2px; background: var(--border); }
.tl-mark { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 800; color: #fff; z-index: 1; }
.tl-mark.ok { background: var(--green); }
.tl-mark.late { background: var(--amber); }
.tl-mark.waiting { background: #C3CAD3; }
.tl-mark.missing, .tl-mark.out-of-order { background: var(--red); }
.tl-status { font-family: var(--mono); font-size: 13px; color: var(--text-dark); font-weight: 600; }
.tl-note { font-size: 11.5px; color: var(--text-body); margin-top: 2px; }
.tl-time { font-family: var(--mono); font-size: 11.5px; color: var(--text-body); white-space: nowrap; }

/* ── Disclosure + code ──────────────────────────────────────── */
details { border: 1px solid var(--border); border-radius: 10px; margin-bottom: 10px; background: var(--bg-white); }
details[open] { box-shadow: 0 1px 3px rgba(16,24,40,.04); }
summary { padding: 11px 14px; cursor: pointer; font-size: 13px; font-weight: 600; color: var(--text-dark); list-style: none; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
summary::-webkit-details-marker { display: none; }
summary::before { content: '▸'; color: var(--text-body); font-size: 11px; }
details[open] summary::before { content: '▾'; }
summary .spacer { margin-left: auto; }
.details-body { padding: 0 14px 14px; }

pre.code {
  background: #12181F; color: #D9E2EC; border-radius: 8px; padding: 13px 15px;
  font-family: var(--mono); font-size: 11.5px; line-height: 1.6;
  overflow-x: auto; max-height: 420px; white-space: pre-wrap; word-break: break-word;
}

.empty { padding: 26px; text-align: center; color: var(--text-body); font-size: 13px; }
.kv { display: grid; grid-template-columns: minmax(120px, auto) 1fr; gap: 6px 16px; font-size: 13px; }
.kv dt { font-weight: 700; color: var(--text-dark); }
.kv dd { font-family: var(--mono); font-size: 12.5px; word-break: break-all; }

.copy-line {
  display: flex; gap: 8px; align-items: center;
  background: var(--bg-light); border: 1px solid var(--border);
  border-radius: 8px; padding: 9px 12px; font-family: var(--mono); font-size: 12.5px;
  color: var(--text-dark); word-break: break-all;
}
.copy-line span { flex: 1; }

/* ── Sign-in ────────────────────────────────────────────────── */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: var(--bg-light); }
.login-box { width: 100%; max-width: 400px; background: var(--bg-white); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; }
.login-head { background: var(--shell); padding: 20px 26px; display: flex; align-items: center; gap: 10px; }
.login-body { padding: 26px; }
.err-text { display: none; margin-top: 14px; font-size: 12.5px; color: var(--red); font-weight: 600; }
.err-text.show { display: block; }

/* ── Toast ──────────────────────────────────────────────────── */
#toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(140%); transition: transform .25s; z-index: 200; }
#toast.show { transform: translateX(-50%) translateY(0); }
#toast .inner { background: var(--text-dark); color: #fff; padding: 12px 20px; border-radius: 10px; font-size: 13.5px; font-weight: 600; box-shadow: 0 8px 24px rgba(16,24,40,.2); max-width: 90vw; }
#toast.bad .inner { background: var(--red); }

/* ── Modal ──────────────────────────────────────────────────── */
.modal-bg { display: none; position: fixed; inset: 0; background: rgba(16,24,40,.55); z-index: 150; padding: 20px; overflow-y: auto; }
.modal-bg.show { display: grid; place-items: start center; }
.modal { background: var(--bg-white); border-radius: 14px; padding: 24px; width: 100%; max-width: 560px; margin-top: 6vh; }

/* ── Phone ──────────────────────────────────────────────────── */
.mobile-bar { display: none; }
@media (max-width: 860px) {
  .mobile-bar {
    display: flex; align-items: center; gap: 12px;
    background: var(--shell); padding: 12px 16px; position: sticky; top: 0; z-index: 60;
  }
  .mobile-title { color: #fff; font-weight: 700; font-size: 15px; }
  .menu-btn { background: none; border: none; padding: 6px; cursor: pointer; display: grid; gap: 4px; }
  .menu-btn span { display: block; width: 20px; height: 2px; background: #fff; border-radius: 2px; }
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; height: 100vh; z-index: 80;
    transform: translateX(-100%); transition: transform .2s;
  }
  .sidebar.open { transform: translateX(0); }
  .nav-backdrop { display: none; position: fixed; inset: 0; background: rgba(16,24,40,.5); z-index: 70; }
  .nav-backdrop.show { display: block; }
  .main { padding: 20px 16px 60px; }
  .check, .check-head { grid-template-columns: 1fr; gap: 4px; }
}
