/* components.css — Phase 2 opt-in core components.
   Token-driven (tokens.css). Data-attribute hooks ([data-slot],
   [data-variant], [data-size]) are orthogonal to JS state classes
   (.active/.is-active/.selected) which we never touch. Loaded AFTER
   shell.css. Nothing in current markup uses [data-slot] → linking this
   file alone = ZERO visual change. Logical properties throughout (RTL). */

/* ── Shared focus-visible (opt-in via data-slot) ─────────────────── */

/* B21 s3 (CODE-13): this sheet is the `components` cascade layer; the order is declared once, in tokens.css. */
@layer components {

[data-slot="button"]:focus-visible,
[data-slot="tabs-trigger"]:focus-visible,
[data-slot="card"][data-variant~="interactive"]:focus-visible,
[data-slot="badge"][data-interactive]:focus-visible {
  outline: none;
  border-color: var(--color-ring);
  box-shadow: 0 0 0 var(--ring-width) var(--ring-color);
}

/* ── Icon foundation (opt-in) ────────────────────────────────────── */
[data-slot="button"] > i,
[data-slot="button"] > svg { font-size: var(--text-base); inline-size: var(--icon-md); block-size: var(--icon-md); flex-shrink: 0; }
[data-slot="button"][data-size="sm"]      > i { font-size: var(--text-sm); }
[data-slot="badge"] > i { font-size: var(--text-xs); }
/* Directional icons flip in RTL; universal-action icons opt OUT via .icon-no-flip */

/* ── Button base ─────────────────────────────────────────────────── */
[data-slot="button"] {
  display: inline-flex; align-items: center; justify-content: center;
  gap: var(--space-2);
  block-size: var(--h-lg);                 /* 36px default */
  padding-inline: var(--space-4);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  font-family: inherit; font-size: var(--text-sm); font-weight: 500;
  line-height: 1; white-space: nowrap; text-decoration: none;
  cursor: pointer; user-select: none;
  transition: background-color var(--dur-base) var(--ease-standard),
              color var(--dur-base) var(--ease-standard),
              border-color var(--dur-base) var(--ease-standard);
}
[data-slot="button"]:disabled { opacity: .5; pointer-events: none; }
/* FIXUP-FILES (FIXFILEVIEW-NEW-006): an aria-disabled kit button keeps the pointer - OSS-09's "a held
   control says why on press" (error_language.js onDisabledPress, each page's own guard) and its tip on
   hover reach it; dimmed and not-allowed, never acting (every setter's handler refuses: the record's audit) */
[data-slot="button"][aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
[data-slot="button"][data-loading="true"] { pointer-events: none; position: relative; color: transparent; }
[data-slot="button"][data-loading="true"]::after {
  content: ""; position: absolute; inline-size: var(--icon-md); block-size: var(--icon-md);
  border: 2px solid currentColor; border-block-start-color: transparent; border-radius: 50%;
  animation: btn-spin var(--dur-slow) linear infinite; color: var(--color-primary-foreground);
}
@keyframes btn-spin { to { transform: rotate(360deg); } }

[data-slot="button"][data-variant="default"],
[data-slot="button"]:not([data-variant]) {
  background: var(--color-primary); color: var(--color-primary-foreground);
}
/* Round 5 — exclude the chat send button from the default-variant blue
   hover. The send button carries data-variant="default" only to inherit
   layout — its hover is owned by chat_enhanced.css (subtle brightness +
   shadow, no hue shift). */
/* B2: the indigo secondary role is retired (UX-PLAN §1.1). The hover is the
   accent 12% toward its own text colour (lighter on a dark accent, darker on
   a light one; settings.css's scope gets the same arithmetic on its accent);
   the secondary variant is the tonal tier. */
[data-slot="button"][data-variant="default"]:not(.chat-send-btn):hover { background: color-mix(in srgb, var(--color-primary) 88%, var(--color-primary-foreground)); }
[data-slot="button"][data-variant="secondary"] { background: var(--color-surface-2); color: var(--color-foreground); }
[data-slot="button"][data-variant="outline"] {
  background: var(--color-background); color: var(--color-foreground); border-color: var(--color-border);
}
[data-slot="button"][data-variant="outline"]:hover { background: var(--color-muted); }
[data-slot="button"][data-variant="ghost"] { background: transparent; color: var(--color-foreground); }
[data-slot="button"][data-variant="ghost"]:hover { background: var(--color-muted); }
[data-slot="button"][data-variant="destructive"] { background: var(--color-danger); color: var(--color-danger-foreground); }
[data-slot="button"][data-variant="destructive"]:hover { background: color-mix(in srgb, var(--color-danger) 88%, var(--color-shadow)); }
/* Neutral inverse-fill: hard black in light mode, hard white in dark mode,
   text inverts. --color-foreground is navy in light and was the wrong knob
   to grab here — a black/white button is the visual point of the variant
   (--color-contrast, tokens.css; B21 s3: one rule, the token flips).
   Used by the paste-modal Close button so the modal's primary action does
   not carry the brand accent. */
[data-slot="button"][data-variant="inverse"] { background: var(--color-contrast); color: var(--color-contrast-foreground); }
[data-slot="button"][data-variant="inverse"]:hover { background: color-mix(in srgb, var(--color-contrast) 88%, var(--color-background)); }
[data-slot="button"][data-variant="link"] {
  background: transparent; color: var(--color-primary); block-size: auto;
  padding-inline: 0; text-decoration: underline; text-underline-offset: 3px;
}
[data-slot="button"][data-size="sm"]      { block-size: var(--h-md); padding-inline: var(--space-3); font-size: var(--text-xs); }
[data-slot="button"][data-size="lg"]      { block-size: var(--h-xl); padding-inline: var(--space-5); }
[data-slot="button"][data-size="icon"]    { inline-size: var(--h-lg); padding-inline: 0; }
[data-slot="button"][data-size="icon-sm"] { inline-size: var(--h-md); block-size: var(--h-md); padding-inline: 0; }
[data-slot="button"][data-size="icon-lg"] { inline-size: var(--h-xl); block-size: var(--h-xl); padding-inline: 0; }
/* Button group (segmented) */
[data-slot="button-group"] { display: inline-flex; }
[data-slot="button-group"] > [data-slot="button"] { border-radius: 0; }
[data-slot="button-group"] > [data-slot="button"]:first-child { border-start-start-radius: var(--radius-md); border-end-start-radius: var(--radius-md); }
[data-slot="button-group"] > [data-slot="button"]:last-child  { border-start-end-radius: var(--radius-md);  border-end-end-radius: var(--radius-md); }
[data-slot="button-group"] > [data-slot="button"]:focus-visible { position: relative; z-index: 1; }

/* Transitional aliases — REMOVE in Phase 9 once markup carries data-slot.
   These DO NOT restyle; they only adopt base geometry for opt-in classes
   that are already visual-only (no JS state depends on geometry). */

/* ── Badge ───────────────────────────────────────────────────────── */
[data-slot="badge"] {
  display: inline-flex; align-items: center; gap: var(--space-1);
  padding-inline: var(--space-2); padding-block: 2px;
  border: 1px solid transparent; border-radius: var(--radius-pill);
  font-size: var(--text-xs); font-weight: 500; line-height: 1.4; white-space: nowrap;
}
[data-slot="badge"][data-variant="default"],
[data-slot="badge"]:not([data-variant]) { background: var(--color-primary); color: var(--color-primary-foreground); }
[data-slot="badge"][data-variant="secondary"]   { background: var(--color-muted); color: var(--color-muted-foreground); }
[data-slot="badge"][data-variant="outline"]     { background: transparent; color: var(--color-foreground); border-color: var(--color-border); }
/* B2: status badges sit on the solid tints of tokens.css, so their text
   contrast holds on any surface (asserted by test_ux_tokens_contrast c2;
   the translucent warning badge read 1.86:1 before). */
[data-slot="badge"][data-variant="success"]     { background: var(--color-accent); color: var(--color-primary-text); }
[data-slot="badge"][data-variant="warning"]     { background: var(--color-warning-tint); color: var(--color-warning); }
[data-slot="badge"][data-variant="info"]        { background: var(--color-surface-2); color: var(--color-text-secondary); }
[data-slot="badge"][data-variant="destructive"] { background: var(--color-danger-tint); color: var(--color-danger); }
[data-slot="badge"][data-variant="count"] { min-inline-size: 18px; block-size: 18px; justify-content: center; padding-inline: var(--space-1); }
/* HC12 (C11 W1): a cited link's verdict, after the link in the reading
   direction ("Verified: produced in this run" / "Not produced in this run").
   The words carry the meaning; the tone is the status badge's. Inside a file
   card it sits under the name and the size. */
.link-verdict { margin-inline-start: var(--space-1); vertical-align: text-bottom; unicode-bidi: isolate; }
.link-verdict > svg { inline-size: var(--icon-xs); block-size: var(--icon-xs); flex-shrink: 0; }
.file-card-body > .link-verdict { margin-inline-start: 0; margin-block-start: var(--space-1); align-self: flex-start; }
/* HC12 (C11 W1): the Library card's "Produced in <conversation>" line, its
   own line above the footer row, in the footer's type and tone. Wrap, do not
   squeeze, do not hide: the title is the part that names the conversation. */
.lib-card > .lib-card-source { flex: 0 0 auto; margin-block-end: var(--space-1);
  font-size: var(--text-xs); color: var(--color-muted-foreground); text-align: start;
  overflow-wrap: anywhere; }

/* ── Status dot (decorative → aria-hidden in markup) ─────────────── */
[data-slot="status"] { display: inline-block; inline-size: 10px; block-size: 10px; border-radius: 50%; background: var(--color-muted-foreground); }
[data-slot="status"][data-status="active"], [data-slot="status"][data-status="online"]  { background: var(--color-success); }
[data-slot="status"][data-status="inactive"],[data-slot="status"][data-status="offline"] { background: var(--color-danger); }
[data-slot="status"][data-status="pending"]    { background: var(--color-warning); }
[data-slot="status"][data-status="processing"] { background: var(--color-primary); animation: btn-spin 1s linear infinite; }

/* ── Card ────────────────────────────────────────────────────────── */
[data-slot="card"] {
  display: flex; flex-direction: column;
  background: var(--color-card); color: var(--color-card-foreground);
  border: 1px solid var(--color-border); border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xs);
}
[data-slot="card"][data-variant~="interactive"] { cursor: pointer; transition: box-shadow var(--dur-base) var(--ease-standard), border-color var(--dur-base) var(--ease-standard); }
[data-slot="card"][data-variant~="interactive"]:hover { box-shadow: var(--shadow-sm); border-color: var(--color-input); }
[data-slot="card"][data-variant~="selected"] { border-color: var(--color-ring); box-shadow: 0 0 0 1px var(--color-ring); }
[data-slot="card"][data-variant~="muted"]   { background: var(--color-muted); }
[data-slot="card"][data-variant~="flat"]    { box-shadow: none; }
[data-slot="card"][data-variant~="compact"] > .card-header,
[data-slot="card"][data-variant~="compact"] > .card-content,
[data-slot="card"][data-variant~="compact"] > .card-footer { padding: var(--space-3) var(--space-4); }
[data-slot="card"][aria-disabled="true"] { opacity: .55; pointer-events: none; }

[data-slot="card"] > .card-header  { display: grid; gap: var(--space-1); padding: var(--space-6); border-block-end: 1px solid var(--color-border); }
[data-slot="card"] > .card-header:has(.card-action) { grid-template-columns: 1fr auto; align-items: start; }
.card-title       { margin: 0; font-weight: 600; font-size: var(--text-lg); }
.card-action  { grid-column: 2; grid-row: 1 / span 2; }
[data-slot="card"] > .card-content { padding: var(--space-6); }
[data-slot="card"] > .card-footer  { display: flex; justify-content: flex-end; gap: var(--space-2); padding: var(--space-6); border-block-start: 1px solid var(--color-border); }

/* ── Tabs ────────────────────────────────────────────────────────── */
[data-slot="tabs-list"] { display: flex; gap: var(--space-1); border-block-end: 1px solid var(--color-border); overflow-x: auto; }
[data-slot="tabs-trigger"] {
  display: inline-flex; align-items: center; gap: var(--space-2);
  padding: var(--space-2) var(--space-3); background: transparent; border: none;
  color: var(--color-muted-foreground); font-size: var(--text-sm); font-weight: 500;
  cursor: pointer; border-block-end: 2px solid transparent;
  transition: color var(--dur-base) var(--ease-standard), border-color var(--dur-base) var(--ease-standard);
}
[data-slot="tabs-trigger"]:hover { color: var(--color-foreground); }
[data-slot="tabs-trigger"][aria-selected="true"] { color: var(--color-primary); border-block-end-color: var(--color-primary); }
[data-slot="tabs-trigger"]:disabled { opacity: .5; cursor: not-allowed; }
[data-slot="tabs-panel"][hidden] { display: none; }
/* Segmented variant */
[data-slot="tabs-list"][data-variant="segmented"] { gap: 0; border: 1px solid var(--color-border); border-radius: var(--radius-md); padding: var(--space-1); }
[data-slot="tabs-list"][data-variant="segmented"] [data-slot="tabs-trigger"] { border-radius: var(--radius-sm); border-block-end: none; }

/* ── Attachment cards (composer) ───────────────────────────────────────────
   Sibling of .file-card. Same hairline-on-transparent treatment, same
   foreground-derived hover, no hardcoded colour except the glyph accent —
   which comes from a role-named token, so both themes are one value.
   Logical properties throughout: the composer is RTL in Hebrew and the
   glyph/text/× order must mirror. */
.att-tray {
    display: flex;
    flex-wrap: wrap;                 /* wrap, not scroll — see cap below */
    gap: var(--space-2);
}
/* The UA's `[hidden] { display: none }` is a UA rule and loses to the class
   selector above, so the empty tray stayed a flex child: it contributed its
   own margin AND the wrapper's row gap (chat_enhanced.css:5097) — the
   composer sat ~16px taller with nothing attached. Same trap, same fix, as
   [data-slot="alert"][hidden] in feedback.css:20. */
.att-tray[hidden] { display: none; }
/* Cap is 5 (AttachmentCard.MAX_ATTACHMENTS). Wrap rather than a horizontal
   scroller: at 5 the tray is at most two rows, and a scroller would hide
   attachments behind an affordance the user has no reason to look for. Past
   the cap the picker refuses with a card-level message. */

.att-card {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: var(--space-3);
    position: relative;              /* .att-progress anchor */
    inline-size: min(320px, 100%);
    min-block-size: 58px;
    padding: var(--space-2) var(--space-3);
    box-sizing: border-box;
    background: transparent;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    overflow: hidden;                /* clips the progress bar to the radius */
    transition: background-color var(--dur-base) var(--ease-standard),
                border-color var(--dur-base) var(--ease-standard);
}
.att-card:hover {
    background: color-mix(in srgb, var(--color-foreground) 4%, transparent);
    border-color: color-mix(in srgb, var(--color-foreground) 18%, transparent);
}
.att-card-icon {
    flex: 0 0 auto;
    inline-size: 34px;
    block-size: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: color-mix(in srgb, var(--color-foreground) 6%, transparent);
    border-radius: var(--radius-md);
}
/* The one place hue appears. Attribute selectors rather than classes so the
   JS writes a role name and never a colour. */
.att-card-icon[data-att-accent="sheet"] { color: var(--file-accent-sheet); }
.att-card-icon[data-att-accent="doc"]   { color: var(--file-accent-doc); }
.att-card-icon[data-att-accent="slide"] { color: var(--file-accent-slide); }
.att-card-icon[data-att-accent="pdf"]   { color: var(--file-accent-pdf); }
.att-card-icon[data-att-accent="image"] { color: var(--file-accent-image); }
.att-card-icon[data-att-accent="text"],
.att-card-icon[data-att-accent="file"]  { color: var(--file-accent-text); }
.att-card-icon-error { color: var(--color-danger, var(--toast-error)); }

.att-card-text  { display: flex; flex-direction: column; gap: 2px; min-inline-size: 0; flex: 1 1 auto; }
/* Near-full contrast for the name, muted small for the type — the two-line
   hierarchy from the reference. */
.att-card-name  {
    color: var(--color-foreground);
    font-size: var(--text-sm);
    font-weight: 500;
    /* min-inline-size:0 on the flex parent is what makes this ellipsis work;
       without it the name forces the card wider than its own max. */
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.att-card-type  {
    color: var(--color-muted-foreground);
    font-size: var(--text-xs);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.att-card-error { color: var(--color-danger, var(--toast-error)); }
/* FIX-1b (JRN-UPLOAD-1, journey-NEW-024): a refusal is the one sentence the
   person needs (on the card, never a toast: AttachmentCard.js), so it wraps
   instead of ending in an ellipsis; the card grows by the lines it needs. */
.att-card-type.att-card-error { white-space: normal; overflow: visible; text-overflow: clip; overflow-wrap: anywhere; }
/* FR2-D (FR2D-NEW-008): what was read of the file ("Long file: read in parts", FIX-FILES' page-image notes) is its
   own line under the kind and size, read whole: it wraps as the refusal does and the card grows by its lines. */
.att-card-note  {
    color: var(--color-muted-foreground);
    font-size: var(--text-xs);
    overflow-wrap: anywhere;
}

/* × — hover-revealed where hover exists, permanent where it does not. */
.att-remove { flex: 0 0 auto; opacity: 0; transition: opacity var(--dur-fast) var(--ease-standard); }
.att-card:hover .att-remove,
.att-card:focus-within .att-remove { opacity: 1; }
@media (hover: none) { .att-remove { opacity: 1; } }

/* Determinate progress, pinned to the block-end edge inside the hairline.
   inset-inline-start:0 + logical inline-size, so it fills from the leading
   edge in both directions. */
.att-progress {
    position: absolute;
    inset-block-end: 0; inset-inline-start: 0;
    inline-size: 100%; block-size: 2px;
    background: color-mix(in srgb, var(--color-foreground) 8%, transparent);
}
.att-progress-fill {
    block-size: 100%; inline-size: 0%;
    /* Foreground-derived, like every other skeleton block. --color-primary
       is the app's action colour; a progress bar on a placeholder is not an
       action, and at 2px the saturation was the loudest thing in a composer
       that is otherwise hairlines and muted text. */
    background: color-mix(in srgb, var(--color-foreground) 32%, transparent);
    transition: inline-size var(--dur-base) var(--ease-standard);
}

/* Skeleton. Footprint matches .att-card exactly (58px, same padding, same
   gap) so resolving is an in-place swap. One mask on the row, same
   stepShimmer keyframes as .artifact-skeleton-inner — the transcript's one
   loading idiom, symmetric ramp, so no [dir="rtl"] variant. */
.att-card[data-att-state="uploading"] { pointer-events: none; }
/* The wrapper had no width rule: as a flex child it shrink-wrapped, and the
   percentage line widths below resolved against an indefinite width — i.e.
   to zero. Only the 34px icon block had intrinsic size, so the "skeleton"
   was a 34px square and the shimmer swept 34px of a 320px card. The
   determinate bar was the only saturated element left, which is the "thin
   blue line" the card appeared to be. */
.att-skeleton { flex: 1 1 auto; min-inline-size: 0; }
/* PRODUCT-DOC-7: the server is working on the sent file (a recording's
   transcription): the skeleton's place, the resolved card's row. */
.att-card-working { display: flex; align-items: center; gap: var(--space-3); flex: 1 1 auto; min-inline-size: 0; padding-inline-end: 28px; }
.att-skeleton-inner {
    display: flex; flex-direction: row; align-items: center;
    gap: var(--space-3); min-block-size: 34px;
    -webkit-mask-image: linear-gradient(90deg,
        color-mix(in srgb, var(--color-shadow) 45%, transparent) 0%, color-mix(in srgb, var(--color-shadow) 45%, transparent) 35%, var(--color-shadow) 50%,
        color-mix(in srgb, var(--color-shadow) 45%, transparent) 65%, color-mix(in srgb, var(--color-shadow) 45%, transparent) 100%);
            mask-image: linear-gradient(90deg,
        color-mix(in srgb, var(--color-shadow) 45%, transparent) 0%, color-mix(in srgb, var(--color-shadow) 45%, transparent) 35%, var(--color-shadow) 50%,
        color-mix(in srgb, var(--color-shadow) 45%, transparent) 65%, color-mix(in srgb, var(--color-shadow) 45%, transparent) 100%);
    -webkit-mask-size: 300% 100%;    mask-size: 300% 100%;
    -webkit-mask-repeat: no-repeat;  mask-repeat: no-repeat;
    -webkit-mask-position: 0% 50%;   mask-position: 0% 50%;
    animation: stepShimmer 2.6s linear infinite;
    will-change: mask-position;
}
.att-skeleton .as-icon,
.att-skeleton .as-line { background: color-mix(in srgb, var(--color-foreground) 9%, transparent); display: block; }
.att-skeleton .as-icon { flex: 0 0 auto; inline-size: 34px; block-size: 34px; border-radius: var(--radius-md); }
.att-skeleton-lines    { display: flex; flex-direction: column; gap: 5px; flex: 1 1 auto; }
.att-skeleton .as-line-name { inline-size: 60%; block-size: 9px;  border-radius: var(--radius-sm); }
.att-skeleton .as-line-type { inline-size: 34%; block-size: 8px;  border-radius: var(--radius-sm); }

/* prefers-reduced-motion: the same stepShimmer as .artifact-skeleton-inner
   runs here, and the .artifact-skeleton prefers-reduced-motion override
   (chat_enhanced.css:14027) is scoped to that selector only. Without an
   equivalent on .att-skeleton-inner, the mask animates for users who
   asked it not to. */
@media (prefers-reduced-motion: reduce) {
    .att-skeleton-inner {
        -webkit-mask-image: none; mask-image: none; animation: none;
    }
}

/* Image tile — the one kind where a thumbnail beats a filename. ~110x140. */
.att-card.att-card-tile {
    flex-direction: column; align-items: stretch;
    inline-size: 110px; block-size: 140px; min-block-size: 0;
    gap: var(--space-1); padding: var(--space-2);
}
.att-card-tile .att-tile-name {
    font-size: var(--text-xs); color: var(--color-foreground);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.att-card-tile .att-tile-body { flex: 1 1 auto; overflow: hidden; border-radius: var(--radius-md); }
.att-card-tile .att-tile-body img { inline-size: 100%; block-size: 100%; object-fit: cover; display: block; }
.att-card-tile .att-tile-badge {
    align-self: start; font-size: var(--text-2xs); font-weight: 600; letter-spacing: .02em;
    color: var(--color-muted-foreground);
    background: color-mix(in srgb, var(--color-foreground) 6%, transparent);
    padding: 1px 5px; border-radius: var(--radius-sm);
}
.att-card-tile .att-remove { position: absolute; inset-block-start: var(--space-2); inset-inline-end: var(--space-2); }

/* Pasted-text card. Taller than the 58px row because the content IS the
   identity — a filename of "pasted.txt" distinguishes nothing. Same border,
   radius, fill, hover and × as every other .att-card; only the interior
   differs. */
.att-card.att-card-paste {
    flex-direction: column;
    align-items: stretch;
    justify-content: space-between;
    gap: var(--space-2);
    inline-size: min(320px, 100%);
    min-block-size: 104px;
    cursor: pointer;
    padding: var(--space-3);
}
.att-paste-preview {
    flex: 1 1 auto;
    min-block-size: 0;
    overflow: hidden;
    color: var(--color-muted-foreground);
    font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
    font-size: var(--text-xs);
    line-height: 1.45;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    /* dir="auto" on the element picks the direction from the first strong
       character — Hebrew prose goes RTL, code goes LTR. `start` follows it;
       a physical `left` inherited from an ancestor would override it. */
    text-align: start;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 4;
    /* Fade rather than an ellipsis: line-clamp's ellipsis lands mid-token on
       code and reads as a syntax error. The gradient is direction-agnostic,
       so no [dir="rtl"] variant. */
    -webkit-mask-image: linear-gradient(to bottom, var(--color-shadow) 60%, transparent 100%);
            mask-image: linear-gradient(to bottom, var(--color-shadow) 60%, transparent 100%);
}
.att-paste-badge {
    align-self: start;
    flex: 0 0 auto;
}
.att-card-paste .att-remove {
    position: absolute;
    inset-block-start: var(--space-2);
    inset-inline-end: var(--space-2);
}

/* Pasted-text modal. Rides its own overlay rather than .ihub-form-overlay:
   that one's panel (.ihub-form-modal) is `background: white` with a
   .dark-mode patch, and this surface is fully token-driven, so both themes
   are one set of values. Same reasoning as .ihub-ds-modal. */
.paste-modal-overlay {
    position: fixed; inset: 0;
    background: var(--color-scrim);
    z-index: var(--z-modal-l1-backdrop);
    display: flex; align-items: center; justify-content: center;
    padding: var(--space-6);
}
.paste-modal {
    position: relative;
    z-index: var(--z-modal-l1-panel);
    inline-size: min(720px, 100%);
    max-block-size: min(80vh, 760px);
    display: flex; flex-direction: column; gap: var(--space-2);
    padding: var(--space-6);
    background: var(--color-card);
    color: var(--color-foreground);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl, 16px);
    box-shadow: var(--shadow-lg);
}
.paste-modal-x {
    position: absolute;
    inset-block-start: var(--space-4);
    /* Logical: the × is at the trailing corner, which is the LEFT in RTL. */
    inset-inline-end: var(--space-4);
}
.paste-modal-title {
    margin: 0;
    /* Leaves room for the × so a long name never slides under it. */
    padding-inline-end: var(--space-8);
    font-size: var(--text-h2); font-weight: 600;
    overflow-wrap: anywhere;
    text-align: start;
}
.paste-modal-sub {
    margin: 0;
    font-size: var(--text-sm);
    color: var(--color-muted-foreground);
}
.paste-modal-meta {
    display: flex; align-items: center; gap: var(--space-2);
    margin-block: var(--space-2);
    flex-wrap: wrap;
}
.paste-modal-facts {
    font-size: var(--text-xs);
    color: var(--color-muted-foreground);
    font-variant-numeric: tabular-nums;
}
.paste-modal-body {
    flex: 1 1 auto;
    min-block-size: 120px;
    overflow: auto;                 /* the app's ::-webkit-scrollbar applies */
    padding: var(--space-4);
    background: color-mix(in srgb, var(--color-foreground) 3%, transparent);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
}
.paste-modal-body pre {
    margin: 0;
    font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
    font-size: var(--text-ui);
    line-height: 1.5;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    /* Follows the element's own dir="auto" instead of an inherited physical
       alignment — same rule as .artifact-panel-pre (chat_enhanced.css:14483). */
    text-align: start;
}
.paste-modal-foot {
    display: flex; justify-content: flex-end; align-items: center;
    gap: var(--space-2);
    margin-block-start: var(--space-2);
}
[data-slot="tabs-list"][data-variant="segmented"] [data-slot="tabs-trigger"][aria-selected="true"] { background: var(--color-card); box-shadow: var(--shadow-xs); }

/* ── UX-B18: the file card's controls, the files footer, the receipt ──────
   The file card is a group (D-P-14, HC12-NEW-001): its toggle, "Go to the
   current version", Download and the ⋯ menu are siblings. The toggle carries
   the icon, the name and the card's state, so it takes the row the card's
   own flex layout (chat_enhanced.css's .file-card) used to give them. Tokens
   only; geometry and the tokens' own colours. */
.file-card > .file-card-open {
  display: flex; flex: 1 1 auto; min-inline-size: 0; align-items: center; gap: var(--space-3);
  margin: 0; padding: 0; border: 0; background: transparent; color: inherit;
  font: inherit; text-align: start; cursor: pointer; border-radius: var(--radius-lg);
}
.file-card > .file-card-open:focus-visible { outline: 2px solid var(--color-ring); outline-offset: 2px; }
.file-card-badges { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1); }
.file-card-badges:not(:has(> :not([hidden]))) { display: none; }
.file-card-audience { font-size: var(--text-xs); color: var(--color-muted-foreground); }
.file-card.is-open { border-color: var(--color-ring); }
/* "Earlier version": muted by its words and a dashed edge, never by opacity
   (the name must keep its contrast). */
.file-card.is-earlier { border-style: dashed; }
.file-card.is-earlier .file-card-name { color: var(--color-muted-foreground); }
.file-card > .file-card-current,
.file-card > .file-card-download { flex: 0 0 auto; }
.file-card > .file-card-more.conversation-actions { opacity: 1; transform: none; flex: 0 0 auto; position: relative; }
.file-card > .file-card-more .conv-more-btn { min-inline-size: 32px; min-block-size: 32px; }
/* The inline Markdown card: the document under the card's row. */
.file-card.file-card-has-doc { flex-wrap: wrap; }
.file-card-doc {
  flex: 1 1 100%; display: flex; flex-direction: column; gap: var(--space-1);
  padding-block-start: var(--space-2); border-block-start: 1px solid var(--color-border); cursor: auto;
}
.file-card-doc-title { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.file-card-doc-body { max-block-size: 12em; overflow: hidden; font-size: var(--text-sm); }
@media (max-width: 640px) {
  /* A narrow phone: the toggle keeps the width; Download shows its icon alone
     (its name stays in aria-label). */
  .file-card > .file-card-download > span { position: absolute; inline-size: 1px; block-size: 1px;
    overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .file-card > .file-card-download, .file-card > .file-card-more .conv-more-btn { min-inline-size: 44px; min-block-size: 44px; }
}

/* The files footer (T11): the turn's created and changed files, under the
   answer, each with Open (the panel's toggle) and Download. */
.turn-files {
  margin-block: var(--space-2); padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-border); border-radius: var(--radius-lg); max-inline-size: 820px;
}
.turn-files-title { margin: 0 0 var(--space-1); font-size: var(--text-xs); font-weight: 600; color: var(--color-muted-foreground); }
.turn-files-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-1); }
.turn-file { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1) var(--space-2); min-block-size: 32px; font-size: var(--text-sm); }
.turn-file-verb { color: var(--color-muted-foreground); }
.turn-file-name { flex: 1 1 8em; min-inline-size: 0; font-weight: 500; overflow-wrap: anywhere; }
.turn-file-actions { display: inline-flex; gap: var(--space-1); margin-inline-start: auto; }
.turn-file.is-earlier .turn-file-name { color: var(--color-muted-foreground); }
.turn-file.is-open .turn-file-open { border-color: var(--color-ring); }
@media (max-width: 640px) {
  .turn-file-actions > [data-slot="button"] { min-block-size: 44px; }
}

