/* Overview Dashboard - Figma 600:17688.
   Colour values are tokens only: a hex outside eventkrowd_theme.css is a bug
   this project has a test for. */

.dashboard__header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-block-end: 1.5rem;
}

.dashboard__title {
  margin: 0;
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--wa-color-text-normal);
}

.dashboard__context {
  margin: 0 0 1.5rem;
  color: var(--wa-color-text-quiet);
}

.dashboard__empty {
  color: var(--wa-color-text-quiet);
}

.dashboard__section-title {
  margin: 2rem 0 1rem;
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--wa-color-text-normal);
}

.dashboard__sample-tag,
.stat-card__sample-tag,
.alert__sample-tag {
  display: inline-block;
  margin-inline-start: 0.5rem;
  padding: 0.0625rem 0.375rem;
  border: 1px solid var(--wa-color-neutral-border-normal);
  border-radius: 0.25rem;
  background: var(--wa-color-neutral-fill-quiet);
  color: var(--wa-color-text-quiet);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  vertical-align: middle;
}

/* ------------------------------------------------------------- stat cards */

.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  border: 1px solid var(--wa-color-surface-border);
  border-radius: 0.5rem;
  overflow: hidden;
  background: var(--wa-color-surface-default);
}

.stat-card {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 2rem;
  border-inline-end: 1px solid var(--wa-color-surface-border);
}

.stat-card:last-child {
  border-inline-end: none;
}

.stat-card__label {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.25;
  color: var(--wa-color-text-normal);
}

.stat-card__content {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.stat-card__value {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.25;
  color: var(--wa-color-text-normal);
}

/* A revenue card can now carry ONE FIGURE PER CURRENCY, because a multi-hotel
   event genuinely takes money in more than one and summing them would be a
   number in no unit. Two 1.5rem figures with margin:0 sit flush against each
   other and read as one wrapped value, so adjacent values get separated. */
.stat-card__value + .stat-card__value {
  margin-top: 0.25rem;
}

.stat-card__detail {
  margin: 0.25rem 0 0;
  font-size: 0.875rem;
  line-height: 1.2;
  color: var(--wa-color-text-quiet);
}

.stat-card__badge {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  /* auto margin keeps the badge at the right edge whether it shares the
     figure's row or wraps onto its own in a narrow card. */
  margin-inline-start: auto;
  width: 3rem;
  height: 3rem;
  border-radius: 0.375rem;
  font-size: 1.125rem;
}

.stat-card__badge--blue {
  background: var(--wa-color-blue-95);
  border: 1px solid var(--wa-color-blue-80);
  color: var(--wa-color-blue);
}

.stat-card__badge--green {
  background: var(--wa-color-green-95);
  border: 1px solid var(--wa-color-green-80);
  color: var(--wa-color-green);
}

.stat-card__badge--amber {
  background: var(--wa-color-yellow-95);
  border: 1px solid var(--wa-color-yellow-80);
  color: var(--wa-color-yellow-50);
}

/* ----------------------------------------------------------------- alerts */

.alerts {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-block-start: 1.5rem;
}

.alert {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: 0.375rem;
}

.alert--danger {
  background: var(--wa-color-red-95);
  color: var(--wa-color-red-20);
}

.alert--neutral {
  background: var(--wa-color-neutral-fill-quiet);
  color: var(--wa-color-text-normal);
}

.alert__text {
  flex: 1;
  margin: 0;
  font-size: 0.875rem;
}

/* ----------------------------------------------------------------- charts */

.charts__grid {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  gap: 2rem;
}

.chart-card {
  padding: 1rem;
  border: 1px solid var(--wa-color-surface-border);
  border-radius: 0.5rem;
  background: var(--wa-color-surface-default);
}

.chart-card__title {
  margin: 0 0 1rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--wa-color-text-normal);
}

.chart-card__canvas {
  display: block;
  width: 100%;
  height: 16rem;
}

.chart-card__caption {
  margin: 0.75rem 0 0;
  font-size: 0.8125rem;
  color: var(--wa-color-text-quiet);
}

/* ----------------------------------------------------------------- tables */

.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--wa-color-surface-default);
  border: 1px solid var(--wa-color-surface-border);
  border-radius: 0.5rem;
}

.data-table th,
.data-table td {
  padding: 0.875rem 1rem;
  text-align: start;
  border-block-end: 1px solid var(--wa-color-surface-border);
}

