/* Alejandra · Centro de operaciones — Tema Dark Ejecutivo
   Dirección: control room de alto valor. Obsidiana, teal y ámbar.
   Mobile-first: la misma composición se pliega a una barra inferior. */

:root {
  --bg-deep:    #06090E;
  --bg-card:    #0B1017;
  --bg-card-2:  #0F1923;
  --border:     #1E293B;
  --border-2:   #2D3F55;
  --text:       #F1F5F9;
  --text-2:     #CBD5E1;
  --muted:      #64748B;
  --teal:       #14B8A6;
  --teal-2:     #2DD4BF;
  --teal-dim:   rgba(20, 184, 166, 0.12);
  --amber:      #F59E0B;
  --amber-2:    #FBBF24;
  --red:        #EF4444;
  --green:      #22C55E;
  --blue:       #3B82F6;
  --radius:     10px;
  --radius-sm:  6px;
  --shadow:     0 1px 0 rgba(0,0,0,0.4), 0 20px 48px -30px rgba(0,0,0,0.8);
  --font-ui:    "Inter", "Segoe UI", system-ui, sans-serif;
  --font-mono:  "JetBrains Mono", "Courier New", monospace;
}

/* Versión Día / Claro Ejecutivo */
html[data-theme="light"] {
  --bg-deep:    #F8FAFC;
  --bg-card:    #FFFFFF;
  --bg-card-2:  #F1F5F9;
  --border:     #E2E8F0;
  --border-2:   #CBD5E1;
  --text:       #0F172A;
  --text-2:     #334155;
  --muted:      #64748B;
  --teal:       #0D9488;
  --teal-2:     #14B8A6;
  --teal-dim:   rgba(13, 148, 136, 0.08);
  --amber:      #D97706;
  --amber-2:    #B45309;
  --red:        #DC2626;
  --green:      #16A34A;
  --blue:       #2563EB;
  --shadow:     0 1px 3px rgba(0,0,0,0.06), 0 10px 25px -5px rgba(15,23,42,0.08);
}

html[data-theme="light"] .rail {
  background: rgba(255, 255, 255, 0.95);
}

html[data-theme="light"] .topbar {
  background: rgba(248, 250, 252, 0.92);
}

html[data-theme="light"] .paper-grain {
  opacity: 0.35;
  background-image:
    radial-gradient(ellipse at 15% 10%, rgba(13, 148, 136, 0.08), transparent 50%),
    radial-gradient(ellipse at 85% 90%, rgba(217, 119, 6, 0.05), transparent 50%);
}

html[data-theme="light"] .signal-bubble.is-in,
html[data-theme="light"] .bubble.is-in {
  background: #F1F5F9;
  border-color: #E2E8F0;
  color: #1E293B;
}

html[data-theme="light"] .signal-bubble.is-out,
html[data-theme="light"] .bubble.is-out {
  background: rgba(13, 148, 136, 0.1);
  border-color: rgba(13, 148, 136, 0.3);
  color: #042F2E;
}

html[data-theme="light"] .media-card.is-video {
  background: linear-gradient(150deg, #E2E8F0, #CBD5E1);
}

html[data-theme="light"] .media-play {
  background: rgba(255, 255, 255, 0.9);
  color: #0D9488;
  border-color: rgba(13, 148, 136, 0.4);
}

html[data-theme="light"] .media-meta {
  background: linear-gradient(transparent, rgba(15, 23, 42, 0.85));
  color: #FFFFFF;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: clip;
  background: var(--bg-deep);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Overlay decorativo — radiales sutiles teal y ámbar */
.paper-grain {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.7;
  background-image:
    radial-gradient(ellipse at 15% 10%, rgba(20, 184, 166, 0.07), transparent 50%),
    radial-gradient(ellipse at 85% 90%, rgba(245, 158, 11, 0.05), transparent 50%);
}

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

button {
  cursor: pointer;
}

a {
  color: inherit;
}

svg {
  display: block;
}

::selection {
  background: var(--teal);
  color: var(--bg-deep);
}

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

/* Scrollbar */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: var(--bg-card); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: var(--teal); }

/* ── Rail ─────────────────────────────────────────────── */

.rail {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 50;
  width: 238px;
  display: flex;
  flex-direction: column;
  gap: 34px;
  padding: 28px 18px 22px;
  border-right: 1px solid var(--border);
  background: rgba(11, 16, 23, 0.95);
  backdrop-filter: blur(20px);
}

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

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  background: var(--teal);
  color: var(--bg-deep);
  font-family: var(--font-mono);
  font-size: 24px;
  font-weight: 700;
  line-height: 1;
  border-radius: var(--radius-sm);
  box-shadow: 0 0 20px rgba(20, 184, 166, 0.3);
}

