/* Fonts are loaded via a <link> in base.html (before this file) rather than an
   @import here, so the browser discovers them without waiting on this stylesheet. */

:root {
    /* Primary Colors */
    --muted-rose: #D05A67;     /* Main brand color. 3.9:1 on white: large text (24px+, or 19px bold), icons, tiles and tints only */
    --muted-rose-deep: #A6414D; /* Rose for small text and button fills: 6.0:1 on white, 5.2:1 on --tint-danger (WCAG audit 2026-09, A11Y-001) */
    --deep-slate-blue: #2A3F5F; /* Support and structure */
    --white: #ffffff;          /* Card and rail surfaces sitting on seasalt */
    --warm-amber: #FDBE3B;     /* Highlighting/attention (backgrounds only: ~1.8:1 on white) */
    --warm-amber-deep: #7F6400; /* Amber for small text on white: 6.3:1 (5.1:1 on --tint-warning; the old #8a6d00 was 4.5:1 there) */
    --deep-teal: #006D77;      /* Active states */
    --reseda-green: #688B58;   /* Completion and success */
    --reseda-green-deep: #4F6B42; /* Green for small text on white: 5.9:1 */
    --cinnabar: #E74C3C;       /* Warnings and errors: icons, borders and tints only (3.8:1 on white) */
    --cinnabar-deep: #B03A2E;  /* Red for small text on white and white text on red fills: 6.0:1 */
    --onyx: #343A40;           /* Text color */
    --seasalt-white: #F8F9FA;  /* Background */
    
    /* Secondary Colors */
    --celadon: #AFE3C0;
    --pistachio: #90C290;

    /* Neutral Greys */
    --grey-lighter: #EEEEEE;  /* Borders, dividers */
    --control-border: #8A8F98; /* Form control boundary: 3.3:1 on white, 3.1:1 on seasalt (WCAG 1.4.11, A11Y-002) */
    --grey-light: #DDDDDD;    /* Inactive states, backgrounds */
    --grey: #666666;          /* Secondary text, icons */
    --grey-dark: #444444;     /* Emphasis text */

    /* Status Tints (light backgrounds) */
    --tint-info: #E0F2F4;     /* Info/current state */
    --tint-success: #E8F2E4;  /* Success/complete state */
    --tint-warning: #FEF3E0;  /* Warning/pending state */
    --tint-danger: #FDEBE9;   /* Error/danger state */

    /* Typography Scale - Golden Ratio 1:1.618 */
    --font-size-xxxl: 68px;
    --font-size-xxl: 42px;
    --font-size-xl: 26px;
    --font-size-m: 16px;
    --font-size-s: 10px;
    
    /* Spacing (based on golden ratio) */
    --spacing-xs: 6px;
    --spacing-s: 10px;
    --spacing-m: 16px;
    --spacing-l: 26px;
    --spacing-xl: 42px;
    --spacing-xxl: 68px;

    /* Border Radius */
    --border-radius-sm: 4px;
    --border-radius-md: 8px;
    --border-radius-lg: 12px;
    --border-radius-pill: 20px;
    --border-radius-full: 50%;

    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Base Typography */
body {
    font-family: 'Work Sans', sans-serif;
    font-size: var(--font-size-m);
    line-height: 1.618;
    color: var(--onyx);
    background-color: var(--seasalt-white);
    margin: 0;
    padding: 0;
}

/* Button reset for bare (non-Bulma) buttons. Deliberately excludes
   button.button: that selector outranks Bulma's .button sizing, so keeping it
   here cancels .is-small/.is-large on real <button> elements while inputs and
   selects still honour them, leaving paired controls mismatched. */
button,
input[type="button"],
input[type="submit"] {
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
}

/* Skip link (WCAG 2.4.1): visually hidden until keyboard focus reaches it */
.skip-link {
    position: absolute;
    left: -9999px;
    top: var(--spacing-s);
    z-index: 1000;
    padding: var(--spacing-xs) var(--spacing-m);
    background-color: var(--deep-teal);
    color: var(--white);
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-md);
}
.skip-link:focus {
    left: var(--spacing-s);
    text-decoration: none;
    color: var(--white);
}

/* Focus indicators for keyboard navigation (WCAG 2.4.7) */
:focus-visible {
    outline: 2px solid var(--deep-teal);
    outline-offset: 2px;
}
/* Bulma 1.0 paints its own ring on a:focus-visible and button:focus-visible
   (specificity beats the rule above) in its link blue. Point its focus tokens
   at the deep teal so every ring is the same 2 px teal (A11Y-027). */
:root {
    --bulma-focus-h: 185deg;
    --bulma-focus-s: 100%;
    --bulma-focus-l: 23%;
    --bulma-focus-offset: 2px;
}
.button:focus-visible {
    outline: 2px solid var(--deep-teal);
    outline-offset: 2px;
    box-shadow: none;
}
/* Native checkbox and radio ticks in brand teal, not the browser default blue. */
input[type="checkbox"],
input[type="radio"] {
    accent-color: var(--deep-teal);
}
input[type="checkbox"]:focus-visible {
    outline: 2px solid var(--deep-teal);
    outline-offset: 2px;
}
/* Checkboxes in table rows get a 24 px hit area (WCAG 2.5.8, A11Y-018):
   dense 30 px rows leave no spacing allowance around a 13 px box. */
.table td > input[type="checkbox"],
.table th > input[type="checkbox"],
.table td > label > input[type="checkbox"] {
    width: 24px;
    height: 24px;
    vertical-align: middle;
}

/* Form controls focus in brand teal, not Bulma's link blue. */
.input:focus,
.textarea:focus,
.select select:focus {
    border-color: var(--deep-teal);
    box-shadow: 0 0 0 0.125em rgba(0, 109, 119, 0.15);
}
/* Keyboard focus on form controls and pagination shows the same 2 px teal
   outline as links and buttons (WCAG 2.4.7, A11Y-003): the halo above is 1.25:1
   and Bulma clears the outline on selects. */
.input:focus-visible,
.textarea:focus-visible,
.select select:focus-visible,
.file-input:focus-visible + .file-cta,
.pagination-link:focus-visible,
.pagination-previous:focus-visible,
.pagination-next:focus-visible {
    outline: 2px solid var(--deep-teal);
    outline-offset: 2px;
}

/* Resting control boundary at 3:1 (WCAG 1.4.11, A11Y-002); Bulma's default
   light grey border is 1.4:1 on white. Focus keeps the teal border above. */
.input,
.textarea,
.select select,
.file-cta,
.file-name,
.form-control,
.form-select {
    border-color: var(--control-border);
}
.input:hover,
.textarea:hover,
.select select:hover,
.file-input:hover + .file-cta,
.file-input:hover ~ .file-name {
    border-color: var(--grey);
}
.input::placeholder,
.textarea::placeholder {
    color: var(--grey);
    opacity: 1;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Work Sans', sans-serif;
    font-weight: 600;
    margin-top: 1.618em;
    margin-bottom: 0.618em;
    line-height: 1.2;
}

/* The first element inside a card/box shouldn't inherit the golden-ratio top
   margin — it pushes the heading away from the card edge. */
.box .content > :first-child,
.box > :first-child {
    margin-top: 0;
}

h1 {
    font-size: var(--font-size-xxl);
    color: var(--muted-rose);
}

h2 {
    font-size: var(--font-size-xl);
    color: var(--muted-rose);
}

h3 {
    font-size: var(--font-size-m);
    font-weight: 600;
    color: var(--muted-rose-deep); /* 16px text needs 4.5:1; the brand rose is 3.9:1 */
}

/* Links inside running text carry an underline so colour is not the only cue
   (WCAG 1.4.1, A11Y-017). Navigation, tables and buttons are exempt. */
p a:not(.button):not(.tag):not(.dc-btn),
.notification a:not(.button):not(.delete),
.assistant-msg a,
.icon-text a,
.help a {
    text-decoration: underline;
}

/* Outlined success buttons: the mid green is 3.4:1 on the success tint */
.button.is-success.is-outlined {
    color: var(--reseda-green-deep);
    border-color: var(--reseda-green-deep);
}
.button.is-success.is-outlined:hover {
    background-color: var(--reseda-green-deep);
    border-color: var(--reseda-green-deep);
    color: white;
}

