/* FeatSuite's shared parts (GitHub issue 203, part 1a; docs/adr/0066-one-interface-foundation.md).
   One page frame, buttons, fields, tables, dialogs, menus, toasts, and the empty, loading and error states, drawn the
   same way on every page of the staff app, Admin settings and the Requester portal, in light and in dark.
   Loaded after styles.css, so these win over the older rules there. Sizes come from tokens.css only: no font size,
   padding, margin, gap, corner or layer is written here in pixels (test/design-tokens.test.js). Colors come from
   styles.css's palette (--ink, --surface, --spruce, --bad…), which changes with the theme. */

/* Something marked hidden stays hidden, whatever display a sheet gives its kind (GitHub issue 203, 1e: a hidden
   "Reset two-step sign-in" and an empty button showed in the user editor, because .outline-button's display won over
   the attribute). Code that shows a thing takes the attribute off; nothing shows a hidden thing by its display. */
[hidden] { display:none !important; }

/* The browser draws its own parts (checkboxes, radios, scroll bars, a select's list, date pickers) in the page's theme. */
:root { color-scheme:light; }
:root[data-theme="dark"] { color-scheme:dark; }
:root {
  /* A field's fill, and the quieter fill of one that is read only or disabled: darker than the card in the dark theme. */
  --field-bg:var(--surface);
  --field-muted-bg:var(--surface-2);
  --on-bad:#ffffff;
  --scrim:rgba(20, 23, 21, .45);
  --field-placeholder:var(--muted);
}
:root[data-theme="dark"] {
  --field-bg:var(--surface-2);
  --field-muted-bg:var(--paper);
  --on-bad:#141715;
  --scrim:rgba(0, 0, 0, .62);
}

/* ======================================================================================================== Page frame
   Every page: the breadcrumb (where you are), the title, and the main action at the top right (ui-parts.js). */
/* The breadcrumb reads in full at every width: no crumb is cut short with an ellipsis. When the crumbs don't fit on
   one line they go on to the next between crumbs, each "›" with the crumb after it, and a crumb longer than the line
   (a department's name is up to 40 characters, the customer's own) wraps between its words, or inside a word longer
   than the line. The owner, 2026-10-24: on a phone, after a 40-character department name, "Admin settings" read
   "Admin s…". test/breadcrumb-wrap.test.js keeps it so in every stylesheet. */
.page-breadcrumb { display:block; margin:0 0 var(--space-150); color:var(--muted); font-size:var(--text-sm); line-height:var(--leading-normal); overflow-wrap:anywhere; }
.page-breadcrumb ol { display:flex; flex-wrap:wrap; align-items:baseline; gap:var(--space-50) var(--space-75); margin:0; padding:0; list-style:none; }
.page-breadcrumb li { display:inline-flex; align-items:baseline; gap:var(--space-75); min-width:0; max-width:100%; }
.page-breadcrumb li + li::before { content:'›'; flex:none; color:var(--muted); font-size:var(--text-md); line-height:1; }
.page-breadcrumb button { min-width:0; min-height:0; padding:0; border:0; border-radius:var(--radius-sm); background:none; color:var(--ink-2); font:inherit; font-weight:var(--weight-medium); text-align:start; white-space:normal; cursor:pointer; box-shadow:none; }
.page-breadcrumb button:hover { color:var(--spruce); text-decoration:underline; text-underline-offset:var(--space-25); }
.page-breadcrumb button:focus-visible { outline:2px solid var(--spruce); outline-offset:var(--space-25); }
.page-breadcrumb [aria-current="page"] { min-width:0; color:var(--ink); font-weight:var(--weight-semibold); }
/* The bar at the top of the content: the same place on every page. */
.page-frame-bar { display:flex; align-items:center; min-height:var(--control-height-sm); margin:0 0 var(--space-100); }
.page-frame-bar[hidden] { display:none; }
.page-frame-bar .page-breadcrumb { margin:0; }
/* The breadcrumb keeps its line, and what sits beside it ("Times in …") goes under it when the two don't fit: on a
   phone the note squeezed the breadcrumb onto two lines beside it (GitHub issue 203, 1e). */
.page-frame-bar { flex-wrap:wrap; row-gap:var(--space-25); }
.page-frame-bar .page-breadcrumb { flex:0 1 auto; max-width:100%; }
/* The breadcrumb sits in the top bar's old place; that one is no longer shown. */
.topbar .breadcrumbs { display:none; }

/* The title row: the title (and a line under it) on the left, the main action on the right. */
.page-heading, .page-frame-heading { display:flex; flex-wrap:wrap; align-items:flex-start; justify-content:space-between; gap:var(--space-150) var(--space-300); margin:0 0 var(--space-300); }
/* The title takes at least 20rem of a row (less on a narrow screen) and the actions sit beside it when they fit. The
   20rem is its width, never its height: a page whose own rules turn the row into a column (CMDB, an open report, Team
   performance) had a 20rem flex basis there, a 200-300 px blank under the description on a phone (GitHub issue 203, 1e). */
