:root {
    /* --- Couleurs de marque SIIO (dégradé sarcelle → cyan ; fixes en clair/sombre) --- */
    --marine: #05242e;        /* abysse — sections profondes, titres */
    --marine-soft: #0a3644;   /* abysse-800 */
    --bleu: #0195b6;          /* sarcelle — couleur d'action */
    --bleu-strong: #02657c;   /* sarcelle-700 */
    --cyan: #6dc6d9;          /* cyan clair — accents, lueurs */
    --glace: #8bb0bb;
    --neige: #e5e1db;
    --neige-soft: #f6f4f1;
    --white: #ffffff;
    --ink: #142a31;           /* encre */
    --gris: #5c6f75;
    --gris-soft: #94a3b8;
    --success: #1f8f5f;
    --success-bg: rgba(31, 143, 95, 0.12);
    --warning: #b7791f;
    --warning-bg: rgba(183, 121, 31, 0.14);
    --danger: #c25e4f;
    --danger-bg: rgba(194, 94, 79, 0.14);
    --radius-md: 8px;
    --radius-lg: 10px;
    --header-height: 76px;
    --sidebar-width: 320px;
    --font-sans: "Inter", "Segoe UI", Arial, sans-serif;
    --font-display: "Space Grotesk", "Inter", "Segoe UI", Arial, sans-serif;

    /* --- Tokens sémantiques (surchargés en thème sombre) --- */
    --bg-1: #f9fbfd;
    --bg-2: #f4f6f9;
    --bg-glow-bleu: rgba(1, 149, 182, 0.18);
    --bg-glow-glace: rgba(154, 176, 192, 0.18);
    --grid-dot: rgba(5, 36, 46, 0.045);

    --line: rgba(5, 36, 46, 0.1);
    --line-strong: rgba(5, 36, 46, 0.18);

    --surface-solid: #ffffff;
    --surface-88: rgba(255, 255, 255, 0.88);
    --surface-96: rgba(255, 255, 255, 0.96);
    --surface-header: rgba(255, 255, 255, 0.82);
    --surface-border-light: rgba(255, 255, 255, 0.7);
    --surface-border-ink: rgba(5, 36, 46, 0.06);

    --text-heading: var(--marine);
    --text-body: var(--ink);
    --text-muted: var(--gris);

    --thead-bg: rgba(246, 244, 241, 0.72);
    --input-bg: rgba(255, 255, 255, 0.96);
    --input-border: rgba(5, 36, 46, 0.1);
    --row-hover: rgba(1, 149, 182, 0.04);
    --badge-muted-bg: rgba(5, 36, 46, 0.06);
    --badge-muted-text: var(--marine);
    --overlay: rgba(5, 36, 46, 0.48);

    --icon-btn-bg: rgba(255, 255, 255, 0.78);
    --icon-btn-border: rgba(5, 36, 46, 0.08);
    --icon-btn-hover: rgba(1, 149, 182, 0.1);

    --shadow-sm: 0 16px 40px rgba(5, 36, 46, 0.06);
    --shadow-md: 0 22px 70px rgba(5, 36, 46, 0.1);
    --shadow-lg: 0 30px 90px rgba(5, 36, 46, 0.16);
}

