/* dashboard.css — owned by WP3 (home dashboard: greeting banner, 3-zone grid,
 * metric cards, activity feed, charts, regulatory-watch hero, compliance table).
 * Ported verbatim from eudr-x operator-react.css (home-* → ct-home-*) —
 * geometry, clamps, z-indices and keyframe timings are unchanged. Colours are
 * Storm / Cyan tokens only (tokens.css): cards are glass, and nearly all of
 * dark mode is the token flip in dark.css. The one dark rule left here is the
 * welcome band's, which is Storm in both themes. */

/* ═══════════════════ SCROLL RELEASE / PAGE-ROOT ═══════════════════
   The dashboard mounts into #page-root (the shell's scroll host, layout.css).
   Free it from the 1120px content cap and make it a flex column so .ct-home-tab
   can fill. On ≥1441px the grid fits the viewport (no page scroll); below, the
   tab releases its height lock and #page-root scrolls (eudr-x `.gt-main:has`
   pattern, re-scoped to `.ct-main:has(.ct-home-tab)`). */
.ct-main > #page-root.ct-dashboard {
  max-width: none;
  display: flex;
  flex-direction: column;
}

.ct-home-tab {
  display: flex;
  flex-direction: column;
  gap: 10px;
  /* Height comes from content — nothing here is height-locked to the viewport
     any more, so there is no growth to negotiate, only a shrink to forbid (the
     compliance section below is a flex sibling of #page-root and would otherwise
     crush these rows instead of pushing the page into scroll). */
  flex: 0 0 auto;
  padding: 0 2px 4px;
}

/* ═══════════════════ WELCOME BANNER (operator-react.css:3130-3208) ═══════════════════ */
/* A Storm band with the brand's cyan glow in its top-right corner. It is dark
   in BOTH themes, so its ink comes from the --chrome-* ramp, which never flips. */
.ct-home-welcome {
  background:
    radial-gradient(60% 170% at 100% 0%, rgb(var(--cyan-rgb) / 0.18), transparent 62%),
    linear-gradient(135deg, var(--brand-storm) 0%, var(--storm-lift) 55%, var(--storm-lift-3) 100%);
  border-radius: var(--radius-fluid);
  /* 18px/24px around three stacked lines made this band ~130px tall — the single
     largest element on the dashboard, spent on the user's own name and today's
     date. Two lines, tighter padding, ~74px. */
  padding: 12px 20px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 6px 24px rgb(var(--storm-rgb) / 0.22);
  flex-shrink: 0;
}
.ct-home-welcome-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  position: relative;
  z-index: 1;
}
/* Inline inside the h1 now ("Good afternoon, Demo QHSE" on one line): the
   greeting is the quiet half, the name the loud half. */
.ct-home-welcome-greeting {
  color: var(--chrome-sec);
  font-weight: 400;
}
.ct-home-welcome-name {
  font-family: var(--font-sans);
  font-size: 1.15rem;
  color: var(--chrome-ink);
  line-height: 1.3;
  margin: 0 0 2px;
  font-weight: 700;
}
.ct-home-welcome-date {
  font-size: 0.76rem;
  color: var(--chrome-dim);
  font-weight: 400;
  margin: 0;
}
/* CTA pill (operator-react.css:3182-3208): a cyan-washed pill on the Storm
   band. No backdrop blur: over a smooth gradient it adds nothing visible. */
.ct-home-start-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 9px 20px;
  background: var(--chrome-active);
  color: var(--chrome-ink);
  border: 1.5px solid rgb(var(--cyan-rgb) / 0.4);
  border-radius: 50px;
  font-family: var(--font-sans);
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.3px;
  text-decoration: none;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
  white-space: nowrap;
  flex-shrink: 0;
}
.ct-home-start-btn:hover {
  background: rgb(var(--cyan-rgb) / 0.2);
  border-color: rgb(var(--cyan-rgb) / 0.65);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgb(0 0 0 / 0.2);
}
.ct-home-start-btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* ═══════════════════ CONTENT ROWS ═══════════════════
   Was a 2×2 areas grid ("map right / btm right") whose ROWS were fractions of
   the viewport (1.3fr / 0.8fr) with min-heights per breakpoint. Fractional rows
   hand every cell the same height whether it holds eight regulatory events or
   one, so the regulatory-watch card sat on ~200px of blank space and the
   "0 open campaigns" tile was stretched into a tall empty box. Height comes from
   content here; the page scrolls in #page-root as it always did. The rows:
     .ct-ready       — the guided readiness card (the page's spine)
     .ct-home-work   — the two chronological lists, side by side
     .ct-home-charts — three comparable charts, side by side           */
.ct-home-work {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr);
  gap: 10px;
  /* start, not stretch: these two lists grow independently, and stretching the
     shorter one is exactly how the old grid manufactured empty space. */
  align-items: start;
}
.ct-home-charts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  /* stretch IS right here — three charts of the same kind should share a
     baseline, and none of them can be empty (each renders its own zero state). */
}
.ct-home-charts .ct-home-dds-bars { gap: 6px; }
.ct-home-charts .ct-home-dds-row-bar { height: 10px; }

