/* Deadline-domain styles (P2). Layered ON TOP of ovg.css — tokens + base
 * components come from there; this file adds only the deadline-specific pieces
 * (summary stat cards, urgency groups, deadline rows, the /all filter bar,
 * type-count chips). ovg.css is frozen, so every new class lives here.
 *
 * CSP-safe: no inline styles anywhere; state colors always ride with a text
 * label (SPEC §5). All color pairs reuse ovg.css's AA-verified tokens; the two
 * extra chips below were contrast-checked (upcoming navy-on-#e7edf7 ≈ 11:1,
 * cancelled #5a6a85-on-#eceef3 = 4.72:1 — both clear WCAG AA). */

/* ---------- status chips (extend .badge) ---------- */

.chip {
  vertical-align: middle;
}

.chip-upcoming {
  background: #e7edf7;
  color: var(--navy);
  border-color: rgba(28, 53, 94, 0.18);
}

.chip-cancelled {
  background: #eceef3;
  color: var(--text-secondary);
  border-color: rgba(28, 53, 94, 0.16);
  text-decoration: line-through;
}

/* ---------- summary stat cards ---------- */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 4px 0 4px;
}

.stat-card {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 16px 14px;
  background: #fff;
  border: 1px solid rgba(28, 53, 94, 0.08);
  border-left: 4px solid var(--navy);
  border-radius: var(--radius-card);
  box-shadow:
    0 1px 2px rgba(28, 53, 94, 0.06),
    0 10px 28px rgba(28, 53, 94, 0.05);
  text-decoration: none;
  color: var(--text-primary);
  min-height: 44px;
}

.stat-card:hover,
.stat-card:focus-visible {
  background: #f8fafd;
}

.stat-card:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.stat-overdue {
  border-left-color: var(--danger-text);
}

.stat-due-today {
  border-left-color: var(--warning-text);
}

.stat-week {
  border-left-color: var(--gold-dark);
}

.stat-num {
  font-size: 30px;
  font-weight: 700;
  line-height: 1.1;
  color: var(--navy);
  font-variant-numeric: tabular-nums;
}

.stat-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

@media (max-width: 520px) {
  .stat-num {
    font-size: 24px;
  }

  .stat-label {
    font-size: 11px;
  }

  .stat-card {
    padding: 12px 10px;
  }
}

/* ---------- urgency groups + deadline rows ---------- */

.group {
  margin-top: 22px;
}

.group-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 10px;
}

.group-title {
  font-size: 15px;
  margin: 0;
}

.group-accent {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  flex: 0 0 auto;
  background: var(--navy);
}

.group-overdue .group-accent {
  background: var(--danger-text);
}

.group-due-today .group-accent {
  background: var(--warning-text);
}

.group-upcoming .group-accent {
  background: var(--gold-dark);
}

.group-owned .group-accent {
  background: var(--navy, var(--gold-dark));
}

