/* ============================================================================
   V&M Outreach — interface system (shared with RoofView)
   ----------------------------------------------------------------------------
   Built on the V&M Systems Group design language (vm-systems-website/
   DESIGN_SPEC.md + css/styles.css), so the platform and the company site read
   as one product rather than two.

   The monogram sets the rules: hard points, no curves, high contrast, a single
   amber accent against near-black. Everything here follows from that —
   4px corners, hairline rules rather than heavy boxes, and structure carried by
   space and tone instead of borders.

   Typography is the brand's: Space Grotesk for headings, Inter for interface
   text, IBM Plex Mono for anything numeric. Figures are tabular throughout,
   because this is a product people read numbers off.
   ========================================================================== */

:root {
  /* Surfaces — identical values to the corporate site */
  --bg: #070a0f;
  --bg-2: #0b1017;
  --surface: #0f1621;
  --surface-2: #131c2a;
  --surface-3: #1a2433;

  /* Hairlines. A border should suggest an edge, not draw a box. */
  --line: rgba(255, 255, 255, .08);
  --line-2: rgba(255, 255, 255, .14);
  --line-3: rgba(255, 255, 255, .22);
  --border: var(--line-2);            /* legacy name, kept so nothing breaks */

  --text: #e9edf3;
  --text-2: #b6bfcc;
  --muted: #8b95a5;
  --muted-2: #5c6675;

  --accent: #f5a623;
  --amber: #f5a623;                   /* legacy name */
  --accent-ink: #0b0d10;
  --accent-soft: rgba(245, 166, 35, .12);
  --accent-line: rgba(245, 166, 35, .45);

  --blue: #6ea8ff;
  --green: #37d67a;
  --red: #ff5d5d;
  --purple: #b07aff;
  --gray: #8b95a5;

  --font-display: "Space Grotesk", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --font-body: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;

  --t-xs: 11px;   --t-sm: 12.5px; --t-base: 14px; --t-md: 15px;
  --t-lg: 18px;   --t-xl: 22px;   --t-2xl: 28px;  --t-3xl: 34px;

  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 20px; --s6: 24px; --s7: 32px; --s8: 44px;

  /* The top inset is zero in a browser tab and 47 to 59px once the app is on a
     home screen. Four rules depend on it, so it is named once here rather than
     hardcoded in each of them and left to drift. */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);

  --radius: 4px;                      /* the brand radius — sharp, like the mark */
  --radius-lg: 6px;
  --topbar-h: 60px;
  --container: 1240px;
  --ease: cubic-bezier(.22, 1, .36, 1);
  --shadow: 0 24px 60px rgba(0, 0, 0, .6);
  --shadow-sm: 0 8px 24px rgba(0, 0, 0, .4);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font-body);
  font-size: var(--t-base);
  line-height: 1.5;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button, input, select, textarea { font: inherit; color: inherit; }
.hidden { display: none !important; }
/* The hidden attribute wins over any author display rule (a flex menu, a flex row of inputs). */
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }

h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 600; letter-spacing: -.015em; margin: 0; }
h1 { font-size: var(--t-2xl); line-height: 1.15; }
h2 { font-size: var(--t-lg); line-height: 1.25; }
h3 { font-size: var(--t-md); }

/* Anything a person reads as a number is tabular and monospaced: figures line
   up column to column, and 1,237 never re-flows into 1,238 at a different width. */
.num, .mono, .est-price, .est-chip, .auto-price, .confirm-amount, .quote-total .grand,
table.stats td, .draw-readout, .hc-thumb .n, .badge, .pill, .step span, .tl-when {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}
.mono { font-size: var(--t-sm); }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.sub { color: var(--muted); font-size: var(--t-sm); }
.section-label {
  font-family: var(--font-mono); font-size: var(--t-xs); letter-spacing: .14em;
  color: var(--muted-2); margin: var(--s6) 0 var(--s3); font-weight: 500; text-transform: uppercase;
}

