:root {
  --page: #f3f5f7;
  --page-strong: #e8edf2;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --surface-dark: #111827;
  --surface-dark-2: #182230;
  --ink: #111827;
  --ink-soft: #2f3a4a;
  --muted: #697789;
  --muted-2: #94a0ae;
  --line: #d7dee7;
  --line-soft: #e7edf3;
  --teal: #0f766e;
  --teal-soft: #e6f4f1;
  --blue: #3156d4;
  --blue-soft: #e9eefc;
  --amber: #b7791f;
  --amber-soft: #fff4dc;
  --red: #c93c3c;
  --red-soft: #fde9e9;
  --green: #158a52;
  --green-soft: #e6f6ed;
  --shadow: 0 24px 70px rgba(17, 24, 39, .08);
  --shadow-tight: 0 10px 26px rgba(17, 24, 39, .07);
  --radius: 8px;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    linear-gradient(180deg, #fbfcfd 0%, var(--page) 42%, var(--page-strong) 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .86), rgba(255, 255, 255, 0) 34%),
    linear-gradient(90deg, rgba(17, 24, 39, .05) 1px, transparent 1px);
  background-size: auto, 88px 100%;
  opacity: .55;
}

body.login-body {
  display: grid;
  place-items: center;
  padding: 34px;
  background:
    linear-gradient(135deg, #eef3f6 0%, #fbfcfd 44%, #e6edf3 100%);
}

body.login-body::before {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .84), rgba(255, 255, 255, 0) 42%),
    linear-gradient(90deg, rgba(17, 24, 39, .045) 1px, transparent 1px),
    linear-gradient(0deg, rgba(17, 24, 39, .035) 1px, transparent 1px),
    linear-gradient(135deg, rgba(15, 118, 110, .08), transparent 28%, rgba(49, 86, 212, .06) 72%, transparent);
  background-size: auto, 88px 100%, 100% 88px, auto;
  opacity: .74;
}

.login-shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.16fr) 432px;
  width: min(1180px, 100%);
  min-height: min(724px, calc(100vh - 68px));
  overflow: hidden;
  border: 1px solid rgba(199, 209, 221, .92);
  border-radius: var(--radius);
  background:
    linear-gradient(90deg, rgba(255, 255, 255, .07), transparent 52%),
    #fff;
  box-shadow: 0 32px 96px rgba(17, 24, 39, .18);
}

.login-visual {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 34px;
  padding: 38px 42px;
  overflow: hidden;
  color: #f8fafc;
  background:
    linear-gradient(135deg, rgba(15, 118, 110, .22), transparent 26%),
    linear-gradient(165deg, #0e1624 0%, #121d2d 52%, #202d42 100%);
}

.login-visual::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, .06) 1px, transparent 1px),
    linear-gradient(0deg, rgba(255, 255, 255, .045) 1px, transparent 1px),
    linear-gradient(135deg, transparent 0 46%, rgba(255, 255, 255, .05) 46% 46.4%, transparent 46.4% 100%);
  background-size: 84px 100%, 100% 84px, auto;
  opacity: .5;
}

.login-visual::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--teal), var(--blue), var(--amber));
}

.login-visual > * {
  position: relative;
  z-index: 1;
}

.login-visual .brand-mark {
  color: var(--surface-dark);
  background: #fff;
}

.login-visual h1 {
  color: #fff;
}

.login-copy {
  display: grid;
  gap: 20px;
  max-width: 640px;
}

.login-command-strip {
  display: flex;
  align-items: center;
  gap: 12px;
  width: fit-content;
  padding: 8px 10px;
  color: #c8d2df;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .07);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06);
  font-size: 12px;
  font-weight: 850;
}

.login-command-strip b {
  color: #fff;
}

.login-copy h2 {
  max-width: 620px;
  color: #fff;
  font-size: 54px;
  line-height: 1;
  font-weight: 950;
  letter-spacing: 0;
}

.login-copy p {
  max-width: 570px;
  color: #b8c3d1;
  font-size: 15px;
  line-height: 1.75;
}

.login-feature-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.login-feature-row span {
  min-height: 34px;
  padding: 8px 11px;
  color: #dce5ef;
  border: 1px solid rgba(255, 255, 255, .11);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .065);
  font-size: 12px;
  font-weight: 850;
}

.login-intel {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.login-intel article {
  display: grid;
  gap: 7px;
  min-height: 84px;
  padding: 15px;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .105), rgba(255, 255, 255, .06));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08);
}

