/*
 * YEDP INTERFACE COMMAND LAYER — DEV_027 R9
 * ---------------------------------------------------------------------------
 * A single structural authority for every CURRENT surface:
 *   ministry-admin, mission-admin, ministry-protocol, ministry-intelligence,
 *   ministry-national-network, ministry-organizations, organizations-portal,
 *   diplomatic-portal, sovereign correspondence.
 *
 * The layer is loaded AFTER each surface stylesheet. It does not replace the
 * per-surface palettes; it normalises DENSITY, NAVIGATION HIERARCHY, TABLES,
 * FILTERS, ACTION BARS, WORKFLOW and RESPONSIVE behaviour so that the same
 * institutional gesture means the same thing on every screen.
 *
 * Rules obeyed here:
 *   - logical properties only (inline-start/end) so RTL and LTR both hold;
 *   - no colour invention: every colour resolves from a surface token with a
 *     documented fallback;
 *   - nothing here hides an actionable control at any viewport;
 *   - no !important except where a surface stylesheet already used one.
 */

/* ═══ 1. DENSITY AND MEASURE ══════════════════════════════════════════════ */

:root {
  /* Density multiplier. 1 = comfortable (default), .82 = compact. */
  --yc-density: 1;

  --yc-step-1: calc(0.25rem * var(--yc-density));
  --yc-step-2: calc(0.5rem * var(--yc-density));
  --yc-step-3: calc(0.75rem * var(--yc-density));
  --yc-step-4: calc(1rem * var(--yc-density));
  --yc-step-5: calc(1.5rem * var(--yc-density));
  --yc-step-6: calc(2rem * var(--yc-density));

  /* Row and control geometry driven by density. */
  --yc-row-h: calc(3rem * var(--yc-density));
  --yc-row-pad-y: calc(0.7rem * var(--yc-density));
  --yc-row-pad-x: calc(0.85rem * var(--yc-density));
  --yc-head-pad-y: calc(0.55rem * var(--yc-density));
  --yc-control-h: 2.5rem;              /* never shrinks: touch target floor */
  --yc-touch-floor: 2.75rem;

  /* Type scale for dense operational reading. */
  --yc-text-micro: 0.6875rem;
  --yc-text-meta: 0.75rem;
  --yc-text-body: 0.8125rem;
  --yc-text-lead: 0.9375rem;
  --yc-text-title: 1.0625rem;
  --yc-text-display: clamp(1.4rem, 2.1vw, 1.95rem);
  --yc-leading-dense: 1.5;

  /* Structural resolution against whatever the surface already defines. */
  --yc-line: var(--line, var(--border, var(--yedp-border, #dbe3ec)));
  --yc-line-soft: color-mix(in srgb, var(--yc-line) 55%, transparent);
  --yc-paper: var(--paper, var(--surface, var(--yedp-surface, #fff)));
  --yc-canvas: var(--bg, var(--surface, var(--yedp-page, #f4f7fa)));
  --yc-ink: var(--ink, var(--text, var(--yedp-text, #14263c)));
  --yc-muted: var(--muted, var(--text-muted, var(--yedp-text-muted, #5f6f82)));
  --yc-navy: var(--navy, var(--navy-900, var(--yedp-navy-900, #0d2a48)));
  --yc-gold: var(--gold, var(--gold-500, var(--yedp-gold-500, #b99854)));
  --yc-focus: var(--focus, var(--yedp-focus, #1f6fc4));

  --yc-radius: 12px;
  --yc-radius-sm: 8px;
  --yc-shadow-flat: 0 1px 2px rgb(9 30 52 / 6%);
  --yc-shadow-raised: 0 10px 30px rgb(9 30 52 / 8%);

  --yc-z-sticky: 20;
  --yc-z-actionbar: 40;
  --yc-z-drawer: 60;
}

[data-density="compact"] { --yc-density: 0.82; }
[data-density="comfortable"] { --yc-density: 1; }

/* Density is an operator choice, not a viewport guess — but a coarse pointer
   never gets the compact row height, because the touch floor wins. */
@media (pointer: coarse) {
  :root { --yc-row-h: max(calc(3rem * var(--yc-density)), var(--yc-touch-floor)); }
}

/* ═══ 2. INFORMATION DENSITY — SHARED PRIMITIVES ══════════════════════════ */

/* Metric strips: one authority for every surface that shows KPI cards.
   Auto-fit replaces the fixed repeat(6) counts each surface hard-coded, so a
   1280px laptop no longer gets six 130px cards with clipped Arabic labels. */
.yc-metrics,
.metric-grid,
.metrics,
.executive-metrics,
.editorial-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11.5rem, 1fr));
  gap: var(--yc-step-3);
  margin-block-end: var(--yc-step-4);
}

.yc-metric,
.metric-card,
.metric,
.editorial-metric,
.metrics > a {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-rows: auto auto;
  gap: var(--yc-step-1) var(--yc-step-3);
  align-content: start;
  min-height: calc(5.5rem * var(--yc-density));
  padding: var(--yc-step-3);
  border: 1px solid var(--yc-line);
  border-radius: var(--yc-radius-sm);
  background: var(--yc-paper);
  box-shadow: var(--yc-shadow-flat);
}

/* The number leads; the label follows. Reversing this was the single biggest
   scanning cost in the R8 dashboards. */
.yc-metric__value,
.metric-card strong,
.metric strong,
.editorial-metric strong,
.metrics strong {
  grid-column: 2;
  order: 1;
  font-size: calc(1.65rem * var(--yc-density));
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  color: var(--yc-navy);
}

.yc-metric__label,
.metric-card p,
.metric span,
.editorial-metric span,
.metrics small {
  grid-column: 2;
  order: 2;
  margin: 0;
  min-height: 0;                 /* was 32px on organizations — dead space */
  font-size: var(--yc-text-meta);
  line-height: 1.4;
  color: var(--yc-muted);
}

.yc-metric__icon,
.metric-card__icon,
.metric-icon {
  grid-column: 1;
  grid-row: 1 / 3;
  display: grid;
  place-items: center;
  inline-size: calc(2.4rem * var(--yc-density));
  block-size: calc(2.4rem * var(--yc-density));
  border-radius: var(--yc-radius-sm);
}

/* A metric that is a button must not look like a static card. */
.yc-metric[role="button"], button.metric-card, button.editorial-metric,
.command-metric, .editorial-pulse-card {
  cursor: pointer;
  text-align: start;
  transition: border-color var(--yedp-motion-fast, 120ms) ease,
              box-shadow var(--yedp-motion-fast, 120ms) ease;
}
.command-metric:hover, button.metric-card:hover, .editorial-pulse-card:hover,
button.editorial-metric:hover {
  border-color: var(--yc-gold);
  box-shadow: var(--yc-shadow-raised);
}
.command-metric::after { display: none; }   /* decorative blob ate the label */

/* Panels: consistent header/body rhythm regardless of surface class name. */
.yc-panel,
.panel {
  border: 1px solid var(--yc-line);
  border-radius: var(--yc-radius);
  background: var(--yc-paper);
  box-shadow: var(--yc-shadow-flat);
  overflow: clip;
}
.yc-panel__head,
.panel__header,
.panel-head,
.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--yc-step-3);
  padding: var(--yc-step-3) var(--yc-step-4);
  border-block-end: 1px solid var(--yc-line);
  background: linear-gradient(180deg, var(--yc-paper), var(--yc-canvas));
}
.yc-panel__head h2, .yc-panel__head h3,
.panel__header h2, .panel__header h3,
.panel-head h3, .panel-heading h2 {
  margin: 0;
  font-size: var(--yc-text-title);
  line-height: 1.35;
  color: var(--yc-navy);
}
.yc-panel__head p, .panel__header p, .panel-heading p {
  margin: var(--yc-step-1) 0 0;
  font-size: var(--yc-text-meta);
  color: var(--yc-muted);
}
.yc-panel__body, .panel__body, .panel-body { padding: var(--yc-step-4); }
.yc-panel__body--flush, .panel__body--flush { padding: 0; }

/* Key/value pairs — the densest way to carry a record header. */
.yc-kv {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  gap: var(--yc-step-2) var(--yc-step-4);
  margin: 0;
}
.yc-kv > div {
  display: grid;
  gap: 2px;
  padding-block: var(--yc-step-2);
  border-block-end: 1px solid var(--yc-line-soft);
}
.yc-kv dt, .yc-kv > div > span {
  font-size: var(--yc-text-micro);
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--yc-muted);
}
.yc-kv dd, .yc-kv > div > strong {
  margin: 0;
  font-size: var(--yc-text-body);
  overflow-wrap: anywhere;
}

/* The `.kv` pattern on organizations used a 180px label rail that collapsed
   badly under Arabic. Same auto-fit treatment. */
.kv { grid-template-columns: minmax(8rem, 14rem) minmax(0, 1fr); gap: var(--yc-step-3); }
@media (max-width: 640px) { .kv { grid-template-columns: 1fr; } }

/* ═══ 3. NAVIGATION HIERARCHY ═════════════════════════════════════════════ */

/*
 * Three explicit tiers instead of one flat scroll:
 *   tier 1  .yc-nav__workspace  — which product you are inside
 *   tier 2  .yc-nav__group      — collapsible domain (persisted per surface)
 *   tier 3  .yc-nav__item       — the destination, with a live count
 */

.yc-nav { display: grid; gap: 2px; padding: var(--yc-step-2); }

.yc-nav__workspace {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: var(--yc-step-3);
  align-items: center;
  margin-block-end: var(--yc-step-3);
  padding: var(--yc-step-3);
  border: 1px solid rgb(255 255 255 / 12%);
  border-radius: var(--yc-radius-sm);
  background: rgb(255 255 255 / 6%);
}
.yc-nav__workspace strong { display: block; font-size: var(--yc-text-body); }
.yc-nav__workspace small { display: block; font-size: var(--yc-text-micro); opacity: 0.72; }

.yc-nav__group { display: grid; }
.yc-nav__group + .yc-nav__group { margin-block-start: var(--yc-step-2); }

/* The group title is a real disclosure button, not decorative text. */
.yc-nav__grouptitle,
.nav-group__title,
.nav-title,
.nav-label {
  display: flex;
  align-items: center;
  gap: var(--yc-step-2);
  inline-size: 100%;
  min-block-size: 2rem;
  margin: 0;
  padding: var(--yc-step-2) var(--yc-step-2) var(--yc-step-1);
  border: 0;
  background: transparent;
  color: currentColor;
  font-size: var(--yc-text-micro);
  font-weight: 800;
  letter-spacing: 0.06em;
  text-align: start;
  opacity: 0.72;
}
button.yc-nav__grouptitle { cursor: pointer; }
button.yc-nav__grouptitle::after {
  content: "";
  flex: 0 0 auto;
  background: none;
  inline-size: 0.42rem;
  block-size: 0.42rem;
  margin-inline-start: auto;
  /* Physical borders on purpose: this is a geometric disclosure glyph, not a
     directional one, so it must point down/up identically in RTL and LTR. */
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translate(-1px, -1px);
  transition: transform 160ms ease;
}
button.yc-nav__grouptitle[aria-expanded="false"]::after { transform: rotate(-45deg); }
.yc-nav__grouptitle[aria-expanded="false"] + .yc-nav__items { display: none; }

.yc-nav__items { display: grid; gap: 1px; }

.yc-nav__item,
.nav-item,
.sidebar nav > a,
.nav > button,
.nav > a,
.primary-nav > a {
  display: grid;
  grid-template-columns: 1.4rem minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--yc-step-2);
  inline-size: 100%;
  min-block-size: max(var(--yc-touch-floor), calc(2.6rem * var(--yc-density)));
  padding-inline: var(--yc-step-2);
  border: 0;
  border-radius: var(--yc-radius-sm);
  background: transparent;
  color: inherit;
  font-size: var(--yc-text-body);
  text-align: start;
  text-decoration: none;
  cursor: pointer;
}

/* Current destination reads instantly: bar + weight + surface, not colour alone. */
.yc-nav__item[aria-current="page"],
.nav-item[aria-current="page"],
.nav > button.active,
.primary-nav > a.active,
.sidebar nav > a.active {
  position: relative;
  background: rgb(255 255 255 / 10%);
  font-weight: 750;
}
.yc-nav__item[aria-current="page"]::before,
.nav-item[aria-current="page"]::before,
.nav > button.active::before,
.primary-nav > a.active::before,
.sidebar nav > a.active::before {
  content: "";
  position: absolute;
  inset-inline-start: 0;
  inset-block: 18%;
  inline-size: 3px;
  border-radius: 3px;
  background: var(--yc-gold);
}

/* Counts are data, not decoration: tabular, right-aligned, dimmed at zero. */
.yc-nav__count,
.nav-item__count,
.nav-badge,
.sidebar a b {
  min-inline-size: 1.6rem;
  padding: 1px var(--yc-step-2);
  border-radius: 999px;
  background: rgb(255 255 255 / 12%);
  font-size: var(--yc-text-micro);
  font-variant-numeric: tabular-nums;
  text-align: center;
}
.yc-nav__count[data-zero="true"], .nav-badge[data-zero="true"] { opacity: 0.4; }
.yc-nav__count[data-tone="alert"], .nav-badge-warn:not([data-zero="true"]) {
  background: var(--yc-gold);
  color: #14263c;
  font-weight: 800;
}

/* Sidebar chrome: one scroll region, brand pinned, footer pinned. */
.yc-sidebar, aside.sidebar, aside.side {
  display: flex;
  flex-direction: column;
  min-block-size: 0;
}
.yc-sidebar > .yc-nav, aside.sidebar > #admin-navigation,
aside.sidebar > nav, aside.side > .nav {
  flex: 1 1 auto;
  min-block-size: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

/* ═══ 4. TABLES ═══════════════════════════════════════════════════════════ */

.yc-tablewrap,
.table-shell,
.table-wrap,
.table-scroll,
.publication-operations-table-wrap {
  position: relative;
  overflow: auto;
  border: 1px solid var(--yc-line);
  border-radius: var(--yc-radius);
  background: var(--yc-paper);
  overscroll-behavior-x: contain;
}

.yc-table,
.data-table,
.thread-table,
.publication-operations-table,
.table-wrap > table,
.table-scroll > table {
  inline-size: 100%;
  border-collapse: collapse;
  font-size: var(--yc-text-body);
  font-variant-numeric: tabular-nums;
}

.yc-table thead th,
.data-table th,
.thread-table th,
.publication-operations-table th,
.table-wrap > table th,
.table-scroll > table th {
  position: sticky;
  inset-block-start: 0;
  z-index: var(--yc-z-sticky);
  padding: var(--yc-head-pad-y) var(--yc-row-pad-x);
  border-block-end: 1px solid var(--yc-line);
  background: var(--yc-canvas);
  color: var(--yc-muted);
  font-size: var(--yc-text-micro);
  font-weight: 800;
  letter-spacing: 0.03em;
  text-align: start;
  white-space: nowrap;
}

.yc-table tbody td,
.data-table td,
.thread-table td,
.publication-operations-table td,
.table-wrap > table td,
.table-scroll > table td {
  padding: var(--yc-row-pad-y) var(--yc-row-pad-x);
  border-block-end: 1px solid var(--yc-line-soft);
  vertical-align: middle;
  line-height: var(--yc-leading-dense);
}

.yc-table tbody tr:last-child td,
.data-table tbody tr:last-child td { border-block-end: 0; }

.yc-table tbody tr:hover td,
.data-table tbody tr:hover,
.table tr.click:hover,
.thread-table tr:hover td { background: color-mix(in srgb, var(--yc-canvas) 60%, transparent); }

/* Numeric columns align to the numeral, in both directions. */
.yc-table [data-numeric], .yc-num { text-align: end; font-variant-numeric: tabular-nums; }

/* Primary cell: title over context, truncated with a real title attribute. */
.yc-cell-primary strong, .cell-title strong, .publication-story a {
  display: block;
  font-weight: 700;
  color: var(--yc-navy);
  line-height: 1.4;
}
.yc-cell-primary small, .cell-title small, .record-meta, .table-subtitle {
  display: block;
  margin-block-start: 2px;
  font-size: var(--yc-text-micro);
  color: var(--yc-muted);
}
.yc-truncate {
  display: block;
  max-inline-size: 22ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Column priority: the layer hides only NON-actionable context columns, and
   only when the table has declared the priority. Actions never disappear. */
@media (max-width: 1200px) { .yc-table [data-priority="3"] { display: none; } }
@media (max-width: 960px)  { .yc-table [data-priority="2"] { display: none; } }

/* Row actions stay on one line and stay reachable. */
.yc-rowactions, .row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--yc-step-1);
  justify-content: flex-end;
}
.yc-rowactions > *, .row-actions > * {
  min-block-size: 2.1rem;
  padding-inline: var(--yc-step-2);
  font-size: var(--yc-text-micro);
  white-space: nowrap;
}

/* Card fallback below 640px: the header text is carried by data-label, which
   command-layer.mjs backfills for tables that never declared it. */
@media (max-width: 640px) {
  .yc-table.yc-table--stack thead,
  .data-table thead { display: none; }
  .yc-table.yc-table--stack tbody,
  .yc-table.yc-table--stack tr,
  .yc-table.yc-table--stack td,
  .data-table tbody, .data-table tr, .data-table td { display: block; inline-size: 100%; }
  .yc-table.yc-table--stack tr, .data-table tr {
    margin-block-end: var(--yc-step-2);
    padding: var(--yc-step-3);
    border: 1px solid var(--yc-line);
    border-radius: var(--yc-radius-sm);
    background: var(--yc-paper);
  }
  .yc-table.yc-table--stack td, .data-table td {
    display: grid;
    grid-template-columns: minmax(6.5rem, 40%) minmax(0, 1fr);
    gap: var(--yc-step-2);
    padding-inline: 0;
    padding-block: var(--yc-step-1);
    border: 0;
  }
  .yc-table.yc-table--stack td::before, .data-table td::before {
    content: attr(data-label);
    font-size: var(--yc-text-micro);
    font-weight: 800;
    color: var(--yc-muted);
  }
  .yc-table.yc-table--stack td[data-label=""]::before,
  .data-table td[data-label=""]::before { display: none; }
  .yc-table.yc-table--stack td:has(.yc-rowactions),
  .data-table td:has(.row-actions) { grid-template-columns: 1fr; }
  .yc-rowactions, .row-actions { justify-content: stretch; }
  .yc-rowactions > *, .row-actions > * { flex: 1 1 auto; justify-content: center; }
}

/* ═══ 5. FILTER BARS ══════════════════════════════════════════════════════ */

/*
 * One filter grammar: a wide query field, then equal-width facets, then the
 * action cluster pinned to the end. Auto-fit means a 5-facet bar and a
 * 15-facet bar (organizations work-queue) both stay legible.
 */
.yc-filterbar,
.filters,
.filter-bar,
.editorial-operations-filters,
.media-library-filters,
.editorial-calendar-filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10.5rem, 1fr));
  gap: var(--yc-step-2);
  align-items: end;
  margin-block-end: var(--yc-step-3);
  padding: var(--yc-step-3);
  border: 1px solid var(--yc-line);
  border-radius: var(--yc-radius-sm);
  background: var(--yc-canvas);
}

/* The search field always leads and always gets double width. */
.yc-filterbar__query,
.filters .field:first-child,
.filter-bar label:first-child,
.operations-search,
.media-search { grid-column: span 2; }

.yc-filterbar label,
.yc-filterbar .field label,
.filters .field label,
.filter-bar label > span {
  display: block;
  margin-block-end: var(--yc-step-1);
  font-size: var(--yc-text-micro);
  font-weight: 750;
  color: var(--yc-muted);
}

.yc-filterbar input, .yc-filterbar select,
.filters .field input, .filters .field select,
.filter-bar input, .filter-bar select,
.editorial-operations-filters input, .editorial-operations-filters select {
  inline-size: 100%;
  min-block-size: var(--yc-control-h);
  padding: var(--yc-step-2);
  border: 1px solid var(--yc-line);
  border-radius: var(--yc-radius-sm);
  background: var(--yc-paper);
  color: var(--yc-ink);
  font: inherit;
  font-size: var(--yc-text-body);
}

/* Action cluster: never orphaned onto its own row above 640px. */
.yc-filterbar__actions,
.filters > button:last-child,
.operations-filter-actions {
  display: flex;
  gap: var(--yc-step-2);
  align-items: end;
  grid-column: -2 / -1;
}
.yc-filterbar__actions > * { min-block-size: var(--yc-control-h); }

/* Applied-filter chips. Written by command-layer.mjs after every submit so the
   operator can see and remove exactly what is narrowing the result set. */
.yc-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--yc-step-2);
  align-items: center;
  margin-block: calc(-1 * var(--yc-step-1)) var(--yc-step-3);
}
.yc-chips:empty { display: none; }
.yc-chips__label { font-size: var(--yc-text-micro); font-weight: 800; color: var(--yc-muted); }
.yc-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--yc-step-2);
  min-block-size: 1.9rem;
  padding-inline: var(--yc-step-3);
  border: 1px solid var(--yc-line);
  border-radius: 999px;
  background: var(--yc-paper);
  font-size: var(--yc-text-micro);
}
.yc-chip__key { color: var(--yc-muted); }
.yc-chip__value { font-weight: 750; color: var(--yc-navy); }
.yc-chip__clear {
  display: grid;
  place-items: center;
  inline-size: 1.15rem;
  block-size: 1.15rem;
  border: 0;
  border-radius: 50%;
  background: color-mix(in srgb, var(--yc-navy) 10%, transparent);
  color: var(--yc-navy);
  font-size: 0.7rem;
  line-height: 1;
  cursor: pointer;
}
.yc-chip__clear:hover { background: var(--yc-navy); color: #fff; }
.yc-chips__reset {
  border: 0;
  background: none;
  color: var(--yc-navy);
  font-size: var(--yc-text-micro);
  font-weight: 800;
  text-decoration: underline;
  cursor: pointer;
}

@media (max-width: 640px) {
  .yc-filterbar, .filters, .filter-bar, .editorial-operations-filters { grid-template-columns: 1fr; }
  .yc-filterbar__query, .filters .field:first-child, .operations-search { grid-column: auto; }
  .yc-filterbar__actions, .operations-filter-actions { grid-column: auto; }
  .yc-filterbar__actions > * { flex: 1 1 auto; }
}

/* ═══ 6. ACTION BARS ══════════════════════════════════════════════════════ */

/* Page-level action bar — sits with the page title, wraps, never overflows. */
.yc-pagehead, .page-head, .page-heading, .media-command-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--yc-step-3);
  margin-block-end: var(--yc-step-4);
}
.yc-pagehead__copy, .page-head__copy { flex: 1 1 26rem; min-inline-size: 0; }
.yc-pagehead h1, .page-head h1, .page-heading h1 {
  margin: 0;
  font-size: var(--yc-text-display);
  line-height: 1.25;
  letter-spacing: -0.02em;
  color: var(--yc-navy);
}
.yc-pagehead p, .page-head p { margin: var(--yc-step-1) 0 0; font-size: var(--yc-text-meta); color: var(--yc-muted); }
.yc-pagehead__actions, .page-actions, .actions, .command-header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--yc-step-2);
  align-items: center;
}

/* Selection action bar — appears only when rows are selected, docks to the
   bottom of the viewport, and states the count it will act on. */
.yc-actionbar {
  position: sticky;
  inset-block-end: var(--yc-step-3);
  z-index: var(--yc-z-actionbar);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--yc-step-3);
  margin-block-start: var(--yc-step-3);
  padding: var(--yc-step-3) var(--yc-step-4);
  border: 1px solid color-mix(in srgb, var(--yc-navy) 22%, transparent);
  border-radius: var(--yc-radius);
  background: var(--yc-navy);
  color: #fff;
  box-shadow: 0 14px 38px rgb(9 30 52 / 26%);
}
.yc-actionbar[hidden] { display: none; }
.yc-actionbar__count {
  display: inline-flex;
  align-items: center;
  gap: var(--yc-step-2);
  font-size: var(--yc-text-body);
  font-weight: 750;
}
.yc-actionbar__count b {
  display: grid;
  place-items: center;
  min-inline-size: 1.8rem;
  block-size: 1.8rem;
  padding-inline: var(--yc-step-2);
  border-radius: 999px;
  background: var(--yc-gold);
  color: #14263c;
  font-variant-numeric: tabular-nums;
}
.yc-actionbar__group { display: flex; flex-wrap: wrap; gap: var(--yc-step-2); margin-inline-start: auto; }
.yc-actionbar__group > * { min-block-size: 2.25rem; }

/* A destructive action inside the bar must never sit adjacent to a routine one. */
.yc-actionbar__group > [data-destructive] { margin-inline-start: var(--yc-step-4); }

/* Toolbar above a table: view switch on one side, tools on the other. */
.yc-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--yc-step-2);
  padding: var(--yc-step-2) var(--yc-step-3);
  border: 1px solid var(--yc-line);
  border-block-end: 0;
  border-start-start-radius: var(--yc-radius);
  border-start-end-radius: var(--yc-radius);
  background: var(--yc-canvas);
}
.yc-toolbar + .yc-tablewrap,
.yc-toolbar + .table-shell { border-start-start-radius: 0; border-start-end-radius: 0; }
.yc-toolbar__spacer { margin-inline-start: auto; }
.yc-toolbar__result { font-size: var(--yc-text-meta); color: var(--yc-muted); font-variant-numeric: tabular-nums; }

/* Segmented control — density switch, view switch, tab-like scopes. */
.yc-segment {
  display: inline-flex;
  padding: 2px;
  border: 1px solid var(--yc-line);
  border-radius: var(--yc-radius-sm);
  background: var(--yc-paper);
}
.yc-segment > button {
  min-block-size: 2rem;
  padding-inline: var(--yc-step-3);
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--yc-muted);
  font-size: var(--yc-text-micro);
  font-weight: 750;
  cursor: pointer;
}
.yc-segment > button[aria-pressed="true"] { background: var(--yc-navy); color: #fff; }

/* ═══ 7. WORKFLOW ═════════════════════════════════════════════════════════ */

/* A single horizontal rail replaces the three different step widgets. */
.yc-workflow {
  display: flex;
  flex-wrap: wrap;
  gap: var(--yc-step-2);
  margin-block: var(--yc-step-3);
  padding: 0;
  list-style: none;
}
.yc-workflow__step {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: var(--yc-step-2);
  align-items: center;
  flex: 1 1 8.5rem;
  min-inline-size: 8.5rem;
  padding: var(--yc-step-2) var(--yc-step-3);
  border: 1px solid var(--yc-line);
  border-radius: var(--yc-radius-sm);
  background: var(--yc-paper);
}
.yc-workflow__step > span:first-child {
  display: grid;
  place-items: center;
  inline-size: 1.6rem;
  block-size: 1.6rem;
  border-radius: 50%;
  background: var(--yc-canvas);
  color: var(--yc-muted);
  font-size: var(--yc-text-micro);
  font-weight: 850;
}
.yc-workflow__step strong { font-size: var(--yc-text-meta); line-height: 1.3; }
.yc-workflow__step small { display: block; font-size: var(--yc-text-micro); color: var(--yc-muted); }
.yc-workflow__step.is-done { border-color: color-mix(in srgb, #1d6f46 40%, transparent); background: color-mix(in srgb, #1d6f46 7%, var(--yc-paper)); }
.yc-workflow__step.is-done > span:first-child { background: #1d6f46; color: #fff; }
.yc-workflow__step.is-current { border-color: var(--yc-gold); box-shadow: inset 0 0 0 1px var(--yc-gold); }
.yc-workflow__step.is-current > span:first-child { background: var(--yc-navy); color: #fff; }
.yc-workflow__step.is-blocked { border-color: color-mix(in srgb, #a33f48 45%, transparent); background: color-mix(in srgb, #a33f48 6%, var(--yc-paper)); }

/* The gate note that explains WHY the next step is unavailable. */
.yc-gate {
  display: grid;
  gap: var(--yc-step-2);
  padding: var(--yc-step-3) var(--yc-step-4);
  border: 1px solid color-mix(in srgb, var(--yc-gold) 55%, transparent);
  border-inline-start-width: 3px;
  border-radius: var(--yc-radius-sm);
  background: color-mix(in srgb, var(--yc-gold) 8%, var(--yc-paper));
}
.yc-gate strong { font-size: var(--yc-text-body); }
.yc-gate ul { margin: 0; padding-inline-start: 1.1rem; font-size: var(--yc-text-meta); }
.yc-gate li + li { margin-block-start: var(--yc-step-1); }

/* ═══ 8. MEDIA PICKER ═════════════════════════════════════════════════════ */

.yc-picker, .dev022-picker {
  inline-size: min(76rem, calc(100vw - 2rem));
  max-block-size: min(90vh, 54rem);
  padding: 0;
  border: 0;
  border-radius: var(--yc-radius);
  box-shadow: 0 30px 80px rgb(7 19 41 / 32%);
}
.yc-picker::backdrop, .dev022-picker::backdrop { background: rgb(7 19 41 / 62%); }

.yc-picker__shell, .dev022-picker-shell {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  max-block-size: min(90vh, 54rem);
  background: var(--yc-paper);
}
.yc-picker__head, .dev022-picker header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--yc-step-4);
  padding: var(--yc-step-4);
  border-block-end: 1px solid var(--yc-line);
}
.yc-picker__head h2, .dev022-picker h2 { margin: 0; font-size: var(--yc-text-title); color: var(--yc-navy); }
.yc-picker__head p { margin: var(--yc-step-1) 0 0; font-size: var(--yc-text-meta); color: var(--yc-muted); }

/* Results grid: bigger thumbnails, selection state, keyboard roving. */
.yc-picker__results, .dev022-picker-results {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
  gap: var(--yc-step-3);
  padding: var(--yc-step-4);
  overflow: auto;
}
.yc-picker__card, .dev022-picker-card {
  display: grid;
  grid-template-rows: auto auto;
  gap: var(--yc-step-2);
  padding: var(--yc-step-2);
  border: 1px solid var(--yc-line);
  border-radius: var(--yc-radius-sm);
  background: var(--yc-paper);
  text-align: start;
  cursor: pointer;
}
.yc-picker__card img, .yc-picker__card .yc-picker__ph,
.dev022-picker-card img, .dev022-picker-placeholder {
  inline-size: 100%;
  aspect-ratio: 4 / 3;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: var(--yc-canvas);
  object-fit: cover;
  color: var(--yc-muted);
  font-size: var(--yc-text-micro);
}
.yc-picker__card strong, .dev022-picker-card strong {
  display: block;
  font-size: var(--yc-text-meta);
  line-height: 1.35;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.yc-picker__card small, .dev022-picker-card small {
  display: block;
  font-size: var(--yc-text-micro);
  color: var(--yc-muted);
}
.yc-picker__card[aria-selected="true"], .dev022-picker-card[aria-selected="true"] {
  border-color: var(--yc-navy);
  box-shadow: 0 0 0 2px var(--yc-navy);
}
/* An asset that is not approved for publication says so on the card itself. */
.yc-picker__card[data-approved="false"]::after {
  content: attr(data-approval-label);
  display: block;
  padding: 2px var(--yc-step-2);
  border-radius: 4px;
  background: color-mix(in srgb, var(--yc-gold) 20%, transparent);
  color: #6d5217;
  font-size: var(--yc-text-micro);
  font-weight: 800;
}
.yc-picker__card:disabled, .dev022-picker-card:disabled { opacity: 0.5; cursor: not-allowed; }

.yc-picker__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--yc-step-3);
  padding: var(--yc-step-3) var(--yc-step-4);
  border-block-start: 1px solid var(--yc-line);
  background: var(--yc-canvas);
}
.yc-picker__foot .yc-picker__status { margin-inline-end: auto; font-size: var(--yc-text-meta); color: var(--yc-muted); }

/* Upload is a drawer, never the first thing the operator sees. */
.yc-picker__upload > summary {
  min-block-size: var(--yc-touch-floor);
  display: flex;
  align-items: center;
  gap: var(--yc-step-2);
  padding-inline: var(--yc-step-3);
  cursor: pointer;
  font-size: var(--yc-text-meta);
  font-weight: 750;
  color: var(--yc-navy);
}

@media (max-width: 640px) {
  .yc-picker, .dev022-picker { inline-size: 100vw; max-block-size: 100dvh; border-radius: 0; }
  .yc-picker__shell, .dev022-picker-shell { max-block-size: 100dvh; }
  .yc-picker__results, .dev022-picker-results { grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr)); }
}

/* ═══ 9. RESPONSIVE SHELL ═════════════════════════════════════════════════ */

/* Sidebar shells: below 1024px the rail becomes an off-canvas drawer with a
   real backdrop and focus containment (command-layer.mjs supplies the trap). */
@media (max-width: 1024px) {
  .admin-app, .app-shell, .shell {
    display: block !important;
    grid-template-columns: none !important;
  }
  .admin-app > .sidebar,
  .app-shell > .sidebar,
  .shell > .side,
  .yc-shell > .yc-sidebar {
    position: fixed;
    inset-block: 0;
    inset-inline-start: 0;
    z-index: var(--yc-z-drawer);
    inline-size: min(22rem, 88vw);
    block-size: 100dvh;
    transform: translateX(-102%);
    transition: transform 220ms cubic-bezier(0.2, 0, 0, 1);
    box-shadow: 0 0 60px rgb(4 21 43 / 34%);
  }
  [dir="rtl"] .admin-app > .sidebar,
  [dir="rtl"] .app-shell > .sidebar,
  [dir="rtl"] .shell > .side,
  [dir="rtl"] .yc-shell > .yc-sidebar { transform: translateX(102%); }
  .admin-app.sidebar-open > .sidebar,
  .app-shell.nav-open > .sidebar,
  .shell.menu > .side,
  .yc-shell.is-navopen > .yc-sidebar { transform: none; }

  .yc-scrim {
    position: fixed;
    inset: 0;
    z-index: calc(var(--yc-z-drawer) - 1);
    background: rgb(4 21 43 / 52%);
    border: 0;
  }
  .yc-scrim[hidden] { display: none; }
}

/* Above 1024px the drawer trigger must not linger. */
@media (min-width: 1025px) {
  .yc-navtoggle, .mobile-menu, #open-sidebar { display: none !important; }
  .yc-scrim { display: none !important; }
}

/* Topbars: the identity block may shrink, the actions may not. */
.yc-topbar, header.top {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: var(--yc-step-3);
  min-block-size: calc(4rem * var(--yc-density));
  padding-inline: var(--yc-step-4);
}
/* Grid topbars keep their own template; the layer only guarantees the search
   column can actually breathe and the action cluster never wraps. */
header.topbar { min-block-size: calc(4rem * var(--yc-density)); align-items: center; }
header.topbar .global-search { min-inline-size: 0; }
header.topbar .global-search input { inline-size: 100%; min-inline-size: 0; }
.yc-topbar__identity, .topbar-start, .top-main { min-inline-size: 0; flex: 1 1 auto; }
.yc-topbar__actions, .top-actions, .topbar-actions {
  display: flex;
  align-items: center;
  gap: var(--yc-step-2);
  flex: 0 0 auto;
}

/* Below 900px, secondary topbar affordances collapse into an overflow menu
   rather than being display:none'd out of existence. */
@media (max-width: 900px) {
  .yc-topbar__actions [data-overflow], .topbar-actions [data-overflow] { display: none; }
  .yc-overflow { display: inline-flex; }
  .yc-topbar { padding-inline: var(--yc-step-3); }
  .breadcrumbs, .breadcrumb { display: none; }
}
@media (min-width: 901px) { .yc-overflow { display: none; } }

/* Main measure. Command surfaces get width; reading surfaces get a measure. */
.yc-main, main.main, .main, main#main-content {
  inline-size: 100%;
  max-inline-size: 110rem;
  margin-inline: auto;
  padding: var(--yc-step-4);
}
@media (max-width: 640px) { .yc-main, main.main, .main, main#main-content { padding: var(--yc-step-3); } }

/* Two-column workspaces collapse in one place instead of six. */
.yc-split, .dashboard-grid, .split-layout, .compose-grid, .detail-layout, .grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(18rem, 0.8fr);
  gap: var(--yc-step-4);
  align-items: start;
}
@media (max-width: 1100px) {
  .yc-split, .dashboard-grid, .split-layout, .compose-grid, .detail-layout, .grid { grid-template-columns: 1fr; }
  .sticky-aside, .compose-side, .publishing-inspector, .media-asset-inspector { position: static; }
}

/* Any element that claims a min-width larger than a phone gets a scroll parent
   instead of pushing the document sideways. */
html, body { overflow-x: clip; }

/* ═══ 10. STATES AND FEEDBACK ═════════════════════════════════════════════ */

.yc-empty, .empty-state, .empty, .editorial-empty-state {
  display: grid;
  place-items: center;
  gap: var(--yc-step-2);
  min-block-size: 12rem;
  padding: var(--yc-step-6) var(--yc-step-4);
  border: 1px dashed var(--yc-line);
  border-radius: var(--yc-radius);
  background: var(--yc-paper);
  text-align: center;
}
.yc-empty strong, .empty strong { font-size: var(--yc-text-lead); color: var(--yc-navy); }
.yc-empty p, .empty-state p { max-inline-size: 42ch; margin: 0; font-size: var(--yc-text-meta); color: var(--yc-muted); }
.yc-empty__actions { display: flex; gap: var(--yc-step-2); margin-block-start: var(--yc-step-2); }

.yc-skeleton {
  position: relative;
  overflow: hidden;
  border-radius: var(--yc-radius-sm);
  background: color-mix(in srgb, var(--yc-line) 60%, var(--yc-paper));
}
.yc-skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgb(255 255 255 / 72%), transparent);
  animation: yc-shimmer 1.4s infinite;
}
@keyframes yc-shimmer { to { transform: translateX(100%); } }

.yc-loading-rows { display: grid; gap: var(--yc-step-2); }
.yc-loading-rows > .yc-skeleton { block-size: var(--yc-row-h); }

/* ═══ 11. FOCUS, MOTION, PRINT ════════════════════════════════════════════ */

:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 3px solid var(--yc-focus);
  outline-offset: 2px;
  border-radius: 4px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
    scroll-behavior: auto !important;
  }
}