.brand-copy {
  display: grid;
  gap: 2px;
}

.brand-copy strong {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

.brand-copy small {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 11px 12px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-align: left;
  text-transform: uppercase;
  transition: background 160ms, color 160ms, border-color 160ms;
}

.nav-item svg {
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
  fill: currentColor;
  opacity: 0.8;
}

.nav-item:hover {
  background: rgba(20, 184, 166, 0.08);
  border-color: var(--border);
  color: var(--text-2);
}

.nav-item.is-active {
  background: rgba(20, 184, 166, 0.15);
  border-color: rgba(20, 184, 166, 0.3);
  border-left: 3px solid var(--teal);
  color: var(--teal);
}

.nav-item.is-active svg {
  opacity: 1;
}

.rail-foot {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: auto;
  padding: 14px 6px 0;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 11px;
}

.rail-foot strong {
  display: block;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.rail-foot small {
  display: block;
  margin-top: 2px;
  font-size: 10px;
}

.live-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  flex: 0 0 7px;
  margin-top: 4px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.45);
  animation: pulse 2.4s ease-out infinite;
}

@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.42); }
  60%  { box-shadow: 0 0 0 7px rgba(34, 197, 94, 0); }
  100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

/* ── Main / topbar ────────────────────────────────────── */

.main {
  position: relative;
  z-index: 1;
  margin-left: 238px;
  padding: 0 44px 90px;
  max-width: 1580px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 72px;
  margin: 0 -44px;
  padding: 0 44px;
  border-bottom: 1px solid var(--border);
  background: rgba(6, 9, 14, 0.88);
  backdrop-filter: blur(16px);
}

.topbar-left {
  display: flex;
  align-items: baseline;
  gap: 14px;
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
}

.kicker {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.business {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.01em;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 0 0 auto;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 10px;
  border: 1px solid rgba(34, 197, 94, 0.3);
  border-radius: 999px;
  background: rgba(34, 197, 94, 0.1);
  color: var(--green);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
}

.status-pill .live-dot {
  margin-top: 0;
}

.clock {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
  color: var(--teal);
}

/* ── Buttons ──────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-2);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: transform 140ms, background 140ms, color 140ms, border-color 140ms;
}

.btn svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
}

.btn:hover {
  background: rgba(20, 184, 166, 0.1);
  border-color: var(--teal);
  color: var(--teal);
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--teal);
  border-color: var(--teal);
  color: var(--bg-deep);
  font-weight: 800;
}

.btn-primary:hover {
  background: var(--teal-2);
  border-color: var(--teal-2);
  color: var(--bg-deep);
}

.btn-ghost {
  border-color: var(--border);
  background: var(--bg-card);
}

.btn-theme,
.btn-sync {
  padding: 0 12px;
  gap: 6px;
  min-height: 36px;
  font-size: 9px;
}

.btn-sync.is-syncing .sync-icon {
  animation: spin 900ms linear infinite;
  color: var(--teal);
}

.btn-link {
  border-color: transparent;
  padding-left: 2px;
  padding-right: 2px;
  color: var(--teal);
}

.btn-link:hover {
  background: transparent;
  color: var(--teal-2);
  border-color: transparent;
}

.btn-replay.is-playing svg {
  animation: spin 1s linear infinite;
}

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

/* ── Views ────────────────────────────────────────────── */

.views {
  padding-top: 0;
}

.view {
  animation: viewIn 420ms cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.view[hidden] {
  display: none !important;
}

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

.eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 18px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.11em;
}

.eyebrow-line {
  display: inline-block;
  width: 26px;
  height: 1px;
  background: var(--teal);
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr);
  gap: clamp(28px, 5vw, 80px);
  align-items: end;
  padding: clamp(38px, 6vw, 76px) 0 44px;
  border-bottom: 1px solid var(--border);
}

.hero h1 {
  max-width: 900px;
  margin: 0 0 22px;
  font-size: clamp(2.7rem, 5.6vw, 5.4rem);
  font-weight: 700;
  letter-spacing: -0.055em;
  line-height: 0.94;
  overflow-wrap: break-word;
  color: var(--text);
}

.hero h1 em {
  color: var(--teal);
  font-style: normal;
}

.hero-lede {
  max-width: 610px;
  margin-bottom: 26px;
  color: var(--text-2);
  font-size: clamp(1rem, 1.4vw, 1.18rem);
  line-height: 1.55;
}

.hero-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 18px;
}

.signal-card {
  position: relative;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  color: var(--text);
  box-shadow: 0 0 0 1px rgba(20, 184, 166, 0.1), var(--shadow);
}

