@import url("https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,500;700&family=Outfit:wght@400;500;600;700&display=swap");

:root {
  --bg0: #0b1418;
  --bg1: #122026;
  --bg2: #1a2c34;
  --ink: #e8f0f2;
  --muted: #8aa0a8;
  --line: rgba(232, 240, 242, 0.1);
  --accent: #2dd4bf;
  --accent2: #fbbf24;
  --danger: #fb7185;
  --ok: #4ade80;
  --font: "Outfit", system-ui, sans-serif;
  --display: "Fraunces", Georgia, serif;
  --radius: 14px;
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg0);
}

body {
  background:
    radial-gradient(ellipse 70% 45% at 0% 0%, rgba(45, 212, 191, 0.14), transparent 55%),
    radial-gradient(ellipse 50% 40% at 100% 10%, rgba(251, 191, 36, 0.1), transparent 50%),
    linear-gradient(165deg, #0b1418 0%, #0f1c22 45%, #12262c 100%);
  background-attachment: fixed;
}

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

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

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 1.4rem 1rem;
  border-right: 1px solid var(--line);
  background: rgba(11, 20, 24, 0.72);
  backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.brand {
  padding: 0.4rem 0.6rem 1rem;
}

.brand strong {
  display: block;
  font-family: var(--display);
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand span {
  color: var(--muted);
  font-size: 0.82rem;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.nav button {
  text-align: left;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 0.7rem 0.85rem;
  border-radius: 10px;
  cursor: pointer;
  transition: 0.2s ease;
}

.nav button:hover,
.nav button.active {
  background: rgba(45, 212, 191, 0.12);
  color: var(--ink);
}

.nav button.active {
  box-shadow: inset 0 0 0 1px rgba(45, 212, 191, 0.35);
}

.main {
  padding: 1.5rem 1.75rem 3rem;
  max-width: 1200px;
}

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.4rem;
}

.page-head h1 {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(1.8rem, 3vw, 2.4rem);
  font-weight: 500;
  letter-spacing: -0.03em;
}

.page-head p {
  margin: 0.35rem 0 0;
  color: var(--muted);
  max-width: 42rem;
}

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

.btn {
  border: 1px solid var(--line);
  background: var(--bg2);
  color: var(--ink);
  padding: 0.65rem 1rem;
  border-radius: 999px;
  cursor: pointer;
  transition: 0.2s ease;
}

.btn:hover {
  border-color: rgba(45, 212, 191, 0.45);
  transform: translateY(-1px);
}

.btn.primary {
  background: linear-gradient(135deg, #2dd4bf, #14b8a6);
  color: #06201c;
  border: 0;
  font-weight: 600;
}

.btn.ghost {
  background: transparent;
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.stat {
  padding: 1rem 1.1rem;
  border-radius: var(--radius);
  background: linear-gradient(160deg, rgba(26, 44, 52, 0.9), rgba(18, 32, 38, 0.9));
  border: 1px solid var(--line);
  animation: rise 0.45s ease both;
}

.stat .label {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.stat .value {
  margin-top: 0.35rem;
  font-family: var(--display);
  font-size: 2rem;
  line-height: 1;
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(18, 32, 38, 0.72);
  padding: 1rem 1.1rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
  animation: rise 0.5s ease both;
}

.panel h2 {
  margin: 0 0 0.85rem;
  font-size: 1rem;
  font-weight: 600;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.9rem;
}

.filters select,
.filters input,
.form-row input,
.form-row select,
.form-row textarea {
  background: var(--bg0);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.55rem 0.75rem;
  min-width: 140px;
}

.form-row {
  display: grid;
  gap: 0.45rem;
  margin-bottom: 0.75rem;
}

.form-row label {
  color: var(--muted);
  font-size: 0.82rem;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.table th,
.table td {
  text-align: left;
  padding: 0.7rem 0.45rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.table th {
  color: var(--muted);
  font-weight: 500;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.table tr {
  cursor: pointer;
  transition: background 0.15s ease;
}

.table tr:hover {
  background: rgba(45, 212, 191, 0.06);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  border: 1px solid var(--line);
  color: var(--muted);
  white-space: nowrap;
}

.badge.teal {
  color: #99f6e4;
  border-color: rgba(45, 212, 191, 0.35);
  background: rgba(45, 212, 191, 0.1);
}

.badge.gold {
  color: #fde68a;
  border-color: rgba(251, 191, 36, 0.35);
  background: rgba(251, 191, 36, 0.1);
}

.badge.rose {
  color: #fecdd3;
  border-color: rgba(251, 113, 133, 0.35);
  background: rgba(251, 113, 133, 0.1);
}

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

.kanban-col {
  background: rgba(11, 20, 24, 0.55);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.75rem;
  min-height: 220px;
}

.kanban-col h3 {
  margin: 0 0 0.7rem;
  font-size: 0.8rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.card {
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.8rem;
  margin-bottom: 0.55rem;
}

.card strong {
  display: block;
  margin-bottom: 0.35rem;
}

.card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.card .row {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-top: 0.65rem;
}

.muted {
  color: var(--muted);
}

.grid-2 {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 1rem;
}

.list {
  display: grid;
  gap: 0.55rem;
}

.list-item {
  padding: 0.85rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(11, 20, 24, 0.4);
}

.feed {
  display: grid;
  gap: 0.85rem;
}

.post-card {
  padding: 1rem 1.05rem;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: linear-gradient(145deg, rgba(26, 44, 52, 0.85), rgba(11, 20, 24, 0.65));
  animation: rise 0.4s ease both;
}

.post-card.competitor {
  border-color: rgba(251, 113, 133, 0.28);
  background: linear-gradient(145deg, rgba(52, 26, 34, 0.55), rgba(11, 20, 24, 0.7));
}

.post-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.7rem;
  align-items: center;
  margin-bottom: 0.65rem;
  font-size: 0.82rem;
}

.post-text {
  margin: 0 0 0.85rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.45rem;
  margin-bottom: 0.55rem;
}

.metrics .m-label {
  display: block;
  color: var(--muted);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.metrics strong {
  font-family: var(--display);
  font-size: 1.15rem;
  font-weight: 500;
}

.bar {
  height: 6px;
  border-radius: 99px;
  background: rgba(232, 240, 242, 0.08);
  overflow: hidden;
  margin: 0.35rem 0 0.7rem;
}

.bar span {
  display: block;
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, #2dd4bf, #fbbf24);
}

.post-actions {
  display: flex;
  gap: 0.45rem;
}

.linkish {
  border: 0;
  background: none;
  color: var(--accent);
  cursor: pointer;
  padding: 0;
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
}

code {
  font-size: 0.85em;
  padding: 0.1rem 0.35rem;
  border-radius: 6px;
  background: rgba(45, 212, 191, 0.12);
}

.dash-filters {
  margin-bottom: 0;
  align-items: center;
}

.dash-filter-panel {
  margin-bottom: 1rem;
}

.table-wrap {
  overflow-x: auto;
}

.dash-table {
  font-size: 0.86rem;
}

.dash-table th,
.dash-table td {
  white-space: nowrap;
}

.network-panel h2 {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}

.dash-note {
  margin: -0.35rem 0 0.85rem;
  font-size: 0.82rem;
}

.dash-sub {
  margin: 1rem 0 0.55rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

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

.chart-bar {
  fill: rgba(45, 212, 191, 0.72);
}

.chart-line {
  stroke: #fbbf24;
  stroke-width: 2.2;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.chart-dot {
  fill: #fbbf24;
}

.chart-grid {
  stroke: rgba(232, 240, 242, 0.12);
  stroke-width: 1;
}

.chart-axis {
  fill: var(--muted);
  font-size: 11px;
  font-family: var(--font);
}

.chart-axis-accent {
  fill: #fbbf24;
}

.hbar-row {
  display: grid;
  grid-template-columns: minmax(7rem, 1.1fr) 1fr auto;
  gap: 0.55rem;
  align-items: center;
  margin-bottom: 0.55rem;
}

.hbar-label {
  font-size: 0.88rem;
  line-height: 1.25;
}

.hbar-label .muted {
  display: block;
  font-size: 0.72rem;
}

.hbar-track {
  height: 8px;
  border-radius: 99px;
  background: rgba(232, 240, 242, 0.08);
  overflow: hidden;
}

.hbar-track span {
  display: block;
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, #14b8a6, #2dd4bf);
}

.hbar-val {
  font-family: var(--display);
  font-size: 0.95rem;
  white-space: nowrap;
  text-align: right;
}

.insight-list {
  margin: 0;
  padding-left: 1.1rem;
  display: grid;
  gap: 0.55rem;
  color: var(--ink);
  line-height: 1.4;
}

.insight-list li::marker {
  color: var(--accent);
}

.compare-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.6rem;
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--line);
}

.compare-strip .muted {
  display: block;
  font-size: 0.72rem;
  margin-bottom: 0.2rem;
}

.compare-strip strong {
  font-family: var(--display);
  font-size: 1.15rem;
  font-weight: 500;
}

/* LiveDune-style analytics */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.kpi-grid.tight {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.kpi {
  padding: 1rem 1.05rem;
  border-radius: var(--radius);
  background: linear-gradient(165deg, rgba(26, 44, 52, 0.95), rgba(14, 28, 34, 0.92));
  border: 1px solid var(--line);
  animation: rise 0.4s ease both;
}

.kpi.accent {
  border-color: rgba(45, 212, 191, 0.45);
  box-shadow: inset 0 0 0 1px rgba(45, 212, 191, 0.12);
}

.kpi.accent2 {
  border-color: rgba(251, 191, 36, 0.4);
}

.kpi .label {
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.kpi .value {
  margin-top: 0.35rem;
  font-family: var(--display);
  font-size: 1.85rem;
  line-height: 1.05;
  font-weight: 600;
}

.kpi-sub {
  margin-top: 0.3rem;
  font-size: 0.74rem;
  color: var(--muted);
}

.sticky-filters {
  position: sticky;
  top: 0.5rem;
  z-index: 5;
  backdrop-filter: blur(10px);
  background: rgba(18, 32, 38, 0.92);
}

.range-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.filter-sep {
  width: 1px;
  align-self: stretch;
  background: var(--line);
  margin: 0 0.25rem;
}

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

.panel-head-row h2 {
  margin-bottom: 0.25rem;
}

.sort-select {
  min-width: 160px;
}

.compare-panel .compare-table td:nth-child(2),
.compare-panel .compare-table td:nth-child(3),
.compare-panel .compare-table td:nth-child(4) {
  font-variant-numeric: tabular-nums;
}

.delta-up {
  color: var(--ok);
  font-weight: 600;
}

.delta-down {
  color: var(--danger);
  font-weight: 600;
}

.row-self {
  background: rgba(45, 212, 191, 0.08);
}

.main {
  max-width: 1280px;
}

@media (max-width: 1100px) {
  .kpi-grid,
  .kpi-grid.tight {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .kpi-grid,
  .kpi-grid.tight {
    grid-template-columns: 1fr 1fr;
  }

  .filter-sep {
    display: none;
  }

  .panel-head-row {
    flex-direction: column;
  }
}

.mini-posts {
  display: grid;
  gap: 0.7rem;
}

.mini-post {
  padding: 0.75rem 0.85rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(11, 20, 24, 0.45);
}

.mini-post p {
  margin: 0 0 0.5rem;
  font-size: 0.9rem;
  line-height: 1.4;
}

.mini-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 0.85rem;
  font-size: 0.78rem;
  color: var(--muted);
}

.mini-metrics a {
  color: var(--accent);
}

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

.mobile-nav {
  display: none;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (max-width: 920px) {
  .app {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: none;
  }

  .mobile-nav {
    display: flex;
    position: sticky;
    top: 0;
    z-index: 20;
    gap: 0.35rem;
    overflow-x: auto;
    padding: 0.75rem;
    background: rgba(11, 20, 24, 0.92);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(10px);
  }

  .mobile-nav button {
    flex: 0 0 auto;
    border: 1px solid var(--line);
    background: var(--bg1);
    color: var(--muted);
    border-radius: 999px;
    padding: 0.45rem 0.8rem;
    cursor: pointer;
  }

  .mobile-nav button.active {
    color: #06201c;
    background: var(--accent);
    border-color: transparent;
  }

  .main {
    padding: 1rem 0.9rem 2.5rem;
  }

  .kanban,
  .grid-2,
  .compare-strip {
    grid-template-columns: 1fr;
  }

  .hbar-row {
    grid-template-columns: 1fr auto;
  }

  .hbar-track {
    grid-column: 1 / -1;
  }

  .table {
    display: block;
    overflow-x: auto;
  }
}
