/* CEO desktop frame (owner order Nov 3 06:45, OFFICE-LAYOUT-CONTRACT sections 1-3 and 9).
   Same skeleton as the Office without the sidebar: the page is exactly one viewport tall and never scrolls;
   panels fill the height and end at the bottom margin M; the bottom row is pocket height P and stops G before the
   AQUIS pocket in the bottom-right corner; long panels scroll INSIDE (header fixed, whole rows only, see ceo-frame.js).
   Below 1280 px (tablet, phone) the page keeps its normal scroll with bottom padding for the floating AQUIS: the CEO's
   eight-stage river, map and four department cards do not fit one 1024 px screen (contract line is 1024; see REPORT). */
:root {
  --ceo-m: 16px;       /* outer margin = gutter between panels (L2) */
  --pocket-w: 119px;   /* AQUIS drop 92 x 1.10 plus word and Dive shoulder */
  --pocket-h: 137px;   /* AQUIS box height */
  --slot-w: calc(var(--pocket-w) + 12px); /* AQUIS slot (OWNER-RULES 2.6): full-height right column = the drop + a 12 px gap */
  --foot-h: clamp(188px, 22vh, 240px);
}
@media (min-width: 1280px) { :root { --platform-gap: 16px; } }

@media (min-width: 1280px) {
  html, html body { height: 100%; overflow: hidden; }
  html body { display: flex; flex-direction: column; }

  /* Top bar: one glass row, same margins as the standard. */
  html:root body .top[data-no-world-launcher] { /* :root outweighs shared/theme-top.css, whose opaque top paint is replaced by the Office glass */
    flex: none; box-sizing: border-box; height: 54px; margin: var(--ceo-m) var(--ceo-m) 0; padding: 0 16px;
    background: var(--platform-fill) !important; border: 1px solid var(--platform-border);
    border-radius: var(--platform-radius); box-shadow: var(--platform-shadow);
    backdrop-filter: var(--gl-blur) !important; -webkit-backdrop-filter: var(--gl-blur) !important;
    gap: 14px;
  }
  html body .top .logo { width: 38px; height: 37px; }
  html body .top .ttl b { font-size: 18px; line-height: 1.1; }
  html body .top .tag { display: none; }

  /* KPI tiles: label on one line, figure and its note side by side. */
  html body .kband .kpi.pv { display: grid; grid-template-columns: minmax(0, 1fr); align-content: center; gap: 2px; padding: 6px 14px; }
  html body .kband .kpi.pv > div:nth-child(2) { display: flex; align-items: baseline; gap: 12px; min-width: 0; }
  html body .kband .kpi.pv .v { flex: none; white-space: nowrap; font-size: 26px; line-height: 1.15; }
  html body .kband .kpi.pv .v.none { font-size: 16px; line-height: 1.3; white-space: normal; }
  html body .kband .kpi.pv .d { flex: 1 1 0; min-width: 0; font-size: 11px; line-height: 1.2; margin: 0; }
  html body .kband .kpi.pv svg { display: none; }
  /* Pipeline River: compact so the working row below keeps its height. */
  html body .river { padding: 8px 0 4px; }
  html body .river .ch { margin: 0; }
  html body .rv { margin-top: 0; }
  html body .rv-water { height: 22px; }
  html body .stages { margin-top: -2px; }
  html body .stages li + li::before { top: 2px; bottom: 2px; }

  /* Content area: from the margin to the margin, ending exactly at the bottom margin. */
  html body main {
    flex: 1 1 auto; min-height: 0; box-sizing: border-box; padding: var(--platform-gap) calc(var(--ceo-m) + var(--slot-w)) var(--ceo-m) var(--ceo-m);
  }
  html body .dash {
    height: 100%; min-height: 0; gap: var(--platform-gap);
    grid-template-rows: auto auto minmax(0, 1fr) var(--foot-h);
  }
  html body .kband { margin: 0; }
  html body .kpi { min-height: 0; padding: 8px 16px; }
  html body .kv { font-size: 26px; }
  html body .mid { min-height: 0; }
  html body .mid > .atlas, html body .mid > .side { min-height: 0; height: 100%; }
  html body .side, html body .cols { min-height: 0; height: 100%; }
  html body .cols > .card { min-height: 0; height: 100%; align-self: stretch; }

  /* Bottom row: ends on the slot's left edge like every other row; nothing sits under AQUIS. */
  html body .foot { position: static; height: var(--foot-h); min-height: 0; padding: 0; }
  html body .foot > .bottom, html body .foot > .bottom-sk { height: var(--foot-h); min-height: 0; }
  html body .bottom > .card, html body .bottom-sk > .card { height: var(--foot-h); min-height: 0; padding: 12px; overflow: hidden; box-sizing: border-box; }
  html body .bottom > .card > .ch { margin: 0 0 8px; min-height: 28px; gap: 8px; }
  html body .bottom > .card > .ch .ico { width: 28px; height: 28px; margin: 0; border-radius: 9px; }
  html body .bottom > .card > .ch h3 { font-size: 16px; line-height: 1.1; }
  html body .bottom > .card > .ch .ico .ic, html body .bottom > .card > .ch .ico svg { width: 18px; height: 18px; }

  /* AQUIS lives in the slot, bottom-right on the margins; the Dive button rides its right shoulder. */
  html body .aquis { position: fixed; right: var(--ceo-m); bottom: var(--ceo-m); width: var(--pocket-w); height: var(--pocket-h); }
  html body .ceo-dive { position: fixed; right: var(--ceo-m); bottom: calc(var(--ceo-m) + 60px); }
}