[data-theme="dark"] {
    --bg-1: #06222b;
    --bg-2: #04171d;
    --bg-glow-bleu: rgba(1, 149, 182, 0.22);
    --bg-glow-glace: rgba(109, 198, 217, 0.08);
    --grid-dot: rgba(255, 255, 255, 0.035);

    --line: rgba(255, 255, 255, 0.1);
    --line-strong: rgba(255, 255, 255, 0.18);

    --surface-solid: #0a3644;
    --surface-88: rgba(10, 54, 68, 0.9);
    --surface-96: rgba(10, 54, 68, 0.96);
    --surface-header: rgba(5, 36, 46, 0.82);
    --surface-border-light: rgba(255, 255, 255, 0.08);
    --surface-border-ink: rgba(255, 255, 255, 0.07);

    --text-heading: #eef4fa;
    --text-body: #dbe6f1;
    --text-muted: #9ab0c0;

    --thead-bg: rgba(255, 255, 255, 0.04);
    --input-bg: rgba(255, 255, 255, 0.05);
    --input-border: rgba(255, 255, 255, 0.12);
    --row-hover: rgba(1, 149, 182, 0.14);
    --badge-muted-bg: rgba(255, 255, 255, 0.09);
    --badge-muted-text: #eef4fa;
    --overlay: rgba(0, 0, 0, 0.62);

    --icon-btn-bg: rgba(255, 255, 255, 0.06);
    --icon-btn-border: rgba(255, 255, 255, 0.12);
    --icon-btn-hover: rgba(255, 255, 255, 0.14);

    --shadow-sm: 0 16px 40px rgba(0, 0, 0, 0.35);
    --shadow-md: 0 22px 70px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 30px 90px rgba(0, 0, 0, 0.55);
}

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

html, body {
    min-height: 100%;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    color: var(--text-body);
    font-family: var(--font-sans);
    background:
        radial-gradient(circle at top right, var(--bg-glow-bleu), transparent 28rem),
        radial-gradient(circle at left center, var(--bg-glow-glace), transparent 24rem),
        linear-gradient(180deg, var(--bg-1) 0%, var(--bg-2) 100%);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image: radial-gradient(var(--grid-dot) 1px, transparent 1px);
    background-size: 24px 24px;
    mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.35), transparent 90%);
}

h1, h2, h3, h4 {
    margin: 0;
    font-family: var(--font-display);
    font-weight: 800;
    letter-spacing: -0.02em;
}

a {
    color: inherit;
}

button,
input,
select {
    font: inherit;
}

.app-shell {
    position: relative;
    min-height: 100vh;
}

.shell-backdrop {
    position: fixed;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(circle at 10% 20%, rgba(1, 149, 182, 0.08), transparent 16rem),
        radial-gradient(circle at 85% 15%, rgba(5, 36, 46, 0.06), transparent 22rem);
}

.app-wrapper {
    position: relative;
    min-height: 100vh;
}

.header {
    position: fixed;
    top: 0;
    right: 0;
    left: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 20px;
    justify-content: space-between;
    min-height: var(--header-height);
    padding: 16px 28px;
    background: var(--surface-header);
    border-bottom: 1px solid var(--surface-border-light);
    box-shadow: 0 12px 32px rgba(5, 36, 46, 0.06);
    backdrop-filter: blur(18px);
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 14px;
    text-decoration: none;
}

.header-logo img,
.login-logo {
    width: auto;
    height: 34px;
}

/* Bascule du logo selon le thème : texte foncé en clair, texte blanc en sombre. */
.logo-on-dark {
    display: none;
}

[data-theme="dark"] .logo-on-light {
    display: none;
}

[data-theme="dark"] .logo-on-dark {
    display: block;
}

.header-brand,
.header-product {
    display: block;
}

.header-brand {
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--bleu);
}

.header-product {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-heading);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 14px;
}

.header-pill {
    padding: 10px 16px;
    border: 1px solid rgba(1, 149, 182, 0.14);
    border-radius: 999px;
    background: var(--surface-88);
    color: var(--text-muted);
    font-size: 0.92rem;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-icon-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 40px;
    padding: 0 12px;
    border: 1px solid var(--icon-btn-border);
    border-radius: 999px;
    background: var(--icon-btn-bg);
    color: var(--text-heading);
    cursor: pointer;
    transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.header-icon-btn:hover {
    background: var(--icon-btn-hover);
    border-color: rgba(1, 149, 182, 0.28);
    transform: translateY(-1px);
}

.header-icon-btn svg {
    width: 20px;
    height: 20px;
}

.header-icon-btn-label {
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

/* Catalogue de logiciels (page Acheter) */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 16px;
}

.product-card {
    display: flex;
    flex-direction: column;
}

/* Ligne d'article du panier */
.cart-line {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
}

.cart-line:last-of-type {
    border-bottom: none;
}

.header-cart {
    position: relative;
    text-decoration: none;
}

.header-cart-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    min-width: 19px;
    height: 19px;
    padding: 0 5px;
    display: grid;
    place-items: center;
    border-radius: 999px;
    background: #007ad9;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    line-height: 1;
}

