:root {
  --ink: #101a2b;
  --ink-2: #223049;
  --muted: #718096;
  --muted-2: #98a3b3;
  --line: #e5e9ef;
  --surface: #ffffff;
  --surface-2: #f6f8fb;
  --surface-3: #eef2f7;
  --orange: #f47c42;
  --orange-dark: #dd6530;
  --orange-soft: #fff1e9;
  --green: #1ca97b;
  --green-soft: #e5f7f0;
  --blue: #3178c6;
  --red: #d95656;
  --red-soft: #fff0f0;
  --yellow: #e2a72e;
  --shadow-sm: 0 2px 10px rgba(24, 36, 55, .05);
  --shadow-md: 0 16px 45px rgba(24, 36, 55, .11);
  --radius: 16px;
  --sidebar: 248px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100%; }
body {
  color: var(--ink);
  background: var(--surface-2);
  font-family: Inter, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.svg-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.muted { color: var(--muted); }
.eyebrow {
  display: block;
  color: var(--orange-dark);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .16em;
  text-transform: uppercase;
}
.eyebrow.light { color: #ffb38f; }

.brand-mark {
  position: relative;
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 11px;
  overflow: hidden;
  background: var(--orange);
  box-shadow: 0 7px 18px rgba(244, 124, 66, .28);
}
.brand-mark span {
  position: absolute;
  bottom: 0;
  width: 7px;
  background: white;
  transform: skewX(-18deg);
}
.brand-mark span:nth-child(1) { left: 8px; height: 17px; opacity: .55; }
.brand-mark span:nth-child(2) { left: 16px; height: 25px; }
.brand-mark span:nth-child(3) { left: 24px; height: 31px; opacity: .75; }

.button {
  min-height: 40px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-weight: 700;
  font-size: 13px;
  text-decoration: none;
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease, border-color .18s ease;
}
.button:hover { transform: translateY(-1px); }
.button:active { transform: translateY(0); }
.button:disabled { opacity: .55; cursor: wait; transform: none; }
.button svg { width: 17px; height: 17px; }
.button.primary {
  color: white;
  background: linear-gradient(135deg, #f68a52, var(--orange-dark));
  box-shadow: 0 7px 18px rgba(223, 101, 48, .22);
}
.button.primary:hover { box-shadow: 0 9px 24px rgba(223, 101, 48, .3); }
.button.dark { color: white; background: var(--ink); }
.button.ghost { border-color: var(--line); background: white; color: var(--ink-2); }
.button.ghost:hover { border-color: #cfd6e0; background: #fbfcfd; }
.button.danger { color: white; background: var(--red); }
.button.wide { width: 100%; justify-content: space-between; padding-left: 19px; padding-right: 16px; }
.button.small { min-height: 34px; padding: 0 12px; font-size: 12px; }
.icon-button {
  width: 38px;
  height: 38px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
  cursor: pointer;
  transition: background .18s ease, color .18s ease;
}
.icon-button:hover { color: var(--orange-dark); background: var(--orange-soft); }
.icon-button svg { width: 18px; height: 18px; }
.muted-icon { border: 0; background: transparent; color: #7d8ca0; }

/* Login */
.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(440px, 1.08fr) minmax(420px, .92fr);
  background: white;
}
.login-visual {
  position: relative;
  min-height: 100vh;
  padding: 48px 58px;
  overflow: hidden;
  color: white;
  background:
    radial-gradient(circle at 82% 18%, rgba(244, 124, 66, .42), transparent 25%),
    linear-gradient(145deg, #0f1b2d 10%, #182740 66%, #213754);
}
.login-visual::after {
  content: "";
  position: absolute;
  width: 520px;
  height: 520px;
  right: -260px;
  top: -230px;
  border: 1px solid rgba(255,255,255,.09);
  border-radius: 50%;
  box-shadow: 0 0 0 55px rgba(255,255,255,.025), 0 0 0 120px rgba(255,255,255,.018);
}
.road-grid {
  position: absolute;
  inset: 0;
  opacity: .16;
  background-image:
    linear-gradient(rgba(255,255,255,.12) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.12) 1px, transparent 1px);
  background-size: 70px 70px;
  transform: perspective(500px) rotateX(58deg) scale(1.6) translateY(30%);
  transform-origin: bottom;
  mask-image: linear-gradient(to top, black, transparent 80%);
}
.login-brand {
  position: relative;
  z-index: 2;
  display: flex;
  gap: 12px;
  align-items: center;
  font-size: 13px;
  letter-spacing: .18em;
  font-weight: 800;
}
.login-copy {
  position: relative;
  z-index: 2;
  max-width: 570px;
  margin-top: clamp(130px, 20vh, 230px);
}
.login-copy h1 {
  margin: 18px 0 24px;
  font-size: clamp(48px, 5vw, 76px);
  line-height: 1.04;
  letter-spacing: -.055em;
  font-weight: 800;
}
.login-copy p {
  max-width: 460px;
  color: #b8c3d3;
  font-size: 16px;
  line-height: 1.85;
}
.login-metrics {
  display: flex;
  gap: 44px;
  margin-top: 48px;
}
.login-metrics div { display: grid; gap: 6px; }
.login-metrics strong { font-size: 19px; }
.login-metrics span { color: #92a2b8; font-size: 11px; letter-spacing: .05em; }
.road-lines {
  position: absolute;
  right: -7%;
  bottom: 9%;
  width: 64%;
  height: 152px;
  transform: perspective(240px) rotateX(64deg) rotateZ(-15deg);
  transform-origin: bottom;
  opacity: .34;
}
.road-lines i {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, transparent, white);
}
.road-lines i:nth-child(2) { width: 75%; bottom: 48px; right: 13%; opacity: .6; }
.road-lines i:nth-child(3) { width: 44%; bottom: 90px; right: 28%; opacity: .3; }
.login-panel {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 40px;
  background:
    radial-gradient(circle at 85% 10%, rgba(244,124,66,.06), transparent 30%),
    white;
}
.login-card { width: min(390px, 100%); }
.mobile-brand { display: none; align-items: center; gap: 12px; margin-bottom: 52px; font-size: 13px; letter-spacing: .16em; font-weight: 800; }
.login-card h2 { margin: 12px 0 8px; font-size: 34px; letter-spacing: -.04em; }
.login-card > .muted { margin: 0 0 32px; line-height: 1.7; }
.login-card .field { margin-bottom: 18px; }
.login-card .button { margin-top: 8px; }
.login-help { display: flex; align-items: center; gap: 8px; margin-top: 24px; color: var(--muted); font-size: 11px; }
.status-dot {
  width: 7px;
  height: 7px;
  display: inline-block;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(28,169,123,.11);
}

/* Forms */
.field { display: grid; gap: 8px; }
.field > span { font-size: 12px; font-weight: 700; color: var(--ink-2); }
.field small { color: var(--muted-2); font-size: 11px; line-height: 1.4; }
input, select, textarea {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid #dfe4eb;
  border-radius: 9px;
  outline: 0;
  color: var(--ink);
  background: white;
  transition: border-color .18s ease, box-shadow .18s ease;
}
textarea { min-height: 88px; resize: vertical; line-height: 1.55; }
input:focus, select:focus, textarea:focus {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(244,124,66,.12);
}
input:read-only { color: var(--muted); background: var(--surface-2); }
.form-error { min-height: 0; color: var(--red); font-size: 12px; line-height: 1.5; }
.form-error:not(:empty) { margin: 8px 0 14px; padding: 9px 11px; border-radius: 8px; background: var(--red-soft); }

/* App layout */
.app-shell { min-height: 100vh; }
.sidebar {
  position: fixed;
  z-index: 30;
  inset: 0 auto 0 0;
  width: var(--sidebar);
  display: flex;
  flex-direction: column;
  background: #111c2e;
  color: #cbd4e1;
}
.sidebar-brand {
  height: 91px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.sidebar-brand .brand-mark { width: 34px; height: 34px; border-radius: 9px; }
.sidebar-brand > div { display: grid; line-height: 1.1; }
.sidebar-brand strong { color: white; letter-spacing: .08em; font-size: 15px; }
.sidebar-brand small { margin-top: 5px; color: #73839a; font-size: 8px; font-weight: 800; letter-spacing: .22em; }
.workspace-label { padding: 22px 25px 8px; color: #64758e; font-size: 9px; font-weight: 800; letter-spacing: .16em; }
.nav { flex: 1; padding: 4px 12px 18px; overflow-y: auto; scrollbar-width: thin; }
.nav-label {
  padding: 20px 14px 7px;
  color: #667792;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .14em;
}
.nav-item {
  position: relative;
  width: 100%;
  height: 43px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 0;
  border-radius: 9px;
  color: #a7b2c3;
  background: transparent;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  transition: color .17s ease, background .17s ease;
}
.nav-item:hover { color: white; background: rgba(255,255,255,.055); }
.nav-item.active { color: white; background: linear-gradient(90deg, rgba(244,124,66,.19), rgba(244,124,66,.06)); }
.nav-item.active::before {
  content: "";
  position: absolute;
  left: 0;
  width: 3px;
  height: 21px;
  border-radius: 0 3px 3px 0;
  background: var(--orange);
  box-shadow: 0 0 12px rgba(244,124,66,.7);
}
.nav-item svg { width: 17px; height: 17px; }
.nav-item.active svg { color: #ff9b6d; }
.sidebar-footer {
  padding: 17px 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-top: 1px solid rgba(255,255,255,.065);
}
.admin-avatar {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 10px;
  color: #ffc1a2;
  background: #23324a;
  font-size: 10px;
  font-weight: 800;
}
.admin-copy { min-width: 0; flex: 1; display: grid; gap: 3px; }
.admin-copy strong { overflow: hidden; color: white; font-size: 12px; text-overflow: ellipsis; }
.admin-copy span { color: #708199; font-size: 10px; }
.sidebar-footer .icon-button { color: #718198; }
.sidebar-footer .icon-button:hover { color: #ffad88; background: rgba(255,255,255,.05); }
.sidebar-backdrop { display: none; }
.main { min-height: 100vh; margin-left: var(--sidebar); }
.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  height: 91px;
  padding: 0 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(15px);
}
.topbar-left { display: flex; align-items: center; gap: 14px; }
.topbar h1 { margin: 5px 0 0; font-size: 23px; letter-spacing: -.035em; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.live-chip {
  padding: 7px 11px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid #e4eee9;
  border-radius: 999px;
  color: #387b64;
  background: #f8fcfa;
  font-size: 11px;
  font-weight: 700;
}
.live-chip .status-dot { width: 6px; height: 6px; }
.menu-button { display: none; }
.loading-bar {
  position: fixed;
  z-index: 80;
  top: 0;
  left: var(--sidebar);
  right: 0;
  height: 3px;
  opacity: 0;
  transform: scaleX(0);
  transform-origin: left;
  background: linear-gradient(90deg, var(--orange), #ffc29f);
  transition: transform .4s ease, opacity .2s ease;
}
.loading-bar.active { opacity: 1; transform: scaleX(.8); animation: loading 1.5s ease-in-out infinite; }
@keyframes loading { 50% { transform: scaleX(.95); } }
.content { max-width: 1680px; margin: 0 auto; padding: 30px 34px 52px; }

/* Dashboard */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.page-head h2 { margin: 7px 0 5px; font-size: 26px; letter-spacing: -.04em; }
.page-head p { margin: 0; color: var(--muted); font-size: 13px; }
.page-actions { display: flex; align-items: center; gap: 8px; }
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.kpi-card {
  position: relative;
  min-height: 142px;
  padding: 19px 20px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
  box-shadow: var(--shadow-sm);
}
.kpi-card::after {
  content: "";
  position: absolute;
  width: 100px;
  height: 100px;
  right: -32px;
  top: -38px;
  border-radius: 50%;
  background: var(--accent-soft, var(--orange-soft));
}
.kpi-top { position: relative; z-index: 1; display: flex; align-items: center; justify-content: space-between; }
.kpi-label { color: var(--muted); font-size: 11px; font-weight: 700; }
.kpi-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: var(--accent, var(--orange));
  background: var(--accent-soft, var(--orange-soft));
}
.kpi-icon svg { width: 17px; height: 17px; }
.kpi-value { position: relative; z-index: 1; margin-top: 16px; font-size: 30px; font-weight: 800; letter-spacing: -.045em; }
.kpi-note { position: relative; z-index: 1; display: flex; align-items: center; gap: 5px; margin-top: 7px; color: var(--muted); font-size: 10px; }
.kpi-note strong { color: var(--green); }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(300px, .8fr); gap: 15px; margin-top: 15px; }
.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
  box-shadow: var(--shadow-sm);
}
.panel-head { padding: 19px 20px 12px; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.panel-head h3 { margin: 0; font-size: 14px; letter-spacing: -.015em; }
.panel-head p { margin: 5px 0 0; color: var(--muted); font-size: 11px; }
.legend { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 10px; }
.legend i { width: 7px; height: 7px; border-radius: 2px; background: var(--orange); }
.chart-wrap { height: 240px; padding: 20px 20px 18px; display: flex; align-items: flex-end; gap: 5px; border-top: 1px solid #f0f2f5; }
.chart-column { position: relative; height: 100%; flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 8px; }
.chart-bar-track { width: 100%; height: calc(100% - 20px); display: flex; align-items: flex-end; }
.chart-bar {
  width: 100%;
  min-height: 3px;
  max-width: 24px;
  margin: 0 auto;
  border-radius: 4px 4px 1px 1px;
  background: linear-gradient(180deg, #f69563, var(--orange));
  opacity: .86;
  transition: opacity .18s ease, transform .18s ease;
}
.chart-column:hover .chart-bar { opacity: 1; transform: scaleX(1.1); }
.chart-label { height: 12px; color: var(--muted-2); font-size: 8px; white-space: nowrap; }
.server-load { padding: 4px 20px 16px; display: grid; gap: 15px; }
.server-load-row { display: grid; gap: 7px; }
.server-load-top { display: flex; justify-content: space-between; gap: 10px; font-size: 11px; }
.server-load-top strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.server-load-top span { color: var(--muted); white-space: nowrap; }
.progress { height: 5px; overflow: hidden; border-radius: 10px; background: var(--surface-3); }
.progress > i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #f8a477, var(--orange)); }
.empty-mini { padding: 35px 20px; text-align: center; color: var(--muted); font-size: 12px; }
.lower-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(300px, .85fr); gap: 15px; margin-top: 15px; }
.activity-list { padding: 1px 20px 13px; }
.activity-row { padding: 11px 0; display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; align-items: center; gap: 11px; border-top: 1px solid #f1f3f6; }
.method-badge { padding: 5px 0; text-align: center; border-radius: 5px; color: #3f719e; background: #edf6ff; font-size: 8px; font-weight: 800; }
.method-badge.POST { color: #a86b11; background: #fff5df; }
.method-badge.DELETE { color: #b24e51; background: #fff0f0; }
.activity-main { min-width: 0; }
.activity-main strong { display: block; overflow: hidden; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 10px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.activity-main span { display: block; margin-top: 4px; color: var(--muted-2); font-size: 9px; }
.activity-result { text-align: right; font-size: 9px; color: var(--muted); }
.activity-result b { display: block; margin-bottom: 4px; color: var(--green); font-size: 10px; }
.system-list { padding: 2px 20px 18px; }
.system-row { padding: 12px 0; display: flex; justify-content: space-between; gap: 16px; border-top: 1px solid #f1f3f6; font-size: 11px; }
.system-row span { color: var(--muted); }
.system-row strong { text-align: right; font-weight: 700; font-size: 10px; word-break: break-all; }
.sync-strip {
  margin-top: 15px;
  padding: 17px 19px;
  display: flex;
  align-items: center;
  gap: 15px;
  border: 1px solid #f3dfd3;
  border-radius: 13px;
  background: linear-gradient(95deg, #fffaf6, #fff);
}
.sync-strip-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 10px;
  color: var(--orange-dark);
  background: var(--orange-soft);
}
.sync-strip-copy { flex: 1; }
.sync-strip-copy strong { display: block; font-size: 12px; }
.sync-strip-copy span { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; }
.sync-strip-actions { display: flex; gap: 7px; }

/* Resource tables */
.table-panel { overflow: hidden; }
.readonly-strip {
  margin-bottom: 15px;
  padding: 11px 14px;
  display: flex;
  align-items: center;
  gap: 9px;
  border: 1px solid rgba(65, 159, 207, .18);
  border-radius: 10px;
  color: #7f9cb6;
  background: rgba(24, 88, 128, .09);
  font-size: 10px;
  line-height: 1.6;
}
.readonly-strip svg { width: 16px; height: 16px; flex: 0 0 auto; color: #59b9e1; }
.table-toolbar {
  min-height: 66px;
  padding: 13px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid var(--line);
}
.toolbar-left, .toolbar-right { display: flex; align-items: center; gap: 8px; }
.search-box { position: relative; width: min(300px, 35vw); }
.search-box svg { position: absolute; left: 11px; top: 50%; width: 16px; height: 16px; transform: translateY(-50%); color: var(--muted-2); }
.search-box input { height: 38px; min-height: 38px; padding-left: 35px; font-size: 12px; background: var(--surface-2); border-color: transparent; }
.count-chip { padding: 5px 9px; border-radius: 999px; color: var(--muted); background: var(--surface-2); font-size: 10px; font-weight: 700; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; table-layout: auto; }
th {
  padding: 12px 15px;
  color: #8490a1;
  background: #fafbfc;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .06em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}
td {
  max-width: 270px;
  padding: 13px 15px;
  overflow: hidden;
  border-top: 1px solid #eef1f4;
  color: #3b485b;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
tbody tr { transition: background .15s ease; }
tbody tr:hover { background: #fcfdfe; }
td strong { color: var(--ink); font-weight: 700; }
.cell-main { display: flex; align-items: center; gap: 9px; min-width: 120px; }
.avatar {
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #a85b35;
  background: #fff0e7;
  font-size: 9px;
  font-weight: 800;
}
.cell-sub { display: block; margin-top: 3px; color: var(--muted-2); font-size: 9px; }
.status-pill, .type-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 8px;
  border-radius: 999px;
  color: #187a5a;
  background: var(--green-soft);
  font-size: 9px;
  font-weight: 700;
}
.status-pill::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.status-pill.off, .status-pill.warn { color: #a66e14; background: #fff6df; }
.status-pill.bad { color: #b94646; background: var(--red-soft); }
.type-pill { color: #867092; background: #f4eff7; }
.row-actions { display: flex; justify-content: flex-end; gap: 4px; }
.row-action {
  width: 29px;
  height: 29px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 7px;
  color: #8d99a9;
  background: transparent;
  cursor: pointer;
}
.row-action:hover { color: var(--orange-dark); background: var(--orange-soft); }
.row-action.delete:hover { color: var(--red); background: var(--red-soft); }
.row-action svg { width: 14px; height: 14px; }
.empty-state { padding: 70px 20px; text-align: center; }
.empty-icon { width: 46px; height: 46px; margin: 0 auto 13px; display: grid; place-items: center; border-radius: 13px; color: #a5afbd; background: var(--surface-2); }
.empty-state strong { display: block; font-size: 13px; }
.empty-state p { max-width: 360px; margin: 7px auto 17px; color: var(--muted); font-size: 11px; line-height: 1.6; }
.pagination { min-height: 58px; padding: 10px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-top: 1px solid var(--line); }
.pagination-info { color: var(--muted); font-size: 10px; }
.pager { display: flex; align-items: center; gap: 5px; }
.pager button {
  min-width: 31px;
  height: 31px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--muted);
  background: white;
  font-size: 10px;
  cursor: pointer;
}
.pager button.active { color: white; border-color: var(--ink); background: var(--ink); }
.pager button:disabled { opacity: .35; cursor: not-allowed; }
.table-skeleton { padding: 20px; display: grid; gap: 10px; }
.skeleton-line { height: 42px; border-radius: 8px; background: linear-gradient(90deg, #f3f5f8, #fafbfc, #f3f5f8); background-size: 200% 100%; animation: shimmer 1.3s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* System pages */
.cards-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.info-card { padding: 19px; border: 1px solid var(--line); border-radius: var(--radius); background: white; box-shadow: var(--shadow-sm); }
.info-card-head { display: flex; justify-content: space-between; gap: 12px; }
.info-card h3 { margin: 0; font-size: 13px; }
.info-card p { margin: 7px 0 0; color: var(--muted); font-size: 10px; line-height: 1.6; }
.info-card-actions { margin-top: 18px; }
.config-key { display: block; margin-top: 14px; padding: 10px; overflow: hidden; border-radius: 8px; color: #536278; background: var(--surface-2); font-family: ui-monospace, Consolas, monospace; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.config-value { display: -webkit-box; margin-top: 10px; overflow: hidden; color: var(--muted); font-size: 10px; line-height: 1.6; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.key-token { padding: 12px; overflow-wrap: anywhere; border: 1px dashed #f0b394; border-radius: 10px; color: #b7542b; background: #fff8f3; font-family: ui-monospace, Consolas, monospace; font-size: 12px; line-height: 1.6; }
.notice { padding: 13px 15px; display: flex; gap: 10px; border: 1px solid #f0e2c6; border-radius: 10px; color: #84632c; background: #fffdf7; font-size: 11px; line-height: 1.6; }
.notice svg { width: 17px; height: 17px; flex: 0 0 auto; margin-top: 1px; }
.transfer-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.transfer-box { padding: 22px; border: 1px solid var(--line); border-radius: var(--radius); background: white; }
.transfer-box h3 { margin: 0 0 6px; font-size: 15px; }
.transfer-box p { margin: 0 0 19px; color: var(--muted); font-size: 11px; line-height: 1.7; }
.file-drop {
  position: relative;
  min-height: 150px;
  padding: 24px;
  display: grid;
  place-items: center;
  border: 1px dashed #cfd7e2;
  border-radius: 12px;
  text-align: center;
  background: var(--surface-2);
  cursor: pointer;
}
.file-drop:hover { border-color: var(--orange); background: #fffaf7; }
.file-drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.file-drop svg { width: 27px; height: 27px; margin-bottom: 10px; color: var(--orange); }
.file-drop strong { display: block; font-size: 12px; }
.file-drop span { display: block; margin-top: 5px; color: var(--muted); font-size: 9px; }
.transfer-options { margin: 15px 0; }
.check-field { display: flex; align-items: flex-start; gap: 9px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.check-field input { width: 15px; min-height: 15px; height: 15px; margin-top: 1px; accent-color: var(--orange); }
.transfer-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.endpoint-list { display: grid; gap: 8px; }
.endpoint-row { padding: 13px 15px; display: grid; grid-template-columns: 48px minmax(210px, .95fr) minmax(180px, 1.4fr) 38px; align-items: center; gap: 12px; border: 1px solid var(--line); border-radius: 10px; background: white; }
.endpoint-method { padding: 5px 0; text-align: center; border-radius: 5px; color: #26704f; background: var(--green-soft); font-size: 8px; font-weight: 800; }
.endpoint-path { overflow: hidden; color: var(--ink); font-family: ui-monospace, Consolas, monospace; font-size: 10px; font-weight: 700; text-overflow: ellipsis; }
.endpoint-desc { color: var(--muted); font-size: 10px; }
.docs-intro { margin-bottom: 15px; padding: 20px; border-radius: 14px; color: #d8e1ed; background: linear-gradient(120deg, #152237, #223552); }
.docs-intro .eyebrow { color: #ffad86; }
.docs-intro h3 { margin: 9px 0 6px; color: white; font-size: 18px; }
.docs-intro p { margin: 0; max-width: 750px; color: #aab8ca; font-size: 11px; line-height: 1.7; }

/* Dialogs and toast */
.modal {
  width: min(650px, calc(100vw - 32px));
  max-height: calc(100vh - 40px);
  padding: 0;
  overflow: auto;
  border: 0;
  border-radius: 18px;
  color: var(--ink);
  background: white;
  box-shadow: 0 30px 90px rgba(12, 25, 43, .28);
}
.modal::backdrop { background: rgba(10, 20, 35, .54); backdrop-filter: blur(3px); }
.modal form { margin: 0; }
.modal-head { padding: 21px 23px 16px; display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 6px 0 0; font-size: 21px; letter-spacing: -.035em; }
.modal-close { width: 32px; height: 32px; }
.modal-body { padding: 21px 23px; }
.modal-body > p { color: var(--muted); line-height: 1.7; font-size: 12px; }
.modal-actions { padding: 14px 23px 20px; display: flex; justify-content: flex-end; gap: 8px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.form-grid .full { grid-column: 1 / -1; }
.compact-modal { width: min(440px, calc(100vw - 32px)); }
.toast-stack { position: fixed; z-index: 100; right: 20px; bottom: 20px; display: grid; gap: 9px; pointer-events: none; }
.toast {
  min-width: 280px;
  max-width: 410px;
  padding: 13px 15px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 11px;
  color: white;
  background: #162237;
  box-shadow: 0 12px 34px rgba(12, 24, 42, .25);
  font-size: 11px;
  line-height: 1.55;
  animation: toast-in .25s ease both;
}
.toast.success { background: #176f58; }
.toast.error { background: #a74343; }
.toast svg { width: 16px; height: 16px; flex: 0 0 auto; margin-top: 1px; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

@media (max-width: 1180px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-grid, .lower-grid { grid-template-columns: 1fr; }
  .cards-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .topbar { padding: 0 24px; }
  .content { padding: 24px; }
}

@media (max-width: 900px) {
  .login-shell { grid-template-columns: 1fr; }
  .login-visual { display: none; }
  .login-panel { min-height: 100vh; padding: 30px; background: linear-gradient(160deg, #fff, #fff8f4); }
  .mobile-brand { display: flex; }
  .sidebar { transform: translateX(-105%); transition: transform .25s ease; box-shadow: 20px 0 50px rgba(12,24,42,.2); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-backdrop { position: fixed; z-index: 25; inset: 0; display: block; opacity: 0; visibility: hidden; background: rgba(10,20,35,.42); transition: .25s ease; }
  .sidebar-backdrop.visible { opacity: 1; visibility: visible; }
  .main { margin-left: 0; }
  .menu-button { display: inline-flex; }
  .loading-bar { left: 0; }
  .topbar { height: 80px; }
  .topbar h1 { font-size: 20px; }
  .live-chip { display: none; }
  .content { padding: 20px; }
}

@media (max-width: 680px) {
  .topbar { padding: 0 14px; }
  .topbar-actions .ghost span { display: none; }
  .topbar-actions .button { padding: 0 11px; }
  .topbar-actions .dark { display: none; }
  .content { padding: 16px 12px 40px; }
  .page-head { align-items: flex-start; flex-direction: column; }
  .page-actions { width: 100%; }
  .page-actions .button { flex: 1; }
  .kpi-grid { gap: 9px; }
  .kpi-card { min-height: 123px; padding: 14px; }
  .kpi-value { font-size: 24px; }
  .chart-wrap { padding-left: 12px; padding-right: 12px; gap: 2px; }
  .chart-column:nth-child(odd) .chart-label { visibility: hidden; }
  .table-toolbar { align-items: stretch; flex-direction: column; }
  .toolbar-left, .toolbar-right { width: 100%; }
  .search-box { width: 100%; flex: 1; }
  .cards-grid, .transfer-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .full { grid-column: auto; }
  .sync-strip { align-items: flex-start; flex-wrap: wrap; }
  .sync-strip-actions { width: 100%; }
  .sync-strip-actions .button { flex: 1; }
  .endpoint-row { grid-template-columns: 44px 1fr 32px; }
  .endpoint-desc { display: none; }
  .pagination { align-items: flex-start; flex-direction: column; }
  .toast-stack { left: 12px; right: 12px; bottom: 12px; }
  .toast { min-width: 0; max-width: none; }
}

/* Proxy routing */
.proxy-guide {
  margin-top: 15px;
  padding: 19px 21px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 18px;
  border: 1px solid #17324b;
  border-radius: var(--radius);
  background:
    radial-gradient(circle at 78% 15%, rgba(67, 168, 216, .15), transparent 27%),
    linear-gradient(110deg, #0d1d2f, #0a1828);
}
.proxy-guide h3 { margin: 7px 0 5px; color: #e5f2ff; font-size: 16px; }
.proxy-guide p { max-width: 610px; margin: 0; color: #7890ab; font-size: 11px; line-height: 1.65; }
.proxy-guide code {
  padding: 11px 14px;
  border: 1px solid rgba(79, 163, 213, .25);
  border-radius: 9px;
  color: #7bd1ff;
  background: #071421;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 10px;
  white-space: nowrap;
}
.proxy-node-grid { margin-top: 15px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; }
.proxy-node-card {
  padding: 19px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.proxy-node-card.disabled { opacity: .62; }
.proxy-node-head { display: flex; align-items: center; gap: 11px; }
.proxy-node-head > div { min-width: 0; flex: 1; }
.proxy-node-head h3 { margin: 0 0 6px; color: var(--ink); font-size: 14px; }
.proxy-node-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 10px;
  color: #62bde9;
  background: rgba(50, 147, 200, .13);
}
.proxy-node-icon svg { width: 19px; height: 19px; }
.proxy-weight { color: var(--muted); font-size: 9px; }
.proxy-url { margin-top: 16px; padding: 9px 9px 9px 12px; display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-2); }
.proxy-url code { min-width: 0; flex: 1; overflow: hidden; color: #8ed7fa; font-family: ui-monospace, Consolas, monospace; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.proxy-url .row-action { flex: 0 0 auto; }
.proxy-node-stats { margin-top: 15px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; }
.proxy-node-stats div { padding: 9px; display: grid; gap: 4px; border-radius: 8px; background: rgba(74, 130, 173, .07); }
.proxy-node-stats span { color: var(--muted); font-size: 8px; }
.proxy-node-stats strong { color: var(--ink-2); font-size: 11px; }
.proxy-node-meta { min-height: 31px; margin-top: 11px; display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; color: var(--muted); font-size: 9px; }
.proxy-error { max-width: 48%; overflow: hidden; color: #d78080; text-overflow: ellipsis; white-space: nowrap; }
.proxy-node-actions { margin-top: 11px; padding-top: 12px; display: flex; justify-content: flex-end; align-items: center; gap: 7px; border-top: 1px solid var(--line); }
.proxy-empty { min-height: 220px; }
.proxy-notice { margin-top: 15px; }
.proxy-notice code { color: #8ed7fa; }

/* History maintenance */
.maintenance-grid {
  margin-top: 15px;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(300px, .85fr);
  gap: 15px;
}
.retention-form {
  padding: 5px 20px 21px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
}
.retention-form .button { align-self: end; }
.maintenance-storage { padding: 3px 20px 14px; }
.storage-row {
  padding: 11px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--line);
  font-size: 10px;
}
.storage-row span { color: var(--muted); }
.storage-row strong { color: var(--ink-2); }
.maintenance-notice { margin: 5px 20px 20px; }
.maintenance-runs { margin-top: 15px; }
.maintenance-run-grid { padding: 3px 20px 20px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px; }
.maintenance-run-grid div { padding: 13px; display: grid; gap: 5px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-2); }
.maintenance-run-grid span { color: var(--muted); font-size: 9px; }
.maintenance-run-grid strong { color: var(--ink-2); font-size: 12px; }

/* Dark operations theme */
:root {
  color-scheme: dark;
  --ink: #e4f0fc;
  --ink-2: #bed0e2;
  --muted: #7189a5;
  --muted-2: #536b86;
  --line: rgba(93, 139, 181, .18);
  --surface: #0d1928;
  --surface-2: #07121f;
  --surface-3: #122439;
  --orange: #4ba8d8;
  --orange-dark: #2b91c8;
  --orange-soft: rgba(62, 160, 210, .13);
  --green: #25c79c;
  --green-soft: rgba(37, 199, 156, .12);
  --blue: #55aee0;
  --red: #e36969;
  --red-soft: rgba(227, 105, 105, .12);
  --yellow: #d9ad46;
  --shadow-sm: 0 5px 24px rgba(0, 0, 0, .18);
  --shadow-md: 0 24px 65px rgba(0, 0, 0, .4);
  --sidebar: 232px;
}
body {
  color: var(--ink);
  background:
    radial-gradient(circle at 85% 0%, rgba(34, 95, 139, .12), transparent 30%),
    #07111d;
}
.app-shell { background: #07111d; }
.main { background: #07111d; }
.sidebar { background: linear-gradient(180deg, #08131f, #06101b); border-right: 1px solid rgba(76, 133, 180, .12); }
.sidebar-brand { border-bottom-color: rgba(114, 167, 208, .12); }
.sidebar-brand strong { color: #e7f3ff; }
.sidebar-brand .brand-mark { background: linear-gradient(145deg, #4eb4e3, #287cae); box-shadow: 0 8px 25px rgba(48, 151, 204, .25); }
.nav-item { color: #7188a2; }
.nav-item:hover { color: #cce9fa; background: rgba(65, 145, 197, .08); }
.nav-item.active { color: #dff4ff; background: linear-gradient(90deg, rgba(58, 152, 205, .2), rgba(58, 152, 205, .03)); }
.nav-item.active::before { background: #55b8e4; box-shadow: 0 0 14px rgba(70, 181, 229, .65); }
.nav-item.active svg { color: #67c9f0; }
.sidebar-footer { border-top-color: rgba(99, 149, 189, .13); }
.admin-avatar { color: #8cdefc; background: #10273a; border-color: rgba(90, 174, 222, .18); }
.topbar {
  border-bottom-color: var(--line);
  background: rgba(7, 17, 29, .91);
  backdrop-filter: blur(18px);
}
.topbar h1 { color: #e7f2fc; }
.live-chip { color: #51d2aa; border-color: rgba(40, 188, 147, .2); background: rgba(23, 112, 88, .11); }
.button.ghost { color: #aac3da; border-color: #233b52; background: #0d1b2b; }
.button.ghost:hover { color: #d9f2ff; border-color: #315f80; background: #102336; }
.button.dark { color: #dcecfa; border-color: #29445d; background: #102137; }
.button.primary { color: white; background: linear-gradient(135deg, #45acdc, #287fb5); box-shadow: 0 8px 24px rgba(45, 148, 203, .23); }
.icon-button { color: #8fa6bd; border-color: #20374d; background: #0d1b2b; }
.icon-button:hover { color: #73c9ee; background: #10263a; }
.content { max-width: 1730px; }
.eyebrow { color: #51b6e4; }
.kpi-card, .panel, .info-card, .transfer-box, .proxy-node-card {
  color: var(--ink);
  border-color: var(--line);
  background: linear-gradient(145deg, rgba(17, 34, 52, .94), rgba(10, 24, 39, .96));
  box-shadow: var(--shadow-sm);
}
.kpi-card::after { opacity: .65; }
.kpi-value { color: #eef8ff; }
.kpi-label, .kpi-note, .panel-head p { color: var(--muted); }
.panel-head h3, .info-card h3, .transfer-box h3 { color: #dcecfb; }
.count-chip { color: #7e96af; background: #0a1827; border: 1px solid rgba(86, 136, 177, .14); }
.chart-wrap { border-top-color: var(--line); }
.chart-bar { background: linear-gradient(180deg, #69caf3, #318ab8); box-shadow: 0 0 12px rgba(64, 174, 223, .2); }
.progress { background: #0b1827; }
.progress > i { background: linear-gradient(90deg, #2d94c2, #6ad3f2); }
.activity-row, .system-row { border-top-color: var(--line); }
.activity-main strong { color: #c7d9e9; }
.method-badge { color: #66bce5; background: rgba(54, 149, 196, .12); }
.method-badge.POST { color: #e6b85b; background: rgba(197, 148, 46, .12); }
.method-badge.DELETE { color: #e08686; background: rgba(205, 86, 86, .11); }
.sync-strip {
  border-color: rgba(65, 159, 207, .18);
  background: linear-gradient(100deg, #0c1e30, #0a1726);
}
.sync-strip-icon { color: #67c4ea; background: rgba(57, 157, 207, .13); }
.table-panel { background: #0b1826; }
.table-toolbar { border-bottom-color: var(--line); }
.search-box input { color: #cfe2f1; background: #071421; border-color: #192d42; }
.search-box input::placeholder { color: #4d6883; }
th { color: #647f9c; background: #0a1725; border-bottom: 1px solid var(--line); }
td { color: #9db2c7; border-top-color: rgba(83, 126, 165, .13); }
td strong { color: #d7e8f7; }
tbody tr:hover { background: rgba(52, 128, 176, .055); }
.avatar { color: #84d3f4; background: #102a3e; }
.cell-sub { color: #536b84; }
.status-pill { color: #52d1aa; background: rgba(32, 174, 137, .13); }
.status-pill.off, .status-pill.warn { color: #e0b75f; background: rgba(195, 148, 44, .13); }
.status-pill.bad { color: #e68787; background: rgba(196, 79, 79, .12); }
.type-pill { color: #a8a0d9; background: rgba(127, 112, 185, .14); }
.row-action { color: #6e89a3; }
.row-action:hover { color: #71c9ef; background: rgba(50, 153, 202, .12); }
.pagination { border-top-color: var(--line); }
.pager button { color: #7891aa; border-color: #1e3348; background: #0c1927; }
.pager button.active { color: #062030; border-color: #5bc2ea; background: #5bc2ea; }
.empty-icon { color: #68839d; background: #0b1b2a; }
.info-card .config-key, .config-key { color: #87a4bd; background: #071421; border: 1px solid var(--line); }
.key-token { color: #93d9f8; border-color: rgba(77, 173, 218, .28); background: rgba(36, 125, 170, .09); }
.notice { color: #bca66e; border-color: rgba(194, 157, 71, .22); background: rgba(150, 115, 40, .08); }
.file-drop { border-color: #28465f; background: #081522; }
.file-drop:hover { border-color: #4fa8d3; background: #0b1d2d; }
.endpoint-row { border-color: var(--line); background: #0b1927; }
.endpoint-path { color: #bcd9ed; }
.docs-intro { border: 1px solid var(--line); background: radial-gradient(circle at 90% 0%, rgba(44, 144, 197, .2), transparent 35%), linear-gradient(120deg, #0c1a2a, #10243a); }
.endpoint-method { color: #4bd0a4; background: rgba(31, 187, 144, .12); }
input, select, textarea { color: #d6e8f7; border-color: #20374d; background: #081522; }
input::placeholder, textarea::placeholder { color: #49627b; }
input:focus, select:focus, textarea:focus { border-color: #4ba8d8; box-shadow: 0 0 0 3px rgba(66, 165, 213, .12); }
input:read-only { color: #718aa3; background: #0a1724; }
.field > span { color: #a9bed2; }
.form-error:not(:empty) { color: #ef9999; background: rgba(191, 70, 70, .1); }
.modal { color: var(--ink); border: 1px solid #263f56; background: #0c1a29; box-shadow: 0 35px 100px rgba(0, 0, 0, .65); }
.modal::backdrop { background: rgba(2, 8, 14, .72); }
.modal-head { border-bottom-color: var(--line); }
.modal-head h2 { color: #e7f3ff; }
.modal-body > p { color: #8198b0; }
.toast { border-color: rgba(107, 170, 210, .18); background: #11283b; }
.toast.success { background: #114f43; }
.toast.error { background: #6e2d36; }
.login-shell, .login-panel { background: #06101c; }
.login-visual {
  background:
    radial-gradient(circle at 80% 18%, rgba(46, 150, 202, .36), transparent 27%),
    linear-gradient(145deg, #071421 10%, #0b2135 62%, #102b43);
}
.login-copy p { color: #829bb4; }
.login-metrics span, .login-help { color: #5e7994; }
.login-card h2 { color: #ecf7ff; }
.login-card .muted { color: #788fa8; }

@media (max-width: 1180px) {
  .proxy-node-grid { grid-template-columns: 1fr; }
  .maintenance-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .proxy-guide { grid-template-columns: 1fr; }
  .proxy-guide code { overflow: auto; white-space: nowrap; }
  .proxy-node-stats { grid-template-columns: 1fr 1fr; }
  .retention-form, .maintenance-run-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 480px) {
  .retention-form, .maintenance-run-grid { grid-template-columns: 1fr; }
}
