:root {
  color-scheme: dark;
  --bg: #070b12;
  --bg-elevated: #0d1420;
  --panel: rgba(14, 23, 36, 0.92);
  --panel-strong: #101b2b;
  --panel-soft: rgba(255, 255, 255, 0.045);
  --line: rgba(211, 222, 239, 0.16);
  --line-strong: rgba(211, 222, 239, 0.28);
  --text: #f4f7fb;
  --text-soft: #b9c5d6;
  --muted: #7f8da3;
  --gold: #d7ad55;
  --gold-strong: #f0c96a;
  --green: #45d483;
  --green-soft: rgba(69, 212, 131, 0.13);
  --red: #f06a6a;
  --red-soft: rgba(240, 106, 106, 0.13);
  --amber: #f1aa4b;
  --amber-soft: rgba(241, 170, 75, 0.13);
  --blue: #75a7ff;
  --blue-soft: rgba(117, 167, 255, 0.13);
  --violet: #b790ff;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.42);
  --sans: "IBM Plex Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  --display: "Bricolage Grotesque", var(--sans);
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  background:
    linear-gradient(180deg, rgba(7, 11, 18, 0.76), var(--bg) 34rem),
    radial-gradient(circle at 20% 0%, rgba(215, 173, 85, 0.13), transparent 28rem),
    var(--bg);
  color: var(--text);
  font-family: var(--sans);
}

button,
select,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

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

img,
canvas {
  display: block;
  max-width: 100%;
}

:focus-visible {
  outline: 2px solid var(--gold-strong);
  outline-offset: 3px;
}

.noise {
  position: fixed;
  inset: 0;
  z-index: -3;
  pointer-events: none;
  opacity: 0.23;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 220 220' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='220' height='220' filter='url(%23n)' opacity='.45'/%3E%3C/svg%3E");
}

.command-grid {
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(211, 222, 239, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(211, 222, 239, 0.055) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.76), transparent 82%);
}

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

.side-rail {
  position: sticky;
  top: 0;
  display: flex;
  height: 100vh;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  border-right: 1px solid var(--line);
  background: rgba(5, 8, 13, 0.78);
  padding: 18px 12px;
  backdrop-filter: blur(18px);
}

.brand-mark {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border: 1px solid rgba(215, 173, 85, 0.55);
  border-radius: 14px;
  background: linear-gradient(145deg, rgba(215, 173, 85, 0.2), rgba(255, 255, 255, 0.04));
  color: var(--gold-strong);
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 800;
  box-shadow: inset 0 0 28px rgba(215, 173, 85, 0.08);
}

.rail-nav {
  display: grid;
  gap: 12px;
}

.rail-nav a {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 14px;
  color: var(--muted);
  transition:
    color 180ms ease,
    background 180ms ease,
    border-color 180ms ease,
    transform 180ms ease;
}

.rail-nav a:hover {
  border-color: var(--line-strong);
  background: var(--panel-soft);
  color: var(--text);
  transform: translateY(-1px);
}

.dashboard-content {
  width: min(100%, 1640px);
  margin: 0 auto;
  padding: 24px clamp(16px, 2.2vw, 36px) 44px;
}

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

.eyebrow,
.profile-kicker,
.metric-label {
  margin: 0;
  color: var(--gold);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.topbar h1 {
  margin: 6px 0 0;
  font-family: var(--display);
  font-size: clamp(25px, 3vw, 44px);
  font-weight: 800;
}

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

.period-switch,
.refresh-button {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.055);
  color: var(--text);
}

.period-switch {
  display: flex;
  align-items: center;
  padding: 4px;
}

.period-button {
  min-width: 54px;
  height: 36px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  transition:
    background 180ms ease,
    color 180ms ease;
}

.period-button.active {
  background: var(--gold);
  color: #16100a;
}

.refresh-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 16px;
  font-size: 14px;
  font-weight: 800;
  transition:
    background 180ms ease,
    border-color 180ms ease,
    transform 180ms ease;
}

.refresh-button:hover {
  border-color: rgba(215, 173, 85, 0.6);
  background: rgba(215, 173, 85, 0.12);
  transform: translateY(-1px);
}

.refresh-button.loading svg {
  animation: spin 900ms linear infinite;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.06fr) minmax(280px, 0.74fr) minmax(280px, 0.58fr);
  gap: 18px;
  align-items: stretch;
  margin-top: 12px;
}

