/* ==========================================================================
   CENELIS CONNECT — DESIGN SYSTEM INSTITUTIONNEL (IDENTITÉ CENELIS ACADEMY)
   Palette Mineral Pine (#145346) & Burnished Copper (#B85D19) · Zéro emoji
   ========================================================================== */

:root {
    --cc-bg: #F4F7F5;
    --cc-bg-elevated: #FFFFFF;
    --cc-bg-subtle: #EBF1EE;
    --cc-bg-muted: #E3ECE8;
    --cc-surface-glass: rgba(255, 255, 255, 0.88);
    --cc-ink: #0E1B17;
    --cc-ink-secondary: #3F544D;
    --cc-ink-muted: #687E76;
    --cc-border: #D6E2DC;
    --cc-border-strong: #B8CCC3;

    /* Pin Minéral Profond (Cenelis Academy) */
    --cc-pine: #145346;
    --cc-pine-hover: #0E3E34;
    --cc-pine-soft: #E6F2EE;
    --cc-pine-border: #B2D6CC;
    --cc-pine-ink: #0C3B31;

    /* Cuivre Ambré Chaleureux */
    --cc-copper: #B85D19;
    --cc-copper-hover: #964910;
    --cc-copper-soft: #FDF2E9;
    --cc-copper-border: #F0CFAF;

    /* Statuts */
    --cc-danger: #B91C1C;
    --cc-danger-soft: #FEF2F2;
    --cc-danger-border: #FECACA;
    --cc-success: #15803D;
    --cc-success-soft: #DCFCE7;
    --cc-success-border: #86EFAC;

    --cc-shadow-xs: 0 1px 2px rgba(14, 27, 23, 0.04);
    --cc-shadow-sm: 0 4px 12px rgba(14, 27, 23, 0.05), 0 1px 2px rgba(14, 27, 23, 0.04);
    --cc-shadow-md: 0 14px 32px rgba(14, 27, 23, 0.08), 0 2px 6px rgba(14, 27, 23, 0.04);
    --cc-shadow-lg: 0 24px 54px rgba(14, 27, 23, 0.13);

    --cc-radius-sm: 10px;
    --cc-radius-md: 14px;
    --cc-radius-lg: 20px;
    --cc-radius-xl: 26px;
    --cc-header-h: 68px;
}

[data-theme="dark"] {
    --cc-bg: #0A1210;
    --cc-bg-elevated: #111C19;
    --cc-bg-subtle: #162520;
    --cc-bg-muted: #1D302A;
    --cc-surface-glass: rgba(15, 26, 22, 0.88);
    --cc-ink: #ECF5F2;
    --cc-ink-secondary: #B4C8C1;
    --cc-ink-muted: #7F988F;
    --cc-border: #22362F;
    --cc-border-strong: #2F4B42;

    --cc-pine: #289E84;
    --cc-pine-hover: #34B598;
    --cc-pine-soft: rgba(40, 158, 132, 0.15);
    --cc-pine-border: rgba(40, 158, 132, 0.36);
    --cc-pine-ink: #6EE7CB;

    --cc-copper: #EA8B42;
    --cc-copper-hover: #F59E5B;
    --cc-copper-soft: rgba(234, 139, 66, 0.14);
    --cc-copper-border: rgba(234, 139, 66, 0.35);

    --cc-danger: #F87171;
    --cc-danger-soft: rgba(248, 113, 113, 0.14);
    --cc-danger-border: rgba(248, 113, 113, 0.34);
    --cc-success: #4ADE80;
    --cc-success-soft: rgba(74, 222, 128, 0.14);
    --cc-success-border: rgba(74, 222, 128, 0.34);

    --cc-shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.28);
    --cc-shadow-sm: 0 4px 14px rgba(0, 0, 0, 0.36);
    --cc-shadow-md: 0 14px 34px rgba(0, 0, 0, 0.48);
    --cc-shadow-lg: 0 26px 60px rgba(0, 0, 0, 0.68);
}

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

html {
    overflow-x: clip;
}

