:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #1b1f24;
  --muted: #6a7380;
  --border: #e2e5ea;
  --accent: #2f6fed;
  --accent-text: #ffffff;
  --code-bg: #0f1720;
  --code-text: #e6edf3;
  --danger: #c93c37;
  --warn-bg: #fff5d6;
  --warn-text: #6b5300;
  --radius: 14px;
  font-family: system-ui, -apple-system, 'Segoe UI', 'Noto Sans Georgian', sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1216;
    --surface: #171b21;
    --text: #e7eaee;
    --muted: #8d96a3;
    --border: #2a3039;
    --accent: #5b8cff;
    --code-bg: #0a0d11;
    --warn-bg: #3a3112;
    --warn-text: #f1d78a;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font-size: 16px; line-height: 1.55; }
button, input, textarea, select { font: inherit; color: inherit; }
button {
  cursor: pointer; border: 1px solid var(--border); background: var(--surface);
  border-radius: 10px; padding: 8px 14px;
}
button.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
button.danger { color: var(--danger); }
button:disabled { opacity: .55; cursor: default; }
input, textarea, select {
  width: 100%; background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 12px;
}
input:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 14px; }
.error { color: var(--danger); font-size: 14px; min-height: 1.2em; }

/* login */
.login {
  min-height: 100%; display: grid; place-items: center; padding: 16px;
}
.login form {
  width: 100%; max-width: 360px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px; display: grid; gap: 12px;
}
.login h1 { margin: 0; font-size: 22px; }

/* shared: admin header + chat message content (layout lives in chat.css) */
header.bar {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 12px 16px; border-bottom: 1px solid var(--border); background: var(--bg);
}
header.bar h1 { font-size: 18px; margin: 0; }
.msg.assistant p { margin: 0 0 8px; }
.msg.assistant p:last-child { margin-bottom: 0; }
.msg.assistant code { background: color-mix(in srgb, var(--border) 60%, transparent); padding: 1px 5px; border-radius: 5px; font-size: .92em; }
.codeblock { position: relative; margin: 8px 0; }
.codeblock pre {
  margin: 0; background: var(--code-bg); color: var(--code-text); padding: 12px 14px;
  border-radius: 10px; overflow-x: auto; font-size: 14px;
}
.codeblock pre code { background: none; padding: 0; }
.codeblock button {
  position: absolute; top: 6px; right: 6px; padding: 3px 9px; font-size: 12px;
  background: #ffffff1a; color: #e6edf3; border-color: #ffffff33;
}
.typing::after { content: '▍'; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* admin */
.admin { max-width: 1000px; margin: 0 auto; padding: 0 16px 40px; }
.tabs { display: flex; gap: 6px; margin: 16px 0; flex-wrap: wrap; }
.tabs button.active { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; margin-bottom: 14px;
}
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.meter { height: 10px; background: var(--border); border-radius: 999px; overflow: hidden; margin: 8px 0 4px; }
.meter > div { height: 100%; background: var(--accent); }
.meter.warn > div { background: #e0a100; }
.warnbox { background: var(--warn-bg); color: var(--warn-text); border-radius: 10px; padding: 10px 12px; font-size: 14px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
td.wrap { white-space: pre-wrap; overflow-wrap: anywhere; }
.table-scroll { overflow-x: auto; }
.badge { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--warn-bg); color: var(--warn-text); }
.editor { display: grid; gap: 10px; }
.editor textarea { min-height: 320px; font-family: ui-monospace, Consolas, monospace; font-size: 14px; }
.editor .grid2 { display: grid; grid-template-columns: 1fr 120px; gap: 10px; }
label.field { display: grid; gap: 4px; font-size: 14px; color: var(--muted); }
@media (max-width: 600px) {
  .editor .grid2 { grid-template-columns: 1fr; }
}