.hero-copy,
.hero-portrait,
.hero-intel,
.panel,
.metric-card {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.hero-copy {
  position: relative;
  overflow: hidden;
  min-height: 430px;
  border-radius: var(--radius-lg);
  padding: clamp(28px, 4vw, 54px);
}

.hero-copy::after {
  content: "";
  position: absolute;
  right: -22%;
  bottom: 0;
  width: 68%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(215, 173, 85, 0.9), transparent);
}

.hero-status {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  padding: 0 12px;
  color: var(--text-soft);
  font-family: var(--mono);
  font-size: 12px;
}

.live-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 8px rgba(69, 212, 131, 0.08);
}

.profile-kicker {
  margin-top: 54px;
}

.hero-copy h2 {
  max-width: 660px;
  margin: 12px 0 0;
  font-family: var(--display);
  font-size: clamp(42px, 6vw, 92px);
  font-weight: 800;
  line-height: 0.92;
}

.profile-positioning {
  max-width: 680px;
  margin: 24px 0 0;
  color: var(--text-soft);
  font-size: clamp(16px, 1.4vw, 20px);
  line-height: 1.65;
}

.hero-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 26px;
}

.hero-tags span {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.045);
  padding: 8px 12px;
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 700;
}

.hero-portrait {
  position: relative;
  display: flex;
  min-height: 430px;
  align-items: end;
  justify-content: center;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background:
    linear-gradient(180deg, rgba(117, 167, 255, 0.16), rgba(215, 173, 85, 0.1)),
    #d9edf7;
}

.hero-portrait img {
  width: min(100%, 520px);
  height: 100%;
  object-fit: cover;
  object-position: center bottom;
  filter: saturate(0.98) contrast(1.03);
}

.hero-portrait figcaption {
  position: absolute;
  right: 16px;
  bottom: 16px;
  display: grid;
  gap: 4px;
  min-width: 170px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 14px;
  background: rgba(7, 11, 18, 0.74);
  padding: 12px;
  backdrop-filter: blur(14px);
}

.hero-portrait figcaption span {
  color: var(--green);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.hero-portrait figcaption strong {
  font-size: 14px;
}

.hero-intel {
  display: grid;
  gap: 12px;
  min-height: 430px;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.intel-card {
  display: grid;
  align-content: end;
  min-height: 132px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.025)),
    var(--panel);
  padding: 22px;
}

.intel-card.primary {
  border-color: rgba(215, 173, 85, 0.48);
  background:
    linear-gradient(145deg, rgba(215, 173, 85, 0.2), rgba(255, 255, 255, 0.04)),
    var(--panel-strong);
}

.intel-card strong {
  margin-top: 10px;
  font-family: var(--mono);
  font-size: clamp(26px, 4vw, 44px);
  line-height: 1;
}

.intel-card small {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

.metric-strip {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.metric-card,
.metric-skeleton {
  min-height: 144px;
  border-radius: var(--radius-md);
  padding: 18px;
}

.metric-card {
  position: relative;
  overflow: hidden;
}

.metric-card::after {
  content: "";
  position: absolute;
  inset: auto 18px 0 18px;
  height: 2px;
  background: var(--metric-color, var(--gold));
  opacity: 0.85;
}

.metric-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.metric-card strong {
  display: block;
  margin-top: 16px;
  font-family: var(--mono);
  font-size: clamp(24px, 2.4vw, 34px);
}

.metric-card p {
  margin: 12px 0 0;
  color: var(--text-soft);
  font-size: 13px;
  line-height: 1.45;
}

.metric-skeleton {
  border: 1px solid var(--line);
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.04));
  background-size: 220% 100%;
  animation: shimmer 1400ms ease infinite;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(360px, 0.75fr);
  gap: 18px;
  margin-top: 18px;
}

.panel {
  min-width: 0;
  border-radius: var(--radius-lg);
  padding: clamp(18px, 2vw, 24px);
}

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

.panel-heading h3 {
  margin: 5px 0 0;
  font-family: var(--display);
  font-size: clamp(20px, 2vw, 28px);
  line-height: 1.05;
}

.panel-badge,
.pressure {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.045);
  padding: 6px 10px;
  color: var(--text-soft);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  white-space: nowrap;
}

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

.social-card {
  display: grid;
  min-height: 210px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.038);
  padding: 16px;
}

