:root {
  --color-background: #030712;
  --color-surface: #091426;
  --color-surface-elevated: #0D1A2E;
  --color-primary: #168DEB;
  --color-primary-secondary: #465EF2;
  --color-highlight: #38BDF8;
  --color-text: #F8FAFC;
  --color-text-muted: #A8B4C8;
  --color-border: rgba(91, 174, 255, 0.25);
  --color-danger: #FB7185;
  --radius-small: 10px;
  --radius-medium: 16px;
  --radius-large: 22px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;

  /* legacy aliases used by dialogs / shared components */
  --bg: var(--color-background);
  --ink: var(--color-text);
  --muted: var(--color-text-muted);
  --line: var(--color-border);
  --cyan: var(--color-highlight);
  --purple: #c084fc;
  --glass: rgba(9, 20, 38, 0.94);
  --font-display: "Orbitron", "Segoe UI", sans-serif;
  --font-ui: "Outfit", "Segoe UI", sans-serif;
  --tap: 44px;
  --tap-lg: 48px;
  --bottom-nav-h: 0px;
  --top-bar-h: 56px;
  --drawer-w: min(320px, 86vw);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
.hidden { display: none !important; }
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}
input[type="file"].sr-only,
input[type="file"][hidden] {
  display: none !important;
  position: absolute !important;
  left: -9999px !important;
  width: 0 !important;
  height: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
}
.error-text { color: var(--color-danger); font-size: 0.85rem; margin: 0; }

body.fenrir-cinematic {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font-ui);
  color: var(--color-text);
  background: var(--color-background);
  overflow: hidden;
}