/* Card footer link (regulatory watch → Changes) */
.ct-home-card-foot {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  font-size: var(--text-sm);
}

/* ═══════════════════ GUIDED READINESS CARD ═══════════════════
   One card that answers "am I OK / what do I do / where am I". It replaced a KPI
   tile row and then a five-stage pipeline strip; both were status displays that
   showed state without ever asking for an action. The order inside the card is
   the order the questions get asked:
     heading + "2 of 4 steps done" + the nearest deadline   → am I OK
     segmented bar                                         → how far along
     DO THIS NEXT + one button                             → what do I do
     the four steps with a you-are-here marker             → where am I
   The bar is SEGMENTED, one segment per step, deliberately not a percentage:
   confirming 31 extracted values and clicking "build package" are not the same
   size of job, and a percentage across uneven steps misstates how close you are. */
.ct-ready {
  background: var(--glass-lit), var(--glass);
  border: 1px solid transparent;
  border-radius: var(--radius-glass);
  box-shadow: inset 0 0 0 0.5px var(--glass-edge), inset 0 1px 0 var(--glass-edge), var(--glass-shadow);
  padding: 18px 22px 16px;
}
.ct-ready-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
}
.ct-ready-title {
  font-family: var(--font-sans);
  font-size: var(--text-lg);
  font-weight: 800;
  color: var(--primary);
  margin: 0;
  line-height: 1.25;
}
.ct-ready-count {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--text-muted);
  margin-top: 2px;
}
.ct-ready-intro {
  margin: 10px 0 0;
  font-size: var(--text-base);
  color: var(--text-muted);
  line-height: 1.5;
  max-width: 80ch;
}

/* Nearest deadline, promoted into the header: "244 days left" only means
   something next to how far from ready you are. */
