:root {
    --color-ink: #28252a;
    --color-muted: #68616a;
    --color-surface: #fffdfa;
    --color-surface-soft: #f7f2ee;
    --color-border: #ddd4ce;
    --color-primary: #7b1734;
    --color-primary-hover: #5f1028;
    --color-accent: #087f83;
    --color-accent-soft: #e3f3f2;
    --color-danger: #a12636;
    --color-danger-soft: #fff0f1;
    --color-warning: #895d00;
    --color-warning-soft: #fff6d8;
    --color-success: #19633d;
    --color-success-soft: #e9f6ee;
    --color-info: #215d78;
    --color-info-soft: #eaf5fa;
    --shadow-panel: 0 18px 50px rgba(30, 18, 23, 0.18);
    --shadow-card: 0 4px 14px rgba(47, 30, 37, 0.08);
    --radius: 7px;
}

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

html {
    min-height: 100%;
    background: #241d21;
}

body {
    min-height: 100vh;
    margin: 0;
    padding: 1.5rem;
    color: var(--color-ink);
    background-color: #241d21;
    background-image: url("../images/stage-background.jpg");
    background-repeat: no-repeat;
    background-position: center top;
    background-size: cover;
    background-attachment: fixed;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.5;
}

main {
    width: min(100%, 1180px);
    min-width: 0;
    min-height: calc(100vh - 5rem);
    margin: 0 auto;
    padding: 1.75rem 2rem 2.25rem;
    overflow-x: auto;
    background: rgba(255, 253, 250, 0.97);
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: var(--radius);
    box-shadow: var(--shadow-panel);
}

main.layout-narrow {
    width: min(100%, 880px);
}

main.layout-medium {
    width: min(100%, 1180px);
}

main.layout-wide {
    width: min(100%, clamp(1480px, 82vw, 1680px));
}

main.layout-full {
    width: 100%;
    max-width: none;
}

/* Cadre authentifié unique : la navigation et les titres gardent les mêmes proportions sur tout le site. */
.authenticated-page main.layout-narrow,
.authenticated-page main.layout-medium,
.authenticated-page main.layout-wide,
.authenticated-page main.layout-full {
    width: min(100%, clamp(1480px, 82vw, 1680px));
    max-width: 1680px;
}

.public-page main {
    min-height: 0;
    margin-top: 8vh;
}

.public-page main.layout-narrow {
    width: min(100%, 880px);
}

footer {
    width: min(100%, 1680px);
    margin: 0.75rem auto 0;
    color: #fff;
    text-align: right;
    text-shadow: 0 1px 3px #000;
}

h1,
h2,
h3 {
    color: #31242a;
    line-height: 1.2;
}

h1 {
    margin: 0 0 1.25rem;
    font-size: clamp(1.75rem, 2.5vw, 2.3rem);
    font-weight: 750;
}

h2 {
    margin: 1.75rem 0 1rem;
    font-size: 1.3rem;
}

h3 {
    font-size: 1.05rem;
}

.diagnostic-notice,
.diagnostic-footer-note {
    padding: 0.9rem 1rem;
    background: var(--color-info-soft);
    border: 1px solid #bedce8;
    border-radius: var(--radius);
}

.diagnostic-global {
    max-width: 760px;
    margin: 1rem auto;
    padding: 0.8rem 1rem;
    border: 1px solid currentColor;
    border-radius: var(--radius);
    text-align: center;
}

.diagnostic-global--ok {
    color: var(--color-success);
    background: var(--color-success-soft);
}

.diagnostic-global--warning {
    color: var(--color-warning);
    background: var(--color-warning-soft);
}

.diagnostic-global--error {
    color: var(--color-danger);
    background: var(--color-danger-soft);
}

.page-heading-actions {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    justify-content: space-between;
}

.page-heading-actions h1 {
    margin-bottom: 0.25rem;
}

.page-heading-actions p {
    margin-top: 0;
}

.diagnostic-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.8rem;
    max-width: 760px;
    margin: 1.25rem auto;
}

.diagnostic-summary__item {
    display: flex;
    align-items: baseline;
    gap: 0.6rem;
    padding: 0.9rem 1rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
}

.diagnostic-summary__item strong {
    font-size: 1.7rem;
}

.diagnostic-summary__item--ok {
    color: var(--color-success);
    background: var(--color-success-soft);
}

.diagnostic-summary__item--warning {
    color: var(--color-warning);
    background: var(--color-warning-soft);
}

.diagnostic-summary__item--error {
    color: var(--color-danger);
    background: var(--color-danger-soft);
}

.diagnostic-section {
    margin-top: 1.5rem;
}

.diagnostic-section h2 {
    margin-bottom: 0.65rem;
}

.diagnostic-table {
    width: 100%;
}

.diagnostic-table__status {
    width: 8.5rem;
    white-space: nowrap;
}

.diagnostic-status {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border: 1px solid currentColor;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 700;
}

.diagnostic-status--ok {
    color: var(--color-success);
    background: var(--color-success-soft);
}

.diagnostic-status--warning {
    color: var(--color-warning);
    background: var(--color-warning-soft);
}

.diagnostic-status--error {
    color: var(--color-danger);
    background: var(--color-danger-soft);
}

.diagnostic-check-list {
    display: grid;
    gap: 0.65rem;
    padding: 0;
    list-style: none;
}

.diagnostic-check-list li {
    padding: 0.7rem;
    background: var(--color-surface-soft);
    border: 1px solid var(--color-border);
    border-radius: 5px;
}

a {
    color: var(--color-primary);
    text-underline-offset: 0.18em;
    text-decoration-thickness: 1px;
}

a:hover {
    color: var(--color-primary-hover);
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 3px solid rgba(8, 127, 131, 0.35);
    outline-offset: 2px;
}

.app-header {
    margin: -1.75rem -2rem 2rem;
    padding: 1rem 1.25rem;
    color: #fff;
    background: #30282d;
    border-radius: var(--radius) var(--radius) 0 0;
}

.app-header__top,
.app-header__tools,
.nav-links,
.nav-group {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
}

.app-header__top {
    gap: 0.8rem 1.25rem;
}

.app-brand {
    display: inline-flex;
    flex: 0 0 auto;
    gap: 0.65rem;
    align-items: center;
    color: #fff;
    font-size: 1.05rem;
    font-weight: 750;
    text-decoration: none;
}

.app-brand:hover {
    color: #fff;
}

.app-brand__mark {
    display: grid;
    width: 2rem;
    height: 2rem;
    place-items: center;
    color: #fff;
    background: var(--color-primary);
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 6px;
}

.nav-links {
    flex: 1 1 650px;
    gap: 0.3rem;
}

.nav-group {
    gap: 0.3rem;
}

.nav-group--secondary {
    padding-left: 0.35rem;
    border-left: 1px solid rgba(255, 255, 255, 0.2);
}

.nav-link {
    display: inline-flex;
    align-items: center;
    min-height: 2.15rem;
    padding: 0.38rem 0.58rem;
    color: #f8f4f6;
    border-radius: 5px;
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
}

.nav-link:hover,
.nav-link.active {
    color: #fff;
    background: var(--color-primary);
}

.app-header__tools {
    gap: 0.6rem;
    margin-top: 0.85rem;
}

.global-search {
    display: flex;
    flex: 1 1 520px;
    gap: 0.45rem;
    margin: 0;
}

.global-search input[type="search"] {
    min-width: 0;
    margin: 0;
    color: var(--color-ink);
    background: #fff;
    border-color: transparent;
}

.logout-link {
    display: inline-flex;
    min-height: 2.55rem;
    padding: 0.55rem 0.8rem;
    align-items: center;
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.42);
    border-radius: 6px;
    font-weight: 650;
    text-decoration: none;
}

.logout-link:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.12);
}

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

