/* ===================== Diligence hub ===================== */
/* Deal-scoped diligence dashboard. Reuses the shared cs__/an-/ppl- primitives;
   this file adds the deal banner, contract review cards, the contract drawer,
   risk/status pills and the checklist coverage table. Warm palette, same
   borders/radii/type as the rest of the app. */

/* ---- Deal banner ---- */
.dil-banner {
  border: 1px solid var(--border-light);
  border-radius: 14px;
  background: var(--bg-white);
  padding: 22px 26px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 24px;
  align-items: center;
}
.dil-banner__left { min-width: 0; }
.dil-banner__kicker {
  font: 400 11px/1.2 'Inter'; letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--fg-muted); display: flex; align-items: center; gap: 9px;
}
.dil-banner__kicker .dil-code {
  color: var(--fg-dark); font-weight: 500; letter-spacing: 0.12em;
}
.dil-banner__kicker .dot { width: 3px; height: 3px; border-radius: 999px; background: var(--fg-light-muted); }
.dil-banner__title {
  margin: 9px 0 0; font: 500 24px/1.2 'Inter'; letter-spacing: -0.02em; color: var(--fg-dark);
}
.dil-banner__sub {
  margin: 7px 0 0; font: 300 13.5px/1.55 'Inter'; color: var(--fg-muted);
  max-width: 560px; text-wrap: pretty;
}
.dil-banner__right {
  display: flex; flex-direction: column; gap: 12px; align-items: flex-end;
  border-left: 1px solid var(--border-light); padding-left: 24px;
}
.dil-banner__badge {
  display: inline-flex; align-items: center; gap: 7px;
  font: 500 11px/1 'Inter'; letter-spacing: 0.03em; text-transform: uppercase;
  color: #345C8C; background: rgba(58,111,176,0.12); padding: 6px 11px; border-radius: 6px;
}
.dil-banner__badge .tick { width: 6px; height: 6px; border-radius: 999px; background: #3A6FB0; }
.dil-timeline { width: 260px; max-width: 40vw; }
.dil-timeline__row {
  display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 7px;
}
.dil-timeline__lbl { font: 400 11px/1 'Inter'; color: var(--fg-muted); letter-spacing: 0.02em; }
.dil-timeline__val { font: 500 12px/1 'Inter'; color: var(--fg-dark); font-variant-numeric: tabular-nums; }
.dil-timeline__track { height: 6px; border-radius: 999px; background: rgba(38,24,17,0.08); overflow: hidden; }
.dil-timeline__fill { height: 100%; border-radius: 999px; background: #3A6FB0; }
.dil-timeline__meta { margin-top: 7px; font: 300 11px/1.3 'Inter'; color: var(--fg-light-muted); text-align: right; }

/* ---- 5-up metric grid ---- */
.cs__kpi-grid--5 { grid-template-columns: repeat(5, 1fr); }
.stat-tile--bad { border-left: 3px solid #C0544B; }
.stat-tile__value .v-hi { color: #A33A32; }

/* ---- Section label (reuse ppl-sec-label spacing) ---- */
.dil-sec {
  font: 400 11px/1.2 'Inter'; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--fg-muted); margin: 4px 0 2px;
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
}
.dil-sec .dil-sec-meta { font: 300 11px/1.2 'Inter'; letter-spacing: 0; text-transform: none; }

/* ---- Checklist coverage table ---- */
.dil-check { display: flex; flex-direction: column; border-top: 1px solid var(--border-light); }
.dil-check__row {
  display: grid; grid-template-columns: 1.5fr 1.4fr auto auto auto;
  align-items: center; gap: 18px;
  padding: 13px 0; border-bottom: 1px solid var(--border-light);
}
.dil-check__row--head > * { font: 400 10px/1.2 'Inter'; text-transform: uppercase; letter-spacing: 0.05em; color: var(--fg-muted); }
.dil-check__cat { font: 400 13.5px/1.3 'Inter'; color: var(--fg-dark); }
.dil-check__bar { display: flex; align-items: center; gap: 11px; }
.dil-check__track { flex: 1; height: 6px; border-radius: 999px; background: rgba(38,24,17,0.07); overflow: hidden; min-width: 90px; }
.dil-check__fill { height: 100%; border-radius: 999px; background: #3F9A5E; }
.dil-check__pct { font: 500 12px/1 'Inter'; color: var(--fg-muted); font-variant-numeric: tabular-nums; width: 34px; text-align: right; }
.dil-check__num { font: 400 12.5px/1 'Inter'; color: var(--fg-base); font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.dil-check__gap { font: 500 12.5px/1 'Inter'; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; width: 66px; }
.dil-check__gap.zero { color: var(--fg-light-muted); font-weight: 400; }
.dil-check__gap.open { color: #A33A32; }
.dil-check__status { justify-self: end; }
.dil-check__row--total { border-bottom: none; }
.dil-check__row--total .dil-check__cat { font-weight: 500; }
.dil-check__row--total .dil-check__num,
.dil-check__row--total .dil-check__gap { font-weight: 500; color: var(--fg-dark); }

/* ---- Pills (risk / status) ---- */
.dil-pill {
  font: 500 10px/1 'Inter'; padding: 4px 9px; border-radius: 5px;
  text-transform: uppercase; letter-spacing: 0.04em; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 6px;
}
.dil-pill .pdot { width: 6px; height: 6px; border-radius: 999px; background: currentColor; opacity: 0.9; }
.dil-pill--high    { background: rgba(208,74,63,0.12);  color: #A33A32; }
.dil-pill--med     { background: rgba(214,158,46,0.16); color: #8A6A1E; }
.dil-pill--low     { background: rgba(82,178,110,0.12); color: #2E6E48; }
.dil-pill--flagged { background: rgba(208,74,63,0.12);  color: #A33A32; }
.dil-pill--review  { background: rgba(214,158,46,0.16); color: #8A6A1E; }
.dil-pill--cleared { background: rgba(82,178,110,0.12); color: #2E6E48; }
.dil-pill--type    { background: rgba(38,24,17,0.06);   color: var(--fg-base); letter-spacing: 0.03em; }

/* ---- Contract review cards ---- */
.dil-roster { display: flex; flex-direction: column; gap: 12px; }
.dil-card {
  border: 1px solid var(--border-light); border-radius: 12px;
  padding: 16px 22px; background: var(--bg-white);
  display: flex; align-items: center; justify-content: space-between; gap: 22px;
  cursor: pointer; transition: border-color 0.15s ease, background 0.15s ease;
  text-align: left; width: 100%; font-family: inherit;
}
.dil-card:hover { border-color: rgba(38,24,17,0.22); background: #fdfcfa; }
.dil-card:focus-visible { outline: none; border-color: var(--fg-base); box-shadow: 0 0 0 2px rgba(23,20,18,0.07); }
.dil-card__main { display: flex; align-items: center; gap: 16px; min-width: 0; flex: 1; }
.dil-card__icon {
  width: 42px; height: 42px; border-radius: 9px; flex: none;
  display: grid; place-items: center;
  background: rgba(38,24,17,0.05); color: var(--fg-muted);
}
.dil-card__icon svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.dil-card__id { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.dil-card__name { font: 500 15px/1.25 'Inter'; color: var(--fg-dark); letter-spacing: -0.01em; }
.dil-card__meta { font: 300 12px/1.2 'Inter'; color: var(--fg-muted); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.dil-card__meta .dot { width: 3px; height: 3px; border-radius: 999px; background: var(--fg-light-muted); }
.dil-card__side { display: flex; align-items: center; gap: 22px; flex: none; }
.dil-card__prov { display: flex; gap: 22px; border-left: 1px solid var(--border-light); padding-left: 22px; }
.dil-card__provcell { display: flex; flex-direction: column; gap: 4px; min-width: 118px; }
.dil-card__provcell .k { font: 400 10px/1 'Inter'; text-transform: uppercase; letter-spacing: 0.05em; color: var(--fg-light-muted); }
.dil-card__provcell .v { font: 400 12.5px/1.25 'Inter'; color: var(--fg-base); }
.dil-card__tags { display: flex; align-items: center; gap: 8px; }
.dil-card__chev { color: var(--fg-light-muted); flex: none; display: grid; place-items: center; }
.dil-card__chev svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

/* ---- Contract drawer body ---- */
.dil-drawer__title { font: 500 22px/1.25 'Inter'; letter-spacing: -0.02em; color: var(--fg-dark); margin: 0; }
.dil-drawer__party { font: 400 13.5px/1.4 'Inter'; color: var(--fg-muted); margin: 6px 0 0; display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.dil-drawer__party .dot { width: 3px; height: 3px; border-radius: 999px; background: var(--fg-light-muted); }
.dil-drawer__pills { display: flex; gap: 8px; margin: 16px 0 0; }

/* provisions list */
.dil-prov { display: flex; flex-direction: column; border-top: 1px solid var(--border-light); }
.dil-prov__item {
  display: grid; grid-template-columns: 190px 1fr; gap: 22px;
  padding: 15px 0; border-bottom: 1px solid var(--border-light);
}
.dil-prov__term { font: 500 12.5px/1.4 'Inter'; color: var(--fg-dark); }
.dil-prov__term .sub { display: block; font: 400 11px/1.3 'Inter'; color: var(--fg-light-muted); margin-top: 3px; }
.dil-prov__val { min-width: 0; }
.dil-prov__valtop { font: 400 13.5px/1.45 'Inter'; color: var(--fg-base); }
.dil-prov__clause {
  margin: 9px 0 0; padding: 11px 14px; border-left: 2px solid var(--border-subtle);
  background: var(--bg-panel); border-radius: 0 8px 8px 0;
  font: 400 12.5px/1.6 'Inter'; color: var(--fg-muted); font-style: italic; text-wrap: pretty;
}
.dil-prov__cite { margin-top: 7px; font: 400 11px/1.3 'Inter'; color: var(--fg-light-muted); display: flex; align-items: center; gap: 7px; }
.dil-prov__cite svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 1.5; }

/* source card */
.dil-source {
  display: flex; align-items: center; gap: 14px;
  border: 1px solid var(--border-light); border-radius: 10px; padding: 14px 16px; background: var(--bg-white);
}
.dil-source__ico { width: 38px; height: 38px; border-radius: 8px; flex: none; display: grid; place-items: center; background: rgba(38,24,17,0.05); color: var(--fg-muted); }
.dil-source__ico svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.dil-source__body { min-width: 0; flex: 1; }
.dil-source__file { font: 500 13px/1.3 'Inter'; color: var(--fg-dark); }
.dil-source__meta { font: 300 11.5px/1.3 'Inter'; color: var(--fg-muted); margin-top: 3px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.dil-source__meta .dot { width: 3px; height: 3px; border-radius: 999px; background: var(--fg-light-muted); }
.dil-source__ai { font: 400 11px/1 'Inter'; color: #6B4E8F; background: rgba(114,76,158,0.10); padding: 5px 9px; border-radius: 5px; white-space: nowrap; flex: none; }

/* linked records */
.dil-linked { display: flex; flex-direction: column; gap: 8px; }
.dil-linked__item {
  display: flex; align-items: center; gap: 11px;
  padding: 11px 14px; border: 1px solid var(--border-light); border-radius: 9px; background: var(--bg-white);
}
.dil-linked__ico { width: 15px; height: 15px; flex: none; color: var(--fg-light-muted); }
.dil-linked__ico svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.dil-linked__txt { font: 400 13px/1.4 'Inter'; color: var(--fg-base); min-width: 0; }
.dil-linked__txt .k { color: var(--fg-light-muted); }

/* counsel note callout inside drawer */
.dil-note {
  display: flex; gap: 12px; padding: 14px 16px; border-radius: 10px;
  border: 1px solid rgba(214,158,46,0.32); background: rgba(214,158,46,0.06);
}
.dil-note--cleared { border-color: rgba(82,178,110,0.32); background: rgba(82,178,110,0.06); }
.dil-note__ico { flex: none; width: 18px; height: 18px; margin-top: 1px; color: #8A6A1E; }
.dil-note--cleared .dil-note__ico { color: #2E6E48; }
.dil-note__ico svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.dil-note__body { font: 400 13px/1.6 'Inter'; color: var(--fg-base); text-wrap: pretty; }

/* "See what the Diligence Hub covers" link */
.dil-covers {
  display: inline-flex; align-items: center; gap: 8px; align-self: flex-start;
  font: 400 13px/1 'Inter'; color: var(--link, #345C8C); cursor: pointer;
  background: none; border: none; padding: 6px 0; font-family: inherit;
}
.dil-covers:hover { text-decoration: underline; }
.dil-covers svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

/* ---- Category bar list (issues-by-category chart substitute) ---- */
.dil-catbars { display: flex; flex-direction: column; gap: 10px; }
.dil-catbars__row { display: grid; grid-template-columns: 160px 1fr 30px; align-items: center; gap: 12px; }
.dil-catbars__label { font: 400 12.5px/1.3 'Inter'; color: var(--fg-base); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dil-catbars__track { height: 8px; border-radius: 999px; background: rgba(38,24,17,0.07); overflow: hidden; }
.dil-catbars__fill { height: 100%; border-radius: 999px; }
.dil-catbars__fill--hi { background: #C0544B; }
.dil-catbars__fill--med { background: #D69E2E; }
.dil-catbars__count { font: 500 12px/1 'Inter'; color: var(--fg-dark); font-variant-numeric: tabular-nums; text-align: right; }

/* ---- Contract drawer (reuses ppl-drawer/ppl-scrim mechanics, own class for future divergence) ---- */
.dil-drawer { }

/* ---- "What the Diligence Hub covers" modal ---- */
.dil-modal-scrim {
  position: fixed; inset: 0; background: rgba(38,24,17,0.32);
  opacity: 0; pointer-events: none; transition: opacity 0.2s ease; z-index: 120;
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.dil-modal-scrim.open { opacity: 1; pointer-events: auto; }
.dil-modal {
  width: min(520px, 100%); background: var(--bg-white); border-radius: 16px;
  border: 1px solid var(--border-light); box-shadow: var(--shadow-popover);
  padding: 26px 28px 24px; transform: translateY(10px) scale(0.98); opacity: 0;
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.dil-modal-scrim.open .dil-modal { transform: translateY(0) scale(1); opacity: 1; }
.dil-modal__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.dil-modal__title { margin: 0; font: 500 18px/1.3 'Inter'; letter-spacing: -0.01em; color: var(--fg-dark); }
.dil-modal__sub { margin: 6px 0 0; font: 300 13px/1.5 'Inter'; color: var(--fg-muted); max-width: 400px; text-wrap: pretty; }
.dil-modal__close {
  width: 28px; height: 28px; border: 0; background: transparent; cursor: pointer;
  border-radius: 6px; color: var(--fg-muted); display: grid; place-items: center; flex: none;
}
.dil-modal__close:hover { background: var(--bg-hover); color: var(--fg-dark); }
.dil-modal__close svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; }
.dil-modal__list { display: flex; flex-direction: column; gap: 14px; margin-top: 20px; }
.dil-modal__item { display: flex; gap: 12px; align-items: flex-start; }
.dil-modal__item-ico {
  flex: none; width: 30px; height: 30px; border-radius: 8px; margin-top: 1px;
  display: grid; place-items: center; background: var(--bg-panel); color: var(--fg-muted);
}
.dil-modal__item-ico svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.dil-modal__item-txt { font: 400 13.5px/1.55 'Inter'; color: var(--fg-base); text-wrap: pretty; padding-top: 4px; }

/* ---- Request list (open items) ---- */
.dil-req { display: flex; flex-direction: column; border-top: 1px solid var(--border-light); }
.dil-req__row {
  display: grid; grid-template-columns: 2.2fr 1.1fr 1fr auto; align-items: center; gap: 16px;
  padding: 12px 0; border-bottom: 1px solid var(--border-light);
}
.dil-req__row--head > * { font: 400 10px/1.2 'Inter'; text-transform: uppercase; letter-spacing: 0.05em; color: var(--fg-muted); }
.dil-req__name { font: 400 13px/1.4 'Inter'; color: var(--fg-dark); }
.dil-req__cat { font: 300 12.5px/1.4 'Inter'; color: var(--fg-muted); }
.dil-req__owner { font: 300 12.5px/1.4 'Inter'; color: var(--fg-muted); }

/* ---- responsive ---- */
@media (max-width: 900px) {
  .dil-req__row { grid-template-columns: 1.6fr 1fr auto; }
  .dil-req__owner { display: none; }
  .dil-catbars__row { grid-template-columns: 110px 1fr 26px; }
  .cs__kpi-grid--5 { grid-template-columns: repeat(2, 1fr); }
  .dil-banner { grid-template-columns: 1fr; }
  .dil-banner__right { border-left: none; padding-left: 0; align-items: flex-start; }
  .dil-timeline { width: 100%; max-width: none; }
  .dil-card { flex-direction: column; align-items: stretch; gap: 14px; }
  .dil-card__side { justify-content: space-between; }
  .dil-card__prov { border-left: none; padding-left: 0; }
  .dil-check__row { grid-template-columns: 1.3fr 1fr auto; }
  .dil-check__num, .dil-check__status { display: none; }
  .dil-prov__item { grid-template-columns: 1fr; gap: 8px; }
}