.page-heading > div:first-child, .page-frame-heading > div:first-child { flex:1 1 0%; min-width:min(20rem, 100%); }
.page-heading h1, .page-frame-title, #settingsView .page-frame-heading h2.page-frame-title, #settingsView .page-frame-title,
.ticket-detail .detail-header h1, .ov-head h1, #overviewView h1 { margin:0; color:var(--ink); font:var(--weight-bold) var(--text-3xl)/var(--leading-tight) var(--font-ui); letter-spacing:-.01em; }
.page-heading .subheading, .page-frame-heading > div:first-child > p:not(.eyebrow) { max-width:80ch; margin:var(--space-75) 0 0; color:var(--ink-2); font-size:var(--text-md); line-height:var(--leading-normal); }
.page-heading .eyebrow { margin:0 0 var(--space-50); }
.page-heading > :not(:first-child), .page-frame-heading > :not(:first-child), .page-actions { display:flex; flex-wrap:wrap; align-items:center; justify-content:flex-end; gap:var(--space-100); margin-left:auto; }
/* The back links the breadcrumb takes over. */
.page-frame-has-breadcrumb .back-to-tickets.page-frame-back { display:none; }
/* A view's heading ("Admin settings", "Reports") gives way to the title of the page open inside it. */
.view > .page-heading.page-frame-replaced { display:none !important; }
/* In the portal, the breadcrumb leads the tab's content. */
#portalBreadcrumb { margin:0 0 var(--space-200); }
#portalBreadcrumb[hidden] { display:none; }

@media (max-width:700px) {
  .page-heading, .page-frame-heading { flex-direction:row; align-items:flex-start; margin-bottom:var(--space-200); }
  .page-heading h1, .page-frame-title, #settingsView .page-frame-title, .ticket-detail .detail-header h1, #overviewView h1 { font-size:var(--text-2xl); }
  .page-heading > :not(:first-child), .page-frame-heading > :not(:first-child) { margin-left:0; justify-content:flex-start; }
  /* The ticket list's title row too: the title on the left, its actions under it. */
  #ticketsView .ticket-page-heading { align-items:flex-start; }
  .ticket-page-actions { justify-content:flex-start; margin-left:0; }
}

/* Headings a page draws without a size of its own read on the scale, not at the browser's own sizes. */
:where(.view-container, .modal, .ticket-detail) :where(h2) { font-size:var(--text-2xl); line-height:var(--leading-tight); }
:where(.view-container, .modal, .ticket-detail) :where(h3) { font-size:var(--text-lg); line-height:var(--leading-tight); }
:where(.view-container, .modal, .ticket-detail) :where(h4) { font-size:var(--text-md); line-height:var(--leading-tight); }

/* ========================================================================================================== Buttons
   Primary (the main action), secondary, danger (takes something away) and quiet (a small action inside a list). */
/* Their size and shape: the same in both themes, and a page's own sheet can still fit a button to its place. Their
   colors, below, also name the dark theme, to win over the old dark-only rules in styles.css. */
.save-button, .create-button, .outline-button, .quiet-button, .danger-button, .app-confirm-danger, .text-button {
  display:inline-flex; align-items:center; justify-content:center; gap:var(--space-100);
  min-height:var(--control-height); padding:0 var(--space-200);
  border:var(--control-border-width) solid transparent; border-radius:var(--radius-lg);
  font-family:var(--font-ui); font-size:var(--text-md); font-weight:var(--weight-semibold); line-height:var(--leading-tight);
  white-space:nowrap; text-decoration:none; cursor:pointer; box-shadow:none; transform:none; filter:none;
  transition:background-color .15s ease, border-color .15s ease, color .15s ease;
}
.save-button, .create-button, [data-theme="dark"] .save-button, [data-theme="dark"] .create-button { border-color:var(--spruce); background:var(--spruce); color:var(--brand-ink); }
.save-button:hover:not(:disabled), .create-button:hover:not(:disabled), [data-theme="dark"] .save-button:hover:not(:disabled), [data-theme="dark"] .create-button:hover:not(:disabled) { border-color:var(--spruce-dark); background:var(--spruce-dark); color:var(--brand-ink); transform:none; box-shadow:none; }
.outline-button, .quiet-button, [data-theme="dark"] .outline-button, [data-theme="dark"] .quiet-button { border-color:var(--control-border); background:var(--surface); color:var(--ink); }
.outline-button:hover:not(:disabled), .quiet-button:hover:not(:disabled), [data-theme="dark"] .outline-button:hover:not(:disabled), [data-theme="dark"] .quiet-button:hover:not(:disabled) { border-color:var(--control-hover); background:var(--surface-2); color:var(--ink); }
.outline-button::first-letter { color:inherit; }
/* The arrow on a button that opens a menu: the same drawn chevron as every dropdown (.custom-select-trigger:after,
   Actions, Columns), never the ⌄ character, which sits low. It turns up while its menu is open. */