button,
.button,
input[type="submit"],
input[type="button"] {
    display: inline-flex;
    min-height: 2.55rem;
    padding: 0.56rem 0.9rem;
    align-items: center;
    justify-content: center;
    color: #fff;
    background: var(--color-primary);
    border: 1px solid var(--color-primary);
    border-radius: 6px;
    box-shadow: 0 2px 5px rgba(62, 15, 31, 0.16);
    font: inherit;
    font-weight: 700;
    line-height: 1.2;
    cursor: pointer;
}

button:hover,
.button:hover,
input[type="submit"]:hover,
input[type="button"]:hover {
    color: #fff;
    background: var(--color-primary-hover);
    border-color: var(--color-primary-hover);
}

.button-secondary,
.filter-actions a {
    color: var(--color-primary);
    background: #fff;
    border-color: var(--color-border);
}

.button-danger,
button.danger,
form[action*="delete"] button,
form[action*="delete"] input[type="submit"] {
    color: #fff;
    background: var(--color-danger);
    border-color: var(--color-danger);
}

.button-document,
a[href*="stage_document_download"] {
    color: #075e62;
    background: var(--color-accent-soft);
    border-color: #a7d6d4;
}

.button-back {
    color: var(--color-ink);
    background: #fff;
    border-color: var(--color-border);
}

button.button-secondary:hover,
a.button-secondary:hover,
button.button-back:hover,
a.button-back:hover {
    color: var(--color-primary);
    background: #f6efec;
    border-color: #cbbbc2;
}

main > p > a[href*="_form.php"],
main > p > a[href="stage_form.php"] {
    display: inline-flex;
    min-height: 2.4rem;
    padding: 0.5rem 0.8rem;
    align-items: center;
    color: #fff;
    background: var(--color-primary);
    border: 1px solid var(--color-primary);
    border-radius: 6px;
    font-weight: 700;
    text-decoration: none;
}

label {
    color: #40383e;
    font-weight: 680;
}

input:not([type="checkbox"]):not([type="radio"]),
select,
textarea {
    width: 100%;
    min-height: 2.55rem;
    padding: 0.58rem 0.68rem;
    color: var(--color-ink);
    background: #fff;
    border: 1px solid #bdb3b8;
    border-radius: 5px;
    font: inherit;
}

textarea {
    min-height: 6rem;
    resize: vertical;
}

input:not([type="checkbox"]):not([type="radio"]):hover,
select:hover,
textarea:hover {
    border-color: #8f8289;
}

input:disabled,
select:disabled,
textarea:disabled {
    color: #777;
    background: #eeeae7;
    cursor: not-allowed;
}

input[type="checkbox"],
input[type="radio"] {
    width: 1rem;
    height: 1rem;
    accent-color: var(--color-primary);
}

form:not(.global-search) {
    padding: 1rem;
    background: var(--color-surface-soft);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
}

form.stage-form {
    max-width: 1100px;
    padding: 0;
    background: transparent;
    border: 0;
}

.entity-form {
    max-width: 820px;
}

.identity {
    max-width: 1100px;
}

form:not(.global-search) label {
    margin-top: 0;
}

fieldset {
    margin: 0 0 1.25rem;
    padding: 1.1rem;
    background: rgba(255, 255, 255, 0.68);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
}

legend {
    padding: 0 0.45rem;
    color: var(--color-primary);
    font-weight: 750;
}

.field {
    display: grid;
    gap: 0.35rem;
    margin-bottom: 1rem;
}

form:not(.global-search) > label,
fieldset > label {
    display: block;
    margin: 0.9rem 0 0.32rem;
}

form:not(.global-search) > label:first-child,
fieldset > label:first-of-type {
    margin-top: 0;
}

.filter-form > label {
    margin: 0;
}

.form-actions,
.filter-actions,
.page-actions,
.panel form {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
    align-items: center;
}

.page-actions {
    margin: 0 0 1.25rem;
}

form.inline-action-form {
    display: inline-flex;
    width: auto;
    margin: 0.2rem 0.35rem 0.2rem 0;
    padding: 0;
    background: transparent;
    border: 0;
    border-radius: 0;
}

.filter-actions {
    margin-top: 0.85rem;
}

.filter-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(175px, 1fr));
    gap: 0.8rem;
    align-items: end;
    margin-bottom: 1.25rem;
}

.filter-form .filter-actions {
    margin-top: 0;
}

.filter-actions a {
    display: inline-flex;
    min-height: 2.55rem;
    padding: 0.55rem 0.8rem;
    align-items: center;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    font-weight: 650;
    text-decoration: none;
}

.table-wrap,
.table-container {
    width: 100%;
    margin-top: 1rem;
    overflow-x: auto;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
}

/* Centre un tableau selon sa largeur réelle, sans neutraliser le défilement si elle dépasse le bloc. */
.table-wrap.table-wrap-centered {
    width: fit-content;
    max-width: 100%;
    margin-right: auto;
    margin-left: auto;
}

body main table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
}

.table-wrap table,
.table-container table {
    width: max-content;
    min-width: 100%;
    table-layout: auto;
    border: 0;
    border-radius: 0;
}

body main table:not(.month-grid) {
    min-width: 680px;
}

body main th,
body main td {
    padding: 0.7rem 0.75rem;
    border: 0;
    border-right: 1px solid #e4ddda;
    border-bottom: 1px solid #e4ddda;
    text-align: left;
    vertical-align: top;
}

body main th:last-child,
body main td:last-child {
    border-right: 0;
}

body main tbody tr:last-child td {
    border-bottom: 0;
}

body main th {
    max-width: none;
    overflow-wrap: normal;
    word-break: keep-all;
    white-space: nowrap;
    color: #3c3036;
    background: #eee7e3;
    font-size: 0.86rem;
    letter-spacing: 0.01em;
    text-transform: uppercase;
}

body main td {
    max-width: none;
    overflow-wrap: normal;
    word-break: normal;
    white-space: normal;
}

.table-container .table-stages {
    width: 100%;
    min-width: 0;
    table-layout: fixed;
    font-size: 0.9rem;
}

.table-stages .col-select {
    width: 38px;
}

.table-stages .col-date {
    width: 82px;
}

.table-stages .col-student {
    width: 180px;
}

.table-stages .col-department {
    width: 68px;
}

.table-stages .col-company {
    width: 240px;
}

.table-stages .col-city {
    width: 110px;
}

.table-stages .col-period {
    width: 135px;
}

.table-stages .col-state {
    width: 110px;
}

.table-stages .col-actions {
    width: 160px;
}

.table-stages th,
.table-stages td {
    padding: 0.5rem 0.52rem;
}

.table-stages td.col-select,
.table-stages td.col-date,
.table-stages td.col-department {
    white-space: nowrap;
}

.table-stages th.col-state,
.table-stages td.col-state {
    overflow-wrap: normal;
    word-break: normal;
    white-space: normal;
}

.table-stages th.col-select,
.table-stages td.col-select {
    padding-right: 0.3rem;
    padding-left: 0.3rem;
    text-align: center;
    vertical-align: middle;
}

.table-stages td.col-period {
    line-height: 1.25;
    overflow-wrap: anywhere;
    white-space: normal;
}

.table-stages td.col-student,
.table-stages td.col-company,
.table-stages td.col-city {
    overflow-wrap: normal;
    word-break: normal;
}

.table-stages td.table-actions {
    white-space: normal;
}

body main .table-stages td.table-actions a {
    margin: 0 0.16rem 0.16rem 0;
    padding: 0.23rem 0.36rem;
    font-size: 0.79rem;
}

form.stage-bulk-delete-form {
    margin: 0;
    padding: 0;
    background: transparent;
    border: 0;
}

.bulk-delete-toolbar {
    display: flex;
    gap: 0.75rem;
    margin: 0.5rem 0 0.75rem;
    align-items: center;
    justify-content: flex-end;
}

