/* AI Chatbot Widget Styles */

/* ── Type ──
   One scale for every AI surface: the widget, the report inside it, and the
   consent notice on step 1. On :root because the notice and the GDPR dialog are
   appended to document.body, outside .ai-widget. */
:root {
    /* Colour note: this file used to write #4a90d9 in fourteen places -- the
       launcher, the panel header, the send button, every link and citation in a
       reply. That is a blue nothing else in the application uses, and it made
       the one surface that IS the AI feature the one surface not wearing the AI
       colour; on white it also measured 3.0:1, under AA for the links and
       citations set in it. They read var(--pa-ai-blue) now, which main.css
       declares as the accent (#19589E, 7.17:1) and dark.css declares as
       #4A90D9 -- so the dark theme, where that blue was always the right one
       against a dark ground, is unchanged. */
    --pa-ai-fs: 13px;      /* body    -- bubbles, chat input, consent notice   */
    --pa-ai-fs-xs: 11px;   /* caption -- speaker label, provenance, ref meta   */
    --pa-ai-fs-sm: 12px;   /* second  -- progress, citations, code, tables     */
    --pa-ai-fs-lg: 14px;   /* h3, panel title, dialog title                    */
    --pa-ai-fs-xl: 15px;   /* h2                                               */
    --pa-ai-fs-2xl: 17px;  /* h1                                               */

    /* One bold, named once so a fallback font cannot draw 600 and 700
       differently - which is what the hardcoded system stack below used to do.

       This used to say 600 and 700 "select the same face", which was true when
       --pa-font-sans carried Light and Semibold only. It now ships real 400,
       600 and 700 cuts, so they are distinct; 700 is a deliberate choice here
       rather than a value that happened not to matter. */
    --pa-ai-bold: 700;

    /* Characters used as icons -- close cross, minimise dash, send arrow, info
       circle. Sized to their hit target, not to the 13px body, so deliberately
       off the scale above. */
    --pa-ai-glyph: 16px;      /* controls in a 28-36px hit target */
    --pa-ai-glyph-lg: 20px;   /* the dialog's own close */
}

/* ── Widget Container ── */
.ai-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 19000;
    font-family: var(--pa-font-sans);
    font-size: var(--pa-ai-fs);
}
/* A form control does not inherit type -- the user agent stamps its own
   `font: 400 13.333px Arial` on every button and textarea. The dialog is listed
   because it is appended to document.body, not into the widget. */
.ai-widget button,
.ai-widget textarea,
.ai-gdpr-disclaimer button {
    font-family: inherit;
}

/* ── FAB Button ── */
.ai-widget-fab {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--pa-ai-blue, #4A90D9);
    color: #fff;
    border: none;
    /* Styles no text: the children are getAIMark()'s SVG, which carries its own
       dimensions, and the badge, which sets its own size. Here only to keep the
       button off the user agent's 13.333px. */
    font-size: var(--pa-ai-fs);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(74, 144, 217, 0.4);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
}
.ai-widget-fab:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 16px rgba(74, 144, 217, 0.6);
}
/* Working state. The old treatment was the fabPulse glow alone, which at
   2s/40% opacity read as a decorative shimmer, not as "the analysis is
   running" - users reported not being able to tell. Three signals now run
   together: a rotating spinner ring around the launcher (the universally
   read "busy" symbol), a faster and much wider glow pulse, and a gentle
   breathing scale on the button itself. */
