/*
 * Deal Passport CSS
 * Version 1 Brand + GOV.UK Design System accessibility patterns
 *
 * Typography scale, spacing, form controls, focus states and
 * component patterns adapted from GOV.UK Frontend.
 * Colours are Version 1 brand.
 *
 * No frameworks, no build tools, pure CSS with custom properties.
 */


/* ========================================
   1. DESIGN TOKENS
   ======================================== */

:root {
    /* Brand colours */
    --color-navy: #052831;
    --color-teal: #00c6c2;
    --color-white: #ffffff;

    /* Functional colours (GOV.UK-inspired mapping) */
    --color-text: #052831;
    --color-secondary-text: #505a5f;
    --color-link: #007a78;           /* Dark teal, 5.15:1 on white — passes AA */
    --color-link-hover: #052831;
    --color-link-visited: #4c2c92;
    --color-border: #b1b4b6;
    --color-input-border: #052831;   /* Dark border for max contrast — GOV.UK pattern */
    --color-focus: #ffdd00;          /* GOV.UK standard focus yellow */
    --color-error: #d4351c;
    --color-success: #00703c;
    --color-body-bg: #f3f4f4;
    --color-surface-bg: #ffffff;

    /* RAG colours — primary */
    --color-rag-red: #cc4b37;
    --color-rag-amber: #ffae00;
    --color-rag-green: #3adb76;

    /* RAG colours — tag variants (dark text on light bg for contrast) */
    --color-tag-red-text: #651b1b;
    --color-tag-red-bg: #f4dbd7;
    --color-tag-amber-text: #594300;
    --color-tag-amber-bg: #ffeecc;
    --color-tag-green-text: #1d6d3b;
    --color-tag-green-bg: #d8f8e4;

    /* RAG colours — selector buttons (strong bg, accessible text) */
    --color-sel-red-bg: #cc4b37;     /* 4.82:1 with white */
    --color-sel-amber-bg: #ffae00;   /* Uses navy text for contrast */
    --color-sel-green-bg: #1a7a42;   /* 5.61:1 with white */

    /* Typography */
    --font-display: 'Plus Jakarta Sans', arial, sans-serif;
    --font-body: 'Inter', arial, sans-serif;

    /* Spacing scale — mobile-first, responsive at tablet */
    --space-1: 5px;
    --space-2: 10px;
    --space-3: 15px;
    --space-4: 15px;
    --space-5: 15px;
    --space-6: 20px;
    --space-7: 25px;
    --space-8: 30px;
    --space-9: 40px;

    /* Borders (GOV.UK values) */
    --border-width: 5px;
    --border-width-narrow: 4px;
    --border-width-form: 2px;
    --border-width-error: 4px;
    --border-color: var(--color-border);

    /* Focus */
    --focus-width: 3px;
    --focus-color: var(--color-focus);

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(5, 40, 49, 0.08);
    --shadow-md: 0 2px 8px rgba(5, 40, 49, 0.12);

    /* Layout */
    --page-width: 1400px;
    --gutter: 30px;
    --half-gutter: 15px;
}

/* Responsive spacing — tablet and above */
@media (min-width: 641px) {
    :root {
        --space-4: 20px;
        --space-5: 25px;
        --space-6: 30px;
        --space-7: 40px;
        --space-8: 50px;
        --space-9: 60px;
    }
}


/* ========================================
   2. RESET & BASE
   ======================================== */

*, *::before, *::after {
    box-sizing: border-box;
}

* {
    margin: 0;
    padding: 0;
}

html {
    font-size: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.5;
    color: var(--color-text);
    background-color: var(--color-body-bg);
    min-height: 100vh;
}

ul, ol {
    list-style: none;
}

img {
    max-width: 100%;
    display: block;
}


/* ========================================
   3. TYPOGRAPHY (GOV.UK responsive scale)
   ======================================== */

/* Heading XL — 32px mobile, 48px desktop */
h1 {
    font-family: var(--font-display);
    font-size: 32px;
    line-height: 1.09375;             /* 35px / 32px */
    font-weight: 700;
    margin-bottom: var(--space-8);
}

@media (min-width: 641px) {
    h1 {
        font-size: 48px;
        line-height: 1.04167;         /* 50px / 48px */
    }
}

/* Heading L — 27px mobile, 36px desktop */
h2 {
    font-family: var(--font-display);
    font-size: 27px;
    line-height: 1.11111;             /* 30px / 27px */
    font-weight: 700;
    margin-bottom: var(--space-6);
}

@media (min-width: 641px) {
    h2 {
        font-size: 36px;
        line-height: 1.11111;         /* 40px / 36px */
    }
}

/* Heading M — 21px mobile, 24px desktop */
h3 {
    font-family: var(--font-display);
    font-size: 21px;
    line-height: 1.19048;             /* 25px / 21px */
    font-weight: 700;
    margin-bottom: var(--space-4);
}

@media (min-width: 641px) {
    h3 {
        font-size: 24px;
        line-height: 1.25;            /* 30px / 24px */
    }
}

/* Heading S — 16px, same at all sizes */
h4 {
    font-family: var(--font-display);
    font-size: 16px;
    line-height: 1.5;
    font-weight: 700;
    margin-bottom: var(--space-4);
}

p {
    margin-bottom: var(--space-4);
}

/* Body small — 16px */
small, .text-small {
    font-size: 16px;
    line-height: 1.25;                /* 20px / 16px */
}

/* Caption — secondary text above headings */
.caption {
    font-size: 16px;
    line-height: 1.3158;
    color: var(--color-secondary-text);
    margin-bottom: var(--space-1);
}

@media (min-width: 641px) {
    .caption {
        font-size: 24px;
        line-height: 1.25;
    }
}


/* ========================================
   4. LINKS
   ======================================== */

a {
    color: var(--color-link);
    text-decoration: underline;
    text-decoration-thickness: max(1px, 0.0625rem);
    text-underline-offset: 0.1578em;
}

a:hover {
    color: var(--color-link-hover);
    text-decoration-thickness: max(3px, 0.1875rem, 0.12em);
}

a:visited {
    color: var(--color-link-visited);
}


/* ========================================
   5. FOCUS STATES (GOV.UK pattern: yellow + navy)
   ======================================== */

/* Links — yellow background + navy bottom border */
a:focus-visible {
    outline: var(--focus-width) solid transparent;
    color: var(--color-text);
    background-color: var(--color-focus);
    box-shadow: 0 -2px var(--color-focus), 0 4px var(--color-text);
    text-decoration: none;
}

/* Form inputs — yellow outline + doubled border */
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    outline: var(--focus-width) solid var(--color-focus);
    outline-offset: 0;
    box-shadow: inset 0 0 0 var(--border-width-form);
}

/* Buttons — yellow with navy text and shadow */
.btn:focus-visible {
    outline: var(--focus-width) solid transparent;
    color: var(--color-text);
    background-color: var(--color-focus);
    border-color: var(--color-focus);
    box-shadow: 0 2px 0 var(--color-text);
    text-decoration: none;
}


/* ========================================
   6. LAYOUT
   ======================================== */

.container {
    max-width: var(--page-width);
    margin-left: auto;
    margin-right: auto;
    padding-left: var(--half-gutter);
    padding-right: var(--half-gutter);
}

@media (min-width: 641px) {
    .container {
        padding-left: var(--gutter);
        padding-right: var(--gutter);
    }
}

/* .container--wide removed — --page-width is now 1400px */

.page-content {
    padding-top: calc(26px + var(--space-6));
    padding-bottom: var(--space-9);
}

/* Two-thirds width (GOV.UK question page layout) */
.width-two-thirds {
    max-width: 640px;
}


/* ========================================
   7. SKIP LINK
   ======================================== */

.skip-link {
    position: absolute;
    top: -100px;
    left: 0;
    background-color: var(--color-focus);
    color: var(--color-text);
    padding: var(--space-2) var(--space-3);
    font-weight: 700;
    font-size: 16px;
    z-index: 9999;
    text-decoration: none;
}

.skip-link:focus {
    top: 0;
    outline: var(--focus-width) solid var(--color-text);
    outline-offset: 0;
    background-color: var(--color-focus);
    color: var(--color-text);
    box-shadow: none;
}


/* ========================================
   8. NAVIGATION
   ======================================== */

.nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background-color: var(--color-navy);
    z-index: 1000;
    border-bottom: var(--border-width) solid var(--color-teal);
}

.nav__inner {
    max-width: var(--page-width);
    margin-left: auto;
    margin-right: auto;
    padding: var(--space-2) var(--half-gutter);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--space-2);
}

@media (min-width: 641px) {
    .nav__inner {
        padding-left: var(--gutter);
        padding-right: var(--gutter);
    }
}

.nav__brand {
    font-family: var(--font-display);
    font-size: 24px;
    font-weight: 700;
    color: var(--color-white);
    text-decoration: none;
}

.nav__brand:hover {
    text-decoration: none;
    color: var(--color-white);
}

.nav__brand:visited {
    color: var(--color-white);
}

.nav__links {
    display: flex;
    align-items: center;
    gap: var(--space-1);
}

.nav__link {
    color: var(--color-white);
    padding: var(--space-1) var(--space-2);
    font-size: 16px;
    font-weight: 500;
    text-decoration: none;
    border-bottom: 3px solid transparent;
}

.nav__link:visited {
    color: var(--color-white);
}

.nav__link:hover {
    color: var(--color-white);
    text-decoration: none;
    border-bottom-color: rgba(0, 198, 194, 0.4);
}

.nav__link--active {
    border-bottom-color: var(--color-teal);
    font-weight: 700;
}

.nav__link:focus-visible {
    color: var(--color-text);
    background-color: var(--color-focus);
    box-shadow: 0 -2px var(--color-focus), 0 4px var(--color-text);
    border-bottom-color: transparent;
}

.nav__cta {
    display: inline-block;
    background-color: var(--color-teal);
    color: var(--color-navy);
    padding: var(--space-1) var(--space-3);
    font-size: 16px;
    font-weight: 700;
    text-decoration: none;
    border: 2px solid transparent;
    min-height: 36px;
}

.nav__cta:visited {
    color: var(--color-navy);
}

.nav__cta:hover {
    background-color: #00b3af;
    color: var(--color-navy);
    text-decoration: none;
}

.nav__cta:focus-visible {
    color: var(--color-text);
    background-color: var(--color-focus);
    border-color: var(--color-text);
    box-shadow: none;
}

@media (max-width: 640px) {
    .nav__inner {
        flex-direction: column;
        align-items: flex-start;
    }

    .nav__links {
        width: 100%;
        flex-wrap: wrap;
    }
}


/* ========================================
   9. BACK LINK (GOV.UK pattern)
   ======================================== */

.back-link {
    display: inline-block;
    font-size: 16px;
    color: var(--color-link);
    margin-bottom: var(--space-4);
    text-decoration: none;
    border-bottom: 1px solid var(--color-link);
}

.back-link::before {
    content: "\2190\00a0";            /* ← + non-breaking space */
    font-size: 16px;
}

.back-link:hover {
    color: var(--color-link-hover);
    border-bottom-color: var(--color-link-hover);
}

.back-link:focus-visible {
    border-bottom-color: transparent;
}


/* ========================================
   10. PAGE HEADER
   ======================================== */

.page-header {
    margin-bottom: var(--space-6);
}

.page-header__title {
    margin-bottom: var(--space-3);
}

.page-header__subtitle {
    color: var(--color-secondary-text);
    font-size: 16px;
    line-height: 1.3158;
    margin-bottom: 0;
}

@media (min-width: 641px) {
    .page-header__subtitle {
        font-size: 24px;
        line-height: 1.25;
    }
}


/* ========================================
   11. BUTTONS (GOV.UK-inspired with V1 brand)
   ======================================== */

.btn {
    display: inline-block;
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 16px;
    font-weight: 700;
    padding: 8px 10px 7px;
    border: var(--border-width-form) solid transparent;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    vertical-align: top;
    -webkit-appearance: none;
}

.btn:visited {
    color: inherit;
}

.btn--primary {
    background-color: var(--color-teal);
    color: var(--color-navy);
}

.btn--primary:hover {
    background-color: #00b3af;
    text-decoration: none;
    color: var(--color-navy);
}

.btn--primary:active {
    top: 2px;
    box-shadow: none;
    position: relative;
}

.btn--secondary {
    background-color: transparent;
    color: #052831;
    border: 1px solid #052831;
}

.btn--secondary:hover {
    background-color: var(--color-teal);
    text-decoration: none;
    color: var(--color-text);
}

.btn--secondary:active {
    top: 2px;
    box-shadow: none;
    position: relative;
}

.btn--danger {
    background-color: var(--color-error);
    color: var(--color-white);
    box-shadow: 0 2px 0 #942514;
}

.btn--danger:hover {
    background-color: #b72e14;
    text-decoration: none;
    color: var(--color-white);
}

.btn--danger:active {
    top: 2px;
    box-shadow: none;
    position: relative;
}

.btn--small {
    font-size: 16px;
    line-height: 16px;
    padding: 6px 10px 5px;
}

/* Button group — horizontal layout with wrap */
.btn-group {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
    margin-top: var(--space-6);
    align-items: baseline;
}

/* Full-width buttons on mobile */
@media (max-width: 640px) {
    .btn {
        width: 100%;
    }

    .btn-group {
        flex-direction: column;
        align-items: stretch;
    }
}


/* ========================================
   12. FORM CONTROLS (GOV.UK patterns)
   ======================================== */

.form-group {
    margin-bottom: var(--space-6);
}

.form-group--error {
    padding-left: var(--space-3);
    border-left: var(--border-width-error) solid var(--color-error);
}

.form-group__label {
    display: block;
    font-size: 16px;
    line-height: 1.3158;
    font-weight: 700;
    margin-bottom: var(--space-1);
    color: var(--color-text);
}

/* Large label — used when label IS the page heading */
.form-group__label--l {
    font-family: var(--font-display);
    font-size: 27px;
    line-height: 1.11111;
    margin-bottom: var(--space-3);
}

@media (min-width: 641px) {
    .form-group__label--l {
        font-size: 36px;
    }
}

.form-group__hint {
    display: block;
    font-size: 16px;
    line-height: 1.3158;
    color: var(--color-secondary-text);
    margin-bottom: var(--space-3);
}

.form-group__input,
.form-group__textarea,
.form-group__select {
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.25;
    width: 100%;
    padding: var(--space-1);
    border: var(--border-width-form) solid var(--color-input-border);
    border-radius: 0;
    color: var(--color-text);
    background-color: var(--color-white);
    min-height: 40px;
    -webkit-appearance: none;
    appearance: none;
}

.form-group__textarea {
    resize: vertical;
    min-height: 120px;
}

.form-group__select {
    min-width: 11.5em;
    /* Restore native select arrow */
    -webkit-appearance: menulist;
    appearance: menulist;
}

/* Error state on inputs */
.form-group--error .form-group__input,
.form-group--error .form-group__textarea,
.form-group--error .form-group__select {
    border-color: var(--color-error);
}

.form-group__error {
    display: block;
    font-size: 16px;
    line-height: 1.3158;
    font-weight: 700;
    color: var(--color-error);
    margin-bottom: var(--space-3);
}

.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
    margin-top: var(--space-6);
    align-items: baseline;
}

@media (max-width: 640px) {
    .form-actions {
        flex-direction: column;
    }
}

/* Fieldset — for grouping related form controls */
fieldset {
    border: none;
    padding: 0;
    margin: 0;
    min-width: 0;
}

legend {
    display: block;
    font-size: 16px;
    line-height: 1.3158;
    font-weight: 700;
    margin-bottom: var(--space-2);
    padding: 0;
}


/* ========================================
   13. TAGS (GOV.UK pattern: dark text on light bg)
   ======================================== */

