/* ============================================================
   Portail Employés NRC — overrides au-dessus de bootstrap.min.css
   (thème NRC jaune #f1cd15 / dark #393939 hérité d'AfterSale).
   ============================================================ */

:root {
    --nrc-noir: #090909;
    --nrc-gris-900: #161616;
    --nrc-gris-800: #1d1d1d;
    --nrc-gris-700: #2a2a2a;
    --nrc-gris-500: #6b6b6b;
    --nrc-gris-400: #8a8a8a;
    --nrc-gris-300: #c8c8c8;
    --nrc-gris-200: #e4e4e4;
    --nrc-gris-100: #f1f1f3;
    --nrc-gris-50:  #f7f7f9;
    --nrc-jaune:    #f1cd15;
    --nrc-jaune-hover: #f3d438;
    --nrc-vert:     #198754;
    --nrc-rouge:    #dc3545;
    --nrc-bleu:     #0d6efd;
    --nrc-bleu-pale: #00e1ff;

    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 14px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.18);
}

html, body { height: 100%; }

/* Blazor/Bootstrap peuvent poser un focus ring noir sur un titre quand
   l'élément reçoit le focus au load ou au tab. On le neutralise ici — les
   h1..h6 ne doivent jamais afficher de cadre de sélection. */
h1, h2, h3, h4, h5, h6 {
    outline: 0 !important;
}
h1:focus, h2:focus, h3:focus, h4:focus, h5:focus, h6:focus,
h1:focus-visible, h2:focus-visible, h3:focus-visible,
h4:focus-visible, h5:focus-visible, h6:focus-visible {
    outline: 0 !important;
    box-shadow: none !important;
}

/* Chrome/Edge autofill : par défaut peint un fond blanc/jaune qui casse
   les inputs sombres (ex. login) ou les inputs compacts des tables admin.
   On neutralise en forçant l'inset shadow à hériter du background courant. */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 1000px transparent inset !important;
    -webkit-text-fill-color: inherit !important;
    transition: background-color 5000s ease-in-out 0s;
    caret-color: inherit;
}
.login-body input:-webkit-autofill,
.login-body input:-webkit-autofill:hover,
.login-body input:-webkit-autofill:focus {
    -webkit-text-fill-color: #fff !important;
}

/* ── App shell (sidebar unique, trois états) ──────────────── */
.app-shell-layout {
    display: flex;
    height: 100vh;
    width: 100%;
    position: relative;
    overflow: hidden;
    background: var(--nrc-gris-50);
}

/* Le spacer réserve l'espace dans le flex flow. La sidebar elle-même
   est absolute pour pouvoir overlay sans pousser le contenu au hover
   (mode collapsed → hover expand). */
.app-sidebar-spacer {
    flex-shrink: 0;
    width: 15rem;
    transition: width 0.18s ease;
}
.app-shell-layout.sidebar-collapsed .app-sidebar-spacer { width: 3.5rem; }
.app-shell-layout.sidebar-hidden    .app-sidebar-spacer { width: 0; }

.app-sidebar {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 15rem;
    background: var(--nrc-gris-900);
    border-right: 3px solid var(--nrc-jaune);
    z-index: 50;
    transition: width 0.18s ease, transform 0.22s ease, box-shadow 0.18s ease;
    overflow-x: hidden;
    overflow-y: auto;
}
.app-shell-layout.sidebar-collapsed .app-sidebar { width: 3.5rem; }
.app-shell-layout.sidebar-collapsed.sidebar-hover .app-sidebar {
    width: 15rem;
    box-shadow: 0 0 24px rgba(0,0,0,0.35);
}
.app-shell-layout.sidebar-hidden .app-sidebar { transform: translateX(-100%); }

/* Quand la sidebar est purement en mode icons (collapsed sans hover),
   on masque les labels et les headings de sections. Dès qu'on hover,
   la classe sidebar-hover est posée et les labels réapparaissent. */
.app-shell-layout.sidebar-collapsed:not(.sidebar-hover) .app-nav-label,
.app-shell-layout.sidebar-collapsed:not(.sidebar-hover) .app-nav-heading { display: none; }
.app-shell-layout.sidebar-collapsed:not(.sidebar-hover) .app-nav-item {
    justify-content: center;
    padding: 0.7rem 0.3rem;
}
.app-shell-layout.sidebar-collapsed:not(.sidebar-hover) .app-nav-item i {
    width: auto;
    font-size: 1.2rem;
}

