:root {
  color-scheme: dark;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --bg: #0b0b0d;
  --surface: #171719;
  --surface-raised: #222226;
  --surface-inset: #111113;
  --ink: #f1f1f3;
  --muted: #b2b2ba;
  --subtle: #85858f;
  --line: #36363d;
  --orange: #f17d45;
  --orange-soft: #382419;
  --radius: 18px;
  --rail-width: 248px;
  --safe-top: env(safe-area-inset-top, 0px);
  --mobile-header: calc(64px + var(--safe-top));
  --mobile-nav: 68px;
}

* { box-sizing: border-box; }
html { min-width: 320px; min-height: 100%; background: var(--bg); scroll-behavior: smooth; }
body { min-width: 320px; min-height: 100vh; margin: 0; overflow-x: hidden; background: var(--bg); color: var(--ink); line-height: 1.5; }
a { color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a:focus-visible { outline: 3px solid #ffb080; outline-offset: 3px; }
h1, h2, p { margin: 0; }
button { cursor: pointer; color: inherit; font: inherit; border: 0; background: transparent; }
[hidden] { display: none !important; }
.skip-link { position: fixed; z-index: 10; top: -100px; left: 12px; padding: 12px 16px; border-radius: 8px; background: var(--surface); color: var(--ink); }
.skip-link:focus { top: 12px; }
.desktop-rail { display: none; }
.app-frame { min-width: 0; }
.topbar { position: sticky; z-index: 4; top: 0; display: flex; height: var(--mobile-header); align-items: center; justify-content: space-between; gap: 12px; padding: var(--safe-top) 20px 0; border-bottom: 1px solid var(--line); background: #111113f5; backdrop-filter: blur(16px); }
.brand { display: inline-flex; min-height: 44px; align-items: center; gap: 10px; color: var(--ink); font-size: 18px; font-weight: 730; letter-spacing: -.45px; text-decoration: none; }
.brand-mark { display: grid; width: 34px; height: 34px; place-items: center; border: 1px solid #8e5938; border-radius: 10px; background: #33251d; color: #ffab78; font-size: 12px; font-style: italic; font-weight: 850; letter-spacing: -1px; }
.topbar-context { color: var(--muted); font-size: 12px; }
main { width: min(100%, 760px); min-height: calc(100dvh - var(--mobile-header)); margin: 0 auto; padding: 28px 20px calc(var(--mobile-nav) + env(safe-area-inset-bottom) + 30px); }
.page-heading { display: flex; min-height: 72px; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.eyebrow, .rail-label { color: var(--subtle); font-size: 10px; font-weight: 700; letter-spacing: 1.5px; }
.eyebrow { margin-bottom: 6px; }
h1 { font-size: clamp(27px, 7vw, 34px); font-weight: 650; letter-spacing: -1.15px; line-height: 1.15; }
.page-content { min-width: 0; }
.shell-card { display: grid; min-height: 256px; align-content: center; justify-items: start; gap: 14px; padding: 28px 24px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.shell-mark { display: grid; width: 48px; height: 48px; place-items: center; border: 1px solid #45454c; border-radius: 15px; background: #242428; color: var(--orange); }
.shell-mark svg, .nav-icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.7; }
.shell-card h2 { font-size: 19px; font-weight: 620; letter-spacing: -.35px; }
.shell-card p { max-width: 42ch; color: var(--muted); font-size: 14px; line-height: 1.65; }
.build-note { margin: 18px 2px 0; color: var(--subtle); font-size: 11px; }
.bottom-nav { position: fixed; z-index: 5; right: 0; bottom: 0; left: 0; display: grid; min-height: calc(var(--mobile-nav) + env(safe-area-inset-bottom)); grid-template-columns: repeat(var(--nav-count, 4), minmax(0, 1fr)); padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: #111113f7; backdrop-filter: blur(16px); }
.nav-link { position: relative; display: flex; min-width: 0; min-height: 54px; flex-direction: column; align-items: center; justify-content: center; gap: 3px; border-radius: 11px; color: var(--muted); font-size: 10px; font-weight: 550; text-decoration: none; }
.bottom-nav .nav-link { min-height: 54px; }
.bottom-nav button.nav-link { padding: 0 2px; }
.nav-link[aria-current="page"] { color: #ffab78; font-weight: 680; }
.nav-link[aria-current="page"]::before { position: absolute; z-index: -1; top: 3px; width: 44px; height: 27px; border-radius: 9px; background: var(--orange-soft); content: ""; }
.nav-icon { display: grid; width: 24px; height: 24px; place-items: center; }
.nav-label { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.more-destinations-dialog { position: fixed; inset: auto 12px calc(var(--mobile-nav) + env(safe-area-inset-bottom) + 12px); width: min(460px, calc(100% - 24px)); max-height: min(72dvh, 620px); margin: 0 auto; overflow: auto; padding: 18px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); color: var(--ink); box-shadow: 0 18px 60px #0009; }
.more-destinations-dialog::backdrop { background: #0009; }
.more-destinations-dialog h2 { margin: 0 0 12px; font-size: 18px; font-weight: 650; }
.more-destinations-list { display: grid; gap: 5px; }
.more-destination-link { min-height: 48px; flex-direction: row; justify-content: flex-start; gap: 12px; padding: 0 12px; border: 1px solid transparent; font-size: 14px; }
.more-destination-link[aria-current="page"] { border-color: #67432e; background: var(--orange-soft); }
.more-destination-link .nav-label { overflow: visible; }
.shell-route-loading, .shell-style-warning { margin: 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--muted); }
.shell-route-retry { min-height: 44px; padding: 0 12px; border: 1px solid #725137; border-radius: 8px; color: var(--ink); font-weight: 650; }
.shell-route-retry:focus-visible, .more-nav-trigger:focus-visible, .more-destination-link:focus-visible { outline: 3px solid #ffb080; outline-offset: 2px; }
.desktop-nav { display: none; }
.topbar-account { display: flex; align-items: center; gap: 16px; }
.account-label { max-width: 28ch; overflow: hidden; color: var(--muted); font-size: 12px; text-decoration: none; text-overflow: ellipsis; white-space: nowrap; }
.sign-out-button { min-height: 44px; padding: 0 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--ink); font-size: 12px; font-weight: 600; }
.sign-out-button:hover { background: var(--surface-raised); }
.sign-out-button:focus-visible, .auth-button:focus-visible, .auth-switch:focus-visible, .auth-retry:focus-visible { outline: 3px solid #ffb080; outline-offset: 3px; }
.auth-shell { width: min(100%, 480px); margin: 8px auto 0; }
.auth-intro { margin: 0 0 22px; }
.auth-intro .eyebrow { margin-bottom: 8px; }
.auth-intro h1 { margin-bottom: 10px; }
.auth-intro p:last-child { color: var(--muted); font-size: 14px; }
.auth-card { padding: 22px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: 0 12px 32px #00000012; }
.auth-card h2 { margin: 0 0 16px; font-size: 18px; font-weight: 630; letter-spacing: -.3px; }
.auth-form { display: grid; gap: 14px; }
.auth-field { display: grid; gap: 7px; color: var(--muted); font-size: 12px; font-weight: 550; }
.auth-field input { width: 100%; min-height: 48px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-inset); color: var(--ink); font: inherit; font-size: 16px; }
.auth-field input::placeholder { color: var(--subtle); opacity: 1; }
.auth-field input:focus-visible { outline: 3px solid #ffb080; outline-offset: 2px; }
.auth-button { display: flex; min-height: 48px; align-items: center; justify-content: center; padding: 0 18px; border: 1px solid var(--orange); border-radius: 10px; background: var(--orange); color: #111113; font-size: 14px; font-weight: 700; }
.auth-button:hover:not(:disabled) { background: #ff925a; }
.auth-button:disabled { cursor: wait; opacity: .65; }
.auth-switch-row { display: flex; min-height: 44px; align-items: center; justify-content: center; gap: 6px; margin-top: 14px; color: var(--muted); font-size: 12px; }
.auth-switch { min-height: 44px; padding: 0 5px; border: 0; background: transparent; color: #ffab78; font-size: 12px; font-weight: 650; text-decoration: underline; text-underline-offset: 3px; }
.auth-feedback, .auth-session-notice, .approval-panel { margin: 0 0 14px; padding: 12px 14px; border: 1px solid #62432e; border-radius: 10px; background: #37271f; color: #f0b78f; font-size: 13px; line-height: 1.5; }
.auth-feedback[data-tone="info"], .auth-session-notice { border-color: #45454c; background: #30251f; color: #ffc49c; }
.auth-feedback[data-tone="approval"], .approval-panel { border-color: #6b4a2e; background: #30261e; color: #f2c294; }
.auth-feedback[data-tone="success"] { border-color: #45644d; background: #202b23; color: #b9e2c0; }
.auth-feedback:focus { outline: 2px solid #ffb080; outline-offset: 3px; }
.approval-panel h2 { margin-bottom: 8px; }
.approval-panel p { color: inherit; font-size: 13px; line-height: 1.6; }
.approval-panel a { color: #ffbd8c; }
.auth-retry { min-height: 44px; margin-top: 10px; padding: 0 12px; border: 1px solid #625047; border-radius: 8px; background: #28282d; color: var(--ink); font-size: 12px; font-weight: 650; }
.auth-checking { min-height: 184px; align-content: center; }
body[data-v2-state="checking"] .desktop-rail,
body[data-v2-state="checking"] .bottom-nav,
body[data-v2-state="anonymous"] .desktop-rail,
body[data-v2-state="anonymous"] .bottom-nav,
body[data-v2-state="checking"] .page-heading,
body[data-v2-state="anonymous"] .page-heading,
body[data-v2-state="checking"] .build-note,
body[data-v2-state="anonymous"] .build-note { display: none; }
body[data-v2-state="checking"] .topbar-account,
body[data-v2-state="anonymous"] .topbar-account { display: none; }
body[data-v2-state="checking"] .app-frame,
body[data-v2-state="anonymous"] .app-frame { margin-left: 0; }
body[data-v2-state="checking"] .mobile-brand,
body[data-v2-state="anonymous"] .mobile-brand { display: inline-flex; }
body[data-v2-state="checking"] .topbar-context,
body[data-v2-state="anonymous"] .topbar-context { margin-left: auto; }
body[data-v2-state="checking"] main,
body[data-v2-state="anonymous"] main { width: min(100%, 560px); min-height: calc(100dvh - var(--mobile-header)); padding-bottom: max(28px, env(safe-area-inset-bottom)); }
body[data-v2-state="authenticated"] .auth-shell { display: none; }
body[data-v2-state="guest-share"] .app-frame { margin-left: 0; }
body[data-v2-state="guest-share"] .topbar-account { display: none; }
body[data-v2-state="guest-share"] .mobile-brand { display: inline-flex; }
body[data-v2-state="guest-share"] main { width: min(100%, 760px); padding-bottom: max(28px, env(safe-area-inset-bottom)); }

@media (max-width: 374px) {
  .topbar { padding-right: 14px; padding-left: 14px; }
  main { padding-right: 14px; padding-left: 14px; }
  .bottom-nav { padding-right: 4px; padding-left: 4px; }
  .nav-link { font-size: 9px; }
  .more-destinations-dialog { right: 8px; left: 8px; width: auto; padding: 14px; }
  .shell-card { min-height: 232px; padding: 22px 18px; }
  .auth-card { padding: 18px; }
  .topbar-context { font-size: 11px; }
}

@media (max-width: 599px) {
  :root { --mobile-header: calc(52px + var(--safe-top)); }
  .topbar { gap: 8px; padding-right: 12px; padding-left: 12px; }
  .brand { gap: 8px; font-size: 16px; }
  .brand-mark { width: 30px; height: 30px; }
  body[data-v2-state="authenticated"] main { padding: 8px 12px calc(var(--mobile-nav) + env(safe-area-inset-bottom) + 18px); }
  .page-heading { min-height: 28px; align-items: center; margin: 0 0 10px; }
  .page-heading .eyebrow { display: none; }
  h1 { font-size: 23px; letter-spacing: -.6px; }
  .topbar-account { gap: 0; }
  .account-label { width: 44px; height: 44px; }
  .sign-out-button { min-height: 44px; }
}

@media (max-width: 1023px) {
  body[data-v2-state="authenticated"] .topbar-context { display: none; }
  body[data-v2-state="authenticated"] .account-label { display: grid; width: 44px; max-width: none; height: 44px; flex: 0 0 44px; place-items: center; border: 1px solid var(--line); border-radius: 50%; background: var(--surface-raised); color: var(--ink); font-size: 0; }
  body[data-v2-state="authenticated"] .account-label::after { content: attr(data-initial); font-size: 14px; font-weight: 700; line-height: 1; }
  .topbar-account { gap: 4px; }
  .topbar-account .shell-admin-shortcut { display: none; }
}

@media (min-width: 600px) and (max-width: 1023px) {
  main { padding-top: 36px; }
  .page-heading { margin-bottom: 28px; }
  .shell-card { min-height: 290px; padding: 36px; }
  .bottom-nav { right: auto; left: 50%; width: min(100%, 760px); transform: translateX(-50%); border-right: 1px solid var(--line); border-left: 1px solid var(--line); }
}

@media (min-width: 1024px) {
  .desktop-rail { position: fixed; z-index: 6; inset: 0 auto 0 0; display: flex; width: var(--rail-width); flex-direction: column; padding: 24px 18px 20px; border-right: 1px solid #28282d; background: #0b0b0d; }
  .desktop-rail .brand { margin: 0 10px 42px; }
  .rail-label { padding: 0 12px; }
  .desktop-nav { display: grid; gap: 6px; margin-top: 12px; }
  .desktop-nav .nav-link { min-height: 48px; flex-direction: row; justify-content: flex-start; gap: 12px; padding: 0 12px; border-radius: 10px; font-size: 13px; }
  .desktop-nav .nav-link[aria-current="page"] { background: #242428; color: var(--ink); }
  .desktop-nav .nav-link[aria-current="page"]::before { display: none; }
  .desktop-nav .nav-link[aria-current="page"] .nav-icon { color: var(--orange); }
  .rail-note { margin: auto 10px 0; color: var(--subtle); font-size: 11px; }
  .app-frame { min-height: 100vh; margin-left: var(--rail-width); }
  .topbar { height: 70px; padding: 0 36px; }
  .mobile-brand { display: none; }
  main { width: min(100%, 1120px); min-height: calc(100vh - 70px); padding: 42px 36px 48px; }
  .page-heading { min-height: 72px; margin-bottom: 28px; }
  .shell-card { min-height: 320px; padding: 42px; }
  .build-note { margin-top: 20px; }
  .bottom-nav { display: none; }
  .account-label { max-width: 34ch; }
  body[data-v2-state="checking"] main,
  body[data-v2-state="anonymous"] main { min-height: calc(100vh - 70px); padding-top: 54px; }
  body[data-v2-state="checking"] .topbar,
  body[data-v2-state="anonymous"] .topbar { height: 70px; }
  body[data-v2-state="authenticated"] .mobile-brand { display: none; }
  body[data-v2-state="authenticated"] .topbar-account { display: flex; }
  body[data-v2-state="guest-share"] .topbar { height: 70px; }
  body[data-v2-state="guest-share"] main { width: min(100%, 1120px); min-height: calc(100vh - 70px); padding: 42px 36px 48px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; }
}

/* Post-launch shared shell: view-specific styles stay with each view. */
.shell-admin-shortcut { display: inline-flex; align-items: center; min-height: 44px; padding: 0 8px; color: var(--orange); font-size: 12px; font-weight: 650; text-decoration: none; }
@media (max-width: 1023px) {
  body[data-v2-state="authenticated"] main { padding-left: 16px; padding-right: 16px; }
  .topbar { padding-left: 16px; padding-right: 16px; }
  .topbar-account .sign-out-button { padding: 0 8px; }
}
@media (min-width: 1024px) {
  body[data-v2-state="authenticated"] main { width: min(100%, 1200px); padding-left: 28px; padding-right: 28px; }
}

@media (max-width: 374px) {
  body[data-v2-state="authenticated"] .mobile-brand > span:last-child { display: none; }
}
/* Shared status treatment for optional session capabilities. */
.feature-status { display: grid; gap: 4px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-inset); color: var(--muted); font-size: 12px; line-height: 1.45; }
.feature-status strong { color: var(--ink); font-size: 11px; font-weight: 700; text-transform: capitalize; }
.feature-status--pending { border-color: #66513a; }
.feature-status--pending strong { color: #ffd09b; }
.feature-status--notice { border-color: #574936; }
.feature-status--notice strong { color: #f2c99c; }
.feature-status--error { border-color: #704039; }
.feature-status--error strong { color: #ffaaa1; }
.feature-status--compact { display: block; padding: 7px 9px; font-size: 11px; }
.feature-status--compact strong { margin-right: 6px; }
.feature-status-elapsed { color: var(--subtle); font-size: 10px; font-variant-numeric: tabular-nums; }