.tag {
    display: inline-block;
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1;
    font-weight: 700;
    padding: 4px 8px 2px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.tag--red {
    color: var(--color-tag-red-text);
    background-color: var(--color-tag-red-bg);
}

.tag--amber {
    color: var(--color-tag-amber-text);
    background-color: var(--color-tag-amber-bg);
}

.tag--green {
    color: var(--color-tag-green-text);
    background-color: var(--color-tag-green-bg);
}

.tag--grey {
    color: var(--color-text);
    background-color: #e0e0e0;
}


/* ========================================
   14. RAG SELECTOR (criterion edit pages)
   ======================================== */

.rag-selector {
    display: flex;
    gap: var(--space-2);
    margin-bottom: var(--space-4);
}

.rag-selector__btn {
    flex: 1;
    font-family: var(--font-body);
    font-size: 16px;
    font-weight: 700;
    padding: var(--space-2) var(--space-3);
    border: var(--border-width-form) solid var(--color-border);
    background-color: var(--color-white);
    color: var(--color-text);
    cursor: pointer;
    min-height: 44px;
    text-align: center;
}

.rag-selector__btn:hover {
    border-color: var(--color-text);
}

.rag-selector__btn:focus-visible {
    outline: var(--focus-width) solid var(--color-focus);
    outline-offset: 0;
    box-shadow: inset 0 0 0 var(--border-width-form);
}

/* Selected states */
.rag-selector__btn--selected-red {
    background-color: var(--color-sel-red-bg);
    border-color: var(--color-sel-red-bg);
    color: var(--color-white);
}

.rag-selector__btn--selected-amber {
    background-color: var(--color-sel-amber-bg);
    border-color: var(--color-sel-amber-bg);
    color: var(--color-navy);
}

.rag-selector__btn--selected-green {
    background-color: var(--color-sel-green-bg);
    border-color: var(--color-sel-green-bg);
    color: var(--color-white);
}


/* ========================================
   15. CARD
   ======================================== */

.card {
    background-color: var(--color-surface-bg);
    padding: var(--space-4);
    margin-bottom: var(--space-6);
}

@media (min-width: 641px) {
    .card {
        padding: var(--space-6);
    }
}


/* ========================================
   16. DEAL CARD (compact summary on criterion pages)
   ======================================== */

.deal-card {
    background-color: var(--color-surface-bg);
    border-left: var(--border-width) solid var(--color-teal);
    padding: var(--space-4);
    margin-bottom: var(--space-6);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: var(--space-4);
}

.deal-card__details {
    flex: 1;
    min-width: 200px;
}

.deal-card__title {
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 700;
    margin-bottom: var(--space-1);
}

.deal-card__meta {
    font-size: 16px;
    color: var(--color-secondary-text);
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2) var(--space-4);
}

.deal-card__score {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.deal-card__score-value {
    font-family: var(--font-display);
    font-size: 36px;
    font-weight: 700;
    line-height: 1;
}

@media (min-width: 641px) {
    .deal-card {
        padding: var(--space-4) var(--space-6);
    }
}


/* ========================================
   17. DEAL HEADER (task list page)
   ======================================== */

.deal-header {
    background-color: var(--color-surface-bg);
    padding: var(--space-4);
    margin-bottom: var(--space-6);
}

@media (min-width: 641px) {
    .deal-header {
        padding: var(--space-6);
    }
}

.deal-header__top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: var(--space-4);
    margin-bottom: var(--space-4);
}

.deal-header__title {
    font-family: var(--font-display);
    font-size: 27px;
    font-weight: 700;
    margin-bottom: var(--space-1);
}

@media (min-width: 641px) {
    .deal-header__title {
        font-size: 36px;
    }
}

.deal-header__metadata {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2) var(--space-4);
    color: var(--color-secondary-text);
    font-size: 16px;
}

.deal-header__actions {
    display: flex;
    gap: var(--space-2);
    flex-wrap: wrap;
}


/* ========================================
   18. TASK LIST (GOV.UK task list pattern)
   ======================================== */

.task-list {
    margin-bottom: var(--space-8);
}

.task-list__section {
    margin-bottom: var(--space-7);
}

.task-list__section-heading {
    font-family: var(--font-display);
    font-size: 21px;
    font-weight: 700;
    margin-bottom: var(--space-3);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--space-2);
}

@media (min-width: 641px) {
    .task-list__section-heading {
        font-size: 24px;
    }
}

.task-list__section-meta {
    font-family: var(--font-body);
    font-size: 16px;
    font-weight: 400;
    color: var(--color-secondary-text);
}

.task-list__items {
    border-top: 1px solid var(--color-border);
}

.task-list__item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-2) 0;
    border-bottom: 1px solid var(--color-border);
    text-decoration: none;
    color: var(--color-text);
    gap: var(--space-2);
    position: relative;
}

.task-list__item:hover {
    background-color: #f3f3f3;
}

.task-list__item-name {
    font-size: 16px;
    font-weight: 400;
    flex: 1;
    min-width: 0;
}

/* The name acts as a link via an ::after pseudo to stretch clickable area */
.task-list__item-name a {
    text-decoration: underline;
    color: var(--color-link);
}

.task-list__item-name a::after {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
}

.task-list__item-name a:focus-visible {
    outline: var(--focus-width) solid var(--color-focus);
    outline-offset: 0;
    background-color: var(--color-focus);
    color: var(--color-text);
    box-shadow: 0 -2px var(--color-focus), 0 4px var(--color-text);
}

.task-list__item-status {
    font-size: 16px;
    font-weight: 400;
    text-align: right;
    padding-left: var(--space-2);
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.task-list__status--completed {
    color: var(--color-text);
}

.task-list__status--in-progress {
    /* Shown as a tag */
}

.task-list__status--not-started {
    color: var(--color-secondary-text);
}


/* ========================================
   19. CRITERION (single question page)
   ======================================== */

.criterion {
    margin-bottom: var(--space-8);
    position: relative;
}

.criterion__question {
    font-size: 16px;
    font-weight: 400;
    margin-bottom: var(--space-6);
    color: var(--color-text);
}

.criterion__weight {
    display: inline-block;
    font-size: 16px;
    font-weight: 700;
    color: var(--color-secondary-text);
    margin-bottom: var(--space-4);
}

/* Assessment guidance — inset text pattern */
.criterion__guidance {
    padding: var(--space-3);
    margin-bottom: var(--space-6);
    border-left: 10px solid var(--color-border);
}

.criterion__guidance-title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: var(--space-2);
}

.criterion__guidance-list {
    list-style: none;
    padding: 0;
}

.criterion__guidance-item {
    margin-bottom: var(--space-2);
    padding-left: var(--space-5);
    position: relative;
    font-size: 16px;
}

.criterion__guidance-item::before {
    content: "";
    position: absolute;
    left: 0;
    top: 8px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.criterion__guidance-item--red::before {
    background-color: var(--color-rag-red);
}

.criterion__guidance-item--amber::before {
    background-color: var(--color-rag-amber);
}

.criterion__guidance-item--green::before {
    background-color: var(--color-rag-green);
}

/* Saved indicator */
.criterion__saved {
    position: absolute;
    top: 0;
    right: 0;
    color: var(--color-success);
    font-size: 16px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: var(--space-1);
    opacity: 0;
}

.criterion__saved--visible {
    animation: fade-in-out 2s ease-in-out;
}

@keyframes fade-in-out {
    0% { opacity: 0; }
    15% { opacity: 1; }
    85% { opacity: 1; }
    100% { opacity: 0; }
}


/* ========================================
   20. SCORE DISPLAY
   ======================================== */

.score {
    font-family: var(--font-display);
    font-weight: 700;
}

.score--good {
    color: var(--color-success);
}

.score--medium {
    color: #b58500;                    /* Darkened amber — AA on white */
}

.score--high-risk {
    color: var(--color-error);
}

.score--na {
    color: var(--color-secondary-text);
}

.score-label {
    display: inline-block;
    font-size: 16px;
    font-weight: 700;
    padding: 4px 8px 2px;
}

.score-label--good {
    color: var(--color-tag-green-text);
    background-color: var(--color-tag-green-bg);
}

.score-label--medium {
    color: var(--color-tag-amber-text);
    background-color: var(--color-tag-amber-bg);
}

.score-label--high-risk {
    color: var(--color-tag-red-text);
    background-color: var(--color-tag-red-bg);
}

.score-label--na {
    color: var(--color-secondary-text);
    background-color: #e0e0e0;
}


/* ========================================
   21. STATS BAR (dashboard)
   ======================================== */

.stats {
    display: flex;
    gap: var(--space-3);
    margin-bottom: var(--space-6);
    flex-wrap: wrap;
}

.stats__item {
    flex: 1;
    min-width: 120px;
    background-color: var(--color-surface-bg);
    padding: var(--space-4);
    text-align: center;
}

.stats__value {
    font-family: var(--font-display);
    font-size: 36px;
    font-weight: 700;
    color: var(--color-text);
    display: block;
    margin-bottom: var(--space-1);
}

@media (min-width: 641px) {
    .stats__value {
        font-size: 48px;
    }
}

.stats__label {
    font-size: 16px;
    color: var(--color-secondary-text);
    display: block;
}


/* ========================================
   22. DEAL LIST (dashboard)
   ======================================== */

.deal-list {
    margin-top: var(--space-4);
}

.deal-list__controls {
    display: flex;
    gap: var(--space-3);
    margin-bottom: var(--space-6);
    flex-wrap: wrap;
    align-items: flex-end;
}

.deal-list__search {
    flex: 1;
    min-width: 200px;
}

.deal-list__item {
    display: block;
    background-color: var(--color-surface-bg);
    padding: var(--space-4);
    margin-bottom: var(--space-3);
    border-left: var(--border-width) solid transparent;
    text-decoration: none;
    color: var(--color-text);
}

.deal-list__item:visited {
    color: var(--color-text);
}

.deal-list__item:hover {
    box-shadow: var(--shadow-md);
    text-decoration: none;
    color: var(--color-text);
}

.deal-list__item:focus-visible {
    outline: var(--focus-width) solid var(--color-focus);
    outline-offset: 0;
    box-shadow: none;
}

.deal-list__item--good {
    border-left-color: var(--color-success);
}

.deal-list__item--medium {
    border-left-color: var(--color-rag-amber);
}

.deal-list__item--high-risk {
    border-left-color: var(--color-error);
}

.deal-list__item--na {
    border-left-color: var(--color-border);
}

.deal-list__item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--space-1);
    gap: var(--space-4);
}

.deal-list__item-title {
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 700;
}

.deal-list__item-score {
    font-family: var(--font-display);
    font-size: 24px;
    font-weight: 700;
}

.deal-list__item-meta {
    color: var(--color-secondary-text);
    font-size: 16px;
    margin-bottom: var(--space-2);
}

.deal-list__item-progress {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 16px;
    color: var(--color-secondary-text);
    flex-wrap: wrap;
    gap: var(--space-2);
}

.deal-list__item-rag {
    display: flex;
    gap: var(--space-1);
}


/* ========================================
   23. GUIDANCE PAGE
   ======================================== */

.guidance__section {
    background-color: var(--color-surface-bg);
    border-left: 10px solid var(--color-teal);
    padding: var(--space-4);
    margin-bottom: var(--space-6);
}

@media (min-width: 641px) {
    .guidance__section {
        padding: var(--space-6);
    }
}

.guidance__section--customer {
    border-left-color: #1d70b8;
}

.guidance__section--capability {
    border-left-color: #4c2c92;
}

.guidance__section--credibility {
    border-left-color: var(--color-success);
}

.guidance__section--commercials {
    border-left-color: #f47738;
}

.guidance__section-title {
    font-size: 24px;
    margin-bottom: var(--space-6);
}

@media (min-width: 641px) {
    .guidance__section-title {
        font-size: 36px;
    }
}

.guidance__entry {
    margin-bottom: var(--space-6);
    padding-bottom: var(--space-6);
    border-bottom: 1px solid var(--color-border);
}

.guidance__entry:last-child {
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 0;
}

.guidance__entry-title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: var(--space-2);
}

.guidance__entry-question {
    color: var(--color-secondary-text);
    font-style: italic;
    margin-bottom: var(--space-4);
}

.guidance__rag-list {
    margin-bottom: var(--space-4);
}

.guidance__rag-item {
    display: flex;
    gap: var(--space-2);
    margin-bottom: var(--space-2);
    align-items: flex-start;
    font-size: 16px;
}

.guidance__gap {
    background-color: var(--color-tag-amber-bg);
    border-left: var(--border-width) solid var(--color-rag-amber);
    padding: var(--space-3);
}

.guidance__gap-title {
    font-weight: 700;
    margin-bottom: var(--space-1);
}


/* ========================================
   24. FLASH MESSAGES
   ======================================== */

.flash {
    position: fixed;
    top: calc(60px + var(--space-3));
    right: var(--space-3);
    z-index: 2000;
    max-width: 400px;
}

.flash__message {
    background-color: var(--color-surface-bg);
    box-shadow: var(--shadow-md);
    padding: var(--space-3) var(--space-4);
    margin-bottom: var(--space-2);
    border-left: var(--border-width) solid transparent;
    font-size: 16px;
}

.flash__message--success {
    border-left-color: var(--color-success);
}

.flash__message--error {
    border-left-color: var(--color-error);
}

.flash__message--info {
    border-left-color: var(--color-teal);
}


/* ========================================
   25. EMPTY STATE
   ======================================== */

.empty-state {
    text-align: center;
    padding: var(--space-8) var(--space-4);
    background-color: var(--color-surface-bg);
}

.empty-state__title {
    margin-bottom: var(--space-4);
}

.empty-state__text {
    color: var(--color-secondary-text);
    margin-bottom: var(--space-6);
    max-width: 480px;
    margin-left: auto;
    margin-right: auto;
}


/* ========================================
   26. SECTION HEADER
   ======================================== */

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: var(--space-6);
    gap: var(--space-4);
    flex-wrap: wrap;
}

.section-header__title {
    margin-bottom: 0;
}

.section-header__meta {
    font-size: 16px;
    color: var(--color-secondary-text);
}


/* ========================================
   27. VISUALLY HIDDEN (accessibility)
   ======================================== */

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    border: 0;
    white-space: nowrap;
}


/* ========================================
   28. INSET TEXT (GOV.UK pattern)
   ======================================== */

.inset-text {
    font-size: 16px;
    padding: var(--space-3);
    margin-top: var(--space-4);
    margin-bottom: var(--space-6);
    border-left: 10px solid var(--color-border);
}


/* ========================================
   29. NOTIFICATION PANEL
   ======================================== */

.panel {
    background-color: var(--color-teal);
    color: var(--color-navy);
    padding: var(--space-4);
    text-align: center;
    margin-bottom: var(--space-6);
}

@media (min-width: 641px) {
    .panel {
        padding: var(--space-7);
    }
}

.panel__title {
    font-family: var(--font-display);
    font-size: 32px;
    font-weight: 700;
    margin-bottom: var(--space-6);
}

@media (min-width: 641px) {
    .panel__title {
        font-size: 48px;
    }
}

.panel__body {
    font-size: 24px;
}

@media (min-width: 641px) {
    .panel__body {
        font-size: 36px;
    }
}


/* ========================================
   30. NAV USER (signed-in user info)
   ======================================== */

.nav__user {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.nav__user-name {
    color: var(--color-white);
    font-size: 16px;
    font-weight: 500;
}

.nav__logout-form {
    display: inline;
}

.nav__logout-btn {
    background: none;
    border: none;
    color: var(--color-white);
    font-family: var(--font-body);
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    padding: var(--space-1) var(--space-2);
    text-decoration: underline;
    text-decoration-thickness: max(1px, 0.0625rem);
    text-underline-offset: 0.1578em;
}

.nav__logout-btn:hover {
    color: var(--color-white);
    text-decoration-thickness: max(3px, 0.1875rem, 0.12em);
}

.nav__logout-btn:focus-visible {
    outline: var(--focus-width) solid transparent;
    color: var(--color-text);
    background-color: var(--color-focus);
    box-shadow: 0 -2px var(--color-focus), 0 4px var(--color-text);
    text-decoration: none;
}


/* ========================================
   31. AUTH PAGE (centered login form)
   ======================================== */

.auth-page {
    max-width: var(--page-width);
    margin: 0 auto;
}


/* ========================================
   32. ADMIN TABLE
   ======================================== */

.admin-table {
    width: 100%;
    border-collapse: collapse;
    background-color: var(--color-surface-bg);
    font-size: 16px;
}

.admin-table th,
.admin-table td {
    text-align: left;
    padding: var(--space-2) var(--space-3);
    border-bottom: 1px solid var(--color-border);
}

.admin-table th {
    font-weight: 700;
    background-color: var(--color-body-bg);
    font-size: 16px;
}

.admin-table__row--inactive td {
    color: var(--color-secondary-text);
}

@media (max-width: 640px) {
    .admin-table {
        display: block;
        overflow-x: auto;
    }
}


/* ========================================
   33. SECTOR CARD (admin sector list)
   ======================================== */

.sector-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--color-surface-bg);
    margin-bottom: var(--space-3);
    padding: var(--space-4);
    text-decoration: none;
    color: inherit;
    border-left: 4px solid var(--color-teal);
    transition: background-color 0.15s ease;
}

.sector-card:hover {
    background-color: var(--color-border);
}

@media (min-width: 641px) {
    .sector-card {
        padding: var(--space-4) var(--space-6);
    }
}

.sector-card__title {
    margin-bottom: var(--space-1);
}

.sector-card__meta {
    color: var(--color-grey-muted);
    font-size: 0.875rem;
    display: flex;
    gap: var(--space-4);
}

.sector-card__action {
    color: var(--color-teal);
    font-weight: 600;
    white-space: nowrap;
}


/* ========================================
   34. INLINE FORM
   ======================================== */

.inline-form {
    display: inline-flex;
    gap: var(--space-2);
    align-items: flex-end;
    flex-wrap: wrap;
}


/* ========================================
   35. ACCESS GRANT (user invite/edit)
   ======================================== */

