@charset "UTF-8";
/* ==========================================================================
   Archinet UI — Bootstrap-free design system for projects.archinet.net
   Evolved from /help/css/archi.help.css. Pure CSS: no framework, no JS deps.
   Uses: @layer, nesting, oklch/light-dark(), color-mix(), :has(), container
   queries, popover + anchor positioning, @starting-style, ::details-content,
   interpolate-size, scroll-driven animations, cross-document view transitions.
   ========================================================================== */

@layer reset, tokens, base, layout, components, utilities;

/* ---------- Fonts (same Alleyn family, now one family w/ real weights) ---------- */
@font-face { font-family: "Alleyn"; font-weight: 300; font-display: swap; src: url("fonts/ArchinetFontKit/webFonts/AlleynLight/font.woff2") format("woff2"); }
@font-face { font-family: "Alleyn"; font-weight: 400; font-display: swap; src: url("fonts/ArchinetFontKit/webFonts/AlleynBook/font.woff2") format("woff2"); }
@font-face { font-family: "Alleyn"; font-weight: 600; font-display: swap; src: url("fonts/ArchinetFontKit/webFonts/AlleynMedium/font.woff2") format("woff2"); }
@font-face { font-family: "Alleyn"; font-weight: 700; font-display: swap; src: url("fonts/ArchinetFontKit/webFonts/AlleynSemiBold/font.woff2") format("woff2"); }
@font-face { font-family: "Alleyn"; font-weight: 700; font-display: swap; src: url("fonts/ArchinetFontKit/webFonts/AlleynBold/font.woff2") format("woff2"); }

@view-transition { navigation: auto; }

/* ---------- Reset ---------- */
@layer reset {
  *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
  html { -webkit-text-size-adjust: none; text-size-adjust: none; interpolate-size: allow-keywords; }
  /* Font Awesome's inline SVG icons keep their own sizing: max-width:100% would let them shrink to 0 in tight cells */
  img, svg:not(.svg-inline--fa), video { display: block; max-width: 100%; }
  input, button, select, textarea { font: inherit; color: inherit; }
  ul[role="list"], ol[role="list"], menu { list-style: none; }
  table { border-collapse: collapse; }
  fieldset { border: 0; min-inline-size: 0; }
  :where(h1, h2, h3, h4) { text-wrap: balance; }
  :where(p, li, td) { text-wrap: pretty; }
  /* The hidden attribute must win over component display values (.btn, .row, .card-actions, …). */
  [hidden] { display: none !important; }
}