body.cc-body {
    margin: 0;
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background:
        radial-gradient(900px 460px at 8% -6%, var(--cc-pine-soft), transparent 62%),
        radial-gradient(760px 420px at 94% 0%, var(--cc-copper-soft), transparent 58%),
        var(--cc-bg);
    color: var(--cc-ink);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

code, kbd {
    font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Consolas, monospace;
}

a {
    color: var(--cc-pine);
    text-decoration: none;
}

button {
    font-family: inherit;
    cursor: pointer;
}

/* ==========================================================================
   1. HEADER INSTITUTIONNEL (STYLE CENELIS ACADEMY)
   ========================================================================== */
.cc-header {
    position: sticky;
    top: 0;
    z-index: 500;
    height: var(--cc-header-h);
    background: var(--cc-surface-glass);
    backdrop-filter: blur(16px) saturate(160%);
    -webkit-backdrop-filter: blur(16px) saturate(160%);
    border-bottom: 1px solid var(--cc-border);
}

.cc-header__inner {
    max-width: 1280px;
    height: 100%;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.cc-brand {
    display: inline-flex;
    align-items: center;
    gap: 11px;
    color: var(--cc-ink);
    flex-shrink: 0;
}

.cc-brand__mark {
    width: 38px;
    height: 38px;
    border-radius: 11px;
    background: linear-gradient(135deg, #145346 0%, #0D382F 100%);
    color: #FFFFFF;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(20, 83, 70, 0.25);
    flex-shrink: 0;
}

.cc-brand__mark svg {
    width: 20px;
    height: 20px;
}

.cc-brand__copy {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}

.cc-brand__eyebrow {
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--cc-copper);
}

.cc-brand__title {
    font-size: 16.5px;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--cc-ink);
}

.cc-header__actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.cc-env-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 999px;
    background: var(--cc-bg-subtle);
    border: 1px solid var(--cc-border);
    font-size: 12px;
    font-weight: 700;
    color: var(--cc-ink-secondary);
}

.cc-env-pill__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--cc-pine);
    box-shadow: 0 0 0 3px var(--cc-pine-soft);
}

.cc-icon-btn {
    width: 38px;
    height: 38px;
    border-radius: 11px;
    border: 1px solid var(--cc-border);
    background: var(--cc-bg-elevated);
    color: var(--cc-ink-secondary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.16s ease, color 0.16s ease, background 0.16s ease;
    flex-shrink: 0;
}

.cc-icon-btn:hover {
    border-color: var(--cc-pine-border);
    color: var(--cc-pine);
}

.cc-icon-btn svg {
    width: 18px;
    height: 18px;
}

[data-theme="light"] .icon-moon { display: block; }
[data-theme="light"] .icon-sun { display: none; }
[data-theme="dark"] .icon-moon { display: none; }
[data-theme="dark"] .icon-sun { display: block; }

.cc-agent-pill {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 4px 12px 4px 5px;
    border-radius: 999px;
    background: var(--cc-bg-elevated);
    border: 1px solid var(--cc-border);
    max-width: 250px;
}

.cc-agent-pill__avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--cc-pine);
    color: #FFFFFF;
    font-size: 12.5px;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.cc-agent-pill__meta {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
    min-width: 0;
}