.access-grant {
    margin-bottom: var(--space-4);
    padding: var(--space-3);
    border: 1px solid var(--color-border);
}

.access-grant__sector {
    margin-bottom: var(--space-2);
}

.access-grant__sector label {
    cursor: pointer;
    font-size: 16px;
}

.access-grant__subsectors {
    padding-left: var(--space-6);
}

.access-grant__subsector {
    display: block;
    margin-bottom: var(--space-1);
    cursor: pointer;
    font-size: 16px;
}

.access-grant__note {
    font-weight: 400;
    color: var(--color-grey-muted);
    font-size: 0.875rem;
}

.access-grant input[type="checkbox"] {
    margin-right: var(--space-1);
    width: 20px;
    height: 20px;
    vertical-align: middle;
}

.access-grant input[type="checkbox"]:disabled {
    opacity: 0.5;
}


/* ========================================
   36. DEAL CREATOR INFO
   ======================================== */

.deal-creator-info {
    background-color: var(--color-surface-bg);
    border-left: 4px solid var(--color-teal);
    padding: var(--space-3) var(--space-4);
    margin-bottom: var(--space-6);
    font-size: 0.875rem;
    color: var(--color-grey-muted);
}

.deal-creator-info strong {
    color: var(--color-text);
}

.deal-creator-info__role {
    margin-left: var(--space-2);
    padding: 2px 8px;
    background-color: var(--color-border);
    border-radius: 3px;
    font-size: 0.75rem;
}

.deal-creator-info__context {
    display: block;
    margin-top: var(--space-1);
    color: var(--color-teal);
    font-weight: 600;
}


/* ========================================
   37. DASHBOARD GRID (company/sector overview)
   ======================================== */

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--space-4);
    margin-bottom: var(--space-6);
}

.dashboard-card {
    background-color: var(--color-surface-bg);
    padding: var(--space-4);
    border-left: var(--border-width) solid var(--color-teal);
    text-decoration: none;
    color: var(--color-text);
    display: block;
}

.dashboard-card:visited {
    color: var(--color-text);
}

.dashboard-card:hover {
    box-shadow: var(--shadow-md);
    text-decoration: none;
    color: var(--color-text);
}

.dashboard-card:focus-visible {
    outline: var(--focus-width) solid var(--color-focus);
    outline-offset: 0;
    box-shadow: none;
}

.dashboard-card__title {
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 700;
    margin-bottom: var(--space-3);
}

@media (min-width: 641px) {
    .dashboard-card__title {
        font-size: 24px;
    }

    .dashboard-card {
        padding: var(--space-6);
    }
}

.dashboard-card__stats {
    display: flex;
    gap: var(--space-6);
    margin-bottom: var(--space-3);
}

.dashboard-card__stat {
    display: flex;
    flex-direction: column;
}

.dashboard-card__stat-value {
    font-family: var(--font-display);
    font-size: 36px;
    font-weight: 700;
    line-height: 1;
}

.dashboard-card__stat-label {
    font-size: 16px;
    color: var(--color-secondary-text);
    margin-top: var(--space-1);
}

.dashboard-card__rag {
    display: flex;
    gap: var(--space-1);
    flex-wrap: wrap;
}

.dashboard-card__empty {
    font-size: 16px;
    color: var(--color-secondary-text);
    margin-bottom: 0;
}


/* ========================================
   38. TREND INDICATOR
   ======================================== */

.trend {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    font-family: var(--font-body);
    font-size: 16px;
    font-weight: 700;
    white-space: nowrap;
}

.trend--up {
    color: var(--color-success);
}

.trend--down {
    color: var(--color-error);
}

.trend--stable {
    color: var(--color-secondary-text);
}

.trend__arrow {
    font-size: 14px;
    line-height: 1;
}


/* ========================================
   39. CSS SPARKLINE
   ======================================== */

.sparkline {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    height: 40px;
    padding: var(--space-1) 0;
}

.sparkline--large {
    height: 80px;
}

.sparkline__bar {
    flex: 1;
    min-width: 4px;
    max-width: 12px;
    border-radius: 1px 1px 0 0;
    transition: opacity 0.15s ease;
}

.sparkline__bar:hover {
    opacity: 0.8;
}

.sparkline__bar--green {
    background-color: var(--color-success);
}

.sparkline__bar--amber {
    background-color: var(--color-rag-amber);
}

.sparkline__bar--red {
    background-color: var(--color-error);
}


/* ========================================
   40. AUDIT TIMELINE (GOV.UK-style)
   ======================================== */

.timeline {
    position: relative;
    padding-left: var(--space-6);
}

.timeline::before {
    content: "";
    position: absolute;
    left: 8px;
    top: 0;
    bottom: 0;
    width: 3px;
    background-color: var(--color-border);
}

.timeline__entry {
    position: relative;
    padding-bottom: var(--space-5);
}

.timeline__entry:last-child {
    padding-bottom: 0;
}

.timeline__entry::before {
    content: "";
    position: absolute;
    left: calc(-1 * var(--space-6) + 4px);
    top: 4px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: var(--color-border);
    border: 2px solid var(--color-surface-bg);
}

.timeline__entry--up::before {
    background-color: var(--color-success);
}

.timeline__entry--down::before {
    background-color: var(--color-error);
}

.timeline__entry--stable::before {
    background-color: var(--color-rag-amber);
}

.timeline__title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: var(--space-1);
    color: var(--color-text);
}

.timeline__detail {
    font-size: 16px;
    color: var(--color-text);
    margin-bottom: var(--space-1);
}

.timeline__time {
    font-size: 14px;
    color: var(--color-secondary-text);
}

.timeline__rag-change {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
}


/* ========================================
   41. PASSWORD FIELD (show/hide toggle)
   ======================================== */

.password-field {
    display: flex;
    align-items: stretch;
    gap: 0;
}

.password-field .form-group__input {
    flex: 1;
    border-right: none;
}

.password-toggle {
    padding: 0 var(--space-3);
    background-color: var(--color-surface-bg);
    border: 2px solid var(--color-text);
    border-left: none;
    cursor: pointer;
    font-size: 16px;
    font-family: var(--font-body);
    color: var(--color-text);
    white-space: nowrap;
    flex-shrink: 0;
}

.password-toggle:hover {
    background-color: var(--color-body-bg);
}

.password-toggle:focus-visible {
    outline: var(--focus-width) solid var(--color-focus);
    outline-offset: 0;
}


/* ========================================
   42. WARNING BANNER
   ======================================== */

.warning-banner {
    background-color: #fff7cc;
    border-left: 4px solid #e8a000;
    padding: var(--space-3) var(--space-4);
}

.warning-banner p {
    margin-bottom: 0;
}

.error-banner {
    background-color: #fef2f2;
    border-left: 4px solid #d4351c;
    padding: var(--space-3) var(--space-4);
    margin-bottom: var(--space-4);
}

/* ========================================
   43. COPY LINK (token display)
   ======================================== */

.copy-link {
    display: flex;
    align-items: stretch;
    gap: var(--space-2);
}

.copy-link .form-group__input {
    flex: 1;
    font-size: 14px;
    font-family: monospace;
}


/* ========================================
   44. STATIC FORM VALUE
   ======================================== */

.form-group__static {
    font-size: 16px;
    margin-bottom: 0;
    padding: var(--space-1) 0;
}


/* ========================================
   42. TABLES
   ======================================== */

.govuk-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 16px;
}

.govuk-table th,
.govuk-table td {
    padding: var(--space-2) var(--space-3);
    text-align: left;
    border-bottom: 1px solid var(--color-border);
}

.govuk-table th {
    font-weight: 700;
    font-size: 14px;
    color: var(--color-secondary-text);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.govuk-table tbody tr:hover {
    background-color: #f8f8f8;
}


/* ========================================
   43. PRINT STYLES
   ======================================== */

@media print {
    .nav,
    .nav__cta,
    .back-link,
    .flash,
    .deal-header__actions,
    .form-actions,
    .btn-group,
    .skip-link,
    .btn {
        display: none;
    }

    body {
        background-color: var(--color-white);
        font-size: 14pt;
        color: #000000;
    }

    .page-content {
        padding-top: 0;
    }

    .card,
    .deal-card,
    .deal-header,
    .deal-list__item,
    .guidance__section {
        box-shadow: none;
        border: 1px solid #000000;
        page-break-inside: avoid;
    }

    a {
        color: #000000;
        text-decoration: underline;
    }

    .tag {
        border: 1px solid currentColor;
    }
}


/* ========================================
   44. GOVERNANCE GATE INDICATOR
   ======================================== */

.governance-gate {
    background: var(--color-surface-bg);
    border: 2px solid var(--color-teal);
    border-radius: 4px;
    padding: var(--space-4);
    margin-bottom: var(--space-5);
}

.governance-gate__header {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-2);
}

.governance-gate__label {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-white);
    background: var(--color-navy);
    padding: 4px 12px;
    border-radius: 2px;
}

.governance-gate__name {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 16px;
    color: var(--color-text);
}

.governance-gate__detail {
    display: flex;
    gap: var(--space-4);
    flex-wrap: wrap;
    color: var(--color-secondary-text);
    font-size: 16px;
}

.governance-gate__next {
    color: var(--color-link);
}


/* ========================================
   45. TARGET RAG STYLES
   ======================================== */

.rag-selector--target {
    margin-top: var(--space-4);
    padding-top: var(--space-4);
    border-top: 1px solid var(--color-border);
}

.rag-selector__btn--clear {
    background: var(--color-body-bg);
    color: var(--color-secondary-text);
    border: 2px solid var(--color-border);
}

.rag-selector__btn--clear:hover {
    background: var(--color-border);
    color: var(--color-text);
}

.rag-selector__btn--active {
    border-color: var(--color-navy);
    background: var(--color-body-bg);
    box-shadow: 0 0 0 2px var(--color-navy);
}


/* ========================================
   46. GAP INDICATOR
   ======================================== */

.gap-indicator {
    display: inline-block;
    font-size: 14px;
    color: var(--color-link);
    font-weight: 600;
    margin-left: var(--space-2);
}

.score-dual {
    display: flex;
    align-items: baseline;
    gap: var(--space-3);
}

.score-dual__target {
    font-size: 24px;
    color: var(--color-secondary-text);
}

.score-dual__gap {
    font-size: 14px;
    color: var(--color-link);
    font-weight: 600;
}


/* ========================================
   47. CRITERION AUDIT TRAIL
   ======================================== */

.criterion-audit {
    margin-top: var(--space-6);
    padding-top: var(--space-5);
    border-top: 2px solid var(--color-border);
}

.criterion-audit h3 {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 16px;
    margin-bottom: var(--space-3);
}


/* ========================================
   48. THRESHOLD MANAGEMENT
   ======================================== */

.threshold-form {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-5);
    margin-bottom: var(--space-4);
}

@media (max-width: 640px) {
    .threshold-form {
        grid-template-columns: 1fr;
    }
}

.threshold-form__group h3,
.threshold-form__group h4 {
    font-family: var(--font-heading);
    font-weight: 700;
    margin-bottom: var(--space-3);
}

.threshold-sector {
    padding: var(--space-4) 0;
    border-bottom: 1px solid var(--color-border);
}

.threshold-sector__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-3);
}

.threshold-sector__header h3 {
    font-family: var(--font-heading);
    font-weight: 700;
    margin: 0;
}

.form-group__input--narrow {
    max-width: 120px;
}


/* ========================================
   49. WIN STRATEGY CHECKLIST
   ======================================== */

.checklist__item {
    padding: var(--space-2) 0;
    border-bottom: 1px solid var(--color-body-bg);
}

.checklist__item:last-child {
    border-bottom: none;
}

.checklist__label {
    display: flex;
    align-items: flex-start;
    gap: var(--space-2);
    cursor: pointer;
    font-size: 16px;
    line-height: 1.5;
}

.checklist__input {
    margin-top: 4px;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    accent-color: var(--color-navy);
}

.checklist__input:focus {
    outline: 3px solid var(--color-focus);
    outline-offset: 2px;
}

.checklist__text {
    flex: 1;
}

.progress-bar {
    height: 8px;
    background: var(--color-body-bg);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar__fill {
    height: 100%;
    background: var(--color-teal);
    border-radius: 4px;
    transition: width 0.3s ease;
}


/* ========================================
   50. ENHANCED DEAL DETAIL CARD
   ======================================== */

.deal-detail-card {
    background: var(--color-surface-bg);
    border-left: var(--border-width) solid var(--color-teal);
    padding: var(--space-5);
    margin-bottom: var(--space-5);
    box-shadow: var(--shadow-sm);
}

.deal-detail-card__top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--space-4);
    flex-wrap: wrap;
}

.deal-detail-card__info {
    flex: 1;
    min-width: 200px;
}

.deal-detail-card__title {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 24px;
    color: var(--color-navy);
    margin: 0 0 var(--space-1) 0;
}

@media (min-width: 641px) {
    .deal-detail-card__title {
        font-size: 30px;
    }
}

.deal-detail-card__meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2) var(--space-4);
    color: var(--color-secondary-text);
    font-size: 16px;
}

.deal-detail-card__score-block {
    text-align: right;
    flex-shrink: 0;
}

.deal-detail-card__score {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 36px;
    line-height: 1;
}

/* Governance section within deal card */
.deal-detail-card__governance {
    margin-top: var(--space-4);
    padding-top: var(--space-4);
    border-top: 1px solid var(--color-border);
}

.deal-detail-card__gate {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    flex-wrap: wrap;
    margin-bottom: var(--space-3);
}

.deal-detail-card__gate-name {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 16px;
    color: var(--color-text);
}

.deal-detail-card__progress {
    color: var(--color-link);
    font-weight: 600;
    font-size: 14px;
}

.deal-detail-card__progress--complete {
    color: var(--color-success);
}

/* Threshold progression bar */
.deal-detail-card__thresholds {
    margin-top: var(--space-3);
}

.threshold-bar {
    position: relative;
    margin-bottom: var(--space-3);
}

.threshold-bar__track {
    position: relative;
    height: 24px;
    background: var(--color-body-bg);
    border-radius: 4px;
    overflow: visible;
}

.threshold-bar__zone {
    position: absolute;
    top: 0;
    height: 100%;
    opacity: 0.25;
}

.threshold-bar__zone--red {
    background: var(--color-rag-red);
    border-radius: 4px 0 0 4px;
}

.threshold-bar__zone--amber {
    background: var(--color-rag-amber);
}

.threshold-bar__zone--green {
    background: var(--color-rag-green);
    border-radius: 0 4px 4px 0;
}

.threshold-bar__gate {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--color-navy);
    opacity: 0.35;
    z-index: 2;
    margin-left: -1px;
}

.threshold-bar__gate-labels {
    position: relative;
    height: 22px;
    margin-bottom: 4px;
}

.threshold-bar__gate-label {
    position: absolute;
    transform: translateX(-50%);
    font-size: 10px;
    font-weight: 600;
    color: var(--color-secondary-text);
    white-space: nowrap;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.threshold-bar__gate-label--target {
    font-weight: 700;
    color: var(--color-navy);
}

.threshold-bar__target {
    position: absolute;
    top: -4px;
    bottom: -4px;
    width: 5px;
    margin-left: -2px;
    background: var(--color-navy);
    border-radius: 2px;
    z-index: 3;
    opacity: 0.7;
}

.threshold-bar__marker {
    position: absolute;
    width: 14px;
    height: 14px;
    margin-left: -7px;
    background: var(--color-navy);
    border: 3px solid var(--color-white);
    border-radius: 50%;
    box-shadow: var(--shadow-sm);
    z-index: 4;
    top: 50%;
    transform: translateY(-50%);
}

.threshold-bar__labels {
    position: relative;
    height: 20px;
    margin-top: 4px;
}

.threshold-bar__label {
    position: absolute;
    transform: translateX(-50%);
    font-size: 12px;
    color: var(--color-secondary-text);
    font-weight: 600;
}

/* Threshold legend */
.deal-detail-card__threshold-legend {
    display: flex;
    gap: var(--space-3);
    flex-wrap: wrap;
}

.threshold-legend__item {
    font-size: 13px;
    padding: 2px 8px;
    border-radius: 2px;
    font-weight: 500;
}

.threshold-legend__item--red {
    color: var(--color-tag-red-text);
    background: var(--color-tag-red-bg);
}

.threshold-legend__item--amber {
    color: var(--color-tag-amber-text);
    background: var(--color-tag-amber-bg);
}

.threshold-legend__item--green {
    color: var(--color-tag-green-text);
    background: var(--color-tag-green-bg);
}

.threshold-legend__item--score {
    color: var(--color-navy);
}

.threshold-legend__item--target {
    color: var(--color-navy);
    opacity: 0.7;
}

/* Actions row */
.deal-detail-card__actions {
    margin-top: var(--space-4);
    padding-top: var(--space-3);
    border-top: 1px solid var(--color-border);
    display: flex;
    gap: var(--space-2);
    flex-wrap: wrap;
}


/* ========================================
   51. WEEK COMPARISON
   ======================================== */

.week-comparison {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-4);
    flex-wrap: wrap;
}