/* Status tags (inline) */
.status-tag-inline {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    white-space: nowrap;
    max-width: 100%;
    line-height: 1.2;
}

.status-tag-inline .icon {
    margin-right: 0;
}

.project-file-actions .button {
    min-width: 96px;
    justify-content: center;
}
.project-file-actions .button.is-small {
    padding: 4px 10px;
    line-height: 1.2;
}

/* Links */
a {
    color: var(--deep-teal);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* ==========================================================================
   Bulma Semantic Colour Overrides
   Maps Bulma's is-primary, is-success, etc. to our design system
   ========================================================================== */

/* Primary - Deep Teal (active states, CTAs) */
.button.is-primary {
    background-color: var(--deep-teal);
    border-color: var(--deep-teal);
    color: white;
}
.button.is-primary:hover {
    background-color: #005a63;
    border-color: #005a63;
    color: white;
}
.button.is-primary.is-outlined {
    background-color: transparent;
    border-color: var(--deep-teal);
    color: var(--deep-teal);
}
.button.is-primary.is-outlined:hover {
    background-color: var(--deep-teal);
    color: white;
}
.button.is-primary.is-light {
    background-color: var(--tint-info);
    border-color: var(--tint-info);
    color: var(--deep-teal);
}
.button.is-primary.is-light:hover {
    background-color: #c4e4e7;
    border-color: #c4e4e7;
    color: var(--deep-teal);
}
/* aria-disabled covers focusable stand-ins for disabled buttons: tippy
   refuses to show tooltips on elements carrying the disabled attribute,
   so an explained control styles via aria-disabled instead. */
.button.is-primary[disabled],
.button.is-primary[disabled]:hover,
.button.is-primary[aria-disabled="true"],
.button.is-primary[aria-disabled="true"]:hover {
    background-color: #8fbfc5;
    border-color: #8fbfc5;
    color: white;
    opacity: 1;
    cursor: not-allowed;
}

/* Sentiment Tags */
.tag.sentiment-support {
    background-color: var(--tint-success);
    color: var(--reseda-green-deep);
}
.tag.sentiment-concern {
    background-color: var(--tint-danger);
    color: var(--muted-rose-deep);
}
.tag.sentiment-conditional {
    background-color: var(--tint-warning);
    color: var(--warm-amber-deep);
}
.tag.sentiment-mixed {
    background-color: var(--tint-info);
    color: var(--deep-slate-blue);
}

/* Design considerations: quiet advisory surfaces for option quality checks */
.quality-note {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-xs);
    font-size: 0.85rem;
    color: var(--grey);
    margin-top: var(--spacing-xs);
}
.considerations-panel {
    background-color: var(--tint-warning);
    border-radius: var(--border-radius-md);
    padding: var(--spacing-m);
    font-size: 0.95rem;
    color: var(--grey-dark);
}
.considerations-panel .considerations-title {
    font-weight: 500;
    margin-bottom: var(--spacing-xs);
}
.considerations-panel ul {
    margin: 0 0 var(--spacing-xs) 1.25rem;
    list-style: disc;
}
.considerations-panel li {
    margin-bottom: var(--spacing-xs);
}
.considerations-panel .considerations-kept-group summary {
    cursor: pointer;
}
.considerations-panel .considerations-kept,
.considerations-panel .considerations-hint {
    font-size: 0.85rem;
    color: var(--grey);
    margin-top: var(--spacing-xs);
}

/* Scrollable bordered list container (token-aligned; replaces inline styles) */
.scroll-list {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid var(--grey-lighter);
    padding: var(--spacing-s);
    border-radius: var(--border-radius-sm);
}
.scroll-block {
    max-height: 400px;
    overflow-y: auto;
}
.input--narrow {
    max-width: 12rem;
}

/* Curation: deliberately stopped work */
.tag.is-stopped {
    background-color: var(--tint-danger);
    color: var(--muted-rose-deep);
}

/* Curation board: generous space between clusters, tight rhythm within */
.curation-cluster {
    margin-bottom: var(--spacing-xl);
}
.curation-cluster-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--spacing-s) var(--spacing-m);
    margin-bottom: var(--spacing-s);
}
.curation-cluster-title {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: var(--spacing-s);
    min-width: 0;
}
.curation-cluster-meta {
    color: var(--grey);
    font-size: 0.875rem;
    white-space: nowrap;
}
.curation-cluster-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--spacing-xs);
}
/* Per-cluster utility form: subordinate, not full-width */
.curation-add-form {
    max-width: 30rem;
    margin-top: var(--spacing-s);
}
.curation-new-cluster {
    max-width: 24rem;
    margin: var(--spacing-l) 0;
}
.curation-footer {
    position: sticky;
    bottom: 0;
    z-index: 20;
    border-top: 1px solid var(--grey-lighter);
    box-shadow: var(--shadow-lg);
}

/* Curation board: quiet rows, secondary actions revealed on hover/focus */
.curation-item {
    border-radius: 6px;
    padding: var(--spacing-xs) var(--spacing-s);
    gap: var(--spacing-s);
    transition: background-color 0.15s ease-out;
}
.curation-item__main {
    display: flex;
    align-items: center;
    gap: var(--spacing-s);
    min-width: 0;
    flex: 1;
}
.curation-item__actions {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-shrink: 0;
}
.curation-item .curation-item-text {
    word-break: break-word;
}
.curation-item .curation-item-secondary {
    gap: 0.35rem;
}
/* Touch devices get full-size tap targets; pointer density stays for mouse.
   Applies to every small button/delete control, not just curation rows:
   Bulma's is-small is ~30px tall, below the WCAG 2.5.8 minimum. */
@media (pointer: coarse) {
    .button.is-small,
    .delete,
    .curation-item .select.is-small select {
        min-height: 44px;
        min-width: 44px;
    }
}
.curation-item:hover,
.curation-item:focus-within {
    background-color: var(--seasalt-white);
}
.curation-item .curation-item-secondary {
    opacity: 0;
    transition: opacity 0.15s ease-out;
}
.curation-item:hover .curation-item-secondary,
.curation-item:focus-within .curation-item-secondary {
    opacity: 1;
}
@media (hover: none) {
    .curation-item .curation-item-secondary {
        opacity: 1;
    }
}
@media (prefers-reduced-motion: reduce) {
    .curation-item,
    .curation-item .curation-item-secondary,
    .curation-cluster .curation-chevron {
        transition: none;
    }
}
/* Stopped work stays fully readable (AA); the strike and tag carry the state */
.curation-item-stopped {
    text-decoration: line-through;
    text-decoration-color: var(--muted-rose);
}

/* Curation accordion: whole summary row is the toggle, controls live in the body */
.curation-cluster > .curation-cluster-summary {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: var(--spacing-s);
    cursor: pointer;
    list-style: none;
}
.curation-cluster > .curation-cluster-summary::-webkit-details-marker {
    display: none;
}
.curation-cluster > .curation-cluster-summary:focus-visible {
    outline: 2px solid var(--deep-teal);
    outline-offset: 2px;
}
.curation-cluster .curation-chevron {
    align-self: center;
    color: var(--grey);
    transition: transform 0.15s ease-out;
}
.curation-cluster[open] > .curation-cluster-summary .curation-chevron {
    transform: rotate(90deg);
}
.curation-cluster[open] > .curation-cluster-summary {
    margin-bottom: var(--spacing-s);
}

/* Show-more cap: rows past 10 hide until expanded; an active filter bypasses
   the cap. !important because item rows use Bulma's .is-flex helper */
.curation-items.is-capped:not(.is-filtering) > .curation-item:nth-child(n+11) {
    display: none !important;
}

/* Client-side filter (curation-board.js) */
.is-hidden-by-filter {
    display: none !important;
}
.curation-filter-bar {
    display: flex;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: var(--spacing-s) var(--spacing-m);
    margin-bottom: var(--spacing-l);
}
.curation-filter-bar .field {
    flex: 1 1 18rem;
    max-width: 30rem;
}
.filter-button.is-compact {
    padding: 0.35rem 0.9rem;
    min-width: 0;
    font-size: 0.875rem;
}