/* OSS-02: a decided approval card's receipt. Text only, in the transcript. */
.hitl-receipt {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1) var(--space-2);
  margin-block: var(--space-2); padding: var(--space-2) var(--space-3); max-inline-size: 820px;
  border: 1px solid var(--color-border); border-radius: var(--radius-lg);
  font-size: var(--text-sm); color: var(--color-foreground);
}
.hitl-receipt-icon { display: inline-flex; color: var(--color-muted-foreground); }
.hitl-receipt-text { flex: 1 1 12em; min-inline-size: 0; overflow-wrap: anywhere; }
.hitl-receipt-outcome { font-weight: 600; }
.hitl-receipt-meta { font-size: var(--text-xs); color: var(--color-muted-foreground); }
.artifact-panel-title { margin: 0; }
.artifact-panel-title:focus { outline: none; }
.artifact-panel-title:focus-visible { outline: 2px solid var(--color-ring); outline-offset: 2px; }

/* ── UX-P5a: the hub kit I (qa/PHASE-UX-P5a.md) ─────────────────────
   The regions, in order: the loading shapes, the row contract's hover rule,
   the header block, the empty block's extras, the audience control
   (.select-inline, .hub-access), the selection bar's Clear and divider, and
   the two shared RTL rules (.flip-rtl, .bidi-plain). Tokens only. */

