/* FinAI — Liquid Glass UI (brand blue + orange) */
:root {
  --blue-deep: #0a1628;
  --blue-mid: #0d2847;
  --blue-bright: #1a6fff;
  --blue-glow: #3d8bff;
  --blue-glass: rgba(26, 111, 255, 0.12);
  --orange: #ff8c00;
  --orange-bright: #ffb347;
  --orange-glass: rgba(255, 140, 0, 0.14);
  --glass-bg: rgba(255, 255, 255, 0.06);
  --glass-bg-strong: rgba(255, 255, 255, 0.1);
  --glass-border: rgba(255, 255, 255, 0.18);
  --glass-border-soft: rgba(255, 255, 255, 0.08);
  --text: #eef4ff;
  --text-muted: rgba(238, 244, 255, 0.62);
  --shadow-glass: 0 8px 32px rgba(0, 0, 0, 0.35);
  --shadow-glow-blue: 0 0 40px rgba(26, 111, 255, 0.2);
  --shadow-glow-orange: 0 0 36px rgba(255, 140, 0, 0.18);
  --blur: blur(20px);
  --radius: 18px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  font-family: Inter, 'Segoe UI', Roboto, Arial, sans-serif;
  color: var(--text);
  background: var(--blue-deep);
}

/* Ambient liquid orbs */
.ambient {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.55;
  animation: float 18s ease-in-out infinite;
}
.orb-blue {
  width: 520px; height: 520px;
  background: radial-gradient(circle, var(--blue-glow) 0%, transparent 70%);
  top: -120px; left: -80px;
}
.orb-orange {
  width: 420px; height: 420px;
  background: radial-gradient(circle, var(--orange) 0%, transparent 70%);
  bottom: -80px; right: 10%;
  animation-delay: -6s;
}
.orb-mix {
  width: 360px; height: 360px;
  background: radial-gradient(circle, #6366f1 0%, var(--orange-bright) 50%, transparent 70%);
  top: 40%; left: 45%;
  opacity: 0.25;
  animation-delay: -12s;
}
@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(30px, -20px) scale(1.05); }
  66% { transform: translate(-20px, 25px) scale(0.95); }
}

.glass-panel {
  background: var(--glass-bg);
  backdrop-filter: var(--blur) saturate(160%);
  -webkit-backdrop-filter: var(--blur) saturate(160%);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-glass), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.app-layout {
  position: relative;
  z-index: 1;
  --side-w: 240px;
  --desk-w: 360px;
  display: grid;
  grid-template-columns: var(--side-w) minmax(0, 1fr) var(--desk-w);
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

.sidebar-backdrop {
  display: none;
}
.nav-toggle,
.sidebar-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-radius: 8px;
  border: 1px solid var(--glass-border-soft);
  background: rgba(26, 111, 255, 0.16);
  color: var(--text);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.nav-toggle {
  padding: 7px 10px;
  white-space: nowrap;
}
.nav-toggle[aria-expanded="true"],
.desk-toggle[aria-expanded="true"] {
  background: rgba(26, 111, 255, 0.32);
}
.sidebar-close {
  width: 32px;
  height: 32px;
  margin-left: auto;
  font-size: 14px;
  line-height: 1;
}

/* Sidebar — fixed column, no page scroll */
.sidebar {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  position: relative;
  top: 0;
  align-self: start;
  padding: 20px 14px;
  border-radius: 0;
  border-top: 0; border-bottom: 0; border-left: 0;
  background: linear-gradient(180deg, rgba(10, 22, 40, 0.85) 0%, rgba(13, 40, 71, 0.75) 100%);
}

.sidebar-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 22px;
  position: relative;
}
.sidebar-meta { flex-basis: 100%; }

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}
.brand-logo {
  height: 42px;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 2px 12px rgba(26, 111, 255, 0.35));
}
.beta {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.06em;
  background: linear-gradient(135deg, var(--orange), var(--orange-bright));
  color: #1a0e00;
  padding: 3px 7px;
  border-radius: 6px;
  box-shadow: var(--shadow-glow-orange);
}
.sidebar-meta {
  color: var(--text-muted);
  font-size: 11px;
  margin-top: 10px;
  padding-left: 4px;
}

.side-nav { display: flex; flex-direction: column; gap: 4px; flex-shrink: 0; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s ease;
}
.nav-item:hover {
  color: var(--text);
  background: var(--blue-glass);
  border-color: var(--glass-border-soft);
}
.nav-item.active {
  color: #fff;
  background: linear-gradient(135deg, var(--blue-glass), var(--orange-glass));
  border-color: rgba(255, 140, 0, 0.25);
  box-shadow: var(--shadow-glow-blue);
}
.nav-icon { width: 20px; text-align: center; opacity: 0.9; }

.recent-section {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  margin: 14px 0 12px;
  padding: 0 4px;
}

.recent-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 8px;
  padding: 0 8px;
}

.recent-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overscroll-behavior: contain;
  padding-right: 2px;
}

.recent-empty {
  font-size: 12px;
  color: var(--text-muted);
  padding: 8px 10px;
  margin: 0;
}

.recent-row {
  display: flex;
  align-items: stretch;
  gap: 2px;
  border-radius: 10px;
  border: 1px solid transparent;
  transition: all 0.2s ease;
}

.recent-row:hover {
  background: var(--blue-glass);
  border-color: var(--glass-border-soft);
}

.recent-row:hover .recent-menu-btn {
  opacity: 1;
}

.recent-row.active {
  background: linear-gradient(135deg, rgba(26, 111, 255, 0.2), rgba(255, 140, 0, 0.12));
  border-color: rgba(255, 140, 0, 0.25);
}

.recent-row.pinned .recent-title {
  color: var(--orange-bright);
}

.recent-open {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 10px 6px 10px 12px;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  text-align: left;
}

.recent-row:hover .recent-open,
.recent-row.active .recent-open {
  color: var(--text);
}

.recent-menu-btn {
  flex-shrink: 0;
  width: 32px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  letter-spacing: 0.02em;
  opacity: 0;
  transition: opacity 0.15s, background 0.15s, color 0.15s;
}

.recent-row.active .recent-menu-btn,
.recent-menu-btn:focus-visible {
  opacity: 1;
}

.recent-menu-btn:hover,
.recent-menu-btn[aria-expanded="true"] {
  opacity: 1;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.recent-title {
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
  display: flex;
  align-items: center;
  gap: 4px;
}

.pin-icon {
  font-size: 10px;
  flex-shrink: 0;
}

.recent-title-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.recent-time {
  font-size: 10px;
  opacity: 0.7;
}

.chat-context-menu {
  position: fixed;
  z-index: 2000;
  min-width: 168px;
  padding: 6px;
  border-radius: 12px;
  background: rgba(12, 24, 44, 0.96);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-glass), 0 12px 40px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(16px);
}

.chat-menu-item {
  display: block;
  width: 100%;
  padding: 9px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s;
}

.chat-menu-item:hover {
  background: var(--blue-glass);
}

.chat-menu-item.danger {
  color: #fca5a5;
}

.chat-menu-item.danger:hover {
  background: rgba(239, 68, 68, 0.15);
}

.finai-toast {
  position: fixed;
  bottom: 96px;
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  z-index: 3000;
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 13px;
  color: #fff;
  background: rgba(12, 24, 44, 0.92);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-glass);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
}

.finai-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (hover: none) {
  .recent-menu-btn {
    opacity: 0.7;
  }
}

.profile-card {
  flex-shrink: 0;
  margin-top: auto;
  padding: 16px;
  border-radius: var(--radius);
  background: var(--glass-bg-strong);
  border: 1px solid var(--glass-border-soft);
  backdrop-filter: blur(12px);
  font-size: 12px;
}
.profile-title {
  font-weight: 700;
  margin-bottom: 12px;
  background: linear-gradient(90deg, var(--blue-bright), var(--orange-bright));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.profile-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 7px;
  color: var(--text-muted);
}
.profile-row strong { color: var(--text); }
.profile-user {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--glass-border-soft);
  color: var(--text-muted);
  font-size: 11px;
}

.profile-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}
.profile-head .profile-title { margin-bottom: 0; }
.profile-edit-btn {
  border: 1px solid var(--glass-border-soft);
  background: var(--glass-bg);
  color: var(--text-muted);
  border-radius: 10px;
  width: 32px;
  height: 32px;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
}
.profile-edit-btn:hover {
  color: var(--text);
  border-color: var(--blue-bright);
  box-shadow: var(--shadow-glow-blue);
}

.profile-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(4, 12, 24, 0.72);
  backdrop-filter: blur(6px);
}
.profile-overlay[hidden] { display: none; }

