:root {
  color-scheme: dark;
  --bg: #07090f;
  --surface: #10141e;
  --surface-2: #171d2a;
  --border: rgba(255, 255, 255, .09);
  --text: #f6f7fb;
  --muted: #9ba6ba;
  --red: #e80037;
  --red-2: #ff315d;
  --blue: #0666df;
  --blue-2: #38a0ff;
  --green: #43d17c;
  --amber: #f6b94d;
  --radius: 18px;
  --shadow: 0 22px 60px rgba(0, 0, 0, .3);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body { margin: 0; min-height: 100vh; color: var(--text); background: radial-gradient(circle at 90% 0, rgba(6, 102, 223, .15), transparent 27rem), var(--bg); }
a { color: var(--blue-2); text-decoration: none; }
a:hover { color: #82c4ff; }
button, input, select, textarea { font: inherit; }
button, .primary { cursor: pointer; }

.shell { min-height: 100vh; display: grid; grid-template-columns: 270px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 22px 18px; border-right: 1px solid var(--border); background: rgba(10, 13, 20, .96); }
.brand { display: flex; align-items: center; gap: 12px; color: var(--text); padding: 4px 8px 22px; }
.brand img { width: 52px; height: 52px; object-fit: contain; }
.brand span, .account { min-width: 0; display: grid; gap: 3px; }
.brand strong, .account strong { overflow: hidden; text-overflow: ellipsis; }
.brand small, .account small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
nav { display: grid; gap: 5px; }
nav a { color: #c9d0dd; padding: 11px 13px; border-radius: 11px; font-weight: 650; }
nav a:hover { background: rgba(255, 255, 255, .05); color: #fff; }
nav a.active { color: #fff; background: linear-gradient(110deg, rgba(232, 0, 55, .28), rgba(6, 102, 223, .24)); box-shadow: inset 3px 0 var(--red); }
.account { margin-top: auto; padding: 18px 10px 4px; border-top: 1px solid var(--border); }
.account form { margin-top: 5px; }

.content { min-width: 0; padding: 30px clamp(18px, 3vw, 46px) 55px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 28px; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(1.8rem, 3vw, 2.55rem); letter-spacing: -.04em; }
h2 { margin-bottom: 18px; font-size: 1.2rem; }
.eyebrow { margin-bottom: 7px; color: var(--blue-2); font-size: .72rem; font-weight: 850; letter-spacing: .16em; text-transform: uppercase; }
.muted { color: var(--muted); line-height: 1.6; }
.health { color: var(--green); font-size: .9rem; font-weight: 750; }

.stats-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 15px; margin-bottom: 18px; }
.stat, .panel { border: 1px solid var(--border); background: linear-gradient(150deg, rgba(23, 29, 42, .97), rgba(13, 17, 26, .98)); box-shadow: var(--shadow); }
.stat { min-height: 125px; display: grid; align-content: space-between; padding: 20px; border-radius: var(--radius); }
.stat span { color: var(--muted); font-size: .88rem; }
.stat strong { font-size: 2.2rem; letter-spacing: -.05em; }
.grid { display: grid; gap: 18px; margin-bottom: 18px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.panel { min-width: 0; padding: clamp(18px, 2.5vw, 27px); border-radius: var(--radius); margin-bottom: 18px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
label { min-width: 0; display: grid; gap: 7px; color: #dce1ea; font-size: .88rem; font-weight: 700; }
label small, .block { display: block; color: var(--muted); font-weight: 450; margin-top: 1px; }
.span-2 { grid-column: 1 / -1; }
input, select, textarea { width: 100%; color: var(--text); background: #090d14; border: 1px solid rgba(255, 255, 255, .13); border-radius: 10px; outline: none; padding: 11px 12px; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--blue-2); box-shadow: 0 0 0 3px rgba(56, 160, 255, .13); }
.check { display: flex; align-items: center; gap: 9px; }
.check input { width: auto; accent-color: var(--red); }
button, .primary { border: 0; border-radius: 10px; padding: 11px 15px; color: #fff; background: #252d3c; font-weight: 780; text-align: center; }
button:hover { background: #323c50; }
.primary { background: linear-gradient(115deg, var(--red), #c60054 55%, var(--blue)); box-shadow: 0 10px 24px rgba(232, 0, 55, .2); }
.primary:hover { color: #fff; filter: brightness(1.12); }
.full { width: 100%; }
.link-button { padding: 0; color: var(--red-2); background: none; font-weight: 700; }
.link-button:hover { color: #ff7894; background: none; }

.table-wrap { max-width: 100%; overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th { color: var(--muted); font-size: .72rem; letter-spacing: .07em; text-align: left; text-transform: uppercase; }
th, td { padding: 13px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:hover { background: rgba(255, 255, 255, .025); }
code { color: #a9d7ff; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; overflow-wrap: anywhere; }
.actions, .inline-form { display: flex; align-items: center; gap: 12px; }
.actions form { margin: 0; }
.inline-form select { min-width: 130px; }
.empty { color: var(--muted); text-align: center; padding: 28px; }
.badge { display: inline-flex; align-items: center; border: 1px solid transparent; border-radius: 999px; padding: 5px 9px; font-size: .72rem; font-weight: 800; }
.status-active, .status-live { color: #9af0b9; border-color: rgba(67, 209, 124, .25); background: rgba(67, 209, 124, .11); }
.status-pending, .status-upcoming, .status-degraded { color: #ffd48b; border-color: rgba(246, 185, 77, .25); background: rgba(246, 185, 77, .11); }
.status-disabled, .status-blocked, .status-suspended, .status-expired, .status-cancelled { color: #ff9bb0; border-color: rgba(232, 0, 55, .28); background: rgba(232, 0, 55, .12); }
.status-finished, .status-unlinked { color: #bac5d7; border-color: rgba(186, 197, 215, .22); background: rgba(186, 197, 215, .09); }
.alert { margin-bottom: 18px; padding: 13px 15px; border-radius: 11px; border: 1px solid; }
.alert.success { color: #a5f4c2; background: rgba(67, 209, 124, .1); border-color: rgba(67, 209, 124, .28); }
.alert.error { color: #ffc0ce; background: rgba(232, 0, 55, .11); border-color: rgba(232, 0, 55, .3); }

.login-body { display: grid; min-height: 100vh; place-items: center; padding: 26px; background: radial-gradient(circle at 20% 20%, rgba(232, 0, 55, .18), transparent 30rem), radial-gradient(circle at 85% 15%, rgba(6, 102, 223, .22), transparent 34rem), #06080d; }
.login-layout { width: min(980px, 100%); display: grid; grid-template-columns: 1.15fr .85fr; overflow: hidden; border: 1px solid var(--border); border-radius: 24px; box-shadow: 0 34px 100px rgba(0, 0, 0, .52); background: rgba(10, 13, 20, .95); }
.login-brand, .login-card { padding: clamp(28px, 5vw, 60px); }
.login-brand { display: grid; align-content: center; min-height: 560px; background: linear-gradient(145deg, rgba(232, 0, 55, .16), rgba(6, 102, 223, .14)); }
.login-brand img { width: min(260px, 72%); margin: 0 auto 35px; filter: drop-shadow(0 18px 30px rgba(0, 0, 0, .36)); }
.login-brand h1 { max-width: 520px; margin-bottom: 15px; font-size: clamp(2.4rem, 5vw, 4.7rem); line-height: .96; }
.login-brand p:last-child { max-width: 540px; color: #c5ccda; font-size: 1.05rem; line-height: 1.65; }
.login-card { display: grid; align-content: center; background: rgba(9, 12, 18, .96); }
.login-card form { display: grid; gap: 17px; margin: 23px 0 18px; }
.login-card > small { color: var(--muted); text-align: center; }

@media (max-width: 980px) {
  .shell { grid-template-columns: 220px minmax(0, 1fr); }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.two { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .shell { display: block; }
  .sidebar { position: static; width: 100%; height: auto; padding: 14px; border-right: 0; border-bottom: 1px solid var(--border); }
  .brand { padding-bottom: 12px; }
  nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  nav a { text-align: center; font-size: .86rem; }
  .account { display: none; }
  .content { padding: 22px 14px 40px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .stat { min-height: 105px; }
  .stat strong { font-size: 1.7rem; }
  .form-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .panel-head { align-items: flex-start; flex-direction: column; }
  .login-layout { grid-template-columns: 1fr; }
  .login-brand { display: none; }
}

@media (max-width: 440px) {
  .stats-grid { grid-template-columns: 1fr; }
  .topbar { align-items: flex-start; }
  .health { margin-top: 7px; font-size: .75rem; }
}
