:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #eef0f3;
  --text: #1b1f24;
  --muted: #5c6470;
  --border: #d9dde3;
  --accent: #1f6f5f;
  --accent-text: #ffffff;
  --ok: #1f7a3d;
  --ok-bg: #e3f3e8;
  --warn: #8a5a00;
  --warn-bg: #fff3d6;
  --err: #a32d2d;
  --err-bg: #fbe3e3;
  --radius: 10px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111418;
    --surface: #1a1f25;
    --surface-2: #232931;
    --text: #e6e9ee;
    --muted: #9aa4b1;
    --border: #2f3741;
    --accent: #4fb39a;
    --accent-text: #0e1512;
    --ok: #6ccf8a;
    --ok-bg: #16311f;
    --warn: #f0c060;
    --warn-bg: #3a2d10;
    --err: #ff8a8a;
    --err-bg: #3c1a1a;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre { font-family: var(--mono); font-size: 0.92em; }
pre {
  background: var(--surface-2);
  padding: 12px 14px;
  border-radius: var(--radius);
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

/* layout */
.topbar {
  display: flex; align-items: center; gap: 24px;
  padding: 12px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.brand { font-weight: 700; letter-spacing: 0.2px; color: var(--text); }
.brand small { color: var(--muted); font-weight: 400; margin-left: 8px; }
.nav { display: flex; gap: 16px; margin-left: auto; }
.nav a { color: var(--muted); }
.nav a.active, .nav a:hover { color: var(--text); text-decoration: none; }
.page { width: 100%; max-width: 1100px; margin: 0 auto; padding: 24px 16px 64px; flex: 1; }
.wizard { display: grid; grid-template-columns: 260px 1fr; gap: 24px; }
@media (max-width: 820px) { .wizard { grid-template-columns: 1fr; } }

/* cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
}
.card + .card { margin-top: 16px; }
.card h1, .card h2 { margin-top: 0; }
h1 { font-size: 1.5rem; margin: 0 0 6px; }
h2 { font-size: 1.15rem; margin: 0 0 10px; }
.lead { color: var(--muted); margin: 0 0 18px; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.stat { display: flex; flex-direction: column; gap: 2px; }
.stat .num { font-size: 1.8rem; font-weight: 700; }
.stat .lbl { color: var(--muted); font-size: 0.9rem; }

/* steps sidebar */
.steps { list-style: none; margin: 0; padding: 0; }
.steps li { display: flex; gap: 12px; align-items: flex-start; padding: 10px 6px; border-radius: 8px; }
.steps li.current { background: var(--surface-2); }
.steps a { color: inherit; display: flex; gap: 12px; width: 100%; }
.steps a:hover { text-decoration: none; }
.dot {
  flex: 0 0 24px; height: 24px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.8rem; font-weight: 700;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--muted);
}
.dot.done { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.steps .t { font-weight: 600; }
.steps .s { color: var(--muted); font-size: 0.85rem; }
.progress { height: 6px; background: var(--surface-2); border-radius: 999px; overflow: hidden; margin: 10px 0 18px; }
.progress > div { height: 100%; background: var(--accent); }

/* checks */
.checks { list-style: none; padding: 0; margin: 0 0 16px; }
.checks li { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.checks li:last-child { border-bottom: 0; }
.checks .mark { flex: 0 0 22px; font-weight: 700; }
.checks .ok .mark { color: var(--ok); }
.checks .bad .mark { color: var(--err); }
.checks .detail { color: var(--muted); font-size: 0.9rem; word-break: break-all; }

/* forms */
label { display: block; font-weight: 600; margin: 14px 0 6px; }
label small { font-weight: 400; color: var(--muted); }
input[type=text], input[type=password], input[type=email], input[type=month], select, textarea {
  width: 100%; padding: 9px 11px; font: inherit;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px;
}
input[type=file] { margin: 8px 0; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.actions { display: flex; gap: 12px; margin-top: 20px; flex-wrap: wrap; align-items: center; }
.btn {
  display: inline-block; padding: 9px 16px; border-radius: 8px; font: inherit; font-weight: 600;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn.primary { background: var(--accent); color: var(--accent-text); border-color: transparent; }
.btn.primary:hover { filter: brightness(1.05); }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.spacer { flex: 1; }

/* badges and flashes */
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 0.8rem; font-weight: 600; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.err { background: var(--err-bg); color: var(--err); }
.badge.muted { background: var(--surface-2); color: var(--muted); }
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; font-weight: 500; }
.flash.ok { background: var(--ok-bg); color: var(--ok); }
.flash.error { background: var(--err-bg); color: var(--err); }
.note { background: var(--surface-2); border-left: 3px solid var(--accent); padding: 10px 14px; border-radius: 6px; color: var(--muted); font-size: 0.93rem; }

/* tables */
table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.3px; }
tr:last-child td { border-bottom: 0; }
.wrap { word-break: break-word; }

/* org tree */
.tree, .tree ul { list-style: none; margin: 0; padding-left: 22px; }
.tree > li { padding-left: 0; }
.tree li { position: relative; padding: 6px 0 6px 0; }
.tree ul li::before { content: ""; position: absolute; left: -14px; top: 0; bottom: 0; border-left: 1px solid var(--border); }
.tree ul li::after { content: ""; position: absolute; left: -14px; top: 20px; width: 10px; border-top: 1px solid var(--border); }
.agent { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.agent .name { font-weight: 600; }
.agent code { color: var(--muted); }
.agent select { width: auto; padding: 5px 8px; }
.card-md { white-space: pre-wrap; font-size: 0.9rem; color: var(--muted); margin: 6px 0 0; }

.footer { text-align: center; color: var(--muted); font-size: 0.85rem; padding: 16px; }

.pill { display:inline-block; padding:2px 10px; border-radius:999px; font-size:0.85em; font-weight:600; }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.bad { background: var(--err-bg); color: var(--err); }
details > summary { list-style: none; }
details > summary::-webkit-details-marker { display: none; }
