/* SYGNAL admin: css/ops.css — the visual refresh of the ops pages on the kit.
 *
 * Pages: Customers › Usage, Partners (Commissions owed, Payouts, Reps, Win map),
 * Training (Bookings, Trainers, Certificates, Revenue, Prices, Make trainer) and
 * Content (Scenarios, Blog). Each one keeps its legacy section id, its data and
 * its actions; what it LOOKS like comes from /ui.css (every ui-* component) plus
 * the page layout below (ops-*). PLAN.md S13 / S15 / S16 / S17 rebuild these
 * pages later; this file is their look until then.
 *
 * Rules, as in ui.css:
 *   - Mobile-first: the base rules are the phone; then min-width 768 / 1024 /
 *     1280. No max-width query.
 *   - Colours, radii, type and spacing come from the kit's tokens (--ui-*), so
 *     no grey here is the old #8896a6.
 *   - Every target stays at least 44 x 44 px and every input 16 px on a phone
 *     (the kit's .ui-input does both).
 *   - No component is redefined: a kit class is used as is, and an ops-* class
 *     only lays kit parts out.
 */

/* Anything an ops page hides with the hidden attribute stays hidden, even where a
   kit component sets its own display (.ui-empty, .ui-banner, .ui-card ...). */
.ops-page [hidden], .ops-modal [hidden] { display: none !important; }

.ops-page { font-family: var(--ui-font); color: var(--ui-ink); }

/* ── Page header: eyebrow (from 768), H1, meta; actions on the right from 768 ── */
.ops-head { display: flex; flex-direction: column; gap: 16px; margin: 0 0 24px; }
.ops-head__text { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.ops-head__eyebrow { display: none; }
.ops-head__meta { max-width: 720px; }
.ops-head__actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 0; }
.ops-head__actions > .ui-btn { width: 100%; }
.ops-head__actions > :last-child:nth-child(odd) { grid-column: 1 / -1; }
@media (min-width: 768px) {
  .ops-head { flex-direction: row; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 32px; }
  .ops-head__eyebrow { display: block; }
  .ops-head__actions { display: flex; flex: none; flex-wrap: wrap; justify-content: flex-end; }
  .ops-head__actions > .ui-btn { width: auto; }
}

/* While an ops page is on screen its heading is in #ui-pagehead (js/ops.js), above the
   sub-pages, as every rebuilt page's is: the band gives the spacing. */
.ui-pagehead--ops .ops-head { margin: 0; }
.ui-pagehead--ops { font-family: var(--ui-font); color: var(--ui-ink); }

/* ── Sections ───────────────────────────────────────────────────────────── */
.ops-section { display: flex; flex-direction: column; gap: 12px; min-width: 0; margin: 0 0 24px; }
.ops-section:last-child { margin-bottom: 0; }
.ops-section__head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; min-width: 0; }
.ops-section__head > .ui-h2, .ops-section__head > .ui-h3 { min-width: 0; }
@media (min-width: 768px) { .ops-section { margin-bottom: 32px; } }

.ops-stack { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.ops-meta { margin: 0; font-size: 13px; line-height: 18px; font-weight: 500; color: var(--ui-muted); overflow-wrap: anywhere; }
.ops-text { margin: 0; font-size: 15px; line-height: 22px; color: var(--ui-slate); overflow-wrap: anywhere; }
.ops-strong { font-weight: 600; color: var(--ui-ink); }
.ops-mono { font-family: var(--ui-font-mono); font-size: 14px; line-height: 20px; overflow-wrap: anywhere; }
.ops-num { font-variant-numeric: tabular-nums; }
.ops-ok { color: var(--ui-success); }
.ops-bad { color: var(--ui-danger); }

/* ── Filter rows: kit chips, a 2-column grid on the phone (full rows) ───── */
.ops-filters { display: flex; flex-direction: column; gap: 12px; margin: 0 0 16px; }
.ops-chips { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 0; }
.ops-chips > .ui-chip { width: 100%; padding: 0 12px; }
.ops-chips > :last-child:nth-child(odd) { grid-column: 1 / -1; }
.ops-filters__row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; align-items: end; }
@media (min-width: 768px) {
  .ops-chips { display: flex; flex-wrap: wrap; }
  .ops-chips > .ui-chip { width: auto; padding: 0 16px; }
  .ops-filters__row { grid-template-columns: minmax(0, 360px) auto; justify-content: start; }
}