.drop-chevron { display:inline-block; flex:none; width:var(--space-75); height:var(--space-75); margin:0 var(--space-50); border-right:1.5px solid currentColor; border-bottom:1.5px solid currentColor; color:var(--muted); transform:rotate(45deg) translateY(-2px); transition:transform .15s; }
[aria-expanded="true"] > .drop-chevron, .agent-profile-menu.open .drop-chevron { transform:rotate(225deg) translate(-1px,-1px); }
@media (prefers-reduced-motion: reduce) { .drop-chevron { transition:none; } }
.danger-button, .app-confirm-danger { border-color:var(--bad); background:var(--bad); color:var(--on-bad); }
.danger-button:hover:not(:disabled), .app-confirm-danger:hover:not(:disabled) { filter:brightness(.92); }
.text-button { min-height:var(--control-height-sm); padding:0 var(--space-100); border-color:transparent; background:transparent; color:var(--spruce); }
.text-button:hover:not(:disabled) { background:var(--hover-bg); color:var(--spruce-dark); }
.save-button:focus-visible, .create-button:focus-visible, .outline-button:focus-visible, .quiet-button:focus-visible, .danger-button:focus-visible, .app-confirm-danger:focus-visible, .text-button:focus-visible { outline:0; box-shadow:0 0 0 var(--focus-ring-width) var(--control-focus); border-color:var(--spruce); }
.save-button:active:not(:disabled), .create-button:active:not(:disabled), .outline-button:active:not(:disabled), .danger-button:active:not(:disabled) { transform:translateY(1px); }
.create-button > span[aria-hidden="true"]:first-child, .create-button > span:first-child:not(.create-label) { font-size:var(--text-xl); line-height:1; }
/* A button that can't be used looks it: a quiet gray fill and muted words, whatever kind it is. */
:is(.save-button, .create-button, .outline-button, .quiet-button, .danger-button, .app-confirm-danger, .text-button, .approve-button, .reject-button, .delete-role-button):is(:disabled, [aria-disabled="true"]),
[data-theme="dark"] :is(.save-button, .create-button, .outline-button, .quiet-button, .danger-button):is(:disabled, [aria-disabled="true"]) {
  border-color:var(--line) !important; background:var(--surface-2) !important; color:var(--muted) !important;
  box-shadow:none !important; filter:none !important; opacity:1 !important; transform:none !important; cursor:not-allowed !important;
}
.text-button:is(:disabled, [aria-disabled="true"]) { background:transparent !important; border-color:transparent !important; }
/* The reason a button can't be used, shown beside it. */
.disabled-reason { display:block; margin:var(--space-50) 0 0; color:var(--muted); font-size:var(--text-xs); line-height:var(--leading-normal); }

/* =========================================================================================================== Fields
   Text boxes, selects, the dropdown drawn over a select, checkboxes, radios and switches. Values read at the body
   size in regular weight; a placeholder is lighter than a value. */
/* The look of every field: its border, fill, words and corners. */
:is(.view-container, .modal, .ticket-detail, .side-panel, .requester-portal-shell) :is(input:not([type="checkbox"], [type="radio"], [type="color"], [type="file"], [type="range"], [type="hidden"], [type="button"], [type="submit"]), select, textarea),
.custom-select-trigger, .ticket-state-multi-trigger, [data-theme="dark"] .custom-select-trigger, [data-theme="dark"] .ticket-state-multi-trigger {
  border-color:var(--control-border); border-radius:var(--radius-lg); background-color:var(--field-bg); color:var(--ink);
}
/* Its line: one thin solid line. Without this, a field no page rule gives a border kept the browser's own 2px "inset"
   one (dark on the top and left, faded on the bottom and right), on 14 pages such as CMDB setup › Asset rules.
   No weight at all (:where), so a page that draws its own border, or none, keeps it. */
:where(.view-container, .modal, .ticket-detail, .side-panel, .requester-portal-shell) :where(input:not([type="checkbox"], [type="radio"], [type="color"], [type="file"], [type="range"], [type="hidden"], [type="button"], [type="submit"]), select, textarea) {
  border-style:solid; border-width:var(--control-border-width);
}
/* Its size, where the page doesn't size a field itself (a title typed in place keeps its own). Its height is left to
   its padding: a field inside a box of its own (a search with an icon, the reply box's time) keeps the box's height. */
:where(.view-container, .modal, .ticket-detail, .side-panel, .requester-portal-shell) :where(input:not([type="checkbox"], [type="radio"], [type="color"], [type="file"], [type="range"], [type="hidden"], [type="button"], [type="submit"]), select, textarea) {
  padding:var(--space-100) var(--space-150); font-family:var(--font-ui); font-size:var(--text-md); font-weight:var(--weight-regular); line-height:var(--leading-tight);
}
:where(.view-container, .modal, .ticket-detail, .side-panel, .requester-portal-shell) textarea { line-height:var(--leading-normal); }
/* A dialog's form fields (a field in a label, or the dialog's own), and the dropdown drawn over a select, everywhere:
   one size. A field inside a box of its own (a search with an icon) keeps the box's. */
