/* Doorway shell: crimson-deep rail (the frame), cream work ground.
   Desktop first: owners and marketing managers run this at a desk; the
   owner's phone view is its own screen (#phone). Light-only. */

body { background: var(--ground); }
.hub { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
kbd { font-family: var(--font-mono); font-size: 10px; border: 1px solid currentColor; border-radius: 4px; padding: 0 4px; opacity: .8; }

/* ---- rail ---- */
.side { background: var(--side-bg); color: var(--side-ink); display: flex; flex-direction: column; gap: 14px; padding: 18px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto; scrollbar-width: thin; }
.side-top { display: flex; align-items: center; justify-content: space-between; padding: 0 6px; }
.side-brand { display: inline-flex; align-items: center; gap: 9px; color: var(--parchment); text-decoration: none; }
.side-brand:hover { text-decoration: none; }
.side-brand .wordmark { font-size: 19px; color: var(--parchment); }
.side-brand .wordmark i { color: var(--door); }
.side-close { display: none; color: var(--side-ink); }
.acct { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 11px; background: var(--frame-2); border: 1px solid rgba(255,255,255,.08); color: var(--side-ink); text-align: left; }
.acct:hover { background: #A3183A; }
.acct b { display: block; color: #FFFFFF; font-size: 13px; }
.acct small { font-size: 11px; color: var(--side-ink-2); }
.acct-tile { width: 28px; height: 28px; border-radius: 7px; background: var(--parchment); color: var(--navy); font-family: var(--font-display); font-weight: 600; font-size: 11px; display: grid; place-items: center; flex: 0 0 auto; }
.acct-list .option { display: flex; align-items: center; gap: 12px; text-align: left; width: 100%; }
.acct-list .option small { display: block; font-size: 12px; color: var(--ink-2); }
.acct-list .bt { width: 30px; height: 30px; border-radius: 7px; color: #fff; font-family: var(--font-display); font-weight: 600; font-size: 11px; display: grid; place-items: center; flex: 0 0 auto; }
.side-nav { display: flex; flex-direction: column; gap: 1px; }
.side-group { font-family: var(--font-mono); font-size: 9.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--side-ink-2); padding: 14px 10px 5px; }
.side-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--side-ink); font-size: 13.5px; font-weight: 500; width: 100%; text-align: left; }
.side-item:hover { background: var(--side-hover); color: #fff; }
.side-item.on { background: var(--parchment); color: var(--navy); font-weight: 600; }
.side-item.on .count { background: rgba(125,3,34,.12); }
.side-item.on .k { color: var(--navy); border-color: rgba(125,3,34,.35); }
.side-item .count { margin-left: auto; font-family: var(--font-mono); font-size: 10px; background: rgba(255,255,255,.12); padding: 1px 7px; border-radius: 99px; }
.side-item .k { opacity: 0; transition: opacity 120ms ease; margin-left: auto; font-size: 9px; color: var(--side-ink-2); border-color: rgba(255,255,255,.18); opacity: 1; }
.side-item .count + .k { display: none; }
.side:hover .side-item .k, .side:focus-within .side-item .k { opacity: 1; }
.side-foot { margin-top: auto; padding: 12px 4px 4px; display: flex; flex-direction: column; gap: 12px; }
.side-door { display: flex; gap: 10px; align-items: flex-start; text-align: left; padding: 9px 10px; border-radius: 10px; border: 1px solid rgba(255,255,255,.1); color: var(--side-ink); }
.side-door:hover { background: var(--side-hover); }
.side-door b { display: block; color: #fff; font-size: 12.5px; }
.side-door small { display: block; font-size: 11px; color: var(--side-ink-2); line-height: 1.4; }
.side-keys { font-family: var(--font-mono); font-size: 10px; color: var(--side-ink-2); padding: 0 6px; }

body[data-role="frontdesk"] [data-hide-frontdesk],
body[data-role="marketing"] [data-hide-marketing],
body[data-role="owner"] [data-hide-owner] { display: none !important; }

/* ---- main ---- */
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 50; display: flex; align-items: center; gap: 12px; padding: 12px 28px; background: color-mix(in srgb, var(--ground) 92%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.page-title { font-family: var(--font-display); font-weight: 600; font-size: 21px; letter-spacing: -.015em; line-height: 1.2; }
.menu-btn { display: none; }
.door-chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px 5px 7px; border: 1px solid var(--line-strong); border-radius: 99px; font-family: var(--font-mono); font-size: 10.5px; font-weight: 600; letter-spacing: .04em; color: var(--navy); background: var(--surface); white-space: nowrap; }
.door-chip:hover { border-color: var(--primary); }
.door-chip .door-g { color: var(--navy); }
.sync-line { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: var(--ink-2); white-space: nowrap; }
.sync-line:hover { color: var(--primary); }
.sync-line .status-dot { background: var(--teal); }
.view-seg button { padding: 6px 10px; font-size: 12px; }
.ask-btn { gap: 8px; padding: 8px 12px; }
.ask-k { font-size: 9.5px; opacity: .7; border-color: rgba(255,255,255,.4); }
.content { padding: 24px 28px 96px; min-width: 0; }
.screen { display: none; }
.screen.active { display: block; }

/* ---- Ask Doorway overlay ---- */
.ask-back { align-items: start; padding-top: 10vh; }
.dw-modal.ask { width: min(640px, 100%); padding: 0; overflow: hidden; }
.ask-field { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.ask-field input { border: 0; outline: 0; font-size: 16px; background: transparent; color: var(--ink); min-width: 0; }
.ask-body { padding: 16px 18px; max-height: 60vh; overflow: auto; }
.ask-q { display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-radius: 10px; border: 1px solid var(--line); font-size: 14px; font-weight: 500; width: 100%; text-align: left; }
.ask-q:hover { border-color: var(--primary); }
.ask-q svg { color: var(--primary); flex: 0 0 auto; }
.ask-sent { font-size: 16px; line-height: 1.5; margin-top: 8px; }
.ask-num { display: flex; align-items: baseline; gap: 10px; margin-top: 12px; padding: 12px 14px; background: var(--surface-2); border-radius: 12px; }
.ask-num .mono { font-size: 26px; font-weight: 600; color: var(--ink); }
.ask-num span:last-child { color: var(--ink); font-size: 13.5px; }
.ask-rec { margin-top: 14px; }
.ask-rec ul { margin: 6px 0 0; padding-left: 18px; font-size: 13px; color: var(--ink-2); }
.ask-rec li { margin: 3px 0; }
.ask-fine { font-size: 11.5px; color: var(--ink-3); padding: 10px 18px 14px; border-top: 1px solid var(--line); }

/* ---- page patterns (use these in screens) ---- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head .lede { color: var(--ink-2); max-width: 66ch; font-size: 14px; margin-top: 6px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.kpi-card { background: var(--surface); border-radius: 14px; padding: 16px; box-shadow: var(--shadow-card); display: flex; flex-direction: column; gap: 6px; min-width: 0; border: 1px solid var(--line); text-align: left; }
button.kpi-card:hover { border-color: var(--primary); }
.kpi-card .label { font-size: 12px; font-weight: 600; color: var(--ink-2); display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.kpi-card .value { font-family: var(--font-mono); font-size: 26px; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.15; color: var(--navy); }
.kpi-card .foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--ink-2); }
.section { margin-top: 22px; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.section-title h2 { font-family: var(--font-display); font-weight: 600; font-size: 16px; letter-spacing: -.01em; }
.split { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 16px; }
.split.even { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--ink-3); flex: 0 0 auto; }
.status-dot.kept { background: var(--teal); } .status-dot.watch { background: var(--watch); } .status-dot.breach { background: var(--breach); } .status-dot.blue { background: var(--frame); }
.filterbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.filter { display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px; border: 1px solid var(--line); border-radius: 99px; background: var(--surface); font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.filter.on { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
.numlink { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-weight: 600; color: inherit; border-bottom: 1px dotted var(--line-strong); }
.numlink:hover { border-bottom-color: var(--primary); color: var(--primary); }

/* ---- colour: crimson for active states and focus ---- */
.seg button.on { background: var(--fill); color: var(--on-fill); }
.side .seg button.on { background: var(--parchment); color: var(--navy); }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.side :focus-visible { outline-color: var(--parchment); }
.side-view { display: none; }

/* ---- disclosure: one pattern everywhere ----
   <details class="more"><summary>Details</summary> … </details> */
details.more { margin-top: 8px; }
details.more > summary { list-style: none; display: inline-flex; align-items: center; gap: 6px; cursor: pointer; padding: 4px 0; font-size: 13px; font-weight: 600; color: var(--primary); user-select: none; border-radius: 6px; }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::after { content: ''; width: 7px; height: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: translateY(-2px) rotate(45deg); transition: transform 160ms var(--ease); flex: 0 0 auto; }
details.more[open] > summary::after { transform: translateY(1px) rotate(-135deg); }
details.more > summary:hover { text-decoration: underline; text-underline-offset: 3px; }
details.more > :not(summary) { margin-top: 8px; }
details.more[open] > summary { margin-bottom: 2px; }

/* ---- phone tab bar (shown under 760px) ---- */
.tabbar { display: none; }

/* ---- responsive ---- */
@media (max-width: 1280px) { .sync-line { display: none; } }
@media (max-width: 1100px) {
  .split, .split.even { grid-template-columns: minmax(0, 1fr); }
  .ask-t { display: none; }
}
@media (max-width: 860px) {
  .hub { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: 280px; z-index: 200; transform: translateX(-100%); transition: transform 180ms var(--ease); height: auto; }
  .side.open { transform: none; }
  .side-close, .menu-btn { display: inline-grid; }
  .side-scrim { position: fixed; inset: 0; background: rgba(42,26,21,.45); z-index: 150; }
  .topbar { padding: 10px 16px; gap: 8px; flex-wrap: wrap; }
  .view-seg { order: 5; width: 100%; }
  .view-seg button { flex: 1; }
  .ask-k { display: none; }
  .content { padding: 18px 16px 110px; }
  .page-title { font-size: 18px; }
  .ask-back { padding-top: 16px; }
}
@media (max-width: 480px) { .door-chip { font-size: 0; gap: 0; padding: 5px; } }
@media (max-width: 760px) {
  .menu-btn, .door-chip, .sync-line, .top-view { display: none !important; }
  .topbar { flex-wrap: nowrap; padding: 10px 16px; }
  .tb-title { min-width: 0; }
  .tb-title .eyebrow, .page-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .ask-btn { width: 38px; height: 38px; padding: 0; border-radius: 11px; }
  .side { bottom: calc(62px + env(safe-area-inset-bottom, 0px)); width: min(300px, 86vw); }
  .side-scrim { bottom: calc(62px + env(safe-area-inset-bottom, 0px)); }
  .side-keys { display: none; }
  .side-view { display: flex; order: 0; width: 100%; flex: 0 0 auto; background: var(--frame-2); border-color: rgba(255,255,255,.1); }
  .side-item .k { display: none; }
  .side-view button { flex: 1; color: var(--side-ink); padding: 7px 6px; font-size: 12px; }
  .tabbar { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); position: fixed; left: 0; right: 0; bottom: 0; z-index: 260; background: var(--frame); padding: 6px 0 calc(6px + env(safe-area-inset-bottom, 0px)); box-shadow: 0 -4px 16px rgba(42,26,21,.18); }
  .tabbar button { position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 5px 0; border-radius: 10px; color: var(--slate-2); font-size: 10px; letter-spacing: -.01em; font-weight: 600; min-width: 0; }
  .tabbar button > span:last-of-type { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .tabbar button.on, .tabbar button.on-more { color: var(--on-frame); }
  .tabbar button.on svg, .tabbar button.on-more svg { color: var(--crimson); }
  .tabbar button.on::before { content: ''; position: absolute; top: -6px; left: 30%; right: 30%; height: 3px; border-radius: 0 0 3px 3px; background: var(--parchment); }
  .tabbar button[hidden] { display: none; }
  .tb-count { position: absolute; top: 1px; left: calc(50% + 6px); font-style: normal; font-family: var(--font-mono); font-size: 9.5px; line-height: 15px; min-width: 15px; padding: 0 4px; border-radius: 99px; background: var(--parchment); color: var(--navy); }
  .content { padding: 16px 16px calc(150px + env(safe-area-inset-bottom, 0px)); }
  .proto-bar { bottom: calc(70px + env(safe-area-inset-bottom, 0px)) !important; }
  body.menu-open .proto-bar { display: none; }
  .dw-toast { bottom: calc(124px + env(safe-area-inset-bottom, 0px)); }
  .page-head { margin-bottom: 14px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi-card { padding: 12px; }
  .kpi-card .value { font-size: 21px; }
}

/* =====================================================================
   SIDEBAR THEMES · html[data-side] = ecru (default) | white | grey | navy
   Light sidebars: ink text, crimson logo, a soft crimson active row.
   ===================================================================== */
html[data-side="ecru"]  { --side-bg: #F3EADB; --side-line: #E4D6BF; }
html[data-side="white"] { --side-bg: #FFFFFF; --side-line: #EADBC4; }
html[data-side="grey"]  { --side-bg: #EFEDEA; --side-line: #DEDAD4; }
html:is([data-side="ecru"],[data-side="white"],[data-side="grey"]) {
  --side-ink: #2A1A15; --side-ink-2: #8A7468; --side-hover: rgba(42,26,21,.06);
}
html:is([data-side="ecru"],[data-side="white"],[data-side="grey"]) .side { border-right: 1px solid var(--side-line); }
html:is([data-side="ecru"],[data-side="white"],[data-side="grey"]) .side-brand,
html:is([data-side="ecru"],[data-side="white"],[data-side="grey"]) .side-brand .wordmark { color: var(--crimson); }
html:is([data-side="ecru"],[data-side="white"],[data-side="grey"]) .acct { background: var(--surface); border-color: var(--side-line); box-shadow: 0 1px 2px rgba(42,26,21,.05); }
html:is([data-side="ecru"],[data-side="white"],[data-side="grey"]) .side-item:hover { color: var(--ink); }
html:is([data-side="ecru"],[data-side="white"],[data-side="grey"]) .side-item.on { background: #F7DFDF; color: var(--crimson-deep); box-shadow: inset 3px 0 0 var(--crimson); }
html:is([data-side="ecru"],[data-side="white"],[data-side="grey"]) .side-item .count { background: rgba(42,26,21,.07); }
html:is([data-side="ecru"],[data-side="white"],[data-side="grey"]) .side-item.on .count { background: rgba(174,4,46,.12); }
html:is([data-side="ecru"],[data-side="white"],[data-side="grey"]) .side-item .k { border-color: rgba(42,26,21,.18); }
html:is([data-side="ecru"],[data-side="white"],[data-side="grey"]) .side-door { border-color: var(--side-line); }
html:is([data-side="ecru"],[data-side="white"],[data-side="grey"]) .side-door b { color: var(--ink); }
html:is([data-side="ecru"],[data-side="white"],[data-side="grey"]) .side .seg button.on { background: var(--crimson); color: #FFFDF8; }
html:is([data-side="ecru"],[data-side="white"],[data-side="grey"]) .side :focus-visible { outline-color: var(--crimson); }
html:is([data-side="ecru"],[data-side="white"],[data-side="grey"]) .side-view { background: var(--surface); border-color: var(--side-line); }
/* the old midnight navy, with the new logo in parchment */
html[data-side="navy"] { --side-bg: #0E1A36; --side-ink: #E6E1D6; --side-ink-2: #9AA3B8; --side-hover: #1B2A4D; }
html[data-side="navy"] .acct, html[data-side="navy"] .side-view { background: #1B2A4D; }
html[data-side="navy"] .side-item.on { background: var(--parchment); color: #0E1A36; }
html:is([data-side="ecru"],[data-side="white"],[data-side="grey"]) .acct b { color: var(--ink); }
html:is([data-side="ecru"],[data-side="white"],[data-side="grey"]) .acct:hover { background: var(--surface-2); }
html:is([data-side="ecru"],[data-side="white"],[data-side="grey"]) .acct-tile { background: var(--crimson); color: #FFFDF8; }
html[data-side="navy"] .acct:hover { background: #24365F; }