/* The loading shapes (R1; BENCH-1-1): a skeleton in the content's own
   geometry — rows (46 px, the K-B row height), a table (a head row and its
   cells), a detail (a heading and its lines). Cards and tiles keep
   integrations_hub.css's .ihub-skel-card / .ihub-skel-tile rules. */
.hub-skeleton--rows, .hub-skeleton--table {
  display: flex; flex-direction: column; border-block-start: 1px solid var(--color-border);
}
.hub-skeleton--rows .ihub-skel-row {
  block-size: 46px; padding: 0; gap: var(--space-3); border-block-end: 1px solid var(--color-border);
}
.hub-skeleton .ihub-skel-tile-sm { inline-size: 24px; block-size: 24px; border-radius: var(--radius-sm); flex: none; }
.hub-skeleton--rows .ihub-skel-name { inline-size: 32%; }
.hub-skeleton--rows .ihub-skel-meta { inline-size: 12%; block-size: 10px; margin-inline-start: auto; }
.hub-skeleton--table .ihub-skel-row {
  display: grid; grid-template-columns: var(--hub-skel-cols, repeat(4, minmax(0, 1fr)));
  gap: var(--space-4); block-size: 44px; align-items: center; padding: 0 var(--space-2);
  border-block-end: 1px solid var(--color-border);
}
.hub-skeleton--table .ihub-skel-row.ihub-skel-head { block-size: 36px; }
.hub-skeleton--table .ihub-skel-line { inline-size: 70%; }
.hub-skeleton--table .ihub-skel-head .ihub-skel-line { inline-size: 40%; block-size: 10px; }
.hub-skeleton--detail {
  display: flex; flex-direction: column; align-items: stretch; gap: var(--space-3);
  padding: var(--space-4) 0; max-inline-size: 720px; text-align: start;
}
.hub-skeleton--detail .ihub-skel-detail { display: flex; flex-direction: column; gap: var(--space-3); }
.hub-skeleton--detail .ihub-skel-h { block-size: 22px; inline-size: 45%; }
.hub-skeleton--detail .ihub-skel-sub { inline-size: 30%; block-size: 10px; }

