/* ============================================================================
   Renewal Manager — v5 cockpit re-skin (dashboard-v5 rollout, Customer lane R3)
   ----------------------------------------------------------------------------
   FORKED from ``contract-v5.css`` / ``fpa-cockpit.css`` so Renewal reads as a
   sibling of the Legal + Finance cockpits — the founder's "единый формат с
   другими ролями" goal. Same ``.cv5`` chrome vocabulary (bleed · sub-bar ·
   wrap), but the department accent is the Customer petrol-green (``--customer``
   = #0E8A72) rather than navy/terracotta, and the bespoke work-core is the
   triage INBOX (the reused Tailwind board partial) framed by a retention KPI
   band and a composition side rail.

   Loaded ONLY on Renewal v5 pages (behind ``settings.renewal_v5_enabled``), so
   it can never clash with the other cockpit stylesheets — no page loads two.

   House rules honoured:
     • General Sans everywhere (inherited from base.html <html>) — NO monospace.
     • Light theme only (dark mode is founder-vetoed) — no prefers-color-scheme.
     • CSP-safe: no @import of remote fonts; zero inline handlers.
     • DELIBERATELY no blanket ``.cv5 a`` / ``.cv5 button`` / ``.cv5 svg`` resets:
       the work-core reuses the shipped Tailwind board partial verbatim, and a
       global anchor/button reset would clobber its utility colours (e.g. an
       active filter pill would render dark-on-dark). Every rule below is scoped
       to a ``.cv5-*`` component class instead.
   ============================================================================ */

.cv5.cv5-rh {
  /* Surface + ink — aligned to the app palette (base.html :root) but kept
     local so the dense cockpit reads a touch cooler than the marketing pages. */
  --cv5-bg: #F4F5F8;
  --cv5-card: #FFFFFF;
  --cv5-ink: #191C22;
  --cv5-ink2: #4A515C;
  --cv5-ink3: #868D99;
  --cv5-ink4: #AEB4BF;
  --cv5-line: #E5E8EE;
  --cv5-line-strong: #D2D7E0;

  /* Customer department band + action accent (design_direction.md). */
  --cv5-accent: #0E8A72;
  --cv5-accent-ink: #0B6F5C;
  --cv5-accent-soft: #E1F3EE;
  --cv5-accent-border: #B9E0D5;

  /* Risk / status palette. */
  --cv5-rose: #C0392B;
  --cv5-rose-soft: #FBEAE8;
  --cv5-rose-border: #F1C4BF;
  --cv5-amber: #B45309;
  --cv5-amber-soft: #FBF1E1;
  --cv5-amber-border: #EDD3A6;
  --cv5-emer: #0B845A;
  --cv5-emer-soft: #E4F4EC;
  --cv5-emer-border: #B7E3CC;
  --cv5-slate: #64748B;

  color: var(--cv5-ink);
  font-size: 14px;
  line-height: 1.55;
}

.cv5-rh .cv5-tnum { font-variant-numeric: tabular-nums; }
.cv5-rh .cv5-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }

/* Full-bleed the cockpit inside app/base.html's padded <main> so the sub-bar
   and content span edge-to-edge like the sibling cockpits. */
.cv5-rh .cv5-bleed { margin: -2rem -1.25rem 0; }
@media (min-width: 768px) { .cv5-rh .cv5-bleed { margin: -2.5rem -2rem 0; } }
.cv5-rh .cv5-wrap { max-width: 1320px; margin: 0 auto; padding: 18px 22px 60px; }