.profile-modal {
  width: min(560px, 100%);
  max-height: min(88vh, 720px);
  display: flex;
  flex-direction: column;
  border-radius: calc(var(--radius) + 4px);
  overflow: hidden;
}
.profile-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 22px 12px;
  border-bottom: 1px solid var(--glass-border-soft);
}
.profile-modal-head h2 {
  margin: 0 0 4px;
  font-size: 1.25rem;
}
.profile-close-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}
.profile-close-btn:hover { color: var(--text); }

.profile-tabs {
  display: flex;
  gap: 6px;
  padding: 10px 16px 0;
}
.profile-tab {
  flex: 1;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  padding: 10px 8px;
  border-radius: 12px 12px 0 0;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
}
.profile-tab.active {
  color: var(--text);
  background: var(--glass-bg-strong);
  border-color: var(--glass-border-soft);
  border-bottom-color: transparent;
}

.profile-modal-body {
  padding: 16px 22px;
  overflow-y: auto;
  flex: 1;
}
.profile-panel-section { display: flex; flex-direction: column; gap: 12px; }
.profile-panel-section[hidden] { display: none !important; }

.field-label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
}
.field-input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--glass-border-soft);
  background: rgba(0, 0, 0, 0.22);
  color: var(--text);
  font-size: 14px;
}
.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.field-check {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
}
.field-check input { accent-color: var(--blue-bright); }

.profile-modal-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 22px 18px;
  border-top: 1px solid var(--glass-border-soft);
}
.profile-save-status.error { color: #ff8a8a; }
.btn-primary {
  border: none;
  border-radius: 12px;
  padding: 10px 18px;
  font-weight: 600;
  cursor: pointer;
  color: #fff;
  background: linear-gradient(135deg, var(--blue-bright), #4f46e5);
  box-shadow: var(--shadow-glow-blue);
}
.btn-primary:hover { filter: brightness(1.08); }

.settings-danger-zone {
  margin-top: 20px;
  padding: 16px;
  border-radius: 14px;
  border: 1px solid rgba(239, 68, 68, 0.35);
  background: rgba(239, 68, 68, 0.06);
}
.settings-danger-title {
  margin: 0 0 8px;
  font-size: 14px;
  font-weight: 700;
  color: #fca5a5;
}
.settings-danger-lead {
  margin: 0 0 10px;
  font-size: 13px;
  line-height: 1.45;
}
.settings-danger-list {
  margin: 0 0 12px 18px;
  padding: 0;
  font-size: 12px;
  line-height: 1.5;
}
.settings-danger-note {
  margin: 0 0 12px;
  font-size: 12px;
}
.btn-danger-outline {
  border: 1px solid rgba(239, 68, 68, 0.55);
  border-radius: 12px;
  padding: 10px 16px;
  font-weight: 600;
  cursor: pointer;
  color: #fca5a5;
  background: transparent;
}
.btn-danger-outline:hover {
  background: rgba(239, 68, 68, 0.12);
}
.btn-danger {
  border: none;
  border-radius: 12px;
  padding: 10px 18px;
  font-weight: 600;
  cursor: pointer;
  color: #fff;
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  margin-top: 12px;
}
.btn-danger:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.user-wipe-modal {
  max-width: 480px;
}
.user-wipe-body {
  padding: 0 22px 22px;
  font-size: 14px;
  line-height: 1.5;
}
.user-wipe-body p { margin: 0 0 10px; }
.user-wipe-warning {
  color: #fca5a5;
  margin: 12px 0 !important;
}
.user-wipe-check {
  margin: 12px 0;
}
body.user-wipe-open { overflow: hidden; }

body.compact-ui .decision-block,
body.compact-ui .dash-card {
  padding: 10px 12px;
}
body.compact-ui .bubble.rich {
  padding: 12px 14px;
}

body.profile-open { overflow: hidden; }

/* Main area — only chat scrolls */
.main {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  min-width: 0;
  overflow: hidden;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  margin: 16px 20px 12px;
  padding: 18px 24px;
  border-radius: var(--radius);
  gap: 12px;
}
.topbar-lead {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
}
.topbar-title {
  margin: 0;
  font-size: 21px;
  font-weight: 700;
  background: linear-gradient(135deg, #fff 30%, var(--blue-glow) 70%, var(--orange-bright) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.topbar-sub { margin: 6px 0 0; color: var(--text-muted); font-size: 13px; }
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.market-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: var(--glass-bg-strong);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(10px);
  color: var(--text);
}
.market-pill .dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--orange-bright);
  box-shadow: 0 0 10px var(--orange);
  animation: pulse 2s infinite;
}
@keyframes pulse { 0%,100%{opacity:1; transform:scale(1)} 50%{opacity:.6; transform:scale(.9)} }

.chat-shell {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 0 10px 20px;
  min-height: 0;
  overflow: hidden;
}

.chat {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column-reverse;
  gap: 6px;
  padding: 8px 4px 8px;
  min-height: 0;
  overscroll-behavior: contain;
}

.composer-wrap {
  flex-shrink: 0;
  padding: 14px;
  border-radius: var(--radius);
  margin-top: auto;
}

/* Bubbles */
.bubble { max-width: 98%; }
.bubble.user {
  align-self: flex-end;
  padding: 14px 18px;
  border-radius: 18px 18px 4px 18px;
  font-size: 14px;
  line-height: 1.55;
  background: linear-gradient(135deg, rgba(26, 111, 255, 0.45), rgba(255, 140, 0, 0.35));
  border: 1px solid rgba(255, 255, 255, 0.22);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow-glass), var(--shadow-glow-blue);
}
.bubble.assistant { align-self: flex-start; width: 100%; max-width: 100%; }

.message-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.message-wrap--assistant {
  align-self: flex-start;
  width: 100%;
  max-width: 100%;
}
.message-wrap--assistant .bubble.assistant {
  margin: 0;
}
.message-wrap--user {
  align-self: flex-end;
  max-width: 88%;
  align-items: flex-end;
}
.message-wrap--user .bubble.user {
  margin: 0;
}

.message-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  padding: 0 4px;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transform: translateY(2px);
  transition: opacity 0.18s ease, transform 0.18s ease, max-height 0.18s ease;
}
.message-wrap:hover .message-actions,
.message-wrap:focus-within .message-actions {
  opacity: 1;
  transform: translateY(0);
  max-height: 40px;
  padding: 2px 4px 4px;
  overflow: visible;
}
.message-wrap--user .message-actions {
  justify-content: flex-end;
  padding-right: 2px;
}
@media (hover: none) {
  .message-actions {
    opacity: 1;
    transform: none;
    max-height: 40px;
    padding: 2px 4px 4px;
    overflow: visible;
  }
}

.msg-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}
.msg-action-btn svg { flex-shrink: 0; opacity: 0.85; }
.msg-action-btn:hover {
  color: var(--text);
  background: var(--glass-bg-strong);
  border-color: var(--glass-border-soft);
}
.msg-action-btn.msg-action-done {
  color: var(--orange-bright);
  border-color: rgba(255, 179, 71, 0.35);
}

.loading-bubble { opacity: 0.85; }
.loading-bubble .muted { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

.welcome-card,
.ai-intro,
.dash-card,
.metric-card {
  background: var(--glass-bg-strong);
  backdrop-filter: var(--blur) saturate(150%);
  -webkit-backdrop-filter: var(--blur) saturate(150%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-glass), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.welcome-card { padding: 26px; }
.welcome-card h2 {
  margin: 0 0 10px;
  font-size: 22px;
  background: linear-gradient(90deg, #fff, var(--orange-bright));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.welcome-card p, .welcome-card ul { color: var(--text-muted); margin: 0 0 10px; }
.welcome-card ul { padding-left: 20px; }

/* Advisory dashboard */
.advisory-dashboard { display: flex; flex-direction: column; gap: 16px; }
.ai-intro {
  padding: 16px 24px 18px 24px;
  font-size: 15px;
  line-height: 1.65;
  width: 100%;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.ai-intro > *:first-child { margin-top: 0; }
.ai-intro > *:last-child { margin-bottom: 0; }
.ai-intro ul, .ai-intro ol {
  margin: 8px 0 0;
  padding-left: 1.4em;
}

.decision-card.structured-answer {
  padding: 18px 22px;
  margin-bottom: 14px;
  border-left: 3px solid var(--orange);
}
.decision-card .decision-title {
  margin: 0 0 14px;
  font-size: 17px;
  font-weight: 700;
  color: #fff;
}
.decision-block {
  margin-bottom: 14px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-muted);
}
.decision-block strong { color: var(--text); }
.decision-block ul, .decision-block ol { margin: 8px 0 0; padding-left: 20px; }
.decision-risk { font-size: 12px; opacity: 0.85; border-top: 1px solid var(--glass-border-soft); padding-top: 10px; }
.decision-result p { margin: 6px 0 0; color: var(--text); font-weight: 600; }

.narrative-table {
  width: 100%;
  border-collapse: collapse;
  margin: 10px 0 14px;
  font-size: 14px;
}
.narrative-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--glass-border-soft);
  color: var(--text-muted);
}
.narrative-table tr:first-child td {
  color: var(--text);
  font-weight: 600;
}

.dash-card { padding: 22px; }
.dash-card h3 {
  margin: 0 0 16px;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
}
.dash-card h3::before {
  content: '';
  width: 4px; height: 16px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--blue-bright), var(--orange));
}

