/* RoofQuery dashboard — dashboard.roofquery.com
   No build step, nothing to compile: everything the portal needs ships here.

   Light UI: white cards on a soft grey field, deep blue sidebar. The blue is
   RoofQuery's own — a cooler, more saturated tone than neighbouring tools use,
   so the two never read as the same product at a glance.

   The landing site has its own stylesheet (landing/public/assets/landing.css)
   and shares only the token block below. Keep the two in sync by hand; they're
   deployed separately and neither should import the other. */

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

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

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

  --green: #27AE60;
  --amber: #E08A2F;
  --red: #C0392B;

  --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;
}
.sub { color: var(--text-body); font-size: 13px; margin: 0 0 18px; }
.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; }

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

.sidebar {
  width: 235px; flex-shrink: 0;
  background: var(--primary-darker);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; align-self: flex-start; overflow-y: auto;
}
/* The wordmark links back to the landing site, which is a different origin —
   hence an <a>, hence the underline reset. */
.brand {
  display: block;
  font-family: var(--font-heading);
  font-size: 23px; font-weight: 800; color: #fff;
  letter-spacing: -.02em;
  text-decoration: none;
  padding: 22px 20px 6px;
}
.brand:hover { color: #fff; opacity: .85; }

.nav-section {
  font-size: 10px; font-weight: 800; letter-spacing: 1.4px; text-transform: uppercase;
  color: rgba(255,255,255,.35); 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(47,168,224,.16); border-left-color: var(--accent); color: #fff; }
.nav-item.disabled { opacity: .45; cursor: not-allowed; }
.nav-item.disabled:hover { background: transparent; color: rgba(255,255,255,.72); }
.nav-tag {
  display: inline-block; margin-left: 6px; padding: 1px 6px; border-radius: 9999px;
  font-size: 9px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
  background: rgba(255,255,255,.16); color: rgba(255,255,255,.8);
}

.main { flex: 1; min-width: 0; padding: 26px 28px 40px; }

.section { display: none; }
.section.active { display: block; }

/* ── Cards ──────────────────────────────────────────────────── */
.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-3 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }

.stat-label {
  font-size: 10.5px; font-weight: 800; text-transform: uppercase;
  letter-spacing: .9px; color: var(--text-body);
}
.stat-value {
  font-family: var(--font-heading);
  font-size: 34px; font-weight: 800; color: var(--text-dark);
  letter-spacing: -.03em; line-height: 1; margin-top: 8px;
}
.stat-note { font-size: 12px; color: var(--text-body); margin-top: 7px; }

/* ── Tables ─────────────────────────────────────────────────── */
table { width: 100%; border-collapse: collapse; }
th {
  font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .8px;
  color: var(--text-body); padding: 0 8px 9px; text-align: left;
  border-bottom: 2px solid var(--bg-light);
}
td {
  padding: 11px 8px; border-bottom: 1px solid var(--bg-light);
  font-size: 13px; vertical-align: middle; color: var(--text-dark);
}
tr:last-child td { border-bottom: none; }

code {
  font-family: var(--mono); font-size: .85em;
  background: var(--bg-light); color: var(--text-dark);
  padding: .12em .4em; border-radius: 4px;
}
pre {
  background: var(--primary-darker); color: #E6EEF5;
  padding: 14px 16px; border-radius: var(--radius-btn);
  overflow-x: auto; font-size: 12px; line-height: 1.55;
  font-family: var(--mono);
}
pre code { background: transparent; color: inherit; padding: 0; }

/* ── Pills ──────────────────────────────────────────────────── */
.pill {
  display: inline-block; padding: 3px 9px; border-radius: 20px;
  font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .3px;
}
.pill.live, .pill.ok { background: #E8F8F0; color: var(--green); }
.pill.test, .pill.warn { background: #FDF2E3; color: var(--amber); }
.pill.err { background: #FDECEA; color: var(--red); }
.pill.info { background: var(--primary-tint); color: var(--primary); }

/* ── Controls ───────────────────────────────────────────────── */
.btn {
  font-family: var(--font-main); font-size: 12.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .5px;
  border: none; border-radius: var(--radius-btn); cursor: pointer;
  padding: 10px 17px; line-height: 1;
  background: var(--primary); color: #fff;
  /* .btn is used on <button> and <a> alike — anchors would otherwise pick up
     the global link underline. */
  display: inline-block; text-decoration: none;
}
.btn:hover { background: var(--primary-dark); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.secondary {
  background: var(--bg-light); color: var(--primary);
  border: 1px solid var(--border-input);
}
.btn.secondary:hover { background: var(--primary-tint); }
/* Text-weight action — used where a third button in a row would compete with
   the two that matter. */
.btn.ghost { background: transparent; color: var(--text-body); }
.btn.ghost:hover { background: var(--bg-light); color: var(--primary); }
.btn.danger { background: var(--red); }
.btn.danger:hover { background: #A93226; }
.btn.small { padding: 6px 11px; font-size: 11px; }

label {
  display: block;
  font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-body); margin: 16px 0 6px;
}
label:first-of-type { margin-top: 0; }

input, select, textarea {
  width: 100%; padding: 10px 12px;
  border: 1px solid var(--border-input); border-radius: var(--radius-btn);
  font-size: 14px; font-family: inherit;
  color: var(--text-dark); background: #fff;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(22,104,184,.18);
}
input[type="color"] { padding: 3px; height: 40px; cursor: pointer; }
textarea { min-height: 92px; resize: vertical; }

.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.end { justify-content: flex-end; }

.empty { padding: 30px; text-align: center; color: var(--text-body); font-size: 13px; }

/* ── Secret reveal ──────────────────────────────────────────── */
.secret {
  background: var(--primary-tint); border: 1px solid var(--primary);
  border-radius: var(--radius-btn); padding: 12px;
  font-family: var(--mono); font-size: 12.5px;
  color: var(--text-dark); user-select: all; word-break: break-all;
}

/* ── Modal ──────────────────────────────────────────────────── */
.modal-bg {
  position: fixed; inset: 0; background: rgba(11,61,107,.45);
  display: none; align-items: center; justify-content: center; padding: 20px; z-index: 1000;
}
.modal-bg.show { display: flex; }
.modal {
  background: #fff; border-radius: var(--radius-card); padding: 24px;
  width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto;
  box-shadow: 0 20px 50px rgba(0,0,0,.25);
}

/* ── Toast ──────────────────────────────────────────────────── */
#toast {
  position: fixed; bottom: 20px; right: 20px; z-index: 1100;
  max-width: min(380px, calc(100vw - 40px));
  opacity: 0; transform: translateY(10px); transition: .25s; pointer-events: none;
}
#toast.show { opacity: 1; transform: translateY(0); }
#toast .inner {
  background: var(--primary-darker); color: #fff;
  padding: 12px 16px; border-radius: var(--radius-btn);
  font-size: 13px; box-shadow: 0 4px 14px rgba(0,0,0,.22);
}
#toast.ok .inner { background: var(--green); }
#toast.err .inner { background: var(--red); }
#toast.warn .inner { background: var(--amber); }

/* ── Login page ─────────────────────────────────────────────── */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-box {
  width: 100%; max-width: 400px; background: #fff;
  border-radius: var(--radius-card); overflow: hidden;
  box-shadow: 0 10px 30px rgba(11,61,107,.15);
}
.login-head { background: var(--primary-darker); padding: 28px 24px; text-align: center; }
.login-head .brand { justify-content: center; padding: 0; }
.login-body { padding: 28px; }
.login-body .h1 { font-size: 30px; margin-bottom: 6px; }
.err-text { color: var(--red); font-size: 12.5px; margin-top: 12px; display: none; }
.err-text.show { display: block; }

/* ── Mobile ─────────────────────────────────────────────────── */
@media (max-width: 820px) {
  .shell { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; overflow: visible; }
  .brand { padding: 16px 16px 4px; }
  .nav-section { display: none; }
  .nav-item { display: inline-block; border-left: none; border-radius: 8px; padding: 8px 12px; margin: 0 4px 4px; }
  .nav-item.active { border-left: none; }
  .main { padding: 18px 16px 32px; }
  .card { padding: 16px; }
  .grid-3, .grid-2 { grid-template-columns: 1fr; }
}

/* ── Address search + map preview ───────────────────────────── */
.address-search { position: relative; }

.suggestions {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 40;
  background: #fff; border: 1px solid var(--border-input);
  border-radius: var(--radius-btn); box-shadow: 0 8px 24px rgba(11,61,107,.14);
  max-height: 280px; overflow-y: auto;
}
.suggestions.hidden { display: none; }
.suggestion {
  padding: 10px 12px; cursor: pointer; font-size: 13.5px; color: var(--text-dark);
  border-bottom: 1px solid var(--bg-light);
}
.suggestion:last-child { border-bottom: none; }
.suggestion:hover, .suggestion.active { background: var(--primary-tint); }
.suggestion .sub-line { font-size: 11.5px; color: var(--text-body); margin-top: 2px; }
.suggestions .empty-note { padding: 12px; font-size: 12.5px; color: var(--text-body); }

.selected-address {
  margin-top: 14px; padding: 14px;
  background: var(--bg-light); border: 1px solid var(--border);
  border-radius: var(--radius-card);
}
.selected-address.hidden { display: none; }

.map-preview {
  display: block; width: 100%; max-width: 700px;
  margin-top: 12px; border-radius: var(--radius-btn);
  border: 1px solid var(--border-input); background: var(--bg-white);
}
.map-preview.loading { opacity: .45; }
