:root {
  color-scheme: dark;
  --color-slate-950: #050b16;
  --color-slate-900: #0b1627;
  --color-slate-850: #101d31;
  --color-slate-800: #16253b;
  --color-slate-700: #223654;
  --color-slate-500: #5f779c;
  --color-white: #f7fbff;
  --color-cyan-400: #3cc8ff;
  --color-blue-500: #4d88ff;
  --color-violet-500: #8d6bff;
  --color-emerald-400: #3ddc97;
  --color-amber-400: #f6bd4f;
  --color-red-400: #ff6c7d;
  --color-rose-400: #fb6f92;
  --app-bg: linear-gradient(180deg, #09101c 0%, #050913 55%, #04070f 100%);
  --sidebar-bg: linear-gradient(180deg, rgba(9, 18, 32, 0.98), rgba(7, 13, 24, 0.98));
  --panel-bg: linear-gradient(180deg, rgba(17, 29, 48, 0.96), rgba(12, 21, 37, 0.96));
  --panel-soft-bg: rgba(14, 25, 43, 0.82);
  --panel-border: rgba(109, 148, 204, 0.16);
  --text-strong: var(--color-white);
  --text-primary: #d4e1f5;
  --text-secondary: #8ea3c4;
  --text-muted: #6f83a3;
  --shadow-xl: 0 32px 72px rgba(0, 0, 0, 0.34);
  --shadow-lg: 0 18px 36px rgba(0, 0, 0, 0.24);
  --accent-primary: var(--color-cyan-400);
  --success: var(--color-emerald-400);
  --warning: var(--color-amber-400);
  --danger: var(--color-red-400);
  --radius-xl: 28px;
  --input-bg: rgba(9, 18, 32, 0.86);
  --input-border: rgba(113, 150, 205, 0.18);
  --button-ghost-bg: rgba(146, 177, 224, 0.08);
  --button-ghost-hover: rgba(146, 177, 224, 0.14);
  --button-primary-bg: linear-gradient(135deg, rgba(40, 197, 255, 1), rgba(92, 114, 255, 1));
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Microsoft YaHei UI", "PingFang SC", "Noto Sans SC", "Segoe UI Variable Display", "Aptos", sans-serif;
  background:
    radial-gradient(circle at top right, rgba(77, 136, 255, 0.22), transparent 26%),
    radial-gradient(circle at 15% 10%, rgba(60, 200, 255, 0.18), transparent 20%),
    var(--app-bg);
  color: var(--text-primary);
}

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

.dashboard-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 252px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  min-height: 100vh;
  padding: 28px 20px;
  display: flex;
  flex-direction: column;
  gap: 26px;
  background: var(--sidebar-bg);
  border-right: 1px solid rgba(132, 165, 215, 0.12);
}

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

.brand-mark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(37, 211, 255, 0.95), rgba(82, 97, 255, 0.95));
  color: var(--color-slate-950);
  font-weight: 900;
  letter-spacing: 0.08em;
}

.brand-name,
.brand-subtitle {
  margin: 0;
}

.brand-name {
  font-size: 19px;
  font-weight: 700;
  color: var(--text-strong);
}

.brand-subtitle {
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-muted);
}

.sidebar-nav {
  display: grid;
  gap: 8px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 16px;
  text-decoration: none;
  color: var(--text-secondary);
  border: 1px solid transparent;
  transition: background 140ms ease, color 140ms ease, border-color 140ms ease;
}

.nav-link:hover,
.nav-link.is-active {
  color: var(--text-strong);
  background: rgba(95, 119, 156, 0.12);
  border-color: rgba(90, 121, 165, 0.18);
}

.nav-icon {
  width: 18px;
  text-align: center;
  color: var(--accent-primary);
}