.signal-head,
.signal-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.signal-head {
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.signal-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--teal);
}

.signal-label .live-dot {
  margin-top: 0;
}

.signal-head time {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
}

.signal-thread {
  display: grid;
  gap: 10px;
}

.signal-bubble {
  max-width: 92%;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  line-height: 1.5;
}

.signal-bubble.is-in {
  justify-self: start;
  background: var(--border);
  border: 1px solid var(--border-2);
  color: var(--text-2);
}

.signal-bubble.is-out {
  justify-self: end;
  background: var(--teal-dim);
  border: 1px solid rgba(20, 184, 166, 0.3);
  color: var(--text);
}

.signal-bubble small {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.signal-bubble.is-in small {
  color: var(--muted);
}

.signal-connector {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-left: 22px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.signal-connector::before {
  content: "";
  width: 18px;
  height: 1px;
  background: var(--teal);
}

.signal-foot {
  justify-content: flex-start;
  margin-top: 18px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 11px;
}

/* ── KPI grid ─────────────────────────────────────────── */

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding: 26px 0 30px;
  counter-reset: kpi;
}

.kpi {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 168px;
  padding: 18px 18px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: border-color 200ms;
}

.kpi:hover {
  border-color: var(--border-2);
}

.kpi::after {
  counter-increment: kpi;
  content: counter(kpi, decimal-leading-zero);
  position: absolute;
  right: 14px;
  bottom: 12px;
  color: var(--border-2);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.08em;
}

.kpi-wide {
  background: var(--bg-card-2);
  border-color: rgba(20, 184, 166, 0.2);
  box-shadow: 0 0 20px rgba(20, 184, 166, 0.05), var(--shadow);
}

.kpi-wide .kpi-note,
.kpi-wide .kpi-tag {
  color: var(--muted);
}

.kpi-wide::after {
  color: var(--border);
}

.kpi-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: auto;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.kpi-wide .kpi-top {
  color: var(--muted);
}

.kpi-icon {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 1px solid var(--border-2);
  border-radius: 50%;
  font-size: 11px;
  line-height: 1;
  opacity: 0.65;
}

.kpi-tag {
  font-size: 8px;
}

.kpi-value {
  display: block;
  margin: 18px 0 8px;
  font-family: var(--font-mono);
  font-size: clamp(2.3rem, 3.6vw, 3.6rem);
  font-weight: 700;
  letter-spacing: -0.07em;
  line-height: 0.9;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.kpi-wide .kpi-value {
  color: var(--teal);
}

.kpi-note {
  margin: 0;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.35;
}

.mark {
  display: inline-block;
  font-family: var(--font-mono);
  font-weight: 700;
}

.mark-ok     { color: var(--green); }
.mark-accent { color: var(--amber); }
.kpi-wide .mark-ok { color: var(--teal-2); }

/* ── Panels / grids ───────────────────────────────────── */

.grid-main {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(300px, 0.8fr);
  gap: 14px;
}

.grid-secondary {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  gap: 14px;
  margin-top: 14px;
}

.panel {
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  box-shadow: var(--shadow);
}

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

.panel-kicker {
  margin: 0 0 5px;
  color: var(--teal);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.panel h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.025em;
  color: var(--text);
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.04em;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.legend-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 1px;
}

.legend-events   { background: rgba(245, 158, 11, 0.7); }
.legend-messages { background: var(--teal); }

.chart-wrap {
  position: relative;
  width: 100%;
  overflow: hidden;
}

#activityChart {
  width: 100%;
  height: auto;
  min-height: 190px;
}

.chart-grid {
  stroke: var(--border);
  stroke-width: 1;
  stroke-dasharray: 2 5;
}

.chart-axis {
  fill: var(--muted);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.04em;
}

.chart-bar-events {
  fill: rgba(245, 158, 11, 0.7);
  transition: height 600ms cubic-bezier(0.2, 0.7, 0.2, 1), y 600ms cubic-bezier(0.2, 0.7, 0.2, 1);
}

.chart-bar-messages {
  fill: rgba(20, 184, 166, 0.8);
  transition: height 600ms cubic-bezier(0.2, 0.7, 0.2, 1), y 600ms cubic-bezier(0.2, 0.7, 0.2, 1);
}

.chart-bar-group:hover .chart-bar-messages { fill: var(--teal-2); }
.chart-bar-group:hover .chart-bar-events   { fill: var(--amber-2); }

.panel-foot {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.5;
}

/* ── Resolution ───────────────────────────────────────── */

.resolution-body {
  display: grid;
  gap: 14px;
}

.donut-wrap {
  position: relative;
  display: grid;
  place-items: center;
  padding: 4px 0 0;
}

#resolutionDonut {
  width: min(190px, 60%);
  height: auto;
}