/* Inner scroll: the scroller keeps the card's remaining height; ceo-frame.js trims it to whole rows. */
html body .ceo-scroll { overflow-x: hidden; overflow-y: auto; min-height: 0; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--platform-accent) 55%, transparent) transparent; }
html body .ceo-scroll { scroll-snap-type: y mandatory; }
html body .ceo-scroll :is(.call, .decision, .metric-row, .inv-tile, .inv-more, .rows > *), html body .ceo-scroll.card-scroll > * { scroll-snap-align: start; }
html body .ceo-scroll:focus-visible { outline: 2px solid var(--platform-accent); outline-offset: -2px; }

@media (min-width: 1280px) {
  /* Live AI verification: header and legend stay fixed, the call list scrolls. */
  html body .verify.pv { display: flex; flex-direction: column; overflow: hidden; }
  html body .verify.pv > :not(.calls):not(.bl) { flex: none; }
  html body .verify.pv > .calls { flex: 1 1 auto; min-height: 0; max-height: 264px; display: grid; grid-auto-rows: minmax(calc(50px + var(--ceo-extra, 0px)), 1fr); align-content: stretch; gap: 6px; }
  /* Today's installs: its figures are equal tiles that take the remaining height, so the card has no empty band. */
  html body .verify.pv > .bl { flex: 1 0 28px; min-height: 28px; max-height: 64px; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 8px; margin: 0; }
  html body .verify.pv > .bl > span { display: flex; align-items: center; justify-content: center; gap: 8px; min-width: 0; padding: 4px 8px; box-sizing: border-box; border: 1px solid var(--platform-row-line); border-radius: 12px; background: var(--platform-row); font-size: 14px; font-weight: 600; text-align: center; line-height: 1.2; }
  html body .verify.pv > .bl > span:only-child { grid-column: 1 / -1; font-weight: 500; font-size: 12px; }
  html body .verify.pv > .ti { margin: 6px 0 6px; }
  html body .verify.pv > .bar { margin: 0 0 8px; }
  html body .verify.pv > .calls > .call { height: auto; margin: 0; width: 100%; min-width: 0; }
  html body .verify.pv > .calls, html body .decide > .decisions { grid-template-columns: minmax(0, 1fr); }
  html body .decide .decision { min-width: 0; margin-inline: 0; width: 100%; }
  @container (max-width: 470px) { html body .verify.pv .call { grid-template-columns: 32px minmax(0, 1fr) 48px auto; gap: 8px; } }
  /* Watch list: header fixed, decisions scroll. */
  html body .decide { display: flex; flex-direction: column; overflow: hidden; }
  html body .decide > .decisions { flex: 1 1 0; min-height: 0; grid-auto-rows: minmax(calc(48px + var(--ceo-extra, 0px)), 1fr); align-content: stretch; }

  /* Bottom cards. */
  html body .bottom > .card { display: flex; flex-direction: column; }
  html body .bottom > .card > .rec-card-cover { position: absolute; inset: 0; }
  html body .bottom .reps .tiles:has(.rep) { flex: 1 1 0; min-height: 0; margin-inline: 0; gap: 4px; grid-auto-rows: minmax(calc(26px + var(--ceo-extra, 0px)), 1fr); align-content: stretch; }
  html body .bottom .reps .tiles .metric-row.rep button { height: 100%; min-height: 26px; padding: 1px 8px 1px 4px; }
  html body .bottom .reps .rk { width: 20px; height: 20px; font-size: 9px; }
  /* An expanded ranking row owns its intrinsic height so its profile action stays clickable; the list scrolls. */
  html body .bottom .reps .tiles:has(.rep-quick:not([hidden])) { grid-auto-rows: auto; }
  html body .bottom .reps .tiles:has(.rep-quick:not([hidden])) .metric-row.rep button { height: auto; min-height: 26px; }
  /* Service: ring + rows scroll together under the fixed header. */
  html body .bottom > .card > .dbody { flex: 1 1 0; min-height: 0; align-items: stretch; }
  html body .bottom > .card > .dbody > .dept-big { align-self: center; }
  html body .bottom > .card > .dbody > .rows { align-self: flex-start; min-height: 100%; margin: 0; }
  html body .bottom .dbody .rows > .dept-flags { min-height: 0; align-items: center; }
  html body .bottom .dbody .rows > .dept-flags > * { min-height: 0; max-height: 100%; padding-block: 0; line-height: 1.2; display: inline-flex; align-items: center; }
  html body .bottom .dbody .rows { gap: 4px; grid-auto-rows: minmax(calc(24px + var(--ceo-extra, 0px)), 1fr); align-content: stretch; }
  html body .bottom .dbody .metric-row button { min-height: 24px; height: 100%; padding: 1px 8px; }
  html body .bottom :is(.ring, .ring.none) { width: 46px !important; height: 46px !important; padding: 0 3px !important; flex: none; }
  html body .bottom .ring b { font-size: 15px; }
  html body .bottom .ring small { max-width: 40px; font-size: 7.5px; }

  /* A department that only has its summary (no product or row lines yet): the summary row fills the card. */
  html body .bottom > .card > .dbody:has(> .dept-big:only-child) { align-items: stretch; }
  html body .bottom > .card > .dbody > .dept-big:only-child { flex: 1 1 auto; width: 100%; height: auto; align-self: stretch; }

  /* People: the card body scrolls as one list of rows. */
  html body .bottom > .card > .card-scroll { flex: 1 1 0; min-height: 0; display: grid; gap: 4px 12px; align-content: start; grid-template-columns: minmax(0, 1fr); }
  html body .bottom > .card > .card-scroll > * { min-width: 0; margin: 0; }
  html body .bottom > .card > .card-scroll > .dbody { order: 1; padding-block: calc(var(--ceo-extra, 0px) / 2); }
  html body .bottom > .card > .card-scroll > .act-strip { order: 2; padding-block: calc(var(--ceo-extra, 0px) / 2); }
  html body .bottom > .card > .card-scroll > .ppl-af { order: 3; }
  html body .bottom > .card > .card-scroll > .people-extra { order: 4; }
  html body .bottom .people-extra, html body .bottom .ppl-af { padding: 0; }
  @container (min-width: 340px) {
    html body .bottom > .card > .card-scroll { grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; box-sizing: border-box; }
    html body .bottom .card-scroll > .ppl-af { order: 2; grid-column: 2; grid-row: 1; align-self: center; }
    html body .bottom .card-scroll > .dbody { grid-column: 1; grid-row: 1; }
    html body .bottom .card-scroll > .act-strip { order: 3; grid-column: 1 / -1; }
    html body .bottom .card-scroll > .people-extra { order: 4; grid-column: 1 / -1; }
  }

  /* Inventory with product lines: header, one summary row, then product rows scroll (whole rows). */
  html body .bottom > .card:has(> .inv-products) { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto minmax(0, 1fr); row-gap: 3px; padding-block: 6px; }
  html body .bottom > .card:has(> .inv-products) > .ch { grid-row: 1; margin: 0; }
  html body .bottom > .card:has(> .inv-products) > .dbody { grid-row: 2; min-height: 0; flex: none; align-items: center; }
  html body .bottom > .card:has(> .inv-products) > .inv-products { grid-row: 3; min-height: 0; }
  html body .bottom > .card:has(> .inv-products) .dept-big { display: flex; align-items: center; gap: 8px; }
  html body .bottom > .card:has(> .inv-products) .ring { width: auto !important; height: 22px !important; padding: 0 9px !important; border-radius: 999px; display: inline-flex; align-items: baseline; justify-content: center; gap: 4px; background: var(--platform-fill) !important; box-shadow: inset 0 0 0 1px var(--platform-border); }
  html body .bottom > .card:has(> .inv-products) .ring b { font-size: 13px; line-height: 22px; }
  html body .bottom > .card:has(> .inv-products) .ring small { max-width: none; font-size: 10px; line-height: 22px; white-space: nowrap; }
  html body .bottom > .card:has(> .inv-products) .ml > span:first-child { display: none; }
  html body .bottom > .card:has(> .inv-products) .ml small { font-size: 10px; line-height: 1.1; display: block; }
  html body .bottom > .card:has(> .inv-products) > .dbody { height: 26px; }
  html body .bottom .inv-products { display: flex; flex-direction: column; gap: 3px; padding: 0; margin: 0; }
  html body .bottom .inv-tile { flex: none; flex-direction: row; align-items: center; gap: 8px; height: calc(30px + var(--ceo-extra, 0px)); padding: 2px 8px 2px 2px; border-radius: 9px; }
  html body .bottom .inv-tile__stage { width: 26px; height: 26px; aspect-ratio: auto; flex: none; border-radius: 7px; }
  html body .bottom .inv-tile__meta { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto auto; align-content: center; align-items: center; column-gap: 8px; row-gap: 0; min-width: 0; }
  html body .bottom .inv-tile__meta > b { grid-column: 1; grid-row: 1 / 3; }
  html body .bottom .inv-tile__units { grid-column: 2; grid-row: 1; justify-self: end; }
  html body .bottom .inv-tile__meta > .inv-chip { grid-column: 2; grid-row: 2; justify-self: end; }
  html body .bottom .inv-tile__meta:not(:has(> .inv-chip)) > .inv-tile__units { grid-row: 1 / 3; }
  html body .bottom .inv-tile__meta b { font-size: 10.5px; line-height: 1.1; -webkit-line-clamp: 2; flex: 1; min-width: 0; overflow-wrap: anywhere; }
  html body .bottom .inv-tile__units { white-space: nowrap; font-size: 10.5px; }
  html body .bottom .inv-chip { margin: 0; padding: 0 6px; font-size: 8.5px; line-height: 1.25; white-space: nowrap; }
  html body .bottom .inv-more { height: calc(30px + var(--ceo-extra, 0px)); padding: 0; display: grid; place-items: center; align-self: stretch; font-size: 10.5px; flex: none; }
}

