:root {
  --bg: #0f1419;
  --card: #1a222c;
  --text: #e7ecf1;
  --muted: #9aa7b5;
  --accent: #3d8bfd;
  --danger: #d9534f;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
}
.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid #2a3441;
}
.top a { color: var(--accent); margin-right: 1rem; }
main { max-width: 900px; margin: 1.5rem auto; padding: 0 1rem; }
main.wide { max-width: 1200px; }
.metrics { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 0.75rem; margin-bottom: 1rem; }
.metric { background: var(--card); border-radius: 8px; padding: 0.75rem 1rem; }
.metric span { display: block; color: var(--muted); font-size: 0.85rem; }
.metric strong { font-size: 1.25rem; }
.category { margin-bottom: 1.25rem; padding-bottom: 0.75rem; border-bottom: 1px solid #2a3441; }
.setting-row { margin-bottom: 0.75rem; }
label.inline { display: inline-flex; align-items: center; gap: 0.4rem; margin-right: 1rem; }
label.inline input { width: auto; margin: 0; }

/* Settings page — clearer layout */
.settings-page .page-head { margin-bottom: 1rem; }
.settings-page .lede { color: var(--muted); max-width: 42rem; margin: 0.35rem 0 0; line-height: 1.45; }
.settings-jump {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.85rem;
  margin: 0 0 1.25rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid #2a3441;
}
.settings-jump a {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.9rem;
}
.settings-jump a:hover, .settings-jump a:focus { text-decoration: underline; }
.flash {
  padding: 0.65rem 0.9rem;
  border-radius: 6px;
  margin-bottom: 1rem;
  background: #1e3a2f;
  border: 1px solid #2f6b4f;
  color: #c6f0d8;
}
.flash.error {
  background: #3a1e1e;
  border-color: #6b2f2f;
  color: #f0c6c6;
}
.status-card .status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.75rem;
  margin-top: 0.75rem;
}
.status-pill {
  background: #0c1015;
  border: 1px solid #2a3441;
  border-radius: 8px;
  padding: 0.75rem 0.9rem;
}
.status-pill .label { display: block; color: var(--muted); font-size: 0.8rem; margin-bottom: 0.25rem; }
.status-pill .value { font-weight: 600; font-size: 1rem; }
.status-pill.ok .value { color: #6dca8e; }
.status-pill.warn .value { color: #e0b35a; }
.status-pill.bad .value { color: #e07a76; }
.callout {
  margin-top: 0.85rem;
  padding: 0.65rem 0.85rem;
  border-radius: 6px;
  background: #1a2430;
  border-left: 3px solid var(--accent);
  color: var(--muted);
  font-size: 0.92rem;
}
.settings-section {
  margin: 1.5rem 0 0;
  padding-top: 1rem;
  border-top: 1px solid #2a3441;
}
.settings-section:first-child { margin-top: 0.5rem; border-top: 0; padding-top: 0; }
.settings-section h3 {
  margin: 0 0 0.25rem;
  font-size: 1.1rem;
}
.settings-section .section-help {
  margin: 0 0 0.85rem;
  color: var(--muted);
  font-size: 0.9rem;
}
.setting-row.compact {
  display: grid;
  grid-template-columns: minmax(10rem, 14rem) minmax(8rem, 1fr) auto;
  gap: 0.5rem 0.75rem;
  align-items: center;
  margin: 0;
  padding: 0.45rem 0;
  border-bottom: 1px solid #232c37;
}
.setting-row.compact:last-child { border-bottom: 0; }
.setting-row.compact .field-label {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  margin: 0;
  font-size: 0.92rem;
}
.setting-row.compact .field-label .hint {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 400;
}
.setting-row.compact input,
.setting-row.compact select {
  width: 100%;
  margin: 0;
  max-width: 28rem;
}
.setting-row.compact input.narrow,
.setting-row.compact select.narrow {
  max-width: 10rem;
}
.setting-row.compact button {
  margin: 0;
  white-space: nowrap;
  min-width: 4.5rem;
}
.setting-row.compact button.saved { background: #2f6b4f; }
.setting-row.compact button.errored { background: var(--danger); }
.badge-future {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #c9b27a;
  background: #2a2418;
  border: 1px solid #5a4a2a;
  border-radius: 3px;
  padding: 0.1rem 0.35rem;
  margin-left: 0.35rem;
  vertical-align: middle;
}
.secret-card {
  background: #0c1015;
  border: 1px solid #2a3441;
  border-radius: 8px;
  padding: 0.9rem 1rem;
  margin-bottom: 0.75rem;
}
.secret-card h3 { margin: 0 0 0.35rem; font-size: 1rem; }
.secret-card .secret-meta { margin: 0 0 0.75rem; font-size: 0.88rem; }
.secret-card .secret-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem;
  align-items: end;
}
.secret-card .secret-actions label { margin: 0; }
.secret-card .secret-actions input { margin-top: 0.25rem; }
.secret-card .btn-row { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.secret-card .btn-row button { margin: 0; }
.reauth-bar {
  background: #0c1015;
  border: 1px solid #2a3441;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  max-width: 24rem;
}
.reauth-bar label { margin: 0; }
.reauth-bar .req { color: var(--muted); font-weight: 400; font-size: 0.85rem; }
.result-box { margin-top: 0.75rem; font-size: 0.85rem; }
@media (max-width: 720px) {
  .setting-row.compact {
    grid-template-columns: 1fr;
  }
  .setting-row.compact input,
  .setting-row.compact select,
  .setting-row.compact input.narrow,
  .setting-row.compact select.narrow {
    max-width: none;
  }
  .secret-card .secret-actions {
    grid-template-columns: 1fr;
  }
}
.card {
  background: var(--card);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
}
label { display: block; margin: 0.5rem 0; }
input {
  width: 100%;
  padding: 0.5rem;
  margin-top: 0.25rem;
  border-radius: 4px;
  border: 1px solid #334;
  background: #0c1015;
  color: var(--text);
}
button {
  margin-top: 0.75rem;
  margin-right: 0.5rem;
  padding: 0.45rem 0.9rem;
  border: 0;
  border-radius: 4px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}
button.danger { background: var(--danger); }
.muted { color: var(--muted); }
.error { color: var(--danger); }
.row { display: flex; flex-wrap: wrap; gap: 0.25rem; }
pre {
  background: #0c1015;
  padding: 0.75rem;
  overflow: auto;
  border-radius: 4px;
}
table { width: 100%; border-collapse: collapse; }
td, th { text-align: left; padding: 0.4rem; border-bottom: 1px solid #2a3441; }
textarea { width: 100%; min-height: 4rem; background: #0c1015; color: var(--text); border: 1px solid #334; border-radius: 4px; padding: 0.5rem; }
textarea.over-limit { border-color: var(--danger); }
.prompt-counter { margin: 0.35rem 0 0.75rem; font-size: 0.85rem; line-height: 1.4; }
.prompt-counter.warn { color: #e0b35a; }
.prompt-counter.error { color: var(--danger); }
select { width: 100%; padding: 0.5rem; margin-top: 0.25rem; background: #0c1015; color: var(--text); border: 1px solid #334; border-radius: 4px; }
