/* Property Outlook — App Shell chrome (Phase 2a per Recovery Plan v1.5 §4 Phase 2)

   Persistent shell wraps every authenticated surface: sidebar (off-canvas) +
   top bar (hamburger + brand + title + credits-pill + UserMenu) + content
   slot. Ported from `mockups/home-dashboard-desktop.html` lines 51-92 (top
   bar) and 72-92 (sidebar) plus 122-150 (page wrapper) — verbatim selectors
   prefixed with `.shell-` so the new chrome doesn't collide with Bundle 30a's
   `.state-top-*` classes. Phase 2b shipped: every authenticated route now
   renders inside `<AppShell>` (12 view files). The legacy `.state-top-*` /
   `.top-*` CSS in `states.css` / `outlook.css` is dead (no JS markup uses
   those classes anymore — verified by grep) but kept in place to avoid
   regression risk from overlapping selectors; Phase 6 cosmetic-cleanup
   round will delete them alongside the test scaffolding work.

   Phase 2a scope (signed off): shell renders on /account/billing and /account/settings.
   Phase 2b scope (signed off): extended to compare, portfolio, subscription,
   outlook + 4 reports (zoning/market/cma/altpathway), loading, errors, and
   the PropertyView/ReportView fallback branches in app.js.

   Design-token discipline: prefers shared tokens for semantic colors,
   radii, shadows, and motion timings (--brand, --g50..g900, --err, --warn,
   --warn-wash, --r-md/lg/full, --sh-sm/md/lg, --tb/tb-slow, --f, --m,
   --sb-bg). Preserves mockup-specific layout values where the home-dashboard
   port carried them as raw literals — sidebar-tinted whites
   (`rgba(255,255,255,.x)` for low-opacity white-on-dark text), explicit
   pixel sizes for chrome dimensions (52px top-bar height, 260px sidebar
   width, icon sizes), and `#FFFFFF` on a few elements where the existing
   token set has no exact match. The five `var(--g500)` etc. literal hex
   strings inside `js/views/settings.js`'s Clerk `appearance` object are
   intentional too: Clerk's appearance API consumes literal CSS color
   strings, not CSS custom-property references.
*/

/* ============================================================================
   TOP BAR
   ============================================================================ */
.shell-top {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 64px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--g200);
  z-index: 40;
  display: flex;
  align-items: center;
  padding: 0 18px;
  gap: 14px;
}

.shell-hamburger {
  width: 34px;
  height: 34px;
  border-radius: var(--r-md);
  display: grid;
  place-items: center;
  color: var(--g600);
  background: none;
  border: none;
  cursor: pointer;
  transition: background var(--tb), color var(--tb);
}
.shell-hamburger:hover {
  background: var(--g100);
  color: var(--g900);
}
.shell-hamburger i {
  width: 17px;
  height: 17px;
}

.shell-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
}
.shell-brand img {
  height: 54px;
  width: auto;
  object-fit: contain;
}
.shell-brand-label {
  font-size: 11px;
  color: var(--g500);
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.shell-divider {
  width: 1px;
  height: 20px;
  background: var(--g200);
}

.shell-title {
  flex: 1;
  font-size: 13px;
  font-weight: 600;
  color: var(--g700);
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.shell-title .shell-subtitle {
  color: var(--g500);
  font-weight: 500;
  margin-left: 6px;
}

.shell-top-r {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.shell-credits {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  background: var(--g100);
  border-radius: var(--r-full);
  font: 700 12px var(--m);
  color: var(--g900);
  text-decoration: none;
  transition: background var(--tb);
}
.shell-credits:hover {
  background: var(--g150);
}
.shell-credits .dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--brand);
}
.shell-credits .reserve {
  font-size: 10px;
  font-weight: 600;
  color: var(--g500);
  margin-left: 2px;
}
.shell-credits.empty .dot {
  background: var(--err);
}
.shell-credits.empty {
  color: var(--err);
}

/* ============================================================================
   SIDEBAR (off-canvas)
   ============================================================================ */
.shell-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 260px;
  background: var(--sb-bg);
  color: rgba(255, 255, 255, 0.8);
  z-index: 60;
  transform: translateX(-100%);
  transition: transform var(--tb-slow);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  box-shadow: var(--sh-lg);
}
.shell-sidebar.open {
  transform: translateX(0);
}

.shell-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0);
  transition: background var(--tb-slow);
  z-index: 55;
  pointer-events: none;
}
.shell-backdrop.on {
  background: rgba(0, 0, 0, 0.42);
  pointer-events: auto;
}

.shell-sb-h {
  padding: 24px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
}
.shell-sb-h img {
  height: 66px;
  width: auto;
  object-fit: contain;
}
.shell-sb-h-text {
  display: flex;
  flex-direction: column;
}
.shell-sb-h-sub {
  font-size: 10px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.55);
  letter-spacing: 0.04em;
  margin-top: 1px;
}
.shell-sb-h .x {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 28px;
  height: 28px;
  border-radius: var(--r-md);
  display: grid;
  place-items: center;
  color: rgba(255, 255, 255, 0.6);
  background: none;
  border: none;
  cursor: pointer;
}
.shell-sb-h .x:hover {
  color: #fff;
}
.shell-sb-h .x i {
  width: 15px;
  height: 15px;
}

.shell-sb-sec {
  padding: 14px 14px 4px;
  font: 600 11px var(--f);
  color: rgba(255, 255, 255, 0.45);
  letter-spacing: 0;
}