.header-user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 10px 8px 8px;
    border-radius: 999px;
    background: var(--surface-88);
    border: 1px solid var(--surface-border-ink);
}

.header-avatar {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    color: var(--white);
    font-weight: 700;
    background: linear-gradient(135deg, var(--bleu) 0%, var(--marine) 100%);
}

.header-user-name {
    font-weight: 700;
    color: var(--text-heading);
}

.header-user-dossier {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.main-container {
    display: flex;
    gap: 24px;
    padding-top: calc(var(--header-height) + 22px);
    min-height: 100vh;
}

.sidebar {
    position: fixed;
    top: calc(var(--header-height) + 18px);
    left: 24px;
    bottom: 24px;
    width: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding: 22px;
    border-radius: 10px;
    background:
        radial-gradient(circle at top right, rgba(1, 149, 182, 0.18), transparent 14rem),
        linear-gradient(180deg, rgba(11, 24, 46, 0.97) 0%, rgba(5, 36, 46, 0.98) 100%);
    color: var(--white);
    box-shadow: var(--shadow-lg);
    overflow-y: auto;
}

.sidebar-brand-card {
    padding: 22px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-brand-card h2 {
    margin: 10px 0 10px;
    font-size: 1.5rem;
    line-height: 1.15;
}

.sidebar-brand-card p {
    margin: 0;
    color: rgba(255, 255, 255, 0.72);
    line-height: 1.55;
}

.sidebar-eyebrow {
    margin: 0;
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.72);
}

.sidebar-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sidebar-label {
    padding: 0 8px;
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.55);
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 0;
    margin: 0;
    list-style: none;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.82);
    text-decoration: none;
    font-weight: 600;
    transition: transform 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.sidebar-link svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.sidebar-link:hover,
.sidebar-link.active {
    color: var(--white);
    background: rgba(255, 255, 255, 0.12);
    transform: translateX(3px);
}

.sidebar-footnote {
    margin-top: auto;
    padding: 18px 20px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.75);
    line-height: 1.5;
}

.sidebar-footnote-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    margin-right: 10px;
    border-radius: 50%;
    background: var(--bleu);
    box-shadow: 0 0 0 6px rgba(1, 149, 182, 0.18);
}

.content {
    flex: 1;
    width: min(100%, calc(100vw - var(--sidebar-width) - 84px));
    margin-left: calc(var(--sidebar-width) + 48px);
    padding: 8px 28px 44px 0;
}

.hero-panel,
.table-container,
.editor-modal,
.login-card,
.stat-card,
.info-card,
.empty-state-panel,
.story-card,
.contract-card {
    box-shadow: var(--shadow-sm);
}

.hero-panel {
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    gap: 24px;
    padding: 34px;
    margin-bottom: 28px;
    border: 1px solid var(--surface-border-light);
    border-radius: var(--radius-lg);
    background:
        radial-gradient(circle at top right, rgba(1, 149, 182, 0.16), transparent 18rem),
        linear-gradient(180deg, var(--surface-96) 0%, var(--surface-88) 100%);
}

.hero-panel-compact {
    align-items: center;
}

.hero-copy {
    max-width: 760px;
}

.hero-copy h1 {
    margin: 16px 0 14px;
    font-size: clamp(2rem, 4vw, 3.5rem);
    line-height: 1.04;
    letter-spacing: -0.04em;
    color: var(--text-heading);
}

.hero-text,
.login-story p,
.story-card p,
.contract-card p,
.info-caption {
    color: var(--text-muted);
    line-height: 1.65;
}

.hero-side {
    display: flex;
    align-items: end;
    justify-content: end;
    min-width: 240px;
}

.hero-actions {
    flex-wrap: wrap;
    gap: 12px;
}