/* A segmented control that fills its row on the phone and may wrap to a second
   control beside it from 768. */
.ops-segs { display: flex; flex-direction: column; gap: 8px; margin: 0; }
.ops-segs > .ui-seg { width: 100%; }
.ui-seg__opt:disabled { cursor: not-allowed; opacity: .45; }
/* A label too long for half a phone row wraps inside its 44 px segment. */
.ops-seg-wrap .ui-seg__opt { white-space: normal; line-height: 18px; text-align: center; }
@media (min-width: 768px) {
  .ops-segs { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 12px; }
  .ops-segs > .ui-seg { width: auto; }
  .ops-segs > .ui-seg .ui-seg__opt, .ui-seg.ops-seg-period .ui-seg__opt { flex: none; padding: 0 14px; white-space: nowrap; }
  .ui-seg.ops-seg-period { display: inline-flex; align-self: flex-start; width: auto; }
}

/* ── KPI tiles (not links): label, value, sub-line. Groups of 4 use .ui-tiles
   (2 x 2, 4 x 1 from 1024); 6 use --3 (2 x 3, 3 x 2 from 768); 3 use --three
   (stacked, 3 x 1 from 768). Every row is full. ───────────────────────────── */
.ops-tiles--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ops-tiles--three { grid-template-columns: minmax(0, 1fr); }
@media (min-width: 768px) {
  .ops-tiles--3, .ops-tiles--three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 1024px) {
  .ops-tiles--3, .ops-tiles--three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.ui-tile.ops-kpi { justify-content: flex-start; gap: 6px; min-height: 104px; }
.ops-kpi__top { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; }
.ops-kpi__label { min-width: 0; font-size: 13px; line-height: 18px; font-weight: 600; color: var(--ui-slate); }
.ops-kpi__value { font-size: 22px; line-height: 28px; font-weight: 700; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; color: var(--ui-ink); overflow-wrap: anywhere; }
.ops-kpi__value--muted { color: var(--ui-muted); }
.ops-kpi__sub { margin: 0; font-size: 13px; line-height: 18px; font-weight: 400; color: var(--ui-muted); overflow-wrap: anywhere; }
.ops-kpi--warning { border-color: var(--ui-warning); }
.ops-kpi--danger { border-color: var(--ui-danger-line); background: var(--ui-danger-50); }
.ops-kpi .ui-i { flex: none; }
@media (min-width: 768px) {
  .ui-tile.ops-kpi { min-height: 128px; gap: 8px; }
  .ops-kpi__label { font-size: 14px; line-height: 20px; }
  .ops-kpi__value { font-size: 28px; line-height: 34px; }
}
.ops-tiles-host { margin: 0 0 24px; }
@media (min-width: 768px) { .ops-tiles-host { margin-bottom: 32px; } }

/* ── Lists: cards of kit parts ──────────────────────────────────────────── */
.ops-list { display: flex; flex-direction: column; gap: 12px; margin: 0; padding: 0; }
.ops-item { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.ops-item__top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; min-width: 0; }
.ops-item__main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ops-item__title { margin: 0; font-size: 16px; line-height: 24px; font-weight: 600; color: var(--ui-ink); overflow-wrap: anywhere; }
.ops-item__aside { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex: none; text-align: right; }
.ops-amount { font-size: 16px; line-height: 24px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--ui-ink); }
.ops-amount__cur { font-size: 13px; font-weight: 500; color: var(--ui-muted); }
.ops-badges { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; margin: 0; }
/* A card's buttons: a 2-up grid on the phone (the odd one spans the row), a row from 768. */
.ops-acts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 0; }
.ops-acts > .ui-btn { width: 100%; min-width: 0; white-space: normal; }
.ops-acts > :last-child:nth-child(odd) { grid-column: 1 / -1; }
@media (min-width: 768px) {
  .ops-acts { display: flex; flex-wrap: wrap; }
  .ops-acts > .ui-btn { width: auto; white-space: nowrap; }
}