.donut-track {
  fill: none;
  stroke: var(--border);
  stroke-width: 14;
}

.donut-value {
  fill: none;
  stroke: var(--teal);
  stroke-width: 14;
  stroke-linecap: butt;
  transform: rotate(-90deg);
  transform-origin: 90px 90px;
  transition: stroke-dasharray 700ms cubic-bezier(0.2, 0.7, 0.2, 1);
}

.donut-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -46%);
  text-align: center;
}

.donut-center strong {
  display: block;
  font-family: var(--font-mono);
  font-size: 2.4rem;
  letter-spacing: -0.08em;
  line-height: 0.9;
  color: var(--text);
}

.donut-center span {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.resolution-list {
  display: grid;
  gap: 9px;
}

.resolution-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--border);
  font-size: 12.5px;
}

.resolution-row:first-child { border-top: 0; }

.resolution-row span:first-child {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-2);
}

.resolution-row strong {
  font-family: var(--font-mono);
  font-size: 15px;
  letter-spacing: -0.04em;
  color: var(--text);
}

.resolution-swatch {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 2px;
}

.swatch-ok    { background: var(--teal); }
.swatch-owner { background: var(--amber); }
.swatch-empty { background: var(--border); border: 1px solid var(--border-2); }

/* ── Feed ─────────────────────────────────────────────── */

.feed-filters,
.segmented {
  display: flex;
  gap: 5px;
}

.chip {
  min-height: 28px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  transition: background 140ms, color 140ms, border-color 140ms;
}

.chip:hover { border-color: var(--teal); color: var(--teal); background: rgba(20, 184, 166, 0.06); }
.chip.is-active { background: var(--teal); border-color: var(--teal); color: var(--bg-deep); font-weight: 800; }

.feed {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 380px;
  overflow: auto;
  border-top: 1px solid var(--border);
  scrollbar-width: thin;
  scrollbar-color: var(--border-2) transparent;
}

.feed-item {
  display: grid;
  grid-template-columns: 54px 10px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  animation: feedIn 420ms cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

@keyframes feedIn {
  from { opacity: 0; transform: translateY(-5px); }
  to   { opacity: 1; transform: translateY(0); }
}

.feed-time {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.feed-dot {
  width: 7px;
  height: 7px;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--border-2);
}

.feed-dot.ok      { background: var(--green); }
.feed-dot.warn    { background: var(--amber); }
.feed-dot.alert   { background: var(--red); }
.feed-dot.neutral { background: var(--teal); }

.feed-body strong {
  display: block;
  margin-bottom: 2px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
}

.feed-body p {
  margin: 0;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.feed-body .platform {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 5px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  vertical-align: 1px;
}

/* ── Contrast ─────────────────────────────────────────── */

.contrast-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.contrast-col {
  padding: 18px;
}

.contrast-before {
  border-right: 1px solid var(--border);
  background: var(--bg-deep);
}

.contrast-after {
  background: var(--teal-dim);
}

.contrast-col h3 {
  margin: 12px 0 12px;
  font-size: 17px;
  line-height: 1.15;
  letter-spacing: -0.03em;
  color: var(--text);
}

.contrast-col ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 9px;
}

.contrast-col li {
  position: relative;
  padding-left: 15px;
  font-size: 11.5px;
  line-height: 1.45;
}

.contrast-col li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 7px;
  width: 5px;
  height: 5px;
  background: currentColor;
  opacity: 0.45;
}

.contrast-before li { color: var(--muted); }
.contrast-after  li { color: var(--text-2); }

.stamp {
  display: inline-block;
  padding: 4px 7px;
  border: 1px solid currentColor;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.1em;
  transform: rotate(-2deg);
}

.stamp-accent { color: var(--teal); }
.stamp-muted  { color: var(--muted); transform: none; }

/* ── Channels ─────────────────────────────────────────── */

.channels {
  margin-top: 44px;
  padding-top: 26px;
  border-top: 1px solid var(--border);
}

.channels-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

.channels-head h2 {
  margin: 0;
  font-size: 18px;
  letter-spacing: -0.025em;
  color: var(--text);
}

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

.channel-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  border-radius: var(--radius);
  transition: border-color 200ms;
}

.channel-card:hover {
  border-color: var(--border-2);
}

.channel-card.is-warn {
  border-style: dashed;
  background: transparent;
}

.channel-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border: 1px solid var(--border-2);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.channel-card.is-ok .channel-icon {
  background: rgba(20, 184, 166, 0.1);
  color: var(--teal);
  border-color: rgba(20, 184, 166, 0.3);
}
.channel-card.is-warn .channel-icon { color: var(--amber); border-color: rgba(245, 158, 11, 0.4); }