.social-top {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.platform-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.platform-icon {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 12px;
  background: var(--platform-bg, var(--blue-soft));
  color: var(--platform-color, var(--blue));
}

.platform-title strong {
  display: block;
  font-size: 16px;
}

.platform-title span {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
}

.source-pill {
  border-radius: 999px;
  padding: 5px 8px;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.source-pill.live {
  background: var(--green-soft);
  color: var(--green);
}

.source-pill.fallback {
  background: var(--amber-soft);
  color: var(--amber);
}

.social-number {
  margin-top: 28px;
}

.social-number strong {
  display: block;
  font-family: var(--mono);
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1;
}

.social-number span,
.social-meta {
  color: var(--text-soft);
  font-size: 13px;
}

.social-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.social-meta span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 8px;
}

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

.chart-wrap,
.signal-map {
  position: relative;
  height: 292px;
}

.narrative-panel,
.agenda-panel,
.content-panel {
  grid-column: 1 / -1;
}

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

.narrative-block {
  min-height: 230px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.036);
  padding: 16px;
}

.narrative-block h4 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 14px;
  font-family: var(--mono);
  font-size: 12px;
  text-transform: uppercase;
}

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

.narrative-block li {
  color: var(--text-soft);
  font-size: 14px;
  line-height: 1.48;
}

.narrative-block li::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 8px;
  border-radius: 50%;
  background: currentColor;
  transform: translateY(-1px);
}

.data-notes {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

.data-notes span {
  border-left: 2px solid var(--gold);
  background: rgba(215, 173, 85, 0.08);
  padding: 9px 10px;
  color: var(--text-soft);
  font-size: 12px;
  line-height: 1.45;
}

.news-list,
.agenda-list,
.content-list {
  display: grid;
  gap: 10px;
}

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

.news-item,
.agenda-item,
.content-item {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.035);
  padding: 16px;
}

.news-item {
  grid-template-columns: 1fr;
}

.news-item h4,
.agenda-item h4,
.content-item h4 {
  margin: 0;
  font-family: var(--display);
  font-size: 18px;
}

.news-item p,
.agenda-item p,
.content-item p {
  margin: 0;
  color: var(--text-soft);
  font-size: 14px;
  line-height: 1.5;
}

.news-meta,
.agenda-meta,
.content-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.news-meta span,
.agenda-meta span,
.content-meta span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 8px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.tone-risco,
.priority-alta {
  color: var(--red) !important;
}

.tone-oportunidade,
.priority-media {
  color: var(--amber) !important;
}

.tone-positivo,
.priority-baixa {
  color: var(--green) !important;
}

.agenda-item strong,
.content-item strong {
  color: var(--gold-strong);
}

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

.empty-state {
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-md);
  padding: 18px;
  color: var(--muted);
  font-size: 14px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes shimmer {
  to {
    background-position: -220% 0;
  }
}

@media (max-width: 1220px) {
  .hero {
    grid-template-columns: minmax(0, 1fr) minmax(300px, 0.72fr);
  }

  .hero-intel {
    grid-column: 1 / -1;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    min-height: auto;
  }

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

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

  .narrative-columns,
  .agenda-list,
  .content-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

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

  .side-rail {
    position: fixed;
    right: 12px;
    bottom: 12px;
    left: 12px;
    top: auto;
    z-index: 20;
    height: 62px;
    flex-direction: row;
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 8px 10px;
  }

  .rail-nav {
    display: flex;
    gap: 4px;
  }

  .brand-mark {
    width: 42px;
    height: 42px;
  }

  .rail-nav a {
    width: 42px;
    height: 42px;
  }

  .dashboard-content {
    padding-bottom: 96px;
  }

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

  .topbar-actions {
    justify-content: stretch;
  }

  .period-switch,
  .refresh-button {
    flex: 1 1 auto;
  }

  .hero,
  .hero-intel,
  .metric-strip,
  .social-grid,
  .agenda-list,
  .narrative-columns,
  .content-list {
    grid-template-columns: 1fr;
  }

  .hero-copy,
  .hero-portrait {
    min-height: 360px;
  }

  .profile-kicker {
    margin-top: 34px;
  }

  .news-item {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .dashboard-content {
    padding-inline: 12px;
  }

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

  .hero-copy {
    padding: 24px;
  }

  .hero-copy h2 {
    font-size: 42px;
  }

  .profile-positioning {
    font-size: 15px;
  }

  .panel-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .chart-wrap,
  .signal-map {
    height: 240px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