.plan-grid {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 24px;
  align-items: center;
}
.donut-wrap { position: relative; width: 180px; height: 180px; margin: 0 auto; }
.donut { width: 100%; height: 100%; border-radius: 50%; box-shadow: var(--shadow-glow-blue); }
.donut-center {
  position: absolute;
  inset: 28%;
  background: rgba(10, 22, 40, 0.9);
  border: 1px solid var(--glass-border);
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(8px);
}
.donut-total { font-size: 14px; font-weight: 800; color: var(--orange-bright); }
.donut-label { font-size: 10px; color: var(--text-muted); }

.alloc-row {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--glass-border-soft);
}
.alloc-row:last-child { border-bottom: 0; }
.alloc-dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 5px; flex-shrink: 0; }
.alloc-meta { display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.alloc-meta span { color: var(--text-muted); font-size: 12px; }

.info-banner {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: 12px;
  font-size: 13px;
  background: linear-gradient(135deg, var(--blue-glass), var(--orange-glass));
  border: 1px solid rgba(26, 111, 255, 0.3);
  color: var(--text);
}

.warning-banner {
  margin-bottom: 14px;
  padding: 14px 16px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  background: linear-gradient(135deg, rgba(255, 140, 0, 0.18), rgba(255, 80, 0, 0.08));
  border: 1px solid rgba(255, 140, 0, 0.45);
  color: var(--orange-bright);
  box-shadow: var(--shadow-glow-orange);
}

.goal-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  margin: 12px 0;
  font-size: 13px;
  color: var(--text-muted);
}

.reality-check {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 13px;
  background: rgba(10, 22, 40, 0.55);
  border: 1px solid var(--glass-border-soft);
  color: var(--text);
}

.scenario-note {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.scenario-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.scenario-card {
  padding: 16px;
  text-align: center;
  border-radius: 14px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border-soft);
  backdrop-filter: blur(10px);
  transition: transform 0.2s, box-shadow 0.2s;
}
.scenario-card:hover { transform: translateY(-2px); }
.scenario-card.highlight {
  border-color: rgba(255, 140, 0, 0.45);
  background: linear-gradient(145deg, var(--orange-glass), var(--blue-glass));
  box-shadow: var(--shadow-glow-orange);
}
.scenario-label { font-weight: 700; font-size: 13px; }
.scenario-sub { font-size: 11px; color: var(--text-muted); margin: 4px 0 8px; }
.scenario-value {
  font-size: 18px;
  font-weight: 800;
  background: linear-gradient(90deg, var(--blue-glow), var(--orange-bright));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.scenario-comparison-table {
  width: 100%;
  border-collapse: collapse;
  margin: 10px 0 12px;
  font-size: 13px;
}
.scenario-comparison-table th,
.scenario-comparison-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--glass-border-soft);
  text-align: left;
}
.scenario-comparison-table th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}
.scenario-comparison-table td.pos { color: var(--green-bright, #3dd68c); font-weight: 600; }
.scenario-comparison-table td.neg { color: var(--orange-bright, #ff9f43); font-weight: 600; }
.scenario-narratives {
  margin: 0 0 8px;
  padding-left: 18px;
  font-size: 12px;
  color: var(--text-muted);
}
.scenario-comparison-meta { font-size: 11px; color: var(--text-muted); margin: 4px 0 8px; }
.scenario-comparison-note { font-size: 11px; color: var(--text-muted); margin-top: 8px; }

.definition-layout { gap: 16px; }
.definition-hero {
  padding: 20px 22px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.14), rgba(34, 197, 94, 0.08));
  border: 1px solid var(--glass-border-soft);
}
.definition-badge,
.definition-badge-inline {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--blue-glow, #818cf8);
  margin-bottom: 8px;
}
.definition-hero h3 { margin: 0 0 10px; font-size: 1.35rem; }
.definition-lead,
.definition-lead-inline {
  margin: 0;
  font-size: 15px;
  line-height: 1.55;
  color: var(--text-primary, #e8eaed);
}
.definition-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.def-card {
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border-soft);
}
.def-card-warn { border-color: rgba(245, 158, 11, 0.35); }
.def-card-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.def-card h4 { margin: 0; font-size: 13px; }
.def-card p { margin: 0; font-size: 13px; line-height: 1.5; color: var(--text-muted); }
.def-icon { font-size: 14px; }
.definition-mini-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}
.def-mini {
  padding: 10px;
  border-radius: 10px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--glass-border-soft);
}
.def-mini p { margin: 4px 0 0; font-size: 12px; color: var(--text-muted); }
.definition-concept { margin: 4px 0 8px; }

.risk-footer {
  display: flex;
  gap: 20px;
  margin-top: 14px;
  font-size: 12px;
  color: var(--text-muted);
}

.opp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.opp-card {
  padding: 14px;
  border-radius: 14px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border-soft);
  backdrop-filter: blur(10px);
}
.opp-head { display: flex; justify-content: space-between; }
.opp-head .up { color: #4ade80; font-weight: 700; font-size: 12px; }
.opp-head .down { color: #f87171; font-weight: 700; font-size: 12px; }
.opp-price { font-size: 18px; font-weight: 800; margin: 8px 0 4px; }
.opp-note { font-size: 11px; color: var(--text-muted); }

.edu-banner {
  padding: 18px 22px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.12), rgba(255, 140, 0, 0.08));
  border: 1px solid var(--glass-border-soft);
  margin-bottom: 16px;
}
.edu-banner h3 { margin: 0 0 8px; font-size: 14px; color: var(--orange-bright); }
.edu-banner p { margin: 0; font-size: 14px; line-height: 1.65; color: var(--text-muted); }

.edu-highlight { border-left: 3px solid var(--blue-bright); }

.card-sub { margin: 0 0 14px; font-size: 13px; line-height: 1.5; }
.alloc-purpose { display: block; font-size: 11px; color: var(--text-muted); margin-top: 2px; }

.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.theme-card {
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border-soft);
}
.theme-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; margin-bottom: 8px; }
.risk-tag {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(255, 140, 0, 0.15);
  color: var(--orange-bright);
  white-space: nowrap;
}
.theme-note { margin: 0 0 10px; font-size: 12px; line-height: 1.55; color: var(--text-muted); }
.theme-etfs { display: flex; flex-direction: column; gap: 6px; font-size: 11px; }
.etf-chip {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 8px;
  background: rgba(99, 102, 241, 0.12);
  color: #c7d2fe;
  margin-top: 4px;
}

.risk-questions li { margin-bottom: 6px; }

.closing-offer {
  padding: 16px 20px;
  margin: 16px 0;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  background: var(--orange-glass);
  border: 1px solid rgba(255, 140, 0, 0.25);
}