/* Pagination - Deep Teal theme */
.pagination-link,
.pagination-previous,
.pagination-next {
    border-color: var(--deep-teal);
    color: var(--deep-teal);
}
.pagination-link:hover,
.pagination-previous:hover,
.pagination-next:hover {
    border-color: var(--deep-teal);
    background-color: var(--tint-info);
}
.pagination-link.is-current {
    background-color: var(--deep-teal);
    border-color: var(--deep-teal);
    color: white;
}

/* Success - Reseda Green (completion). Fills use the deep shade so white
   text reaches 6:1; the mid green (3.9:1) is for icons and borders. */
.button.is-success {
    background-color: var(--reseda-green-deep);
    border-color: var(--reseda-green-deep);
    color: white;
}
.button.is-success:hover {
    background-color: #3f5634;
    border-color: #3f5634;
    color: white;
}
.button.is-success.is-light {
    background-color: var(--tint-success);
    border-color: var(--tint-success);
    color: var(--reseda-green-deep);
}
.button.is-success.is-light:hover {
    background-color: #d4ecd8;
    border-color: #d4ecd8;
    color: var(--reseda-green-deep);
}
.tag.is-success {
    background-color: var(--reseda-green-deep);
    color: white;
}
.notification.is-success {
    background-color: var(--tint-success);
    color: var(--onyx);
}

/* Warning - Warm Amber (attention) */
.button.is-warning {
    background-color: var(--warm-amber);
    border-color: var(--warm-amber);
    color: var(--onyx);
}
.button.is-warning:hover {
    background-color: #e5a82e;
    border-color: #e5a82e;
    color: var(--onyx);
}
.button.is-warning.is-light {
    background-color: var(--tint-warning);
    border-color: var(--tint-warning);
    color: var(--warm-amber-deep);
}
.button.is-warning.is-light:hover {
    background-color: #fce9c4;
    border-color: #fce9c4;
    color: var(--warm-amber-deep);
}
.tag.is-warning {
    background-color: var(--warm-amber);
    color: var(--onyx);
}
.notification.is-warning {
    background-color: var(--tint-warning);
    color: var(--onyx);
}

/* Danger - Cinnabar (errors). Fills use the deep shade for 6:1 white text. */
.button.is-danger {
    background-color: var(--cinnabar-deep);
    border-color: var(--cinnabar-deep);
    color: white;
}
.button.is-danger:hover {
    background-color: #963226;
    border-color: #963226;
    color: white;
}
.button.is-danger.is-light {
    background-color: var(--tint-danger);
    border-color: var(--tint-danger);
    color: var(--muted-rose-deep);
}
.button.is-danger.is-light:hover {
    background-color: #fbd5d1;
    border-color: #fbd5d1;
    color: var(--muted-rose-deep);
}
.tag.is-danger {
    background-color: var(--cinnabar-deep);
    color: white;
}
.notification.is-danger {
    background-color: var(--tint-danger);
    color: var(--onyx);
}

/* Info - Deep Teal (same as primary for consistency) */
.button.is-info {
    background-color: var(--deep-teal);
    border-color: var(--deep-teal);
    color: white;
}
.button.is-info:hover {
    background-color: #005a63;
    border-color: #005a63;
    color: white;
}
.button.is-info.is-light {
    background-color: var(--tint-info);
    border-color: var(--tint-info);
    color: var(--deep-teal);
}
.button.is-info.is-light:hover {
    background-color: #c4e4e7;
    border-color: #c4e4e7;
    color: var(--deep-teal);
}
.tag.is-info {
    background-color: var(--deep-teal);
    color: white;
}
.notification.is-info {
    background-color: var(--tint-info);
    color: var(--onyx);
}

/* Link - Deep Teal */
.button.is-link {
    background-color: var(--deep-teal);
    border-color: var(--deep-teal);
    color: white;
}
.button.is-link:hover {
    background-color: #005a63;
    border-color: #005a63;
    color: white;
}
.button.is-link.is-light {
    background-color: var(--tint-info);
    border-color: var(--tint-info);
    color: var(--deep-teal);
}
.button.is-link.is-light:hover {
    background-color: #c4e4e7;
    border-color: #c4e4e7;
    color: var(--deep-teal);
}

/* Outlined and ghost variants: Bulma leaves these on its default blue
   unless each is overridden, which is how corporate blue leaks in. */
.button.is-info.is-outlined,
.button.is-link.is-outlined {
    background-color: transparent;
    border-color: var(--deep-teal);
    color: var(--deep-teal);
}
.button.is-info.is-outlined:hover,
.button.is-link.is-outlined:hover {
    background-color: var(--deep-teal);
    border-color: var(--deep-teal);
    color: white;
}
.button.is-ghost {
    color: var(--deep-teal);
}
.button.is-ghost:hover {
    color: #005a63;
}

/* Small text in the danger colour: the 12px .help size needs the deep rose
   (5.2:1 on white), not --cinnabar (3.8:1). */
.help.is-danger {
    color: var(--muted-rose-deep);
}

/* Tabs - themed to match buttons */
.tabs-scroll {
    overflow-x: auto;
    padding-bottom: 0.25rem;
}
.tabs-scroll ul {
    flex-wrap: nowrap;
    gap: 0.5rem;
}
.tabs a.tab-link {
    border: 1px solid var(--deep-teal);
    border-radius: 8px;
    color: var(--deep-teal);
    background: var(--white);
    padding: 0.5rem 0.9rem;
    font-weight: 600;
    min-height: 2.5rem;
    line-height: 1.2;
    transition: background-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}