/* The row contract (R2; BENCH-2-2): a .hub-row reveals its ⋯ and one quick
   action on hover and on focus; always visible where there is no hover
   (touch) and under 768 px. Scoped to .hub-row: a list that has not adopted
   the contract keeps .hub-menu's at-rest ⋯ (integrations_hub.css). */
.hub-row { position: relative; }
.hub-row .hub-menu .conv-more-btn, .hub-row .hub-row-quick { opacity: 0; transition: opacity 120ms var(--ease-standard); }
.hub-row:hover .hub-menu .conv-more-btn, .hub-row:focus-within .hub-menu .conv-more-btn,
.hub-row .hub-menu .conv-more-btn[aria-expanded="true"],
.hub-row:hover .hub-row-quick, .hub-row:focus-within .hub-row-quick { opacity: 1; }
@media (hover: none), (max-width: 768px) {
  .hub-row .hub-menu .conv-more-btn, .hub-row .hub-row-quick { opacity: 1; }
}

/* The header block (R3; BENCH-5-1; mockup 4-task-header.html): one row —
   the title (its icon, its status pill) at the inline-start, the actions at
   the inline-end; the description and the meta line under the title. At
   390 px the actions wrap under the title, start-aligned, 44 px targets. */
.hub-header-row { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-4); flex-wrap: wrap; }
.hub-header-main { display: flex; flex-direction: column; gap: var(--space-1); min-inline-size: 0; flex: 1 1 320px; }
.hub-header-main > .ihub-view-title, .hub-header-title { flex-wrap: wrap; row-gap: var(--space-1); }
.hub-header-title { display: flex; align-items: center; gap: var(--space-3); }
.hub-header-title > h1, .hub-header-title > h2 { margin: 0; font-size: var(--text-2xl); font-weight: 700; line-height: var(--leading-tight); letter-spacing: -0.02em; }
.hub-header-pill {
  display: inline-flex; align-items: center; gap: var(--space-1); block-size: 24px; padding: 0 10px;
  border-radius: var(--radius-pill); background: var(--color-muted); color: var(--color-foreground);
  font-size: var(--text-xs); font-weight: 600; letter-spacing: 0; white-space: nowrap;
}
.hub-header-pill::before { content: ""; inline-size: 8px; block-size: 8px; border-radius: var(--radius-pill); border: 2px solid currentColor; flex: none; }
.hub-header-pill[data-tone="success"] { color: var(--color-success); }
.hub-header-pill[data-tone="warning"] { color: var(--color-warning); }
.hub-header-pill[data-tone="danger"] { color: var(--color-danger); }
.hub-header-pill[data-tone="primary"] { color: var(--color-primary); }
.hub-header-desc { margin: 0; font-size: var(--text-sm); color: var(--color-foreground); }
.hub-header-meta { margin: 0; display: flex; align-items: center; gap: var(--space-2); font-size: var(--text-xs); font-weight: 500; color: var(--color-muted-foreground); }
.hub-header-actions { display: flex; align-items: center; gap: var(--space-2); flex: 0 0 auto; margin-inline-start: auto; }
.hub-header-desc:empty, .hub-header-meta:empty, .hub-header-actions:empty { display: none; }
@media (max-width: 768px) {
  .hub-header-actions { margin-inline-start: 0; inline-size: 100%; flex-wrap: nowrap; }
  .hub-header-actions > .ihub-btn, .hub-header-actions > .conv-more-btn, .hub-header-actions > .hub-menu > .conv-more-btn { min-block-size: 44px; min-inline-size: 44px; }
}
/* UX-B42 (UXP5E-NEW-006): a detail page in a narrow container (a side panel
   open beside it) wraps its actions under the title start-aligned too, not
   only a narrow viewport: the hub's own container (each hub root's
   `container: … / inline-size`) decides. */
