:root {
  --bg: #0f1419;
  --surface: #1a2332;
  --border: #2d3a4f;
  --text: #e8eef7;
  --muted: #8b9cb3;
  --accent: #3d8bfd;
  --accent-dim: #2563c7;
  --success: #34d399;
  --error: #f87171;
  --radius: 10px;
  font-family: "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.muted { color: var(--muted); }
.small { font-size: 0.875rem; }

.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}
.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
}
.auth-card h1 { margin-top: 0; font-size: 1.5rem; }

.layout-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.layout-top h1 { margin: 0; font-size: 1.15rem; }
.layout-body { padding: 1.5rem; max-width: 1200px; margin: 0 auto; }

.stack { display: flex; flex-direction: column; gap: 0.75rem; }
label { display: flex; flex-direction: column; gap: 0.35rem; font-size: 0.9rem; }
input, textarea, select {
  padding: 0.5rem 0.65rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font: inherit;
}
textarea { min-height: 100px; resize: vertical; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font: inherit;
}
.btn.primary {
  background: var(--accent);
  border-color: var(--accent-dim);
  color: #fff;
}
.btn.danger { border-color: var(--error); color: var(--error); }
.btn.small { padding: 0.25rem 0.5rem; font-size: 0.8rem; }

.alert {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
}
.alert-error { background: rgba(248,113,113,0.15); border: 1px solid var(--error); color: #fecaca; }
.alert-success { background: rgba(52,211,153,0.12); border: 1px solid var(--success); color: #a7f3d0; }

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
}
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}
.panel h2 { margin: 0 0 1rem; font-size: 1.05rem; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
th, td { text-align: left; padding: 0.5rem 0.4rem; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; }

.badge {
  display: inline-block;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  font-size: 0.75rem;
  background: var(--border);
}
.badge-ok { background: rgba(52,211,153,0.25); color: #a7f3d0; }
.badge-err { background: rgba(248,113,113,0.2); color: #fecaca; }
.badge-queue { background: rgba(61,139,253,0.2); color: #93c5fd; }

.inline-check {
  flex-direction: row !important;
  align-items: center;
  gap: 0.5rem;
}
.inline-check input { width: auto; }

.transcript-box {
  width: 100%;
  font-size: 0.85rem;
  line-height: 1.45;
  opacity: 0.95;
}

.admin-edit-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
}
.admin-edit-box h3 {
  margin: 0 0 1rem;
  font-size: 1rem;
}
.admin-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}
.table-wrap {
  overflow-x: auto;
}
.admin-user-table .admin-actions {
  white-space: nowrap;
}
.admin-user-table .admin-actions .inline-form {
  display: inline-block;
  margin-left: 0.35rem;
  vertical-align: middle;
}

/* Help / documentation — sidebar + main column (two grid children only) */
.doc-layout {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}
@media (min-width: 960px) {
  .doc-layout {
    display: grid;
    grid-template-columns: minmax(200px, 260px) minmax(0, 1fr);
    gap: 1.75rem;
    align-items: start;
  }
  .doc-sidebar {
    position: sticky;
    top: 1rem;
    align-self: start;
    max-height: calc(100vh - 5rem);
    overflow-y: auto;
    overflow-x: hidden;
  }
}
.doc-main {
  min-width: 0;
}
.doc-lead {
  margin: 0 0 1rem;
}
.doc-toc-title {
  margin: 0 0 0.75rem;
  font-size: 0.95rem;
}
.doc-toc-list {
  margin: 0;
  padding-left: 1.1rem;
  font-size: 0.88rem;
  line-height: 1.6;
}
.doc-toc-list ul {
  margin: 0.35rem 0 0.5rem;
  padding-left: 1rem;
  list-style: disc;
}
.doc-content {
  min-width: 0;
}
.doc-section {
  margin-bottom: 1.25rem;
}
.doc-section:last-child {
  margin-bottom: 0;
}
.doc-section h2 {
  margin-top: 0;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
  font-size: 1.2rem;
}
.doc-section h3 {
  margin: 1.25rem 0 0.5rem;
  font-size: 1.02rem;
  color: var(--text);
}
.doc-section ul {
  margin: 0.5rem 0;
  padding-left: 1.25rem;
}
.doc-section p {
  margin: 0.65rem 0;
}
.doc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  margin: 0.75rem 0;
}
.doc-table th,
.doc-table td {
  border: 1px solid var(--border);
  padding: 0.5rem 0.65rem;
  vertical-align: top;
}
.doc-table th {
  background: var(--bg);
  color: var(--muted);
  text-align: left;
}
.doc-table code {
  font-size: 0.85em;
}
.doc-section code {
  background: var(--bg);
  padding: 0.12rem 0.35rem;
  border-radius: 4px;
  font-size: 0.88em;
}
.score-pill {
  font-weight: 700;
  color: var(--success);
}

.tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.tabs a {
  padding: 0.4rem 0.85rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  color: var(--muted);
}
.tabs a.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.inline-form { display: inline; }

.rec-detail audio { width: 100%; margin: 0.5rem 0; }