.bulk-delete-toolbar span {
    color: var(--color-muted);
    font-size: 0.9rem;
}

.stage-bulk-delete-form .stage-table-container {
    margin-top: 0;
}

.bulk-confirmation-table table {
    width: 100%;
    min-width: 760px;
    table-layout: auto;
}

/* Listes principales : largeur fluide, colonnes utiles souples et secondaires compactes. */
.archive-filters,
.audit-filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 0.75rem;
    align-items: end;
}

.archive-summary,
.audit-summary {
    color: var(--color-muted);
}

.archive-table-container,
.audit-table-container {
    width: 100%;
}

.archive-table-container .table-archives,
.audit-table-container .table-audit {
    width: 100%;
    min-width: 0;
    table-layout: fixed;
}

.table-archives .col-date {
    width: 9rem;
}

.table-archives .col-student {
    width: 17%;
}

.table-archives .col-status {
    width: 9rem;
}

.table-archives .col-promotion {
    width: 8rem;
}

.table-archives .col-company {
    width: 27%;
}

.table-archives .col-state {
    width: 10rem;
}

.table-archives .col-actions {
    width: 8rem;
}

.table-archives td.col-student,
.table-archives td.col-company,
.table-archives td.col-state {
    overflow-wrap: normal;
    word-break: normal;
    white-space: normal;
}

.archive-status {
    display: inline-flex;
    padding: 0.18rem 0.42rem;
    background: var(--color-surface-soft);
    border: 1px solid var(--color-border);
    border-radius: 4px;
}

.table-audit .col-date {
    width: 10.5rem;
}

.table-audit .col-user,
.table-audit .col-role,
.table-audit .col-module,
.table-audit .col-action,
.table-audit .col-target {
    width: 9rem;
}

.table-audit .col-summary {
    width: auto;
}

.table-audit .col-result {
    width: 6.5rem;
}

.table-audit td {
    overflow-wrap: normal;
    word-break: normal;
    white-space: normal;
}

.table-audit td.col-target,
.table-audit td.col-summary {
    overflow-wrap: anywhere;
}

.result {
    font-weight: 700;
}

.result.error {
    color: var(--color-danger);
}

.result.success {
    color: var(--color-success);
}

.enterprise-table-container,
.calendar-table-container,
.calendar-month-container {
    width: 100%;
}

.enterprise-table-container .table-enterprises,
.calendar-table-container .table-calendar {
    width: 100%;
    min-width: 0;
    table-layout: fixed;
}

.table-enterprises .col-company {
    width: 18%;
}

.table-enterprises .col-activity {
    width: 16%;
}

.table-enterprises .col-manager {
    width: 12%;
}

.table-enterprises .col-city {
    width: 9%;
}

.table-enterprises .col-phone {
    width: 9rem;
}

.table-enterprises .col-email {
    width: 15%;
}

.table-enterprises .col-internship {
    width: 6.5rem;
}

.table-enterprises .col-actions {
    width: 13rem;
}

.table-enterprises td {
    overflow-wrap: normal;
    word-break: normal;
    white-space: normal;
}

.table-enterprises td.col-email {
    overflow-wrap: anywhere;
}

.calendar-filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.75rem;
    align-items: end;
}

.current-only {
    display: flex;
    gap: 0.4rem;
    align-items: center;
}

.current-only input {
    width: auto;
    margin: 0;
}

.calendar-table-container .table-calendar .col-student {
    width: 16%;
}

.calendar-table-container .table-calendar .col-company {
    width: 22%;
}

.calendar-table-container .table-calendar .col-city {
    width: 13%;
}

.calendar-table-container .table-calendar .col-period {
    width: auto;
}

.calendar-table-container .table-calendar .col-state {
    width: 11rem;
}

.calendar-table-container .table-calendar .col-actions {
    width: 7rem;
}

.table-calendar td {
    overflow-wrap: normal;
    word-break: normal;
    white-space: normal;
}

.calendar-month-container .month-grid {
    width: 100%;
    min-width: 900px;
    table-layout: fixed;
}

.month-grid .outside {
    color: var(--color-muted);
    background: var(--color-surface-soft);
}

.month-grid .today {
    outline: 2px solid var(--color-success);
    outline-offset: -2px;
}

/* Règles communes aux listes métier et aux référentiels. */
.table-wrap.table-wrap-compact {
    width: min(100%, 1180px);
    margin-right: auto;
    margin-left: auto;
}

.table-wrap table.table-balanced,
.table-container table.table-balanced {
    width: 100%;
    min-width: 0;
    table-layout: fixed;
}

.table-wrap table.table-compact,
.table-container table.table-compact {
    font-size: 0.9rem;
}

.table-balanced th,
.table-balanced td,
.table-compact th,
.table-compact td {
    padding: 0.52rem 0.58rem;
    overflow-wrap: normal;
    word-break: normal;
    white-space: normal;
}

.table-balanced .col-description {
    width: 34%;
}

.table-balanced .col-commentaire {
    width: 28%;
}

.table-balanced .col-actions,
.table-compact .col-actions {
    width: 10.5rem;
    white-space: normal;
}

.table-balanced .col-select,
.table-compact .col-select {
    width: 2.75rem;
    text-align: center;
}

.table-balanced .col-count,
.table-compact .col-count,
.table-balanced .col-status,
.table-compact .col-status {
    width: 7.5rem;
}

.table-balanced td.col-actions a,
.table-compact td.col-actions a {
    display: inline-flex;
    margin: 0.08rem 0.18rem 0.08rem 0;
    padding: 0.24rem 0.4rem;
    font-size: 0.82rem;
}

.table-cell-muted {
    color: var(--color-muted);
}

form.reference-bulk-form {
    margin: 0;
    padding: 0;
    background: transparent;
    border: 0;
}

.reference-bulk-actions {
    display: grid;
    grid-template-columns: minmax(13rem, 0.7fr) minmax(16rem, 1fr) auto;
    gap: 0.75rem;
    margin: 0.75rem 0;
    align-items: end;
}

@media (max-width: 900px) {
    .table-wrap table.table-balanced {
        min-width: 760px;
    }

    .table-wrap .company-classification-table {
        min-width: 900px;
    }

    .reference-bulk-actions {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 1100px) {
    .table-container .table-stages {
        min-width: 1125px;
    }

    .archive-table-container .table-archives {
        min-width: 900px;
    }

    .audit-table-container .table-audit {
        min-width: 1050px;
    }

    .calendar-table-container .table-calendar {
        min-width: 900px;
    }
}

@media (max-width: 1300px) {
    .enterprise-table-container .table-enterprises {
        min-width: 1180px;
    }
}

.sort-link {
    display: inline;
    color: inherit;
    text-decoration: none;
}

.sort-link:hover,
.sort-link--active {
    color: var(--color-primary);
    text-decoration: underline;
}

.sort-link__indicator {
    margin-left: 0.35rem;
    color: var(--color-primary);
    font-size: 0.75em;
}

body main tbody tr:nth-child(even) td {
    background: #fbf8f6;
}

body main tbody tr:hover td {
    background: #eef8f7;
}

body main td:last-child a {
    display: inline-flex;
    margin: 0.1rem 0.25rem 0.1rem 0;
    padding: 0.26rem 0.45rem;
    align-items: center;
    color: var(--color-primary);
    background: #fff;
    border: 1px solid #d7c8ce;
    border-radius: 5px;
    font-size: 0.88rem;
    font-weight: 650;
    line-height: 1.2;
    text-decoration: none;
}

body main td:last-child a[href*="delete"] {
    color: var(--color-danger);
    background: var(--color-danger-soft);
    border-color: #edc4ca;
}

.table-action,
body main td:last-child a[href*="stage_document_download"] {
    display: inline-flex;
    padding: 0.26rem 0.45rem;
    color: var(--color-primary);
    background: #fff;
    border: 1px solid #d7c8ce;
    border-radius: 5px;
    font-size: 0.88rem;
    font-weight: 650;
    line-height: 1.2;
    text-decoration: none;
}

.table-action--danger {
    color: var(--color-danger) !important;
    background: var(--color-danger-soft) !important;
    border-color: #edc4ca !important;
}

.danger-zone {
    border-color: #e4aeb6;
    background: var(--color-danger-soft);
}

body main td:last-child a[href*="stage_document_download"] {
    color: #075e62;
    background: var(--color-accent-soft);
    border-color: #a7d6d4;
}

.panel,
.detail-section,
.dashboard-section,
.crm-section,
.calendar-section,
.preview-section,
.search-category,
.mail-field,
.mail-body {
    margin: 1.25rem 0;
    padding: 1.1rem;
    background: rgba(255, 255, 255, 0.82);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
}

.panel > h2:first-child,
.detail-section > h2:first-child,
.dashboard-section > h2:first-child,
.crm-section > h2:first-child,
.calendar-section > h2:first-child,
.preview-section > h2:first-child,
.search-category > h2:first-child {
    margin-top: 0;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.detail-section {
    min-width: 0;
    margin: 0;
    padding: 1.1rem;
}

.detail-section dl {
    display: block;
    margin-bottom: 0;
}

.detail-section dt {
    border-bottom: 0;
}

.indicators,
.preview-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(165px, 1fr));
    gap: 0.8rem;
}