.cc-agent-pill__name {
    font-size: 12.5px;
    font-weight: 700;
    color: var(--cc-ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cc-agent-pill__role {
    font-size: 10.5px;
    font-weight: 600;
    color: var(--cc-ink-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ==========================================================================
   2. PAGE DE CONNEXION AGENT (/ & /login) — SANS CRÉATION
   ========================================================================== */
.cc-auth-main {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
}

.cc-auth-grid {
    width: 100%;
    max-width: 1120px;
    display: grid;
    grid-template-columns: 1.08fr 0.92fr;
    gap: 44px;
    align-items: center;
}

.cc-eyebrow-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 13px;
    border-radius: 999px;
    background: var(--cc-pine-soft);
    border: 1px solid var(--cc-pine-border);
    color: var(--cc-pine-ink);
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.cc-eyebrow-badge svg {
    width: 14px;
    height: 14px;
}

.cc-showcase-title {
    margin: 18px 0 14px;
    font-size: clamp(2rem, 3.2vw, 2.85rem);
    font-weight: 800;
    line-height: 1.12;
    letter-spacing: -0.03em;
    color: var(--cc-ink);
}

.cc-showcase-title em {
    font-family: 'Instrument Serif', Georgia, serif;
    font-style: italic;
    font-weight: 400;
    color: var(--cc-pine);
    font-size: 1.08em;
}

.cc-showcase-lead {
    margin: 0 0 28px;
    font-size: 15.5px;
    color: var(--cc-ink-secondary);
    max-width: 520px;
}

.cc-feature-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.cc-feature-item {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 14px 16px;
    border-radius: var(--cc-radius-md);
    background: var(--cc-bg-elevated);
    border: 1px solid var(--cc-border);
    box-shadow: var(--cc-shadow-xs);
}

.cc-feature-item__icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: var(--cc-pine-soft);
    color: var(--cc-pine);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.cc-feature-item__icon svg {
    width: 19px;
    height: 19px;
}

.cc-feature-item strong {
    display: block;
    font-size: 14px;
    font-weight: 700;
    color: var(--cc-ink);
    margin-bottom: 2px;
}

.cc-feature-item p {
    margin: 0;
    font-size: 13px;
    color: var(--cc-ink-secondary);
}

.cc-login-card {
    background: var(--cc-bg-elevated);
    border: 1px solid var(--cc-border);
    border-radius: var(--cc-radius-xl);
    padding: 34px 32px 28px;
    box-shadow: var(--cc-shadow-md);
}

.cc-card-kicker {
    display: inline-block;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--cc-copper);
    margin-bottom: 6px;
}

.cc-login-card__head h2 {
    margin: 0 0 8px;
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -0.025em;
}

.cc-login-card__head p {
    margin: 0 0 22px;
    font-size: 13.5px;
    color: var(--cc-ink-secondary);
}

.cc-login-card__head code {
    padding: 2px 6px;
    border-radius: 6px;
    background: var(--cc-bg-subtle);
    color: var(--cc-pine);
    font-size: 12px;
    font-weight: 600;
}

.cc-alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border-radius: var(--cc-radius-sm);
    margin-bottom: 18px;
    font-size: 13px;
    font-weight: 600;
}

.cc-alert.is-hidden {
    display: none;
}

.cc-alert svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    margin-top: 1px;
}

.cc-alert--danger {
    background: var(--cc-danger-soft);
    border: 1px solid var(--cc-danger-border);
    color: var(--cc-danger);
}

.cc-field {
    margin-bottom: 16px;
}

.cc-field label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: var(--cc-ink);
    margin-bottom: 7px;
}

.cc-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.cc-input-icon {
    position: absolute;
    left: 13px;
    color: var(--cc-ink-muted);
    display: inline-flex;
    pointer-events: none;
}

.cc-input-icon svg {
    width: 18px;
    height: 18px;
}

