:root {
  --bg: #0f1115;
  --surface: #181b22;
  --border: #2a2f3a;
  --text: #e8eaf0;
  --muted: #8a91a0;
  --accent: #e50914;
  --danger-bg: #3a1417;
  --danger-text: #ffb4b8;
  color-scheme: dark;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}
h1 { font-size: 1.5rem; margin: 0 0 1rem; }
h2 { font-size: 1rem; margin: 0 0 .5rem; }
.muted { color: var(--muted); }
.spacer { flex: 1; }

/* login */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 1rem; }
.login-card {
  width: 100%; max-width: 380px; padding: 2rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
}
.brand { text-align: center; margin-bottom: 1.5rem; }
.brand h1 { margin: .5rem 0 0; }
.brand p { margin: .25rem 0 0; }
.brand-logo { max-height: 56px; }
form label { display: block; margin: 1rem 0 .35rem; font-size: .9rem; color: var(--muted); }
input[type=text], input[type=password] {
  width: 100%; padding: .7rem .8rem; font: inherit; color: var(--text);
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
}
input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
button[type=submit]:not(.link-button) {
  width: 100%; margin-top: 1.5rem; padding: .75rem; font: inherit; font-weight: 600;
  color: #fff; background: var(--accent); border: 0; border-radius: 8px; cursor: pointer;
}
.alert {
  padding: .7rem .9rem; border-radius: 8px; font-size: .9rem;
  background: var(--danger-bg); color: var(--danger-text);
}

/* panel shell */
.topbar {
  display: flex; align-items: center; gap: 1rem; padding: .75rem 1.25rem;
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.topbar form { margin: 0; }
.topbar-brand { font-weight: 700; }
.role-badge {
  font-size: .75rem; text-transform: uppercase; letter-spacing: .05em;
  padding: .15rem .5rem; border-radius: 999px; border: 1px solid var(--border);
}
.role-master { color: #ffd479; border-color: #6b5520; }
.link-button { background: none; border: 0; color: var(--muted); font: inherit; cursor: pointer; }
.link-button:hover { color: var(--text); }
.shell { display: flex; min-height: calc(100vh - 50px); }
.sidebar {
  width: 220px; flex-shrink: 0; padding: 1rem .75rem;
  background: var(--surface); border-right: 1px solid var(--border);
}
.sidebar a {
  display: block; padding: .5rem .75rem; border-radius: 6px;
  color: var(--text); text-decoration: none;
}
.sidebar a:hover { background: var(--border); }
.nav-heading {
  margin: 1rem .75rem .25rem; font-size: .75rem; text-transform: uppercase;
  letter-spacing: .05em; color: var(--muted);
}
.content { flex: 1; padding: 1.5rem; min-width: 0; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; }
.card { padding: 1rem 1.25rem; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; }
.card p { margin: .25rem 0; }

@media (max-width: 700px) {
  .shell { flex-direction: column; }
  .sidebar { width: auto; border-right: 0; border-bottom: 1px solid var(--border); }
}

/* v2 additions */
.row { display: flex; align-items: center; gap: .75rem; }
.button { padding: .5rem .9rem; background: var(--accent); color: #fff; border-radius: 8px; text-decoration: none; font-weight: 600; }
.two-col { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1rem; align-items: start; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.card + .card, .two-col > div > .card + .card { margin-top: 1rem; }
.card form.inline, form.inline { display: flex; gap: .5rem; margin: .5rem 0; }
form.inline input { flex: 1; }
form.inline button, .profile-row button, .card .row form button { width: auto; margin: 0; padding: .5rem .8rem; }
input, select { width: 100%; padding: .6rem .8rem; font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--border); border-radius: 8px; }
label.check { display: flex; align-items: center; gap: .5rem; margin-top: 1rem; }
label.check input { width: auto; }
table { width: 100%; border-collapse: collapse; margin: .5rem 0 1rem; }
th, td { text-align: left; padding: .5rem .6rem; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: .8rem; text-transform: uppercase; }
table.compact td, table.compact th { padding: .3rem .5rem; font-size: .85rem; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.small { font-size: .8rem; word-break: break-all; }
.big { font-size: 2rem; font-weight: 700; margin: 0; }
h2.section { margin-top: 2rem; }
.status { font-size: .75rem; padding: .15rem .5rem; border-radius: 999px; border: 1px solid var(--border); text-transform: uppercase; }
.status-success { color: #7ee2a8; border-color: #23573a; }
.status-failed { color: #ffb4b8; border-color: #6b2a2e; }
.status-running { color: #ffd479; border-color: #6b5520; }
.notice { padding: .7rem .9rem; margin-bottom: 1rem; border-radius: 8px; background: #16321f; color: #b6f0cc; word-break: break-all; }
pre.log { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 1rem; overflow: auto; max-height: 60vh; font-size: .8rem; white-space: pre-wrap; }
.profile-row { display: grid; grid-template-columns: 2rem minmax(0, 1fr) auto minmax(0, 1fr) auto auto auto; gap: .5rem; align-items: center; margin: .5rem 0; }
.profile-row .pos { color: var(--muted); text-align: center; }
.profile-row label.check { margin: 0; }
.danger { color: #ffb4b8; }
.danger-button { width: 100%; margin-top: 1rem; padding: .7rem; font: inherit; font-weight: 600; color: #fff; background: #8a1c22; border: 0; border-radius: 8px; cursor: pointer; }
.card a { color: var(--accent); }
@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } .profile-row { grid-template-columns: 2rem 1fr auto; } }
textarea { width: 100%; padding: .6rem .8rem; font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--border); border-radius: 8px; }