:is(.modal label, .modal) > :is(input:not([type="checkbox"], [type="radio"], [type="color"], [type="file"], [type="range"], [type="hidden"], [type="button"], [type="submit"]), select, textarea),
.custom-select-trigger, .ticket-state-multi-trigger {
  min-height:var(--control-height); padding:var(--space-100) var(--space-150); font-family:var(--font-ui); font-size:var(--text-md); font-weight:var(--weight-regular); line-height:var(--leading-tight);
}
:is(.modal label, .modal) > textarea { line-height:var(--leading-normal); }
:is(.view-container, .modal, .ticket-detail, .side-panel, .requester-portal-shell) :is(input, textarea)::placeholder { color:var(--field-placeholder); font-weight:var(--weight-regular); opacity:1; }
:is(.view-container, .modal, .ticket-detail, .side-panel, .requester-portal-shell) :is(input:not([type="checkbox"], [type="radio"]), select, textarea):hover:not(:disabled):not([readonly]),
.custom-select-trigger:hover:not(:disabled), .ticket-state-multi-trigger:hover:not(:disabled) { border-color:var(--control-hover); }
:is(.view-container, .modal, .ticket-detail, .side-panel, .requester-portal-shell) :is(input, select, textarea):focus-visible,
.custom-select-trigger:focus-visible, .ticket-state-multi-trigger:focus-visible { border-color:var(--spruce); outline:0; box-shadow:0 0 0 var(--focus-ring-width) var(--control-focus); }
/* Read only: the value is there to read, in a quiet fill with no pointer; it can still be selected and copied. */
:is(input, textarea)[readonly]:not([type="checkbox"], [type="radio"], [type="button"], [type="submit"], :disabled, .rp-name, .rp-description, .kbe-title, .tw-title-input),
.is-read-only :is(input:not([type="checkbox"], [type="radio"]), textarea) {
  border-color:var(--line) !important; border-style:dashed !important; background:var(--field-muted-bg) !important; color:var(--ink) !important; box-shadow:none !important; cursor:default;
}
/* Disabled: muted words in the quiet fill, and a cursor that says no. The custom dropdown follows its select. */
:is(.view-container, .modal, .ticket-detail, .side-panel, .requester-portal-shell, body) :is(input:not([type="checkbox"], [type="radio"], [type="range"], [type="color"], [type="hidden"]), textarea, select):disabled,
.custom-select-trigger:disabled, .custom-select-wrapper.is-disabled .custom-select-trigger, .state-dropdown-trigger:disabled {
  border-color:var(--line) !important; border-style:solid !important; background:var(--field-muted-bg) !important; color:var(--muted) !important; -webkit-text-fill-color:var(--muted);
  box-shadow:none !important; opacity:1 !important; cursor:not-allowed !important;
}
:is(input[type="checkbox"], input[type="radio"]) { accent-color:var(--spruce); }
:is(input[type="checkbox"], input[type="radio"]):disabled { opacity:.5; cursor:not-allowed; }
label:has(> input:disabled), label:has(> input:disabled) * { cursor:not-allowed; }
/* A switch: an on/off setting (the checkbox in .ai-switch, or any checkbox marked role="switch"). */
.ai-switch > input[type="checkbox"], input[type="checkbox"][role="switch"] {
  appearance:none; -webkit-appearance:none; position:relative; flex:0 0 auto; width:2.25rem; height:1.25rem; margin:var(--space-25) 0 0;
  border:var(--control-border-width) solid var(--control-border); border-radius:var(--radius-pill); background:var(--surface-2); cursor:pointer;
  transition:background-color .15s ease, border-color .15s ease;
}
.ai-switch > input[type="checkbox"]::after, input[type="checkbox"][role="switch"]::after {
  content:''; position:absolute; top:50%; left:var(--space-25); width:.875rem; height:.875rem; border-radius:var(--radius-round);
  background:var(--muted); transform:translateY(-50%); transition:transform .15s ease, background-color .15s ease;
}
.ai-switch > input[type="checkbox"]:checked, input[type="checkbox"][role="switch"]:checked { border-color:var(--spruce); background:var(--spruce); }
.ai-switch > input[type="checkbox"]:checked::after, input[type="checkbox"][role="switch"]:checked::after { background:var(--brand-ink); transform:translate(1rem, -50%); }
.ai-switch > input[type="checkbox"]:focus-visible, input[type="checkbox"][role="switch"]:focus-visible { outline:0; box-shadow:0 0 0 var(--focus-ring-width) var(--control-focus); }
.ai-switch > input[type="checkbox"]:disabled, input[type="checkbox"][role="switch"]:disabled { opacity:.5; cursor:not-allowed; }
.ai-switch:has(> input:disabled) { cursor:not-allowed; }
.ai-switch:has(> input:disabled) :is(b, small, span) { color:var(--muted); }

/* ============================================================================================================= Tabs
   A row of tabs under a page's title: one size and spacing; a row too long for the screen scrolls sideways. */
.ticket-view-tabs { gap:var(--space-50); scrollbar-width:thin; }
.ticket-view-tab { margin-right:var(--space-100); padding:var(--space-100) var(--space-150) var(--space-150); font-size:var(--text-md); }

/* =========================================================================================================== Tables */
.tableWrap { width:100%; overflow-x:auto; overscroll-behavior-x:contain; border-radius:var(--radius-lg); }
.tableWrap table, table.rp-table { width:100%; border-collapse:collapse; font-size:var(--text-sm); }
.tableWrap th, table.rp-table th { padding:var(--space-100) var(--space-150); border-bottom:var(--control-border-width) solid var(--line); background:transparent; color:var(--muted); font-size:var(--text-xs); font-weight:var(--weight-semibold); letter-spacing:.04em; text-align:left; text-transform:uppercase; white-space:nowrap; }
.tableWrap td, table.rp-table td { padding:var(--space-150); border-bottom:var(--control-border-width) solid var(--line); color:var(--ink); vertical-align:top; }
.tableWrap tbody tr:last-child td, table.rp-table tbody tr:last-child td { border-bottom:0; }
.tableWrap tbody tr:hover, table.rp-table tbody tr:hover { background:var(--surface-2); }
[data-theme="dark"] .tableWrap td { color:var(--ink); }
[data-theme="dark"] .tableWrap th { color:var(--muted) !important; }
/* On a narrow screen a wide table scrolls inside its card, and a shade at the edge says there is more. */
@media (max-width:700px) {
  .tableWrap { background:linear-gradient(to right, var(--surface) 30%, transparent) left / 2rem 100% no-repeat local, linear-gradient(to left, var(--surface) 30%, transparent) right / 2rem 100% no-repeat local, linear-gradient(to right, rgba(0, 0, 0, .12), transparent) left / .75rem 100% no-repeat scroll, linear-gradient(to left, rgba(0, 0, 0, .12), transparent) right / .75rem 100% no-repeat scroll; }
}

