/* The shared look of every chematiqs-cloud page (2026-11-28), taken from the Billing page: flat on the white page, no
   grey tiles; Carbon's components and tokens; small, quiet secondary text. Loaded by base.html on every page, after
   Carbon and base.css and before a page's own CSS, so a new page that uses these classes looks like the rest without
   any CSS of its own. Where two pages differed, the subtler wins. How to use each piece: app/common/UI.md.

   Tokens are set on body, not :root: Carbon defines its own (--cds-*) on <body class="cds--white">, so a token
   that refers to one must be resolved there. Ported tools (their own CSS under .pcb, .fsx, .sdsx, .dex, .smx) point
   their brand tokens at these. */
body {
  --ui-text: var(--cds-text-primary, #161616);
  --ui-text-secondary: var(--cds-text-secondary, #525252);
  --ui-text-placeholder: var(--cds-text-placeholder, #a8a8a8);
  --ui-text-disabled: var(--cds-text-disabled, #c6c6c6);
  --ui-surface: var(--cds-background, #fff);
  --ui-layer: var(--cds-layer-01, #f4f4f4);           /* a quiet fill: fields, code, table detail rows */
  --ui-hover: var(--cds-layer-hover-01, #e8e8e8);
  --ui-selected: var(--cds-layer-selected-01, #e0e0e0);
  --ui-border-subtle: var(--cds-border-subtle-00, #e0e0e0);   /* hairlines between things */
  --ui-border: var(--cds-border-subtle-01, #c6c6c6);
  --ui-border-strong: var(--cds-border-strong-01, #8d8d8d);   /* a field's underline, a total's rule */
  --ui-accent: var(--cds-interactive, #0f62fe);
  --ui-accent-soft: var(--cds-highlight, #d0e2ff);
  --ui-focus: var(--cds-focus, #0f62fe);
  --ui-error: var(--cds-text-error, #da1e28);
  --ui-error-tint: #fff1f1;
  --ui-warning: var(--cds-support-warning, #f1c21b);          /* fills and icons only: too light for text */
  --ui-warning-text: #8e6a00;
  --ui-warning-tint: var(--cds-notification-background-warning, #fcf4d6);
  --ui-success: var(--cds-support-success, #24a148);
  --ui-success-text: #198038;
  --ui-success-tint: #defbe6;
  --ui-info-tint: #edf5ff;
  --ui-radius: 0;                                              /* Carbon's corners are square */
  --ui-font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

/* --- Text --- */
.muted { color: var(--ui-text-secondary); }
.sub { display: block; font-size: .75rem; color: var(--ui-text-secondary); white-space: normal; }   /* a second line */
.mono { font-family: var(--ui-font-mono); }
.nowrap { white-space: nowrap; }
.text-error { color: var(--ui-error) !important; }
.text-warning { color: var(--ui-warning-text) !important; }
.text-success { color: var(--ui-success-text) !important; }
[hidden] { display: none !important; }   /* Carbon's display rules (e.g. .cds--btn) would otherwise beat it */

/* --- Page toolbar: one line, never wrapping. The page's main control (e.g. a Period dropdown) on the left; on the
   right, the status (how old or where the data is, or what's happening) and the page's ☰ menu. A long status shortens
   with an ellipsis (its full text in the title). --- */
.page-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-block-end: .5rem; }
.toolbar-end { display: flex; align-items: center; gap: .5rem; min-inline-size: 0; margin-inline-start: auto; }
.toolbar-end > .status { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* A form row of labelled controls (labels above), wrapping when narrow: the pages with several inputs. */
.toolbar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 1rem; margin-block-end: .75rem; }
.toolbar > .cds--form-item, .toolbar > .cds--select { flex: 0 1 auto; inline-size: auto; margin: 0; }
.toolbar-label { font-size: .875rem; color: var(--ui-text-secondary); }

/* A labelled dropdown with its label beside it, keeping Carbon's field look (grey fill, underline, chevron) so it
   reads as selectable. Markup: div.cds--select.field-inline > label.cds--label + div.cds--select-input__wrapper >
   select.cds--select-input + svg.cds--select__arrow. */
.field-inline { flex-direction: row; align-items: center; gap: .5rem; flex: none; inline-size: auto; }   /* Carbon's is 100% */
.field-inline .cds--label { margin: 0; white-space: nowrap; }
.field-inline .cds--select-input__wrapper { inline-size: 12rem; }
.cds--select-input { cursor: pointer; }
.cds--select-input:disabled { cursor: default; }
.cds--select__arrow { fill: var(--ui-text); }

/* --- Status: one quiet line saying what's happening, what failed (.text-error) or that data is stale (.is-stale). --- */
.status { margin: 0 0 .75rem; font-size: .875rem; color: var(--ui-text-secondary); }
.status:empty { display: none; }
.status.is-stale { color: var(--ui-error); }

/* --- Sections: flat, a small bold heading with a hairline under it, then its hint, then its content. --- */
.section + .section, .section-title:not(:first-child) { margin-block-start: 2rem; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: .75rem;
                 margin: 0 0 .75rem; padding-block-end: .5rem; border-block-end: 1px solid var(--ui-border-subtle);
                 font-size: 1rem; font-weight: 600; line-height: 1.375; }
.section-title > span { display: inline-flex; align-items: center; }
.section-hint { margin: 0 0 .75rem; font-size: .75rem; color: var(--ui-text-secondary); max-inline-size: 60rem; }
.section-hint:empty { display: none; }
.empty-note { color: var(--ui-text-secondary); }

/* --- Icon buttons ---
   The "i" button opens a section's or a row's popup (base.js openInfo). Doubled class: it must win over a ported
   tool's own `.x button` rules. */
.info-btn.info-btn { display: inline-grid; place-items: center; inline-size: 1rem; block-size: 1rem; min-block-size: 0;
                     margin: 0 0 0 .375rem; padding: 0; border-radius: 50%; border: 1px solid var(--cds-icon-secondary, #525252);
                     background: none; cursor: pointer; color: var(--cds-icon-secondary, #525252);
                     font: italic 600 .625rem/1 Georgia, serif; vertical-align: .1em; box-shadow: none; }
.info-btn.info-btn:hover, .info-btn.info-btn:focus-visible { background: var(--cds-icon-secondary, #525252); color: #fff; outline: none; }
/* A small icon action (refresh, copy, close): no box, dims on hover. */
.icon-btn { display: inline-flex; align-items: center; padding: 0; border: 0; background: none; cursor: pointer;
            line-height: 1; user-select: none; color: var(--cds-icon-secondary, #525252); }
.icon-btn:hover, .icon-btn:focus-visible { opacity: .65; }
.icon-btn svg, .icon-btn + svg { vertical-align: -2px; }
/* A warning after a row's "i": the same size, why on hover (title). */
.warn-icon { display: inline-flex; inline-size: 1rem; block-size: 1rem; margin-inline-start: .375rem; vertical-align: -.2em; cursor: help; }
.warn-icon .warn-fill { fill: var(--ui-warning); }
.warn-icon .warn-mark { fill: #161616; }
/* A colour swatch left of a label: the key between a row and its chart segment. */
.swatch { display: inline-block; inline-size: .625rem; block-size: .625rem; margin-inline-end: .5rem; border-radius: 2px; }

/* --- Menus: the page's ☰ menu (.menu in the page toolbar) and a row's ⋮ menu (.row-menu, row-menu.js), the same
   list. base.js opens and closes any .menu: a .menu-btn toggles its .menu-list, a click elsewhere or Escape closes. --- */
.menu, .row-menu { position: relative; flex: none; display: inline-block; }
.menu-btn, .row-menu-btn { display: inline-flex; align-items: center; justify-content: center; inline-size: 2rem; block-size: 2rem;
                           padding: 0; border: 0; background: none; cursor: pointer; color: var(--cds-icon-primary, #161616);
                           fill: var(--cds-icon-primary, #161616); }
.menu-btn:hover, .menu-btn[aria-expanded="true"], .row-menu-btn:hover, .row-menu-btn[aria-expanded="true"] { background: var(--ui-hover); }
.menu-list, .row-menu-list { z-index: 7500; min-inline-size: 12rem; margin: 0; padding: 0; list-style: none;
                             background: var(--cds-layer, #f4f4f4); box-shadow: 0 2px 6px rgba(0, 0, 0, .3); }
.menu-list { position: absolute; top: 100%; right: 0; }
.row-menu-list { position: fixed; }   /* placed by row-menu.js, so a scrolling table can't clip it */
.menu-list button, .row-menu-list button { display: block; inline-size: 100%; padding: .6875rem 1rem; border: 0; background: none;
                                           font: inherit; font-size: .875rem; text-align: start; cursor: pointer; color: var(--ui-text); }
.menu-list button:hover:not(:disabled), .row-menu-list button:hover:not(:disabled) { background: var(--ui-hover); }
.menu-list button:disabled, .row-menu-list button:disabled { color: var(--ui-text-disabled); cursor: not-allowed; }
.row-menu-list button.danger:hover:not(:disabled) { background: var(--cds-button-danger-primary, #da1e28); color: #fff; }

/* --- Tables: Carbon's data table, small and zebra (cds--data-table cds--data-table--sm cds--data-table--zebra) in a
   .table-scroll. Numbers right-aligned (.num); a total row in tfoot with a rule above and none below. --- */
.table-scroll { overflow-x: auto; }
.cds--data-table th.num, .cds--data-table td.num { text-align: end; white-space: nowrap; }
.cds--data-table td.nowrap { white-space: nowrap; }
.cds--data-table td.wrap { white-space: normal; overflow-wrap: anywhere; }
.cds--data-table tfoot td { font-weight: 600; border-block-start: 1px solid var(--ui-border-strong); border-block-end: 0; }
.cds--data-table tr.is-selected td { background: var(--ui-selected); }

/* Grouped rows: a group's line (tr.group-row) is bold, with a ▸ disclosure button (.group-toggle, aria-expanded) that
   shows its rows (tr.group-child, indented under the second column); a collapsed group's usage-type cell says
   "(various)"; a root row's first cell may start with a .swatch. */
.group-row td { font-weight: 600; }
.group-toggle { background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer; }
.group-toggle::before { content: "▸"; display: inline-block; inline-size: 1.1em; transition: transform .1s; }
.group-toggle[aria-expanded="true"]::before { transform: rotate(90deg); }
.group-toggle:focus-visible { outline: 2px solid var(--ui-focus); outline-offset: 2px; }
.group-child td:nth-child(2) { padding-inline-start: 2rem; }

/* --- Notices: a callout above content (a warning, or an error that isn't one line of status). --- */
.notice { margin: 0 0 1rem; padding: .75rem 1rem; font-size: .875rem; color: var(--ui-text);
          border-inline-start: 3px solid var(--ui-accent); background: var(--ui-info-tint); }
.notice--warning { border-inline-start-color: var(--ui-warning); background: var(--ui-warning-tint); }
.notice--error { border-inline-start-color: var(--ui-error); background: var(--ui-error-tint); }
.notice--success { border-inline-start-color: var(--ui-success); background: var(--ui-success-tint); }

/* --- Popups (base.js openInfo): a row's own notes listed under "This row", above the file's closing links. --- */
.info-row-notes h2 { font-size: 1rem; font-weight: 600; }
.info-row-notes ul { list-style: disc; padding-inline-start: 1.25rem; }

/* --- Ported tools' plain controls: their buttons, fields and links (classless HTML from their originals) in the shared
   look. A tool's root element gets class "ui-plain", and its own CSS keeps only layout and states (a selected tab, a
   danger button armed): these rules sit in :where(), so they count as one class and any rule of the tool's wins.
   Buttons: Carbon's tertiary (blue outline) by default, .primary filled. Fields: Carbon's (grey fill, underline). --- */
.ui-plain { font-size: .875rem; line-height: 1.43; color: var(--ui-text); }
.ui-plain :where(button:not([class*="cds--"], .info-btn, .icon-btn, .menu-btn, .row-menu-btn, .group-toggle)) {
  font: inherit; font-size: .875rem; padding: .375rem 1rem; border: 1px solid var(--ui-accent); border-radius: var(--ui-radius);
  background: transparent; color: var(--ui-accent); cursor: pointer; text-align: start; }
.ui-plain :where(button:not([class*="cds--"], .info-btn, .icon-btn, .menu-btn, .row-menu-btn, .group-toggle):hover:not(:disabled)) {
  background: var(--ui-accent); color: #fff; }
.ui-plain :where(button.primary) { background: var(--ui-accent); color: #fff; }
.ui-plain :where(button.primary:hover:not(:disabled)) { background: var(--cds-button-primary-hover, #0050e6); }
.ui-plain :where(button:disabled) { color: var(--ui-text-disabled); border-color: var(--ui-text-disabled); background: transparent; cursor: not-allowed; }
.ui-plain :where(button.primary:disabled) { background: var(--ui-text-disabled); color: #8d8d8d; }
.ui-plain :where(input[type="text"], input[type="search"], input[type="number"], input[type="date"], input:not([type]), select, textarea):where(:not([class*="cds--"])) {
  font: inherit; font-size: .875rem; color: var(--ui-text); background: var(--ui-layer); border: 0;
  border-block-end: 1px solid var(--ui-border-strong); border-radius: var(--ui-radius); padding: .375rem .75rem; }
.ui-plain :where(input, select, textarea):focus { outline: 2px solid var(--ui-focus); outline-offset: -2px; }
.ui-plain :where(a) { color: var(--ui-accent); }
.ui-plain :where(h1, h2) { font-size: 1rem; font-weight: 600; line-height: 1.375; }