.trust-card { border-left: 3px solid var(--blue-bright); }
.confidence-row { display: grid; grid-template-columns: 140px 1fr; gap: 16px; align-items: start; }
.confidence-meter {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px;
  border-radius: 14px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border-soft);
}
.confidence-meter[data-level="high"] .conf-value { color: #4ade80; }
.confidence-meter[data-level="moderate"] .conf-value { color: var(--orange-bright); }
.confidence-meter[data-level="low"] .conf-value { color: #f87171; }
.conf-value { font-size: 28px; font-weight: 800; }
.conf-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; }
.confidence-meta .metric-row { padding: 6px 0; }
.compliance-blocker {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(248, 113, 113, 0.12);
  border: 1px solid rgba(248, 113, 113, 0.35);
  font-size: 13px;
}
.compliance-warn {
  margin-top: 8px;
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(255, 140, 0, 0.1);
  border: 1px solid rgba(255, 140, 0, 0.25);
  font-size: 12px;
}
.mifid { margin-top: 10px; font-size: 12px; }

.signal-card { border-left: 3px solid #4ade80; }

.feedback-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.feedback-btn {
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid var(--glass-border-soft);
  background: var(--glass-bg);
  color: var(--text);
  font-size: 12px;
  cursor: pointer;
  transition: border-color 0.2s;
}
.feedback-btn:hover { border-color: var(--blue-bright); }
.feedback-btn.muted-btn { opacity: 0.85; }
.feedback-status { margin-top: 10px; font-size: 12px; }

.aurin-lockin {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 140, 0, 0.08);
  border: 1px solid rgba(255, 140, 0, 0.28);
  max-width: 520px;
}
.aurin-name {
  margin: 0 0 4px;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--orange-bright);
}
.aurin-keep, .aurin-question, .aurin-note {
  margin: 0 0 8px;
  font-size: 13px;
  line-height: 1.45;
}
.aurin-keep-label { color: var(--text-muted); margin-right: 4px; }
.aurin-controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.aurin-guide {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 0 0 10px;
}
.aurin-face {
  flex: 0 0 auto;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid #2b241c;
  background: #ffd7b0;
  box-shadow: 0 3px 0 #1c2b4a;
  animation: aurin-in 0.35s ease;
}
.aurin-face svg { width: 100%; height: 100%; display: block; }
.aurin-speech {
  margin: 0;
  padding: 8px 10px;
  border-radius: 4px 12px 12px 12px;
  background: rgba(255, 140, 0, 0.1);
  border: 1px solid rgba(255, 140, 0, 0.28);
  font-size: 13px;
  line-height: 1.45;
}
.aurin-speech .aurin-name {
  display: block;
  margin: 0 0 2px;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--orange-bright);
}
@keyframes aurin-in {
  from { transform: translateY(6px); opacity: 0; }
  to { transform: none; opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .aurin-face { animation: none; }
}
.aurin-choice, .aurin-submit, .chat-game button {
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--glass-border-soft);
  background: var(--glass-bg);
  color: var(--text);
  cursor: pointer;
}
.chat-game {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(47, 95, 224, 0.08);
  border: 1px solid rgba(47, 95, 224, 0.28);
  max-width: 520px;
}
.chat-game-note, .chat-game-line, .chat-game-answer, .chat-game-result {
  margin: 0 0 8px;
  font-size: 13px;
  line-height: 1.45;
}
.chat-game form, .chat-game label {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}
.chat-game input[type="number"], .chat-game input[type="range"] {
  max-width: 120px;
}
.aurin-choice:hover, .aurin-submit:hover { border-color: var(--orange-bright); }
.aurin-input {
  flex: 1;
  min-width: 140px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--glass-border-soft);
  background: rgba(0, 0, 0, 0.25);
  color: var(--text);
  font-size: 13px;
}
.aurin-chip {
  display: inline-block;
  margin: 0;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(74, 222, 128, 0.12);
  border: 1px solid rgba(74, 222, 128, 0.35);
  color: #bbf7d0;
  font-size: 12px;
}

.guide-dashboard.concise .guide-answer { font-size: 15px; line-height: 1.65; margin: 0; }
.roadmap-list { margin: 0; padding-left: 20px; font-size: 14px; line-height: 1.7; }
.roadmap-list li { margin-bottom: 10px; }
.broker-grid { display: flex; flex-direction: column; gap: 10px; }
.broker-row {
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border-soft);
}
.broker-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 4px; }
.compact-link { margin-top: 8px; padding: 8px 12px !important; font-size: 12px; }

.bottom-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.check-list { margin: 0; padding-left: 18px; font-size: 13px; line-height: 1.75; color: var(--text-muted); }

.action-grid { display: flex; flex-direction: column; gap: 8px; }
.action-btn {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 12px 14px;
  border-radius: 12px;
  text-decoration: none;
  color: var(--text);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border-soft);
  transition: all 0.2s;
}
.action-btn:hover {
  border-color: rgba(255, 140, 0, 0.4);
  background: var(--orange-glass);
  box-shadow: var(--shadow-glow-orange);
}
.action-platform { font-weight: 700; font-size: 13px; color: var(--orange-bright); }
.action-desc { font-size: 11px; color: var(--text-muted); }

.metric-card { padding: 20px; max-width: 420px; }
.metric-card h3 { margin: 0 0 12px; font-size: 15px; color: #fff; }
.metric-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--glass-border-soft);
  font-size: 13px;
}
.metric-row span { color: var(--text-muted); }
.metric-card.accent-green { border-left: 3px solid #4ade80; }
.metric-card.accent-red { border-left: 3px solid #f87171; }
.metric-card.accent-blue { border-left: 3px solid var(--blue-bright); }

.metric-with-chart { display: flex; flex-direction: column; gap: 14px; max-width: 100%; }
.chart-card { margin-top: 4px; }
.finai-chart-wrap {
  border-radius: 12px;
  overflow: hidden;
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid var(--glass-border-soft);
}
.finai-chart {
  width: 100%;
  min-height: 200px;
}
.finai-chart-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 13px;
  min-height: 200px;
}
.chart-attribution {
  margin: 0;
  padding: 8px 12px 10px;
  font-size: 11px;
  text-align: right;
  border-top: 1px solid var(--glass-border-soft);
}
.chart-attribution a {
  color: var(--text-muted);
  text-decoration: none;
}
.chart-attribution a:hover { color: var(--blue-bright); }

.news-grid { display: flex; flex-direction: column; gap: 10px; }
.news-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px;
  border-radius: 12px;
  text-decoration: none;
  color: var(--text);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border-soft);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.news-item:hover {
  border-color: var(--blue-bright);
  box-shadow: 0 0 0 1px rgba(26, 111, 255, 0.15);
}
.news-provider {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--orange-bright);
  font-weight: 700;
}
.news-headline {
  font-size: 14px;
  line-height: 1.35;
  color: var(--text);
}
.news-desc {
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.news-sentiment-badge {
  margin-left: 6px;
  vertical-align: middle;
  text-transform: none;
  letter-spacing: 0;
}
.finai-news-card {
  border-left: 3px solid var(--blue-bright);
}
.finai-news-card .news-section-title,
.dash-card.finai-news-card .news-section-title {
  color: var(--orange-bright);
  font-weight: 700;
  margin-bottom: 12px;
}

.disclaimer-inline, .disclaimer { font-size: 11px; color: var(--text-muted); line-height: 1.5; }
.error-card {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(248, 113, 113, 0.35);
  color: #fecaca;
  padding: 14px;
  border-radius: 12px;
  backdrop-filter: blur(10px);
}
.muted { color: var(--text-muted); font-size: 13px; }

.query-interpretation {
  margin: 0 0 10px;
  padding: 0 2px;
  font-size: 12px;
  line-height: 1.4;
  opacity: 0.9;
}
.query-interpretation em {
  font-style: italic;
  color: var(--text-muted);
  font-weight: 500;
}

.bubble.assistant pre {
  white-space: pre-wrap;
  margin: 0;
  font-family: inherit;
  font-size: 14px;
  padding: 18px;
  border-radius: var(--radius);
  background: var(--glass-bg-strong);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(12px);
}

/* Composer */
.quick-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.chip {
  border: 1px solid var(--glass-border-soft);
  background: var(--glass-bg);
  color: var(--text-muted);
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 12px;
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: all 0.2s;
}
.chip:hover {
  color: #fff;
  border-color: rgba(255, 140, 0, 0.4);
  background: var(--orange-glass);
  box-shadow: var(--shadow-glow-orange);
}

.composer {
  display: grid;
  grid-template-columns: 118px 1fr 44px 50px;
  gap: 10px;
  align-items: end;
}
.composer-main {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.attachment-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.attachment-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 4px 8px;
  border-radius: 10px;
  border: 1px solid rgba(255, 140, 0, 0.35);
  background: rgba(255, 140, 0, 0.12);
  color: var(--text);
  font-size: 12px;
}
.attachment-chip button {
  border: none;
  background: transparent;
  color: rgba(238, 244, 255, 0.7);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0 2px;
}
.attachment-chip button:hover { color: #fff; }
.btn-attach {
  width: 44px;
  height: 50px;
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  background: rgba(10, 22, 40, 0.5);
  color: var(--text);
  font-size: 18px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.btn-attach:hover {
  border-color: var(--orange);
  background: var(--orange-glass);
}
.mode-select, .input {
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  padding: 13px 15px;
  font-size: 14px;
  background: rgba(10, 22, 40, 0.5);
  color: var(--text);
  backdrop-filter: blur(8px);
}
.mode-select option { background: var(--blue-deep); color: var(--text); }
.input::placeholder { color: rgba(238, 244, 255, 0.35); }
.input:focus, .mode-select:focus {
  outline: none;
  border-color: var(--blue-bright);
  box-shadow: 0 0 0 3px rgba(26, 111, 255, 0.2);
}

.btn-send {
  width: 50px;
  height: 50px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 14px;
  background: linear-gradient(135deg, var(--blue-bright), var(--orange));
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  box-shadow: var(--shadow-glow-blue), var(--shadow-glow-orange);
  transition: transform 0.15s, box-shadow 0.15s;
}
.btn-send:hover:not(:disabled) { transform: scale(1.04); }
.btn-send:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-stop {
  width: 50px;
  height: 50px;
  border: 1px solid rgba(239, 68, 68, 0.45);
  border-radius: 14px;
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
  font-size: 16px;
  cursor: pointer;
  transition: background 0.15s, transform 0.15s;
}
.btn-stop:hover:not(:disabled) {
  background: rgba(239, 68, 68, 0.28);
  transform: scale(1.04);
}
.btn-stop:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-stop[hidden] { display: none; }

.bubble.assistant.stream-stopped .stream-body {
  opacity: 0.92;
}

@media (max-width: 1180px) {
  .app-layout { grid-template-columns: var(--side-w) minmax(0, 1fr); }
  .desk-rail {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(400px, 92vw);
    transform: translateX(110%);
    z-index: 30;
    border-left: 1px solid var(--glass-border);
  }
  body.desk-open .desk-rail { transform: none; }
  .desk-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 25;
    background: rgba(6, 12, 24, 0.55);
  }
  body.desk-open .desk-backdrop { display: block; }
}

@media (max-width: 980px) {
  .app-layout {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
  }

  /* Sidebar as off-canvas drawer — chat fills the viewport */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: auto;
    width: min(300px, 86vw);
    /* Prefer small viewport so profile stays above mobile browser chrome / home bar */
    height: 100%;
    height: -webkit-fill-available;
    height: 100svh;
    max-height: 100svh;
    z-index: 40;
    transform: translateX(-105%);
    transition: transform 0.22s ease;
    padding: 12px 12px;
    padding-top: max(12px, env(safe-area-inset-top, 0px));
    padding-bottom: max(20px, calc(12px + env(safe-area-inset-bottom, 0px)));
    border-right: 1px solid var(--glass-border);
    border-bottom: 0;
    flex-direction: column;
    flex-wrap: nowrap;
    gap: 0;
    overflow: hidden;
    overscroll-behavior: none;
    box-shadow: 8px 0 32px rgba(0, 0, 0, 0.35);
  }
  body.sidebar-open .sidebar,
  .sidebar.is-open {
    transform: translateX(0) !important;
  }

  .sidebar-head {
    flex-shrink: 0;
    margin-bottom: 12px;
  }
  .sidebar .brand-logo { height: 34px; }
  .sidebar-meta { margin-top: 6px; }

  .sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 35;
    background: rgba(6, 12, 24, 0.55);
  }
  body.sidebar-open .sidebar-backdrop {
    display: block;
  }

  .nav-toggle,
  .sidebar-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 40px;
    flex-shrink: 0;
    border-radius: 12px;
    border: 1px solid var(--glass-border-soft);
    background: var(--blue-glass);
    color: var(--text);
    line-height: 1;
    cursor: pointer;
  }
  .nav-toggle {
    width: auto;
    padding: 0 12px;
    font-size: 13px;
  }
  .sidebar-close {
    position: absolute;
    top: 10px;
    right: 8px;
    width: 36px;
    height: 36px;
    margin-left: 0;
    font-size: 16px;
  }

  .main {
    width: 100%;
    min-width: 0;
    height: 100vh;
    height: 100dvh;
  }

  .side-nav { flex-direction: column; flex-wrap: nowrap; flex: none; flex-shrink: 0; width: 100%; }
  .recent-section {
    flex: 1 1 0;
    min-height: 0;
    margin: 10px 0 8px;
    overflow: hidden;
  }
  .profile-card {
    width: 100%;
    flex-shrink: 0;
    margin-top: auto;
    padding: 10px 12px;
  }
  .profile-card .profile-title { margin-bottom: 0; }
  .profile-card .profile-head { margin-bottom: 8px; }
  .profile-card .profile-row { margin-bottom: 4px; }
  .profile-card .profile-user { margin-top: 8px; padding-top: 8px; }
  .plan-grid, .bottom-grid, .scenario-grid { grid-template-columns: 1fr; }
  .definition-grid, .definition-mini-grid { grid-template-columns: 1fr; }

  .topbar {
    margin: 10px 10px 8px;
    margin-top: max(10px, env(safe-area-inset-top));
    padding: 12px 14px;
    gap: 10px;
  }
  .topbar-title { font-size: 16px; line-height: 1.25; }
  .topbar-sub { font-size: 11px; margin-top: 4px; }
  .market-pill { display: none; }
  .chat-shell {
    padding: 0 10px 10px;
    padding-bottom: max(10px, env(safe-area-inset-bottom));
  }
  .composer-wrap {
    padding: 10px;
    padding-bottom: max(10px, env(safe-area-inset-bottom));
  }
  .desk-toggle,
  .copy-chat-btn {
    font-size: 12px;
    padding: 8px 10px;
    white-space: nowrap;
  }
}

