/* ═══════════════════════════════════════════════════════════════════════════
 * VØLT app shell — 2026-09-22 sprint. Loaded LAST so it is authoritative over
 * the legacy blocks it harmonises. Dark/gold is the product; the half-built
 * light scheme (survey-only rules that leaked white inputs/modals and a cream
 * body under the dark app) is retired.
 * ═══════════════════════════════════════════════════════════════════════════ */
:root { color-scheme: dark; }
html, body { background: var(--dark, #060608); }

/* ── Header: back chevron on drill-downs + avatar (replaces the Logout button) ── */
#app .topbar { gap: .5rem; }
.topbar-lead { display: flex; align-items: center; gap: .35rem; min-width: 0; }
.topbar-back {
  width: 40px; height: 40px; margin-left: -8px; border-radius: 12px;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: 0; color: var(--light, #f3f4fa); cursor: pointer;
  transition: background .2s var(--vos-ease, ease), transform .14s var(--vos-ease, ease);
}
.topbar-back[hidden] { display: none; }
.topbar-back:hover { background: rgba(255,255,255,.06); }
.topbar-back:active { transform: scale(.92); }
.topbar-back svg { width: 22px; height: 22px; }
.topbar-avatar {
  width: 38px; height: 38px; flex: 0 0 38px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: radial-gradient(120% 120% at 30% 20%, rgba(var(--gold-rgb, 240,178,74), .28), rgba(255,255,255,.04));
  border: 1px solid rgba(var(--gold-rgb, 240,178,74), .55);
  color: var(--gold, #f0b24a); font: 700 .8rem/1 var(--font-cond, inherit); letter-spacing: .04em;
  cursor: pointer; transition: transform .14s var(--vos-ease, ease), box-shadow .2s var(--vos-ease, ease);
}
.topbar-avatar:hover { box-shadow: 0 0 0 4px rgba(var(--gold-rgb, 240,178,74), .12); }
.topbar-avatar:active { transform: scale(.94); }

/* ── Account card (sign-out lives here now) ── */
.volt-account-card { margin-top: 1.25rem; }
.volt-account-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.volt-account-email { color: var(--muted, #a7adc4); font-size: .88rem; word-break: break-all; }
.volt-signout {
  min-height: 44px; padding: 0 1.1rem; border-radius: 12px; cursor: pointer;
  background: transparent; color: var(--red, #ff6b6b); border: 1px solid color-mix(in oklab, var(--red, #ff6b6b) 55%, transparent);
  font: 600 .85rem/1 var(--font-cond, inherit); letter-spacing: .05em; text-transform: uppercase;
}
.volt-signout:hover { background: color-mix(in oklab, var(--red, #ff6b6b) 10%, transparent); }

/* ── Coach broadcast on the client Today screen ── */
.volt-broadcast {
  display: flex; gap: .85rem; align-items: flex-start; margin: 0 0 1rem;
  padding: 1rem 1rem 1rem 1.1rem; border-radius: 16px;
  background: linear-gradient(135deg, rgba(var(--gold-rgb, 240,178,74), .14), rgba(255,255,255,.03));
  border: 1px solid rgba(var(--gold-rgb, 240,178,74), .35);
  animation: voltBcIn .34s var(--vos-ease, ease) both;
}
.volt-broadcast-emoji { font-size: 1.5rem; line-height: 1; padding-top: .1rem; }
.volt-broadcast-body { flex: 1; min-width: 0; }
.volt-broadcast-from { font: 700 .68rem/1 var(--font-cond, inherit); letter-spacing: .14em; text-transform: uppercase; color: var(--gold, #f0b24a); margin-bottom: .35rem; }
.volt-broadcast-msg { color: var(--light, #f3f4fa); font-size: .95rem; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.volt-broadcast-x { width: 36px; height: 36px; margin: -.4rem -.4rem 0 0; border: 0; background: transparent; color: var(--muted, #a7adc4); font-size: 1rem; cursor: pointer; border-radius: 10px; }
.volt-broadcast-x:hover { background: rgba(255,255,255,.06); color: var(--light, #f3f4fa); }
@keyframes voltBcIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* ── The storm is the onboarding moment, not a daily-use backdrop ──
   Inside the app it painted bolts over cards and text and burned battery. */
body.volt-in-app #volt-lightning { display: none !important; }

/* ── Never cover the tab bar ── */
@media (max-width: 680px) {
  body.volt-in-app #volt-ios-a2hs { bottom: calc(82px + env(safe-area-inset-bottom)) !important; }
  /* Quick-log ⚡ FAB owns the thumb spot (5.5rem); the AI coach FAB stacks above it. */
  body.volt-in-app .volt-chat-fab { bottom: calc(5.5rem + 64px + env(safe-area-inset-bottom)) !important; }
  body.volt-in-app #mainContent { padding-bottom: calc(96px + env(safe-area-inset-bottom)) !important; }
}

/* ── Accessible, visible focus everywhere (keyboard only) ── */
:where(button, [role="button"], a, input, select, textarea, summary, .nav-tab, .mob-nav-btn):focus-visible {
  outline: 2px solid var(--gold, #f0b24a) !important; outline-offset: 2px !important;
}

/* ── Tap-target floor on touch devices ── */
@media (pointer: coarse) {
  .mob-nav-btn { min-height: 48px; }
  #app .btn, #app .btn-sm, #app .topbar-icon-btn { min-height: 40px; }
}

/* ── Drill-down entrance (tabs keep the VØLT OS fade) ── */
@media (prefers-reduced-motion: no-preference) {
  body.volt-in-view #mainContent.vos-screen-in { animation-name: voltPushIn; }
  @keyframes voltPushIn { from { opacity: 0; transform: translateX(14px); } to { opacity: 1; transform: none; } }
}

/* ── Chat: pending state + timestamps ── */
.volt-chat-msg .volt-msg-meta { display: block; margin-top: .3rem; font-size: .68rem; letter-spacing: .04em; opacity: .55; }
.volt-chat-send[disabled], #voltChatInput[disabled] { opacity: .55; cursor: progress; }

/* ── AI coach FAB: compact on phones, out of the way of composers ── */
body.volt-on-messages .volt-chat-fab, body.volt-on-messages #fabBtn { display: none !important; }
@media (max-width: 680px) {
  body.volt-in-app .volt-chat-fab {
    width: 48px; height: 48px; padding: 0; border-radius: 50%; justify-content: center;
    right: 20px; background: var(--dark3, #14151f); color: var(--gold, #f0b24a);
    border: 1px solid rgba(var(--gold-rgb, 240,178,74), .5); box-shadow: 0 6px 22px rgba(0,0,0,.45);
  }
  body.volt-in-app .volt-chat-fab .fab-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}

/* ── Horizontal chip scrollers: chips keep their width and scroll, never clip
   ("EAKFA" / "UNCH" on Recipes — flex items were shrinking below their text). */
[style*="display:flex"][style*="overflow-x:auto"] > .btn { flex: 0 0 auto; }
[style*="display:flex"][style*="overflow-x:auto"] { scrollbar-width: none; -webkit-overflow-scrolling: touch; }
[style*="display:flex"][style*="overflow-x:auto"]::-webkit-scrollbar { display: none; }

/* ── More sheet ── */
.volt-sheet-wrap { position: fixed; inset: 0; z-index: 9500; pointer-events: none; }
.volt-sheet-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.55); opacity: 0; transition: opacity .24s var(--vos-ease, ease); }
.volt-sheet {
  position: absolute; left: 0; right: 0; bottom: 0; max-width: 560px; margin: 0 auto;
  background: var(--dark2, #0d0e16); border: 1px solid rgba(255,255,255,.08); border-bottom: 0;
  border-radius: 22px 22px 0 0; padding: 10px 16px calc(18px + env(safe-area-inset-bottom));
  box-shadow: 0 -18px 48px rgba(0,0,0,.5);
  transform: translateY(104%); transition: transform .34s var(--vos-ease, cubic-bezier(.2,.8,.2,1));
}
.volt-sheet-wrap.open { pointer-events: auto; }
.volt-sheet-wrap.open .volt-sheet-backdrop { opacity: 1; }
.volt-sheet-wrap.open .volt-sheet { transform: none; }
.volt-sheet-grip { width: 40px; height: 4px; border-radius: 4px; background: rgba(255,255,255,.18); margin: 0 auto 12px; }
.volt-sheet-title { font: 700 .72rem/1 var(--font-cond, inherit); letter-spacing: .16em; text-transform: uppercase; color: var(--muted, #a7adc4); margin: 0 4px 12px; }
.volt-sheet-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.volt-sheet-item {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  min-height: 84px; padding: 12px 6px; border-radius: 16px; cursor: pointer;
  background: rgba(255,255,255,.035); border: 1px solid rgba(255,255,255,.07); color: var(--light, #f3f4fa);
  font: 600 .78rem/1.15 var(--font-cond, inherit); letter-spacing: .04em; text-align: center;
  transition: background .18s var(--vos-ease, ease), transform .12s var(--vos-ease, ease), border-color .18s;
}
.volt-sheet-item:hover { background: rgba(var(--gold-rgb, 240,178,74), .08); border-color: rgba(var(--gold-rgb, 240,178,74), .35); }
.volt-sheet-item:active { transform: scale(.96); }
.volt-sheet-ico { color: var(--gold, #f0b24a); display: inline-flex; }
.volt-sheet-ico svg { width: 24px; height: 24px; stroke-width: 1.75; }
body.volt-sheet-open { overflow: hidden; }
@media (prefers-reduced-motion: reduce) { .volt-sheet, .volt-sheet-backdrop { transition: none; } }

/* The install hint must never sit above sheets, the chat drawer or modals. */
body.volt-in-app #volt-ios-a2hs { z-index: 7000 !important; }
body.volt-sheet-open #volt-ios-a2hs { display: none !important; }