.ai-widget-fab.is-processing {
    animation: fabGlowPulse 1.4s ease-in-out infinite,
               fabBreathe 1.4s ease-in-out infinite;
}
.ai-widget-fab.is-processing::before {
    content: "";
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    border: 3px solid rgba(74, 144, 217, 0.25);
    border-top-color: var(--pa-ai-blue, #4A90D9);
    animation: fabSpin 0.9s linear infinite;
}
.ai-widget-fab-badge {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    position: absolute;
    top: -2px;
    right: -2px;
    border: 2px solid #fff;
    font-size: var(--pa-ai-fs-xs);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ── Panel ── */
.ai-widget-panel {
    width: 380px;
    height: 500px;
    position: absolute;
    bottom: 70px;
    right: 0;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px);
    pointer-events: none;
    transition: all 0.3s ease;
}
.ai-widget-panel.is-expanded {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}
.ai-widget-panel.is-fullscreen {
    opacity: 1;
    transform: none;
    pointer-events: auto;
    position: fixed;
    top: 20px;
    left: 20px;
    right: 20px;
    bottom: 20px;
    width: auto;
    height: auto;
    border-radius: 8px;
    z-index: 20000;
}
/* Fullscreen moves the scale up two steps, on the message area alone: it is a
   request to read the report, not to inflate the chrome around it.

   Restated rather than derived with calc(). A custom property is substituted at
   the element that declares it, so `--pa-ai-fs-xs: calc(var(--pa-ai-fs) - 2px)`
   on :root resolves against :root's 13px and inherits as 11px however deep
   --pa-ai-fs is later overridden. A single knob reads better and does not
   work. */
.ai-widget-panel.is-fullscreen .ai-widget-messages {
    --pa-ai-fs: 15px;
    --pa-ai-fs-xs: 13px;
    --pa-ai-fs-sm: 14px;
    --pa-ai-fs-lg: 16px;
    --pa-ai-fs-xl: 17px;
    --pa-ai-fs-2xl: 19px;
    font-size: var(--pa-ai-fs);
}
/* The fullscreen bubble's max-width is set with the rest of its type further
   down, at 900px. An earlier 800px stood here and was simply overridden. */

/* ── Header ── */
.ai-widget-header {
    background: var(--pa-ai-blue, #4A90D9);
    color: #fff;
    padding: 10px 12px 10px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: var(--pa-ai-bold);
    font-size: var(--pa-ai-fs-lg);
    min-height: 42px;
}
.ai-widget-header-title {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
/* Not `gap`: the ellipsis above needs this to stay a non-flex inline context,
   so the space between mark and name is a margin on the mark itself. The mark
   takes its size from this header's own font-size, which is why there is no
   width here to keep in step with the markup. */
.ai-widget-header-title .po-ai-mark {
    margin-right: 7px;
}
.ai-widget-header-actions {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
    margin-left: 8px;
}
.ai-minimize-btn,
.ai-fullscreen-btn {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    line-height: 1;
    opacity: 0.8;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: opacity 0.15s, background 0.15s;
    /* Was 18px for the dash and 15px for the cross -- two buttons of identical
       size, side by side, drawing their glyphs at different sizes. */
    font-size: var(--pa-ai-glyph);
}
.ai-minimize-btn:hover,
.ai-fullscreen-btn:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.15);
}

/* ── Progress ── */
.ai-widget-progress {
    padding: 8px 12px;
    background: #f0f7ff;
    border-bottom: 1px solid #e0e0e0;
}
.ai-progress-detail {
    font-size: var(--pa-ai-fs-sm);
    color: #336;
    margin-bottom: 4px;
}
/* ── Activity feed ──
   The agent's own tool calls, streamed under the bar while it works. A
   ten-minute run used to show a percentage and one sentence; this shows which
   pathways it examined, what it searched for, when it delegated. */
.ai-activity {
    list-style: none;
    margin: 6px 0 0;
    padding: 0;
    /* The feed is capped at six events plus a count, so it never needs to
       scroll; a max-height only clipped the last row in half. */
    overflow: hidden;
}
.ai-activity-row {
    display: flex;
    align-items: baseline;
    gap: 6px;
    font-size: var(--pa-ai-fs-xs, 11px);
    line-height: 1.5;
    color: #45506b;
    white-space: nowrap;
}
.ai-activity-tool { flex: 0 0 auto; font-weight: 600; }
.ai-activity-detail {
    flex: 1 1 auto;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #6b7a99;
}
.ai-activity-ms { flex: 0 0 auto; color: #8a93a8; font-variant-numeric: tabular-nums; }
.ai-activity-row.is-count { color: #8a93a8; font-style: italic; }
.ai-activity-row.is-failed .ai-activity-tool,
.ai-activity-row.is-failed .ai-activity-detail { color: #b23b3b; }

.ai-progress-track {
    height: 6px;
    background: #dde8f0;
    border-radius: 3px;
    overflow: hidden;
}
.ai-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--pa-ai-blue, #4A90D9), #67b8f7);
    border-radius: 3px;
    transition: width 0.5s ease;
    position: relative;
    overflow: hidden;
}
/* A sheen sweeping the filled part keeps the bar visibly alive between the
   coarse percent updates - a static fill at 40% for a minute reads as hung. */
.ai-progress-fill::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.55), transparent);
    animation: progressSheen 1.2s linear infinite;
}
.ai-widget-progress.is-done .ai-progress-fill::after,
.ai-widget-progress.is-error .ai-progress-fill::after {
    animation: none;
    content: none;
}
.ai-widget-progress.is-done {
    background: #e8f5e9;
}
.ai-widget-progress.is-done .ai-progress-fill {
    background: #66bb6a;
}
.ai-widget-progress.is-error {
    background: #ffebee;
}
.ai-widget-progress.is-error .ai-progress-fill {
    background: #ef5350;
}