@container (max-width: 640px) {
  .hub-header-actions { margin-inline-start: 0; inline-size: 100%; }
}

/* UX-B42 (the operator, 2026-11-04): one content width for every hub. Each
   hub's view, its list and its detail, sits in ONE centred column
   (--ihub-col-max, 72rem), and the header block, the toolbar, the chips and
   the table share its edges; no hub keeps a width of its own. The body
   scrolls and the header does not, so the kit gives the header the body's
   scrollbar gutter (--hub-gutter, hub/page.js): both columns centre in the
   same box. */
.integrations-hub-view > .ihub-view-header > .ihub-column,
.integrations-hub-view > .ihub-view-body > [id$="-root"] {
  max-inline-size: var(--ihub-col-max);
  margin-inline: auto;
  padding-inline: var(--ihub-col-pad);
  inline-size: 100%;
  box-sizing: border-box;
}
.integrations-hub-view > .ihub-view-body { padding-inline: 0; }
.integrations-hub-view > .ihub-view-header { padding-inline-end: var(--hub-gutter, 0px); }

/* The empty block (BENCH-7-1): the primary action's shortcut, the one secondary link. */
.hub-empty-actions .hub-kbd {
  font: inherit; font-size: var(--text-xs); line-height: 1; padding: 2px 6px; margin-inline-start: var(--space-2);
  border: 1px solid var(--color-border); border-radius: var(--radius-sm); color: var(--color-muted-foreground);
}
.hub-empty-link { align-self: center; font-size: var(--text-sm); color: var(--color-primary); text-decoration: none; }
.hub-empty-link:hover { text-decoration: underline; }

/* The audience control (R4; BENCH-4-1, 4-3; mockup 3-side-panel.html): a
   text button sized to its words — an icon slot, the label, a chevron, 32 px
   — never a full-width select; its helper sentence under it, muted. */
.select-inline {
  display: inline-flex; align-items: center; gap: var(--space-2); block-size: 32px; max-inline-size: 100%;
  padding: 0 10px; border-radius: var(--radius-md); border: 1px solid var(--color-border);
  background: var(--color-background); color: var(--color-foreground);
  font-family: inherit; font-size: var(--text-sm); font-weight: 500; line-height: 1; cursor: pointer;
}
.select-inline:hover { background: var(--color-muted); }
.select-inline:focus-visible { outline: none; border-color: var(--color-ring); box-shadow: 0 0 0 var(--ring-width) var(--ring-color); }
.select-inline[disabled], .select-inline[aria-disabled="true"] { opacity: 0.6; cursor: default; }
.select-inline-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.select-inline > .lc { flex: none; }
.select-inline-chevron { color: var(--color-muted-foreground); }
.hub-access { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.hub-access-label { font-size: var(--text-sm); font-weight: 600; }
.hub-access-help { margin: 0; font-size: var(--text-xs); color: var(--color-muted-foreground); }
.hub-access-form { display: flex; flex-direction: column; gap: var(--space-2); }
.hub-access-opt {
  display: flex; align-items: flex-start; gap: var(--space-3); padding: var(--space-3);
  border: 1px solid var(--color-border); border-radius: var(--radius-md); cursor: pointer;
}
.hub-access-opt:has(input:checked) { border-color: var(--color-primary); }
.hub-access-opt:has(input:focus-visible) { box-shadow: 0 0 0 var(--ring-width) var(--ring-color); }
.hub-access-opt-main { display: flex; flex-direction: column; gap: 2px; min-inline-size: 0; }
.hub-access-opt-label { display: flex; align-items: center; gap: var(--space-2); font-weight: 600; }
.hub-access-opt-desc { font-size: var(--text-xs); color: var(--color-muted-foreground); }

/* The selection bar (UXP4-NEW-013-a; spec §2.2 L-B-details): "× Clear
   selection" first, a divider before the destructive action. */
.ks-selbar__clear--first { display: inline-flex; align-items: center; gap: var(--space-1); }
.ks-selbar__divider { inline-size: 1px; align-self: stretch; min-block-size: 20px; background: var(--color-border); margin-inline: var(--space-1); }

/* Shared RTL rules (UXP4-NEW-060-a, -095-a): a glyph that points along the
   line inside .flip-rtl mirrors in a right-to-left page; an English-only
   sentence block keeps its punctuation at its own end. */
[dir="rtl"] .flip-rtl .lc { transform: scaleX(-1); }
.bidi-plain { unicode-bidi: plaintext; }

/* ── UX-B13 s2: dialogs, confirmations, cards, shortcuts ─────────── */
/* `hidden` always wins over a [data-slot] display (INT-NEW-173's rule, for
   every page; UX-B13S1-NEW-006). */
[data-slot][hidden] { display: none !important; }
/* HubModal.dialog()'s Back is `hidden` until a second step; .ihub-modal-close's
   display beat the attribute, so an empty "Back" was every dialog's first stop. */
.ihub-modal-back[hidden] { display: none !important; }

/* The legacy dialogs' × are buttons named "Close" now: no button chrome.
   (0,0,2): above style.css's bare `button` fill, below each dialog's own
   class rules, which still size and colour them. */
html button:where(.popup-modal-close, .close, .agent-selection-close) {
  appearance: none; background: none; border: 0; padding: 0; margin: 0;
  font: inherit; color: inherit; line-height: 1; cursor: pointer; box-shadow: none;
}
:where(button.popup-modal-close, button.close, button.agent-selection-close):focus-visible {
  outline: var(--ring-width) solid var(--ring-color); outline-offset: 2px; border-radius: var(--radius-sm);
}

/* D-P-02: a card's title is its button; the ring is the whole card's.
   (0,0,2) as above: the title's own class rules still win. */
html button:where([data-card-open]) {
  appearance: none; background: none; border: 0; border-radius: 0; padding: 0; margin: 0;
  font: inherit; color: inherit; text-align: start; cursor: pointer; box-shadow: none;
}
[data-hub-card] button[data-card-open]:focus-visible { outline: none; }   /* ring: [data-hub-card]:has(...) */
[data-hub-card]:has(button[data-card-open]:focus-visible) {
  outline: var(--ring-width) solid var(--ring-color); outline-offset: 2px;
}

/* The one confirmation's parts (HubModal.confirm). Its danger button on the
   danger token: integrations_hub.css's #ef4444 under white text is 3.8:1. */
[data-hub-modal] .ihub-btn.danger,
[data-hub-modal] .ihub-btn.danger:hover { background: var(--color-danger); color: var(--color-danger-foreground); }
/* …and its Cancel in the text colour (the muted grey read 3.x:1 on the panel). */
[data-hub-modal] .ihub-btn.ghost { color: var(--color-foreground); }
.hub-confirm-consequence,
.hub-confirm-exception,
.hub-confirm-escape { margin: 0 0 var(--space-3); font-size: var(--text-sm); line-height: 1.5; }
.hub-confirm-exception,
.hub-confirm-escape { color: var(--color-muted-foreground); }
/* UX-B30 s2: what goes with a delete (the server's preflight, one line each)
   and the retention sentence, in the place "This cannot be undone." takes
   when it can be undone for 30 days. */
.hub-confirm-lines {
  margin: 0 0 var(--space-3); padding-inline-start: var(--space-5);
  font-size: var(--text-sm); line-height: 1.5;
}
.hub-confirm-lines li + li { margin-block-start: var(--space-1); }
.hub-confirm-retention {
  margin: 0 0 var(--space-5); font-size: var(--text-sm); font-weight: 600; line-height: 1.5;
}

/* The keyboard shortcuts dialog (shortcuts.js). */
.kbd-section { margin: var(--space-4) 0 var(--space-2); font-size: var(--text-sm); font-weight: 600; }
.kbd-section:first-child { margin-block-start: 0; }
.kbd-list { margin: 0; }
.kbd-row {
  display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-4);
  padding-block: var(--space-2); border-block-end: 1px solid var(--color-border);
}
.kbd-row dt { order: 2; flex-shrink: 0; white-space: nowrap; }
.kbd-row dd { order: 1; margin: 0; font-size: var(--text-sm); }
.kbd-row kbd {
  display: inline-block; min-inline-size: 1.75em; padding: 2px var(--space-1);
  border: 1px solid var(--color-border); border-radius: var(--radius-sm);
  background: var(--color-muted); color: var(--color-foreground);
  font: inherit; font-size: var(--text-xs); text-align: center;
}
.kbd-row dt span { margin-inline: 2px; color: var(--color-muted-foreground); }
.kbd-note { color: var(--color-muted-foreground); font-size: var(--text-xs); }

