/*
 * OfficePress shared controls and feedback over the r005 class vocabulary (stylesheet slot 7).
 * Load after r005/{tokens,reset,base,wireframe}.css and officepress/{fonts,tokens}.css, before shell.css and
 * r005/app.css. Only --op-* and the remapped --wf-* tokens appear here: a missing colour is a question for
 * tokens.css, never a literal in this file. The look comes from design-drafts/r001-officepress-workspace
 * (assets/officepress.css and operate.css patterns); pairings that tokens.css reports as failing contrast in
 * the preview use the replacement roles listed in reports/officepress-alignment/00001/contrast.md.
 *
 * State rules used throughout, so nothing relies on colour alone:
 *   selected  = a shape or weight change as well as a colour (underline, raised pill, ring, glyph)
 *   status    = its text label always, plus a glyph or ring where the pill is small
 *   error     = message text with a leading glyph, and a heavier field outline
 *   focus     = a 2px outline offset from the control; inside scrolling strips it is drawn inset
 * Shell-only styles (sidebar, header, drawer, mode control, account menu) belong to shell.css.
 */

/* ---------- Document ---------- */

body {
  -webkit-font-smoothing: antialiased;
  scrollbar-color: var(--op-border-strong) transparent;
  scrollbar-width: thin;
}

::selection { background: var(--op-tint-2); color: var(--op-text); }
input, textarea { caret-color: var(--op-accent-text); }
h1, h2, h3, h4 { text-wrap: balance; }
p { text-wrap: pretty; }

.fact dd, .summary-list dd, .request-meta, .request-side, .progress-label, .result-count,
.timeline-item time, .detail-meta, .stat strong, .badge, .pager-range { font-variant-numeric: tabular-nums; }

/* ---------- Icons and focus ---------- */

/* Sprite glyphs: 1.5 beside regular text, 2 beside bold (buttons, tabs, status). */
.icon { stroke-width: 1.5; }
.button .icon, .tab .icon, .badge .icon, .segment .icon, .back-link .icon,
.notice .icon, .saved-note .icon, .toast .icon { stroke-width: 2; }
.button .icon { width: 16px; height: 16px; }
.badge .icon { width: 12px; height: 12px; }
[data-icon] { display: inline-flex; flex: 0 0 auto; }

:focus-visible {
  outline: var(--op-focus-width) solid var(--op-focus);
  outline-offset: var(--op-focus-offset);
}

/* Scrolling strips would clip an outside outline, so these draw it inside the control. */
.tab:focus-visible,
.segment:focus-visible,
.category-button:focus-visible,
.step-button:focus-visible,
.section-button:focus-visible { outline-offset: -3px; border-radius: var(--op-radius-4); }

/* ---------- Links ---------- */

/* Inline text links are underlined so they do not depend on colour; structural links (buttons, cards, rows) keep
   the plain look their own classes give them. */
