:root {
  color-scheme: light;
  --bg: #f7f8fa;
  --panel: #ffffff;
  --ink: #172026;
  --muted: #65727e;
  --line: #d9e0e6;
  --line-strong: #b9c4cd;
  --accent: #1f7a5a;
  --accent-dark: #155d44;
  --accent-soft: #e3f4ec;
  --warn: #9a5b00;
  --warn-soft: #fff0d6;
  --danger: #a33b3b;
  --danger-soft: #fdecec;
  --info: #2d5f93;
  --info-soft: #e7f0fa;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  font-size: 14px;
}

button,
select,
input {
  font: inherit;
  color: inherit;
}

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 24px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

.brand-logo {
  display: block;
  height: 32px;
  width: auto;
}

.brand-subtitle {
  margin: 0;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.nav {
  display: flex;
  gap: 4px;
}

.nav-link {
  padding: 8px 14px;
  border-radius: 6px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
}

.nav-link:hover {
  background: var(--bg);
  color: var(--ink);
}

.nav-link.active {
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.tz-selector {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  font-weight: 700;
}

.tz-selector select {
  min-height: 32px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
}

.view {
  width: min(1440px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 24px 0 48px;
}

.loading {
  color: var(--muted);
  padding: 24px;
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 12px;
  padding: 14px 16px;
  margin-bottom: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.filter-bar label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}

.filter-bar .grow {
  flex: 1 1 240px;
  min-width: 200px;
}

.filter-bar select,
.filter-bar input {
  min-height: 36px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--ink);
}

.filter-actions {
  display: flex;
  gap: 6px;
}

button {
  min-height: 36px;
  padding: 8px 14px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
  font-weight: 600;
}

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

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

button.ghost:hover {
  background: var(--bg);
}

.result-count {
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.table-wrap {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: auto;
  max-height: calc(100vh - 240px);
}

.table-wrap.tall {
  max-height: calc(100vh - 160px);
}

.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.data-table thead th {
  position: sticky;
  top: 0;
  background: var(--panel);
  border-bottom: 1px solid var(--line-strong);
  padding: 10px 12px;
  text-align: left;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  font-weight: 700;
  z-index: 1;
}

.data-table tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.data-table.dense tbody td {
  padding: 6px 10px;
  font-size: 13px;
}

.data-table tbody tr.case-row {
  cursor: pointer;
}

.data-table tbody tr.case-row:hover {
  background: var(--accent-soft);
}

.data-table tbody tr.msg-actionable td {
  background: var(--accent-soft);
}

.data-table tbody tr.msg-actionable td:first-child {
  box-shadow: inset 3px 0 0 var(--accent);
}

.data-table .nowrap {
  white-space: nowrap;
}

.data-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.messages-table.hide-tech .tech-col {
  display: none;
}

.messages-table td.wide {
  max-width: 360px;
}

.messages-table td.wide .cell-clip {
  max-height: 100px;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

button.ghost.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-dark);
}

.data-table thead th.sortable {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.data-table thead th.sortable:hover {
  background: var(--bg);
  color: var(--ink);
}

/* Active sort: a quiet muted underline + darkened label. Direction (asc/desc)
   lives in the popover, not the header. Muted keeps it distinct from the green
   .has-filter underline; when a column is both sorted and filtered the two
   stack into a double rule (green filter below, muted sort above). */
.data-table thead th.sorted {
  color: var(--ink);
  box-shadow: inset 0 -2px 0 var(--muted);
}

.data-table thead th.sorted.has-filter {
  box-shadow: inset 0 -2px 0 var(--accent), inset 0 -4px 0 var(--muted);
}

/* Header-cell filter dropdown (replaces the standalone filter-bar selects). */

.data-table thead th.filterable .filter-ind {
  display: inline-flex;
  align-items: center;
  margin-left: 6px;
  padding: 2px 4px;
  color: var(--muted);
  border-radius: 4px;
  cursor: pointer;
  user-select: none;
  vertical-align: middle;
}

.data-table thead th.filterable .filter-ind svg {
  display: block;
}

.data-table thead th.filterable .filter-ind:hover {
  background: var(--bg);
  color: var(--ink);
}

.data-table thead th.filterable .filter-ind.active {
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.data-table thead th.has-filter {
  box-shadow: inset 0 -2px 0 var(--accent);
}

.filter-dropdown {
  position: absolute;
  z-index: 50;
  min-width: 240px;
  max-width: 360px;
  padding: 10px;
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(23, 32, 38, 0.16);
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
  text-transform: none;
  letter-spacing: 0;
}

.filter-dropdown .filter-dd-search {
  width: 100%;
  min-height: 30px;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--ink);
  font-weight: 400;
}

.filter-dropdown .filter-dd-actions {
  display: flex;
  gap: 6px;
}

.filter-dropdown .filter-dd-actions button {
  flex: 1 1 0;
  min-height: 28px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 600;
}

.filter-dropdown .filter-dd-list {
  max-height: 260px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.filter-dropdown .filter-dd-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 6px;
  border-radius: 4px;
  cursor: pointer;
  color: var(--ink);
  font-weight: 400;
  text-transform: none;
}

.filter-dropdown .filter-dd-option:hover {
  background: var(--bg);
}

.filter-dropdown .filter-dd-option input[type="checkbox"] {
  margin: 0;
  cursor: pointer;
}

.filter-dropdown .filter-dd-option .label {
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.filter-dropdown .filter-dd-option .count {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
}

.filter-dropdown .filter-dd-empty {
  padding: 6px;
  color: var(--muted);
  font-style: italic;
  font-size: 12px;
}

/* Sort section sits above the filter section inside a single popover. The
 * separator only appears when both are present. */
.filter-dropdown .filter-dd-sort {
  display: flex;
  gap: 6px;
}

.filter-dropdown .filter-dd-sort .sort-btn {
  flex: 1 1 0;
  min-height: 28px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 600;
}

.filter-dropdown .filter-dd-sort .sort-btn.active {
  background: var(--accent-soft);
  color: var(--accent-dark);
  border-color: var(--accent);
}

.filter-dropdown .filter-dd-sep {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 2px 0;
}

.filter-dropdown.date-range {
  min-width: 220px;
}

.filter-dropdown.date-range label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}

.filter-dropdown.date-range input[type="date"] {
  min-height: 30px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--ink);
  font-weight: 400;
  text-transform: none;
}

.chip {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--info-soft);
  color: var(--info);
  font-size: 12px;
  font-weight: 700;
}

.status {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: #edf1f5;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.status-summarized {
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.status-candidate {
  background: var(--info-soft);
  color: var(--info);
}

.status-needs_review {
  background: var(--danger-soft);
  color: var(--danger);
}

.status-repeat_suppressed,
.status-repeat_escalated {
  background: var(--warn-soft);
  color: var(--warn);
}

.case-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
  max-width: 880px;
}

.case-card > header {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.case-card .meta {
  margin: 0 0 24px;
  color: var(--muted);
  font-size: 14px;
}

.case-card .meta .dot {
  margin: 0 6px;
}

.case-card section {
  margin-top: 20px;
}

.case-card h3 {
  margin: 0 0 8px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  font-weight: 700;
}

.case-card .summary {
  margin: 0;
  font-size: 16px;
  line-height: 1.5;
}

.case-card .draft {
  margin: 0;
  padding: 14px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
  font-size: 14px;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.case-card .empty-inline {
  margin: 0;
  color: var(--muted);
  font-style: italic;
}

.back-link {
  display: inline-block;
  margin-bottom: 16px;
  color: var(--info);
  text-decoration: none;
  font-weight: 600;
}

.back-link:hover {
  text-decoration: underline;
}

.page-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 16px;
  padding: 0 4px;
}

.page-header h2 {
  margin: 0;
  font-size: 22px;
}

.page-header .period,
.page-header .result-count {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.page-header .period-note {
  font-size: 11px;
  font-style: italic;
  margin-left: 4px;
}

.totals {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.metric {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.metric strong {
  display: block;
  font-size: 28px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.metric span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}

.aggregations {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 16px;
}

.aggregations article {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.aggregations h3 {
  margin: 0 0 12px;
  font-size: 14px;
}

.data-table.small thead th,
.data-table.small tbody td {
  padding: 8px 10px;
  font-size: 13px;
}

.throughput {
  margin-top: 16px;
  padding: 16px 20px 8px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.throughput header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 8px;
}

.bucket-toggle {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  flex-shrink: 0;
}

.bucket-btn {
  min-height: 30px;
  padding: 6px 14px;
  border: 0;
  border-right: 1px solid var(--line);
  border-radius: 0;
  background: var(--panel);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  cursor: pointer;
}

.bucket-btn:last-child {
  border-right: 0;
}

.bucket-btn:hover:not(.active) {
  background: var(--bg);
  color: var(--ink);
}

.bucket-btn.active {
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.throughput h3 {
  margin: 0 0 4px;
  font-size: 14px;
}

.throughput-meta {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.throughput-svg-wrap {
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-color: var(--line-strong) transparent;
}

.throughput-svg-wrap::-webkit-scrollbar {
  height: 10px;
}

.throughput-svg-wrap::-webkit-scrollbar-track {
  background: var(--bg);
  border-radius: 5px;
}

.throughput-svg-wrap::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border-radius: 5px;
}

.throughput-svg-wrap::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}

.throughput-svg {
  display: block;
  height: 220px;
}

.throughput-svg .axis-line {
  stroke: var(--line-strong);
  stroke-width: 1;
}

.throughput-svg .grid-line {
  stroke: var(--line);
  stroke-width: 1;
  stroke-dasharray: 3 3;
}

.throughput-svg .bar-actionable {
  fill: var(--accent);
  fill-opacity: 0.85;
}

.throughput-svg .bar-non-actionable {
  fill: var(--muted);
  fill-opacity: 0.45;
}

.throughput-svg .bar-hit {
  fill: transparent;
  pointer-events: all;
}

.throughput-svg .bar-stack:hover .bar-actionable {
  fill-opacity: 1;
}

.throughput-svg .bar-stack:hover .bar-non-actionable {
  fill-opacity: 0.7;
}

.throughput-svg .bar-value {
  font-size: 10px;
  fill: var(--ink);
  font-family: inherit;
}

.throughput-svg .axis-label {
  font-size: 11px;
  fill: var(--muted);
  font-family: inherit;
}

.throughput-svg .axis-label.minor {
  font-size: 10px;
  fill: var(--line-strong);
}

.empty-state,
.error-state {
  margin: 32px auto;
  padding: 24px;
  max-width: 640px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  text-align: center;
}

.empty-state h2,
.error-state h2 {
  margin: 0 0 8px;
}

.empty-state p,
.error-state pre {
  color: var(--muted);
}

.error-state pre {
  text-align: left;
  white-space: pre-wrap;
  font-size: 13px;
}

@media (max-width: 720px) {
  .topbar {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .nav {
    overflow-x: auto;
  }
  .view {
    width: min(100vw - 16px, 720px);
  }
  .filter-bar {
    flex-direction: column;
    align-items: stretch;
  }
  .result-count {
    margin-left: 0;
  }
}

/* ----- Outreach (Phase 5) -------------------------------------------- */

.outreach-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 16px;
  height: calc(100vh - 130px);
}

.outreach-sidebar {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.outreach-sidebar-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: var(--panel);
}

.outreach-item {
  display: block;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
  color: var(--ink);
}

.outreach-item:hover {
  background: var(--accent-soft);
}

.outreach-item.selected {
  background: var(--accent-soft);
  border-left: 3px solid var(--accent);
  padding-left: 11px;
}

.outreach-item.closed {
  opacity: 0.6;
}

.outreach-item-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.active-dot {
  color: var(--accent);
  font-size: 16px;
  line-height: 1;
}

.outreach-item-meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.chip.mini {
  font-size: 10px;
  padding: 2px 6px;
}

.outreach-item-preview {
  margin: 4px 0 2px;
  font-size: 12px;
  color: var(--muted);
}

.outreach-item-time {
  margin: 0;
  font-size: 11px;
  color: var(--muted);
}

.outreach-main {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.outreach-placeholder {
  padding: 32px;
  color: var(--muted);
  text-align: center;
  margin: auto;
}

.chat-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  gap: 8px 16px;
}

.chat-header h2 {
  margin: 0 0 6px;
}

.chat-header-main {
  grid-column: 1;
  grid-row: 1;
}

.chat-header-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.chat-header-actions {
  grid-column: 2;
  grid-row: 1;
  display: flex;
  gap: 6px;
  align-items: start;
}

.chat-header-actions .danger {
  color: var(--danger);
  border-color: var(--danger);
}

.chat-case-details {
  grid-column: 1 / -1;
  grid-row: 2;
  border-top: 1px solid var(--line);
  padding-top: 8px;
  font-size: 12px;
}

.chat-case-details summary {
  cursor: pointer;
  color: var(--muted);
  font-weight: 600;
}

.chat-case-details pre.draft {
  background: var(--bg);
  padding: 8px;
  border-radius: 6px;
  white-space: pre-wrap;
  margin: 4px 0;
}

.badge-active {
  background: var(--accent);
  color: white;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
}

.chat-thread {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bubble-row {
  display: flex;
}

.bubble-row.from-agent {
  justify-content: flex-start;
}

.bubble-row.from-driver {
  justify-content: flex-end;
}

.bubble {
  max-width: 70%;
  padding: 8px 12px;
  border-radius: 14px;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.05);
}

.from-agent .bubble {
  background: var(--panel);
  border: 1px solid var(--line);
  border-bottom-left-radius: 4px;
}

.from-driver .bubble {
  background: var(--accent-soft);
  border: 1px solid #c9e8d8;
  border-bottom-right-radius: 4px;
}

.bubble-text {
  white-space: pre-wrap;
  word-wrap: break-word;
}

.bubble-subtitle {
  margin-top: 4px;
  font-style: italic;
  color: var(--muted);
  font-size: 12px;
  border-top: 1px dashed var(--line);
  padding-top: 4px;
}

.bubble-meta {
  margin-top: 4px;
  font-size: 10px;
  color: var(--muted);
}

.chat-composer {
  border-top: 1px solid var(--line);
  padding: 12px;
  display: flex;
  gap: 8px;
  background: var(--panel);
}

.chat-composer textarea {
  flex: 1;
  resize: vertical;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  font-family: inherit;
}

.chat-composer textarea:disabled {
  background: var(--bg);
  color: var(--muted);
}

.outreach-cta {
  margin-top: 16px;
  display: flex;
  gap: 12px;
  align-items: center;
}

.outreach-cta .muted,
.outreach-cta #start-outreach-msg {
  color: var(--muted);
  font-size: 12px;
}

button.primary {
  background: var(--accent);
  color: white;
  border: 1px solid var(--accent-dark);
  padding: 8px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
}

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

button.primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ----- Usage / cost ledger ------------------------------------------- */

.status-ok {
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.status-failed {
  background: var(--danger-soft);
  color: var(--danger);
}

.usage-runs-head {
  margin: 24px 4px 12px;
  font-size: 16px;
}

.usage-note {
  max-width: 360px;
  color: var(--muted);
  font-size: 12px;
  word-break: break-word;
}

/* ----- Issues (layer 3: problem aggregation) ------------------------- */

.issue-note {
  margin: 0 4px 16px;
  color: var(--muted);
  font-size: 12px;
}

.issue-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 10px;
  overflow: hidden;
}

.issue-card[open] {
  border-color: var(--line-strong);
}

.issue-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  list-style: none;
}

.issue-summary::-webkit-details-marker {
  display: none;
}

.issue-summary:hover {
  background: var(--bg);
}

.issue-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

.issue-counts {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.issue-counts strong {
  color: var(--ink);
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

.issue-counts .dot {
  margin: 0 6px;
}

.issue-card .table-wrap {
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  max-height: 360px;
}

/* Messages pagination (numbered pages with ellipsis). */
.pagination {
  display: flex;
  gap: 4px;
  align-items: center;
  justify-content: center;
  margin-top: 12px;
  flex-wrap: wrap;
}
.pagination button,
.pagination .pagi-ellipsis {
  min-width: 36px;
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  user-select: none;
}
.pagination button:hover:not(:disabled):not(.active) {
  background: var(--bg);
}
.pagination button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.pagination .pagi-num.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
  cursor: default;
}
.pagination .pagi-ellipsis {
  border: 0;
  background: transparent;
  cursor: default;
  color: var(--muted);
}

/* ----------------------------------------------------------------------- */
/* Pulse landing screen (docs/web-ui-redesign.md)                          */
/* ----------------------------------------------------------------------- */
.pulse-periodbar { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.pulse-presets { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.period-chip {
  padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--panel); color: var(--muted); cursor: pointer; font-size: 13px;
}
.period-chip:hover { border-color: var(--line-strong); color: var(--ink); }
.period-chip.active { background: var(--accent-soft); color: var(--accent-dark); border-color: var(--accent); }
.pulse-range-label { margin-left: 8px; color: var(--muted); font-size: 12px; }

.pulse-calendar { min-height: 22px; }
.cal-track { display: flex; gap: 3px; align-items: flex-end; flex-wrap: wrap; }
.cal-cell {
  width: 14px; height: 14px; border-radius: 3px; border: 1px solid var(--line);
  background: var(--bg); cursor: pointer; padding: 0;
}
.cal-cell:hover { outline: 2px solid var(--accent-soft); }
.cal-cell.selected { outline: 2px solid var(--accent); }
.cal-cell.lvl-0 { background: #eef1f4; }
.cal-cell.lvl-1 { background: #cdeadd; }
.cal-cell.lvl-2 { background: #8fd3b4; }
.cal-cell.lvl-3 { background: #4fae84; }
.cal-cell.lvl-4 { background: var(--accent); }
.cal-empty { color: var(--muted); font-size: 12px; }

.pulse-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(300px, 1fr);
  grid-template-rows: auto auto;
  grid-template-areas: "c a" "b a";
  gap: 16px;
  align-items: start;
}
.pulse-c { grid-area: c; }
.pulse-b { grid-area: b; overflow-x: auto; }
.pulse-a { grid-area: a; align-self: stretch; max-height: calc(100vh - 220px); overflow-y: auto; }

.pulse-c-head, .pulse-b-head, .pulse-a-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 12px; flex-wrap: wrap;
}
.pulse-c-head h2, .pulse-b-head h2, .pulse-a-head h2 { margin: 0; font-size: 18px; }

.funnel { display: flex; gap: 6px; flex-wrap: wrap; }
.funnel-pill {
  font-size: 12px; padding: 2px 9px; border-radius: 999px;
  background: var(--bg); border: 1px solid var(--line);
}
.funnel-pill.conf-confirmed { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-dark); }
.funnel-pill.conf-observed { background: var(--info-soft); border-color: var(--info); color: var(--info); }
.funnel-pill.conf-suspected { background: var(--bg); color: var(--muted); }

.narrative {
  background: var(--accent-soft); border: 1px solid var(--accent);
  border-radius: 8px; padding: 14px 16px; margin-bottom: 16px;
}
.narrative-text { margin: 0; color: var(--ink); line-height: 1.5; }
.narrative-text.muted { color: var(--muted); }
.narrative-meta { margin: 8px 0 0; font-size: 11px; color: var(--muted); }

.cloud { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.cloud-tag {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 11px; border-radius: 999px; text-decoration: none;
  border: 1px solid var(--line); background: var(--panel); color: var(--ink); line-height: 1.3;
}
.cloud-tag:hover { border-color: var(--line-strong); }
.cloud-tag .cloud-count {
  font-size: 11px; font-weight: 700; padding: 0 6px; border-radius: 999px;
  background: var(--bg); color: var(--muted);
}
.cloud-tag.conf-confirmed { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-dark); }
.cloud-tag.conf-confirmed .cloud-count { background: var(--accent); color: #fff; }
.cloud-tag.conf-observed { border-color: var(--info); background: var(--info-soft); color: var(--info); }
.cloud-tag.conf-observed .cloud-count { background: var(--info); color: #fff; }
.cloud-tag.conf-suspected { border-color: var(--line); color: var(--muted); }

.totals.compact { gap: 8px; }
.totals.compact .metric { padding: 10px 12px; }
.totals.compact .metric strong { font-size: 20px; }
.pulse-byissue { margin-top: 12px; }
.pulse-chart { margin-top: 12px; }

.settings-card { margin-bottom: 16px; }
.settings-card h3 { margin-top: 0; }
.tz-selector.inline { display: inline-flex; flex-direction: row; align-items: center; gap: 8px; }
.tz-selector.inline select { min-height: 32px; border: 1px solid var(--line); border-radius: 6px; padding: 4px 8px; }
.error-inline { color: var(--danger); font-size: 13px; }

@media (max-width: 1024px) {
  .pulse-grid { grid-template-columns: 1fr; grid-template-areas: "c" "b" "a"; }
  .pulse-a { max-height: none; }
}
