:root {
  --bg: #f6f5fb;
  --panel: #ffffff;
  --panel-2: #f1effa;
  --text: #1d1a2e;
  --muted: #6b6785;
  --line: #e4e1f0;
  --brand: #5b4bb7;
  --brand-2: #463a94;
  --brand-soft: #ece9fb;
  --ok: #1f9d6b;
  --ok-soft: #e3f6ee;
  --warn: #b7791f;
  --warn-soft: #fdf3e1;
  --bad: #d14343;
  --bad-soft: #fdeaea;
  --shadow: 0 1px 2px rgba(30, 20, 70, 0.06), 0 4px 16px rgba(30, 20, 70, 0.05);
  --radius: 12px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12111a;
    --panel: #1b1a26;
    --panel-2: #232232;
    --text: #ecebf5;
    --muted: #9b98b3;
    --line: #2e2c40;
    --brand: #8b7cf0;
    --brand-2: #a597ff;
    --brand-soft: #2a2648;
    --ok: #43c08d;
    --ok-soft: #173327;
    --warn: #e0a645;
    --warn-soft: #3a2d14;
    --bad: #f06b6b;
    --bad-soft: #3d1c1f;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--brand); }
button, input, select, textarea { font: inherit; color: inherit; }
code, .mono { font-family: "JetBrains Mono", ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 12.5px; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
h1 { font-size: 22px; font-weight: 650; }
h2 { font-size: 16px; font-weight: 600; }
h3 { font-size: 14px; font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.hidden { display: none !important; }

/* layout */
.app { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.side {
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 18px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; font-weight: 650; font-size: 15px; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 9px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  display: grid; place-items: center; color: #fff;
}
.brand small { display: block; font-weight: 500; color: var(--muted); font-size: 11.5px; }
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 8px;
  color: var(--muted); text-decoration: none; font-weight: 500;
}
.nav a:hover { background: var(--panel-2); color: var(--text); }
.nav a.active { background: var(--brand-soft); color: var(--brand); }
.nav .badge { margin-left: auto; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 6px; padding: 8px; }
.main { padding: 28px 32px 60px; max-width: 1180px; width: 100%; }
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.head p { margin: 4px 0 0; }

/* componentes */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 18px 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.grid { display: grid; gap: 14px; }
.stats { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.two { grid-template-columns: 1.4fr 1fr; }
.stat .label { color: var(--muted); font-size: 12.5px; font-weight: 500; }
.stat .value { font-size: 22px; font-weight: 650; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat .sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.spacer { flex: 1; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 34px; padding: 0 14px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--panel); cursor: pointer; font-weight: 550;
  white-space: nowrap;
}
.btn:hover { background: var(--panel-2); }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-2); }
.btn.danger { color: var(--bad); }
.btn.danger.solid { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12.5px; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--panel-2); }
.icon { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--panel-2); color: var(--muted); }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.brand { background: var(--brand-soft); color: var(--brand); }
.badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--bad); color: #fff; font-size: 11px; font-weight: 700; display: inline-grid; place-items: center; }

.bar { height: 8px; border-radius: 999px; background: var(--panel-2); overflow: hidden; display: flex; }
.bar > span { display: block; height: 100%; background: var(--brand); }
.bar > span.alt { background: color-mix(in srgb, var(--brand) 40%, transparent); }
.bar.ok > span { background: var(--ok); }