@media (max-width: 600px) {
  .composer { grid-template-columns: 1fr 44px 50px; }
  .composer .mode-select { grid-column: 1 / -1; }
  .mode-select { grid-column: 1 / -1; }
  .topbar-sub { display: none; }
  .bubble.user { max-width: 92%; font-size: 13px; }
  .question-input,
  #question,
  .input {
    font-size: 16px; /* avoid iOS zoom on focus */
  }
}

@media (min-width: 981px) {
  .sidebar-backdrop { display: none !important; }
  body.sidebar-open .sidebar { transform: none; }
  body.sidebar-collapsed .app-layout { --side-w: 0px; }
  body.sidebar-collapsed .sidebar {
    visibility: hidden;
    overflow: hidden;
    padding: 0;
    border-width: 0;
    pointer-events: none;
  }
}

/* --- FinAI design system cards (v3.4.1) --- */
.finai-card {
  border: 1px solid var(--glass-border-soft);
  border-radius: var(--radius);
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(12px);
  padding: 16px 18px;
  margin: 12px 0;
}
.finai-card .card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.finai-card .card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}
.finai-card .card-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}
.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.badge-green { background: rgba(34, 197, 94, 0.18); color: #86efac; }
.badge-red { background: rgba(239, 68, 68, 0.18); color: #fca5a5; }
.badge-amber { background: rgba(245, 158, 11, 0.18); color: #fcd34d; }
.badge-blue { background: rgba(59, 130, 246, 0.18); color: #93c5fd; }
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
  margin-top: 12px;
}
.metrics-grid.compact { grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); }
.metric { padding: 8px 10px; border-radius: 10px; background: rgba(255,255,255,0.04); }
.metric-label { font-size: 11px; color: var(--text-muted); }
.metric-value { font-size: 14px; font-weight: 700; margin-top: 2px; }
.market-hero-price {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 8px 0 12px;
  background: linear-gradient(135deg, #fff 20%, var(--blue-glow) 80%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.sim-bars { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; }
.sim-row { display: grid; grid-template-columns: 88px 1fr 88px; gap: 10px; align-items: center; }
.sim-label { font-size: 12px; color: var(--text-muted); }
.sim-track { height: 8px; border-radius: 999px; background: rgba(255,255,255,0.08); overflow: hidden; }
.sim-fill { height: 100%; border-radius: 999px; }
.sim-val { font-size: 12px; font-weight: 600; text-align: right; }

/* Interactive Monte Carlo widget */
.finai-mc-widget { position: relative; }
.finai-mc-widget.mc-loading .mc-fan-host { opacity: 0.55; }
.mc-fan-host { margin: 8px 0 12px; min-height: 200px; }
.finai-mc-fan-chart { width: 100%; height: auto; display: block; }
.mc-fan-band { fill: rgba(99, 102, 241, 0.22); stroke: none; }
.mc-fan-median { stroke: #378add; stroke-width: 2.5; }
.mc-target-line { stroke: #f59e0b; stroke-width: 1.5; stroke-dasharray: 6 4; }
.mc-fan-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 8px;
  font-size: 11px;
  color: var(--text-muted);
}
.mc-legend-item { display: inline-flex; align-items: center; gap: 6px; }
.mc-swatch { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.mc-swatch.band { background: rgba(99, 102, 241, 0.35); }
.mc-swatch.median { background: #378add; }
.mc-swatch.target { background: #f59e0b; }
.mc-controls { display: grid; gap: 12px; margin: 12px 0; }
.mc-control {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
}
.mc-control input[type="range"] { width: 100%; }
.mc-num-input {
  width: 100%;
  border: 1px solid var(--glass-border-soft);
  background: rgba(255,255,255,0.04);
  color: var(--text);
  border-radius: 8px;
  padding: 6px 8px;
}
.mc-target-input::placeholder { color: var(--text-muted); opacity: 0.8; }
.mc-target-note {
  font-size: 11px;
  color: #f59e0b;
}
.mc-risk-fieldset {
  border: 1px solid var(--glass-border-soft);
  border-radius: 10px;
  padding: 8px 10px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.mc-risk-fieldset legend { font-size: 12px; color: var(--text-muted); padding: 0 4px; }
.mc-disclaimer { font-size: 11px; margin-top: 8px; }
.mc-success-wrap { margin-left: auto; }
.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--glass-border-soft);
}
.card-action-btn {
  border: 1px solid var(--glass-border-soft);
  background: rgba(99, 102, 241, 0.12);
  color: var(--text);
  border-radius: 10px;
  padding: 6px 12px;
  font-size: 12px;
  cursor: pointer;
  white-space: normal;
  line-height: 1.35;
  text-align: left;
  max-width: 100%;
}
.card-action-btn:hover { background: rgba(99, 102, 241, 0.22); }
.finai-macro-card .macro-indicators { margin: 8px 0; }
.finai-risk-card .sector-breakdown { margin: 8px 0; }
.finai-steps-card .roadmap-list { margin: 8px 0 0; padding-left: 20px; }
.finai-card-text p { margin: 0; color: var(--text); line-height: 1.5; }
.finai-clarification-card .clarification-questions {
  margin: 12px 0 0;
  padding-left: 20px;
  color: var(--text);
}
.finai-clarification-card .clarification-questions li { margin: 6px 0; }
.finai-error-card .error-detail {
  margin: 8px 0 0;
  color: #fca5a5;
  line-height: 1.45;
}
.finai-fx-card .market-hero-price { margin-bottom: 8px; }

/* Track B — decision intelligence + autonomous monitor */
.finai-di-panel { margin-top: 12px; display: grid; gap: 8px; }
.finai-collapsible {
  border: 1px solid var(--glass-border-soft);
  border-radius: 12px;
  background: var(--glass-bg);
  padding: 8px 12px;
}
.finai-collapsible summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--text);
}
.finai-collapsible-body { margin-top: 8px; color: var(--text-muted); }
.portfolio-score-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
}
.portfolio-score-item {
  padding: 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--glass-border-soft);
}
.portfolio-score-label { font-size: 12px; color: var(--text-muted); }
.portfolio-score-value { font-size: 20px; font-weight: 700; margin-top: 4px; }
.finai-autonomous-monitor { margin-top: 12px; }
.finai-comparison-card .comparison-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}
.finai-comparison-card .comparison-side {
  padding: 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--glass-border-soft);
}
.comparison-side-title {
  font-weight: 700;
  margin-bottom: 8px;
  white-space: normal;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.comparison-dimensions-table {
  width: 100%;
  border-collapse: collapse;
  margin: 10px 0;
  font-size: 13px;
}
.comparison-dimensions-table th,
.comparison-dimensions-table td {
  border: 1px solid var(--glass-border-soft);
  padding: 8px;
  text-align: left;
}
.comparison-verdict {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--blue-glass);
}

.public-demo-banner {
  padding: 10px 16px;
  border-bottom: 1px solid var(--glass-border-soft);
  background: var(--blue-glass);
  color: var(--text);
  font-size: 13px;
  line-height: 1.45;
}

.public-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  align-items: center;
  padding: 8px 16px;
  color: var(--muted);
  font-size: 12px;
}