.ct-ready-due {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  flex-wrap: wrap;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  text-decoration: none;
  color: inherit;
  font-size: var(--text-sm);
}
.ct-ready-due:hover { background: var(--surface-3); }
.ct-ready-due-count {
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.ct-ready-due-title { color: var(--text-muted); }
.ct-ready-due .ct-deadline-overdue { color: var(--confirmed); }
.ct-ready-due .ct-deadline-urgent { color: var(--potential); }

/* Segmented bar: one segment per step. */
.ct-ready-bar {
  display: flex;
  gap: 4px;
  margin: 14px 0 0;
}
/* The empty-segment colour is a variable, not a background a dark-mode rule
   re-declares: `body.dark-mode .ct-ready-seg` would outweigh `.ct-ready-seg--done`
   (two classes beats one) and paint COMPLETED segments grey. --border flips
   with the theme, so no dark rule is needed at all.
   Green = done (it matches the step checks), cyan = where you are (it matches
   the "you are here" tag and the highlighted step row). */
.ct-ready-seg {
  --seg-empty: var(--border);
  flex: 1 1 0;
  height: 6px;
  border-radius: 3px;
  background: var(--seg-empty);
}
.ct-ready-seg--done { background: var(--clear); }
.ct-ready-seg--current {
  /* Half-filled reads as "in progress" without claiming a false fraction. */
  background: linear-gradient(90deg, var(--highlight) 0 50%, var(--seg-empty) 50% 100%);
}

/* The prescriptive block — the only button on the card. */
.ct-ready-action {
  margin-top: 16px;
  padding: 14px 16px 16px;
  border-radius: var(--radius);
  background: var(--surface-2);
  border: 1px solid var(--accent);
}
.ct-ready-action--clear {
  border-color: var(--clear-edge);
  background: var(--clear-tint);
}
.ct-ready-action-label {
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  /* --link, not --accent: this is small text, and --accent (cyan-deep) is
     only 3.6:1 on white. --link is the cyan-ink text tone and flips to cyan. */
  color: var(--link);
  margin-bottom: 4px;
}
.ct-ready-action-title {
  font-family: var(--font-sans);
  font-size: var(--text-md);
  font-weight: 800;
  color: var(--text);
  line-height: 1.3;
}
.ct-ready-action-why {
  margin: 4px 0 12px;
  font-size: var(--text-sm);
  color: var(--text-muted);
  line-height: 1.5;
  max-width: 88ch;
}
.ct-ready-action-cta {
  display: inline-flex;
  text-decoration: none;
}
.ct-ready-action--clear .ct-ready-action-why { margin-bottom: 0; }

/* The four steps. Done = check + struck-back tone, current = highlighted with a
   "you are here" tag, upcoming = quiet. */
.ct-ready-list {
  list-style: none;
  margin: 16px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}
.ct-ready-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border-top: 1px solid var(--border);
  font-size: var(--text-sm);
}
.ct-ready-item:first-child { border-top: none; }
.ct-ready-check,
.ct-ready-num {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.66rem;
  font-weight: 800;
}
.ct-ready-check {
  background: var(--clear);
  /* --text-invert, not white: dark mode lightens --clear to mint, where a
     white check would vanish. */
  color: var(--text-invert);
}
.ct-ready-num {
  border: 1.5px solid var(--border-strong);
  color: var(--text-muted);
}
.ct-ready-item-title {
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  min-width: 0;
}
.ct-ready-item-title:hover { text-decoration: underline; }
.ct-ready-item-meta {
  margin-left: auto;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.ct-ready-here {
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--highlight-ink);
  background: var(--highlight);
  border: 1px solid var(--highlight);
  border-radius: var(--radius-pill);
  padding: 1px 7px;
  white-space: nowrap;
}
.ct-ready-item--done .ct-ready-item-title { color: var(--text-muted); }
.ct-ready-item--current {
  background: var(--primary-soft);
}
.ct-ready-item--current .ct-ready-item-title { font-weight: 800; }
.ct-ready-item--todo .ct-ready-item-title,
.ct-ready-item--todo .ct-ready-item-meta { color: var(--text-subtle); }

/* Readiness is a count of steps this product can see, not a legal position —
   the same care the verdicts take about provisional reference data. */
.ct-ready-caveat {
  margin: 12px 0 0;
  font-size: var(--text-xs);
  color: var(--text-subtle);
  line-height: 1.45;
}
.ct-ready-flags {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.ct-ready-flags-label {
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--text-subtle);
}
.ct-ready--firstrun {
  max-width: 820px;
}
.ct-ready-skel-bar {
  height: 6px;
  border-radius: 3px;
  width: 100%;
}

/* ═══════════════════ CHART CARDS (operator-react.css:3254-3315) ═══════════════════ */
.ct-home-chart-card {
  background: var(--glass-lit), var(--glass);
  border: 1px solid transparent;
  border-radius: var(--radius-glass);
  padding: 18px 20px 16px;
  box-shadow: inset 0 0 0 0.5px var(--glass-edge), inset 0 1px 0 var(--glass-edge), var(--glass-shadow);
  display: flex;
  flex-direction: column;
}
.ct-home-chart-card--clickable {
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition);
}
.ct-home-chart-card--clickable:hover {
  transform: translateY(-2px);
  /* Keep the glass edges; only the outer shadow deepens. */
  box-shadow: inset 0 0 0 0.5px var(--glass-edge), inset 0 1px 0 var(--glass-edge), var(--shadow-lg);
}
.ct-home-chart-card:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}
.ct-home-chart-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 8px;
}
.ct-home-chart-title svg { flex-shrink: 0; }