@media print {
  .yc-sidebar, aside.sidebar, aside.side, .yc-topbar, header.topbar,
  .yc-actionbar, .yc-toolbar, .yc-filterbar, .filters, .yc-scrim { display: none !important; }
  .yc-main, main.main { max-inline-size: none; padding: 0; }
  .yc-table thead th { position: static; }
}

/* ═══ 12. TOPBAR OVERFLOW MENU ════════════════════════════════════════════ */

.yc-overflow { position: relative; }
.yc-overflow > summary {
  display: grid;
  place-items: center;
  inline-size: var(--yc-touch-floor);
  block-size: var(--yc-touch-floor);
  border: 1px solid var(--yc-line);
  border-radius: var(--yc-radius-sm);
  background: var(--yc-paper);
  color: var(--yc-navy);
  cursor: pointer;
  list-style: none;
}
.yc-overflow > summary::-webkit-details-marker { display: none; }
.yc-overflow__panel {
  position: absolute;
  z-index: var(--yc-z-drawer);
  inset-block-start: calc(100% + var(--yc-step-2));
  inset-inline-end: 0;
  display: grid;
  gap: var(--yc-step-2);
  min-inline-size: 13rem;
  padding: var(--yc-step-3);
  border: 1px solid var(--yc-line);
  border-radius: var(--yc-radius-sm);
  background: var(--yc-paper);
  box-shadow: var(--yc-shadow-raised);
}
.yc-overflow__panel > * { inline-size: 100%; justify-content: flex-start; }