.sidebar-footer {
  margin-top: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.sidebar-badge {
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(146, 177, 224, 0.08);
  border: 1px solid rgba(146, 177, 224, 0.14);
  font-size: 12px;
  color: var(--text-secondary);
}

.main-column {
  padding: 28px 28px 40px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 22px;
}

.topbar-copy h1,
.hero-copy h2,
.panel h2 {
  margin: 0;
  color: var(--text-strong);
}

.topbar-kicker,
.section-label {
  margin: 0 0 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--accent-primary);
}

.topbar-copy h1 {
  font-size: clamp(30px, 5vw, 42px);
  line-height: 1;
}

.topbar-subtitle {
  max-width: 66ch;
  margin: 10px 0 0;
  color: var(--text-secondary);
  line-height: 1.6;
}

.topbar-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.topbar-chip {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  padding: 0 14px;
  border-radius: 999px;
  color: var(--text-primary);
  background: rgba(18, 31, 52, 0.94);
  border: 1px solid rgba(132, 165, 215, 0.16);
  box-shadow: var(--shadow-lg);
}

.panel {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
}

.hero-banner {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.6fr);
  gap: 24px;
  padding: 28px;
}

.hero-copy h2 {
  max-width: 14ch;
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.02;
}

.hero-description {
  max-width: 58ch;
  margin: 16px 0 0;
  color: var(--text-secondary);
  line-height: 1.7;
}

.hero-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.hero-pills span {
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid rgba(80, 153, 255, 0.18);
  background: rgba(8, 16, 29, 0.66);
  color: var(--text-secondary);
  font-size: 12px;
}

.hero-callout {
  align-self: stretch;
  display: grid;
  align-content: center;
  gap: 10px;
  padding: 22px;
  border-radius: 22px;
  border: 1px solid rgba(97, 136, 190, 0.18);
  background:
    radial-gradient(circle at top right, rgba(60, 200, 255, 0.18), transparent 34%),
    rgba(7, 15, 29, 0.78);
}

.callout-label {
  margin: 0;
  color: var(--text-muted);
  letter-spacing: 0.12em;
  font-size: 11px;
}

.hero-callout strong {
  font-size: clamp(34px, 5vw, 56px);
  line-height: 1;
  color: var(--text-strong);
}

.hero-callout span {
  color: var(--text-secondary);
  line-height: 1.5;
}

.metrics-grid {
  margin-top: 22px;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 16px;
}

.metric-card {
  min-height: 130px;
  display: flex;
  gap: 14px;
  padding: 20px;
  background: var(--panel-soft-bg);
  border: 1px solid var(--panel-border);
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
}

.metric-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  font-size: 18px;
  font-weight: 900;
  background: rgba(146, 177, 224, 0.08);
  border: 1px solid rgba(146, 177, 224, 0.12);
}

.accent-blue { color: var(--color-blue-500); }
.accent-violet { color: var(--color-violet-500); }
.accent-cyan { color: var(--accent-primary); }
.accent-emerald { color: var(--success); }
.accent-amber { color: var(--warning); }
.accent-rose { color: var(--danger); }

.metric-copy {
  display: grid;
  gap: 6px;
}

.metric-copy p,
.metric-copy span {
  margin: 0;
}

.metric-copy p {
  color: var(--text-muted);
  font-size: 12px;
  letter-spacing: 0.08em;
}

.metric-copy strong {
  font-size: 30px;
  line-height: 1;
  color: var(--text-strong);
}

.metric-copy span {
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.45;
}

.analytics-grid {
  margin-top: 22px;
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(360px, 0.65fr);
  gap: 18px;
}

.chart-panel,
.workspace-main .panel,
.workspace-side .panel,
.secondary-panel {
  padding: 24px;
}

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

.tight-head {
  margin-bottom: 14px;
}

.panel-meta {
  margin: 0;
  color: var(--text-muted);
  font-size: 13px;
}

.trend-chart {
  min-height: 278px;
  border-radius: 20px;
  border: 1px solid rgba(132, 165, 215, 0.12);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent 24%), rgba(7, 14, 27, 0.74);
  padding: 16px;
}