.channel-copy { min-width: 0; }
.channel-copy strong { display: block; font-size: 13px; color: var(--text); }
.channel-copy small  { display: block; color: var(--muted); font-family: var(--font-mono); font-size: 9px; }
.channel-status {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}
.channel-status .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); }
.channel-card.is-warn .channel-status .dot { background: var(--amber); }

.case-note {
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  margin: 22px 0 0;
  padding: 16px 0 0;
  border-top: 1px dashed var(--border-2);
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.55;
}

.case-note .panel-kicker { margin: 2px 0 0; }
.case-note strong { color: var(--text); }

/* ── View header ──────────────────────────────────────── */

.view-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 42px 0 28px;
  border-bottom: 1px solid var(--border);
}

.view-head .eyebrow { margin-bottom: 12px; }

.view-head h1 {
  margin: 0 0 8px;
  font-size: clamp(2.2rem, 4.6vw, 4.4rem);
  letter-spacing: -0.055em;
  line-height: 0.95;
  color: var(--text);
}

.view-lede {
  max-width: 640px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.view-stat {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding-bottom: 4px;
  white-space: nowrap;
}

.view-stat strong {
  font-family: var(--font-mono);
  font-size: 2.4rem;
  letter-spacing: -0.07em;
  line-height: 1;
  color: var(--teal);
}

.view-stat span {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* ── Inbox ────────────────────────────────────────────── */

.inbox {
  display: grid;
  grid-template-columns: minmax(300px, 390px) minmax(0, 1fr);
  min-height: 620px;
  margin-top: 20px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  border-radius: var(--radius);
  overflow: hidden;
}

.inbox-list {
  border-right: 1px solid var(--border);
  overflow: auto;
  max-height: 720px;
}

.conv-row {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
  width: 100%;
  padding: 15px 14px;
  border: 0;
  border-bottom: 1px solid var(--border);
  border-left: 3px solid transparent;
  background: transparent;
  text-align: left;
  transition: background 140ms, border-color 140ms;
}

.conv-row:hover { background: rgba(20, 184, 166, 0.05); }
.conv-row.is-active {
  background: rgba(20, 184, 166, 0.1);
  border-left-color: var(--teal);
}

.avatar {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border-2);
  border-radius: 50%;
  background: rgba(20, 184, 166, 0.1);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--teal);
}

.conv-main { min-width: 0; }
.conv-top  { display: flex; align-items: center; gap: 7px; margin-bottom: 2px; }
.conv-top strong { font-size: 12.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.conv-top time   { margin-left: auto; color: var(--muted); font-family: var(--font-mono); font-size: 9px; white-space: nowrap; }
.conv-snippet {
  margin: 0;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.conv-tags { display: flex; gap: 5px; margin-top: 7px; flex-wrap: wrap; }

.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}
.tag-ok      { color: var(--green);  border-color: rgba(34, 197, 94, 0.35); background: rgba(34, 197, 94, 0.07); }
.tag-warn    { color: var(--amber);  border-color: rgba(245, 158, 11, 0.4); background: rgba(245, 158, 11, 0.07); }
.tag-alert   { color: var(--red);    border-color: rgba(239, 68, 68, 0.4); }
.tag-ig      { color: #E1306C;       border-color: rgba(225, 48, 108, 0.4); }
.tag-tt      { color: #69C9D0;       border-color: rgba(105, 201, 208, 0.4); }
.tag-dm      { color: var(--teal);   border-color: rgba(20, 184, 166, 0.4); background: rgba(20, 184, 166, 0.08); font-weight: 700; }
.tag-comment { color: var(--muted);  border-color: var(--border); }

.inbox-detail {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background:
    repeating-linear-gradient(0deg, rgba(20, 184, 166, 0.015) 0 1px, transparent 1px 4px),
    var(--bg-card);
}

.detail-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
}

.detail-head .avatar { width: 32px; height: 32px; flex: 0 0 32px; }
.detail-title { min-width: 0; }
.detail-title strong { display: block; font-size: 13px; color: var(--text); }
.detail-title small  { display: block; color: var(--muted); font-family: var(--font-mono); font-size: 9px; }
.detail-close {
  display: none;
  margin-left: auto;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  font-size: 16px;
  line-height: 1;
}

.thread {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 22px 18px;
  overflow: auto;
  max-height: 520px;
}

.thread-day {
  align-self: center;
  margin: 4px 0;
  padding: 3px 8px;
  background: var(--border);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-radius: 999px;
}

.bubble {
  max-width: min(520px, 82%);
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--border);
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-2);
}

