:root {
  --ink: #f5f5f5;
  --ink-soft: #b8b8b8;
  --paper: #0a0a0a;
  --panel: rgba(18, 18, 18, 0.88);
  --panel-border: rgba(246, 147, 29, 0.22);
  --accent: #f6931d;
  --accent-deep: #ef8f22;
  --accent-glow: rgba(246, 147, 29, 0.35);
  --warn: #fbbf24;
  --danger: #f87171;
  --credit: #4ade80;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
  --radius: 22px;
  --font: "Outfit", system-ui, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1000px 520px at 8% -8%, rgba(246, 147, 29, 0.16), transparent 55%),
    radial-gradient(800px 480px at 100% 0%, rgba(246, 147, 29, 0.08), transparent 50%),
    linear-gradient(180deg, #000000 0%, #0c0c0c 45%, #111111 100%);
  overflow-x: hidden;
}

.bg-grid {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.18;
  background-image:
    linear-gradient(rgba(246, 147, 29, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(246, 147, 29, 0.07) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse at center, black 20%, transparent 75%);
}

.bg-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(40px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.45;
}

.bg-orb-a {
  width: 280px;
  height: 280px;
  background: rgba(246, 147, 29, 0.28);
  top: 18%;
  left: -80px;
  animation: drift 14s ease-in-out infinite;
}

.bg-orb-b {
  width: 220px;
  height: 220px;
  background: rgba(246, 147, 29, 0.14);
  right: -60px;
  bottom: 12%;
  animation: drift 18s ease-in-out infinite reverse;
}

@keyframes drift {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(24px);
  }
}

.app {
  position: relative;
  z-index: 1;
  width: min(1100px, calc(100% - 2rem));
  margin: 1.25rem auto 2.5rem;
}

.topbar {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
}

.brand {
  display: flex;
  gap: 0.85rem;
  align-items: center;
}

.brand-logo {
  width: 48px;
  height: 48px;
  object-fit: contain;
  border-radius: 12px;
  background: #000;
  padding: 4px;
  border: 1px solid rgba(246, 147, 29, 0.35);
  box-shadow: 0 10px 24px var(--accent-glow);
}

.brand-name {
  margin: 0;
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1.1;
  color: var(--accent);
}

