:root {
  --bg: #fff7d1;
  --panel: rgba(255, 255, 255, 0.88);
  --panel-solid: #ffffff;
  --ink: #24212a;
  --muted: #74717d;
  --line: #ebe5cf;
  --oxxo-red: #d71920;
  --oxxo-yellow: #f8cf00;
  --oxxo-yellow-soft: #ffed8a;
  --oxxo-brown: #4d3514;
  --facebook: #1877f2;
  --instagram: #d84f8a;
  --tiktok: #202532;
  --green: #21c58b;
  --cyan: #52d6bf;
  --pink: #f15b91;
  --violet: #8b5cf6;
  --shadow: 0 18px 45px rgba(76, 55, 14, 0.14);
  --soft-shadow: 0 10px 24px rgba(76, 55, 14, 0.1);
  font-family: Inter, "Segoe UI", Arial, Helvetica, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 12% 8%, rgba(255, 255, 255, 0.72) 0 120px, transparent 121px),
    radial-gradient(circle at 88% 18%, rgba(248, 207, 0, 0.36) 0 160px, transparent 161px),
    radial-gradient(circle at 78% 92%, rgba(255, 255, 255, 0.52) 0 190px, transparent 191px),
    linear-gradient(135deg, #fff0a3 0%, #fff8de 46%, #f4f7fb 100%);
  color: var(--ink);
}

.app-shell {
  width: calc(100vw - 18px);
  min-height: calc(100vh - 36px);
  margin: 9px auto;
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  border: 1px solid rgba(255, 255, 255, 0.74);
  background: rgba(255, 255, 255, 0.48);
  box-shadow: var(--shadow);
  overflow: hidden;
  border-radius: 8px;
  backdrop-filter: blur(12px);
}

.sidebar {
  padding: 24px 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.2), transparent 42%),
    linear-gradient(180deg, var(--oxxo-yellow) 0%, #f5bd00 100%);
  color: var(--oxxo-brown);
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-label {
  margin-top: 10px;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.sidebar-card {
  margin-top: auto;
  min-height: 128px;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.48);
  background: rgba(255, 255, 255, 0.34);
  border-radius: 8px;
  box-shadow: var(--soft-shadow);
  display: grid;
  align-content: center;
  gap: 6px;
}

.sidebar-card span,
.sidebar-card small {
  color: rgba(77, 53, 20, 0.7);
  font-size: 12px;
  text-transform: uppercase;
  font-weight: 800;
}

.sidebar-card strong {
  font-size: 24px;
}

.workspace {
  min-width: 0;
  background:
    radial-gradient(circle at 22% 18%, rgba(255, 255, 255, 0.96) 0 170px, transparent 171px),
    linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(246, 248, 251, 0.92));
}

.topbar {
  min-height: 92px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 20px 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.7);
  position: sticky;
  top: 0;
  z-index: 5;
  backdrop-filter: blur(14px);
}

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

.logo {
  width: 98px;
  height: 48px;
  display: block;
  object-fit: contain;
  background: transparent;
}

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

h1 {
  font-size: 26px;
  line-height: 1;
  letter-spacing: 0;
}

.brand p,
.small,
.muted {
  color: var(--muted);
}

.filters {
  display: flex;
  align-items: end;
  gap: 10px;
  flex-wrap: wrap;
}

.filters label {
  display: grid;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
}

input,
select,
button {
  height: 38px;
  border: 1px solid rgba(210, 202, 178, 0.75);
  background: rgba(255, 255, 255, 0.78);
  color: var(--ink);
  font: inherit;
  border-radius: 8px;
}

input,
select {
  padding: 0 8px;
}

select {
  min-width: 210px;
}

button {
  padding: 0 14px;
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
  cursor: pointer;
  font-weight: 700;
  box-shadow: 0 10px 20px rgba(36, 33, 42, 0.14);
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

main {
  padding: 22px 28px 34px;
}

.tabs {
  display: grid;
  gap: 8px;
}

.tabs button {
  width: 100%;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  text-align: left;
  padding-left: 18px;
  background: rgba(255, 255, 255, 0.22);
  color: var(--oxxo-brown);
  border-color: rgba(255, 255, 255, 0.35);
  box-shadow: none;
  position: relative;
}

.tabs button.active {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.68);
  border-color: rgba(255, 255, 255, 0.82);
}