.cc-input-wrap input {
    width: 100%;
    height: 48px;
    padding: 0 44px 0 42px;
    border-radius: 12px;
    border: 1.5px solid var(--cc-border);
    background: var(--cc-bg);
    color: var(--cc-ink);
    font-family: inherit;
    font-size: 15px;
    font-weight: 500;
    transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.cc-input-wrap input:focus {
    outline: none;
    border-color: var(--cc-pine);
    background: var(--cc-bg-elevated);
    box-shadow: 0 0 0 4px var(--cc-pine-soft);
}

.cc-pw-toggle {
    position: absolute;
    right: 8px;
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--cc-ink-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.cc-pw-toggle:hover {
    color: var(--cc-ink);
    background: var(--cc-bg-subtle);
}

.cc-pw-toggle svg {
    width: 18px;
    height: 18px;
}

.cc-check-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 6px 0 20px;
    font-size: 13px;
    font-weight: 600;
    color: var(--cc-ink-secondary);
    cursor: pointer;
}

.cc-check-row input {
    width: 17px;
    height: 17px;
    accent-color: var(--cc-pine);
}

.cc-primary-btn {
    width: 100%;
    height: 50px;
    border: none;
    border-radius: 13px;
    background: linear-gradient(135deg, #145346 0%, #0E3E34 100%);
    color: #FFFFFF;
    font-size: 14.5px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 8px 20px rgba(20, 83, 70, 0.25);
    transition: transform 0.14s ease, box-shadow 0.16s ease, opacity 0.16s ease;
}

[data-theme="dark"] .cc-primary-btn {
    background: linear-gradient(135deg, #289E84 0%, #197862 100%);
}

.cc-primary-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 26px rgba(20, 83, 70, 0.32);
}

.cc-primary-btn:disabled {
    opacity: 0.65;
    cursor: wait;
    transform: none;
}

.cc-primary-btn svg {
    width: 18px;
    height: 18px;
}

.cc-login-card__foot {
    margin-top: 22px;
    padding-top: 16px;
    border-top: 1px solid var(--cc-border);
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 12px;
    color: var(--cc-ink-muted);
    line-height: 1.45;
}

.cc-login-card__foot svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    color: var(--cc-copper);
    margin-top: 1px;
}

/* ==========================================================================
   3. ÉCRAN CODE PIN (/pin) — PC (CLAVIER/NUMPAD) & MOBILE (CERCLES DÉVERROUILLAGE)
   ========================================================================== */
html.cc-pin-html,
body.cc-pin-body {
    height: 100dvh;
    max-height: 100dvh;
    overflow: hidden;
    overscroll-behavior: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    touch-action: manipulation;
}

.cc-pin-viewport {
    width: 100%;
    height: 100dvh;
    max-height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.cc-pin-topbar {
    flex-shrink: 0;
    height: 62px;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: var(--cc-surface-glass);
    border-bottom: 1px solid var(--cc-border);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

.cc-pin-topbar__right {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.cc-pin-stage {
    flex: 1;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow: hidden;
}

.cc-pin-card {
    width: 100%;
    max-width: 500px;
    background: var(--cc-bg-elevated);
    border: 1px solid var(--cc-border);
    border-radius: var(--cc-radius-xl);
    padding: 30px 28px 26px;
    box-shadow: var(--cc-shadow-lg);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.cc-pin-head {
    max-width: 420px;
}

.cc-pin-badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 5px 12px;
    border-radius: 999px;
    background: var(--cc-pine-soft);
    border: 1px solid var(--cc-pine-border);
    color: var(--cc-pine-ink);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.cc-pin-badge svg {
    width: 13.5px;
    height: 13.5px;
}

.cc-pin-title {
    margin: 12px 0 6px;
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -0.025em;
    color: var(--cc-ink);
}

.cc-pin-subtitle {
    margin: 0;
    font-size: 13.5px;
    color: var(--cc-ink-secondary);
    line-height: 1.45;
}

/* Sélecteur 4 / 6 chiffres lors de la création */
.cc-setup-bar {
    margin-top: 14px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.cc-length-switch {
    display: inline-flex;
    padding: 3px;
    border-radius: 999px;
    background: var(--cc-bg-subtle);
    border: 1px solid var(--cc-border);
    gap: 3px;
}

.cc-len-btn {
    border: none;
    background: transparent;
    padding: 6px 15px;
    border-radius: 999px;
    font-size: 12.5px;
    font-weight: 700;
    color: var(--cc-ink-secondary);
    transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
    touch-action: manipulation;
}

.cc-len-btn.is-active {
    background: var(--cc-pine);
    color: #FFFFFF;
    box-shadow: 0 2px 8px rgba(20, 83, 70, 0.25);
}

.cc-step-pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 12px;
    font-weight: 700;
    color: var(--cc-copper);
}

.cc-step-pill__num {
    padding: 2px 7px;
    border-radius: 999px;
    background: var(--cc-copper-soft);
    border: 1px solid var(--cc-copper-border);
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
}

/* Pastilles du code (4 ou 6 ronds) */
.cc-dots-stage {
    margin: 22px 0 14px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cc-dots {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
}

.cc-dot {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid var(--cc-border-strong);
    background: var(--cc-bg);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.14s ease, background 0.14s ease, transform 0.14s cubic-bezier(0.22, 1, 0.36, 1);
}

.cc-dot__core {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: transparent;
    transform: scale(0.3);
    transition: transform 0.14s cubic-bezier(0.22, 1, 0.36, 1), background 0.14s ease;
}

.cc-dot.is-filled {
    border-color: var(--cc-pine);
    background: var(--cc-pine-soft);
    transform: scale(1.08);
}

.cc-dot.is-filled .cc-dot__core {
    background: var(--cc-pine);
    transform: scale(1);
}

.cc-dots.is-success .cc-dot {
    border-color: var(--cc-success);
    background: var(--cc-success-soft);
}

.cc-dots.is-success .cc-dot__core {
    background: var(--cc-success);
    transform: scale(1);
}

.cc-dots.is-error {
    animation: ccShake 0.42s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

.cc-dots.is-error .cc-dot {
    border-color: var(--cc-danger);
    background: var(--cc-danger-soft);
}

.cc-dots.is-error .cc-dot__core {
    background: var(--cc-danger);
    transform: scale(1);
}

@keyframes ccShake {
    10%, 90% { transform: translate3d(-3px, 0, 0); }
    20%, 80% { transform: translate3d(5px, 0, 0); }
    30%, 50%, 70% { transform: translate3d(-7px, 0, 0); }
    40%, 60% { transform: translate3d(7px, 0, 0); }
}

/* Message d'état / erreur sous les pastilles */
.cc-pin-feedback {
    width: 100%;
    min-height: 36px;
    padding: 7px 14px;
    border-radius: 10px;
    background: var(--cc-bg-subtle);
    border: 1px solid var(--cc-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--cc-ink-secondary);
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.cc-pin-feedback strong {
    color: var(--cc-pine);
}

.cc-pin-feedback.is-danger {
    background: var(--cc-danger-soft);
    border-color: var(--cc-danger-border);
    color: var(--cc-danger);
    font-weight: 700;
}

.cc-pin-feedback.is-success {
    background: var(--cc-success-soft);
    border-color: var(--cc-success-border);
    color: var(--cc-success);
    font-weight: 700;
}

/* Indication PC (Clavier / Numpad) */
.cc-pc-hint {
    margin-top: 18px;
    padding: 14px 16px;
    width: 100%;
    border-radius: var(--cc-radius-md);
    background: var(--cc-bg);
    border: 1px dashed var(--cc-border-strong);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.cc-pc-hint__keys {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--cc-ink-muted);
    font-size: 12px;
    font-weight: 700;
}

.cc-pc-hint__keys kbd {
    padding: 3px 8px;
    border-radius: 7px;
    background: var(--cc-bg-elevated);
    border: 1px solid var(--cc-border-strong);
    box-shadow: 0 2px 0 var(--cc-border);
    color: var(--cc-ink);
    font-size: 12px;
    font-weight: 700;
}

.cc-pc-hint p {
    margin: 0;
    font-size: 12.5px;
    color: var(--cc-ink-muted);
    max-width: 370px;
}

/* Pavé numérique rond type déverrouillage téléphone (masqué sur PC souris/clavier) */
.cc-keypad {
    display: none;
}

/* Bascule Mobile & Écrans Tactiles : affichage des ronds de déverrouillage téléphone */
@media (max-width: 820px), (pointer: coarse) {
    body.cc-pin-body {
        position: fixed;
        inset: 0;
        width: 100%;
    }

    .cc-pin-topbar {
        height: 54px;
        padding: 0 14px;
    }

    .cc-brand--compact .cc-brand__eyebrow {
        display: none;
    }

    .cc-brand--compact .cc-brand__mark {
        width: 32px;
        height: 32px;
        border-radius: 9px;
    }

    .cc-brand--compact .cc-brand__title {
        font-size: 15px;
    }

    .cc-agent-pill {
        max-width: 175px;
        padding: 3px 10px 3px 4px;
    }

    .cc-agent-pill__role {
        display: none;
    }

    .cc-pin-stage {
        padding: 8px 14px calc(12px + env(safe-area-inset-bottom, 0px));
        align-items: stretch;
    }

    .cc-pin-card {
        max-width: 420px;
        margin: 0 auto;
        background: transparent;
        border: none;
        box-shadow: none;
        padding: 4px 4px 0;
        justify-content: space-between;
    }

    .cc-pin-title {
        margin: 8px 0 4px;
        font-size: 21px;
    }

    .cc-pin-subtitle {
        font-size: 12.5px;
    }

    .cc-setup-bar {
        margin-top: 8px;
        gap: 6px;
    }

    .cc-dots-stage {
        margin: 10px 0 8px;
        min-height: 34px;
    }

    .cc-dot {
        width: 19px;
        height: 19px;
    }

    .cc-dot__core {
        width: 9px;
        height: 9px;
    }

    .cc-pin-feedback {
        padding: 6px 12px;
        min-height: 32px;
        font-size: 12px;
    }

    .cc-pc-hint {
        display: none !important;
    }

    .cc-keypad {
        display: grid;
        grid-template-columns: repeat(3, 72px);
        justify-content: center;
        align-items: center;
        gap: 13px 24px;
        margin-top: 8px;
        padding-bottom: 4px;
    }

    .cc-key {
        width: 72px;
        height: 72px;
        border-radius: 50%;
        border: 1.5px solid var(--cc-border-strong);
        background: var(--cc-bg-elevated);
        color: var(--cc-ink);
        box-shadow: var(--cc-shadow-sm);
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: 0;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
        transition: transform 0.08s ease, background 0.1s ease, color 0.1s ease, border-color 0.1s ease;
    }

    .cc-key__num {
        font-size: 27px;
        font-weight: 700;
        line-height: 1.05;
        letter-spacing: -0.02em;
    }

    .cc-key__sub {
        font-size: 8.5px;
        font-weight: 800;
        letter-spacing: 0.18em;
        color: var(--cc-ink-muted);
        margin-top: 1px;
    }

    .cc-key--fn {
        background: var(--cc-bg-subtle);
        border-color: var(--cc-border);
        box-shadow: none;
        color: var(--cc-ink-secondary);
    }

    .cc-key__fn-label {
        font-size: 11.5px;
        font-weight: 700;
    }

    .cc-key--fn svg {
        width: 22px;
        height: 22px;
    }

    .cc-key:active,
    .cc-key.is-pressed {
        transform: scale(0.91);
        background: var(--cc-pine);
        border-color: var(--cc-pine);
        color: #FFFFFF;
    }

    .cc-key:active .cc-key__sub,
    .cc-key.is-pressed .cc-key__sub {
        color: rgba(255, 255, 255, 0.8);
    }
}

/* Adaptation compacte pour téléphones de faible hauteur (iPhone SE / barres navigateur) */
@media (max-width: 820px) and (max-height: 730px) {
    .cc-pin-title { font-size: 19px; margin: 5px 0 2px; }
    .cc-pin-subtitle { font-size: 11.5px; }
    .cc-dots-stage { margin: 6px 0; min-height: 28px; }
    .cc-keypad {
        grid-template-columns: repeat(3, 62px);
        gap: 10px 20px;
    }
    .cc-key {
        width: 62px;
        height: 62px;
    }
    .cc-key__num { font-size: 23px; }
}

@media (max-width: 820px) and (max-height: 630px) {
    .cc-pin-subtitle { display: none; }
    .cc-keypad {
        grid-template-columns: repeat(3, 54px);
        gap: 8px 18px;
    }
    .cc-key {
        width: 54px;
        height: 54px;
    }
    .cc-key__num { font-size: 20px; }
    .cc-key__sub { display: none; }
}

/* ==========================================================================
   4. PORTAIL AGENT (/portail)
   ========================================================================== */
.cc-portal-main {
    width: 100%;
    max-width: 1240px;
    margin: 0 auto;
    padding: 32px 24px 60px;
}

.cc-portal-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 28px 30px;
    border-radius: var(--cc-radius-xl);
    background: var(--cc-bg-elevated);
    border: 1px solid var(--cc-border);
    box-shadow: var(--cc-shadow-sm);
    margin-bottom: 20px;
}

.cc-portal-hero h1 {
    margin: 4px 0 8px;
    font-size: clamp(1.65rem, 2.5vw, 2.2rem);
    font-weight: 800;
    letter-spacing: -0.025em;
}

.cc-portal-hero h1 em {
    font-family: 'Instrument Serif', Georgia, serif;
    font-style: italic;
    font-weight: 400;
    color: var(--cc-pine);
}

.cc-portal-hero p {
    margin: 0;
    color: var(--cc-ink-secondary);
    font-size: 14.5px;
    max-width: 600px;
}

.cc-identity-box {
    padding: 16px 20px;
    border-radius: var(--cc-radius-md);
    background: var(--cc-bg-subtle);
    border: 1px solid var(--cc-border);
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex-shrink: 0;
}

.cc-identity-box__label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--cc-ink-muted);
}

.cc-identity-box__email {
    font-size: 13.5px;
    font-weight: 700;
    color: var(--cc-pine);
}

.cc-identity-box__groups {
    font-size: 12px;
    font-weight: 600;
    color: var(--cc-copper);
}

.cc-security-strip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 18px 22px;
    border-radius: var(--cc-radius-lg);
    background: var(--cc-pine-soft);
    border: 1px solid var(--cc-pine-border);
    margin-bottom: 24px;
}

.cc-security-strip__status {
    display: flex;
    align-items: center;
    gap: 14px;
}

.cc-status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--cc-copper);
    flex-shrink: 0;
}

.cc-status-dot.is-unlocked {
    background: var(--cc-success);
    box-shadow: 0 0 0 4px var(--cc-success-soft);
}

.cc-security-strip__status strong {
    display: block;
    font-size: 14px;
    color: var(--cc-ink);
}

.cc-security-strip__status p {
    margin: 2px 0 0;
    font-size: 12.5px;
    color: var(--cc-ink-secondary);
}

.cc-security-strip__actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.cc-ghost-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 14px;
    border-radius: 11px;
    border: 1px solid var(--cc-border-strong);
    background: var(--cc-bg-elevated);
    color: var(--cc-ink);
    font-size: 12.5px;
    font-weight: 700;
    transition: border-color 0.15s ease, color 0.15s ease, transform 0.12s ease;
}

.cc-ghost-btn:hover {
    border-color: var(--cc-pine);
    color: var(--cc-pine);
}

.cc-ghost-btn--copper:hover {
    border-color: var(--cc-copper);
    color: var(--cc-copper);
}

.cc-ghost-btn--compact {
    padding: 7px 12px;
}

.cc-ghost-btn svg {
    width: 16px;
    height: 16px;
}

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

.cc-console-card {
    padding: 20px;
    border-radius: var(--cc-radius-lg);
    background: var(--cc-bg-elevated);
    border: 1px solid var(--cc-border);
    box-shadow: var(--cc-shadow-xs);
    display: flex;
    flex-direction: column;
    color: var(--cc-ink);
    transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.cc-console-card:hover {
    transform: translateY(-2px);
    border-color: var(--cc-pine-border);
    box-shadow: var(--cc-shadow-md);
}

.cc-console-card__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 14px;
}

.cc-console-card__icon {
    width: 40px;
    height: 40px;
    border-radius: 11px;
    background: var(--cc-pine-soft);
    color: var(--cc-pine);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.cc-console-card__icon svg {
    width: 20px;
    height: 20px;
}

.cc-console-card__pole {
    font-size: 11px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--cc-bg-subtle);
    color: var(--cc-ink-secondary);
}

.cc-console-card h3 {
    margin: 0 0 6px;
    font-size: 16.5px;
    font-weight: 800;
    letter-spacing: -0.015em;
}

.cc-console-card p {
    margin: 0 0 16px;
    font-size: 13px;
    color: var(--cc-ink-secondary);
    flex: 1;
}

.cc-console-card__go {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12.5px;
    font-weight: 700;
    color: var(--cc-pine);
}

.cc-console-card__go svg {
    width: 15px;
    height: 15px;
}

/* Responsive Login & Portail */
@media (max-width: 960px) {
    .cc-auth-grid {
        grid-template-columns: 1fr;
        gap: 24px;
        max-width: 520px;
    }

    .cc-auth-showcase {
        order: 2;
    }

    .cc-login-card {
        order: 1;
        padding: 26px 22px;
    }

    .cc-portal-hero {
        flex-direction: column;
        align-items: flex-start;
    }

    .cc-identity-box {
        width: 100%;
    }

    .cc-security-strip {
        flex-direction: column;
        align-items: flex-start;
    }

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

@media (max-width: 600px) {
    .cc-header__inner {
        padding: 0 14px;
        gap: 8px;
    }

    .cc-header .cc-brand__eyebrow {
        display: none;
    }

    .cc-header .cc-brand__mark {
        width: 34px;
        height: 34px;
    }

    .cc-header .cc-brand__title {
        font-size: 15.5px;
    }

    .cc-header .cc-agent-pill {
        padding: 4px;
    }

    .cc-header .cc-agent-pill__meta {
        display: none;
    }

    .cc-env-pill {
        display: none;
    }

    .cc-auth-main {
        padding: 20px 14px 36px;
    }

    .cc-portal-main {
        padding: 20px 14px 44px;
    }

    .cc-portal-grid {
        grid-template-columns: 1fr;
    }

    .cc-ghost-btn--compact span {
        display: none;
    }
}