.tabs a.tab-link:hover {
    background-color: var(--tint-info);
}
.tabs a.tab-link:focus-visible {
    outline: 2px solid var(--deep-teal);
    outline-offset: 2px;
}
.tabs.is-toggle li.is-active a.tab-link {
    background-color: var(--deep-teal);
    border-color: var(--deep-teal);
    color: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

/* Tags */
.tag.is-light {
    background-color: var(--tint-info);
    border-color: var(--tint-info);
    color: var(--deep-teal);
}

/* Light tag combos: without these, Bulma's default light palette (cyan,
   mint) leaks through wherever templates use `tag is-X is-light`. */
.tag.is-primary.is-light,
.tag.is-link.is-light,
.tag.is-info.is-light {
    background-color: var(--tint-info);
    color: var(--deep-teal);
}
.tag.is-success.is-light {
    background-color: var(--tint-success);
    color: var(--reseda-green-deep);
}
.tag.is-warning.is-light {
    background-color: var(--tint-warning);
    color: var(--warm-amber-deep);
}
.tag.is-danger.is-light {
    background-color: var(--tint-danger);
    color: var(--muted-rose-deep);
}

/* Bulma background/text helpers used in templates; Bulma sets these with
   !important, so the overrides must too. */
.has-background-info-light,
.has-background-primary-light,
.has-background-link-light {
    background-color: var(--tint-info) !important;
}
.has-background-success-light {
    background-color: var(--tint-success) !important;
}
.has-background-warning-light {
    background-color: var(--tint-warning) !important;
}
.has-background-danger-light {
    background-color: var(--tint-danger) !important;
}
.has-background-primary {
    background-color: var(--deep-teal) !important;
}
.has-text-dark {
    color: var(--onyx) !important;
}

/* Messages: map Bulma's message component to the tint palette (it was
   previously unstyled here, so is-info rendered Bulma cyan). */
.message.is-info,
.message.is-primary,
.message.is-link {
    background-color: var(--tint-info);
}
.message.is-info .message-body,
.message.is-primary .message-body,
.message.is-link .message-body {
    border-color: var(--deep-teal);
    color: var(--onyx);
}
.message.is-info .message-header,
.message.is-primary .message-header,
.message.is-link .message-header {
    background-color: var(--deep-teal);
    color: var(--white);
}
.message.is-success {
    background-color: var(--tint-success);
}
.message.is-success .message-body {
    border-color: var(--reseda-green);
    color: var(--onyx);
}
.message.is-success .message-header {
    background-color: var(--reseda-green);
    color: var(--white);
}
.message.is-warning {
    background-color: var(--tint-warning);
}
.message.is-warning .message-body {
    border-color: var(--warm-amber);
    color: var(--onyx);
}
.message.is-warning .message-header {
    background-color: var(--warm-amber);
    color: var(--onyx);
}
.message.is-danger {
    background-color: var(--tint-danger);
}
.message.is-danger .message-body {
    border-color: var(--cinnabar);
    color: var(--onyx);
}
.message.is-danger .message-header {
    background-color: var(--cinnabar);
    color: var(--white);
}
.message.is-dark {
    background-color: var(--grey-lighter);
}
.message.is-dark .message-body {
    border-color: var(--deep-slate-blue);
    color: var(--onyx);
}
.message.is-dark .message-header {
    background-color: var(--deep-slate-blue);
    color: var(--white);
}

/* Chip add controls alignment */
.chip-addons .input.is-small,
.chip-addons .button.is-small {
    height: 2.5rem;
}

/* Light variants with tints. Body text on a tint needs the deep shades:
   --reseda-green and --cinnabar sit at about 3.4:1 and 3.3:1 on their tints. */
.notification.is-success.is-light {
    background-color: var(--tint-success);
    color: var(--reseda-green-deep);
}
.notification.is-warning.is-light {
    background-color: var(--tint-warning);
    color: var(--warm-amber-deep);
}
.notification.is-danger.is-light {
    background-color: var(--tint-danger);
    color: var(--muted-rose-deep);
}
.notification.is-info.is-light {
    background-color: var(--tint-info);
    color: var(--deep-teal);
}

/* Progress bars */
.progress.is-primary::-webkit-progress-value {
    background-color: var(--deep-teal);
}
.progress.is-primary::-moz-progress-bar {
    background-color: var(--deep-teal);
}
.progress.is-success::-webkit-progress-value {
    background-color: var(--reseda-green);
}
.progress.is-success::-moz-progress-bar {
    background-color: var(--reseda-green);
}
.progress.is-info::-webkit-progress-value {
    background-color: var(--deep-teal);
}
.progress.is-info::-moz-progress-bar {
    background-color: var(--deep-teal);
}
.progress.is-warning::-webkit-progress-value {
    background-color: var(--warm-amber);
}
.progress.is-warning::-moz-progress-bar {
    background-color: var(--warm-amber);
}
.progress.is-danger::-webkit-progress-value {
    background-color: var(--cinnabar);
}
.progress.is-danger::-moz-progress-bar {
    background-color: var(--cinnabar);
}

/* Indeterminate progress bars (animated loading bars) */
.progress.is-primary:indeterminate {
    background-image: linear-gradient(to right, var(--deep-teal) 30%, var(--grey-lighter) 30%);
}
.progress.is-success:indeterminate {
    background-image: linear-gradient(to right, var(--reseda-green) 30%, var(--grey-lighter) 30%);
}
.progress.is-info:indeterminate {
    background-image: linear-gradient(to right, var(--deep-teal) 30%, var(--grey-lighter) 30%);
}
.progress.is-warning:indeterminate {
    background-image: linear-gradient(to right, var(--warm-amber) 30%, var(--grey-lighter) 30%);
}
.progress.is-danger:indeterminate {
    background-image: linear-gradient(to right, var(--cinnabar) 30%, var(--grey-lighter) 30%);
}

/* File upload component. The boundary uses the form-control token so the
   file input measures 3:1 like every other field (WCAG 1.4.11, A11Y-002). */
.file-cta {
    background-color: var(--seasalt-white);
    border-color: var(--control-border);
    color: var(--onyx);
}
.file-cta:hover {
    background-color: var(--grey-lighter);
    border-color: var(--grey);
}
.file-name {
    border-color: var(--control-border);
}

/* Plotly injects `.js-plotly-plot .plotly .modebar-btn:focus-visible` (a 1 px
   black ring) after this sheet loads, so this selector outranks it (A11Y-027) */
.js-plotly-plot .plotly .modebar-group .modebar-btn:focus-visible {
    outline: 2px solid var(--deep-teal);
    outline-offset: 2px;
}

/* Text colour helpers - greys */
.has-text-grey {
    color: var(--grey) !important;
}
.has-text-grey-light {
    /* Text must stay readable: --grey-light (#DDD) is 1.35:1 on white, so the
       "light" text helper renders as standard secondary grey (WCAG 1.4.3).
       --grey-light remains available for borders and inactive backgrounds. */
    color: var(--grey) !important;
}
.has-text-grey-dark {
    color: var(--grey-dark) !important;
}

/* Text colour helpers - semantic */
.has-text-primary {
    color: var(--deep-teal) !important;
}
.has-text-info {
    color: var(--deep-teal) !important;
}
.has-text-success {
    color: var(--reseda-green-deep) !important;
}
.has-text-warning {
    color: var(--warm-amber-deep) !important;
}
.has-text-danger {
    color: var(--cinnabar-deep) !important;
}
.has-text-link {
    color: var(--deep-teal) !important;
}

/* Utility classes */
.is-inline {
    display: inline !important;
}
.is-inline-block {
    display: inline-block !important;
}

/* Consistent icon sizing in small buttons */
.button.is-small .icon.is-small i {
    font-size: 0.75rem;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    /* padding: 0 var(--spacing-m); */ /* Commented out - Bulma provides container padding */
}

/* Forms */
input, textarea, select {
    font-family: 'Work Sans', sans-serif;
    font-size: var(--font-size-m);
    padding: var(--spacing-s);
    border: 1px solid #ddd;
    border-radius: 4px;
    /* Removed width: 100% to allow inline elements like checkboxes to size naturally */
}

/* Specific override for textareas and selects if they should remain full width */
textarea, select {
    width: 100%;
}

/* Ensure text inputs are block or inline-block if needed */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="search"],
input[type="tel"],
input[type="url"],
input[type="file"] {
    width: 100%;
    display: block; /* Or inline-block if preferred */
}


label {
    display: block;
    margin-bottom: var(--spacing-xs);
    font-weight: 500;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: var(--spacing-s) var(--spacing-m);
    font-family: 'Work Sans', sans-serif;
    font-weight: 600;
    font-size: var(--font-size-m);
    text-align: center;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-primary {
    background-color: var(--muted-rose-deep);
    color: var(--white);
}

.btn-primary:hover {
    background-color: #bb4e59;
}

.btn-secondary {
    background-color: var(--deep-slate-blue);
    color: var(--seasalt-white);
}

.btn-secondary:hover {
    background-color: #1f3050;
}

.btn-highlight {
    background-color: var(--warm-amber);
    color: var(--onyx);
}

.btn-highlight:hover {
    background-color: #eaad32;
}

/* Card */
/* Commented out - Relying on Bulma's card styles now
.card {
    background-color: #fff;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    padding: var(--spacing-m);
    margin-bottom: var(--spacing-m);
}
*/

.card-header {
    margin-top: 0;
    margin-bottom: var(--spacing-m);
    border-bottom: 1px solid #eee;
    padding-bottom: var(--spacing-s);
}

/* Data elements */
.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-family: 'Inter', sans-serif;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.data-table th {
    font-weight: 500;
    text-align: left;
    padding: var(--spacing-m) var(--spacing-l);
    background-color: var(--seasalt-white);
    color: var(--onyx);
    font-size: var(--font-size-m);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid #E9ECEF;
}

.data-table td {
    padding: var(--spacing-m) var(--spacing-l);
    border-bottom: 1px solid #E9ECEF;
    font-size: var(--font-size-m);
    color: var(--onyx);
}

.data-table tr:last-child td {
    border-bottom: none;
}

.data-table tr:hover {
    background-color: var(--seasalt-white);
    transition: background-color 0.2s ease;
}

/* Status badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.375rem 0.75rem;
    font-size: var(--font-size-s);
    font-weight: 600;
    line-height: 1;
    border-radius: 9999px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.status-badge-draft {
    background-color: var(--warm-amber);
    color: var(--onyx);
}

.status-badge-active {
    background-color: var(--reseda-green);
    color: var(--seasalt-white);
}

.status-badge-archived {
    background-color: var(--deep-slate-blue);
    color: var(--seasalt-white);
}

/* Filter buttons */
.filter-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    min-width: 120px;
    font-size: var(--font-size-m);
    font-weight: 500;
    border-radius: 0.75rem;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
    font-family: 'Work Sans', sans-serif;
    border: 1px solid transparent;
    white-space: nowrap;
}

