:root {
  color-scheme: light;
  font-family: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  color: #111827;
  background: #f4f5f7;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #f4f5f7;
}

button,
select {
  font: inherit;
}

.shell {
  width: min(1126px, calc(100% - 32px));
  min-height: 100svh;
  margin: 0 auto;
  padding: 28px 24px 42px;
  border-inline: 1px solid #e5e7eb;
}

.header {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto auto;
  align-items: end;
  gap: 12px;
  margin-bottom: 14px;
}

.kicker,
.label {
  margin: 0 0 6px;
  color: #9ca3af;
  font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  color: #0f172a;
  line-height: 1.1;
}

h1 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(26px, 3vw, 30px);
  font-weight: 800;
  letter-spacing: -0.4px;
}

h2 {
  font-family: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  font-size: 16px;
  font-weight: 700;
}

.subtle {
  margin: 4px 0 0;
  color: #9ca3af;
  font-size: 12px;
}

.controls,
.tabs {
  display: flex;
  flex-shrink: 0;
  gap: 2px;
  padding: 3px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #eef0f4;
}

.seg,
.tab {
  min-height: 36px;
  padding: 0 13px;
  border: 0;
  border-radius: 7px;
  color: #6b7280;
  background: transparent;
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 500;
}

.seg.active,
.tab.active {
  color: #111827;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
  font-weight: 700;
}

.notice {
  margin-bottom: 14px;
  padding: 10px 14px;
  border: 1px solid #fde68a;
  border-radius: 10px;
  color: #374151;
  background: #fffbeb;
  font-size: 12.5px;
}

.hidden,
.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

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

.kpi,
.panel,
.brand-card {
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.kpi {
  min-height: 120px;
  padding: 16px;
  text-align: center;
}

.kpi span,
.kpi small {
  display: block;
  color: #6b7280;
  font-size: 11.5px;
}

.kpi strong {
  display: block;
  margin: 10px 0 4px;
  color: #111827;
  font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 29px;
  font-weight: 800;
  line-height: 1;
}

.stake-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.mini-kpi {
  min-height: 86px;
  padding: 14px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #f8f9fb;
  text-align: center;
}

.mini-kpi span {
  display: block;
  color: #9ca3af;
  font-size: 11.5px;
}

.mini-kpi strong {
  display: block;
  margin-top: 8px;
  color: #111827;
  font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 27px;
  font-weight: 800;
  line-height: 1;
}

.panel {
  margin-bottom: 16px;
  padding: 18px;
}

.period-panel {
  padding: 12px 14px;
}

.period-panel .panel-head {
  margin-bottom: 0;
}

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

select {
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid #e5e7eb;
  border-radius: 7px;
  color: #374151;
  background: #ffffff;
  font-size: 12.5px;
}

.period-controls {
  display: grid;
  gap: 7px;
  justify-items: end;
}

.period-group {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 3px;
  max-width: 520px;
  padding: 2px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #f3f4f6;
}

.period-group.compact {
  max-width: 330px;
}

.period-btn {
  min-height: 25px;
  padding: 0 8px;
  border: 0;
  border-radius: 5px;
  color: #9ca3af;
  background: transparent;
  cursor: pointer;
  font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.period-btn.active {
  color: #111827;
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

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

.brand-card {
  padding: 16px;
  border-top: 3px solid #d6a64f;
  background: #f8f9fb;
}

.brand-card.brand-crema {
  border-top-color: #d6a64f;
  background: #fffaf0;
}

.brand-card.brand-magic {
  border-top-color: #7c3aed;
  background: #faf7ff;
}

.brand-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.brand-title strong {
  color: #b7791f;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 16px;
  font-weight: 800;
}

.brand-magic .brand-title strong {
  color: #7c3aed;
}

.brand-title code {
  color: #9ca3af;
  font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 10px;
}

.metric-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 0;
  border-top: 1px solid #eef2f6;
  color: #9ca3af;
  font-size: 12.5px;
}

.metric-row b {
  color: #111827;
  font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-weight: 800;
}

.month-chart {
  display: grid;
  gap: 12px;
}

.chart-row {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
}

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

.chart-label strong {
  color: #374151;
  font-size: 12px;
}

.chart-label span {
  color: #9ca3af;
  font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
}

.chart-track {
  height: 9px;
  overflow: hidden;
  border-radius: 6px;
  background: #f3f4f6;
}

.chart-bar {
  height: 100%;
  border-radius: 6px;
  background: #d6a64f;
}

.chart-row.brand-crema .chart-bar {
  background: #d6a64f;
}

.chart-row.brand-magic .chart-bar {
  background: #7c3aed;
}

.chart-row.empty .chart-bar {
  background: #cbd5e1;
}

.visual-grid {
  display: grid;
  grid-template-columns: minmax(260px, 0.8fr) minmax(0, 1.2fr);
  gap: 16px;
  margin-bottom: 16px;
}

.visual-panel {
  min-height: 220px;
}

.donut-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  margin-top: 22px;
}

.donut {
  --value: 0%;
  display: grid;
  place-items: center;
  width: 132px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: conic-gradient(#059669 var(--value), #e5e7eb 0);
  color: #0f172a;
  font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 22px;
  font-weight: 800;
}

.donut::after {
  content: attr(data-value);
  display: grid;
  place-items: center;
  width: 82px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #ffffff;
}

.donut-wrap strong {
  display: block;
  color: #111827;
  font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 36px;
  line-height: 1;
}

.donut-wrap span {
  display: block;
  margin-top: 6px;
  color: #6b7280;
  font-size: 12px;
}

.trend-chart {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(36px, 1fr);
  align-items: end;
  gap: 7px;
  height: 150px;
  margin-top: 20px;
  padding-top: 10px;
}

.trend-item {
  display: grid;
  grid-template-rows: 1fr auto;
  align-items: end;
  gap: 7px;
  min-width: 0;
  height: 100%;
}

.trend-bar {
  width: 100%;
  min-height: 3px;
  border-radius: 5px 5px 2px 2px;
  background: #059669;
}

.trend-bar.empty {
  background: #cbd5e1;
}

.trend-item span {
  overflow: hidden;
  color: #9ca3af;
  font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 10px;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.empty-state {
  align-self: center;
  color: #9ca3af;
  font-size: 12.5px;
}

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

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 11px 10px;
  border-bottom: 1px solid #f3f4f6;
  text-align: left;
  white-space: nowrap;
}

th {
  color: #9ca3af;
  font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

td {
  color: #374151;
  font-size: 13px;
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 5px;
  color: #047857;
  background: #d1fae5;
  font-size: 11.5px;
  font-weight: 700;
}

.status:not(.active) {
  color: #dc2626;
  background: #fee2e2;
}

@media (max-width: 900px) {
  .header {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .controls,
  .tabs {
    width: 100%;
  }

  .seg,
  .tab {
    flex: 1;
  }
}

@media (max-width: 760px) {
  .shell {
    width: min(100%, calc(100% - 18px));
    padding: 20px 12px 32px;
  }

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

  .period-controls {
    width: 100%;
    justify-items: stretch;
  }

  .period-group {
    justify-content: flex-start;
    max-width: none;
  }

  .kpi-grid,
  .brand-grid,
  .visual-grid,
  .stake-summary {
    grid-template-columns: 1fr;
  }

  .chart-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }
}