/* Operator typography bump (operator-react.css:3792-3818) */
.ct-home-tab .ct-home-chart-title { font-size: 1rem; }
.ct-home-tab .ct-home-dds-total-num { font-size: 1.55rem; }
.ct-home-tab .ct-home-dds-total-label { font-size: 0.88rem; }
.ct-home-tab .ct-home-dds-row-label { font-size: 0.88rem; }
.ct-home-tab .ct-home-dds-row-count { font-size: 0.92rem; }
.ct-home-tab .ct-home-legend-item { font-size: 0.86rem; }
.ct-home-tab .ct-home-legend-name { font-size: 0.9rem; }
.ct-home-tab .ct-home-legend-pct { font-size: 0.84rem; }
@media (min-width: 769px) and (max-width: 1399px) {
  .ct-home-tab .ct-home-chart-title { font-size: 0.94rem; }
  .ct-home-tab .ct-home-dds-total-num { font-size: 1.4rem; }
  .ct-home-tab .ct-home-dds-total-label { font-size: 0.82rem; }
  .ct-home-tab .ct-home-dds-row-label { font-size: 0.82rem; }
  .ct-home-tab .ct-home-dds-row-count { font-size: 0.86rem; }
  .ct-home-tab .ct-home-legend-item { font-size: 0.8rem; }
  .ct-home-tab .ct-home-legend-name { font-size: 0.82rem; }
  .ct-home-tab .ct-home-legend-pct { font-size: 0.78rem; }
}

/* ═══════════════════ DONUT (operator-react.css:3318-3374) ═══════════════════ */
.ct-home-donut-wrap {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-height: 0;
}
.ct-home-donut-wrap > svg {
  width: 120px;
  height: 120px;
  flex-shrink: 0;
}
.ct-home-donut-num {
  font-family: var(--font-sans);
  font-size: 20px;
  font-weight: 800;
  fill: var(--primary);
}
.ct-home-donut-unit {
  font-family: var(--font-sans);
  font-size: 8px;
  letter-spacing: 1.5px;
  fill: var(--text-muted);
}
.ct-home-legend {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}
.ct-home-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.74rem;
  min-width: 0;
}
.ct-home-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.ct-home-legend-name {
  flex: 1;
  color: var(--text);
  font-weight: 500;
  font-size: 0.79rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ct-home-legend-count {
  font-weight: 700;
  color: var(--text);
  min-width: 18px;
  text-align: right;
}
.ct-home-legend-pct {
  font-size: 0.72rem;
  color: var(--text-muted);
  min-width: 34px;
  text-align: right;
}

/* ═══════════════════ DDS BAR LIST (operator-react.css:3536-3609) ═══════════════════ */
.ct-home-dds-total {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 5px;
}
.ct-home-dds-total-num {
  font-family: var(--font-sans);
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1;
}
.ct-home-dds-total-label {
  font-size: 0.78rem;
  color: var(--text-muted);
}
.ct-home-dds-bars {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  justify-content: space-evenly;
}
.ct-home-dds-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.ct-home-dds-row-label {
  width: 120px;
  font-size: 0.77rem;
  font-weight: 600;
  color: var(--text);
  flex-shrink: 0;
  line-height: 1.3;
}
.ct-home-dds-row-bar {
  flex: 1;
  height: 16px;
  background: var(--surface-3);
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.ct-home-dds-bar-fill {
  height: 100%;
  border-radius: 4px;
  min-width: 0;
}
.ct-home-dds-row-count {
  width: 26px;
  text-align: right;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text);
}

/* ═══════════════════ ACTIVITY FEED (spec-widgets §5.2) ═══════════════════ */
.ct-home-activity-feed {
  overflow: hidden;
}
.ct-home-activity-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 10px;
}
.ct-home-activity-list { list-style: none; margin: 0; padding: 0; }
.ct-home-activity-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding-bottom: 14px;
  position: relative;
}
.ct-home-activity-item:last-child { padding-bottom: 0; }
.ct-home-activity-rail {
  position: relative;
  width: 9px;
  flex-shrink: 0;
  align-self: stretch;
  margin-top: 5px;
}
.ct-home-activity-dot {
  display: block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--dot);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--dot) 13%, transparent);
  position: relative;
  z-index: 1;
}
.ct-home-activity-line {
  position: absolute;
  top: 13px;
  bottom: -14px;
  left: 50%;
  width: 2px;
  transform: translateX(-50%);
  background: var(--border);
}
.ct-home-activity-item:last-child .ct-home-activity-line { display: none; }
.ct-home-activity-body { flex: 1; min-width: 0; }
.ct-home-activity-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ct-home-activity-time {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 1px;
}
.ct-home-activity-empty {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-style: italic;
  padding: 8px 0;
}