.indicator,
.preview-indicator {
    min-height: 7rem;
    padding: 1rem;
    background: #fff;
    border: 1px solid var(--color-border);
    border-top: 4px solid var(--color-accent);
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
}

.indicator strong,
.preview-indicator strong {
    display: block;
    color: var(--color-primary);
    font-size: 1.65rem;
}

.indicator span,
.preview-indicator span {
    display: block;
    margin-top: 0.25rem;
    color: var(--color-muted);
}

.synthesis-distributions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem 1.5rem;
    margin-top: 1.25rem;
}

.synthesis-distribution {
    min-width: 0;
    padding-top: 0.8rem;
    border-top: 2px solid var(--color-border);
}

.synthesis-distribution h3 {
    margin-top: 0;
}

.distribution-list,
.synthesis-alerts {
    padding: 0;
    margin: 0;
    list-style: none;
}

.distribution-list li {
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    padding: 0.45rem 0;
    border-bottom: 1px solid var(--color-border);
}

.distribution-list span {
    min-width: 0;
    overflow-wrap: anywhere;
}

.synthesis-alerts li {
    margin: 0.65rem 0;
}

.reference-suggestions {
    padding-left: 1rem;
    margin: 0;
}

.reference-suggestions li + li {
    margin-top: 0.45rem;
}

.cleanup-value {
    padding: 0.75rem;
    overflow-wrap: anywhere;
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: 5px;
}

.message,
.error,
.success,
.warning,
.info,
.field-error,
.settings-note {
    margin: 0.85rem 0;
    padding: 0.75rem 0.9rem;
    border: 1px solid transparent;
    border-left-width: 4px;
    border-radius: 5px;
    font-weight: 650;
}

.message,
.success {
    color: var(--color-success);
    background: var(--color-success-soft);
    border-color: #a7d5b9;
}

.error,
.field-error,
.warning-list {
    color: var(--color-danger);
}

.error,
.field-error {
    background: var(--color-danger-soft);
    border-color: #edbdc4;
}

.warning {
    color: var(--color-warning);
    background: var(--color-warning-soft);
    border-color: #e4cb82;
}

.info,
.settings-note {
    color: var(--color-info);
    background: var(--color-info-soft);
    border-color: #afd5e5;
}

.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.35rem 0.8rem;
    margin: 0.9rem 0;
}

.regulatory-prefilled {
    margin-top: 1rem;
    padding: 0.85rem 1rem;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
}

.regulatory-prefilled summary {
    cursor: pointer;
    color: var(--color-primary);
    font-weight: 750;
}

.student-form-intro {
    max-width: 980px;
}

.form-secondary-details {
    margin-top: 0.85rem;
    padding: 0.75rem 0.9rem;
    background: rgba(255, 255, 255, 0.58);
    border: 1px dashed var(--color-border);
    border-radius: var(--radius);
}

.form-secondary-details summary {
    cursor: pointer;
    color: var(--color-primary);
    font-weight: 750;
}

dl:not(.mail-field) {
    display: grid;
    grid-template-columns: minmax(150px, 230px) minmax(0, 1fr);
    max-width: 980px;
    margin: 1rem 0;
    overflow: hidden;
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
}

dl:not(.mail-field) dt,
dl:not(.mail-field) dd {
    margin: 0;
    padding: 0.7rem 0.85rem;
    border-bottom: 1px solid #e5dedb;
}

body main .detail-section dl {
    max-width: none;
    margin-bottom: 0;
    background: transparent;
    border: 0;
    border-radius: 0;
}

dl:not(.mail-field) dt {
    color: #463940;
    background: #f3eeeb;
    font-weight: 720;
}

dl:not(.mail-field) dd {
    min-width: 0;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

.admin-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin: 1rem 0 1.5rem;
}

.admin-tabs a {
    padding: 0.5rem 0.75rem;
    color: var(--color-primary);
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: 5px;
    font-weight: 650;
    text-decoration: none;
}

body main .admin-tabs a.active {
    color: #fff;
    background: var(--color-primary);
    border-color: var(--color-primary);
}

.subnav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.subnav a {
    display: inline-flex;
    padding: 0.38rem 0.62rem;
    color: var(--color-primary);
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: 5px;
    font-weight: 650;
    text-decoration: none;
}

.subnav a.active {
    color: #fff;
    background: var(--color-primary);
    border-color: var(--color-primary);
}

.module-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 0.85rem;
}

.module-grid a {
    display: grid;
    gap: 0.35rem;
    min-height: 7rem;
    padding: 1rem;
    align-content: center;
    color: var(--color-ink);
    background: #fff;
    border: 1px solid var(--color-border);
    border-top: 4px solid var(--color-accent);
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
    text-decoration: none;
}

.module-grid a:hover {
    color: var(--color-primary);
    border-top-color: var(--color-primary);
}

.settings-hub {
    margin-top: 1rem;
}

.settings-heading {
    max-width: 980px;
    margin-bottom: 1.25rem;
}

.settings-heading h1 {
    margin: 0 0 0.65rem;
}

.settings-heading > p:last-child {
    margin: 0;
    color: var(--color-muted);
}