.week-comparison__block {
    text-align: center;
    padding: var(--space-3) var(--space-5);
    background: var(--color-body-bg);
    border-radius: 4px;
    min-width: 140px;
}

.week-comparison__block--empty {
    opacity: 0.5;
}

.week-comparison__label {
    font-size: 13px;
    color: var(--color-secondary-text);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
    margin-bottom: var(--space-1);
}

.week-comparison__value {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 36px;
    color: var(--color-navy);
    line-height: 1.2;
}

.week-comparison__detail {
    font-size: 14px;
    color: var(--color-secondary-text);
    margin-top: var(--space-1);
}

.week-comparison__arrow {
    flex-shrink: 0;
}


/* ========================================
   52. WEEKLY SPARKLINE
   ======================================== */

.weekly-sparkline {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    height: 120px;
    padding-bottom: 56px;
    position: relative;
    overflow-x: auto;
}

.weekly-sparkline__col {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-shrink: 0;
    height: 100%;
    justify-content: flex-end;
    position: relative;
}

.weekly-sparkline__bar {
    border-radius: 3px 3px 0 0;
    min-width: 20px;
    transition: opacity 0.2s;
}

.weekly-sparkline__bar:hover {
    opacity: 0.8;
}

.weekly-sparkline__bar--green {
    background: var(--color-rag-green);
}

.weekly-sparkline__bar--amber {
    background: var(--color-rag-amber);
}

.weekly-sparkline__bar--red {
    background: var(--color-rag-red);
}

.weekly-sparkline__delta {
    font-size: 11px;
    font-weight: 700;
    margin-top: 2px;
}

.weekly-sparkline__delta--up {
    color: var(--color-success);
}

.weekly-sparkline__delta--down {
    color: var(--color-error);
}

.weekly-sparkline__label {
    font-size: 10px;
    color: var(--color-secondary-text);
    white-space: nowrap;
    position: absolute;
    bottom: -48px;
    transform: rotate(-45deg);
    transform-origin: top center;
}


/* ========================================
   53. DENSITY CHART
   ======================================== */

.density-chart {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    height: 80px;
    padding-bottom: 56px;
    position: relative;
    overflow-x: auto;
}

.density-chart__col {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-shrink: 0;
    width: 40px;
    height: 100%;
    justify-content: flex-end;
    position: relative;
}

.density-chart__bar {
    width: 24px;
    background: var(--color-teal);
    border-radius: 3px 3px 0 0;
    min-height: 2px;
    transition: opacity 0.2s;
}

.density-chart__bar:hover {
    opacity: 0.8;
}

.density-chart__count {
    font-size: 12px;
    font-weight: 700;
    color: var(--color-navy);
    margin-top: 2px;
}

.density-chart__label {
    font-size: 10px;
    color: var(--color-secondary-text);
    white-space: nowrap;
    position: absolute;
    bottom: -48px;
    transform: rotate(-45deg);
    transform-origin: top center;
}


/* ========================================
   DANGER ZONE
   ======================================== */

.danger-zone {
    border: 2px solid var(--color-error);
    margin-top: var(--space-8);
}

.danger-zone__title {
    color: var(--color-error);
    font-size: 16px;
    font-weight: 700;
    margin: 0 0 var(--space-2) 0;
}

.danger-zone__text {
    color: var(--color-secondary-text);
    font-size: 16px;
    line-height: 1.5;
    margin: 0 0 var(--space-4) 0;
}


/* ========================================
   RESPONSIVE: DEAL DETAIL CARD
   ======================================== */

@media (max-width: 640px) {
    .deal-detail-card__top {
        flex-direction: column;
    }

    .deal-detail-card__score-block {
        text-align: left;
    }

    .week-comparison {
        flex-direction: column;
    }

    .week-comparison__arrow {
        transform: rotate(90deg);
    }
}


/* ========================================
   QUICK QUESTIONS
   ======================================== */

.quick-questions {
    margin-bottom: var(--space-6);
    padding: var(--space-4);
    background: var(--color-surface-bg);
    border-radius: 8px;
    border: 1px solid var(--color-border);
}

.quick-questions__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-4);
}

.quick-questions__title {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
}

.quick-questions__count {
    font-size: 0.875rem;
    color: var(--color-secondary-text);
}

.quick-questions__item {
    margin-bottom: var(--space-3);
    padding-bottom: var(--space-3);
    border-bottom: 1px solid var(--color-border);
}

.quick-questions__item:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.quick-questions__question {
    font-size: 16px;
    margin-bottom: var(--space-2);
    color: var(--color-text);
}

.quick-questions__buttons {
    display: flex;
    gap: var(--space-2);
}

.quick-questions__btn {
    padding: var(--space-1) var(--space-3);
    font-size: 0.875rem;
    font-weight: 500;
    border: 2px solid var(--color-border);
    border-radius: 4px;
    background: white;
    cursor: pointer;
    transition: all 0.15s;
    min-width: 70px;
    text-align: center;
}

.quick-questions__btn:hover {
    border-color: var(--color-teal);
}

.quick-questions__btn:focus {
    outline: 3px solid var(--color-focus);
    outline-offset: 0;
}

.quick-questions__btn--selected.quick-questions__btn--yes {
    background: var(--color-rag-green);
    color: white;
    border-color: var(--color-rag-green);
}

.quick-questions__btn--selected.quick-questions__btn--no {
    background: var(--color-rag-red);
    color: white;
    border-color: var(--color-rag-red);
}

.quick-questions__btn--selected.quick-questions__btn--unsure {
    background: var(--color-rag-amber);
    color: white;
    border-color: var(--color-rag-amber);
}


/* ========================================
   COACHING PANEL
   ======================================== */

.coaching-panel {
    margin-top: var(--space-6);
    padding: var(--space-4);
    background: var(--color-surface-bg);
    border: 2px solid var(--color-teal);
    border-radius: 4px;
}

.coaching-panel--unavailable {
    border-color: var(--color-border);
    opacity: 0.7;
}

.coaching-panel__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-3);
}

.coaching-panel__title {
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 700;
    margin: 0;
    color: var(--color-navy);
}

.coaching-panel__status {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-secondary-text);
}

.coaching-panel__unavailable-text {
    font-size: 16px;
    color: var(--color-secondary-text);
    margin: 0;
}

/* Messages area */
.coaching-panel__messages {
    max-height: 600px;
    overflow-y: auto;
    margin-bottom: var(--space-3);
    scroll-behavior: smooth;
}

.coaching-panel__messages:empty {
    display: none;
}

.coaching-panel__message {
    margin-bottom: var(--space-3);
    padding: var(--space-2) var(--space-3);
    font-size: 16px;
    line-height: 1.5;
    border-radius: 4px;
}

.coaching-panel__message--assistant {
    background: var(--color-body-bg);
    border-left: 3px solid var(--color-teal);
    margin-right: var(--space-6);
}

.coaching-panel__message--user {
    background: var(--color-navy);
    color: var(--color-white);
    margin-left: var(--space-6);
    border-radius: 4px;
}

.coaching-panel__message-label {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: var(--space-1);
    display: block;
}

.coaching-panel__message--assistant .coaching-panel__message-label {
    color: var(--color-teal);
}

.coaching-panel__message--user .coaching-panel__message-label {
    color: rgba(255, 255, 255, 0.7);
}

.coaching-panel__message-content p {
    margin: 0 0 var(--space-2) 0;
}

.coaching-panel__message-content p:last-child {
    margin-bottom: 0;
}

.coaching-panel__message-content strong {
    font-weight: 700;
}

.coaching-panel__message-content ul {
    margin: var(--space-1) 0 var(--space-2) var(--space-4);
    padding: 0;
}

.coaching-panel__message-content li {
    margin-bottom: var(--space-1);
}

/* Input area */
.coaching-panel__input-area {
    margin-bottom: var(--space-3);
}

.coaching-panel__input-wrap {
    display: flex;
    gap: var(--space-2);
    align-items: flex-end;
}

.coaching-panel__input {
    flex: 1;
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.4;
    padding: var(--space-2);
    border: 2px solid var(--color-input-border);
    border-radius: 4px;
    resize: vertical;
    min-height: 44px;
    max-height: 120px;
}

.coaching-panel__input:focus {
    outline: 3px solid var(--color-focus);
    outline-offset: 0;
}

.coaching-panel__send {
    background: var(--color-teal);
    color: var(--color-navy);
    border: none;
    border-radius: 4px;
    width: 44px;
    height: 44px;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.coaching-panel__send:hover {
    background: #00b3af;
}

.coaching-panel__send:focus-visible {
    outline: 3px solid var(--color-focus);
    outline-offset: 0;
}

.coaching-panel__send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.coaching-panel__input-meta {
    font-size: 12px;
    color: var(--color-secondary-text);
    text-align: right;
    margin-top: var(--space-1);
}

/* Summary */
.coaching-panel__summary {
    padding: var(--space-3);
    background: var(--color-body-bg);
    border-left: 4px solid var(--color-teal);
    margin-bottom: var(--space-3);
    border-radius: 0 4px 4px 0;
}

.coaching-panel__summary-content {
    font-size: 16px;
    line-height: 1.6;
    white-space: pre-wrap;
}

.coaching-panel__summary-content h2 {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: var(--space-1);
    margin-top: var(--space-3);
}

.coaching-panel__summary-content h2:first-child {
    margin-top: 0;
}

.coaching-panel__summary-content ul {
    padding-left: var(--space-4);
    list-style: disc;
    margin-bottom: var(--space-2);
}

.coaching-panel__summary-content li {
    margin-bottom: var(--space-1);
}

.coaching-panel__suggested-rag {
    margin-top: var(--space-3);
    font-size: 16px;
    font-weight: 600;
}

.coaching-panel__summary-actions {
    margin-top: var(--space-3);
    display: flex;
    gap: var(--space-2);
    flex-wrap: wrap;
}

/* Nudge */
.coaching-panel__nudge {
    padding: var(--space-2) var(--space-3);
    background: var(--color-tag-amber-bg);
    border-left: 3px solid var(--color-rag-amber);
    font-size: 14px;
    color: var(--color-tag-amber-text);
    margin-bottom: var(--space-3);
    border-radius: 0 4px 4px 0;
}

/* Actions */
.coaching-panel__actions {
    display: flex;
    gap: var(--space-2);
    flex-wrap: wrap;
}

/* Loading animation */
.coaching-panel__loading {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: var(--space-2) var(--space-3);
    margin-bottom: var(--space-3);
}

.coaching-panel__loading-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-teal);
    animation: coaching-dot-pulse 1.4s infinite ease-in-out both;
}

.coaching-panel__loading-dot:nth-child(1) {
    animation-delay: -0.32s;
}

.coaching-panel__loading-dot:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes coaching-dot-pulse {
    0%, 80%, 100% {
        transform: scale(0.6);
        opacity: 0.4;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}


/* ========================================
   DEAL ANALYSIS
   ======================================== */

.deal-analysis__content {
    font-size: 16px;
    line-height: 1.6;
}

.deal-analysis__empty {
    text-align: center;
    padding: var(--space-4) 0;
}

.deal-analysis__empty p {
    color: var(--color-secondary-text);
    max-width: 480px;
    margin: 0 auto var(--space-4) auto;
}

.deal-analysis__text {
    font-size: 16px;
    line-height: 1.5;
}

.deal-analysis__text h1,
.deal-analysis__text h2 {
    font-size: 17px;
    font-weight: 700;
    margin: var(--space-3) 0 var(--space-1) 0;
}

.deal-analysis__text h1:first-child,
.deal-analysis__text h2:first-child {
    margin-top: 0;
}

.deal-analysis__text h3 {
    font-size: 16px;
    font-weight: 700;
    margin: var(--space-2) 0 var(--space-1) 0;
}

.deal-analysis__text p {
    margin: 0 0 var(--space-2) 0;
}

.deal-analysis__text ul,
.deal-analysis__text ol {
    padding-left: var(--space-4);
    list-style: disc;
    margin: 0 0 var(--space-2) 0;
}

.deal-analysis__text ol {
    list-style: decimal;
}

.deal-analysis__text li {
    margin-bottom: 2px;
}

.deal-analysis__text strong {
    font-weight: 600;
}

.deal-analysis__text blockquote {
    border-left: 3px solid var(--color-border);
    padding-left: var(--space-2);
    margin: 0 0 var(--space-2) 0;
    color: var(--color-secondary-text);
}

.deal-analysis__meta {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-top: var(--space-3);
    padding-top: var(--space-3);
    border-top: 1px solid var(--color-border);
}

.deal-analysis__timestamp {
    font-size: 14px;
    color: var(--color-secondary-text);
}

.deal-analysis__stale-badge {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-tag-amber-text);
    background: var(--color-tag-amber-bg);
    padding: 2px 8px;
}

.deal-analysis__loading {
    text-align: center;
    padding: var(--space-6) 0;
}

.deal-analysis__loading-text {
    font-size: 16px;
    color: var(--color-secondary-text);
    margin-top: var(--space-3);
}

.deal-analysis__error {
    padding: var(--space-3);
    border-left: 4px solid var(--color-error);
    background: #fdf0ed;
}

.deal-analysis__error p {
    color: var(--color-error);
    font-size: 16px;
    margin-bottom: var(--space-2);
}


/* ========================================
   DEPTH INDICATOR
   ======================================== */

.depth-indicator {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    margin-left: var(--space-2);
}

.depth-indicator__bar {
    width: 4px;
    height: 14px;
    border-radius: 1px;
    background: var(--color-border);
}

.depth-indicator__bar--filled {
    background: var(--color-teal);
}

.depth-indicator__bar--level-3 {
    background: var(--color-success);
}

.depth-indicator__bar--level-4 {
    background: var(--color-navy);
}

.depth-label {
    font-size: 12px;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 2px;
    white-space: nowrap;
}

.depth-label--0 {
    color: var(--color-secondary-text);
}

.depth-label--1 {
    color: var(--color-tag-amber-text);
    background: var(--color-tag-amber-bg);
}

.depth-label--2 {
    color: var(--color-tag-amber-text);
    background: var(--color-tag-amber-bg);
}

.depth-label--3 {
    color: var(--color-tag-green-text);
    background: var(--color-tag-green-bg);
}

.depth-label--4 {
    color: var(--color-white);
    background: var(--color-navy);
}

/* Qualification depth summary bar */
.depth-summary {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    flex-wrap: wrap;
    font-size: 14px;
    margin-bottom: var(--space-4);
    padding: var(--space-2) var(--space-3);
    background: var(--color-body-bg);
    border-radius: 4px;
}

.depth-summary__item {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    white-space: nowrap;
}

.depth-summary__count {
    font-weight: 700;
    font-size: 16px;
}

.depth-summary__label {
    color: var(--color-secondary-text);
}


/* ========================================
   CRITERION HUB (redesigned criterion page)
   ======================================== */

/* Section dividers */
.criterion-hub__section-divider {
    margin-top: var(--space-6);
    margin-bottom: var(--space-4);
    padding-top: var(--space-4);
    border-top: 2px solid var(--color-border);
}

.criterion-hub__section-label {
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-secondary-text);
}

/* Current position */
.criterion-hub__position {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    flex-wrap: wrap;
    margin-bottom: var(--space-2);
}

.criterion-hub__rag-badge {
    display: inline-block;
}

.criterion-hub__rag-badge--none {
    font-size: 16px;
    font-weight: 700;
    color: var(--color-secondary-text);
}

.criterion-hub__rag-source {
    font-size: 16px;
    color: var(--color-secondary-text);
}

