/* ── Hygiene (js/hygiene.js) ─────────────────────────────────────────────────
   One list of everything the system left for a person: area tiles, filter
   pills, then priority sections → kind groups → rows with one-click actions.
   Token-only colours, so css/dark.css needs no overrides here. */

.hy-view { padding-bottom: 90px; }

/* Area tiles: count + dollars at stake; click to filter */
.hy-stats {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}
.hy-stat {
  appearance: none; font: inherit; text-align: left; cursor: pointer;
  display: flex; flex-direction: column; gap: 2px; min-width: 0;
  padding: 12px 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  color: var(--text-primary);
  transition: transform var(--dur-fast) ease, border-color var(--dur-fast) ease, box-shadow var(--dur-fast) ease;
}
.hy-stat:hover { transform: translateY(-1px); border-color: rgba(var(--brand-primary-rgb), 0.4); box-shadow: var(--shadow-hover); }
.hy-stat:focus-visible { outline: 2px solid var(--brand-primary); outline-offset: 2px; }
.hy-stat.active { border-color: var(--brand-primary); box-shadow: 0 0 0 2px rgba(var(--brand-primary-rgb), 0.18); }
.hy-stat-label {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 600; letter-spacing: var(--tracking-caps); text-transform: uppercase;
  color: var(--text-tertiary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.hy-stat-num {
  font-family: var(--font-display); font-size: 24px; font-weight: 700; line-height: 1.15;
  letter-spacing: var(--tracking-tight); font-variant-numeric: tabular-nums;
}
.hy-stat-sub { font-size: 12px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hy-stat.urgent .hy-stat-num { color: var(--status-danger); }
.hy-stat.clear .hy-stat-num { color: var(--status-success); }
.hy-stat.clear .hy-stat-num .ui-icon { width: 22px; height: 22px; }

/* Toolbar */
.hy-toolbar { row-gap: 10px; }
.hy-pill-n { margin-left: 4px; font-variant-numeric: tabular-nums; opacity: 0.7; }
.hy-check {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--text-secondary); cursor: pointer; user-select: none; white-space: nowrap;
}
.hy-check input { accent-color: var(--brand-primary); }

/* Priority sections */
.hy-body { position: relative; min-height: 120px; }
.hy-section { margin: 0 0 var(--space-6); }
.hy-section-head { margin: 0 0 var(--space-3); }
.hy-section-title {
  display: flex; align-items: center; gap: 8px; margin: 0;
  font-family: var(--font-display); font-size: 16px; font-weight: 600; color: var(--text-primary);
}
.hy-section-title::before {
  content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--text-tertiary); flex-shrink: 0;
}
.hy-p1 .hy-section-title::before { background: var(--status-danger); }
.hy-p2 .hy-section-title::before { background: var(--brand-primary); }
.hy-section-n {
  font-size: 12px; font-weight: 600; color: var(--text-secondary);
  background: var(--surface-sunken); border-radius: 999px; padding: 1px 8px; font-variant-numeric: tabular-nums;
}
.hy-section-sub { margin: 2px 0 0 16px; font-size: 12.5px; color: var(--text-secondary); }

/* Kind groups: one card each */
.hy-group {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--space-3);
  overflow: hidden;
}
.hy-group-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  padding: 10px 16px; background: var(--bg-elevated); border-bottom: 1px solid var(--border-subtle);
}
.hy-group-title { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.hy-group-meta { font-size: 12px; color: var(--text-tertiary); font-variant-numeric: tabular-nums; white-space: nowrap; }

.hy-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  border-top: 1px solid var(--border-subtle);
  transition: background var(--dur-fast) ease, opacity var(--dur-fast) ease;
}
.hy-rows .hy-row:first-child { border-top: 0; }
.hy-row:hover { background: var(--surface-hover); }
.hy-row.busy { opacity: 0.55; pointer-events: none; }
.hy-row-main { min-width: 0; }
.hy-row-title { font-size: 13.5px; font-weight: 600; color: var(--text-primary); line-height: 1.35; overflow-wrap: anywhere; }
.hy-row-detail { margin-top: 2px; font-size: 12.5px; color: var(--text-secondary); line-height: 1.45; overflow-wrap: anywhere; }
.hy-row-hint { margin-top: 3px; font-size: 11.5px; color: var(--text-tertiary); }
/* Failed PO email: is its order already in the system? (js/hygiene.js _hyEmailPOHint) */
.hy-po-in      { color: #047857; font-weight: 600; }
.hy-po-missing { color: #b45309; font-weight: 600; }
.hy-link { border: 0; background: none; padding: 0; font: inherit; font-weight: 600; color: var(--brand-primary); cursor: pointer; }
.hy-link:hover { text-decoration: underline; }
.hy-row-side { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; min-width: 84px; }
.hy-row-amt { font-family: var(--font-display); font-weight: 600; font-size: 13.5px; color: var(--text-primary); font-variant-numeric: tabular-nums; white-space: nowrap; }
.hy-row-when { font-size: 11.5px; color: var(--text-tertiary); white-space: nowrap; }
.hy-row-acts { display: flex; align-items: center; justify-content: flex-end; gap: 6px; flex-wrap: wrap; }
.hy-row-acts .btn-sm { white-space: nowrap; max-width: 220px; overflow: hidden; text-overflow: ellipsis; }

.hy-icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: var(--control-h-sm); height: var(--control-h-sm);
  border: 1px solid var(--border-default); border-radius: var(--control-radius);
  background: var(--bg-surface); color: var(--text-tertiary); cursor: pointer; font-size: 14px;
  transition: color var(--dur-fast) ease, border-color var(--dur-fast) ease;
}
.hy-icon-btn:hover { color: var(--brand-primary); border-color: rgba(var(--brand-primary-rgb), 0.4); }
.hy-icon-btn:focus-visible { outline: 2px solid var(--brand-primary); outline-offset: 2px; }

.hy-more {
  display: block; width: 100%; padding: 9px 16px;
  border: 0; border-top: 1px solid var(--border-subtle); background: transparent; cursor: pointer;
  font: inherit; font-size: 12.5px; font-weight: 600; color: var(--brand-primary); text-align: left;
}
.hy-more:hover { background: var(--surface-hover); }

.hy-empty .btn { margin-top: var(--space-3); }

@media (max-width: 1100px) {
  .hy-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 768px) {
  .hy-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-2); }
  .hy-stat { padding: 10px 12px; }
  .hy-stat-num { font-size: 20px; }
  .hy-row { grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; padding: 12px; }
  .hy-row-acts { grid-column: 1 / -1; justify-content: flex-start; }
  .hy-group-head { padding: 10px 12px; }
  .hy-section-sub { margin-left: 0; }
}
