:root {
  --meet-bg: #0b0d14;
  --meet-panel: #12141c;
  --meet-panel-2: #181b27;
  --meet-line: rgba(255, 255, 255, 0.08);
  --meet-text: #f4f5f8;
  --meet-muted: #9aa0b4;
}

body.hablar-body {
  background: var(--background);
}

body.hablar-body.is-meeting {
  background: var(--meet-bg);
  color: var(--meet-text);
}

body.hablar-body.is-meeting .nav {
  background: rgba(11, 13, 20, 0.88);
  border-bottom-color: var(--meet-line);
}

body.hablar-body.is-meeting .nav__links a {
  color: var(--meet-muted);
}

body.hablar-body.is-meeting .nav__links a:hover {
  color: #fff;
}

body.hablar-body.is-meeting .btn--small {
  background: var(--primary);
}

/* ---- Login / session start ---- */
.auth-screen {
  min-height: calc(100vh - var(--nav-height));
  display: grid;
  place-items: center;
  padding: 40px var(--container-padding) 64px;
  background:
    radial-gradient(900px 420px at 50% -10%, rgba(44, 72, 255, 0.16), transparent 60%),
    var(--background);
}

/* display:grid above beats the UA [hidden] rule — must force hide */
.auth-screen[hidden] {
  display: none !important;
}

.auth-card {
  width: min(420px, 100%);
  background: #fff;
  color: #0a0b0e;
  border: 1px solid var(--border-light);
  border-radius: 24px;
  box-shadow: 0 24px 80px rgba(10, 11, 14, 0.08);
  padding: 32px 28px 28px;
}

/* Never inherit meeting-room light text onto the login card */
.auth-card,
.auth-card h1,
.auth-card h2,
.auth-card p,
.auth-card label,
.auth-panel,
.auth-panel h1,
.auth-panel p {
  color: #0a0b0e;
}

.auth-card__brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.auth-card__brand img {
  width: 40px;
  height: 40px;
  border-radius: 12px;
}

.auth-card__brand span {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--primary);
}

.auth-card h1 {
  font-size: 1.7rem;
  margin: 0 0 8px;
}

.auth-card > p {
  margin: 0 0 24px;
}

.auth-form {
  display: grid;
  gap: 14px;
}

.auth-form label {
  display: grid;
  gap: 6px;
  font-size: 0.9rem;
  font-weight: 600;
  color: #0a0b0e;
}

.auth-form input {
  width: 100%;
  border: 1px solid var(--border-light);
  border-radius: 14px;
  padding: 14px 14px;
  font: inherit;
  font-size: 1.05rem;
  background: #fff;
  color: #0a0b0e;
}

.auth-form input:focus {
  outline: 2px solid rgba(44, 72, 255, 0.25);
  border-color: var(--primary);
}

.auth-form .btn {
  width: 100%;
  text-align: center;
  padding: 14px 20px;
}

.auth-form .btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.auth-hint,
.auth-error {
  font-size: 0.9rem;
  margin: 0;
}