.shell-sb-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  margin: 0 8px 1px;
  border-radius: var(--r-md);
  font-size: 12.5px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.58);
  cursor: pointer;
  transition: all var(--tb);
  position: relative;
  text-decoration: none;
}
.shell-sb-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.88);
}
.shell-sb-item.on {
  background: rgba(255, 255, 255, 0.10);
  color: #fff;
  font-weight: 600;
}
.shell-sb-item.on::before {
  content: '';
  position: absolute;
  left: 0;
  top: 5px;
  bottom: 5px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--brand);
}
.shell-sb-item.disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}
.shell-sb-item i {
  width: 15px;
  height: 15px;
}
.shell-sb-item .ct {
  margin-left: auto;
  font: 700 10px var(--m);
  color: rgba(255, 255, 255, 0.55);
}
.shell-sb-item .soon {
  margin-left: auto;
  font: 500 11px var(--f);
  color: rgba(255, 255, 255, 0.4);
  letter-spacing: 0;
}

.shell-sb-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
  margin: 8px 14px;
}

.shell-sb-footer {
  margin-top: auto;
  padding: 12px 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 12px;
}
.shell-sb-av {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  display: grid;
  place-items: center;
  font: 700 11px var(--m);
}
.shell-sb-footer-info {
  color: #fff;
  font-weight: 600;
  flex: 1;
  min-width: 0;
}
.shell-sb-footer-info span {
  display: block;
  color: rgba(255, 255, 255, 0.55);
  font-weight: 400;
  font-size: 10px;
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ============================================================================
   PAGE WRAPPER (content slot below the fixed top bar)
   ============================================================================ */
.shell-page {
  margin-top: 64px;
  min-height: calc(100vh - 64px);
  background: var(--g50);
}

/* When a Phase 2a/2b view's outer wrapper is nested inside the shell,
   neutralize its `min-height: 100vh` and any state-top-era top padding
   that assumed a 52px fixed-position header (now provided by .shell-top
   itself, which already pushes .shell-page content down via margin-top).

   `.bill-page` (Phase 2a · billing.js) — set background + min-height.
   `.state-page` (Phase 2b · compare/portfolio/subscription/loading/errors) —
   set padding 76px top (was 52px state-top + 24px breathing) + min-height
   100vh. Inside the shell both are double-counted, so we reset the top
   padding here and let inner content govern padding from there. The
   bottom + side padding stays so visual rhythm matches the prior chrome.

   `.page` (Phase 2b · outlook.js) — sets `margin-top: 52px` for the legacy
   fixed TopBar plus `min-height: calc(100vh - 52px)`. Inside the shell the
   margin-top is already provided by `.shell-page`, so the inner `.page`
   would double-count to a 104px gap; reset it.

   These overrides are scoped to the immediate `.shell-page` child so they
   don't leak into nested matches. */
.shell-page > .bill-page,
.shell-page > .state-page,
.shell-page > .page {
  min-height: auto;
  background: transparent;
}
.shell-page > .state-page {
  padding-top: 24px;
}
.shell-page > .page {
  margin-top: 0;
}

/* ============================================================================
   CONFIG-ERROR BANNER (Phase 2a — visible billing-not-configured surface)
   Used when STRIPE_PRICE_IDS contain null placeholders. Replaces silent
   fallback per Recovery Plan v1.5 §4 Phase 2 acceptance criterion.
   ============================================================================ */
.shell-config-error {
  margin: 18px 28px 0;
  padding: 14px 18px;
  background: var(--warn-wash);
  border: 1px solid var(--warn);
  border-left: 4px solid var(--warn);
  border-radius: var(--r-md);
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 13px;
  color: var(--g800);
  line-height: 1.5;
}
.shell-config-error i {
  width: 18px;
  height: 18px;
  color: var(--warn);
  flex-shrink: 0;
  margin-top: 1px;
}
.shell-config-error strong {
  color: var(--g900);
  font-weight: 700;
}
.shell-config-error-body {
  flex: 1;
}
.shell-config-error-title {
  font-weight: 700;
  color: var(--g900);
  margin-bottom: 2px;
}
.shell-config-error code {
  font: 600 11px var(--m);
  background: var(--w);
  padding: 1px 5px;
  border-radius: 3px;
  border: 1px solid var(--g200);
}

/* ============================================================================
   CLERK USERPROFILE WRAPPER (Phase 2a — /account/settings)
   Light appearance overrides per user direction Path 1 with guardrails: align
   font + primary + radius + background to Property Outlook tokens. Anything
   beyond is P2 polish, not a Phase 2a blocker.
   ============================================================================ */
.shell-settings {
  max-width: 1080px;
  margin: 0 auto;
  padding: 28px 28px 60px;
}
.shell-settings-h {
  margin-bottom: 18px;
}
.shell-settings-h h1 {
  font: 700 22px var(--f);
  color: var(--g900);
  letter-spacing: 0;
  margin-bottom: 4px;
}
.shell-settings-h p {
  font-size: 13px;
  color: var(--g600);
}
.shell-settings-mount {
  background: var(--w);
  border: 1px solid var(--g200);
  border-radius: var(--r-lg);
  padding: 0;
  overflow: hidden;
  box-shadow: var(--sh-sm);
}
.shell-settings-error,
.shell-settings-loading {
  padding: 60px 28px;
  text-align: center;
  font-size: 13px;
  color: var(--g600);
}
.shell-settings-error h2 {
  font: 700 16px var(--f);
  color: var(--g900);
  margin-bottom: 6px;
}

/* ============================================================================
   RESPONSIVE — sidebar stays off-canvas at all widths (toggle only).
   Top bar already fluid via flex layout.
   ============================================================================ */
@media (max-width: 760px) {
  .shell-top {
    padding: 0 12px;
    gap: 8px;
  }
  .shell-brand-label {
    display: none;
  }
  .shell-credits .reserve {
    display: none;
  }
  .shell-settings {
    padding: 18px 14px 40px;
  }
  .shell-config-error {
    margin: 14px 14px 0;
  }
}