.chart-svg {
  display: block;
  width: 100%;
  height: 246px;
}

.chart-empty {
  min-height: 246px;
  display: grid;
  place-items: center;
  color: var(--text-muted);
  border: 1px dashed rgba(132, 165, 215, 0.14);
  border-radius: 16px;
}

.status-distribution {
  min-height: 278px;
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 20px;
  align-items: center;
}

.status-donut-shell {
  display: grid;
  place-items: center;
}

.status-donut-chart {
  --donut-fill: conic-gradient(from 180deg, rgba(91, 112, 143, 0.28) 0deg 360deg);
  position: relative;
  width: 196px;
  height: 196px;
  border-radius: 50%;
  background: var(--donut-fill);
}

.status-donut-chart::after {
  content: "";
  position: absolute;
  inset: 24px;
  border-radius: 50%;
  background: rgba(7, 15, 29, 0.98);
  border: 1px solid rgba(132, 165, 215, 0.12);
}

.status-donut-center {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: grid;
  place-items: center;
  gap: 4px;
  text-align: center;
}

.status-donut-center strong {
  color: var(--text-strong);
  font-size: 32px;
  line-height: 1;
}

.status-donut-center span {
  color: var(--text-muted);
  font-size: 12px;
  letter-spacing: 0.08em;
}

.status-legend {
  display: grid;
  gap: 10px;
}

.status-legend-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(8, 16, 29, 0.58);
  border: 1px solid rgba(132, 165, 215, 0.12);
}

.status-legend-label {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-secondary);
}