/* ═══ 13. CORRECTION ROUND 1 — measured defects ═══════════════════════════ */

/*
 * A grid item's implicit min-width:auto let `.data-table{min-width:760px}`
 * widen its own track past the declared column and overlap the adjacent
 * column. Every vertical stack now declares a zero minimum so the scroll
 * container, not the document, absorbs a wide table.
 */
.stack, .command-primary, .command-secondary, .yc-stack {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--yc-step-4);
  min-inline-size: 0;
}
.yc-split > *, .dashboard-grid > *, .split-layout > *, .detail-layout > *,
.compose-grid > *, .grid > * { min-inline-size: 0; }
.panel, .yc-panel, .command-section { min-inline-size: 0; }

/* Sort affordances must clear the 32px minimum like every other control. */
.yc-sort { min-block-size: 2.15rem; }

/* ═══ 14. MEDIA PICKER — INSPECTOR MODEL ══════════════════════════════════ */

/* Browse on one side, evidence on the other. A pick is confirmed from the
   inspector, never from a single click on a thumbnail. */
.yc-picker__shell { grid-template-rows: auto auto auto minmax(0, 1fr) auto; }
.yc-picker__body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(16rem, 20rem);
  min-block-size: 0;
}
.yc-picker__body > .yc-picker__results { border-inline-end: 1px solid var(--yc-line); }
.yc-picker__inspector {
  display: grid;
  align-content: start;
  gap: var(--yc-step-2);
  padding: var(--yc-step-4);
  overflow: auto;
  background: var(--yc-canvas);
}
.yc-picker__inspector .eyebrow { margin: 0; font-size: var(--yc-text-micro); font-weight: 850; color: var(--yc-gold); letter-spacing: .05em; }
.yc-picker__inspector h3 { margin: 0 0 var(--yc-step-2); font-size: var(--yc-text-lead); line-height: 1.4; color: var(--yc-navy); overflow-wrap: anywhere; }
.yc-picker__preview {
  inline-size: 100%;
  aspect-ratio: 4 / 3;
  border-radius: var(--yc-radius-sm);
  background: var(--yc-paper);
  object-fit: contain;
}
.yc-picker__preview--empty { display: grid; place-items: center; border: 1px dashed var(--yc-line); color: var(--yc-muted); font-size: var(--yc-text-meta); }
.yc-picker__inspector .yc-kv { grid-template-columns: 1fr; gap: 0; }
.yc-picker__inspector-empty {
  display: grid;
  place-items: center;
  gap: var(--yc-step-2);
  min-block-size: 12rem;
  color: var(--yc-muted);
  text-align: center;
}
.yc-picker__inspector-empty > span { font-size: 2rem; opacity: .5; }
.yc-picker__inspector-empty > p { max-inline-size: 24ch; margin: 0; font-size: var(--yc-text-meta); }