.module-grid--main {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.module-grid--main a {
    min-height: 8rem;
}

.module-grid a span {
    color: var(--color-muted);
    font-size: 0.94rem;
    line-height: 1.4;
}

.maintenance-panel {
    margin-top: 1rem;
    padding: 1rem;
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
}

.maintenance-panel summary {
    cursor: pointer;
    color: var(--color-primary);
    font-weight: 780;
}

.maintenance-panel > p {
    max-width: 880px;
    margin: 0.75rem 0 1rem;
    color: var(--color-muted);
}

.module-grid--maintenance a {
    min-height: 5.8rem;
    border-top-color: #8a7f84;
    box-shadow: none;
}

.status,
.search-scope,
.event-category {
    display: inline-flex;
    padding: 0.18rem 0.48rem;
    color: #285052;
    background: var(--color-accent-soft);
    border: 1px solid #b8dedd;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 700;
}

.status-disabled {
    color: var(--color-muted);
    background: #eeeae7;
    border-color: #cfc5c0;
}

.search-scope.archive {
    color: var(--color-warning);
    background: var(--color-warning-soft);
    border-color: #e4cb82;
}

.search-results {
    list-style: none;
    padding: 0;
}

.search-results li {
    padding: 0.7rem 0;
    border-bottom: 1px solid var(--color-border);
}

.search-detail,
.search-summary,
.archive-summary,
.match-note,
.dashboard-heading p {
    color: var(--color-muted);
}

form.search-page-form {
    display: flex;
    gap: 0.5rem;
    max-width: 920px;
    margin-bottom: 1rem;
    padding: 0.75rem;
}

.search-page-form input[type="search"] {
    margin: 0;
}

.search-empty {
    padding: 1rem;
    color: var(--color-muted);
    background: var(--color-surface-soft);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
}

.search-categories {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    align-items: start;
}

.search-category {
    min-width: 0;
    margin: 0;
}

.search-category .section-heading {
    align-items: center;
}

.search-results {
    margin: 0.75rem 0 0;
}

.search-results li:last-child {
    border-bottom: 0;
}

.search-result {
    display: grid;
    gap: 0.28rem;
    padding: 0.45rem;
    color: var(--color-ink);
    border-radius: 5px;
    text-decoration: none;
}

.search-result:hover {
    color: var(--color-primary);
    background: var(--color-accent-soft);
}

.search-result__heading {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    align-items: center;
}

.search-type {
    display: inline-flex;
    padding: 0.15rem 0.42rem;
    color: #fff;
    background: var(--color-primary);
    border-radius: 999px;
    font-size: 0.74rem;
    font-weight: 720;
}

.search-detail {
    overflow-wrap: normal;
    word-break: normal;
    white-space: normal;
    font-size: 0.88rem;
}

.timeline {
    position: relative;
    padding-left: 1.4rem;
}

.timeline::before {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0.38rem;
    width: 2px;
    content: "";
    background: #cab8c0;
}

.timeline-event {
    position: relative;
    margin-bottom: 0.9rem;
    padding: 0.9rem 1rem;
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
}

.timeline-event::before {
    position: absolute;
    top: 1.15rem;
    left: -1.39rem;
    width: 0.72rem;
    height: 0.72rem;
    content: "";
    background: var(--color-accent);
    border: 3px solid #fff;
    border-radius: 50%;
    box-shadow: 0 0 0 1px var(--color-accent);
}

.mail-body {
    line-height: 1.65;
    white-space: normal;
}

.attachments,
.warning-list,
.quick-links,
.name-list,
.document-list {
    padding-left: 1.25rem;
}

.quick-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
    padding: 0;
    list-style: none;
}

.quick-links a {
    display: inline-flex;
    min-height: 2.4rem;
    padding: 0.48rem 0.72rem;
    align-items: center;
    color: var(--color-primary);
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    font-weight: 650;
    text-decoration: none;
}

.dashboard-heading,
.section-heading {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1.5rem;
    align-items: end;
    justify-content: space-between;
}

.dashboard-heading {
    margin-bottom: 1.25rem;
}

.dashboard-heading h1,
.section-heading h2,
.chart h3 {
    margin: 0;
}

.dashboard-heading > p,
.section-heading > span {
    margin: 0;
    color: var(--color-muted);
    font-size: 0.9rem;
}

.dashboard-kicker,
.section-eyebrow {
    margin: 0 0 0.2rem;
    color: var(--color-primary);
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.dashboard-search {
    display: grid;
    grid-template-columns: minmax(210px, 0.65fr) minmax(320px, 1.35fr);
    gap: 1rem;
    margin: 0 0 1.75rem;
    padding: 1rem 1.1rem;
    align-items: center;
    color: #fff;
    background: #3a3035;
    border-left: 5px solid var(--color-accent);
    border-radius: var(--radius);
}

.dashboard-search h2,
.dashboard-search p {
    margin: 0;
    color: #fff;
}

.dashboard-search p {
    margin-top: 0.2rem;
    color: #d9d2d6;
    font-size: 0.9rem;
}

.dashboard-search form {
    display: flex;
    gap: 0.45rem;
    margin: 0;
    padding: 0;
    background: transparent;
    border: 0;
}

.dashboard-search input[type="search"] {
    margin: 0;
    background: #fff;
}

.dashboard-summary,
.statistics-section {
    margin: 1.75rem 0;
}

.chef-dashboard {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    margin: 1.75rem 0;
}

.operational-group {
    min-width: 0;
    padding: 1rem;
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
}

.operational-group--today {
    grid-column: 1 / -1;
    border-top: 4px solid var(--color-primary);
}

.operational-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 0.65rem;
    margin-top: 0.8rem;
}

.operational-card {
    display: grid;
    min-width: 0;
    min-height: 9.4rem;
    padding: 0.8rem;
    align-content: start;
    color: var(--color-ink);
    background: var(--color-surface-soft);
    border: 1px solid var(--color-border);
    border-left: 5px solid #8a7f84;
    border-radius: 6px;
    text-decoration: none;
}

.operational-card:hover {
    color: var(--color-primary);
    background: #fff;
    box-shadow: var(--shadow-card);
}

.operational-card--blocking { border-left-color: var(--color-danger); }
.operational-card--urgent { border-left-color: #c58a11; }
.operational-card--watch { border-left-color: var(--color-info); }

.operational-card__priority {
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.operational-card--blocking .operational-card__priority { color: var(--color-danger); }
.operational-card--urgent .operational-card__priority { color: #8a5a00; }
.operational-card--watch .operational-card__priority { color: var(--color-info); }

.operational-card strong {
    margin: 0.45rem 0 0.2rem;
    font-size: 1.85rem;
    line-height: 1;
}

.operational-card__label { font-weight: 750; }

.operational-card small {
    margin-top: 0.4rem;
    color: var(--color-muted);
    line-height: 1.35;
}

.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(155px, 1fr));
    gap: 0.75rem;
    margin-top: 0.9rem;
}

.summary-card {
    display: grid;
    min-height: 8.25rem;
    padding: 0.9rem;
    align-content: space-between;
    color: var(--color-ink);
    background: #fff;
    border: 1px solid var(--color-border);
    border-top: 4px solid #8a7f84;
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
    text-decoration: none;
    transition: transform 140ms ease, box-shadow 140ms ease;
}

.summary-card:hover {
    color: var(--color-primary);
    box-shadow: 0 8px 20px rgba(47, 30, 37, 0.13);
    transform: translateY(-2px);
}

.summary-card strong {
    color: #33292e;
    font-size: 1.85rem;
    line-height: 1;
}

.summary-card span {
    margin: 0.55rem 0;
    font-weight: 720;
}

.summary-card small {
    color: var(--color-muted);
    font-weight: 650;
}

.summary-card--primary { border-top-color: var(--color-primary); }
.summary-card--accent { border-top-color: var(--color-accent); }
.summary-card--danger { border-top-color: var(--color-danger); }
.summary-card--warning { border-top-color: #c58a11; }
.summary-card--info { border-top-color: var(--color-info); }
.summary-card--success { border-top-color: var(--color-success); }

.dashboard-columns {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(280px, 0.55fr);
    gap: 1rem;
    margin: 1.75rem 0;
}

.dashboard-panel {
    min-width: 0;
    padding: 1.1rem;
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
}

.alert-list {
    display: grid;
    gap: 0.5rem;
    margin: 0.9rem 0 0;
    padding: 0;
    list-style: none;
}

.alert-item {
    border-left: 4px solid var(--color-info);
    background: var(--color-info-soft);
    border-radius: 5px;
}

.alert-item--danger {
    background: var(--color-danger-soft);
    border-left-color: var(--color-danger);
}

.alert-item--warning {
    background: var(--color-warning-soft);
    border-left-color: #c58a11;
}

.alert-item a {
    display: grid;
    gap: 0.1rem;
    padding: 0.65rem 0.75rem;
    color: var(--color-ink);
    text-decoration: none;
}

.alert-item a:hover strong {
    color: var(--color-primary);
}

.alert-item span {
    color: var(--color-muted);
    font-size: 0.87rem;
}

.quick-action-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.55rem;
    margin-top: 0.9rem;
}

.quick-action {
    display: flex;
    min-height: 3.7rem;
    padding: 0.65rem;
    align-items: center;
    justify-content: center;
    color: var(--color-primary);
    background: var(--color-surface-soft);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 720;
    text-align: center;
    text-decoration: none;
}

.quick-action:hover,
.quick-action--primary {
    color: #fff;
    background: var(--color-primary);
    border-color: var(--color-primary);
}

.dashboard-empty {
    margin: 0.9rem 0 0;
    padding: 0.75rem;
    color: var(--color-muted);
    background: var(--color-surface-soft);
    border-radius: 5px;
}

.statistics-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.8rem;
    margin-top: 0.9rem;
}