/* ========================================================================================================== Dialogs
   A dialog stays on the screen at any width and scrolls inside itself. Its backdrop covers the whole page, the top bar
   and the outage banner included. */
/* The layers: the top bar over the page, a ticket (a page of its own) under the top bar, dialogs over both. */
.topbar, [data-theme="dark"] .topbar { z-index:var(--z-topbar); }
.ticket-detail-backdrop { z-index:var(--z-page); }
.modal-backdrop, .side-panel-backdrop { z-index:var(--z-dialog); }
.modal-backdrop { position:fixed; inset:0; padding:var(--viewport-gap); overflow:auto; place-items:center; }
.modal-backdrop, [data-theme="dark"] .modal-backdrop { background:var(--scrim); backdrop-filter:blur(2px); }
.modal-backdrop.open { display:grid; }
.modal-backdrop:has(> .wf-modal), .modal-backdrop:has(> .share-modal) { z-index:var(--z-dialog); }
/* A dialog opened from another dialog, and the "are you sure?" question, sit above it. */
.app-confirm-backdrop, .modal-backdrop.modal-over { z-index:var(--z-dialog-over); }
.modal {
  box-sizing:border-box; width:min(var(--dialog-width), 100%); max-width:100%; min-width:0;
  max-height:calc(100dvh - 2 * var(--viewport-gap)); overflow-y:auto; overscroll-behavior:contain;
  padding:var(--space-300);
}
.modal, [data-theme="dark"] .modal { border:var(--control-border-width) solid var(--line); border-radius:var(--radius-xl); background:var(--surface); color:var(--ink); box-shadow:var(--shadow-pop); }
:where(.modal) :where(div, label, section, fieldset, form, article, p, ul, li) { min-width:0; }
.modal .tableWrap { min-width:0; }
/* The dialog's own title (not the headings of what it shows, such as an article's sections). */
.modal > h2 { margin:var(--space-50) var(--space-500) var(--space-75) 0; color:var(--ink); font:var(--weight-semibold) var(--text-xl)/var(--leading-tight) var(--font-ui); letter-spacing:-.01em; }
/* An article's title reads above its sections (24 px, sections 20 and 18 px; one step up in the portal). */
.modal.article-reader > h2 { font-size:var(--text-3xl); }
.modal > p, .modal .wf-hint { color:var(--ink-2); font-size:var(--text-sm); }
.modal label { color:var(--ink-2); font-size:var(--text-sm); font-weight:var(--weight-semibold); }
.modal > .modal-close { position:absolute; top:var(--space-150); right:var(--space-150); z-index:1; display:grid; place-items:center; width:var(--control-height-sm); height:var(--control-height-sm); padding:0; border:0; border-radius:var(--radius-md); background:transparent; color:var(--muted); font-size:var(--text-2xl); line-height:1; cursor:pointer; }
.modal > .modal-close:hover { background:var(--surface-2); color:var(--ink); }
.modal-two-col { display:grid; grid-template-columns:repeat(2, minmax(0, 1fr)); gap:var(--space-150); }
/* A dialog that saves an item of a list keeps its Save in view (GitHub issue 203, 1d, AH7; docs/adr/0078): its
   buttons sit in a footer that sticks to the dialog's foot while what is above it scrolls, edge to edge. */
.modal .dialog-footer {
  position:sticky; bottom:calc(-1 * var(--space-300)); z-index:1; display:flex; flex-wrap:wrap; align-items:center; justify-content:flex-end; gap:var(--space-100);
  margin:var(--space-250) calc(-1 * var(--space-300)) calc(-1 * var(--space-300)); padding:var(--space-200) var(--space-300);
  border-top:var(--control-border-width) solid var(--line); border-radius:0 0 var(--radius-xl) var(--radius-xl); background:var(--surface);
}
.modal .dialog-footer > .full-width { width:auto; margin:0; }
@media (max-width:640px) {
  .modal { padding:var(--space-250) var(--space-200); }
  .modal-two-col { grid-template-columns:minmax(0, 1fr); }
  .modal .dialog-footer { bottom:calc(-1 * var(--space-250)); margin:var(--space-200) calc(-1 * var(--space-200)) calc(-1 * var(--space-250)); padding:var(--space-150) var(--space-200); }
}

/* Side panels (drawers) keep inside the screen too. */
.side-panel-backdrop .side-panel, .side-panel { max-width:100vw; }

/* ============================================================================================================ Menus
   A menu or dropdown never runs off the screen: it is at most as wide as the screen, scrolls when it is tall, and
   ui-parts.js moves it back inside when it would open past an edge. */