/* ═══════════════════ REGULATORY WATCH HERO (chart-card chrome + timeline) ═══════════════════ */
.ct-home-regwatch-card {
  overflow: hidden;
  /* NOT align-self: stretch. That was left over from the fractional grid and it
     overrode the row's `align-items: start`, so this card kept matching the
     height of whatever sat beside it and its flex:1 body absorbed the difference
     as blank space — the void this rebuild set out to remove, reintroduced by one
     line. Content height; a ragged bottom edge next to a taller neighbour is the
     honest result. */
  align-self: start;
}
.ct-home-regwatch-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  flex-shrink: 0;
}
.ct-home-regwatch-header .ct-home-chart-title { margin-bottom: 0; }
.ct-home-regwatch-body {
  flex: 1;
  min-height: 0;
  /* Cap, don't stretch: eight regulatory events scroll inside 260px instead of
     making the card (and the row it shares) 600px tall, and one event leaves the
     card 100px tall instead of holding 260px of blank space open. */
  max-height: 260px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.ct-home-regwatch-body .ct-home-activity-label { white-space: normal; }
.ct-home-recheck {
  padding: 6px 12px;
  font-size: 0.78rem;
  gap: 6px;
  flex-shrink: 0;
}
@media (max-width: 600px) {
  /* "Επανέλεγχος χαρτοφυλακίου" ran past the card at 390px */
  .ct-home-recheck {
    flex-shrink: 1;
    min-width: 0;
    white-space: normal;
  }
}
/* Reference freshness chips (styled like the eudr-x .sc-legend chips) */
.ct-home-ref {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.ct-home-ref-label {
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--text-subtle);
  margin-bottom: 6px;
}
.ct-home-ref-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.ct-home-ref-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 20px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  font-size: 0.7rem;
}
.ct-home-ref-chip-code {
  font-weight: 800;
  color: var(--text);
  letter-spacing: 0.2px;
}
.ct-home-ref-chip-meta {
  color: var(--text-muted);
  font-size: 0.66rem;
}

/* ═══════════════════ COMPLIANCE SECTION (below the grid) ═══════════════════ */
.ct-home-below {
  margin-top: 14px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.ct-home-section-title {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--canvas-text-muted); /* sits on the ground, not in a card */
}
/* Section header: title on the left, its filters on the right, one row. */
.ct-home-below-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
}
.ct-home-filters {
  margin: 0;
  gap: var(--space-3);
}
/* The regime select sized itself to its longest option and came out ~370px next
   to a 137px status select. Equal, bounded lanes instead. */
.ct-home-filters .ct-question {
  min-width: 0;
}
.ct-home-filters select {
  width: 200px;
  max-width: 100%;
}

/* ═══════════════════ WIDGET SKELETON (spec-widgets §9) ═══════════════════ */
.ct-home-skel-banner {
  border-radius: var(--radius-fluid);
  flex-shrink: 0;
}
.ct-home-skel-body {
  flex: 1 1 auto;
  min-height: 44px;
  margin-top: 10px;
}

/* ═══════════════════ RESPONSIVE ═══════════════════
   Five tiers (1599/1440/1280/1024/768/480) collapsed to three. The old ones
   existed to re-negotiate viewport height locks and per-breakpoint min-heights
   that no longer exist: with content-driven rows there is nothing to unlock, so
   the only decisions left are how many columns each row gets. */

/* Laptop chrome: same layout, tighter card padding and type. */
@media (min-width: 1025px) and (max-width: 1599px) {
  .ct-ready { padding: 16px 18px 14px; }
  .ct-ready-action { padding: 12px 14px 14px; }
  .ct-home-chart-card { padding: 14px 16px 12px; }
  .ct-home-tab .ct-home-chart-title { font-size: 0.78rem; margin-bottom: 5px; }
}

/* Tablet landscape / small laptop: the two lists stack, charts drop to 2-up (the
   donut keeps the wider cell). The pipeline stays one row — five stages at
   ~130px each still fit, and breaking the chain is what would cost the meaning. */
@media (max-width: 1024px) {
  .ct-home-work { grid-template-columns: minmax(0, 1fr); }
  .ct-home-charts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ct-home-charts .ct-home-donut-card { grid-column: 1 / -1; }
}