/* ── Messages Area ── */
.ai-widget-messages {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    background: #fafafa;
}
.ai-message {
    margin-bottom: 12px;
    max-width: 90%;
    animation: fadeIn 0.3s ease;
}
.ai-msg-user {
    margin-left: auto;
    text-align: right;
}
.ai-msg-user .ai-msg-bubble {
    background: #e3f2fd;
    border: 1px solid #bbdefb;
    border-radius: 12px 12px 2px 12px;
    padding: 8px 12px;
    display: inline-block;
    text-align: left;
    font-size: var(--pa-ai-fs);
}
.ai-msg-assistant {
    margin-right: auto;
}
.ai-msg-assistant .ai-msg-bubble {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 12px 12px 12px 2px;
    padding: 10px 14px;
    display: inline-block;
    font-size: var(--pa-ai-fs);
    line-height: 1.5;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    max-width: 100%;
    word-wrap: break-word;
}

/* Markdown styles inside assistant bubbles. h4 is at the body size on purpose:
   it is a run-in heading, told apart by weight and colour. h3 is not -- it was
   13.5px against a 13px body, a difference no screen draws. */
.ai-msg-assistant .ai-msg-bubble h1 {
    font-size: var(--pa-ai-fs-2xl);
    font-weight: var(--pa-ai-bold);
    color: #1a1a2e;
    margin: 16px 0 8px 0;
    padding-bottom: 4px;
    border-bottom: 2px solid var(--pa-ai-blue, #4A90D9);
}
.ai-msg-assistant .ai-msg-bubble h1:first-child {
    margin-top: 0;
}
.ai-msg-assistant .ai-msg-bubble h2 {
    font-size: var(--pa-ai-fs-xl);
    font-weight: var(--pa-ai-bold);
    color: #2c3e50;
    margin: 14px 0 6px 0;
    padding-bottom: 3px;
    border-bottom: 1px solid #e0e0e0;
}
.ai-msg-assistant .ai-msg-bubble h3 {
    font-size: var(--pa-ai-fs-lg);
    font-weight: var(--pa-ai-bold);
    color: #34495e;
    margin: 10px 0 4px 0;
}
.ai-msg-assistant .ai-msg-bubble h4 {
    font-size: var(--pa-ai-fs);
    font-weight: var(--pa-ai-bold);
    color: #555;
    margin: 8px 0 4px 0;
}
.ai-msg-assistant .ai-msg-bubble ul,
.ai-msg-assistant .ai-msg-bubble ol {
    padding-left: 20px;
    margin: 4px 0;
}
.ai-msg-assistant .ai-msg-bubble li {
    margin: 2px 0;
}
.ai-msg-assistant .ai-msg-bubble p {
    margin: 4px 0;
}
.ai-msg-assistant .ai-msg-bubble hr {
    border: none;
    border-top: 1px solid #e0e0e0;
    margin: 12px 0;
}
.ai-msg-assistant .ai-msg-bubble code {
    background: #f5f5f5;
    padding: 1px 4px;
    border-radius: 3px;
    font-size: var(--pa-ai-fs-sm);
}
/* One rule for both spellings, at the one weight. */
.ai-msg-assistant .ai-msg-bubble strong,
.ai-msg-assistant .ai-msg-bubble b {
    font-weight: var(--pa-ai-bold);
    color: #2c3e50;
}
/* No font-style: italic means "gene symbol" here (see the em rule below), so
   italicising a whole block makes the callout read as if every word in it were
   one. The left rule and the tint already mark it. */
.ai-msg-assistant .ai-msg-bubble blockquote {
    border-left: 3px solid var(--pa-ai-blue, #4A90D9);
    background: #f0f7ff;
    padding: 8px 12px;
    margin: 8px 0;
    color: #333;
}
.ai-msg-assistant .ai-msg-bubble pre {
    background: #1e1e2e;
    color: #cdd6f4;
    padding: 10px 14px;
    border-radius: 6px;
    overflow-x: auto;
    margin: 8px 0;
    font-size: var(--pa-ai-fs-sm);
    line-height: 1.45;
}
.ai-msg-assistant .ai-msg-bubble pre code {
    background: none;
    padding: 0;
    color: inherit;
    font-size: inherit;
}
.ai-msg-assistant .ai-msg-bubble table {
    border-collapse: collapse;
    width: 100%;
    margin: 8px 0;
}
.ai-msg-assistant .ai-msg-bubble th {
    background: #f0f4f8;
    padding: 6px 10px;
    border: 1px solid #dde;
    font-size: var(--pa-ai-fs-sm);
    font-weight: var(--pa-ai-bold);
    text-align: left;
}
.ai-msg-assistant .ai-msg-bubble td {
    padding: 6px 10px;
    border: 1px solid #eee;
    font-size: var(--pa-ai-fs-sm);
}
/* Italic here is nomenclature, not emphasis: the model writes gene symbols as
   *Pard3*, *Bcl2*, *Smad3* -- 31 of them in one sampled report against 21
   bolds. This rule used to set nothing but `color: #555`, which drew them
   lighter than the sentence around them. The slant is the mark; it needs no
   colour of its own, and certainly not a fainter one. */
.ai-msg-assistant .ai-msg-bubble em,
.ai-msg-assistant .ai-msg-bubble i {
    font-style: italic;
    color: inherit;
}
.ai-msg-assistant .ai-msg-bubble a {
    color: var(--pa-ai-blue, #4A90D9);
    text-decoration: none;
}
.ai-msg-assistant .ai-msg-bubble a:hover {
    text-decoration: underline;
}
.ai-msg-assistant .ai-msg-bubble ul ul,
.ai-msg-assistant .ai-msg-bubble ol ol,
.ai-msg-assistant .ai-msg-bubble ul ol,
.ai-msg-assistant .ai-msg-bubble ol ul {
    padding-left: 18px;
}
.ai-msg-assistant .ai-msg-bubble h1 strong,
.ai-msg-assistant .ai-msg-bubble h2 strong,
.ai-msg-assistant .ai-msg-bubble h3 strong {
    color: inherit;
}
/* Size comes from the restated tokens above; only non-type properties here. */
.ai-widget-panel.is-fullscreen .ai-msg-bubble {
    line-height: 1.65;
    padding: 14px 20px;
    max-width: 900px;
}

/* Was 10px, the only size below the caption step. */
.ai-msg-label {
    font-size: var(--pa-ai-fs-xs);
    /* Was #999 - 2.85:1, a straight AA failure, and at the smallest size in
       the sheet. This names who is speaking in the transcript, so it is read,
       not glanced at. */
    color: var(--pa-ink-muted, #595959);
    margin-bottom: 2px;
}
.ai-msg-user .ai-msg-label {
    text-align: right;
}

/* ── Report provenance ──
   Who produced the write-up, stated at the foot of the report itself.

   Inside the bubble rather than in the panel header on purpose: the report is
   the surface people select and paste into a draft, and an attribution in the
   chrome does not travel with it. Set below the body type and behind a rule so
   it reads as a caption about the text rather than as its last paragraph --
   the same job .ai-msg-label does for the speaker.

   The model/host/operator half is empty in the markup and filled from
   /ai_provider, like .ai-provider-inline on the upload form; an empty inline
   span occupies nothing, so no :empty rule is needed to collapse it. */
.ai-report-provenance {
    margin-top: 12px;
    padding-top: 8px;
    border-top: 1px solid #e0e0e0;
    font-size: var(--pa-ai-fs-xs);
    line-height: 1.5;
    color: #555;          /* 7.46:1 on the white assistant bubble */
}

/* ── Citations ── */
.ai-citations-toggle {
    display: inline-block;
    color: var(--pa-ai-blue, #4A90D9);
    cursor: pointer;
    font-size: var(--pa-ai-fs-sm);
    margin-top: 8px;
    user-select: none;
}
.ai-citations-toggle:hover {
    text-decoration: underline;
}
.ai-citations-list {
    margin-top: 6px;
    padding: 0;
    font-size: var(--pa-ai-fs-sm);
}
.ai-citation-item {
    padding: 6px 8px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
}
.ai-citation-item:hover {
    background: #f5f5f5;
}
/* No size of its own: it sits inside .ai-citation-title and was restating it. */
.ai-citation-ref {
    color: var(--pa-ai-blue, #4A90D9);
    font-weight: var(--pa-ai-bold);
    margin-right: 2px;
}
.ai-citation-title {
    font-weight: var(--pa-ai-bold);
    color: #333;
    font-size: var(--pa-ai-fs-sm);
    margin-bottom: 1px;
}
.ai-citation-meta {
    /* Was #888 - 3.54:1, below AA. A citation's journal and year are the part
       a reader checks before trusting the claim above it. */
    color: var(--pa-ink-muted, #595959);
    font-size: var(--pa-ai-fs-xs);
}
.ai-citation-pmid {
    color: var(--pa-ai-blue, #4A90D9);
    font-size: var(--pa-ai-fs-xs);
    font-weight: var(--pa-ai-bold);
}

/* ── Inline Citation Links ── */
.ai-citation-link {
    color: var(--pa-ai-blue, #4A90D9);
    text-decoration: none;
    font-weight: var(--pa-ai-bold);
    cursor: pointer;
    transition: color 0.2s;
}
.ai-citation-link:hover {
    color: #2a6cb8;
    text-decoration: underline;
}

/* ── Inline Pathway Links ── */
/* Distinct from PubMed citations: these stay inside the app rather than opening
   an external site, so they are marked with a colour of their own and a dotted
   underline that reads as "expandable" rather than "leaves the page". */
.ai-pathway-link {
    color: #2e8b57;
    text-decoration: none;
    font-weight: var(--pa-ai-bold);
    cursor: pointer;
    border-bottom: 1px dotted #2e8b57;
    transition: color 0.2s, background-color 0.2s;
}
.ai-pathway-link:hover {
    color: #1c5f3a;
    background-color: rgba(46, 139, 87, 0.10);
    border-bottom-style: solid;
}
.ai-pathway-link::after {
    content: " \25B8";
    font-size: 0.85em;
    opacity: 0.7;
}

/* ── Cluster ids ── */
/* "C01" in the prose is shorthand for a group of pathways. The dotted mark
   says "there is more here"; the browser title on hover names the cluster
   and its members, and a click scrolls to the row that defines it. */
.ai-cluster-link {
    color: inherit;
    text-decoration: none;
    font-weight: var(--pa-ai-bold);
    cursor: help;
    border-bottom: 1px dotted currentColor;
    padding: 0 1px;
    border-radius: 2px;
}
.ai-cluster-link:hover {
    background-color: rgba(46, 139, 87, 0.12);
    border-bottom-style: solid;
}
tr.ai-cluster-row-flash > td {
    background-color: rgba(46, 139, 87, 0.18);
    transition: background-color 0.6s;
}

/* ── Input Area ── */
.ai-widget-input-area {
    padding: 10px;
    border-top: 1px solid #e0e0e0;
    background: #fff;
    display: flex;
    gap: 8px;
    align-items: flex-end;
}
.ai-widget-input-area textarea {
    flex: 1;
    border: 1px solid #ccc;
    border-radius: 18px;
    padding: 8px 14px;
    font-size: var(--pa-ai-fs);
    resize: none;
    min-height: 36px;
    max-height: 80px;
    font-family: inherit;
    outline: none;
    line-height: 1.4;
}
.ai-widget-input-area textarea:focus {
    border-color: var(--pa-ai-blue, #4A90D9);
    box-shadow: 0 0 0 2px rgba(74, 144, 217, 0.15);
}
.ai-send-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--pa-ai-blue, #4A90D9);
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--pa-ai-glyph);
    flex-shrink: 0;
    transition: background 0.2s;
}
.ai-send-btn:hover {
    background: #3a7bc8;
}
.ai-send-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* ── Loading & Retry ── */
.ai-loading {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px;
    color: var(--pa-ink-muted, #595959);
    font-size: var(--pa-ai-fs);
}
.ai-loading-dots {
    display: inline-flex;
    gap: 3px;
}
.ai-loading-dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #999;
    animation: dotPulse 1.2s ease-in-out infinite;
}
.ai-loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.ai-loading-dots span:nth-child(3) { animation-delay: 0.4s; }
.ai-retry-btn {
    background: var(--pa-ai-blue, #4A90D9);
    color: #fff;
    border: none;
    border-radius: var(--pa-radius-btn, 8px);
    padding: 6px 16px;
    font-size: var(--pa-ai-fs-sm);
    cursor: pointer;
    margin-top: 6px;
}
.ai-retry-btn:hover {
    background: #3a7bc8;
}

/* ── Keyframes ── */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes fabGlowPulse {
    0%, 100% { box-shadow: 0 2px 10px rgba(74, 144, 217, 0.45); }
    50% { box-shadow: 0 2px 28px 6px rgba(74, 144, 217, 0.85); }
}
@keyframes fabBreathe {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.06); }
}
@keyframes fabSpin {
    to { transform: rotate(360deg); }
}
@keyframes progressSheen {
    from { transform: translateX(-100%); }
    to { transform: translateX(100%); }
}
@keyframes dotPulse {
    0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
    40% { opacity: 1; transform: scale(1); }
}

/* The AI section's own styling used to live here as .ai-interpret-section,
   .ai-privacy-btn and .ai-experiment-design. All three are gone: nothing in the
   repository or in the deployed container carries any of those classes, and the
   section is drawn by .po-ai-section-body in main.css instead.

   .ai-interpret-section was the one worth removing rather than leaving. It was
   not merely unused, it was the same rule frozen before two corrections -
   identical to the live one in background, border, shadow and padding, and
   differing only where .po-ai-section-body was fixed: border-radius 8px against
   the surface token, and margin 20px against the card inset. Both of those are
   values the live rule carries a comment explaining it should not have. A copy
   that disagrees only where the original was corrected is the copy someone
   reaches for next. */

/* ── GDPR Disclaimer Popup ── */

/* The warning ink on the consent checkbox: the clause naming what is sent and
   who receives it, and the icon that opens the full notice. Both carried this
   colour as an inline `style` in PA_Step1Views.js, which no stylesheet can
   override, so the dark theme could not lighten them and the sentence sat at
   3.29:1. #C44500 is 5.00:1 on white; dark.css takes it from here. */
.ai-consent-warn {
    color: #C44500;
}
.ai-gdpr-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 20000;
    display: flex;
    align-items: center;
    justify-content: center;
}
/* A column: title bar on top, and the notice scrolling under it.

   The whole card used to be the scroller (`overflow-y: auto` here, nothing on
   the body), so the title and its close control scrolled away with the text --
   on a notice this long, three flicks in there was no way to shut it without
   scrolling back up. The header is a flex item that does not shrink and the
   body is the one that scrolls; `overflow: hidden` on the card keeps the
   scrolling body inside the 8px corners. */
.ai-gdpr-disclaimer {
    position: relative;
    z-index: 20001;
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 8px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.25);
    width: 520px;
    max-width: 90vw;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    font-family: var(--pa-font-sans);
    font-size: var(--pa-ai-fs);
    line-height: 1.5;
    color: #333;
}
.ai-gdpr-disclaimer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex: 0 0 auto;
    padding: 12px 16px;
    background: #f5f8fc;
    border-bottom: 1px solid #e0e0e0;
    border-radius: 8px 8px 0 0;
}
/* Set like the widget panel's title -- same thing on two AI surfaces. */
.ai-gdpr-disclaimer-header strong {
    font-size: var(--pa-ai-fs-lg);
    font-weight: var(--pa-ai-bold);
    color: #333;
}
/* The close control, on the same rail as the title opposite it.

   `padding: 0 4px` on a 20px glyph made an 18px box whose ink sits ~4px inside
   each edge, so against the header's 16px padding the x landed ~20px from the
   right while the title started 16px from the left -- a 4px asymmetry across
   518px, which is exactly the kind of thing that reads as "not aligned" without
   being nameable. A square hit area, centred, pulled back by half the slack:
   the ink now ends where the title begins, mirrored. */
.ai-gdpr-close {
    background: none;
    border: none;
    /* fa-times, which is what every other close control in the application is
       drawn with (Step 3's rail, Step 4's six panels, the upload abort). This
       one was the character &times; at 20px -- a different shape, a different
       weight and a different optical size from all of them. */
    font-size: var(--pa-ai-fs);
    cursor: pointer;
    /* Was #999, 2.85:1. It is the only way to dismiss the panel. */
    color: var(--pa-ink-muted, #595959);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    padding: 0;
    /* -8, measured: the box sits 8px from the header's edge and the glyph is
       centred in its 26px, which puts the ink on 16px -- the title's own inset,
       mirrored. */
    margin-right: -8px;
    border-radius: var(--pa-radius-sm, 6px);
    line-height: 1;
    transition: background var(--pa-transition), color var(--pa-transition);
}
.ai-gdpr-close:hover {
    background: rgba(24, 24, 27, 0.06);
    color: #333;
}
.ai-gdpr-disclaimer-body {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 12px 16px;
}
.ai-gdpr-disclaimer-body p {
    margin: 6px 0;
}
/* Stated rather than left to the user agent, so the notice's many bolds and the
   two title classes below cannot come out at different weights. */
.ai-gdpr-disclaimer-body strong {
    font-weight: var(--pa-ai-bold);
}
/* The closing confirmation, moved out of an inline `style="font-size:11px;
   color:#666"` that no stylesheet could reach -- and that dark.css still has an
   `[style*="color:#666"] !important` rule downstairs for. */
.ai-gdpr-fineprint {
    font-size: var(--pa-ai-fs-xs);
    /* Fine print about what leaves the machine is the last text that should be
       hard to read. Was #666 at the smallest size in the sheet. */
    color: var(--pa-ink-muted, #595959);
    margin-top: 8px;
}
.ai-gdpr-disclaimer-body hr {
    border: none;
    border-top: 1px solid #eee;
    margin: 10px 0;
}
.ai-gdpr-disclaimer-body ul {
    padding-left: 20px;
    margin: 6px 0;
}
.ai-gdpr-disclaimer-body li {
    margin: 3px 0;
}
.ai-gdpr-safe li::marker {
    color: #2e7d32;
}
/* The markers were #c62828 -- a red bullet per line, on a list that is now
   advice about which data to leave out rather than a prohibition. Same list,
   ordinary markers. */
.ai-gdpr-unsafe li::marker {
    color: var(--pa-ink-muted, #595959);
}

/* Provenance: who receives the data. Both of these are filled from
   /ai_provider at runtime and are empty in the markup, so they must collapse
   rather than reserve a blank band when the request fails or the server
   cannot say which legal regime applies. `:empty` does that; it is exact here
   because fillAIProvenance() either writes the whole string or writes nothing.

   Set apart from the surrounding prose with a rule and a tint, because in a
   notice this long a statement of the recipient reads as one more paragraph
   otherwise - and the recipient is the single fact the notice exists to
   deliver. */
.ai-gdpr-where,
.ai-gdpr-transfer {
    background: #eef4fb;
    border-left: 4px solid #1F6BC1;
    padding: 10px 14px;
    margin: 10px 0;
    border-radius: 3px;
    line-height: 1.5;
}
.ai-gdpr-where:empty,
.ai-gdpr-transfer:empty {
    display: none;
}

/* The same fact in the step 1 callout, where it is a trailing sentence rather
   than a block. No colour of its own: it is the end of the paragraph it sits
   in, and a second tinted box on that card would compete with the consent
   checkbox beside it. */
.ai-provider-inline:empty {
    display: none;
}

/* The paragraph above the consent checkbox on step 1. Its size and colour were
   an inline `style` on the <p>, same as .ai-gdpr-fineprint above and for the
   same reason: PA_Step1Views.js writes this markup as a string. */
.ai-intro-copy {
    font-size: var(--pa-ai-fs);
    color: #555;
    line-height: 1.55;
    margin: 0 0 10px 0;
}

/* The two lists that carry the actual disclosure: what leaves this server and
   what does not. Both fills used to be inline `style="background:#fff3e0"` /
   `#e8f5e9` on the div, which no stylesheet could reach - so in dark mode the
   theme lightened the body ink to #C9CBD0 while the fill stayed near-white and
   the text measured 1.48:1 and 1.44:1. The most load-bearing paragraphs in the
   consent notice were the least readable ones on the page.

   Stated as classes so dark.css can reach them. */
.ai-gdpr-sent,
.ai-gdpr-notsent {
    padding: 10px 14px;
    margin: 10px 0;
    border-radius: 3px;
    border-left: 4px solid;
}
.ai-gdpr-sent {
    background: #fff3e0;
    border-left-color: #C44500;
}
.ai-gdpr-notsent {
    background: #e8f5e9;
    border-left-color: #2e7d32;
}
.ai-gdpr-sent-title { color: #C44500; }
.ai-gdpr-notsent-title { color: #2e7d32; }
