/* ============================================================
   RESERVD CUSTOMER APP SHELL — Phase 7.9, Phase 8.0 navy
   Dark branded shell (sidebar · phone business header · bottom bar) in deep
   RESERVD navy around the light workspace. Phase 8.0 follows the clarity
   of a members-portal sidebar: compact rail, clear brand → business →
   grouped pages, one obvious active page. The floating launcher is Ruby
   (photo + "Ask Ruby"). The sidebar is navigation only:
   business identity → RESERVD website → grouped pages. Account actions live
   in the top-right profile menu (identity opens Profile · Settings · Admin
   Console for admins · Sign out). No install link in the app (the browser's
   own install option and the PWA are unchanged).
   ============================================================ */
:root[data-theme="app"]{ --sidebar-w:232px; --appbar-h:60px; --bottomnav-h:64px; }

/* ---------- avatars & business mark ---------- */
.av{display:inline-flex; align-items:center; justify-content:center; flex-shrink:0; border-radius:50%; overflow:hidden; background:#E9E4DC; box-shadow:0 0 0 1px rgba(44,36,28,.10)}
.av img, .av .av-svg{display:block; width:100%; height:100%; object-fit:cover}
.av-initials{background:linear-gradient(135deg, #2C5C86 0%, #5F8FB5 100%); color:#FFFFFF; font-weight:600; letter-spacing:.02em}
.av-initials > span{line-height:1}
.biz-mark{display:inline-flex; align-items:center; justify-content:center; flex-shrink:0; border-radius:10px; font-weight:700; letter-spacing:.02em; color:#FBEBDD;
  background:linear-gradient(140deg, #6B3F27 0%, #A8653E 55%, #C98A57 100%); box-shadow:inset 0 1px 0 rgba(255,255,255,.18), 0 0 0 1px rgba(255,236,222,.1)}

/* ---------- desktop sidebar (dark) ---------- */
:root[data-theme="app"] .sidenav{
  width:var(--sidebar-w); padding:18px 12px 18px; gap:2px;
  background:linear-gradient(180deg, #13243B 0%, #0F1C2E 55%, #0D1828 100%);
  border-right:1px solid rgba(214,228,245,.06);
}
:root[data-theme="app"] .sidenav-brand{padding:2px 8px 18px; gap:10px}
:root[data-theme="app"] .sidenav-brand .brand-emblem{width:28px; height:28px; border-radius:7px; box-shadow:0 0 0 1px rgba(255,255,255,.08)}
:root[data-theme="app"] .sidenav .brand-word{color:#FFFFFF; font-size:12.5px; letter-spacing:.24em}
.sn-biz-wrap{position:relative; margin:0 0 2px}
.sn-biz{display:flex; align-items:center; gap:10px; width:100%; padding:9px 10px; border-radius:12px; border:1px solid var(--line); background:rgba(232,240,250,.05); color:var(--ink); font:inherit; text-align:left; cursor:pointer;
  transition:background-color var(--t-fast) ease, border-color var(--t-fast) ease}
.sn-biz:hover{background:rgba(232,240,250,.09); border-color:var(--line-strong)}
.sn-biz:focus-visible{outline:none; box-shadow:var(--focus-ring)}
.sn-biz-text{min-width:0; flex:1; display:flex; flex-direction:column; gap:2px}
.sn-biz-name{font-size:13.5px; font-weight:600; color:var(--ink); white-space:nowrap; overflow:hidden; text-overflow:ellipsis}
.sn-biz-meta{font-size:11.5px; color:var(--ink-faint); white-space:nowrap; overflow:hidden; text-overflow:ellipsis}
.sn-biz-chev{color:var(--ink-faint); display:flex}
.sn-biz-menu{position:absolute; left:0; right:0; top:calc(100% + 6px); z-index:20; padding:6px; border-radius:14px; background:#18293F; border:1px solid var(--line-strong); box-shadow:0 24px 50px -18px rgba(4,10,20,.65)}
.sn-biz-cur{display:flex; align-items:center; gap:10px; padding:8px; border-radius:10px; background:rgba(232,240,250,.06); color:var(--good)}
.sn-biz-cur > span{flex:1; min-width:0; display:flex; flex-direction:column; color:var(--ink)}
.sn-biz-cur b{font-size:13px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis}
.sn-biz-cur small{font-size:11.5px; color:var(--ink-faint)}
.sn-biz-menu .menu-item{display:flex; align-items:center; gap:10px; width:100%; min-height:40px; padding:0 8px; margin-top:4px; border:none; background:none; border-radius:9px; color:var(--ink); font:inherit; font-size:13.5px; cursor:pointer; text-decoration:none}
.sn-biz-menu .menu-item:hover{background:rgba(232,240,250,.08)}
.sn-biz-menu .menu-item svg{color:var(--ink-faint)}
.menu-item.is-planned{color:var(--ink-faint); cursor:default}
.menu-item.is-planned:hover{background:none}
.menu-item.is-planned .r-chip{margin-left:auto}
/* RESERVD website — compact and secondary, directly under the business card */
.sn-site{display:inline-flex; align-items:center; gap:7px; align-self:flex-start; min-height:32px; margin:6px 0 10px 4px; padding:0 8px; border-radius:8px; color:var(--ink-faint); font-size:12px; font-weight:500; text-decoration:none}
.sn-site:hover{color:var(--ink); background:rgba(232,240,250,.06)}
.sn-site:focus-visible{outline:none; box-shadow:var(--focus-ring)}
.sn-group{margin-top:10px}
:root[data-theme="app"] .sidenav-label{font-size:10.5px; font-weight:600; letter-spacing:.12em; text-transform:uppercase; color:#7F8FA5; padding:10px 12px 6px}
/* one obvious active page: a lighter navy band, white label and a slim RESERVD-blue marker */
:root[data-theme="app"] .sidenav .nav-item{min-height:42px; gap:12px; padding:0 12px; border-radius:10px; font-size:14px; font-weight:500; color:var(--ink-muted); margin-bottom:2px; position:relative}
:root[data-theme="app"] .sidenav .nav-item svg{color:#8496AE}
:root[data-theme="app"] .sidenav .nav-item:hover{background:rgba(232,240,250,.06); color:var(--ink)}
:root[data-theme="app"] .sidenav .nav-item:hover svg{color:var(--ink-muted)}
:root[data-theme="app"] .sidenav .nav-item.active{background:rgba(232,240,250,.12); color:#FFFFFF; font-weight:600; box-shadow:inset 0 1px 0 rgba(255,255,255,.05)}
:root[data-theme="app"] .sidenav .nav-item.active::before{content:""; position:absolute; left:-12px; top:9px; bottom:9px; width:3px; border-radius:0 3px 3px 0; background:#8FB6DE}
:root[data-theme="app"] .sidenav .nav-item.active svg{color:#AFCBEA}
:root[data-theme="app"] .sidenav .nav-item:focus-visible{outline:none; box-shadow:var(--focus-ring)}

/* ---------- page header (workspace) ---------- */
.page-head{min-width:0; display:flex; flex-direction:column; gap:3px}
.page-sub{margin:0; font-size:var(--fs-sm); color:var(--ink-faint); line-height:1.4}
.page-head.is-overview{visibility:hidden}
.head-actions{display:flex; align-items:center; gap:8px}
:root[data-theme="app"] .acct-btn{width:44px; height:44px}
:root[data-theme="app"] .acct-btn .av{box-shadow:0 0 0 2px #FFFFFF, 0 0 0 3px rgba(44,36,28,.12)}
:root[data-theme="app"] .acct-menu{border-radius:16px; padding:8px; width:min(300px, calc(100vw - 24px))}
.acct-id{display:flex; align-items:center; gap:12px; width:100%; padding:8px; border:none; background:none; border-radius:12px; text-align:left; font:inherit; color:var(--ink); cursor:pointer}
.acct-id:hover{background:rgba(44,36,28,.04)}
.acct-id:focus-visible{outline:none; box-shadow:var(--focus-ring)}
.acct-id > svg{margin-left:auto; color:var(--ink-faint); flex-shrink:0}
.acct-id-t{min-width:0; display:flex; flex-direction:column; gap:1px}
.acct-name{font-size:14.5px; font-weight:600; color:var(--ink); white-space:nowrap; overflow:hidden; text-overflow:ellipsis}
.acct-id .acct-user, .acct-id .acct-biz{font-size:12px; color:var(--ink-faint); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; margin:0}
.acct-sep{height:1px; background:var(--line); margin:6px 4px}
:root[data-theme="app"] .acct-menu .menu-item{display:flex; align-items:center; gap:10px; width:100%; min-height:42px; padding:0 10px; margin:2px 0 0; border:none; background:none; border-radius:10px; color:var(--ink); font:inherit; font-size:14px; cursor:pointer; text-decoration:none}
:root[data-theme="app"] .acct-menu .menu-item:hover{background:rgba(44,36,28,.05)}
:root[data-theme="app"] .acct-menu .menu-item svg{color:var(--ink-faint)}
@media (min-width:900px){
  :root[data-theme="app"] .topbar{padding:24px 40px 0; min-height:88px; align-items:center}
  :root[data-theme="app"] .page-title{font-size:28px; font-weight:650; letter-spacing:-.025em; color:var(--ink)}
  :root[data-theme="app"] .acct-menu{top:72px; right:28px}
  :root[data-theme="app"] .head-actions{display:flex !important}
  .pg-h{display:none}
  .mi-header h2, .qt-header h2, .st-header h2, .st-header p{display:none}
  .mi-header{justify-content:flex-end}
  .st-header{padding-bottom:0}
}
/* phones/tablets: the dark business header stays (approved in 7.8) */
@media (max-width:899px){
  :root[data-theme="app"] .topbar{background:rgba(34,49,70,.97); border-bottom:1px solid rgba(214,228,245,.07); -webkit-backdrop-filter:blur(16px) saturate(140%); backdrop-filter:blur(16px) saturate(140%)}
  :root[data-theme="app"] .appbar-biz{color:#F2F6FB}
  :root[data-theme="app"] .appbar-word{color:#93A2B6}
  .page-head{display:none}
  .pg-h h2{margin:0 0 14px; font-size:24px; font-weight:600; letter-spacing:-.02em; color:var(--ink)}
}

/* ---------- bottom navigation (dark, compact) ---------- */
:root[data-theme="app"] .bottomnav{background:rgba(34,49,70,.97); border-top:1px solid rgba(214,228,245,.07); -webkit-backdrop-filter:blur(16px); backdrop-filter:blur(16px)}
:root[data-theme="app"] .bottomnav button{color:#93A2B6; font-size:11px; min-height:calc(var(--bottomnav-h) - 12px)}
:root[data-theme="app"] .bottomnav button.on{color:#FFFFFF}
:root[data-theme="app"] .bottomnav button.on svg{background:rgba(175,200,226,.18); color:#FFFFFF}
:root[data-theme="app"] .bottomnav button:active svg{background:rgba(232,240,250,.09)}
/* Ruby in the bottom bar: her photo is the mobile launcher */
/* PERMANENT: Ruby is the centre tab on every phone (web and native), her own portrait in a purple ring — see docs/DESIGN_SYSTEM.md */
.bn-ruby-ring{display:block; width:34px; height:34px; padding:2px; margin:-3px 0 -1px; border-radius:50%; box-sizing:border-box;
  background:linear-gradient(140deg, #A792FF 0%, #7B61E8 55%, #5A43C4 100%); box-shadow:0 2px 8px -2px rgba(108,82,224,.55)}
.bn-ari{width:30px; height:30px; border-radius:50%; object-fit:cover; display:block; border:1.5px solid #1E1838; box-sizing:border-box}
:root[data-theme="app"] .bottomnav button.bn-ruby > span:last-child{color:#C9BCFF; font-weight:600}
:root[data-theme="app"] .bottomnav button.bn-ruby.on > span:last-child{color:#FFFFFF}
:root[data-theme="app"] .bottomnav button.bn-ruby.on .bn-ruby-ring{background:linear-gradient(140deg, #C4B5FF 0%, #9277FF 55%, #6C52E0 100%);
  box-shadow:0 0 0 3px rgba(146,119,255,.22), 0 3px 12px -2px rgba(124,96,240,.7)}
:root[data-theme="app"] .bottomnav button.bn-ruby:active .bn-ruby-ring{transform:scale(.96)}
:root[data-theme="app"] .bottomnav button.bn-ruby:focus-visible{outline:none; box-shadow:inset 0 0 0 2px #B9A8FF; border-radius:12px}
@media (prefers-reduced-motion: reduce){ :root[data-theme="app"] .bottomnav button.bn-ruby:active .bn-ruby-ring{transform:none} }
body.kb-open .bottomnav, body.voice-open .bottomnav{display:none}
/* Phase 9.3 — native apps: js/native.js marks the body while the system keyboard is up (Keyboard plugin) */
body[data-native-kb] .bottomnav{display:none}

/* ---------- More sheet (phones) ---------- */
.more-backdrop .sheet{max-width:560px}
.more-me{display:flex; align-items:center; gap:14px; width:100%; padding:14px; margin:0 0 14px; border-radius:16px; color:var(--ink); font:inherit; text-align:left; cursor:pointer}
.more-me > span:not(.av){flex:1; min-width:0; display:flex; flex-direction:column; gap:2px}
.more-me b{font-size:16px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis}
.more-me small{font-size:12.5px; color:var(--ink-faint); overflow-wrap:anywhere}
.more-me .more-biz{color:var(--ink-muted)}
.more-group{border:1px solid var(--line); border-radius:16px; overflow:hidden; margin-bottom:12px; background:#FFFFFF}
.more-row{display:flex; align-items:center; gap:14px; width:100%; min-height:56px; padding:10px 14px; border:none; border-top:1px solid var(--line); background:none; color:var(--ink); font:inherit; text-align:left; cursor:pointer; text-decoration:none}
.more-row:first-child{border-top:none}
.more-row:active{background:var(--surface-2)}
.more-row > svg:last-child{color:var(--ink-faint); margin-left:auto}
.more-ic{width:36px; height:36px; border-radius:10px; display:flex; align-items:center; justify-content:center; background:var(--accent-soft); color:var(--accent); flex-shrink:0}
.more-t{display:flex; flex-direction:column; min-width:0}
.more-t b{font-size:15px; font-weight:600}
.more-t small{font-size:12.5px; color:var(--ink-faint)}
.more-plain{min-height:50px}
.more-plain > svg{color:var(--ink-faint)}

/* ---------- Ruby launcher (desktop): photo + "Ask Ruby", quiet navy pill ---------- */
.ask-orb{position:fixed; right:28px; bottom:28px; z-index:45; display:none; align-items:center; gap:10px; min-height:52px; padding:0 20px 0 6px; border-radius:999px; cursor:pointer;
  border:1px solid rgba(214,228,245,.12); color:#FFFFFF; font:inherit; font-size:14.5px; font-weight:600; letter-spacing:-.005em;
  background:linear-gradient(180deg, #33476A, #223146); box-shadow:0 18px 38px -16px rgba(20,30,46,.55), 0 2px 6px rgba(12,24,42,.18);
  transition:transform var(--t-fast) ease, box-shadow var(--t-med) ease}
.ask-orb:hover{transform:translateY(-1px); box-shadow:0 22px 44px -16px rgba(12,24,42,.65)}
.ask-orb:focus-visible{outline:none; box-shadow:0 0 0 2px #F4F1EB, 0 0 0 4px #2C5C86}
.ask-orb-av{position:relative; width:40px; height:40px; flex-shrink:0}
.ask-orb-av img{width:40px; height:40px; border-radius:50%; object-fit:cover; display:block; box-shadow:0 0 0 2px rgba(255,255,255,.9)}
.ask-orb-av::after{content:""; position:absolute; right:0; bottom:1px; width:10px; height:10px; border-radius:50%; background:#3FBF85; box-shadow:0 0 0 2px #223146}
.ask-orb[hidden]{display:none !important}
@media (min-width:900px){ :root[data-theme="app"] .ask-orb{display:inline-flex} body.ask-panel-open .ask-orb{display:none !important} }

/* ---------- profile (Settings → Profile) ---------- */
.pf-card{display:flex; align-items:center; gap:16px; padding:16px; border-radius:16px; margin:4px 0 6px}
.pf-id{display:flex; flex-direction:column; min-width:0}
.pf-id b{font-size:17px; color:var(--ink)}
.pf-id span{font-size:13px; color:var(--ink-faint); overflow-wrap:anywhere}
.pf-actions{display:flex; flex-wrap:wrap; gap:10px; align-items:center; margin-top:12px}
.pf-actions .btn{width:auto; margin:0; min-height:44px; padding:10px 16px; display:inline-flex; align-items:center; cursor:pointer}
.pf-actions [hidden]{display:none !important}
.pf-crop:not(:empty){margin-top:14px; padding:14px; border-radius:16px; border:1px solid var(--line); background:var(--surface-2)}
.pf-presets{display:grid; grid-template-columns:repeat(auto-fill, minmax(76px, 1fr)); gap:10px; margin-top:16px}
.pf-preset{display:flex; flex-direction:column; align-items:center; gap:6px; padding:10px 4px 8px; border-radius:14px; border:1px solid var(--line); background:#FFFFFF; color:var(--ink-muted); font:inherit; font-size:12px; cursor:pointer; min-height:44px;
  transition:border-color var(--t-fast) ease, background-color var(--t-fast) ease}
.pf-preset .av-svg{width:52px; height:52px; border-radius:50%; box-shadow:0 0 0 1px rgba(44,36,28,.1)}
.pf-preset:hover{border-color:var(--line-strong); color:var(--ink)}
.pf-preset.on{border-color:var(--accent); background:var(--accent-soft); color:var(--ink); box-shadow:0 0 0 1px var(--accent)}
.pf-preset:focus-visible{outline:none; box-shadow:var(--focus-ring)}
.pf-lock{display:inline-flex; vertical-align:-2px; color:var(--ink-faint); margin-left:4px}

/* crop editor (shared with Admin — js/admin-avatar-crop.js) */
.pf-crop .adm-crop{display:grid; grid-template-columns:minmax(0, 260px) minmax(0, 1fr); gap:12px 16px; align-items:start}
.pf-crop .adm-crop-stage{position:relative; width:100%; aspect-ratio:1 / 1; overflow:hidden; border-radius:14px; background:#0F1C2E; touch-action:none; cursor:grab; user-select:none; -webkit-user-select:none; border:1px solid var(--line)}
.pf-crop .adm-crop-stage.is-dragging{cursor:grabbing}
.pf-crop .adm-crop-stage:focus-visible{outline:none; box-shadow:var(--focus-ring)}
.pf-crop .adm-crop-stage canvas{position:absolute; inset:0; width:100%; height:100%; pointer-events:none}
.pf-crop .adm-crop-ring{position:absolute; inset:0; border-radius:50%; box-shadow:0 0 0 999px rgba(20,16,13,.6); outline:2px solid rgba(255,255,255,.9); outline-offset:-2px; pointer-events:none}
.pf-crop .adm-crop-side{display:grid; justify-items:start; gap:8px}
.pf-crop .adm-crop-label{font-size:11px; font-weight:700; letter-spacing:.06em; text-transform:uppercase; color:var(--ink-faint)}
.pf-crop .adm-crop-preview{width:64px; height:64px; border-radius:50%; background:#E9E4DC; box-shadow:inset 0 0 0 1px rgba(44,36,28,.12)}
.pf-crop .adm-crop-side small{color:var(--ink-faint); font-size:12px; line-height:1.45}
.pf-crop .adm-crop-zoom{grid-column:1 / -1; display:flex; align-items:center; gap:10px}
.pf-crop .adm-crop-zoom input[type=range]{flex:1; padding:0; border:0; background:none; box-shadow:none; accent-color:#2C5C86; height:30px; min-height:0}
.pf-crop .adm-crop-actions{grid-column:1 / -1; display:flex; gap:8px; align-items:center}
.pf-crop .adm-crop-actions > span{flex:1}
.pf-crop .adm-btn{display:inline-flex; align-items:center; justify-content:center; min-height:44px; min-width:44px; padding:0 14px; border-radius:10px; border:1px solid var(--line-strong); background:#FFFFFF; color:var(--ink); font:inherit; font-size:13px; font-weight:600; cursor:pointer}
.pf-crop .adm-btn:hover{background:var(--surface-2)}
.pf-crop .adm-btn.is-primary{background:var(--accent-strong); border-color:transparent; color:#fff}
.pf-crop .adm-btn.is-primary:hover{background:var(--accent-hover)}
@media (max-width:599px){
  .pf-crop .adm-crop{grid-template-columns:minmax(0, 1fr)}
  .pf-crop .adm-crop-stage{max-width:300px; justify-self:center}
  .pf-crop .adm-crop-side{grid-template-columns:auto 1fr; align-items:center}
  .pf-crop .adm-crop-side .adm-crop-label{display:none}
}

/* Phase 9.1A — offline notice (js/app.js paintNetBanner) */
.net-banner{position:fixed; z-index:90; left:50%; transform:translateX(-50%); top:calc(8px + env(safe-area-inset-top)); max-width:calc(100vw - 32px); padding:10px 16px; border-radius:10px; background:#223146; color:#fff; font-size:14px; line-height:1.4; box-shadow:0 6px 20px rgba(0,0,0,.18); text-align:center}
/* Phase 9.3: figures couldn't be refreshed — say when they were loaded, offer a retry */
.net-banner.is-stale{background:#5A3E10}
/* phones: below the dark business header instead of on top of it (Phase 9.3 — seen in the native apps) */
@media (max-width:899px){ .net-banner{top:calc(env(safe-area-inset-top) + 72px)} }
.net-retry{margin-left:8px; padding:4px 10px; min-height:32px; border-radius:8px; border:1px solid rgba(255,255,255,.4); background:transparent; color:#fff; font:inherit; font-weight:600; cursor:pointer}