body.bg-wolf-galaxy .galaxy-photo {
  background-image: url("/assets/fenrir-galaxy-3d-template.png?v=20260714persist1");
  opacity: 1;
}
body.bg-galaxy-soft .galaxy-photo {
  background-image: url("/assets/galaxy-wolf-template.png?v=20260714persist1");
  opacity: 1;
  filter: saturate(0.95) contrast(1.02);
}
body.bg-deep-space .galaxy-photo {
  background-image: none;
  opacity: 0;
}
body.bg-deep-space .galaxy-scrim {
  background:
    radial-gradient(ellipse at 30% 20%, rgba(22, 141, 235, 0.18), transparent 55%),
    radial-gradient(ellipse at 70% 80%, rgba(70, 94, 242, 0.14), transparent 50%),
    linear-gradient(180deg, #030712 0%, #07111f 100%);
}

/* Appearance: Plain = solid dark, no atmosphere images (owner-approved 2026-07-15) */
body.appearance-plain .galaxy-photo {
  display: none !important;
  opacity: 0 !important;
  background-image: none !important;
  animation: none !important;
}
body.appearance-plain .galaxy-scrim {
  background: #030712 !important;
}
body.appearance-plain {
  background: #030712;
}

.entry-dialog {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-large);
  padding: 0;
  max-width: min(420px, calc(100vw - 32px));
  background: var(--color-surface);
  color: var(--color-text);
}
.entry-dialog::backdrop {
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(10px);
}
.entry-form {
  display: grid;
  gap: var(--space-3);
  padding: var(--space-5);
}
.entry-logo {
  justify-self: center;
  border-radius: 16px;
}
.entry-actions {
  display: grid;
  gap: var(--space-2);
}
.entry-brand {
  margin: 0;
  justify-self: center;
  font-family: var(--font-display);
  font-size: 1.55rem;
  letter-spacing: 0.18em;
  font-weight: 700;
}
.entry-tagline {
  margin: 0;
  justify-self: center;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--color-text);
}
.entry-sub {
  margin: 0;
  text-align: center;
  font-size: 0.88rem;
}
.entry-guest {
  margin-top: 4px;
}
.session-help {
  font-size: 0.82rem;
  line-height: 1.45;
}
body.is-guest .suggestion-chip.signed-in-only,
body:not(.is-signed-in) .suggestion-chip.signed-in-only,
body.is-guest .quick-action-tile.signed-in-only,
body:not(.is-signed-in) .quick-action-tile.signed-in-only {
  display: none !important;
}
.primary-btn {
  appearance: none;
  border: 0;
  border-radius: var(--radius-medium);
  padding: 12px 16px;
  font: inherit;
  font-weight: 600;
  color: #04101f;
  background: linear-gradient(135deg, #7dd3fc, #38bdf8 45%, #0ea5e9);
  cursor: pointer;
}
.primary-btn:hover { filter: brightness(1.05); }
.auth-form {
  display: grid;
  gap: var(--space-3);
}
.password-rules {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.82rem;
  color: var(--color-text-muted);
  display: grid;
  gap: 0.2rem;
}
.password-rules li::before {
  content: "â—‹ ";
}
.password-rules li.met {
  color: #86efac;
}
.password-rules li.met::before {
  content: "âœ“ ";
}
.password-rules li.unmet {
  color: #fecdd3;
}
.policy-check {
  display: flex;
  gap: var(--space-2);
  align-items: flex-start;
  font-size: 0.92rem;
  color: var(--color-text-muted);
}
.policy-check input {
  margin-top: 4px;
}
body.is-guest .signed-in-only { display: none !important; }
.guest-only-banner {
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: var(--radius-medium);
  padding: var(--space-3);
  background: rgba(22, 141, 235, 0.08);
}
.empty-state .empty-prompt {
  font-size: clamp(1.15rem, 3.5vw, 1.45rem);
  font-weight: 600;
  letter-spacing: 0.01em;
}
.error-banner {
  margin: var(--space-3) var(--space-4);
  padding: var(--space-3);
  border-radius: var(--radius-medium);
  border: 1px solid rgba(251, 113, 133, 0.45);
  background: rgba(127, 29, 45, 0.35);
  color: #fecdd3;
}

/* â€”â€” Atmosphere (fixed overlays only; not page chrome) â€”â€” */
.galaxy-photo {
  position: fixed;
  inset: -4%;
  z-index: 0;
  background: url("/assets/fenrir-galaxy-3d-template.png?v=20260714persist1") center / cover no-repeat;
  filter: saturate(1.08) contrast(1.04) brightness(0.92);
  opacity: 1;
  pointer-events: none;
  animation: kenburns 48s ease-in-out infinite alternate;
  will-change: transform;
}
.galaxy-scrim {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    linear-gradient(
      180deg,
      rgba(3, 7, 18, 0.88) 0%,
      rgba(3, 7, 18, 0.7) 32%,
      rgba(3, 7, 18, 0.78) 58%,
      rgba(3, 7, 18, 0.96) 100%
    ),
    radial-gradient(ellipse at 52% 38%, rgba(3, 7, 18, 0.28) 0%, rgba(3, 7, 18, 0.9) 78%);
}
body.thinking-active .galaxy-photo {
  filter: saturate(1.3) contrast(1.08) hue-rotate(18deg);
  transition: filter 0.6s ease;
}
@keyframes kenburns {
  from { transform: scale(1.02) translate3d(0, 0, 0); }
  to { transform: scale(1.08) translate3d(-1.5%, 1%, 0); }
}

/* â€”â€” AppShell: flex column, 100dvh, safe areas â€”â€” */
.app-shell {
  position: relative;
  z-index: 4;
  display: flex;
  flex-direction: column;
  height: var(--app-vv-height, 100dvh);
  max-height: var(--app-vv-height, 100dvh);
  width: 100%;
  overflow: hidden;
}
.safe-area-top {
  flex: 0 0 env(safe-area-inset-top, 0px);
  min-height: env(safe-area-inset-top, 0px);
}
.safe-area-bottom {
  flex: 0 0 env(safe-area-inset-bottom, 0px);
  min-height: env(safe-area-inset-bottom, 0px);
}

.top-app-bar {
  position: relative;
  z-index: 10;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  min-height: var(--top-bar-h);
  padding: var(--space-2) var(--space-4);
  background: rgba(9, 20, 38, 0.92);
  border-bottom: 1px solid var(--color-border);
  backdrop-filter: blur(16px);
}
.brand-lockup {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
}
.brand-logo {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  border: 1px solid var(--color-border);
  object-fit: cover;
  background: linear-gradient(145deg, var(--color-primary), var(--color-primary-secondary));
  box-shadow: 0 0 20px rgba(22, 141, 235, 0.35);
}
.brand-text {
  min-width: 0;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}
.brand-title,
.active-chat-title {
  display: block;
  font-family: var(--font-display);
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: min(52vw, 16rem);
}
.brand-chat-meta {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  color: var(--color-muted, rgba(226, 232, 240, 0.72));
}
.brand-product-label {
  font-family: var(--font-display);
  letter-spacing: 0.16em;
  font-weight: 600;
  text-transform: uppercase;
}
.hamburger-btn {
  flex: 0 0 auto;
  position: relative;
  z-index: 11;
}
.hamburger-lines {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 18px;
  height: 18px;
}
.hamburger-lines span {
  display: block;
  height: 2px;
  width: 100%;
  border-radius: 2px;
  background: var(--color-text);
}

/* Hamburger side drawer */
.nav-drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 120;
  background: rgba(0, 0, 0, 0.55);
  border: 0;
  padding: 0;
  margin: 0;
  cursor: pointer;
}
.nav-drawer-backdrop[hidden] { display: none !important; }
.nav-drawer {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 130;
  width: var(--drawer-w);
  height: 100dvh;
  max-height: 100dvh;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: calc(env(safe-area-inset-top, 0px) + var(--space-4)) var(--space-4) calc(env(safe-area-inset-bottom, 0px) + var(--space-4));
  background: rgba(9, 20, 38, 0.98);
  border-right: 1px solid var(--color-border);
  box-shadow: 12px 0 40px rgba(0, 0, 0, 0.45);
  transform: translateX(0);
  transition: transform 0.22s ease;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  overscroll-behavior: contain;
}
.nav-drawer[hidden] { display: none !important; }
.nav-drawer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
  flex: 0 0 auto;
}
.nav-drawer-brand-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.nav-drawer-logo {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  object-fit: cover;
  border: 1px solid var(--color-border);
  flex: 0 0 auto;
}
.nav-drawer-brand {
  display: block;
  font-family: var(--font-display);
  letter-spacing: 0.16em;
  font-size: 0.95rem;
}
.nav-drawer-head small { display: block; margin-top: 2px; font-size: 0.78rem; }
.nav-drawer-online { color: #86efac; }
.online-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #22c55e;
  margin-right: 6px;
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.65);
  vertical-align: middle;
}
.nav-drawer-search {
  flex: 0 0 auto;
  margin: 0;
}
.nav-drawer-nav {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  flex: 0 0 auto;
}
.nav-drawer-nav-footer {
  margin-bottom: var(--space-1);
}
.nav-drawer-item {
  min-height: var(--tap);
  text-align: left;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: 0;
  border-radius: 12px;
  padding: 10px 12px;
  background: transparent;
  color: var(--color-text);
  font: inherit;
  cursor: pointer;
}
.nav-drawer-item-primary {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 999px;
}
.nav-drawer-item-ico {
  width: 1.25rem;
  height: 1.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0.9;
  flex: 0 0 auto;
  line-height: 0;
}
.nav-drawer-item-ico svg {
  width: 18px;
  height: 18px;
  display: block;
}
.nav-drawer-item {
  font-weight: 600;
}
.nav-drawer-item:hover,
.nav-drawer-item:focus-visible,
.nav-drawer-item.is-active {
  background: rgba(22, 141, 235, 0.14);
  outline: none;
}
.nav-drawer-sections {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 0 0 auto;
  max-height: none;
  overflow: visible;
  border-top: 1px solid var(--color-border);
  padding-top: var(--space-2);
}
.nav-drawer-section {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.nav-drawer-section-head {
  display: flex;
  align-items: center;
  gap: 6px;
}
.nav-drawer-section-toggle {
  flex: 1 1 auto;
  min-height: var(--tap);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  text-align: left;
  border: 0;
  border-radius: var(--radius-small);
  background: transparent;
  color: var(--color-text);
  font: inherit;
  font-weight: 600;
  padding: 8px 12px;
  cursor: pointer;
}
.nav-drawer-section-toggle:hover,
.nav-drawer-section-toggle:focus-visible,
.nav-drawer-section-toggle.is-active {
  background: rgba(22, 141, 235, 0.14);
  outline: none;
}
.nav-drawer-section-chevron {
  color: var(--color-text-muted);
  font-size: 1.1rem;
  line-height: 1;
}
.nav-drawer-section-toggle.is-active .nav-drawer-section-chevron {
  transform: rotate(90deg);
}
.nav-drawer-section-action {
  flex: 0 0 auto;
  min-width: var(--tap);
  padding: 0 10px;
}
.nav-drawer-new-project {
  align-self: flex-start;
  margin: 4px 0 6px;
}
.nav-drawer-section-body {
  padding: 0 4px 6px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.nav-drawer-section-body[hidden] {
  display: none !important;
}
.project-list-item {
  min-height: 40px;
  text-align: left;
  border: 0;
  border-radius: var(--radius-small);
  background: transparent;
  color: var(--color-text-muted);
  font: inherit;
  font-weight: 500;
  padding: 6px 10px;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.project-list-item:hover,
.project-list-item:focus-visible,
.project-list-item.is-active {
  background: rgba(22, 141, 235, 0.12);
  color: var(--color-text);
  outline: none;
}
.nav-drawer-section-hint {
  margin: 0;
  font-size: 0.78rem;
  padding: 0 2px;
}
.nav-drawer-section-hint.hidden {
  display: none !important;
}
.conversation-item-meta {
  display: block;
  font-size: 0.72rem;
  color: var(--color-text-muted);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nav-drawer-recents {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-height: 0;
  flex: 1 1 auto;
  overflow: visible;
  border-top: 1px solid var(--color-border);
  padding-top: var(--space-3);
}
.nav-drawer-recents-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  flex: 0 0 auto;
}
.nav-drawer-recents-title {
  margin: 0;
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  font-weight: 700;
}
.conversation-list-drawer {
  flex: 1 1 auto;
  min-height: 0;
  max-height: min(42vh, 320px);
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  overscroll-behavior: contain;
}
.nav-drawer-footer {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding-top: var(--space-3);
  border-top: 1px solid var(--color-border);
}
.nav-drawer-links {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding-top: var(--space-2);
}
.nav-drawer-links a {
  color: var(--color-text-muted);
  text-decoration: none;
  font-size: 0.88rem;
  min-height: var(--tap);
  display: flex;
  align-items: center;
}
.nav-drawer-links a:hover { color: var(--color-highlight); }
body.drawer-open { overflow: hidden; }

.online-state {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--color-text-muted);
  font-size: 0.72rem;
}
.online-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 10px #4ade80;
}
.online-state.is-offline .online-dot {
  background: var(--color-danger);
  box-shadow: 0 0 10px var(--color-danger);
}

.top-app-actions {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}
.header-new-chat {
  white-space: nowrap;
  min-height: var(--tap);
  padding: 0 12px;
  font-size: 0.82rem;
}
@media (max-width: 420px) {
  .header-new-chat {
    padding: 0 10px;
    font-size: 0.78rem;
  }
}

.icon-btn, .profile-btn {
  min-width: var(--tap);
  min-height: var(--tap);
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  border-radius: var(--radius-medium);
  cursor: pointer;
  font: inherit;
  padding: 0;
}
.profile-btn {
  border-radius: 50%;
  padding: 0;
  border: 0;
  background: transparent;
}
.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 30% 30%, #7dd3fc, #1e3a8a);
  border: 1px solid var(--color-border);
  font-weight: 800;
  color: #fff;
  font-size: 0.75rem;
}
.avatar-lg { width: 48px; height: 48px; font-size: 0.9rem; }

