:root {
  --bg: #0b1016;
  --panel: #131b26;
  --panel-2: #192434;
  --text: #f3f6fb;
  --muted: #90a0b8;
  --accent: #38d4b2;
  --accent-2: #4aa7ff;
  --danger: #ff6b6b;
  --border: rgba(255, 255, 255, 0.12);
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --font: "Space Grotesk", ui-sans-serif, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(circle at 10% 10%, rgba(56, 212, 178, 0.16), transparent 42%),
    radial-gradient(circle at 88% 0%, rgba(74, 167, 255, 0.18), transparent 38%),
    linear-gradient(160deg, #091019 0%, #0e1521 62%, #0a0f18 100%);
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 1.65rem;
  letter-spacing: 0.02em;
}

h2 {
  font-size: 1.15rem;
  font-weight: 600;
}

h3 {
  font-size: 1rem;
}

.subtle {
  color: var(--muted);
  font-size: 0.92rem;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.68rem;
  color: var(--accent);
  margin-bottom: 0.2rem;
}

code {
  font-family: var(--mono);
  color: var(--accent-2);
}

.topbar {
  padding: 1.35rem 1.5rem 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.topbar-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.dashboard-grid {
  padding: 1rem 1.5rem 1.5rem;
  display: grid;
  grid-template-columns: repeat(2, minmax(280px, 1fr));
  gap: 1rem;
}

.panel {
  background: linear-gradient(150deg, rgba(24, 33, 46, 0.94), rgba(16, 23, 34, 0.96));
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1rem;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
}

.panel-wide {
  grid-column: span 2;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 0.75rem;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(160px, 1fr));
  gap: 0.65rem;
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 0.75rem;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  background: rgba(8, 13, 21, 0.75);
  padding: 0.62rem 0.7rem;
  font-family: var(--font);
  font-size: 0.95rem;
}

textarea {
  resize: vertical;
  min-height: 80px;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--accent-2);
  box-shadow: 0 0 0 3px rgba(74, 167, 255, 0.15);
}

.btn {
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 0.55rem 0.82rem;
  color: var(--text);
  background: transparent;
  cursor: pointer;
  font-family: var(--font);
  font-size: 0.88rem;
  font-weight: 600;
  transition: all 0.15s ease;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-primary {
  background: linear-gradient(132deg, #1fb9a4 0%, #2b99f7 100%);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(43, 153, 247, 0.35);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--border);
}

.btn-secondary:hover:not(:disabled),
.btn-ghost:hover:not(:disabled) {
  border-color: rgba(255, 255, 255, 0.4);
  background: rgba(255, 255, 255, 0.12);
}

.btn-ghost {
  background: transparent;
  border-color: var(--border);
}

.btn-danger {
  background: rgba(255, 107, 107, 0.17);
  border-color: rgba(255, 107, 107, 0.4);
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.inline-control {
  display: inline-flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.75rem;
}

.inline-control select {
  min-width: 160px;
  width: auto;
  padding: 0.4rem 0.6rem;
}

.voice-filter-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: flex-end;
  margin-bottom: 0.65rem;
}

.filter-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0 0 0.5rem;
}

.filter-tag {
  border: 1px solid rgba(56, 212, 178, 0.55);
  background: rgba(56, 212, 178, 0.18);
  color: #d8fff7;
  border-radius: 999px;
  padding: 0.22rem 0.58rem;
  font-size: 0.74rem;
  font-family: var(--font);
  cursor: pointer;
  display: inline-flex;
  gap: 0.35rem;
  align-items: center;
}

.filter-tag:hover {
  background: rgba(56, 212, 178, 0.28);
}

.filter-tag-remove {
  font-weight: 700;
  font-size: 0.72rem;
}

.tag {
  font-size: 0.75rem;
  color: #dbecff;
  background: rgba(255, 255, 255, 0.09);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.24rem 0.64rem;
}

.status-line {
  margin-top: 0.6rem;
  min-height: 1.15rem;
  font-size: 0.82rem;
  color: var(--muted);
}

.status-line.error {
  color: #ff9f9f;
}

.status-line.success {
  color: #7ef2d4;
}

.voice-list {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(5, 9, 14, 0.55);
  max-height: 320px;
  overflow: auto;
  padding: 0.4rem;
}

.voice-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 0.48rem 0.55rem;
  margin-bottom: 0;
  color: var(--text);
  font-size: 0.9rem;
  transition: all 0.15s ease;
  cursor: pointer;
}

.voice-row:hover {
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.06);
}

.voice-row-main {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
  flex: 1;
}

.voice-avatar {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  object-fit: cover;
  border: 1px solid var(--border);
  flex: 0 0 32px;
}

.voice-avatar-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(140deg, rgba(56, 212, 178, 0.45), rgba(74, 167, 255, 0.42));
  color: #f4fbff;
  font-size: 0.72rem;
  font-weight: 700;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  flex: 0 0 32px;
}

.voice-meta {
  min-width: 0;
  flex: 1;
}

.voice-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.voice-name {
  font-weight: 600;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.voice-id {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--muted);
}

.voice-provider {
  font-size: 0.72rem;
  background: rgba(255, 255, 255, 0.09);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.1rem 0.45rem;
}

.batch-log {
  margin-top: 0.65rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(5, 9, 14, 0.7);
  min-height: 120px;
  max-height: 250px;
  overflow: auto;
  padding: 0.6rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  line-height: 1.45;
}

.runs-list {
  display: grid;
  gap: 0.58rem;
}

.run-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.65rem;
  background: rgba(5, 9, 14, 0.48);
  display: grid;
  gap: 0.45rem;
}

.run-head {
  display: flex;
  justify-content: space-between;
  gap: 0.65rem;
  align-items: center;
}

.run-id {
  font-family: var(--mono);
  font-size: 0.76rem;
  color: #d8e6fb;
}

.run-stats {
  font-size: 0.77rem;
  color: var(--muted);
}

.audio-player {
  width: 100%;
  margin-top: 0.7rem;
}

.checkbox-row {
  display: flex;
  align-items: center;
  flex-direction: row;
  gap: 0.5rem;
  margin-bottom: 0;
  color: var(--text);
  font-size: 0.88rem;
}

.checkbox-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.call-overlay {
  position: fixed;
  inset: 0;
  background: rgba(3, 7, 14, 0.8);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.hidden {
  display: none;
}

.call-card {
  width: min(520px, calc(100vw - 2rem));
  background: linear-gradient(170deg, #0f1725, #192434);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1rem;
  box-shadow: 0 24px 44px rgba(0, 0, 0, 0.36);
  display: grid;
  gap: 0.8rem;
}

.auth-body {
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-shell {
  width: min(420px, calc(100vw - 1.8rem));
  padding: 1.5rem 0;
}

.auth-card {
  background: linear-gradient(160deg, rgba(20, 31, 44, 0.95), rgba(13, 20, 32, 0.98));
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.2rem;
  box-shadow: 0 24px 44px rgba(0, 0, 0, 0.35);
  display: grid;
  gap: 1rem;
}

.auth-form {
  display: grid;
  gap: 0.4rem;
}

.alert {
  border-radius: 10px;
  padding: 0.55rem 0.7rem;
  font-size: 0.85rem;
}

.alert-error {
  background: rgba(255, 107, 107, 0.18);
  border: 1px solid rgba(255, 107, 107, 0.45);
  color: #ffc9c9;
}

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

  .panel-wide {
    grid-column: span 1;
  }

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

  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }
}