@media (min-width: 1280px) {
  html body .stages button { grid-template-columns: auto auto; column-gap: 8px; justify-content: center; align-content: start; row-gap: 0; }
  html body .stages button .num { grid-row: 1; grid-column: 1; }
  html body .stages button .sn { grid-row: 1; grid-column: 2; align-self: center; }
  html body .stages button .sv, html body .stages button .sa { grid-row: 2; grid-column: 1 / -1; }
}


/* An unconnected figure reads as one line of text, not as a wrapped headline (all widths). */
html body .kpi.pv .v.none { font-size: 16px; line-height: 1.3; }

/* A new dealer's sparse states: team totals instead of a rep ranking, sample calls, two roles. Same panels, nothing cut or spilled. */
@media (min-width: 1280px) {
  html body .bottom .reps .tiles:not(:has(.rep)) .metric-row button { flex-direction: row; align-items: center; min-height: 0; height: 100%; padding: 2px 12px; }
  html body .verify.pv > .calls .call.is-sample { position: relative; align-content: center; }
  /* P1p: a smaller chip in the row's top corner, above the status word. At 1440 the status centres at 13.5px in a 41px row; the old 17px chip at top:2px reached 19px and overlapped it by 3px. */
  html body .verify.pv > .calls .call.is-sample .sample-chip { position: absolute; top: 0; right: 8px; margin: 0; padding: 0 6px; font-size: 8px; line-height: 10px; }
  html body .bottom .ppl-roles:not(:has(> :nth-child(3))) { flex-direction: row; align-items: center; gap: 12px; }
  html body .bottom .ppl-roles:not(:has(> :nth-child(3))) .ppl-rolebar { flex: 1 1 0; min-width: 0; }
}
@media (max-width: 640px) {
  html body .reps .tiles:not(:has(.rep)) { grid-template-columns: minmax(0, 1fr); }
  html body .reps .tiles:not(:has(.rep)) .metric-row button { flex-direction: row; align-items: center; min-height: 44px; }
}
html body .ti-empty { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 10px; }
/* Wide screens have shorter call rows: the sample chip takes the place of a sample row's waveform, clear of the title in both languages and of the status. */
@media (min-width: 1700px) {
  html body .verify.pv > .calls .call.is-sample .wave { visibility: hidden; } /* keeps its column, so the status keeps its width */
  html body .verify.pv > .calls .call.is-sample .sample-chip { right: auto; left: 215px; top: 50%; transform: translateY(-50%); }
}