.shell-body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  width: 100%;
  overflow: hidden;
}

.history-sidebar {
  display: none;
  flex-direction: column;
  width: 280px;
  flex-shrink: 0;
  padding: var(--space-4);
  gap: var(--space-3);
  background: rgba(9, 20, 38, 0.96);
  border-right: 1px solid var(--color-border);
  overflow: hidden;
}
.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}
.sidebar-head-actions,
.panel-title-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.conversation-row {
  display: flex;
  align-items: stretch;
  gap: 6px;
}
.conversation-row .conversation-item {
  flex: 1 1 auto;
  min-width: 0;
}
.conversation-item-title {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.conversation-item.pinned .conversation-item-title::before {
  content: "ðŸ“Œ ";
  font-size: 0.85em;
}
.conversation-menu {
  flex: 0 0 auto;
  border: 1px solid var(--color-border);
  background: transparent;
  color: var(--color-text-muted);
  border-radius: var(--radius-small);
  padding: 0 10px;
  cursor: pointer;
  font: inherit;
  font-size: 1.05rem;
  line-height: 1;
  min-height: var(--tap);
  min-width: var(--tap);
}
.conversation-menu:hover,
.conversation-menu:focus-visible {
  color: var(--color-highlight);
  border-color: rgba(22, 141, 235, 0.55);
  outline: none;
}
.conversation-fav.is-favorited {
  color: var(--color-highlight);
  border-color: rgba(22, 141, 235, 0.55);
}
.project-picker-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 4px 0 12px;
  max-height: 40vh;
  overflow: auto;
}
.project-picker-item.is-active {
  border-color: var(--color-highlight);
  color: var(--color-highlight);
}
.conversation-delete {
  flex: 0 0 auto;
  border: 1px solid var(--color-border);
  background: transparent;
  color: var(--color-text-muted);
  border-radius: var(--radius-small);
  padding: 0 10px;
  cursor: pointer;
  font: inherit;
  font-size: 1.1rem;
  line-height: 1;
  min-height: var(--tap);
  min-width: var(--tap);
}
.conversation-delete:hover,
.conversation-delete:focus-visible {
  color: #fda4af;
  border-color: rgba(251, 113, 133, 0.55);
  outline: none;
}
.danger-chip {
  color: #fda4af !important;
  border-color: rgba(251, 113, 133, 0.4) !important;
}
.sidebar-head h2,
.panel-pad > h2,
.panel-title-row h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 0.95rem;
  letter-spacing: 0.1em;
}
.sidebar-search { margin: 0; }

