:root {
  color-scheme: light;
  --bg: #f5f4ef;
  --card: #fffefa;
  --text: #20221e;
  --muted: #74786f;
  --line: #dedfd8;
  --accent: #354f3f;
  --accent-hover: #263d30;
  --danger: #a43e36;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--text); }
button, input, select, textarea { font: inherit; }
button { border: 0; border-radius: 9px; padding: 10px 16px; background: var(--accent); color: white; cursor: pointer; font-weight: 650; }
button:hover { background: var(--accent-hover); }
button:disabled { opacity: .55; cursor: wait; }
button.secondary { background: transparent; color: var(--text); border: 1px solid var(--line); }
main { min-height: 100vh; }
.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(420px, 100%); }
.brand { font-family: Georgia, serif; font-size: 28px; letter-spacing: -.5px; }
h1 { margin: 8px 0; font-size: 28px; }
h2 { margin: 0 0 8px; font-size: 18px; }
p { color: var(--muted); line-height: 1.6; }
.muted, small { color: var(--muted); }
.error { min-height: 20px; color: var(--danger); }
.card { padding: 24px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 5px 18px rgb(35 42 34 / 4%); }
label { display: grid; gap: 7px; font-size: 14px; font-weight: 650; }
input, select, textarea { width: 100%; border: 1px solid #cfd1c8; border-radius: 8px; background: white; padding: 10px 12px; color: var(--text); }
input:focus, select:focus, textarea:focus { outline: 2px solid #9daf9f; border-color: var(--accent); }
.login-card label { margin: 18px 0; }
.login-card button { width: 100%; }
header { height: 76px; padding: 0 max(28px, calc((100vw - 1180px)/2)); display: flex; align-items: center; justify-content: space-between; background: var(--card); border-bottom: 1px solid var(--line); }
header p { margin: 0; font-size: 12px; }
.header-actions { display: flex; align-items: center; gap: 16px; }
nav { display: flex; gap: 4px; padding: 18px max(28px, calc((100vw - 1180px)/2)) 0; }
nav button { color: var(--muted); background: transparent; }
nav button:hover, nav button.active { color: var(--text); background: #e7e9e2; }
[data-panel], .notice { width: min(1180px, calc(100% - 56px)); margin: 28px auto 56px; }
.notice { padding: 12px 16px; background: #e6eee8; border: 1px solid #bfd0c2; border-radius: 9px; color: #274632; }
.notice.error { background: #f7e9e6; border-color: #dfbbb4; color: var(--danger); }
.page-title { display: flex; justify-content: space-between; align-items: end; margin-bottom: 20px; }
.page-title h1, .page-title p { margin: 0; }
.metric-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 16px; }
.metric { display: grid; gap: 12px; }
.metric span { color: var(--muted); }
.metric strong { font-size: 24px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.full { grid-column: 1 / -1; }
.switch-row, .section-heading { display: flex; align-items: center; justify-content: space-between; }
.switch-row span { display: grid; gap: 5px; }
.switch-row input, .section-heading input { width: 22px; height: 22px; }
.form-actions { display: flex; justify-content: flex-end; }
#models-form { display: grid; gap: 18px; }
#prompts-form { display: grid; gap: 18px; }
#prompts-form label { margin-top: 12px; }
.section-heading { margin-bottom: 22px; }
.section-heading p { margin: 0; }
.test-model { margin-top: 20px; }
.sticky-actions { position: sticky; bottom: 16px; display: flex; justify-content: flex-end; pointer-events: none; }
.sticky-actions button { pointer-events: auto; box-shadow: 0 5px 22px rgb(0 0 0 / 18%); }
.table-wrap { overflow-x: auto; padding: 0; }
table { width: 100%; border-collapse: collapse; min-width: 820px; }
th, td { padding: 14px 16px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; font-size: 13px; }
th { color: var(--muted); font-weight: 650; }
td code { white-space: pre-wrap; word-break: break-word; }

@media (max-width: 720px) {
  header { padding: 0 18px; }
  nav { padding: 12px 14px 0; overflow-x: auto; }
  [data-panel], .notice { width: calc(100% - 28px); margin-top: 18px; }
  .metric-grid, .form-grid { grid-template-columns: 1fr; }
  .full { grid-column: auto; }
  .page-title { align-items: flex-start; gap: 12px; }
  .card { padding: 18px; }
  #admin-name { display: none; }
}