/* ---------- brand mark ---------- */
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; }
.brand-mark { width: 22px; height: 22px; flex: none; color: var(--text); display: block; }
.brand-mark svg { width: 100%; height: 100%; display: block; }
.brand-text {
  font-family: var(--font-display); font-weight: 700; font-size: var(--t-md);
  letter-spacing: .04em; white-space: nowrap; line-height: 1.1;
}
.brand-text span { color: var(--accent); }
.brand-text small {
  display: block; font-family: var(--font-mono); color: var(--muted-2);
  font-weight: 400; letter-spacing: .18em; font-size: 9.5px; margin-top: 3px;
}

/* ---------- sign in ---------- */
.login {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(900px 500px at 50% -10%, rgba(245,166,35,.07), transparent 70%),
    linear-gradient(180deg, var(--bg-2), var(--bg));
  z-index: 100; padding: var(--s5);
}
.login-card {
  width: 400px; max-width: 100%; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); padding: var(--s8) var(--s7);
  box-shadow: var(--shadow);
}
.login-card h1 { font-size: var(--t-lg); margin: var(--s7) 0 var(--s5); }

/* ---------- form controls ---------- */
.field { margin-bottom: var(--s4); }
.field label {
  display: block; font-size: var(--t-xs); color: var(--muted); margin-bottom: 7px;
  letter-spacing: .1em; text-transform: uppercase; font-weight: 500; font-family: var(--font-mono);
}
.field label .opt { color: var(--muted-2); letter-spacing: 0; text-transform: none; font-family: var(--font-body); }
.field input, .field textarea, .field select {
  width: 100%; padding: 11px 12px; border-radius: var(--radius);
  border: 1px solid var(--line-2); background: var(--bg); color: var(--text);
  font-size: var(--t-md); outline: none; font-family: inherit; transition: border-color .15s var(--ease);
}
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--accent); }
.field textarea.mono { font-family: var(--font-mono); }
.field-hint { color: var(--muted); font-size: var(--t-sm); margin-top: 6px; line-height: 1.5; }
.error-msg { color: var(--red); font-size: var(--t-sm); min-height: 18px; margin: var(--s2) 0; }
.row { display: flex; gap: var(--s3); flex-wrap: wrap; align-items: flex-end; }
.row .field { flex: 1; min-width: 160px; margin-bottom: 0; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  padding: 10px 16px; border-radius: var(--radius); border: 1px solid var(--line-2);
  background: var(--surface-2); color: var(--text); cursor: pointer;
  font-size: var(--t-base); font-weight: 500; min-height: 40px; text-decoration: none;
  user-select: none; white-space: nowrap; transition: border-color .15s var(--ease), background .15s var(--ease);
}
.btn:hover { border-color: var(--line-3); background: var(--surface-3); }
.btn.primary {
  background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 700;
}
.btn.primary:hover { filter: brightness(1.08); background: var(--accent); }
.btn.danger { color: var(--red); border-color: rgba(255,93,93,.3); }
.btn.danger:hover { border-color: var(--red); background: rgba(255,93,93,.08); }
.btn.small { padding: 6px 11px; min-height: 32px; font-size: var(--t-sm); }
.btn.block { width: 100%; }
.btn.ghost { background: transparent; }
.btn:disabled { opacity: .45; cursor: default; }
.icon-btn {
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--line-2);
  width: 34px; height: 34px; min-width: 34px; border-radius: var(--radius); cursor: pointer;
  font-size: 15px; display: inline-flex; align-items: center; justify-content: center;
  transition: color .15s var(--ease), border-color .15s var(--ease);
}
.icon-btn:hover { color: var(--text); border-color: var(--line-3); }
.link-btn {
  background: none; border: none; color: var(--blue); cursor: pointer; font: inherit;
  text-decoration: underline; text-underline-offset: 2px; padding: 2px 4px;
}