:is(.custom-select-menu, .state-dropdown-menu, .action-menu-dropdown, .columns-menu, .detail-more-dropdown, .range-menu, .assistant-menu,
  .bell-panel, .ticket-views-popover, .requester-profile-dropdown, .agent-profile-dropdown, .profile-menu-dropdown, .clipboard-compact-panel,
  .ticket-state-multi-menu, .state-multi-menu, .workspace-menu, .dashboard-picker-menu, .tw-post-menu, .kbe-menu, .ai-composer-menu, .wd-add-menu) {
  max-width:calc(100vw - 2 * var(--viewport-gap)); max-height:min(70vh, 32rem); overflow-y:auto; overscroll-behavior:contain; z-index:var(--z-menu);
  border-radius:var(--radius-lg);
}
.custom-select-option, .state-dropdown-option, .action-menu-dropdown button, .detail-more-dropdown button { min-height:var(--control-height-sm); padding:var(--space-75) var(--space-100); border-radius:var(--radius-md); font-size:var(--text-md); white-space:normal; }
.custom-select-option.is-unavailable, .state-dropdown-option[aria-disabled="true"], .detail-more-dropdown button:disabled, .action-menu-dropdown button:disabled { color:var(--muted); cursor:not-allowed; }
/* A dropdown's headings (its <optgroup>s: tickets.js enhanceDropdown; docs/adr/0137): quiet, small words above their own
   choices, a thin line between one heading's choices and the next. A heading isn't a choice and can't be picked. */
.custom-select-group[hidden] { display:none; }
.custom-select-heading { padding:var(--space-100) var(--space-100) var(--space-50); color:var(--muted); font-size:var(--text-xs); font-weight:var(--weight-semibold); cursor:default; user-select:none; }
.custom-select-group + .custom-select-group, .custom-select-option + .custom-select-group { margin-top:var(--space-50); padding-top:var(--space-50); border-top:1px solid var(--line); }
/* A state that can't be chosen is muted whole, its colored dot and name included. */
.state-dropdown-option[aria-disabled="true"], .state-dropdown-option[aria-disabled="true"] *,
html .ticket-detail .state-field .state-dropdown-option[class][aria-disabled="true"], html .ticket-detail .state-field .state-dropdown-option[class][aria-disabled="true"] * { color:var(--muted) !important; }
.state-dropdown-option[aria-disabled="true"] :is(i, .state-dot, [class*="dot"]) { opacity:.5; }
.state-dropdown-option[aria-disabled="true"]:hover, .custom-select-option.is-unavailable:hover { background:transparent; color:var(--muted); }
.state-dropdown-option .disabled-reason { margin:var(--space-25) 0 0; font-size:var(--text-xs); }
/* The reason Resolved and Closed can't be chosen, at the foot of a ticket's state menu (workflow.js). */
.state-dropdown-note { max-width:36ch; margin:var(--space-75) var(--space-100) var(--space-50); }
.state-dropdown-note[hidden] { display:none; }

/* =========================================================================================================== Toasts */
.toast { right:calc(var(--space-300) + env(safe-area-inset-right, 0px)); bottom:calc(var(--space-300) + env(safe-area-inset-bottom, 0px)); z-index:var(--z-toast); max-width:min(32rem, calc(100vw - 2 * var(--viewport-gap))); gap:var(--space-100); padding:var(--space-150) var(--space-200); font-size:var(--text-md); }
.toast, [data-theme="dark"] .toast { border-radius:var(--radius-lg); }
.toast p { margin:0; font-size:var(--text-md); line-height:var(--leading-normal); }
@media (max-width:640px) { .toast { right:calc(var(--viewport-gap) + env(safe-area-inset-right, 0px)); left:calc(var(--viewport-gap) + env(safe-area-inset-left, 0px)); bottom:calc(var(--viewport-gap) + env(safe-area-inset-bottom, 0px)); } }

/* ============================================================================= Empty, loading and error states
   One block for "nothing here yet", "loading" and "that didn't work": an icon, a line in bold, what to do, and a button. */