.status-legend-count {
  color: var(--text-strong);
  font-weight: 700;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.workspace-grid {
  margin-top: 22px;
  display: grid;
  grid-template-columns: minmax(0, 1.18fr) minmax(360px, 0.82fr);
  gap: 18px;
}

.workspace-main,
.workspace-side {
  display: grid;
  gap: 18px;
}

.dashboard-form {
  display: grid;
  gap: 16px;
}

.config-form {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.provider-form {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

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

.dashboard-form label {
  display: grid;
  gap: 8px;
}

.dashboard-form .field-stack {
  display: grid;
  gap: 10px;
  align-content: start;
}

.dashboard-form .conditional-field[hidden] {
  display: none;
}

.dashboard-form span {
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.dashboard-form input,
.dashboard-form select {
  width: 100%;
  border-radius: 14px;
  border: 1px solid var(--input-border);
  background: var(--input-bg);
  color: var(--text-primary);
  padding: 13px 14px;
  outline: none;
}

.dashboard-form input:focus,
.dashboard-form select:focus {
  border-color: rgba(60, 200, 255, 0.4);
  box-shadow: 0 0 0 3px rgba(60, 200, 255, 0.12);
}

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

.form-actions,
.detail-actions,
.button-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.form-actions {
  grid-column: 1 / -1;
  justify-content: space-between;
}

.status-message,
.subtle-meta {
  margin: 0;
}

.status-message {
  min-height: 20px;
  color: var(--text-muted);
}

.status-message[data-variant="success"] { color: var(--success); }
.status-message[data-variant="error"] { color: var(--danger); }

.field-hint {
  margin: 0;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.6;
}

.subtle-meta {
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.5;
}

.ghost-button,
.primary-button {
  min-height: 44px;
  border: 0;
  border-radius: 999px;
  padding: 0 18px;
  cursor: pointer;
  transition: transform 140ms ease, opacity 140ms ease, background 140ms ease;
}

.ghost-button {
  color: var(--text-primary);
  background: var(--button-ghost-bg);
  border: 1px solid rgba(132, 165, 215, 0.14);
}

.primary-button {
  min-width: 148px;
  color: #08111f;
  font-weight: 700;
  background: var(--button-primary-bg);
  box-shadow: 0 14px 28px rgba(43, 120, 255, 0.24);
}

.ghost-button:hover,
.primary-button:hover {
  transform: translateY(-1px);
}

.ghost-button:hover {
  background: var(--button-ghost-hover);
}

.ghost-button:disabled,
.primary-button:disabled {
  opacity: 0.5;
  transform: none;
  cursor: default;
}

.task-list {
  display: grid;
  gap: 12px;
}

.task-card {
  display: grid;
  gap: 12px;
  padding: 18px;
  border-radius: 18px;
  border: 1px solid rgba(132, 165, 215, 0.12);
  background: rgba(7, 15, 29, 0.72);
}

.task-card-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.task-id {
  margin-top: 6px;
  color: var(--text-muted);
  font-size: 12px;
  font-family: Consolas, "Courier New", monospace;
  word-break: break-all;
}

.task-status {
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(97, 119, 156, 0.12);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.task-status[data-status="done"] {
  background: rgba(61, 220, 151, 0.14);
  color: var(--success);
}

.task-status[data-status="processing"],
.task-status[data-status="pending"] {
  background: rgba(60, 200, 255, 0.14);
  color: var(--accent-primary);
}

.task-status[data-status="failed"],
.task-status[data-status="cancelled"] {
  background: rgba(255, 108, 125, 0.14);
  color: var(--danger);
}

.task-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.task-meta-row span {
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(132, 165, 215, 0.08);
  color: var(--text-secondary);
  font-size: 12px;
}

.task-prompt {
  margin: 0;
  color: var(--text-primary);
  line-height: 1.7;
}

.task-card-actions,
.detail-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.task-card-button {
  min-height: 40px;
  padding: 0 14px;
  font-size: 13px;
}

.config-preview {
  margin: 0;
  min-height: 164px;
  padding: 18px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(4, 10, 20, 0.98), rgba(7, 13, 24, 0.98));
  border: 1px solid rgba(132, 165, 215, 0.1);
  color: #cce0ff;
  font-size: 12px;
  line-height: 1.7;
  font-family: Consolas, "Courier New", monospace;
  overflow: auto;
}

.empty-state {
  padding: 28px 16px;
  text-align: center;
  border-radius: 18px;
  border: 1px dashed rgba(132, 165, 215, 0.16);
  color: var(--text-muted);
}

.secondary-panel {
  margin-top: 22px;
  padding: 24px;
}

.page-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(320px, 0.92fr);
  gap: 18px;
  margin-top: 22px;
}

.page-panel {
  padding: 24px;
}

.quick-links,
.info-list {
  display: grid;
  gap: 14px;
}

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

.quick-link-card,
.info-card {
  display: grid;
  gap: 8px;
  padding: 18px;
  border-radius: 18px;
  text-decoration: none;
  border: 1px solid rgba(132, 165, 215, 0.12);
  background: rgba(7, 15, 29, 0.72);
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
}

.quick-link-card:hover {
  transform: translateY(-1px);
  border-color: rgba(60, 200, 255, 0.22);
  background: rgba(9, 19, 35, 0.86);
}

.quick-link-card strong,
.info-card strong {
  color: var(--text-strong);
  font-size: 17px;
}

.quick-link-card span,
.info-card span {
  color: var(--text-secondary);
  line-height: 1.65;
}

.chart-empty-inline {
  min-height: 100px;
}

@media (max-width: 1480px) {
  .metrics-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .analytics-grid,
  .workspace-grid,
  .page-grid {
    grid-template-columns: 1fr;
  }
}

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

  .sidebar {
    position: static;
    min-height: auto;
    border-right: 0;
    border-bottom: 1px solid rgba(132, 165, 215, 0.12);
  }

  .topbar {
    flex-direction: column;
  }

  .topbar-meta {
    justify-content: flex-start;
  }

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

@media (max-width: 820px) {
  .main-column {
    padding: 18px;
  }

  .metrics-grid,
  .config-form,
  .provider-form,
  .inline-form,
  .status-distribution,
  .quick-links {
    grid-template-columns: 1fr;
  }

  .task-card-actions,
  .detail-actions,
  .button-row {
    justify-content: stretch;
  }

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