.eyebrow-pill,
.modal-eyebrow {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    padding: 8px 14px;
    border-radius: 999px;
    background: var(--surface-96);
    border: 1px solid rgba(1, 149, 182, 0.14);
    color: var(--bleu);
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.modal-eyebrow {
    padding: 0;
    background: none;
    border: none;
    margin: 0 0 6px;
}

.info-card {
    width: 100%;
    max-width: 260px;
    padding: 22px;
    border-radius: 8px;
    background: linear-gradient(180deg, rgba(5, 36, 46, 0.96) 0%, rgba(13, 29, 56, 0.98) 100%);
    color: var(--white);
}

.info-label {
    display: block;
    margin-bottom: 12px;
    color: rgba(255, 255, 255, 0.62);
    font-size: 0.82rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.info-card strong {
    display: block;
    font-size: 2.8rem;
    line-height: 1;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 28px;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 22px;
    border-radius: 8px;
    border: 1px solid var(--surface-border-light);
    background: var(--surface-88);
}

.stat-card-spotlight {
    background:
        radial-gradient(circle at top right, rgba(1, 149, 182, 0.16), transparent 14rem),
        var(--surface-96);
}

.stat-icon {
    display: grid;
    place-items: center;
    width: 52px;
    height: 52px;
    border-radius: 8px;
}

.stat-icon svg {
    width: 24px;
    height: 24px;
}

.stat-icon.primary {
    background: rgba(1, 149, 182, 0.12);
    color: var(--bleu);
}

.stat-icon.success {
    background: var(--success-bg);
    color: var(--success);
}

.stat-icon.warning {
    background: var(--warning-bg);
    color: var(--warning);
}

.stat-icon.danger {
    background: var(--danger-bg);
    color: var(--danger);
}

.stat-value {
    font-size: 2.2rem;
    line-height: 1;
    font-weight: 800;
    letter-spacing: -0.04em;
    color: var(--text-heading);
}

.stat-label {
    margin-top: 6px;
    color: var(--text-muted);
}

.card-grid {
    display: grid;
    gap: 18px;
}

.contract-grid {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    margin-bottom: 28px;
}

.contract-card {
    display: flex;
    flex-direction: column;
    gap: 14px;
    width: 100%;
    padding: 24px;
    text-align: left;
    border: 1px solid var(--surface-border-light);
    border-radius: 8px;
    background: var(--surface-88);
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.contract-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: rgba(1, 149, 182, 0.18);
}

.contract-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.contract-card h3 {
    margin: 0;
    font-size: 1.3rem;
    color: var(--text-heading);
}

.contract-meta,
.row-index,
.table-meta,
.user-email {
    color: var(--text-muted);
}

.contract-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: auto;
    color: var(--bleu);
    font-weight: 700;
}

.contract-link svg {
    width: 18px;
    height: 18px;
}

.table-container {
    overflow: hidden;
    border-radius: var(--radius-lg);
    border: 1px solid var(--surface-border-light);
    background: var(--surface-88);
}

.table-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 20px 24px;
    border-bottom: 1px solid var(--line);
}

.table-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-heading);
}

.table-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.search-input,
.status-filter,
.form-control,
.input-wrapper input {
    width: 100%;
    border: 1px solid var(--input-border);
    border-radius: 8px;
    background: var(--input-bg);
    color: var(--text-body);
}

.search-input,
.status-filter,
.form-control {
    min-height: 48px;
    padding: 12px 14px;
}

.search-input {
    min-width: 240px;
}

.search-input:focus,
.status-filter:focus,
.form-control:focus,
.input-wrapper input:focus {
    outline: none;
    border-color: rgba(1, 149, 182, 0.5);
    box-shadow: 0 0 0 4px rgba(1, 149, 182, 0.1);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead {
    background: var(--thead-bg);
}

.data-table th,
.data-table td {
    padding: 16px 24px;
    text-align: left;
    border-bottom: 1px solid var(--line);
}

.data-table th {
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-muted);
}

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

.clickable-row {
    cursor: pointer;
    transition: background 0.18s ease, transform 0.18s ease;
}

.clickable-row:hover {
    background: var(--row-hover);
}