.filter-button-active {
    background-color: var(--muted-rose-deep);
    color: var(--white);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.filter-button-active:hover {
    background-color: #bb4e59;
    text-decoration: none;
}

.filter-button-inactive {
    background-color: var(--seasalt-white);
    color: var(--onyx);
    border-color: #E9ECEF;
}

.filter-button-inactive:hover {
    background-color: #E9ECEF;
    text-decoration: none;
    border-color: #DEE2E6;
}

/* Action links */
.action-link {
    color: var(--deep-teal);
    font-weight: 500;
    text-decoration: none;
    transition: color 0.2s ease;
}

.action-link:hover {
    color: #005a63;
    text-decoration: none;
}

.action-link-primary {
    color: var(--muted-rose);
}

.action-link-primary:hover {
    color: #bb4e59;
}

/* Alert messages */
.alert {
    padding: var(--spacing-m);
    border-radius: 4px;
    margin-bottom: var(--spacing-m);
}

.alert-error {
    background-color: rgba(231, 76, 60, 0.1);
    border-left: 4px solid var(--cinnabar);
    color: var(--cinnabar);
}

.alert-success {
    background-color: rgba(104, 139, 88, 0.1);
    border-left: 4px solid var(--reseda-green);
    color: var(--reseda-green);
}

.alert-info {
    background-color: rgba(0, 109, 119, 0.1);
    border-left: 4px solid var(--deep-teal);
    color: var(--deep-teal);
}

/* Fallback styles in case components don't load */
textarea {
    width: 100%;
    min-height: 150px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: 'Work Sans', sans-serif;
    font-size: var(--font-size-m);
    margin-bottom: var(--spacing-m);
}

/* :not(.button) keeps this off Bulma buttons: the attribute selector outranks
   Bulma's variable-driven colour and padding, which turned every styled submit
   button rose with fixed padding regardless of its classes. :not(.tag) keeps
   it off Bulma delete tags (submit buttons on the element mapping page), which
   otherwise render as a solid rose box instead of a quiet grey cross. */
button[type="submit"]:not(.button):not(.tag):not(.dc-btn):not(.delete):not(.avatar-menu__item) {
    background-color: var(--muted-rose-deep);
    color: var(--white);
    padding: var(--spacing-s) var(--spacing-m);
    border: none;
    border-radius: 4px;
    font-weight: 600;
    cursor: pointer;
}

button[type="submit"]:not(.button):not(.tag):not(.dc-btn):not(.delete):not(.avatar-menu__item):hover {
    background-color: #8a3540;
}

/* Key activities list styling */
.key-activities {
    list-style-type: none;
    padding-left: 0;
}

.key-activities li {
    margin: 5px 0;
    padding-left: 20px;
    position: relative;
}

.key-activities li:before {
    content: "•";
    position: absolute;
    left: 0;
    color: var(--onyx);
}

.alignment-score {
    font-weight: bold;
    color: var(--deep-teal);
}

/* Feedback form styling */
.feedback-form {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px dashed #ccc;
}

.rating-container {
    display: flex;
    flex-wrap: wrap;
    margin: 10px 0;
    gap: var(--spacing-s);
}

.feedback-textarea {
    height: 80px;
    width: 100%;
}

.model-info {
    font-size: 0.8em;
    color: #666;
    margin-top: 10px;
}

.feedback-submitted {
    background-color: rgba(104, 139, 88, 0.1);
    border-left: 4px solid var(--reseda-green);
    color: var(--reseda-green);
    padding: 10px;
    border-radius: 4px;
    margin-top: 10px;
    display: none;
}

/* Header and Navigation */
.site-header {
    background-color: var(--muted-rose) !important;
    padding: var(--spacing-m) 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo a {
    color: var(--seasalt-white);
    font-weight: 600;
    font-size: var(--font-size-xl);
    text-decoration: none;
}

.main-nav ul {
    display: flex;
    list-style: none;
    padding: 0;
    margin: 0;
    gap: var(--spacing-m);
}

.main-nav a {
    color: var(--seasalt-white);
    text-decoration: none;
    font-weight: 500;
    padding: var(--spacing-xs) var(--spacing-s);
    border-radius: 4px;
    transition: background-color 0.2s;
}

.main-nav a:hover {
    background-color: rgba(255,255,255,0.1);
    text-decoration: none;
}

/* Footer styling */
.site-footer {
    background-color: var(--onyx);
    color: var(--seasalt-white);
    padding: var(--spacing-m) 0;
    margin-top: var(--spacing-xxl);
    text-align: center;
}

/* HTMX Indicator */
.htmx-indicator {
    opacity: 0;
    transition: opacity 200ms ease-in;
}
.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
    opacity: 1;
}
/* Hide elements during HTMX request */
.htmx-request .htmx-indicator-hide,
.htmx-request.htmx-indicator-hide {
    display: none !important;
}

/* Automatic busy state: htmx puts .htmx-request on the element that fired
   the request, so any button-triggered action shows a spinner and blocks
   double-clicks with no per-template wiring. Templates can still opt into
   richer feedback with hx-indicator. */
.button.htmx-request {
    pointer-events: none;
    position: relative;
    color: transparent !important;
}
.button.htmx-request::after {
    content: "";
    position: absolute;
    left: calc(50% - 8px);
    top: calc(50% - 8px);
    width: 16px;
    height: 16px;
    border: 2px solid var(--grey-light);
    border-top-color: var(--deep-teal);
    border-radius: var(--border-radius-full);
    animation: htmx-busy-spin 0.6s linear infinite;
}
@keyframes htmx-busy-spin {
    to { transform: rotate(360deg); }
}
@media (prefers-reduced-motion: reduce) {
    /* Static ring, no rotation (WCAG 2.2.2 / 2.3.3, A11Y-021); the button
       text still says what is happening */
    .button.htmx-request::after { animation: none; }
}

/* Checkbox List Item Alignment */
.checkbox-list-item {
    margin-bottom: var(--spacing-s); /* Keep existing margin */
}

.checkbox-list-item > div { /* Target the wrapper div */
    display: flex;
    align-items: flex-start; /* Align items to the top */
}

.checkbox-list-item input[type="checkbox"] {
    margin-right: var(--spacing-s); /* Space between checkbox and label */
    flex-shrink: 0; /* Prevent checkbox from shrinking */
    margin-top: 0.2em; /* Small adjustment to align checkbox visually with text */
    /* Reset width if it was globally set */
    width: auto; 
}

.checkbox-list-item label {
    margin-bottom: 0; /* Override default label margin */
    /* Ensure label takes remaining space if needed, though not strictly necessary with flex-start */
}

/* Survey Detail Info List Styling */
.survey-info dl {
    margin-top: var(--spacing-s); /* Add some space above the list */
    padding: var(--spacing-m);
    background-color: #fff; /* White background */
    border-radius: 4px; /* Match card radius */
    box-shadow: 0 2px 4px rgba(0,0,0,0.1); /* Match card shadow */
}

.survey-info dt {
    font-weight: 600; /* Bold terms */
    color: var(--deep-slate-blue); /* Use a supporting colour */
    margin-top: var(--spacing-s); /* Space above each term */
}

.survey-info dt:first-of-type {
    margin-top: 0; /* No margin above the first term */
}

.survey-info dd {
    margin-left: 0; /* Remove default indentation */
    margin-bottom: var(--spacing-s); /* Space below each definition */
    color: var(--onyx); /* Standard text colour */
}

/* Bulma Overrides - Phase 1 (Navbar) */

/* Override the background color of the main navbar */
.navbar.navbar-main {
    --bulma-navbar-background-color: var(--muted-rose); /* Tell Bulma's variable system to use our color */
    background-color: var(--muted-rose); /* Also set it directly */
    /* Additional overrides for text color, hover states, etc. will be kept */
}

/* Override the text color for links within the main navbar */
.navbar.navbar-main .navbar-item,
.navbar.navbar-main .navbar-link {
    color: var(--seasalt-white); /* White text for contrast */
}

/* Override hover/focus states for links within the main navbar */
.navbar.navbar-main .navbar-item:hover,
.navbar.navbar-main .navbar-item:focus,
.navbar.navbar-main .navbar-link:hover,
.navbar.navbar-main .navbar-link:focus {
    background-color: rgba(255, 255, 255, 0.1); /* Slight white highlight on hover */
    color: var(--seasalt-white); /* Ensure text remains white */
}

/* Override the active state background color for links within the main navbar */
.navbar.navbar-main .navbar-item.is-active,
.navbar.navbar-main .navbar-link.is-active {
    background-color: rgba(255, 255, 255, 0.2); /* Slightly stronger highlight for active */
    color: var(--seasalt-white);
}

/* Override the color of the navbar burger icon */
.navbar.navbar-main .navbar-burger {
    color: var(--seasalt-white);
}

/* Ensure the brand text (if styled separately) also uses the correct color */
.navbar.navbar-main .navbar-brand .navbar-item .has-text-white {
    color: var(--seasalt-white) !important; /* Use !important if necessary to override Bulma utility */
}

/* Bulma Overrides - Dashboard Cards */

/* Style links within card titles to use the design system link color */
.card .card-content .title a {
    color: var(--deep-teal);
}

/* Optional: Define hover state if needed */
.card .card-content .title a:hover {
    /* color: var(--some-hover-color); */ /* Uncomment and set if a specific hover color is desired */
    text-decoration: underline; /* Keep Bulma's default underline on hover for links */
}

/* Ensure cards within columns stretch to the same height - only for card grids */
.columns.is-card-grid .column .card {
    height: 100%;
    /* Optional: If content needs aligning, make card a flex container too */
    /* display: flex; */
    /* flex-direction: column; */
}

/* Optional: If card-content needs to grow */
/* .column .card .card-content {
    flex-grow: 1;
} */

/* Add custom styles at the end or in appropriate sections */

/* Increase Navbar Height */
.navbar-item {
    padding-top: 1rem; 
    padding-bottom: 1rem;
}

/* Increase Logo Max Height within Navbar */
.navbar-brand .navbar-item img {
    max-height: 2.5rem; /* Adjust as needed */
}

/* Bulma Overrides - Breadcrumb */
.breadcrumb a {
    color: var(--deep-teal);
}
.breadcrumb a:hover {
    color: var(--deep-teal);
}
.breadcrumb li.is-active a {
    color: var(--onyx);
}

/* Bulma Overrides - Tabs */
.tabs a {
    color: var(--deep-teal);
    border-bottom-color: var(--grey-light);
}
.tabs a:hover {
    color: var(--deep-teal);
    border-bottom-color: var(--deep-teal);
}
.tabs li.is-active a {
    color: var(--deep-teal);
    border-bottom-color: var(--deep-teal);
}
.tabs.is-boxed li.is-active a {
    background-color: var(--seasalt-white);
    border-color: var(--grey-light);
    border-bottom-color: transparent;
}

/* Bulma Overrides - Dropdown button items */
/* Native <button> elements inside dropdown menus need explicit styling
   since Bulma's .dropdown-item rules mainly target <a> elements */
.dropdown-content button.dropdown-item {
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    font-size: inherit;
    font-family: inherit;
    padding: 0.375rem 1rem;
    color: var(--onyx);
}
.dropdown-content button.dropdown-item:hover {
    background-color: var(--bulma-background);
    color: var(--onyx);
}

/* Step Indicator - Reusable workflow stepper */
.steps-indicator {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 1.5rem 0;
    padding: 0 1rem;
    /* Also used as an <ol> (review stepper); neutralise list rendering. */
    list-style: none;
}

.step-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    flex: 1;
}