.login-intel span {
  color: #aab5c3;
  font-size: 12px;
  font-weight: 850;
}

.login-intel b {
  color: #fff;
  font-size: 18px;
  line-height: 1.15;
}

.login-card {
  position: relative;
  display: grid;
  align-content: center;
  gap: 24px;
  padding: 44px 42px;
  background:
    linear-gradient(180deg, #ffffff 0%, #fbfcfd 100%);
}

.login-card::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 1px;
  background: linear-gradient(180deg, transparent, var(--line), transparent);
}

.login-card-glance {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 12px;
  color: var(--muted);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: #f8fafc;
  font-size: 12px;
  font-weight: 850;
}

.login-card-glance b {
  color: var(--teal);
}

.login-card-head {
  display: grid;
  gap: 9px;
}

.login-card-head h2 {
  font-size: 32px;
  line-height: 1.1;
  font-weight: 900;
}

.login-card-head p:last-child {
  color: var(--muted);
  line-height: 1.6;
}

.login-alert {
  padding: 12px 14px;
  color: var(--red);
  border: 1px solid var(--red-soft);
  border-radius: var(--radius);
  background: var(--red-soft);
  font-size: 13px;
  font-weight: 800;
}

.login-form {
  display: grid;
  gap: 15px;
}

.login-form input {
  min-height: 46px;
  border-color: #cbd5df;
  background: #fff;
  box-shadow: 0 1px 0 rgba(17, 24, 39, .03);
}

.login-form .primary-btn {
  width: 100%;
  min-height: 46px;
  margin-top: 4px;
  background:
    linear-gradient(135deg, #111827, #172033);
  box-shadow: 0 16px 36px rgba(17, 24, 39, .18);
}

.login-card-foot {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

button, input, select, textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.shell {
  position: relative;
  width: min(1480px, calc(100% - 56px));
  margin: 0 auto;
  padding: 32px 0 48px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 14px 0 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: var(--radius);
  background: var(--surface-dark);
  color: #fff;
  font-size: 15px;
  font-weight: 900;
  box-shadow: var(--shadow-tight);
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--teal);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1, h2, h3, p {
  margin: 0;
}

h1 {
  font-size: 36px;
  line-height: 1.05;
  font-weight: 900;
}

h2 {
  font-size: 18px;
  line-height: 1.2;
  font-weight: 850;
}

h3 {
  font-size: 14px;
  line-height: 1.2;
  font-weight: 850;
}

.top-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.primary-btn,
.ghost-btn,
.icon-btn,
.row-actions button,
.drawer-actions button,
.inline-form button,
.form-grid button {
  min-height: 42px;
  border-radius: var(--radius);
  font-weight: 850;
  transition: transform .16s ease, box-shadow .16s ease, background .16s ease, border-color .16s ease, color .16s ease;
}

.primary-btn {
  padding: 0 18px;
  color: #fff;
  background: var(--surface-dark);
  box-shadow: var(--shadow-tight);
}

.ghost-btn {
  padding: 0 14px;
  color: var(--ink);
  background: rgba(255, 255, 255, .88);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-tight);
}

.nav-link {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.primary-btn:hover,
.ghost-btn:hover,
.icon-btn:hover,
.row-actions button:hover,
.drawer-actions button:hover,
.inline-form button:hover,
.form-grid button:hover {
  transform: translateY(-1px);
}

.icon-btn {
  width: 42px;
  color: var(--ink);
  background: rgba(255, 255, 255, .88);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-tight);
}

.icon-btn.loading {
  animation: spin .8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.status-pill,
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
}

.status-pill {
  color: var(--muted);
  background: rgba(255, 255, 255, .9);
  border: 1px solid var(--line);
}

.status-pill.healthy,
.badge.good {
  color: var(--green);
  background: var(--green-soft);
}

.status-pill.degraded,
.badge.warn {
  color: var(--amber);
  background: var(--amber-soft);
}

.status-pill.down,
.status-pill.unknown,
.badge.danger {
  color: var(--red);
  background: var(--red-soft);
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 14px;
  margin-bottom: 14px;
}

.command-panel {
  min-height: 234px;
  padding: 30px;
  display: grid;
  align-content: space-between;
  gap: 22px;
  overflow: hidden;
  position: relative;
  color: #f7fafc;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, #111827 0%, #16202d 56%, #1f2937 100%);
  box-shadow: var(--shadow);
}

.command-panel::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--teal), var(--blue), var(--amber));
}