.panel-host {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.panel {
  flex: 1 1 auto;
  min-height: 0;
  display: none;
  flex-direction: column;
  overflow: hidden;
}
.panel.is-active {
  display: flex;
}
.panel-pad {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
}
.panel-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

/* Chat panel */
.panel-chat {
  position: relative;
}
.empty-state {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  padding: var(--space-5) var(--space-4);
  text-align: center;
}
.empty-state.is-hidden { display: none; }
.empty-wolf {
  width: 88px;
  height: 88px;
  opacity: 0.92;
  filter: saturate(1.05);
  border-radius: 999px;
  pointer-events: none;
  box-shadow: 0 0 40px rgba(56, 189, 248, 0.25);
}
.empty-prompt {
  margin: 0;
  font-family: var(--font-ui);
  font-size: clamp(1.15rem, 3.8vw, 1.55rem);
  letter-spacing: 0.01em;
  font-weight: 600;
  color: var(--color-text);
  text-shadow: 0 2px 24px rgba(3, 7, 18, 0.9);
}
.quick-action-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  width: min(420px, 100%);
  margin-top: 4px;
}
/* Keep composer usable: hide home tiles while typing / keyboard open (no redesign). */
.panel-chat.is-composing .quick-action-grid,
.panel-chat.keyboard-open .quick-action-grid,
body.keyboard-open .panel-chat:not(.has-messages) .quick-action-grid {
  display: none !important;
}
.panel-chat.is-composing .empty-state,
.panel-chat.keyboard-open .empty-state {
  justify-content: flex-start;
  padding-top: var(--space-3);
  gap: var(--space-2);
}
.panel-chat.is-composing .empty-wolf,
.panel-chat.keyboard-open .empty-wolf {
  width: 56px;
  height: 56px;
}
.panel-chat.is-composing .ai-disclosure,
.panel-chat.keyboard-open .ai-disclosure {
  display: none;
}
.quick-action-tile {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 10px;
  min-height: 88px;
  padding: 14px 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: rgba(15, 23, 42, 0.72);
  color: var(--color-text);
  font: inherit;
  font-size: 0.92rem;
  font-weight: 550;
  text-align: left;
  cursor: pointer;
  backdrop-filter: blur(8px);
}
.quick-action-tile:hover,
.quick-action-tile:focus-visible {
  border-color: rgba(56, 189, 248, 0.55);
  outline: none;
  background: rgba(15, 23, 42, 0.88);
}
.quick-action-icon {
  width: 1.4rem;
  height: 1.4rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}
.quick-action-icon svg {
  width: 22px;
  height: 22px;
  display: block;
}
.quick-action-icon-design { color: #c4b5fd; }
.quick-action-icon-explain { color: #86efac; }
.quick-action-icon-image { color: #7dd3fc; }
.quick-action-icon-more { color: #cbd5e1; }
.quick-action-label { line-height: 1.25; }
.suggestion-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-2);
  max-width: 520px;
}
.suggestion-chip {
  /* legacy class retained for JS wiring; tiles own visual style */
}

.messages {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: var(--space-3) var(--space-4) var(--space-3);
  width: min(760px, 100%);
  margin: 0 auto;
  align-self: stretch;
  scroll-behavior: auto;
}
.panel-chat.has-messages .empty-state { display: none; }
.panel-chat:not(.has-messages) .messages:empty { display: none; }

.message {
  max-width: min(92%, 560px);
  padding: 12px 14px;
  border-radius: var(--radius-medium);
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  animation: rise 0.28s ease;
}
@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
.message.user {
  align-self: flex-end;
  background: linear-gradient(135deg, rgba(22, 141, 235, 0.92), rgba(70, 94, 242, 0.92));
  border: 1px solid rgba(125, 211, 252, 0.35);
  color: #fff;
}
.message.assistant {
  align-self: flex-start;
  background: rgba(9, 20, 38, 0.96);
  border: 1px solid var(--color-border);
}
/* Pending assistant bubble lives in #messages (after user) â€” never sticky/fixed near header.
   Readability pass (intentional): stronger Fenrir contrast, wrap-safe on mobile. */
.message.assistant.pending {
  position: static;
  animation: none;
  color: var(--color-text);
  min-height: 0;
  margin-bottom: 10px;
}
.message.assistant.pending .message-meta {
  color: #f8fafc;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  opacity: 1;
}
.message.assistant.pending .pending-body {
  display: inline-flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 2px 0;
  max-width: 100%;
  white-space: normal;
  color: #f1f5f9;
  font-size: 1.02rem;
  line-height: 1.45;
  font-weight: 560;
}
.message.assistant.pending .pending-label {
  color: #f8fafc;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
}
.message.assistant.pending .pending-dots {
  display: inline-flex;
  width: 1.25em;
  margin-left: 2px;
  letter-spacing: 0;
  color: #e2e8f0;
}
.message.assistant.pending .pending-dots span {
  opacity: 0.35;
  animation: pendingDot 1.2s ease-in-out infinite;
}
.message.assistant.pending .pending-dots span:nth-child(2) {
  animation-delay: 0.2s;
}
.message.assistant.pending .pending-dots span:nth-child(3) {
  animation-delay: 0.4s;
}
@keyframes pendingDot {
  0%,
  80%,
  100% { opacity: 0.25; }
  40% { opacity: 1; }
}
.tts-autoplay-nudge {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 6px 0 10px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.72);
  border: 1px solid rgba(148, 163, 184, 0.35);
  color: #f8fafc;
  font-size: 0.9rem;
}
.tts-autoplay-nudge[hidden] {
  display: none !important;
}
.tts-settings-row {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}
.tts-settings-row label {
  display: grid;
  gap: 4px;
  font-size: 0.9rem;
}
.message-meta {
  margin-bottom: 4px;
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-highlight);
}
.message.user .message-meta { color: rgba(248, 250, 252, 0.85); }
.message-image {
  display: block;
  max-width: 100%;
  border-radius: 12px;
  margin-bottom: 8px;
}