.chart {
    min-width: 0;
    padding: 1rem;
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
}

.chart h3 {
    min-height: 2.5rem;
    font-size: 1rem;
}

.bar-chart {
    display: grid;
    gap: 0.7rem;
    margin-top: 0.85rem;
}

.bar-label {
    display: flex;
    gap: 0.5rem;
    justify-content: space-between;
    color: var(--color-muted);
    font-size: 0.82rem;
}

.bar-label span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bar-label strong {
    color: var(--color-ink);
}

.bar-track {
    height: 0.5rem;
    overflow: hidden;
    background: #e8e1de;
    border-radius: 999px;
}

.bar-track span {
    display: block;
    height: 100%;
    min-width: 3px;
    background: var(--color-accent);
    border-radius: inherit;
}

.month-grid td {
    min-width: 145px;
    height: 120px;
}

.month-stage {
    display: block;
    margin-top: 0.35rem;
    padding: 0.35rem;
    color: #075e62;
    background: var(--color-accent-soft);
    border-left: 3px solid var(--color-accent);
    border-radius: 4px;
    font-size: 0.82rem;
    text-decoration: none;
}

.high-contrast {
    --color-ink: #000;
    --color-muted: #222;
    --color-primary: #68001f;
    --color-primary-hover: #430014;
    --color-border: #222;
    background-image: none;
    background-color: #fff;
}

.high-contrast main {
    background: #fff;
    border-color: #000;
    box-shadow: none;
}

.pedagogy-family-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.pedagogy-family-list {
    min-width: 0;
    padding: 1rem;
    background: var(--color-surface-soft);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
}

form.pedagogy-inline-form {
    display: flex;
    gap: 0.5rem;
    padding: 0;
    align-items: center;
    background: transparent;
    border: 0;
    box-shadow: none;
}

.pedagogy-family-list .pedagogy-inline-form + .pedagogy-inline-form {
    margin-top: 0.5rem;
}

.pedagogy-inline-form input,
.pedagogy-inline-form select {
    min-width: 12rem;
    margin: 0;
    flex: 1 1 auto;
}

.pedagogy-inline-form button {
    flex: 0 0 auto;
}

.pedagogy-new-family {
    padding-top: 0.75rem;
    border-top: 1px solid var(--color-border);
}

.target-profile-form {
    display: grid;
    gap: 1rem;
}

.target-profile-numbers,
.target-profile-families,
.pedagogy-recommendation-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.target-profile-numbers {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.target-profile-families fieldset {
    min-width: 0;
}

.target-family-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.45rem;
}

.target-family-option {
    display: flex;
    gap: 0.45rem;
    margin: 0;
    align-items: flex-start;
}

.target-family-option input {
    width: auto;
    margin: 0.2rem 0 0;
}

form.compact-form {
    display: flex;
    gap: 0.5rem;
    padding: 0;
    align-items: center;
    background: transparent;
    border: 0;
    box-shadow: none;
}

.input-reference-tabs {
    max-width: 42rem;
}

.input-reference-tabs label {
    font-size: 1rem;
}

.input-reference-table td {
    padding: 0.55rem;
}

form.input-reference-row {
    display: grid;
    grid-template-columns: minmax(11rem, 1fr) auto minmax(15rem, 1.4fr) auto;
    gap: 0.75rem;
    margin: 0;
    padding: 0;
    align-items: center;
    background: transparent;
    border: 0;
    box-shadow: none;
}

.input-reference-row label,
.input-reference-add label,
.input-reference-merge label {
    margin: 0;
}

.input-reference-row select[multiple] {
    min-height: 5.3rem;
}

.input-reference-active {
    display: inline-flex;
    gap: 0.35rem;
    align-items: center;
    white-space: nowrap;
}

.input-reference-active input {
    margin: 0;
}

form.input-reference-add,
form.input-reference-merge {
    display: grid;
    grid-template-columns: repeat(2, minmax(12rem, 1fr)) auto;
    gap: 0.8rem;
    margin-top: 1rem;
    align-items: end;
}

.input-reference-maintenance section + section {
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid var(--color-border);
}

.company-classification-summary {
    max-width: 760px;
    grid-template-columns: repeat(3, minmax(150px, 1fr));
}

.company-classification-filters {
    grid-template-columns: repeat(auto-fit, minmax(175px, 1fr));
}

.company-classification-pending {
    min-height: 2.55rem;
    padding: 0.55rem 0.7rem;
    align-self: end;
    background: var(--color-surface-soft);
    border: 1px solid var(--color-border);
    border-radius: 6px;
}

.company-classification-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    align-items: center;
    margin: 1rem 0;
}

.company-classification-toolbar button,
.company-classification-toolbar .button-secondary {
    margin: 0;
}

form.company-classification-form {
    margin: 0;
    padding: 0;
    background: transparent;
    border: 0;
}

.company-classification-table td {
    font-size: 0.84rem;
    vertical-align: top;
}

.company-classification-table th {
    font-size: 0.82rem;
}

.table-wrap .company-classification-table {
    width: 100%;
    min-width: 900px;
    table-layout: fixed;
}

.company-classification-table th:nth-child(2),
.company-classification-table td:nth-child(2) {
    width: 7.6rem;
}

.company-classification-table th:nth-child(3),
.company-classification-table td:nth-child(3) {
    width: 5.6rem;
}

.company-classification-table .col-description {
    width: 8.4rem;
    white-space: normal;
}

.company-classification-table th:nth-child(5),
.company-classification-table td:nth-child(5) {
    width: 3.1rem;
}

.company-classification-table th:nth-child(6),
.company-classification-table td:nth-child(6) {
    width: 5.1rem;
}

.company-classification-table th:nth-child(7),
.company-classification-table td:nth-child(7),
.company-classification-table th:nth-child(8),
.company-classification-table td:nth-child(8),
.company-classification-table th:nth-child(9),
.company-classification-table td:nth-child(9) {
    width: 6.9rem;
}

.company-classification-table th:nth-child(10),
.company-classification-table td:nth-child(10) {
    width: 4.8rem;
}

.company-classification-table th:nth-child(11),
.company-classification-table td:nth-child(11),
.company-classification-table .col-actions {
    width: 4.9rem;
}

.company-classification-table td.col-actions {
    padding-right: 0.42rem;
    padding-left: 0.42rem;
}

.company-classification-table select {
    width: 100%;
    min-width: 0;
    max-width: none;
    margin: 0;
    padding-right: 1.45rem;
    font-size: 0.82rem;
}

.classification-multi {
    position: relative;
    width: 100%;
    background: var(--color-surface);
    border: 1px solid var(--color-border-strong);
    border-radius: 5px;
}

.classification-multi summary {
    padding: 0.5rem 0.45rem;
    overflow: hidden;
    font-size: 0.78rem;
    line-height: 1.25;
    text-overflow: ellipsis;
    cursor: pointer;
}