.criterion-hub__depth {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

/* Large tag variant */
.tag--large {
    font-size: 24px;
    padding: 6px 16px 4px;
}

@media (min-width: 641px) {
    .tag--large {
        font-size: 30px;
        padding: 8px 20px 6px;
    }
}

/* Suggested RAG display on quick check page */
.criterion-hub__suggested-rag {
    margin-bottom: var(--space-4);
    min-height: 48px;
    display: flex;
    align-items: center;
}

.criterion-hub__suggested-rag-placeholder {
    color: var(--color-secondary-text);
    font-size: 16px;
}

/* Position summary — AI-generated summary under the question */
.criterion-hub__position-summary {
    margin-top: var(--space-3);
    margin-bottom: var(--space-4);
}

.criterion-hub__position-summary-text {
    font-size: 16px;
    line-height: 1.5;
    color: var(--color-text);
}

.criterion-hub__position-summary-placeholder {
    font-size: 16px;
    color: var(--color-secondary-text);
    font-style: italic;
}

.criterion-hub__summary-regenerate {
    background: none;
    border: none;
    padding: 0;
    font-size: 14px;
    color: var(--color-link);
    cursor: pointer;
    text-decoration: underline;
    margin-top: var(--space-1);
    display: inline-block;
}

.criterion-hub__summary-regenerate:hover {
    color: var(--color-link-hover);
}

.criterion-hub__summary-regenerate:disabled {
    color: var(--color-secondary-text);
    cursor: default;
    text-decoration: none;
}

/* Notes log */
.notes-log__entry {
    padding: var(--space-3) 0;
    border-bottom: 1px solid var(--color-border);
}

.notes-log__entry:last-child {
    border-bottom: none;
}

.notes-log__text {
    font-size: 16px;
    line-height: 1.5;
    color: var(--color-text);
}

.notes-log__text p {
    margin: 0 0 var(--space-2) 0;
}

.notes-log__text p:last-child {
    margin-bottom: 0;
}

.notes-log__text strong {
    font-weight: 700;
}

.notes-log__text h3 {
    font-size: 16px;
    font-weight: 700;
    margin: var(--space-2) 0 var(--space-1) 0;
}

.notes-log__text ul {
    margin: var(--space-1) 0 var(--space-2) var(--space-4);
    padding: 0;
}

.notes-log__text li {
    margin-bottom: var(--space-1);
}

.notes-log__meta {
    font-size: 14px;
    color: var(--color-secondary-text);
    margin-top: var(--space-1);
}

/* CTA cards — go deeper section */
.criterion-hub__cta-cards {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    margin-bottom: var(--space-2);
}

.criterion-hub__cta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-3) var(--space-4);
    background: var(--color-surface-bg);
    border: 2px solid var(--color-border);
    border-radius: 4px;
    text-decoration: none;
    color: var(--color-text);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.criterion-hub__cta:visited {
    color: var(--color-text);
}

.criterion-hub__cta:hover {
    border-color: var(--color-teal);
    box-shadow: var(--shadow-sm);
    text-decoration: none;
    color: var(--color-text);
}

.criterion-hub__cta:focus-visible {
    outline: var(--focus-width) solid var(--color-focus);
    outline-offset: 0;
    box-shadow: none;
}

.criterion-hub__cta-content {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.criterion-hub__cta-title {
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 700;
    color: var(--color-link);
}

.criterion-hub__cta-status {
    font-size: 16px;
    color: var(--color-secondary-text);
}

.criterion-hub__cta-arrow {
    font-size: 24px;
    color: var(--color-secondary-text);
    flex-shrink: 0;
    margin-left: var(--space-3);
}

.criterion-hub__cta--locked {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
    border-style: dashed;
}

.criterion-hub__cta-lock-icon {
    flex-shrink: 0;
    margin-left: var(--space-3);
    color: var(--color-secondary-text);
}


/* ========================================
   DEAL OUTCOMES
   ======================================== */

/* Outcomes intro and empty states */
.outcomes__intro {
    margin-bottom: var(--space-4);
    color: var(--color-secondary-text);
    font-size: 16px;
    line-height: 1.5;
}

.outcomes__qualification-note {
    font-size: 16px;
    color: var(--color-secondary-text);
    margin-top: var(--space-2);
}

.outcomes__loading-text {
    color: var(--color-secondary-text);
    font-size: 16px;
    animation: pulse 1.5s ease-in-out infinite;
}

.outcomes__error-text {
    color: var(--color-error);
    font-size: 16px;
}

/* Loading animation */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Outcomes actions bar */
.outcomes__actions {
    display: flex;
    gap: var(--space-2);
    margin-bottom: var(--space-4);
}

/* Criterion link (used in outcome completion page) */
.outcome-card__criterion-link {
    color: var(--color-teal);
    text-decoration: none;
}

.outcome-card__criterion-link:hover {
    text-decoration: underline;
}

/* ─── Outcomes tabs ─── */
.outcomes-tabs {
    display: flex;
    gap: var(--space-1);
    border-bottom: 2px solid var(--color-border);
    margin-bottom: var(--space-4);
}

.outcomes-tabs__tab {
    padding: var(--space-2) var(--space-4);
    border: none;
    background: none;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-secondary-text);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color 0.15s, border-color 0.15s;
}

.outcomes-tabs__tab:hover {
    color: var(--color-text);
}

.outcomes-tabs__tab--active {
    color: var(--color-link);
    border-bottom-color: var(--color-link);
}

/* ─── Backlog table ─── */
.outcomes-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.outcomes-table__th {
    text-align: left;
    padding: var(--space-2) var(--space-3);
    border-bottom: 1px solid var(--color-border);
    font-weight: 600;
    font-size: 0.8125rem;
    color: var(--color-secondary-text);
    white-space: nowrap;
    user-select: none;
}

.outcomes-table__th--sortable {
    cursor: pointer;
}

.outcomes-table__th--sortable:hover {
    color: var(--color-text);
}

.outcomes-table__th--active {
    color: var(--color-text);
}

.outcomes-table__sort-icon {
    font-size: 0.625rem;
    margin-left: 0.25rem;
}

.outcomes-table__td {
    padding: var(--space-2) var(--space-3);
    border-bottom: 1px solid #f0f0f0;
    vertical-align: middle;
}

.outcomes-table__td--priority {
    width: 4rem;
    font-weight: 600;
    text-align: center;
}

.outcomes-table__td--due {
    white-space: nowrap;
}

.outcomes-table__row:hover {
    background: #fafafa;
}

.outcomes-table__row--done {
    opacity: 0.5;
}

.outcomes-table__link {
    color: var(--color-link);
    text-decoration: none;
    font-weight: 500;
}

.outcomes-table__link:hover {
    text-decoration: underline;
}

.outcomes-table__link--done {
    text-decoration: line-through;
    color: var(--color-secondary-text);
}

.outcomes-table__no-date {
    color: var(--color-secondary-text);
}

.outcomes-table__status {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
}

.outcomes-table__status--to_do {
    background: #f0f0f0;
    color: #505a5f;
}

.outcomes-table__status--in_progress {
    background: #fef3cd;
    color: #856404;
}

.outcomes-table__status--done {
    background: #d4edda;
    color: #155724;
}

/* ─── Kanban board ─── */
.kanban {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: var(--space-3);
    min-height: 200px;
}

@media (max-width: 768px) {
    .kanban {
        grid-template-columns: 1fr;
    }
}

.kanban__column {
    background: #f8f8f8;
    border-radius: 0.5rem;
    padding: var(--space-3);
    min-height: 150px;
}

.kanban__column--done {
    background: #f5f5f5;
}

.kanban__column-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-3);
    padding-bottom: var(--space-2);
    border-bottom: 2px solid var(--color-border);
}

.kanban__column-title {
    font-size: 0.8125rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-secondary-text);
    margin: 0;
}

.kanban__column-count {
    background: var(--color-border);
    color: var(--color-secondary-text);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.125rem 0.5rem;
    border-radius: 1rem;
}

.kanban__cards {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.kanban-card {
    display: block;
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: 0.375rem;
    padding: var(--space-3);
    text-decoration: none;
    color: var(--color-text);
    transition: box-shadow 0.15s, border-color 0.15s;
}

.kanban-card:hover {
    border-color: var(--color-link);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

.kanban-card--done {
    opacity: 0.6;
}

.kanban-card--dismissed {
    opacity: 0.4;
    border-style: dashed;
}

.kanban-card__title {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.3;
    margin-bottom: var(--space-2);
}

.kanban-card--done .kanban-card__title {
    text-decoration: line-through;
}

.kanban-card__meta {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: 0.75rem;
}

.kanban-card__priority {
    font-weight: 700;
    padding: 0.0625rem 0.375rem;
    border-radius: 0.25rem;
    font-size: 0.6875rem;
}

.kanban-card__priority--high {
    background: #fce4ec;
    color: #c62828;
}

.kanban-card__priority--medium {
    background: #fff3e0;
    color: #e65100;
}

.kanban-card__priority--low {
    background: #e8f5e9;
    color: #2e7d32;
}

.kanban-card__due {
    color: var(--color-secondary-text);
}

/* Completion review page */
.completion-review {
    margin-top: var(--space-4);
}

.completion-review__quote {
    background: #fdf0ed;
    padding: var(--space-3) var(--space-4);
    border-left: 4px solid var(--color-teal);
    margin-bottom: var(--space-4);
    font-size: 16px;
    line-height: 1.5;
}

.suggestion-card {
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--color-border);
    border-radius: 4px;
    margin-bottom: var(--space-3);
}

.suggestion-card__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-2);
}

.suggestion-card__type {
    font-weight: 600;
    font-size: 0.875rem;
}

.suggestion-card__actions {
    display: flex;
    gap: var(--space-2);
}

.suggestion-card__accept,
.suggestion-card__dismiss {
    font-size: 0.8125rem;
    padding: var(--space-1) var(--space-2);
    border: 1px solid var(--color-border);
    border-radius: 4px;
    cursor: pointer;
    background: white;
    font-family: var(--font-body);
}

.suggestion-card__accept:hover {
    background: var(--color-rag-green);
    color: white;
    border-color: var(--color-rag-green);
}

.suggestion-card__dismiss:hover {
    background: var(--color-body-bg);
}

.suggestion-card--accepted {
    border-color: var(--color-rag-green);
    background: rgba(58, 219, 118, 0.05);
}

.suggestion-card--dismissed {
    opacity: 0.4;
}

.suggestion-card__content {
    font-size: 0.9375rem;
    line-height: 1.5;
}

.suggestion-card__reasoning {
    font-size: 0.8125rem;
    color: var(--color-secondary-text);
    margin-top: var(--space-2);
    font-style: italic;
}

/* ─── Outcome complete page ─── */

.outcome-complete__description {
    font-size: 1.0625rem;
    line-height: 1.5;
    color: var(--color-secondary-text);
    margin-bottom: var(--space-3);
}

.outcome-complete__criteria {
    font-size: 0.9375rem;
    color: var(--color-secondary-text);
    margin-bottom: var(--space-4);
}

.outcome-complete__actions {
    display: flex;
    gap: var(--space-3);
    margin-top: var(--space-4);
    padding-top: var(--space-4);
    border-top: 1px solid var(--color-border);
}

.outcome-complete__done {
    text-align: center;
    padding: var(--space-6) 0;
}

.outcome-complete__done h2 {
    margin-bottom: var(--space-3);
}

.outcome-complete__done p {
    margin-bottom: var(--space-4);
    color: var(--color-secondary-text);
}

/* ─── Refresh page ─── */

.refresh__current {
    margin-bottom: var(--space-4);
    padding-bottom: var(--space-4);
    border-bottom: 1px solid var(--color-border);
}

.refresh__current h3 {
    margin-bottom: var(--space-2);
}

.refresh__outcome-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.refresh__outcome-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) 0;
    border-bottom: 1px solid var(--color-border);
}

.refresh__outcome-item:last-child {
    border-bottom: none;
}

.refresh__outcome-priority {
    font-weight: 700;
    font-size: 0.875rem;
    color: var(--color-secondary-text);
    min-width: 24px;
}

.refresh__outcome-title {
    flex: 1;
    font-size: 0.9375rem;
}

/* ─── Criterion hub: related outcomes ─── */

.criterion-hub__related-outcomes {
    margin-bottom: var(--space-4);
}

.criterion-hub__outcome {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) 0;
    border-bottom: 1px solid var(--color-border);
}

.criterion-hub__outcome:last-child {
    border-bottom: none;
}

.criterion-hub__outcome-priority {
    font-weight: 700;
    font-size: 0.875rem;
    color: var(--color-secondary-text);
    min-width: 24px;
}

.criterion-hub__outcome-content {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex: 1;
}

.criterion-hub__outcome-title {
    font-size: 0.9375rem;
    flex: 1;
}


/* ========================================
   OUTCOME DETAIL PAGE
   ======================================== */

.outcome-detail__title {
    transition: background-color 0.2s;
}

.outcome-detail__title--editing,
.outcome-detail__description--editing {
    background-color: #fdf0ed;
    outline: 2px solid var(--color-teal);
    padding: var(--space-2);
    border-radius: 4px;
}

.outcome-detail__description {
    color: var(--color-secondary-text);
    font-size: 16px;
    line-height: 1.5;
    transition: background-color 0.2s;
}

.outcome-detail__status-buttons {
    display: flex;
    gap: var(--space-2);
    margin-bottom: var(--space-4);
}

.outcome-detail__status-btn {
    padding: var(--space-2) var(--space-4);
    border: 2px solid var(--color-border);
    background: var(--color-white);
    cursor: pointer;
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 500;
    border-radius: 4px;
    transition: all 0.15s;
}

.outcome-detail__status-btn:hover {
    border-color: var(--color-teal);
    color: var(--color-teal);
}

.outcome-detail__status-btn--active {
    border-color: var(--color-teal);
    background: var(--color-teal);
    color: var(--color-white);
}

.outcome-detail__status-btn--active:hover {
    color: var(--color-white);
}

.outcome-detail__completion-note {
    background: #f8f8f8;
    padding: var(--space-3) var(--space-4);
    border-left: 4px solid var(--color-teal);
    border-radius: 0 4px 4px 0;
    line-height: 1.6;
}

/* Related criteria — simple list of links */
.outcome-detail__criteria-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2) var(--space-4);
}

.outcome-detail__criteria-list li {
    font-size: 1rem;
}

.outcome-detail__criteria-list a {
    color: var(--color-link);
    text-decoration: none;
}

.outcome-detail__criteria-list a:hover {
    text-decoration: underline;
    color: var(--color-link-hover);
}

/* Due date — larger, nicer control */
.outcome-detail__due-date {
    margin-bottom: var(--space-2);
}

.outcome-detail__date-input {
    font-family: var(--font-body);
    font-size: 1.125rem;
    padding: var(--space-2) var(--space-3);
    border: 2px solid var(--color-input-border);
    border-radius: 4px;
    background: var(--color-white);
    min-width: 220px;
}

.outcome-detail__date-input:focus {
    outline: 3px solid var(--color-teal);
    outline-offset: 0;
    border-color: var(--color-input-border);
}

/* Priority buttons — HIGH / MEDIUM / LOW */
.outcome-detail__priority-buttons {
    display: flex;
    gap: var(--space-2);
    margin-bottom: var(--space-4);
}

.outcome-detail__priority-btn {
    padding: var(--space-2) var(--space-4);
    border: 2px solid var(--color-border);
    background: var(--color-white);
    cursor: pointer;
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 600;
    border-radius: 4px;
    transition: all 0.15s;
}

.outcome-detail__priority-btn:hover {
    border-color: var(--color-navy);
}

.outcome-detail__priority-btn--high.outcome-detail__priority-btn--active {
    border-color: var(--color-error);
    background: var(--color-error);
    color: var(--color-white);
}

.outcome-detail__priority-btn--medium.outcome-detail__priority-btn--active {
    border-color: #f47738;
    background: #f47738;
    color: var(--color-white);
}

.outcome-detail__priority-btn--low.outcome-detail__priority-btn--active {
    border-color: var(--color-success, #00703c);
    background: var(--color-success, #00703c);
    color: var(--color-white);
}


/* ========================================
   OUTCOME ADD PAGE — CHECKBOX GRID
   ======================================== */

.checkbox-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-2);
    margin-top: var(--space-2);
}

.checkbox-grid__item {
    display: flex;
    align-items: flex-start;
    gap: var(--space-2);
    font-size: 0.9375rem;
    line-height: 1.4;
    cursor: pointer;
    padding: var(--space-1);
}

.checkbox-grid__item input[type="checkbox"] {
    margin-top: 3px;
    flex-shrink: 0;
}

@media (max-width: 640px) {
    .checkbox-grid {
        grid-template-columns: 1fr;
    }
}


/* ========================================
   ERROR PAGES
   ======================================== */

.error-page {
    max-width: 640px;
    margin: 3rem auto;
    padding: 0 1.5rem;
}

.error-page__heading {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--color-text);
}

.error-page__message {
    font-size: 1.125rem;
    line-height: 1.6;
    margin-bottom: 2rem;
    color: var(--color-secondary-text);
}

.error-page__link {
    display: inline-block;
    color: var(--color-link);
    font-weight: 500;
    text-decoration: underline;
}

.error-page__link:hover {
    color: var(--color-link-hover);
}

.error-page__link:visited {
    color: var(--color-link-visited);
}

.error-page__link:focus {
    outline: var(--focus-width) solid var(--focus-color);
    outline-offset: 0;
    background-color: var(--focus-color);
    color: var(--color-text);
}
}

/* ============================================================
   PLAN EDITOR (Phase 2 — ADR-012)
   ============================================================ */

.plan-editor {
    display: flex;
    gap: var(--space-6);
    align-items: flex-start;
}

.plan-editor__sidebar {
    flex: 0 0 280px;
    position: sticky;
    top: 80px;
}

.plan-editor__group {
    margin-bottom: var(--space-4);
}

.plan-editor__group-title {
    font-size: 0.875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-secondary, #505a5f);
    margin-bottom: var(--space-2);
    padding: 0 var(--space-2);
}

.plan-editor__section-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.plan-editor__section-item {
    margin-bottom: 1px;
}