.composer-dock {
  flex: 0 0 auto;
  position: relative;
  z-index: 8;
  width: min(760px, 100%);
  margin: 0 auto;
  padding: var(--space-2) var(--space-4) calc(var(--space-3) + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(180deg, transparent, rgba(3, 7, 18, 0.72) 28%, rgba(3, 7, 18, 0.92));
  padding-bottom: calc(var(--space-3) + env(safe-area-inset-bottom, 0px) + var(--vv-keyboard-inset, 0px));
}
.composer {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 0;
  border-radius: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  min-width: 0;
}
.composer-chatgpt .composer-pill {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: flex-end;
  gap: 4px;
  padding: 4px 6px 4px 12px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: rgba(15, 23, 42, 0.94);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
}
.composer textarea {
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  resize: none;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--color-text);
  font: inherit;
  font-size: 1.02rem;
  line-height: 1.35;
  min-height: var(--tap);
  max-height: 120px;
  padding: 10px 4px;
}
.composer textarea::placeholder { color: #7f93b0; }
.composer-icon {
  display: block;
  flex-shrink: 0;
  pointer-events: none;
}
.composer-attach,
.composer-mic,
.composer-voice {
  flex: 0 0 auto;
  min-width: var(--tap);
  min-height: var(--tap);
  width: var(--tap);
  height: var(--tap);
  border-radius: 999px;
  position: relative;
}
.composer-attach {
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(15, 23, 42, 0.92);
  color: #e2f3ff;
  z-index: 2;
}
.composer-attach:not(.hidden) {
  display: inline-grid !important;
}
.composer-mic {
  background: transparent;
  border: 0;
  box-shadow: none;
  color: #cbd5e1;
  min-width: 40px;
  min-height: 40px;
  width: 40px;
  height: 40px;
}
.composer-voice {
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(15, 23, 42, 0.92);
  color: #e2e8f0;
}
.composer-mic .icon-mic-stop,
.composer-mic .icon-mic-busy {
  display: none;
}
.composer-mic[data-mic-state="recording"] .icon-mic-idle,
.composer-mic[data-mic-state="transcribing"] .icon-mic-idle,
.composer-mic[data-mic-state="sending"] .icon-mic-idle {
  display: none;
}
.composer-mic[data-mic-state="recording"] .icon-mic-stop {
  display: block;
}
.composer-mic[data-mic-state="transcribing"] .icon-mic-busy,
.composer-mic[data-mic-state="sending"] .icon-mic-busy {
  display: block;
}
.composer-mic.recording,
.composer-mic[aria-pressed="true"],
.composer-mic[data-mic-state="recording"] {
  background: linear-gradient(135deg, #b91c1c, #f97316);
  box-shadow: 0 0 18px rgba(249, 115, 22, 0.55);
  color: #fff;
}
.composer-mic[data-mic-state="permission_denied"],
.composer-mic[data-mic-state="unsupported"] {
  background: rgba(71, 85, 105, 0.55);
  box-shadow: none;
  opacity: 0.85;
}
.composer-speak {
  /* Speaker moved to assistant message actions; keep rule for legacy hooks */
  display: none !important;
}
.send-btn {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: var(--tap);
  width: var(--tap);
  height: var(--tap);
  min-height: var(--tap);
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  color: #04101b;
  font: inherit;
  font-weight: 700;
  font-size: 0.75rem;
  padding: 0;
  background: linear-gradient(145deg, #7dd3fc, var(--color-primary));
  box-shadow: 0 0 20px rgba(56, 189, 248, 0.35);
}
.send-btn .send-label {
  display: none;
}
.send-btn .icon-send {
  display: block;
}

/* Bottom nav removed â€” hamburger drawer only */
.bottom-nav { display: none !important; }
.nav-item { display: none !important; }

.photo-draft {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-2);
  padding: var(--space-3);
  border-radius: var(--radius-medium);
  border: 1px solid var(--color-border);
  background: rgba(13, 26, 46, 0.96);
}
.photo-draft.hidden { display: none !important; }
.photo-draft img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid var(--color-border);
}
.photo-draft-meta {
  flex: 1 1 160px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.photo-draft-meta strong { font-size: 0.9rem; }
.photo-draft-meta small { color: var(--color-text-muted); font-size: 0.8rem; }
.photo-draft-filemeta { display: block; word-break: break-all; }
.photo-draft-progress {
  width: 100%;
  height: 6px;
  margin-top: 6px;
  border-radius: 999px;
  background: rgba(125, 211, 252, 0.15);
  overflow: hidden;
}
.photo-draft-progress.hidden { display: none !important; }
.photo-draft-progress-bar {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, #38bdf8, #7dd3fc);
  transition: width 0.15s ease-out;
}
.photo-draft-progress-label {
  display: block;
  margin-top: 2px;
  font-size: 0.75rem;
  color: var(--color-highlight);
}
.photo-draft-progress-label.hidden { display: none !important; }
.photo-draft-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: 4px;
}
.photo-draft .error-text { width: 100%; margin: 0; }
.photo-draft-file-fallback {
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  border: 1px solid var(--color-border);
  background: rgba(9, 20, 38, 0.9);
  color: var(--color-highlight);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.message-image-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 8px;
  max-width: 100%;
}
.message-image-wrap .message-image { margin-bottom: 0; }
.message-image-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.message-image-actions a,
.message-image-actions .msg-action-btn {
  color: var(--color-highlight);
  font-size: 0.8rem;
  text-decoration: none;
}
.message-image-primary .message-image {
  width: min(100%, 520px);
  max-height: min(70vh, 640px);
  object-fit: contain;
  border-radius: 12px;
}
.message-image-caption {
  font-size: 0.92rem;
  opacity: 0.88;
  max-width: 36rem;
}
.attach-sheet .sheet-action { text-align: left; }

.message-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}
.msg-action-btn {
  min-height: 32px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: rgba(13, 26, 46, 0.9);
  color: var(--color-text-muted);
  font: inherit;
  font-size: 0.75rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.msg-action-btn:hover,
.msg-action-btn:focus-visible {
  color: var(--color-text);
  border-color: var(--color-highlight);
  outline: none;
}
.msg-action-btn.is-active {
  color: var(--color-highlight);
  border-color: var(--color-highlight);
}
.msg-speak-btn .msg-speak-icon-stop {
  display: none;
}
.msg-speak-btn.is-active .msg-speak-icon-play {
  display: none;
}
.msg-speak-btn.is-active .msg-speak-icon-stop {
  display: block;
}
.msg-speak-btn .composer-icon {
  width: 14px;
  height: 14px;
}
.msg-setup-note {
  align-self: center;
  font-size: 0.72rem;
  color: var(--color-text-muted);
  max-width: 280px;
  line-height: 1.3;
}
.msg-retry-vision-btn {
  border-color: var(--color-highlight);
  color: var(--color-highlight);
}
.msg-retry-chat-btn {
  border-color: var(--color-highlight);
  color: var(--color-highlight);
}

/* Settings / support stubs */
.settings-title-row {
  margin-bottom: 4px;
}
.settings-title-row h2 {
  margin: 0;
  flex: 1 1 auto;
  text-align: center;
}
.settings-title-spacer {
  width: var(--tap);
  flex: 0 0 auto;
}
.settings-profile {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4);
  border-radius: var(--radius-medium);
  background: rgba(13, 26, 46, 0.96);
  border: 1px solid var(--color-border);
}
.settings-profile small { display: block; margin-top: 2px; }
.settings-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.settings-group-label {
  margin: 0;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  padding-left: 4px;
}
.settings-list {
  display: flex;
  flex-direction: column;
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(15, 23, 42, 0.88);
  overflow: hidden;
}
.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 52px;
  padding: 12px 14px;
  border: 0;
  border-bottom: 1px solid rgba(148, 163, 184, 0.14);
  background: transparent;
  color: var(--color-text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  text-decoration: none;
}
.settings-list > .settings-row:last-child,
.settings-list > .settings-detail:last-child + .settings-row,
.settings-list > .settings-detail:last-child {
  border-bottom: 0;
}
.settings-row:hover,
.settings-row:focus-visible {
  background: rgba(22, 141, 235, 0.1);
  outline: none;
}
.settings-row-main {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.settings-row-ico {
  width: 1.2rem;
  height: 1.2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0.9;
  line-height: 0;
  flex: 0 0 auto;
}
.settings-row-ico svg {
  width: 18px;
  height: 18px;
  display: block;
}
.settings-row-meta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--color-text-muted);
  font-size: 0.9rem;
  flex: 0 0 auto;
}
.settings-chevron {
  opacity: 0.7;
  font-size: 1.1rem;
}
.settings-detail {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 14px 16px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.14);
  background: rgba(2, 6, 23, 0.35);
}
.settings-detail[hidden] {
  display: none !important;
}
.settings-nested {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 6px;
}
.settings-nested h4 {
  margin: 0;
  font-size: 0.85rem;
}
.settings-row.danger-row,
.settings-row.danger-row .settings-row-main {
  color: #fb7185;
}
.settings-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.settings-section h3 {
  margin: 0 0 var(--space-1);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}
