/* PROVIS UI layer — 4-tab shell, calmer palette, 44px touch targets.
   Loaded AFTER the inline <style> of index.html, so it wins on equal specificity.
   Every id the app bundle binds to is still in the page; this file only decides
   what is visible and how it looks. */

:root {
  --gold: #a85f12;      /* accent — white text on it is 4.9:1 (was 2.5:1 with #c99a54) */
  --gold-soft: #f6ead9;
  --ink: #1d2430;
  --muted: #5f5a52;     /* 6.4:1 on --card (was 3.5:1) */
  --line: #e4dfd4;
  --bg: #f5f3ee;
  --card: #ffffff;
  --ok: #3f7d4a;
  --warn: #a85f12;
  --danger: #b0473a;
  --slate: #3f6fa3;
  --teal: #2a8580;
  --shadow: 0 1px 2px rgba(29,36,48,.05), 0 6px 18px rgba(29,36,48,.06);
}

body { background: var(--bg); color: var(--ink); padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
.wrap { padding-top: 10px; }

/* header: smaller, calmer logo (the turning emblem no longer loops) */
.topbar { margin-bottom: 12px; }
.logo { height: 40px; }
.p-inner, .p-glint { animation: none !important; }
.chip { min-height: 28px; display: inline-flex; align-items: center; background: #ebe7de; }
.chip.ok { background: rgba(63,125,74,.14); color: var(--ok); }
.chip.warn { background: rgba(168,95,18,.14); color: var(--warn); }
#pvBtn { background: #ebe7de; width: 44px; height: 44px; border-radius: 22px; }

/* tabs: one section at a time */
[data-pane] { display: none; }
body[data-tab="home"] [data-pane="home"],
body[data-tab="rooms"] [data-pane="rooms"],
body[data-tab="tour"] [data-pane="tour"],
body[data-tab="export"] [data-pane="export"] { display: block; }

#tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 90; display: flex;
  background: rgba(255,255,255,.96); backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  justify-content: center; gap: 4px;
}
#tabbar button {
  flex: 1; max-width: 140px; min-height: 52px; border: 0; background: transparent;
  border-radius: 14px; color: var(--muted); display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 2px; font: inherit;
}
#tabbar button i { font-style: normal; font-size: 20px; line-height: 1; }
#tabbar button span { font-size: 11px; font-weight: 700; letter-spacing: .2px; }
#tabbar button.on { color: var(--gold); background: var(--gold-soft); }
.modal:not(.hidden) ~ #tabbar { display: none; }

/* cards */
.card { border-radius: 18px; border: 1px solid var(--line); box-shadow: var(--shadow); background: var(--card); }
.card h2 { font-size: 16px; margin-bottom: 2px; }
.card .sub { font-size: 13px; }
.field { font-weight: 600; }
input.text { border-radius: 12px; min-height: 48px; background: #fbfaf7; }
input.text:focus, .editrow input:focus { outline: 2px solid var(--gold); outline-offset: 1px; }

/* stats strip */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); text-align: center; padding: 14px 8px; }
.stats b { display: block; font-size: 26px; font-weight: 800; letter-spacing: -.5px; }
.stats span { font-size: 12px; color: var(--muted); font-weight: 600; }
.stats div + div { border-left: 1px solid var(--line); }

