/* ============================================================
   HYBRID-V3 · Component library
   Extracted from: Pacing Live + Asset Flow
   Font: Hanken Grotesk (load 400,500,600,700,800)
   Namespace: .hv-   States: .is-*   Formats: .fmt-*
   ============================================================ */

/* ── 1. Tokens ─────────────────────────────────────────────── */
:root {
  /* palette */
  --hv-navy: #0f2440;
  --hv-navy-soft: #e3e9f2;
  --hv-teal: #0e8a7d;
  --hv-teal-soft: #d9efec;
  --hv-red: #b91c1c;
  --hv-red-soft: #fef2f2;
  --hv-red-border: #fecaca;
  --hv-amber: #b45309;
  --hv-amber-soft: #fef3e2;
  --hv-green: #047857;
  --hv-green-soft: #ecfdf5;

  /* neutrals */
  --hv-ink: #1a2332;
  --hv-muted: #64748b;
  --hv-faint: #94a3b8;
  --hv-line: #e2e8f0;
  --hv-line-faint: #f1f5f9;
  --hv-bg: #f6f8fa;
  --hv-card: #ffffff;

  /* shape & type */
  --hv-radius: 8px;
  --hv-radius-sm: 6px;
  --hv-font: 'Hanken Grotesk', sans-serif;
  --hv-gap: 10px;
}

/* ── 2. Base ───────────────────────────────────────────────── */
.hv-body {
  font-family: var(--hv-font);
  background: var(--hv-bg);
  color: var(--hv-ink);
  font-size: 13px;
  margin: 0;
}
.hv-num { font-variant-numeric: tabular-nums; }
.hv-label {
  font-size: 10px; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--hv-muted);
}

/* ── 3. Layout ─────────────────────────────────────────────── */
.hv-page { max-width: 1560px; margin: 0 auto; padding: 14px 20px 30px; }
/* single-viewport app shell: page never scrolls */
.hv-app {
  height: 100vh; overflow: hidden;
  display: flex; flex-direction: column; gap: var(--hv-gap);
  max-width: 1720px; margin: 0 auto; padding: 10px 18px 12px;
}
.hv-row { display: flex; gap: var(--hv-gap); align-items: stretch; }
.hv-row > .hv-flex { flex: 1 1 auto; min-width: 0; min-height: 0; }
.hv-fill { flex: 1 1 auto; min-height: 0; }   /* the element that absorbs spare height */
.hv-fixed { flex: 0 0 auto; }
.hv-spacer { flex: 1; }

.hv-card {
  background: var(--hv-card);
  border: 1px solid var(--hv-line);
  border-radius: var(--hv-radius);
  padding: 12px 16px;
}
.hv-card-title {
  font-size: 11px; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--hv-navy);
  margin: 0 0 8px;
}

/* ── 4. Controls: fields, chips, countdown ────────────────── */
.hv-field { display: flex; align-items: center; gap: 8px; }
.hv-field > label { font-size: 10px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--hv-muted); white-space: nowrap; }
.hv-field select, .hv-field input {
  font-family: inherit; font-size: 13px; font-weight: 500;
  color: var(--hv-ink); background: var(--hv-card);
  border: 1px solid var(--hv-line); border-radius: var(--hv-radius-sm);
  padding: 5px 9px; height: 32px;
}

