/* Notification delivery log. Surfaces and text follow Wagtail's theme tokens
   (light and dark); the four status colours are fixed and always carry an
   icon and a label, never colour alone. */

:root {
  --zwd-good: #0ca30c;
  --zwd-warning: #fab219;
  --zwd-critical: #d03b3b;
  --zwd-neutral: #8a8a87;
  --zwd-surface: var(--w-color-surface-dashboard-panel, var(--w-color-surface-page, #fff));
  --zwd-border: var(--w-color-border-furniture, #e6e6e6);
  --zwd-text: var(--w-color-text-context, #262626);
  --zwd-muted: var(--w-color-text-label, #5c5c5c);
}

.zwd {
  color: var(--zwd-text);
  min-width: 0;
}

.zwd-card {
  min-width: 0;
  background: var(--zwd-surface);
  border: 1px solid var(--zwd-border);
  border-radius: 0.5rem;
  padding: 1rem 1.25rem;
  margin-block-end: 1.25rem;
}

.zwd-h2 {
  font-size: 1.125rem;
  font-weight: 700;
  margin: 0 0 0.75rem;
}

summary.zwd-h2 {
  cursor: pointer;
  margin: 0;
}

.zwd-muted {
  color: var(--zwd-muted);
}

.zwd-small {
  font-size: 0.75rem;
}

.zwd-scroll {
  overflow-x: auto;
  /* A wide table or chart scrolls here instead of widening the page. */
  contain: inline-size;
}

.zwd-table {
  width: 100%;
}

.zwd-table td,
.zwd-table th {
  vertical-align: top;
}

.zwd-pre {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.875rem;
  margin: 0.5rem 0 0;
}

/* Status pill: tinted background, text in the text colour, icon + label. */
.zwd-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
  padding: 0.1em 0.6em;
  border-radius: 999px;
  border: 1px solid currentColor;
  font-size: 0.8125rem;
  font-weight: 600;
  white-space: nowrap;
  color: var(--zwd-text);
}

.zwd-pill--good { border-color: var(--zwd-good); background: color-mix(in srgb, var(--zwd-good) 14%, transparent); }
.zwd-pill--warning { border-color: var(--zwd-warning); background: color-mix(in srgb, var(--zwd-warning) 18%, transparent); }
.zwd-pill--critical { border-color: var(--zwd-critical); background: color-mix(in srgb, var(--zwd-critical) 14%, transparent); }
.zwd-pill--neutral { border-color: var(--zwd-neutral); background: color-mix(in srgb, var(--zwd-neutral) 12%, transparent); }

.zwd-callout {
  border-inline-start: 4px solid var(--zwd-neutral);
  background: var(--zwd-surface);
  padding: 0.75rem 1rem;
  margin-block-end: 1rem;
  border-radius: 0.25rem;
}

.zwd-callout--critical { border-inline-start-color: var(--zwd-critical); }
.zwd-callout--warning { border-inline-start-color: var(--zwd-warning); }

.zwd-dl {
  display: grid;
  grid-template-columns: minmax(8rem, max-content) 1fr;
  gap: 0.4rem 1.25rem;
  margin: 0;
}

.zwd-dl dt { color: var(--zwd-muted); }
.zwd-dl dd { margin: 0; }

/* Filters */
.zwd-filters summary {
  list-style-position: outside;
}

.zwd-filter-group {
  border: 0;
  border-block-start: 1px solid var(--zwd-border);
  margin: 1rem 0 0;
  padding: 0.75rem 0 0;
  min-width: 0;
}

.zwd-filter-group__title {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--zwd-muted);
  padding: 0;
}

.zwd-filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(15rem, 100%), 1fr));
  gap: 0 1.5rem;
  align-items: start;
}

/* Every control fills its own cell and never spills into the next one. */
.zwd-filter {
  min-width: 0;
}

.zwd-filter .w-field__wrapper {
  margin-block-end: 0.75rem;
}