.classification-multi__options {
    display: grid;
    gap: 0.35rem;
    min-width: 11rem;
    max-height: 15rem;
    padding: 0.55rem;
    overflow: auto;
    background: var(--color-surface);
}

.classification-multi__options label,
.reference-checklist label {
    display: flex;
    gap: 0.4rem;
    margin: 0;
    align-items: flex-start;
    font-weight: 500;
}

.classification-multi__options input,
.reference-checklist input {
    width: auto;
    margin: 0.12rem 0 0;
}

.reference-checklist {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
    gap: 0.55rem 1rem;
    margin: 0.8rem 0;
    padding: 0.8rem;
    border: 1px solid var(--color-border);
    border-radius: 6px;
}

.company-offer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin: 1rem 0;
}

.company-offer-item {
    padding: 0.9rem 1rem;
    border: 1px solid var(--border-color, #d8d1cf);
    border-radius: 0.55rem;
    background: var(--surface-soft, #f7f4f2);
}

.company-offer-item h3 {
    margin-top: 0;
}

.reference-checklist legend {
    padding: 0 0.35rem;
    font-weight: 750;
}

.company-classification-count {
    text-align: center;
    white-space: nowrap;
}

.company-classification-table td.company-classification-actions {
    display: table-cell;
    width: 4.9rem;
    background-clip: padding-box;
}

.company-classification-actions button {
    display: block;
    width: 100%;
    box-sizing: border-box;
    margin: 0 0 0.32rem;
    padding: 0.3rem 0.22rem;
    font-size: 0.75rem;
    white-space: nowrap;
}

.company-classification-actions button:last-child {
    margin-bottom: 0;
}

.classification-status {
    display: inline-flex;
    padding: 0.25rem 0.5rem;
    border: 1px solid transparent;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 750;
    white-space: nowrap;
}

.classification-status + small {
    display: block;
    max-width: 4.8rem;
    margin-top: 0.35rem;
    color: var(--color-muted);
}

.classification-status--pending {
    color: var(--color-warning);
    background: var(--color-warning-soft);
    border-color: #dfbd68;
}

.classification-status--validated {
    color: var(--color-success);
    background: var(--color-success-soft);
    border-color: #8ec3a5;
}

.classification-status--review {
    color: var(--color-danger);
    background: var(--color-danger-soft);
    border-color: #dca8b0;
}

/* Circuit de validation externe des conventions (PR-037). */
.stage-signature-panel {
    border-left: 0.35rem solid var(--accent, #8c1237);
}

.stage-signature-fallback > summary {
    cursor: pointer;
    color: var(--color-primary);
    font-size: 1.1rem;
    font-weight: 750;
}

.stage-signature-fallback[open] > summary {
    margin-bottom: 0.85rem;
}

.signature-metadata,
.signature-summary dl {
    display: grid;
    grid-template-columns: minmax(10rem, 0.35fr) minmax(0, 1fr);
    gap: 0.45rem 1rem;
    margin: 1rem 0;
}

.signature-metadata dt,
.signature-summary dt {
    font-weight: 700;
}

.signature-metadata dd,
.signature-summary dd {
    margin: 0;
    overflow-wrap: break-word;
}

.signature-link-box {
    display: grid;
    gap: 0.4rem;
    margin: 1rem 0;
    padding: 1rem;
    border: 1px solid #d9c8ce;
    border-radius: 0.4rem;
    background: #fbf7f8;
}

.signature-link-box input {
    width: 100%;
    box-sizing: border-box;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.signature-prepare-form,
.signature-response-form {
    display: grid;
    gap: 0.75rem;
    max-width: 52rem;
}

.signature-prepare-form {
    grid-template-columns: minmax(10rem, 14rem) minmax(12rem, 18rem);
    align-items: end;
    margin: 1rem 0;
}

.signature-prepare-form button {
    grid-column: 1 / -1;
    width: fit-content;
}

.docuseal-import-form {
    grid-template-columns: 1fr;
    max-width: none;
    padding: 1rem;
    border: 1px solid #d9c8ce;
    border-radius: 0.4rem;
    background: #fbf7f8;
}

.docuseal-import-form input[type="file"] {
    width: 100%;
    box-sizing: border-box;
}

.signature-metadata code {
    overflow-wrap: anywhere;
}

.signature-response-form input:not([type="checkbox"]),
.signature-response-form textarea,
.signature-prepare-form select {
    width: 100%;
    box-sizing: border-box;
}

.signature-response-form textarea {
    resize: vertical;
}

.public-signature-header {
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 0.2rem solid var(--accent, #8c1237);
}

.secure-link-preview {
    overflow-wrap: anywhere;
}

@media (max-width: 700px) {
    .signature-metadata,
    .signature-summary dl,
    .signature-prepare-form {
        grid-template-columns: 1fr;
    }
}

.pagination {
    display: flex;
    gap: 0.45rem;
    margin: 1rem 0;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
}

.pagination a,
.pagination strong {
    min-width: 2rem;
    padding: 0.3rem 0.5rem;
    text-align: center;
    border: 1px solid var(--color-border);
    border-radius: 5px;
}

.compact-form select {
    margin: 0;
}

.portfolio-checklist {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.55rem;
    margin-top: 0.85rem;
}

.portfolio-item {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 0.55rem;
    padding: 0.65rem 0.75rem;
    align-items: center;
    color: var(--color-muted);
    background: var(--color-surface-soft);
    border: 1px solid var(--color-border);
    border-radius: 6px;
}

.portfolio-item.is-encountered {
    color: var(--color-ink);
    background: #eef7f0;
    border-color: var(--color-success);
}

.portfolio-item input {
    width: auto;
    margin: 0;
    accent-color: var(--color-success);
}

.portfolio-item small {
    color: var(--color-muted);
    white-space: nowrap;
}

.path-summary-cards {
    max-width: 760px;
    grid-template-columns: repeat(3, minmax(150px, 1fr));
}

.path-filters {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.path-table td {
    vertical-align: top;
}

.path-table-wrap {
    width: 100%;
}

.table-wrap .path-table {
    width: 100%;
    min-width: 0;
    table-layout: fixed;
    font-size: 0.84rem;
}

.path-table th,
.path-table td {
    padding: 0.5rem 0.45rem;
    overflow-wrap: normal;
    word-break: normal;
}

.path-table th {
    white-space: normal;
}

.path-table__level,
.path-table__numeric,
.path-table__action {
    white-space: nowrap;
}

.path-table__alerts {
    white-space: normal;
}

.path-table__score {
    width: 10%;
    min-width: 0;
}

.path-table__identity {
    width: 8%;
    overflow-wrap: break-word;
}

.path-table__promotion {
    width: 9%;
}

.path-table__numeric {
    width: 5%;
    text-align: center;
}

.path-table__administrative-state {
    width: 9%;
    white-space: normal;
}

.path-table__gaps {
    width: 10%;
    max-width: none;
    white-space: normal;
}

.path-table__recommendation {
    width: 16%;
    min-width: 0;
    max-width: none;
    white-space: normal;
}

.path-table__action {
    width: 10%;
    white-space: normal;
}

@media (max-width: 1200px) {
    .table-wrap .path-table {
        min-width: 1120px;
    }
}

.path-badge {
    display: inline-flex;
    padding: 0.28rem 0.55rem;
    align-items: center;
    border: 1px solid transparent;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 760;
    white-space: nowrap;
}

.path-badge--danger {
    color: #7d1f2e;
    background: var(--color-danger-soft);
    border-color: #dca8b0;
}

.path-badge--warning {
    color: #664500;
    background: var(--color-warning-soft);
    border-color: #dfbd68;
}

.path-badge--success {
    color: var(--color-success);
    background: var(--color-success-soft);
    border-color: #8ec3a5;
}

.path-alert-list {
    margin: 0;
    padding-left: 1.1rem;
}

.path-alert-list li + li {
    margin-top: 0.25rem;
}

.path-no-alert {
    color: var(--color-success);
    font-weight: 700;
}

.path-gaps-summary {
    display: grid;
    grid-template-columns: minmax(180px, 0.35fr) minmax(0, 1fr);
    gap: 1rem;
    margin-top: 1rem;
    padding-top: 1rem;
    align-items: start;
    border-top: 1px solid var(--color-border);
}

.path-gaps-summary > div:first-child {
    display: flex;
    gap: 0.4rem;
    flex-direction: column;
}

.path-gaps-summary > div:first-child strong {
    color: var(--color-primary);
    font-size: 1.8rem;
}

.path-gap-list,
.pedagogy-component-list,
.recommendation-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.path-gap-list {
    display: flex;
    gap: 0.45rem;
    flex-wrap: wrap;
}

.path-gap-list li {
    display: inline-flex;
    gap: 0.45rem;
    padding: 0.35rem 0.55rem;
    background: var(--color-surface-soft);
    border: 1px solid var(--color-border);
    border-radius: 999px;
}

.pedagogy-score {
    display: grid;
    gap: 0.4rem;
    min-width: 8.5rem;
}

.pedagogy-score > div:first-child {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    justify-content: space-between;
}

.pedagogy-score > div:first-child > strong {
    font-size: 1.2rem;
    white-space: nowrap;
}

.pedagogy-progress {
    height: 0.48rem;
    overflow: hidden;
    background: var(--color-border);
    border-radius: 999px;
}

.pedagogy-progress span {
    display: block;
    height: 100%;
    background: var(--color-primary);
    border-radius: inherit;
}

.pedagogy-score--danger .pedagogy-progress span {
    background: var(--color-danger);
}

.pedagogy-score--warning .pedagogy-progress span {
    background: #b57800;
}

.pedagogy-score--success .pedagogy-progress span {
    background: var(--color-success);
}

.pedagogy-priority {
    margin: 1rem 0;
    padding: 0.8rem 1rem;
    background: var(--color-accent-soft);
    border-left: 4px solid var(--color-primary);
    border-radius: 4px;
}

.pedagogy-priority p {
    margin: 0.25rem 0 0;
}

.date-picker-help {
    padding: 0.7rem 0.8rem;
    color: var(--color-info);
    background: var(--color-info-soft);
    border-left: 4px solid var(--color-info);
    border-radius: 5px;
}

.date-row input[type="date"] {
    cursor: pointer;
}

.student-guidance {
    margin: 1rem 0;
    padding: 1rem;
    background: #fff;
    border: 2px solid #c58a11;
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
}

.student-guidance h2 {
    margin-top: 0;
}

.student-guidance > div {
    padding: 0.75rem 0.85rem;
    border-left: 5px solid #c58a11;
    border-radius: 5px;
}

.student-guidance > div + div {
    margin-top: 0.7rem;
}

.student-guidance p {
    margin: 0.3rem 0 0;
}

.student-guidance__action {
    background: var(--color-warning-soft);
}

.student-guidance__return {
    background: var(--color-danger-soft);
    border-left-color: var(--color-danger) !important;
}

.student-guidance__complete {
    background: var(--color-success-soft);
    border-left-color: var(--color-success) !important;
}

.student-validation-button {
    font-size: 1rem;
    box-shadow: 0 0 0 3px rgba(197, 138, 17, 0.25);
}

.recommendation-list,
.pedagogy-component-list {
    display: grid;
    gap: 0.55rem;
}

.recommendation,
.pedagogy-component-list li {
    display: block;
    padding: 0.6rem 0.7rem;
    background: var(--color-surface-soft);
    border-left: 3px solid var(--color-border);
    border-radius: 4px;
}

.recommendation--critical {
    border-left-color: var(--color-danger);
}

.recommendation--important {
    border-left-color: #b57800;
}

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

.pedagogy-component-list li {
    display: flex;
    gap: 0.55rem;
    align-items: center;
}

.pedagogy-component-list li > span {
    font-size: 1.15rem;
}

.pedagogy-component-list small {
    display: block;
    color: var(--color-muted);
}

.pedagogy-component-list .is-complete > span {
    color: var(--color-success);
}

.pedagogy-component-list .is-missing > span {
    color: #b57800;
}

@media (max-width: 900px) {
    body {
        padding: 0.75rem;
        background-attachment: scroll;
    }

    main {
        min-height: calc(100vh - 2rem);
        padding: 1.25rem;
    }

    .app-header {
        margin: -1.25rem -1.25rem 1.5rem;
    }

    .app-brand {
        width: 100%;
    }

    .nav-group--secondary {
        padding-top: 0.3rem;
        padding-left: 0;
        border-top: 1px solid rgba(255, 255, 255, 0.2);
        border-left: 0;
    }

    .global-search {
        flex-basis: 100%;
    }

    .dashboard-columns,
    .chef-dashboard,
    .statistics-grid,
    .synthesis-distributions,
    .search-categories {
        grid-template-columns: 1fr;
    }

    .operational-group--today {
        grid-column: auto;
    }

    .pedagogy-family-grid {
        grid-template-columns: 1fr;
    }

    .target-profile-families,
    .pedagogy-recommendation-grid,
    .path-gaps-summary {
        grid-template-columns: 1fr;
    }

    .path-summary-cards {
        max-width: none;
    }

    form.input-reference-row,
    form.input-reference-add,
    form.input-reference-merge {
        grid-template-columns: 1fr;
    }

    .company-classification-summary {
        max-width: none;
        grid-template-columns: 1fr;
    }
}

@media (max-width: 620px) {
    body {
        padding: 0;
        background-image: none;
        background-color: var(--color-surface);
    }

    main {
        min-height: 100vh;
        padding: 1rem;
        border: 0;
        border-radius: 0;
        box-shadow: none;
    }

    .app-header {
        margin: -1rem -1rem 1.25rem;
        border-radius: 0;
    }

    .nav-links,
    .nav-group {
        width: 100%;
    }

    .nav-link {
        flex: 1 1 46%;
    }

    .global-search {
        flex-wrap: wrap;
    }

    .global-search button,
    .logout-link {
        width: 100%;
    }

    .dashboard-search {
        grid-template-columns: 1fr;
    }

    .dashboard-search form {
        flex-wrap: wrap;
    }

    form.search-page-form {
        flex-wrap: wrap;
    }

    .search-page-form button {
        width: 100%;
    }

    .dashboard-search button {
        width: 100%;
    }

    .pedagogy-inline-form,
    .compact-form {
        align-items: stretch;
        flex-direction: column;
    }

    .pedagogy-inline-form input,
    .pedagogy-inline-form select {
        width: 100%;
        min-width: 0;
    }

    .summary-cards {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .diagnostic-summary {
        grid-template-columns: 1fr;
    }

    .path-summary-cards {
        grid-template-columns: 1fr;
    }

    .summary-card {
        min-height: 7.5rem;
    }

    form:not(.global-search),
    fieldset,
    .panel,
    .dashboard-section,
    .crm-section,
    .calendar-section,
    .preview-section,
    .search-category,
    .mail-field,
    .mail-body {
        padding: 0.8rem;
    }

    form.pedagogy-inline-form,
    form.compact-form {
        padding: 0;
    }

    .date-row {
        grid-template-columns: 1fr;
    }

    .detail-grid {
        grid-template-columns: 1fr;
    }

    dl:not(.mail-field) {
        display: block;
    }

    dl:not(.mail-field) dt {
        border-bottom: 0;
    }

    footer {
        display: none;
    }
}

@media print {
    body {
        padding: 0;
        background: #fff;
    }

    main {
        max-width: none;
        border: 0;
        box-shadow: none;
    }

    .app-header,
    footer,
    button,
    .filter-actions {
        display: none;
    }
}