/* Tablet portrait and below: one card per row, and the pipeline wraps to a 2-up
   grid — below ~700px five columns would each be ~90px, too narrow for a label
   and a number. Reading order still runs 1→5, so the chain survives the wrap. */
@media (max-width: 768px) {
  .ct-home-charts { grid-template-columns: minmax(0, 1fr); }
  .ct-home-charts .ct-home-donut-card { grid-column: auto; }
  .ct-home-welcome { padding: 16px 18px; }
  .ct-home-welcome-content { flex-direction: column; align-items: flex-start; gap: 14px; }
  .ct-home-welcome-name { font-size: 1.25rem; }
  .ct-home-start-btn { width: 100%; justify-content: center; }
  .ct-ready { padding: 14px 16px 14px; }
  /* The step rows wrap rather than squeezing the count against the title. */
  .ct-ready-item { flex-wrap: wrap; row-gap: 2px; }
  .ct-ready-item-meta { margin-left: 28px; text-align: left; }
  .ct-ready-action-cta { width: 100%; justify-content: center; }
}

@media (max-width: 480px) {
  .ct-home-tab { gap: 8px; }
  .ct-home-tab .ct-home-welcome { padding: 14px 16px; }
}

/* ═══════════════════ DARK MODE ═══════════════════
   Cards, insets, bars, chips and text all flip through the tokens (the dark
   --surface-2 / --surface-3 are lighter than the glass, so the readiness card's
   action block and step rows still lift off it). The welcome band is Storm in
   both themes, so on the Storm ground it needs a black shadow and a hairline
   edge to stay separate. */
body.dark-mode .ct-home-welcome {
  box-shadow: 0 6px 24px rgb(0 0 0 / 0.4);
  border: 1px solid var(--chrome-line);
}

/* ═══════════════════════ Deadline strip (home + ops) ═══════════════════════ */
/* Sits directly under the welcome banner: the countdown is the one number on
   the dashboard that changes behaviour, so it outranks every chart below it. */
.ct-deadline-strip {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  flex-wrap: wrap;
  margin-bottom: var(--space-4);
  padding: var(--space-3) var(--space-4);
  background: var(--glass-lit), var(--glass);
  border: 1px solid transparent;
  border-radius: var(--radius-glass);
  box-shadow: inset 0 0 0 0.5px var(--glass-edge), inset 0 1px 0 var(--glass-edge), var(--glass-shadow);
}
.ct-deadline-strip--empty {
  color: var(--text-muted);
}
.ct-deadline-strip-label {
  font-size: var(--text-xs);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-subtle);
}
/* Equal lanes rather than content-width items: with one deadline the strip was a
   full-width card with its content hugging the left third and ~600px of blank
   surface to the right, which reads as a rendering fault rather than a layout. */
.ct-deadline-list {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: var(--space-3);
  flex: 1 1 auto;
}
@media (max-width: 900px) {
  .ct-deadline-list {
    grid-auto-flow: row;
    grid-auto-columns: auto;
  }
  /* Narrow: back to the stacked form — a countdown, a long regime name and a
     date do not fit on one phone-width line. */
  .ct-deadline-item:only-child {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
  }
}
.ct-deadline-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  text-decoration: none;
  color: inherit;
}
.ct-deadline-item:hover {
  background: var(--surface-3);
}
/* A single deadline gets the whole strip, so lay it out as one row — countdown,
   what it is, then when, pushed to the right edge. Stacked, it left the right
   two-thirds of a full-width card empty. Two or three deadlines share the strip
   in lanes and stay stacked, where the compact form is the readable one. */
.ct-deadline-item:only-child {
  flex-direction: row;
  align-items: baseline;
  gap: var(--space-4);
  padding: 8px var(--space-3);
}
.ct-deadline-item:only-child .ct-deadline-meta {
  flex: 1 1 auto;
}
.ct-deadline-item:only-child .ct-deadline-title {
  flex: 1 1 auto;
}
.ct-deadline-count {
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  /* "244 days left" is one unit — it broke onto three lines when the flex row
     squeezed it on a phone. */
  white-space: nowrap;
  flex-shrink: 0;
}
.ct-deadline-meta {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  align-items: baseline;
  font-size: var(--text-sm);
  color: var(--text-muted);
}
.ct-deadline-title {
  font-weight: 600;
}
.ct-deadline-date {
  font-variant-numeric: tabular-nums;
  color: var(--text-subtle);
}
/* A statutory date the regime config has not had confirmed against the ΦΕΚ is
   never presented as fact — same rule the CMR verdicts follow. */