.public-footer span {
  margin-right: auto;
}

.public-footer a {
  color: var(--text);
}

.legal-page {
  width: min(760px, calc(100% - 32px));
  margin: 32px auto;
  padding: 24px;
  border: 1px solid var(--glass-border-soft);
  border-radius: 14px;
  background: var(--glass);
  color: var(--text);
  line-height: 1.6;
}

.legal-page h1,
.legal-page h2 {
  margin-top: 0;
}

.legal-page h2 {
  margin-top: 24px;
}

.legal-page a {
  color: var(--text);
}

.daily-tools {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
  min-height: 0;
  flex: 1;
}
.desk-rail {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  padding: 16px 14px 18px;
  border-radius: 0;
  border-top: 0;
  border-bottom: 0;
  border-right: 0;
  background: rgba(10, 22, 40, 0.82);
  border-left: 1px solid var(--glass-border-soft);
}
.desk-rail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.desk-rail-sub {
  margin: 0;
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
}
.desk-close,
.desk-toggle,
.copy-chat-btn {
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  background: rgba(26, 111, 255, 0.16);
  border: 1px solid var(--glass-border-soft);
  border-radius: 8px;
  padding: 7px 10px;
  cursor: pointer;
  white-space: nowrap;
}
.copy-chat-btn:hover,
.desk-toggle:hover {
  border-color: var(--glass-border);
  background: rgba(26, 111, 255, 0.24);
}
.desk-backdrop {
  display: none;
}
.plan-card {
  border: 1px solid var(--glass-border-soft);
  border-radius: 12px;
  padding: 10px 12px 12px;
  background: rgba(10, 22, 40, 0.35);
}
.plan-card.is-active {
  border-color: rgba(26, 111, 255, 0.75);
  background: rgba(26, 111, 255, 0.14);
  opacity: 1;
}
.plan-card.is-quiet {
  opacity: 1;
}
.plan-purpose {
  margin: 0 0 8px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-muted);
}
.plan-group-label {
  margin: 4px 0 6px;
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
}
#planCardMix {
  background: rgba(255, 255, 255, 0.045);
}
#planCardToday {
  background: transparent;
}
.plan-today-plain {
  margin: 0 0 6px;
  font-size: 14px;
  line-height: 1.4;
  color: var(--text);
}
#planCardToday .plan-card-line {
  display: inline-block;
  margin: 0;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--glass-border-soft);
  font-size: 11px;
  color: var(--text-muted);
}
.plan-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(88px, 1fr));
  gap: 6px;
  margin: 0 0 8px;
}
.plan-stat {
  min-width: 0;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid var(--glass-border-soft);
  background: rgba(255, 255, 255, 0.04);
}
.plan-stat span {
  display: block;
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.plan-stat strong {
  display: block;
  margin-top: 2px;
  font-size: 13px;
  font-weight: 600;
  overflow-wrap: anywhere;
}
.plan-holdings,
.plan-notes {
  list-style: none;
  margin: 0 0 8px;
  padding: 0;
}
.plan-holding {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 2px 8px;
  padding: 7px 0;
  border-bottom: 1px solid var(--glass-border-soft);
}
.plan-holding-id {
  display: flex;
  gap: 6px;
  align-items: baseline;
  min-width: 0;
}
.plan-holding-id strong { font-size: 13px; }
.plan-holding-w { font-size: 11px; color: var(--text-muted); }
.plan-holding-name {
  grid-column: 1 / -1;
  font-size: 11px;
  line-height: 1.35;
  color: var(--text-muted);
}
.plan-holding-px {
  font-size: 12px;
  text-align: right;
  white-space: nowrap;
}
.plan-chg.down { color: #e07a5f; }
.plan-chg.up { color: #8fbfa8; }
.plan-note,
.plan-notes li {
  margin: 0 0 6px;
  font-size: 12px;
  line-height: 1.4;
  color: var(--text-muted);
}
.desk-plan-body .plan-group-label {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--glass-border-soft);
}
.daily-form .plan-group-label:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}
.daily-form button[type="submit"] {
  font-weight: 600;
  padding: 9px 10px;
  cursor: pointer;
  background: rgba(26, 111, 255, 0.22);
}
.desk-plan-body ul {
  margin: 0 0 8px;
  padding-left: 16px;
}
.desk-plan-body li { margin: 0 0 4px; }
.chat-game-title {
  margin: 0 0 8px;
  font-size: 15px;
  line-height: 1.2;
  color: var(--text);
}
.chat-game form {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}
.chat-game form label {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  margin: 0;
  font-size: 12px;
  color: var(--text-muted);
}
.chat-game form input,
.chat-game form button,
.chat-game > button {
  font: inherit;
  font-size: 13px;
}
.chat-game form input[type="number"],
.chat-game form input[type="text"] {
  width: 100%;
  max-width: none;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--glass-border-soft);
  background: rgba(0, 0, 0, 0.25);
  color: var(--text);
}
.chat-game-why {
  margin: 0 0 8px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--text-muted);
}
.chat-game-step {
  margin: 2px 0 6px;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--orange-bright);
}
.answer-covered {
  position: relative;
  min-height: 84px;
  padding: 28px 16px 16px;
  border-radius: 14px;
  border: 1px solid rgba(255, 180, 90, 0.35);
  background: linear-gradient(180deg, rgba(28, 40, 78, 0.96), rgba(14, 20, 42, 0.98));
  box-shadow: inset 0 0 0 7px rgba(255, 160, 60, 0.06);
}
.answer-covered::before {
  content: "";
  position: absolute;
  top: 10px;
  left: 50%;
  width: 16px;
  height: 16px;
  margin-left: -8px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #ffb15a, #c45a12 72%);
  box-shadow: 0 0 0 4px rgba(255, 140, 0, 0.16);
}
.answer-covered-note {
  margin: 8px 0 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}