.bubble.is-in  { align-self: flex-start; border-bottom-left-radius: 0; }
.bubble.is-out {
  align-self: flex-end;
  background: rgba(20, 184, 166, 0.12);
  border-color: rgba(20, 184, 166, 0.25);
  color: var(--text);
  border-bottom-right-radius: 0;
}
.bubble small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.bubble.is-out small { color: rgba(20, 184, 166, 0.6); }

.detail-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
  padding: 14px 18px;
  border-top: 1px solid var(--border);
  background: var(--bg-card);
}

.detail-note {
  flex: 1;
  min-width: 180px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.empty-inbox {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 320px;
  padding: 30px;
  color: var(--muted);
  text-align: center;
}

/* ── CRM ──────────────────────────────────────────────── */

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

.stage {
  padding: 12px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  transition: border-color 200ms;
}

.stage.is-current {
  border-top: 2px solid var(--teal);
}

.stage-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.stage strong {
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 18px;
  letter-spacing: -0.05em;
}

.stage-bar {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}

.stage-bar span {
  display: block;
  height: 100%;
  background: var(--border-2);
  border-radius: 2px;
}

.stage.is-current .stage-bar span { background: var(--teal); }

.panel-table { padding: 0; overflow: hidden; }

.table-toolbar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}

.table-toolbar h2 { margin: 0; font-size: 16px; letter-spacing: -0.02em; color: var(--text); }
.mono-note { color: var(--muted); font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.04em; }

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

.ledger {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.ledger th {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-deep);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}

.ledger td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  color: var(--text-2);
}

.ledger tr:last-child td { border-bottom: 0; }
.ledger tr:hover td { background: rgba(20, 184, 166, 0.04); }

.lead-cell { display: flex; align-items: center; gap: 9px; min-width: 180px; }
.lead-cell .avatar { width: 30px; height: 30px; flex: 0 0 30px; font-size: 9px; }
.lead-cell strong  { display: block; font-size: 12px; font-weight: 600; color: var(--text); }
.lead-cell small   { display: block; color: var(--muted); font-family: var(--font-mono); font-size: 9px; }
.ledger .muted   { color: var(--muted); }
.ledger .snippet { max-width: 280px; color: var(--text-2); line-height: 1.4; }

/* ── Agenda ───────────────────────────────────────────── */

.agenda-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(300px, 0.75fr);
  gap: 14px;
  margin-top: 20px;
}

.panel-calendar { min-height: 520px; }

.calendar {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  border: 1px solid var(--border);
  border-right: 0;
  background:
    repeating-linear-gradient(0deg, transparent 0 43px, var(--border) 43px 44px),
    var(--bg-card);
  min-height: 240px;
}

.cal-day {
  min-height: 240px;
  padding: 10px 8px;
  border-right: 1px solid var(--border);
  text-align: center;
}

.cal-day strong {
  display: block;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.cal-day span {
  display: block;
  margin-top: 4px;
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

.cal-day.is-today span {
  color: var(--teal);
}

.cal-day.is-today::after {
  content: "";
  display: block;
  width: 5px;
  height: 5px;
  margin: 7px auto 0;
  border-radius: 50%;
  background: var(--teal);
}

.cal-slot {
  margin-top: 12px;
  padding: 5px 4px;
  border: 1px dashed rgba(20, 184, 166, 0.4);
  background: rgba(20, 184, 166, 0.05);
  color: var(--teal);
  font-family: var(--font-mono);
  font-size: 7px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-radius: 3px;
}

.empty-state {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-top: 18px;
  padding: 16px;
  border: 1px dashed var(--border-2);
  background: var(--bg-deep);
  border-radius: var(--radius-sm);
}

.empty-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border: 1px solid var(--border-2);
  border-radius: 50%;
  color: var(--teal);
  font-size: 18px;
}

.empty-state h3 { margin: 0 0 4px; font-size: 14px; letter-spacing: -0.02em; color: var(--text); }
.empty-state p  { margin: 0; color: var(--muted); font-size: 11.5px; line-height: 1.45; }

.rule-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0;
  border-top: 1px solid var(--border);
}

.rule-list li {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 10px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.rule-list li > span {
  color: var(--teal);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
}

.rule-list strong { display: block; margin-bottom: 3px; font-size: 12.5px; color: var(--text); }
.rule-list p { margin: 0; color: var(--muted); font-size: 11.5px; line-height: 1.45; }

.rule-note {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  padding: 12px;
  background: rgba(20, 184, 166, 0.05);
  border: 1px solid rgba(20, 184, 166, 0.15);
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-size: 11.5px;
}

/* ── Publicaciones ────────────────────────────────────── */

.post-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 20px;
}

