:root {
  --bg: #eff6f1;
  --ink: #0f1d3a;
  --muted: #63718a;
  --line: rgba(18, 72, 86, .16);
  --card: rgba(255, 252, 246, .88);
  --teal: #0f8173;
  --mint: #36c2b4;
  --blue: #163957;
  --gold: #ffc85a;
  --shadow: 0 24px 70px rgba(16, 57, 70, .16);
  font-family: "Instrument Sans", sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 18% 12%, rgba(54, 194, 180, .20), transparent 28rem),
    radial-gradient(circle at 84% 4%, rgba(255, 200, 90, .22), transparent 24rem),
    linear-gradient(135deg, #f8f4e9 0%, #dceff2 100%);
}

.shell {
  display: grid;
  grid-template-columns: 320px 1fr;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px 26px;
  background: rgba(255, 252, 246, .64);
  border-right: 1px solid var(--line);
  backdrop-filter: blur(18px);
  overflow: auto;
}

.brand {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 26px;
}

.brand-mark {
  width: 58px;
  height: 58px;
  border-radius: 20px;
  display: grid;
  place-items: center;
  color: white;
  font-weight: 900;
  background: linear-gradient(145deg, var(--teal), var(--mint));
  box-shadow: 0 18px 38px rgba(15, 129, 115, .24);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--teal);
  text-transform: uppercase;
  letter-spacing: .24em;
  font: 800 12px/1 "JetBrains Mono", monospace;
}

h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: 18px; line-height: 1.1; }
h2 { margin-bottom: 18px; font-size: clamp(42px, 5vw, 76px); line-height: .94; letter-spacing: -.07em; }
h3 { margin-bottom: 8px; font-size: 24px; letter-spacing: -.04em; }

.status-card,
.side-links a,
.filter-card,
.panel,
.metric-card,
.module-header {
  border: 1px solid var(--line);
  background: var(--card);
  box-shadow: var(--shadow);
}

.status-card {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 18px;
  border-radius: 22px;
  margin-bottom: 20px;
}

.pulse {
  width: 14px;
  height: 14px;
  border-radius: 99px;
  background: var(--gold);
  box-shadow: 0 0 0 8px rgba(255, 200, 90, .18);
}

.status-card.ok .pulse { background: var(--teal); box-shadow: 0 0 0 8px rgba(15, 129, 115, .15); }
.status-card.error .pulse { background: #ef4444; box-shadow: 0 0 0 8px rgba(239, 68, 68, .15); }
.status-card small, .metric-card small, .hero-copy, .module-header p { color: var(--muted); }

.side-links {
  display: grid;
  gap: 10px;
  margin-bottom: 20px;
}

.side-links a {
  color: var(--ink);
  text-decoration: none;
  font-weight: 800;
  padding: 16px 18px;
  border-radius: 18px;
}

.side-links a.active { border-color: rgba(15, 129, 115, .38); color: var(--teal); }

.filter-card {
  display: grid;
  gap: 10px;
  padding: 18px;
  border-radius: 22px;
}

label { font-weight: 800; color: var(--ink); }
select, input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  color: var(--ink);
  background: rgba(255,255,255,.76);
}

select { min-height: 72px; }
button, .ghost-button {
  border: 0;
  border-radius: 999px;
  padding: 13px 18px;
  font: 900 14px/1 "Instrument Sans", sans-serif;
  cursor: pointer;
  color: #fff;
  background: linear-gradient(135deg, var(--teal), var(--mint));
  text-decoration: none;
}

button.ghost, .ghost-button {
  color: var(--ink);
  background: rgba(255,255,255,.18);
  border: 1px solid rgba(255,255,255,.36);
}

.content { padding: 28px 34px; }
.hero {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: center;
  margin-bottom: 24px;
  padding: 36px;
  border-radius: 36px;
  color: white;
  background:
    radial-gradient(circle at 88% 14%, rgba(255, 200, 90, .22), transparent 16rem),
    linear-gradient(135deg, #0f5e55, #153752);
  box-shadow: var(--shadow);
}

.hero .eyebrow, .hero-copy { color: #d9fff8; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }

.module-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-bottom: 18px;
  padding: 28px;
  border-radius: 28px;
}

.source-chip {
  padding: 12px 16px;
  border-radius: 999px;
  font: 800 12px/1 "JetBrains Mono", monospace;
  color: #0f665d;
  background: rgba(15, 129, 115, .12);
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

.metric-card {
  padding: 22px;
  border-radius: 24px;
}

.metric-card span { display: block; color: var(--muted); margin-bottom: 8px; }
.metric-card strong { display: block; font-size: 38px; letter-spacing: -.06em; }

.chart-grid {
  display: grid;
  grid-template-columns: 1.15fr .85fr;
  gap: 18px;
  margin-bottom: 18px;
}

.panel {
  padding: 24px;
  border-radius: 26px;
  margin-bottom: 18px;
}

.panel.wide { grid-column: 1 / -1; }
.panel-head { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-bottom: 16px; }
canvas { width: 100%; max-height: 360px; }

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

.media-pill {
  padding: 18px;
  border-radius: 20px;
  background: rgba(15, 129, 115, .09);
}

.media-pill strong { display: block; font-size: 28px; margin-top: 6px; }

.table-wrap { overflow: auto; border-radius: 18px; border: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 14px 16px; border-bottom: 1px solid var(--line); text-align: left; }
th { font: 900 12px/1 "JetBrains Mono", monospace; color: var(--muted); text-transform: uppercase; letter-spacing: .12em; }

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  max-width: 360px;
  padding: 14px 16px;
  border-radius: 16px;
  color: white;
  background: #153752;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(10px);
  transition: .2s ease;
}

.toast.show { opacity: 1; transform: translateY(0); }
.admin-shell { max-width: 1120px; margin: 0 auto; padding: 30px; }
.admin-hero { margin-top: 0; }
.admin-form { display: grid; grid-template-columns: 1fr auto auto; gap: 14px; align-items: end; }
pre { white-space: pre-wrap; min-height: 220px; padding: 18px; border-radius: 18px; background: #0f1d3a; color: #d9fff8; overflow: auto; }

@media (max-width: 1100px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  .metrics-grid, .chart-grid, .media-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 720px) {
  .content, .admin-shell { padding: 18px; }
  .hero, .module-header, .panel-head, .admin-form { display: grid; }
  .metrics-grid, .chart-grid, .media-grid { grid-template-columns: 1fr; }
  h2 { font-size: 44px; }
}
