:root {
  --ink: #1f2933;
  --charcoal: #2b2f33;
  --muted: #667085;
  --line: #d7d2cb;
  --soft-line: #ece7df;
  --page: #f6f2ec;
  --surface: #ffffff;
  --cream: #fbf7f2;
  --blush: #f8eceb;
  --rose: #b76e79;
  --teal: #176b87;
  --teal-soft: #e7f0f2;
  --green: #2f855a;
  --amber: #c68422;
  --red: #b84a4a;
  --shadow: 0 14px 40px rgba(31, 41, 51, 0.09);
}

* {
  box-sizing: border-box;
}

html {
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--page);
}

body {
  margin: 0;
  min-width: 320px;
}

button,
input {
  font: inherit;
}

.app-shell {
  width: min(1480px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 36px;
}

.topbar {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  color: #ffffff;
  background: var(--ink);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 6px;
  color: #dce7ea;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  font-size: clamp(1.35rem, 2.2vw, 2rem);
  line-height: 1.12;
}

.period-box {
  display: grid;
  min-width: 240px;
  align-content: center;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
}

.period-box span {
  color: #dce7ea;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

.period-box strong {
  margin-top: 3px;
  color: #ffffff;
  font-size: 1.02rem;
}

.summary-strip {
  margin-top: 12px;
  padding: 11px 14px;
  color: var(--ink);
  background: var(--blush);
  border: 1px solid #ead8d5;
  border-radius: 8px;
  line-height: 1.45;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.kpi-card,
.panel,
.insight-card {
  background: var(--surface);
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(31, 41, 51, 0.06);
}

.kpi-card {
  min-height: 126px;
  padding: 14px;
  display: grid;
  align-content: space-between;
  border-top: 4px solid var(--teal);
}

.kpi-card:nth-child(1) {
  border-top-color: var(--rose);
}

.kpi-card:nth-child(4) {
  border-top-color: var(--amber);
}

.kpi-card:nth-child(5) {
  border-top-color: var(--red);
}

.kpi-label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.kpi-value {
  margin-top: 10px;
  color: var(--ink);
  font-size: clamp(1.45rem, 2.4vw, 2.05rem);
  font-weight: 850;
  line-height: 1;
}

.kpi-note {
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.35;
}

.chart-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.panel {
  overflow: hidden;
}

.chart-panel {
  min-height: 362px;
}

.panel-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--soft-line);
}

.panel-heading h2 {
  font-size: 1rem;
  line-height: 1.25;
}

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

.chart-box {
  width: 100%;
  min-height: 302px;
  padding: 12px 14px 16px;
}

.chart-box svg {
  display: block;
  width: 100%;
  height: 290px;
}

.axis-label {
  fill: var(--muted);
  font-size: 10px;
}

.chart-value {
  fill: var(--ink);
  font-size: 11px;
  font-weight: 700;
}

.bar-main {
  fill: var(--teal);
}

.bar-alt {
  fill: var(--rose);
}

.grid-line {
  stroke: #ded9d2;
  stroke-dasharray: 4 4;
  stroke-width: 1;
}

.donut-layout {
  display: grid;
  grid-template-columns: minmax(160px, 260px) 1fr;
  align-items: center;
  gap: 18px;
  min-height: 300px;
  padding: 18px 20px;
}

.donut {
  width: min(240px, 100%);
  aspect-ratio: 1;
  border-radius: 50%;
  position: relative;
  box-shadow: inset 0 0 0 1px rgba(31, 41, 51, 0.08);
}

.donut::after {
  content: "";
  position: absolute;
  inset: 28%;
  background: var(--surface);
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(31, 41, 51, 0.06);
}

.legend-list {
  display: grid;
  gap: 10px;
}

.legend-item {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  color: var(--ink);
  font-size: 0.86rem;
  line-height: 1.25;
}

.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

.legend-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.legend-value {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

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

.insight-card {
  min-height: 132px;
  padding: 14px;
  border-left: 4px solid var(--charcoal);
}

.insight-card:nth-child(2) {
  border-left-color: var(--rose);
}

.insight-card:nth-child(3) {
  border-left-color: var(--teal);
}

.insight-card:nth-child(4) {
  border-left-color: var(--amber);
}

.insight-card h3 {
  margin-bottom: 8px;
  font-size: 0.86rem;
  text-transform: uppercase;
}

.insight-card p {
  color: var(--ink);
  font-size: 0.92rem;
  line-height: 1.45;
}

.table-panel {
  margin-top: 16px;
}

.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  background: var(--cream);
  border-bottom: 1px solid var(--soft-line);
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tab-button {
  min-height: 36px;
  padding: 8px 12px;
  color: var(--ink);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
}

.tab-button[aria-selected="true"] {
  color: #ffffff;
  background: var(--ink);
  border-color: var(--ink);
}

.search-box {
  display: grid;
  grid-template-columns: auto minmax(150px, 240px);
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.search-box input {
  width: 100%;
  min-height: 36px;
  padding: 7px 10px;
  color: var(--ink);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
}

.search-box input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(23, 107, 135, 0.14);
}

.table-wrap {
  overflow: auto;
  max-height: 640px;
}

table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
  font-size: 0.86rem;
}

th,
td {
  padding: 10px 11px;
  border-bottom: 1px solid var(--soft-line);
  text-align: left;
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: #ffffff;
  background: var(--charcoal);
  font-size: 0.76rem;
  text-transform: uppercase;
  white-space: nowrap;
}

td {
  background: #ffffff;
  line-height: 1.35;
}

td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

td.status {
  font-weight: 700;
}

.priority-high {
  color: var(--red);
  font-weight: 800;
}

.priority-medium {
  color: var(--amber);
  font-weight: 800;
}

.empty-state {
  padding: 28px;
  color: var(--muted);
  text-align: center;
}

.source-note {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 0.82rem;
}

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

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

  .donut-layout {
    grid-template-columns: minmax(160px, 220px) 1fr;
  }
}

@media (max-width: 720px) {
  .app-shell {
    width: min(100% - 20px, 1480px);
    padding-top: 10px;
  }

  .topbar,
  .table-toolbar {
    display: grid;
  }

  .period-box {
    min-width: 0;
  }

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

  .panel-heading {
    display: grid;
  }

  .donut-layout {
    grid-template-columns: 1fr;
  }

  .donut {
    width: min(230px, 72vw);
    margin: 0 auto;
  }

  .search-box {
    grid-template-columns: 1fr;
  }

  table {
    min-width: 860px;
  }
}