/* UX-B39 (CONN-C5): the one trust sentence on every connector surface
   (HubConnections.trustHtml, static/js/hub/connections.js). Tokens only. */
.conn-trust {
  margin: var(--space-2) 0; color: var(--color-muted-foreground);
  font-size: var(--text-xs); line-height: 1.45;
}
.conv-menu .conn-trust { margin: 0; padding: var(--space-1) var(--space-3) var(--space-2); max-inline-size: 18rem; }

/* ── UX-P5b: the one menu (BENCH-3-1 … 3-3; UXP4-NEW-066, -075, -092; the mockup
   2-row-and-menu.html) ─────────────────────────────────────────────────────
   One block, on tokens, that every menu picks up by the class it already
   carries: .conv-menu (HubMenu.render: every ⋯ menu, the user menu, the
   connectors' cluster, Regenerate), .conv-submenu (a nested view) and
   .proj-sort-menu (HubDropdown: the sorts, the filters, the share sheet's
   audience). 220–280 px wide, 12 px corners, 6 px inset; rows 32 px tall
   with 8 px corners; one separator; the icon column 16 px (all or none per
   menu, the builder's rule); the shortcut at the inline end in the muted
   colour, one notation; the danger row red and last; a disabled row muted,
   still under the pointer and in the keyboard's walk (its reason is a
   HubTip). `body` scopes the panel rules so they outrank the page sheets'
   own panel rules in the same layer (chat_enhanced.css's
   .conv-menu:has(.ui-menu-item), integrations_hub.css's .proj-sort-menu):
   those duplicates are UX-B42's sweep to delete; nothing here sets display
   or position, which stay the opener's. The composer's .pmode-menu joins
   when UX-B44 draws it through Dialogs.menu. A panel that holds a search
   above its role="menu" list (a search box is no child a menu may hold:
   the composer's connectors, HubDropdown's searchable mode) says
   data-menu-panel and takes the same look (UX-B42, UXP5F-NEW-001 / -002). */
body .conv-menu[role="menu"],
body .conv-menu[data-menu-panel],
body .conv-submenu[role="menu"],
body .proj-sort-menu[role="menu"],
body .proj-sort-menu[data-menu-panel] {
  box-sizing: border-box;
  padding: var(--space-1_5);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-card);
  background-clip: padding-box;
  color: var(--color-foreground);
  box-shadow: var(--shadow-md);
  font-size: var(--text-ui);
  font-weight: 500;
}
/* The width: 220–280 px, the content's, for the ⋯ menus. A dropdown
   (HubDropdown: a select's list) follows its control and its content — its
   trigger's width when portaled (hub/place.js), its content's otherwise —
   under the same cap: a 220 px floor on a list anchored at the inline end of
   a short "Sort by" near the edge of a 390 px page ran off it. */
body .conv-menu[role="menu"],
body .conv-menu[data-menu-panel],
body .conv-submenu[role="menu"] {
  inline-size: max-content;
  min-inline-size: 220px;
  max-inline-size: 280px;
}
body .proj-sort-menu:is([role="menu"], [data-menu-panel]) { max-inline-size: min(280px, calc(100vw - 16px)); }
body :is(.conv-menu, .conv-submenu, .proj-sort-menu) :is(.ui-menu-item, .proj-sort-item) {
  display: flex;
  align-items: center;
  gap: var(--space-2_5);
  inline-size: 100%;
  min-block-size: 32px;
  margin: 0;
  padding: 0 var(--space-2_5);
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-foreground);
  font: inherit;
  text-align: start;
  cursor: pointer;
}
body :is(.conv-menu, .conv-submenu, .proj-sort-menu) :is(.ui-menu-item, .proj-sort-item):hover {
  background: color-mix(in srgb, var(--color-foreground) 6%, transparent);
}
body :is(.conv-menu, .conv-submenu, .proj-sort-menu) :is(.ui-menu-item, .proj-sort-item):focus-visible {
  outline: none;
  background: color-mix(in srgb, var(--color-foreground) 6%, transparent);
  box-shadow: 0 0 0 var(--ring-width, 2px) var(--ring-color);
}
body :is(.conv-menu, .conv-submenu, .proj-sort-menu) :is(.ui-menu-item-icon, .proj-sort-item-icon) {
  flex: 0 0 16px;
  inline-size: 16px;
  block-size: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--color-muted-foreground);
}
body :is(.conv-menu, .conv-submenu, .proj-sort-menu) :is(.ui-menu-item-label, .proj-sort-item-text) {
  flex: 1 1 auto;
  min-inline-size: 0;
  text-align: start;
  font-weight: 500;
}
/* HubDropdown's chosen row (single-select) keeps its emphasis. */
body .proj-sort-menu .proj-sort-item.active {
  background: color-mix(in srgb, var(--color-foreground) 6%, transparent);
  font-weight: 600;
}
/* The shortcut column: the row's own letter (B13 s3's kbd) and a declared
   shortcut (HubMenu.shortcut) print the same way — muted, at the inline end. */
