/* Doorway Home shell: a phone on a desk at wide widths, the real
   full-screen mobile web app below 640px. Light-only, like the canon demo.
   Components come from shared/components.css; app-only pieces below. */

.stage {
  min-height: 100vh; display: grid; grid-template-columns: 250px auto 290px;
  gap: 44px; justify-content: center; align-content: center; padding: 32px 24px 80px;
}
.rail { display: flex; flex-direction: column; gap: 10px; max-height: calc(100vh - 80px); min-width: 0; }
.kicker { font-family: var(--font-mono); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-2); line-height: 1.9; margin: 4px 0 8px; }
.rail-nav { display: flex; flex-direction: column; gap: 1px; overflow-y: auto; padding-right: 4px; scrollbar-width: thin; }
.rail-group { font-family: var(--font-mono); font-size: 9.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); padding: 12px 10px 4px; }
.rail-item { display: flex; gap: 10px; align-items: baseline; padding: 6px 10px; border-radius: 7px; color: var(--ink-2); font-size: 13px; font-weight: 500; text-align: left; width: 100%; }
.rail-item .n { font-family: var(--font-mono); font-size: 10px; color: var(--ink-3); width: 18px; flex: 0 0 auto; }
.rail-item:hover { background: var(--surface); color: var(--ink); }
.rail-item.on { background: var(--frame); color: var(--on-frame); }
.rail-item.on .n { color: var(--slate); }
.keyhint { font-family: var(--font-mono); font-size: 9.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }
.keyhint b { border: 1px solid var(--line-strong); border-radius: 4px; padding: 1px 5px; font-weight: 500; }

.notes { display: flex; flex-direction: column; justify-content: center; gap: 14px; min-width: 0; }
.note-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 20px; display: flex; flex-direction: column; gap: 10px; }
.note-card.quiet { background: transparent; }
.note-card .sub { font-size: 13.2px; }
.note-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; padding-top: 12px; border-top: 1px solid var(--line); }

/* ---- phone ---- */
.phone-wrap { display: flex; align-items: center; justify-content: center; }
.phone {
  width: 392px; height: min(844px, calc(100vh - 80px)); min-height: 640px;
  background: var(--bezel); border-radius: 46px; padding: 11px; box-shadow: var(--shadow-device);
}
.viewport { position: relative; width: 100%; height: 100%; background: var(--ground); border-radius: 36px; overflow: hidden; display: flex; flex-direction: column; }
.statusbar { flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 13px 22px 6px; font-size: 12px; font-weight: 600; color: var(--ink); background: var(--ground); }
.urlpill { font-family: var(--font-display); font-size: 11.5px; font-weight: 600; color: var(--ink-2); letter-spacing: -.005em; display: inline-flex; align-items: center; gap: 4px; min-width: 0; white-space: nowrap; overflow: hidden; }
.viewport.web .statusbar { background: var(--surface-2); border-bottom: 1px solid var(--line); padding-bottom: 8px; }
.viewport.web .urlpill { font-family: var(--font-mono); font-weight: 500; font-size: 10.5px; background: var(--surface); border: 1px solid var(--line); border-radius: 99px; padding: 3px 10px; }
.viewport.web .urlpill b { color: var(--ink); font-weight: 600; }
.viewport.tech { background: var(--surface); }
.viewport.tech .statusbar { background: #1D4E89; color: #fff; }
.viewport.tech .urlpill { color: rgba(255,255,255,.8); }
.screens { position: relative; flex: 1; min-height: 0; }
.screen { position: absolute; inset: 0; overflow-y: auto; padding: 14px 20px 28px; display: none; scrollbar-width: thin; overscroll-behavior: contain; }
.screen.active { display: block; }
.viewport.no-tabs .tabbar { display: none; }

/* ---- tab bar: Pros · Visits · Home (raised) · Community · Records ---- */
.tabbar { flex: 0 0 auto; display: flex; align-items: flex-end; border-top: 1px solid var(--line); background: var(--surface); padding: 6px 4px calc(env(safe-area-inset-bottom, 0px) + 12px); position: relative; z-index: 2; }
.tab { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 4px 0 0; color: var(--ink-3); text-align: center; font-size: 10.5px; font-weight: 600; min-width: 0; }
.tab:hover { color: var(--ink-2); }
.tab.on { color: var(--primary); }
.tab .disc { width: 56px; height: 56px; border-radius: 50%; background: var(--fill); color: var(--on-fill); display: grid; place-items: center; margin-top: -30px; box-shadow: 0 8px 20px rgba(42,26,21,.26), 0 0 0 5px var(--surface); transition: transform 150ms var(--ease); }
.tab.center { color: var(--ink); }
.tab.center:hover .disc { transform: translateY(-2px); }
.tab.center.on .disc { box-shadow: 0 8px 20px rgba(42,26,21,.26), 0 0 0 5px var(--surface), 0 0 0 7px var(--line-strong); }

/* ---- app-only components ---- */
.appbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; min-height: 34px; }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--ink-2); font-size: 13.5px; font-weight: 600; padding: 6px 8px 6px 2px; border-radius: 8px; }
.back:hover { color: var(--ink); }
.h1 { font-family: var(--font-display); font-weight: 600; font-size: 26px; line-height: 1.12; letter-spacing: -.02em; text-wrap: balance; }
.lede { color: var(--ink-2); font-size: 14.5px; line-height: 1.5; margin-top: 6px; }
.sec { margin-top: 22px; }
.sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.h2 { font-family: var(--font-display); font-weight: 600; font-size: 17px; letter-spacing: -.01em; }
.group { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 2px 14px; }
.group > .list-row { padding: 12px 0; }
.row-ic { width: 34px; height: 34px; border-radius: 10px; background: var(--surface-2); color: var(--primary); display: grid; place-items: center; flex: 0 0 auto; }
.chev { color: var(--ink-3); flex: 0 0 auto; display: inline-flex; }

