:root {
  --accent: #C1121F;
  --accent-dark: #8f0d17;
  --text: #1f2933;
  --muted: #6b7280;
  --border: #e5e7eb;
  --soft: #fff1f2;
  --row-alt: #fff0f3;
  --white: #ffffff;
  --page: #f7f7f8;
  --shadow: 0 10px 30px rgba(31, 41, 51, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--page);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

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

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 16px 0 18px;
  border-bottom: 1px solid rgba(17, 24, 39, 0.08);
  box-shadow: 0 8px 18px -18px rgba(17, 24, 39, 0.45);
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
  line-height: 1.15;
  font-weight: 750;
  color: var(--accent);
}

#last-update {
  margin-top: 6px;
  color: var(--muted);
  font-size: 14px;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 28px;
  min-height: 34px;
}

.brand span {
  color: #9ca3af;
  font-size: 15px;
  font-weight: 750;
  white-space: nowrap;
}

.tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--white);
  box-shadow: 0 2px 10px rgba(31, 41, 51, 0.04);
}

.tab {
  min-width: 104px;
  min-height: 38px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.tab.active {
  background: var(--accent);
  color: var(--white);
  font-weight: 700;
}

.tab:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.filters,
.cards,
.table-section {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.filters {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr)) auto;
  gap: 14px;
  align-items: end;
  padding: 16px;
}

label {
  display: grid;
  gap: 6px;
}

label span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

input,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--white);
  color: var(--text);
  padding: 0 12px;
}

input:focus,
select:focus {
  border-color: var(--accent);
  outline: 3px solid rgba(193, 18, 31, 0.14);
}

.primary-button {
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: var(--white);
  font-weight: 700;
  padding: 0 18px;
  cursor: pointer;
}

.primary-button:hover {
  background: var(--accent-dark);
}

.cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  margin-top: 16px;
  overflow: hidden;
}

.metric-card {
  min-height: 128px;
  padding: 22px;
  background: var(--white);
  border-left: 1px solid var(--border);
}

.metric-card:first-child {
  border-left: 0;
}

.metric-card span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

.metric-card strong {
  display: block;
  margin-top: 14px;
  color: var(--accent);
  font-size: 34px;
  line-height: 1.1;
  font-weight: 800;
}

.table-section {
  margin-top: 16px;
  overflow: hidden;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}

h2 {
  font-size: 18px;
  line-height: 1.2;
}

#table-count {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

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

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 860px;
}

th,
td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
  font-size: 14px;
}

th {
  background: var(--soft);
  color: #6f111a;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

tbody tr:nth-child(even) {
  background: var(--row-alt);
}

td:nth-child(4),
th:nth-child(4) {
  text-align: right;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  max-width: 220px;
  border-radius: 6px;
  background: rgba(193, 18, 31, 0.11);
  color: #8f0d17;
  padding: 0 9px;
  font-size: 12px;
  font-weight: 750;
  white-space: nowrap;
}

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

@media (max-width: 920px) {
  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .tabs {
    overflow-x: auto;
  }

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

  .primary-button {
    grid-column: 1 / -1;
  }

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

  .metric-card,
  .metric-card:first-child {
    border-left: 0;
    border-top: 1px solid var(--border);
  }

  .metric-card:first-child {
    border-top: 0;
  }
}

@media (max-width: 560px) {
  .app-shell {
    width: min(100% - 20px, 1360px);
    padding-top: 14px;
  }

  h1 {
    font-size: 22px;
  }

  .brand {
    gap: 16px;
  }

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

  .metric-card strong {
    font-size: 28px;
  }
}