/* ---------- Tokens ---------- */
@layer tokens {
  :root {
    color-scheme: light dark;

    /* Brand — Help Center blue */
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-soft: light-dark(#dbeafe, color-mix(in oklch, #2563eb 22%, #0f141b));
    --primary-ink: light-dark(#1d4ed8, #93b4ff);
    --on-primary: #ffffff;
    --archinet-gray: #53585a;
    --archinet-yellow: #ffc708;

    /* Neutrals (cool slate, as in /help) */
    --bg:        light-dark(#f8fafc, #0f141b);
    --bg-linear-line-color: light-dark(rgba(50, 50, 50, 0.05), rgba(255, 255, 255, 0.05));
    --surface:   light-dark(#ffffff, #161c24);
    --surface-2: light-dark(#f1f5f9, #1d2530);
    --surface-3: light-dark(#d6e6f8, #202d44);
    --text:      light-dark(#1f2937, #dde3ea);
    --heading:   light-dark(#111827, #f5f7fa);
    --muted:     light-dark(#5b6678, #95a1b2);
    --border:    light-dark(#e2e8f0, #28313d);
    --border-strong: light-dark(#94a3b8, #4a5667);

    /* Status */
    --success: light-dark(#15803d, #4ade80);
    --warning-bg: light-dark(#fef3c7, #3a2e0d);
    --warning-ink: light-dark(#92400e, #fcd34d);
    --danger: light-dark(#b91c1c, #f87171);
    --danger-bg: light-dark(#fee2e2, #3b1414);
    --info-bg: var(--primary-soft);

    /* Type */
    --font: "Alleyn", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --mono: ui-monospace, "Cascadia Code", Menlo, Consolas, monospace;
    --fs-xs: .75rem; --fs-sm: .875rem; --fs-md: 1rem; --fs-lg: 1.125rem;
    --fs-xl: 1.375rem; --fs-2xl: clamp(1.5rem, 1.1rem + 1.4vw, 2rem);

    /* Shape & depth */
    --r-sm: .5rem; --r-md: .75rem; --r-lg: 1rem; --r-pill: 9999px;
    --shadow-sm: 0 1px 2px rgb(15 23 42 / .06);
    --shadow-md: 0 4px 12px -2px rgb(15 23 42 / .10), 0 2px 4px -2px rgb(15 23 42 / .06);
    --shadow-lg: 0 18px 36px -12px rgb(15 23 42 / .22), 0 6px 12px -6px rgb(15 23 42 / .10);
    --ring: 0 0 0 3px color-mix(in oklch, var(--primary) 35%, transparent);

    /* Space */
    --space-1: .25rem; --space-2: .5rem; --space-3: .75rem; --space-4: 1rem;
    --space-5: 1.5rem; --space-6: 2rem; --space-7: 3rem;
    --pad-cell: .75rem 1rem;

    /* Motion */
    --ease-out: cubic-bezier(.2, .7, .2, 1);
    --ease-spring: linear(0, .35 8%, .78 18%, 1.02 30%, 1.06 38%, 1.01 52%, .99 70%, 1);
    --t-fast: 150ms; --t-med: 250ms; --t-slow: 420ms;

    /* Layout */
    --page-max: 1400px;
    --aside: 300px;
    --brand-banner: light-dark(#f8fafc, #93b4ff);        /* overridden per client by a .brand-banner--<hex> class below */
  }

  /* Theme picker in the user menu: Light and Dark override the device setting, Auto follows it */
  :root:has(#theme-light:checked) { color-scheme: light; }
  :root:has(#theme-dark:checked) { color-scheme: dark; }

  /* Density switch: <html data-density="compact"> */
  [data-density="compact"] { --pad-cell: .45rem .75rem; --space-5: 1rem; --fs-md: .9375rem; }

  @media (prefers-reduced-motion: reduce) {
    :root { --t-fast: 0ms; --t-med: 0ms; --t-slow: 0ms; }
  }
}

/* ---------- Base ---------- */
@layer base {
  body {
    font-family: var(--font);
    font-weight: 550;
    font-size: var(--fs-md);
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
    min-height: 100dvh;
    display: flex; flex-direction: column;
    -webkit-font-smoothing: antialiased;
    background-image: linear-gradient(rgba(50, 50, 50, 0.05) 1px, transparent 1px),
linear-gradient(90deg, rgba(50, 50, 50, 0.05) 1px, transparent 1px);
    background-size: 20px 20px;
  }
  h1, h2, h3, h4 { color: var(--heading); line-height: 1.2; font-weight: 700; }
  a { color: var(--primary-ink); text-decoration: none; transition: color var(--t-fast); }
  a:hover { color: var(--primary-hover); text-decoration: underline; text-underline-offset: .2em; }
  :focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 4px; }
  ::selection { background: var(--primary-soft); }
  hr { border: 0; border-top: 1px solid var(--border); margin-block: var(--space-4); }
  pre, code { font-family: var(--mono); font-size: .8125rem; }
  /* The Font Awesome kit draws SVG icons; "nest" mode keeps each <i> and moves the fa-* classes onto its <svg>. */
  i[class*="fa-"], i[data-fa-i2svg] { line-height: 1; }
  input, select, textarea { accent-color: var(--primary); }
  summary { cursor: pointer; }
}

/* ---------- Layout ---------- */
@layer layout {
  .page { width: min(100% - 2rem, var(--page-max)); margin-inline: auto; padding-block: var(--space-5) var(--space-7); flex: 1; }
  .layout {
    display: grid; gap: var(--space-6);
    grid-template-columns: minmax(0, 1fr) var(--aside);
    align-items: start;
    @media (width < 1024px) { grid-template-columns: minmax(0, 1fr); }
    /* role-gated asides are not rendered at all when empty: use the full width */
    &:not(:has(> .aside)) { grid-template-columns: minmax(0, 1fr); }
  }
  .stack { display: flex; flex-direction: column; gap: var(--space-4); }
  .aside { display: flex; flex-direction: column; gap: var(--space-5); position: sticky; top: calc(var(--header-h, 110px) + 1rem);
    @media (width < 1024px) { position: static; &:not(:has(> :not(.hide-lt-lg))) { display: none; } }
    /* a sticky aside taller than the window (long announcements, notification lists) scrolls on its own, so its
       lower panels stay reachable; the padding/negative margin keeps the cards' shadows from being clipped */
    @media (width >= 1024px) {
      max-height: calc(100dvh - var(--header-h, 110px) - 2rem); overflow-y: auto; scrollbar-width: thin;
      padding: .5rem; margin: -.5rem;
    }
  }
}

/* ---------- Components ---------- */
@layer components {

  /* --- Site header: brand banner + nav --- */
  .site-header {
    position: sticky; top: 0; z-index: 50;
    /* oklab, not oklch: an oklch mix with transparent drops the hue and tints the dark header red */
    background: color-mix(in oklab, var(--surface) 88%, transparent);
    backdrop-filter: saturate(1.6) blur(14px);
    border-bottom: 1px solid var(--border);
    animation: header-lift linear both;
    animation-timeline: scroll(root);
    animation-range: 0 120px;
  }
  @keyframes header-lift { to { box-shadow: var(--shadow-md); border-bottom-color: transparent; } }

  .brand-banner {
    background: var(--brand-banner);
    display: flex; align-items: center; justify-content: space-between; gap: var(--space-4);
    padding: .55rem clamp(1rem, 3vw, 1.5rem);
    min-height: 44px;
    border-bottom: 1px solid var(--border);
    & img { height: 25px; width: auto; }
  }
  /* Client banner colors: one class per branding_tbl.brand_banner_bkgd_col value in use. ui2/inc_navbar.cfm adds
     brand-banner--<hex> for the page's system, never a style attribute, and a color with no class here keeps the default
     above. The database holds only the light color. The dark one is that color mixed 80% with 20% of the dark surface
     (#161c24) in OKLab, so the band stays light enough for client logos without glaring, and the "powered by" ink is
     darkened to keep 4.5:1 on it. On 2026-10-28 all 50 branding rows were ffffff. */
  .brand-banner--ffffff { --brand-banner: light-dark(#ffffff, #caccce); --banner-ink: light-dark(#5b6678, #4c5665); }
  .powered-by {
    font-size: var(--fs-xs); letter-spacing: .02em;
    color: var(--banner-ink, #5b6678);
    display: inline-flex; align-items: center; gap: .4em; white-space: nowrap;
    & a { color: inherit; font-weight: 700; }
    & a:hover { text-decoration: none; opacity: .85; }
    & .gray { color: var(--archinet-gray); } & .yellow { color: var(--archinet-yellow); }
    @media (width < 560px) { & .label { display: none; } }
  }

  .navbar {
    display: flex; align-items: center; gap: var(--space-2);
    padding: .4rem clamp(.5rem, 2vw, 1rem);
    min-height: 56px;
  }
  .nav-list {
    display: flex; align-items: center; gap: 2px;
    overflow-x: auto; scrollbar-width: none; flex: 1; min-width: 0;
    mask-image: linear-gradient(to right, #000 calc(100% - 2rem), transparent);
    @media (width < 1180px) { & .nav-link .nav-text { display: none; } }
    /* narrow screens: every menu goes icon-only (My Projects, Inbox and Add included) so all of them fit without scrolling;
       800px is where the three labels stop fitting beside the icon-only items on the project list (which adds Clients);
       icon-only links keep the 40px target (DESIGN.md, The Thumb Rule) */
    @media (width < 800px) { & .nav-link .nav-label, & .nav-link .caret { display: none; } & .nav-link { padding-inline: .65rem; min-height: 40px; } }
    @media (width >= 1180px) { mask-image: none; }
  }
  .nav-link {
    appearance: none; border: 0; background: transparent; cursor: pointer;
    display: inline-flex; align-items: center; gap: .5rem;
    padding: .5rem .8rem; border-radius: var(--r-sm);
    color: var(--text); font-size: var(--fs-sm); font-weight: 600; white-space: nowrap;
    transition: background var(--t-fast), color var(--t-fast);
    & i:first-child { color: var(--muted); transition: color var(--t-fast); }
    & .caret { font-size: .65em; opacity: .6; transition: rotate var(--t-med) var(--ease-out); }
    &:hover { background: var(--surface-2); color: var(--heading); text-decoration: none; & i:first-child { color: var(--primary); } }
    &[aria-current="page"], &.is-active { background: var(--primary-soft); color: var(--primary-ink); & i:first-child { color: var(--primary); } }
    &:has(+ .menu:popover-open) { background: var(--surface-2); & .caret { rotate: 180deg; } }
  }

  /* Dropdown menus: native popover, anchor-positioned, animated in & out */
  .menu {
    position: fixed; inset: auto; margin: 0;
    position-area: bottom span-right;
    position-try-fallbacks: flip-inline;
    margin-top: 6px;
    min-width: 240px; max-height: min(70dvh, 520px); overflow: auto;
    padding: .4rem;
    background: var(--surface); color: var(--text);
    border: 1px solid var(--border); border-radius: var(--r-md);
    box-shadow: var(--shadow-lg);
    opacity: 0; translate: 0 -6px; scale: .98; transform-origin: top left;
    transition: opacity var(--t-med) var(--ease-out), translate var(--t-med) var(--ease-out), scale var(--t-med) var(--ease-out),
                display var(--t-med) allow-discrete, overlay var(--t-med) allow-discrete;
    &:popover-open { opacity: 1; translate: 0 0; scale: 1;
      @starting-style { opacity: 0; translate: 0 -6px; scale: .98; }
    }
    &.menu-end { position-area: bottom span-left; transform-origin: top right; }
    & a, & button.menu-item {
      display: flex; align-items: center; gap: .65rem; width: 100%;
      padding: .5rem .7rem; border-radius: var(--r-sm); border: 0; background: none; text-align: left; cursor: pointer;
      color: var(--text); font-size: var(--fs-sm);
      & i { width: 1.1em; text-align: center; color: var(--muted); }
      &:hover { background: var(--primary-soft); color: var(--primary-ink); text-decoration: none; & i { color: var(--primary); } }
      &[aria-current="page"] { color: var(--primary-ink); font-weight: 700; & i { color: var(--primary); } }
    }
  }
  .menu-label { padding: .6rem .7rem .25rem; font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
  .menu-sep { height: 1px; background: var(--border); margin: .35rem .25rem; }
  .menu-card { padding: .7rem; font-size: var(--fs-sm); line-height: 1.45; color: var(--muted);
    & strong { color: var(--heading); display: block; font-weight: 700; }
  }
  .menu .choice { display: flex; margin: .25rem; & label { flex: 1; justify-content: center; padding-inline: .6rem; } }
  /* Fallback when anchor positioning is unsupported */
  @supports not (position-area: bottom) {
    .menu { position: fixed; inset: auto auto auto auto; top: var(--header-h, 110px); left: 1rem; }
    .menu.menu-end { left: auto; right: 1rem; }
  }

  /* Anchor names (one per trigger) */
  #nav-projects-btn { anchor-name: --nav-projects; } #nav-projects { position-anchor: --nav-projects; }
  #nav-clients-btn  { anchor-name: --nav-clients; }  #nav-clients  { position-anchor: --nav-clients; }
  #nav-add-btn      { anchor-name: --nav-add; }      #nav-add      { position-anchor: --nav-add; }
  #nav-manage-btn   { anchor-name: --nav-manage; }   #nav-manage   { position-anchor: --nav-manage; }
  #nav-user-btn     { anchor-name: --nav-user; }     #nav-user     { position-anchor: --nav-user; }

  /* Nav search */
  .nav-search {
    position: relative; display: flex; align-items: center; gap: .5rem;
    /* direct child only: the "this project only" checkbox label also holds an icon */
    & > i { position: absolute; left: .85rem; color: var(--muted); pointer-events: none; transition: color var(--t-fast); }
    & .switch-row { gap: .35rem; color: var(--muted); white-space: nowrap; }
    /* 44px hit area (DESIGN.md Thumb Rule) around the 38px visible pill: a 3px transparent border is part of the
       tappable box but is not painted (background-clip), the 1px rule is an inset shadow, and on focus the border
       itself becomes the 3px ring (the --ring colour), so the field looks as it did at 38px. */
    & input[type="search"] {
      width: clamp(10rem, 22vw, 22rem); height: 44px;
      padding: 0 .9rem 0 calc(2.3rem - 2px); border-radius: var(--r-pill);
      border: 3px solid transparent; background: var(--surface-2); background-clip: padding-box;
      box-shadow: inset 0 0 0 1px var(--border);
      font-size: var(--fs-sm);
      transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast), width var(--t-med) var(--ease-out);
      &::placeholder { color: var(--muted); }
      &:focus { outline: none; border-color: color-mix(in oklch, var(--primary) 35%, transparent); background: var(--surface); background-clip: padding-box; box-shadow: inset 0 0 0 1px var(--primary); width: clamp(12rem, 28vw, 26rem); }
    }
    &:focus-within > i { color: var(--primary); }
    @media (width < 760px) { & input[type="search"] { width: 9rem; } }
    /* phones: collapse to the magnifier; the field opens when tapped */
    @media (width < 560px) {
      & input[type="search"] { width: 44px; padding-right: 0; cursor: pointer;
        &::placeholder { color: transparent; }
        &:focus, &:not(:placeholder-shown) { width: 11rem; padding-right: .9rem; cursor: text; &::placeholder { color: var(--muted); } }
      }
      & .switch-row { display: none; }
    }
  }
  @media (width < 800px) { #nav-user-btn { padding-inline: .5rem; & .caret { display: none; } } } /* with the nav's icon-only breakpoint */
  .avatar {
    inline-size: 30px; block-size: 30px; border-radius: 50%;
    display: grid; place-items: center; font-size: var(--fs-xs); font-weight: 700;
    background: var(--primary-soft); color: var(--primary-ink);
  }

  /* --- Breadcrumbs (Help Center style) --- */
  .crumbs {
    display: flex; align-items: center; gap: .5rem; flex-wrap: wrap;
    padding: .7rem 1rem; margin-bottom: var(--space-5);
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md);
    box-shadow: var(--shadow-sm); font-size: var(--fs-sm);
    & ol { display: flex; align-items: center; gap: .5rem; list-style: none; flex-wrap: wrap; }
    & li { display: inline-flex; align-items: center; gap: .5rem; max-width: 100%; }
    /* long unbroken labels (file names) wrap instead of widening the page */
    & li > :is(a, span) { min-width: 0; overflow-wrap: anywhere; }
    & li + li::before { content: "/"; color: var(--border-strong); }
    & [aria-current="page"] { color: var(--muted); }
    & .mark { height: 1.1rem; width: auto; }
  }

  /* --- Page title --- */
  .page-title {
    /* baseline, no wrap: on a phone a long title wraps beside its icon instead of dropping below it */
    display: flex; align-items: baseline; gap: .75rem;
    font-family: var(--font); font-weight: 400; font-size: var(--fs-lg); letter-spacing: -.01em;
    color: var(--heading);
    & i { font-size: .8em; color: var(--primary); flex: none; }
    & .count { font-size: var(--fs-sm); font-weight: 600; }
  }
  .section-label { font-size: var(--fs-xs); font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }

  /* --- Buttons --- */
  .btn {
    --_bg: var(--surface); --_fg: var(--text); --_bd: var(--border);
    display: inline-flex; align-items: center; justify-content: center; gap: .55rem;
    padding: .55rem 1rem; min-height: 40px;
    border-radius: var(--r-sm); border: 1px solid var(--_bd);
    background: var(--_bg); color: var(--_fg);
    font-size: var(--fs-sm); font-weight: 600; line-height: 1.2; cursor: pointer; white-space: nowrap;
    box-shadow: var(--shadow-sm);
    transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast), box-shadow var(--t-med), translate var(--t-med) var(--ease-out);
    &:hover { text-decoration: none; translate: 0 -1px; box-shadow: var(--shadow-md); border-color: var(--border-strong); color: var(--_fg); }
    &:active { translate: 0 0; box-shadow: var(--shadow-sm); }
    &:disabled, &[aria-disabled="true"] { opacity: .5; cursor: not-allowed; translate: none; box-shadow: none; border-color: var(--_bd); }
    &[aria-disabled="true"] { pointer-events: none; }
    & i { font-size: .95em; }
  }
  .btn-primary { --_bg: var(--primary); --_fg: var(--on-primary); --_bd: var(--primary);
    &:hover { --_bg: var(--primary-hover); border-color: var(--primary-hover); }
  }
  .btn-soft { --_bg: var(--primary-soft); --_fg: var(--primary-ink); --_bd: transparent; box-shadow: none;
    &:hover { --_bg: var(--primary); --_fg: var(--on-primary); border-color: transparent; }
  }
  .btn-ghost { --_bg: transparent; --_bd: transparent; box-shadow: none; &:hover { --_bg: var(--surface-2); box-shadow: none; } }
  .btn-lg { min-height: 52px; font-size: var(--fs-md); padding-inline: 1.25rem; border-radius: var(--r-md); }
  .btn-sm { min-height: 32px; padding: .35rem .75rem; font-size: var(--fs-xs); }
  .btn-block { width: 100%; }
  /* a public file's coded address (/public/f/<code>, one 42-character word) in the document page's Copy URL button: it
     wraps inside the button, which grows in height, instead of pushing past the side column (min-inline-size: 0 lets the
     flex item shrink below that word; overflow-wrap: anywhere breaks it, on this element only) */
  .public-address { min-inline-size: 0; overflow-wrap: anywhere; text-align: start; }

  /* --- Segmented control (Active / Completed) --- */
  .segmented {
    display: inline-flex; padding: 4px; gap: 4px;
    background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-pill);
    & a {
      display: inline-flex; align-items: center; gap: .5rem;
      padding: .4rem 1rem; border-radius: var(--r-pill);
      font-size: var(--fs-sm); font-weight: 600; color: var(--muted);
      transition: background var(--t-med) var(--ease-out), color var(--t-fast), box-shadow var(--t-med);
      &:hover { color: var(--heading); text-decoration: none; }
      &[aria-current="page"] { background: var(--surface); color: var(--heading); box-shadow: var(--shadow-sm); }
    }
  }

  /* --- Badges / pills --- */
  .badge {
    display: inline-flex; align-items: center; gap: .3rem;
    min-width: 1.6rem; justify-content: center;
    padding: .15rem .55rem; border-radius: var(--r-pill);
    font-size: var(--fs-xs); font-weight: 700; line-height: 1.4;
    background: var(--primary-soft); color: var(--primary-ink);
    font-variant-numeric: tabular-nums;
  }
  .badge-neutral { background: var(--surface-2); color: var(--muted); }
  .badge-warning { background: var(--warning-bg); color: var(--warning-ink); }
  .badge-success { background: light-dark(#dcfce7, #10301c); color: var(--success); }
  .badge-danger { background: var(--danger-bg); color: var(--danger); }
  .badge-info { background: var(--primary-soft); color: var(--primary-ink); }
  .badge-primary { background: var(--primary); color: var(--on-primary); }

  /* --- Card --- */
  .card {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
    box-shadow: var(--shadow-sm); padding: var(--space-5);
    transition: box-shadow var(--t-med), border-color var(--t-med);
    &:hover { box-shadow: var(--shadow-md); }
  }
  .card-title { font-size: var(--fs-lg); font-weight: 700; margin-bottom: var(--space-3); }
  .card-actions { display: grid; gap: var(--space-3);
    /* long labels ("Download File (6,225 KB)") wrap instead of overflowing the 300px aside */
    & .btn { white-space: normal; text-align: center; }
  }

  /* --- Client accordion (native <details>, animated) --- */
  .client-list { display: flex; flex-direction: column; gap: var(--space-4); }
  .client, .disclosure {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
    box-shadow: var(--shadow-sm); overflow: clip;
    transition: box-shadow var(--t-med), border-color var(--t-med);
    animation: rise var(--t-slow) var(--ease-out) both;
    animation-delay: calc(var(--i, 0) * 60ms);
    &:hover { border-color: var(--border-strong); }
    &[open] { box-shadow: var(--shadow-md); }
    /* Links to #client_N / category anchors land below the sticky header. */
    scroll-margin-top: calc(var(--header-h, 110px) + 1rem);

    &::details-content {
      block-size: 0; overflow: clip;
      transition: block-size var(--t-slow) var(--ease-out), content-visibility var(--t-slow) allow-discrete;
    }
    &[open]::details-content { block-size: auto; }
  }
  .client-summary {
    list-style: none; cursor: pointer;
    display: flex; align-items: center; gap: .85rem;
    padding: 1rem 1.25rem;
    transition: background var(--t-fast);
    &::-webkit-details-marker { display: none; }
    &:hover { background: color-mix(in oklch, var(--primary-soft) 55%, var(--surface)); }
    & .chev {
      inline-size: 28px; block-size: 28px; border-radius: var(--r-sm);
      display: grid; place-items: center; flex: none;
      background: var(--surface-2); color: var(--muted); font-size: .75rem;
      transition: rotate var(--t-med) var(--ease-spring), background var(--t-fast), color var(--t-fast);
    }
    & h3 { font-size: var(--fs-sm); font-weight: 700; text-transform: uppercase; letter-spacing: 0.01em; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  }
  :is(.client, .disclosure)[open] > .client-summary {
    border-bottom: 1px solid var(--border);
    & .chev { rotate: 90deg; background: var(--primary); color: var(--on-primary); }
  }

  /* --- Data table (plain HTML, responsive via container query) --- */
  /* position: relative keeps .sr-only labels inside the sideways scroll instead of widening the page */
  .table-wrap { container-type: inline-size; overflow-x: auto; position: relative; }
  .table {
    width: 100%; font-size: var(--fs-sm);
    & th {
      text-align: left; font-weight: 700; font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .06em;
      color: var(--muted); padding: var(--pad-cell); border-bottom: 1px solid var(--border); white-space: nowrap;
      background: var(--surface-2);
    }
    & td { padding: var(--pad-cell); border-bottom: 1px solid var(--border); vertical-align: middle; }
    & tbody tr { transition: background var(--t-fast); }
    & tbody tr:hover { background: color-mix(in oklch, var(--primary-soft) 45%, transparent); }
    /* rows a page script marks as chosen (notify lists on Upload and the Dropbox transfer) */
    & tbody tr.selected { background: var(--primary-soft); }
    & tbody tr:last-child td { border-bottom: 0; }
    & .num { font-variant-numeric: tabular-nums; color: var(--muted); white-space: nowrap; }
    & .name a { font-weight: 700; color: var(--heading); &:hover { color: var(--primary-ink); } }
    & .actions { text-align: right; width: 1%; white-space: nowrap; }
    & td.is-empty { color: var(--warning-ink); }
    & td.is-empty .doc-count { background: var(--warning-bg); }
  }
  .doc-count { display: inline-flex; align-items: center; gap: .4rem; padding: .1rem .5rem; border-radius: var(--r-pill); font-variant-numeric: tabular-nums;
    & i { opacity: .7; }
  }
  .col-number { font-weight: 600;}
  @container (width < 640px) {
    .table .col-created, .table .col-number { display: none; }
  }
  @container (width < 460px) {
    .table .col-latest { display: none; }
    .table .actions .label { display: none; }
  }

  /* --- Alerts --- */
  .alert {
    display: flex; gap: .75rem; align-items: flex-start;
    padding: .85rem 1rem; border-radius: var(--r-md); font-size: var(--fs-sm);
    background: var(--info-bg); color: var(--primary-ink);
    &.alert-danger { background: var(--danger-bg); color: var(--danger); }
    &.alert-warning { background: var(--warning-bg); color: var(--warning-ink); }
  }
  /* An alert without a leading icon (built by module scripts and flashes from text, links and buttons) flows as
     ordinary text, not as a flex row of separate pieces. */
  .alert:not(:has(> :is(i, svg):first-child)) { display: block;
    & > * + * { margin-top: .5rem; }
  }

  /* --- Admin log --- */
  .log {
    background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md);
    padding: 1rem; max-height: 220px; overflow: auto; color: var(--muted); white-space: pre-wrap;
  }
  /* View Group: zip progress lines streamed into an initially empty .log */
  .server-events { font-size: var(--fs-xs); padding: .6rem .75rem; &:empty { display: none; } }

  /* --- Footer --- */
  .site-footer {
    border-top: 1px solid var(--border); background: var(--surface);
    padding-block: var(--space-6) var(--space-5); font-size: var(--fs-sm);
    & .inner { width: min(100% - 2rem, var(--page-max)); margin-inline: auto; }
    & .cols { display: grid; gap: var(--space-5); grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
    & h4 { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; margin-bottom: var(--space-3); }
    & ul { list-style: none; display: grid; gap: .35rem; }
    & a { color: var(--text); &:hover { color: var(--primary-ink); } }
    & .legal { display: flex; justify-content: space-between; gap: var(--space-4); flex-wrap: wrap; align-items: center;
      margin-top: var(--space-5); padding-top: var(--space-4); border-top: 1px solid var(--border); color: var(--muted);
      & nav { display: flex; gap: var(--space-4); }
    }
    & .build { margin-top: var(--space-3); font-size: var(--fs-xs); color: var(--muted); text-align: center; }
  }

  /* --- Back to top: appears via scroll-driven animation, no JS --- */
  .back-to-top {
    position: fixed; right: 1.25rem; bottom: 1.25rem; z-index: 40;
    inline-size: 46px; block-size: 46px; border-radius: 50%;
    display: grid; place-items: center;
    background: var(--surface); color: var(--heading); border: 1px solid var(--border); box-shadow: var(--shadow-lg);
    animation: reveal linear both; animation-timeline: scroll(root); animation-range: 300px 500px;
    &:hover { color: var(--primary); text-decoration: none; }
  }
  @supports not (animation-timeline: scroll()) { .back-to-top { opacity: 1; } }
  @keyframes reveal { from { opacity: 0; scale: .6; pointer-events: none; } to { opacity: 1; scale: 1; pointer-events: auto; } }

  /* Motion primitives */
  @keyframes rise { from { opacity: 0; translate: 0 10px; } to { opacity: 1; translate: 0 0; } }
  .rise { animation: rise var(--t-slow) var(--ease-out) both; animation-delay: calc(var(--i, 0) * 60ms); }
}

/* ---------- Utilities ---------- */
@layer utilities {
  .sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .muted { color: var(--muted); }
  .warn { color: var(--warning-ink); }
  .info { color: var(--primary-ink); }
  .lead { font-size: var(--fs-lg); }
  .small { font-size: var(--fs-sm); }
  .nowrap { white-space: nowrap; }
  /* term / description pairs side by side (was Bootstrap's dl-horizontal); one column on phones */
  .dl-grid { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: .3rem 1rem; margin: 0;
    & dt { font-weight: 700; color: inherit; }
    & dd { margin: 0; overflow-wrap: anywhere; }
    @media (width < 560px) { grid-template-columns: minmax(0, 1fr); & dd { margin-bottom: .35rem; } }
  }
  .row { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
  /* a row of labelled fields (filters, inline forms): align the controls and buttons along the bottom */
  .row:has(> .field) { align-items: flex-end; }
  .spread { justify-content: space-between; }
  .ml-auto { margin-left: auto; }
  .blurred { filter: blur(6px); }
  /* long lists (Download / Response Required, …) scroll inside their panel instead of paginating */
  .scroll-y { max-height: var(--max-h, 22rem); overflow-y: auto; overscroll-behavior: contain; }
  /* Legacy page scripts still toggle Bootstrap's .hidden class. */
  .hidden { display: none !important; }
  /* Rich text saved from CKEditor (announcements, comments, descriptions): restore the spacing the reset removes. */
  .prose { overflow-wrap: anywhere;
    & > * + * { margin-top: .6em; }
    & :is(ul, ol) { padding-left: 1.25em; }
    & li + li { margin-top: .2em; }
    & img { height: auto; }
  }
  /* Stored rich text (descriptions, comments, announcements; net/archinet/RichText.cfc cleans it): its content stays inside
     its own box, so nothing in it can be drawn over the page around it; a wide table scrolls sideways inside the box, and
     a text taller than 20,000px scrolls inside it (no real one is), so the rest of the page always stays reachable. No
     padding and no margin: the text lines up as it always has, and nothing in the box reaches past it. A focused link
     inside draws its ring inside its own box (the site's ring sits 2px outside), so the clip never cuts it. Each box
     carries the same box rule as its own style, for a browser holding an older copy of this file. */
  .rich-text { overflow-x: auto; overflow-y: auto; max-height: 20000px; padding: 0; margin: 0; }
  .rich-text :focus-visible { outline-offset: -2px; }
  /* under a Description toggle (the report pages) the box keeps the toggle's own gap above it */
  .mini-details > .rich-text { margin-top: .5rem; }
  @media (width < 1024px) { .hide-lt-lg { display: none !important; } }
  @media (width >= 1024px) { .show-lt-lg { display: none !important; } }
}

/* ==========================================================================
   Detail-page components (View Project, View Group, View Document, Upload)
   ========================================================================== */
@layer components {

  /* --- Panel: card with header row --- */
  .panel {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
    box-shadow: var(--shadow-sm); overflow: clip;
    transition: box-shadow var(--t-med);
    &:hover { box-shadow: var(--shadow-md); }
  }
  .panel-head {
    display: flex; align-items: center; gap: .6rem; flex-wrap: wrap;
    padding: .85rem 1.25rem; border-bottom: 1px solid var(--border); background: var(--surface-2);
    & h2, & h3 { font-size: var(--fs-md); font-weight: 700; display: flex; align-items: center; gap: .55rem; flex: 1; min-width: 0; }
    & h2 > i, & h3 > i { color: var(--primary); }
  }
  .panel-body { padding: 1.25rem; display: flex; flex-direction: column; gap: var(--space-4); }
  .panel-body.flush { padding: 0; gap: 0; }
  /* a panel that needs attention (e.g. Fireflies' "Needs your attention") */
  .panel.is-warning { border-color: color-mix(in oklab, var(--warning-ink) 35%, var(--border));
    & > .panel-head { background: var(--warning-bg); color: var(--warning-ink); }
  }
  /* a panel holding a destructive action (e.g. Fireflies' "Delete minutes") */
  .panel.is-danger { border-color: color-mix(in oklab, var(--danger) 35%, var(--border));
    & > .panel-head { background: var(--danger-bg); color: var(--danger); & h2 > i, & h3 > i { color: inherit; } }
  }
  details.panel > summary.panel-head { cursor: pointer; list-style: none; border-bottom-color: transparent; transition: background var(--t-fast);
    &::-webkit-details-marker { display: none; }
    &:hover { background: var(--primary-soft); }
    /* A plus drawn with gradients: the Font Awesome kit is SVG-only, so no icon font exists for a pseudo-element. */
    &::after { content: ""; flex: none; inline-size: .75rem; block-size: .75rem; color: var(--muted);
      background: linear-gradient(currentColor 0 0) center / 100% 2px no-repeat, linear-gradient(currentColor 0 0) center / 2px 100% no-repeat;
      transition: rotate var(--t-med) var(--ease-spring); }
  }
  details.panel[open] > summary.panel-head { border-bottom-color: var(--border); &::after { rotate: 45deg; } }
  details.panel::details-content { block-size: 0; overflow: clip; transition: block-size var(--t-slow) var(--ease-out), content-visibility var(--t-slow) allow-discrete; }
  details.panel[open]::details-content { block-size: auto; }

  /* --- Tabs: pure CSS (radio + :has) --- */
  .tabs { display: flex; flex-direction: column; gap: var(--space-4); }
  /* position: relative keeps the hidden radios inside the sideways scroll instead of widening the page on a phone */
  .tab-list {
    position: relative; display: flex; gap: 4px; padding: 4px; overflow-x: auto; scrollbar-width: none;
    background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md);
    & input { position: absolute; opacity: 0; pointer-events: none; }
  }
  .tab {
    display: inline-flex; align-items: center; gap: .5rem; white-space: nowrap; cursor: pointer;
    padding: .55rem 1rem; border-radius: var(--r-sm); font-size: var(--fs-sm); font-weight: 600; color: var(--muted);
    transition: background var(--t-med) var(--ease-out), color var(--t-fast), box-shadow var(--t-med);
    &:hover { color: var(--heading); }
    &:has(input:checked) { background: var(--surface); color: var(--heading); box-shadow: var(--shadow-sm); & i { color: var(--primary); } }
    &:has(input:focus-visible) { outline: 2px solid var(--primary); outline-offset: 1px; }
  }
  /* link tabs (each tab is its own page, e.g. Fireflies settings): the current one looks selected */
  a.tab { text-decoration: none;
    &[aria-current="page"] { background: var(--surface); color: var(--heading); box-shadow: var(--shadow-sm); }
  }
  .tab-panel { display: none; animation: rise var(--t-slow) var(--ease-out) both; }
  .tabs:has([data-tab="1"]:checked) [data-panel="1"],
  .tabs:has([data-tab="2"]:checked) [data-panel="2"],
  .tabs:has([data-tab="3"]:checked) [data-panel="3"],
  .tabs:has([data-tab="4"]:checked) [data-panel="4"],
  .tabs:has([data-tab="5"]:checked) [data-panel="5"],
  .tabs:not(:has(.tab-list input:checked)) [data-panel="1"] { display: block; }
  .tabs:not(:has(.tab-list input:checked)) .tab:first-child { background: var(--surface); color: var(--heading); box-shadow: var(--shadow-sm); }

  /* --- Meta list: icon + text rows --- */
  .meta-list {
    list-style: none; display: grid; gap: .4rem; font-size: var(--fs-sm);
    & li { display: flex; align-items: baseline; gap: .6rem; }
    & li > i:first-child { width: 1.1em; flex: none; text-align: center; color: var(--muted); }
    & .is-danger, & .is-danger i { color: var(--danger) !important; }
  }
  .kv-title { font-size: var(--fs-xs); font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: .5rem; display: flex; align-items: center; gap: .4rem; }
  .split { container-type: inline-size; }
  /* minmax(0, …): a long unbreakable label must not push the other column out of the panel */
  .split-grid { display: grid; gap: var(--space-5) var(--space-6); grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  @container (width < 36rem) { .split-grid { grid-template-columns: minmax(0, 1fr); } }

  /* --- List group (Download / Response Required) --- */
  .list-group { list-style: none; display: flex; flex-direction: column;
    & > li { display: flex; align-items: center; gap: .75rem; padding: .7rem 1.25rem; border-top: 1px solid var(--border); font-size: var(--fs-sm); transition: background var(--t-fast); }
    & > li:first-child { border-top: 0; }
    & > li:hover { background: color-mix(in oklch, var(--primary-soft) 45%, transparent); }
    & .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    /* narrow lists (View Document aside): labels that share a long prefix wrap instead of all reading "2023.08…" */
    &.wrap-labels .grow { white-space: normal; overflow-wrap: anywhere; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; }
    & .empty { color: var(--muted); }
    & [aria-current="page"] { font-weight: 700; color: var(--heading); }
    & > li:has(> [aria-current="page"]) { background: var(--primary-soft); }
  }
  .icon-btn {
    inline-size: 32px; block-size: 32px; border-radius: var(--r-sm); display: grid; place-items: center; flex: none;
    color: var(--muted); background: transparent; border: 0; cursor: pointer; transition: background var(--t-fast), color var(--t-fast);
    &:hover { background: var(--primary-soft); color: var(--primary-ink); text-decoration: none; }
  }

  /* --- Image placeholder / thumbnail --- */
  .thumb {
    position: relative; display: grid; place-items: center; overflow: hidden;
    aspect-ratio: var(--ratio, 4 / 3); inline-size: var(--w, 100%);
    border-radius: var(--r-sm); border: 1px solid var(--border);
    background: repeating-linear-gradient(135deg, var(--surface-2) 0 8px, color-mix(in oklch, var(--surface-2) 60%, var(--border)) 8px 9px);
    color: var(--muted); font: 500 .6875rem/1.2 var(--mono); text-align: center; padding: .25rem;
    transition: transform var(--t-med) var(--ease-out), box-shadow var(--t-med);
    /* opaque so the file-type label behind it only shows when the image is missing (onerror removes the img) */
    & img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: var(--surface); }
  }
  a:hover > .thumb, .thumb:is(a):hover { transform: scale(1.03); box-shadow: var(--shadow-md); }

  /* --- Document rows (categories / groups) --- */
  .doc-row {
    display: grid; gap: .5rem 1.25rem; align-items: center;
    grid-template-columns: 72px minmax(0, 2fr) minmax(0, 1.2fr) minmax(0, 1fr);
    padding: 1rem 1.25rem; border-top: 1px solid var(--border);
    transition: background var(--t-fast);
    &:first-child { border-top: 0; }
    &:hover { background: color-mix(in oklch, var(--primary-soft) 35%, transparent); }
    & h4 { font-size: var(--fs-md); font-weight: 700; line-height: 1.3; }
    & h4 a { color: var(--heading); }
    & .file { font-size: var(--fs-sm); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    &.is-nested { background: color-mix(in oklch, var(--surface-2) 70%, transparent); padding-left: 2.5rem; }
  }
  .doc-rows { container-type: inline-size; }
  @container (width < 640px) {
    .doc-row { grid-template-columns: 64px minmax(0, 1fr); }
    .doc-row > :nth-child(n+3) { grid-column: 2; }
  }
  .dl-link { display: inline-flex; align-items: center; gap: .35rem; font-size: var(--fs-sm); }
  .zero { color: var(--muted); opacity: .7; }

  /* --- Group file rows with actions --- */
  .file-row {
    display: grid; gap: 1rem; align-items: center;
    grid-template-columns: 110px minmax(0, 1fr) auto;
    padding: 1rem 1.25rem; border-top: 1px solid var(--border);
    &:first-child { border-top: 0; }
    & .actions { display: flex; gap: .5rem; flex-wrap: wrap; justify-content: flex-end; }
  }
  @container (width < 640px) { .file-row { grid-template-columns: 90px minmax(0, 1fr); } .file-row .actions { grid-column: 1 / -1; justify-content: stretch; & .btn { flex: 1; } } }

  /* --- Buttons: extra variants --- */
  .btn-warning { --_bg: light-dark(#fff7e6, #3a2e0d); --_fg: var(--warning-ink); --_bd: light-dark(#f5d48a, #6b5317); }
  .btn-danger { --_bg: var(--danger-bg); --_fg: var(--danger); --_bd: light-dark(#fecaca, #5b1f1f);
    &:hover { --_bg: var(--danger); --_fg: #fff; border-color: var(--danger); }
  }
  .btn-group { display: flex; gap: .4rem; flex-wrap: wrap; }

  /* --- Alerts: success variant + announcement --- */
  .alert-success { background: light-dark(#dcfce7, #10301c); color: light-dark(#166534, #86efac); }
  .announcement {
    border-radius: var(--r-md); padding: 1rem; display: grid; gap: .5rem;
    background: light-dark(#f0fdf4, #0f2618); border: 1px solid light-dark(#bbf7d0, #1f4d30);
    & h4 { font-size: var(--fs-md); }
    & p { font-size: var(--fs-sm); }
    & .by { font-size: var(--fs-xs); color: var(--muted); }
    &.is-old { background: var(--surface-2); border-color: var(--border); }
  }
  .announce-more > summary { list-style: none; cursor: pointer; font-size: var(--fs-sm); color: var(--primary-ink); display: inline-flex; align-items: center; gap: .4rem;
    &::-webkit-details-marker { display: none; }
    & i { transition: rotate var(--t-med) var(--ease-spring); }
  }
  .announce-more[open] > summary i { rotate: 45deg; }
  .announce-more > .stack { margin-top: .75rem; }

  /* --- Notifications (grouped users) --- */
  .people { list-style: none; display: grid; gap: var(--space-4); font-size: var(--fs-sm);
    & > li > strong { display: block; font-weight: 700; color: var(--heading); margin-bottom: .35rem; }
    & ul { list-style: none; display: grid; gap: .35rem; padding-left: .75rem; border-left: 2px solid var(--border); }
    & .req { list-style: none; display: grid; gap: .15rem; padding: .2rem 0 0 .25rem; border: 0; font-size: var(--fs-xs); color: var(--muted);
      & li { display: flex; gap: .4rem; align-items: center; }
    }
  }
  .ok { color: var(--success); } .no { color: var(--danger); }
  .dl-pill { display: inline-flex; align-items: center; gap: .25rem; font-size: var(--fs-xs); font-weight: 700; margin-left: .35rem; font-variant-numeric: tabular-nums; }

  /* --- Comments thread --- */
  .thread { list-style: none; display: grid; gap: var(--space-3); }
  .comment {
    margin-left: calc(var(--depth, 0) * 1.5rem);
    display: grid; gap: .5rem; padding: .9rem 1rem; border-radius: var(--r-md);
    background: var(--surface-2); border: 1px solid var(--border);
    &.is-root { background: var(--primary-soft); border-color: transparent; }
    & p { font-size: var(--fs-sm); color: var(--text); }
    & footer { display: flex; align-items: center; gap: .9rem; flex-wrap: wrap; font-size: var(--fs-xs); color: var(--muted); }
    & footer .btn { margin-left: auto; }
  }

  /* --- Forms --- */
  .form { display: grid; gap: var(--space-5); }
  /* a field in a .row grows from 11rem (a components rule, so a page's own rule can size one field differently) */
  .row > .field { flex: 1 1 11rem; min-width: 0; }
  .field { display: grid; gap: .4rem;
    & > label, & > .label, & > legend { font-size: var(--fs-sm); font-weight: 700; color: var(--heading); }
    & .hint { font-size: var(--fs-xs); color: var(--muted); }
    & .error { display: none; font-size: var(--fs-xs); color: var(--danger); }
    &:has(:user-invalid) .error, &:has([aria-invalid="true"]) .error { display: block; }
  }
  .input, .select, .textarea {
    width: 100%; min-height: 44px; padding: .6rem .85rem;
    border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface);
    font-size: var(--fs-sm); color: var(--text);
    transition: border-color var(--t-fast), box-shadow var(--t-fast);
    &::placeholder { color: var(--muted); }
    &:hover { border-color: var(--border-strong); }
    &:disabled { opacity: .6; cursor: not-allowed; background-color: var(--surface-2); border-color: var(--border); }
    &:focus { outline: none; border-color: var(--primary); box-shadow: var(--ring); }
    &:user-invalid, &[aria-invalid="true"] { border-color: var(--danger); box-shadow: 0 0 0 3px color-mix(in oklch, var(--danger) 18%, transparent); }
  }
  .select { appearance: none; padding-right: 2.25rem; cursor: pointer;
    background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
    background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat;
  }
  .textarea { field-sizing: content; min-height: 7.5rem; resize: vertical; line-height: 1.5; }
  .char-count { font-size: var(--fs-xs); color: var(--muted); justify-self: end; font-variant-numeric: tabular-nums; }

  input[type="checkbox"].check { inline-size: 18px; block-size: 18px; cursor: pointer; }

  /* Radio segmented (access flags) */
  .choice { display: inline-flex; padding: 4px; gap: 4px; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--border); flex-wrap: wrap;
    & label { position: relative; display: inline-flex; align-items: center; gap: .5rem; padding: .5rem .95rem; border-radius: var(--r-sm); cursor: pointer; font-size: var(--fs-sm); font-weight: 600; color: var(--muted); transition: background var(--t-med) var(--ease-out), color var(--t-fast); }
    & input { position: absolute; opacity: 0; }
    & label:has(input:checked) { background: var(--primary); color: var(--on-primary); box-shadow: var(--shadow-sm); }
    & label:has(input:focus-visible) { outline: 2px solid var(--primary); outline-offset: 2px; }
  }

  /* Switch */
  input[type="checkbox"].switch {
    appearance: none; inline-size: 40px; block-size: 24px; border-radius: 99px; position: relative; cursor: pointer; flex: none;
    background: var(--border-strong); transition: background var(--t-med);
    &::before { content: ""; position: absolute; inset: 3px auto 3px 3px; aspect-ratio: 1; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: translate var(--t-med) var(--ease-spring); }
    &:checked { background: var(--primary); &::before { translate: 16px 0; } }
  }
  .switch-row { display: flex; align-items: center; gap: .75rem; font-size: var(--fs-sm); cursor: pointer; }

  /* Dropzone */
  .dropzone {
    position: relative; display: grid; place-items: center; gap: .5rem; text-align: center;
    padding: 2.25rem 1rem; border: 2px dashed var(--border-strong); border-radius: var(--r-lg);
    background: var(--surface-2); color: var(--muted); cursor: pointer;
    transition: border-color var(--t-fast), background var(--t-fast), transform var(--t-med) var(--ease-out);
    & i { font-size: 1.75rem; color: var(--primary); transition: translate var(--t-med) var(--ease-spring); }
    & strong { color: var(--heading); font-weight: 700; }
    & input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
    &:hover, &.is-over, &:has(input:focus-visible) { border-color: var(--primary); background: var(--primary-soft); & i { translate: 0 -4px; } }
    &.is-over { transform: scale(1.01); }
  }
  .queue { list-style: none; display: grid; gap: .5rem;
    & li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: .75rem; align-items: center; padding: .65rem .85rem; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); font-size: var(--fs-sm); animation: rise var(--t-med) var(--ease-out) both; }
    & .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
    & .size { color: var(--muted); font-size: var(--fs-xs); font-variant-numeric: tabular-nums; }
    & progress { grid-column: 2 / -1; }
  }
  progress {
    appearance: none; inline-size: 100%; block-size: 8px; border: 0; border-radius: 99px; overflow: hidden; background: var(--surface-2);
    &::-webkit-progress-bar { background: var(--surface-2); }
    &::-webkit-progress-value { background: var(--primary); border-radius: 99px; transition: inline-size var(--t-slow) var(--ease-out); }
    &::-moz-progress-bar { background: var(--primary); border-radius: 99px; }
  }
  .steps { list-style: none; counter-reset: step; display: grid; gap: .75rem; font-size: var(--fs-sm);
    & > li { counter-increment: step; display: grid; grid-template-columns: 28px 1fr; gap: .75rem; align-items: start; }
    & > li::before { content: counter(step); inline-size: 28px; block-size: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary-ink); font-weight: 700; font-size: var(--fs-xs); }
    & ul { list-style: none; display: grid; gap: .3rem; margin-top: .4rem; color: var(--muted); }
  }
  .table .center { text-align: center; }
  .table.is-compact { --pad-cell: .45rem .6rem; }
  .table-scroll { max-height: var(--max-h, 320px); overflow: auto; position: relative; border: 1px solid var(--border); border-radius: var(--r-md);
    /* the whole thead sticks, so two-row headers stay stacked instead of overlapping */
    & thead { position: sticky; top: 0; z-index: 1; }
  }
  .panel > .table-scroll { border: 0; border-radius: 0; }

  /* --- Native <dialog> modal --- */
  dialog.modal {
    margin: auto; inline-size: min(100% - 2rem, 460px); padding: 0; border: 1px solid var(--border); border-radius: var(--r-lg);
    background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg);
    opacity: 0; translate: 0 12px; scale: .97;
    transition: opacity var(--t-med) var(--ease-out), translate var(--t-med) var(--ease-out), scale var(--t-med) var(--ease-out), display var(--t-med) allow-discrete, overlay var(--t-med) allow-discrete;
    &[open] { opacity: 1; translate: 0 0; scale: 1; @starting-style { opacity: 0; translate: 0 12px; scale: .97; } }
    &::backdrop { background: rgb(15 23 42 / 0); backdrop-filter: blur(0); transition: background var(--t-med), backdrop-filter var(--t-med), display var(--t-med) allow-discrete, overlay var(--t-med) allow-discrete; }
    &[open]::backdrop { background: rgb(15 23 42 / .45); backdrop-filter: blur(4px); @starting-style { background: rgb(15 23 42 / 0); backdrop-filter: blur(0); } }
    & .panel-head { background: transparent; }
    & footer { display: flex; justify-content: flex-end; gap: .5rem; padding: 1rem 1.25rem; border-top: 1px solid var(--border); }
    /* scrolling over the backdrop or inside the dialog never scrolls the page behind it (modern-web-guidance dialog) */
    &:modal { overscroll-behavior: contain; }
    &::backdrop { overflow: hidden; overscroll-behavior: contain; }
  }
  .copy-field { display: flex; border: 1px solid var(--border); border-radius: var(--r-sm); overflow: hidden;
    & span { padding: .6rem .8rem; background: var(--surface-2); font-size: var(--fs-xs); color: var(--muted); white-space: nowrap; display: grid; place-items: center; }
    & input { flex: 1; min-width: 0; border: 0; padding: .6rem .8rem; font: 500 var(--fs-sm) var(--mono); background: var(--surface); }
  }

  /* --- Document hero --- */
  .doc-title { font-size: clamp(1.4rem, 1rem + 1.4vw, 2rem); font-weight: 700; line-height: 1.2; overflow-wrap: anywhere; }
  .doc-desc { font-size: var(--fs-lg); color: var(--text); font-weight: 300; }
  .qr { --ratio: 1; --w: 160px; justify-self: center; }
}

/* ==========================================================================
   Login
   ========================================================================== */
@layer components {
  .nav-note { margin-left: auto; font-size: var(--fs-sm); color: var(--muted); padding-inline: .75rem; text-align: right;
    & time { font-variant-numeric: tabular-nums; }
    @media (width < 760px) { & .when { display: none; } }
  }
  .login-grid { display: grid; gap: var(--space-6); grid-template-columns: minmax(300px, 380px) minmax(0, 1fr); align-items: start;
    @media (width < 900px) { grid-template-columns: minmax(0, 1fr); }
  }
  .auth-card { display: grid; gap: var(--space-5); padding: var(--space-5);
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-md);
    animation: rise var(--t-slow) var(--ease-out) both;
    & h2 { font-size: var(--fs-lg); display: flex; align-items: center; gap: .55rem; & i { color: var(--primary); font-size: .9em; } }
    & form { display: grid; gap: var(--space-3); }
    & .fine { font-size: var(--fs-xs); color: var(--muted); line-height: 1.5; }
  }
  .or { display: flex; align-items: center; gap: .75rem; font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .1em; color: var(--muted);
    &::before, &::after { content: ""; flex: 1; height: 1px; background: var(--border); }
  }
  .btn-ms { --_bg: var(--surface); --_fg: var(--heading); --_bd: var(--border-strong); min-height: 52px; font-size: var(--fs-md); white-space: normal;
    & i { color: #0078d4; font-size: 1.1em; }
  }
  .input-lg { min-height: 52px; font-size: var(--fs-md); padding-inline: 1rem; }
  /* block padding only: a .select keeps its right padding for the arrow */
  .input-sm { min-height: 36px; padding-block: .35rem; }
  .input-icon { position: relative;
    & > i { position: absolute; left: 1rem; top: 50%; translate: 0 -50%; color: var(--muted); pointer-events: none; transition: color var(--t-fast); }
    & .input { padding-left: 2.6rem; }
    & .reveal { position: absolute; right: .4rem; top: 50%; translate: 0 -50%; }
    &:focus-within > i { color: var(--primary); }
    &:has(.input:user-invalid) > i, &:has(.input[aria-invalid="true"]) > i { color: var(--danger); }
  }
  .mini-details { font-size: var(--fs-sm);
    & > summary { cursor: pointer; list-style: none; color: var(--primary-ink); display: inline-flex; align-items: center; gap: .4rem; font-weight: 600;
      &::-webkit-details-marker { display: none; }
      &::before { content: ""; inline-size: .45em; block-size: .45em; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; rotate: -45deg; transition: rotate var(--t-med) var(--ease-spring); }
    }
    &[open] > summary::before { rotate: 45deg; }
    & > :not(summary) { margin-top: .5rem; color: var(--muted); line-height: 1.55; }
    &::details-content { block-size: 0; overflow: clip; transition: block-size var(--t-med) var(--ease-out), content-visibility var(--t-med) allow-discrete; }
    &[open]::details-content { block-size: auto; }
  }
  .promo { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: var(--space-6); align-items: start; padding: var(--space-6);
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-sm);
    animation: rise var(--t-slow) var(--ease-out) 80ms both;
    & img { width: 100%; height: auto; border-radius: var(--r-md); box-shadow: var(--shadow-md); transition: transform var(--t-slow) var(--ease-out); }
    & a:hover img { transform: scale(1.02); }
    & h2 { font-size: var(--fs-2xl); font-weight: 300; color: var(--primary-ink); margin-bottom: var(--space-4); }
    & h3 { font-size: var(--fs-lg); margin: var(--space-5) 0 var(--space-2); }
    & p { margin-bottom: var(--space-3); }
    @container (width < 720px) { grid-template-columns: minmax(0, 1fr); }
  }
  .promo-wrap { container-type: inline-size; }
  .social { display: flex; gap: .75rem; margin-top: var(--space-3);
    & a { display: grid; place-items: center; inline-size: 40px; block-size: 40px; border-radius: var(--r-sm); border: 1px solid var(--border); background: var(--surface); transition: translate var(--t-med) var(--ease-spring), box-shadow var(--t-med); }
    & a:hover { translate: 0 -2px; box-shadow: var(--shadow-md); }
    & img { width: 22px; height: 22px; }
  }
}

/* ==========================================================================
   Add Comment / Add Announcement
   ========================================================================== */
@layer components {
  .form-narrow { max-width: 760px; }
  .picker { display: grid; gap: var(--space-3); container-type: inline-size; }
  .picker-toolbar { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; font-size: var(--fs-sm);
    & .input { min-height: 38px; flex: 1; min-width: 180px; max-width: 280px; }
  }
  .picker-groups { display: grid; gap: var(--space-3); grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); }
  .picker-group { border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); overflow: clip;
    & > header { display: flex; align-items: center; gap: .6rem; padding: .6rem .85rem; background: var(--surface-2); border-bottom: 1px solid var(--border); font-size: var(--fs-sm); font-weight: 700; color: var(--heading); cursor: pointer; }
    & > header .badge { margin-left: auto; }
    & ul { list-style: none; display: grid; padding: .35rem; }
    & li label { display: flex; align-items: center; gap: .6rem; padding: .45rem .5rem; border-radius: var(--r-sm); font-size: var(--fs-sm); cursor: pointer; transition: background var(--t-fast); }
    & li label:hover { background: var(--primary-soft); }
    & li label:has(input:checked) { color: var(--heading); font-weight: 600; }
    & li label:has(input:disabled) { cursor: default; color: var(--muted); }
    & .tag { margin-left: auto; font-size: var(--fs-xs); color: var(--muted); font-weight: 400; }
    &:has(input:checked) { border-color: color-mix(in oklch, var(--primary) 45%, var(--border)); }
  }
  .quote { display: grid; gap: .5rem; padding: 1rem 1.1rem; border-radius: var(--r-md); background: var(--primary-soft); border-left: 0; position: relative;
    & p { font-size: var(--fs-sm); color: var(--text); }
    & footer { display: flex; gap: .9rem; flex-wrap: wrap; font-size: var(--fs-xs); color: var(--muted); }
    &::before { content: "\201C"; position: absolute; top: -.2rem; right: .8rem; font-size: 3rem; line-height: 1; color: color-mix(in oklch, var(--primary) 30%, transparent); font-family: Georgia, serif; }
  }
  .form-actions { display: flex; gap: .6rem; flex-wrap: wrap; padding-top: var(--space-2); }
  .success-hero { display: grid; justify-items: start; gap: var(--space-3); animation: rise var(--t-slow) var(--ease-out) both;
    & .check-badge { inline-size: 48px; block-size: 48px; border-radius: 50%; display: grid; place-items: center; background: light-dark(#dcfce7, #10301c); color: var(--success); font-size: 1.35rem; animation: pop .5s var(--ease-spring) both; }
  }
  @keyframes pop { from { scale: .4; opacity: 0; } to { scale: 1; opacity: 1; } }
  .notified { list-style: none; display: grid; gap: .4rem; font-size: var(--fs-sm);
    & li { display: flex; align-items: center; gap: .6rem; animation: rise var(--t-med) var(--ease-out) both; animation-delay: calc(var(--i, 0) * 40ms); }
    & li > i { color: var(--muted); width: 1.1em; text-align: center; }
    & .tag { font-size: var(--fs-xs); }
  }
}

/* ==========================================================================
   DataTables skin — only for the few pages that keep DataTables (LOCAL.uiDataTables) for search, sort and paging on
   long admin / report / location lists. DataTables' own stylesheet is not loaded.
   ========================================================================== */
@layer components {
  .dataTables_wrapper {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-3);
    font-size: var(--fs-sm);
    /* only the controls are muted; the table inside the wrapper keeps the normal text colour */
    & :is(.dataTables_length, .dataTables_filter, .dataTables_info, .dataTables_paginate) { color: var(--muted); }
    & > table.dataTable, & > .dataTables_scroll { flex: 1 0 100%; }
    & :is(.dataTables_length select, .dataTables_filter input) {
      min-height: 36px; padding: .35rem .7rem; margin-inline: .35rem; border: 1px solid var(--border); border-radius: var(--r-sm);
      background: var(--surface); color: var(--text); font-size: var(--fs-sm);
      &:focus { outline: none; border-color: var(--primary); box-shadow: var(--ring); }
    }
    & .dataTables_paginate { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
    & .paginate_button {
      min-width: 32px; padding: .3rem .6rem; border: 1px solid var(--border); border-radius: var(--r-sm);
      background: var(--surface); color: var(--text); text-align: center; cursor: pointer;
      &:hover { background: var(--primary-soft); color: var(--primary-ink); text-decoration: none; }
      &.current { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
      &.disabled { opacity: .45; pointer-events: none; }
    }
    & .ellipsis { padding-inline: .35rem; }
    & .dataTables_processing { color: var(--primary-ink); }
  }
  table.dataTable { width: 100% !important;
    & thead :is(.sorting, .sorting_asc, .sorting_desc) { cursor: pointer; padding-right: 1.6rem; position: relative; }
    & thead :is(.sorting, .sorting_asc, .sorting_desc)::after { position: absolute; right: .6rem; top: 50%; translate: 0 -50%; color: var(--border-strong); font-size: .85em; }
    & thead .sorting::after { content: "\2195"; }
    & thead .sorting_asc::after { content: "\2191"; color: var(--primary); }
    & thead .sorting_desc::after { content: "\2193"; color: var(--primary); }
    & tbody tr.selected { background: var(--primary-soft); }
    & td.dataTables_empty { text-align: center; color: var(--muted); }
    /* Responsive extension: the +/- control in the first cell and the child-row details */
    &.dtr-inline.collapsed > tbody > tr > td:first-child { position: relative; padding-left: 2.2rem; cursor: pointer; }
    &.dtr-inline.collapsed > tbody > tr > td:first-child::before {
      content: "+"; position: absolute; left: .6rem; top: 50%; translate: 0 -50%; inline-size: 1.15rem; block-size: 1.15rem;
      display: grid; place-items: center; border-radius: 50%; background: var(--primary); color: var(--on-primary); font-weight: 700; font-size: .8rem; line-height: 1;
    }
    &.dtr-inline.collapsed > tbody > tr.parent > td:first-child::before { content: "\2212"; background: var(--danger); }
    & > tbody > tr.child ul.dtr-details { list-style: none; display: grid; gap: .35rem; }
    & > tbody > tr.child span.dtr-title { font-weight: 700; margin-right: .5rem; color: var(--heading); }
  }
}

/* ==========================================================================
   jQuery UI autocomplete skin — the admin and report pages still use jQuery UI 1.11 autocomplete for company / user /
   project look-ups. jQuery UI's own stylesheet is not loaded, so the menu and its screen-reader live region are styled here.
   ========================================================================== */
@layer components {
  .ui-helper-hidden-accessible { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .ui-autocomplete {
    position: absolute; top: 0; left: 0; z-index: 60; list-style: none; cursor: default;
    max-height: min(50dvh, 22rem); overflow-y: auto; overscroll-behavior: contain; padding: .35rem;
    background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: var(--r-md);
    box-shadow: var(--shadow-lg); font-size: var(--fs-sm);
    & .ui-menu-item { list-style: none; padding: .45rem .6rem; border-radius: var(--r-sm); cursor: pointer; line-height: 1.35; }
    & .ui-menu-item a { display: block; color: inherit; text-decoration: none; }
    & .text-muted { color: var(--muted); }
    & .ui-state-focus, & .ui-state-active { background: var(--primary-soft); color: var(--primary-ink); }
  }
}

/* ==========================================================================
   Meeting minutes (fireflies/): a few module rules. The review HTML stored with each minutes version keeps
   Renderer.cfc's Bootstrap 3 table and label classes, so they are styled here, inside the minutes panel only.
   ========================================================================== */
@layer components {
  /* the module's pages keep a readable measure (they were col-md-10 / col-lg-8) */
  .ff-page { max-width: 72rem;
    /* sub-headings inside a panel ("Add a rule", "Replace the key") and the minutes' section headings */
    & .panel-body h3 { font-size: var(--fs-md); }
    /* a bare control in a row of buttons (version picker, project picker) sizes to the row, not to 100% */
    & .row > :is(.input, .select) { width: auto; flex: 1 1 12rem; min-width: 0; }
    /* Open plus the Download HTML / PDF pair on one line in a table's actions cell (no wrap: the cell is sized to
       what it holds, so a wrapping group would spill out of it) */
    & .table .btn-group { display: inline-flex; flex-wrap: nowrap; vertical-align: middle; }
    /* row headings (a check, a vendor, a key version) read as the row's name, not as a column label */
    & .table tbody th { text-transform: none; letter-spacing: 0; font-size: inherit; color: var(--heading);
      background: none; white-space: normal; }
    & .table tbody tr:last-child th { border-bottom: 0; }
  }
  /* the Home / All minutes / Settings switch keeps its own width in the page's column */
  .ff-module-nav { align-self: flex-start; }
  /* setup checklist: a step's state text on its own line under the mark and the link */
  .list-group > li.ff-setup-step { flex-wrap: wrap; row-gap: .2rem;
    & > div { flex-basis: 100%; }
  }
  /* Settings, internal domains: a boxed list like the tables beside it */
  .list-group.ff-domain-list { border: 1px solid var(--border); border-radius: var(--r-md);
    & > li { padding: .4rem .5rem .4rem .85rem; }
  }
  /* Meeting controls: settings, review and export each keep their own task order. */
  #firefliesMeeting {
    container: ff-meeting / inline-size;
    & .ff-meeting-settings, & .ff-minutes-controls {
      display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-4);
      align-items: start; padding: var(--space-4);
    }
    & .ff-control-group { display: grid; gap: var(--space-3); min-inline-size: 0; }
    & .ff-control-heading, & .ff-control-group h2 { font-size: var(--fs-md); color: var(--heading); }
    & .ff-control-group .field { min-inline-size: 0; gap: var(--space-1); }
    & .ff-control-group .field > label { font-size: var(--fs-sm); }
    & .ff-control-group .select { min-inline-size: 0; inline-size: 100%; min-block-size: 2.5rem; }
    & .ff-project-form, & .ff-version-picker, & .ff-export-form {
      display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--space-2);
      align-items: end; min-inline-size: 0;
    }
    & .ff-project-form:has(.ff-project-template-field) > .field:first-of-type { grid-column: 1 / -1; }
    & .ff-project-form > .ff-form-status { grid-column: 1 / -1; }
    & .ff-control-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; }
    & .ff-control-group .btn { min-block-size: 2.5rem; }
    /* Keep empty live regions available to assistive technology without reserving a grid row. */
    & .ff-control-group .ff-form-status:empty {
      position: absolute; inline-size: 1px; block-size: 1px;
      overflow: hidden; clip-path: inset(50%); white-space: nowrap;
    }
    & .ff-meeting-status, & .ff-download-controls {
      border-block-start: 1px solid var(--border); padding-block-start: var(--space-4);
    }
    & .ff-meeting-status p { overflow-wrap: anywhere; }
  }
  @container ff-meeting (width >= 44rem) {
    #firefliesMeeting {
      & .ff-meeting-settings { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: var(--space-5); }
      & .ff-minutes-controls { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--space-5); }
      & .ff-meeting-status, & .ff-download-controls {
        border-block-start: 0; padding-block-start: 0;
        border-inline-start: 1px solid var(--border); padding-inline-start: var(--space-5);
      }
    }
  }
  @container ff-meeting (width >= 64rem) {
    #firefliesMeeting .ff-project-form:has(.ff-project-template-field) {
      grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
      & > .field:first-of-type { grid-column: auto; }
    }
  }
  #ff-minutes-panel {
    & .ff-minutes { display: grid; gap: var(--space-5); }
    & .ff-minutes-section { display: grid; gap: .6rem; }
    & .ff-minutes-topic { font-size: var(--fs-sm); margin-top: .4rem; }
    & .ff-minutes :is(ul, ol) { padding-left: 1.4rem; display: grid; gap: .3rem; }
    & .text-muted { color: var(--muted); }
    & .text-warning { color: var(--warning-ink); }
    & .table-responsive { overflow-x: auto; }
    & .table-condensed { --pad-cell: .45rem .6rem; }
    & .table-bordered :is(th, td) { border: 1px solid var(--border); }
    /* the minutes read as a document: their table headings keep their case */
    & .ff-minutes .table th { text-transform: none; letter-spacing: 0; font-size: inherit; color: var(--heading); }
    & .label { display: inline-flex; align-items: center; padding: .1rem .45rem; border-radius: var(--r-pill);
      font-size: var(--fs-xs); font-weight: 700; background: var(--surface-2); color: var(--muted); }
    & .label-warning { background: var(--warning-bg); color: var(--warning-ink); }
  }
  /* Edit: each list a fieldset of rows, each row a small box of fields */
  .ff-edit-list { display: grid; gap: .75rem;
    & > legend { font-size: var(--fs-md); font-weight: 700; color: var(--heading); margin-bottom: .5rem; }
    & > .ff-edit-add { justify-self: start; }
  }
  .ff-edit-rows { display: grid; gap: .75rem; }
  .ff-edit-row { display: grid; gap: .6rem; padding: .85rem 1rem; border: 1px solid var(--border); border-radius: var(--r-md);
    background: var(--surface-2);
    & .textarea { min-height: 4.5rem; }
  }
  .ff-edit-row-tools > .field { flex: 0 0 7rem; }
  /* Evidence: the quoted transcript lines under an item */
  .ff-evidence-lines { display: grid; gap: .3rem; font-size: var(--fs-sm); }
}

/* ==========================================================================
   Public document (share page): photo showcase + document rail
   ========================================================================== */
@layer components {
  .showcase {
    --rail: clamp(360px, 32vw, 460px);
    display: grid; grid-template-columns: minmax(0, 1fr) var(--rail);
    min-block-size: calc(100dvh - var(--header-h, 58px));
    @media (width < 960px) { grid-template-columns: minmax(0, 1fr); }
  }
  .stage {
    position: sticky; top: var(--header-h, 58px); block-size: calc(100dvh - var(--header-h, 58px));
    overflow: hidden; background: #2b2e30; isolation: isolate; color: #fff;
    @media (width < 960px) { position: relative; top: 0; block-size: min(72svh, 640px); }
  }
  .stage-slide {
    position: absolute; inset: 0; opacity: 0; transition: opacity 1.2s var(--ease-out);
    & img { width: 100%; height: 100%; object-fit: cover; scale: 1.08; transition: scale 9s linear; }
    &.is-on { opacity: 1; z-index: 1; & img { scale: 1; } }
  }
  @media (prefers-reduced-motion: reduce) { .stage-slide img { transition: none; scale: 1; } }
  .stage-shade { position: absolute; inset: 0; z-index: 2; pointer-events: none;
    background: linear-gradient(to top, rgb(10 12 14 / .78) 0%, rgb(10 12 14 / .35) 28%, transparent 55%), linear-gradient(to bottom, rgb(10 12 14 / .35), transparent 18%);
  }
  .stage-top { position: absolute; z-index: 3; inset: 1.25rem 1.25rem auto; display: flex; gap: .5rem; align-items: center; justify-content: space-between; }
  .stage-tag { display: inline-flex; align-items: center; gap: .45rem; padding: .35rem .8rem; border-radius: var(--r-pill);
    background: rgb(15 23 42 / .55); backdrop-filter: blur(8px); font-size: var(--fs-xs); font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
    & i { color: var(--archinet-yellow); }
  }
  .stage-cap { position: absolute; z-index: 3; inset: auto 0 0; padding: clamp(1.25rem, 3vw, 2.5rem); display: grid; gap: .6rem; max-width: 60ch;
    animation: rise var(--t-slow) var(--ease-out) both;
    & .eyebrow { font-size: var(--fs-xs); font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--archinet-yellow); }
    & h2 { font-size: clamp(1.6rem, 1rem + 2.2vw, 2.75rem); font-weight: 300; line-height: 1.1; color: #fff; text-wrap: balance; }
    & p { font-size: var(--fs-sm); color: rgb(255 255 255 / .85); }
    & .credit { display: inline-flex; align-items: center; gap: .45rem; font-size: var(--fs-xs); color: rgb(255 255 255 / .85);
      & a { color: #fff; text-decoration: underline; text-underline-offset: 2px; } }
    & .btn { justify-self: start; --_bg: rgb(255 255 255 / .14); --_fg: #fff; --_bd: rgb(255 255 255 / .35); backdrop-filter: blur(8px);
      &:hover { --_bg: #fff; --_fg: #111; } }
  }
  .stage-dots { display: flex; gap: .4rem;
    & button { inline-size: 28px; block-size: 4px; border-radius: 2px; border: 0; padding: 0; cursor: pointer; background: rgb(255 255 255 / .35); position: relative; overflow: hidden; }
    & button::after { content: ""; position: absolute; inset: 0; background: #fff; scale: 0 1; transform-origin: left; }
    & button.is-on::after { animation: dotfill var(--dur, 7s) linear forwards; }
    & button.is-done::after { scale: 1 1; }
  }
  /* hover or keyboard focus on the photo holds the slideshow, and its progress dot with it */
  .stage.is-held .stage-dots button.is-on::after { animation-play-state: paused; }
  @keyframes dotfill { to { scale: 1 1; } }
  .stage-nav { display: flex; gap: .35rem;
    & button { inline-size: 36px; block-size: 36px; border-radius: 50%; border: 1px solid rgb(255 255 255 / .35); background: rgb(15 23 42 / .45); color: #fff; cursor: pointer; backdrop-filter: blur(8px); transition: background var(--t-fast);
      &:hover { background: rgb(15 23 42 / .75); } }
  }

  .rail { display: flex; flex-direction: column; gap: var(--space-4); padding: var(--space-5); background: var(--bg); border-left: 1px solid var(--border);
    @media (width < 960px) { border-left: 0; }
    & > * { animation: rise var(--t-slow) var(--ease-out) both; animation-delay: calc(var(--i, 0) * 70ms); }
    & .crumbs { margin: 0; }
  }
  .doc-card { display: grid; gap: var(--space-4); padding: var(--space-5); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); }
  .file-chip { display: inline-flex; align-items: center; gap: .5rem; justify-self: start; padding: .3rem .7rem .3rem .45rem; border-radius: var(--r-pill); background: var(--danger-bg); color: var(--danger); font-size: var(--fs-xs); font-weight: 600;
    & i { font-size: 1rem; }
    & .muted { font-weight: 400; }
  }
  .doc-card h1 { font-size: var(--fs-xl); font-weight: 600; line-height: 1.25; color: var(--heading); text-wrap: pretty; }
  .file-name { font: 500 var(--fs-xs)/1.5 var(--mono); color: var(--muted); overflow-wrap: anywhere; padding: .55rem .7rem; border-radius: var(--r-sm); background: var(--surface-2); border: 1px solid var(--border); }
  .share-row { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap;
    & .label { font-size: var(--fs-xs); color: var(--muted); margin-right: auto; }
  }
  .own-card { position: relative; overflow: hidden; display: grid; gap: .6rem; padding: var(--space-5); border-radius: var(--r-lg); color: #fff;
    background: radial-gradient(120% 90% at 100% 0%, color-mix(in oklch, var(--archinet-yellow) 22%, transparent), transparent 60%), var(--archinet-gray);
    & .own { font-size: var(--fs-2xl); font-weight: 300; line-height: 1; }
    & .tag { font-size: var(--fs-lg); font-weight: 600; color: var(--archinet-yellow); line-height: 1.25; }
    & p { font-size: var(--fs-sm); color: rgb(255 255 255 / .85); }
    & .btn { justify-self: start; --_bg: #fff; --_fg: #1f2326; --_bd: transparent; &:hover { --_bg: var(--archinet-yellow); } }
  }
  .ad-note { display: flex; align-items: center; gap: .6rem; font-size: var(--fs-xs); color: var(--muted); padding: .75rem .9rem; border: 1px dashed var(--border-strong); border-radius: var(--r-md);
    & a { font-weight: 600; margin-left: auto; white-space: nowrap; }
  }
  /* the document viewer (the public page's View File and the document page's Explore PDF, ui2/inc_pdf_viewer.cfm)
     uses nearly the whole window (all of it on phones) */
  dialog.viewer { inline-size: min(100% - 2rem, 1600px); block-size: calc(100dvh - 2rem); max-inline-size: none; max-block-size: none;
    @media (width < 640px) { inline-size: 100%; block-size: 100dvh; border: 0; border-radius: 0; }
    & .panel-body { flex: 1; padding: 0; min-block-size: 0; }
    &[open] { display: flex; flex-direction: column; }
    /* scrolling the pages never scrolls the document page underneath, not from the backdrop either */
    &:modal { overscroll-behavior: contain; }
    &::backdrop { overflow: hidden; overscroll-behavior: contain; }
    & .viewer-frame { flex: 1; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); font: 500 var(--fs-sm) var(--mono); min-block-size: 0;
      /* the PDF stage (pdf.js's pages) and videos fill the frame; image previews keep their own size */
      & .pdf-stage, & video { grid-area: 1 / 1; place-self: stretch; inline-size: 100%; block-size: 100%; min-block-size: 0; }
      /* "Loading…" (with the bytes so far) / "couldn't load" paints above the PDF stage while it shows: the stage is the
         later sibling with an opaque surround and would cover it; a successful load hides the status, a failed one the stage */
      & .viewer-status { grid-area: 1 / 1; z-index: 1; display: grid; justify-items: center; gap: .75rem; padding: 1.5rem; text-align: center; font-family: var(--font); }
      & .viewer-status[hidden], & .pdf-stage[hidden] { display: none; }
      & video { background: #000; }
      & .thumb { max-inline-size: 100%; }
    }
    & .panel-head h3 { flex: 1; min-inline-size: 0; overflow-wrap: anywhere; }
    /* the PDF toolbar: pages and zoom (js/archinet.pdfviewer.js binds the controls) */
    & .viewer-tools { display: flex; align-items: center; flex-wrap: wrap; gap: .35rem; padding: .4rem .75rem; border-bottom: 1px solid var(--border); background: var(--surface); font-size: var(--fs-sm); font-variant-numeric: tabular-nums;
      &[hidden] { display: none; }
      & .viewer-pages { display: inline-flex; align-items: center; gap: .3rem; color: var(--muted); }
      & .viewer-pages .input { inline-size: 4.5rem; min-height: 32px; padding: .2rem .4rem; text-align: center; }
      & .viewer-gap { flex: 1; }
      & .viewer-zoom { min-inline-size: 3.5rem; text-align: center; color: var(--muted); }
      & .btn { min-height: 32px; }
    }
  }
}

/* The pdf.js stage inside dialog.viewer. markback/js/pdf-viewer.js injects its own unlayered <style> when the viewer is
   built (after this sheet in document order), so these rules stay outside @layer and win on specificity: the surround
   follows the theme, the loading and error overlays are the dialog's own status line instead, and the pages are a
   2D surface (a 36 x 48 sheet scrolls sideways without swiping the browser back). */
dialog.viewer .pdf-stage.pdf-viewer-container { background-color: var(--surface-2); overscroll-behavior: contain; scrollbar-gutter: stable; /* a fit that adds or removes the scrollbar must not change the width it was fitted to (ResizeObserver loop) */ }
dialog.viewer .pdf-stage.pdf-viewer-container:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
dialog.viewer .pdf-stage .pdf-loading-overlay, dialog.viewer .pdf-stage .pdf-error-overlay { display: none !important; }
dialog.viewer .pdf-stage .pdf-page-wrapper { box-shadow: var(--shadow-lg); }
/* the renderer's password prompt (a light-only stylesheet of its own) follows the theme, like Markback's does */
dialog.pdf-password-dialog { margin: auto; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); font-family: var(--font); }
dialog.pdf-password-dialog::backdrop { background: rgb(15 23 42 / .45); backdrop-filter: blur(4px); }
dialog.pdf-password-dialog .pdf-password-form h3 { color: var(--heading); }
dialog.pdf-password-dialog .pdf-password-message { color: var(--muted); }
dialog.pdf-password-dialog .pdf-password-input { background: var(--surface); color: var(--text); border-color: var(--border); }
dialog.pdf-password-dialog .pdf-password-buttons button { background: var(--surface-2); color: var(--text); border-color: var(--border); }
dialog.pdf-password-dialog .pdf-password-buttons .pdf-password-ok { background: var(--primary) !important; border-color: var(--primary) !important; color: #fff; }

/* Native autocomplete and progressive tables. All table inputs stay in their form. */
@layer components {
  .archinet-autocomplete { position: relative; min-width: 0; flex: 1; width: 100%; }
  .archinet-suggestions {
    position: absolute; z-index: 40; inset-inline: 0; top: 100%;
    max-height: 18rem; overflow-y: auto; margin: .25rem 0 0; padding: .25rem;
    list-style: none; color: var(--heading); background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--r-sm); box-shadow: 0 8px 24px #0002;
    & [role="option"] { padding: .65rem .75rem; border-radius: var(--r-sm); cursor: pointer; overflow-wrap: anywhere; }
    & [role="option"]:hover, & [aria-selected="true"] { background: var(--primary-soft); color: var(--primary-ink); }
    & small { display: block; margin-top: .2rem; color: var(--muted); }
  }
  .archinet-table-controls {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
    gap: .75rem; margin-block: .75rem; color: var(--muted); font-size: var(--fs-sm);
    & label { display: flex; align-items: center; gap: .5rem; }
    & .input { width: min(16rem, 60vw); }
    & .select { width: auto; }
  }
  .archinet-table-pages { display: flex; align-items: center; flex-wrap: wrap; gap: .65rem; }
  .archinet-table-sort {
    appearance: none; border: 0; background: none; color: inherit; font: inherit;
    text-align: inherit; text-transform: inherit; letter-spacing: inherit; padding: .25rem 0; cursor: pointer;
    &::after { content: ' ↕'; opacity: .5; }
    &[data-direction="asc"]::after { content: ' ↑'; opacity: 1; }
    &[data-direction="desc"]::after { content: ' ↓'; opacity: 1; }
  }
  .archinet-table-empty { text-align: center; color: var(--muted); }
}

/* Internal report previews share the native shell; email markup stays separate. */
@layer components {
  .task-preview {
    & .task-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr)); gap: var(--space-4); align-items: start; }
    & .task-grid > * { min-width: 0; }
    & .task-filter-list, & .task-filter-options { list-style: none; margin: 0; padding: 0; }
    & .task-filter-options { margin-top: .5rem; padding: .5rem; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface); }
    & .task-filter-options a { display: block; padding: .35rem .5rem; }
    & .task-filter-options .active > a { font-weight: 700; background: var(--primary-soft); color: var(--primary-ink); }
    & .task-filter-options .divider { border-top: 1px solid var(--border); margin-block: .35rem; }
    & .task-filter > summary { cursor: pointer; }
    & .task-filter > summary::after { content: ' ▾'; }
    & .task-filter[open] > summary::after { content: ' ▴'; }
    & .task-list-item { padding-block: .25rem; }
  }
}

/* ==========================================================================
   Autodesk pages (autodesk/UI-BRIEF.md): the access bar, identity statements, one-level ACC lists with file rows,
   the copy destination and its dropzone, the send tray and the project documents table.
   ========================================================================== */
@layer components {
  /* Module: Autodesk (autodesk/) */
  .adsk-page { display: flex; flex-direction: column; gap: var(--space-5); }
  .adsk-page .crumbs { margin-bottom: 0; }
  .adsk-lede { max-inline-size: 70ch; color: var(--text); }
  .adsk-page .fail { color: var(--danger); }
  .adsk-wrap { overflow-wrap: anywhere; }
  /* the Thumb Rule: a disclosure that is the only way to a choice (the member, the copy destination, an error's
     Details) is 40px tall; inline ones keep reading as part of their sentence */
  .adsk-page .mini-details > summary { min-block-size: 40px; }
  .adsk-member .mini-details > summary, .adsk-dest .mini-details > summary { padding-inline: .25rem; }

  /* Identity statement: a 40px icon tile, "Viewing as <name>", the sub-line and the capability badge */
  .adsk-tile {
    inline-size: 40px; block-size: 40px; flex: none; display: grid; place-items: center;
    border-radius: var(--r-sm); background: var(--surface-2); color: var(--primary); font-size: 1.05rem;
    &.is-quiet { color: var(--muted); }
  }
  .adsk-who {
    display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: .5rem .85rem; align-items: center;
    & .adsk-who-text { display: grid; gap: .15rem; min-width: 0; }
    & .adsk-who-name { color: var(--heading); overflow-wrap: anywhere; line-height: 1.35;
      & strong { font-weight: 700; }
    }
    & .adsk-who-sub { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .6rem; font-size: var(--fs-sm); color: var(--muted); overflow-wrap: anywhere; }
    & .adsk-who-end { justify-self: end; display: flex; gap: .5rem; flex-wrap: wrap; }
  }
  .adsk-can { list-style: none; display: grid; gap: .4rem; font-size: var(--fs-sm);
    & li { display: flex; align-items: baseline; gap: .6rem; }
    & li > i { inline-size: 1.1em; flex: none; text-align: center; color: var(--muted); }
  }

  /* The access bar: switch, statement, offers and the x-user-id member line */
  .adsk-access { container-type: inline-size;
    & > .panel-body { gap: var(--space-4); }
    & .adsk-offer { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; font-size: var(--fs-sm); color: var(--text); }
    & .adsk-member { font-size: var(--fs-sm); color: var(--text); overflow-wrap: anywhere;
      & strong { color: var(--heading); }
      & .mini-details { display: inline; }
      & .mini-details[open] { display: block; }
      & form { display: grid; gap: .5rem; max-inline-size: 100%; }
      & .select { max-inline-size: 100%; }
    }
  }
  .adsk-switch {
    max-inline-size: 100%; align-self: flex-start;
    & a { min-height: 40px; min-width: 0; }
    & .adsk-seg-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-inline-size: 18rem; }
  }
  @container (width < 36rem) {
    .adsk-switch { display: flex; inline-size: 100%; align-self: stretch;
      & a { flex: 1 1 0; min-height: 44px; justify-content: center; padding-inline: .75rem; }
    }
    .adsk-who { grid-template-columns: 40px minmax(0, 1fr);
      & .adsk-who-end { grid-column: 1 / -1; justify-self: stretch; & > *, & .btn { flex: 1; } }
    }
  }

  /* Start page: the two doors side by side, stacking under 40rem of their own width */
  .adsk-doors { container-type: inline-size; display: grid; gap: var(--space-3); }
  .adsk-door-grid { display: grid; gap: var(--space-4) var(--space-5); grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: stretch;
    &:has(> :only-child) { grid-template-columns: minmax(0, 40rem); }
    & > .panel { display: flex; flex-direction: column; }
    & > .panel > .panel-body { flex: 1; }
    & .adsk-door-actions { margin-top: auto; display: flex; flex-wrap: wrap; gap: .5rem; padding-top: var(--space-2); }
    & .adsk-door-actions form { display: contents; }
  }
  @container (width < 40rem) { .adsk-door-grid, .adsk-door-grid:has(> :only-child) { grid-template-columns: minmax(0, 1fr); } }

  /* Start page: the documents table stacks as cards under 640px of its own width */
  .adsk-doc-table {
    & .name { overflow-wrap: anywhere; min-inline-size: 12rem;
      & a { font-weight: 700; color: var(--heading); &:hover { color: var(--primary-ink); } }
      & small { display: block; color: var(--muted); font-size: var(--fs-xs); }
    }
    & td small { display: block; }
    & .adsk-doc-actions { display: flex; gap: .5rem; justify-content: flex-end; }
    & .adsk-doc-actions form { display: contents; }
    & .badge { white-space: nowrap; }
  }
  @container (width < 640px) {
    .adsk-doc-table, .adsk-doc-table tbody, .adsk-doc-table tr, .adsk-doc-table td { display: block; }
    .adsk-doc-table thead { display: none; }
    .adsk-doc-table tr { padding: .85rem 1rem; border-bottom: 1px solid var(--border); display: grid; gap: .35rem; }
    .adsk-doc-table tbody tr:last-child { border-bottom: 0; }
    .adsk-doc-table td { padding: 0; border: 0; }
    .adsk-doc-table .name { min-inline-size: 0; }
    .adsk-doc-table td[data-label]::before { content: attr(data-label) ": "; font-weight: 700; color: var(--muted); }
    .adsk-doc-table td.actions { inline-size: auto; text-align: start; white-space: normal; padding-top: .35rem; }
    .adsk-doc-table .adsk-doc-actions { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); & .btn { inline-size: 100%; } }
  }
  .adsk-pager { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; padding: .85rem 1.25rem; border-top: 1px solid var(--border); font-size: var(--fs-sm); color: var(--muted); font-variant-numeric: tabular-nums; }

  /* ACC browser: one level at a time, as a list of grid rows (icon, name and meta, actions) */
  .adsk-list { list-style: none; container-type: inline-size; }
  .adsk-item {
    position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: .5rem 1rem; align-items: center;
    padding: .75rem 1.25rem; border-top: 1px solid var(--border); transition: background var(--t-fast), box-shadow var(--t-fast);
    &:first-child { border-top: 0; }
    &:hover { background: color-mix(in oklch, var(--primary-soft) 35%, transparent); }
    &[hidden] { display: none; }
    &.is-over { background: var(--primary-soft); box-shadow: inset 0 0 0 1px var(--primary); }
    &[draggable="true"] { cursor: grab; }
    &.is-dragging { opacity: .55; }
    /* the drag image (acc-browser.js): the row's tile and name on a floating sheet, placed off screen while the browser takes it */
    &.adsk-drag-ghost {
      position: fixed; inset-block-start: -1000px; inset-inline-start: 0;
      grid-template-columns: auto minmax(0, 1fr); inline-size: max-content; max-inline-size: min(28rem, 80vw);
      padding: .6rem .9rem; border: 1px solid var(--border); border-radius: var(--r-md);
      background: var(--surface); box-shadow: var(--shadow-lg); pointer-events: none;
    }
    & .adsk-lead { display: flex; align-items: center; gap: .4rem; }
    & .adsk-grip { color: var(--muted); font-size: .9rem; inline-size: 1rem; text-align: center; }
    & .adsk-main { display: grid; gap: .1rem; min-width: 0; }
    & .adsk-name { font-weight: 700; color: var(--heading); overflow-wrap: anywhere; line-height: 1.35; }
    & a.adsk-name { &:hover { color: var(--primary-ink); } }
    /* rows that only navigate: the whole row is the link's target */
    & a.adsk-go::after { content: ""; position: absolute; inset: 0; }
    & .adsk-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .15rem .75rem; font-size: var(--fs-sm); color: var(--muted); font-variant-numeric: tabular-nums; }
    & .adsk-actions { display: flex; gap: .5rem; flex-wrap: wrap; justify-content: flex-end; position: relative; }
    & .adsk-progress { grid-column: 2 / -1; }
  }
  @container (width < 640px) {
    .adsk-item .adsk-actions { grid-column: 1 / -1; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); & .btn { inline-size: 100%; } }
    .adsk-item .adsk-progress { grid-column: 1 / -1; }
  }
  @media (pointer: coarse) { .adsk-grip { display: none !important; } }

  /* the file-type tile: the extension in the mono label face, as the document thumbnails show it */
  .adsk-ftile {
    inline-size: 40px; block-size: 40px; flex: none; display: grid; place-items: center; overflow: hidden;
    border-radius: var(--r-sm); border: 1px solid var(--border); background: var(--surface-2);
    font: 500 .6875rem/1 var(--mono); color: var(--muted); text-transform: uppercase; letter-spacing: .02em;
  }

  /* inline copy progress (a row, the queue) */
  .adsk-progress { display: grid; gap: .25rem; font-size: var(--fs-xs); color: var(--muted); overflow-wrap: anywhere;
    & progress { block-size: 6px; }
    & .ok { color: var(--success); font-weight: 700; }
    & .fail { color: var(--danger); font-weight: 700; }
  }

  /* the project filter */
  .adsk-filter { padding: .85rem 1.25rem; border-bottom: 1px solid var(--border); display: grid; gap: .4rem;
    & .input { max-inline-size: 28rem; }
    & .hint { font-size: var(--fs-xs); color: var(--muted); font-variant-numeric: tabular-nums; }
  }
  .adsk-empty { padding: 1.25rem; display: grid; gap: .75rem; justify-items: start; color: var(--text); }

  /* Copy to Archinet: the destination panel sits between the main panel's stack and the admin/technical stack in the
     markup, so below 1024px the files come first and reading order = visual order; from 1024px it is the second
     column beside both stacks (the flexible second row takes any extra height of a tall panel, below everything) */
  .adsk-layout {
    row-gap: var(--space-4);
    @media (width >= 1024px) {
      grid-template-rows: auto 1fr;
      & > .stack { grid-column: 1; }
      & > .aside { grid-column: 2; grid-row: 1 / span 2; }
    }
  }
  .adsk-pull { gap: .5rem; }
  .adsk-dest {
    scroll-margin-top: calc(var(--header-h, 110px) + 1rem);
    /* folded by the script on load (a phone with no destination yet): no closing animation */
    &.is-instant::details-content { transition: none; }
    & .adsk-dest-line { overflow-wrap: anywhere; font-size: var(--fs-sm);
      & strong { color: var(--heading); }
    }
    & form { display: grid; gap: var(--space-3); }
    & .field .select, & .field .input { inline-size: 100%; }
    & .adsk-drop { padding: 1.25rem 1rem; cursor: default; font-size: var(--fs-sm); overflow-wrap: anywhere;
      & i { font-size: 1.4rem; }
      /* a file row is being dragged: the border shows where to drop it (.is-over then adds the fill) */
      &.is-armed { border-color: var(--primary); }
      &[data-ready="false"]:not(.is-over, .is-armed) { &:hover { border-color: var(--border-strong); background: var(--surface-2); & i { translate: none; } } & i { color: var(--muted); } }
    }
    & .queue li { grid-template-columns: minmax(0, 1fr); gap: .35rem; }
    & .queue .name { white-space: normal; overflow-wrap: anywhere; }
    & .adsk-note { font-size: var(--fs-sm); &:empty { display: none; } }
    & .queue:empty { display: none; }
  }
  /* the start page's client and project pickers keep a readable width on a wide page */
  .adsk-pickers > .field { max-inline-size: 28rem; }
  /* an alert's Details keeps the alert's own ink (a muted grey on a tinted wash would fail contrast) */
  .adsk-page .alert .mini-details { & > summary, & > :not(summary) { color: inherit; } }

  /* Send an Archinet document to ACC: the tray at the top of the main panel */
  .adsk-tray {
    position: sticky; top: calc(var(--header-h, 110px) + .5rem); z-index: 5;
    display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .75rem 1rem; align-items: center;
    padding: .85rem 1.25rem; background: var(--surface); border-bottom: 1px solid var(--border);
    & .adsk-tray-text { display: grid; gap: .5rem; min-width: 0; font-size: var(--fs-sm); }
    & .adsk-tray-actions { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: flex-end; }
    & .adsk-tray-actions form { display: contents; }
    /* a finished send: "Send it again" is a plain link beside Done, never a second button */
    & .adsk-tray-again { align-self: center; padding: .6rem .25rem; font-size: var(--fs-sm); text-align: center; }
  }
  .adsk-chip {
    display: inline-flex; align-items: center; gap: .6rem; max-inline-size: 100%; justify-self: start;
    padding: .25rem .75rem .25rem .25rem; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface-2);
    & .adsk-ftile { inline-size: 32px; block-size: 32px; background: var(--surface); }
    & .adsk-chip-name { font-weight: 700; color: var(--heading); overflow-wrap: anywhere; min-width: 0; }
    &[draggable="true"] { cursor: grab; }
    &[draggable="true"]:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); }
  }
  @container (width < 640px) {
    .adsk-tray { grid-template-columns: minmax(0, 1fr);
      & .adsk-tray-actions { justify-content: stretch; & > *, & .btn { flex: 1; } }
    }
  }
  .adsk-main-panel { container-type: inline-size; }

  /* Watch this folder and Technical details: details panels; their summaries carry a status badge */
  .adsk-page details.panel > summary.panel-head .badge { flex: none; }
  .adsk-tech {
    & .dl-grid { font-size: var(--fs-sm); & dd { font-family: var(--mono); font-size: .8125rem; } }
    & pre { white-space: pre-wrap; overflow-wrap: anywhere; max-block-size: 20rem; overflow: auto;
      padding: .75rem; border-radius: var(--r-sm); background: var(--surface-2); border: 1px solid var(--border); color: var(--text); }
    & .mini-details > :not(summary) { color: var(--text); }
    & h3 { font-size: var(--fs-sm); }
  }
  .adsk-page .table-wrap { border-radius: var(--r-md); }
  .adsk-page .panel > .table-wrap { border-radius: 0; }
  .adsk-page .panel-body > .table-wrap { border: 1px solid var(--border); }
  .adsk-page .table td { overflow-wrap: anywhere; }

  /* ---- PR 2: the Viewer, View in Autodesk, model data, sheet sets and issues ---- */
  /* the title row: the page title (a file name may be long) and its Back link */
  .adsk-titlebar { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1rem;
    & .page-title { flex: 1 1 18rem; min-width: 0; overflow-wrap: anywhere; }
    & > .btn { flex: none; }
  }
  .adsk-page .panel-head h2 .adsk-wrap { min-width: 0; }
  /* one identity line (inc_access_note.cfm): the compact sibling of the access bar's statement */
  .adsk-who.is-compact { grid-template-columns: 32px minmax(0, 1fr) auto; gap: .25rem .7rem;
    & .adsk-tile { inline-size: 32px; block-size: 32px; font-size: .9rem; }
    & .adsk-who-name { font-size: var(--fs-sm); }
    & .adsk-who-sub { font-size: var(--fs-xs); }
  }
  .adsk-notes { display: grid; gap: var(--space-3); }
  /* a row of actions: buttons and the forms that hold them sit side by side and wrap */
  .adsk-actionbar { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem;
    & form { display: contents; }
    /* a long label wraps inside its panel instead of running past it on a phone */
    & .btn { white-space: normal; text-align: start; max-inline-size: 100%; }
  }
  .adsk-hint { font-size: var(--fs-xs); color: var(--muted); max-inline-size: 70ch; }

  /* the Viewer: the access line and status above a box that keeps a usable height on a phone */
  .adsk-viewer-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 1rem;
    & .adsk-who { flex: 1 1 20rem; }
  }
  .adsk-viewer-status { font-size: var(--fs-sm); color: var(--muted); overflow-wrap: anywhere; }
  .adsk-viewer {
    position: relative; inline-size: 100%; block-size: 75dvh; min-block-size: 24rem;
    border: 1px solid var(--border); border-radius: var(--r-lg); overflow: clip; background: var(--surface-2); box-shadow: var(--shadow-sm);
    & > #apsViewer { position: absolute; inset: 0; }
    /* phones: the box runs edge to edge (the page's 1rem gutters) */
    @media (width < 640px) { margin-inline: -1rem; inline-size: auto; border-radius: 0; border-inline: 0; }
  }
  /* waiting for Autodesk: an indeterminate bar (the native one is hidden by the stylesheet's progress styling) */
  .adsk-wait { display: grid; gap: .75rem; max-inline-size: 40rem;
    & h2 { font-size: var(--fs-md); font-weight: 700; color: var(--heading); }
  }
  .adsk-page progress:not([value]) {
    background: linear-gradient(90deg, transparent 0 35%, var(--primary) 35% 65%, transparent 65%) 0 0 / 250% 100% no-repeat, var(--surface-2);
    animation: adsk-indeterminate 1.6s linear infinite;
    &::-webkit-progress-bar { background: transparent; }
    &::-moz-progress-bar { background: transparent; }
    @media (prefers-reduced-motion: reduce) { animation: none; background-position: 50% 0; }
  }
  @keyframes adsk-indeterminate { from { background-position: 100% 0; } to { background-position: 0% 0; } }

  /* the file a page works on: its type tile, name and meta line, and a state badge */
  .adsk-file { container-type: inline-size; }
  .adsk-file-head { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: .5rem .85rem; align-items: center;
    & .adsk-file-name { font-size: var(--fs-md); font-weight: 700; color: var(--heading); overflow-wrap: anywhere; line-height: 1.35; }
    & .adsk-file-meta { display: flex; flex-wrap: wrap; gap: .15rem .75rem; font-size: var(--fs-sm); color: var(--muted); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
    & > .badge { justify-self: end; white-space: nowrap; }
  }
  @container (width < 30rem) {
    .adsk-file-head { grid-template-columns: 40px minmax(0, 1fr);
      & > .badge { grid-column: 2; justify-self: start; }
    }
  }

  /* View in Autodesk's confirmation card keeps a readable width */
  .adsk-confirm { max-inline-size: 48rem; }

  /* model data: the counts as one line of links to their sections */
  .adsk-summary { display: grid; gap: .5rem; }
  .adsk-counts { list-style: none; display: flex; flex-wrap: wrap; gap: .25rem 1.25rem; font-size: var(--fs-sm); font-variant-numeric: tabular-nums;
    & strong { color: var(--heading); }
  }
  .adsk-page details.panel { scroll-margin-top: calc(var(--header-h, 110px) + 1rem); }
  .adsk-page .table .num { text-align: end; }
  /* wide tables (rooms, areas) keep readable columns and scroll sideways inside their panel on a phone */
  .adsk-wide { min-inline-size: 48rem; }
  .adsk-page .adsk-wide td { overflow-wrap: normal; }
  /* a long table scrolls inside its panel with the header kept in view; keyboard users scroll it too (tabindex) */
  .adsk-scroll { max-block-size: 32rem; overflow: auto;
    & thead { position: sticky; inset-block-start: 0; z-index: 1; }
    &:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
  }
  /* on a phone, a wide table says that more columns sit to the right */
  .adsk-scroll-hint { display: none; }
  @media (width < 640px) { .adsk-scroll-hint { display: block; } }
  /* tables of a few columns stack as rows of labelled lines under 640px of their own width (responsive-table guide) */
  @container (width < 640px) {
    .adsk-stack, .adsk-stack tbody, .adsk-stack tr, .adsk-stack td { display: block; }
    .adsk-stack thead { display: none; }
    .adsk-stack tr { padding: .75rem 1rem; border-bottom: 1px solid var(--border); display: grid; gap: .25rem; }
    .adsk-stack tbody tr:last-child { border-bottom: 0; }
    .adsk-stack td { padding: 0; border: 0; }
    .adsk-page .adsk-stack td.num { text-align: start; }
    .adsk-stack td[data-label]::before { content: attr(data-label) ": "; font-weight: 700; color: var(--muted); }
    .adsk-stack td[data-label]:empty { display: none; }
    .adsk-stack td.adsk-cell-title { font-weight: 700; color: var(--heading); }
  }

  /* sheet sets: the four steps in a row (one column when narrow); the current one is marked, done ones carry a check */
  .adsk-run { container-type: inline-size; }
  .steps.adsk-steps { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .5rem 1rem;
    & > li { display: flex; align-items: center; gap: .6rem; min-width: 0; color: var(--muted); }
    & > li::before { content: none; }
    & .adsk-step-mark { inline-size: 28px; block-size: 28px; flex: none; border-radius: 50%; display: grid; place-items: center;
      font-size: var(--fs-xs); font-weight: 700; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
    & > li.is-done .adsk-step-mark { background: var(--primary-soft); color: var(--primary-ink); border-color: transparent; }
    & > li[aria-current="step"] { color: var(--heading); font-weight: 700;
      & .adsk-step-mark { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
    }
    & > li.is-failed .adsk-step-mark { background: var(--danger-bg); color: var(--danger); border-color: transparent; }
  }
  @container (width < 36rem) { .steps.adsk-steps { grid-template-columns: minmax(0, 1fr); } }
  .adsk-result { display: grid; gap: var(--space-3); max-inline-size: 40rem;
    & .field .select, & .field .input { inline-size: 100%; }
  }

  /* issues: the link panel's danger sub-area, the member picker and the issue rows */
  .adsk-danger { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem 1rem;
    padding: .85rem 1rem; border-radius: var(--r-md); border: 1px solid color-mix(in oklab, var(--danger) 35%, var(--border));
    background: color-mix(in oklab, var(--danger-bg) 55%, var(--surface)); font-size: var(--fs-sm);
    & p { flex: 1 1 18rem; color: var(--text); }
    & form { display: contents; }
  }
  .adsk-tabs .tab-list { align-self: flex-start; max-inline-size: 100%; }
  .adsk-tabs .tab-list { flex-wrap: wrap; }
  .adsk-tabs .tab { min-height: 40px; flex: 1 1 auto; justify-content: center; }
  .adsk-tabs .tab-panel { padding-top: var(--space-2); }
  .adsk-tabs .tab-panel:not([hidden]) > * + * { margin-top: var(--space-3); }
  .adsk-tabs .tab-panel > p { max-inline-size: 70ch; }
  .adsk-tabs form { display: grid; gap: var(--space-3); max-inline-size: 40rem; }
  .adsk-pick { list-style: none; container-type: inline-size; border-block: 1px solid var(--border);
    & > li + li { border-top: 1px solid var(--border); }
    & label { display: grid; grid-template-columns: 18px minmax(0, 1fr) auto; gap: .35rem .85rem; align-items: center; min-block-size: 44px;
      padding: .6rem 1.25rem; cursor: pointer; transition: background var(--t-fast); }
    & label:hover { background: color-mix(in oklch, var(--primary-soft) 35%, transparent); }
    & label:has(input:disabled) { cursor: default; }
    & .adsk-main { display: grid; gap: .1rem; min-width: 0; }
    & .adsk-name { font-weight: 700; color: var(--heading); overflow-wrap: anywhere; }
    & .adsk-meta { display: flex; flex-wrap: wrap; gap: .1rem .75rem; font-size: var(--fs-xs); color: var(--muted); overflow-wrap: anywhere; }
    & .badge { white-space: nowrap; }
  }
  @container (width < 30rem) { .adsk-pick label { grid-template-columns: 18px minmax(0, 1fr); & .badge { grid-column: 2; justify-self: start; } } }
  .adsk-panel-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem 1rem; }
  .adsk-segmented a { min-height: 40px; }
  .adsk-issue-desc { display: block; font-size: var(--fs-xs); color: var(--muted); font-weight: 400; }
  .adsk-quote { margin: 0;
    & footer a { font-weight: 600; }
  }
  .adsk-form { display: grid; gap: var(--space-4); max-inline-size: 40rem;
    & fieldset { border: 0; padding: 0; margin: 0; min-width: 0; display: grid; gap: var(--space-4); }
  }
  .adsk-checkline { display: flex; align-items: center; gap: .6rem; font-size: var(--fs-sm); min-block-size: 40px; cursor: pointer; }

  /* the project page's ACC issues card (inc_project_issues.cfm) */
  .adsk-side {
    & p { font-size: var(--fs-sm); color: var(--muted); }
    & ul { list-style: none; display: grid; gap: .4rem; font-size: var(--fs-sm); }
    & li { overflow-wrap: anywhere; }
    & .badge { margin-inline-start: .25rem; }
  }

  /* ---- PR 3: the admin pages, the service account (service.cfm) and firm apps (firms.cfm) ---- */
  /* explanations keep a readable measure; ids, emails and variable names wrap instead of widening a phone */
  .adsk-prose { max-inline-size: 75ch; }
  .adsk-admin code { overflow-wrap: anywhere; user-select: all; }
  .adsk-subhead { font-size: var(--fs-md); font-weight: 700; color: var(--heading); }
  /* a status list: the term, then a badge and its sentence */
  .adsk-status { font-size: var(--fs-sm); gap: .65rem 1.5rem; max-inline-size: 90ch;
    & dt { color: var(--heading); }
    & dd { line-height: 1.6; }
    & dd .badge { margin-inline-end: .2rem; white-space: nowrap; }
    & dd .badge.adsk-wrap { white-space: normal; }
  }
  /* inline forms (adopt, create, the firm search): the field grows, its button sits on the field's line; a hint follows */
  .adsk-inline-form { display: grid; gap: .4rem; max-inline-size: 48rem;
    & > .row > .field { flex: 1 1 16rem; }
    & .btn { white-space: normal; text-align: start; }
    @media (width < 560px) { & > .row > .btn { flex: 1 1 100%; } }
  }
  .adsk-admin .adsk-danger .btn { flex: none; }
  /* wide enough for columns: ids, dates and statuses keep whole words; the last column takes the rest */
  @container (width >= 640px) { .adsk-admin .adsk-stack td:not(:last-child), .adsk-admin .adsk-stack td:not(:last-child) code { overflow-wrap: normal; } }
  /* a procedure inside a disclosure reads in the body ink, not the disclosure's muted grey */
  .adsk-procedure > :not(summary) { color: var(--text); }
  /* confirmations (inc_confirm_dialog.cfm): a plain sentence, then Cancel and the action, wrapping on a narrow phone */
  dialog.adsk-dialog {
    & .panel-head h2 { font-size: var(--fs-md); }
    & .panel-body { gap: var(--space-3); }
    & .panel-body p { font-size: var(--fs-sm); color: var(--text); }
    & [data-adsk-status] { color: var(--muted); }
    & [data-adsk-status]:empty { display: none; }
    & footer { flex-wrap: wrap; & .btn { white-space: normal; } }
  }
  /* firm rows: badges and labelled facts on the meta line, the last test's note under it, the row being edited marked */
  .adsk-firms {
    & .adsk-meta > span { display: inline-flex; align-items: center; gap: .35rem; }
    & .adsk-firm-note { font-size: var(--fs-xs); color: var(--muted); overflow-wrap: anywhere; max-inline-size: 70ch; }
    & .adsk-item[aria-current="true"] { background: var(--primary-soft); box-shadow: inset 3px 0 0 var(--primary); }
  }
  .adsk-firm-edit fieldset.field { gap: .4rem; }
  .adsk-firm-edit .form-actions { align-items: center; }
  .adsk-admin .choice { max-inline-size: 100%;
    & label { min-block-size: 40px; white-space: normal; }
  }
  /* the Add a firm matches and the service accounts at Autodesk: list rows, the action or the status at the end */
  .adsk-results { border: 1px solid var(--border); border-radius: var(--r-md); overflow: clip; }
  :is(.adsk-results, .adsk-accounts) > li { justify-content: space-between; flex-wrap: wrap; }
  .adsk-results-name { flex: 1 1 10rem; min-width: 0; overflow-wrap: anywhere; color: var(--heading); font-weight: 600; }

  /* ---- the busy dialog (inc_busy_dialog.cfm, busy.js): the control that started a slow action is held at once; past
     400ms this modal names what is happening, a spinner beside it and one muted line under it. No buttons: Escape stops
     waiting. It is not inside .adsk-page (the host's document page includes it too), so every rule here stands alone. ---- */
  dialog.adsk-busy {
    inline-size: min(100% - 2rem, 420px);
    /* the page under the modal never scrolls with a gesture made over it or over the backdrop */
    overscroll-behavior: contain;
    &::backdrop { overflow: hidden; overscroll-behavior: contain; }
    /* it takes focus only so the page under it is inert; with nothing in it to operate, it draws no ring */
    &:focus-visible { outline: none; }
    & .adsk-busy-body { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: .3rem 1rem; align-items: center; padding: 1.25rem 1.5rem; }
    & .adsk-spinner { grid-row: 1 / span 2; }
    & h2 { font-size: var(--fs-md); font-weight: 700; color: var(--heading); line-height: 1.35; overflow-wrap: anywhere; text-wrap: pretty; }
    & p { grid-column: 2; font-size: var(--fs-sm); color: var(--muted); line-height: 1.45; }
  }
  /* an indeterminate native <progress> drawn as a ring: a conic arc that grows and shrinks while the ring turns */
  progress.adsk-spinner:indeterminate {
    --_from: calc(90deg + var(--adsk-arc-start, 0deg));
    --_to: calc(90deg + var(--adsk-arc-end, 158deg));
    --_thickness: 3px;
    --_duration: 1.5s;
    inline-size: 40px; block-size: 40px; border-radius: 50%; appearance: none; border: 0;
    background: conic-gradient(from var(--_from), var(--primary) calc(var(--_to) - var(--_from)), transparent 0) var(--primary-soft);
    /* the arc's growth runs only where @property registers --adsk-spin-dash; elsewhere the ring just turns */
    animation: adsk-spin var(--_duration) linear infinite var(--adsk-spin-dash, );
    @supports (background-clip: border-area) { background-clip: border-area; border: var(--_thickness) solid transparent; background-origin: border-box; }
    @supports not (background-clip: border-area) {
      mask-image: radial-gradient(farthest-side, transparent calc(100% - var(--_thickness)), black calc(100% - var(--_thickness)));
    }
    /* slower, never still: the wait is still visibly alive */
    @media (prefers-reduced-motion: reduce) { --_duration: 6s; }
  }
  progress.adsk-spinner:indeterminate::-webkit-progress-bar { display: none; background: none; }
  progress.adsk-spinner:indeterminate::-webkit-progress-value { display: none; background: none; }
  progress.adsk-spinner:indeterminate::-moz-progress-bar { display: none; background: none; }
  /* while it waits: the chosen row keeps its highlight, links show the progress cursor and take no second click */
  :root.adsk-waiting { cursor: progress; }
  a.is-busy { cursor: progress; }
  .adsk-item:has(a.adsk-go.is-busy) { background: var(--primary-soft); }
}
@property --adsk-arc-start { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
@property --adsk-arc-end { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
@property --adsk-spin-dash { syntax: "*"; inherits: false; initial-value: , adsk-spin-dash 3s ease-in-out infinite; }
@keyframes adsk-spin { to { rotate: 1turn; } }
@keyframes adsk-spin-dash {
  from { --adsk-arc-start: 0deg; --adsk-arc-end: 3deg; }
  50% { --adsk-arc-start: 100deg; --adsk-arc-end: 358deg; }
  to { --adsk-arc-start: 360deg; --adsk-arc-end: 363deg; }
}

/* ==========================================================================
   Procore pages (procore/UI-BRIEF.md): slice 1, the connection page (W1): the identity line, what connecting allows,
   the action row and Technical details. Slice 2, the browse page (W2): list rows, tiles, flags, the project filter,
   the pager and the empty/error states. Slice 3, send: the tray, the drop targets, the review, the receipt and the
   document-page badge. Later slices add their progress here.
   ========================================================================== */
@layer components {
  /* Module: Procore (procore/) */
  .pcr-page { display: flex; flex-direction: column; gap: var(--space-5); }
  .pcr-page .crumbs { margin-bottom: 0; }
  .pcr-titlebar { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1rem;
    & .page-title { flex: 1 1 18rem; min-width: 0; overflow-wrap: anywhere; }
  }
  .pcr-lede { max-inline-size: 70ch; color: var(--text); }
  .pcr-hint { font-size: var(--fs-xs); color: var(--muted); max-inline-size: 70ch; overflow-wrap: anywhere;
    & .badge { margin-inline-end: .35rem; }
  }
  .pcr-empty { color: var(--muted); }
  /* the Thumb Rule for the error Details disclosures inside this module's alerts */
  .pcr-page .mini-details > summary { min-block-size: 40px; }

  /* The identity line (inc_who.cfm): a 40px tile, "Connected as <name>", the muted line and the environment badge */
  .pcr-account { container-type: inline-size; }
  .pcr-tile {
    inline-size: 40px; block-size: 40px; flex: none; display: grid; place-items: center;
    border-radius: var(--r-sm); background: var(--surface-2); color: var(--primary); font-size: 1.05rem;
    &.is-quiet { color: var(--muted); }
  }
  .pcr-who {
    display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: .5rem .85rem; align-items: center;
    & .pcr-who-text { display: grid; gap: .15rem; min-width: 0; }
    & .pcr-who-name { color: var(--heading); overflow-wrap: anywhere; line-height: 1.35;
      & strong { font-weight: 700; }
    }
    & .pcr-who-sub { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .6rem; font-size: var(--fs-sm); color: var(--muted); overflow-wrap: anywhere; }
    & .pcr-who-end { justify-self: end; display: flex; gap: .5rem; flex-wrap: wrap;
      & form { display: contents; } /* the browse page's Disconnect form: its button is the flex item */
    }
  }
  .pcr-can { list-style: none; display: grid; gap: .4rem; font-size: var(--fs-sm);
    & li { display: flex; align-items: baseline; gap: .6rem; }
    & li > i { inline-size: 1.1em; flex: none; text-align: center; color: var(--muted); }
  }
  /* a row of actions: the buttons and the forms that hold them sit side by side and wrap */
  .pcr-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem;
    & form { display: contents; }
    & .btn { white-space: normal; text-align: start; max-inline-size: 100%; }
  }
  @container (width < 36rem) {
    .pcr-who { grid-template-columns: 40px minmax(0, 1fr);
      & .pcr-who-end { grid-column: 1 / -1; justify-self: stretch; & > *, & .btn { flex: 1; } }
    }
    /* one row of two, full width, as the Autodesk pages do under a narrow container */
    .pcr-actions > .btn, .pcr-actions > form > .btn { flex: 1 1 calc(50% - .25rem); justify-content: center; }
  }

  /* Technical details: ids and statuses in the mono face, collapsed by default */
  .pcr-tech {
    & .dl-grid { font-size: var(--fs-sm); & dd { font-family: var(--mono); font-size: .8125rem; overflow-wrap: anywhere; } }
  }

  /* ---- Slice 2: the browse page (W2) ---- */
  /* the compact identity line ("Browsing as <name> · Sandbox" and the Connection link); its own container so the link drops under the text when narrow */
  .pcr-whobar { container-type: inline-size; }
  .pcr-who.is-compact { grid-template-columns: 32px minmax(0, 1fr) auto; gap: .25rem .7rem;
    & .pcr-tile { inline-size: 32px; block-size: 32px; font-size: .9rem; }
    & .pcr-who-name { font-size: var(--fs-sm); }
  }
  .pcr-main-panel { container-type: inline-size; }
  /* one level at a time, as a list of grid rows: icon or file tile, the name and its meta line, then the actions */
  .pcr-list { list-style: none; }
  .pcr-item {
    display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: .5rem 1rem; align-items: center;
    padding: .75rem 1.25rem; border-top: 1px solid var(--border); transition: background var(--t-fast);
    &:first-child { border-top: 0; }
    &:hover { background: color-mix(in oklch, var(--primary-soft) 35%, transparent); }
    & .pcr-lead { display: flex; align-items: center; }
    & .pcr-main { display: grid; gap: .1rem; min-width: 0; }
    & .pcr-name { font-weight: 700; color: var(--heading); overflow-wrap: anywhere; line-height: 1.35; }
    & .pcr-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .15rem .75rem; font-size: var(--fs-sm); color: var(--muted); font-variant-numeric: tabular-nums;
      & .badge .fa-lock { margin-inline-end: .2rem; }
    }
    & .pcr-row-actions { display: flex; gap: .5rem; flex-wrap: wrap; justify-content: flex-end; }
  }
  /* the busy highlight for a row whose Open link is waiting (busy.js marks the link .is-busy) */
  .pcr-item:has(a.is-busy) { background: var(--primary-soft); }
  /* the file-type tile: the extension in the mono label face */
  .pcr-ftile {
    inline-size: 40px; block-size: 40px; flex: none; display: grid; place-items: center; overflow: hidden;
    border-radius: var(--r-sm); border: 1px solid var(--border); background: var(--surface-2);
    font: 500 .6875rem/1 var(--mono); color: var(--muted); text-transform: uppercase; letter-spacing: .02em;
  }
  /* empty and error states: one sentence in the main panel, the status behind Details */
  .pcr-state { padding: 1.25rem; display: grid; gap: .75rem; justify-items: start; color: var(--text);
    & .alert { inline-size: 100%; }
  }
  .pcr-page .alert .mini-details { & > summary, & > :not(summary) { color: inherit; } }
  .pcr-list-note { padding: 0 1.25rem 1rem; }
  /* the project filter (above 8 projects) */
  .pcr-filter { padding: .85rem 1.25rem; border-bottom: 1px solid var(--border); display: grid; gap: .4rem;
    & .input { max-inline-size: 28rem; }
    & .pcr-filter-count { font-size: var(--fs-xs); color: var(--muted); font-variant-numeric: tabular-nums; }
  }
  /* the pager under a paged list: "Page 1 of 2", then Newer and Older */
  .pcr-pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 1rem;
    padding: .85rem 1.25rem; border-top: 1px solid var(--border); font-size: var(--fs-sm); color: var(--muted); font-variant-numeric: tabular-nums;
    & .pcr-pager-actions { display: flex; gap: .5rem; }
  }
  @container (width < 640px) {
    /* the actions drop below at full width in one row of two (UI-BRIEF §2) */
    .pcr-item .pcr-row-actions { grid-column: 1 / -1; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); & .btn { inline-size: 100%; } }
    .pcr-pager .pcr-pager-actions { flex: 1 1 100%; & .btn { flex: 1; } }
  }

  /* ---- Slice 3: send (W3 tray, W4 review, W7 receipt, W8 document page, W1 recent copies) ---- */
  /* the send tray: sticky at the top of the main panel (hubs.cfm's tray); not sticky under 640px, where it would eat the viewport */
  .pcr-tray {
    position: sticky; top: calc(var(--header-h, 110px) + .5rem); z-index: 5;
    display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .75rem 1rem; align-items: center;
    padding: .85rem 1.25rem; background: var(--surface); border-bottom: 1px solid var(--border);
    & .pcr-tray-text { display: grid; gap: .5rem; min-width: 0; font-size: var(--fs-sm); overflow-wrap: anywhere; }
    & .pcr-tray-actions { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: flex-end; }
    & .pcr-tray-problem { color: var(--text); & i { color: var(--muted); margin-inline-end: .25rem; } }
    & #pcrTrayStatus:empty { display: none; }
  }
  /* the document chip: the file tile and the name; draggable on a fine pointer (procore.js pcrDrag) */
  .pcr-chip {
    display: inline-flex; align-items: center; gap: .6rem; max-inline-size: 100%; justify-self: start;
    padding: .25rem .75rem .25rem .25rem; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface-2);
    & .pcr-ftile { inline-size: 32px; block-size: 32px; background: var(--surface); }
    & .pcr-chip-name { font-weight: 700; color: var(--heading); overflow-wrap: anywhere; min-width: 0; }
    & .pcr-grip { color: var(--muted); font-size: .9rem; inline-size: 1rem; text-align: center; padding-inline-start: .35rem; }
    &[draggable="true"] { cursor: grab; }
    &[draggable="true"]:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); }
  }
  @media (pointer: coarse) { .pcr-grip { display: none !important; } }
  /* Send here sits at the inline end of the open folder's panel head */
  .pcr-main-panel > .panel-head { flex-wrap: wrap; gap: .5rem 1rem; & .pcr-sendhere { display: contents; } }
  /* a writable folder row while the tray's document is dragged over it (the .adsk-item.is-over rule) */
  .pcr-item.pcr-drop { position: relative; transition: background var(--t-fast), box-shadow var(--t-fast);
    &.is-over { background: var(--primary-soft); box-shadow: inset 0 0 0 1px var(--primary); }
  }
  @container (width < 640px) {
    .pcr-tray { position: static; grid-template-columns: minmax(0, 1fr);
      & .pcr-tray-actions { justify-content: stretch; & > *, & .btn { flex: 1; } }
    }
  }

  /* the review (W4) and the receipt (W7): term / value pairs. Not .dl-grid: that lives in the utilities layer and would
     override this component's columns and its 480px stacking (SPEC §19 item 92). */
  .pcr-review, .pcr-receipt {
    display: grid; grid-template-columns: 9rem minmax(0, 1fr); gap: .75rem 1.25rem; align-items: baseline;
    & dt { font-size: var(--fs-xs); font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
    & dd { margin: 0; min-width: 0; overflow-wrap: anywhere; display: grid; gap: .4rem; justify-items: start; }
    & .pcr-review-meta { font-size: var(--fs-sm); color: var(--muted); }
    & .alert { inline-size: 100%; }
  }
  .pcr-receipt-line { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .75rem; }
  .pcr-receipt-when { font-size: var(--fs-sm); color: var(--muted); font-variant-numeric: tabular-nums; }
  .pcr-mono { font-family: var(--mono); font-size: .8125rem; overflow-wrap: anywhere; }
  .pcr-review-actions { justify-content: flex-end; & form { display: contents; } }
  .pcr-flash-link { margin: 0; }
  @media (width < 480px) {
    .pcr-review, .pcr-receipt { grid-template-columns: minmax(0, 1fr); gap: .25rem; & dd { margin-block-end: .6rem; } }
  }
  @container (width < 640px) {
    .pcr-review-actions > .btn, .pcr-review-actions > form > .btn { flex: 1 1 calc(50% - .3rem); justify-content: center; }
  }
  /* W1 recent copies: the name is the receipt link */
  .pcr-recent .pcr-item { & a.pcr-name { text-decoration: none; &:hover { color: var(--primary-ink); text-decoration: underline; } } }
  /* W8: the "Sent to Procore" badge on the document page, under the Procore button (both copies) */
  /* the badge keeps its size; the link's hit area is 40px tall (SPEC §16), inside the line's own 40px */
  .pcr-doc-state { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; min-block-size: 40px;
    & a.badge { position: relative; text-decoration: none; &:hover { text-decoration: underline; }
      &::after { content: ""; position: absolute; inset-inline: 0; inset-block-start: 50%; block-size: 40px; translate: 0 -50%; } }
    & .badge i { margin-inline-end: .25rem; }
  }
  /* W5, W5b, W6 (slice 4): the import review form, its read-only confirm panel and the relay's progress */
  .pcr-import .panel-body { display: grid; gap: var(--space-4); }
  .pcr-import-fields { gap: var(--space-4); }
  .pcr-fieldset { border: 0; padding: 0; margin: 0; min-inline-size: 0; display: grid; gap: var(--space-3);
    & > legend { display: flex; align-items: center; gap: .5rem; padding: 0; margin-block-end: var(--space-2);
      font-size: var(--fs-md); font-weight: 700; color: var(--heading); & i { color: var(--primary); } }
  }
  .pcr-pickers { display: flex; flex-wrap: wrap; gap: var(--space-3); & > .field { flex: 1 1 13rem; min-inline-size: 0; } }
  .pcr-optional { font-weight: 400; color: var(--muted); }
  .pcr-versions fieldset { border: 0; padding: .5rem 0 0; margin: 0; }
  .pcr-version { display: flex; align-items: center; gap: .6rem; min-block-size: 40px; font-size: var(--fs-sm); cursor: pointer;
    & input { inline-size: 18px; block-size: 18px; flex: none; } & span { overflow-wrap: anywhere; } }
  .pcr-members { --max-h: 22rem;
    & th[scope="row"] { font-weight: 600; text-align: start; overflow-wrap: anywhere; }
    & .pcr-member-client { display: block; font-weight: 400; font-size: var(--fs-xs); color: var(--muted); }
    & td.center { min-inline-size: 5.5rem; }
    & td.center input { margin: 11px; }
  }
  .pcr-keepopen { display: flex; align-items: baseline; gap: .5rem; font-size: var(--fs-sm); color: var(--muted); & i { color: var(--primary); } }
  .pcr-subtitle { font-size: var(--fs-md); font-weight: 700; color: var(--heading); overflow-wrap: anywhere;
    &:focus { outline: none; } &:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; } }
  .pcr-progress { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: .5rem 1rem;
    & .pcr-progress-text { font-size: var(--fs-sm); color: var(--muted); font-variant-numeric: tabular-nums; }
  }
  .pcr-import progress:not([value]) {
    background: linear-gradient(90deg, transparent 0 35%, var(--primary) 35% 65%, transparent 65%) 0 0 / 250% 100% no-repeat, var(--surface-2);
    animation: adsk-indeterminate 1.6s linear infinite;
    &::-webkit-progress-bar { background: transparent; }
    &::-moz-progress-bar { background: transparent; }
    @media (prefers-reduced-motion: reduce) { animation: none; background-position: 50% 0; }
  }
  .steps.pcr-steps { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5rem 1rem;
    & > li { display: flex; align-items: center; gap: .6rem; min-width: 0; color: var(--muted); }
    & > li::before { content: none; }
    & .pcr-step-mark { inline-size: 28px; block-size: 28px; flex: none; border-radius: 50%; display: grid; place-items: center;
      font-size: var(--fs-xs); font-weight: 700; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
    & > li.is-done .pcr-step-mark { background: var(--primary-soft); color: var(--primary-ink); border-color: transparent; }
    & > li[aria-current="step"] { color: var(--heading); font-weight: 700;
      & .pcr-step-mark { background: var(--primary); color: var(--on-primary); border-color: var(--primary); } }
    & > li.is-failed .pcr-step-mark { background: var(--danger-bg); color: var(--danger); border-color: transparent; }
  }
  @container (width < 640px) {
    .steps.pcr-steps { grid-template-columns: minmax(0, 1fr); }
    .pcr-progress { grid-template-columns: minmax(0, 1fr); }
  }

  /* Slice 5: the same-name choice on the send review (W4 variant), the default-folder line (W3) and the project link
     panel (W10). Native radios (accent-color from the base layer), 44px option rows, tokens only. */
  .pcr-choice { display: contents; }
  .pcr-choice-set { border: 0; margin: 0; padding: 0; min-inline-size: 0; display: grid; gap: .5rem;
    & > legend { padding: 0; margin-block-end: .35rem; color: var(--text); overflow-wrap: anywhere; }
    & > .pcr-chip { justify-self: start; }
  }
  .pcr-choice-option {
    display: flex; align-items: flex-start; gap: .6rem; min-block-size: 44px; padding: .55rem .75rem;
    border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface); cursor: pointer; overflow-wrap: anywhere;
    & input[type="radio"] { flex: none; inline-size: 1.1rem; block-size: 1.1rem; margin-block-start: .15rem; }
    & > span { min-width: 0; }
    &:has(input:checked) { border-color: var(--primary); background: var(--surface-2); }
    &:has(input:focus-visible) { outline: 2px solid var(--primary); outline-offset: 2px; }
    &.is-disabled { cursor: not-allowed; color: var(--muted); }
    & .badge { margin-inline-start: .35rem; }
  }
  .pcr-choice-note { display: block; font-size: var(--fs-xs); color: var(--muted); }
  .pcr-default-line { color: var(--text); overflow-wrap: anywhere; & i { color: var(--muted); margin-inline-end: .25rem; }
    & a { display: inline-flex; align-items: center; min-block-size: 40px; }
  }
  .pcr-link .panel-body { display: grid; gap: .6rem; overflow-wrap: anywhere; }
  .pcr-link > summary.panel-head .badge { flex: none; }
  .pcr-link-actions { margin-block-start: .25rem; }
  .pcr-review-again { margin-block-start: .5rem; }

  /* Slice 7: a large copy's progress on the receipt (W7; procore.js pcrPoll). Native <progress>, limited styling only. */
  .pcr-job { display: grid; gap: .4rem; margin-block: .5rem; max-inline-size: 40rem;
    & progress { inline-size: 100%; accent-color: var(--primary); }
    & .pcr-job-line { margin: 0; font-size: var(--fs-sm); color: var(--text); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
    & .pcr-job-refresh { justify-self: start; display: inline-flex; align-items: center; min-block-size: 40px; }
  }

  /* ---- Slice 8a: the Procore admin console (W11, procore/admin.cfm; UI-BRIEF §11) ---- */
  /* the section bar: the segmented control, wrapping to two rows on a phone; each link keeps the 40px touch target */
  .pcr-admin-bar { flex-wrap: wrap; border-radius: var(--r-md); max-inline-size: 100%;
    & a { min-block-size: 40px; border-radius: var(--r-sm); }
  }
  .pcr-admin-dl { & dd { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .5rem; overflow-wrap: anywhere; } }
  .pcr-admin-plain { list-style: none; display: grid; gap: .35rem; & li { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .5rem; } }
  /* its own container, so a list inside a panel body drops its actions below on a phone like every module list */
  .pcr-admin-stack { display: grid; gap: 1rem; container-type: inline-size; }
  .pcr-admin-stop-note { color: var(--text); overflow-wrap: anywhere; }
  .pcr-admin-note { padding: .5rem 1.25rem 0; }
  /* a list row whose actions are forms: the forms are the flex items' boxes */
  .pcr-admin-item .pcr-row-actions form { display: contents; }
  .pcr-admin-company { align-items: start; }
  /* the row's content never widens its column: long names, selects and hints wrap inside it */
  .pcr-admin-item .pcr-main > *, .pcr-admin-company .pcr-main > * { min-inline-size: 0; }
  .pcr-admin-company .pcr-meta > span { min-inline-size: 0; overflow-wrap: anywhere; }
  .pcr-admin-toggles { display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; margin-block-start: .5rem; }
  .pcr-admin-toggle { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .6rem; font-size: var(--fs-sm); color: var(--text);
    & > span:first-child { font-weight: 700; color: var(--heading); }
    & form { display: contents; }
  }
  .pcr-admin-options { margin-block-start: .5rem;
    & > summary { min-block-size: 40px; display: flex; align-items: center; overflow-wrap: anywhere; }
  }
  .pcr-admin-option-grid { display: grid; gap: .75rem; padding-block: .75rem .25rem; min-inline-size: 0; }
  .pcr-admin-option { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .75rem; font-size: var(--fs-sm);
    &.is-indented { padding-inline-start: 1.25rem; border-inline-start: 2px solid var(--border); }
    & .select, & .input { inline-size: auto; flex: 1 1 14rem; max-inline-size: min(22rem, 100%); min-inline-size: 0; }
    & .pcr-admin-number { flex: 0 1 9rem; }
    & > * { max-inline-size: 100%; }
    & .pcr-hint { overflow-wrap: anywhere; }
    & form { display: contents; }
  }
  .pcr-admin-option-name { font-weight: 700; color: var(--heading); min-inline-size: 11rem; }
  /* fields side by side with their labels on one line and the button level with the inputs (hints go under the form) */
  .pcr-admin-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .75rem 1rem;
    & > .field { flex: 1 1 14rem; min-inline-size: 0; max-inline-size: 28rem; }
  }
  /* a destructive form with its required note ("Why?"): the note is filled in before the confirm dialog opens */
  .pcr-admin-noteform { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .75rem; margin-block-start: .5rem; font-size: var(--fs-sm);
    & label { font-weight: 700; color: var(--heading); }
    & .input { flex: 1 1 14rem; max-inline-size: 24rem; min-inline-size: 0; }
  }
  .pcr-admin-filters { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 12rem), 1fr)); gap: .75rem 1rem; align-items: end; }
  .pcr-admin-filter-actions { display: flex; flex-wrap: wrap; gap: .5rem; grid-column: 1 / -1; }
  .pcr-admin-export { margin-inline-start: auto; }
  /* section 6: the one table of the module (columns compared row by row); a keyboard-scrollable region, stacked under 640px */
  .pcr-admin-table { max-inline-size: 100%;
    & th[scope="row"] { text-transform: none; letter-spacing: 0; font-size: var(--fs-sm); background: var(--surface); white-space: nowrap; }
    & td { overflow-wrap: anywhere; }
    &:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
  }
  @container (width < 640px) {
    .pcr-admin-table {
      & table, & tbody, & tr, & th, & td { display: block; }
      & thead { display: none; }
      & tr { padding: .75rem 1.25rem; border-top: 1px solid var(--border); }
      & tbody th[scope="row"], & td { padding: .15rem 0; border: 0; white-space: normal; }
      & td::before, & tbody th[scope="row"]::before { content: attr(data-label) ": "; font-weight: 700; color: var(--muted); font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .04em; }
    }
    .pcr-admin-option-name { min-inline-size: 0; flex: 1 1 100%; }
    /* a phone gets the whole row for the content: no lead tile */
    .pcr-admin-item, .pcr-admin-company { grid-template-columns: minmax(0, 1fr); & .pcr-lead { display: none; } }
    /* the console's action labels are long ("Grant the procore role"): one full-width button per row */
    .pcr-admin-item .pcr-row-actions { grid-auto-flow: row; }
    .pcr-admin-option .btn { flex: 0 1 auto; }
    .pcr-admin-option .select, .pcr-admin-option .input:not(.pcr-admin-number) { flex: 1 1 100%; max-inline-size: 100%; }
    .pcr-admin-toggle .btn, .pcr-admin-noteform .btn { flex: 1 1 100%; }
  }
}

/* ---- Search page (search.cfm): the values that were style attributes (docs/search/PLAN.md slice 0.3) ---- */
@layer components {
  .search-layout { --aside: 340px; }
  .search-main { gap: 1.5rem; }
  .search-empty { padding: 1.25rem; font-size: var(--fs-sm); }
  .search-result .thumb { --w: 64px; }
  .search-summary { grid-column: 2 / -1; font-size: var(--fs-sm); padding: .6rem .85rem; border-radius: var(--r-sm); background: var(--surface-2); overflow-wrap: anywhere; }
  /* the new engine's highlighted words (search.cfm turns the highlighter's markers into <mark>) */
  .search-summary mark { background: var(--warning-bg); color: var(--warning-ink); border-radius: 2px; padding: 0 .1em; }
  .form.search-form { gap: var(--space-4); }
  /* its own class, not .row: .row lives in the utilities layer and would win over these */
  .search-input-row { display: flex; align-items: center; gap: .5rem; flex-wrap: nowrap;
    & .input { flex: 1; min-width: 0; }
  }
  .panel-body.search-info { font-size: var(--fs-sm); }
  .search-sort { margin: 0; }
  .card.search-log { margin-top: 2rem; }
}

/* ---- Procore construction administration (slice 9b): W13 procore/ca.cfm, W12 procore/inc_project_ca.cfm (SPEC §22.7) ---- */
@layer components {
  .pcr-ca-head { display: grid; gap: .6rem; & .pcr-receipt-line { margin: 0; } & .alert { inline-size: 100%; } }
  /* W13's heading is one flex item (the label never breaks); W12's count line wraps under its title on a phone */
  .pcr-ca-label { white-space: nowrap; }
  .pcr-ca-tab > .panel-head h3 { flex: 1 0 auto; }
  /* plain text kept as written: the request and the replies (escaped, never rendered as HTML) */
  .pcr-ca-text { white-space: pre-wrap; overflow-wrap: anywhere; max-inline-size: 75ch; margin: 0; }
  .pcr-ca-body { display: grid; gap: .75rem; }
  .pcr-ca-subhead { font-size: var(--fs-sm); color: var(--muted); padding: .75rem 1.25rem 0; margin: 0; border-top: 1px solid var(--border); }
  .pcr-ca-plain { list-style: none; display: grid; gap: .25rem; }
  /* the responses: one article per response, the initials tile and the text, oldest first */
  .pcr-ca-timeline { list-style: none; margin: 0; padding: 0;
    & > li { border-top: 1px solid var(--border); padding: 1rem 1.25rem; }
    & > li:first-child { border-top: 0; }
  }
  .pcr-ca-reply { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: .5rem .85rem; align-items: start;
    & .pcr-tile { font-weight: 700; font-size: .8125rem; line-height: 1; }
    & .pcr-ca-reply-main { display: grid; gap: .45rem; min-width: 0; }
    & .pcr-ca-who { font-size: var(--fs-md, 1rem); margin: 0; overflow-wrap: anywhere; }
    & .pcr-receipt-line:empty { display: none; }
    &.is-held { color: var(--muted); & p { margin: 0; } }
  }
  .pcr-ca-files { border: 1px solid var(--border); border-radius: var(--r-md);
    & .pcr-item { padding: .6rem .85rem; }
  }
  /* W14 (slice 10): the reply form's document checklist; each row is one 40px label (the checkbox, the type tile, the name and facts) */
  .pcr-ca-attach { border: 0; padding: 0; margin: 0; min-inline-size: 0; }
  .pcr-ca-receipt-tech { font-size: var(--fs-sm); & > summary { color: var(--muted); cursor: pointer; inline-size: fit-content; } & .pcr-receipt { margin-block-start: .4rem; } }
  .pcr-ca-checklist { list-style: none; display: grid; gap: .2rem; max-block-size: 22rem; overflow: auto; padding: .25rem;
    border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface);
    & li[hidden] { display: none; }
  }
  .pcr-ca-check { display: grid; grid-template-columns: auto 40px minmax(0, 1fr); gap: .35rem .75rem; align-items: center; min-block-size: 40px;
    padding: .35rem .5rem; border-radius: var(--r-sm); cursor: pointer;
    &:hover { background: var(--surface-2); }
    &:has(input:checked) { background: var(--primary-soft); }
    &:has(input:focus-visible) { outline: 2px solid var(--primary); outline-offset: 1px; }
    &.is-disabled { cursor: not-allowed; opacity: .7; }
    & .pcr-main { display: grid; gap: .1rem; min-width: 0; }
    & .pcr-name { color: var(--heading); font-weight: 600; overflow-wrap: anywhere; line-height: 1.35; }
    & .pcr-meta { display: flex; flex-wrap: wrap; gap: .1rem .75rem; font-size: var(--fs-sm); color: var(--muted); }
  }
  /* W12: the filters as segmented links, then the table; under 640px each item is a card with the same words */
  .pcr-ca-filters { display: flex; flex-wrap: wrap; gap: .5rem .75rem; padding: .85rem 1.25rem; border-bottom: 1px solid var(--border);
    & .segmented a { min-block-size: 40px; }
  }
  .pcr-ca-table {
    & .pcr-ca-item a { font-weight: 700; white-space: nowrap; }
    & .pcr-ca-spec { display: block; }
    & .pcr-ca-status .badge { margin-block: .1rem; }
    & tr.is-private .pcr-ca-title { color: var(--muted); }
    & .pcr-ca-due, & .pcr-ca-change, & time { white-space: nowrap; }
  }
  @container (width < 640px) {
    .pcr-ca-table thead { display: none; }
    .pcr-ca-table tbody tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .2rem .75rem; padding: .75rem 1rem; border-bottom: 1px solid var(--border); }
    .pcr-ca-table tbody tr:last-child { border-bottom: 0; }
    .pcr-ca-table td { display: block; padding: 0; border: 0; }
    .pcr-ca-table td.pcr-ca-title { grid-column: 1 / -1; }
    .pcr-ca-table td.pcr-ca-bic, .pcr-ca-table td.pcr-ca-change { font-size: var(--fs-sm); color: var(--muted); }
    .pcr-ca-table td.pcr-ca-bic::before { content: "Ball in court: "; }
    .pcr-ca-table td.pcr-ca-change::before { content: "Changed "; }
    /* the overdue badge goes under the date instead of over the next cell */
    .pcr-ca-table td.pcr-ca-due { white-space: normal; }
  }
}

/* ---- Search: the new engine's Refine panel (search.cfm, PLAN.md slice 1.5) ---- */
@layer components {
  .search-refine {
    & .panel-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
    & h4 { font-size: var(--fs-sm); margin: .9rem 0 .35rem; color: var(--muted); }
    & h4:first-child { margin-top: 0; }
  }
  .search-facet-list { list-style: none; margin: 0; padding: 0;
    & li { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .15rem 0; font-size: var(--fs-sm); }
    & a { min-width: 0; overflow-wrap: anywhere; }
    & a[aria-current="true"] { font-weight: 600; }
  }
}
