:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --panel-2: #eef1f5;
  --border: #dde2e8;
  --text: #1a1f26;
  --muted: #677180;
  --accent: #2563eb;
  --accent-dim: #2563eb14;
  --user: #15803d;
  --agent: #b45309;
  --error: #dc2626;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.page {
  max-width: 880px;
  margin: 0 auto;
  padding: 24px 16px 64px;
}

/* --- Top nav - always full-width and identical on every page --- */
.nav {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
  flex-wrap: wrap;
}
.nav .brand {
  font-weight: 700;
  margin-right: 16px;
  color: var(--text);
}
.nav a {
  color: var(--muted);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
}
.nav a:hover { color: var(--text); text-decoration: none; background: var(--panel-2); }
.nav a.active { color: var(--accent); background: var(--accent-dim); }
.nav .agent-picker { margin-left: auto; }

/* --- Cards / layout --- */
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}
h1 { font-size: 20px; margin: 0 0 4px; }
h2 { font-size: 16px; margin: 0 0 12px; }
.subtitle { color: var(--muted); font-size: 13px; margin: 0 0 20px; }

/* --- Instructional callouts --- */
.howto {
  background: var(--accent-dim);
  border: 1px solid #2563eb33;
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 20px;
  font-size: 13.5px;
  line-height: 1.6;
}
.howto strong { color: var(--text); }
.howto ol { margin: 8px 0 0; padding-left: 20px; }
.howto li { margin-bottom: 4px; }

/* --- Forms --- */
.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
}
.field input, .field textarea, .field select {
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 9px 11px;
  font-size: 14px;
  font-family: inherit;
}
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none;
  border-color: var(--accent);
}
.field .hint { color: var(--muted); font-size: 12px; margin-top: 4px; }

/* --- Buttons --- */
button, .btn {
  font-size: 14px;
  font-weight: 600;
  padding: 9px 18px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  background: var(--accent);
  color: #fff;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
button:disabled, .btn:disabled { opacity: 0.5; cursor: not-allowed; }
button.secondary, .btn.secondary { background: var(--panel-2); color: var(--text); border: 1px solid var(--border); }
button.danger, .btn.danger { background: var(--error); }
button.small, .btn.small { padding: 5px 12px; font-size: 13px; }

/* --- Status pills --- */
.status {
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
  display: inline-block;
  background: var(--panel);
}
.status.active { color: var(--user); border-color: var(--user); background: #15803d14; }
.status.draft { color: var(--agent); border-color: var(--agent); background: #b4530914; }
.status.listening { color: var(--user); border-color: var(--user); background: #15803d14; }
.status.speaking { color: var(--agent); border-color: var(--agent); background: #b4530914; }

/* --- Tables --- */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.03em; }
tr:hover td { background: var(--panel-2); cursor: pointer; }

/* --- Chat (setup assistant) --- */
.chat-log {
  height: 420px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 12px;
  background: var(--bg);
}
.bubble { max-width: 80%; margin-bottom: 10px; padding: 9px 13px; border-radius: 12px; font-size: 14px; line-height: 1.45; }
.bubble.user { background: var(--accent); color: #fff; margin-left: auto; border-bottom-right-radius: 3px; }
.bubble.assistant { background: var(--panel-2); border-bottom-left-radius: 3px; }
.chat-input-row { display: flex; gap: 8px; }
.chat-input-row input { flex: 1; }

/* --- Voice grid --- */
.voice-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.voice-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  background: var(--panel-2);
}
.voice-card.selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.voice-card .name { font-weight: 600; margin-bottom: 2px; }
.voice-card .accent { color: var(--muted); font-size: 12px; margin-bottom: 10px; }
.voice-card .row { display: flex; gap: 8px; }

.empty { color: var(--muted); font-size: 13px; }
.error-text { color: var(--error); font-size: 13px; }

code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
pre.config {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  font-size: 12.5px;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
}