.step-item:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 1rem;
    left: 60%;
    right: -40%;
    height: 2px;
    background-color: var(--grey-light);
    z-index: 1;
}

.step-item.is-completed:not(:last-child)::after {
    background-color: var(--reseda-green);
}

.step-item.is-active:not(:last-child)::after {
    background-color: var(--deep-teal);
}

.step-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background-color: var(--grey-light);
    color: var(--grey-dark); /* --grey on --grey-light is only ~4.3:1 at this size */
    font-weight: 600;
    font-size: 0.875rem;
    z-index: 2;
    position: relative;
    margin-bottom: 0.5rem;
}

.step-item.is-active .step-number {
    background-color: var(--deep-teal);
    color: white;
}

.step-item.is-completed .step-number {
    background-color: var(--reseda-green);
    color: white;
}

.step-label {
    font-size: 0.75rem;
    font-weight: 500;
    text-align: center;
    color: var(--grey);
}

.step-item.is-active .step-label {
    color: var(--deep-teal);
    font-weight: 600;
}

.step-item.is-completed .step-label {
    color: var(--reseda-green-deep); /* base green fails AA at this text size */
}

.step-helper {
    font-size: 0.7rem;
    color: var(--grey);
    text-align: center;
    max-width: 12rem;
    margin-top: 0.25rem;
}

/* Helper text is a prompt for steps not yet reached; active and completed
   steps hide it to keep the indicator quiet (promoted from the deleted
   design_principles fork). Consumers without .step-helper are unaffected. */
.step-item.is-active .step-helper,
.step-item.is-completed .step-helper {
    display: none;
}

/* Element mapping: the remove-mapping delete tag needs a touch target of at
   least 24px (WCAG 2.5.8); Bulma's default is ~20px. */
.tag.is-delete.element-map-remove {
    min-width: 1.75rem;
    min-height: 1.75rem;
}

/* ==========================================================================
   Utility Classes
   ========================================================================== */

.has-text-rose {
    color: var(--muted-rose);
}

/* Row divider inside a padded list box (Bulma has no border helper). */
.has-border-bottom {
    border-bottom: 1px solid var(--grey-lighter);
}

/* Keeps the line breaks in multi-line messages queued by views. */
.is-pre-line {
    white-space: pre-line;
}

/* Gap for inline flex groups (a title beside its status tag, say). */
.is-flex-gap-xs {
    gap: var(--spacing-xs);
}

/* Plain activity list: Bulma's .content would otherwise bullet and indent it. */
.recent-activity-list {
    list-style: none;
    margin-left: 0;
}

/* Truncating tags: Bulma tags never wrap, so a long value (a source filename,
   say) runs past the edge of its card. Put .is-truncating on the wrapping
   .control and .is-truncated on the text span; keep the full value in the
   tag's title attribute so hover still reveals it.
   The selector has to out-specify Bulma's `.field.is-grouped > .control`,
   which pins flex-shrink to 0 and would keep the control at content width. */
.field.is-grouped > .control.is-truncating,
.control.is-truncating {
    min-width: 0;
    flex-shrink: 1;
}

.control.is-truncating .tag {
    max-width: min(100%, 20rem);
}

.tag .is-truncated {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ==========================================================================
   Notification Overrides (brand colours)
   ========================================================================== */

.notification.is-success.is-light {
    background-color: var(--tint-success);
    color: var(--reseda-green-deep);
}
.notification.is-danger.is-light {
    background-color: var(--tint-danger);
    color: var(--muted-rose-deep);
}
.notification.is-warning.is-light {
    background-color: var(--tint-warning);
    color: var(--warm-amber-deep);
}
.notification.is-info.is-light {
    background-color: var(--tint-info);
    color: var(--deep-teal);
}

/* ==========================================================================
   Reduced motion: disable decorative transitions for users who ask for it
   (WCAG 2.3.3). Covers every transition defined in this file.
   ========================================================================== */

/* ==========================================================================
   Rendered user guides (help centre page and the assistant drawer's Guide
   tab share these; the markup wraps guide HTML in .help-guide-content).
   ========================================================================== */

.help-guide-content img {
    max-width: 100%;
    border: 1px solid var(--grey-lighter);
    border-radius: var(--border-radius-md, 6px);
    box-shadow: var(--shadow-sm, 0 2px 6px rgba(0, 0, 0, 0.06));
    margin: 0.5rem 0 1rem;
}

.help-guide-content h1,
.help-guide-content h2,
.help-guide-content h3 {
    color: var(--deep-slate-blue);
    scroll-margin-top: 4rem;
}

/* Help centre index cards (templates/help/index.html). The a.box selectors
   outrank Bulma's link-blue a.box:hover border and the anchor underline. */
.help-guide-card {
    display: block;
    height: 100%;
    transition: box-shadow 0.15s ease, transform 0.15s ease;
}
a.help-guide-card:hover,
a.help-guide-card:focus {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
    text-decoration: none;
}
a.help-guide-card:focus-visible {
    outline: 2px solid var(--deep-teal);
    outline-offset: 2px;
}
.help-guide-card__title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    font-weight: 600;
    color: var(--deep-slate-blue);
    margin-bottom: 0.25rem;
}
.help-guide-card__title .icon {
    color: var(--deep-teal);
    transition: transform 0.15s ease;
}
.help-guide-card:hover .help-guide-card__title .icon {
    transform: translateX(3px);
}