.data-table thead th {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--wa-color-text-quiet);
  background: var(--wa-color-neutral-fill-quiet);
}

.data-table tbody tr:last-child th,
.data-table tbody tr:last-child td {
  border-block-end: none;
}

.data-table__row-header {
  font-weight: 600;
  color: var(--wa-color-text-normal);
}

.status-pill {
  display: inline-block;
  padding: 0.125rem 0.5rem;
  border-radius: 1rem;
  font-size: 0.75rem;
  font-weight: 600;
}

.status-pill--ok {
  background: var(--wa-color-blue-95);
  color: var(--wa-color-blue-20);
}

.status-pill--warning {
  background: var(--wa-color-yellow-95);
  color: var(--wa-color-yellow-20);
}

.status-pill--critical {
  background: var(--wa-color-red-95);
  color: var(--wa-color-red-20);
}

.dashboard-table__note {
  margin: 0.75rem 0 0;
  font-size: 0.8125rem;
  color: var(--wa-color-text-quiet);
}

/* -------------------------------------------------------- header controls */

.dashboard__period-picker,
.dashboard__event-picker {
  margin: 0;
}

/* ------------------------------------------------------------------ alerts */

.dashboard__alerts {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-block-start: 1.5rem;
}

/* wa-callout has no action slot; this flex span pins the trailing button to
   the right edge like the Figma alert rows. */
.dashboard__alert-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.dashboard__alert-text {
  flex: 1 1 auto;
  font-size: 0.875rem;
}

/* --------------------------------------------------------------- stat card extras */

/* min-content, not 0: a currency figure is one unbreakable string, and a
   shrinkable figure clips digits (a $1,685,593.50 exposure read "$1,685,593.5"
   under the badge). The figure may not shrink below its longest figure; the
   badge/sparkline wrap to a second row instead. */
.stat-card__figure {
  min-width: min-content;
}

/* Last resort for a figure longer than the whole card. */
.stat-card__value {
  overflow-wrap: anywhere;
}

.stat-card__delta {
  display: inline-block;
  margin-top: 0.25rem;
  padding: 0.125rem 0.5rem;
  border-radius: 1rem;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--wa-color-green-95);
  color: var(--wa-color-green-20);
}

.stat-card__delta--down {
  background: var(--wa-color-red-95);
  color: var(--wa-color-red-20);
}

.stat-card__sparkline {
  flex-shrink: 0;
  align-self: center;
}

/* ------------------------------------------------------------ chart extras */

.chart-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.chart-card__header .chart-card__title {
  margin: 0;
}

.chart-card__tabs {
  display: flex;
  gap: 0.25rem;
}

.chart-card__tab {
  padding: 0.25rem 0.75rem;
  border-radius: var(--wa-border-radius-m);
  font-size: 0.8125rem;
  color: var(--wa-color-text-quiet);
  text-decoration: none;
}

.chart-card__tab--active {
  background: var(--wa-color-brand-fill-quiet);
  color: var(--wa-color-text-normal);
  font-weight: 600;
}

.chart-card__legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  margin: 0.75rem 0 0;
  padding: 0;
  list-style: none;
  font-size: 0.8125rem;
  color: var(--wa-color-text-quiet);
}

.chart-card__legend li {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
}

.chart-card__dot {
  width: 0.625rem;
  height: 0.625rem;
  border-radius: 50%;
}

/* Match the chart's own series tokens so the legend cannot drift from the
   rendered slices. */
.chart-card__dot--0 { background: var(--border-color-1); }
.chart-card__dot--1 { background: var(--border-color-2); }
.chart-card__dot--2 { background: var(--border-color-3); }
.chart-card__dot--3 { background: var(--border-color-4); }

/* ------------------------------------------------------------- table extras */

.dashboard-table {
  margin-block-start: 2rem;
}

.dashboard-table__title {
  margin: 0 0 0.75rem;
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--wa-color-text-normal);
}

.dashboard-table__count {
  margin: 0.75rem 0 0;
  font-size: 0.8125rem;
  color: var(--wa-color-text-quiet);
}

/* Sort links inside data-table headers keep the header's own type styles. */
.data-table thead th a {
  color: inherit;
  text-decoration: none;
}

@media (max-width: 60rem) {
  .charts__grid {
    grid-template-columns: 1fr;
  }
}