/* ---------- app shell ---------- */
#app { position: fixed; inset: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: var(--s4);
  /* The height has to grow by the inset, not absorb it: with border-box a fixed
     60px bar loses its content box to the notch. */
  height: calc(var(--topbar-h) + var(--safe-top));
  padding: 0 max(var(--s5), env(safe-area-inset-left)) 0 max(var(--s5), env(safe-area-inset-left));
  padding-top: var(--safe-top);
  background: rgba(7, 10, 15, .88); backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--line); z-index: 30; flex: none;
}
/* Wraps rather than clips. This row cannot break its own line, so on a narrow
   screen the last button — Sign out — was being cut off by body{overflow:hidden}
   with nothing to say it had happened. */
.topbar-right { display: flex; gap: 6px; margin-left: auto; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.topbar .btn.small { background: transparent; border-color: transparent; color: var(--muted); font-weight: 500; }
.topbar .btn.small:hover { color: var(--text); background: var(--surface-2); border-color: var(--line); }

.search { position: relative; flex: 1; max-width: 460px; }
.search input {
  width: 100%; padding: 10px 12px; border-radius: var(--radius); border: 1px solid var(--line-2);
  background: var(--bg); color: var(--text); outline: none;
}

/* ---------- cards ---------- */
.card, .card-flat {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: var(--s5); margin-bottom: var(--s3);
}
.card h3 { margin: 0 0 4px; }
.card .sub { color: var(--muted); font-size: var(--t-sm); }

.ds-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); gap: var(--s4); }
.ds-tile {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--s4);
}

/* ---------- status pills ---------- */
.pill, .badge, .dmg-badge {
  display: inline-block; padding: 2px 8px; border-radius: 2px;
  font-size: var(--t-xs); font-weight: 600; letter-spacing: .05em;
  border: 1px solid; vertical-align: middle; white-space: nowrap; text-transform: uppercase;
}
.pill.wait { color: var(--muted); border-color: var(--line-2); }
.pill.act  { color: var(--accent); border-color: var(--accent-line); background: var(--accent-soft); }
.pill.go   { color: var(--blue); border-color: rgba(110,168,255,.4); background: rgba(110,168,255,.1); }
.pill.done { color: var(--green); border-color: rgba(55,214,122,.4); background: rgba(55,214,122,.1); }
.pill.off  { color: var(--muted-2); border-color: var(--line); }
.badge.ready { background: rgba(55,214,122,.1); color: var(--green); border-color: rgba(55,214,122,.4); }