.auth-hint { color: #6b6b72 !important; }
.auth-error { color: #d92a2a !important; font-weight: 600; }

body.hablar-body.is-meeting .auth-screen {
  /* If login is ever shown over meeting styles, keep it readable */
  color: #0a0b0e;
}

.auth-linkish {
  background: none;
  border: none;
  padding: 0;
  color: var(--primary);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.auth-panel[hidden] { display: none !important; }

/* ---- Meeting room ---- */
.meeting {
  min-height: calc(100vh - var(--nav-height));
  display: grid;
  grid-template-columns: minmax(220px, 280px) minmax(0, 1fr) minmax(240px, 300px);
  gap: 0;
}

.meeting[hidden] { display: none !important; }

.meeting__agent,
.meeting__chat,
.meeting__accounts {
  min-height: calc(100vh - var(--nav-height));
  border-right: 1px solid var(--meet-line);
}

.meeting__accounts {
  border-right: 0;
  border-left: 1px solid var(--meet-line);
}

.meeting__agent {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 28px 20px;
  background:
    radial-gradient(420px 280px at 50% 35%, rgba(44, 72, 255, 0.28), transparent 70%),
    var(--meet-panel);
}

.agent-stage {
  width: min(220px, 70vw);
  aspect-ratio: 1;
  border-radius: 28px;
  background: var(--meet-panel-2);
  border: 1px solid var(--meet-line);
  overflow: hidden;
  position: relative;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

.agent-stage canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
}

.agent-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 50% 40%, rgba(92, 86, 212, 0.45), transparent 55%),
    linear-gradient(160deg, #1a1f33, #0d1020);
}

.agent-fallback[hidden] { display: none !important; }

.agent-orb {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: linear-gradient(145deg, #5c56d4, #2c48ff);
  display: grid;
  place-items: center;
  box-shadow: 0 0 0 0 rgba(44, 72, 255, 0.45);
  animation: agent-idle 2.8s ease-in-out infinite;
}

.agent-orb img {
  width: 42px;
  height: 42px;
  filter: brightness(10);
}

.meeting__agent.is-thinking .agent-orb,
.meeting__agent.is-speaking .agent-orb {
  animation: agent-speak 1s ease-in-out infinite;
}

.meeting__agent.is-listening .agent-orb {
  animation: agent-listen 1.4s ease-in-out infinite;
}

@keyframes agent-idle {
  0%, 100% { transform: translateY(0); box-shadow: 0 0 0 0 rgba(44, 72, 255, 0.25); }
  50% { transform: translateY(-6px); box-shadow: 0 0 0 14px rgba(44, 72, 255, 0); }
}

@keyframes agent-speak {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(64, 242, 153, 0.35); }
  50% { transform: scale(1.06); box-shadow: 0 0 0 18px rgba(64, 242, 153, 0); }
}

@keyframes agent-listen {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(44, 72, 255, 0.4); }
  50% { transform: scale(1.04); box-shadow: 0 0 0 16px rgba(44, 72, 255, 0); }
}

.agent-meta {
  text-align: center;
}

.agent-meta h2 {
  margin: 0 0 6px;
  font-size: 1.25rem;
  color: #fff;
  text-align: center;
}

.agent-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--meet-muted);
  margin: 0;
}

.agent-status__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 0 rgba(64, 242, 153, 0.5);
}

.meeting__agent.is-listening .agent-status__dot,
.meeting__agent.is-speaking .agent-status__dot {
  animation: hablar-pulse 1.2s ease-in-out infinite;
}

.meeting__chat {
  display: flex;
  flex-direction: column;
  background: #0e1018;
}

.meeting__chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--meet-line);
  background: rgba(18, 20, 28, 0.9);
}

.meeting__chat-header h2 {
  margin: 0;
  font-size: 1.05rem;
  text-align: left;
  color: #fff;
}

.meeting__chat-header p {
  margin: 4px 0 0;
  color: var(--meet-muted);
  font-size: 0.85rem;
}

.meeting__chat-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.meeting__chat-actions .btn {
  padding: 8px 14px;
  font-size: 0.82rem;
}

.btn--ghost {
  background: transparent;
  color: var(--meet-text);
  border: 1px solid var(--meet-line);
}

.btn--ghost:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

.btn--danger-ghost {
  background: transparent;
  color: #ff9b8f;
  border: 1px solid rgba(255, 120, 102, 0.35);
}

.hablar-messages {
  flex: 1;
  overflow-y: auto;
  padding: 22px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.msg {
  max-width: min(88%, 560px);
  padding: 12px 14px;
  border-radius: 16px;
  font-size: 0.95rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.msg--user {
  align-self: flex-end;
  background: var(--primary);
  color: #fff;
  border-bottom-right-radius: 6px;
}

.msg--assistant {
  align-self: flex-start;
  background: var(--meet-panel-2);
  border: 1px solid var(--meet-line);
  color: var(--meet-text);
  border-bottom-left-radius: 6px;
}

.msg--system {
  align-self: center;
  background: transparent;
  color: var(--meet-muted);
  font-size: 0.85rem;
  text-align: center;
}

.msg.is-pending { opacity: 0.7; }

.hablar-voice-bar {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  background: rgba(44, 72, 255, 0.12);
  border-top: 1px solid rgba(44, 72, 255, 0.2);
  color: #c9d0ff;
  font-size: 0.88rem;
  font-weight: 600;
}

.hablar-voice-bar.is-on { display: flex; }

.hablar-voice-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  animation: hablar-pulse 1.2s ease-in-out infinite;
}

@keyframes hablar-pulse {
  0%, 100% { opacity: 0.35; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1.15); }
}