a:not([class]),
.error-secondary {
  color: var(--op-accent-ink);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.back-link { color: var(--op-text-2); }
.readiness-action { color: var(--op-accent-ink); }

/* ---------- Buttons ---------- */

.button {
  min-height: var(--op-control-h);
  gap: var(--op-space-2);
  padding: 0 var(--op-space-4);
  border: 1px solid var(--op-accent-strong);
  border-radius: var(--op-radius-4);
  background: var(--op-accent-strong);
  color: var(--op-on-accent);
  font: 700 13px/1 var(--op-font);
  /* Theme tokens can invert both a button surface and its ink. Interpolating either
   * color produces a briefly illegible intermediate state immediately after a mode
   * change, so semantic button colors change atomically. */
}

.button--secondary {
  border-color: var(--op-control-border);
  background: var(--op-surface);
  color: var(--op-text);
}

.button--ghost {
  border-color: transparent;
  background: transparent;
  color: var(--op-text);
}

.button--danger {
  border-color: var(--op-danger);
  background: var(--op-surface);
  color: var(--op-danger);
}

.button--small {
  min-height: var(--op-control-compact-h);
  padding-inline: var(--op-space-3);
  font-size: 12px;
}

.button--icon { width: var(--op-control-h); padding: 0; }
.button--small.button--icon { width: var(--op-control-compact-h); }

/* Hover and press only where a pointer can hover, so a tapped control returns to rest on touch screens. */
@media (hover: hover) {
  .button:hover:not(:disabled):not([aria-disabled="true"]) {
    border-color: color-mix(in srgb, var(--op-accent-strong) 90%, var(--op-text));
    background: color-mix(in srgb, var(--op-accent-strong) 90%, var(--op-text));
  }
  .button--secondary:hover:not(:disabled):not([aria-disabled="true"]),
  .button--ghost:hover:not(:disabled):not([aria-disabled="true"]) {
    border-color: var(--op-control-border);
    background: var(--op-sunken);
  }
  .button--ghost:hover:not(:disabled):not([aria-disabled="true"]) { border-color: transparent; }
  .button--danger:hover:not(:disabled):not([aria-disabled="true"]) {
    border-color: var(--op-danger);
    background: var(--op-danger-tint);
  }
}

/* Disabled stays legible: muted text on a flat sunken plate with a hairline, and no pointer affordance. */
.button:disabled,
.button[aria-disabled="true"] {
  border-color: var(--op-border);
  background: var(--op-sunken);
  color: var(--op-text-2);
  cursor: not-allowed;
}

.button--ghost:disabled,
.button--ghost[aria-disabled="true"] { border-color: transparent; background: transparent; }

/* The r005 structural sheets contain older generic button declarations.  Keep every
 * button variant bound to the active mode scope when a client-side mode save changes
 * it in place; otherwise a descendant can retain light ink on a dark surface. */
.mode-scope[data-mode="dark"] .button { border-color: var(--op-accent-strong); background: var(--op-accent-strong); color: var(--op-on-accent); }
.mode-scope[data-mode="dark"] .button--secondary { border-color: var(--op-control-border); background: var(--op-surface); color: var(--op-text); }
.mode-scope[data-mode="dark"] .button--ghost { border-color: transparent; background: transparent; color: var(--op-text); }
.mode-scope[data-mode="dark"] .button--danger { border-color: var(--op-danger); background: var(--op-surface); color: var(--op-danger); }
@media not print {
  :root:has(.mode-scope[data-mode="dark"]) .button { border-color: var(--op-accent-strong); background: var(--op-accent-strong); color: var(--op-on-accent); }
  :root:has(.mode-scope[data-mode="dark"]) .button--secondary { border-color: var(--op-control-border); background: var(--op-surface); color: var(--op-text); }
  :root:has(.mode-scope[data-mode="dark"]) .button--ghost { border-color: transparent; background: transparent; color: var(--op-text); }
  :root:has(.mode-scope[data-mode="dark"]) .button--danger { border-color: var(--op-danger); background: var(--op-surface); color: var(--op-danger); }
}

/* Loading: a spinner ahead of the label, which stays visible. The two-label swap button keeps its width, so
   its spinner is placed over the left padding instead of adding to the row. */
.button[aria-busy="true"],
.button[data-busy] { cursor: progress; }

.button[aria-busy="true"]::before,
.button[data-busy]::before {
  content: "";
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: op-spin 800ms linear infinite;
}

.button-swap[aria-busy="true"]::before,
.button-swap[data-busy]::before { position: absolute; left: var(--op-space-3); }

@keyframes op-spin { to { transform: rotate(360deg); } }

/* ---------- Fields ---------- */

.field { gap: 6px; }
.label { font-size: var(--wf-text-xs); font-weight: 700; color: var(--op-text); }
.help { color: var(--op-text-2); font-size: var(--wf-text-xs); }

.input,
.select,
.textarea {
  min-height: var(--op-input-h);
  padding: var(--op-space-2) var(--op-space-3);
  border: 1px solid var(--op-control-border);
  border-radius: var(--op-radius-4);
  background-color: var(--op-surface);
  color: var(--op-text);
  transition-property: border-color, box-shadow;
  transition-duration: var(--op-dur-fast);
}

/* Single-line fields hold 40px exactly (date inputs otherwise grow). */
input.input, .select { height: var(--op-input-h); }
.textarea { min-height: 112px; border-radius: var(--op-radius-8); line-height: 1.5; }

.select {
  appearance: none;
  padding-right: 36px;
  background-image: linear-gradient(45deg, transparent 50%, var(--op-text-2) 50%), linear-gradient(135deg, var(--op-text-2) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
}

.input::placeholder,
.textarea::placeholder { color: var(--op-text-2); opacity: 1; }

@media (hover: hover) {
  .input:hover:not(:disabled), .select:hover:not(:disabled), .textarea:hover:not(:disabled) { border-color: var(--op-text); }
}

/* The border changes on any focus; keyboard focus (and every click into a text field) adds the outline ring. */
.input:focus, .select:focus, .textarea:focus { border-color: var(--op-focus-field); }

.input:disabled, .select:disabled, .textarea:disabled {
  border-color: var(--op-border);
  background-color: var(--op-sunken);
  color: var(--op-text-2);
  cursor: not-allowed;
}

.input[readonly], .textarea[readonly] { background-color: var(--op-sunken); }

/* Invalid: a heavier danger outline, plus the error message below with its own glyph. */
.field.is-invalid .input,
.field.is-invalid .select,
.field.is-invalid .textarea,
.input[aria-invalid="true"],
.select[aria-invalid="true"],
.textarea[aria-invalid="true"] {
  border: 1px solid var(--op-danger);
  background-color: var(--op-surface);
  box-shadow: 0 0 0 1px var(--op-danger);
}

.error {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  color: var(--op-danger);
  font-size: var(--wf-text-xs);
  font-weight: 600;
}

/* The glyphs below are alpha masks: the shape is drawn in the element's own colour. */
.error::before,
.badge--soft::before,
.badge--striped::before {
  content: "";
  flex: 0 0 auto;
  background: currentColor;
  mask: center / contain no-repeat;
  -webkit-mask: center / contain no-repeat;
}

.error::before {
  width: 14px;
  height: 14px;
  margin-top: 1px;
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 7.5v5.5M12 16.5h.01'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 7.5v5.5M12 16.5h.01'/%3E%3C/svg%3E");
}

/* Native checkboxes and radios take the accent. */
input[type="checkbox"], input[type="radio"] { accent-color: var(--op-accent-strong); }

/* Search: a rounded field with its glyph inside. */
.search .icon { left: 14px; width: 16px; height: 16px; color: var(--op-text-2); }
.search .input { padding-left: 40px; border-radius: var(--op-radius-full); background-color: var(--op-sunken); }

/* File choosers wear the secondary button. */
.upload-zone { border-color: var(--op-border-strong); border-radius: var(--op-radius-8); background: var(--op-sunken); }
input[type="file"]::file-selector-button {
  min-height: var(--op-control-compact-h);
  margin-right: var(--op-space-3);
  padding: 0 var(--op-space-3);
  border: 1px solid var(--op-control-border);
  border-radius: var(--op-radius-4);
  background: var(--op-surface);
  color: var(--op-text);
  font: 700 12px/1 var(--op-font);
  cursor: pointer;
}

/* Switch: the thumb moves as well as the track recolouring, and the row's text names the setting. */
.switch-track { border-color: var(--op-control-border); background: var(--op-sunken); }
.switch-track::after { background: var(--op-text-2); }
.switch input:checked + .switch-track { border-color: var(--op-accent-strong); background: var(--op-accent-strong); }
.switch input:checked + .switch-track::after { background: var(--op-on-accent); }
.switch input:focus-visible + .switch-track { outline: var(--op-focus-width) solid var(--op-focus); outline-offset: 2px; }

/* ---------- Status pills and badges ---------- */

.badge {
  min-height: 20px;
  gap: var(--op-space-1);
  padding: 0 var(--op-space-2);
  border: 1px solid var(--op-border);
  background: var(--op-status-neutral-bg);
  color: var(--op-status-neutral-text);
  font-size: 11px;
  font-weight: 700;
}

/* Open: warning hue with a dot. Approved: tint with a check. Rejected: danger with a cross. The label is always
   the visible text; the glyph is a second cue. */
.badge--dot {
  border-color: color-mix(in srgb, currentColor 35%, transparent);
  background: var(--op-status-open-bg);
  color: var(--op-status-open-text);
}

.badge--dot::before { width: 8px; height: 8px; background: currentColor; }

.badge--soft {
  border-color: color-mix(in srgb, currentColor 35%, transparent);
  background: var(--op-status-approved-bg);
  color: var(--op-status-approved-text);
}

.badge--striped {
  border-color: color-mix(in srgb, currentColor 35%, transparent);
  background: var(--op-status-rejected-bg);
  color: var(--op-status-rejected-text);
}

.badge--soft::before,
.badge--striped::before { width: 12px; height: 12px; }

.badge--soft::before {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12 4 4L19 6'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12 4 4L19 6'/%3E%3C/svg%3E");
}

.badge--striped::before {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 6 12 12M18 6 6 18'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 6 12 12M18 6 6 18'/%3E%3C/svg%3E");
}

.badge--solid { border-color: var(--op-accent-strong); background: var(--op-accent-strong); color: var(--op-on-accent); }

/* A count inside a filter segment is a plain number chip. */
.segment .badge { min-height: 18px; padding: 0 6px; border: 0; background: var(--op-border); color: var(--op-text); }
.segment.is-active .badge,
.segment[aria-selected="true"] .badge,
.segment[aria-pressed="true"] .badge { background: var(--op-tint-2); }

.chip { border-color: var(--op-border); background: var(--op-sunken); color: var(--op-text); }

/* ---------- Avatars and sign-off ---------- */

.avatar {
  width: 32px;
  height: 32px;
  border: 0;
  background: var(--op-accent-strong);
  color: var(--op-on-accent);
  font: 700 11px/1 var(--op-font);
}

.avatar img { outline: 1px solid var(--op-image-outline); outline-offset: -1px; }
.avatar.avatar--lg { font-size: var(--wf-text-sm); }
.avatar--unknown { background: var(--op-sunken); color: var(--op-text-2); box-shadow: inset 0 0 0 1px var(--op-control-border); }

.signoff { display: flex; flex-wrap: wrap; gap: 6px; }

.signoff-line {
  position: relative;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--op-tint-2);
  color: var(--op-text);
}

.signoff-name { font-size: 11px; font-weight: 700; line-height: 1; }
.signoff-day { display: none; }
.signoff-line img { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }

/* Pending approvers are a dashed ring; decided ones carry a check or cross badge, so state is shape as well as hue. */
.signoff-line.is-open { border: 1.5px dashed var(--op-control-border); background: var(--op-surface); color: var(--op-text-2); }
.signoff-line.is-rejected { background: var(--op-danger-tint); }

.signoff-mark {
  position: absolute;
  z-index: 1;
  right: -3px;
  bottom: -3px;
  width: 16px;
  height: 16px;
  display: none;
  place-items: center;
  border: 2px solid var(--op-surface);
  border-radius: 50%;
}

.signoff-line.is-signed .signoff-mark { display: grid; background: var(--op-accent-strong); color: var(--op-on-accent); }
.signoff-line.is-rejected .signoff-mark { display: grid; background: var(--op-danger); color: var(--op-on-danger); }
.signoff-mark svg { width: 10px; height: 10px; }
.signoff-mark path { fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.signoff.is-ended .signoff-line.is-signed .signoff-mark { background: var(--op-text-2); }

/* ---------- Progress and loading placeholders ---------- */

.progress-track { height: 6px; background: var(--op-tint-2); box-shadow: inset 0 0 0 1px var(--op-border); }
.progress-value { background: var(--op-accent-strong); }
.progress-label { color: var(--op-text-2); }

/* Fallback when approvers are not in hand: one bar per required approval, filled when signed and hollow when open. */
.tick-strip { display: inline-flex; gap: 3px; }
.tick { width: 18px; height: 6px; border-radius: var(--op-radius-full); background: var(--op-surface); box-shadow: inset 0 0 0 1px var(--op-control-border); }
.tick.is-signed { background: var(--op-accent-strong); box-shadow: none; }
.tick svg { display: none; }
.tick-strip--small .tick { width: 12px; }
.tick-strip.is-ended .tick.is-signed { background: var(--op-text-2); }

.skeleton {
  display: block;
  height: 12px;
  border-radius: var(--op-radius-4);
  background: linear-gradient(90deg, var(--op-sunken) 0%, var(--op-border) 50%, var(--op-sunken) 100%) 0 0 / 200% 100%;
  animation: op-skeleton 1400ms ease-in-out infinite;
}

.skeleton--pill { height: 22px; }
.skeleton--title { height: 24px; margin-top: 4px; }
.skeleton--text { height: 12px; }
.skeleton--avatar { width: 32px; height: 32px; border-radius: 50%; }
.skeleton-stack { display: grid; gap: var(--op-space-3); }
.skeleton-row { display: flex; align-items: center; gap: var(--op-space-2); margin-top: var(--op-space-1); }
.skeleton-tabs { display: flex; gap: 22px; overflow: hidden; padding: 15px 0; border-bottom: 1px solid var(--op-border); }
.skeleton-copy { margin-top: 22px; }
.skeleton-facts { margin-top: 22px; border-top: 1px solid var(--op-border); }
.skeleton-fact { display: grid; grid-template-columns: minmax(120px, 170px) minmax(0, 1fr); gap: var(--op-space-3); padding: 13px 0; border-bottom: 1px solid var(--op-border); }
.preview-skeleton .preview-header { display: block; }

@keyframes op-skeleton {
  from { background-position: 100% 0; }
  to { background-position: -100% 0; }
}

/* ---------- Segmented filter, tabs and pagination ---------- */

.segmented {
  gap: 2px;
  padding: var(--op-space-1);
  border-color: var(--op-border);
  border-radius: var(--op-radius-8);
  background: var(--op-sunken);
}

.segment {
  min-height: var(--op-control-compact-h);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: var(--op-radius-4);
  color: var(--op-text-2);
  font: 700 12px/1 var(--op-font);
  transition-property: background-color, color;
  transition-duration: var(--op-dur-fast);
}

/* Selected is a raised, outlined plate in primary ink, not only a different colour. */
.segment.is-active,
.segment[aria-selected="true"],
.segment[aria-pressed="true"] {
  background: var(--op-surface);
  color: var(--op-text);
  box-shadow: var(--op-elev-card), inset 0 0 0 1px var(--op-control-border);
}

@media (hover: hover) {
  .segment:hover { color: var(--op-text); }
}

/* Tabs: the selected tab is darker text with an underline. */
.tabs { gap: var(--op-space-6); border-bottom-color: var(--op-border); }

.tab {
  min-height: 44px;
  border-bottom-width: 2px;
  color: var(--op-text-2);
  font: 700 13px/1.5 var(--op-font);
  transition-property: color, border-color;
  transition-duration: var(--op-dur-fast);
}

.tab[aria-selected="true"] { border-bottom-color: var(--op-accent-strong); color: var(--op-text); }

@media (hover: hover) {
  .tab:hover { color: var(--op-text); }
  .tab[aria-selected="true"]:hover { border-bottom-color: var(--op-accent-strong); }
}

/* Collection pager: a toolbar-toned footer, so Previous / Next read as the surface's own controls. */
.pager { background: var(--op-toolbar); border-radius: 0 0 var(--op-radius-12) var(--op-radius-12); }
.pager-size-label,
.pager-range { color: var(--op-text-2); }

/* ---------- Inline feedback ---------- */

.notice {
  padding: var(--op-space-3) var(--op-space-4);
  border-color: var(--op-border);
  border-radius: var(--op-radius-8);
  background: var(--op-tint);
  color: var(--op-text);
}

.notice > [data-icon] { margin-top: 1px; color: var(--op-accent-ink); }

/* A notice announced as an alert is a failure: danger outline and icon, text still in primary ink. */
.notice[role="alert"] { border-color: var(--op-danger); background: var(--op-danger-tint); }
.notice[role="alert"] > [data-icon] { color: var(--op-danger); }

.saved-note { color: var(--op-text); }
.saved-note > [data-icon] { color: var(--op-accent-ink); }
.account-quiet-note { border-color: var(--op-border); border-radius: var(--op-radius-8); background: var(--op-surface); }

/* ---------- Dialog ---------- */

.dialog {
  width: min(calc(100% - 32px), 480px);
  border: 0;
  border-radius: var(--op-radius-12);
  background: var(--op-surface);
  color: var(--op-text);
  box-shadow: var(--op-elev-pop);
}

.dialog::backdrop { background: var(--op-scrim); }
.dialog[open] { animation: op-dialog-in var(--op-dur) var(--op-ease-out); }
.dialog-header { padding: var(--op-space-5) var(--op-space-6) var(--op-space-3); border-bottom: 0; }
.dialog-header h2 { font: var(--op-text-heading); color: var(--op-text); overflow-wrap: anywhere; }
.dialog-body { padding: var(--op-space-2) var(--op-space-6) var(--op-space-5); }

.dialog-footer {
  padding: var(--op-space-3) var(--op-space-6);
  border-top: 1px solid var(--op-border);
  border-radius: 0 0 var(--op-radius-12) var(--op-radius-12);
  background: var(--op-toolbar);
}

@keyframes op-dialog-in { from { opacity: 0; translate: 0 4px; } }

@media (max-width: 700px) {
  .dialog { width: 100%; border-radius: var(--op-radius-12) var(--op-radius-12) 0 0; }
  .dialog-header { padding-inline: var(--op-space-4); }
  .dialog-body { padding-inline: var(--op-space-4); }
  .dialog-footer { padding-inline: var(--op-space-4); border-radius: 0; }
}

/* ---------- Toast ---------- */

/* Hidden toasts are removed from the tab order and the accessibility tree by visibility; the transition keeps
   them visible until the fade ends. A success toast and an error toast share the corner; only one shows. */
.toast {
  border: 0;
  border-radius: var(--op-radius-8);
  background: var(--op-text);
  color: var(--op-surface);
  font-size: var(--wf-text-sm);
  font-weight: 600;
  box-shadow: var(--op-elev-pop);
  visibility: hidden;
  transition-property: opacity, transform, visibility;
  transition-duration: var(--op-dur-fast), var(--op-dur), var(--op-dur-fast);
  transition-timing-function: var(--op-ease-out);
}

.toast.is-visible { visibility: visible; }
.toast > [data-icon] { align-self: flex-start; margin-top: 1px; }
.toast > span:not([data-icon]) { min-width: 0; overflow-wrap: anywhere; }

/* A failure is a tinted card with a danger outline, an alert icon and a Dismiss button. */
.toast--error {
  border: 1px solid var(--op-danger);
  background: var(--op-danger-tint);
  color: var(--op-text);
}

.toast--error > [data-icon] { color: var(--op-danger); }

/* r005 leaves every toast click-through; the error toast holds a button, so it takes pointer events while shown. */
.toast--error.is-visible { pointer-events: auto; }

.toast-dismiss {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: var(--op-control-compact-h);
  height: var(--op-control-compact-h);
  margin: calc(var(--op-space-2) * -1) calc(var(--op-space-2) * -1) calc(var(--op-space-2) * -1) auto;
  padding: 0;
  border: 0;
  border-radius: var(--op-radius-4);
  background: transparent;
  color: inherit;
}

@media (hover: hover) {
  .toast-dismiss:hover { background: var(--op-sunken); }
}

/* Desktop: centred under the work, as the preview draws it. Phones keep the full-width bottom bar from r005. */
@media (min-width: 701px) {
  .toast { right: auto; left: 50%; transform: translate(-50%, 24px); }
  .toast.is-visible { transform: translate(-50%, 0); }
}

/* ---------- Brand lockups (sign-in, verification and error pages) ---------- */

.brand-mark {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: var(--op-radius-8);
  background: none;
  object-fit: contain;
}

.verify-brand,
.error-brand { justify-content: center; padding: 0; color: var(--op-text); font: var(--op-text-title); }

.verify-page:has(> .verify-brand) { align-content: center; gap: var(--op-space-5); }

/* ---------- Motion, forced colours ---------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  /* A static, open ring still reads as "working" next to the label and aria-busy. */
  .skeleton { background: var(--op-sunken); }
}

/* Windows high contrast: keep state glyphs and outlines on system colours. */
@media (forced-colors: active) {
  .badge, .tick, .signoff-line, .segment[aria-selected="true"], .segment[aria-pressed="true"], .segment.is-active { border: 1px solid CanvasText; }
  .tab[aria-selected="true"] { border-bottom-color: Highlight; }
  .error::before, .badge--soft::before, .badge--striped::before { background: CanvasText; }
  .switch-track { forced-color-adjust: none; border-color: CanvasText; background: Canvas; }
  .switch-track::after { background: CanvasText; }
  .switch input:checked + .switch-track { background: Highlight; }
  .switch input:checked + .switch-track::after { background: HighlightText; }
}
