/* ═══════════════════════════════════════════════════════════════════════════
   HC view v2 - KPI strip, filter chips, priority rails, mini stage chains,
   approval trail, type/aging/status pills.
   Scope: .hc-v2-* classes only. Legacy .hc-item / .detail-grid stays for
   any other callers.
   ═══════════════════════════════════════════════════════════════════════════ */

#hc-list, #hc-detail { font-family: 'IBM Plex Sans', sans-serif; color: #111827; }

/* Override legacy width to give the v2 list room for the rich item layout */
#hc-list { width: 460px; }
@media (max-width: 1100px) { #hc-list { width: 400px; } }
@media (max-width: 900px)  { #hc-list { width: 100%; } }

/* ── Page head ─────────────────────────────────────────────────────────── */
.hc-v2-head {
  padding: 16px 18px 12px;
  background: #FFFFFF;
  border-bottom: 1px solid #E5E7EB;
  position: sticky;
  top: 0;
  z-index: 5;
}
.hc-v2-head h3 {
  font-size: 14px;
  font-weight: 800;
  color: #111827;
  margin: 0;
  letter-spacing: -0.01em;
}
.hc-v2-head p {
  font-size: 10.5px;
  color: #6B7280;
  margin: 2px 0 0;
  font-weight: 600;
}

/* ── KPI strip ─────────────────────────────────────────────────────────── */
.hc-v2-kpis {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  padding: 12px;
  background: #FAFAFA;
  border-bottom: 1px solid #E5E7EB;
}
.hc-v2-kpi {
  background: #FFFFFF;
  border: 1px solid #E5E7EB;
  border-radius: 8px;
  border-left: 3px solid #D1D5DB;
  padding: 10px 12px;
}
.hc-v2-kpi-info   { border-left-color: #1565C0; }
.hc-v2-kpi-budget { border-left-color: #059669; }
.hc-v2-kpi-age    { border-left-color: #6B7280; }
.hc-v2-kpi-ok     { border-left-color: #059669; }
.hc-v2-kpi-bad    { border-left-color: #DC2626; }
.hc-v2-kpi-val {
  font-size: 20px;
  font-weight: 800;
  color: #111827;
  letter-spacing: -0.02em;
  line-height: 1;
}
.hc-v2-kpi-info   .hc-v2-kpi-val { color: #1565C0; }
.hc-v2-kpi-budget .hc-v2-kpi-val { color: #059669; }
.hc-v2-kpi-bad    .hc-v2-kpi-val { color: #DC2626; }
.hc-v2-kpi-ok     .hc-v2-kpi-val { color: #059669; }
.hc-v2-kpi-lbl {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #6B7280;
  margin-top: 4px;
}
.hc-v2-kpi-sub {
  font-size: 9.5px;
  color: var(--muted-text);
  margin-top: 2px;
  font-weight: 600;
}
/* Budget-pending tile: base vs fully-loaded, side by side. */
.hc-v2-kpi-budget-split {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.hc-v2-kpi-budget-cell {
  flex: 1 1 0;
  min-width: 0;
}
.hc-v2-kpi-budget-cell + .hc-v2-kpi-budget-cell {
  border-left: 1px solid #E5E7EB;
  padding-left: 10px;
}
.hc-v2-kpi-budget-amt {
  font-size: 17px;
  font-weight: 800;
  color: #059669;
  letter-spacing: -0.02em;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hc-v2-kpi-budget-amt-loaded { color: #047857; }
.hc-v2-kpi-budget-cap {
  font-size: 8.5px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #6B7280;
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Filter bar ────────────────────────────────────────────────────────── */
.hc-v2-filter {
  padding: 10px 12px;
  background: #FFFFFF;
  border-bottom: 1px solid #E5E7EB;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.hc-v2-filter-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.hc-v2-filter-label {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #6B7280;
  flex: 0 0 50px;
}
.hc-v2-chips {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  flex: 1;
  min-width: 0;
}
.hc-v2-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 11px;
  border: 1px solid #D1D5DB;
  background: #FFFFFF;
  font-size: 10.5px;
  font-weight: 700;
  color: #4B5563;
  cursor: pointer;
  transition: all 0.12s ease;
  font-family: inherit;
  white-space: nowrap;
}
.hc-v2-chip:hover {
  background: #F3F4F6;
  border-color: var(--muted-text);
  color: #111827;
}
.hc-v2-chip-active {
  background: var(--orange);
  border-color: var(--orange);
  color: var(--black);
}
.hc-v2-chip-count {
  font-size: 9.5px;
  font-weight: 800;
  padding: 0 5px;
  border-radius: 7px;
  background: rgba(0,0,0,0.06);
  min-width: 16px;
  text-align: center;
}
.hc-v2-chip-active .hc-v2-chip-count { background: rgba(0,0,0,0.14); }

.hc-v2-filter-search {
  position: relative;
  display: flex;
  align-items: center;
}
.hc-v2-filter-search-icon {
  position: absolute;
  left: 9px;
  font-size: 13px;
  color: var(--muted-text);
  pointer-events: none;
}
.hc-v2-filter-search-input {
  width: 100%;
  padding: 6px 12px 6px 28px;
  border: 1px solid #D1D5DB;
  border-radius: 6px;
  font-size: 11.5px;
  font-family: inherit;
  background: #FFFFFF;
  color: #111827;
  outline: none;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.hc-v2-filter-search-input:focus {
  border-color: #1565C0;
  box-shadow: 0 0 0 2px rgba(21,101,192,0.15);
}

/* ── List items ────────────────────────────────────────────────────────── */
.hc-v2-items {
  background: #FFFFFF;
}
.hc-v2-item {
  display: flex;
  align-items: stretch;
  gap: 0;
  border-bottom: 1px solid #F3F4F6;
  cursor: pointer;
  transition: background 0.12s ease;
  position: relative;
}
.hc-v2-item:hover { background: #FFFBEB; }
.hc-v2-item-active {
  background: #FEF3C7;
}
.hc-v2-item-active:hover { background: #FDE68A; }
.hc-v2-item-rail {
  flex: 0 0 4px;
  align-self: stretch;
}
.hc-v2-item-body {
  flex: 1;
  min-width: 0;
  padding: 10px 14px 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.hc-v2-item-row1 {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.hc-v2-item-title {
  font-size: 12px;
  font-weight: 700;
  color: #111827;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.hc-v2-item-row2 {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 10.5px;
  color: #6B7280;
}
.hc-v2-item-meta {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.hc-v2-item-row3 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 2px;
}
.hc-v2-item-budget {
  font-size: 11px;
  font-weight: 800;
  color: #065F46;
  font-variant-numeric: tabular-nums;
}

/* ── Type / status / aging pills ───────────────────────────────────────── */
.hc-v2-type-chip {
  display: inline-block;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.04em;
  padding: 2px 7px;
  border-radius: 10px;
  white-space: nowrap;
  flex: 0 0 auto;
}
.hc-v2-status-pill {
  display: inline-block;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  padding: 3px 9px;
  border-radius: 11px;
  white-space: nowrap;
  /* Defensive: pill carries its own typography (status labels like
     "Pending" / "Approved" use Title Case). */
  text-transform: none;
}
.hc-v2-age-pill {
  display: inline-block;
  font-size: 9.5px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 9px;
  white-space: nowrap;
  flex: 0 0 auto;
}

/* ── Mini stage chain ──────────────────────────────────────────────────── */
.hc-v2-chain {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.hc-v2-chain-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #E5E7EB;
  display: inline-block;
}
.hc-v2-chain-dot-done {
  background: #059669;
}
.hc-v2-chain-dot-current {
  background: #FFFFFF;
  box-shadow: 0 0 0 1.5px #1565C0, 0 0 0 3.5px rgba(21,101,192,0.18);
}
.hc-v2-chain-dot-pending {
  background: #E5E7EB;
}
.hc-v2-chain-dot-faded {
  background: #F3F4F6;
}
.hc-v2-chain-cap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  font-size: 10px;
  font-weight: 800;
  margin-left: 2px;
}
.hc-v2-chain-cap-pending {
  background: #F3F4F6;
  color: var(--muted-text);
}
.hc-v2-chain-cap-approved {
  background: #059669;
  color: #FFFFFF;
}
.hc-v2-chain-cap-rejected {
  background: #DC2626;
  color: #FFFFFF;
}

/* ── Empty state ───────────────────────────────────────────────────────── */
.hc-v2-empty {
  text-align: center;
  padding: 36px 20px;
  color: var(--muted-text);
}
.hc-v2-empty-icon {
  font-size: 32px;
  margin-bottom: 8px;
  color: #D1D5DB;
}
.hc-v2-empty-sub {
  font-size: 10.5px;
  color: #B0B7C3;
  margin-top: 6px;
}

/* ── Department dot ────────────────────────────────────────────────────── */
.hc-v2-dept-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: 0 0 auto;
  margin-right: 4px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Detail pane (#hc-detail)
   ═══════════════════════════════════════════════════════════════════════════ */
#hc-detail { background: #FAFAFA; padding: 0; }

.hc-v2-detail {
  background: #FFFFFF;
  margin: 18px 26px;
  border: 1px solid #E5E7EB;
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  align-items: stretch;
  position: relative;
}
.hc-v2-detail-rail {
  flex: 0 0 6px;
  align-self: stretch;
}
.hc-v2-detail-body {
  flex: 1;
  padding: 20px 24px 24px;
  min-width: 0;
}

.hc-v2-detail-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  padding-bottom: 18px;
  border-bottom: 1px solid #F3F4F6;
}
.hc-v2-detail-head-left { flex: 1; min-width: 0; }
.hc-v2-detail-row-meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.hc-v2-detail-title {
  font-size: 22px;
  font-weight: 800;
  color: #111827;
  letter-spacing: -0.02em;
  line-height: 1.25;
}
.hc-v2-detail-sub {
  font-size: 12px;
  color: #6B7280;
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.hc-v2-detail-head-right {
  text-align: right;
  flex: 0 0 auto;
}
.hc-v2-detail-budget {
  font-size: 28px;
  font-weight: 800;
  color: #059669;
  letter-spacing: -0.02em;
  line-height: 1;
}
.hc-v2-detail-budget-lbl {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #6B7280;
  margin-top: 4px;
}
.hc-v2-detail-budget-loaded {
  font-size: 11px;
  font-weight: 700;
  color: #047857;
  margin-top: 5px;
  white-space: nowrap;
}

/* ── Detail stats ──────────────────────────────────────────────────────── */
.hc-v2-detail-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: 18px 0;
}
.hc-v2-detail-stat {
  background: #F9FAFB;
  border: 1px solid #F3F4F6;
  border-radius: 6px;
  padding: 8px 10px;
}
.hc-v2-detail-stat-lbl {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #6B7280;
  margin-bottom: 3px;
}
.hc-v2-detail-stat-val {
  font-size: 14px;
  font-weight: 700;
  color: #111827;
}

/* ── Detail sections ───────────────────────────────────────────────────── */
.hc-v2-detail-section {
  margin-top: 20px;
}
.hc-v2-detail-section-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #111827;
  margin-bottom: 12px;
}
.hc-v2-detail-section-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 4px;
  color: #FFFFFF;
  font-size: 11px;
  font-weight: 800;
  flex: 0 0 auto;
}

/* ── Approval trail ────────────────────────────────────────────────────── */
.hc-v2-trail {
  display: flex;
  align-items: stretch;
  gap: 0;
  padding: 4px 6px;
}
.hc-v2-trail-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
  text-align: center;
}
.hc-v2-trail-marker {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
  background: #E5E7EB;
  color: var(--muted-text);
}
.hc-v2-trail-done .hc-v2-trail-marker {
  background: #059669;
  color: #FFFFFF;
}
.hc-v2-trail-current .hc-v2-trail-marker {
  background: #FFFFFF;
  border: 2px solid #1565C0;
  color: #1565C0;
}
.hc-v2-trail-rejected .hc-v2-trail-marker {
  background: #DC2626;
  color: #FFFFFF;
}
.hc-v2-trail-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.hc-v2-trail-stage {
  font-size: 10.5px;
  font-weight: 700;
  color: #111827;
}
.hc-v2-trail-state {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted-text);
}
.hc-v2-trail-done    .hc-v2-trail-state { color: #059669; }
.hc-v2-trail-current .hc-v2-trail-state { color: #1565C0; }
.hc-v2-trail-rejected .hc-v2-trail-state { color: #DC2626; }
.hc-v2-trail-line {
  flex: 0 0 auto;
  align-self: flex-start;
  margin-top: 13px;
  width: 12%;
  height: 2px;
  background: #E5E7EB;
}

/* ── Justification card ────────────────────────────────────────────────── */
.hc-v2-detail-just {
  font-size: 12.5px;
  line-height: 1.55;
  color: #374151;
  background: #FAFAFA;
  border: 1px solid #F3F4F6;
  border-left: 3px solid #7E57C2;
  border-radius: 6px;
  padding: 12px 14px;
  white-space: pre-wrap;
}
.hc-v2-detail-just em { color: var(--muted-text); font-style: italic; }

/* ── Detail actions ────────────────────────────────────────────────────── */
.hc-v2-detail-actions {
  margin-top: 20px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.hc-v2-pos-link {
  padding: 6px 14px;
  border: 1px solid var(--orange);
  background: #FFFFFF;
  color: var(--orange-text);
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.12s ease;
}
.hc-v2-pos-link:hover {
  background: var(--orange);
  color: var(--black);
}

/* ── Detail empty ──────────────────────────────────────────────────────── */
.hc-v2-detail-empty {
  text-align: center;
  padding: 80px 24px;
  color: var(--muted-text);
}
.hc-v2-detail-empty-icon {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.5;
}
.hc-v2-detail-empty-title {
  font-size: 14px;
  font-weight: 700;
  color: #6B7280;
  margin-bottom: 4px;
}
.hc-v2-detail-empty-sub {
  font-size: 11px;
  color: var(--muted-text);
  max-width: 340px;
  margin: 0 auto;
  line-height: 1.5;
}
