:root {
  --bg: #0f1419;
  --surface: #1a2332;
  --surface-2: #243044;
  --text: #e8eef7;
  --muted: #93a4bb;
  --accent: #4da3ff;
  --accent-2: #7c5cff;
  --success: #3ecf8e;
  --warn: #ffd166;
  --danger: #ff6b6b;
  --border: rgba(255, 255, 255, 0.08);
  --radius: 16px;
  font-family: "SF Pro Text", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(77, 163, 255, 0.16), transparent 35%),
    radial-gradient(circle at top right, rgba(124, 92, 255, 0.14), transparent 30%),
    var(--bg);
  line-height: 1.5;
}

.page { max-width: 920px; margin: 0 auto; padding: 28px 20px 56px; }
.page.narrow { max-width: 440px; padding-top: 72px; }

.topbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 24px; }
.brand { font-weight: 700; font-size: 1.25rem; color: var(--text); text-decoration: none; }
.brand span { color: var(--accent); }
.topbar nav { display: flex; gap: 14px; align-items: center; color: var(--muted); font-size: 0.9rem; }
.topbar a, .link { color: var(--accent); text-decoration: none; background: none; border: none; padding: 0; font: inherit; cursor: pointer; }

h1 { margin: 0 0 8px; font-size: clamp(1.6rem, 4vw, 2.2rem); line-height: 1.15; }
h2 { margin: 0 0 14px; font-size: 1.15rem; }
h3 { margin: 20px 0 10px; font-size: 1rem; }

.card {
  background: rgba(26, 35, 50, 0.92);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.hidden { display: none !important; }
.error-text { color: var(--danger); }
.ok-text { color: var(--success); }

.tip {
  background: rgba(77, 163, 255, 0.08);
  border: 1px solid rgba(77, 163, 255, 0.25);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 18px;
  font-size: 0.92rem;
}
.tip p { margin: 0 0 6px; }
.tip p:last-child { margin: 0; }
.tip ul { margin: 6px 0 0; padding-left: 20px; }

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }

label { display: flex; flex-direction: column; gap: 6px; font-size: 0.9rem; margin-bottom: 14px; }
label.inline { flex-direction: row; align-items: center; gap: 8px; }
.hint { font-size: 0.8rem; color: var(--muted); }

input[type="text"], input[type="email"], input[type="password"], input[type="date"], input[type="number"],
input[type="file"], select, textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
}
textarea { min-height: 96px; resize: vertical; }
textarea.tall { min-height: 320px; font-family: "SF Mono", "Menlo", "Consolas", monospace; font-size: 0.85rem; }

.context-block { border: 1px solid var(--border); border-radius: 12px; padding: 14px; margin-bottom: 14px; }
.context-block > strong { display: block; margin-bottom: 8px; }

details { margin-bottom: 14px; }
summary { cursor: pointer; color: var(--accent); margin-bottom: 10px; }

button { appearance: none; border: none; border-radius: 12px; padding: 11px 18px; font: inherit; font-weight: 600; cursor: pointer; }
.primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: white; }
.secondary { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.danger { background: transparent; color: var(--danger); border: 1px solid rgba(255, 107, 107, 0.4); }
button:disabled { opacity: 0.45; cursor: not-allowed; }
a.button { display: inline-flex; align-items: center; text-decoration: none; border-radius: 12px; padding: 11px 18px; font-weight: 600; }

.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 8px; }

.progress { height: 10px; background: var(--surface-2); border-radius: 999px; overflow: hidden; margin: 8px 0; }
.progress > div { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--success)); transition: width 0.4s ease; }

.list { list-style: none; margin: 0; padding: 0; }
.list li {
  display: flex; justify-content: space-between; gap: 12px; align-items: center;
  padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; margin-bottom: 8px; cursor: pointer;
}
.list li:hover { border-color: rgba(77, 163, 255, 0.4); }
.status { font-size: 0.8rem; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--border); white-space: nowrap; }
.status.done { color: var(--success); border-color: rgba(62, 207, 142, 0.4); }
.status.failed { color: var(--danger); border-color: rgba(255, 107, 107, 0.4); }
.status.active { color: var(--warn); border-color: rgba(255, 209, 102, 0.4); }

.speaker-row { display: grid; grid-template-columns: 110px 1fr; gap: 12px; align-items: start; margin-bottom: 12px; }
.speaker-row .meta { font-size: 0.85rem; }
.speaker-row .sample { font-size: 0.82rem; color: var(--muted); font-style: italic; margin-top: 4px; }

.preview {
  white-space: pre-wrap; word-break: break-word; background: #f4f7fb; color: #152033;
  border-radius: 12px; padding: 16px; max-height: 460px; overflow: auto; margin: 10px 0;
  font-size: 0.92rem; line-height: 1.55;
}

table.admin { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
table.admin td, table.admin th { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--border); }
.copy-field { display: flex; gap: 8px; }
.copy-field input { flex: 1; }

footer { margin-top: 28px; color: var(--muted); font-size: 0.82rem; }

@media (max-width: 600px) {
  .speaker-row { grid-template-columns: 1fr; }
  .topbar { flex-direction: column; align-items: flex-start; }
}

.steps {
  margin: 0.75rem 0;
  padding-left: 1.4rem;
}

.steps li {
  margin: 0.3rem 0;
}

#inbox-linking {
  margin-bottom: 1rem;
}