.stub-card {
  padding: var(--space-4);
  border-radius: var(--radius-medium);
  background: rgba(13, 26, 46, 0.96);
  border: 1px solid var(--color-border);
}
.stub-card strong { display: block; margin-bottom: var(--space-2); }
.stub-link { text-decoration: none; text-align: center; }
.ai-disclosure {
  margin: 0;
  max-width: 28rem;
  font-size: 0.82rem;
  line-height: 1.4;
}
.about-block {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-3);
  border-radius: var(--radius-medium);
  background: rgba(13, 26, 46, 0.96);
  border: 1px solid var(--color-border);
}
.about-block p { margin: 0; }
.support-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.support-form textarea,
.sheet-search textarea,
.sheet-search select {
  border: 1px solid var(--color-border);
  background: var(--color-surface-elevated);
  color: #fff;
  border-radius: var(--radius-small);
  padding: 10px 12px;
  font: inherit;
  min-height: var(--tap);
  width: 100%;
  box-sizing: border-box;
}
.support-form textarea,
.sheet-search textarea { min-height: 96px; resize: vertical; }
.message-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.msg-action-btn {
  border: 1px solid var(--color-border);
  background: transparent;
  color: var(--color-text-muted);
  border-radius: 999px;
  padding: 4px 10px;
  font: inherit;
  font-size: 0.72rem;
  cursor: pointer;
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.msg-action-btn:hover { color: var(--color-text); border-color: var(--color-highlight); }
.danger-action {
  background: linear-gradient(135deg, #9f1239, #7f1d2d) !important;
  border-color: rgba(251, 113, 133, 0.45) !important;
}
.confirm-row {
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  gap: 10px;
}
.confirm-row input { width: auto; min-height: auto; }
.login-legal { font-size: 0.75rem; margin: 8px 0 0; }
.login-legal a { color: var(--color-highlight); }
.install-hint { margin: 0; }
.ghost-chip {
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  border-radius: 999px;
  padding: 8px 12px;
  font: inherit;
  font-size: 0.75rem;
  cursor: pointer;
  min-height: 36px;
}
.install-chip {
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-secondary));
  border-color: var(--color-highlight);
  color: #fff;
  font-weight: 600;
}

