/* Custom styles — Pico CSS handles almost everything. */

/* -- Global button sizing (Pico default ~42px is too tall for a data-dense admin UI) --
   Pico sets button[type=submit]{width:100%} with specificity 0,1,1.
   We must match that specificity to override it. */
button,
button[type=submit],
button[type=button],
button[type=reset],
input[type="submit"],
input[type="button"],
input[type="reset"] {
  padding-block: 0.4rem;
  padding-inline: 1rem;
  font-size: 0.9rem;
  width: auto;
  margin-bottom: 0;
}
a[role="button"],
label[role="button"] {
  padding: 0.4rem 1rem;
  font-size: 0.9rem;
  white-space: nowrap;
}
/* nav a[role="button"] in base.html has higher specificity (nav prefix) and keeps its own sizing */

/* -- Severity badges -- */
.severity-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 0.25rem;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.severity-error   { background: #dc3545; color: #fff; }
.severity-warning { background: #e67e22; color: #fff; }
.severity-info    { background: #3498db; color: #fff; }

/* -- Discrepancy review status -- */
.disc-status {
  display: inline-block;
  padding: 0.1rem 0.4rem;
  border-radius: 0.2rem;
  font-size: 0.75rem;
  font-weight: 600;
}
.disc-status-open     { background: #e9ecef; color: #495057; }
.disc-status-reviewed { background: #d4edda; color: #155724; }
.disc-status-expected { background: #cce5ff; color: #004085; }

/* -- Stat cards -- */
.disc-stat-card {
  text-align: center;
  padding: 0.75rem 0.5rem;
}
.disc-stat-card strong { display: block; font-size: 1.5rem; }
.disc-stat-card small  { color: var(--pico-muted-color); }

/* -- Filter bar -- */
.disc-filters { margin-bottom: 1rem; }
.disc-filters select { margin-bottom: 0; }

/* -- Discrepancy table -- */
.disc-table { font-size: 0.88rem; }
.disc-table td, .disc-table th { padding: 0.4rem 0.6rem; vertical-align: top; }
.disc-table code { font-size: 0.82rem; word-break: break-word; }

/* -- Inline annotation form -- */
.disc-actions { position: relative; }
.disc-action-btn { padding: 0.2rem 0.5rem; font-size: 0.8rem; margin: 0; }
.disc-actions form {
  position: absolute;
  right: 0;
  z-index: 10;
  background: var(--pico-background-color);
  border: 1px solid var(--pico-muted-border-color);
  border-radius: var(--pico-border-radius);
  padding: 0.75rem;
  min-width: 240px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}
.disc-actions form label { margin-bottom: 0.4rem; }
.disc-save-btn { padding: 0.3rem 0.8rem; font-size: 0.8rem; }

/* -- Progress detail -- */
.stage-detail {
  text-align: center;
  font-size: 0.85rem;
  color: var(--pico-muted-color);
  margin-top: -0.5rem;
  font-style: italic;
}

/* -- Delete run -- */
.delete-run { margin-top: 2rem; }
.delete-run summary { width: auto; display: inline-block; }
.delete-confirm-btn {
  background: var(--pico-del-color);
  border-color: var(--pico-del-color);
  font-size: 0.85rem;
}

/* -- Config saved flash -- */
@keyframes saved-highlight {
  0%   { background-color: #d4edda; }
  100% { background-color: transparent; }
}
.saved-flash {
  animation: saved-highlight 1.5s ease-out;
}

/* -- Comparison styles -- */
.compare-up   { color: #28a745; }
.compare-down { color: #dc3545; }
.compare-changed { background: #fffde7; }
.compare-new     { background: #e8f5e9; }
.compare-removed { background: #ffebee; }
.compare-total-card { text-align: center; }
.compare-store-table { font-size: 0.88rem; }
.compare-store-table td { padding: 0.4rem 0.6rem; }

/* -- Trend chart -- */
.trend-chart {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 200px;
  padding: 0.5rem 0;
  border-bottom: 2px solid var(--pico-muted-border-color);
  margin-bottom: 1.5rem;
  overflow-x: auto;
}
.trend-bar-wrapper {
  flex: 1;
  min-width: 36px;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  justify-content: flex-end;
}
.trend-bar {
  width: 100%;
  max-width: 48px;
  background: var(--pico-primary);
  border-radius: 3px 3px 0 0;
  position: relative;
  min-height: 4px;
  transition: height 0.3s;
}
.trend-bar-disc {
  background: #e67e22;
}
.trend-bar-value {
  position: absolute;
  top: -1.3rem;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.65rem;
  white-space: nowrap;
  color: var(--pico-muted-color);
}
.trend-bar-label {
  font-size: 0.65rem;
  margin-top: 4px;
  color: var(--pico-muted-color);
  white-space: nowrap;
}

/* -- Audit trail -- */
.audit-timeline {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.audit-event {
  border: 1px solid var(--pico-muted-border-color);
  border-radius: var(--pico-border-radius);
  padding: 0;
}
.audit-event summary {
  padding: 0.6rem 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  font-size: 0.88rem;
  cursor: pointer;
}
.audit-timestamp {
  color: var(--pico-muted-color);
  font-size: 0.8rem;
  min-width: 8rem;
  font-variant-numeric: tabular-nums;
}
.audit-badge {
  font-size: 0.75rem;
  padding: 0.1rem 0.4rem;
  border-radius: 0.2rem;
  font-weight: 600;
}
.audit-badge-run    { background: #cce5ff; color: #004085; }
.audit-badge-config { background: #fff3cd; color: #856404; }
.audit-action {
  font-size: 0.75rem;
  padding: 0.1rem 0.4rem;
  border-radius: 0.2rem;
  font-weight: 600;
}
.audit-action-create { background: #d4edda; color: #155724; }
.audit-action-update { background: #fff3cd; color: #856404; }
.audit-action-delete { background: #f8d7da; color: #721c24; }
.audit-summary { flex: 1; }
.audit-user {
  color: var(--pico-muted-color);
  font-size: 0.8rem;
}
.audit-detail {
  padding: 0.75rem;
  border-top: 1px solid var(--pico-muted-border-color);
  font-size: 0.88rem;
}
.audit-detail dl { margin: 0; }
.audit-detail dt { font-weight: 600; display: inline; }
.audit-detail dt::after { content: ': '; }
.audit-detail dd { display: inline; margin: 0 1rem 0 0; }
.audit-error { color: #dc3545; }
.audit-changes { margin: 0; padding-left: 1.2rem; }
.audit-changes li { font-size: 0.85rem; }