.hero-intel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.server-kicker {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  color: #aab5c3;
  font-size: 13px;
}

.server-kicker b {
  color: #fff;
}

.surface-code {
  padding: 7px 10px;
  border-radius: 999px;
  color: #c7d2df;
  background: rgba(255, 255, 255, .08);
  border: 1px solid rgba(255, 255, 255, .11);
  font-size: 12px;
  font-weight: 800;
}

.command-panel h2 {
  max-width: 720px;
  font-size: 52px;
  line-height: .98;
  font-weight: 950;
  letter-spacing: 0;
}

.hero-copy {
  max-width: 640px;
  color: #b8c3d1;
  font-size: 15px;
  line-height: 1.7;
}

.hero-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.hero-meta span {
  padding: 8px 10px;
  border-radius: var(--radius);
  color: #d8e0ea;
  background: rgba(255, 255, 255, .07);
  border: 1px solid rgba(255, 255, 255, .1);
  font-size: 12px;
  font-weight: 750;
}

.ops-card,
.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .92);
  box-shadow: var(--shadow-tight);
  backdrop-filter: blur(18px);
}

.ops-card {
  padding: 24px;
  display: grid;
  align-content: space-between;
  gap: 24px;
}

.ops-card span,
.metrics span,
.section-title p,
.user-toolbar p,
label span,
.endpoint span,
.traffic-stack span,
.quota-cell small,
.drawer-head p,
.detail-grid span,
.time-stack span {
  color: var(--muted);
}

.ops-card strong {
  display: block;
  margin-top: 8px;
  font-size: 30px;
  line-height: 1.12;
  font-weight: 900;
}

.ops-card p {
  color: var(--ink-soft);
  line-height: 1.55;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin-bottom: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .94);
  box-shadow: var(--shadow-tight);
}

.metrics article {
  min-height: 96px;
  padding: 18px 20px;
  border-right: 1px solid var(--line-soft);
}

.metrics article:last-child {
  border-right: 0;
}

.metrics strong {
  display: block;
  margin-top: 8px;
  font-size: 28px;
  line-height: 1.05;
  font-weight: 900;
}

.layout {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.side-stack {
  display: grid;
  gap: 14px;
}

.panel {
  padding: 20px;
}

.section-title,
.user-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 16px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-grid.compact {
  grid-template-columns: 120px 1fr;
}

.full {
  grid-column: 1 / -1;
}

label {
  display: grid;
  gap: 7px;
}

label span {
  font-size: 12px;
  font-weight: 850;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  outline: none;
  transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}

textarea {
  min-height: 86px;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  line-height: 1.5;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, .12);
}

.form-grid button,
.inline-form button {
  padding: 0 14px;
  color: #fff;
  background: var(--teal);
}

.endpoint-list {
  display: grid;
  gap: 4px;
}

.endpoint {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 54px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line-soft);
}

.endpoint:last-child {
  border-bottom: 0;
}

.endpoint div {
  display: grid;
  gap: 3px;
}

.endpoint strong {
  font-size: 14px;
}

.endpoint b {
  color: var(--green);
  font-size: 12px;
  text-transform: uppercase;
}

.users-panel {
  min-width: 0;
  padding: 20px 22px 22px;
}

.filters {
  display: flex;
  gap: 10px;
  width: min(560px, 100%);
}

.filters input {
  min-width: 250px;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

table {
  width: 100%;
  min-width: 1040px;
  border-collapse: collapse;
  background: #fff;
}

th,
td {
  padding: 14px;
  border-bottom: 1px solid var(--line-soft);
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  background: #f8fafc;
  font-size: 12px;
  font-weight: 850;
}

tbody tr {
  transition: background .16s ease;
}

tbody tr:hover {
  background: #fbfdff;
}

tr:last-child td {
  border-bottom: 0;
}

.user-link-btn {
  display: grid;
  gap: 4px;
  padding: 0;
  color: var(--ink);
  background: transparent;
  text-align: left;
}

.user-link-btn b {
  font-size: 15px;
}

.user-link-btn span {
  color: var(--muted);
  font-size: 12px;
}

.traffic-stack,
.time-stack {
  display: grid;
  gap: 4px;
}

.traffic-stack b {
  font-size: 14px;
}

.traffic-stack span,
.time-stack span {
  font-size: 12px;
  white-space: nowrap;
}

.quota-cell {
  min-width: 150px;
  display: grid;
  gap: 6px;
}

.progress {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #edf2f7;
}

.progress span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--teal), var(--blue));
}

