:root {
  --bg: #0b0f14;
  --panel: #121922;
  --panel-2: #172231;
  --line: #243244;
  --text: #e7eef7;
  --muted: #8fa3b8;
  --accent: #5eead4;
  --accent-2: #60a5fa;
  --warn: #fbbf24;
  --bad: #fb7185;
  --good: #34d399;
  --radius: 14px;
  --shadow: 0 18px 50px rgba(0, 0, 0, .35);
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: radial-gradient(1200px 600px at 20% -10%, #143042 0%, var(--bg) 55%); color: var(--text); }
body { padding: 0; }
a { color: var(--accent); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

.login-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
}
.login-card {
  width: min(440px, 100%); background: linear-gradient(180deg, rgba(23,34,49,.96), rgba(18,25,34,.96));
  border: 1px solid var(--line); border-radius: 20px; padding: 30px; box-shadow: var(--shadow);
}
.login-card h1 { margin: 0 0 6px; font-size: 26px; letter-spacing: -.02em; }
.login-card p { margin: 0 0 22px; color: var(--muted); line-height: 1.5; }
.btn {
  appearance: none; border: 1px solid var(--line); background: var(--panel-2); color: var(--text);
  border-radius: 10px; padding: 10px 14px; font-size: 14px; font-weight: 600; cursor: pointer;
  transition: border-color .15s ease, transform .05s ease, background .15s ease;
}
.btn:hover { border-color: #3a5169; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: linear-gradient(180deg, #2dd4bf, #14b8a6); border-color: #14b8a6; color: #042f2e; }
.btn.danger { background: linear-gradient(180deg, #fb7185, #e11d48); border-color: #e11d48; color: #fff; }
.btn.ghost { background: transparent; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.sm { padding: 7px 10px; font-size: 12px; }

.shell { max-width: 1280px; margin: 0 auto; padding: 22px 18px 70px; }
header.top {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 0 18px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand .mark {
  width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center;
  background: linear-gradient(135deg, #2dd4bf, #3b82f6); color: #04111a; font-weight: 900;
}
.brand h1 { font-size: 18px; margin: 0; letter-spacing: -.01em; }
.brand p { margin: 2px 0 0; font-size: 12px; color: var(--muted); }
.top-actions { display: flex; align-items: center; gap: 10px; }
.pill { border: 1px solid var(--line); background: rgba(18,25,34,.7); border-radius: 999px; padding: 7px 11px; font-size: 12px; color: var(--muted); }
.pill.live { color: var(--good); border-color: rgba(52,211,153,.35); }
.pill.warn { color: var(--warn); border-color: rgba(251,191,36,.35); }
.pill.bad { color: var(--bad); border-color: rgba(251,113,133,.35); }

.grid { display: grid; gap: 14px; }
.grid.cards { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 14px; }
.card {
  background: linear-gradient(180deg, rgba(23,34,49,.9), rgba(18,25,34,.9));
  border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow);
}
.card .label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
.card .value { font-size: 26px; font-weight: 750; margin-top: 8px; letter-spacing: -.02em; }
.card .sub { color: var(--muted); font-size: 12px; margin-top: 6px; line-height: 1.45; }
.card.compact .value { font-size: 18px; }

.layout { display: grid; grid-template-columns: 1.35fr 1fr; gap: 14px; align-items: start; }
.panel {
  background: linear-gradient(180deg, rgba(23,34,49,.88), rgba(18,25,34,.92));
  border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow);
  margin-bottom: 14px; overflow: hidden;
}
.panel h2 { margin: 0 0 4px; font-size: 15px; letter-spacing: -.01em; }
.panel .lead { margin: 0 0 14px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.panel-head h2 { margin: 0; }

.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid rgba(36,50,68,.65); }
.row:first-of-type { border-top: 0; }
.row .k { color: var(--muted); font-size: 13px; }
.row .v { font-weight: 600; font-size: 13px; text-align: right; }
.bar { height: 9px; border-radius: 999px; background: #0a1119; border: 1px solid var(--line); overflow: hidden; margin: 10px 0 6px; }
.bar > i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #2dd4bf, #60a5fa); transition: width .4s ease; }
.bar.warn > i { background: linear-gradient(90deg, #fbbf24, #fb923c); }
.bar.bad > i { background: linear-gradient(90deg, #fb7185, #e11d48); }

.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.field { display: grid; gap: 6px; margin: 10px 0; }
.field label { font-size: 12px; color: var(--muted); }
.field input[type=text], .field input[type=number], .field textarea {
  width: 100%; border: 1px solid var(--line); background: #0b121a; color: var(--text);
  border-radius: 9px; padding: 10px 11px; font: inherit; font-size: 13px;
}
.field textarea { min-height: 70px; resize: vertical; }
.check { display: flex; align-items: center; gap: 9px; padding: 8px 0; font-size: 13px; }
.check input { width: 16px; height: 16px; accent-color: #2dd4bf; }

.list { display: grid; gap: 8px; }
.item {
  border: 1px solid rgba(36,50,68,.8); background: rgba(11,18,26,.55);
  border-radius: 10px; padding: 10px 12px; display: flex; gap: 10px; align-items: flex-start; justify-content: space-between;
}
.item .title { font-size: 13px; font-weight: 650; }
.item .meta { font-size: 12px; color: var(--muted); margin-top: 3px; line-height: 1.45; }
.dot { width: 8px; height: 8px; border-radius: 99px; background: var(--muted); display: inline-block; margin-right: 6px; }
.dot.good { background: var(--good); }
.dot.bad { background: var(--bad); }
.dot.warn { background: var(--warn); }

table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
th { text-align: left; color: var(--muted); font-weight: 600; padding: 8px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 9px 8px; border-bottom: 1px solid rgba(36,50,68,.55); vertical-align: top; }
tr:hover td { background: rgba(96,165,250,.04); }
.badge { display: inline-block; border: 1px solid var(--line); border-radius: 999px; padding: 2px 8px; font-size: 11px; color: var(--muted); }
.badge.bad { color: var(--bad); border-color: rgba(251,113,133,.4); }
.badge.warn { color: var(--warn); border-color: rgba(251,191,36,.4); }
.badge.good { color: var(--good); border-color: rgba(52,211,153,.4); }

.toast {
  position: fixed; right: 18px; bottom: 18px; max-width: min(460px, calc(100vw - 36px));
  background: #101a25; border: 1px solid var(--line); border-left: 3px solid var(--accent);
  border-radius: 10px; padding: 12px 14px; box-shadow: var(--shadow); font-size: 13px; z-index: 50;
}
.toast.bad { border-left-color: var(--bad); }
.toast.warn { border-left-color: var(--warn); }

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(3,7,12,.72); backdrop-filter: blur(4px);
  display: grid; place-items: center; padding: 18px; z-index: 100;
}
.modal {
  width: min(520px, 100%); background: #111b26; border: 1px solid var(--line); border-radius: 16px;
  padding: 20px; box-shadow: var(--shadow);
}
.modal h3 { margin: 0 0 8px; font-size: 17px; }
.modal p { margin: 0 0 14px; color: var(--muted); line-height: 1.5; font-size: 13px; }
.modal .actions { justify-content: flex-end; }

.error-box { border: 1px solid rgba(251,113,133,.35); background: rgba(251,113,133,.08); color: #fecdd3; border-radius: 10px; padding: 12px; font-size: 13px; line-height: 1.5; }
.ok-box { border: 1px solid rgba(52,211,153,.35); background: rgba(52,211,153,.08); color: #bbf7d0; border-radius: 10px; padding: 12px; font-size: 13px; line-height: 1.5; }

@media (max-width: 980px) {
  .grid.cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .layout { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .grid.cards { grid-template-columns: 1fr; }
  header.top { align-items: flex-start; flex-direction: column; }
}