.brand-sub {
  margin: 0.1rem 0 0;
  color: var(--ink-soft);
  font-size: 0.92rem;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.field {
  display: grid;
  gap: 0.3rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.field select {
  min-width: 150px;
  border: 1px solid var(--panel-border);
  background: rgba(0, 0, 0, 0.65);
  border-radius: 12px;
  padding: 0.55rem 0.75rem;
  font: inherit;
  color: var(--ink);
}

.hero-panel {
  display: grid;
  place-items: center;
  gap: 0.65rem;
  padding: 1.75rem 1rem 1.5rem;
  margin-bottom: 1rem;
  border-radius: calc(var(--radius) + 4px);
  background: var(--panel);
  border: 1px solid var(--panel-border);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
  text-align: center;
}

.hero-kicker {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

.hero-title {
  margin: 0;
  font-size: clamp(2.4rem, 6vw, 3.4rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: #fff;
  line-height: 1;
}

.hero-lead {
  margin: 0;
  max-width: 34rem;
  color: var(--ink-soft);
  font-size: 1rem;
  line-height: 1.45;
}

.status-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 1.5rem;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #94a3b8;
}

.dot[data-state="connected"] {
  background: #16a34a;
  box-shadow: 0 0 0 4px rgba(22, 163, 74, 0.18);
}

.dot[data-state="connecting"] {
  background: #d97706;
  animation: pulse 1s ease-in-out infinite;
}

.dot[data-state="error"] {
  background: var(--danger);
}

#connectionLabel {
  margin: 0;
  font-size: 0.95rem;
  color: var(--ink-soft);
}

.mode-chip {
  margin: 0;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: rgba(246, 147, 29, 0.14);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.mic-button {
  position: relative;
  width: 112px;
  height: 112px;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  color: #000;
  background: linear-gradient(160deg, var(--accent) 0%, #c96f0f 100%);
  box-shadow: 0 16px 36px var(--accent-glow);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.mic-button:hover {
  transform: translateY(-2px) scale(1.02);
}

.mic-button:active {
  transform: scale(0.98);
}

.mic-button[aria-pressed="true"] {
  color: #fff;
  background: linear-gradient(160deg, #b91c1c 0%, #7f1d1d 100%);
  box-shadow: 0 16px 36px rgba(185, 28, 28, 0.35);
}

.mic-button[aria-pressed="true"] .mic-ring {
  animation: ring 1.6s ease-out infinite;
}

.mic-ring {
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  border: 2px solid rgba(246, 147, 29, 0.45);
  opacity: 0;
}

.mic-icon {
  display: grid;
  place-items: center;
}

.mic-hint {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.95rem;
}

.phone-panel {
  margin-top: 0.75rem;
  width: min(100%, 28rem);
  padding: 0.9rem 1rem;
  border-radius: 16px;
  border: 1px solid rgba(246, 147, 29, 0.35);
  background: rgba(246, 147, 29, 0.08);
  text-align: center;
}

.phone-label {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.phone-number {
  margin: 0.35rem 0 0.25rem;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--accent);
}

.phone-hint {
  margin: 0;
  font-size: 0.85rem;
  color: var(--ink-soft);
}

.error-banner,
.lockout-banner {
  margin: 0;
  max-width: 32rem;
  text-align: center;
  padding: 0.65rem 0.9rem;
  border-radius: 12px;
  font-size: 0.9rem;
}

.error-banner {
  background: rgba(248, 113, 113, 0.12);
  color: var(--danger);
  border: 1px solid rgba(248, 113, 113, 0.35);
}

.lockout-banner {
  background: rgba(251, 191, 36, 0.1);
  color: var(--warn);
  border: 1px solid rgba(251, 191, 36, 0.3);
}

.workspace {
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  gap: 1rem;
}

.panel-head-actions {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
  min-height: 320px;
  display: flex;
  flex-direction: column;
}

.dashboard-panel {
  min-height: 360px;
}

.live-chip {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.28rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--panel-border);
  color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.7);
}

.live-chip[data-state="live"] {
  color: #15803d;
  border-color: rgba(21, 128, 61, 0.35);
  background: rgba(21, 128, 61, 0.1);
}

.live-chip[data-state="connecting"] {
  color: var(--warn);
  border-color: rgba(180, 83, 9, 0.3);
  background: rgba(180, 83, 9, 0.08);
  animation: pulse 1.4s ease-in-out infinite;
}

.dashboard-body {
  padding: 0.35rem 1.1rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  overflow-y: auto;
  max-height: 520px;
}

.dashboard-body.dash-flash {
  animation: dashPulse 0.55s ease;
}

@keyframes dashPulse {
  0% {
    box-shadow: inset 0 0 0 0 rgba(15, 118, 110, 0);
  }
  35% {
    box-shadow: inset 0 0 0 2px rgba(15, 118, 110, 0.35);
  }
  100% {
    box-shadow: inset 0 0 0 0 rgba(15, 118, 110, 0);
  }
}

.dash-user {
  margin: 0;
  font-size: 0.9rem;
  color: var(--ink-soft);
}

.dash-user strong {
  color: var(--ink);
  font-weight: 700;
}

.dash-balances {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}

.dash-balance {
  padding: 0.75rem 0.85rem;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--panel-border);
}

.dash-label {
  margin: 0;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  font-weight: 600;
}

.dash-amount {
  margin: 0.25rem 0 0.15rem;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--accent-deep);
}

.dash-meta {
  margin: 0;
  font-size: 0.78rem;
  color: var(--ink-soft);
  word-break: break-all;
}

.dash-section h3 {
  margin: 0 0 0.45rem;
  font-size: 0.88rem;
}

.dash-billers {
  margin: 0;
  font-size: 0.88rem;
  color: var(--ink-soft);
  line-height: 1.45;
}

.dash-updated {
  margin: 0;
  font-size: 0.75rem;
  color: var(--ink-soft);
}

.dash-empty-tx {
  justify-content: center;
  color: var(--ink-soft);
  border-bottom: none !important;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.1rem 0.6rem;
  gap: 0.75rem;
}

.panel-head h2 {
  margin: 0;
  font-size: 1rem;
  letter-spacing: -0.01em;
}

.text-btn {
  border: none;
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0.25rem 0.4rem;
}

.text-btn:hover {
  text-decoration: underline;
}

.live-chip[data-state="live"] {
  color: var(--credit);
  border-color: rgba(74, 222, 128, 0.35);
  background: rgba(74, 222, 128, 0.1);
}

.live-chip[data-state="connecting"] {
  color: var(--warn);
  border-color: rgba(251, 191, 36, 0.3);
  background: rgba(251, 191, 36, 0.08);
  animation: pulse 1.4s ease-in-out infinite;
}

.dash-balance {
  padding: 0.75rem 0.85rem;
  border-radius: 16px;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid var(--panel-border);
}

.dash-amount {
  margin: 0.25rem 0 0.15rem;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--accent);
}

.result-card {
  border-radius: 16px;
  padding: 0.9rem 1rem;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid var(--panel-border);
  animation: fadeUp 0.3s ease;
}

.amount-credit {
  color: var(--credit);
}

.tx-list li {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.9rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid rgba(246, 147, 29, 0.12);
}

.transcript {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem 1.1rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  max-height: 420px;
}

.bubble {
  max-width: 92%;
  padding: 0.7rem 0.9rem;
  border-radius: 16px;
  font-size: 0.95rem;
  line-height: 1.45;
  color: #f5f5f5;
  animation: fadeUp 0.28s ease;
}

.bubble.user {
  align-self: flex-end;
  background: rgba(246, 147, 29, 0.22);
  border: 1px solid rgba(246, 147, 29, 0.35);
  border-bottom-right-radius: 6px;
}

.bubble.agent {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(246, 147, 29, 0.28);
  border-bottom-left-radius: 6px;
  color: #fff;
}

.bubble .who {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
  margin-bottom: 0.2rem;
}

.cards {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0.5rem 1.1rem 1.1rem;
  overflow-y: auto;
  max-height: 420px;
}

.empty-hint {
  margin: auto 1.1rem 1.2rem;
  color: var(--ink-soft);
  font-size: 0.9rem;
  text-align: center;
}

.result-card {
  border-radius: 16px;
  padding: 0.9rem 1rem;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid var(--panel-border);
  animation: fadeUp 0.3s ease;
}

.result-card h3 {
  margin: 0 0 0.55rem;
  font-size: 0.95rem;
}

.result-card dl {
  margin: 0;
  display: grid;
  gap: 0.35rem;
}

.result-card dt {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
}

.result-card dd {
  margin: 0 0 0.35rem;
  font-weight: 600;
}

.tx-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.45rem;
}

.tx-list li {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.9rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid rgba(11, 31, 28, 0.06);
}

.tx-list li:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.amount-debit {
  color: var(--danger);
}

.amount-credit {
  color: #15803d;
}

.footer {
  margin-top: 1.25rem;
  text-align: center;
  color: var(--ink-soft);
  font-size: 0.85rem;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.45;
  }
}

@keyframes ring {
  0% {
    transform: scale(0.92);
    opacity: 0.7;
  }
  100% {
    transform: scale(1.25);
    opacity: 0;
  }
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1100px) {
  .workspace {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .dash-balances {
    grid-template-columns: 1fr;
  }

  .app {
    width: min(100% - 1.25rem, 1100px);
  }

  .mic-button {
    width: 104px;
    height: 104px;
  }
}