.remarks {
  color: var(--muted);
  font-size: 13px;
}

.row-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.row-actions button,
.drawer-actions button {
  min-height: 36px;
  padding: 0 12px;
  color: var(--ink);
  background: var(--surface-soft);
  border: 1px solid var(--line);
}

.empty {
  padding: 34px;
  color: var(--muted);
  text-align: center;
}

.drawer {
  position: fixed;
  inset: 0;
  z-index: 40;
  pointer-events: none;
}

.drawer.show {
  pointer-events: auto;
}

.drawer-backdrop {
  position: absolute;
  inset: 0;
  opacity: 0;
  background: rgba(17, 24, 39, .38);
  transition: opacity .2s ease;
}

.drawer.show .drawer-backdrop {
  opacity: 1;
}

.drawer-panel {
  position: absolute;
  top: 0;
  right: 0;
  width: min(560px, 100%);
  height: 100%;
  padding: 28px;
  overflow: auto;
  background: #fff;
  box-shadow: -28px 0 70px rgba(17, 24, 39, .18);
  transform: translateX(100%);
  transition: transform .24s ease;
}

.drawer.show .drawer-panel {
  transform: translateX(0);
}

.drawer-close {
  position: absolute;
  top: 18px;
  right: 18px;
  font-size: 22px;
}

.drawer-head {
  display: grid;
  gap: 8px;
  padding: 18px 52px 20px 0;
}

.drawer-head h2 {
  font-size: 38px;
}

.drawer-section {
  display: grid;
  gap: 14px;
  padding: 18px 0;
  border-top: 1px solid var(--line);
}

.drawer-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.detail-grid article {
  display: grid;
  gap: 5px;
  min-height: 72px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.detail-grid b {
  overflow-wrap: anywhere;
}

.inline-form {
  display: grid;
  grid-template-columns: 1fr 130px;
  gap: 10px;
  align-items: end;
}

.link-action {
  width: fit-content;
  min-height: 34px;
  padding: 0;
  color: var(--teal);
  background: transparent;
  font-weight: 850;
}

.danger-zone .danger-btn {
  color: #fff;
  background: var(--red);
  border-color: var(--red);
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 60;
  padding: 13px 16px;
  color: #fff;
  border-radius: var(--radius);
  background: var(--surface-dark);
  box-shadow: 0 18px 42px rgba(17, 24, 39, .22);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast.error {
  background: var(--red);
}

@media (max-width: 1120px) {
  .login-shell {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .login-visual {
    min-height: 420px;
  }

  .login-card::before {
    top: 0;
    right: 0;
    bottom: auto;
    width: auto;
    height: 1px;
  }

  .metrics {
    grid-template-columns: repeat(3, 1fr);
  }

  .metrics article:nth-child(3) {
    border-right: 0;
  }

  .layout,
  .hero-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  body.login-body {
    padding: 12px;
  }

  .login-shell {
    width: 100%;
  }

  .login-visual,
  .login-card {
    padding: 24px;
  }

  .login-command-strip,
  .login-card-glance {
    align-items: flex-start;
    flex-direction: column;
    width: 100%;
  }

  .login-copy h2 {
    font-size: 36px;
  }

  .login-intel {
    grid-template-columns: 1fr;
  }

  .login-card-foot {
    flex-direction: column;
  }

  .shell {
    width: min(100% - 24px, 1480px);
    padding-top: 14px;
  }

  .topbar,
  .section-title,
  .user-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .top-actions,
  .filters,
  .row-actions {
    width: 100%;
  }

  .filters {
    flex-direction: column;
  }

  .filters input {
    min-width: 0;
  }

  .command-panel {
    min-height: 260px;
    padding: 24px;
  }

  .command-panel h2 {
    font-size: 36px;
  }

  .metrics {
    grid-template-columns: repeat(2, 1fr);
  }

  .metrics article {
    border-right: 0;
    border-bottom: 1px solid var(--line-soft);
  }

  .metrics article:last-child {
    border-bottom: 0;
  }

  .form-grid,
  .form-grid.compact,
  .inline-form,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .drawer-panel {
    padding: 22px;
  }
}