.banner { display: flex; gap: 14px; align-items: center; padding: 16px 20px; border-radius: var(--radius); border: 1px solid var(--line); }
.banner .dot { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex: none; }
.banner.ok { background: var(--ok-soft); border-color: transparent; }
.banner.ok .dot { background: var(--ok); color: #fff; }
.banner.warn { background: var(--warn-soft); border-color: transparent; }
.banner.warn .dot { background: var(--warn); color: #fff; }
.banner.bad { background: var(--bad-soft); border-color: transparent; }
.banner.bad .dot { background: var(--bad); color: #fff; }

.list { display: flex; flex-direction: column; }
.list > .item { display: flex; gap: 12px; align-items: center; padding: 12px 20px; border-top: 1px solid var(--line); }
.list > .item:first-child { border-top: 0; }

table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 10px 20px; border-bottom: 1px solid var(--line); }
td { padding: 12px 20px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--panel-2); }

.disk { padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; }
.disk-top { display: flex; align-items: flex-start; gap: 12px; }
.disk-ico { width: 38px; height: 38px; border-radius: 10px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; flex: none; }
.disk.offline .disk-ico { background: var(--bad-soft); color: var(--bad); }
.disk.removed { opacity: 0.6; }
.disks { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-weight: 550; font-size: 13px; }
.field .hint { color: var(--muted); font-size: 12px; }
.input, select.input, textarea.input {
  height: 36px; padding: 0 11px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); width: 100%;
}
textarea.input { height: auto; padding: 8px 11px; }
.input:focus { outline: 2px solid color-mix(in srgb, var(--brand) 35%, transparent); border-color: var(--brand); }
.check { display: flex; align-items: center; gap: 8px; cursor: pointer; }

.secret-box { background: var(--panel-2); border-radius: 10px; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.secret-row { display: flex; gap: 8px; align-items: center; }
.secret-row .k { width: 92px; color: var(--muted); font-size: 12.5px; flex: none; }
.secret-row code { flex: 1; word-break: break-all; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 5px 8px; }
pre.snippet { margin: 0; background: var(--panel-2); border-radius: 10px; padding: 12px 14px; overflow: auto; white-space: pre-wrap; word-break: break-all; }

dialog {
  border: 1px solid var(--line); border-radius: 14px; padding: 0; background: var(--panel); color: var(--text);
  width: min(560px, calc(100vw - 32px)); box-shadow: 0 20px 60px rgba(20, 10, 60, 0.25);
}
dialog.wide { width: min(720px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(15, 10, 35, 0.45); }
.dlg-head { padding: 18px 22px 0; display: flex; align-items: center; justify-content: space-between; }
.dlg-body { padding: 16px 22px; display: flex; flex-direction: column; gap: 14px; max-height: 70vh; overflow: auto; }
.dlg-foot { padding: 14px 22px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; }

.browser { border: 1px solid var(--line); border-radius: 10px; max-height: 260px; overflow: auto; }
.browser button { display: flex; width: 100%; gap: 8px; align-items: center; padding: 7px 12px; border: 0; background: none; cursor: pointer; text-align: left; }
.browser button:hover { background: var(--panel-2); }

.segmented { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.segmented label { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; cursor: pointer; display: flex; flex-direction: column; gap: 2px; }
.segmented input { display: none; }
.segmented label:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.segmented b { font-size: 14px; }

.events { max-height: 380px; overflow: auto; }
.events .item { align-items: flex-start; padding: 9px 20px; font-size: 13px; }
.lvl { width: 8px; height: 8px; border-radius: 50%; margin-top: 7px; background: var(--muted); flex: none; }
.lvl.warn { background: var(--warn); }
.lvl.error { background: var(--bad); }

.shards { display: flex; gap: 3px; }
.shards i { width: 10px; height: 18px; border-radius: 3px; background: var(--brand); display: block; }
.shards i.p { background: color-mix(in srgb, var(--brand) 45%, transparent); }

.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.auth .card { width: min(400px, 100%); padding: 28px; display: flex; flex-direction: column; gap: 16px; }
.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg);
  padding: 10px 16px; border-radius: 10px; font-weight: 550; z-index: 100; box-shadow: var(--shadow); max-width: calc(100vw - 32px);
}
.toast.err { background: var(--bad); color: #fff; }
.empty { padding: 36px 20px; text-align: center; color: var(--muted); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); padding: 0 16px; }
.tabs button { border: 0; background: none; padding: 10px 10px; cursor: pointer; color: var(--muted); font-weight: 550; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button.active { color: var(--brand); border-bottom-color: var(--brand); }

@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 10px 12px; }
  .brand { padding: 0 8px 0 0; }
  .nav { display: flex; flex-wrap: wrap; gap: 2px; }
  .side-foot { display: none; }
  .main { padding: 20px 16px 48px; }
  .two { grid-template-columns: 1fr; }
  th:nth-child(n + 4), td:nth-child(n + 4) { display: none; }
}