.user-cell {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.user-name {
    font-weight: 700;
    color: var(--text-heading);
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 7px 12px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
}

.badge-success {
    background: var(--success-bg);
    color: var(--success);
}

.badge-danger {
    background: var(--danger-bg);
    color: var(--danger);
}

.badge-muted {
    background: var(--badge-muted-bg);
    color: var(--badge-muted-text);
}

.machine-id {
    display: inline-flex;
    padding: 7px 12px;
    border-radius: 6px;
    background: var(--badge-muted-bg);
    color: var(--text-muted);
    font-family: Consolas, Monaco, monospace;
    font-size: 0.8rem;
}

.machine-id-empty {
    font-family: inherit;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 48px;
    padding: 0 18px;
    border: none;
    border-radius: 8px;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-primary,
.btn-login {
    color: var(--white);
    background: linear-gradient(135deg, var(--bleu) 0%, var(--marine) 100%);
    box-shadow: 0 16px 32px rgba(1, 149, 182, 0.18);
}

.btn-secondary {
    color: var(--text-heading);
    background: var(--surface-88);
    border: 1px solid var(--input-border);
}

.loading,
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    min-height: 240px;
}

.empty-state {
    padding: 40px 20px;
    text-align: center;
}

.empty-state h3,
.empty-state h4 {
    margin: 0;
    color: var(--text-heading);
}

.empty-state p {
    max-width: 420px;
    margin: 0;
    color: var(--text-muted);
}

.empty-state-panel {
    border-radius: var(--radius-lg);
    background: var(--surface-88);
    border: 1px solid var(--surface-border-light);
}

.spinner {
    width: 34px;
    height: 34px;
    border: 3px solid var(--line);
    border-top-color: var(--bleu);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.spinner-sm {
    width: 18px;
    height: 18px;
    border-width: 2px;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 120;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: var(--overlay);
    backdrop-filter: blur(12px);
}

.editor-modal {
    width: 100%;
    max-width: 680px;
    border-radius: 10px;
    border: 1px solid var(--surface-border-light);
    background: var(--surface-96);
}

.editor-modal-header,
.editor-modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 22px 26px;
}

.editor-modal-header {
    border-bottom: 1px solid var(--line);
}

.editor-modal-header h3 {
    margin: 0;
    color: var(--text-heading);
}

.editor-modal-close {
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 50%;
    background: var(--badge-muted-bg);
    color: var(--text-heading);
    cursor: pointer;
}

.editor-modal-body {
    padding: 24px 26px;
}

.editor-modal-footer {
    justify-content: flex-end;
    border-top: 1px solid var(--line);
}

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

.form-group {
    margin-bottom: 18px;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-label {
    display: inline-block;
    margin-bottom: 8px;
    color: var(--text-heading);
    font-size: 0.92rem;
    font-weight: 700;
}

.form-alert {
    padding: 12px 14px;
    margin-bottom: 16px;
    border-radius: 6px;
}

.form-alert-danger,
.error-banner {
    color: var(--danger);
    background: var(--danger-bg);
}

.form-alert-success {
    color: var(--success, #1f6f54);
    background: var(--success-bg, rgba(31, 111, 84, 0.1));
}

.winui-switch {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
}

.winui-switch input {
    position: absolute;
    opacity: 0;
}

.winui-switch-track {
    position: relative;
    width: 48px;
    height: 28px;
    border-radius: 999px;
    background: var(--input-border);
    transition: background 0.18s ease;
}

.winui-switch-thumb {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--white);
    box-shadow: 0 4px 14px rgba(5, 36, 46, 0.18);
    transition: transform 0.18s ease;
}

.winui-switch input:checked + .winui-switch-track {
    background: var(--bleu);
}

.winui-switch input:checked + .winui-switch-track .winui-switch-thumb {
    transform: translateX(20px);
}

.winui-switch-label {
    font-weight: 600;
    color: var(--text-heading);
}

.login-shell {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 24px;
    align-items: stretch;
    min-height: calc(100vh - var(--header-height) - 40px);
}

.login-story {
    padding: 34px;
    border-radius: 10px;
    background:
        radial-gradient(circle at top right, rgba(1, 149, 182, 0.18), transparent 16rem),
        linear-gradient(180deg, var(--surface-96) 0%, var(--surface-88) 100%);
    border: 1px solid var(--surface-border-light);
}

.login-story h1 {
    margin: 18px 0 16px;
    font-size: clamp(2rem, 4vw, 3.2rem);
    line-height: 1.05;
    letter-spacing: -0.04em;
    color: var(--text-heading);
}

.login-story-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-top: 28px;
}

.story-card {
    padding: 20px;
    border-radius: 8px;
    background: var(--surface-88);
    border: 1px solid var(--surface-border-ink);
}

.story-card span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    margin-bottom: 14px;
    border-radius: 6px;
    background: rgba(1, 149, 182, 0.1);
    color: var(--bleu);
    font-weight: 800;
}

