:root {
  --bg: #0f1419;
  --panel: #1a222c;
  --panel2: #232d3a;
  --text: #e8eef5;
  --muted: #9aa8b8;
  --accent: #3d9cf0;
  --ok: #3ecf8e;
  --warn: #f0b429;
  --bad: #f07178;
  --line: #2c3848;
  --radius: 12px;
  --font: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--font);
  background: radial-gradient(1200px 600px at 10% -10%, #1a2a3d, var(--bg));
  color: var(--text);
  min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
.top {
  display: flex; gap: 1rem; align-items: center; justify-content: space-between;
  padding: .75rem 1rem; border-bottom: 1px solid var(--line); background: rgba(15,20,25,.9);
  position: sticky; top: 0; z-index: 10; backdrop-filter: blur(8px);
}
.brand a { color: var(--text); font-weight: 700; letter-spacing: .02em; }
nav { display: flex; gap: .75rem; flex-wrap: wrap; }
nav a { color: var(--muted); padding: .35rem .55rem; border-radius: 8px; }
nav a.on, nav a:hover { background: var(--panel2); color: var(--text); }
.logout button, button, .btn {
  background: var(--accent); color: #041018; border: 0; border-radius: 8px;
  padding: .55rem .9rem; font-weight: 600; cursor: pointer;
}
.logout button { background: var(--panel2); color: var(--text); }
.wrap { padding: 1rem; max-width: 1200px; margin: 0 auto; }
.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem;
}
.card h2, .card h3 { margin: 0 0 .6rem; font-size: 1rem; }
.kpi { font-size: 1.6rem; font-weight: 700; }
.muted { color: var(--muted); font-size: .9rem; }
.ok { color: var(--ok); } .warn { color: var(--warn); } .bad { color: var(--bad); }
.row { display: flex; gap: 1rem; flex-wrap: wrap; }
.col { flex: 1 1 320px; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: .45rem .35rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.pill {
  display: inline-block; padding: .15rem .45rem; border-radius: 999px; background: var(--panel2);
  font-size: .75rem; color: var(--muted);
}
.pill.run { background: #163528; color: var(--ok); }
.pill.idle { background: #2a2f38; }
.pill.err { background: #3a1d22; color: var(--bad); }
.chat {
  display: flex; flex-direction: column; gap: .6rem; max-height: 420px; overflow: auto;
  background: var(--panel2); border-radius: var(--radius); padding: .75rem;
}
.bubble { padding: .65rem .75rem; border-radius: 10px; max-width: 92%; white-space: pre-wrap; }
.bubble.user { align-self: flex-end; background: #1e3a5f; }
.bubble.assistant { align-self: flex-start; background: #243040; }
.chat-form { display: flex; gap: .5rem; margin-top: .75rem; }
.chat-form input {
  flex: 1; background: var(--panel2); border: 1px solid var(--line); color: var(--text);
  border-radius: 8px; padding: .65rem .75rem;
}
.login-body { display: grid; place-items: center; min-height: 100vh; }
.login-card {
  width: min(400px, 92vw); background: var(--panel); border: 1px solid var(--line);
  border-radius: 16px; padding: 1.4rem; display: grid; gap: .75rem;
}
.login-card label { display: grid; gap: .35rem; font-size: .9rem; color: var(--muted); }
.login-card input {
  background: var(--panel2); border: 1px solid var(--line); color: var(--text);
  border-radius: 8px; padding: .65rem .75rem;
}
.err { background: #3a1d22; color: var(--bad); padding: .5rem .7rem; border-radius: 8px; }
.alert {
  border: 1px solid #5a4020; background: #2a2114; color: #f0d9a0; padding: .8rem 1rem;
  border-radius: var(--radius); margin-bottom: 1rem;
}
.facts { display: grid; gap: .45rem; margin: .75rem 0; }
.facts.compact { grid-template-columns: 1fr; }
.facts div { display: grid; grid-template-columns: 9rem 1fr; gap: .5rem; }
.facts dt { color: var(--muted); margin: 0; }
.facts dd { margin: 0; }
.tech { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .78rem; word-break: break-all; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.task-head, .actions { display: flex; gap: .75rem; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; }
.actions form { display: inline-flex; gap: .35rem; align-items: center; flex-wrap: wrap; }
.actions select, .decision input, .task input, label input {
  background: var(--panel); border: 1px solid var(--line); color: var(--text);
  border-radius: 8px; padding: .5rem .65rem;
}
.decision label { display: grid; gap: .35rem; margin: .6rem 0; }
.btn-bad { background: var(--bad) !important; color: #fff !important; }
.btn-muted { background: var(--panel) !important; color: var(--text) !important; border: 1px solid var(--line); }
tr.dim { opacity: .72; }
.decision button, .actions button { margin: .2rem .25rem .2rem 0; }
@media (max-width: 700px) {
  .top { flex-wrap: wrap; }
  .kpi { font-size: 1.3rem; }
  .facts div { grid-template-columns: 1fr; }
  nav { width: 100%; }
  .chat { max-height: 320px; }
  th, td { font-size: .82rem; }
}
