:root {
  color-scheme: dark;
  --bg: #0a0a0c;
  --panel: rgba(24, 23, 27, .94);
  --panel-2: #211f24;
  --line: #38343b;
  --text: #f4f0e8;
  --muted: #aaa4ac;
  --red: #e6352b;
  --red-dark: #9e1d1d;
  --amber: #ffbd45;
  --green: #51d58b;
  --radius: 18px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--text); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.ambient { position: fixed; width: 420px; height: 420px; border-radius: 50%; filter: blur(130px); opacity: .16; pointer-events: none; }
.ambient-one { background: var(--red); top: -180px; left: -120px; }
.ambient-two { background: var(--amber); right: -260px; bottom: -250px; }

.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(460px, 100%); padding: 42px; border: 1px solid var(--line); border-radius: 28px; background: var(--panel); box-shadow: 0 30px 90px #0009; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand svg { width: 48px; height: 48px; fill: var(--red); stroke: var(--amber); stroke-width: 3; }
.brand strong { display: block; font-size: 25px; letter-spacing: .16em; }
.brand span { display: block; color: var(--muted); font-size: 10px; letter-spacing: .28em; }
.brand-large { margin-bottom: 44px; }
.brand-large svg { width: 64px; height: 64px; }
.brand-large strong { font-size: 34px; }
.eyebrow { color: var(--amber); font-size: 11px; font-weight: 800; letter-spacing: .18em; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 12px; font-size: 34px; }
h2 { margin-bottom: 0; font-size: 28px; }
.muted { color: var(--muted); line-height: 1.6; }
.stack { display: grid; gap: 18px; margin-top: 30px; }
label { display: grid; gap: 8px; color: #d8d1d8; font-size: 13px; }
input, select, textarea { width: 100%; border: 1px solid var(--line); border-radius: 11px; padding: 12px 13px; color: var(--text); background: #111013; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--red); box-shadow: 0 0 0 3px #e6352b20; }
button { border: 0; border-radius: 11px; padding: 12px 16px; color: white; background: linear-gradient(135deg, var(--red), var(--red-dark)); font-weight: 750; }
button:hover { filter: brightness(1.08); }
.ghost { background: transparent; border: 1px solid var(--line); color: var(--muted); }
.form-error { min-height: 18px; margin: 0; color: #ff7770; font-size: 13px; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 238px 1fr; }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 26px 18px; border-right: 1px solid var(--line); background: #0d0c0f; display: flex; flex-direction: column; }
.sidebar .brand { padding: 0 10px 28px; }
nav { display: grid; gap: 7px; }
nav button { text-align: left; background: transparent; color: var(--muted); padding: 12px 14px; }
nav button.active { color: white; background: linear-gradient(90deg, #e6352b25, transparent); border-left: 2px solid var(--red); border-radius: 0 10px 10px 0; }
.operator { margin-top: auto; padding: 16px 10px 0; border-top: 1px solid var(--line); display: grid; gap: 5px; }
.operator small { color: var(--amber); text-transform: uppercase; letter-spacing: .12em; }
.operator button { margin-top: 12px; }
.workspace { min-width: 0; padding: 34px clamp(22px, 4vw, 58px) 70px; }
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 34px; }
.live { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 12px; }
.live i { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 14px var(--green); }
.flash { margin-bottom: 20px; padding: 13px 16px; border: 1px solid #4c754f; border-radius: 12px; background: #1d3924; }

.cards { display: grid; grid-template-columns: repeat(3, minmax(170px, 1fr)); gap: 16px; }
.card, .panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.card { padding: 22px; min-height: 138px; }
.card .label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .1em; }
.card .value { margin-top: 18px; font-size: 34px; font-weight: 800; }
.card .note { color: var(--muted); font-size: 12px; }
.panel { margin-top: 18px; padding: 22px; overflow: hidden; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.panel-head h3 { margin: 0; }
.actions { display: flex; gap: 9px; flex-wrap: wrap; }
.actions button { padding: 9px 12px; font-size: 12px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { color: var(--muted); text-align: left; font-size: 10px; text-transform: uppercase; letter-spacing: .1em; }
th, td { padding: 13px 10px; border-bottom: 1px solid #302d33; vertical-align: top; }
tbody tr:hover { background: #ffffff05; }
.badge { display: inline-flex; border: 1px solid var(--line); border-radius: 99px; padding: 4px 8px; color: var(--muted); font-size: 11px; }
.badge.active, .badge.success { border-color: #32734c; color: var(--green); background: #153322; }
.badge.critical, .badge.failure, .badge.disabled { border-color: #7d302e; color: #ff7770; background: #3b1717; }
.badge.warning, .badge.degraded { border-color: #775c2a; color: var(--amber); background: #332814; }
.row-actions { display: flex; gap: 7px; }
.row-actions button { padding: 7px 9px; font-size: 11px; background: #2a272d; }
.empty { padding: 30px; color: var(--muted); text-align: center; }
.alert-list { display: grid; gap: 10px; }
.alert { padding: 13px 15px; border-left: 3px solid var(--amber); background: #242025; border-radius: 8px; }
.alert.critical { border-color: var(--red); }
.alert strong { display: block; margin-bottom: 4px; }
.alert span { color: var(--muted); font-size: 12px; }

dialog { width: min(560px, calc(100% - 28px)); border: 1px solid var(--line); border-radius: 20px; padding: 24px; color: var(--text); background: #17161a; box-shadow: 0 35px 100px #000c; }
dialog::backdrop { background: #000a; backdrop-filter: blur(5px); }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.modal-head h3 { margin: 0; }
.icon-button { padding: 4px 10px; background: transparent; border: 1px solid var(--line); font-size: 22px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.form-grid .wide { grid-column: 1 / -1; }
.form-submit { grid-column: 1 / -1; margin-top: 8px; }
code { color: var(--amber); }

@media (max-width: 900px) {
  .app-shell { grid-template-columns: 82px 1fr; }
  .sidebar { padding: 22px 10px; }
  .sidebar .brand div, nav button, .operator span, .operator small { font-size: 0; }
  .sidebar .brand { justify-content: center; padding-inline: 0; }
  .sidebar .brand svg { width: 42px; }
  nav button { text-align: center; padding: 14px 5px; }
  nav button::first-letter { font-size: 15px; }
  .cards { grid-template-columns: repeat(2, minmax(150px, 1fr)); }
}

@media (max-width: 620px) {
  .app-shell { display: block; }
  .sidebar { position: static; width: 100%; height: auto; flex-direction: row; align-items: center; overflow-x: auto; }
  .sidebar .brand, .operator { display: none; }
  nav { display: flex; }
  nav button { min-width: 90px; font-size: 12px; }
  .workspace { padding: 24px 16px 50px; }
  .topbar { align-items: flex-start; }
  .live { display: none; }
  .cards, .form-grid { grid-template-columns: 1fr; }
}