.answer-covered.is-opening {
  animation: letter-open 0.28s ease forwards;
}
@keyframes letter-open {
  to { transform: translateY(-8px); opacity: 0; }
}
.aurin-face .mood-placed,
.aurin-face .mood-wrong,
.aurin-face .mood-open { opacity: 0; }
.aurin-guide[data-mood="placed"] .mood-idle,
.aurin-guide[data-mood="wrong"] .mood-idle,
.aurin-guide[data-mood="open"] .mood-idle { opacity: 0; }
.aurin-guide[data-mood="placed"] .mood-placed,
.aurin-guide[data-mood="wrong"] .mood-wrong,
.aurin-guide[data-mood="open"] .mood-open { opacity: 1; }
.puzzle-tray,
.puzzle-bank {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0 0 8px;
}
.puzzle-tray {
  min-height: 64px;
  padding: 8px;
  border-radius: 10px;
  border: 1px dashed rgba(255, 140, 0, 0.55);
}
.puzzle-tray:empty::before {
  content: "Place it here";
  color: var(--text-muted);
  font-size: 12px;
}
.puzzle-tray[data-hint]:empty::before { content: attr(data-hint); }
.puzzle-tray.is-hot {
  border-style: solid;
  background: rgba(255, 140, 0, 0.08);
}
.puzzle-tray.is-shaking { animation: tray-shake 0.28s ease; }
@keyframes tray-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}
.chat-game.is-wrong .puzzle-tray { border-color: #e07a5f; }
.puzzle-tile.is-set { animation: tile-set 0.18s ease; }
@keyframes tile-set {
  from { transform: translateY(-6px); }
  to { transform: none; }
}
.puzzle-tile.is-dragging { opacity: 0.35; }
.puzzle-ghost {
  position: fixed;
  z-index: 80;
  margin: 0;
  pointer-events: none;
  transform: rotate(-2deg);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
}
.chat-game[data-game="fee"] .puzzle-tile,
.chat-game[data-game="inflation"] .puzzle-tile {
  background:
    linear-gradient(90deg, rgba(255, 176, 90, 0.22), transparent 14px),
    rgba(255, 255, 255, 0.05);
}
.chat-game[data-game="puzzle"] .puzzle-tray,
.chat-game[data-game="city"] .puzzle-tray { counter-reset: piece; }
.chat-game[data-game="puzzle"] .puzzle-tray .puzzle-tile,
.chat-game[data-game="city"] .puzzle-tray .puzzle-tile {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}
.chat-game[data-game="puzzle"] .puzzle-tray .puzzle-tile::before,
.chat-game[data-game="city"] .puzzle-tray .puzzle-tile::before {
  counter-increment: piece;
  content: counter(piece);
  flex: 0 0 auto;
  width: 1.4em;
  height: 1.4em;
  border-radius: 50%;
  background: rgba(255, 140, 0, 0.22);
  color: var(--orange-bright);
  font-size: 12px;
  line-height: 1.4em;
  text-align: center;
}
.chat-game[data-game="call"] .puzzle-tile[data-dir="higher"]::before { content: "↑ "; }
.chat-game[data-game="call"] .puzzle-tile[data-dir="flat"]::before { content: "– "; }
.chat-game[data-game="call"] .puzzle-tile[data-dir="lower"]::before { content: "↓ "; }
.puzzle-tile {
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--glass-border-soft);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  line-height: 1.4;
}
.puzzle-tile:hover { border-color: rgba(255, 140, 0, 0.55); }
.puzzle-rank {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(48px, 1fr) auto;
  gap: 8px;
  align-items: center;
  font-size: 13px;
}
.puzzle-bar {
  height: 8px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}