/* ── Cockpit sub-bar (role + collapsed tab row) ──────────────────────────── */
.cv5-rh .cv5-sub { background: #fff; border-bottom: 1px solid var(--cv5-line); }
.cv5-rh .cv5-sub-in {
  max-width: 1320px; margin: 0 auto; padding: 0 22px;
  display: flex; align-items: center; gap: 2px; flex-wrap: wrap;
}
.cv5-rh .cv5-role {
  font-size: 12px; font-weight: 700; color: var(--cv5-accent-ink);
  padding-right: 14px; margin-right: 6px; border-right: 1px solid var(--cv5-line);
  display: flex; align-items: center; gap: 7px; white-space: nowrap;
}
.cv5-rh .cv5-role .b { width: 8px; height: 8px; border-radius: 2px; background: var(--cv5-accent); }
.cv5-rh .cv5-tab {
  font-size: 13.5px; font-weight: 600; color: var(--cv5-ink3);
  padding: 12px 13px; border-bottom: 2px solid transparent; margin-bottom: -1px;
  white-space: nowrap; text-decoration: none;
}
.cv5-rh .cv5-tab:hover { color: var(--cv5-ink); }
.cv5-rh .cv5-tab.on { color: var(--cv5-accent-ink); border-bottom-color: var(--cv5-accent); }
.cv5-rh .cv5-tab-util { margin-left: auto; color: var(--cv5-ink3); }

/* ── Panel title ─────────────────────────────────────────────────────────── */
.cv5-rh .cv5-ptitle { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 2px 0 14px; flex-wrap: wrap; }
.cv5-rh .cv5-ptitle h1 { font-size: 21px; font-weight: 700; letter-spacing: -.01em; }
.cv5-rh .cv5-ptitle p { font-size: 12.5px; color: var(--cv5-ink3); margin-top: 4px; max-width: 640px; }
.cv5-rh .cv5-ptitle .side { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.cv5-rh .cv5-counts { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--cv5-ink3); flex-wrap: wrap; }
.cv5-rh .cv5-counts b { font-weight: 700; font-variant-numeric: tabular-nums; }
.cv5-rh .cv5-counts .lc { color: var(--cv5-rose); }
.cv5-rh .cv5-counts .ar { color: var(--cv5-amber); }
.cv5-rh .cv5-counts .ex { color: var(--cv5-emer); }
.cv5-rh .cv5-covpill {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 8px;
  font-size: 11px; font-weight: 600; border-radius: 999px; padding: 3px 10px;
  border: 1px solid var(--cv5-accent-border); background: var(--cv5-accent-soft); color: var(--cv5-accent-ink);
  text-decoration: none; width: max-content;
}
.cv5-rh .cv5-covpill.warn { border-color: var(--cv5-amber-border); background: var(--cv5-amber-soft); color: var(--cv5-amber); }
.cv5-rh .cv5-covpill .lv { text-transform: uppercase; letter-spacing: .06em; }
.cv5-rh .cv5-export {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600;
  color: var(--cv5-ink2); border: 1px solid var(--cv5-line-strong); border-radius: 8px; padding: 6px 12px;
  background: #fff; text-decoration: none;
}
.cv5-rh .cv5-export:hover { border-color: var(--cv5-accent); color: var(--cv5-accent-ink); }

/* ── Retention KPI band ──────────────────────────────────────────────────── */
.cv5-rh .cv5-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.cv5-rh .cv5-kpi { background: #fff; border: 1px solid var(--cv5-line); border-radius: 12px; padding: 14px 16px; min-width: 0; }
.cv5-rh .cv5-kpi.risk { border-left: 3px solid var(--cv5-rose); }
.cv5-rh .cv5-kpi .l { font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--cv5-ink3); font-weight: 700; display: flex; align-items: center; gap: 5px; }
.cv5-rh .cv5-kpi .v { font-size: 26px; font-weight: 700; letter-spacing: -.02em; margin-top: 7px; font-variant-numeric: tabular-nums; line-height: 1.05; }
.cv5-rh .cv5-kpi .v.abst { color: var(--cv5-ink4); font-weight: 600; font-size: 15px; letter-spacing: 0; }
.cv5-rh .cv5-kpi.risk .v { color: var(--cv5-rose); }
.cv5-rh .cv5-kpi .s { font-size: 11.5px; color: var(--cv5-ink3); margin-top: 5px; line-height: 1.4; }

/* Glossary term — dotted underline + CSS-only tooltip (hover / focus), no JS. */
.cv5-rh .cv5-gl { position: relative; border-bottom: 1px dotted var(--cv5-ink3); cursor: help; }
.cv5-rh .cv5-gl:focus { outline: none; }
.cv5-rh .cv5-gl .cv5-tip {
  position: absolute; bottom: calc(100% + 8px); left: 0;
  width: max-content; max-width: 240px; background: var(--cv5-ink); color: #fff;
  font-size: 11.5px; line-height: 1.5; font-weight: 400; text-transform: none; letter-spacing: 0;
  padding: 8px 11px; border-radius: 8px; box-shadow: 0 10px 28px -12px rgba(0,0,0,.55);
  opacity: 0; visibility: hidden; transition: opacity .12s, visibility .12s; z-index: 40; text-align: left; pointer-events: none;
}
.cv5-rh .cv5-gl:hover .cv5-tip, .cv5-rh .cv5-gl:focus .cv5-tip, .cv5-rh .cv5-gl:focus-within .cv5-tip { opacity: 1; visibility: visible; }

/* ── Two-column cockpit: work-core + side rail ───────────────────────────── */
.cv5-rh .cv5-ck { display: grid; grid-template-columns: minmax(0, 1fr) 328px; gap: 18px; align-items: start; }
.cv5-rh .cv5-ck-main { min-width: 0; }
.cv5-rh .cv5-ck-rail { display: flex; flex-direction: column; gap: 14px; }

/* Notices reused from the legacy inbox (cap / flash) as calm cv5 banners. */
.cv5-rh .cv5-notice { display: flex; align-items: flex-start; gap: 10px; margin: 0 0 14px; padding: 11px 15px; border-radius: 10px; font-size: 13px; line-height: 1.45; }
.cv5-rh .cv5-notice.ok { background: var(--cv5-accent-soft); color: var(--cv5-accent-ink); border: 1px solid var(--cv5-accent-border); }
.cv5-rh .cv5-notice.warn { background: var(--cv5-amber-soft); color: var(--cv5-amber); border: 1px solid var(--cv5-amber-border); }
.cv5-rh .cv5-notice .cta { margin-left: auto; font-weight: 700; text-decoration: underline; white-space: nowrap; }
.cv5-rh .cv5-needsyou {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 14px; padding: 11px 15px; border-radius: 10px; font-size: 13px; font-weight: 600;
  background: var(--cv5-accent-soft); border: 1px solid var(--cv5-accent-border); color: var(--cv5-accent-ink);
  text-decoration: none;
}
.cv5-rh .cv5-needsyou:hover { border-color: var(--cv5-accent); }

/* Work-core section heading above the reused board. */
.cv5-rh .cv5-worklead { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--cv5-ink3); margin: 4px 0 10px; }