.ct-deadline-provisional {
  padding: 1px 6px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-pill);
  font-size: var(--text-xs);
  color: var(--text-subtle);
}
/* Severity dot ahead of the countdown (it replaced a 4px side stripe); the
   countdown text itself turns red / amber when overdue / urgent. */
.ct-deadline-item .ct-deadline-count::before,
.ct-ready-due-count::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 6px;
  border-radius: 50%;
  vertical-align: 1px;
  background: var(--neutral-status);
}
.ct-deadline-overdue .ct-deadline-count::before,
.ct-ready-due-count.ct-deadline-overdue::before { background: var(--confirmed); }
.ct-deadline-urgent .ct-deadline-count::before,
.ct-ready-due-count.ct-deadline-urgent::before { background: var(--potential); }
.ct-deadline-soon .ct-deadline-count::before,
.ct-ready-due-count.ct-deadline-soon::before { background: var(--accent); }
.ct-deadline-ok .ct-deadline-count::before,
.ct-ready-due-count.ct-deadline-ok::before { background: var(--clear); }
.ct-deadline-overdue .ct-deadline-count {
  color: var(--confirmed);
}
.ct-deadline-urgent .ct-deadline-count {
  color: var(--potential);
}
/* Inline variant used in the ops tenant table cell. */
td > .ct-deadline {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
td > .ct-deadline-overdue {
  color: var(--confirmed);
}
td > .ct-deadline-urgent {
  color: var(--potential);
}

/* ═══════════════════ ADMIN HOME (/ops, pages/ops-home.js) ═══════════════════
   EUDR's admin Home (AdminHomeTab + admin.css .home-figures): the greeting
   band, a row of figure cards, then the expert's work in two glass cards —
   the decisions across every client and the clients' summary. Like the
   client dashboard it sits on the ground, not in a page card. */
.ct-main > #page-root.ct-admin-homepage {
  max-width: none;
  display: flex;
  flex-direction: column;
}
.ct-admin-home {
  gap: 12px;
}

/* Figures: what each counts on top, the number, its line under it. Sentence
   case (Greek capitals lose their accents under text-transform). */
.ct-kpis {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}
.ct-kpi {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  min-width: 0;
  padding: 14px 16px 12px;
  border: 1px solid transparent;
  border-radius: var(--radius-glass);
  background: var(--glass-lit), var(--glass);
  box-shadow: inset 0 0 0 0.5px var(--glass-edge), inset 0 1px 0 var(--glass-edge), var(--glass-shadow);
  color: var(--text);
  font: inherit;
  text-align: left;
  text-decoration: none;
}
a.ct-kpi,
button.ct-kpi {
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition);
}
a.ct-kpi:hover,
button.ct-kpi:hover {
  color: var(--text);
  transform: translateY(-2px);
  box-shadow: inset 0 0 0 0.5px var(--glass-edge), inset 0 1px 0 var(--glass-edge), var(--shadow-lg);
}
.ct-kpi:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}
.ct-kpi-label {
  font-size: var(--text-sm);
  font-weight: 800;
  line-height: 1.3;
  color: var(--text-muted);
}
.ct-kpi-value {
  margin-top: 2px;
  font-size: 1.9rem;
  font-weight: 800;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
}
.ct-kpi-sub {
  font-size: var(--text-xs);
  line-height: 1.35;
  color: var(--text-muted);
}
/* A figure that needs attention: its number in the status colour and a rail. */
.ct-kpi--warn { box-shadow: inset 3px 0 0 var(--potential), inset 0 0 0 0.5px var(--glass-edge), var(--glass-shadow); }
.ct-kpi--danger { box-shadow: inset 3px 0 0 var(--confirmed), inset 0 0 0 0.5px var(--glass-edge), var(--glass-shadow); }
.ct-kpi--warn .ct-kpi-value { color: var(--potential); }
.ct-kpi--danger .ct-kpi-value { color: var(--confirmed); }

