:root {
  color-scheme: dark;
  --night: #07131d;
  --ink: #0c1c28;
  --raised: #122735;
  --line: rgba(219, 235, 245, 0.1);
  --chalk: #f4f8fb;
  --muted: #91a5b5;
  --steel: #7da6c4;
  --green: #42d392;
  --green-wash: rgba(66, 211, 146, 0.12);
  --coral: #ff7373;
  --coral-wash: rgba(255, 115, 115, 0.11);
  --amber: #ffd187;
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.3);
}

* { box-sizing: border-box; }

html {
  min-height: 100%;
  background: var(--night);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--chalk);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
  background:
    linear-gradient(90deg, rgba(125, 166, 196, 0.05) 1px, transparent 1px) 0 0 / 96px 100%,
    radial-gradient(circle at 85% 0%, rgba(63, 120, 155, 0.14), transparent 34%),
    var(--night);
}

button, input { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible {
  outline: 2px solid var(--steel);
  outline-offset: 3px;
}

.hidden { display: none !important; }

.shell {
  position: relative;
  width: min(900px, calc(100% - 32px));
  margin: 0 auto;
  padding: 54px 0 80px 22px;
}

.shell::before {
  position: absolute;
  inset: 54px auto 80px 0;
  width: 2px;
  background: linear-gradient(var(--steel), rgba(125, 166, 196, 0.04));
  content: "";
}

.login-card {
  width: min(590px, 100%);
  margin: 8vh auto 0;
  padding: 40px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(12, 28, 40, 0.94);
  box-shadow: var(--shadow);
}

.brand-mark {
  display: grid;
  width: 58px;
  height: 58px;
  margin-bottom: 28px;
  place-items: center;
  border-radius: 16px;
  background: var(--chalk);
  color: var(--night);
  font-family: "Arial Narrow", "Avenir Next Condensed", sans-serif;
  font-size: 14px;
  font-weight: 900;
  letter-spacing: -0.03em;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--steel);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.18em;
}

h1, h2, p { margin-top: 0; }
h1, h2 {
  font-family: "Avenir Next Condensed", "Arial Narrow", ui-sans-serif, sans-serif;
}
h1 {
  margin-bottom: 9px;
  font-size: clamp(32px, 6vw, 50px);
  font-weight: 750;
  letter-spacing: -0.045em;
  line-height: 0.98;
}
h2 {
  margin-bottom: 6px;
  font-size: 21px;
  letter-spacing: -0.02em;
}
.subtle, .panel-heading p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.55;
}

.login-card form { margin-top: 32px; }
.login-card label {
  display: block;
  margin-bottom: 9px;
  color: #d4dee5;
  font-size: 13px;
}
.login-row { display: flex; gap: 10px; }
.login-row input {
  min-width: 0;
  flex: 1;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--raised);
  color: var(--chalk);
}
.login-row button {
  padding: 14px 22px;
  border: 0;
  border-radius: 12px;
  background: var(--chalk);
  color: var(--night);
  font-weight: 800;
}
.form-error {
  min-height: 20px;
  margin: 10px 0 0;
  color: var(--coral);
  font-size: 13px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 26px;
}
.topbar .subtle { max-width: 560px; }

.ghost-button {
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: transparent;
  color: #c7d4dd;
}
.ghost-button:hover { background: rgba(255, 255, 255, 0.045); }
.ghost-button:disabled, .login-row button:disabled {
  cursor: wait;
  opacity: 0.52;
}

.active-summary {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 18px;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(12, 28, 40, 0.72);
}
.active-summary span { color: var(--muted); font-size: 13px; }
.active-summary strong {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 18px;
}

.distribution-warning {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-bottom: 18px;
  padding: 15px 17px;
  border: 1px solid rgba(255, 209, 135, 0.25);
  border-radius: 14px;
  background: rgba(255, 209, 135, 0.08);
  color: var(--amber);
  font-size: 14px;
}

.panel {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(12, 28, 40, 0.94);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.16);
}
.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 22px 24px;
  border-bottom: 1px solid var(--line);
}
.panel-heading p { font-size: 13px; }
.manager-list { padding: 0 24px; }
.manager-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 90px 92px;
  align-items: center;
  gap: 18px;
  padding: 21px 0;
  border-bottom: 1px solid var(--line);
}
.manager-row:last-child { border-bottom: 0; }
.manager-name {
  overflow: hidden;
  font-size: 16px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  font-weight: 800;
}
.status::before {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  content: "";
}
.status.enabled { color: var(--green); }
.status.enabled::before {
  background: var(--green);
  box-shadow: 0 0 0 5px var(--green-wash);
}
.status.disabled { color: var(--coral); }
.status.disabled::before {
  background: var(--coral);
  box-shadow: 0 0 0 5px var(--coral-wash);
}
.toggle-button {
  width: 92px;
  padding: 10px 14px;
  border-radius: 11px;
  font-weight: 800;
}
.toggle-button.turn-off {
  border: 1px solid rgba(255, 115, 115, 0.23);
  background: var(--coral-wash);
  color: var(--coral);
}
.toggle-button.turn-on {
  border: 1px solid rgba(66, 211, 146, 0.23);
  background: var(--green-wash);
  color: var(--green);
}
.toggle-button:disabled { cursor: wait; opacity: 0.52; }

.global-error {
  margin: 0 24px 24px;
  padding: 13px 15px;
  border: 1px solid rgba(255, 115, 115, 0.23);
  border-radius: 12px;
  background: var(--coral-wash);
  color: #ffb6b6;
  font-size: 13px;
}
.empty-state { padding: 18px 0; color: var(--muted); font-size: 13px; }
.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  max-width: min(360px, calc(100% - 48px));
  padding: 13px 16px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #132735;
  box-shadow: var(--shadow);
  transform: translateY(20px);
  opacity: 0;
  pointer-events: none;
  transition: 180ms ease;
}
.toast.visible { transform: translateY(0); opacity: 1; }

@media (prefers-reduced-motion: reduce) {
  .toast { transition: none; }
}

@media (max-width: 680px) {
  .shell { width: min(100% - 20px, 900px); padding: 26px 0 60px 14px; }
  .shell::before { inset: 26px auto 60px 0; }
  .login-card { padding: 28px 20px; }
  .login-row, .topbar { flex-direction: column; }
  .topbar .ghost-button { align-self: flex-start; }
  .panel-heading, .manager-list { padding-left: 16px; padding-right: 16px; }
  .manager-row { grid-template-columns: 1fr auto; gap: 14px; }
  .manager-name { grid-column: 1 / -1; }
}