/* Brand bar en haut de sidebar (remplace la topbar). */
.app-sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.45rem 0.4rem 0.6rem;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    min-height: 2.75rem;
    color: #fff;
}
.app-sidebar-brand .brand-link {
    color: #fff;
    font-size: 0.8rem;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    flex: 1 1 auto;
    min-width: 0;
}
.app-sidebar-brand .brand-logo {
    height: 1.85rem;
    width: 2.25rem;
    flex-shrink: 0;
    object-fit: contain;
}
.app-sidebar-brand .brand-text-expanded {
    font-weight: 600;
    letter-spacing: 0.02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.app-sidebar-brand .brand-ctrls {
    display: flex;
    align-items: center;
    gap: 0.15rem;
    flex-shrink: 0;
}
/* En mode collapsed pur : seulement le logo, centré. La hauteur de la
   brand-bar reste identique (min-height 3.25rem) pour que la nav en
   dessous ne bouge pas en Y quand on toggle expand/collapse. */
.app-shell-layout.sidebar-collapsed:not(.sidebar-hover) .app-sidebar-brand {
    justify-content: center;
    padding: 0.55rem 0.2rem;
}
.app-shell-layout.sidebar-collapsed:not(.sidebar-hover) .app-sidebar-brand .brand-link {
    justify-content: center;
    flex: 0 0 auto;
    gap: 0;
}
.app-shell-layout.sidebar-collapsed:not(.sidebar-hover) .app-sidebar-brand .brand-text-expanded {
    display: none;
}
.app-shell-layout.sidebar-collapsed:not(.sidebar-hover) .app-sidebar-brand .brand-ctrls {
    display: none;
}

.app-sidebar-ctrl {
    background: transparent;
    color: rgba(255,255,255,0.65);
    border: 0;
    padding: 0.15rem 0.25rem;
    font-size: 0.78rem;
    line-height: 1;
    border-radius: 0.25rem;
    cursor: pointer;
    transition: background 0.12s, color 0.12s;
}
.app-sidebar-ctrl:hover { background: rgba(255,255,255,0.1); color: #fff; }

.app-sidebar-nav {
    padding: 0.3rem 0;
    overflow-y: auto;
    /* Bootstrap .nav fournit `flex-wrap: wrap` + on hérite `flex-direction: column`
       via .flex-column. Sans `nowrap` explicite, quand la hauteur du viewport
       diminue (pas full screen), les items qui ne rentrent plus verticalement
       wrappent vers une nouvelle COLONNE à droite — la section admin se retrouve
       à côté des items principaux au lieu d'en-dessous. */
    flex-wrap: nowrap;
    /* min-height:0 permet au flex item (.app-sidebar-nav) de rétrécir sous sa
       hauteur de contenu naturelle — sinon overflow-y:auto ne déclenche jamais
       le scroll et la nav déborde du wrapper. */
    min-height: 0;
    /* Scrollbar invisible mais scroll wheel/touch toujours fonctionnel.
       La sidebar contient au max ~15 items connus de l'utilisateur (les nav
       links principaux + section admin) — pas besoin d'une scrollbar visible
       qui alourdit le look. */
    scrollbar-width: none;          /* Firefox */
}
.app-sidebar-nav::-webkit-scrollbar { width: 0; height: 0; }  /* Chromium/Safari */
/* Conséquence de min-height:0 ci-dessus : les enfants directs de la nav
   (flex items) ont flex-shrink:1 par défaut → ils se compriment quand la
   hauteur manque, au lieu de garder leur taille et de déclencher le scroll.
   flex-shrink:0 force chaque item à garder sa hauteur naturelle et active
   le overflow-y:auto. */
.app-sidebar-nav > * {
    flex-shrink: 0;
}

.app-sidebar-footer {
    border-top: 1px solid rgba(255,255,255,0.08);
    padding: 0.4rem 0 0.5rem;
}
.app-sidebar-footer form { padding: 0; }

.app-sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.35rem 1rem;
    color: var(--nrc-gris-400);
    font-size: 0.8rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.app-sidebar-user i { width: 1.3rem; font-size: 1rem; text-align: center; flex-shrink: 0; }

/* Supprime la bordure de focus Blazor/Bootstrap sur les boutons de la sidebar
   (le login tout juste posté laissait un outline noir autour du logout). */
.app-sidebar button:focus,
.app-sidebar button:focus-visible,
.app-sidebar a:focus,
.app-sidebar a:focus-visible {
    outline: none;
    box-shadow: none;
}

/* Bouton flottant (hamburger) pour réafficher la sidebar.
   Rendu toujours dans le DOM ; visibilité contrôlée par les classes d'état
   du shell + les media queries en bas du fichier (responsive). */
.app-sidebar-show {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    z-index: 60;
    width: 2.4rem;
    height: 2.4rem;
    padding: 0;
    display: none;             /* caché par défaut */
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    border-radius: 0.35rem;
}
/* Desktop : visible uniquement quand la sidebar est entièrement masquée. */
.app-shell-layout.sidebar-hidden .app-sidebar-show {
    display: inline-flex;
}

.app-nav-item {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.42rem 1rem;
    color: var(--nrc-gris-300);
    text-decoration: none;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    border-left: 3px solid transparent;
    transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.app-nav-item:hover {
    background: rgba(255,255,255,0.06);
    color: #fff;
    text-decoration: none;
}
.app-nav-item.active {
    background: rgba(241, 205, 21, 0.12);
    color: var(--nrc-jaune);
    border-left-color: var(--nrc-jaune);
}
.app-nav-item.as-button {
    background: transparent;
    border: none;
    border-left: 3px solid transparent;
    width: 100%;
    text-align: left;
    cursor: pointer;
    font: inherit;
}
.app-nav-item i {
    width: 1.3rem;
    font-size: 1.05rem;
    text-align: center;
    flex-shrink: 0;
}

.app-nav-heading {
    letter-spacing: 0.06em;
    font-size: 0.82rem;
    color: rgba(255,255,255,0.35);
}
.app-nav-divider {
    border: none;
    border-top: 1px solid rgba(255,255,255,0.08);
    margin: 0.3rem 0.75rem;
}

/* Section Admin : bloc visuellement distinct avec icônes bleues. Seuls les
   items dans ce wrapper reçoivent le traitement bleu ; les autres items
   (Accueil, Sites) gardent le gris/jaune. */
.app-nav-admin-section {
    margin-top: 0;
    padding-top: 0;
}
.app-nav-admin-section .app-nav-item i {
    color: var(--nrc-bleu-pale);
}
.app-nav-admin-section .app-nav-item:hover i,
.app-nav-admin-section .app-nav-item.active i {
    color: var(--nrc-bleu-pale);
}
.app-nav-admin-section .app-nav-heading {
    color: rgba(142, 197, 255, 0.55);
}

.app-main { background: #fff; min-width: 0; }

.app-embed-frame {
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
    position: relative;
    z-index: 1;
}

/* Container positionné pour superposer le spinner au-dessus de l'iframe le
   temps que le backend MadCap réponde (cold start PHP/Apache peut être lent). */
.app-embed-container {
    position: relative;
    width: 100%;
    height: 100%;
}

.app-embed-loading {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.1rem;
    background: linear-gradient(180deg, #ffffff 0%, var(--nrc-gris-50) 100%);
    transition: opacity 0.4s ease, visibility 0.4s ease;
}
.app-embed-loading.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.app-embed-loading .embed-brand {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    color: var(--nrc-gris-500);
    margin-bottom: 0.25rem;
}
.app-embed-loading .embed-brand span {
    color: var(--nrc-gris-900);
    border-bottom: 2px solid var(--nrc-jaune);
    padding-bottom: 1px;
}

.app-embed-loading .embed-spinner {
    width: 58px;
    height: 58px;
    border-radius: 50%;
    border: 4px solid var(--nrc-gris-200);
    border-top-color: var(--nrc-jaune);
    animation: embed-spin 0.85s linear infinite;
}

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

.app-embed-loading .embed-loading-text {
    font-size: 0.95rem;
    color: var(--nrc-gris-700);
    letter-spacing: 0.01em;
}

.app-embed-loading .embed-loading-hint {
    font-size: 0.78rem;
    color: var(--nrc-gris-500);
    margin-top: -0.35rem;
}

/* ── Home — cartes de sites ─────────────────────────────────── */
.site-card {
    border: 1px solid var(--nrc-gris-200);
    border-top: 3px solid var(--nrc-jaune);
    transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
    color: inherit;
}
.site-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    text-decoration: none;
}
.site-card .site-icon svg {
    width: 2rem;
    height: 2rem;
}

/* ── Login page (hors app-shell) ────────────────────────────── */
.login-page {
    position: fixed;
    inset: 0;
    background-image: url('/img/homeBackground.jpg');
    background-repeat: no-repeat;
    background-size: cover;
    background-position: 20% 75%;
    overflow: hidden;
}
.login-page::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(110deg, rgba(0,0,0,0.55) 0%, rgba(0,0,0,0.15) 55%, rgba(0,0,0,0) 100%);
    pointer-events: none;
}
.login-container {
    position: absolute;
    top: 50%;
    right: 9%;
    transform: translateY(-50%);
    width: min(420px, calc(100% - 2rem));
    border-radius: var(--radius-lg);
    background: rgba(9, 9, 9, 0.92);
    color: #bbbbbb;
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(6px);
    overflow: hidden;
}
.login-header {
    background: var(--nrc-noir);
    padding: 1.5rem 1.25rem 1.25rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.login-header img { width: 110px; height: auto; }
.login-header .title .app-name {
    color: var(--nrc-jaune);
    font-size: 1.35rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.login-body {
    padding: 1.5rem 1.5rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.login-body .form-group { display: flex; flex-direction: column; gap: 0.35rem; }
.login-body label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--nrc-gris-300);
}
.login-body input {
    width: 100%;
    background: transparent;
    border: 0;
    border-bottom: 1px solid rgba(255,255,255,0.15);
    color: #fff;
    padding: 0.55rem 0.1rem;
    font-size: 1rem;
    border-radius: 0;
}
.login-body input:focus-visible {
    outline: none;
    border-bottom-color: var(--nrc-jaune);
    box-shadow: 0 1px 0 0 var(--nrc-jaune);
}
.login-footer { padding: 0.75rem 1.5rem 1.5rem; }
.login-footer button {
    width: 100%;
    /* Hauteur explicite garantie : padding seul peut être écrasé si une
       règle globale (form/button reset, font 0…) intervient. */
    min-height: 2.6rem;
    line-height: 1.3;
    padding: 0.7rem 1rem;
    background: var(--nrc-jaune);
    border: 1px solid var(--nrc-jaune);
    color: #111;
    font-size: 0.9rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.login-footer button:hover { background: var(--nrc-jaune-hover); border-color: var(--nrc-jaune-hover); color: #000; }
.login-footer button:focus,
.login-footer button:focus-visible { outline: none; box-shadow: 0 0 0 2px rgba(241, 205, 21, 0.35); }
.login-body .error {
    color: #ff7878;
    font-size: 0.85rem;
    text-align: center;
}
.login-links {
    padding: 0 1.5rem 1.5rem;
    text-align: center;
}
.login-container a.login-link,
.login-container a.login-link:link,
.login-container a.login-link:visited {
    color: var(--nrc-jaune) !important;
    font-size: 0.9rem;
    font-weight: 700;
    text-decoration: underline;
    letter-spacing: .02em;
}
.login-container a.login-link:hover,
.login-container a.login-link:focus {
    color: var(--nrc-jaune-hover) !important;
    text-decoration: underline;
}

/* ── Admin : panels, tables, formulaires ────────────────────── */
.loading-inline {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 1.5rem;
    color: var(--nrc-gris-500);
    font-style: italic;
}
.loading-inline::before {
    content: "";
    display: inline-block;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 3px solid var(--nrc-gris-200);
    border-top-color: var(--nrc-jaune);
    animation: embed-spin 0.85s linear infinite;
    flex-shrink: 0;
}

.admin-panel {
    background: #fff;
    border: 1px solid var(--nrc-gris-200);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}
.admin-panel.scroll-x { overflow-x: auto; }
.admin-panel + .admin-panel { margin-top: 1rem; }
.admin-panel .panel-header {
    padding: 0.9rem 1.25rem;
    background: var(--nrc-gris-100);
    border-bottom: 1px solid var(--nrc-gris-200);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--nrc-gris-500);
    font-weight: 600;
}
.admin-panel .panel-body { padding: 1rem 1.25rem; }

.admin-form-row {
    display: flex;
    gap: 0.75rem;
    align-items: flex-end;
    flex-wrap: wrap;
}
.admin-form-row .field { flex: 1 1 12rem; }
.admin-form-row input,
.admin-form-row select { width: 100%; }

.field { display: flex; flex-direction: column; gap: 0.3rem; }
.field label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--nrc-gris-500);
    font-weight: 600;
}
.field input, .field select {
    font: inherit;
    padding: 0.5rem 0.65rem;
    background: #fff;
    border: 1px solid var(--nrc-gris-300);
    border-radius: var(--radius-sm);
    color: #111;
    min-width: 0;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}
.admin-table thead th {
    text-align: left;
    padding: 0.7rem 1rem;
    background: var(--nrc-gris-100);
    border-bottom: 1px solid var(--nrc-gris-200);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--nrc-gris-500);
    font-weight: 600;
}
.admin-table tbody td {
    padding: 0.7rem 1rem;
    border-bottom: 1px solid var(--nrc-gris-200);
    vertical-align: middle;
}
.admin-table tbody tr:last-child td { border-bottom: 0; }
.admin-table tbody tr:hover { background: var(--nrc-gris-50); }
.admin-table tbody tr.empty-row td {
    text-align: center;
    color: var(--nrc-gris-500);
    padding: 2rem;
    font-style: italic;
}
.admin-table .col-actions { text-align: right; white-space: nowrap; }
.admin-table .col-actions .btn,
.admin-table .col-actions .btn-access-lock {
    padding: .25rem .5rem;
    font-size: .875rem;
    line-height: 1.5;
    border-radius: .25rem;
}
.admin-table input[type="text"],
.admin-table input:not([type]) {
    padding: 0.35rem 0.5rem;
    font-size: 0.88rem;
    border: 1px solid var(--nrc-gris-300);
    border-radius: var(--radius-sm);
}

.cell-readonly { font-size: .88rem; color: var(--nrc-gris-800); }
.cell-muted { color: var(--nrc-gris-400); }
.admin-table tbody tr.row-no-portal { background: var(--nrc-gris-50); }
.admin-table tbody tr.row-no-portal:hover { background: var(--nrc-gris-100); }

.chip-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}
.chip-group label {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.6rem;
    background: var(--nrc-gris-100);
    border: 1px solid var(--nrc-gris-200);
    border-radius: 999px;
    font-size: 0.8rem;
    cursor: pointer;
}
.chip-group label:hover { background: var(--nrc-gris-200); }
.chip-group label:has(input:checked) {
    background: #fff4bf;
    border-color: var(--nrc-jaune);
    color: #333;
}

.error-msg {
    padding: 0.6rem 0.85rem;
    background: #fdecec;
    border: 1px solid #f5b5b5;
    color: #9e1d1a;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    margin-top: 0.75rem;
}

/* ── Badges journal ─────────────────────────────────────── */
.badge-allow { background: #d9f3dc; color: #1e5a23; }
.badge-deny  { background: #f9d4d0; color: #8c2a1f; }
.row-deny td { background: #fff6f5; }

/* ── Toast admin ────────────────────────────────────────── */
.admin-toast {
    position: fixed;
    top: 1rem;
    right: 1rem;
    background: var(--nrc-vert);
    color: #fff;
    padding: 0.55rem 1rem;
    border-radius: 6px;
    box-shadow: 0 4px 14px rgba(0,0,0,.18);
    font-weight: 600;
    font-size: 0.9rem;
    z-index: 10000;
    animation: toast-in .15s ease-out;
}
@keyframes toast-in {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Accès MadCap (grants / denials) ────────────────────── */
.expand-row > td {
    background: var(--nrc-gris-100);
    padding: 1rem 1.25rem;
    border-top: 2px solid var(--nrc-bleu);
}
.access-site {
    margin-bottom: 1rem;
    background: #fff;
    border: 1px solid var(--nrc-gris-300);
    border-radius: 6px;
    padding: 0.75rem 1rem;
}
.access-site:last-child { margin-bottom: 0; }
.access-site-header { font-weight: 600; margin-bottom: 0.5rem; }
.access-site-header small { color: var(--nrc-gris-500); font-weight: 400; margin-left: 0.25rem; }
.access-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 720px) { .access-cols { grid-template-columns: 1fr; } }
.access-col-title { font-weight: 600; font-size: 0.85rem; margin-bottom: 0.4rem; }
.access-empty { color: var(--nrc-gris-500); font-size: 0.82rem; font-style: italic; margin-bottom: 0.4rem; }
.access-list { list-style: none; padding: 0; margin: 0 0 0.5rem 0; }
.access-list li { display: flex; align-items: center; gap: 0.4rem; padding: 0.2rem 0; font-size: 0.85rem; }
.access-list code { background: var(--nrc-gris-100); padding: 0.1rem 0.4rem; border-radius: 3px; }
.access-reason { color: var(--nrc-gris-500); font-size: 0.78rem; }
.access-add { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.access-add input { flex: 1 1 10rem; min-width: 0; padding: 0.25rem 0.4rem; font-size: 0.85rem; border: 1px solid var(--nrc-gris-300); border-radius: var(--radius-sm); }
.access-add-friendly { display: flex; flex-direction: column; gap: .35rem; }
.access-add-row { display: flex; gap: 0.4rem; }
.access-add-row input { flex: 1 1 10rem; min-width: 0; padding: 0.25rem 0.4rem; font-size: 0.85rem; border: 1px solid var(--nrc-gris-300); border-radius: var(--radius-sm); }
.access-children-toggle { display: flex; align-items: center; gap: .35rem; font-size: .82rem; color: var(--nrc-gris-700); cursor: pointer; }
.access-children-toggle input[type="checkbox"] { margin: 0; }
.access-preview { color: var(--nrc-gris-500); font-size: .78rem; }
.access-preview strong { color: var(--nrc-gris-700); }
.access-reason-input { width: 100%; padding: 0.25rem 0.4rem; font-size: 0.85rem; border: 1px solid var(--nrc-gris-300); border-radius: var(--radius-sm); }
.access-rule-label { font-size: .82rem; flex: 1; }
.access-rule-raw { font-size: .72rem; color: var(--nrc-gris-400); background: transparent; padding: 0; }
.btn-link-danger {
    background: none;
    border: none;
    color: var(--nrc-rouge);
    font-weight: 700;
    cursor: pointer;
    padding: 0 0.3rem;
}

/* ── Env banner (DEV/STAGING hashed stripes) ───────────── */
.env-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 20px;
    z-index: 9999;
    overflow: hidden;
    pointer-events: none;
}

/* ── Dirty row indicator (inline grid edits) ────────────── */
.dirty-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--nrc-jaune);
    box-shadow: 0 0 0 2px rgba(241, 205, 21, .25);
    margin-right: .5rem;
    vertical-align: middle;
    flex-shrink: 0;
}

/* ── Overlay admin accès MadCap (sur /embed) ───────────── */
.embed-access-fab {
    position: absolute;
    bottom: 1.25rem;
    right: 1.25rem;
    width: 48px;
    height: 48px;
    padding: 0;
    border-radius: 50%;
    border: 2px solid var(--nrc-bleu-pale);
    background: var(--nrc-noir);
    color: var(--nrc-bleu-pale);
    cursor: pointer;
    z-index: 1000;
    box-shadow: 0 4px 14px rgba(0, 0, 0, .35);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform .15s, background .15s, color .15s, box-shadow .15s;
}
.embed-access-fab i { font-size: 1.25rem; }
.embed-access-fab:hover {
    background: var(--nrc-bleu-pale);
    color: var(--nrc-noir);
    transform: scale(1.05);
}
.embed-access-fab.open {
    background: var(--nrc-bleu-pale);
    color: var(--nrc-noir);
    box-shadow: 0 6px 18px rgba(0, 225, 255, .5);
}

.embed-access-panel {
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
    bottom: 5rem;
    width: 24rem;
    max-width: calc(100% - 2.5rem);
    background: #fff;
    border: 1px solid var(--nrc-gris-300);
    border-radius: 10px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, .25);
    z-index: 1001;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: embed-access-slide .18s ease-out;
}
@keyframes embed-access-slide {
    from { opacity: 0; transform: translateX(10px); }
    to { opacity: 1; transform: translateX(0); }
}
.embed-access-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .7rem .9rem;
    background: var(--nrc-noir);
    color: var(--nrc-jaune);
    font-weight: 700;
    letter-spacing: .03em;
}
.embed-access-close {
    background: transparent;
    border: none;
    color: var(--nrc-jaune);
    cursor: pointer;
    padding: .2rem .4rem;
    border-radius: 4px;
}
.embed-access-close:hover { background: rgba(255, 255, 255, .1); }
.embed-access-body {
    padding: .9rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: .75rem;
}
.embed-access-field { display: flex; flex-direction: column; gap: .25rem; }
.embed-access-field > label {
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--nrc-gris-600);
}
.embed-access-field input[type="text"],
.embed-access-field select {
    padding: .4rem .5rem;
    border: 1px solid var(--nrc-gris-300);
    border-radius: 5px;
    font-size: .85rem;
}
.embed-access-field code {
    font-size: .75rem;
    color: var(--nrc-noir);
    background: rgba(0, 0, 0, .05);
    padding: .1rem .3rem;
    border-radius: 3px;
}
.embed-access-radios {
    display: flex;
    gap: .4rem;
}
.embed-access-radios > label {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .3rem;
    padding: .45rem .5rem;
    border: 1.5px solid var(--nrc-gris-300);
    border-radius: 6px;
    cursor: pointer;
    font-size: .82rem;
    font-weight: 600;
    transition: background .12s, border-color .12s, color .12s;
}
.embed-access-radios > label input { display: none; }
.embed-access-radios > label:hover { border-color: var(--nrc-gris-500); }
.embed-access-radios > label.active.grant {
    background: #2e7d32;
    border-color: #2e7d32;
    color: #fff;
}
.embed-access-radios > label.active.deny {
    background: var(--nrc-rouge);
    border-color: var(--nrc-rouge);
    color: #fff;
}
.embed-access-toast {
    padding: .5rem .7rem;
    border-radius: 6px;
    font-size: .82rem;
    font-weight: 600;
}
.embed-access-toast.ok { background: rgba(46, 125, 50, .12); color: #1b5e20; border: 1px solid rgba(46, 125, 50, .25); }
.embed-access-toast.error { background: rgba(198, 40, 40, .12); color: #8b1111; border: 1px solid rgba(198, 40, 40, .25); }
.embed-access-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: .25rem;
    max-height: 14rem;
    overflow-y: auto;
}
.embed-access-list li {
    display: flex;
    align-items: center;
    gap: .4rem;
    padding: .3rem .45rem;
    border-radius: 5px;
    border: 1px solid var(--nrc-gris-200);
    background: var(--nrc-gris-100);
    font-size: .78rem;
}
.embed-access-list li.allow { border-left: 3px solid #2e7d32; }
.embed-access-list li.deny { border-left: 3px solid var(--nrc-rouge); }
.embed-access-list li code { flex: 1; background: transparent; padding: 0; }
.embed-access-remove {
    background: transparent;
    border: none;
    color: var(--nrc-rouge);
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 .3rem;
}
.embed-access-remove:hover { color: #8b1111; }

/* ── Bouton cadenas (config accès MadCap par groupe) ────── */
.btn-access-lock {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .3rem;
    padding: .25rem .5rem;
    border: 1.5px solid var(--nrc-jaune);
    background: var(--nrc-noir);
    color: var(--nrc-jaune);
    border-radius: .25rem;
    cursor: pointer;
    font-size: .875rem;
    font-weight: 600;
    line-height: 1.5;
    transition: background .15s, color .15s, box-shadow .15s, transform .08s;
    vertical-align: middle;
}
.btn-access-lock i { font-size: .875rem; line-height: 1; }
.btn-access-lock:hover {
    background: var(--nrc-jaune);
    color: var(--nrc-noir);
    box-shadow: 0 0 0 5px rgba(241, 205, 21, .25);
    transform: scale(1.05);
}
.btn-access-lock:active { transform: scale(.95); }
.btn-access-lock.active {
    background: var(--nrc-jaune);
    color: var(--nrc-noir);
    box-shadow: 0 0 0 3px rgba(241, 205, 21, .3);
}

/* ── Carte rabais employé ───────────────────────────────── */
.carte-rabais-page {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.carte-rabais-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.carte-rabais-wrapper {
    display: flex;
    justify-content: center;
}

.carte-rabais {
    position: relative;
    width: 100%;
    max-width: 720px;
    aspect-ratio: 1500 / 848;
    background: var(--nrc-noir);
    box-shadow: 0 10px 30px rgba(0, 0, 0, .25);
    border-radius: 6px;
    overflow: hidden;
}

.carte-rabais-bg {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.carte-rabais-overlay {
    position: absolute;
    left: 17%;
    right: 3%;
    bottom: 4%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .55rem 1rem;
    /* Même teinte exacte que le bandeau jaune du PNG (#F3D500), pas
       --nrc-jaune (#f1cd15) qui crée une différence visible. */
    background: #F3D500;
    color: var(--nrc-noir);
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .35);
    font-family: "Segoe UI", system-ui, sans-serif;
}

.carte-rabais-tag {
    font-weight: 800;
    font-size: clamp(14px, 2.2vw, 22px);
    letter-spacing: .02em;
    text-transform: lowercase;
}

.carte-rabais-name {
    font-weight: 800;
    font-size: clamp(14px, 2.4vw, 24px);
    text-transform: uppercase;
    letter-spacing: .03em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Overlay qui couvre la mention de validité hardcoded sur l'image PNG.
   Coordonnées issues d'une analyse pixel par pixel de carte-rabais.png
   (2000×1143) :
   - Le 2e bandeau jaune occupe y=15.3%→30.2%
   - Le texte sombre « Valide du... » est à y=22.0%→25.1%, x=41.2%→84.2%
   - À cette hauteur, la diagonale noire de gauche s'étend jusqu'à x=25.6%
     — d'où left:26% (et non 17% comme le bandeau du bas qui n'a pas de
     diagonale à cet endroit). Fond jaune assorti, fondu dans le bandeau. */
.carte-rabais-validity-cover {
    position: absolute;
    top: 21%;
    left: 26%;
    right: 3%;
    height: 5%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-family: "Segoe UI", system-ui, sans-serif;
    font-weight: 700;
    font-size: clamp(11px, 1.8vw, 22px);
    letter-spacing: .02em;
    color: #161616;
    /* Teinte exacte du bandeau jaune dans carte-rabais.png (#F3D500),
       qui diffère de --nrc-jaune (#f1cd15). On fixe la valeur littérale
       pour que le cover se fonde parfaitement dans l'image. */
    background: #F3D500;
    line-height: 1;
}

/* ═══════════════════════════════════════════════════════════════════════
   Responsive — tablette (<992px) puis mobile (<768px)
   Le site est en flex-row avec sidebar fixe ; on adapte progressivement.
   ═══════════════════════════════════════════════════════════════════════ */

/* Tablette portrait + mobile : alléger les padding et autoriser le wrap */
@media (max-width: 991.98px) {
    .carte-rabais-page { padding: 1rem; }
    .admin-panel { padding: 0.85rem; }
    .admin-panel .panel-body { padding: 0.5rem 0; }
    .carte-rabais-toolbar { flex-wrap: wrap; }
    /* Tables admin : scroll horizontal quand on dépasse */
    .admin-panel { overflow-x: auto; }
    .admin-table { font-size: 0.9rem; }
    /* Inputs forms : ne pas déborder */
    .form-control, .form-select { max-width: 100%; box-sizing: border-box; }
    /* Login : ramener vers le centre (perdrait du sens collé tout à droite) */
    .login-container { right: 5%; }
}

/* Mobile : sidebar devient overlay (hamburger toujours dispo), content
   prend toute la largeur, tout passe en colonne. */
@media (max-width: 767.98px) {
    /* Spacer à 0 — le sidebar absolute ne réserve plus d'espace */
    .app-shell-layout .app-sidebar-spacer { width: 0 !important; }

    /* Sidebar par défaut hors écran. L'état Blazor "expanded" la fait
       glisser en overlay. L'état "collapsed" (icons-only desktop) n'a pas
       de sens sur mobile : on la traite comme hidden. */
    .app-shell-layout .app-sidebar {
        transform: translateX(-100%);
        width: min(85vw, 18rem) !important;
        box-shadow: 0 0 24px rgba(0, 0, 0, 0.5);
    }
    .app-shell-layout.sidebar-expanded .app-sidebar {
        transform: translateX(0);
    }
    /* En "collapsed" sur mobile : sidebar masqué ; hamburger visible. */
    .app-shell-layout.sidebar-collapsed .app-sidebar { transform: translateX(-100%); }

    /* Bouton hamburger : visible dans tout état SAUF expanded
       (overlay déjà ouvert → on offre plutôt le X pour fermer). */
    .app-shell-layout:not(.sidebar-expanded) .app-sidebar-show {
        display: inline-flex;
    }

    /* Labels visibles dès que le sidebar est expanded en mobile */
    .app-shell-layout.sidebar-expanded .app-nav-label,
    .app-shell-layout.sidebar-expanded .app-nav-heading { display: inline; }

    /* Login : forcer centrage horizontal (right:9% perd son sens en 375px) */
    .login-container {
        right: 50%;
        transform: translate(50%, -50%);
        width: min(420px, calc(100% - 1rem));
    }
    .login-page { background-position: 50% 50%; }

    /* Tables et toolbars admin : scroll horizontal + tailles compactes */
    .admin-panel { padding: 0.6rem; border-radius: 4px; }
    .admin-panel .panel-header { font-size: 0.95rem; padding: 0.5rem 0.6rem; }
    .admin-table { font-size: 0.82rem; }
    .admin-table th, .admin-table td { padding: 0.35rem 0.45rem; }

    /* Calendrier : empile (gros écart de date / horaire qui sinon déborde) */
    .carte-rabais-page,
    [class^="page-"] { padding: 0.75rem; }
    h1, h2 { font-size: 1.3rem !important; line-height: 1.25; }
    h3 { font-size: 1.1rem !important; }

    /* Champ recherche admin (SearchableSelect) plein écran */
    .searchable-select { max-width: 100% !important; }
    .form-group { max-width: 100% !important; }

    /* MadCap embed : occupe toute la place dispo */
    .app-embed-frame, .app-embed-container { height: calc(100vh - 0px); }

    /* Brand bar plus compacte */
    .app-sidebar-brand { padding: 0.4rem 0.5rem; min-height: 3rem; }

    /* Boutons : tap target min 44px (recommandation Apple/Material) */
    .btn { min-height: 44px; padding-top: 0.4rem; padding-bottom: 0.4rem; }
    .app-sidebar-ctrl { min-height: 36px; min-width: 36px; }
}

@media print {
    .no-print { display: none !important; }
    .app-shell-layout .app-sidebar,
    .app-shell-layout .app-sidebar-spacer,
    .app-sidebar-show,
    .env-banner { display: none !important; }
    .app-shell-layout .app-main { overflow: visible !important; }
    .carte-rabais-page { padding: 0 !important; }
    .carte-rabais {
        max-width: 100% !important;
        box-shadow: none !important;
        border-radius: 0 !important;
        page-break-inside: avoid;
    }
    body { background: #fff !important; }
}

/* ── SearchableSelect (combobox unique) ─────────────────────────────────
   Single input qui ouvre un panneau filtré au focus (:focus-within),
   sans JS. Voir Components/Shared/SearchableSelect.razor. */
.searchable-select {
    position: relative;
    outline: none;
}

.searchable-select-label {
    display: block;
    font-size: .8rem;
    color: var(--nrc-gris-500);
    margin-bottom: .25rem;
}

.searchable-select-input {
    width: 100%;
    padding: .5rem .75rem;
    border: 1px solid var(--nrc-gris-300);
    border-radius: 4px;
    font: inherit;
    background: #fff;
    box-sizing: border-box;
}

.searchable-select-input:focus {
    outline: none;
    border-color: var(--nrc-noir);
    box-shadow: 0 0 0 2px rgba(0, 0, 0, .08);
}

.searchable-select-panel {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 320px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid var(--nrc-gris-300);
    border-radius: 4px;
    box-shadow: 0 6px 16px rgba(0, 0, 0, .14);
    z-index: 50;
    margin-top: .25rem;
    display: none;
}

.searchable-select:focus-within .searchable-select-panel {
    display: block;
}

.searchable-select-count {
    padding: .35rem .75rem;
    font-size: .75rem;
    color: var(--nrc-gris-500);
    border-bottom: 1px solid var(--nrc-gris-200);
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 1;
}

.searchable-select-empty {
    padding: .75rem;
    color: var(--nrc-gris-500);
    text-align: center;
    font-size: .85rem;
}

.searchable-select-item {
    display: block;
    width: 100%;
    padding: .5rem .75rem;
    border: none;
    background: transparent;
    text-align: left;
    cursor: pointer;
    border-bottom: 1px solid var(--nrc-gris-100);
    font: inherit;
    color: inherit;
}

.searchable-select-item:hover,
.searchable-select-item:focus {
    background: var(--nrc-gris-100);
    outline: none;
}

.searchable-select-item.is-selected {
    background: #fff8d0;
    font-weight: 600;
}

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