.plan-editor__section-item--active .plan-editor__section-link {
    background: var(--color-teal);
    color: var(--color-navy);
    font-weight: 700;
}

.plan-editor__section-item--active .plan-editor__section-link .tag {
    background: rgba(255, 255, 255, 0.3);
}

.plan-editor__section-link {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2);
    text-decoration: none;
    color: var(--color-text);
    border-radius: 4px;
    transition: background-color 0.15s;
}

.plan-editor__section-link:hover {
    background: var(--color-bg-secondary, #f3f2f1);
}

.plan-editor__section-link:focus-visible {
    outline: var(--focus-width) solid var(--focus-color);
    outline-offset: 0;
    background-color: var(--focus-color);
}

.plan-editor__section-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--color-navy);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    flex-shrink: 0;
}

.plan-editor__section-name {
    flex: 1;
    font-size: 0.875rem;
}

.plan-editor__content {
    flex: 1;
    min-width: 0;
}

/* Save indicator */
.save-indicator {
    font-size: 0.875rem;
    transition: opacity 0.3s;
}

.save-indicator--saving {
    color: var(--color-text-secondary, #505a5f);
}

.save-indicator--saved {
    color: var(--color-success);
}

.save-indicator--retrying {
    color: var(--color-rag-amber);
}

.save-indicator--failed {
    color: var(--color-error);
    font-weight: 700;
}

/* Wide variant — sidebar in left margin, full content area */
.plan-editor--wide {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: var(--space-5);
    max-width: calc(1400px + 240px + 30px);
    margin: 0 auto;
}

.plan-editor--wide .plan-editor__sidebar {
    position: sticky;
    top: 80px;
    align-self: start;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    flex: none;
    /* Visually lighter in the margin role */
    opacity: 0.9;
}

.plan-editor--wide .plan-editor__content {
    max-width: 1400px;
    min-width: 0;
}

/* Collapse sidebar on screens too narrow for the wide layout */
@media (max-width: 1200px) {
    .plan-editor--wide {
        grid-template-columns: 1fr;
    }
    .plan-editor--wide .plan-editor__sidebar {
        display: none;
    }
}

/* Responsive: stack on mobile */
@media (max-width: 768px) {
    .plan-editor {
        flex-direction: column;
    }
    .plan-editor__sidebar {
        flex: none;
        width: 100%;
        position: static;
    }
}

/* ============================================================
   Section editor forms (TG4-6)
   ============================================================ */

.section-editor-fieldset {
    border: none;
    padding: 0;
    margin: 0;
}

/* Repeating items (add/remove cards) */
.repeating-item__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-3);
}

.repeating-item__heading {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
}

/* Narrow inputs for financial/numeric fields */
.form-group__input--narrow {
    max-width: 120px;
}

.form-group__input--error {
    border-color: var(--color-error);
}

/* Error summary */
.error-summary {
    border: 4px solid var(--color-error);
    padding: var(--space-4);
    margin-bottom: var(--space-4);
}

.error-summary__title {
    margin-top: 0;
    font-size: 1.1rem;
    color: var(--color-error);
}

.error-summary__list {
    margin: var(--space-2) 0 0;
    padding-left: var(--space-4);
}

.error-summary__list li {
    color: var(--color-error);
}

/* Financial tables */
.financial-table input[type="number"] {
    width: 90px;
    padding: var(--space-1) var(--space-2);
    font-size: 0.85rem;
    text-align: right;
}

.financial-table__grand-total td {
    font-weight: 700;
    border-top: 2px solid var(--color-text);
}

.financial-grand-total {
    text-align: right;
    font-size: 0.85rem;
}

/* Stakeholder power/interest matrix */
.stakeholder-matrix__grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2px;
    margin-top: var(--space-3);
    border: 1px solid var(--color-border);
}

.stakeholder-matrix__quadrant {
    padding: var(--space-3);
    min-height: 80px;
}

.stakeholder-matrix__quadrant--high-high {
    background: #e8f5e9;
}

.stakeholder-matrix__quadrant--high-low {
    background: #fff3e0;
}

.stakeholder-matrix__quadrant--low-high {
    background: #e3f2fd;
}

.stakeholder-matrix__quadrant--low-low {
    background: var(--color-bg-secondary, #f3f2f1);
}

.stakeholder-matrix__label {
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--color-text-secondary);
    margin-bottom: var(--space-1);
}

.stakeholder-matrix__names {
    font-size: 0.85rem;
}

/* Warning button */
.btn--warning {
    background: transparent;
    color: var(--color-error);
    border: 1px solid var(--color-error);
}

.btn--warning:hover {
    background: var(--color-error);
    color: #fff;
}

/* ========================================
   PLAN VIEW (read-only presentation)
   ======================================== */

.plan-view {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: var(--space-6);
    margin-top: var(--space-6);
}

.plan-view__sidebar {
    position: sticky;
    top: var(--space-4);
    align-self: start;
    max-height: calc(100vh - var(--space-8));
    overflow-y: auto;
}

.plan-view__content {
    min-width: 0;
}

.plan-view__section {
    margin-bottom: var(--space-4);
}

.plan-view__details {
    border: 1px solid var(--color-border);
    background: var(--color-white);
}

.plan-view__summary {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-5);
    cursor: pointer;
    list-style: none;
    font-weight: 700;
}

.plan-view__summary::-webkit-details-marker {
    display: none;
}

.plan-view__summary::before {
    content: "\25B6";
    font-size: var(--font-14);
    color: var(--color-secondary-text);
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

details[open] > .plan-view__summary::before {
    transform: rotate(90deg);
}

.plan-view__summary:hover {
    background: var(--color-bg-secondary, #f3f2f1);
}

.plan-view__section-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--color-navy);
    color: var(--color-white);
    font-size: var(--font-14);
    font-weight: 700;
    flex-shrink: 0;
}

.plan-view__section-title {
    flex: 1;
    font-size: var(--font-19);
}

.plan-view__section-body {
    padding: var(--space-4) var(--space-5) var(--space-5);
    border-top: 1px solid var(--color-border);
}

.plan-view__section-body .plan-section__body {
    margin: 0;
}

.plan-view__section-body .plan-section__card {
    border: 1px solid #e8e8e8;
    padding: var(--space-4);
    margin-bottom: var(--space-3);
    background: #fafafa;
}

.plan-view__section-body .plan-section__card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-3);
}

.plan-view__section-body .plan-section__card-title {
    margin: 0;
    font-size: var(--font-19);
}

.plan-view__section-body .plan-section__details {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: var(--space-1) var(--space-4);
    font-size: var(--font-16);
}

.plan-view__section-body .plan-section__details dt {
    font-weight: 700;
    color: var(--color-secondary-text);
}

.plan-view__section-body .plan-section__details dd {
    margin: 0;
}

.plan-view__section-body .plan-section__notes {
    margin-top: var(--space-3);
    font-size: var(--font-16);
    color: var(--color-secondary-text);
    font-style: italic;
}

.plan-view__section-body .plan-section__subtitle {
    font-size: var(--font-19);
    margin: var(--space-4) 0 var(--space-3);
    padding-bottom: var(--space-2);
    border-bottom: 2px solid var(--color-teal);
}

.plan-view__section-body .plan-section__subtitle:first-child {
    margin-top: 0;
}

.plan-view__section-body .plan-section__table-wrap {
    overflow-x: auto;
    margin-bottom: var(--space-4);
}

.plan-view__section-body .plan-section__table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--font-16);
}

.plan-view__section-body .plan-section__table th {
    text-align: left;
    padding: var(--space-2) var(--space-3);
    background: var(--color-navy);
    color: var(--color-white);
    font-size: var(--font-14);
    font-weight: 700;
}

.plan-view__section-body .plan-section__table td {
    padding: var(--space-2) var(--space-3);
    border-bottom: 1px solid var(--color-border);
}

.plan-view__section-body .plan-section__table tbody tr:hover {
    background: #f8f8f8;
}

@media (max-width: 768px) {
    .plan-view {
        grid-template-columns: 1fr;
    }

    .plan-view__sidebar {
        position: static;
        max-height: none;
    }
}

/* ========================================
   PLAN DASHBOARD
   ======================================== */

.plan-dashboard {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-6);
    margin-top: var(--space-6);
}

.plan-dashboard__widget {
    background: var(--color-white);
    border: 1px solid var(--color-border);
    padding: var(--space-5);
}

.plan-dashboard__widget--full {
    grid-column: 1 / -1;
}

.plan-dashboard__widget-title {
    font-size: var(--font-24);
    font-weight: 700;
    margin-top: 0;
    margin-bottom: var(--space-4);
    color: var(--color-text);
}

progress.plan-dashboard__progress-bar {
    width: 100%;
    height: 8px;
    margin-bottom: var(--space-4);
    appearance: none;
    border: none;
    border-radius: 4px;
    overflow: hidden;
}

progress.plan-dashboard__progress-bar::-webkit-progress-bar {
    background: var(--color-border);
    border-radius: 4px;
}

progress.plan-dashboard__progress-bar::-webkit-progress-value {
    background: var(--color-teal);
    border-radius: 4px;
}

progress.plan-dashboard__progress-bar::-moz-progress-bar {
    background: var(--color-teal);
    border-radius: 4px;
}

.plan-dashboard__stat {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: var(--space-2) 0;
    border-bottom: 1px solid #f0f0f0;
}

.plan-dashboard__stat:last-child {
    border-bottom: none;
}

.plan-dashboard__stat-label {
    color: var(--color-secondary-text);
    font-size: var(--font-16);
}

.plan-dashboard__stat-value {
    font-size: var(--font-24);
    font-weight: 700;
    color: var(--color-text);
}

.plan-dashboard__stakeholder-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.plan-dashboard__stakeholder-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-2) 0;
    border-bottom: 1px solid #f0f0f0;
}

.plan-dashboard__stakeholder-item:last-child {
    border-bottom: none;
}

@media (max-width: 768px) {
    .plan-dashboard {
        grid-template-columns: 1fr;
    }
}


/* ============================================================
   PLAN PRESENTATION VIEW
   ============================================================ */

.plan-presentation {
    background: var(--color-body-bg);
}

/* Page banner — reusable dark header used across all pages */
.page-banner {
    background: linear-gradient(135deg, var(--color-navy) 0%, #0a3540 100%);
    color: var(--color-white);
    padding: var(--space-8) var(--space-5);
    border-bottom: 4px solid var(--color-teal);
    margin-bottom: 20px;
}

.page-banner__content {
    max-width: var(--page-width);
    margin: 0 auto;
}

.page-banner__nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-4);
    flex-wrap: wrap;
}

.page-banner__back-link,
.page-banner__back-link:visited {
    color: var(--color-white);
    text-decoration: underline;
}

.page-banner__back-link:hover,
.page-banner__back-link:focus {
    color: var(--color-teal);
}

.page-banner__title {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: var(--space-2);
    color: var(--color-white);
}

.page-banner__subtitle {
    font-size: 1.2rem;
    color: var(--color-teal);
    margin-bottom: 0;
}

.page-banner__actions {
    display: flex;
    gap: var(--space-3);
}

.page-banner__actions .btn--secondary {
    background-color: transparent;
    color: var(--color-white);
    border: 2px solid var(--color-white);
    box-shadow: none;
}

.page-banner__actions .btn--secondary:hover {
    background-color: rgba(255, 255, 255, 0.15);
    color: var(--color-white);
}

/* Plan presentation header — extends page-banner */
.plan-presentation__header {
    background: linear-gradient(135deg, var(--color-navy) 0%, #0a3540 100%);
    color: var(--color-white);
    padding: var(--space-8) var(--space-5);
    border-bottom: 4px solid var(--color-teal);
    margin-bottom: 20px;
}

.plan-presentation__header-content {
    max-width: var(--page-width, 1400px);
    margin: 0 auto;
}

.plan-presentation__header-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-4);
    flex-wrap: wrap;
    gap: var(--space-3);
}

.plan-presentation__header-actions {
    display: flex;
    gap: var(--space-3);
}

.plan-presentation__header-actions .btn--secondary {
    background-color: transparent;
    color: var(--color-white);
    border: 2px solid var(--color-white);
    box-shadow: none;
}

.plan-presentation__header-actions .btn--secondary:hover {
    background-color: rgba(255, 255, 255, 0.15);
    color: var(--color-white);
}

.plan-presentation__back-link {
    color: var(--color-white);
    text-decoration: underline;
}

.plan-presentation__back-link:hover {
    color: var(--color-teal);
}

.plan-presentation__title {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: var(--space-2);
    color: var(--color-white);
}

.plan-presentation__subtitle {
    font-size: 1.2rem;
    color: var(--color-teal);
    margin-bottom: 0;
}

/* Status select in header — styled like btn--secondary to match View/Edit buttons */
.plan-presentation__status-select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background: transparent;
    color: var(--color-white, #fff);
    border: 2px solid var(--color-white, #fff);
    padding: 6px 28px 6px 12px;
    border-radius: 0;
    font-size: 0.85rem;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23fff' stroke-width='2' fill='none'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
}
.plan-presentation__status-select:hover,
.plan-presentation__status-select:focus {
    background-color: rgba(255, 255, 255, 0.15);
    outline: 3px solid var(--color-teal, #00c6c2);
    outline-offset: 0;
}
.plan-presentation__status-select option {
    background: var(--color-navy, #052831);
    color: #fff;
}

.plan-presentation__meta {
    display: flex;
    gap: var(--space-4);
    align-items: center;
    flex-wrap: wrap;
    color: rgba(255, 255, 255, 0.8);
}

/* Summary cards */
.plan-presentation__summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-4);
    max-width: 1400px;
    margin: var(--space-5) auto;
    padding: 0 var(--space-5);
}

.plan-presentation__summary-card {
    background: var(--color-white);
    padding: var(--space-4);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border-left: 4px solid var(--color-teal);
}

.plan-presentation__summary-card h3 {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-secondary-text);
    margin-bottom: var(--space-2);
}

.plan-presentation__summary-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--color-teal);
}

.plan-presentation__summary-subtext {
    font-size: 0.9rem;
    color: var(--color-secondary-text);
    margin-top: var(--space-1);
}

/* Body container */
.plan-presentation__body {
    max-width: 1400px;
    margin: 0 auto;
    padding: var(--space-5);
}