.zwd-filter input:not([type="checkbox"]):not([type="radio"]),
.zwd-filter select {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

/* The two date inputs sit side by side. */
.zwd-filter--created_at .daterange_field {
  display: flex;
  align-items: stretch;
  gap: 0.5rem;
}

/* Wagtail styles the two inputs differently; give both the same box. */
.zwd-filter--created_at .daterange_field input {
  flex: 1 1 0;
  margin: 0;
  height: auto;
  padding-block: 0.6rem;
}

/* Checkbox lists read as one compact row that wraps. */
.zwd-filter--channel .w-field__input > div,
.zwd-filter--status .w-field__input > div {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  padding-block-start: 0.4rem;
}

.zwd-filter--channel label,
.zwd-filter--status label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  white-space: nowrap;
}

.zwd-filter--created_at,
.zwd-filter--status {
  grid-column: span 2;
}

@media (max-width: 40rem) {
  .zwd-filter--created_at,
  .zwd-filter--status {
    grid-column: auto;
  }
}

.zwd-filters__note {
  margin-block: 1rem 0;
  font-size: 0.875rem;
}

.zwd-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-block: 0.75rem 0;
}

/* Headline tiles */
.zwd-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(10rem, 100%), 1fr));
  gap: 0.75rem;
  margin-block-end: 1.25rem;
}

.zwd-tile {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.85rem 1rem;
  background: var(--zwd-surface);
  border: 1px solid var(--zwd-border);
  border-radius: 0.5rem;
  color: var(--zwd-text);
  text-decoration: none;
}

.zwd-tile:hover,
.zwd-tile:focus-visible {
  border-color: var(--w-color-border-field-hover, #999);
}

.zwd-tile--critical { border-block-start: 3px solid var(--zwd-critical); }
.zwd-tile--warning { border-block-start: 3px solid var(--zwd-warning); }

.zwd-tile__label { font-size: 0.8125rem; color: var(--zwd-muted); }
.zwd-tile__value { font-size: 1.75rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.zwd-tile__note { font-size: 0.75rem; color: var(--zwd-muted); }

/* Daily stacked columns */
.zwd-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  list-style: none;
  padding: 0;
  margin: 0 0 0.75rem;
  font-size: 0.875rem;
}

.zwd-legend li { display: inline-flex; align-items: center; gap: 0.4rem; }

.zwd-swatch {
  display: inline-block;
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 2px;
}

.zwd-swatch--reached { background: var(--zwd-good); }
.zwd-swatch--unconfirmed { background: var(--zwd-warning); }
.zwd-swatch--failed { background: var(--zwd-critical); }
.zwd-swatch--skipped { background: var(--zwd-neutral); }

.zwd-chart {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  min-height: 12rem;
  padding-block-end: 0.25rem;
}

.zwd-chart__axis {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-self: stretch;
  padding-block-end: 1.5rem;
  font-size: 0.75rem;
  color: var(--zwd-muted);
  font-variant-numeric: tabular-nums;
  padding-inline-end: 0.25rem;
}

.zwd-chart__col {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1 0 1.75rem;
  max-width: 3rem;
}

.zwd-chart__stack {
  height: 10rem;
  width: 100%;
  display: flex;
  flex-direction: column-reverse;
  gap: 2px; /* surface gap between segments */
  border-block-end: 1px solid var(--zwd-border);
}

.zwd-chart__seg {
  display: block;
  width: 100%;
  min-height: 2px;
}

/* Rounded data-end: the top of the stack only. */
.zwd-chart__seg:last-child { border-radius: 4px 4px 0 0; }

.zwd-chart__col:hover .zwd-chart__seg { filter: brightness(1.08); }

.zwd-chart__label {
  font-size: 0.6875rem;
  color: var(--zwd-muted);
  margin-block-start: 0.35rem;
  white-space: nowrap;
}

.zwd-columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(18rem, 100%), 1fr));
  gap: 0 1.25rem;
}