/* ── Side-rail cards ─────────────────────────────────────────────────────── */
.cv5-rh .cv5-rc { background: #fff; border: 1px solid var(--cv5-line); border-radius: 12px; padding: 14px 16px; }
.cv5-rh .cv5-rc > h4 {
  font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--cv5-ink3); margin-bottom: 12px; display: flex; align-items: center; gap: 7px;
}
.cv5-rh .cv5-rc .rc-link { margin-left: auto; font-size: 11px; font-weight: 600; color: var(--cv5-accent-ink); text-decoration: none; }
.cv5-rh .cv5-rc .rc-link:hover { text-decoration: underline; }
.cv5-rh .cv5-rc .rc-empty { font-size: 12px; color: var(--cv5-ink3); }

/* Health-move strip. */
.cv5-rh .cv5-hmoves { display: flex; gap: 8px; margin-bottom: 10px; }
.cv5-rh .cv5-hmoves .h { flex: 1; border: 1px solid var(--cv5-line); border-radius: 9px; padding: 9px 10px; text-align: center; }
.cv5-rh .cv5-hmoves .h .n { font-size: 20px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.cv5-rh .cv5-hmoves .h.up .n { color: var(--cv5-emer); }
.cv5-rh .cv5-hmoves .h.down .n { color: var(--cv5-rose); }
.cv5-rh .cv5-hmoves .h .k { font-size: 10px; text-transform: uppercase; letter-spacing: .04em; color: var(--cv5-ink3); margin-top: 4px; font-weight: 600; }
.cv5-rh .cv5-hmeta { font-size: 11.5px; color: var(--cv5-ink3); }
.cv5-rh .cv5-hchips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.cv5-rh .cv5-hchip { font-size: 10.5px; font-weight: 600; border-radius: 5px; padding: 2px 7px; background: #F1F3F6; color: var(--cv5-ink2); }

/* Renewals-by-quarter list. */
.cv5-rh .cv5-qrow { display: grid; grid-template-columns: 1fr auto; gap: 3px 10px; padding: 8px 0; border-bottom: 1px solid var(--cv5-line); }
.cv5-rh .cv5-qrow:last-child { border-bottom: none; }
.cv5-rh .cv5-qrow .ql { font-size: 12.5px; font-weight: 600; color: var(--cv5-ink); }
.cv5-rh .cv5-qrow .qtot { font-size: 12.5px; font-weight: 700; color: var(--cv5-ink); font-variant-numeric: tabular-nums; }
.cv5-rh .cv5-qrow .qmeta { font-size: 11px; color: var(--cv5-ink3); }
.cv5-rh .cv5-qrow .qrisk { font-size: 11px; color: var(--cv5-rose); font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.cv5-rh .cv5-qbar { grid-column: 1 / -1; height: 5px; border-radius: 3px; background: var(--cv5-line); overflow: hidden; margin-top: 3px; }
.cv5-rh .cv5-qbar i { display: block; height: 100%; background: var(--cv5-accent); }
.cv5-rh .cv5-qbar i.risk { background: var(--cv5-rose); }

/* Notice-window list. */
.cv5-rh .cv5-nrow { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--cv5-line); font-size: 12.5px; }
.cv5-rh .cv5-nrow:last-child { border-bottom: none; }
.cv5-rh .cv5-nrow .nm { font-weight: 600; color: var(--cv5-ink); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-decoration: none; }
.cv5-rh .cv5-nrow a.nm:hover { color: var(--cv5-accent-ink); }
.cv5-rh .cv5-nrow .nb { margin-left: auto; font-size: 10.5px; font-weight: 700; border-radius: 999px; padding: 2px 8px; white-space: nowrap; }
.cv5-rh .cv5-nrow .nb.soon { background: var(--cv5-amber-soft); color: var(--cv5-amber); border: 1px solid var(--cv5-amber-border); }
.cv5-rh .cv5-nrow .nb.passed { background: var(--cv5-rose-soft); color: var(--cv5-rose); border: 1px solid var(--cv5-rose-border); }
.cv5-rh .cv5-nrow .nd { font-size: 11px; color: var(--cv5-ink3); white-space: nowrap; }
.cv5-rh .cv5-nhint { font-size: 11px; color: var(--cv5-ink3); margin-top: 10px; }

/* Proof-of-outcomes tile. */
.cv5-rh .cv5-proof { display: flex; gap: 8px; margin-bottom: 10px; }
.cv5-rh .cv5-proof .p { flex: 1; border: 1px solid var(--cv5-line); border-radius: 9px; padding: 9px 10px; text-align: center; }
.cv5-rh .cv5-proof .p .n { font-size: 20px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.cv5-rh .cv5-proof .p.won .n { color: var(--cv5-emer); }
.cv5-rh .cv5-proof .p.lost .n { color: var(--cv5-rose); }
.cv5-rh .cv5-proof .p .k { font-size: 10px; text-transform: uppercase; letter-spacing: .04em; color: var(--cv5-ink3); margin-top: 4px; font-weight: 600; }

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 1080px) {
  .cv5-rh .cv5-ck { grid-template-columns: 1fr; }
  .cv5-rh .cv5-ck-rail { flex-direction: row; flex-wrap: wrap; }
  .cv5-rh .cv5-ck-rail > .cv5-rc { flex: 1; min-width: 260px; }
  .cv5-rh .cv5-kpis { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .cv5-rh .cv5-kpis { grid-template-columns: 1fr; }
}

/* ── Pill-button contrast restore ────────────────────────────────────────────
   The header note above assumed "no page loads two" cockpit sheets — but the
   dashboard-v5 shell loads contract-v5.css on EVERY app page, and it ships
   blanket ``.cv5 a`` / ``.cv5 button`` resets (``color: inherit``,
   ``background: none``). Those (0,1,1) rules outrank Tailwind's single-class
   ``.text-paper`` / ``.bg-ink`` (0,1,0) on the reused board partial, so the
   solid active-filter pills render dark-on-dark (invisible label). Re-assert the
   two utilities those pills rely on, scoped to this cockpit so it can never
   touch a sibling — ``.cv5-rh a.text-paper`` (0,2,1) beats the global reset
   (0,1,1). ``#141310`` == Tailwind ``ink``, ``#fff`` == ``paper``. */
.cv5-rh a.text-paper,
.cv5-rh button.text-paper,
.cv5-rh a.text-white,
.cv5-rh button.text-white { color: #fff; }
.cv5-rh a.bg-ink,
.cv5-rh button.bg-ink { background-color: #141310; }