/* Guide page sidebar: keeps the guide list in view on long guides. */
.help-guide-sidebar {
    position: sticky;
    top: 1rem;
}
.help-guide-sidebar .menu-list a {
    padding: 0.4rem 0.6rem;
    border-radius: var(--border-radius-sm);
    color: var(--onyx);
}
.help-guide-sidebar .menu-list a:hover {
    background-color: var(--tint-info);
    color: var(--deep-teal);
    text-decoration: none;
}
.help-guide-sidebar .menu-list a.is-active {
    background-color: var(--deep-teal);
    color: var(--white);
    font-weight: 600;
}

/* Breadcrumb row doubles as the action row: crumbs left, page actions
   right, so utility buttons sit at the very top instead of pushing the
   title and stepper down. */
.module-topbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    margin-bottom: 1rem;
}

.module-topbar .breadcrumb {
    margin-bottom: 0;
}

.module-topbar__actions {
    margin-left: auto;
}

/* Between Bulma's small (0.75rem) and default (1rem): readable without
   competing with the page title. Padding scales with the em-based button. */
.module-topbar__actions .button {
    font-size: 0.875rem;
}

/* ==========================================================================
   Assistant drawer: thread, composer, empty state. Markup lives in
   modus/assistant/templates; the drawer shell itself is push-drawer.css.
   ========================================================================== */

.assistant-thread {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* 13px body: a readable step up from Bulma's is-size-7 without crowding the
   380px drawer. */
.assistant-msg {
    max-width: 92%;
    min-width: 0;
    padding: 0.6rem 0.8rem;
    border-radius: var(--border-radius-lg);
    font-size: 0.8125rem;
    line-height: 1.55;
    /* Long unbroken tokens (filenames, URLs, identifiers) must wrap, not
       widen the pane into a horizontal scroll. */
    overflow-wrap: anywhere;
}

.assistant-msg--user {
    align-self: flex-end;
    background-color: var(--tint-info);
    border-bottom-right-radius: var(--border-radius-sm);
}

.assistant-msg--assistant {
    align-self: flex-start;
    background-color: var(--seasalt-white);
    border: 1px solid var(--grey-lighter);
    border-bottom-left-radius: var(--border-radius-sm);
}

/* Answers hold headings and lists; give them the full drawer width. */
.assistant-msg--answer {
    max-width: 100%;
}

.assistant-msg--inflight {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--grey);
}

/* Gentle entrance for the newest message. Scoped to the settled state so the
   2s HTMX poll (which re-swaps the whole thread while in flight) never
   replays it on every tick. */
#assistant-body[data-in-flight="false"] .assistant-thread .assistant-msg:last-child {
    animation: assistant-msg-in 0.25s cubic-bezier(0.25, 1, 0.5, 1);
}
@keyframes assistant-msg-in {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
}

/* Typing dots while an answer is queued or processing. */
.assistant-typing {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}
.assistant-typing span {
    width: 6px;
    height: 6px;
    border-radius: var(--border-radius-full);
    background-color: var(--deep-teal);
    opacity: 0.35;
    animation: assistant-typing 1.2s ease-in-out infinite;
}
.assistant-typing span:nth-child(2) {
    animation-delay: 0.15s;
}
.assistant-typing span:nth-child(3) {
    animation-delay: 0.3s;
}
@keyframes assistant-typing {
    0%, 60%, 100% {
        opacity: 0.35;
        transform: none;
    }
    30% {
        opacity: 1;
        transform: translateY(-2px);
    }
}

/* Empty state (module without a guide): centred invitation. */
.assistant-empty {
    text-align: center;
    padding: 1.5rem 0.75rem 1rem;
}
.assistant-empty__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: var(--border-radius-full);
    background-color: var(--tint-info);
    color: var(--deep-teal);
    font-size: 1.1rem;
    margin-bottom: 0.6rem;
}
.assistant-empty__title {
    font-weight: 600;
    font-size: 0.9375rem;
    color: var(--deep-slate-blue);
    margin-bottom: 0.2rem;
}
.assistant-empty__hint {
    font-size: 0.8125rem;
    color: var(--grey);
}

/* Empty state (guided module): the guide's sections as tappable rows. */
.assistant-empty-sections {
    margin: 0;
}
.assistant-empty-sections a {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    padding: 0.35rem 0.5rem;
    border-radius: var(--border-radius-sm);
    font-size: 0.8125rem;
    color: var(--deep-teal);
}
.assistant-empty-sections a:hover {
    background-color: var(--tint-info);
}

/* Suggested-question chips: soft teal pills that wrap long questions. */
.assistant-chip.button {
    height: auto;
    white-space: normal;
    text-align: left;
    border-radius: var(--border-radius-pill);
    border: 1px solid #c4e4e7;
    background-color: var(--white);
    color: var(--deep-teal);
}
.assistant-chip.button:hover:not([disabled]) {
    background-color: var(--tint-info);
    border-color: var(--deep-teal);
    color: var(--deep-teal);
}

/* Composer: input and send button on one row, chat style. */
.assistant-composer__row {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
}
/* Single line at rest, exactly the send button's height; assistant-drawer.js
   grows it with the draft (works in every browser, unlike field-sizing). */
.assistant-composer__row .textarea {
    flex: 1 1 auto;
    min-width: 0;
    margin: 0; /* the legacy bare-textarea fallback adds margin-bottom, which
                  flex-end aligns to and drops the send button 1rem low */
    font-size: 0.8125rem;
    min-height: 2.5rem;
    max-height: 9rem;
    resize: none;
    overflow-y: auto;
}
.assistant-composer__send {
    flex: 0 0 auto;
    width: 2.5rem;
    height: 2.5rem;
    padding: 0;
    border-radius: var(--border-radius-md);
}
@media (pointer: coarse) {
    .assistant-composer__send {
        width: 44px;
        height: 44px;
    }
}
.assistant-composer__hint {
    margin-top: 0.35rem;
    font-size: 0.6875rem;
    color: var(--grey);
}

/* Same register as the review workspace's "not legal advice" line. */
.assistant-disclaimer {
    margin-top: 0.75rem;
    font-size: 0.6875rem;
    color: var(--grey);
}

/* The drawer's Guide tab shares .help-guide-content; match the thread size. */
.assistant-guide .help-guide-content {
    font-size: 0.8125rem;
    overflow-wrap: anywhere;
}
.assistant-guide__open a {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8125rem;
}

/* ==========================================================================
   Pack workbench: element list and editing pane
   ========================================================================== */

/* The element list scrolls on its own so it never pushes the editing pane
   out of reach; the pane keeps the page scroll. */
.pack-workbench .pack-element-list-scroll {
    position: sticky;
    top: 1rem;
    max-height: calc(100vh - 2rem);
    overflow-y: auto;
}

/* Breathing room when the pane is scrolled to after selecting an element. */
#pack-element-pane {
    scroll-margin-top: 1rem;
}

/* Element guidance: optional by design, a quiet disclosure above the
   editor rather than a block of prose the consultant must scroll past. */
.pack-guidance summary {
    cursor: pointer;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--grey);
}

.pack-guidance summary:hover {
    color: var(--deep-teal);
}

.pack-guidance[open] summary {
    color: var(--deep-teal);
    margin-bottom: 0.25rem;
}

/* Editor bar: formatting buttons left, Write/Preview toggle right.
   Hidden until pack-editor.js reveals it (the buttons need scripting). */
.pack-editor-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.pack-editor-bar .buttons,
.pack-editor-bar .tabs {
    margin-bottom: 0;
}

.pack-editor-preview {
    min-height: 8rem;
}

/* Bulma toggle tabs default to link blue; the active state is teal here
   like every other active control. */
.pack-editor-tabs li.is-active a {
    background-color: var(--deep-teal);
    border-color: var(--deep-teal);
    color: var(--white);
}