.tabs button.active::before {
  content: "";
  width: 4px;
  position: absolute;
  left: 0;
  top: 9px;
  bottom: 9px;
  border-radius: 0 8px 8px 0;
  background: var(--oxxo-red);
}

.status {
  padding: 22px;
  border: 1px solid rgba(255, 255, 255, 0.86);
  background: var(--panel);
  border-radius: 8px;
  box-shadow: var(--soft-shadow);
}

.warning {
  padding: 10px 12px;
  margin-bottom: 12px;
  border: 1px solid #f2c94c;
  background: #fff8d8;
  color: #7a4d00;
  font-size: 13px;
}

.sheet {
  display: grid;
  grid-template-columns: minmax(300px, 0.95fr) minmax(420px, 1.45fr) minmax(340px, 1.1fr);
  gap: 16px;
}

.panel {
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.86);
  min-width: 0;
  border-radius: 8px;
  box-shadow: var(--soft-shadow);
  overflow: hidden;
}

.panel-title {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

.panel-body {
  padding: 16px;
}

.network-head {
  min-height: 142px;
  padding: 18px;
  display: grid;
  align-content: space-between;
  color: var(--ink);
  background:
    radial-gradient(circle at 90% 0%, rgba(215, 25, 32, 0.12) 0 60px, transparent 61px),
    linear-gradient(135deg, rgba(255, 237, 138, 0.92), rgba(255, 255, 255, 0.82));
}

.network-head h2 {
  font-size: clamp(28px, 3vw, 40px);
  line-height: 1;
}

.handle {
  font-size: 14px;
  color: var(--muted);
}

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

.kpi {
  border: 1px solid rgba(235, 229, 207, 0.9);
  background: rgba(255, 255, 255, 0.76);
  padding: 12px;
  min-height: 82px;
  border-radius: 8px;
  min-width: 0;
  overflow: hidden;
}

.kpi span {
  display: block;
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  font-weight: 800;
  min-height: 28px;
}

.kpi strong {
  display: block;
  margin-top: 8px;
  font-size: clamp(20px, 2.1vw, 28px);
  line-height: 1;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  letter-spacing: 0;
}

.chart {
  width: 100%;
  height: 330px;
}

.readable-chart {
  height: 300px;
}

.mini-chart {
  height: 280px;
}

.bars {
  display: grid;
  gap: 12px;
}

.bar-row {
  display: grid;
  grid-template-columns: 92px minmax(120px, 1fr) 74px;
  gap: 8px;
  align-items: center;
  font-size: 12px;
}

.mix-chart {
  display: grid;
  gap: 10px;
}

.mix-row {
  display: grid;
  grid-template-columns: 42px minmax(160px, 1fr) 64px;
  gap: 10px;
  align-items: center;
  font-size: 12px;
}

.mix-period {
  font-weight: 800;
  color: var(--muted);
}

.mix-track {
  height: 22px;
  background: #f1ebd3;
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}

.mix-total {
  height: 100%;
  min-width: 2px;
  position: relative;
  border-radius: inherit;
  overflow: hidden;
}

.mix-segment {
  position: absolute;
  top: 0;
  bottom: 0;
}

.mix-row strong {
  text-align: right;
  font-size: 12px;
}

.mix-legend {
  margin: 0;
}

.mix-breakdown {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.followers-priority .mini-chart {
  height: 300px;
}

.dual-chart {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
  align-items: stretch;
}

.dual-chart-block {
  min-width: 0;
  display: grid;
  gap: 8px;
}

.chart-caption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
}

.chart-caption strong {
  color: var(--ink);
  font-size: 14px;
}

.mix-breakdown span {
  border: 1px solid var(--line);
  background: #f9fafb;
  padding: 8px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  font-weight: 800;
  min-width: 0;
}

.mix-breakdown strong {
  display: block;
  margin-top: 4px;
  color: var(--ink);
  font-size: clamp(14px, 1.2vw, 18px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-track {
  height: 16px;
  background: #f1ebd3;
  border-radius: 8px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--green), var(--cyan));
}

.span-2 {
  grid-column: span 2;
}

.span-3 {
  grid-column: 1 / -1;
}

.table-wrap {
  overflow-y: auto;
  overflow-x: hidden;
  max-height: 520px;
}

.pager {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.pager button {
  height: 30px;
  padding: 0 10px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--ink);
  border-color: var(--line);
}

table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  font-size: 11px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 7px;
  text-align: left;
  vertical-align: top;
  overflow-wrap: anywhere;
}