.sheet {
  width: min(420px, 94vw);
  max-height: 80dvh;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-large);
  background: var(--color-surface);
  color: var(--color-text);
  padding: 0;
}
.sheet::backdrop { background: rgba(0, 0, 0, 0.7); backdrop-filter: blur(8px); }
.sheet-inner { padding: 18px; display: flex; flex-direction: column; gap: 10px; overflow: auto; }
.sheet-inner header { display: flex; justify-content: space-between; align-items: center; }
.sheet-inner h2 { margin: 0; font-family: var(--font-display); font-size: 1rem; letter-spacing: 0.08em; }
.sheet-action, .primary-btn {
  border: 1px solid var(--color-border);
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-secondary));
  color: #fff;
  border-radius: 12px;
  padding: 12px 14px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  text-align: left;
  min-height: var(--tap);
}
.sheet-search { display: grid; gap: 6px; color: var(--color-text-muted); font-size: 0.8rem; }
.sheet-search input {
  border: 1px solid var(--color-border);
  background: var(--color-surface-elevated);
  color: #fff;
  border-radius: var(--radius-small);
  padding: 10px 12px;
  font: inherit;
  min-height: var(--tap);
}
.conversation-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow: auto;
  min-height: 0;
  flex: 1 1 auto;
}
.conversation-list-full { max-height: none; }
.conversation-item {
  border: 1px solid var(--color-border);
  background: var(--color-surface-elevated);
  color: var(--color-text);
  border-radius: var(--radius-small);
  padding: 12px;
  text-align: left;
  cursor: pointer;
  font: inherit;
  min-height: var(--tap);
  overflow: hidden;
}
.conversation-item.active { border-color: var(--color-highlight); }
.status-list, .muted { color: var(--color-text-muted); font-size: 0.85rem; }
.status-list { display: grid; gap: 4px; }

#loginDialog {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-large);
  background: var(--color-surface);
  color: var(--color-text);
  padding: 28px;
  width: min(380px, 92vw);
}
#loginDialog::backdrop { background: rgba(0, 0, 0, 0.78); backdrop-filter: blur(10px); }
.login-form { display: grid; gap: 12px; }
.login-form h2 { margin: 0; font-family: var(--font-display); letter-spacing: 0.08em; }
.login-form input {
  border: 1px solid var(--color-border);
  background: var(--color-surface-elevated);
  color: #fff;
  border-radius: 12px;
  padding: 12px;
  font: inherit;
  min-height: var(--tap);
}

.voice-panel {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(6px);
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
}
.voice-panel.hidden { display: none !important; }
.voice-panel-card {
  width: min(440px, 100%);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 18px;
  padding: 16px;
  display: grid;
  gap: 10px;
  color: var(--color-text);
}
.voice-panel-card header { display: flex; justify-content: space-between; align-items: center; }
.voice-panel-card h2 { margin: 0; font-family: var(--font-display); font-size: 1.1rem; }
.voice-panel-card textarea {
  width: 100%;
  min-height: 72px;
  border-radius: 12px;
  border: 1px solid var(--color-border);
  background: var(--color-surface-elevated);
  color: #fff;
  padding: 10px;
  font: inherit;
  resize: vertical;
}
.voice-primary {
  min-height: 56px;
  font-size: 1.05rem;
  text-align: center !important;
}
.hold-talk {
  min-height: 64px;
  font-size: 1.05rem;
  user-select: none;
  touch-action: none;
  -webkit-user-select: none;
}
.hold-talk.recording,
#voiceToggleBtn.recording {
  background: linear-gradient(135deg, #b91c1c, #f97316) !important;
  border-color: #fb923c !important;
}

/* Desktop: sidebar history */
@media (min-width: 900px) {
  .history-sidebar { display: flex; }
  .composer-chatgpt .composer-pill {
    padding: 6px 8px 6px 14px;
  }
  .send-btn {
    min-width: var(--tap);
    width: var(--tap);
    height: var(--tap);
  }
}

@media (max-width: 820px) {
  .desktop-hold { display: none !important; }
  .composer {
    gap: 6px;
    padding: 0;
  }
  .composer textarea {
    font-size: 16px; /* prevent iOS zoom */
    min-width: 0;
    flex: 1 1 auto;
    padding: 10px 2px;
  }
  .composer-attach,
  .composer-voice {
    min-width: 40px;
    min-height: 40px;
    width: 40px;
    height: 40px;
  }
  .composer-mic {
    min-width: 36px;
    min-height: 36px;
    width: 36px;
    height: 36px;
  }
  .send-btn {
    min-width: 40px;
    width: 40px;
    height: 40px;
    min-height: 40px;
    padding: 0;
    font-size: 0.75rem;
  }
  .message { max-width: 94%; font-size: 0.95rem; }
  .voice-panel {
    align-items: stretch;
    padding: 0;
  }
  .voice-panel-card {
    width: 100%;
    border-radius: 18px 18px 0 0;
    padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
    max-height: 92dvh;
    overflow: auto;
  }
  .quick-action-grid {
    gap: 8px;
  }
  .quick-action-tile {
    min-height: 80px;
    padding: 12px;
    font-size: 0.86rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .galaxy-photo { animation: none; }
  .message { animation: none; }
  .pulse { animation: none; }
}

/* Keyboard / short viewport: keep composer reachable */
@media (max-height: 560px) {
  .quick-action-grid {
    display: none !important;
  }
  .empty-state .ai-disclosure {
    display: none;
  }
  .empty-wolf { width: 56px; height: 56px; }
  .composer-dock {
    padding-top: 2px;
    padding-bottom: calc(4px + env(safe-area-inset-bottom, 0px) + var(--vv-keyboard-inset, 0px));
  }
  .composer textarea {
    max-height: 72px;
    min-height: 36px;
    padding: 6px 2px;
  }
  .composer-attach,
  .composer-mic,
  .composer-voice {
    min-width: 36px;
    min-height: 36px;
    width: 36px;
    height: 36px;
  }
  .send-btn {
    min-width: 36px;
    width: 36px;
    height: 36px;
    min-height: 36px;
  }
}

/* Surface sub-navigation (Family / Jarvis / Home) — functional chips, no redesign */
.surface-subnav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0.75rem 0 1rem;
}
.surface-subnav--scroll {
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
  max-width: 100%;
  padding-bottom: 0.25rem;
}
.surface-subnav--scroll .surface-subnav-btn {
  flex: 0 0 auto;
  scroll-snap-align: center;
  white-space: nowrap;
}
.surface-subnav-btn {
  appearance: none;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: rgba(15, 23, 42, 0.72);
  color: var(--color-text);
  border-radius: 999px;
  padding: 0.4rem 0.75rem;
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
}
.surface-subnav-btn.is-active,
.surface-subnav-btn[aria-current="true"] {
  border-color: rgba(56, 189, 248, 0.55);
  background: rgba(15, 23, 42, 0.95);
}
@media (min-width: 900px) {
  .surface-subnav--scroll {
    flex-wrap: wrap;
    overflow-x: visible;
    scroll-snap-type: none;
  }
}