/* ---------- panels and modals ---------- */
.panel {
  position: absolute; top: calc(var(--topbar-h) + var(--s3)); bottom: var(--s3); width: 390px;
  background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius);
  z-index: 20; display: flex; flex-direction: column; overflow: hidden; box-shadow: var(--shadow);
}
.panel.left { left: var(--s3); }
.panel.right { right: var(--s3); }
.panel-head {
  padding: var(--s4) var(--s5) var(--s3); border-bottom: 1px solid var(--line);
  display: flex; align-items: flex-start; gap: var(--s3); flex: none;
}
.panel-head h2 { margin: 0; font-size: var(--t-lg); line-height: 1.25; flex: 1; }
.panel-head .sub { margin-top: 4px; }
.panel-body { padding: var(--s4) var(--s5) var(--s5); overflow-y: auto; flex: 1; -webkit-overflow-scrolling: touch; }
.house-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.66); z-index: 55; backdrop-filter: blur(2px); }
.panel.modal-mode {
  position: fixed; left: 50%; top: 50%; right: auto; bottom: auto;
  transform: translate(-50%, -50%); width: min(680px, 94vw); max-height: 86vh; z-index: 60;
}
.photo-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s2); }
.photo-grid .ph { position: relative; border-radius: 2px; overflow: hidden; cursor: pointer; background: #000; aspect-ratio: 4/3; border: 1px solid var(--line); }
.photo-grid .ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-grid .ph .n { position: absolute; right: 5px; bottom: 5px; background: rgba(7,10,15,.8); font-size: 10px; padding: 1px 5px; border-radius: 2px; font-family: var(--font-mono); }
.house-actions { display: flex; gap: var(--s2); margin-top: var(--s5); }
.note-row { display: flex; gap: var(--s2); margin-top: var(--s3); }
.note-row textarea { flex: 1; min-height: 42px; max-height: 120px; resize: vertical; font-size: var(--t-base); border-radius: var(--radius); border: 1px solid var(--line-2); background: var(--bg); color: var(--text); padding: 10px; font-family: inherit; }

/* ---------- modals ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.66); backdrop-filter: blur(2px); z-index: 150; display: flex; align-items: center; justify-content: center; padding: var(--s5); }
.modal { background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius); width: 560px; max-width: 100%; max-height: 84vh; display: flex; flex-direction: column; box-shadow: var(--shadow); }
.modal.wide { width: 720px; max-height: 88vh; }
.modal-head { padding: var(--s4) var(--s5); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: var(--s3); }
.modal-head h3 { margin: 0; font-size: var(--t-md); flex: 1; word-break: break-word; }
.modal-body { overflow-y: auto; padding: var(--s2) 0; flex: 1; }
.modal-foot { padding: var(--s3) var(--s5); border-top: 1px solid var(--line); display: flex; gap: var(--s2); align-items: center; flex-wrap: wrap; }
.dir-item { padding: 10px var(--s5); cursor: pointer; display: flex; gap: var(--s3); align-items: center; font-size: var(--t-base); }
.dir-item:hover { background: var(--surface-2); }

/* ---------- tabs and tables ---------- */
.tabs { display: flex; gap: 2px; margin: var(--s5) 0; flex-wrap: wrap; border-bottom: 1px solid var(--line); }
.tab {
  padding: 10px 16px; border: none; border-bottom: 2px solid transparent; background: transparent;
  color: var(--muted); cursor: pointer; font-size: var(--t-base); font-weight: 500; min-height: 40px;
  font-family: var(--font-display); letter-spacing: -.01em;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab .badge-dot { background: var(--red); color: #fff; }
.tab.active .badge-dot { background: var(--accent); color: var(--accent-ink); }
.progress { height: 4px; background: var(--bg); border-radius: 2px; overflow: hidden; margin: var(--s3) 0 var(--s1); border: 1px solid var(--line); }
.progress i { display: block; height: 100%; background: var(--accent); transition: width .4s var(--ease); }
.access-grid { display: flex; flex-wrap: wrap; gap: var(--s2); margin-top: var(--s3); }
.access-grid label { display: inline-flex; gap: var(--s2); align-items: center; border: 1px solid var(--line-2); border-radius: var(--radius); padding: 8px 12px; cursor: pointer; font-size: var(--t-sm); background: var(--surface-2); min-height: 38px; }
.access-grid input { width: 16px; height: 16px; accent-color: var(--accent); }
table.stats { width: 100%; border-collapse: collapse; font-size: var(--t-sm); }
table.stats th { text-align: left; color: var(--muted-2); font-weight: 500; font-size: var(--t-xs); letter-spacing: .1em; text-transform: uppercase; padding: var(--s2) 10px; border-bottom: 1px solid var(--line-2); font-family: var(--font-mono); }
table.stats td { padding: 10px; border-bottom: 1px solid var(--line); }
table.stats td.num { text-align: right; }
.feed { font-size: var(--t-sm); margin: 0; padding: 0; }

/* ---------- sign-in brand ---------- */
.login-card .brand { flex-direction: column; align-items: flex-start; gap: var(--s4); }
.login-card .brand-mark { width: 44px; height: 44px; color: var(--accent); }
.login-card .brand-text { font-size: var(--t-xl); letter-spacing: .05em; }
.login-card .brand-text small { font-size: 10px; margin-top: 6px; }

