:root {
  --bg: #f2efe8;
  --panel: rgba(255, 252, 246, 0.84);
  --ink: #13211d;
  --muted: #55645f;
  --accent: #c84c24;
  --accent-strong: #962f11;
  --line: rgba(19, 33, 29, 0.12);
  --shadow: 0 24px 80px rgba(75, 50, 28, 0.14);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Space Grotesk", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(200, 76, 36, 0.18), transparent 28%),
    radial-gradient(circle at right 20%, rgba(57, 124, 98, 0.18), transparent 24%),
    linear-gradient(180deg, #f7f1e8 0%, var(--bg) 100%);
}

.shell {
  width: min(1100px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 72px;
}

.shell-login {
  display: grid;
  min-height: 100vh;
  align-items: center;
  padding-top: 24px;
}

.hero {
  max-width: 100%;
  margin-bottom: 14px;
}

.hero-bar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

.login-panel {
  width: min(520px, 100%);
  margin: 0 auto;
}

.account-card {
  min-width: 220px;
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.56);
}

.account-label {
  margin: 0;
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-strong);
}

.eyebrow {
  margin: 0 0 6px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-strong);
}

h1,
h2 {
  margin: 0;
  line-height: 0.95;
}

h1 {
  font-size: clamp(1.2rem, 2.2vw, 1.9rem);
  max-width: 24ch;
}

h2 {
  font-size: 1.25rem;
}

.lede {
  max-width: 58ch;
  margin: 8px 0 0;
  font-size: 0.94rem;
  line-height: 1.45;
  color: var(--muted);
}

.panel {
  backdrop-filter: blur(14px);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 28px;
  box-shadow: var(--shadow);
  padding: 24px;
}

.panel + .panel {
  margin-top: 18px;
}

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

.full {
  grid-column: 1 / -1;
}

label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.94rem;
  color: var(--muted);
}

.checkbox-row {
  flex-direction: row;
  align-items: center;
  gap: 10px;
  color: var(--ink);
}

.checkbox-row input {
  width: auto;
  margin: 0;
}

input,
textarea,
button,
pre {
  font: inherit;
}

input,
textarea {
  width: 100%;
  border: 1px solid rgba(19, 33, 29, 0.16);
  border-radius: 16px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  transition: border-color 140ms ease, transform 140ms ease;
}

input:focus,
textarea:focus {
  outline: none;
  border-color: rgba(200, 76, 36, 0.72);
  transform: translateY(-1px);
}

textarea {
  min-height: 180px;
  resize: vertical;
  line-height: 1.5;
}

small,
.hint {
  color: var(--muted);
}

.actions {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 16px;
}

.inline-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.login-actions {
  margin-top: 24px;
}

.logout-form {
  margin-top: 6px;
}

button {
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent) 0%, #de7f32 100%);
  color: #fff8f2;
  padding: 14px 22px;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent) 0%, #de7f32 100%);
  color: #fff8f2;
  padding: 14px 22px;
  font-weight: 700;
  letter-spacing: 0.01em;
  text-decoration: none;
}

button:hover {
  filter: brightness(1.03);
}

.button-link:hover {
  filter: brightness(1.03);
}

.secondary-button {
  background: rgba(19, 33, 29, 0.08);
  color: var(--ink);
}

.transfer-button {
  background: linear-gradient(135deg, #24634f 0%, #397c62 100%);
  color: #f4fff8;
}

.danger-button {
  background: linear-gradient(135deg, #8f1d17 0%, #c84c24 100%);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  filter: none;
}

.login-form {
  margin-top: 24px;
  grid-template-columns: 1fr;
}

.status-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.status-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  cursor: pointer;
  list-style: none;
  font-size: 1.25rem;
  font-weight: 700;
}

.status-summary::-webkit-details-marker {
  display: none;
}

.status-panel details[open] .status-summary {
  margin-bottom: 16px;
}

.transcript-tools {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pill {
  border-radius: 999px;
  padding: 8px 12px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: rgba(19, 33, 29, 0.08);
}

.pill[data-status="error"],
.pill[data-status="failed"] {
  background: rgba(200, 76, 36, 0.14);
  color: var(--accent-strong);
}

.pill[data-status="in-progress"],
.pill[data-status="answered"],
.pill[data-status="transferring"] {
  background: rgba(57, 124, 98, 0.14);
  color: #16553d;
}

.recording-link {
  margin: 0 0 12px;
}

.recording-link a {
  color: #16553d;
  font-weight: 700;
  text-decoration: none;
}

.recording-link a:hover {
  text-decoration: underline;
}

pre {
  margin: 0;
  overflow: auto;
  padding: 18px;
  border-radius: 18px;
  background: #101917;
  color: #d9f6e8;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.85rem;
  line-height: 1.6;
}

.diagnostics-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.diagnostic-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.58);
  padding: 16px;
}

.diagnostic-card h3 {
  margin: 0 0 12px;
  font-size: 0.95rem;
}

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

.diagnostic-list {
  display: grid;
  gap: 10px;
}

.diagnostic-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.92rem;
}

.events-list {
  display: grid;
  gap: 10px;
}

.history-list {
  display: grid;
  gap: 10px;
}

.history-entry {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.58);
  padding: 14px 16px;
}

.history-entry header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.history-entry p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.event-entry {
  border-radius: 14px;
  background: rgba(19, 33, 29, 0.06);
  padding: 12px;
}

.event-entry header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
}

.event-entry p {
  margin: 0;
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

#transcript-output {
  display: grid;
  gap: 12px;
}

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

.transcript-list {
  display: grid;
  gap: 12px;
}

.transcript-entry {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.64);
}

.transcript-entry header {
  margin-bottom: 8px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.transcript-entry p {
  margin: 0;
  line-height: 1.6;
}

.transcript-entry.agent {
  background: rgba(57, 124, 98, 0.08);
}

.transcript-entry.callee {
  background: rgba(200, 76, 36, 0.08);
}

@media (max-width: 780px) {
  .shell {
    width: min(100% - 20px, 1100px);
    padding-top: 28px;
  }

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

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

  .actions,
  .status-head {
    flex-direction: column;
    align-items: flex-start;
  }

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