body :is(.conv-menu, .conv-submenu, .proj-sort-menu) .ui-menu-key {
  flex: 0 0 auto;
  margin-inline-start: auto;
  min-inline-size: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  font: inherit;
  font-size: var(--text-xs);
  font-weight: 400;
  line-height: 1;
  color: var(--color-muted-foreground);
}
body :is(.conv-menu, .conv-submenu, .proj-sort-menu) .conv-chev {
  flex: 0 0 auto;
  margin-inline-start: auto;
  color: var(--color-muted-foreground);
  opacity: 1;
}
[dir="rtl"] body :is(.conv-menu, .conv-submenu, .proj-sort-menu) .conv-chev,
body [dir="rtl"] :is(.conv-menu, .conv-submenu, .proj-sort-menu) .conv-chev { transform: scaleX(-1); }
body :is(.conv-menu, .conv-submenu, .proj-sort-menu) .ui-menu-sep {
  block-size: 1px;
  margin: var(--space-1_5) var(--space-1);
  background: var(--color-border);
}
body :is(.conv-menu, .conv-submenu, .proj-sort-menu) .ui-menu-section {
  padding: var(--space-2) var(--space-2_5) var(--space-1);
  font-size: var(--text-2xs);
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--color-muted-foreground);
}
/* The danger row: red, last (the builder's and the census's rule). */
body :is(.conv-menu, .conv-submenu, .proj-sort-menu) :is(.ui-menu-item--danger, .proj-sort-item-danger),
body :is(.conv-menu, .conv-submenu, .proj-sort-menu) :is(.ui-menu-item--danger, .proj-sort-item-danger) :is(.ui-menu-item-icon, .ui-menu-item-label, .proj-sort-item-icon, .proj-sort-item-label) {
  color: var(--color-danger);
}
body :is(.conv-menu, .conv-submenu, .proj-sort-menu) :is(.ui-menu-item--danger, .proj-sort-item-danger):hover {
  background: color-mix(in srgb, var(--color-danger) 10%, transparent);
}
/* A disabled row (UXP4-NEW-066-a): muted, reachable by the keyboard and the
   pointer (hub/menu.js's guard stops its click); its reason is its tip. */
body :is(.conv-menu, .conv-submenu, .proj-sort-menu) :is(.ui-menu-item, .proj-sort-item)[aria-disabled="true"],
body :is(.conv-menu, .conv-submenu, .proj-sort-menu) :is(.ui-menu-item, .proj-sort-item)[aria-disabled="true"] :is(.ui-menu-item-icon, .ui-menu-item-label, .proj-sort-item-icon, .proj-sort-item-label) {
  color: var(--color-muted-foreground);
}
body :is(.conv-menu, .conv-submenu, .proj-sort-menu) :is(.ui-menu-item, .proj-sort-item)[aria-disabled="true"] {
  cursor: default;
  pointer-events: auto;
}
body :is(.conv-menu, .conv-submenu, .proj-sort-menu) :is(.ui-menu-item, .proj-sort-item)[aria-disabled="true"]:hover {
  background: transparent;
}
/* A nested view opened by hub/menu.js (data-hub-static) sits beside its
   trigger, placed by the kit; the sidebar's own (the projects) keeps its rule. */
body .conv-submenu[data-hub-static] { display: none; z-index: 10001; }
body .conv-submenu[data-hub-static].show { display: block; }

/* ── UX-P5b: the tip (.tip region; HubTip in hub/hint.js) ─────────────────
   One #hub-tip in the page: the reason a control gives on hover and on
   keyboard focus. Fixed, above every menu and dialog, never under the
   pointer; the words wrap at 18 rem. */
#hub-tip.hub-tip {
  position: fixed;
  z-index: var(--z-tooltip, 10002);
  max-inline-size: 18rem;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  background: var(--color-foreground);
  color: var(--color-background);
  font-size: var(--text-xs);
  font-weight: 400;
  line-height: 1.4;
  text-align: start;
  pointer-events: none;
  box-shadow: var(--shadow-sm);
}
#hub-tip.hub-tip[hidden] { display: none; }

/* ── UX-B25 s2: the artefact panel's identity, its table and html kinds ───
   (ArtifactPanel.js). The strip under the header: the versions button and
   list (the current marked; an earlier version read-only), who can see it.
   The workbook's tables, the html frame's sheet, the panel's footer with
   "Open new files automatically". Tokens only; 12 px corners. */
.artifact-panel-info {
  flex: 0 0 auto; display: flex; flex-direction: column; gap: var(--space-2);
  padding: var(--space-2) var(--space-4); border-block-end: 1px solid var(--color-border);
  font-size: var(--text-sm);
}
.artifact-panel-inforow { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-3); }
.artifact-panel-audience { color: var(--color-muted-foreground); }
.artifact-panel-readonly {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1) var(--space-2); margin: 0;
  padding: var(--space-2) var(--space-3); border: 1px dashed var(--color-border); border-radius: var(--radius-md);
}
/* `hidden` wins over each part's own display (a file the entity does not know shows none). */
.artifact-panel-info[hidden], .artifact-panel-readonly[hidden], .artifact-panel-vlist[hidden] { display: none; }
.artifact-panel-vlist {
  list-style: none; margin: 0; padding: var(--space-1); display: flex; flex-direction: column; gap: var(--space-1);
  max-block-size: 14rem; overflow: auto; border: 1px solid var(--color-border); border-radius: var(--radius-md);
}
.artifact-panel-vrow { display: flex; align-items: center; gap: var(--space-2); }
.artifact-panel-vopen {
  display: flex; flex: 1 1 auto; min-inline-size: 0; flex-wrap: wrap; align-items: center; gap: var(--space-1) var(--space-2);
  min-block-size: 32px; padding: var(--space-1) var(--space-2); border: 0; border-radius: var(--radius-md);
  background: transparent; color: inherit; font: inherit; text-align: start; cursor: pointer;
}
.artifact-panel-vopen:hover { background: var(--color-muted); }
.artifact-panel-vopen[aria-current="true"] { background: var(--color-muted); font-weight: 600; }
.artifact-panel-vopen:focus-visible, .artifact-panel-vturn:focus-visible,
.artifact-panel-tablewrap:focus-visible, .artifact-panel-rename:focus-visible {
  outline: 2px solid var(--color-ring); outline-offset: 2px;
}
.artifact-panel-vwhen { color: var(--color-muted-foreground); font-size: var(--text-xs); font-weight: 400; }
.artifact-panel-vturn { flex: 0 0 auto; font-size: var(--text-xs); color: var(--color-foreground); }
.artifact-panel-note { margin: 0; font-size: var(--text-xs); color: var(--color-muted-foreground); }
.artifact-panel-note:empty { display: none; }
.artifact-panel-rename {
  inline-size: 100%; min-block-size: 32px; padding-inline: var(--space-2); border: 1px solid var(--color-input);
  border-radius: var(--radius-md); background: var(--color-background); color: var(--color-foreground);
  font: inherit; font-weight: 600;
}
.artifact-panel-table { block-size: 100%; overflow: auto; padding: var(--space-3) var(--space-4); }
.artifact-panel-sheet + .artifact-panel-sheet { margin-block-start: var(--space-4); }
.artifact-panel-sheet-name { margin: 0 0 var(--space-2); font-size: var(--text-sm); font-weight: 600; }
.artifact-panel-tablewrap { overflow: auto; max-inline-size: 100%; border: 1px solid var(--color-border); border-radius: var(--radius-md); }
/* The workbook's table is the design system's (data-display.css's slots);
   here only its size in the panel and its column rules. */
.artifact-panel-grid { inline-size: auto; font-size: var(--text-xs); }
.artifact-panel-grid th, .artifact-panel-grid td {
  padding: var(--space-1) var(--space-2); border-inline-end: 1px solid var(--color-border); white-space: nowrap;
}
/* The header's words in the text colour: in dark the page's own table rule
   (dark-mode.css) lightens the header's ground, where the muted words fail. */
.artifact-panel-grid th { color: var(--color-foreground); font-weight: 600; }
.artifact-panel-sheet-more { margin: var(--space-3) 0 0; font-size: var(--text-xs); color: var(--color-muted-foreground); }
.artifact-panel-htmlhost { block-size: 100%; }
/* The deliverable's own sheet: white in both themes, as a PDF page is (its
   text was written for a white page). */
.artifact-panel-html { display: block; inline-size: 100%; block-size: 100%; border: 0; background: var(--color-on-brand); }
.artifact-panel-foot {
  flex: 0 0 auto; padding: var(--space-2) var(--space-4); border-block-start: 1px solid var(--color-border);
  font-size: var(--text-xs); color: var(--color-muted-foreground);
}
.artifact-panel-auto { display: inline-flex; align-items: center; gap: var(--space-2); min-block-size: 32px; cursor: pointer; }
@media (max-width: 768px) {
  .artifact-panel-vopen, .artifact-panel-access .hub-access-btn, .artifact-panel-auto { min-block-size: 44px; }
}
/* ── UX-P5h: the panel's one state, its tabs and the Outputs list (mockup
   3-side-panel.html; UXP4-NEW-006-b, -012-a; BENCH-6-1 … 6-3, 15-3). The
   audience chip on its own row (HubAccess's .select-inline, sized to its
   words); the type card every non-content state draws (a 64 px type icon,
   the name, the facts, the sentence of a failure, its actions); the four
   tabs (the kit's pills) and the three parts beside the preview's body; the
   facts, the events and the Outputs rows. Tokens only; 12 px corners. */