.state-block, .empty-state { display:flex; flex-direction:column; align-items:center; justify-content:center; gap:var(--space-100); min-height:0; padding:var(--space-500) var(--space-300); text-align:center; color:var(--ink-2); }
.state-block .state-icon, .empty-state .empty-icon { display:grid; place-items:center; width:var(--control-height-lg); height:var(--control-height-lg); margin:0 0 var(--space-50); border-radius:var(--radius-round); background:var(--spruce-pale); color:var(--spruce); font-size:var(--text-xl); font-weight:var(--weight-bold); }
.state-block.is-error .state-icon { background:var(--bad-soft); color:var(--bad); }
.state-block h2, .state-block h3, .state-block .state-title, .empty-state h2 { margin:0; color:var(--ink); font:var(--weight-semibold) var(--text-lg)/var(--leading-tight) var(--font-ui); }
.state-block p, .empty-state p { max-width:52ch; margin:0; color:var(--ink-2); font-size:var(--text-md); line-height:var(--leading-normal); }
.state-block .state-actions { display:flex; flex-wrap:wrap; justify-content:center; gap:var(--space-100); margin-top:var(--space-100); }
.state-block.is-compact { padding:var(--space-300) var(--space-200); }
.state-spinner { width:var(--space-300); height:var(--space-300); border:3px solid var(--line); border-top-color:var(--spruce); border-radius:var(--radius-round); animation:state-spin .8s linear infinite; }
@keyframes state-spin { to { transform:rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .state-spinner { animation-duration:2.4s; } }

/* The small "nothing here" lines inside cards and lists read the same everywhere. */
:is(.people-empty, .rp-empty, .related-empty, .requester-empty, .change-setting-empty, .dashboard-empty, .portal-admin-empty, .ov-empty, .login-history-empty, .global-empty, .sp-empty, .sla-policy-empty, .approval-empty, .sch-empty, .holiday-empty, .merge-ticket-empty, .notification-rule-empty, .journey-step-empty, .group-member-empty, .outage-filter-empty) { color:var(--ink-2); font-size:var(--text-md); line-height:var(--leading-normal); }

/* The app's own loading and error screens, before the workspace is drawn (bootstrap.js). */
.app-startup-status { z-index:var(--z-startup); gap:var(--space-150); padding:var(--space-300); color:var(--ink-2); font:var(--weight-medium) var(--text-md) var(--font-ui); }
.app-startup-status .startup-mark { display:grid; place-items:center; justify-self:center; width:var(--control-height-lg); height:var(--control-height-lg); border-radius:var(--radius-lg); background:var(--spruce); color:var(--brand-ink); font:var(--weight-bold) var(--text-xl) var(--font-ui); }
.app-startup-status .state-spinner { justify-self:center; }
.app-startup-status p { max-width:44ch; margin:0; }
.app-startup-status.error .startup-mark { background:var(--bad-soft); color:var(--bad); }
.app-startup-status.error .state-spinner { display:none; }
.app-startup-status .save-button { border-color:var(--spruce); background:var(--spruce); color:var(--brand-ink); }
.app-startup-status button { justify-self:center; min-height:var(--control-height); padding:0 var(--space-200); border-radius:var(--radius-lg); font:var(--weight-semibold) var(--text-md) var(--font-ui); }

/* =================================================================================================== Outage banner
   One line: what is down and a way to read more. "Details" opens the rest. On a phone, the count and a link. */
.outage-banner { z-index:var(--z-banner); align-items:center; gap:var(--space-150); padding:var(--space-100) var(--space-400); font-size:var(--text-sm); line-height:var(--leading-tight); }
.outage-banner .outage-banner-icon { width:var(--space-250); height:var(--space-250); font-size:var(--text-xs); }
.outage-banner-body { flex:1 1 auto; flex-wrap:nowrap; align-items:center; gap:var(--space-150); overflow:hidden; line-height:var(--leading-tight); }
.outage-banner-body > b { flex:0 0 auto; white-space:nowrap; }
.outage-banner-body ul { display:flex; flex:1 1 auto; min-width:0; gap:var(--space-150); overflow:hidden; }
.outage-banner-body li { display:flex; flex:0 1 auto; flex-wrap:nowrap; align-items:center; gap:var(--space-75); min-width:0; }
.outage-banner-body li > button { overflow-wrap:break-word; white-space:normal; }
/* Folded, it names the first outage in full (wrapping if it is long) beside "3 active outages"; Details lists the rest.
   Side by side, each name was squeezed into a narrow column, several lines tall and split mid-word. */
.outage-banner:not(.is-expanded) .outage-banner-body li:not(:first-child) { display:none; }
.outage-banner-body li > span, .outage-banner-body .outage-banner-note { display:none; }
.outage-banner-toggle, .outage-banner .outage-banner-toggle { flex:0 0 auto; white-space:nowrap; }
.outage-banner.is-expanded { align-items:flex-start; }
.outage-banner.is-expanded .outage-banner-body { flex-wrap:wrap; align-items:baseline; overflow:visible; }
.outage-banner.is-expanded .outage-banner-body ul { flex-direction:column; flex-basis:100%; gap:var(--space-100); }
.outage-banner.is-expanded .outage-banner-body li { flex-wrap:wrap; }
.outage-banner.is-expanded .outage-banner-body li > button { white-space:normal; }
.outage-banner.is-expanded .outage-banner-body li > span { display:inline; opacity:.9; font-size:var(--text-xs); }
.outage-banner.is-expanded .outage-banner-body .outage-banner-note { display:block; flex-basis:100%; margin:0; font-size:var(--text-xs); }
@media (max-width:640px) {
  .outage-banner { padding:var(--space-75) var(--space-200); }
  .outage-banner:not(.is-expanded) .outage-banner-body ul { display:none; }
}

/* ================================================================================== Pages that ran past a phone's edge */
/* The article editor's buttons wrap instead of running off the screen. */
@media (max-width:640px) {
  .kbe-actions { flex-wrap:wrap; }
  .kbe-actions > * { flex:1 1 auto; min-width:0; white-space:normal; }
}
/* A page's title keeps its room: an open report's name no longer shrinks to fit its buttons, which wrap below it. */
.rp-title-row { flex-wrap:wrap; }
/* Its 24rem is its width, never its height (the row is a column on a phone: a 280 px blank under the description). */
.rp-title-block { flex:1 1 0%; min-width:min(24rem, 100%); }
/* The article editor's breadcrumb has a line of its own at the top of its header. */
.kbe-header { flex-wrap:wrap; row-gap:0; }
.kbe-header > .page-breadcrumb { flex:1 0 100%; margin:0; padding-top:var(--space-100); }
/* The dashboard's "Needs attention" lines shorten with an ellipsis rather than pushing the page sideways on a phone. */
.dashboard-attention-main > span { min-width:0; }
/* The ticket's number keeps its width beside a long title (it shrank under the title's words). */
.dashboard-attention-main > .ticket-number { flex:none; }
/* Admin settings home: one column of cards on a phone. */
@media (max-width:768px) {
  #settingsLayout.settings-layout, .settings-layout { grid-template-columns:minmax(0, 1fr) !important; }
}
/* A record's title in a list shows two lines at most (the owner, 2026-11-14: "cap titles at two lines and show the full
   title on hover"): the ticket list's rows and phone cards, My workspace, the Overview, the Dashboard, problems, changes
   (the list, Upcoming changes, the calendar) and the approval queue, knowledge articles, the CMDB's names, the reports'
   ticket table and the Requester portal's requests (a department's too). On a title that is a button, .title-cap is on the
   words inside it, never on the button: the mask clips all it draws outside its box, the focus outline too.
   A longer title fades out over the last words of its second line (ui-parts.js says where they end, --title-cap-end),
   never with "…"; its title attribute shows all of it on hover, and all its words stay in the page for a screen reader. ui-parts.js marks a title that is cut (.is-capped), so
   a short one looks as it always did. The fade is a mask on the words themselves: the row's own background shows
   through, in light and dark, on hover and when a row is picked. Names, groups and states keep wrapping in full. */
:root { --title-cap-fade:var(--space-800); }
html body .title-cap { display:block; max-height:2lh; overflow:hidden; overflow-wrap:break-word; white-space:normal; }
html body .title-cap.is-capped { -webkit-mask-image:linear-gradient(black, black), linear-gradient(to right, black calc(var(--title-cap-end, 100%) - var(--title-cap-fade)), transparent var(--title-cap-end, 100%)); mask-image:linear-gradient(black, black), linear-gradient(to right, black calc(var(--title-cap-end, 100%) - var(--title-cap-fade)), transparent var(--title-cap-end, 100%)); -webkit-mask-size:100% calc(100% - 1lh), 100% 1lh; mask-size:100% calc(100% - 1lh), 100% 1lh; -webkit-mask-position:0 0, 0 100%; mask-position:0 0, 0 100%; -webkit-mask-repeat:no-repeat; mask-repeat:no-repeat; }
/* A title button whose words are capped stands on its own line, as it did when the cap was on the button itself (a short
   title's card keeps its height); My workspace's keeps to the cell's line (staff-polish.css). */
.article-open:has(> .title-cap), .ov-chg-title:has(> .title-cap) { display:block; }
/* Record my screen (GitHub issue 516; public/js/app/screen-recording.js): the button beside Attach files, the bar while
   recording (fixed at the bottom, above any dialog, never covering the page's own controls for long), the preview, and
   Admin settings › Screen recording's rows. Long words wrap; the bar fits a 390 px phone though it never shows there. */
.raise-files-row .record-screen-button, .composer-footer .record-screen-button { display:inline-flex; align-items:center; gap:var(--space-75); }
.sr-bar { position:fixed; left:50%; bottom:var(--space-300); z-index:var(--z-toast); transform:translateX(-50%); display:flex; flex-wrap:wrap; align-items:center; gap:var(--space-100) var(--space-150); max-width:calc(100vw - var(--space-400)); padding:var(--space-100) var(--space-150) var(--space-100) var(--space-200); border:var(--control-border-width) solid var(--line); border-radius:var(--radius-pill); background:var(--surface); color:var(--ink); box-shadow:var(--shadow-pop); }
.sr-bar-words { overflow-wrap:anywhere; }
.sr-clock { font-variant-numeric:tabular-nums; color:var(--muted); }
.sr-dot { width:var(--space-150); height:var(--space-150); flex:none; border-radius:var(--radius-round); background:var(--bad); animation:sr-pulse 1.2s ease-in-out infinite; }
@keyframes sr-pulse { 50% { opacity:.35; } }
@media (prefers-reduced-motion: reduce) { .sr-dot { animation:none; } }
.sr-bar .sr-stop { min-height:var(--control-height-sm); }
.screen-recording-modal { width:min(640px, 100%); }
.screen-recording-modal p { overflow-wrap:anywhere; }
.sr-microphone { display:flex; align-items:center; gap:var(--space-100); margin:var(--space-150) 0; min-height:var(--control-height-lg); }
.sr-preview { display:block; width:100%; max-height:60vh; margin:var(--space-150) 0 var(--space-100); border-radius:var(--radius-lg); background:var(--ink); }
.sr-actions { display:flex; flex-wrap:wrap; justify-content:flex-end; gap:var(--space-100); margin-top:var(--space-200); }
.sr-workspaces { display:grid; gap:var(--space-150); margin:var(--space-150) 0 0; padding:0; list-style:none; }
.sr-workspace { padding:var(--space-150) var(--space-200); border:var(--control-border-width) solid var(--line); border-radius:var(--radius-lg); }
.sr-workspace h4 { margin:0 0 var(--space-100); overflow-wrap:anywhere; }
.sr-controls { display:flex; flex-wrap:wrap; align-items:center; gap:var(--space-100) var(--space-300); }
.sr-switch { display:inline-flex; align-items:center; gap:var(--space-100); min-height:var(--control-height-lg); }
.sr-length { display:inline-flex; flex-wrap:wrap; align-items:center; gap:var(--space-100); }
.sr-warning { color:var(--warn-ink); }
.record-screen-button .vis-icon { width:14px; height:14px; flex:none; fill:none; stroke:currentColor; stroke-width:2; stroke-linecap:round; stroke-linejoin:round; }
/* A page of figures worked out from every ticket while they are read (core.js ticketsAllHere, `cover`; GitHub issue
   641): only the line saying so shows, never a figure from the tickets the page happens to hold. */
.tickets-all-waiting > :not(.tickets-all-status) { display:none !important; }
