:root {
  --bg: #f4f7fb;
  --bg-alt: #eef3f8;
  --panel: rgba(255, 255, 255, 0.9);
  --panel-solid: #ffffff;
  --text: #0f172a;
  --muted: #5f7186;
  --border: rgba(148, 163, 184, 0.2);
  --shadow: 0 20px 60px rgba(15, 23, 42, 0.08);
  --shadow-soft: 0 10px 30px rgba(15, 23, 42, 0.05);
  --accent: #2563eb;
  --accent-2: #14b8a6;
  --accent-3: #7c3aed;
  --success: #16a34a;
  --warning: #f59e0b;
  --danger: #ef4444;
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, 0.08), transparent 30%),
    radial-gradient(circle at 85% 15%, rgba(20, 184, 166, 0.08), transparent 28%),
    linear-gradient(180deg, #f8fbff 0%, var(--bg) 100%);
  color: var(--text);
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  position: relative;
  overflow-x: hidden;
}

.dashboard-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(120deg, rgba(37, 99, 235, 0.04), transparent 35%),
    linear-gradient(320deg, rgba(20, 184, 166, 0.03), transparent 30%);
  z-index: 0;
}

.dashboard-container {
  max-width: 1600px;
  margin: 0 auto;
  padding-left: 1.25rem;
  padding-right: 1.25rem;
}

.dashboard-main {
  position: relative;
  z-index: 1;
  padding-top: 1.5rem;
  padding-bottom: 3rem;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(18px);
  background: rgba(248, 251, 255, 0.72);
  border-bottom: 1px solid rgba(148, 163, 184, 0.18);
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1rem;
  color: var(--text);
  text-decoration: none;
}

.brand-dot {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 0 8px rgba(37, 99, 235, 0.08);
}

.topbar-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.5rem 0.85rem;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.08);
  color: #24446f;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.topbar-pill-muted {
  background: rgba(20, 184, 166, 0.1);
  color: #0f5f57;
}

.hero-panel,
.panel,
.metric-card {
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(14px);
}

.hero-panel {
  display: grid;
  grid-template-columns: 1.8fr 0.8fr;
  gap: 1rem;
  padding: 1.8rem;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.94), rgba(255, 255, 255, 0.82)),
    radial-gradient(circle at top right, rgba(37, 99, 235, 0.06), transparent 40%);
}

.hero-copy h1 {
  margin: 0;
  font-size: clamp(2rem, 3vw, 3.4rem);
  line-height: 1.04;
  letter-spacing: -0.04em;
  font-weight: 800;
  max-width: 12ch;
}

.hero-kicker {
  margin: 0 0 0.75rem;
  color: var(--accent);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.75rem;
}

.hero-text {
  margin: 1rem 0 0;
  max-width: 72ch;
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.75;
}

.hero-side {
  display: grid;
  gap: 0.9rem;
  align-content: start;
}

.hero-stat {
  padding: 1rem 1.1rem;
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(248, 250, 252, 0.96));
  border: 1px solid rgba(148, 163, 184, 0.16);
}

