:root {
  --bg-0: #03060c;
  --bg-1: #0a111a;
  --card-bg: #0c141d;
  --card-bg-2: #0f1822;
  --card-border: #1d2b37;
  --text-main: #eef4f8;
  --text-muted: #b1bdc9;
  --accent: #ff2636;
  --shadow: 0 12px 24px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Exo 2", sans-serif;
  color: var(--text-main);
  background:
    radial-gradient(circle at 12% 18%, rgba(255, 38, 54, 0.2), transparent 35%),
    radial-gradient(circle at 80% 0, rgba(61, 94, 124, 0.25), transparent 40%),
    linear-gradient(170deg, var(--bg-1), var(--bg-0));
}

.wallboard {
  width: min(1920px, 100%);
  margin: 0 auto;
  padding: 22px 18px 14px;
}

.top-row {
  display: grid;
  grid-template-columns: repeat(6, minmax(180px, 1fr));
  gap: 12px;
}

.metric-card {
  background: linear-gradient(165deg, var(--card-bg), var(--card-bg-2));
  border: 1px solid var(--card-border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  min-height: 174px;
  padding: 14px 16px 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}

.metric-card::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 5px;
  background: var(--accent);
}

.metric-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.metric-icon {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.metric-icon svg {
  width: 40px;
  height: 40px;
  fill: none;
  stroke: var(--text-main);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

h2 {
  margin: 0;
  font-family: "Barlow Condensed", sans-serif;
  text-transform: uppercase;
  font-size: 1.9rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-main);
  line-height: 1;
}

.metric-value {
  margin: 0;
  text-align: center;
  font-family: "Barlow Condensed", sans-serif;
  font-size: clamp(3.2rem, 4.2vw, 5.1rem);
  letter-spacing: 0.03em;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1;
}

.metric-value.accent {
  color: var(--accent);
}

.status-line {
  position: fixed;
  z-index: 3;
  bottom: 18px;
  left: 18px;
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.agent-tables {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.agent-view-control {
  position: fixed;
  z-index: 3;
  right: 0;
  bottom: 0;
  left: 0;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  height: 72px;
  padding: 0 18px 18px;
}

.agent-view-control button {
  min-block-size: 32px;
  padding: 0 12px;
  border: 1px solid var(--card-border);
  border-radius: 5px;
  color: var(--text-main);
  background: var(--card-bg);
  font: 600 0.9rem "Exo 2", sans-serif;
  cursor: pointer;
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.agent-view-control:hover button,
.agent-view-control:focus-within button {
  opacity: 1;
  transform: translateY(0);
}

.agent-view-control button:hover,
.agent-view-control button:focus-visible {
  border-color: var(--accent);
  outline: none;
}

.agent-table-section {
  background: linear-gradient(165deg, var(--card-bg), var(--card-bg-2));
  border: 1px solid var(--card-border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.agent-table-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 2px solid var(--accent);
}

.agent-table-header h2 {
  font-size: 1.35rem;
}

.agent-table-total {
  margin-left: auto;
  color: var(--text-main);
  font-size: 1rem;
}

.agent-table-icon {
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  fill: none;
  stroke: var(--text-main);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.agent-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 1rem;
}

.agent-table th,
.agent-table td {
  padding: 9px 16px;
  text-align: left;
}

.agent-table th:last-child,
.agent-table td:last-child {
  text-align: right;
}

.agent-table th:first-child,
.agent-table td:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agent-table th:not(:first-child),
.agent-table td:not(:first-child) {
  white-space: nowrap;
}

.agent-table th:last-child,
.agent-table td:last-child {
  width: 140px;
}

.agent-table th:nth-child(2):not(:last-child),
.agent-table td:nth-child(2):not(:last-child) {
  width: 64px;
}

.agent-table th {
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 500;
}

.agent-table td {
  border-top: 1px solid var(--card-border);
}

.agent-table tr.performance-color td {
  background: var(--booking-performance-color);
}

.carousel-column-header {
  display: none;
}

.agent-tables.carousel-view {
  display: block;
  position: relative;
  min-block-size: min(68vh, 760px);
  margin-top: 10px;
  overflow: hidden;
}

.carousel-view .agent-table-section {
  display: none;
  position: absolute;
  inset: 0;
  width: 100%;
}

.carousel-view .agent-table-section.carousel-active,
.carousel-view .agent-table-section.carousel-entering,
.carousel-view .agent-table-section.carousel-exiting {
  display: flex;
  flex-direction: column;
}

.carousel-view .agent-table-section.carousel-entering {
  z-index: 2;
  animation: carousel-slide-in 500ms ease-out both;
}

.carousel-view .agent-table-section.carousel-exiting {
  z-index: 1;
  animation: carousel-slide-out 500ms ease-in both;
}

.carousel-view .agent-table-header {
  padding: 14px 20px;
}

.carousel-view .agent-table-header h2 {
  font-size: 1.9rem;
}

.carousel-view .agent-table-total {
  font-size: 2.4rem;
}

.carousel-view .agent-table-icon {
  width: 40px;
  height: 40px;
}

.carousel-view .agent-table,
.carousel-view .agent-table tbody {
  min-block-size: 0;
}

.carousel-view .agent-table {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
}

.carousel-view .agent-table thead {
  display: none;
}

.carousel-view .agent-table th {
  padding: 0;
  font-size: 1.28rem;
}

.carousel-view .agent-table tbody {
  display: grid;
  flex: 1 1 auto;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: 38px repeat(var(--carousel-agent-rows, 1), minmax(0, 1fr));
  grid-auto-flow: column;
  gap: 1px;
  background: var(--card-border);
}

.carousel-view .agent-table tbody tr {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  min-block-size: 0;
  background: var(--card-bg);
}

.carousel-view .agent-table tbody tr:has(td:nth-child(3)) {
  grid-template-columns: minmax(0, 1fr) 100px 150px;
}

.carousel-view .agent-table td {
  display: flex;
  align-items: center;
  padding: 8px 30px;
  border: 0;
  font-size: 1.92rem;
  font-weight: 500;
}

.carousel-view .agent-table td:not(:first-child) {
  justify-content: center;
}

.carousel-view .agent-table td:last-child {
  width: auto;
  font-family: "Barlow Condensed", sans-serif;
  font-size: 1.92rem;
  font-weight: 700;
}

.carousel-view .agent-table th:nth-child(2):not(:last-child),
.carousel-view .agent-table td:nth-child(2):not(:last-child) {
  width: auto;
}

.carousel-view .agent-table tbody tr.carousel-column-header {
  display: grid;
  background: var(--card-bg-2);
}

.carousel-view .agent-table tbody tr.carousel-column-header td {
  min-block-size: 0;
  padding-block: 3px;
  color: var(--text-muted);
  font-family: "Exo 2", sans-serif;
  font-size: 1.28rem;
  font-weight: 500;
  line-height: 1;
}

@keyframes carousel-slide-in {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

@keyframes carousel-slide-out {
  from { transform: translateX(0); }
  to { transform: translateX(-100%); }
}

@media (max-width: 1280px) {
  .top-row {
    grid-template-columns: repeat(3, minmax(180px, 1fr));
  }

  .agent-tables {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .top-row {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }

  .agent-tables {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  h2 {
    font-size: 1.55rem;
  }

  .metric-value {
    font-size: clamp(2.5rem, 8vw, 4rem);
  }

  .carousel-view .agent-table-header h2 {
    font-size: 1.55rem;
  }

  .carousel-view .agent-table td {
    padding: 12px 18px;
    font-size: 1.28rem;
  }

  .carousel-view .agent-table td:last-child {
    font-size: 1.28rem;
  }

  .carousel-view .agent-table tbody tr:has(td:nth-child(3)) {
    grid-template-columns: minmax(0, 1fr) 76px 110px;
  }
}

@media (max-width: 560px) {
  .wallboard {
    padding: 10px;
  }

  .top-row {
    grid-template-columns: 1fr;
  }

  .agent-tables {
    grid-template-columns: 1fr;
  }

  .metric-card {
    min-height: 140px;
  }
}
