:root {
  --blue: #0052ff;
  --blue-active: #003ecc;
  --ink: #0a0b0d;
  --body: #5b616e;
  --muted: #7c828a;
  --line: #dee1e6;
  --line-soft: #eef0f3;
  --canvas: #ffffff;
  --surface: #f7f8fa;
  --surface-strong: #eef0f3;
  --dark: #0a0b0d;
  --dark-card: #16181c;
  --up: #05b169;
  --down: #cf202f;
  --warning: #f4b000;
  --radius: 16px;
  --radius-lg: 24px;
  --shadow: 0 18px 48px rgba(10, 11, 13, 0.08);
  color-scheme: light;
  font-family: "Avenir Next", "SF Pro Text", "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--canvas);
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(0, 82, 255, 0.045), transparent 340px),
    var(--canvas);
  letter-spacing: 0;
}

body::selection {
  background: rgba(0, 82, 255, 0.18);
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select {
  font: inherit;
}

button {
  color: inherit;
}

.login-shell {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(320px, 0.9fr) minmax(360px, 460px);
  gap: 42px;
  align-items: center;
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 32px;
}

.login-copy h1,
.dashboard-hero h2 {
  margin: 12px 0 0;
  font-size: 64px;
  font-weight: 500;
  line-height: 1;
}

.login-copy p,
.dashboard-hero p {
  max-width: 620px;
  margin: 18px 0 0;
  color: var(--body);
  font-size: 18px;
  line-height: 1.65;
}

.login-api-card {
  display: grid;
  gap: 8px;
  width: min(520px, 100%);
  margin-top: 32px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

.login-api-card span,
.sidebar-foot small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.login-api-card strong {
  overflow-wrap: anywhere;
  font-weight: 600;
}

.login-panel {
  width: 100%;
  background: var(--canvas);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 32px;
}

.login-mark,
.brand-mark {
  width: 44px;
  height: 44px;
  display: inline-grid;
  place-items: center;
  background: var(--blue);
  color: #fff;
  border-radius: 12px;
  font-weight: 800;
}

.login-panel h2 {
  margin: 22px 0 6px;
  font-size: 32px;
  font-weight: 500;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 276px minmax(0, 1fr);
  background: var(--surface);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px;
  background: var(--dark);
  color: #fff;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

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

.brand strong,
.brand small,
nav a span,
nav a small {
  display: block;
}

.brand strong {
  font-size: 15px;
}

.brand small,
.sidebar-foot span,
.sidebar .muted {
  color: #a8acb3;
}

nav {
  display: grid;
  gap: 8px;
}

nav a {
  padding: 12px 13px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: #e6e8eb;
  transition: background 180ms ease, color 180ms ease, border-color 180ms ease, transform 180ms ease;
}

nav a small {
  margin-top: 3px;
  color: #8b919c;
  font-size: 12px;
  line-height: 1.35;
}

nav a.active,
nav a:hover {
  background: #fff;
  color: var(--ink);
  transform: translateX(2px);
}

nav a.active small,
nav a:hover small {
  color: var(--body);
}

.sidebar-foot {
  margin-top: auto;
  display: grid;
  gap: 10px;
  padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.main-panel {
  display: grid;
  align-content: start;
  gap: 22px;
  width: min(1320px, 100%);
  margin: 0 auto;
  padding: 28px clamp(20px, 4vw, 44px) 48px;
}

.topbar {
  min-height: 86px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.topbar h1,
.panel h2,
.agent-card h2,
.profile-band h2 {
  margin: 0;
  font-weight: 500;
}

.topbar h1 {
  margin-top: 5px;
  font-size: 38px;
  line-height: 1.08;
}

.topbar p {
  margin: 8px 0 0;
  color: var(--body);
  overflow-wrap: anywhere;
}

.eyebrow {
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.dashboard-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.48fr);
  gap: 28px;
  align-items: end;
  min-height: 310px;
  padding: 34px;
  border-radius: var(--radius-lg);
  background:
    radial-gradient(circle at 80% 10%, rgba(0, 82, 255, 0.42), transparent 26rem),
    linear-gradient(135deg, #0a0b0d 0%, #151821 100%);
  color: #fff;
  overflow: hidden;
  position: relative;
}

.dashboard-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px),
    linear-gradient(180deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 42px 42px;
  opacity: 0.5;
}

.dashboard-hero > * {
  position: relative;
  z-index: 1;
}

.dashboard-hero p {
  color: #c5cad3;
}

.hero-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.hero-metrics .metric-card {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.16);
  color: #fff;
}

.hero-metrics .metric-card span {
  color: #c5cad3;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 14px;
}

.metric-card,
.panel,
.agent-card,
.toolbar-panel,
.profile-band {
  background: var(--canvas);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: 0 12px 32px rgba(10, 11, 13, 0.04);
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.metric-card:hover,
.panel:hover,
.agent-card:hover,
.toolbar-panel:hover,
.profile-band:hover {
  border-color: rgba(0, 82, 255, 0.28);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.metric-card {
  min-height: 120px;
  padding: 22px;
  display: grid;
  align-content: space-between;
}

.metric-card span,
.muted {
  color: var(--muted);
}

.metric-card strong {
  margin-top: 14px;
  font-size: 38px;
  font-weight: 600;
  line-height: 1;
}

.split-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
}

.agent-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.panel,
.agent-card,
.toolbar-panel,
.profile-band {
  padding: 22px;
  min-width: 0;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.panel-head h2,
.agent-card h2 {
  font-size: 22px;
}

.panel-head a,
.table-link {
  color: var(--blue);
  font-weight: 700;
}

.profile-band {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  background:
    linear-gradient(110deg, rgba(0, 82, 255, 0.08), transparent 42%),
    var(--canvas);
}

.profile-band h2 {
  margin-top: 8px;
  font-size: 36px;
}

.profile-band p {
  margin: 8px 0 0;
  color: var(--body);
  overflow-wrap: anywhere;
}

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

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(0, 82, 255, 0.08);
  color: var(--blue);
  font-weight: 700;
  white-space: nowrap;
}

table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

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

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

td strong,
td small {
  display: block;
}

td small {
  margin-top: 4px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

tr:hover td {
  background: rgba(0, 82, 255, 0.035);
}

.clip {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.form-stack,
.filter-form,
.form-grid,
.inline-form {
  display: grid;
  gap: 12px;
}

.filter-form {
  grid-template-columns: minmax(220px, 1.4fr) repeat(3, minmax(130px, 0.8fr)) auto;
  align-items: center;
}

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

.inline-form {
  margin-top: 16px;
  grid-template-columns: minmax(120px, 160px) minmax(80px, 120px) auto;
}

label span {
  display: block;
  margin-bottom: 7px;
  color: var(--body);
  font-size: 13px;
  font-weight: 700;
}

input,
select {
  width: 100%;
  min-height: 44px;
  padding: 10px 13px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

input:focus,
select:focus {
  outline: 0;
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(0, 82, 255, 0.12);
}

.primary-button,
.ghost-button {
  min-height: 44px;
  border-radius: 999px;
  padding: 0 18px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
  border: 1px solid transparent;
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease;
}

.primary-button {
  background: var(--blue);
  color: #fff;
}

.primary-button:hover {
  background: var(--blue-active);
  transform: translateY(-1px);
}

.ghost-button {
  background: var(--surface-strong);
  border-color: var(--surface-strong);
  color: var(--ink);
}

.ghost-button:hover {
  border-color: var(--line);
  background: #fff;
  transform: translateY(-1px);
}

.sidebar .ghost-button {
  color: #fff;
  background: var(--dark-card);
  border-color: rgba(255, 255, 255, 0.12);
}

.alert,
.notice {
  padding: 13px 15px;
  border-radius: 14px;
  border: 1px solid rgba(207, 32, 47, 0.2);
  background: rgba(207, 32, 47, 0.08);
  color: var(--down);
}

.notice {
  border-color: rgba(5, 177, 105, 0.22);
  background: rgba(5, 177, 105, 0.08);
  color: #057a49;
}

.bar-list {
  display: grid;
  gap: 13px;
}

.bar-row {
  display: grid;
  grid-template-columns: 80px minmax(0, 1fr) 48px;
  gap: 12px;
  align-items: center;
}

.bar-row div {
  height: 2px;
  background: transparent;
  overflow: hidden;
}

.bar-row i {
  display: block;
  height: 100%;
  background: var(--blue);
}

.bar-row strong {
  text-align: right;
}

.event-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 12px;
}

.event-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line-soft);
}

.event-list span,
.empty {
  color: var(--muted);
}

.pager {
  margin-top: 18px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
}

.pager a {
  padding: 9px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--blue);
  font-weight: 700;
}

.pager a.disabled {
  pointer-events: none;
  opacity: 0.45;
  color: var(--muted);
}

.mono {
  font-family: "SFMono-Regular", "Cascadia Code", Consolas, monospace;
  color: var(--muted);
  overflow-wrap: anywhere;
}

@media (prefers-reduced-motion: no-preference) {
  .dashboard-hero,
  .metric-card,
  .panel,
  .agent-card,
  .toolbar-panel,
  .profile-band,
  .login-panel,
  .login-copy {
    animation: rise-in 420ms cubic-bezier(0.16, 1, 0.3, 1) both;
  }

  .metrics-grid .metric-card:nth-child(2) {
    animation-delay: 45ms;
  }

  .metrics-grid .metric-card:nth-child(3) {
    animation-delay: 90ms;
  }

  .metrics-grid .metric-card:nth-child(4) {
    animation-delay: 135ms;
  }
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1100px) {
  .metrics-grid,
  .split-grid,
  .agent-grid,
  .hero-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .filter-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  .login-shell,
  .app-shell {
    grid-template-columns: 1fr;
  }

  .login-shell {
    padding: 18px;
  }

  .login-copy h1,
  .dashboard-hero h2 {
    font-size: 42px;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .main-panel {
    padding: 18px;
  }

  .metrics-grid,
  .split-grid,
  .agent-grid,
  .filter-form,
  .form-grid,
  .inline-form,
  .hero-metrics {
    grid-template-columns: 1fr;
  }

  .profile-band,
  .event-list li {
    align-items: flex-start;
    flex-direction: column;
  }

  .panel,
  .agent-card,
  .toolbar-panel,
  .profile-band,
  .dashboard-hero,
  .login-panel {
    padding: 18px;
  }

  table {
    min-width: 760px;
  }

  .panel {
    overflow-x: auto;
  }
}

@media (max-width: 520px) {
  nav {
    grid-template-columns: 1fr;
  }

  .topbar h1 {
    font-size: 30px;
  }

  .primary-button,
  .ghost-button {
    width: 100%;
  }
}