/* Home panel — semantic cards (functional layout; cinematic shell preserved) */
.home-status-banner {
  margin: 0.5rem 0 0.75rem;
  padding: 0.65rem 0.8rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  max-width: 100%;
}
.home-status-banner[data-state="setup"] {
  border-color: rgba(230, 126, 34, 0.4);
}
.home-status-banner[data-state="error"] {
  border-color: rgba(239, 68, 68, 0.4);
}
.home-status-banner #homeStatusLine {
  margin: 0;
}
.home-tab-data,
.home-demo-panel {
  max-width: 100%;
  overflow-x: hidden;
  font-size: 0.9rem;
}
.home-overview-card {
  display: grid;
  gap: 0.65rem;
  max-width: 100%;
}
.home-banner-text {
  margin: 0;
  font-weight: 600;
}
.home-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
}
.home-adapter-list,
.home-cap-list,
.home-item-list,
.home-limits,
.home-setup-steps,
.home-fusion-timeline {
  margin: 0;
  padding-left: 1.1rem;
  max-width: 100%;
}
.home-adapter-list {
  list-style: none;
  padding-left: 0;
  display: grid;
  gap: 0.4rem;
}
.home-adapter-row,
.home-cap-list li,
.home-item-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.65rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
}
.home-adapter-name {
  font-weight: 600;
}
.home-badge {
  display: inline-block;
  border-radius: 999px;
  padding: 0.15rem 0.55rem;
  font-size: 0.75rem;
  border: 1px solid rgba(148, 163, 184, 0.35);
  color: var(--color-text-muted);
  white-space: nowrap;
}
.home-badge.warn {
  border-color: rgba(230, 126, 34, 0.45);
  color: #ffc089;
}
.home-dev-tools {
  margin-top: 1.25rem;
}
.home-dev-tools > summary {
  cursor: pointer;
  font-weight: 600;
  padding: 0.35rem 0;
}
.home-dev-tools[open] > summary {
  margin-bottom: 0.5rem;
}
.panel-home .panel-pad {
  overflow-x: hidden;
  max-width: 100%;
}
.surface-tab-data {
  white-space: pre-wrap;
  font-size: 0.85rem;
  max-height: 16rem;
  overflow: auto;
}
.surface-tab-limits {
  margin: 0.35rem 0;
  padding-left: 1.1rem;
  font-size: 0.82rem;
}
.surface-tab-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

/* Functional provider degraded banner — no chrome redesign */
.provider-health-banner {
  margin: 0.5rem 1rem 0;
  padding: 0.55rem 0.75rem;
  border-radius: 10px;
  font-size: 0.85rem;
  color: var(--color-text-muted);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.provider-health-banner[hidden] { display: none !important; }

/* Stocks / Nexus semantic panels — functional mobile layout, no redesign */
.stocks-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
  margin: 0.35rem 0 0.75rem;
}
.stocks-metric {
  padding: 0.65rem 0.75rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(148, 163, 184, 0.22);
}
.stocks-metric-label {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin-bottom: 0.2rem;
}
.stocks-metric-value {
  font-size: 1.05rem;
  font-weight: 700;
}
.stocks-holdings {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.stocks-holding-row,
.stocks-filing-row,
.stocks-scenario-card {
  padding: 0.7rem 0.8rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(148, 163, 184, 0.2);
}
.stocks-holding-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.35rem 0.75rem;
}
.stocks-scenario-card h4 {
  margin: 0 0 0.35rem;
  font-size: 1rem;
}
.stocks-badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0.35rem 0;
}
.stocks-badge {
  display: inline-block;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  font-size: 0.72rem;
  background: rgba(22, 141, 235, 0.16);
  color: var(--color-text);
}
.stocks-badge.warn {
  background: rgba(245, 158, 11, 0.18);
}
.stocks-empty,
.stocks-unavailable,
.nexus-empty {
  margin: 0.4rem 0;
}
.nexus-status-panel,
.nexus-plan-panel {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.nexus-metric-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem;
}
.nexus-plan-step {
  margin: 0;
  padding-left: 1.1rem;
}
.stocks-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
}
.stocks-row input {
  flex: 1;
  min-width: 7rem;
}
.stocks-view-toggle {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.35rem 0 0.65rem;
}
.stocks-view-toggle .ghost-chip.is-active {
  outline: 1px solid rgba(22, 141, 235, 0.55);
}
.stocks-orient,
.stocks-help {
  margin: 0.25rem 0 0.65rem;
  line-height: 1.45;
}
.stocks-dfn {
  font-style: normal;
  text-decoration: underline dotted rgba(148, 163, 184, 0.7);
  cursor: help;
}
.stocks-trade-review:not([hidden]) {
  margin-top: 0.65rem;
}
.stocks-glossary-list {
  margin: 0.4rem 0 0;
  padding-left: 1.1rem;
}
.stocks-data-list {
  margin: 0.35rem 0 0;
  padding-left: 1.1rem;
}
.stocks-watch-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}
.stocks-skeleton {
  opacity: 0.8;
}
@media (max-width: 420px) {
  .stocks-metrics,
  .nexus-metric-grid {
    grid-template-columns: 1fr;
  }
}