.story-card strong {
    display: block;
    margin-bottom: 8px;
    color: var(--text-heading);
}

.login-card {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 34px;
    border-radius: 10px;
    border: 1px solid var(--surface-border-light);
    background: var(--surface-96);
}

.login-header {
    margin-bottom: 24px;
}

.login-header h2 {
    margin: 16px 0 8px;
    color: var(--text-heading);
}

.login-header p,
.login-footer p {
    color: var(--text-muted);
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.input-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 52px;
    padding: 0 14px;
    border: 1px solid var(--input-border);
    border-radius: 8px;
    background: var(--input-bg);
}

.input-wrapper svg {
    flex-shrink: 0;
    color: var(--text-muted);
}

.input-wrapper input {
    min-height: 48px;
    padding: 0;
    border: 0;
    background: transparent;
}

.toggle-password {
    padding: 0;
    border: 0;
    background: none;
    color: var(--text-muted);
    cursor: pointer;
}

.btn-login {
    width: 100%;
    margin-top: 10px;
}

.error-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 6px;
}

.login-footer {
    margin-top: 22px;
}

.login-footer a {
    color: var(--bleu);
    font-weight: 700;
    text-decoration: none;
}

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

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

.text-warning {
    color: var(--warning);
}

.text-danger {
    color: var(--danger);
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 1320px) {
    .header-pill {
        display: none;
    }

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

    .login-story-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 1080px) {
    .sidebar {
        display: none;
    }

    .content {
        width: 100%;
        margin-left: 0;
        padding: 8px 22px 38px;
    }

    .main-container {
        padding-top: calc(var(--header-height) + 12px);
    }

    .login-shell {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .header {
        padding: 14px 18px;
    }

    .header-right {
        gap: 10px;
    }

    .header-user {
        max-width: 180px;
    }

    .header-user-name,
    .header-user-dossier {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .hero-panel,
    .login-story,
    .login-card {
        padding: 24px;
    }

    .hero-panel,
    .table-header {
        flex-direction: column;
        align-items: stretch;
    }

    .hero-side,
    .hero-actions {
        justify-content: stretch;
    }

    .hero-actions .btn,
    .hero-side .btn,
    .table-actions,
    .search-input {
        width: 100%;
    }

    .table-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .stats-grid,
    .editor-grid {
        grid-template-columns: 1fr;
    }

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

    .data-table {
        min-width: 720px;
    }

    .table-container {
        overflow-x: auto;
    }
}

/* ============================================================
   Détail licence — gestion des sièges (postes)
   ============================================================ */
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 18px;
    margin-bottom: 28px;
}

/* Cartes de métrique sans icône : label au-dessus, valeur en dessous. */
.stats-row .stat-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
}

.stats-row .stat-label {
    margin-top: 0;
    order: -1;
}

.seats-link {
    color: var(--text-heading);
    text-decoration: none;
    font-weight: 600;
}

.seats-link:hover {
    text-decoration: underline;
}

.seats-full {
    color: var(--danger);
    font-weight: 700;
}

.row-muted {
    opacity: 0.55;
}

.form-alert-warning {
    color: var(--warning);
    background: var(--warning-bg);
}