/* Contractor mark: the pro's own colour and initial (their brand, not ours) */
.pmark { width: 38px; height: 38px; border-radius: 10px; background: var(--brand, var(--navy)); color: #fff; display: grid; place-items: center; font-family: var(--font-display); font-weight: 700; font-size: 17px; flex: 0 0 auto; }
.pmark.sm { width: 30px; height: 30px; border-radius: 8px; font-size: 14px; }
.pmark.lg { width: 56px; height: 56px; border-radius: 14px; font-size: 26px; }
.pmark.inv { background: #fff; color: var(--brand); }

/* Brand band: the top of a contractor-branded page */
.brandband { background: var(--brand); color: #fff; margin: -14px -20px 0; padding: 16px 20px 22px; }
.brandband .h1 { color: #fff; }
.brandband .bb-sub { color: rgba(255,255,255,.8); font-size: 13.5px; margin-top: 4px; }
.brandband .onbrand { display: inline-flex; align-items: center; gap: 5px; background: rgba(255,255,255,.16); color: #fff; border-radius: 99px; padding: 4px 10px; font-size: 11.5px; font-weight: 600; }
.brandband .back { color: rgba(255,255,255,.85); }
.btn.brand { background: var(--brand); color: #fff; }

/* Sticky action bar at the bottom of a screen */
.stickybar { position: sticky; bottom: -28px; margin: 18px -20px -28px; padding: 12px 20px 18px; background: var(--ground); border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; z-index: 3; }
.textbtn { color: var(--ink-2); font-weight: 600; font-size: 13.5px; padding: 8px; text-align: center; }
.textbtn:hover { color: var(--ink); }

/* Bottom sheets: dw-modal moved inside the phone viewport */
.viewport > .dw-modal-back { position: absolute; inset: 0; padding: 0; align-items: end; place-items: end stretch; display: grid; z-index: 20; background: rgba(42,26,21,.4); }
.viewport > .dw-modal-back[hidden] { display: none !important; }
.viewport > .dw-modal-back .dw-modal { width: 100%; max-height: 86%; border-radius: 22px 22px 0 0; padding: 10px 20px 24px; animation: sheet-in 180ms var(--ease) both; }
.dw-modal .grab { width: 38px; height: 5px; border-radius: 3px; background: var(--line-strong); margin: 0 auto 14px; }
@keyframes sheet-in { from { transform: translateY(24px); opacity: .6 } to { transform: none; opacity: 1 } }

/* Photo placeholder */
.photo { position: relative; border-radius: 12px; overflow: hidden; background: var(--surface-2); border: 1px solid var(--line); display: grid; place-items: center; color: var(--ink-3); aspect-ratio: 16 / 9; }
.photo svg.art { position: absolute; inset: 0; width: 100%; height: 100%; }
.photo .cap { position: absolute; left: 8px; bottom: 8px; background: rgba(42,26,21,.72); color: #fff; font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 6px; }

/* Checks list (what saving does) */
.checks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.checks li { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; line-height: 1.45; }
.checks .ck { width: 20px; height: 20px; border-radius: 50%; background: var(--kept-soft); color: var(--kept); display: grid; place-items: center; flex: 0 0 auto; margin-top: 1px; }

/* Checkbox (tickable) */
.tick { width: 24px; height: 24px; border-radius: 7px; border: 2px solid var(--line-strong); background: var(--surface); display: grid; place-items: center; flex: 0 0 auto; color: #fff; }
.tick[aria-checked="true"] { background: var(--fill); border-color: var(--primary); color: var(--on-fill); }
.tick[aria-checked="false"] svg { visibility: hidden; }

/* Stepper progress */
.steps { display: flex; gap: 5px; flex: 1; }
.steps i { flex: 1; height: 4px; border-radius: 2px; background: var(--line); }
.steps i.on { background: var(--primary); }

/* Big check / pending */
.bigcheck { width: 64px; height: 64px; border-radius: 50%; background: var(--kept-soft); color: var(--kept); display: grid; place-items: center; }
.bigcheck.pending { background: var(--surface-2); color: var(--ink-3); }
.spin { animation: app-spin 900ms linear infinite; }
@keyframes app-spin { to { transform: rotate(360deg) } }

/* Phone number card */
.phonecard { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--surface); border: 1.5px solid var(--line); border-radius: 14px; padding: 12px 12px 12px 16px; }
.phonecard .pn { font-family: var(--font-mono); font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }

/* Age bar with typical-life band */
.lifebar { position: relative; height: 6px; border-radius: 3px; background: var(--surface-2); }
.lifebar i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 3px; background: var(--ink-3); }
.lifebar.late i { background: var(--watch); }

/* Stars */
.stars { display: flex; gap: 4px; }
.stars button { color: var(--line-strong); padding: 2px; }
.stars button.on { color: var(--primary); }
.stars button.on svg path { fill: currentColor; }

/* Provenance chip */
.prov { font-size: 11px; color: var(--ink-3); }

.footer-note { margin-top: 18px; font-family: var(--font-mono); font-size: 9px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); line-height: 1.9; }

/* ---- responsive ---- */
@media (max-width: 1180px) and (min-width: 641px) {
  .stage { grid-template-columns: 1fr; gap: 20px; padding: 20px 16px 80px; justify-items: center; }
  .rail { width: 100%; max-width: 392px; max-height: none; }
  .rail-nav { flex-direction: row; overflow-x: auto; gap: 6px; padding-bottom: 6px; }
  .rail-group { display: none; }
  .rail-item { flex: 0 0 auto; width: auto; background: var(--surface); border: 1px solid var(--line); }
  .keyhint, .kicker { display: none; }
  .phone { width: min(392px, calc(100vw - 32px)); height: 78vh; min-height: 600px; }
  .notes { width: 100%; max-width: 392px; }
}
@media (max-width: 640px) {
  .stage { display: block; padding: 0; min-height: 100dvh; height: 100dvh; }
  .rail, .notes { display: none; }
  .phone-wrap { height: 100%; }
  .phone { width: 100vw; height: 100dvh; min-height: 0; border-radius: 0; padding: 0; box-shadow: none; }
  .viewport { border-radius: 0; }
  .statusbar { display: none; }
  .viewport.web .statusbar { display: flex; padding-top: 8px; }
  .viewport.web .statusbar > span:first-child, .viewport.web .statusbar > span:last-child { display: none; }
  .viewport.web .urlpill { margin: 0 auto; }
  .tabbar { padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 56px); }
  .screen { padding-bottom: 72px; }
  .stickybar { bottom: -72px; margin-bottom: -72px; padding-bottom: 62px; }
  .viewport.no-tabs .stickybar { padding-bottom: 62px; }
}
.stickybar .btn { white-space: normal; text-align: center; }
.phonecard .pn { white-space: nowrap; font-size: 18px; }

/* A pro who isn't on Doorway yet: no brand colour to borrow, a dashed outline instead */
.pmark.out { background: var(--surface-2); color: var(--ink-2); border: 1.5px dashed var(--line-strong); }