/* The two work cards: a title row, the toolbar, the table. */
.ct-admin-card {
  gap: 12px;
  min-width: 0;
}
.ct-admin-card-head {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.ct-admin-card-head--row {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
}
.ct-admin-card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text);
}
.ct-admin-card-title svg {
  flex: none;
  color: var(--accent);
}
.ct-admin-card-sub {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--text-muted);
}
.ct-admin-card .ct-toolbar {
  margin-bottom: 0;
}
.ct-admin-more {
  align-self: flex-start;
  font-size: var(--text-sm);
  font-weight: 700;
}

@media (max-width: 1399px) {
  .ct-kpis {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
@media (max-width: 600px) {
  .ct-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
  .ct-kpi {
    padding: 12px;
  }
  .ct-kpi-value {
    font-size: 1.6rem;
  }
}
a.ct-kpi--warn:hover,
button.ct-kpi--warn:hover {
  box-shadow: inset 3px 0 0 var(--potential), inset 0 0 0 0.5px var(--glass-edge), var(--shadow-lg);
}
a.ct-kpi--danger:hover,
button.ct-kpi--danger:hover {
  box-shadow: inset 3px 0 0 var(--confirmed), inset 0 0 0 0.5px var(--glass-edge), var(--shadow-lg);
}

/* ══════════════ Phase 2 (C1): every number opens its list ══════════════
   A door (core/charts.js door()): a legend line, a bar row or a donut
   segment, by mouse and by Tab + Enter/Space. The card's title is the
   keyboard's button to the card's own list (EUDR HomeTab.js:376-386). */
.ct-home-activity-dot.is-info { --dot: var(--accent); }
.ct-home-activity-dot.is-warning { --dot: var(--potential); }
.ct-home-activity-dot.is-danger { --dot: var(--confirmed); }

.ct-home-donut { filter: drop-shadow(0 3px 10px rgb(var(--storm-rgb) / 0.08)); }
.ct-home-donut-track { stroke: var(--border); opacity: 0.55; }
.ct-home-donut-seg.ct-door { cursor: pointer; }
.ct-home-donut-seg.ct-door:hover { opacity: 0.85; }
.ct-home-donut-seg.ct-door:focus-visible { outline: none; stroke-width: 20; }

.ct-door { cursor: pointer; border-radius: 8px; }
.ct-door:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.ct-home-legend-item.ct-door,
.ct-home-dds-row.ct-door {
  margin: 0 -6px;
  padding: 2px 6px;
  transition: background-color 0.15s ease;
}
.ct-home-legend-item.ct-door:hover,
.ct-home-dds-row.ct-door:hover {
  background: var(--surface-2);
}

.ct-home-chart-title-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  cursor: pointer;
}
.ct-home-chart-title-link:hover { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }
.ct-home-chart-title-link:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; border-radius: 4px; }

/* A figure: the words above the number, the state line under it. */
.ct-home-figure {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin: 0 0 10px;
}
.ct-home-figure-label {
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 700;
}
.ct-home-figure-value {
  color: var(--text);
  font-size: 1.55rem;
  font-weight: 800;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}
.ct-home-figure-sub {
  color: var(--text-muted);
  font-size: 0.8rem;
}
.ct-home-figure-sub.is-act {
  color: var(--potential);
  font-weight: 700;
}

/* Four charts: one row on a wide screen, two by two on a laptop. */
.ct-home-charts.ct-home-charts--four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
@media (max-width: 1599px) {
  .ct-home-charts.ct-home-charts--four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ct-home-charts.ct-home-charts--four .ct-home-donut-card { grid-column: auto; }
}
@media (max-width: 768px) {
  .ct-home-charts.ct-home-charts--four { grid-template-columns: minmax(0, 1fr); }
}
.ct-home-welcome-name .ct-help-tip { margin-left: 8px; }
.ct-home-donut-seg.is-lit { stroke-width: 20; }
/* The "?" on the green welcome banner reads in the banner's own ink. */
.ct-home-welcome .ct-help-tip { color: var(--text-invert); --help-tip-disc: 0.22; }

/* a step of the work that is Green Trust's (technical questionnaire Q55) */
.ct-ready-who { font-size: 0.72rem; font-weight: 600; padding: 2px 8px; border-radius: 999px;
  background: rgba(2, 163, 164, 0.1); color: var(--accent); white-space: nowrap; }