/* Label / value pairs (ledger details): 2 columns on the phone, as many as fit from 768. */
.ops-dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; margin: 0; }
.ops-dl > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ops-dl dt { margin: 0; font-size: 13px; line-height: 18px; font-weight: 600; color: var(--ui-slate); }
.ops-dl dd { margin: 0; font-size: 15px; line-height: 22px; color: var(--ui-ink); overflow-wrap: anywhere; }
@media (min-width: 768px) { .ops-dl { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); } }

/* Rows inside a card: name and meta on the left, a number on the right. */
.ops-rows { display: flex; flex-direction: column; margin: 0; padding: 0; list-style: none; }
.ops-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; min-height: 44px; padding: 11px 0; border-bottom: 1px solid var(--ui-line); }
.ops-row:last-child { border-bottom: 0; }
.ops-row__text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ops-row__name { font-size: 15px; line-height: 22px; font-weight: 600; color: var(--ui-ink); overflow-wrap: anywhere; }
.ops-row__num { flex: none; font-size: 15px; line-height: 22px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--ui-ink); text-align: right; }
.ops-row__side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex: none; }
.ops-none { margin: 0; padding: 12px 0; font-size: 15px; line-height: 22px; color: var(--ui-muted); }

/* ── Tables (cards below 768, real tables from 768): a value that never pushes
   the page sideways, a cell that stacks its label above its value, and row
   buttons that may wrap inside their cell on a tablet. ───────────────────── */
