:root {
  --bg: #08111a;
  --bg-alt: #0d1722;
  --panel: rgba(255, 255, 255, 0.07);
  --panel-strong: rgba(255, 255, 255, 0.1);
  --border: rgba(255, 255, 255, 0.14);
  --text: #f4f7fb;
  --muted: #b7c3d1;
  --accent: #79d3ff;
  --accent-warm: #f4b76b;
  --good: #7ccf8a;
  --warn: #f0b35a;
  --bad: #ff7d72;
  --shadow: rgba(0, 0, 0, 0.28);
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
}

* { box-sizing: border-box; }

html,
body {
  margin: 0;
  min-height: 100%;
  color: var(--text);
  background:
    radial-gradient(circle at 15% 12%, rgba(121, 211, 255, 0.14), transparent 26%),
    radial-gradient(circle at 86% 14%, rgba(244, 183, 107, 0.14), transparent 22%),
    linear-gradient(180deg, #09111a 0%, var(--bg) 100%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body { position: relative; }

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: linear-gradient(to bottom, black, transparent 90%);
}

a { color: inherit; }
img { max-width: 100%; }

.shell {
  width: min(1440px, calc(100vw - 24px));
  margin: 0 auto;
  padding: 18px 0 40px;
  position: relative;
  z-index: 1;
}

.topbar,
.panel,
.card,
.table-shell,
.source-item,
.filter-bar,
.detail-card {
  border: 1px solid var(--border);
  background: linear-gradient(180deg, var(--panel-strong), var(--panel));
  border-radius: var(--radius-lg);
  box-shadow: 0 18px 44px var(--shadow);
  backdrop-filter: blur(14px);
}

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

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  text-decoration: none;
}

.logo {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  flex: none;
  background:
    radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.95), transparent 12%),
    linear-gradient(135deg, #79d3ff 0%, #4d7cff 55%, #f4b76b 100%);
}

.brand strong {
  display: block;
  font-size: 17px;
  letter-spacing: 0.2px;
}

.brand span,
.muted {
  color: var(--muted);
  font-size: 13px;
}

.chip-link,
.button,
.chip,
.filter-chip,
.tab-chip,
.small-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
  cursor: pointer;
}

.chip-link:hover,
.button:hover,
.chip:hover,
.filter-chip:hover,
.tab-chip:hover,
.small-link:hover,
.filter-chip.active,
.tab-chip.active {
  color: var(--text);
  background: rgba(255, 255, 255, 0.1);
}

.button.primary,
.tab-chip.primary {
  background: rgba(121, 211, 255, 0.16);
  border-color: rgba(121, 211, 255, 0.28);
  color: #dff6ff;
  font-weight: 700;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 0.9fr);
  gap: 16px;
  margin-bottom: 16px;
}

.hero-card,
.panel,
.card,
.detail-card,
.table-shell {
  padding: 18px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 11px;
  border-radius: 999px;
  background: rgba(121, 211, 255, 0.12);
  border: 1px solid rgba(121, 211, 255, 0.2);
  color: #d8f2ff;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 14px;
}

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

h1 {
  font-size: clamp(34px, 4.7vw, 58px);
  line-height: 0.98;
  letter-spacing: -1.6px;
  max-width: 820px;
}

.hero p,
.panel p,
.detail-card p,
.table-shell p,
.card p {
  color: var(--muted);
  line-height: 1.6;
}

.hero-actions,
.card-actions,
.page-actions,
.item-actions,
.source-links,
.summary-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.hero-actions { margin-top: 22px; }

.grid { display: grid; gap: 16px; }
.two-col { grid-template-columns: minmax(0, 1.7fr) minmax(320px, 0.9fr); }
.three-col { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.four-col { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.summary-card,
.metric,
.source-item,
.card { padding: 16px; }

.metric strong,
.summary-card strong {
  display: block;
  font-size: 24px;
  line-height: 1;
  margin-bottom: 6px;
}

.metric span,
.summary-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.card { border-radius: var(--radius-md); }
.card h3,
.card h4,
.detail-card h3 { margin-bottom: 8px; letter-spacing: -0.3px; }

.status-row,
.meta-row,
.source-meta,
.table-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.badge,
.pill,
.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.pill.live,
.status-pill.live { color: #defbe6; border-color: rgba(124, 207, 138, 0.28); background: rgba(124, 207, 138, 0.12); }
.pill.cached,
.status-pill.cached { color: #dcefff; border-color: rgba(121, 211, 255, 0.28); background: rgba(121, 211, 255, 0.12); }
.pill.external,
.status-pill.external { color: #fbe2c2; border-color: rgba(244, 183, 107, 0.28); background: rgba(244, 183, 107, 0.12); }
.pill.manual,
.status-pill.manual { color: #f6d5ff; border-color: rgba(214, 144, 255, 0.24); background: rgba(214, 144, 255, 0.12); }

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

.section-head h2 {
  font-size: 22px;
  letter-spacing: -0.4px;
}

.filter-bar { display: grid; gap: 12px; }
.filter-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.filter-stack,
.filter-item,
.field { display: grid; gap: 6px; }

.field label,
.filter-item label,
.filter-stack label {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.field input,
.field select,
.field textarea,
.filter-item input,
.filter-item select,
.filter-item textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  padding: 10px 12px;
  font: inherit;
  outline: none;
}

.field textarea,
.filter-item textarea {
  min-height: 110px;
  resize: vertical;
}

.field input::placeholder,
.field textarea::placeholder,
.filter-item input::placeholder,
.filter-item textarea::placeholder { color: #8f9cab; }

.inline-options { display: flex; flex-wrap: wrap; gap: 8px; }

.inline-options label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-size: 12px;
}

.inline-options input { accent-color: var(--accent); }

.table-shell { overflow: hidden; }
.table-wrap {
  overflow: auto;
  border-radius: calc(var(--radius-lg) - 6px);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1080px;
}

th,
td {
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  background: rgba(10, 18, 28, 0.94);
  z-index: 1;
  color: #d7e6f4;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

tbody tr:hover { background: rgba(255, 255, 255, 0.04); }

.table-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.table-actions .small-link,
.table-actions .chip {
  min-height: 30px;
  padding: 0 10px;
  font-size: 12px;
}

.loading,
.empty,
.error {
  padding: 16px;
  border-radius: var(--radius-md);
  border: 1px dashed rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
}

.error {
  border-color: rgba(255, 125, 114, 0.28);
  color: #ffd4cf;
  background: rgba(255, 125, 114, 0.08);
}

.detail-card {
  position: sticky;
  top: 16px;
}

.detail-card .summary { color: var(--muted); margin-bottom: 14px; }

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 14px 0;
}

.detail-metric {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.04);
  padding: 10px;
}

.detail-metric span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 3px;
}

.detail-metric strong { font-size: 14px; }

.pagination {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 14px;
}

.footer-note {
  margin-top: 18px;
  color: var(--muted);
  text-align: center;
  font-size: 12px;
}

@media (max-width: 1180px) {
  .two-col,
  .hero,
  .filter-grid,
  .three-col,
  .four-col { grid-template-columns: 1fr; }

  .detail-card { position: static; }
  table { min-width: 920px; }
}

@media (max-width: 700px) {
  .shell {
    width: min(100vw - 14px, 1440px);
    padding-top: 10px;
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  h1 { font-size: 33px; }
}