:root {
  --bg: #f4f5f2;
  --panel: #ffffff;
  --ink: #1d2320;
  --muted: #66706b;
  --line: #e2e5e0;
  --side: #ffffff;
  --side-ink: #2b332f;
  --accent: #005826;
  --accent-ink: #ffffff;
  --accent-soft: #e3efe7;
  --ok: #1e8a4c;
  --ok-soft: #e2f4e8;
  --warn: #a96500;
  --warn-soft: #fbefd9;
  --bad: #b3261e;
  --bad-soft: #fbe5e3;
  --info: #2b5fa8;
  --info-soft: #e4ecf8;
  --mono: ui-monospace, "Cascadia Mono", Consolas, Menlo, monospace;
  --radius: 8px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.45 "Segoe UI", system-ui, -apple-system, Roboto, sans-serif; background: var(--bg); color: var(--ink); }
.hidden { display: none !important; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0; letter-spacing: -.01em; }
h2 { font-size: 15px; margin: 0 0 12px; }
code, .mono { font-family: var(--mono); font-size: 12.5px; }

/* Layout */
.app { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.side { background: var(--side); color: var(--side-ink); display: flex; flex-direction: column; padding: 18px 12px; position: sticky; top: 0; height: 100vh; border-right: 1px solid var(--line); }
.brand { display: block; padding: 2px 8px 18px; text-decoration: none !important; }
.brand img { display: block; width: 100%; max-width: 190px; height: auto; }
.brand small { display: block; margin-top: 6px; color: var(--muted); font-size: 12px; letter-spacing: .02em; text-transform: uppercase; }
#nav { display: flex; flex-direction: column; gap: 2px; }
#nav a { color: var(--side-ink); padding: 8px 10px; border-radius: 6px; text-decoration: none; }
#nav a:hover { background: #f1f4f1; color: var(--ink); }
#nav a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; box-shadow: inset 3px 0 0 var(--accent); }
.side-foot { gap: 10px; margin-top: auto; padding: 10px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--muted); }
.main { padding: 26px 32px 60px; min-width: 0; }
.head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.head .sub { color: var(--muted); margin-top: 2px; }
.crumb { color: var(--muted); font-size: 13px; margin-bottom: 4px; }