/* Section blocks */
.plan-presentation__section {
    background: var(--color-white);
    margin-bottom: var(--space-5);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

.plan-presentation__section-header {
    background: var(--color-navy);
    color: var(--color-white);
    padding: var(--space-4);
    border-left: 4px solid var(--color-teal);
}

.plan-presentation__section-header h2 {
    font-size: 1.5rem;
    color: var(--color-white);
    margin-bottom: var(--space-1);
}

.plan-presentation__section-header p {
    color: var(--color-teal);
    font-size: 0.95rem;
    margin: 0;
}

.plan-presentation__section-content {
    padding: var(--space-5);
}

/* Tables */
.plan-presentation__table {
    width: 100%;
    border-collapse: collapse;
    margin: var(--space-3) 0;
}

.plan-presentation__table th {
    background: var(--color-navy);
    color: var(--color-white);
    padding: var(--space-3);
    text-align: left;
    font-weight: 600;
    font-size: 0.9rem;
}

.plan-presentation__table td {
    padding: var(--space-3);
    border-bottom: 1px solid var(--color-border);
    vertical-align: top;
}

.plan-presentation__table tr:hover {
    background: var(--color-body-bg);
}

.plan-presentation__table--compact th,
.plan-presentation__table--compact td {
    padding: var(--space-2);
    font-size: 0.9rem;
}

.plan-presentation__row-total td {
    font-weight: 700;
    border-top: 2px solid var(--color-navy);
}

/* Subsection titles */
.plan-presentation__subsection-title {
    font-size: 1.2rem;
    color: var(--color-navy);
    margin: var(--space-5) 0 var(--space-3);
    padding-bottom: var(--space-2);
    border-bottom: 2px solid var(--color-teal);
}

.plan-presentation__subsection-title:first-child {
    margin-top: 0;
}

/* RAG indicators */
.plan-presentation__rag {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 6px;
    vertical-align: middle;
}

.plan-presentation__rag--green { background: var(--color-rag-green); }
.plan-presentation__rag--amber { background: var(--color-rag-amber); }
.plan-presentation__rag--red { background: var(--color-rag-red); }

.plan-presentation__rag-label {
    font-size: 0.85rem;
    vertical-align: middle;
}

/* Highlight blocks */
.plan-presentation__highlight {
    background: rgba(0, 198, 194, 0.08);
    padding: var(--space-4);
    border-radius: 8px;
    border-left: 4px solid var(--color-teal);
    margin: var(--space-4) 0;
}

/* Narrative blocks */
.plan-presentation__narrative {
    background: var(--color-body-bg);
    padding: var(--space-4);
    border-radius: 8px;
    border-left: 4px solid var(--color-teal);
    margin: var(--space-3) 0;
}

.plan-presentation__narrative p {
    margin: 0;
    line-height: 1.6;
}

/* Empty state */
.plan-presentation__empty {
    text-align: center;
    padding: var(--space-8) var(--space-5);
    background: var(--color-white);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* Responsive */
@media (max-width: 768px) {
    .plan-presentation__title {
        font-size: 1.75rem;
    }

    .plan-presentation__summary-cards {
        grid-template-columns: 1fr 1fr;
        padding: 0 var(--space-4);
    }

    .plan-presentation__body {
        padding: var(--space-4);
    }

    .page-banner {
        padding: var(--space-5) var(--space-4);
    }

    .page-banner__title {
        font-size: 1.75rem;
    }

    .plan-presentation__header {
        padding: var(--space-5) var(--space-4);
    }

    .plan-presentation__table th,
    .plan-presentation__table td {
        padding: var(--space-2);
        font-size: 0.85rem;
    }
}

/* ============================================================
   AI Features — Section Assist, Review, Intelligence, Chat
   ============================================================ */

/* AI Preview Panel */
/* Back link in dark header — all states white, hover teal */
.plan-presentation__back-link,
.plan-presentation__back-link:visited,
.plan-presentation__back-link:active {
    color: #fff;
    text-decoration: underline;
}
.plan-presentation__back-link:hover,
.plan-presentation__back-link:focus {
    color: var(--color-accent, #00c6c2);
}

/* Header nav links — same treatment */
.plan-presentation__header-nav a,
.plan-presentation__header-nav a:visited,
.plan-presentation__header-nav a:active {
    color: #fff;
}
.plan-presentation__header-nav a:hover,
.plan-presentation__header-nav a:focus {
    color: var(--color-accent, #00c6c2);
}

/* Status select in dark header */
.plan-presentation__status-select {
    background: rgba(255,255,255,0.15);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.3);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.85rem;
    cursor: pointer;
}
.plan-presentation__status-select option {
    background: var(--color-primary, #052831);
    color: #fff;
}

.ai-preview-panel {
    border-left: 4px solid var(--color-accent, #00c6c2);
    margin-bottom: var(--space-4);
}

.ai-preview__label {
    margin-bottom: var(--space-2);
}

.ai-preview__cached {
    color: var(--color-secondary);
    font-size: 0.85rem;
}

.ai-preview__json {
    background: var(--color-bg-light, #f3f4f4);
    padding: var(--space-3);
    border-radius: 4px;
    font-size: 0.8rem;
    overflow-x: auto;
    max-height: 400px;
    white-space: pre-wrap;
    word-break: break-word;
}

.ai-status {
    display: block;
    font-size: 0.85rem;
    margin-top: var(--space-2);
}
.ai-status--info { color: var(--color-secondary); }
.ai-status--success { color: var(--color-success, #3adb76); }
.ai-status--error { color: var(--color-alert, #cc4b37); }

.ai-loading {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    color: var(--color-secondary);
    padding: var(--space-3);
}

.ai-loading__spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid var(--color-secondary);
    border-top-color: var(--color-accent, #00c6c2);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Tag: purple for AI-generated */
.tag--purple {
    background: #7c3aed;
    color: #fff;
}

/* Intelligence Widget */
.intelligence-widget {
    margin-bottom: var(--space-4);
}

.intelligence-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.intelligence-item {
    padding: var(--space-2) 0;
    border-bottom: 1px solid var(--color-border, #e0e0e0);
}

.intelligence-item:last-child {
    border-bottom: none;
}

.intelligence-item__category {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-secondary);
    margin-bottom: var(--space-1);
}

.intelligence-item__text {
    margin: 0;
    font-size: 0.9rem;
}

.intelligence-content__placeholder {
    color: var(--color-secondary);
    font-style: italic;
}

/* Review Panel */
.review-header {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-3);
}

.review-rag-label {
    font-weight: 600;
}

.review-summary {
    margin-bottom: var(--space-3);
    font-size: 0.95rem;
}

.review-feedback-list {
    list-style: none;
    padding: 0;
    margin: 0 0 var(--space-3);
}

.review-feedback-item {
    padding: var(--space-2);
    margin-bottom: var(--space-2);
    border-radius: 4px;
    background: var(--color-bg-light, #f3f4f4);
}

.review-feedback-item--blocking {
    border-left: 4px solid var(--color-alert, #cc4b37);
}

.review-feedback-item--change_required {
    border-left: 4px solid var(--color-warning, #ffae00);
}

.review-feedback-item--comment {
    border-left: 4px solid var(--color-secondary);
}

.review-feedback-item--resolved {
    opacity: 0.6;
}

.review-recommendations {
    list-style: none;
    padding: 0;
}

.review-recommendations li {
    padding: var(--space-2) 0;
    border-bottom: 1px solid var(--color-border, #e0e0e0);
}

/* RAG dots */
.rag-dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
}
.rag-dot--green { background: var(--color-success, #3adb76); }
.rag-dot--amber { background: var(--color-warning, #ffae00); }
.rag-dot--red { background: var(--color-alert, #cc4b37); }

/* Document Upload */
.document-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.document-list__item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) 0;
    border-bottom: 1px solid var(--color-border, #e0e0e0);
}

.document-list__item:last-child {
    border-bottom: none;
}

.document-list__name {
    flex: 1;
}

.document-upload-form {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

/* Chat Interface */
.chat-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 250px);
    min-height: 500px;
    border: 1px solid var(--color-border, #e0e0e0);
    border-radius: 8px;
    background: #fff;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-4);
}

.chat-message {
    margin-bottom: var(--space-3);
    max-width: 80%;
}

.chat-message--user {
    margin-left: auto;
    text-align: right;
}

.chat-message--assistant {
    margin-right: auto;
}

.chat-message__role {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-secondary);
    margin-bottom: var(--space-1);
}

.chat-message__text {
    display: inline-block;
    padding: var(--space-2) var(--space-3);
    border-radius: 12px;
    font-size: 0.95rem;
    line-height: 1.5;
    text-align: left;
    white-space: pre-wrap;
}

.chat-message--user .chat-message__text {
    background: var(--color-primary, #052831);
    color: #fff;
}

.chat-message--assistant .chat-message__text {
    background: var(--color-bg-light, #f3f4f4);
    color: var(--color-text, #333);
}

.chat-input-area {
    border-top: 1px solid var(--color-border, #e0e0e0);
    padding: var(--space-3);
}

.chat-input-row {
    display: flex;
    gap: var(--space-2);
}

.chat-input {
    flex: 1;
    padding: var(--space-2);
    border: 1px solid var(--color-border, #e0e0e0);
    border-radius: 4px;
    font-family: inherit;
    font-size: 0.95rem;
    resize: vertical;
}

.chat-input:focus {
    outline: 3px solid var(--color-accent, #00c6c2);
    outline-offset: 0;
}

.chat-send-btn {
    align-self: flex-end;
}

.chat-input-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: var(--space-2);
    flex-wrap: wrap;
    gap: var(--space-2);
}

.char-count {
    font-size: 0.8rem;
    color: var(--color-secondary);
}

.char-count--warning {
    color: var(--color-alert, #cc4b37);
    font-weight: 600;
}

.chat-actions {
    display: flex;
    gap: var(--space-2);
}

/* ============================================================
   Section Coach Panel (ADR-033)
   Fixed to right edge, full viewport height, in the page gutter.
   ============================================================ */

.coach-panel {
    position: fixed;
    right: 0;
    top: 0;
    margin-top: 96px;
    width: 340px;
    height: 89vh;
    border-left: 1px solid var(--color-border, #e0e0e0);
    display: flex;
    flex-direction: column;
    background: #fff;
    z-index: 50;
}

.coach-panel--collapsed {
    display: none;
}

/* Push main content away from the fixed coach panel */
body:has(.coach-panel:not(.coach-panel--collapsed)) .container--wide {
    margin-right: 340px;
}

.coach-panel__header {
    padding: var(--space-2) var(--space-3);
    border-bottom: 1px solid var(--color-border, #e0e0e0);
    background: var(--color-bg-light, #f3f4f4);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.coach-panel__title {
    font-size: 0.9rem;
    margin: 0;
}

.coach-messages {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-3);
}

.coach-message {
    margin-bottom: var(--space-2);
}

.coach-message__role {
    display: block;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--color-secondary);
    margin-bottom: 2px;
}

.coach-message__text {
    font-size: 0.85rem;
    line-height: 1.5;
    padding: var(--space-1) var(--space-2);
    border-radius: 8px;
    white-space: pre-wrap;
}

.coach-message--user .coach-message__text {
    background: var(--color-primary, #052831);
    color: #fff;
}

.coach-message--assistant .coach-message__text {
    background: var(--color-bg-light, #f3f4f4);
}

.coach-message--streaming .coach-message__text {
    border-left: 3px solid var(--color-accent, #00c6c2);
}

.coach-input-area {
    border-top: 1px solid var(--color-border, #e0e0e0);
    padding: var(--space-2);
}

.coach-input {
    width: 100%;
    padding: var(--space-1);
    border: 1px solid var(--color-border, #e0e0e0);
    border-radius: 4px;
    font-family: inherit;
    font-size: 0.85rem;
    resize: none;
}

.coach-input:focus {
    outline: 3px solid var(--color-accent, #00c6c2);
    outline-offset: 0;
}

.coach-input-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: var(--space-1);
}

.coach-unavailable {
    padding: var(--space-3);
    color: var(--color-secondary);
    font-style: italic;
    font-size: 0.85rem;
}

/* Coach change proposals */
.coach-change-proposal {
    margin: var(--space-2) 0;
    padding: var(--space-2);
    border: 1px solid var(--color-warning, #ffae00);
    border-radius: 4px;
    background: var(--color-bg-cream, #fdf7ea);
}

.coach-change-detail {
    font-size: 0.8rem;
    margin: var(--space-1) 0;
}

.coach-change-field {
    font-weight: 600;
    margin-bottom: var(--space-1);
}

.coach-change-from {
    color: var(--color-alert, #cc4b37);
    text-decoration: line-through;
}

.coach-change-to {
    color: var(--color-success, #3adb76);
    font-weight: 600;
}

.coach-change-reason {
    color: var(--color-secondary);
    margin-top: var(--space-1);
    font-style: italic;
}

.coach-change-actions {
    display: flex;
    gap: var(--space-2);
    margin-top: var(--space-2);
}

/* Make plan-editor layout accommodate coach panel */
.plan-editor {
    display: flex;
}

.plan-editor__content {
    flex: 1;
    min-width: 0;
}

@media (max-width: 1200px) {
    .coach-panel {
        box-shadow: -4px 0 12px rgba(0,0,0,0.15);
    }
    /* Don't push content on narrow screens — coach overlays */
    body:has(.coach-panel:not(.coach-panel--collapsed)) .container--wide {
        margin-right: 0;
    }
}

/* ==========================================================================
   Plan template extracted inline styles
   ========================================================================== */

/* --- plan/list.html ---- */

.plan-list__import-action {
    margin-bottom: var(--space-6);
}

.plan-list__controls {
    margin-bottom: var(--space-4);
}

.plan-list__filter-group {
    margin-bottom: 0;
}

.plan-list__search-input {
    max-width: 300px;
    display: inline-block;
}

.plan-list__filter-select {
    display: inline-block;
}

.plan-list__sort {
    margin-top: var(--space-3);
}

/* --- plans/edit.html --- */

.plan-edit__upload-form {
    margin-top: var(--space-3);
}

.plan-edit__history-summary {
    cursor: pointer;
    font-weight: 600;
}

.plan-edit__history-list {
    margin-top: var(--space-3);
    padding-left: var(--space-4);
}

.plan-edit__history-item {
    margin-bottom: var(--space-2);
}

.text-secondary {
    color: var(--color-secondary);
}

/* --- plans/edit_section.html --- */

.plan-editor__section-actions {
    margin-bottom: var(--space-4);
    display: flex;
    align-items: center;
    gap: var(--space-3);
    flex-wrap: wrap;
}

/* --- plans/intelligence_explore.html --- */

.intelligence-explore__insight-card {
    margin-bottom: var(--space-4);
    border-left: 4px solid var(--color-accent, #00c6c2);
}

.intelligence-explore__insight-body {
    padding: var(--space-3);
}

.intelligence-explore__insight-title {
    font-size: 1rem;
    margin: 0 0 var(--space-2) 0;
}

.intelligence-explore__insight-category {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-secondary);
}

.intelligence-explore__insight-text {
    margin: var(--space-1) 0 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.intelligence-explore__layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-4);
    align-items: start;
}

.intelligence-explore__messages {
    min-height: 400px;
    max-height: 70vh;
    overflow-y: auto;
    padding: var(--space-3);
}

.intelligence-explore__input-footer {
    border-top: 1px solid var(--color-border, #e0e0e0);
    padding: var(--space-3);
}

.intelligence-explore__input-row {
    display: flex;
    gap: var(--space-2);
    align-items: center;
}

.intelligence-explore__text-input {
    flex: 1;
}

.intelligence-explore__char-count {
    display: block;
    margin-top: var(--space-1);
}

.intelligence-explore__actions-card {
    position: sticky;
    top: 96px;
}

.intelligence-explore__actions-list {
    padding: var(--space-2);
}

.intelligence-explore__actions-items {
    list-style: none;
    padding: 0;
    margin: 0;
}

.intelligence-explore__action-item {
    margin-bottom: var(--space-2);
    padding-bottom: var(--space-2);
    border-bottom: 1px solid var(--color-border, #e0e0e0);
}

.intelligence-explore__action-link {
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    color: var(--color-link, #1d70b8);
    display: block;
}

.intelligence-explore__visited-tag {
    margin-top: var(--space-1);
    display: inline-block;
}

/* --- plans/detail.html --- */

.plan-detail__intelligence-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--space-4);
}

.text-secondary-body {
    color: var(--color-secondary-text, #505a5f);
}

/* Section editor partials — extracted inline styles */

/* Repeating item card spacing */
.repeating-item--mb3 {
    margin-bottom: var(--space-3);
}

.repeating-item--mb4 {
    margin-bottom: var(--space-4);
}

/* Add-item button spacing */
.btn--add-mt2 {
    margin-top: var(--space-2);
}

.btn--add-mt3 {
    margin-top: var(--space-3);
}

/* Section sub-heading spacing */
.section-editor__subheading {
    margin-bottom: var(--space-3);
}

.section-editor__subheading--mt5 {
    margin-top: var(--space-5);
    margin-bottom: var(--space-3);
}

/* Summary / totals card (teal accent) */
.section-summary-card {
    margin-bottom: var(--space-4);
    padding: var(--space-4);
    background: rgba(0, 198, 194, 0.08);
    border-left: 4px solid var(--color-brand, #00c6c2);
}

.section-summary-card__heading {
    margin-bottom: var(--space-3);
}

/* Summary stats grids */
.section-summary-card__stats--3col {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-4);
}

.section-summary-card__stats--4col {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-4);
}

/* Individual stat within summary card */
.section-stat__label {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-secondary-text, #505a5f);
    margin-bottom: var(--space-1);
}

.section-stat__value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-brand, #00c6c2);
}

.section-stat__count {
    font-size: 0.85rem;
    color: var(--color-secondary-text, #505a5f);
}

/* Grand total sub-grid (M / G / T columns within a metric) */
.section-grand-total__metric-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: var(--space-2);
    font-size: 0.9rem;
}

.section-grand-total__prefix {
    color: var(--color-secondary-text, #505a5f);
}

.section-grand-total__value {
    font-weight: 600;
}

.section-grand-total__value--total {
    font-weight: 700;
    color: var(--color-brand, #00c6c2);
}

/* form-group-row grid variants */
.form-group-row--2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-3);
}

.form-group-row--2col-wide {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: var(--space-3);
}

.form-group-row--3col {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: var(--space-3);
}

.form-group-row--3col-wide {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: var(--space-3);
}

.form-group-row--4col {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr;
    gap: var(--space-3);
}

/* Service line / deep dive metric grid (2-col bordered box) */
.metric-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    border: 1px solid var(--color-border, #b1b4b6);
    border-radius: 4px;
    overflow: hidden;
}

.metric-grid__cell {
    padding: var(--space-3);
}

.metric-grid__cell--border-right {
    border-right: 1px solid var(--color-border, #b1b4b6);
}

.metric-grid__cell--border-bottom {
    border-bottom: 1px solid var(--color-border, #b1b4b6);
}

.metric-grid__label {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-secondary-text, #505a5f);
    margin-bottom: var(--space-2);
}

.metric-grid__inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-2);
}

.metric-grid__total-row {
    margin-top: var(--space-2);
    font-weight: 600;
    color: var(--color-text, #052831);
}

/* Deep dive card heading */
.deep-dive-card__heading {
    margin-bottom: var(--space-3);
}

.deep-dive-card__financials-heading {
    margin-top: var(--space-3);
    margin-bottom: var(--space-2);
}

/* Quarter section */
.quarter-section {
    margin-bottom: var(--space-5);
}

.quarter-section__heading {
    margin-bottom: var(--space-3);
}

/* Stakeholder matrix spacing */
.stakeholder-matrix--mt5 {
    margin-top: var(--space-5);
}

/* RAG select (auto width) */
.form-group__select--auto {
    width: auto;
}

/* Financial errors spacing */
.financial-errors--mt3 {
    margin-top: var(--space-3);
}

/* Service line card spacing */
.service-line-card {
    margin-bottom: var(--space-4);
}

.service-line-card__heading {
    margin-bottom: var(--space-3);
}

/* Deal list compact — used in hub account cards and account detail */
.deal-list-compact {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    margin-top: var(--space-3);
}

.deal-list-compact__item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2) 0;
    border-bottom: 1px solid var(--color-border);
}

.deal-list-compact__item:last-child {
    border-bottom: none;
}

.deal-list-compact__client {
    color: var(--color-secondary-text);
    font-size: 14px;
}

.deal-list-compact__date {
    color: var(--color-secondary-text);
    font-size: 14px;
    margin-left: auto;
}

/* Account detail page */
.account-detail__plan {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    flex-wrap: wrap;
}

.account-detail__plan-progress {
    color: var(--color-secondary-text);
    font-size: 14px;
}

.account-detail__plan-actions {
    display: flex;
    gap: var(--space-2);
    margin-top: var(--space-3);
}

/* ============================================================
   Strategic Objectives — Section 9 editor and presentation
   ============================================================ */

.section-editor-objectives {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.objective-card {
    border-left: 4px solid var(--color-border);
    transition: border-color 0.2s;
}

.objective-card[data-status="on_track"] { border-left-color: var(--color-rag-green); }
.objective-card[data-status="at_risk"] { border-left-color: var(--color-rag-red); }
.objective-card[data-status="achieved"] { border-left-color: var(--color-rag-green); }
.objective-card[data-status="abandoned"] { border-left-color: var(--color-border); opacity: 0.6; }

.objective-card__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-3);
    flex-wrap: wrap;
}

.objective-card__title-row {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex: 1;
    min-width: 0;
}

.objective-card__priority {
    font-weight: bold;
    color: var(--color-secondary-text);
    font-size: 14px;
    flex-shrink: 0;
}

.objective-card__title {
    font-size: 18px;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.objective-card__actions {
    display: flex;
    gap: var(--space-1);
    flex-shrink: 0;
}

.objective-card__detail {
    margin-top: var(--space-4);
    padding-top: var(--space-4);
    border-top: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

/* RAG selector */
.rag-selector {
    display: flex;
    gap: var(--space-2);
}

.rag-selector__option {
    cursor: pointer;
}

.rag-selector__input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.rag-selector__input:checked + .rag-selector__label {
    outline: 2px solid var(--color-text);
    outline-offset: 2px;
}

.rag-selector__input:focus-visible + .rag-selector__label {
    outline: 2px solid var(--color-focus);
    outline-offset: 2px;
}

/* KPI fieldset */
.kpi-fieldset {
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: var(--space-4);
}

.kpi-fieldset__legend {
    font-weight: bold;
    font-size: 16px;
    padding: 0 var(--space-2);
}

.kpi-chart-area {
    margin-top: var(--space-3);
}

.kpi-chart {
    display: block;
    max-width: 100%;
    height: auto;
}

.kpi-data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: var(--space-2);
    font-size: 14px;
}

.kpi-data-table th,
.kpi-data-table td {
    padding: var(--space-1) var(--space-2);
    border-bottom: 1px solid var(--color-border);
    text-align: left;
}

.kpi-data-table th {
    font-weight: 600;
    color: var(--color-secondary-text);
}

.kpi-record-form {
    margin-top: var(--space-3);
    padding: var(--space-3);
    background: var(--color-bg-subtle);
    border-radius: var(--radius);
}

.kpi-record-form h4 {
    margin: 0 0 var(--space-2);
    font-size: 14px;
}

/* Milestones */
.milestones-fieldset {
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: var(--space-4);
}

.milestones-fieldset__legend {
    font-weight: bold;
    font-size: 16px;
    padding: 0 var(--space-2);
}

.milestones-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.milestone-item {
    padding: var(--space-3);
    background: var(--color-bg-subtle);
    border-radius: var(--radius);
}

.milestone-item__header {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-2);
}

.milestones-add {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-top: var(--space-3);
}

/* Status tags */
.tag--not-started { background: var(--color-bg-subtle); color: var(--color-secondary-text); }
.tag--on-track { background: #e6f4ea; color: #1a7f37; }
.tag--at-risk { background: #fff3e0; color: #d84315; }
.tag--achieved { background: #e6f4ea; color: #1a7f37; font-style: italic; }
.tag--abandoned { background: var(--color-bg-subtle); color: var(--color-secondary-text); text-decoration: line-through; }
.tag--in-progress { background: #e3f2fd; color: #1565c0; }
.tag--complete { background: #e6f4ea; color: #1a7f37; }
.tag--missed { background: #fce4ec; color: #c62828; }

/* Presentation view */
.objective-summary-card {
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    margin-bottom: var(--space-3);
}

.objective-summary-card__header {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-4);
    cursor: pointer;
    list-style: none;
}

.objective-summary-card__header::-webkit-details-marker {
    display: none;
}

.objective-summary-card__header::before {
    content: "\25B6";
    font-size: 12px;
    transition: transform 0.2s;
}

.objective-summary-card[open] > .objective-summary-card__header::before {
    transform: rotate(90deg);
}

.objective-summary-card__priority {
    font-weight: bold;
    color: var(--color-secondary-text);
}

.objective-summary-card__title {
    flex: 1;
    font-weight: 600;
}

.objective-summary-card__kpi-badge {
    font-size: 14px;
    color: var(--color-secondary-text);
}

.objective-summary-card__detail {
    padding: 0 var(--space-4) var(--space-4);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.objective-summary-card__description {
    color: var(--color-secondary-text);
    line-height: 1.5;
}

.objective-summary-card__owner {
    font-size: 14px;
}

.kpi-progress h4 {
    font-size: 16px;
    margin: 0 0 var(--space-2);
}

.milestones-summary h4 {
    font-size: 16px;
    margin: 0 0 var(--space-2);
}

.milestones-summary__list {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.milestones-summary__item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2);
    background: var(--color-bg-subtle);
    border-radius: var(--radius);
}

.milestones-summary__desc {
    flex: 1;
}

.abandoned-objectives {
    margin-top: var(--space-4);
    padding-top: var(--space-3);
    border-top: 1px solid var(--color-border);
}

.abandoned-objectives__heading {
    font-size: 14px;
    color: var(--color-secondary-text);
    margin: 0 0 var(--space-2);
}

.abandoned-objectives__item {
    padding: var(--space-1) 0;
}

/* Inline select for milestone status */
.form-group__select--inline {
    width: auto;
    min-width: 120px;
    padding: var(--space-1) var(--space-2);
    font-size: 14px;
}

/* 3-column row */
.form-group-row--3col {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-3);
}

@media (max-width: 768px) {
    .form-group-row--3col {
        grid-template-columns: 1fr;
    }
}

/* ---- Objective Wizard ---- */

.wizard-nav {
    margin-bottom: var(--space-4);
}

.wizard-nav__back {
    color: var(--color-link);
    text-decoration: none;
    font-size: 0.875rem;
}

.wizard-nav__back:hover {
    text-decoration: underline;
}

.wizard-steps {
    display: flex;
    gap: var(--space-2);
    list-style: none;
    padding: 0;
    margin: 0 0 var(--space-6) 0;
    counter-reset: step;
}

.wizard-steps__item {
    flex: 1;
    text-align: center;
    position: relative;
}

.wizard-steps__item::after {
    content: '';
    position: absolute;
    top: 16px;
    right: -50%;
    width: 100%;
    height: 2px;
    background: var(--color-border);
    z-index: 0;
}

.wizard-steps__item:last-child::after {
    display: none;
}

.wizard-steps__item--complete::after {
    background: var(--color-primary);
}

.wizard-steps__link {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-1);
    text-decoration: none;
    color: var(--color-secondary-text);
    position: relative;
    z-index: 1;
}

a.wizard-steps__link {
    color: var(--color-primary);
}

a.wizard-steps__link:hover {
    text-decoration: underline;
}

.wizard-steps__number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--color-border);
    color: var(--color-secondary-text);
    font-weight: 600;
    font-size: 0.875rem;
}

.wizard-steps__item--active .wizard-steps__number {
    background: var(--color-primary);
    color: white;
}

.wizard-steps__item--complete .wizard-steps__number {
    background: var(--color-rag-green);
    color: white;
}

.wizard-steps__label {
    font-size: 0.75rem;
    font-weight: 500;
}

.wizard-content {
    max-width: 1400px;
}

/* Two-column layout for wizard step 1 */
.wizard-two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-4);
    align-items: start;
}

.wizard-two-col__input,
.wizard-two-col__coach {
    min-width: 0;
}

@media (max-width: 900px) {
    .wizard-two-col {
        grid-template-columns: 1fr;
    }
}

.wizard-actions {
    display: flex;
    gap: var(--space-3);
    justify-content: flex-end;
    margin-top: var(--space-6);
    padding-top: var(--space-4);
    border-top: 1px solid var(--color-border);
}

/* Wizard AI panel */
.wizard-ai-panel {
    margin-top: var(--space-4);
}

.wizard-ai-messages {
    margin: var(--space-2) 0;
}

.wizard-ai-chat {
    max-height: 400px;
    overflow-y: auto;
    padding: var(--space-2);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    margin-bottom: var(--space-2);
}

.wizard-ai-msg {
    padding: var(--space-2);
    margin-bottom: var(--space-2);
    border-radius: var(--radius);
    white-space: pre-wrap;
    font-size: 0.875rem;
    line-height: 1.5;
}

.wizard-ai-msg--user {
    background: var(--color-background-light);
    margin-left: var(--space-6);
}

.wizard-ai-msg--assistant {
    background: var(--color-primary-light, #e8f4fd);
    margin-right: var(--space-6);
}

.wizard-ai-msg--assistant p {
    margin: 0 0 var(--space-2) 0;
}

.wizard-ai-msg--assistant p:last-child {
    margin-bottom: 0;
}

.wizard-ai-msg--assistant ul,
.wizard-ai-msg--assistant ol {
    margin: 0 0 var(--space-2) var(--space-4);
    padding: 0;
}

.wizard-ai-msg--assistant strong {
    font-weight: 600;
}

.wizard-ai-msg--system {
    background: var(--color-rag-amber-light, #fff3cd);
    font-style: italic;
}

.wizard-ai-reply {
    display: flex;
    gap: var(--space-2);
}

.wizard-ai-reply .form-input {
    flex: 1;
}

/* KPI form layout */
.kpi-fieldset {
    margin-bottom: var(--space-2);
    padding: var(--space-3);
}

.form-row {
    display: flex;
    gap: var(--space-3);
    align-items: flex-end;
}

.form-group--flex {
    flex: 2;
}

.form-group--small {
    flex: 1;
}

@media (max-width: 768px) {
    .form-row {
        flex-direction: column;
    }
}

/* Milestone fieldsets */
.milestone-fieldset {
    margin-bottom: var(--space-3);
    padding: var(--space-3) 0;
    border: none;
}

.milestone-fieldset--divided {
    border-top: 2px solid var(--color-border);
    padding-top: var(--space-4);
}

.milestone-fieldset legend {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: var(--space-2);
}

/* Target state repeating list */
.target-state-item {
    display: flex;
    gap: var(--space-2);
    align-items: center;
    margin-bottom: var(--space-1);
}

.target-state-item .form-group__input {
    flex: 1;
}

/* Review cards */
.review-card {
    margin-bottom: var(--space-3);
    padding: var(--space-4);
}

.review-card__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-2);
}

.review-card__dl {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: var(--space-1) var(--space-3);
}

.review-card__dl dt {
    font-weight: 600;
    color: var(--color-secondary-text);
}

.review-milestone {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) 0;
    border-bottom: 1px solid var(--color-border);
}

.review-milestone:last-child {
    border-bottom: none;
}

.review-milestone__criteria {
    margin: var(--space-1) 0 0 var(--space-6);
    padding: 0;
    font-size: 0.875rem;
    color: var(--color-secondary-text);
}

.review-milestone__criteria li {
    margin-bottom: 2px;
}

/* Review milestone cards (step 4) */
.review-milestone-card {
    padding: var(--space-3) 0;
}

.review-milestone-card--divided {
    border-top: 1px solid var(--color-border);
}

.review-milestone-card__header {
    display: flex;
    gap: var(--space-1);
    margin-bottom: var(--space-1);
}

.review-milestone-card__desc {
    font-size: 0.9375rem;
    font-weight: 500;
    margin: 0 0 var(--space-1) 0;
}

.review-milestone-card__label {
    font-size: 0.8125rem;
    color: var(--color-secondary-text);
    margin: var(--space-1) 0 0 0;
}

/* ---- Kanban Board (Swim Lanes) ---- */

.swim-lane {
    margin-bottom: var(--space-6);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    overflow: hidden;
}

.swim-lane__header {
    padding: var(--space-3) var(--space-4);
    background: var(--color-background-light);
    border-bottom: 1px solid var(--color-border);
}

.swim-lane__title-row {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    flex-wrap: wrap;
}

.swim-lane__title {
    font-size: 1rem;
    margin: 0;
}

.swim-lane__title-link {
    color: var(--color-text);
    text-decoration: none;
}

.swim-lane__title-link:hover {
    color: var(--color-link);
    text-decoration: underline;
}

.swim-lane__badges {
    display: flex;
    gap: var(--space-1);
}

.swim-lane__meta {
    display: flex;
    gap: var(--space-3);
    font-size: 0.75rem;
    color: var(--color-secondary-text);
    margin-top: var(--space-1);
}

.kanban-board {
    display: flex;
    gap: 0;
    overflow-x: auto;
    min-height: 120px;
}

.kanban-column {
    flex: 1;
    min-width: 180px;
    padding: var(--space-2);
    border-right: 1px solid var(--color-border);
}

.kanban-column:last-child {
    border-right: none;
}

.kanban-column__header {
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-secondary-text);
    margin-bottom: var(--space-2);
    padding-bottom: var(--space-1);
    border-bottom: 2px solid var(--color-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.kanban-column__count {
    background: var(--color-border);
    border-radius: 10px;
    padding: 0 6px;
    font-size: 0.625rem;
}

.kanban-column__empty {
    min-height: 60px;
}

.kanban-card {
    background: white;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: var(--space-2);
    margin-bottom: var(--space-2);
}

.kanban-card__quarter {
    margin-bottom: var(--space-1);
}

a.kanban-card__title {
    display: block;
    font-size: 0.8125rem;
    line-height: 1.4;
    margin: var(--space-1) 0;
    color: var(--color-link);
    text-decoration: none;
}

a.kanban-card__title:hover {
    text-decoration: underline;
}

.kanban-card__target {
    font-size: 0.75rem;
    color: var(--color-secondary-text);
    margin-bottom: var(--space-1);
}

.kanban-card__status-select {
    width: 100%;
    font-size: 0.75rem;
    padding: 2px 4px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-background-light);
}

@media (max-width: 768px) {
    .kanban-board {
        flex-direction: column;
    }
    .kanban-column {
        border-right: none;
        border-bottom: 1px solid var(--color-border);
    }
}

/* ---- Modal ---- */

.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal[hidden] {
    display: none;
}

.modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
}

.modal__content {
    position: relative;
    background: white;
    border-radius: var(--radius);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.2);
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

.modal__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-4);
    border-bottom: 1px solid var(--color-border);
}

.modal__title {
    font-size: 1.125rem;
    margin: 0;
}

.modal__close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0 var(--space-1);
    color: var(--color-secondary-text);
}

.modal__close:hover {
    color: var(--color-text);
}

.modal__body {
    padding: var(--space-4);
    overflow-y: auto;
    flex: 1;
}

.modal__footer {
    padding: var(--space-3) var(--space-4);
    border-top: 1px solid var(--color-border);
    display: flex;
    gap: var(--space-2);
    justify-content: flex-end;
}

/* Button-as-link reset — preserves text appearance while using native <button> */
.btn--reset {
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    cursor: pointer;
    font: inherit;
    text-align: left;
}

/* Button variants of swim-lane title link and kanban card title */
button.swim-lane__title-link {
    color: var(--color-text);
    text-decoration: none;
}

button.swim-lane__title-link:hover {
    color: var(--color-link);
    text-decoration: underline;
}

button.kanban-card__title {
    display: block;
    font-size: 0.8125rem;
    line-height: 1.4;
    margin: var(--space-1) 0;
    color: var(--color-link);
    text-decoration: none;
}

button.kanban-card__title:hover {
    text-decoration: underline;
}

/* Modal backdrop as button — inherits position/background from .modal__backdrop */
button.modal__backdrop {
    border: none;
    padding: 0;
    cursor: default;
}
