:root {
  --bg: #030712;
  --bg-2: #050b22;
  --surface: rgba(6, 12, 32, 0.9);
  --surface-soft: rgba(15, 23, 42, 0.85);
  --surface-strong: rgba(10, 15, 34, 0.95);
  --border-light: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(56, 189, 248, 0.4);
  --text: #f8fafc;
  --text-muted: #a5b4fc;
  --accent: #38bdf8;
  --accent-strong: #6366f1;
  --accent-secondary: #34d399;
  font-family: "Inter", "Space Grotesk", system-ui, sans-serif;
  color: var(--text);
  background-color: var(--bg);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at top, rgba(56, 189, 248, 0.15), transparent 45%),
    linear-gradient(180deg, #060b1d 0%, #030712 100%);
  color: var(--text);
}

body::selection {
  background: rgba(56, 189, 248, 0.4);
  color: #fff;
}

.dashboard-shell {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.5rem 3rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  position: relative;
}

.page-header {
  display: grid;
  grid-template-columns: minmax(0, 2fr) auto;
  gap: 1.5rem;
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.9), rgba(5, 9, 33, 0.9));
  border-radius: 22px;
  padding: 1.75rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 20px 45px rgba(3, 5, 18, 0.75);
  backdrop-filter: blur(16px);
  position: relative;
  overflow: hidden;
}

.page-header::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 22px;
  pointer-events: none;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.page-header__content {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  z-index: 1;
}

.hero-heading {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.hero-badge {
  align-self: flex-start;
  padding: 0.2rem 0.8rem;
  border-radius: 999px;
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.4);
  font-size: 0.8rem;
  letter-spacing: 0.2rem;
  text-transform: uppercase;
  color: var(--accent);
}

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.3rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.page-header h1 {
  margin: 0;
  font-size: clamp(2rem, 3vw, 2.7rem);
}

.hero-subtitle {
  margin: 0;
  font-size: 1rem;
  color: var(--text-muted);
  max-width: 620px;
}

.hero-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.info-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  background: rgba(59, 130, 246, 0.12);
  border: 1px solid rgba(59, 130, 246, 0.3);
  font-size: 0.85rem;
  color: #e0e7ff;
}

.hero-chips strong {
  color: var(--accent);
}

.hero-metrics {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.hero-kpi {
  background: rgba(255, 255, 255, 0.05);
  padding: 0.75rem 1rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  min-width: 120px;
}

.hero-kpi__label {
  margin: 0;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.2rem;
  color: var(--text-muted);
}

.hero-kpi__value {
  margin: 0.35rem 0 0;
  font-size: 1.4rem;
  font-weight: 600;
}

.page-header__actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.75rem;
  z-index: 1;
}

.timestamp {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.reset-otp-button {
  border: 1px solid rgba(59, 130, 246, 0.8);
  background: transparent;
  color: #bfdbfe;
  border-radius: 999px;
  padding: 0.55rem 1.3rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.25s ease, border-color 0.25s ease, transform 0.2s ease;
}

.reset-otp-button:hover,
.reset-otp-button:focus-visible {
  background: rgba(59, 130, 246, 0.25);
  border-color: rgba(59, 130, 246, 1);
  transform: translateY(-1px);
}

section {
  background: var(--surface);
  border-radius: 20px;
  padding: 1.75rem;
  border: 1px solid var(--border-light);
  box-shadow: 0 25px 50px rgba(3, 5, 15, 0.8);
  backdrop-filter: blur(12px);
  animation: surfaceFade 0.6s ease both;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin: 0 0 0.75rem;
}

.section-heading h2 {
  margin: 0;
  font-size: 1.5rem;
}

.section-heading p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.orchestrator .card {
  padding: 1.25rem;
  border-radius: 16px;
  background: linear-gradient(145deg, rgba(12, 20, 37, 0.85), rgba(3, 6, 19, 0.85));
  border: 1px solid rgba(59, 130, 246, 0.2);
  animation: float 0.6s ease 0.1s both;
}

.orchestrator .status {
  margin: 0;
  font-weight: 600;
}

.orchestrator-actions {
  margin-top: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.orchestrator-actions button {
  border: none;
  padding: 0.8rem 1.35rem;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent-secondary), var(--accent));
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 12px 30px rgba(12, 74, 110, 0.55);
  transition: transform 0.2s ease;
}