/* Panels & tiles */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 18px; }
.panel.flush { padding: 0; overflow: hidden; }
.panel.flush > h2 { padding: 16px 18px 0; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin-bottom: 18px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.tile .n { font-size: 26px; font-weight: 650; letter-spacing: -.02em; }
.tile .l { color: var(--muted); font-size: 13px; }
.tile.warn .n { color: var(--warn); }
.tile.bad .n { color: var(--bad); }
.tile.ok .n { color: var(--ok); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 6px 12px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-word; }

/* Tables */
.tbl-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; background: #fafbf9; position: sticky; top: 0; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #f8faf8; }
tr.click { cursor: pointer; }
td.num, th.num { text-align: right; }
td.nowrap { white-space: nowrap; }
td.actions { white-space: nowrap; text-align: right; }
.empty { padding: 28px; text-align: center; color: var(--muted); }

/* Badges & dots */
.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 550; background: #eef0ed; color: #47504c; white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.accent { background: var(--accent-soft); color: var(--accent); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; background: #b9c0bc; vertical-align: 1px; }
.dot.on { background: #2fbf71; box-shadow: 0 0 0 3px #2fbf7126; }

/* Forms & buttons */
.btn { font: inherit; border: 1px solid var(--line); background: #fff; color: var(--ink); padding: 7px 13px; border-radius: 6px; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: #c8cdc8; background: #fafbfa; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: #00441d; }
.btn.danger { color: var(--bad); }
.btn.danger:hover { background: var(--bad-soft); border-color: #efc4c0; }
.btn.sm { padding: 3px 9px; font-size: 13px; }
.btn.wide { width: 100%; padding: 10px; }
.btn:disabled { opacity: .5; cursor: default; }
.link { background: none; border: 0; color: inherit; cursor: pointer; font: inherit; text-decoration: underline; padding: 0; }
.btns { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
label { display: block; font-weight: 550; font-size: 13px; margin-bottom: 12px; }
label small { font-weight: 400; color: var(--muted); }
input, select, textarea { display: block; width: 100%; margin-top: 4px; font: inherit; padding: 8px 10px; border: 1px solid #cfd5d0; border-radius: 6px; background: #fff; color: var(--ink); }
textarea { font-family: var(--mono); font-size: 12.5px; min-height: 140px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid #00582640; border-color: var(--accent); }
input[type=checkbox] { display: inline; width: auto; margin: 0 6px 0 0; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar input, .toolbar select { width: auto; min-width: 200px; margin: 0; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.err { color: var(--bad); min-height: 18px; font-size: 13px; margin-bottom: 8px; }
.hint { color: var(--muted); font-size: 13px; }
.selbar { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--accent-soft); border-radius: var(--radius); margin-bottom: 12px; }

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.tabs button { background: none; border: 0; padding: 9px 14px; font: inherit; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button.active { color: var(--ink); border-bottom-color: var(--accent); font-weight: 600; }

/* Code */
.code { position: relative; background: #17211d; color: #d7e4dd; padding: 12px 14px; border-radius: 6px; font-family: var(--mono); font-size: 12px; white-space: pre-wrap; word-break: break-all; margin: 6px 0 14px; }
.code .copy { position: absolute; top: 6px; right: 6px; background: #2a3d35; color: #d7e4dd; border: 0; border-radius: 4px; padding: 3px 8px; cursor: pointer; font: 12px system-ui; }
pre.out { background: #f6f7f5; border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; font-family: var(--mono); font-size: 12px; white-space: pre-wrap; word-break: break-word; max-height: 420px; overflow: auto; margin: 0; }

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; background: radial-gradient(circle at 30% 20%, #e3efe7, var(--bg) 60%); }
.login-logo { display: block; width: 240px; max-width: 100%; height: auto; margin: 0 auto 14px; }
.login-title { text-align: center; font-weight: 650; font-size: 16px; margin-bottom: 20px; }
.login-title span { display: block; font-weight: 400; font-size: 13px; color: var(--muted); }
.login-card { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 28px; width: 360px; box-shadow: 0 10px 40px #0000000f; }

/* Modal */
.modal { position: fixed; inset: 0; background: #0f17138c; display: grid; place-items: center; z-index: 50; padding: 20px; }
.modal-card { background: #fff; border-radius: 10px; width: min(640px, 100%); max-height: calc(100vh - 40px); overflow: auto; padding: 22px; box-shadow: 0 20px 60px #0000003a; }
.modal-card.wide { width: min(900px, 100%); }
.modal-card h2 { font-size: 17px; margin-bottom: 16px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }

/* Toasts */
.toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 60; }
.toast { background: #17211d; color: #fff; padding: 10px 14px; border-radius: 6px; box-shadow: 0 6px 20px #0003; max-width: 380px; }
.toast.bad { background: var(--bad); }

.bar { height: 6px; background: #e8ebe7; border-radius: 3px; overflow: hidden; min-width: 80px; }
.bar > span { display: block; height: 100%; background: var(--accent); }

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 10px; }
  .brand { padding: 4px 8px 8px 6px; } .brand img { width: 120px; } .brand small { display: none; }
  #nav { flex-direction: row; flex-wrap: wrap; }
  .side-foot { margin: 0 0 0 auto; border: 0; }
  .main { padding: 18px 16px 40px; }
  .grid2, .row2 { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 120px 1fr; }
}

.score { font-size: 38px; font-weight: 700; letter-spacing: -.03em; line-height: 1.1; margin-bottom: 4px; }
.score.ok { color: var(--accent); } .score.warn { color: var(--warn); } .score.crit { color: var(--bad); }
.meters { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-top: 14px; }
.meter .ml { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--muted); margin-bottom: 4px; }
.meter .ml b { color: var(--ink); }
.setupbox { display: flex; gap: 14px; align-items: center; justify-content: space-between; background: var(--accent-soft); border-radius: 6px; padding: 12px 14px; margin-bottom: 14px; flex-wrap: wrap; }
.or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; margin: 16px 0; }
.or::before, .or::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.btn.sso { display: block; text-align: center; text-decoration: none; color: var(--ink); }
.btn.sso::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 3px; background: #fd4b2d; margin-right: 8px; vertical-align: 0; }
.center { text-align: center; }
.mfa-head { text-align: center; margin: 0 0 14px; }
.qr { display: block; width: 200px; height: 200px; image-rendering: pixelated; border: 1px solid var(--line); border-radius: 8px; padding: 6px; background: #fff; }
.codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px 18px; font-family: var(--mono); font-size: 15px; background: #f6f7f5; border: 1px solid var(--line); border-radius: 8px; padding: 14px 18px; margin: 10px 0 14px; }
.stack > * + * { margin-top: 10px; }
.notice { background: var(--warn-soft); border: 1px solid #f0d9a8; border-radius: var(--radius); padding: 12px 14px; margin-bottom: 18px; }
.notice.ok { background: var(--accent-soft); border-color: #bfdccb; }
ol.steps { margin: 6px 0 12px; padding-left: 20px; } ol.steps li { margin: 4px 0; }
pre.out.small { max-height: 220px; }