.hero-stat-label {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.hero-stat strong {
  display: block;
  margin-top: 0.35rem;
  font-size: 1.5rem;
  line-height: 1.1;
  letter-spacing: -0.03em;
}

.panel {
  border-radius: var(--radius-xl);
  padding: 1.25rem;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1rem;
}

.panel-header.compact {
  margin-bottom: 0.75rem;
}

.panel-header h2 {
  margin: 0;
  font-size: 1.08rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.panel-header p {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.panel-actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.btn-soft {
  background: rgba(15, 23, 42, 0.03);
  border: 1px solid rgba(148, 163, 184, 0.2);
  color: var(--text);
}

.filters-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 1rem;
}

.filter-field,
.filter-toggle {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.filter-field span,
.filter-toggle span {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--muted);
  text-transform: uppercase;
}

.filter-field input,
.filter-field select {
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  padding: 0.8rem 0.95rem;
  background: rgba(255, 255, 255, 0.88);
  color: var(--text);
  font-size: 0.95rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

.filter-help {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.2;
}

.filter-field input:focus,
.filter-field select:focus {
  outline: none;
  border-color: rgba(37, 99, 235, 0.45);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.filter-toggle {
  flex-direction: row;
  align-items: center;
  justify-content: center;
  min-height: 100%;
  padding: 0.85rem 1rem;
  border-radius: 16px;
  background: rgba(15, 23, 42, 0.03);
  border: 1px solid rgba(148, 163, 184, 0.2);
}

.filter-toggle input {
  width: 1rem;
  height: 1rem;
  accent-color: var(--accent);
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 1rem;
}

.metric-card {
  border-radius: 24px;
  padding: 1.15rem;
  min-height: 118px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}

.metric-card::after {
  content: "";
  position: absolute;
  inset: auto -15% -55% auto;
  width: 140px;
  height: 140px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(37, 99, 235, 0.08), transparent 65%);
  pointer-events: none;
}

.metric-card strong {
  font-size: clamp(1.8rem, 2vw, 2.3rem);
  font-weight: 800;
  letter-spacing: -0.04em;
}

.metric-card-sync {
  align-items: center;
  text-align: center;
  justify-content: center;
  gap: 0.2rem;
}

.metric-sync-icon {
  font-size: clamp(2rem, 2.8vw, 3rem) !important;
  line-height: 1;
}

.metric-sync-label {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
}

.metric-label {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.metric-card-accent {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.12), rgba(20, 184, 166, 0.12));
}

.insight-grid,
.charts-grid {
  display: grid;
  gap: 1rem;
}

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

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

.agent-highlight {
  display: grid;
  gap: 0.3rem;
  padding: 1rem 0.25rem 0.3rem;
}

.agent-highlight-name {
  color: var(--muted);
  font-size: 0.88rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.agent-highlight-score {
  font-size: 2.1rem;
  font-weight: 800;
  letter-spacing: -0.05em;
}

.agent-highlight-meta {
  color: var(--muted);
  font-size: 0.92rem;
}

.queue-list {
  display: grid;
  gap: 0.75rem;
}

.queue-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1rem;
  border-radius: 16px;
  background: rgba(15, 23, 42, 0.03);
  border: 1px solid rgba(148, 163, 184, 0.14);
}

.queue-item strong {
  font-size: 0.98rem;
}

.queue-item span {
  color: var(--muted);
}

.chart-panel {
  min-height: 420px;
}

.chart-panel-wide {
  grid-column: 1 / -1;
}

.chart-box {
  position: relative;
  height: 320px;
}

.chart-box canvas {
  width: 100% !important;
  height: 100% !important;
}

.table-panel {
  padding-bottom: 0.5rem;
}

.dashboard-table {
  margin-bottom: 0;
  color: var(--text);
}

.dashboard-table thead th {
  background: rgba(248, 250, 252, 0.96);
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-bottom: 1px solid rgba(148, 163, 184, 0.16);
  padding-top: 0.95rem;
  padding-bottom: 0.95rem;
  white-space: nowrap;
}

.dashboard-table tbody td {
  vertical-align: middle;
  border-top-color: rgba(148, 163, 184, 0.14);
  padding-top: 1rem;
  padding-bottom: 1rem;
}

.table-empty {
  text-align: center;
  color: var(--muted);
  padding: 2rem !important;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.38rem 0.72rem;
  border-radius: 999px;
  font-size: 0.77rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  border: 1px solid transparent;
}

.status-badge--completed {
  background: rgba(22, 163, 74, 0.12);
  color: #166534;
  border-color: rgba(22, 163, 74, 0.18);
}

.status-badge--launched,
.status-badge--launching {
  background: rgba(37, 99, 235, 0.12);
  color: #1d4ed8;
  border-color: rgba(37, 99, 235, 0.18);
}

.status-badge--pending {
  background: rgba(100, 116, 139, 0.14);
  color: #475569;
  border-color: rgba(100, 116, 139, 0.2);
}

.status-badge--failed,
.status-badge--cancelled {
  background: rgba(239, 68, 68, 0.12);
  color: #b91c1c;
  border-color: rgba(239, 68, 68, 0.18);
}

.blank-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.2rem;
  padding: 0.32rem 0.55rem;
  border-radius: 999px;
  background: rgba(245, 158, 11, 0.12);
  color: #92400e;
  font-weight: 700;
  font-size: 0.78rem;
}

.score-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.4rem;
  padding: 0.32rem 0.6rem;
  border-radius: 999px;
  font-weight: 800;
  font-size: 0.82rem;
  background: rgba(37, 99, 235, 0.12);
  color: #1d4ed8;
}

.customer-mask {
  font-feature-settings: "tnum";
  letter-spacing: 0.02em;
}

.alert-soft {
  border-radius: 18px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow-soft);
}

.dashboard-footer {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.35rem;
  margin-top: 1.5rem;
  padding: 1.2rem 0 0.25rem;
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
}

.dashboard-footer a {
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
}

.dashboard-footer a:hover {
  text-decoration: underline;
}

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

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

@media (max-width: 992px) {
  .hero-panel {
    grid-template-columns: 1fr;
  }

  .insight-grid,
  .charts-grid {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 768px) {
  .dashboard-container {
    padding-left: 0.85rem;
    padding-right: 0.85rem;
  }

  .hero-panel,
  .panel,
  .metric-card {
    border-radius: 20px;
  }

  .filters-grid {
    grid-template-columns: 1fr;
  }

  .metrics-grid {
    grid-template-columns: 1fr;
  }

  .panel-header {
    flex-direction: column;
  }

  .chart-panel {
    min-height: 360px;
  }
}
