:root {
  --bg: #0f0f1a;
  --sidebar: #1a1a2e;
  --card: #1e1e3a;
  --border: #2d2d5e;
  --text: #ffffff;
  --muted: #94a3b8;
  --accent-a: #667eea;
  --accent-b: #764ba2;
  --green: #22c55e;
  --red: #ef4444;
  --yellow: #eab308;
  --blue: #38bdf8;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.24);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}

a {
  color: #a5b4fc;
  text-decoration: none;
}

button,
input,
select {
  font: inherit;
}

input,
select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #141428;
  color: var(--text);
  padding: 13px 14px;
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--accent-a);
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.16);
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.92rem;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(1.8rem, 3vw, 2.6rem);
}

h2 {
  margin-bottom: 0;
  font-size: 1.1rem;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--accent-a), var(--accent-b));
  color: white;
  font-weight: 800;
}

.brand-mark.small {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  flex: 0 0 auto;
}

.primary-btn,
.secondary-btn,
.icon-btn {
  border: 0;
  border-radius: 10px;
  color: white;
  cursor: pointer;
  font-weight: 700;
  transition: transform 0.18s ease, opacity 0.18s ease, border-color 0.18s ease;
}

.primary-btn {
  background: linear-gradient(135deg, var(--accent-a), var(--accent-b));
  padding: 13px 18px;
}

.secondary-btn,
.icon-btn {
  background: #17172f;
  border: 1px solid var(--border);
  padding: 11px 14px;
}

.primary-btn:hover,
.secondary-btn:hover,
.icon-btn:hover {
  transform: translateY(-1px);
}

.primary-btn:disabled,
.secondary-btn:disabled,
.call-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.full {
  width: 100%;
}

.form-error {
  min-height: 22px;
  color: #fca5a5;
}

.muted {
  color: var(--muted);
}

.hidden {
  display: none !important;
}

.eyebrow {
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 86px;
  border-radius: 999px;
  padding: 7px 10px;
  font-size: 0.78rem;
  font-weight: 800;
}

.badge.danger {
  background: rgba(239, 68, 68, 0.12);
  color: #fca5a5;
}

.badge.success {
  background: rgba(34, 197, 94, 0.13);
  color: #86efac;
}

.badge.neutral {
  background: rgba(148, 163, 184, 0.14);
  color: #cbd5e1;
}

.badge.recording {
  background: rgba(239, 68, 68, 0.14);
  color: #fecaca;
}

.app-shell {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px 18px;
  background: var(--sidebar);
  border-right: 1px solid var(--border);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 32px;
  color: white;
  font-weight: 800;
}

.sidebar nav {
  display: grid;
  gap: 10px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  width: 100%;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 11px 12px;
  text-align: left;
}

.nav-link span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  color: #c7d2fe;
  font-size: 0.72rem;
}

.nav-link strong {
  color: inherit;
}

.nav-link.active,
.nav-link:hover {
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.22), rgba(118, 75, 162, 0.22));
  border-color: rgba(102, 126, 234, 0.35);
  color: white;
}

.main-panel {
  padding: 30px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 26px;
}

.topbar-user {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(30, 30, 58, 0.72);
  padding: 8px 14px;
  color: var(--muted);
}

.status-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--red);
}

.status-dot.ready {
  background: var(--green);
  box-shadow: 0 0 0 6px rgba(34, 197, 94, 0.12);
}

.status-dot.connecting {
  background: var(--yellow);
}

.status-dot.active {
  background: var(--blue);
  box-shadow: 0 0 0 6px rgba(56, 189, 248, 0.12);
}

.card {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card);
  box-shadow: var(--shadow);
  padding: 22px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 20px;
}

.settings-grid {
  display: grid;
  gap: 18px;
}

.settings-list,
.password-grid {
  display: grid;
  gap: 14px;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 48px;
  border-bottom: 1px solid rgba(45, 45, 94, 0.65);
}

.toggle-row input {
  width: auto;
}

.settings-actions {
  display: flex;
  align-items: center;
  gap: 18px;
}

.table-card {
  min-height: 560px;
}

.table-toolbar {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  margin-bottom: 16px;
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 820px;
}

td audio {
  width: 220px;
  max-width: 100%;
}

th,
td {
  border-bottom: 1px solid rgba(45, 45, 94, 0.72);
  padding: 14px 12px;
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 240px;
  color: var(--muted);
}

.pagination {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 14px;
  padding-top: 18px;
}

.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(2, 6, 23, 0.72);
  z-index: 20;
}

.modal-panel {
  width: min(760px, 100%);
  max-height: 88vh;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card);
  padding: 22px;
}

.modal-panel .icon-btn {
  float: right;
}

.modal-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--muted);
  margin-bottom: 16px;
}

pre {
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
  color: #dbeafe;
}

@media (max-width: 840px) {
  .app-shell {
    grid-template-columns: 78px minmax(0, 1fr);
  }

  .sidebar {
    padding: 16px 10px;
  }

  .sidebar-brand span:last-child,
  .nav-link strong {
    display: none;
  }

  .nav-link {
    justify-content: center;
    padding: 10px;
  }

  .main-panel {
    padding: 20px;
  }

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