th {
  position: sticky;
  top: 0;
  background: #fff8d8;
  z-index: 1;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
}

th:nth-child(1),
td:nth-child(1) {
  width: 60px;
}

th:nth-child(2),
td:nth-child(2) {
  width: 72px;
}

th:nth-child(3),
td:nth-child(3) {
  width: auto;
}

th:nth-child(4),
td:nth-child(4) {
  width: 78px;
}

th:nth-child(n+5),
td:nth-child(n+5) {
  width: 74px;
}

th:last-child,
td:last-child {
  width: 64px;
}

.thumb {
  width: 58px;
  height: 58px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eef1f5;
}

.thumb-placeholder {
  display: inline-flex;
  width: 58px;
  height: 58px;
  align-items: center;
  justify-content: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #f6f7f9;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  line-height: 1.1;
  text-align: center;
  text-transform: uppercase;
}

.post-copy {
  min-width: 0;
  max-width: none;
  line-height: 1.35;
}

.post-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 58px;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff8d8;
  color: var(--ink);
  font-weight: 800;
  text-decoration: none;
}

.post-link:hover {
  border-color: var(--oxxo-red);
  color: var(--oxxo-red);
}

.note {
  padding: 10px 12px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 11px;
}

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

.legend i {
  width: 10px;
  height: 10px;
  display: inline-block;
  border-radius: 999px;
}

.sentiment .network-head h2 {
  color: var(--oxxo-red);
}

.sentiment-chart text {
  letter-spacing: 0;
}

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

.topic-card {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.topic-card header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
}

.topic-card header strong {
  color: var(--oxxo-red);
  font-size: 15px;
}

.topic-card header span {
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.topic-legend {
  margin-top: 0;
}

.topic-row {
  display: grid;
  grid-template-columns: minmax(140px, 0.75fr) minmax(120px, 1fr) minmax(108px, 0.45fr);
  align-items: center;
  gap: 10px;
  font-size: 12px;
}

.topic-row span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topic-track {
  height: 12px;
  border-radius: 999px;
  background: #efe9cf;
  overflow: hidden;
  position: relative;
}

.topic-total {
  display: block;
  height: 100%;
  min-width: 2px;
  border-radius: inherit;
  overflow: hidden;
  position: relative;
}

.topic-total i {
  display: block;
  height: 100%;
  position: absolute;
  top: 0;
}

.topic-value {
  display: grid;
  gap: 2px;
  text-align: right;
  font-size: 12px;
}

.topic-value small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.15;
}

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

.insight-card {
  min-height: 138px;
  padding: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  border-radius: 8px;
  display: grid;
  gap: 10px;
}

.insight-card div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.insight-card span {
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--oxxo-yellow-soft);
  color: var(--oxxo-brown);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.insight-card strong {
  font-size: 12px;
  color: var(--muted);
  text-align: right;
}

.insight-card p {
  line-height: 1.4;
  font-size: 14px;
}

.insight-card footer {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

@media (max-width: 1080px) {
  .app-shell {
    grid-template-columns: 210px minmax(0, 1fr);
  }

  .sheet {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .span-3 {
    grid-column: span 2;
  }
}

@media (max-width: 760px) {
  .app-shell {
    width: 100%;
    min-height: 100vh;
    margin: 0;
    grid-template-columns: 1fr;
    border-radius: 0;
  }

  .sidebar {
    position: static;
  }

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

  main {
    padding: 12px;
  }

  .sheet,
  .kpis {
    grid-template-columns: 1fr;
  }

  .mix-breakdown {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

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

  .dual-chart {
    grid-template-columns: 1fr;
  }

  .span-2,
  .span-3 {
    grid-column: auto;
  }
}
