/* One frame radius, matched to the homepage date-filter buttons. No palette,
   spacing, typography or business behaviour belongs in this contract. */
:root {
  --workbench-border-radius: 8px !important;
  --radius: var(--workbench-border-radius) !important;
  --radius-xs: var(--workbench-border-radius) !important;
  --radius-sm: var(--workbench-border-radius) !important;
  --radius-md: var(--workbench-border-radius) !important;
  --radius-lg: var(--workbench-border-radius) !important;
  --radius-xl: var(--workbench-border-radius) !important;
  --wb-radius-control: var(--workbench-border-radius) !important;
  --wb-radius-card: var(--workbench-border-radius) !important;
  --wb-radius-panel: var(--workbench-border-radius) !important;
  --workbench-nav-radius: var(--workbench-border-radius) !important;
}

/* First-paint coverage. The companion script covers unnamed and dynamically
   rendered bordered boxes, including legacy inline !important declarations. */
html:root :is(
  button, select, textarea, fieldset, dialog,
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="hidden"]),
  [role="dialog"], [role="alertdialog"], [role="button"],
  .card, .panel, .modal, .dialog, .popover, .dropdown,
  .table-wrap, .table-scroll, .input-wrap, .form-section,
  [data-workbench-rounded="true"]
):not([data-workbench-radius="preserve"], [data-workbench-radius="preserve"] *,
  thead, tbody, tfoot, tr, td, th, col, colgroup,
  [role="switch"], .avatar, .profile-large-avatar, .spinner, .loading-spinner) {
  border-radius: var(--workbench-border-radius) !important;
}

/* Collapsed tables ignore border-radius when painting cell backgrounds.
   Clip only a table that itself owns an enclosing border, never its cells,
   scroll container, dropdowns or the application layout. */
table[data-workbench-rounded="true"]:not(:has(details[open], [aria-haspopup]:not([aria-expanded="false"]), [aria-expanded="true"], [role="menu"], [role="listbox"], [class*="dropdown"], [class*="popover"], [class*="menu"])) {
  clip-path: inset(0 round var(--workbench-border-radius));
}