.ops-cell { min-width: 0; overflow-wrap: anywhere; }
.ops-cell--stack { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ui-table td.ops-td-stack { flex-direction: column; align-items: stretch; justify-content: flex-start; gap: 4px; text-align: left; }
.ui-table td.ops-td-badges .ops-badges { justify-content: flex-end; }
.ui-table td .ui-small { overflow-wrap: anywhere; }
/* A row with no next step draws no empty "actions" strip on the phone. */
.ui-table td.ui-table__actions:empty { display: none; }
.ops-page .ui-table td.ui-table__actions .ui-btn { white-space: normal; }
@media (min-width: 768px) {
  .ui-table td.ops-td-badges .ops-badges { justify-content: flex-start; }
  .ui-table td.ui-table__actions:empty { display: table-cell; }
  .ui-table td.ops-td-stack > .ops-cell, .ui-table td.ops-td-stack > .ui-small, .ui-table td.ops-td-stack > .ops-strong { display: block; }
  .ops-page .ui-table td { height: auto; min-height: 64px; padding-top: 12px; padding-bottom: 12px; }
  .ops-page .ui-table td.ui-table__actions { white-space: normal; }
  .ops-page .ui-table td.ui-table__actions .ui-btn { margin: 4px 8px 4px 0; white-space: nowrap; }
  .ops-page .ui-table td.ui-table__actions .ui-btn:last-child { margin-right: 0; }
  /* In a table a long word wraps at its own breaks (a space, a hyphen), never mid-word:
     "anywhere" let the table squeeze a column to one letter. */
  .ops-page .ui-table .ops-cell, .ops-page .ui-table .ui-small { overflow-wrap: break-word; }
  .ops-page .ui-table td.ui-table__lead { min-width: 168px; }
  .ops-page .ui-table .ops-mono { white-space: nowrap; }
}

/* ── Forms ──────────────────────────────────────────────────────────────── */
.ops-form { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.ops-form__row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.ops-form__group { display: flex; flex-direction: column; gap: 12px; margin: 8px 0 0; }
.ops-form__group:first-child { margin-top: 0; }
.ops-form__foot { display: flex; flex-direction: column; align-items: stretch; gap: 12px; padding-top: 4px; }
.ops-form__foot > .ui-btn { width: 100%; }
.ops-optional { font-weight: 400; color: var(--ui-muted); }
.ops-checks { display: flex; flex-direction: column; margin: 0; }
@media (min-width: 768px) {
  .ops-form__row--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ops-form__row--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ops-form__foot { flex-direction: row; align-items: center; }
  .ops-form__foot > .ui-btn { width: auto; }
  .ops-card-form { max-width: 760px; }
}
.ops-control-suffix-word input.ui-input { padding-right: 76px; }

/* The legacy inline messages (.msg, set by each page's script) drawn as kit banners. */
.ops-page .msg, .ops-modal .msg { margin: 16px 0 0; padding: 12px 16px; border: 1px solid transparent; border-radius: var(--ui-radius-control); font-family: var(--ui-font); font-size: 15px; line-height: 22px; color: var(--ui-ink); overflow-wrap: anywhere; }
.ops-page .msg.success, .ops-modal .msg.success { background: var(--ui-success-50); border-color: transparent; color: var(--ui-ink); }
.ops-page .msg.error, .ops-modal .msg.error { background: var(--ui-danger-50); border-color: var(--ui-danger-line); color: var(--ui-ink); }
.ops-page .msg.info, .ops-modal .msg.info { background: var(--ui-brand-50); border-color: transparent; color: var(--ui-ink); }
.ops-page .msg strong, .ops-modal .msg strong { font-weight: 600; }

/* Loading: a kit spinner and a word, where the content will be. */
.ops-loading { display: flex; align-items: center; justify-content: center; gap: 12px; min-height: 96px; margin: 0; padding: 16px; font-family: var(--ui-font); font-size: 15px; line-height: 22px; color: var(--ui-muted); }
.ops-loading > .ui-banner { flex: 1 1 auto; }
.ops-block { display: block; }

/* Empty states sit in a card (one per page). */
.ops-empty { padding: 0; }

/* ── Usage: chart and map cards ─────────────────────────────────────────── */
.ops-pair { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--ui-gap); margin: 0 0 var(--ui-gap); }
@media (min-width: 768px) { .ops-pair { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.ops-card-head { display: flex; flex-direction: column; gap: 2px; margin: 0 0 12px; }
.ops-chart { position: relative; height: 240px; }
.ops-map-sub { margin-top: 12px; }
.ops-note { margin: 8px 0 0; }
.ops-full { margin: 0 0 var(--ui-gap); }
/* isolation (S3): Leaflet's panes (z-index 400) and controls (1000) stay inside the
   map, under the sticky top bar and the bottom tab bar. */
.act-map { position: relative; height: 340px; margin: 12px 0 0; border: 1px solid var(--ui-line); border-radius: var(--ui-radius-control); overflow: hidden; isolation: isolate; }
@media (min-width: 1024px) { .act-map { height: 440px; } }
/* Leaflet's own controls, at the kit's 44 px. */
.act-map .leaflet-control-zoom a, .act-map .leaflet-bar a { width: 44px; height: 44px; line-height: 44px; font-size: 22px; }
.act-map .leaflet-control-attribution { display: flex; flex-wrap: wrap; align-items: center; gap: 0 4px; padding: 0 6px; font-family: var(--ui-font); font-size: 12px; line-height: 16px; color: var(--ui-slate); }
.act-map .leaflet-control-attribution a { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; color: var(--ui-brand); }
.ops-map-note { position: absolute; inset: 0; z-index: 500; display: flex; align-items: center; justify-content: center; padding: 16px; pointer-events: none; }
.ops-map-note > .ui-card { max-width: 340px; text-align: center; }
.ops-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; }

/* ── Ledger: dealer groups ──────────────────────────────────────────────── */
.ops-group { overflow: hidden; }
.ops-group__head { display: flex; flex-direction: column; gap: 8px; padding: var(--ui-card-pad); background: var(--ui-surface-2); border-bottom: 1px solid var(--ui-line); }
.ops-group__title { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; min-width: 0; }
.ops-group__totals { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 0; font-size: 14px; line-height: 20px; color: var(--ui-slate); }
.ops-group__totals strong { color: var(--ui-ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.ops-deal { display: flex; flex-direction: column; gap: 12px; padding: var(--ui-card-pad); border-bottom: 1px solid var(--ui-line); }
.ops-deal:last-child { border-bottom: 0; }
@media (min-width: 768px) {
  .ops-group__head { flex-direction: row; align-items: center; justify-content: space-between; }
}

/* ── Payouts: a dealer card and its transfer attempts ───────────────────── */
.ops-disclose { align-self: flex-start; margin-left: -12px; }
.ops-disclose .ui-i { transition: transform .12s; }
.ops-disclose[aria-expanded="true"] .ui-i { transform: rotate(180deg); }

/* ── Pickers: one result per row (Make trainer) ─────────────────────────── */
.ops-picks { display: flex; flex-direction: column; gap: 8px; margin: 0; }
.ui-btn.ops-pick { justify-content: flex-start; gap: 12px; min-height: 64px; padding: 8px 14px; text-align: left; white-space: normal; }
.ops-pick__text { display: flex; flex-direction: column; min-width: 0; flex: 1 1 auto; }
.ops-pick__name { font-size: 15px; line-height: 22px; font-weight: 600; color: var(--ui-ink); overflow-wrap: anywhere; }
.ops-pick__domain { font-size: 13px; line-height: 18px; font-weight: 500; color: var(--ui-muted); overflow-wrap: anywhere; }
.ops-logo { flex: none; width: 40px; height: 40px; border-radius: var(--ui-radius-control); object-fit: contain; background: var(--ui-surface); border: 1px solid var(--ui-line); }

/* ── Certificates: the result ───────────────────────────────────────────── */
.ops-result { display: flex; flex-direction: column; gap: 12px; margin: 16px 0 0; padding: var(--ui-card-pad); background: var(--ui-success-50); border-radius: var(--ui-radius-card); }
.ops-result__row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 4px 12px; }
.ops-result__label { grid-column: 1 / -1; font-size: 13px; line-height: 18px; font-weight: 600; color: var(--ui-slate); }
.ops-result__link { display: block; min-width: 0; padding: 11px 0; overflow: hidden; color: var(--ui-brand); font-size: 15px; line-height: 22px; text-overflow: ellipsis; white-space: nowrap; }

/* ── Dialogs built from the legacy overlays (Blog) ──────────────────────── */
/* The overlay keeps .confirm-overlay (Back closes it: the router's onClose) and is
   drawn as the kit's scrim: a bottom sheet below 768, a centred card from 768. */
.confirm-overlay.ops-modal { z-index: 1000; align-items: flex-end; justify-content: center; padding: 0; background: var(--ui-overlay); font-family: var(--ui-font); }
.ops-modal .ui-dialog { max-height: calc(100% - 24px); }
.ops-modal .ui-dialog__head { justify-content: space-between; }
.ops-modal .ui-dialog__head .ui-btn--icon { flex: none; margin: -10px -10px 0 0; }
.ops-modal__foot { display: flex; flex-direction: column-reverse; gap: 8px; margin: 0; }
.ops-modal__foot .ui-btn { width: 100%; min-height: 52px; font-size: 16px; line-height: 24px; white-space: normal; }
/* The foot stacks bottom-up on the phone (Primary on top), which put an option that
   changes what the Primary does (Publish + "Send the newsletter email") BELOW the
   buttons. It goes above them, so it is read first; from 768 it sits at the left of
   the row (browser:ops checks both). */
.ops-modal__foot .ui-check-row { order: 1; }
.ops-seo { display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 12px 16px; background: var(--ui-surface-2); border: 1px solid var(--ui-line); border-radius: var(--ui-radius-control); font-size: 14px; line-height: 20px; color: var(--ui-slate); overflow-wrap: anywhere; }
.ops-seo strong { color: var(--ui-ink); font-weight: 600; }
.ops-article { font-size: 15px; line-height: 24px; color: var(--ui-ink); overflow-wrap: anywhere; }
.ops-article h1, .ops-article h2, .ops-article h3 { margin: 16px 0 8px; font-size: 18px; line-height: 24px; font-weight: 600; }
.ops-article p, .ops-article ul, .ops-article ol { margin: 0 0 12px; }
.ops-article ul, .ops-article ol { padding-left: 20px; }
.ops-article a { color: var(--ui-brand); }
.ops-sources { display: flex; flex-direction: column; gap: 4px; }
.ops-sources a { display: inline-flex; align-items: center; min-height: 44px; color: var(--ui-brand); font-size: 15px; line-height: 22px; overflow-wrap: anywhere; }
@media (min-width: 768px) {
  .confirm-overlay.ops-modal { align-items: center; padding: 24px; }
  .ops-modal .ui-dialog--wide { width: 720px; }
  .ops-modal__foot { flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: flex-end; }
  .ops-modal__foot .ui-btn { width: auto; min-height: 44px; font-size: 15px; line-height: 22px; }
  .ops-modal__foot .ui-check-row { order: 0; margin-right: auto; }
}