.puzzle-bar i {
  display: block;
  height: 100%;
  background: var(--blue-bright);
}
.chat-game form button,
.chat-game > button.chat-scene-start,
.chat-game > button.chat-city-load,
.chat-game > button.chat-quest-save,
.chat-game > button.chat-call-start,
.chat-game > button.puzzle-lock,
.chat-game button.puzzle-lock {
  width: 100%;
  padding: 10px 12px;
  font-weight: 600;
  background: rgba(26, 111, 255, 0.22);
  border: 1px solid transparent;
}
.chat-game button.puzzle-lock:not(:disabled),
.chat-game .chat-call-lock:not(:disabled) {
  background: rgba(255, 140, 0, 0.28);
  border-color: rgba(255, 180, 90, 0.7);
}
@media (prefers-reduced-motion: reduce) {
  .puzzle-tile.is-set,
  .puzzle-tray.is-shaking,
  .answer-covered.is-opening,
  .chat-game .puzzle-tile:hover,
  .answer-covered.is-inking::before { animation: none; transform: none; }
}
.chat-game {
  padding: 14px 14px 16px;
  border-radius: 22px;
  background: #f6f0e4;
  color: #2b241c;
  border: 3px solid #2b241c;
  box-shadow: 0 6px 0 #1c2b4a;
}
.chat-game-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 8px;
  font-size: 18px;
  font-weight: 800;
  color: #2b241c;
}
.chat-game-title::before {
  content: "";
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border-radius: 12px;
  border: 2.5px solid #2b241c;
  box-shadow: 0 3px 0 #2b241c;
  background: #ffd15c center / 22px no-repeat;
}
.chat-game[data-game="fee"] .chat-game-title::before {
  background-color: #ffd15c;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Ccircle cx='16' cy='18' r='8' fill='%23fff' stroke='%232b241c' stroke-width='2'/%3E%3Cpath d='M11 11l2 4 3-4 3 4 2-4' fill='none' stroke='%232b241c' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
.chat-game[data-game="inflation"] .chat-game-title::before {
  background-color: #c9b6ff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath d='M8 14c0-6 16-6 16 2v10H8V14z' fill='%23fff' stroke='%232b241c' stroke-width='2'/%3E%3Ccircle cx='13' cy='18' r='1.4' fill='%232b241c'/%3E%3Ccircle cx='19' cy='18' r='1.4' fill='%232b241c'/%3E%3Cpath d='M13 22c1.4 1.4 4.6 1.4 6 0' fill='none' stroke='%232b241c' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E");
}
.chat-game[data-game="call"] .chat-game-title::before {
  background-color: #7ad1ff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath d='M8 8h12l4 4v12H8z' fill='%23fff' stroke='%232b241c' stroke-width='2'/%3E%3Cpath d='M16 14v8M12 18h8' fill='none' stroke='%232b241c' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E");
}
.chat-game[data-game="impulse"] .chat-game-title::before {
  background-color: #ff8b7a;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath d='M16 6l8 4v7c0 5-3.4 8-8 9-4.6-1-8-4-8-9V10z' fill='%23fff' stroke='%232b241c' stroke-width='2'/%3E%3C/svg%3E");
}
.chat-game[data-game="flaw"] .chat-game-title::before {
  background-color: #ffd15c;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Ccircle cx='14' cy='14' r='6' fill='%23fff' stroke='%232b241c' stroke-width='2'/%3E%3Cpath d='M18 18l6 6' stroke='%232b241c' stroke-width='2.4' stroke-linecap='round'/%3E%3C/svg%3E");
}
.chat-game[data-game="advisor"] .chat-game-title::before {
  background-color: #9be37a;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath d='M7 9h14v10H12l-5 4V9z' fill='%23fff' stroke='%232b241c' stroke-width='2'/%3E%3C/svg%3E");
}
.chat-game[data-game="city"] .chat-game-title::before,
.chat-game[data-game="puzzle"] .chat-game-title::before {
  background-color: #7ad1ff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath d='M7 22V12h5v10M14 22V8h6v14M22 22v-6h4v6' fill='%23fff' stroke='%232b241c' stroke-width='2'/%3E%3C/svg%3E");
}
.chat-game[data-game="quest"] .chat-game-title::before,
.chat-game[data-game="cards"] .chat-game-title::before,
.chat-game[data-game="ask"] .chat-game-title::before {
  background-color: #ffb0d0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath d='M16 7l2.2 5.2L24 15l-5.8 2.2L16 23l-2.2-5.8L8 15l5.8-2.8z' fill='%23fff' stroke='%232b241c' stroke-width='1.8'/%3E%3C/svg%3E");
}
.chat-game .chat-game-why,
.chat-game .chat-game-note,
.chat-game .chat-game-line,
.chat-game label,
.chat-game .aurin-keep,
.chat-game .aurin-question {
  color: #3b3228;
}
.chat-game .chat-game-step {
  display: inline-block;
  margin: 2px 0 8px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #2b241c;
  color: #ffd15c;
  font-weight: 800;
}
.chat-game .aurin-face {
  width: 68px;
  height: 68px;
  border: 3px solid #2b241c;
  box-shadow: 0 3px 0 #2b241c;
  background: #ffd7b0;
}
.chat-game .aurin-speech {
  position: relative;
  background: #fff;
  color: #2b241c;
  border: 2.5px solid #2b241c;
  border-radius: 18px;
  box-shadow: 0 3px 0 #2b241c;
}
.chat-game .aurin-speech::before,
.chat-game .aurin-speech::after {
  content: "";
  position: absolute;
  left: -11px;
  top: 18px;
  border-width: 7px 11px 7px 0;
  border-style: solid;
  border-color: transparent #2b241c transparent transparent;
}
.chat-game .aurin-speech::after {
  left: -7px;
  border-color: transparent #fff transparent transparent;
}
.chat-game .aurin-name { color: #e07a12; }
.chat-game .puzzle-tray {
  min-height: 78px;
  border-radius: 18px;
  border: 3px dashed #2b241c;
  background: #fff8ea;
}
.chat-game .puzzle-tray:empty::before {
  color: #8a7360;
  font-weight: 800;
}
.chat-game .puzzle-tray.is-hot {
  background: #ffe7a3;
  border-style: solid;
}
.chat-game .puzzle-tile {
  border: 2.5px solid #2b241c;
  border-radius: 16px;
  background: #fff;
  color: #2b241c;
  font-weight: 800;
  box-shadow: 0 4px 0 #2b241c;
}
.chat-game .puzzle-tile:hover {
  transform: translateY(-2px);
  border-color: #2b241c;
}
.chat-game .puzzle-tile:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #2b241c;
}
.chat-game[data-game="fee"] .puzzle-tile,
.chat-game[data-game="inflation"] .puzzle-tile {
  background: linear-gradient(90deg, #ffe08a 0 12px, #fff 12px);
}
.chat-game form input[type="number"],
.chat-game form input[type="text"],
.chat-game input[type="text"] {
  border: 2.5px solid #2b241c;
  border-radius: 14px;
  background: #fff;
  color: #2b241c;
  font-weight: 700;
}
.chat-game form button,
.chat-game > button.chat-scene-start,
.chat-game > button.chat-city-load,
.chat-game > button.chat-quest-save,
.chat-game > button.chat-call-start,
.chat-game > button.puzzle-lock,
.chat-game button.puzzle-lock,
.chat-game .chat-call-lock {
  border: 3px solid #2b241c;
  border-radius: 16px;
  background: #1cb0f6;
  color: #fff;
  font-weight: 800;
  box-shadow: 0 4px 0 #0b7eb8;
}
.chat-game button.puzzle-lock:disabled,
.chat-game .chat-call-lock:disabled {
  background: #e6dfd2;
  color: #8d7d6c;
  border-color: #c9bfb0;
  box-shadow: none;
}
.chat-game button.puzzle-lock,
.chat-game .chat-call-lock {
  display: none;
}
.chat-game.is-inking .puzzle-tray {
  background: #ffe7a3;
  border-style: solid;
}
.answer-covered.is-inking::before {
  animation: seal-wobble 0.18s ease-in-out infinite;
}
@keyframes seal-wobble {
  50% { transform: rotate(-10deg) scale(1.12); }
}
.chat-game .chat-game-result {
  border: 2.5px solid #2b241c;
  border-radius: 14px;
  background: #e7f8d4;
  color: #23400f;
  font-weight: 700;
}
.answer-covered {
  border-radius: 20px;
  border: 3px solid #2b241c;
  background: #f6e7c1;
  box-shadow: 0 5px 0 #1c2b4a;
}
.answer-covered::before {
  width: 26px;
  height: 26px;
  margin-left: -13px;
  border: 2.5px solid #2b241c;
  background: radial-gradient(circle at 35% 35%, #ff8d7a, #d64545 70%);
  box-shadow: 0 2px 0 #2b241c;
}
.answer-covered-note {
  color: #5c4630;
  font-weight: 800;
}
.chat-scene-choices,
.chat-fee-choices,
.chat-call-dirs {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0 0 8px;
}
.chat-call-dirs {
  flex-direction: row;
}
.chat-call-dirs button {
  flex: 1;
  text-align: center;
}
.chat-scene-choices button,
.chat-fee-choices button,
.chat-call-dirs button {
  width: 100%;
  min-height: 40px;
  text-align: left;
}
.chat-call-dirs button { text-align: center; }
.chat-game-result {
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--glass-border-soft);
  background: rgba(26, 111, 255, 0.1);
}
.chat-game > label {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  margin: 0 0 6px;
  font-size: 13px;
}
.plan-card-line,
.plan-card-state,
.plan-card-meta {
  margin: 0 0 8px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--text);
}
.plan-card-state {
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.plan-card-meta {
  font-size: 12px;
  color: var(--text-muted);
}
.plan-set {
  list-style: none;
  margin: 0 0 8px;
  padding: 0;
  font-size: 13px;
}
.plan-set li { margin: 0 0 4px; }
.plan-set-label {
  margin-right: 6px;
  color: var(--text-muted);
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.plan-fill {
  height: 6px;
  margin: 0 0 8px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}
.plan-fill span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--blue-bright, #1a6fff);
}
.plan-card[data-spend-state="over"] .plan-fill span {
  background: #e07a5f;
}
.plan-card[data-spend-state="at_the_line"] .plan-fill span {
  background: #e0b15f;
}
.desk-block h3 {
  margin: 0 0 4px;
  font-size: 15px;
  letter-spacing: 0;
  text-transform: none;
  color: var(--text);
}
.desk-hint {
  margin: 0 0 8px;
  font-size: 11px;
  line-height: 1.4;
  color: var(--text-muted);
}
.desk-plan-body {
  font-size: 12px;
  line-height: 1.45;
  color: var(--text);
  margin-bottom: 8px;
}
.desk-plan-body p { margin: 0 0 6px; }
.desk-plan-body p[data-desk-drift] { color: var(--text); }
.desk-plan-body ul {
  margin: 0 0 8px;
  padding-left: 16px;
}
.desk-plan-body a { color: var(--text); }
.desk-empty { color: var(--text-muted); }
.desk-field {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 11px;
  color: var(--text-muted);
}
.desk-result {
  margin: 0;
  font-size: 12px;
  line-height: 1.45;
  color: var(--text);
  padding: 8px;
  border-radius: 8px;
  border: 1px solid var(--glass-border-soft);
  background: rgba(26, 111, 255, 0.1);
}
.desk-result.is-blocked {
  background: rgba(180, 60, 60, 0.16);
}
.desk-ask {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.desk-ask .chip {
  font-size: 11px;
}
.desk-block .nav-item {
  width: 100%;
  justify-content: center;
  background: var(--blue-glass);
  border-color: var(--glass-border-soft);
  color: var(--text);
}
@media (min-width: 1181px) {
  .desk-backdrop { display: none !important; }
  body.desk-collapsed .app-layout { --desk-w: 0px; }
  body.desk-collapsed .desk-rail {
    visibility: hidden;
    overflow: hidden;
    padding: 0;
    border-width: 0;
    pointer-events: none;
  }
}
.pane-resize {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 10px;
  z-index: 6;
  cursor: col-resize;
  touch-action: none;
  background: transparent;
}
.pane-resize:hover,
.pane-resize.is-dragging {
  background: rgba(26, 111, 255, 0.45);
}
.pane-resize-side { right: 0; }
.pane-resize-desk { left: 0; }
@media (max-width: 980px) {
  .pane-resize-side { display: none; }
}
@media (max-width: 1180px) {
  .desk-rail { position: fixed; }
  .pane-resize-desk { display: none; }
}
.daily-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0 0 8px;
}
.daily-form input,
.daily-form select,
.daily-form button {
  font: inherit;
  font-size: 12px;
  border-radius: 8px;
  border: 1px solid var(--glass-border-soft);
  background: rgba(10, 22, 40, 0.55);
  color: var(--text);
  padding: 7px 8px;
}
.daily-form-row {
  display: flex;
  gap: 6px;
}
.daily-form-row select,
.daily-form-row button {
  flex: 1;
}
.cooling-ticket-list {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  font-size: 11px;
  color: var(--text-muted);
}
.cooling-ticket-list li {
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.cooling-ticket-list button {
  flex: 0 0 auto;
  padding: 4px 8px;
  font-size: 11px;
}
.morning-brief-strip {
  margin: 0 18px 8px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--glass-border-soft);
  background: rgba(10, 22, 40, 0.55);
  color: var(--text);
  font-size: 12px;
  line-height: 1.45;
}
.brief-row { display: flex; flex-wrap: wrap; gap: 6px; }
.brief-chip {
  display: inline-flex;
  gap: 6px;
  align-items: baseline;
  max-width: 100%;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--glass-border-soft);
  background: rgba(255, 255, 255, 0.04);
}
.brief-chip-label {
  color: var(--text-muted);
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.brief-note,
.brief-empty {
  margin: 6px 0 0;
  color: var(--text-muted);
  font-size: 12px;
}
.desk-contract h4,
.advisor-monitor h4 {
  margin: 10px 0 4px;
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}