@media (forced-colors: active) {
  .zwd-chart__seg { border: 1px solid CanvasText; }
  .zwd-swatch { border: 1px solid CanvasText; }
}

/* Detail page */
.zwd-h3 {
  font-size: 0.95rem;
  font-weight: 700;
  margin: 1rem 0 0.5rem;
}

.zwd-code {
  font-family: var(--w-font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
  background: color-mix(in srgb, var(--zwd-neutral) 10%, transparent);
  padding: 0.75rem;
  border-radius: 0.25rem;
}

.zwd-links {
  margin: 0;
  padding-inline-start: 1.25rem;
}

.zwd-links li + li {
  margin-block-start: 0.35rem;
}

.zwd-timeline {
  list-style: none;
  margin: 0;
  padding: 0;
}

.zwd-timeline__item {
  display: grid;
  grid-template-columns: minmax(10.5rem, max-content) 1fr;
  gap: 0.15rem 1rem;
  padding: 0.45rem 0 0.45rem 1rem;
  border-inline-start: 3px solid var(--zwd-neutral);
}

.zwd-timeline__item--good { border-inline-start-color: var(--zwd-good); }
.zwd-timeline__item--warning { border-inline-start-color: var(--zwd-warning); }
.zwd-timeline__item--critical { border-inline-start-color: var(--zwd-critical); }

.zwd-timeline__time {
  color: var(--zwd-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.zwd-timeline__item > .zwd-small {
  grid-column: 2;
}

@media (max-width: 40rem) {
  .zwd-timeline__item {
    grid-template-columns: 1fr;
  }

  .zwd-timeline__item > .zwd-small {
    grid-column: 1;
  }
}

/* List cells that must stay on one line ("18 minutes ago", the details button). */
.zwd-nowrap {
  white-space: nowrap;
}

/* ── Concord UI Kit overview (concord_overview.html) ─────────────────────── */
/* Layout only: colours, type and spacing come from the kit's own tokens, so
   the page follows the kit's light and dark themes. */
.zwd-kit {
  align-content: start;
}
.zwd-kit-card {
  display: grid;
  align-content: start;
  gap: var(--cc-space-sm, 8px);
  min-width: 0;
  padding: var(--cc-space-md, 16px);
  border: 1px solid var(--cc-line);
  border-radius: 7px;
  background: var(--cc-panel);
}
.zwd-kit-h2 {
  margin: 0;
  font-size: var(--cc-text-small);
  font-weight: 600;
}
.zwd-kit-muted,
.zwd-kit-note {
  margin: 0;
  color: var(--cc-muted);
  font-size: var(--cc-text-small);
}
.zwd-kit-note {
  display: block;
  margin-top: var(--cc-space-xs, 4px);
}
.zwd-kit-callout {
  margin: 0;
  padding: var(--cc-space-sm, 8px) var(--cc-space-md, 16px);
  border-inline-start: 3px solid var(--cc-line);
}
.zwd-kit-filters {
  display: grid;
  gap: var(--cc-space-sm, 8px);
}
.zwd-kit-filters__summary {
  cursor: pointer;
  font-weight: 600;
}
.zwd-kit-columns {
  display: grid;
  gap: var(--cc-space-md, 16px);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr));
}
.zwd-kit .cc-data-table {
  overflow-x: auto;
}

/* ── "Notifications" side panel on the user editor ────────────────────────── */
.zwd-user-panel {
  display: grid;
  gap: 1rem;
}
/* The stock panel: clear Wagtail's drawer close button, stack the links. */
.zwd.zwd-user-panel {
  padding-top: 2.5rem;
}
.zwd-user-panel .zwd-actions {
  display: grid;
  justify-items: start;
  gap: 0.5rem;
}
.zwd-user-panel .zwd-actions .button {
  margin: 0;
}
.zwd-user-panel__heading {
  margin: 0;
  font-size: 1rem;
}
.zwd-user-panel__list {
  display: grid;
  gap: 0.75rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