.hv-chip {
  font-size: 12px; font-weight: 600; padding: 5px 10px;
  border-radius: var(--hv-radius-sm); border: 1px solid var(--hv-line);
  background: var(--hv-card); color: var(--hv-muted);
  display: inline-flex; align-items: center; gap: 6px; height: 32px;
}
.hv-chip.is-danger  { background: var(--hv-red);   border-color: var(--hv-red);   color: #fff; text-transform: uppercase; font-size: 11px; letter-spacing: 0.04em; }
.hv-chip.is-success { background: var(--hv-green); border-color: var(--hv-green); color: #fff; text-transform: uppercase; font-size: 11px; letter-spacing: 0.04em; }
.hv-chip.is-accent  { background: var(--hv-amber); border-color: var(--hv-amber); color: #fff; letter-spacing: 0.04em; }

.hv-countdown {
  display: flex; align-items: center; gap: 10px;
  border: 1px solid var(--hv-line); background: var(--hv-card);
  border-radius: var(--hv-radius-sm); padding: 5px 12px; height: 32px;
}
.hv-countdown .cd-label { font-size: 10px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--hv-muted); }
.hv-countdown .cd-time  { font-size: 15px; font-weight: 800; color: var(--hv-navy); font-variant-numeric: tabular-nums; min-width: 34px; }
.hv-countdown .cd-bar   { width: 90px; height: 5px; background: var(--hv-line-faint); border-radius: 3px; overflow: hidden; }
.hv-countdown .cd-fill  { height: 100%; background: var(--hv-teal); border-radius: 3px; transition: width 1s linear; }

/* ── 5. Buttons ────────────────────────────────────────────── */
.hv-btn {
  font-family: inherit; font-size: 12.5px; font-weight: 700;
  border-radius: var(--hv-radius-sm); padding: 7px 14px; height: 32px;
  border: 1px solid var(--hv-line); background: var(--hv-card); color: var(--hv-ink);
  cursor: pointer;
}
.hv-btn:hover { background: var(--hv-bg); }
.hv-btn.is-primary { background: var(--hv-navy); border-color: var(--hv-navy); color: #fff; }
.hv-btn.is-primary:hover { background: #1a3559; }
.hv-btn.is-danger { background: var(--hv-red); border-color: var(--hv-red); color: #fff; }
.hv-btn.is-ghost { border-color: transparent; background: transparent; color: var(--hv-muted); }

/* ── 6. Stat strip ─────────────────────────────────────────── */
.hv-stats {
  background: var(--hv-card); border: 1px solid var(--hv-line);
  border-radius: var(--hv-radius); display: flex;
}
.hv-stat { flex: 1; padding: 8px 14px; border-right: 1px solid var(--hv-line); min-width: 0; }
.hv-stat:last-child { border-right: none; }
.hv-stat .k { font-size: 9.5px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--hv-muted); margin-bottom: 2px; white-space: nowrap; }
.hv-stat .v { font-size: 19px; font-weight: 700; color: var(--hv-navy); font-variant-numeric: tabular-nums; line-height: 1.1; }
.hv-stat .s { font-size: 10.5px; color: var(--hv-faint); margin-top: 1px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.hv-stat .v.is-neg { color: var(--hv-red); }
.hv-stat .v.is-pos { color: var(--hv-green); }
.hv-stat .v.is-teal { color: var(--hv-teal); }

/* ── 7. Alert / action band ────────────────────────────────── */
.hv-alert {
  border-radius: var(--hv-radius); padding: 10px 14px;
  display: flex; gap: 24px; align-items: flex-start;
  border: 1px solid var(--hv-line); border-left-width: 4px;
  background: var(--hv-card);
}
.hv-alert.is-danger  { background: var(--hv-red-soft);   border-color: var(--hv-red-border); border-left-color: var(--hv-red); }
.hv-alert.is-success { background: var(--hv-green-soft); border-color: #a7f3d0;             border-left-color: var(--hv-green); }
.hv-alert.is-warning { background: var(--hv-amber-soft); border-color: #fde4bd;             border-left-color: var(--hv-amber); }
.hv-alert .a-head { flex: 0 0 280px; }
.hv-alert .a-title { font-size: 13px; font-weight: 800; margin-bottom: 2px; }
.hv-alert.is-danger  .a-title { color: var(--hv-red); }
.hv-alert.is-success .a-title { color: var(--hv-green); }
.hv-alert.is-warning .a-title { color: var(--hv-amber); }
.hv-alert .a-sub { font-size: 11.5px; color: var(--hv-ink); line-height: 1.35; }
.hv-alert .a-body { flex: 1; }

.hv-steps { list-style: none; margin: 0; padding: 0; }
.hv-steps li { display: flex; gap: 8px; font-size: 11.5px; line-height: 1.4; color: var(--hv-ink); padding: 1px 0; }
.hv-steps .n {
  flex: 0 0 15px; height: 15px; margin-top: 2px; border-radius: 50%;
  background: var(--hv-red); color: #fff; font-size: 9.5px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.hv-alert.is-success .hv-steps .n { background: var(--hv-green); }
.hv-alert.is-warning .hv-steps .n { background: var(--hv-amber); }

/* ── 8. Meter + pipeline ───────────────────────────────────── */
/* meter track spans 0–110%; target tick marks 100% at 90.9% */
.hv-meter { position: relative; height: 10px; background: var(--hv-line-faint); border-radius: 3px; }
.hv-meter .m-fill { position: absolute; left: 0; top: 0; bottom: 0; background: var(--hv-red); border-radius: 3px 0 0 3px; min-width: 2px; }
.hv-meter .m-fill.is-pos { background: var(--hv-teal); }
.hv-meter .m-target { position: absolute; top: -2px; bottom: -2px; left: 90.9%; width: 2px; background: var(--hv-navy); }
.hv-meter.is-tall { height: 18px; }

.hv-pipeline { display: flex; align-items: stretch; }
.hv-pipe-cell {
  flex: 1; min-width: 0;
  border: 1px solid var(--hv-line); border-radius: var(--hv-radius-sm);
  padding: 8px 10px; background: var(--hv-card);
}
.hv-pipe-cell .pc-label { font-size: 10px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--hv-muted); }
.hv-pipe-cell .pc-value { font-size: 22px; font-weight: 800; color: var(--hv-red); font-variant-numeric: tabular-nums; line-height: 1.15; }
.hv-pipe-cell .pc-value.is-pos { color: var(--hv-teal); }
.hv-pipe-cell .pc-value small { font-size: 10px; font-weight: 600; color: var(--hv-faint); margin-left: 3px; }
.hv-pipe-cell .hv-meter { margin: 4px 0 5px; }
.hv-pipe-cell .pc-nums { font-size: 11px; color: var(--hv-muted); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hv-pipe-cell .pc-nums strong { color: var(--hv-ink); font-weight: 600; }
.hv-pipe-arrow {
  flex: 0 0 22px; display: flex; align-items: center; justify-content: center;
  color: var(--hv-faint); font-size: 15px; font-weight: 700;
}
.hv-pipe-note { font-size: 11px; color: var(--hv-faint); margin-top: 7px; }
.hv-pipe-note strong { color: var(--hv-muted); font-weight: 600; }

/* ── 9. Data table ─────────────────────────────────────────── */
.hv-table-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
.hv-table { width: 100%; border-collapse: collapse; }
.hv-table th, .hv-table td {
  font-size: 10.5px; padding: 2.5px 6px; text-align: right;
  font-variant-numeric: tabular-nums; white-space: nowrap;
  border-bottom: 1px solid var(--hv-line-faint);
}
.hv-table th.is-lead, .hv-table td.is-lead { text-align: left; font-weight: 700; color: var(--hv-muted); }
.hv-table thead th {
  font-size: 9.5px; font-weight: 700; letter-spacing: 0.05em;
  text-transform: uppercase; color: var(--hv-navy);
  border-bottom: 1px solid var(--hv-line); padding-bottom: 4px;
  position: sticky; top: 0; background: var(--hv-card);
}
.hv-table td { color: var(--hv-ink); }
.hv-table td.is-strong { font-weight: 700; }
.hv-table td.is-good { background: var(--hv-green-soft); color: var(--hv-green); }
.hv-table td.is-bad  { background: var(--hv-red-soft);   color: var(--hv-red); }
.hv-table tr.is-now td { background: var(--hv-amber-soft); }
.hv-table tr.is-now td.is-lead { color: var(--hv-amber); }
.hv-table tr:last-child td { border-bottom: none; }

/* ── 10. Timeline ruler ────────────────────────────────────── */
.hv-timeline .tl-months { display: flex; margin-bottom: 6px; }
.hv-timeline .tl-months span { flex: 1; font-size: 10px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--hv-faint); }
.hv-timeline .tl-track { display: flex; height: 26px; border-radius: 5px; overflow: hidden; }
.hv-timeline .tl-seg { display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; }
.hv-timeline .tl-seg.is-teal  { background: var(--hv-teal-soft);  color: var(--hv-teal); }
.hv-timeline .tl-seg.is-navy  { background: var(--hv-navy-soft);  color: var(--hv-navy); }
.hv-timeline .tl-seg.is-amber { background: var(--hv-amber-soft); color: var(--hv-amber); }
.hv-timeline .tl-events { position: relative; height: 20px; margin-top: 4px; }
.hv-timeline .tl-event { position: absolute; transform: translateX(-50%); font-size: 10px; color: var(--hv-amber); font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
.hv-timeline .tl-event::before { content: '◆ '; font-size: 8px; }

/* ── 11. Flow grid (lanes × stages) ────────────────────────── */
.hv-flowgrid { display: grid; grid-template-columns: 104px 1fr 30px 1fr 30px 1fr 74px; row-gap: 4px; align-items: center; }
.hv-flowgrid .fg-head { font-size: 10px; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: var(--hv-muted); padding-bottom: 6px; border-bottom: 1px solid var(--hv-line); align-self: end; }
.hv-flowgrid .fg-head.is-center { text-align: center; }
.hv-flowgrid .fg-head.is-right { text-align: right; }
.hv-flowgrid .fg-head.is-teal  { color: var(--hv-teal); }
.hv-flowgrid .fg-head.is-navy  { color: var(--hv-navy); }
.hv-flowgrid .fg-head.is-amber { color: var(--hv-amber); }
.hv-flowgrid .lane { display: contents; }
.hv-flowgrid .lane > * { padding: 7px 0; border-bottom: 1px solid var(--hv-line-faint); }
.hv-flowgrid .lane-label { font-size: 12.5px; font-weight: 700; color: var(--hv-navy); }
.hv-flowgrid .lane-label .fmt { display: block; font-size: 10px; font-weight: 500; color: var(--hv-faint); }
.hv-flowgrid .lane-total { text-align: right; font-size: 16px; font-weight: 800; color: var(--hv-navy); font-variant-numeric: tabular-nums; }
.hv-flowgrid .lane-total small { display: block; font-size: 10px; font-weight: 600; color: var(--hv-faint); }
.hv-flowgrid .totals > * { padding-top: 8px; border-top: 1px solid var(--hv-line); border-bottom: none; font-size: 12px; font-weight: 700; color: var(--hv-muted); }

/* ── 12. Fan of creatives ──────────────────────────────────── */
.hv-fan-cell {
  display: flex; align-items: center; gap: 10px; justify-content: center;
  cursor: pointer; border-radius: var(--hv-radius-sm); padding: 5px 6px;
  border: 1px solid transparent;
}
.hv-fan-cell:hover { background: #f8fafc; border-color: var(--hv-line); }
.hv-fan-cell.is-selected { background: #f8fafc; border-color: var(--hv-navy); }
.hv-fan { position: relative; flex: 0 0 auto; }
.hv-fan .t { position: absolute; box-shadow: 0 1px 3px rgba(15,36,64,0.18); border-radius: 3px; overflow: hidden; }
.hv-fan .t:nth-child(1) { transform: rotate(-6deg); left: 0;    top: 6px; }
.hv-fan .t:nth-child(2) { transform: rotate(0deg);  left: 12px; top: 3px; }
.hv-fan .t:nth-child(3) { transform: rotate(6deg);  left: 24px; top: 0; }
.hv-fan-count {
  position: absolute; right: -8px; top: -8px; z-index: 5;
  min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px;
  color: #fff; font-size: 11px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  font-variant-numeric: tabular-nums;
  background: var(--hv-navy);
}
.hv-fan-count.is-teal  { background: var(--hv-teal); }
.hv-fan-count.is-amber { background: var(--hv-amber); }
.hv-fan-count.is-red   { background: var(--hv-red); }
/* fan footprints per dominant format */
.hv-fan.f-wide  { width: 82px; height: 44px; }
.hv-fan.f-sq    { width: 66px; height: 42px; }
.hv-fan.f-story { width: 52px; height: 46px; }

/* ── 13. Creative thumbnails ───────────────────────────────── */
.hv-thumb { position: relative; background: #fff; border: 1px solid var(--hv-line); border-radius: 3px; overflow: hidden; display: flex; flex-direction: column; }
.hv-thumb .img { flex: 1; position: relative; }
.hv-thumb .img::after { content: ''; position: absolute; inset: 0; background: linear-gradient(160deg, transparent 55%, rgba(15,36,64,0.25)); }
/* gradient placeholders — swap .img for <img> when real creatives exist */
.hv-g1 { background: linear-gradient(135deg, #0e8a7d, #1fb5a3); }
.hv-g2 { background: linear-gradient(135deg, #0f2440, #2d4a75); }
.hv-g3 { background: linear-gradient(135deg, #b45309, #e08b3c); }
.hv-g4 { background: linear-gradient(135deg, #475569, #7d92ab); }
.hv-g5 { background: linear-gradient(135deg, #7c3aed, #a78bfa); }
.hv-g6 { background: linear-gradient(135deg, #0369a1, #38bdf8); }
.hv-thumb .txtbar { background: #fff; padding: 3px 4px; }
.hv-thumb .h { display: block; height: 3px; border-radius: 2px; background: #cbd5e1; margin-bottom: 2px; }
.hv-thumb .h.short { width: 60%; }
.hv-thumb .cta { position: absolute; bottom: 4px; left: 4px; background: #fff; color: var(--hv-navy); font-size: 5px; font-weight: 800; padding: 1.5px 4px; border-radius: 2px; }
.hv-thumb .logo { position: absolute; top: 3px; left: 3px; background: rgba(255,255,255,0.92); color: var(--hv-navy); font-size: 5px; font-weight: 800; padding: 1px 3px; border-radius: 2px; }
.hv-thumb .play { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); width: 0; height: 0; border-left: 9px solid rgba(255,255,255,0.95); border-top: 6px solid transparent; border-bottom: 6px solid transparent; filter: drop-shadow(0 1px 2px rgba(0,0,0,0.3)); }
.hv-thumb .storybar { position: absolute; top: 2px; left: 3px; right: 3px; height: 2px; border-radius: 1px; background: rgba(255,255,255,0.5); }
.hv-thumb .storybar::after { content: ''; display: block; width: 40%; height: 100%; background: #fff; border-radius: 1px; }
.hv-thumb .storycta { position: absolute; bottom: 3px; left: 50%; transform: translateX(-50%); background: rgba(255,255,255,0.95); color: var(--hv-navy); font-size: 4.5px; font-weight: 800; padding: 1.5px 5px; border-radius: 6px; white-space: nowrap; }
/* format footprints: fan scale */
.hv-thumb.fmt-mpu   { width: 40px; height: 33px; }
.hv-thumb.fmt-lb    { width: 52px; height: 12px; flex-direction: row; }
.hv-thumb.fmt-lb .txtbar { width: 40%; display: flex; flex-direction: column; justify-content: center; }
.hv-thumb.fmt-land  { width: 48px; height: 27px; }
.hv-thumb.fmt-sq    { width: 34px; height: 34px; }
.hv-thumb.fmt-story { width: 22px; height: 39px; }
/* format footprints: detail scale (wrap in .hv-asset) */
.hv-asset .hv-thumb.fmt-mpu   { width: 120px; height: 100px; }
.hv-asset .hv-thumb.fmt-lb    { width: 128px; height: 22px; }
.hv-asset .hv-thumb.fmt-land  { width: 128px; height: 72px; }
.hv-asset .hv-thumb.fmt-sq    { width: 104px; height: 104px; }
.hv-asset .hv-thumb.fmt-story { width: 66px;  height: 117px; }
.hv-asset .hv-thumb .h { height: 4px; margin-bottom: 3px; }
.hv-asset .hv-thumb .cta { font-size: 8px; padding: 2px 6px; bottom: 6px; left: 6px; }
.hv-asset .hv-thumb .logo { font-size: 8px; padding: 2px 5px; top: 5px; left: 5px; }
.hv-asset .hv-thumb .storycta { font-size: 7.5px; padding: 3px 9px; bottom: 6px; }
.hv-asset .hv-thumb .play { border-left-width: 14px; border-top-width: 9px; border-bottom-width: 9px; }

/* ── 14. Asset card + status ───────────────────────────────── */
.hv-asset { width: 128px; }
.hv-asset .preview { display: flex; align-items: flex-end; justify-content: center; margin-bottom: 6px; }
.hv-asset .name { font-size: 11px; font-weight: 700; color: var(--hv-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hv-asset .meta { font-size: 10px; color: var(--hv-faint); display: flex; align-items: center; gap: 5px; }
.hv-asset-strip { display: flex; gap: 14px; flex-wrap: wrap; align-items: flex-end; }

.hv-dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }
.hv-dot.is-live   { background: var(--hv-green); }
.hv-dot.is-review { background: var(--hv-amber); }
.hv-dot.is-paused { background: var(--hv-faint); }
.hv-legend { display: flex; gap: 14px; font-size: 10.5px; color: var(--hv-muted); }
.hv-legend span { display: flex; align-items: center; gap: 5px; }

/* ── 15. Chart conventions ─────────────────────────────────── */
.hv-chart-legend { display: flex; gap: 14px; font-size: 11px; color: var(--hv-muted); }
.hv-chart-legend span { display: flex; align-items: center; gap: 5px; }
.hv-swatch { width: 16px; height: 0; border-top: 2px solid; }
.hv-swatch.is-actual { border-color: var(--hv-teal); }
.hv-swatch.is-target { border-top-style: dashed; border-color: var(--hv-faint); }
.hv-swatch.is-now    { border-top-style: dotted; border-color: var(--hv-amber); }
