/* BIG AV HQ: owner dashboard and pipeline. Uses the tokens from home.css. */
#hq-app { position: fixed; inset: 0; z-index: 150; display: grid; grid-template-columns: 252px 1fr; background: var(--app); color: var(--ink); font-family: var(--font); }
#hq-app[hidden] { display: none; }
body.hq-open { overflow: hidden; }
body.hq-open #portal-container, body.hq-open #bottom-nav { visibility: hidden; }

/* Sidebar */
.hq-side { display: flex; flex-direction: column; gap: 4px; padding: 16px 12px 12px; background: var(--card); border-right: 1px solid var(--line); overflow: hidden; min-height: 0; }
.hq-brand { display: flex; align-items: center; gap: 10px; padding: 2px 6px 12px; }
.hq-mark img { display: block; width: 36px; height: 36px; border-radius: 10px; }
.hq-brand-name { font-size: 15px; font-weight: 700; letter-spacing: -0.02em; }
.hq-brand-sub { font-size: 12px; color: var(--muted); }
.hq-icon-btn.hq-drawer-close { display: none; margin-left: auto; }
.hq-search { flex: none; display: flex; align-items: center; gap: 8px; margin: 0 2px 8px; padding: 0 12px; min-height: 44px; border-radius: 12px; background: var(--fill); color: var(--muted); }
.hq-search svg { width: 16px; height: 16px; flex: none; }
.hq-search input { flex: 1; align-self: stretch; min-width: 0; border: 0; background: none; font: inherit; font-size: 14px; color: var(--ink); outline: none; }
.hq-search:focus-within { box-shadow: 0 0 0 2px var(--brand); }
.hq-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; min-height: 0; overflow-y: auto; margin: 0 -4px; padding: 0 4px; }
.hq-nav-group { margin: 14px 10px 6px; font-size: 11px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.hq-nav-item { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 0 10px; border: 0; border-radius: 12px; background: none; font: inherit; font-size: 14.5px; color: var(--ink); text-align: left; cursor: pointer; }
.hq-nav-item:hover { background: var(--fill); }
.hq-nav-item.is-active { background: var(--brand-tint); color: var(--brand-text); font-weight: 500; }
.hq-nav-item.is-locked { color: var(--muted); cursor: default; }
.hq-nav-item.is-locked:hover { background: none; }
.hq-nav-item.is-locked .hq-tile { background: var(--fill); color: var(--faint); }
.hq-lock { margin-left: auto; color: var(--faint); display: grid; }
.hq-lock svg { width: 14px; height: 14px; }
.hq-badge { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--bad); color: #fff; font-size: 11.5px; font-weight: 500; display: grid; place-items: center; }
.hq-user { flex: none; display: flex; align-items: center; gap: 10px; margin-top: auto; padding: 14px 6px 4px; border-top: 1px solid var(--line-soft); }
.hq-user-name { font-size: 14px; font-weight: 500; }
.hq-user-role { font-size: 12px; color: var(--muted); }

/* Tiles and avatars */
.hq-tile { width: 36px; height: 36px; flex: none; border-radius: 11px; display: grid; place-items: center; background: var(--fill); color: var(--ink-2); }
.hq-tile svg { width: 18px; height: 18px; }
.hq-tile.is-sm { width: 26px; height: 26px; border-radius: 8px; }
.hq-tile.is-sm svg { width: 15px; height: 15px; }
.t-brand { background: var(--brand-tint); color: var(--brand-text); }
.t-ok { background: var(--ok-tint); color: var(--ok); }
.t-warn { background: var(--warn-tint); color: var(--warn); }
.t-bad { background: var(--bad-tint); color: var(--bad); }
.t-info { background: var(--info-tint); color: var(--info); }
.t-muted { background: var(--fill); color: var(--muted); }
.hq-avatar { width: 36px; height: 36px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--brand-tint); color: var(--brand-text); font-size: 12.5px; font-weight: 700; letter-spacing: .02em; }
.hq-avatar.is-brand { background: linear-gradient(135deg, #6E62D6, var(--brand)); color: #fff; }

/* Main column */
.hq-main { overflow-y: auto; min-width: 0; }
.hq-top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 10px 28px; background: rgba(246,247,249,.92); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); border-bottom: 1px solid var(--line); }
.hq-top-title { display: flex; align-items: baseline; gap: 10px; font-size: 18px; font-weight: 700; letter-spacing: -0.02em; min-width: 0; }
.hq-top-date { font-size: 13.5px; font-weight: 400; color: var(--muted); white-space: nowrap; }
.hq-top-actions { margin-left: auto; display: flex; gap: 8px; }
.hq-icon-btn { width: 44px; height: 44px; flex: none; border: 0; border-radius: 12px; background: var(--card); box-shadow: var(--shadow); display: grid; place-items: center; color: var(--ink); cursor: pointer; }
.hq-icon-btn svg { width: 20px; height: 20px; }
.hq-icon-btn.hq-menu { display: none; }
.hq-content { padding: 24px 28px 48px; max-width: 1240px; }