@media (prefers-reduced-motion: reduce) {
    .tabs a.tab-link,
    .btn,
    .data-table tr:hover,
    .filter-button,
    .action-link,
    .main-nav a,
    .htmx-indicator {
        transition: none;
    }
    /* Bulma's indeterminate progress bar animates regardless of preference;
       show it static (Font Awesome spinners already respect this query) */
    .progress:indeterminate {
        animation: none;
    }
    /* Assistant drawer and help cards: static dots, no lifts or entrances. */
    #assistant-body[data-in-flight="false"] .assistant-thread .assistant-msg:last-child,
    .assistant-typing span {
        animation: none;
    }
    .help-guide-card,
    .help-guide-card__title .icon,
    .assistant-chip.button {
        transition: none;
    }
}

/* Help and feedback form (tools/support). */
.help-guide-card--feedback {
    border-left: 3px solid var(--deep-teal);
}
/* Honeypot: off-screen and out of the tab order; aria-hidden on the wrapper
   keeps it away from assistive technology. Never display:none, bots skip that. */
.support-form__honeypot {
    position: absolute;
    left: -10000px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}
.support-form__errors:focus {
    outline: 2px solid var(--deep-teal);
    outline-offset: 2px;
}
.support-form .select,
.support-form .select select {
    width: 100%;
}

/* ---------------------------------------------------------------------------
   Findings library (tools.findings): cards a person confirms or rejects whole.
   One card = one claim; the status edge is the only colour that changes.
   --------------------------------------------------------------------------- */
.findings-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-s);
}
.finding-card {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-s) var(--spacing-m);
    padding: var(--spacing-s) var(--spacing-m);
    background: var(--white);
    border: 1px solid var(--grey-lighter);
    border-width: 0 0 1px;
    border-radius: 0;
    box-shadow: none;
}
.finding-card--candidate { border-left-color: var(--warm-amber); }
.finding-card--confirmed { border-left-color: var(--reseda-green); }
.finding-card--rejected { border-left-color: var(--grey-light); }
.finding-card__main { flex: 1 1 28rem; min-width: 0; }
.finding-card__headline {
    font-weight: 600;
    font-size: var(--font-size-m);
    line-height: 1.4;
    margin-bottom: var(--spacing-xs);
    overflow-wrap: anywhere;
}
.finding-card--rejected .finding-card__headline { color: var(--grey-dark); font-weight: 500; }
.finding-card__meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-xs);
    align-items: center;
    margin-bottom: var(--spacing-xs);
}
.finding-card__status--candidate { background: var(--tint-warning); color: var(--warm-amber-deep); }
.finding-card__status--confirmed { background: var(--tint-success); color: var(--reseda-green-deep); }
.finding-card__status--rejected { background: var(--grey-lighter); color: var(--grey-dark); }
.finding-card__label { background: var(--tint-info); color: var(--deep-slate-blue); }
.finding-card__weak { font-size: 0.85rem; color: var(--warm-amber-deep); margin-bottom: var(--spacing-xs); }
.finding-card__source { font-size: 0.85rem; color: var(--grey); overflow-wrap: anywhere; }
.finding-card__byline { display: block; margin-top: 2px; }
.finding-card__details { font-size: 0.85rem; margin-top: var(--spacing-xs); }
.finding-card__details > summary { cursor: pointer; color: var(--deep-teal); }
.finding-card__snippet {
    margin: var(--spacing-xs) 0 0;
    padding: var(--spacing-xs) var(--spacing-s);
    border-left: 3px solid var(--deep-teal);
    background: var(--seasalt-white);
    font-style: italic;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}
.finding-card__actions {
    flex: 0 0 auto;
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-xs);
    align-items: flex-start;
    align-content: flex-start;
    max-width: 100%;
}
/* The tools come last in the row; an open tool takes a row of its own with
   its form beneath, so the decision buttons before it never move. */
.finding-card__tool > summary { list-style: none; display: inline-flex; }
.finding-card__tool > summary::-webkit-details-marker { display: none; }
.finding-card__tool[open] { flex-basis: 100%; }
.finding-card__tool[open] > summary { background: var(--tint-info); }
.finding-card__form {
    width: min(28rem, 100%);
    margin-top: var(--spacing-xs);
    padding: var(--spacing-s);
    border: 1px solid var(--grey-lighter);
    border-radius: var(--border-radius-sm);
    background: var(--seasalt-white);
}
.finding-card__labels {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-xs) var(--spacing-s);
    border: 0;
    padding: 0;
    margin: 0;
}
.findings-counts { display: flex; flex-wrap: wrap; gap: var(--spacing-xs); margin-bottom: var(--spacing-s); }
.findings-counts .tag { text-decoration: none; }
.findings-runs { display: flex; flex-direction: column; gap: var(--spacing-xs); }
.findings-run .notification { margin-bottom: 0; }
.findings-filters { margin-bottom: var(--spacing-m); }
.findings-filters .field.is-grouped { align-items: flex-end; }
.findings-filters__apply { display: flex; gap: var(--spacing-xs); }
.findings-sheet__group + .findings-sheet__group { margin-top: var(--spacing-l); }
@media (max-width: 768px) {
    .finding-card { flex-direction: column; }
    .finding-card__main { flex: 0 1 auto; }
    .finding-card__actions { width: 100%; }
}

/* Suggested findings strip in the pack workbench (consumer of tools.findings). */
.pack-findings {
    padding: var(--spacing-s) var(--spacing-m);
    border: 1px solid var(--grey-lighter);
    border-left: 4px solid var(--deep-teal);
    border-radius: var(--border-radius-md);
    background: var(--white);
}
.pack-findings__list { display: flex; flex-direction: column; gap: var(--spacing-xs); border: 0; padding: 0; margin: 0; }
.pack-findings__item { display: grid; grid-template-columns: auto 1fr; column-gap: var(--spacing-xs); align-items: start; line-height: 1.4; }
.pack-findings__item input { margin-top: 4px; }
.pack-findings__headline { grid-column: 2; font-weight: 500; overflow-wrap: anywhere; }
.pack-findings__source { grid-column: 2; font-size: 0.8rem; color: var(--grey); }
.findings-export .control.is-expanded { min-width: 0; }
.findings-export .select, .findings-export .select select { min-width: 0; width: 100%; }
@media (max-width: 768px) {
    .findings-export { flex-basis: 100%; }
}
/* Input-plus-button rows wrap on narrow screens so the chosen value stays readable
   before the button that acts on it. */
@media (max-width: 768px) {
    .findings-extract .field.has-addons,
    .findings-label-form .field.has-addons,
    .findings-browse-form .field.has-addons,
    .findings-export.field.has-addons { flex-wrap: wrap; }
    .findings-extract .field.has-addons > .control.is-expanded,
    .findings-label-form .field.has-addons > .control.is-expanded,
    .findings-browse-form .field.has-addons > .control,
    .findings-export.field.has-addons > .control { flex-basis: 100%; }
    .findings-extract .field.has-addons > .control .select,
    .findings-extract .field.has-addons > .control .select select,
    .findings-browse-form .field.has-addons > .control .select,
    .findings-browse-form .field.has-addons > .control .select select,
    .findings-export .select, .findings-export .select select { width: 100%; }
    .findings-extract .field.has-addons > .control + .control,
    .findings-label-form .field.has-addons > .control + .control,
    .findings-browse-form .field.has-addons > .control + .control,
    .findings-export.field.has-addons > .control + .control { margin-top: var(--spacing-xs); }
    .finding-card__actions .button { min-height: 2.75rem; }
    .findings-page-header { flex-wrap: wrap; }
    .findings-page-header > .content-card__title { flex-basis: 100%; }
}

/* Findings review uses compact rows and bounded source selectors. */
.findings-filters .control { max-width: 100%; }
.findings-filters .select, .findings-filters select { max-width: 100%; }
.pack-findings__list { max-height: 24rem; overflow-y: auto; }
.findings-upload .field { margin-bottom: var(--spacing-m); }

.drafting-form .radio { margin-inline-end: 1rem; }
.drafting-form .checkbox, #thought-result .checkbox { padding-block: 0.25rem; }
@media (max-width: 768px) {
    #findings-page .buttons .button, .findings-workflow .button, .thought-actions .button { max-width: 100%; white-space: normal; height: auto; min-height: 2.75rem; text-align: center; }
    .drafting-form .radio { display: block; margin-block: 0.5rem; }
}