.hablar-composer {
  display: flex;
  gap: 10px;
  padding: 14px 16px 16px;
  border-top: 1px solid var(--meet-line);
  background: var(--meet-panel);
}

.hablar-composer textarea {
  flex: 1;
  resize: none;
  min-height: 48px;
  max-height: 140px;
  border: 1px solid var(--meet-line);
  border-radius: 14px;
  padding: 12px 14px;
  font: inherit;
  line-height: 1.4;
  background: #0b0d14;
  color: #fff;
}

.hablar-composer textarea:focus {
  outline: 2px solid rgba(44, 72, 255, 0.35);
  border-color: var(--primary);
}

.hablar-composer .btn {
  align-self: flex-end;
  flex-shrink: 0;
}

/* Accounts sidebar */
.meeting__accounts {
  background: var(--meet-panel);
  display: flex;
  flex-direction: column;
  padding: 20px 16px;
  gap: 14px;
}

.meeting__accounts h3 {
  margin: 0;
  font-size: 0.95rem;
  color: #fff;
}

.meeting__accounts > p {
  margin: 0;
  color: var(--meet-muted);
  font-size: 0.85rem;
}

.accounts-list {
  display: grid;
  gap: 8px;
  flex: 1;
  align-content: start;
  overflow-y: auto;
}

.account-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border-radius: 14px;
  background: var(--meet-panel-2);
  border: 1px solid var(--meet-line);
}

.account-chip__badge {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: rgba(44, 72, 255, 0.18);
  color: #c9d0ff;
  display: grid;
  place-items: center;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
}

.account-chip__meta {
  min-width: 0;
}

.account-chip__meta strong {
  display: block;
  font-size: 0.9rem;
  color: #fff;
}

.account-chip__meta span {
  display: block;
  font-size: 0.78rem;
  color: var(--meet-muted);
}

.accounts-empty {
  padding: 18px 14px;
  border-radius: 16px;
  border: 1px dashed rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.02);
  text-align: center;
}

.accounts-empty p {
  margin: 0 0 14px;
  color: var(--meet-muted);
  font-size: 0.88rem;
}

.accounts-empty .btn,
#connectAccountBtn {
  width: 100%;
  text-align: center;
}

.accounts-footer {
  margin-top: auto;
}

/* WealthReader modal */
.wr-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(5, 7, 12, 0.72);
  display: grid;
  place-items: center;
  padding: 24px;
}

.wr-modal[hidden] { display: none !important; }

.wr-modal__card {
  width: min(920px, 100%);
  height: min(860px, calc(100vh - 48px));
  background: #fff;
  border-radius: 20px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 30px 100px rgba(0, 0, 0, 0.45);
}

.wr-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-light);
  background: #fafafa;
}

.wr-modal__header h3 {
  margin: 0;
  font-size: 1rem;
}

.wr-modal__frame {
  flex: 1;
  width: 100%;
  border: 0;
  background: #fff;
}

@media (max-width: 980px) {
  .meeting {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(50vh, 1fr) auto;
  }

  .meeting__agent,
  .meeting__chat,
  .meeting__accounts {
    min-height: auto;
    border-right: 0;
    border-left: 0;
  }

  .meeting__agent {
    padding: 20px 16px 12px;
    border-bottom: 1px solid var(--meet-line);
  }

  .agent-stage {
    width: 140px;
  }

  .meeting__accounts {
    border-top: 1px solid var(--meet-line);
    min-height: 220px;
  }

  .meeting__chat {
    min-height: 55vh;
  }
}