/* Hero */
.hq-hero { position: relative; overflow: hidden; border-radius: var(--r-hero); padding: 26px 26px 24px; color: #fff; box-shadow: var(--shadow-hero);
  background: radial-gradient(70% 120% at 100% 100%, rgba(57,43,179,.75) 0%, rgba(57,43,179,0) 60%), linear-gradient(135deg, #1C1C24 0%, #111114 100%); }
.hq-hero-date { font-size: 13px; font-weight: 500; color: #B9B2F5; }
.hq-hero-title { font-size: 26px; font-weight: 700; letter-spacing: -0.03em; margin-top: 4px; }
.hq-hero-sub { font-size: 14.5px; opacity: .78; margin-top: 4px; }
.hq-hero-nums { display: flex; flex-wrap: wrap; gap: 14px 36px; margin-top: 22px; }
.hq-num { font-size: 26px; font-weight: 700; letter-spacing: -0.035em; font-variant-numeric: tabular-nums; }
.hq-num-label { font-size: 12.5px; opacity: .7; margin-top: 2px; }

/* KPI cards */
.hq-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-top: 16px; }
.hq-kpi { background: var(--card); border-radius: var(--r-small); box-shadow: var(--shadow); padding: 16px 18px; }
.hq-kpi-head { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--ink-2); }
.hq-kpi-body { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; margin-top: 10px; }
.hq-kpi-value { font-size: 26px; font-weight: 700; letter-spacing: -0.035em; font-variant-numeric: tabular-nums; }
.hq-kpi-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.hq-kpi-sub b { color: var(--ok); font-weight: 500; }
.hq-kpi-sub b.is-bad { color: var(--bad); }
.hq-spark { width: 86px; height: 30px; flex: none; overflow: visible; }
.hq-spark-line { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; }
.hq-spark-area { fill: currentColor; opacity: .1; stroke: none; }
.hq-spark-flat { stroke: var(--line); stroke-width: 1.5; }
.hq-spark.t-brand { color: var(--brand); background: none; }
.hq-spark.t-ok { color: var(--ok); background: none; }
.hq-spark.t-info { color: var(--info); background: none; }

/* Dashboard grid */
.hq-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 16px; margin-top: 16px; align-items: start; }
.hq-card { background: var(--card); border-radius: var(--r-small); box-shadow: var(--shadow); padding: 6px 0 8px; min-width: 0; }
.hq-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 20px 8px; }
.hq-card-head h2 { font-size: 16px; font-weight: 700; letter-spacing: -0.02em; }
.hq-count { min-width: 24px; height: 24px; padding: 0 7px; border-radius: 12px; background: var(--bad-tint); color: var(--bad); font-size: 12.5px; font-weight: 500; display: grid; place-items: center; }
.hq-count.is-neutral { background: var(--fill, #f1f1f4); color: var(--ink, #1a1a1f); }
.hq-link { border: 0; background: none; color: var(--brand-text); font: inherit; font-size: 14px; font-weight: 500; cursor: pointer; min-height: 44px; }
.hq-legend { display: flex; gap: 14px; font-size: 12.5px; color: var(--muted); }
.hq-legend span { display: inline-flex; align-items: center; gap: 6px; }
.hq-legend i { width: 9px; height: 9px; border-radius: 2px; display: inline-block; }
.is-won { background: var(--brand); }
.is-cash { background: #A9A1EE; }
.hq-bars { display: grid; grid-template-columns: repeat(8, 1fr); gap: 10px; padding: 14px 20px 8px; align-items: end; }
.hq-bar-col { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.hq-bar-pair { display: flex; align-items: flex-end; gap: 4px; }
.hq-bar { width: 14px; min-height: 2px; border-radius: 4px 4px 0 0; }
.hq-bar-label { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.hq-list { display: flex; flex-direction: column; }
.hq-row { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 60px; padding: 10px 20px; border: 0; border-top: 1px solid var(--line-soft); background: none; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.hq-row:first-child { border-top: 0; }
.hq-row:hover { background: var(--fill); }
.hq-row.is-static { cursor: default; }
.hq-row.is-static:hover { background: none; }
.hq-row > svg { width: 18px; height: 18px; flex: none; color: var(--faint); }
.hq-row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.hq-row-title { font-size: 14.5px; font-weight: 500; line-height: 1.35; }
.hq-row-detail { font-size: 12.5px; color: var(--muted); margin-top: 1px; }
.hq-row-time { font-size: 12.5px; color: var(--muted); flex: none; align-self: flex-start; margin-top: 2px; }
.hq-site-prog { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex: none; }
.hq-site-stage { font-size: 12.5px; color: var(--muted); }
.hq-site-stage b { color: var(--ink); font-weight: 500; }
.hq-segs { display: flex; gap: 3px; }
.hq-segs span { width: 16px; height: 5px; border-radius: 3px; background: var(--fill-2); }
.hq-segs span.on { background: var(--brand); }
.hq-segs span.now { background: linear-gradient(90deg, var(--brand) 50%, var(--fill-2) 50%); }
.hq-empty { padding: 14px 20px 16px; font-size: 14px; color: var(--muted); }
.hq-error { padding: 20px; }
.hq-error h2 { font-size: 16px; margin-bottom: 6px; }
.hq-error p { color: var(--muted); margin-bottom: 12px; }

/* Pipeline */
.hq-page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.hq-page-title { font-size: 26px; font-weight: 700; letter-spacing: -0.03em; }
.hq-page-sub { font-size: 14px; color: var(--muted); margin-top: 4px; }
.hq-board { display: grid; grid-auto-flow: column; grid-auto-columns: 236px; gap: 12px; scroll-snap-type: x proximity; overflow-x: auto; padding-bottom: 12px; align-items: start; }
.hq-col { scroll-snap-align: start; background: var(--fill); border-radius: var(--r-small); padding: 10px; display: flex; flex-direction: column; gap: 10px; }
.hq-col-head { display: flex; align-items: center; gap: 8px; padding: 4px 6px 2px; font-size: 14px; }
.hq-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.hq-dot.t-brand { background: var(--brand); } .hq-dot.t-ok { background: var(--ok); } .hq-dot.t-warn { background: #D98E04; }
.hq-dot.t-info { background: var(--info); } .hq-dot.t-muted { background: var(--faint); }
.hq-col-name { font-weight: 500; }
.hq-col-count { color: var(--muted); }
.hq-col-total { margin-left: auto; font-weight: 500; font-variant-numeric: tabular-nums; }
.hq-col-empty { padding: 14px 6px; font-size: 13px; color: var(--muted); text-align: center; }
.hq-deal { display: flex; flex-direction: column; gap: 10px; width: 100%; padding: 14px; border: 0; border-radius: 16px; background: var(--card); box-shadow: var(--shadow); font: inherit; color: inherit; text-align: left; cursor: pointer; transition: transform .15s var(--ease); }
.hq-deal:hover { transform: translateY(-1px); }
.hq-deal:focus-visible, .hq-row:focus-visible, .hq-nav-item:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }
.hq-deal-top { display: flex; align-items: center; gap: 10px; }
.hq-deal-who { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.hq-deal-name { font-size: 14.5px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hq-deal-town { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hq-deal-value { font-size: 15px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.hq-deal-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.hq-deal-chips:empty { display: none; }
.hq-deal-foot { display: flex; align-items: center; gap: 6px; padding-top: 10px; border-top: 1px solid var(--line-soft); font-size: 12.5px; color: var(--muted); }
.hq-deal-foot svg { width: 14px; height: 14px; flex: none; }
.hq-deal-foot.is-hot { color: var(--bad); font-weight: 500; }

/* Narrow screens: the sidebar becomes a drawer. */
@media (max-width: 1100px) { .hq-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } .hq-grid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 860px) {
  #hq-app { grid-template-columns: 1fr; }
  .hq-side { position: fixed; inset: 0 auto 0 0; width: min(300px, 86vw); z-index: 20; transform: translateX(-105%); transition: transform .3s var(--ease); }
  #hq-app.drawer-open .hq-side { box-shadow: 0 20px 60px rgba(0,0,0,.2); }
  .hq-needs { order: -1; }
  .hq-spark { display: none; }
  .hq-bar-col:nth-child(even) .hq-bar-label { visibility: hidden; }
  .hq-scrim { position: fixed; inset: 0; z-index: 19; background: rgba(10,12,14,.4); opacity: 0; pointer-events: none; transition: opacity .3s var(--ease); }
  #hq-app.drawer-open .hq-side { transform: none; }
  #hq-app.drawer-open .hq-scrim { opacity: 1; pointer-events: auto; }
  .hq-icon-btn.hq-menu, .hq-icon-btn.hq-drawer-close { display: grid; }
  .hq-top { padding: 10px 16px; }
  .hq-top-date { display: none; }
  .hq-content { padding: 16px 16px 40px; }
  .hq-hero { padding: 20px 18px; }
  .hq-hero-nums { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
  .hq-num { font-size: 22px; }
  .hq-kpis { gap: 10px; }
  .hq-kpi { padding: 14px; }
  .hq-kpi-value { font-size: 22px; }
  .hq-spark { width: 60px; }
  .hq-bars { gap: 4px; padding: 14px 12px 8px; }
  .hq-bar { width: 9px; }
  .hq-row { padding: 10px 16px; }
  .hq-site-prog { display: none; }
  .hq-board { grid-auto-columns: min(84vw, 320px); scroll-snap-type: x mandatory; }
  .hq-col { scroll-snap-align: start; }
}
@media (max-width: 420px) {
  .hq-wide { display: none; }
  .hq-top-title { font-size: 17px; }
}
@media (min-width: 421px) { .hq-narrow { display: none; } }
@media (min-width: 861px) { .hq-scrim { display: none; } }

/* Phase 4 review: 44px targets and quiet labels */
.hq-top .b-sm, .hq-error .b-sm { min-height: 44px; }
.hq-card-note { font-size: 12.5px; color: var(--muted); }

/* Invoices card (GoHighLevel mirror). */
.hq-bill-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; padding: 4px 20px 8px; }
.hq-bill-value.is-ok { color: var(--ok, #0E7A48); }
.hq-bill-value.is-warn { color: var(--warn, #8A5600); }
.hq-bill-label { font-size: 12.5px; color: var(--muted, #62677A); margin-top: 2px; }
.hq-bill-note { display: block; margin: 4px 0 0; padding: 0 20px; }
.hq-bill-msg { font-size: 13px; margin: 10px 0 8px; padding: 0 20px; color: var(--muted, #62677A); }
.hq-bill-msg.is-ok { color: var(--ok, #0E7A48); }
.hq-bill-msg.is-warn { color: var(--warn, #8A5600); font-weight: 600; }
.hq-bill-msg.is-bad { color: var(--bad, #B23A33); }
.hq-billing [data-hq-sync][disabled] { opacity: .6; cursor: progress; }
.hq-stack { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
@media (max-width: 1100px) { .hq-stack { display: contents; } }

/* Scope check: Portal.io scope against GHL money, per home */
.hq-scope-row { align-items: flex-start; }
.hq-scope-row .hq-row-main { display: flex; flex-direction: column; gap: 2px; }
.hq-scope-flags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.hq-flag { display: inline-block; padding: 3px 9px; border-radius: 999px; background: var(--warn-tint, #fff4e0); color: var(--warn, #a15c00); font-size: 12.5px; font-weight: 500; }
.hq-flag.is-bad { background: var(--bad-tint); color: var(--bad); }
.hq-row-detail.is-ok { color: var(--ok, #1f7a3f); }
.hq-punch .hq-row-main { display: flex; flex-direction: column; gap: 2px; }
.hq-row-answer { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