/* A blocked or incomplete asset explains itself in words, not by going grey. */
.yc-picker__blocked, .yc-picker__warnbox {
  margin: 0;
  padding: var(--yc-step-3);
  border-radius: var(--yc-radius-sm);
  font-size: var(--yc-text-meta);
  line-height: 1.7;
}
.yc-picker__blocked { border: 1px solid color-mix(in srgb, #a33f48 40%, transparent); background: color-mix(in srgb, #a33f48 8%, var(--yc-paper)); color: #7d2a31; }
.yc-picker__warnbox { border: 1px solid color-mix(in srgb, var(--yc-gold) 55%, transparent); background: color-mix(in srgb, var(--yc-gold) 10%, var(--yc-paper)); color: #6d5217; }
.yc-picker__warn { display: block; margin-block-start: 2px; color: #8a650e; font-size: var(--yc-text-micro); font-weight: 750; }

.yc-picker__card:focus-visible { outline: 3px solid var(--yc-focus); outline-offset: 2px; }

@media (max-width: 900px) {
  .yc-picker__body { grid-template-columns: 1fr; grid-template-rows: minmax(10rem, 1fr) auto; }
  .yc-picker__body > .yc-picker__results { border-inline-end: 0; border-block-end: 1px solid var(--yc-line); }
  .yc-picker__inspector { max-block-size: 45vh; }
}

/* ═══ 15. LONG EDITORIAL FORMS — SECTION RAIL AND SAVE BAR ════════════════ */

/*
 * The minister and head-of-mission pages are long bilingual records. A single
 * scroll gives the editor no sense of where they are or what is still missing,
 * so both adopt one rail: sections on the side, completion per section, and a
 * save bar that never scrolls away.
 */
.yc-editor {
  display: grid;
  grid-template-columns: minmax(13rem, 15rem) minmax(0, 1fr) minmax(17rem, 21rem);
  gap: var(--yc-step-4);
  align-items: start;
}
.yc-editor__rail { position: sticky; inset-block-start: var(--yc-step-5); display: grid; gap: var(--yc-step-1); }
.yc-editor__body { display: grid; gap: var(--yc-step-4); min-inline-size: 0; }
.yc-editor__aside { position: sticky; inset-block-start: var(--yc-step-5); display: grid; gap: var(--yc-step-3); }

.yc-sectionrail__title {
  margin: 0 0 var(--yc-step-2);
  font-size: var(--yc-text-micro);
  font-weight: 850;
  letter-spacing: .05em;
  color: var(--yc-muted);
}
.yc-sectionrail__item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: var(--yc-step-2);
  align-items: center;
  inline-size: 100%;
  min-block-size: var(--yc-touch-floor);
  padding-inline: var(--yc-step-3);
  border: 0;
  border-inline-start: 2px solid var(--yc-line);
  background: transparent;
  color: var(--yc-muted);
  font-size: var(--yc-text-meta);
  text-align: start;
  cursor: pointer;
}
.yc-sectionrail__item[aria-current="true"] {
  border-inline-start-color: var(--yc-gold);
  background: color-mix(in srgb, var(--yc-gold) 8%, transparent);
  color: var(--yc-navy);
  font-weight: 750;
}
.yc-sectionrail__dot {
  inline-size: .55rem;
  block-size: .55rem;
  border: 1.5px solid var(--yc-muted);
  border-radius: 50%;
}
.yc-sectionrail__item[data-complete="true"] .yc-sectionrail__dot { border-color: #1d6f46; background: #1d6f46; }
.yc-sectionrail__item[data-complete="false"] .yc-sectionrail__dot { border-color: var(--yc-gold); background: color-mix(in srgb, var(--yc-gold) 40%, transparent); }
.yc-sectionrail__count { font-size: var(--yc-text-micro); font-variant-numeric: tabular-nums; opacity: .75; }

/* Bilingual pairs: two labelled columns, each carrying its own direction, so a
   Latin title never renders reversed inside an RTL form. */
.yc-bilingual {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: var(--yc-step-3);
  padding: var(--yc-step-3);
  border: 1px solid var(--yc-line);
  border-radius: var(--yc-radius-sm);
  background: var(--yc-canvas);
}
.yc-bilingual > * { min-inline-size: 0; }
.yc-bilingual__lang {
  display: inline-flex;
  align-items: center;
  gap: var(--yc-step-1);
  margin-block-end: var(--yc-step-1);
  padding: 1px var(--yc-step-2);
  border-radius: 4px;
  background: color-mix(in srgb, var(--yc-navy) 8%, transparent);
  color: var(--yc-navy);
  font-size: var(--yc-text-micro);
  font-weight: 850;
  letter-spacing: .04em;
}
.yc-bilingual [dir="ltr"] { text-align: left; }

/* Save bar. Docked, states what will happen, and carries the save status. */
.yc-savebar {
  position: sticky;
  inset-block-end: var(--yc-step-3);
  z-index: var(--yc-z-actionbar);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--yc-step-3);
  margin-block-start: var(--yc-step-3);
  padding: var(--yc-step-3) var(--yc-step-4);
  border-radius: var(--yc-radius);
  background: var(--yc-navy);
  color: #fff;
  box-shadow: 0 14px 38px rgb(9 30 52 / 26%);
}
.yc-savebar__note { min-inline-size: 0; font-size: var(--yc-text-meta); color: rgb(255 255 255 / 78%); }
.yc-savebar__actions { display: flex; flex-wrap: wrap; gap: var(--yc-step-2); margin-inline-start: auto; }

@media (max-width: 1280px) {
  .yc-editor { grid-template-columns: minmax(12rem, 14rem) minmax(0, 1fr); }
  .yc-editor__aside { grid-column: 1 / -1; position: static; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); }
}
@media (max-width: 900px) {
  .yc-editor { grid-template-columns: 1fr; }
  .yc-editor__rail {
    position: static;
    display: flex;
    gap: var(--yc-step-2);
    overflow-x: auto;
    padding-block-end: var(--yc-step-2);
    scroll-snap-type: x proximity;
  }
  .yc-sectionrail__title { display: none; }
  .yc-sectionrail__item {
    flex: 0 0 auto;
    border: 1px solid var(--yc-line);
    border-radius: 999px;
    scroll-snap-align: start;
  }
  .yc-sectionrail__item[aria-current="true"] { border-color: var(--yc-gold); }
  .yc-savebar { flex-direction: column; align-items: stretch; }
  .yc-savebar__actions { margin-inline-start: 0; }
  .yc-savebar__actions > * { flex: 1 1 auto; }
}

/* ═══ 16. CORRECTION ROUND 1 (cont.) — editorial form measurements ════════ */

/*
 * Measured at 1440px: a 15rem rail plus a 21rem aside left the field column at
 * ~500px, which forced every bilingual pair to stack and defeated the point of
 * pairing them. The rail and aside give width back to the work.
 */
.yc-editor { grid-template-columns: minmax(11rem, 12.5rem) minmax(0, 1fr) minmax(15rem, 18rem); }
.yc-bilingual { grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); }

/* The docked save bar overlays the tail of the form, so the form ends above it. */
.yc-editor__body { padding-block-end: calc(var(--yc-step-6) + 1rem); }
.yc-savebar { backdrop-filter: blur(6px); }

/* Five workflow steps inside a 300px aside produced five unreadable slivers.
   Wrapping is correct here; a fixed five-column track is not. */
.workflow--horizontal, .dev022-workflow-steps {
  display: flex;
  flex-wrap: wrap;
  grid-template-columns: none;
  gap: var(--yc-step-2);
}
.workflow--horizontal > .workflow-step, .dev022-workflow-steps > li {
  flex: 1 1 7.5rem;
  min-inline-size: 7.5rem;
}

/* Minister preview inside a narrow aside: the portrait frame must not force a
   280px column and shred the copy beside it. */
.admin-preview-hero { grid-template-columns: minmax(0, 1fr); gap: var(--yc-step-3); min-block-size: 0; padding: var(--yc-step-4); }
.adminMinisterAsset { min-block-size: 9rem; max-inline-size: 11rem; margin-inline: auto; border-radius: 5rem 5rem var(--yc-radius-sm) var(--yc-radius-sm); font-size: 2.5rem; }
.adminMinisterAsset img { block-size: 100%; max-block-size: 13rem; }
.admin-preview-hero h2 { font-size: var(--yc-text-title); }

/* Readiness lists read faster in two columns once they pass four items. */
.mission-readiness-banner ul { columns: 2; column-gap: var(--yc-step-5); }
@media (max-width: 720px) { .mission-readiness-banner ul { columns: 1; } }

/* ═══ 17. CORRECTION ROUND 1 (cont.) — sidebar scroll containment ═════════ */

/*
 * The rails are `height:100vh` with a pinned footer. Without an explicit zero
 * minimum on the scrolling middle, the nav list refused to shrink and its tail
 * rendered underneath the footer card. This is the flexbox min-content default
 * biting, not a z-index problem.
 */
aside.sidebar, aside.side, .yc-sidebar {
  max-block-size: 100dvh;
  overflow: clip;
}
aside.sidebar > nav, aside.side > .nav, aside.sidebar > #admin-navigation,
aside.sidebar > .primary-nav, .yc-sidebar > .yc-nav {
  flex: 1 1 auto;
  min-block-size: 0;
  overflow-y: auto;
}
aside.sidebar > .sidebar-footer, aside.sidebar > .sidebar__footer,
aside.side > .side-footer, .yc-sidebar > .yc-sidebar__footer {
  flex: 0 0 auto;
  margin-block-start: 0;
}
/* Brand and scope blocks are fixed chrome, not part of the scroll region. */
aside.sidebar > .brand-block, aside.sidebar > .sidebar__brand,
aside.sidebar > .mission-identity, aside.sidebar > .environment-badge,
aside.sidebar > .sidebar-search, aside.side > .brand { flex: 0 0 auto; }

/* ═══ 18. CORRECTION ROUND 1 (cont.) — bare-element metric grids ══════════ */

/*
 * The national-network and central read-model grids use bare <article> children
 * rather than a metric class, so they inherited the new grid track but none of
 * the card treatment and painted as an unstyled block. Same card, same rhythm.
 */
.metric-grid > article, .metrics > article, .yc-metrics > article {
  display: grid;
  align-content: start;
  gap: var(--yc-step-1);
  min-block-size: calc(5rem * var(--yc-density));
  padding: var(--yc-step-3);
  border: 1px solid var(--yc-line);
  border-radius: var(--yc-radius-sm);
  background: var(--yc-paper);
  box-shadow: var(--yc-shadow-flat);
}
.metric-grid > article > span, .metrics > article > span {
  order: 2;
  font-size: var(--yc-text-meta);
  color: var(--yc-muted);
}
.metric-grid > article > strong, .metrics > article > strong {
  order: 1;
  font-size: calc(1.65rem * var(--yc-density));
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
  color: var(--yc-navy);
}

/* ═══ 19. NATIONAL NETWORK / READ-MODEL SURFACES ══════════════════════════ */

/*
 * The read-model grid was drawn as a hairline table: `gap:1px` over a border
 * coloured background. Once the tracks auto-fit, the unfilled tail of the last
 * row showed that background as a grey slab. The cards now carry their own
 * borders, so the separator layer is removed rather than patched.
 */
.metric-grid { gap: var(--yc-step-3); background: none; border: 0; }

/* A 380px masthead before the first indicator is a poster, not a command
   surface. Same compression already applied to the ministry dashboard. */
.control-masthead { padding-block: var(--yc-step-5) var(--yc-step-3); }
.control-masthead h1 { max-inline-size: 34ch; font-size: clamp(1.5rem, 2.6vw, 2.4rem); line-height: 1.3; }
.control-masthead p { max-inline-size: 78ch; font-size: var(--yc-text-meta); line-height: 1.75; }
.control-masthead__top { gap: var(--yc-step-5); align-items: center; }
.control-environment { padding: var(--yc-step-3); gap: var(--yc-step-1); font-size: var(--yc-text-meta); }
.control-tabs { margin-block-start: var(--yc-step-4); }
.control-tabs button { min-block-size: 2.75rem; padding-inline: var(--yc-step-4); font-size: var(--yc-text-body); }
.control-surface, .executive-surface { padding-block: var(--yc-step-5); }

/* Fixed table layout plus an 80rem minimum made every read-model column equal
   width regardless of content. Content decides, the scroll parent absorbs. */
.table-scroll > table { table-layout: auto; min-inline-size: 62rem; }
.table-scroll th, .table-scroll td { vertical-align: middle; overflow-wrap: normal; }
.table-scroll td[data-label="البعثة"], .table-scroll td:first-child { font-weight: 700; white-space: nowrap; }

/* ═══ 20. ICON SLOTS AND RAIL SCROLLING — MIXED CONVENTIONS ═══════════════ */

/*
 * Surfaces disagree about what a nav icon is: some use a 1em glyph, the
 * intelligence centre uses a two-letter Arabic abbreviation in a 28px chip.
 * The layer's 1.4rem icon track clipped the second kind. The track now sizes
 * to its content, with a floor rather than a fixed width.
 */
.yc-nav__item, .nav-item, .sidebar nav > a, .nav > button, .nav > a, .primary-nav > a {
  grid-template-columns: minmax(1.4rem, auto) minmax(0, 1fr) auto;
}
.nav-item__icon, .nav-icon, .yc-nav__icon {
  flex: 0 0 auto;
  min-inline-size: 1.4rem;
  white-space: nowrap;
}

/* Intelligence uses a sticky rail with its own scroller and a `margin-top:auto`
   footer, which only holds when the rail is a flex column with a real minimum. */
.shell > .sidebar, .intel-shell > .sidebar {
  display: flex;
  flex-direction: column;
  max-block-size: 100dvh;
}
.sidebar > .nav-list, .sidebar > nav { flex: 1 1 auto; min-block-size: 0; overflow-y: auto; }
.sidebar > .sidebar-footer { flex: 0 0 auto; }

/* `.nav-label` is a group heading on this surface and a control label on
   others; as a heading it must not inherit the control minimum height. */
.sidebar .nav-label { min-block-size: 0; }

/* ═══ 21. CORRECTION ROUND 2 — MEASURED TOUCH TARGETS ═════════════════════ */

/*
 * The review pass measured interactive elements under 32px tall across the
 * mission workspace: `.link-button` (padding:0), `.ministry-link`, the inline
 * text buttons inside table cells, and several bare inputs.
 *
 * The rule below is deliberately narrow. It raises CONTROLS — elements whose
 * job is to be pressed — and leaves prose links alone, because inflating every
 * <a> in a paragraph would wreck line rhythm in Arabic body copy. Where a
 * control must stay visually inline (a text button inside a dense table row),
 * the target is grown with padding and a negative margin so the hit area
 * clears the floor without moving the text.
 */

:where(button, [role="button"], input:not([type="hidden"]), select, textarea,
       a.button, a[class*="button"], .nav-item, .yc-nav__item) {
  min-block-size: 2rem;
}

@media (pointer: coarse) {
  :where(button, [role="button"], input:not([type="hidden"]), select,
         a.button, a[class*="button"], .nav-item, .yc-nav__item, summary) {
    min-block-size: var(--yc-touch-floor);
  }
  /* Inline text controls keep their typography and gain their hit area. */
  .link-button, .text-button, .ministry-link, .calendar-more, .yc-chips__reset,
  a:not([class]):where(td *, li *) {
    padding-block: 0.7rem;
    margin-block: -0.55rem;
  }
}

/* Even with a fine pointer these were genuinely too small to aim at. */
.link-button, .text-button {
  min-block-size: 2rem;
  padding-inline: 0.25rem;
  margin-inline: -0.25rem;
  border-radius: 4px;
}
.ministry-link { min-block-size: 2.4rem; display: flex; align-items: center; }
.table-primary { min-block-size: 2rem; align-content: center; }
.row-action, .yc-rowactions > *, .row-actions > * { min-block-size: 2rem; }

/* A filter or form control that is 30px tall is not a style choice; the
   command layer's control height is the floor everywhere. */
.filters input, .filters select, .filter-bar input, .filter-bar select,
.field input, .field select, .form-grid input, .form-grid select,
.editorial-operations-filters input, .editorial-operations-filters select {
  min-block-size: var(--yc-control-h);
}

/* ═══ 22. CORRECTION ROUND 2 (cont.) — checkboxes and title links ═════════ */

/*
 * A native checkbox cannot be stretched to 44px without becoming a cartoon, so
 * the target is the LABEL, not the box. The box is enlarged to a comfortable
 * 1.15rem and the label around it carries the touch height. This is why the
 * previous blanket min-height did nothing useful for them.
 */
input[type="checkbox"], input[type="radio"] {
  inline-size: 1.15rem;
  block-size: 1.15rem;
  min-block-size: 0;
  accent-color: var(--yc-navy);
  flex: 0 0 auto;
}
:where(label, .checkbox-card, .choice-card, .check, .switch-control,
       .inspector-choice, .amb-visibility-grid > label):has(input[type="checkbox"], input[type="radio"]) {
  display: flex;
  align-items: center;
  gap: var(--yc-step-2);
  min-block-size: var(--yc-touch-floor);
  padding-inline: var(--yc-step-2);
  cursor: pointer;
}

/*
 * Record-title links inside table cells and cards were 18px tall — the exact
 * height of their own text. They are the primary way into a record, so they
 * get a real hit area without displacing the row's baseline.
 */
.publication-story a, .publication-title-cell a, .yc-cell-primary strong a,
.cell-title strong a, td a:not([class]), .record-card h3 a, .search-result-card h2 a {
  display: inline-block;
  padding-block: 0.45rem;
  margin-block: -0.45rem;
}

/* ═══ 23. CORRECTION ROUND 2 (cont.) — editor breakpoint cascade ══════════ */

/*
 * Measured at 390px: the editor still resolved to `176px 0px 240px`. The
 * correction in section 16 restated `.yc-editor` tracks unconditionally and,
 * sitting after the section-15 media queries, won the cascade at every width —
 * so the phone layout kept three columns and the field column collapsed to
 * zero. The breakpoints are restated here, last, where they belong.
 */
@media (max-width: 1280px) {
  .yc-editor { grid-template-columns: minmax(10rem, 12rem) minmax(0, 1fr); }
  .yc-editor__aside {
    grid-column: 1 / -1;
    position: static;
    grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  }
}
@media (max-width: 900px) {
  .yc-editor { grid-template-columns: minmax(0, 1fr); }
  .yc-editor__rail { position: static; display: flex; overflow-x: auto; }
  .yc-editor__aside { grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); }
}
