:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --border: #e2e5ea;
  --border-strong: #cfd4dc;
  --text: #1b2130;
  --muted: #687082;
  --side: #141a26;
  --side-2: #1c2433;
  --side-text: #aeb6c6;
  --accent: #e0446c;
  --accent-dark: #c0325a;
  --ok: #1f8a54;
  --ok-bg: #e7f5ee;
  --warn: #a86400;
  --warn-bg: #fdf3e2;
  --bad: #c22f3a;
  --bad-bg: #fcebec;
  --info-bg: #eaf0fb;
  --radius: 4px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05);
  font-family: Inter, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  color: var(--text);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); line-height: 1.5; }
a { color: var(--accent-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre, .mono { font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }
h1 { font-size: 20px; font-weight: 600; margin: 0; letter-spacing: -.01em; }
h2 { font-size: 15px; font-weight: 600; margin: 0 0 12px; }
h3 { font-size: 13px; font-weight: 600; margin: 0 0 8px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }

/* ---------- layout ---------- */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.side { background: var(--side); color: var(--side-text); padding: 18px 0; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 20px 18px; color: #fff; font-weight: 600; font-size: 15px; border-bottom: 1px solid #222b3b; }
.brand .mark { width: 28px; height: 28px; border-radius: var(--radius); background: var(--accent); display: grid; place-items: center; font-size: 13px; font-weight: 700; }
.nav { padding: 12px 10px; }
.nav .group { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #6c7488; padding: 14px 10px 6px; }
.nav a { display: flex; align-items: center; gap: 10px; color: var(--side-text); padding: 8px 10px; border-radius: var(--radius); font-size: 13.5px; }
.nav a:hover { background: var(--side-2); color: #fff; text-decoration: none; }
.nav a.on { background: var(--side-2); color: #fff; box-shadow: inset 2px 0 0 var(--accent); }
.nav svg { width: 16px; height: 16px; flex: none; opacity: .85; }
.main { min-width: 0; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; background: var(--surface); border-bottom: 1px solid var(--border); padding: 12px 28px; }
.top .who { display: flex; align-items: center; gap: 14px; color: var(--muted); font-size: 13px; }
.role { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; border: 1px solid var(--border-strong); padding: 1px 7px; border-radius: var(--radius); color: var(--text); }
.content { padding: 24px 28px 48px; max-width: 1240px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.banner { background: var(--warn-bg); color: var(--warn); padding: 8px 28px; font-size: 13px; border-bottom: 1px solid #f1dcb5; }

/* ---------- surfaces ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-body { padding: 18px 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; border-bottom: 1px solid var(--border); }
.card-head h2 { margin: 0; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }

.stat { padding: 16px 18px; }
.stat .label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }
.stat .value { font-size: 24px; font-weight: 600; margin-top: 4px; letter-spacing: -.02em; }

/* cPanel-like tool tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.tile { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; padding: 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); transition: border-color .12s, background .12s; }
.tile:hover { border-color: var(--accent); background: #fff8fa; text-decoration: none; }
.tile svg { width: 22px; height: 22px; color: var(--accent); }
.tile span { font-weight: 500; font-size: 13.5px; }

/* ---------- table ---------- */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; padding: 10px 14px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: #fbfbfc; }
.table-wrap { overflow-x: auto; }

/* ---------- badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500; padding: 2px 8px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--border); white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.badge.plain::before { display: none; }
.b-ok { color: var(--ok); background: var(--ok-bg); border-color: #c7e7d6; }
.b-warn { color: var(--warn); background: var(--warn-bg); border-color: #f1dcb5; }
.b-bad { color: var(--bad); background: var(--bad-bg); border-color: #f3c9cd; }
.b-info { color: #2a5bb8; background: var(--info-bg); border-color: #cddbf4; }

/* ---------- forms ---------- */
label { display: block; font-weight: 500; font-size: 13px; margin-bottom: 6px; }
.field { margin-bottom: 14px; }
.hint { color: var(--muted); font-size: 12.5px; margin-top: 4px; }
input[type=text], input[type=password], input[type=email], input[type=number], select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--border-strong); border-radius: var(--radius);
  background: #fff; font: inherit; color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(224, 68, 108, .12); }
textarea { min-height: 90px; resize: vertical; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 400; }
.btn { display: inline-flex; align-items: center; gap: 7px; padding: 8px 14px; border-radius: var(--radius); border: 1px solid var(--border-strong); background: #fff; color: var(--text); font: inherit; font-weight: 500; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn svg { width: 15px; height: 15px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn-danger { color: var(--bad); border-color: #efc2c6; }
.btn-danger:hover { background: var(--bad-bg); }
.btn-sm { padding: 5px 10px; font-size: 12.5px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
form.inline { display: inline; }

/* ---------- alerts ---------- */
.alert { padding: 10px 14px; border-radius: var(--radius); border: 1px solid; margin-bottom: 14px; font-size: 13.5px; }
.alert-ok { background: var(--ok-bg); border-color: #c7e7d6; color: #17643e; }
.alert-error { background: var(--bad-bg); border-color: #f3c9cd; color: #9b1f29; }
.alert-info { background: var(--info-bg); border-color: #cddbf4; color: #234c99; }

/* ---------- instance page ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; }
.tabs a { padding: 9px 14px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 500; white-space: nowrap; }
.tabs a.on { color: var(--text); border-bottom-color: var(--accent); }
.tabs a:hover { color: var(--text); text-decoration: none; }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 8px 16px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-all; }
.meter { height: 8px; background: #eceef2; border-radius: var(--radius); overflow: hidden; margin-top: 8px; }
.meter > i { display: block; height: 100%; background: var(--ok); }
.meter.mid > i { background: #d69300; }
.meter.high > i { background: var(--bad); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
pre.logs { background: #0f141e; color: #d5dbe7; padding: 14px; border-radius: var(--radius); max-height: 560px; overflow: auto; margin: 0; white-space: pre-wrap; word-break: break-all; }
.jobbar { display: none; align-items: center; gap: 10px; padding: 10px 14px; border: 1px solid #cddbf4; background: var(--info-bg); color: #234c99; border-radius: var(--radius); margin-bottom: 16px; }
.jobbar.show { display: flex; }
.spin { width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.secret { display: inline-flex; gap: 6px; align-items: center; }
.empty { padding: 36px; text-align: center; color: var(--muted); }
.copy { cursor: pointer; }

/* ---------- login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: linear-gradient(160deg, #141a26 0%, #1f2638 100%); }
.login { width: 100%; max-width: 380px; }
.login .card-body { padding: 28px; }
.login .brand { border: none; padding: 0 0 18px; color: var(--text); }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; }
  .nav { display: flex; flex-wrap: wrap; gap: 4px; }
  .nav .group { display: none; }
  .g2, .g3, .g4 { grid-template-columns: 1fr; }
  .content, .top { padding-left: 16px; padding-right: 16px; }
  .kv { grid-template-columns: 1fr; }
}