.artifact-panel-audience:empty { display: none; }
.artifact-panel-access .hub-access-btn { max-inline-size: 100%; }
.artifact-panel-tabs {
  flex: 0 0 auto; padding: var(--space-2) var(--space-4); border-block-end: 1px solid var(--color-border);
}
.artifact-panel-tabs[hidden], .artifact-panel-body[hidden], .artifact-panel-pane[hidden] { display: none; }
.artifact-panel-tabs .hub-tabs { margin: 0; flex-wrap: nowrap; overflow-x: auto; }
.artifact-panel-tabs .ihub-tab { flex: none; white-space: nowrap; }
.artifact-panel-tabs .ihub-tab[disabled] { opacity: 0.5; cursor: default; }
.artifact-panel-tabs .ihub-tab:focus-visible { outline: 2px solid var(--color-ring); outline-offset: 2px; }
.artifact-panel-pane { flex: 1 1 auto; min-block-size: 0; overflow: auto; padding: var(--space-3) var(--space-4); }
.artifact-panel-pane:focus-visible { outline: 2px solid var(--color-ring); outline-offset: -2px; }
.artifact-panel-pane .hub-details-sec:first-child { border-block-start: 0; padding-block-start: 0; }
.artifact-panel-card {
  inline-size: min(100%, 360px); box-sizing: border-box; gap: var(--space-3); padding: var(--space-6) var(--space-5);
  border: 1px solid var(--color-border); border-radius: var(--radius-md); background: var(--color-card);
}
.artifact-panel-typeicon {
  display: inline-flex; align-items: center; justify-content: center; inline-size: 64px; block-size: 64px; flex: none;
  border-radius: var(--radius-md); background: var(--color-muted); color: var(--color-primary);
}
.artifact-panel-typeicon svg { inline-size: 32px; block-size: 32px; }
.artifact-panel-card .artifact-panel-state-name { font-size: var(--text-base); }
.artifact-panel-card .artifact-panel-state-facts {
  text-transform: none; letter-spacing: 0; opacity: 1; font-size: var(--text-ui); font-weight: 500;
  color: var(--color-muted-foreground);
}
.artifact-panel-card .artifact-panel-state-msg { color: var(--color-foreground); }
.artifact-panel-state-acts { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--space-2); }
.artifact-panel-state-acts > [data-slot="button"] { display: inline-flex; align-items: center; gap: var(--space-2); margin: 0; }
.artifact-panel-facts {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: var(--space-2) var(--space-4);
  margin: 0; font-size: var(--text-sm);
}
.artifact-panel-facts dt { color: var(--color-muted-foreground); }
.artifact-panel-facts dd { margin: 0; overflow-wrap: anywhere; }
.artifact-panel-events { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-2); font-size: var(--text-sm); }
.artifact-panel-event-when { color: var(--color-muted-foreground); font-size: var(--text-xs); }
.artifact-panel-empty { padding: var(--space-6) var(--space-2); }
.artifact-panel-olist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-1); }
.artifact-panel-oopen {
  display: flex; align-items: center; gap: var(--space-3); inline-size: 100%; min-block-size: 48px;
  padding: var(--space-2) var(--space-3); border: 0; border-radius: var(--radius-md);
  background: transparent; color: inherit; font: inherit; text-align: start; cursor: pointer;
}
.artifact-panel-oopen:hover, .artifact-panel-oopen[aria-current="true"] { background: var(--color-muted); }
.artifact-panel-oopen:focus-visible { outline: 2px solid var(--color-ring); outline-offset: 2px; }
.artifact-panel-oicon { flex: none; display: inline-flex; color: var(--color-muted-foreground); }
.artifact-panel-obody { display: flex; flex-direction: column; gap: 2px; min-inline-size: 0; }
.artifact-panel-oname { font-size: var(--text-sm); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.artifact-panel-ometa { font-size: var(--text-xs); color: var(--color-muted-foreground); }
/* The share sheets' audience row (BENCH-4-2): who can open the link as two
   cards (the kit's option cards), "Copy link" at the row's end. */
.share-audience-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--space-3); }
.share-audience { flex: 1 1 280px; min-inline-size: 0; margin: 0; padding: 0; border: 0; }
.share-audience > legend { padding: 0; margin-block-end: var(--space-2); }
.share-audience-cards { flex-direction: row; flex-wrap: wrap; }
.share-audience-cards > .hub-access-opt { flex: 1 1 200px; }
.share-audience-cards > .hub-access-opt:has(input:disabled) { opacity: 0.6; cursor: default; }
.share-copy-link { flex: none; display: inline-flex; align-items: center; gap: var(--space-2); }
/* (UX-P6a: the conversation's share sheet is chat_enhanced.css's share region.) */
@media (max-width: 768px) {
  .artifact-panel-tabs .ihub-tab, .artifact-panel-state-acts > [data-slot="button"] { min-block-size: 44px; }
}
/* The Library's row: an artefact listed once says how many versions it has. */
.lib-vcount { flex: none; font-size: var(--text-ui); color: var(--color-muted-foreground); white-space: nowrap; }

/* ── PRODUCT-OUTPUTS: how outputs look in the panel (qa/PHASE-OUTPUTS.md). A
   Markdown document read rendered, its Source a toggle away (FILES-UI-1); a
   diagram's frame and its failure (FILES-UI-2); Download as, an icon button
   beside Download (FILES-UI-4); the Outputs tab's Working files (FILES-UI-5);
   "A newer version is ready" (FILES-UI-6); "This reply made version N"
   (FILES-UI-7); each version's note and the card's "Updated: <note>"
   (FILES-UI-8). New selectors only; tokens only; 12 px corners. */
.artifact-panel-viewbar {
  position: sticky; inset-block-start: 0; z-index: 1; display: flex; justify-content: flex-end;
  padding: var(--space-1) var(--space-3); border-block-end: 1px solid var(--color-border); background: var(--sidebar);
}
.artifact-panel-source[aria-pressed="true"] { background: var(--color-muted); }
.artifact-panel-doc.markdown-body {
  box-sizing: border-box; max-inline-size: 75ch; padding: var(--space-4) var(--space-5); overflow-wrap: anywhere;
}
.artifact-panel-doc[hidden], .artifact-panel-text .artifact-panel-pre[hidden] { display: none; }
.artifact-panel-doc table { display: block; max-inline-size: 100%; overflow-x: auto; }
.artifact-panel-doc img { max-inline-size: 100%; block-size: auto; }
.artifact-panel-trunc { margin: 0; padding: var(--space-2) var(--space-5); font-size: var(--text-xs); color: var(--color-muted-foreground); }
.artifact-panel-diagram { margin: var(--space-3) 0; }
.artifact-panel-mermaid {
  display: block; inline-size: 100%; border: 1px solid var(--color-border); border-radius: var(--radius-md);
  background: transparent;
}
.artifact-panel-diagram-failed {
  margin: var(--space-3) 0; padding: var(--space-3); border: 1px dashed var(--color-border); border-radius: var(--radius-md);
}
.artifact-panel-diagram-failed > p { margin: 0 0 var(--space-2); font-size: var(--text-sm); }
.artifact-panel-diagram-failed > pre { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: var(--text-xs); }
.artifact-panel-export[hidden], .artifact-panel-newer[hidden], .artifact-panel-made[hidden], .file-card-updated[hidden] { display: none; }
.artifact-panel-export { display: inline-flex; }
.artifact-panel-newer {
  flex: 0 0 auto; display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2);
  margin: 0; padding: var(--space-2) var(--space-4); border-block-end: 1px solid var(--color-border);
  background: var(--color-muted); font-size: var(--text-sm);
}
.artifact-panel-made { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1) var(--space-2); margin: 0; font-size: var(--text-sm); }
.artifact-panel-vrow:has(.artifact-panel-vnote) { flex-wrap: wrap; }
.artifact-panel-vnote {
  flex: 1 0 100%; margin: 0; padding-inline: var(--space-2); font-size: var(--text-xs); color: var(--color-muted-foreground);
}
.artifact-panel-working {
  display: inline-flex; align-items: center; gap: var(--space-2); min-block-size: 32px; margin-block-end: var(--space-2);
  font-size: var(--text-sm); cursor: pointer;
}
.artifact-panel-working input { inline-size: 16px; block-size: 16px; margin: 0; accent-color: var(--color-primary); }
.file-card-updated { display: block; font-size: var(--text-xs); color: var(--color-muted-foreground); overflow-wrap: anywhere; }
.file-card-doc-diagram { font-style: italic; color: var(--color-muted-foreground); }
@media (max-width: 768px) {
  .artifact-panel-working, .artifact-panel-newer-show, .artifact-panel-made-open, .artifact-panel-source { min-block-size: 44px; }
}

} /* end @layer components */