.post-card {
  display: flex;
  flex-direction: column;
  min-height: 220px;
  padding: 18px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  border-radius: var(--radius);
  transition: border-color 200ms;
}

.post-card:hover { border-color: var(--border-2); }

.post-card.is-ig { border-top: 3px solid #E1306C; }
.post-card.is-tt { border-top: 3px solid #69C9D0; }

.post-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 18px;
}

.post-platform {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.platform-ig { color: #E1306C; }
.platform-tt { color: #69C9D0; }

.post-card h3 {
  margin: 0 0 8px;
  font-size: 19px;
  line-height: 1.1;
  letter-spacing: -0.03em;
  color: var(--text);
}

.post-card p    { margin: 0 0 20px; color: var(--muted); font-size: 11.5px; }
.post-foot      { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.post-date      { color: var(--muted); font-family: var(--font-mono); font-size: 9px; }
.post-link      { color: var(--teal); font-family: var(--font-mono); font-size: 9px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; text-decoration: none; border-bottom: 1px solid rgba(20, 184, 166, 0.4); }
.post-link:hover { color: var(--teal-2); border-color: var(--teal); }

.panel-media { margin-top: 14px; }

.media-rail {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 6px;
  scrollbar-width: thin;
  scrollbar-color: var(--border-2) transparent;
}

.media-card {
  position: relative;
  flex: 0 0 168px;
  height: 200px;
  border: 1px solid var(--border);
  background: var(--bg-card-2);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.media-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.media-card.is-video {
  display: flex;
  align-items: flex-end;
  background:
    radial-gradient(circle at 70% 30%, rgba(20, 184, 166, 0.25), transparent 45%),
    linear-gradient(150deg, #0F1923, #06090E);
}

.media-play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(20, 184, 166, 0.5);
  border-radius: 50%;
  color: var(--teal);
  font-size: 13px;
  background: rgba(6, 9, 14, 0.6);
}

.media-meta {
  position: relative;
  z-index: 1;
  width: 100%;
  padding: 10px;
  background: linear-gradient(transparent, rgba(6, 9, 14, 0.9));
  color: var(--text);
}

.media-card.is-photo .media-meta {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
}

.media-meta strong { display: block; font-size: 11px; color: var(--text); }
.media-meta small  { display: block; color: rgba(241, 245, 249, 0.55); font-family: var(--font-mono); font-size: 8px; letter-spacing: 0.04em; text-transform: uppercase; }

/* ── Aprobaciones ─────────────────────────────────────── */

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

.approval-card {
  display: flex;
  flex-direction: column;
  padding: 18px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  border-radius: var(--radius);
  transition: border-color 200ms;
}

.approval-card:hover { border-color: var(--border-2); }

.approval-card.is-obsolete {
  border-style: dashed;
  opacity: 0.5;
  background: transparent;
}

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

.approval-kind {
  color: var(--teal);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.approval-card h3 {
  margin: 0 0 8px;
  font-size: 18px;
  line-height: 1.15;
  letter-spacing: -0.03em;
  color: var(--text);
}

.approval-card p {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.approval-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.approval-actions { display: flex; gap: 6px; }

.btn-small {
  min-height: 30px;
  padding: 0 10px;
  font-size: 8px;
}

.btn-approve {
  background: rgba(20, 184, 166, 0.15);
  border-color: rgba(20, 184, 166, 0.4);
  color: var(--teal);
}

.btn-approve:hover { background: var(--teal); border-color: var(--teal); color: var(--bg-deep); }

.approval-note {
  margin: 18px 0 0;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.03em;
}

/* ── Toast ────────────────────────────────────────────── */

.toast {
  position: fixed;
  z-index: 100;
  left: 50%;
  bottom: 26px;
  transform: translate(-50%, 20px);
  max-width: min(92vw, 460px);
  padding: 12px 18px;
  border: 1px solid var(--teal);
  border-radius: var(--radius-sm);
  background: var(--bg-card-2);
  color: var(--text);
  font-size: 12px;
  line-height: 1.4;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms, transform 180ms;
  box-shadow: 0 0 20px rgba(20, 184, 166, 0.15);
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ── Replay state ─────────────────────────────────────── */

body.is-replaying .kpi-value {
  color: var(--teal);
}

body.is-replaying .feed-item {
  animation-duration: 280ms;
}

/* ── Responsive ───────────────────────────────────────── */

@media (max-width: 1180px) {
  .main { padding-left: 30px; padding-right: 30px; }
  .topbar { margin: 0 -30px; padding: 0 30px; }
  .hero { grid-template-columns: minmax(0, 1.1fr) minmax(290px, 0.9fr); gap: 34px; }
  .grid-main, .grid-secondary, .agenda-grid { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .post-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 980px) {
  .rail {
    inset: auto 0 0 0;
    width: auto;
    height: 70px;
    flex-direction: row;
    gap: 0;
    padding: 0;
    border-right: 0;
    border-top: 1px solid var(--border);
    background: rgba(11, 16, 23, 0.97);
    box-shadow: 0 -8px 30px -10px rgba(0, 0, 0, 0.6);
  }

  .brand,
  .rail-foot {
    display: none;
  }

  .nav {
    flex-direction: row;
    width: 100%;
    gap: 0;
  }

  .nav-item {
    flex: 1;
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    height: 70px;
    padding: 6px 2px;
    border: 0;
    border-radius: 0;
    font-size: 8px;
    letter-spacing: 0.02em;
    text-align: center;
  }

  .nav-item svg { width: 18px; height: 18px; flex-basis: 18px; }
  .nav-item.is-active {
    background: transparent;
    color: var(--teal);
    border-left: none;
    border-top: 2px solid var(--teal);
  }
  .nav-item.is-active svg { opacity: 1; }

  .main {
    margin-left: 0;
    padding: 0 22px 100px;
  }

  .topbar { margin: 0 -22px; padding: 0 22px; min-height: 62px; }
  .hero { grid-template-columns: 1fr; align-items: start; padding-top: 34px; }
  .signal-card { max-width: 520px; }
  .kpi-grid { gap: 10px; }
  .kpi { min-height: 148px; }
  .inbox { grid-template-columns: 1fr; min-height: 0; }
  .inbox-list { border-right: 0; max-height: none; }
  .inbox-detail { display: none; }
  .inbox-detail.is-open {
    display: flex;
    position: fixed;
    inset: 0;
    z-index: 90;
    background: var(--bg-card);
  }
  .detail-close { display: block; }
  .thread { max-height: none; flex: 1; }
  .pipeline { grid-template-columns: repeat(2, minmax(0, 1fr)); overflow-x: visible; padding-bottom: 4px; }
  .pipeline .stage:last-child { grid-column: 1 / -1; }
  .approval-grid { grid-template-columns: 1fr; }
  .channel-grid { grid-template-columns: 1fr; }
  .post-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 680px) {
  .main { padding-left: 16px; padding-right: 16px; }
  .topbar { margin: 0 -16px; padding: 0 16px; }
  .topbar-left .kicker { display: none; }
  .business-cat { display: none; }
  .clock { display: none; }
  .status-pill { padding: 5px 8px; }
  .btn-replay span { display: none; }
  .btn-replay { width: 40px; padding: 0; }
  .hero h1 { font-size: clamp(2.1rem, 9vw, 3.2rem); }
  .hero-lede { font-size: 14px; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .kpi { min-height: 144px; padding: 14px; }
  .kpi-value { font-size: 2.5rem; margin-top: 14px; }
  .kpi-note { font-size: 10px; }
  .panel { padding: 16px; }
  .panel-head { flex-direction: column; gap: 10px; }
  .legend { gap: 8px; }
  .contrast-grid { grid-template-columns: 1fr; }
  .contrast-before { border-right: 0; border-bottom: 1px solid var(--border); }
  .post-grid { grid-template-columns: 1fr; }
  .view-head { flex-direction: column; align-items: flex-start; gap: 12px; padding-top: 30px; }
  .view-stat { padding-bottom: 0; }
  .calendar { min-height: 190px; }
  .cal-day { min-height: 190px; padding: 8px 3px; }
  .cal-slot { display: none; }
  .stage { padding: 10px 8px; }
  .feed-filters { flex-wrap: wrap; }
  .approval-foot { flex-direction: column; align-items: flex-start; }
  .channels-head { flex-direction: column; gap: 4px; }
  .case-note { grid-template-columns: 1fr; gap: 6px; }
  .table-wrap { overflow: visible; }
  .ledger thead { display: none; }
  .ledger, .ledger tbody, .ledger tr, .ledger td { display: block; width: 100%; }
  .ledger tr {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 12px;
    padding: 14px;
    border-bottom: 1px solid var(--border);
  }
  .ledger td { padding: 0; border: 0; }
  .ledger td[data-label]::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 3px;
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: 7px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }
  .ledger td.lead-cell {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 10px;
    padding-top: 0;
  }
  .ledger td.lead-cell::before { display: none; }
  .ledger td.snippet-cell { grid-column: 1 / -1; }
  .ledger .snippet { max-width: none; }
  .toast { bottom: 86px; }
}

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