.orchestrator-actions button:hover {
  transform: translateY(-1px) scale(1.01);
}

.agent-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.agent-card {
  padding: 1.4rem;
  border-radius: 18px;
  background: linear-gradient(145deg, rgba(15, 23, 42, 0.95), rgba(2, 6, 23, 0.95));
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 25px 30px rgba(3, 5, 15, 0.6);
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
  animation: float 0.6s ease both;
}

.agent-card--placeholder {
  opacity: 0.6;
  border-style: dashed;
}

.agent-card--clickable {
  cursor: pointer;
}

.agent-card--clickable:hover {
  transform: translateY(-4px);
  border-color: rgba(56, 189, 248, 0.6);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.agent-card--clickable:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

.agent-name {
  font-size: 1.15rem;
  font-weight: 600;
  margin: 0;
}

.agent-role {
  margin: 0.1rem 0;
  font-size: 0.95rem;
  color: #e2e8f0;
}

.agent-card-description {
  margin: 0.45rem 0 0;
  color: #cbd5f5;
  font-size: 0.9rem;
  min-height: 42px;
}

.agent-card-status {
  margin: 0.35rem 0 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.agent-card-tags {
  margin-top: 0.7rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.agent-card-tag {
  padding: 0.25rem 0.8rem;
  border-radius: 999px;
  font-size: 0.75rem;
  border: 1px solid rgba(59, 130, 246, 0.5);
  background: rgba(59, 130, 246, 0.15);
  color: #dbeafe;
}

.flow-header {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.command-form {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.9rem;
}

.command-form input {
  flex: 1;
  padding: 0.95rem 1.15rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(15, 23, 42, 0.8);
  color: var(--text);
  font-size: 1rem;
}

.command-form input:focus {
  outline: 2px solid rgba(59, 130, 246, 0.6);
}

.command-form button {
  border: none;
  background: linear-gradient(135deg, var(--accent), var(--accent-secondary));
  color: #fff;
  font-weight: 600;
  padding: 0.95rem 1.4rem;
  border-radius: 999px;
  cursor: pointer;
}

.log {
  margin-top: 1rem;
  padding: 1.25rem;
  border-radius: 16px;
  background: linear-gradient(145deg, rgba(2, 6, 23, 0.8), rgba(15, 23, 42, 0.9));
  border: 1px dashed rgba(255, 255, 255, 0.3);
  min-height: 130px;
  font-family: "JetBrains Mono", "SFMono-Regular", monospace;
}

.log-item {
  margin: 0;
  padding: 0.2rem 0;
  font-size: 0.95rem;
  color: #cfd9ff;
}

.chat-shell {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(220px, 1fr);
  gap: 1rem;
  margin-top: 1rem;
}

.chat-main {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.chat-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.chat-room-filter {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.chat-room-filter select {
  min-width: 180px;
  border-radius: 999px;
  padding: 0.55rem 0.95rem;
  border: 1px solid rgba(255, 255, 255, 0.13);
  background: rgba(15, 23, 42, 0.8);
  color: var(--text);
  font-size: 0.9rem;
}

.chat-toolbar button {
  border: none;
  background: linear-gradient(135deg, var(--accent-strong), var(--accent));
  color: #fff;
  font-weight: 600;
  padding: 0.8rem 1.3rem;
  border-radius: 999px;
  cursor: pointer;
}

.chat-feed {
  min-height: 260px;
  max-height: 310px;
  border-radius: 18px;
  padding: 1.25rem;
  background: rgba(2, 6, 23, 0.85);
  border: 1px dashed rgba(255, 255, 255, 0.2);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.chat-entry {
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  animation: float 0.5s ease both;
}

.chat-entry:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.chat-entry-header {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: #cbd5f5;
}

.chat-entry-agent {
  font-weight: 600;
  color: #fff;
}

.chat-entry-room {
  margin: 0.4rem 0 0;
  font-size: 0.75rem;
  color: #94a3b8;
}

.chat-entry-text {
  margin: 0.2rem 0 0;
  color: #e0e7ff;
  font-size: 0.95rem;
  line-height: 1.5;
}

.chat-placeholder,
.chat-error {
  margin: 0;
  font-size: 0.95rem;
  color: var(--text-muted);
  font-style: italic;
}

.chat-aside {
  background: rgba(15, 23, 42, 0.9);
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 1rem;
  max-height: 340px;
  overflow-y: auto;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02);
}

.chat-aside h3 {
  margin: 0 0 0.75rem;
  font-size: 1.1rem;
}

.chat-room-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.chat-room-item {
  padding: 0.85rem;
  border-radius: 12px;
  background: rgba(2, 6, 23, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.chat-room-name {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: #fff;
}

.chat-room-meta {
  margin: 0.2rem 0 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.agent-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.form-field label {
  text-transform: uppercase;
  letter-spacing: 0.12rem;
  font-size: 0.75rem;
}

.form-field input,
.form-field textarea {
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 0.85rem 1rem;
  background: rgba(15, 23, 42, 0.8);
  color: var(--text);
  font-size: 0.95rem;
}

.form-field textarea {
  min-height: 100px;
  resize: vertical;
}

.form-actions {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.form-actions button {
  border: none;
  padding: 0.9rem 1.75rem;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent-secondary), var(--accent));
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}

.agent-form-status {
  margin: 0;
  font-size: 0.85rem;
  color: #34d399;
}

.agent-form-note {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

footer {
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 1rem;
}

.dashboard-shell.is-locked {
  filter: blur(4px) saturate(0.8);
  opacity: 0.7;
  pointer-events: none;
  user-select: none;
}

.otp-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.9), rgba(5, 6, 23, 0.95)),
    rgba(5, 8, 22, 0.95);
  padding: 2rem 1rem;
  z-index: 1000;
}

.otp-panel {
  background: rgba(15, 23, 42, 0.95);
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 2rem;
  width: min(480px, 100%);
  text-align: center;
  box-shadow: 0 25px 45px rgba(0, 0, 0, 0.55);
}

.otp-panel__eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.3rem;
  font-size: 0.75rem;
  color: var(--accent);
  margin: 0 0 0.8rem;
}

.otp-panel h2 {
  margin: 0 0 0.5rem;
  font-size: 1.6rem;
}

.otp-panel p {
  margin: 0 0 1rem;
  color: #cbd5f5;
}

.otp-input-label {
  display: block;
  text-transform: uppercase;
  letter-spacing: 0.15rem;
  font-size: 0.7rem;
  color: #94a3b8;
  margin-bottom: 0.35rem;
}

.otp-input {
  width: 100%;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(15, 23, 42, 0.9);
  color: #fff;
  padding: 0.9rem 1rem;
  font-size: 1.25rem;
  letter-spacing: 0.4rem;
  text-align: center;
}

.otp-hint {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.otp-actions {
  display: flex;
  justify-content: center;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}

.otp-confirm {
  border: none;
  padding: 0.75rem 1.6rem;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent-secondary), var(--accent));
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}

.otp-request-link {
  font-size: 0.9rem;
  color: #a5b4fc;
  text-decoration: underline;
}

.otp-toast {
  font-size: 0.95rem;
  color: #fef08a;
  min-height: 1.5rem;
}

.otp-error {
  font-size: 0.9rem;
  color: #f87171;
  min-height: 1.2rem;
}

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

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

@media (max-width: 980px) {
  .page-header {
    grid-template-columns: 1fr;
  }

  .page-header__actions {
    flex-direction: row;
    align-items: center;
  }

  .hero-metrics {
    flex-direction: column;
  }

  .chat-shell {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .command-form {
    flex-direction: column;
  }

  .command-form button {
    width: 100%;
  }

  .agent-form {
    grid-template-columns: 1fr;
  }

  .page-header {
    padding: 1.25rem;
  }
}