/* buttons: one primary per screen, the rest quiet */
.primary { background: var(--gold); border-radius: 14px; min-height: 54px; font-size: 17px; font-weight: 800; box-shadow: 0 4px 12px rgba(168,95,18,.25); }
.primary.small { width: auto; min-height: 44px; padding: 0 22px; font-size: 15px; box-shadow: none; }
button.ghost, a.ghost {
  border: 1px solid var(--line); background: #fff; color: var(--ink); border-radius: 12px;
  min-height: 44px; padding: 0 14px; font: inherit; font-size: 14px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none;
}
button.ghost:active, a.ghost:active { background: var(--gold-soft); }
.ghost.wide { width: 100%; }
.altrow { display: flex; gap: 8px; margin-top: 8px; }
.altrow > * { flex: 1; }
.projbtns { display: flex; gap: 8px; }
.projbtns > * { flex: 1; }
.expgrp { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.expgrp .exportlbl { flex: 0 0 82px; }
.exportlbl { font-size: 11px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.toolbar { border-top: 1px solid var(--line); padding-top: 12px; margin: 4px 0 0; }

/* segmented toggles and floor chips */
.units { background: #ece8df; border-radius: 12px; padding: 3px; display: inline-flex; }
.useg { min-height: 34px; min-width: 46px; display: flex; align-items: center; justify-content: center; border-radius: 9px; font-weight: 700; font-size: 13px; color: var(--muted); }
.useg.on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.floorchip { min-height: 44px; display: inline-flex; align-items: center; border-radius: 12px; }
.floorchip.on { background: var(--ink); }
.floorchip.add { color: var(--gold); }
.featbtn.on { background: var(--gold); border-color: var(--gold); }

/* overview + rooms */
.ovitem { background: #faf8f3; border-radius: 14px; }
.roomcard { border-radius: 16px; background: #fff; }
.roomcard .roomhdr { min-height: 32px; }
.roomdel, .iconbtn, .projdel { min-width: 44px; min-height: 44px; }
.laser { background: rgba(168,95,18,.12); color: var(--warn); min-height: 36px; }
.rhint { color: var(--gold); }
.empty { color: var(--muted); }

/* the 3D scans card (injected by the bridge) sits in Rooms */
#pvScanCard { margin-top: 0; }

/* guided steps: import → capture → live tour → compare */
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; counter-reset: st; }
.steps li {
  counter-increment: st; display: grid; grid-template-columns: 34px 1fr auto; gap: 12px;
  align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: 16px; background: #fbfaf7;
}
.steps li::before {
  content: counter(st); width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center;
  justify-content: center; font-weight: 800; background: #ebe7de; color: var(--muted);
}
.steps li.done::before { content: "✓"; background: var(--ok); color: #fff; }
.steps li.next { border-color: var(--gold); background: var(--gold-soft); }
.steps li.next::before { background: var(--gold); color: #fff; }
.steps li.locked { opacity: .55; }
.steps .st-t { font-weight: 800; font-size: 14px; }
.steps .st-d { font-size: 12px; color: var(--muted); margin-top: 2px; }
.steps a, .steps button { min-height: 44px; }
.steps a.go { background: var(--gold); color: #fff; border: 0; padding: 0 16px; border-radius: 12px; font-weight: 800; font-size: 14px; display: inline-flex; align-items: center; text-decoration: none; }
.steps li.locked a.go { background: #cfc9bb; pointer-events: none; }
.steps li.done a.go { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.cta { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: linear-gradient(135deg, #fff, var(--gold-soft)); }
.cta .sub { margin: 0; }

/* modals: same look as the cards behind them */
.modal { background: var(--bg); }
.modalbar { min-height: 56px; }
.backbtn { background: var(--gold); min-height: 44px; border-radius: 12px; }
.modaltitle { border-bottom-color: var(--line); background: transparent; }
.modalplan, #floorField { background: #faf8f3; border-radius: 16px; }
.danger { border-color: var(--danger); color: var(--danger); min-height: 48px; }
.rep-tag { color: var(--gold); }

/* bridge: profile panel + toast follow the palette */
#pvCard { background: var(--card); }
#pvCard .btn { background: #f5f3ee; min-height: 48px; }
#pvToast { background: var(--ink); }
#pvCloud { color: var(--muted); }
#pvCloud a { color: var(--gold); }
#pvArRow { flex-wrap: wrap; }

/* bridge: floating capture buttons must never cover the tab bar */
#pvFabWrap { bottom: calc(84px + env(safe-area-inset-bottom)); }

.ver { text-align: center; color: var(--muted); font-size: 11px; margin: 10px 0 0; }

@media (min-width: 720px) {
  .wrap { max-width: 640px; }
  #tabbar { left: 50%; right: auto; transform: translateX(-50%); width: 640px; border-radius: 18px 18px 0 0; border: 1px solid var(--line); border-bottom: 0; }
}