.group-count {
  color: var(--text-secondary);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

/* Section-header urgency chips (the "Owned by me" lens). Deliberately smaller
 * and lighter than .stat-card — these annotate a section, they don't compete
 * with the summary cards above. Every pair below is one of ovg.css's already
 * AA-verified combinations: #991b1b on #fde9e9 ≈ 8.9:1, #92400e on #fef4e6 ≈
 * 7.6:1, navy #1c355e on #e7edf7 ≈ 11:1 — all well past the 4.5:1 floor. */
.group-chips {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
}

.group-chip {
  font-size: 11px;
  font-weight: 600;
  line-height: 1.6;
  padding: 0 8px;
  border-radius: 999px;
  border: 1px solid transparent;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* The owned section's deep link into the department board's owned scope
 * (gate P2 pass-3 PD-9). Navy on the page background clears AA by a mile. */
.group-link {
  margin-left: auto;
  font-size: 12px;
  font-weight: 600;
  color: var(--navy, #1c355e);
  text-decoration: none;
  white-space: nowrap;
}

.group-link:hover,
.group-link:focus {
  text-decoration: underline;
}

.group-chip--overdue {
  background: var(--danger-bg);
  color: var(--danger-text);
  border-color: rgba(153, 27, 27, 0.22);
}

.group-chip--due-today {
  background: var(--warning-bg);
  color: var(--warning-text);
  border-color: rgba(146, 64, 14, 0.22);
}

.group-chip--week {
  background: #e7edf7;
  color: var(--navy);
  border-color: rgba(28, 53, 94, 0.18);
}

.deadline-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.deadline-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  background: #fff;
  border: 1px solid rgba(28, 53, 94, 0.08);
  border-radius: var(--radius-card);
  box-shadow: 0 1px 2px rgba(28, 53, 94, 0.05);
  padding: 14px;
}

.deadline-main {
  flex: 1 1 auto;
  min-width: 0;
}

.deadline-title {
  display: inline-block;
  font-weight: 600;
  color: var(--navy);
  text-decoration: none;
  font-size: 15px;
  word-break: break-word;
}

.deadline-title:hover,
.deadline-title:focus-visible {
  text-decoration: underline;
}

.deadline-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.deadline-date {
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 600;
}

.deadline-progress {
  color: var(--text-secondary);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.deadline-owner {
  color: var(--text-secondary);
  font-size: 13px;
  word-break: break-word;
}

.deadline-flag {
  color: var(--warning-text);
  font-size: 12px;
  font-weight: 700;
}

.deadline-action {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.done-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--success-text);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

@media (max-width: 520px) {
  .deadline-item {
    flex-direction: column;
  }

  .deadline-action {
    align-items: stretch;
    width: 100%;
  }

  .deadline-action .btn-primary,
  .deadline-action .btn-secondary {
    width: 100%;
  }
}

/* ---------- /all filter bar + type counts ---------- */

.filter-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.filter-grid .filter-wide {
  grid-column: 1 / -1;
}

@media (max-width: 520px) {
  .filter-grid {
    grid-template-columns: 1fr;
  }
}

.filter-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.type-counts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.type-count {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--navy);
  background: #fff;
  border: 1px solid var(--border-navy-strong);
  border-radius: 999px;
  padding: 6px 12px;
  min-height: 36px;
  cursor: pointer;
}

.type-count:hover,
.type-count:focus-visible {
  background: #f4f7fc;
}

.type-count[aria-pressed="true"] {
  background: var(--navy);
  color: #fff;
  border-color: var(--navy-dark);
}

.type-count .type-count-n {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.results-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin: 18px 0 10px;
}

.results-count {
  color: var(--text-secondary);
  font-size: 13px;
}

.overflow-note {
  color: var(--warning-text);
  background: var(--warning-bg);
  border: 1px solid rgba(146, 64, 14, 0.22);
  border-radius: var(--radius-button);
  padding: 8px 12px;
  font-size: 13px;
  margin: 10px 0 0;
}

/* ---------- collapsible filter panel (design pass 2026-08-04) ---------- */

/* <details> gets card styling from .card; these rules make the closed state
 * read as a single tidy bar rather than a card with a stray heading in it. */
.filter-panel {
  padding: 0;
}

.filter-summary {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 18px;
  cursor: pointer;
  list-style: none;
  border-radius: var(--radius-card);
  user-select: none;
}

/* Replace the default triangle with a chevron that rotates on open, so the
 * affordance is unmistakable and matches the brand rather than the browser. */
.filter-summary::-webkit-details-marker {
  display: none;
}

.filter-summary::after {
  content: "";
  margin-left: auto;
  width: 9px;
  height: 9px;
  border-right: 2px solid var(--text-secondary);
  border-bottom: 2px solid var(--text-secondary);
  transform: rotate(45deg) translate(-2px, -2px);
  transition: transform 0.15s ease;
}

.filter-panel[open] > .filter-summary::after {
  transform: rotate(-135deg) translate(-2px, -2px);
}

.filter-summary:hover {
  background: #f8fafd;
}

.filter-summary:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: -2px;
}

.filter-hint {
  font-size: 13px;
  color: var(--text-secondary);
}

/* A gold left edge when filters are narrowing the list — the same "only mark
 * deviations from the default" rule the status chips follow. */
.filter-panel-active {
  border-left: 3px solid var(--gold);
}

.filter-panel-active .filter-hint {
  color: var(--gold-dark);
  font-weight: 600;
}

.filter-panel > .gold-rule,
.filter-panel > .filter-grid {
  margin-left: 18px;
  margin-right: 18px;
}

.filter-panel > .filter-grid {
  padding-bottom: 18px;
}

/* By-type chips as a plain row rather than a card (see all.html). */
.type-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.type-row-title {
  margin: 0;
  font-size: 11px;
  flex: 0 0 auto;
}

.type-row .type-counts {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* The h2 inside <summary> keeps the outline, but needs its default block
 * margins removed so it sits on the summary's baseline row. */
.filter-summary .section-title {
  margin: 0;
  flex: 0 0 auto;
}
