:root {
    --color-primary: #0f172a;
    --color-primary-2: #1e3a8a;
    --color-secondary: #f59e0b;
    --color-accent: #22c55e;
    --color-dark: #0f172a;
    --color-muted: #475569;
    --color-light: #eff6ff;
    --color-white: #ffffff;
    --border: rgba(148, 163, 184, 0.25);
    --shadow-soft: 0 24px 60px rgba(15, 23, 42, 0.18);
    --radius-xl: 28px;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background:
        radial-gradient(circle at top, rgba(56, 189, 248, 0.12), transparent 28%),
        linear-gradient(135deg, #07111f 0%, #111827 45%, #172554 100%);
    color: var(--color-dark);
}

body.app-body { min-height: 100vh; }

body.app-dashboard-body {
    background: linear-gradient(135deg, #07111f 0%, #111827 45%, #172554 100%);
}

img { max-width: 100%; }

a { text-decoration: none; }

.flash-message {
    position: fixed;
    top: 18px;
    right: 18px;
    z-index: 30;
    padding: 12px 14px;
    border-radius: 14px;
    color: #fff;
    box-shadow: var(--shadow-soft);
    max-width: 380px;
}

.flash-success { background: linear-gradient(135deg, #16a34a, #15803d); }
.flash-error { background: linear-gradient(135deg, #ef4444, #b91c1c); }

.auth-page {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1.05fr 0.95fr;
    gap: 0;
}

.auth-visual-panel,
.auth-card {
    padding: 48px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.auth-visual-panel {
    color: var(--color-white);
    background:
        linear-gradient(150deg, rgba(30, 41, 59, 0.96), rgba(15, 23, 42, 0.98)),
        radial-gradient(circle at top right, rgba(56, 189, 248, 0.25), transparent 20%);
}

.auth-badge {
    display: inline-flex;
    width: fit-content;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.16);
    border: 1px solid rgba(148, 163, 184, 0.25);
    text-transform: uppercase;
    letter-spacing: 0.28em;
    font-size: 0.72rem;
    font-weight: 700;
}

.auth-visual-panel h1 {
    font-size: clamp(2rem, 4vw, 3.1rem);
    line-height: 1.08;
    margin: 18px 0 10px;
}

.auth-visual-panel p {
    color: #dbe4f0;
    max-width: 430px;
    line-height: 1.6;
}

.auth-highlights {
    list-style: none;
    display: grid;
    gap: 10px;
    padding: 0;
    margin: 24px 0 0;
}

.auth-highlights li {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #eff6ff;
}

.auth-highlights li::before {
    content: '✓';
    width: 28px;
    height: 28px;
    display: inline-grid;
    place-items: center;
    border-radius: 999px;
    background: rgba(56, 189, 248, 0.16);
    color: #bfdbfe;
    font-weight: 700;
}

.auth-credential-box {
    margin-top: 28px;
    padding: 16px;
    border-radius: 18px;
    border: 1px solid rgba(148, 163, 184, 0.25);
    background: rgba(15, 23, 42, 0.45);
    display: grid;
    gap: 6px;
    max-width: 340px;
}

.auth-credential-box span { color: #dbeafe; font-size: 0.96rem; }

.auth-card {
    background: rgba(248, 250, 252, 0.98);
    border-left: 1px solid rgba(148, 163, 184, 0.18);
}

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

.auth-kicker {
    text-transform: uppercase;
    letter-spacing: 0.28em;
    font-size: 0.72rem;
    color: #2563eb;
    font-weight: 700;
}

.auth-header h2 {
    font-size: 1.9rem;
    color: var(--color-dark);
    margin: 10px 0 8px;
}

.auth-header p { color: var(--color-muted); line-height: 1.5; }

.auth-form { display: grid; gap: 10px; }

.auth-form label {
    font-weight: 600;
    color: #1f2937;
    font-size: 0.95rem;
}

.auth-form input {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 13px 14px;
    background: #fff;
    color: var(--color-dark);
    font-size: 1rem;
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.04);
}

.auth-form input:focus {
    outline: none;
    border-color: #38bdf8;
    box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.16);
}

.btn {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    border: none;
    border-radius: 14px;
    padding: 12px 16px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

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

.btn-primary {
    color: #fff;
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    box-shadow: 0 14px 30px rgba(37, 99, 235, 0.22);
}

.auth-footer {
    margin-top: 18px;
    color: var(--color-muted);
    font-size: 0.92rem;
}

.app-shell {
    min-height: 100vh;
    display: flex;
}

.app-shell--portal {
    display: block;
}

.app-sidebar {
    width: 310px;
    padding: 24px 18px;
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.98), rgba(17, 24, 39, 0.98));
    color: #fff;
    border-right: 1px solid rgba(148, 163, 184, 0.12);
}

.app-sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #fff;
    padding: 10px;
    border-radius: 18px;
    margin-bottom: 18px;
}

.app-sidebar-logo {
    width: 48px;
    height: 48px;
    display: inline-grid;
    place-items: center;
    border-radius: 14px;
    background: linear-gradient(135deg, #38bdf8, #2563eb);
    font-weight: 800;
    letter-spacing: 0.08em;
}

.app-sidebar-brand strong,
.app-sidebar-brand small { display: block; }

.app-sidebar-brand small { color: #cbd5e1; font-size: 0.82rem; }

.app-sidebar-nav { display: grid; gap: 6px; }

.app-nav-link {
    color: #e2e8f0;
    padding: 11px 12px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 600;
}

.app-nav-link:hover,
.app-nav-link.active { background: rgba(59, 130, 246, 0.18); color: #fff; }

.app-main { flex: 1; display: flex; flex-direction: column; background: rgba(248, 250, 252, 0.92); }

.app-main--portal {
    min-height: 100vh;
}

.app-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 24px 28px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.18);
    background: rgba(255, 255, 255, 0.88);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
}

.app-topbar-kicker {
    text-transform: uppercase;
    letter-spacing: 0.28em;
    font-size: 0.72rem;
    color: #2563eb;
    font-weight: 700;
}

.app-topbar h1 {
    margin: 8px 0 0;
    color: #111827;
    font-size: 1.35rem;
}

.app-topbar--portal {
    border-bottom: 1px solid rgba(148, 163, 184, 0.18);
    background: linear-gradient(135deg, rgba(255,255,255,0.96), rgba(248,250,252,0.96));
}

.app-topbar-subtitle {
    margin: 8px 0 0;
    color: #475569;
    font-size: 0.95rem;
}

.app-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

.app-profile-avatar {
    width: 44px; height: 44px; border-radius: 50%;
    display: grid; place-items: center;
    background: linear-gradient(135deg, #1d4ed8, #8b5cf6);
    color: #fff; font-weight: 800;
}

.app-profile-info { display: grid; line-height: 1.15; }

.app-profile-info strong { color: #111827; font-size: 0.98rem; }

.app-profile-info span { color: var(--color-muted); font-size: 0.85rem; }

.app-logout-link {
    margin-left: 6px;
    color: #1d4ed8;
    font-weight: 700;
}

.app-content { padding: 28px; }

.app-content--portal {
    padding-top: 24px;
}

.dashboard-hero {
    display: flex; justify-content: space-between; align-items: end; gap: 16px;
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.98), rgba(30, 41, 59, 0.98));
    color: #fff;
    border-radius: 28px;
    padding: 24px;
    box-shadow: var(--shadow-soft);
}

.eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.28em;
    font-size: 0.72rem;
    color: #bfdbfe;
    font-weight: 700;
}

.dashboard-hero h2 { font-size: 1.6rem; margin: 8px 0 8px; }

.dashboard-subtitle { color: #dbeafe; max-width: 640px; line-height: 1.5; }

.hero-chip {
    background: rgba(148, 163, 184, 0.18);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 999px;
    padding: 10px 12px;
    color: #eff6ff;
    font-weight: 700;
    white-space: nowrap;
}

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

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

.portal-stats .stat-card {
    min-height: 122px;
}

.portal-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 18px;
    margin: 18px 0;
}

.portal-card {
    background: linear-gradient(155deg, rgba(255,255,255,0.98), rgba(248,250,252,0.98));
    border-radius: 24px;
    padding: 18px;
    box-shadow: var(--shadow-soft);
    border: 1px solid rgba(148, 163, 184, 0.18);
    display: grid;
    gap: 10px;
}

.portal-card h3 {
    margin: 0;
    color: #111827;
    font-size: 1.08rem;
}

.portal-card p {
    margin: 0;
    color: #334155;
    line-height: 1.5;
}

.portal-icon {
    display: inline-grid;
    place-items: center;
    width: 46px;
    height: 46px;
    border-radius: 14px;
    background: linear-gradient(135deg, #1d4ed8, #8b5cf6);
    color: #fff;
    font-weight: 800;
    letter-spacing: 0.08em;
    font-size: 0.82rem;
}

.portal-action {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    width: fit-content;
    padding: 8px 11px;
    border-radius: 10px;
    background: rgba(37, 99, 235, 0.08);
    color: #1d4ed8;
    font-weight: 700;
}

.module-transit { box-shadow: inset 4px 0 0 #38bdf8; }
.module-docs { box-shadow: inset 4px 0 0 #f59e0b; }
.module-stock { box-shadow: inset 4px 0 0 #22c55e; }
.module-admin { box-shadow: inset 4px 0 0 #818cf8; }

.portal-panels { margin-top: 18px; }

.stat-card {
    background: #fff;
    border-radius: 24px;
    padding: 18px;
    box-shadow: var(--shadow-soft);
    border: 1px solid rgba(148, 163, 184, 0.18);
}

.stat-card span { color: var(--color-muted); font-size: 0.92rem; }

.stat-card strong { display: block; font-size: 2rem; margin: 8px 0 4px; color: #111827; }

.stat-card small { color: #334155; }

.accent-blue { box-shadow: inset 4px 0 0 #2563eb; }
.accent-gold { box-shadow: inset 4px 0 0 #f59e0b; }
.accent-green { box-shadow: inset 4px 0 0 #22c55e; }
.accent-rose { box-shadow: inset 4px 0 0 #f472b6; }

.dashboard-panels { display: grid; grid-template-columns: 1.2fr 0.8fr; gap: 18px; }

.panel-card {
    background: #fff;
    border-radius: 24px;
    padding: 18px;
    box-shadow: var(--shadow-soft);
    border: 1px solid rgba(148, 163, 184, 0.18);
}

.panel-header { display: flex; justify-content: space-between; align-items: start; gap: 10px; }

.panel-header h3 { margin: 4px 0 0; color: #111827; font-size: 1.1rem; }

.badge {
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.14em;
}

.badge-live { color: #166534; background: rgba(134, 239, 172, 0.35); }

.check-list { padding-left: 16px; color: #334155; line-height: 1.6; }

.mini-stack { display: grid; gap: 10px; margin-top: 8px; }

.mini-link {
    display: block;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    color: #111827;
    background: #f8fafc;
    font-weight: 600;
}

.mini-link.muted { color: #1d4ed8; }

@media (max-width: 1100px) {
    .auth-page { grid-template-columns: 1fr; }
    .auth-visual-panel, .auth-card { padding: 28px; }
    .dashboard-grid, .dashboard-panels, .portal-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 900px) {
    .app-shell { flex-direction: column; }
    .app-sidebar { width: 100%; border-right: none; border-bottom: 1px solid rgba(148, 163, 184, 0.12); }
}

@media (max-width: 700px) {
    .dashboard-grid, .dashboard-panels, .portal-grid { grid-template-columns: 1fr; }
    .app-topbar, .dashboard-hero { flex-direction: column; align-items: flex-start; }
    .app-profile { flex-wrap: wrap; }
    .app-content { padding: 18px; }
}


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

.portal-status {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.06);
    color: #334155;
    font-size: 0.76rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.12em;
}

/* --------------------------------------------------------------------------
   Portail modules façon FINEA
   -------------------------------------------------------------------------- */
.app-main--portal {
    background:
        radial-gradient(circle at 10% 0%, rgba(250, 189, 2, 0.12), transparent 26%),
        radial-gradient(circle at 90% 0%, rgba(29, 43, 87, 0.14), transparent 30%),
        #f3f6fb;
}

.app-topbar--portal {
    background: rgba(255, 255, 255, 0.82);
    border-bottom: 1px solid rgba(29, 43, 87, 0.08);
    box-shadow: 0 12px 35px rgba(29, 43, 87, 0.06);
}

.app-topbar-kicker,
.finea-eyebrow {
    color: #1d2b57;
}

.finea-portal-hero {
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    gap: 22px;
    border-radius: 30px;
    padding: 30px;
    color: #ffffff;
    background:
        linear-gradient(135deg, rgba(29, 43, 87, 0.98), rgba(15, 23, 42, 0.98)),
        radial-gradient(circle at top right, rgba(250, 189, 2, 0.28), transparent 35%);
    box-shadow: 0 28px 70px rgba(29, 43, 87, 0.22);
}

.finea-portal-hero::after {
    content: '';
    position: absolute;
    width: 260px;
    height: 260px;
    right: -90px;
    top: -95px;
    border-radius: 999px;
    background: rgba(250, 189, 2, 0.18);
}

.finea-hero-main,
.finea-hero-side {
    position: relative;
    z-index: 1;
}

.finea-hero-main h2 {
    margin: 8px 0 10px;
    max-width: 780px;
    font-size: clamp(1.7rem, 3vw, 2.55rem);
    line-height: 1.08;
    letter-spacing: -0.04em;
}

.finea-hero-main p:not(.finea-eyebrow) {
    margin: 0;
    max-width: 720px;
    color: #dbeafe;
    line-height: 1.6;
}

.finea-eyebrow {
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.26em;
    font-size: 0.72rem;
    font-weight: 800;
}

.finea-portal-hero .finea-eyebrow {
    color: #fabd02;
}

.finea-hero-side {
    min-width: 220px;
    align-self: stretch;
    display: grid;
    align-content: center;
    gap: 8px;
    border-radius: 24px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.14);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
}

.finea-version-chip {
    width: fit-content;
    border-radius: 999px;
    padding: 7px 10px;
    color: #1d2b57;
    background: #fabd02;
    font-weight: 900;
    font-size: 0.75rem;
    letter-spacing: 0.12em;
}

.finea-hero-side strong {
    font-size: 2rem;
    letter-spacing: -0.04em;
}

.finea-hero-side small {
    color: #dbeafe;
    line-height: 1.45;
}

.finea-module-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin: 22px 0;
    padding: 14px;
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.88);
    border: 1px solid rgba(29, 43, 87, 0.08);
    box-shadow: 0 18px 45px rgba(29, 43, 87, 0.08);
}

.portal-module-toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
    padding: 18px;
}

.portal-module-filter,
.portal-module-filter-field,
.portal-module-filter .finea-select-search {
    width: 100%;
    min-width: 0;
}

.portal-module-filter-field {
    gap: 10px;
}

.portal-module-filter-field > label {
    font-size: .82rem;
    color: #1d2b57;
    letter-spacing: .02em;
}

.portal-module-filter .finea-select-control {
    width: 100%;
    min-height: 62px;
    padding: 10px 14px;
    border-radius: 19px;
    background: #f8fafc;
    border-color: rgba(29, 43, 87, .12);
}

.portal-module-filter .finea-select-input {
    min-width: 260px;
    font-weight: 650;
}

.portal-module-filter .finea-select-menu {
    max-height: 340px;
}

.portal-module-filter-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    min-height: 34px;
    color: #1d2b57;
    font-weight: 800;
    font-size: .9rem;
}

.portal-filter-reset {
    min-height: 34px;
    padding: 6px 11px;
}

.finea-search-box {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 52px;
    padding: 0 16px;
    border-radius: 18px;
    background: #f8fafc;
    border: 1px solid rgba(29, 43, 87, 0.1);
}

.finea-search-box svg,
.finea-module-icon svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.finea-search-box svg { color: #1d2b57; }

.finea-search-box input {
    width: 100%;
    border: 0;
    outline: 0;
    background: transparent;
    color: #0f172a;
    font: inherit;
    font-weight: 650;
}

.finea-search-box input::placeholder {
    color: #64748b;
    font-weight: 500;
}

.finea-toolbar-meta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    color: #1d2b57;
    font-weight: 800;
    font-size: 0.9rem;
}

.finea-module-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(150px, 1fr));
    gap: 18px;
}

.finea-module-card {
    min-height: 245px;
}

.finea-module-card.is-maintenance {
    filter: grayscale(1);
    opacity: .62;
    cursor: not-allowed;
}

.finea-module-card.is-maintenance .finea-module-link {
    cursor: not-allowed;
}

.finea-module-maintenance-reason {
    display: block;
    margin-top: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    color: #9a3412;
    background: #ffedd5;
    font-size: .78rem;
    font-weight: 700;
}

.finea-module-link {
    position: relative;
    overflow: hidden;
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 13px;
    padding: 20px;
    border-radius: 30px;
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid rgba(29, 43, 87, 0.08);
    box-shadow: 0 22px 55px rgba(29, 43, 87, 0.11);
    color: #0f172a;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.finea-module-link:hover {
    transform: translateY(-6px);
    box-shadow: 0 32px 70px rgba(29, 43, 87, 0.18);
    border-color: rgba(29, 43, 87, 0.16);
}

.finea-module-glow {
    position: absolute;
    width: 150px;
    height: 150px;
    right: -55px;
    top: -55px;
    border-radius: 999px;
    opacity: 0.14;
    background: currentColor;
}

.finea-module-topline,
.finea-module-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.finea-module-icon {
    width: 58px;
    height: 58px;
    display: inline-grid;
    place-items: center;
    border-radius: 19px;
    color: #ffffff;
    box-shadow: 0 14px 30px rgba(15, 23, 42, 0.15);
}

.finea-module-code {
    position: relative;
    z-index: 1;
    padding: 7px 9px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.05);
    color: #334155;
    font-weight: 900;
    font-size: 0.72rem;
    letter-spacing: 0.12em;
}

.finea-module-title {
    position: relative;
    z-index: 1;
    display: block;
    font-size: 1.18rem;
    font-weight: 900;
    letter-spacing: -0.03em;
    color: #101828;
}

.finea-module-description {
    position: relative;
    z-index: 1;
    flex: 1;
    color: #475569;
    line-height: 1.5;
    font-size: 0.92rem;
}

.finea-module-status {
    padding: 7px 10px;
    border-radius: 999px;
    background: rgba(29, 43, 87, 0.07);
    color: #1d2b57;
    font-weight: 850;
    font-size: 0.74rem;
}

.finea-module-open {
    color: #1d2b57;
    font-weight: 900;
}

.finea-empty-state {
    margin: 18px 0 0;
    padding: 18px;
    border-radius: 18px;
    color: #475569;
    background: #ffffff;
    border: 1px dashed rgba(29, 43, 87, 0.18);
    text-align: center;
    font-weight: 750;
}

.finea-portal-note {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: 22px;
    padding: 20px;
    border-radius: 24px;
    background: #ffffff;
    border: 1px solid rgba(29, 43, 87, 0.08);
    box-shadow: 0 18px 45px rgba(29, 43, 87, 0.08);
}

.finea-portal-note h3 {
    margin: 6px 0 0;
    color: #101828;
    font-size: 1.05rem;
}

.finea-secondary-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0 14px;
    border-radius: 14px;
    color: #1d2b57;
    background: rgba(250, 189, 2, 0.18);
    font-weight: 900;
    white-space: nowrap;
}

@media (max-width: 1250px) {
    .finea-module-grid { grid-template-columns: repeat(3, minmax(170px, 1fr)); }
}

@media (max-width: 850px) {
    .finea-portal-hero,
    .finea-module-toolbar,
    .finea-portal-note {
        flex-direction: column;
        align-items: stretch;
    }

    .finea-module-grid { grid-template-columns: repeat(2, minmax(150px, 1fr)); }
    .finea-toolbar-meta { justify-content: center; }
    .portal-module-filter-meta { align-items: flex-start; }
}

@media (max-width: 560px) {
    .finea-portal-hero { padding: 22px; border-radius: 24px; }
    .finea-module-grid { grid-template-columns: 1fr; }
    .finea-module-card { min-height: 0; }
    .portal-module-filter .finea-select-input { min-width: 150px; }
    .portal-module-filter-meta { flex-direction: column; }
}
/* Couleurs caractéristiques des modules du portail.
   Chaque module garde une identité visuelle différente de son point d’entrée. */
.module-finance .finea-module-icon { background: linear-gradient(135deg, #1d2b57, #2563eb); }
.module-finance .finea-module-glow { color: #2563eb; }

.module-rh .finea-module-icon { background: linear-gradient(135deg, #6d28d9, #a855f7); }
.module-rh .finea-module-glow { color: #7c3aed; }

.module-colisage .finea-module-icon { background: linear-gradient(135deg, #ca8a04, #f59e0b); }
.module-colisage .finea-module-glow { color: #f59e0b; }

.module-logistique .finea-module-icon { background: linear-gradient(135deg, #047857, #22c55e); }
.module-logistique .finea-module-glow { color: #10b981; }

.module-employee .finea-module-icon { background: linear-gradient(135deg, #0369a1, #38bdf8); }
.module-employee .finea-module-glow { color: #0ea5e9; }

.module-crm .finea-module-icon { background: linear-gradient(135deg, #9d174d, #ec4899); }
.module-crm .finea-module-glow { color: #ec4899; }

.module-tickets .finea-module-icon { background: linear-gradient(135deg, #991b1b, #ef4444); }
.module-tickets .finea-module-glow { color: #ef4444; }

.module-website .finea-module-icon { background: linear-gradient(135deg, #0f766e, #14b8a6); }
.module-website .finea-module-glow { color: #14b8a6; }

.module-admin .finea-module-icon { background: linear-gradient(135deg, #0f172a, #64748b); }
.module-admin .finea-module-glow { color: #0f172a; }

/* Identités distinctives des nouveaux modules transit/import-export. */
.module-transit-douane .finea-module-icon { background: linear-gradient(135deg, #4c1d95, #7c3aed); }
.module-transit-douane .finea-module-glow { color: #7c3aed; }
.module-tracking-colis .finea-module-icon { background: linear-gradient(135deg, #155e75, #06b6d4); }
.module-tracking-colis .finea-module-glow { color: #06b6d4; }
.module-facturation .finea-module-icon { background: linear-gradient(135deg, #14532d, #16a34a); }
.module-facturation .finea-module-glow { color: #16a34a; }
.module-entrepots .finea-module-icon { background: linear-gradient(135deg, #713f12, #a16207); }
.module-entrepots .finea-module-glow { color: #a16207; }
.module-flotte-transport .finea-module-icon { background: linear-gradient(135deg, #7c2d12, #ea580c); }
.module-flotte-transport .finea-module-glow { color: #ea580c; }
.module-portefeuille-clients .finea-module-icon { background: linear-gradient(135deg, #365314, #84cc16); }
.module-portefeuille-clients .finea-module-glow { color: #84cc16; }
.module-agents-correspondants .finea-module-icon { background: linear-gradient(135deg, #312e81, #6366f1); }
.module-agents-correspondants .finea-module-glow { color: #6366f1; }
.module-pilotage-dg .finea-module-icon { background: linear-gradient(135deg, #854d0e, #eab308); }
.module-pilotage-dg .finea-module-glow { color: #eab308; }

/* Pages d'erreur partagées : 404, maintenance et futurs états HTTP. */
.error-state {
    --error-accent: #4f46e5;
    --error-accent-soft: #e0e7ff;
    position: relative;
    min-height: 100vh;
    display: grid;
    place-items: center;
    overflow: hidden;
    padding: 40px 20px;
    isolation: isolate;
    background:
        radial-gradient(circle at 15% 20%, rgba(79, 70, 229, 0.13), transparent 30%),
        radial-gradient(circle at 85% 80%, rgba(14, 165, 233, 0.12), transparent 32%),
        linear-gradient(145deg, #f8fafc, #eef2ff);
}

.error-state--maintenance {
    --error-accent: #ea580c;
    --error-accent-soft: #ffedd5;
    background:
        radial-gradient(circle at 15% 20%, rgba(249, 115, 22, 0.14), transparent 30%),
        radial-gradient(circle at 85% 80%, rgba(245, 158, 11, 0.13), transparent 32%),
        linear-gradient(145deg, #fffaf5, #fff7ed);
}

.error-state--auth {
    --error-accent: #0891b2;
    --error-accent-soft: #cffafe;
}

.error-state--forbidden {
    --error-accent: #dc2626;
    --error-accent-soft: #fee2e2;
    background:
        radial-gradient(circle at 15% 20%, rgba(220, 38, 38, 0.12), transparent 30%),
        radial-gradient(circle at 85% 80%, rgba(244, 63, 94, 0.1), transparent 32%),
        linear-gradient(145deg, #fffafa, #fff1f2);
}

.error-state--request {
    --error-accent: #7c3aed;
    --error-accent-soft: #ede9fe;
}

.error-state--timeout {
    --error-accent: #ca8a04;
    --error-accent-soft: #fef3c7;
    background:
        radial-gradient(circle at 15% 20%, rgba(202, 138, 4, 0.12), transparent 30%),
        radial-gradient(circle at 85% 80%, rgba(245, 158, 11, 0.12), transparent 32%),
        linear-gradient(145deg, #fffdf5, #fffbeb);
}

.error-state--server {
    --error-accent: #334155;
    --error-accent-soft: #e2e8f0;
    background:
        radial-gradient(circle at 15% 20%, rgba(51, 65, 85, 0.13), transparent 30%),
        radial-gradient(circle at 85% 80%, rgba(71, 85, 105, 0.11), transparent 32%),
        linear-gradient(145deg, #f8fafc, #e2e8f0);
}

.error-state__glow {
    position: absolute;
    z-index: -1;
    width: 360px;
    height: 360px;
    border-radius: 999px;
    filter: blur(10px);
    opacity: 0.55;
    background: var(--error-accent-soft);
}

.error-state__glow--one { top: -180px; right: -90px; }
.error-state__glow--two { bottom: -220px; left: -100px; }

.error-state__card {
    width: min(980px, 100%);
    display: grid;
    grid-template-columns: minmax(260px, 0.8fr) minmax(320px, 1.2fr);
    overflow: hidden;
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 36px;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 35px 90px rgba(15, 23, 42, 0.16);
    -webkit-backdrop-filter: blur(18px);
    backdrop-filter: blur(18px);
}

.error-state__visual {
    position: relative;
    min-height: 430px;
    display: grid;
    place-items: center;
    overflow: hidden;
    color: #ffffff;
    background:
        linear-gradient(155deg, color-mix(in srgb, var(--error-accent) 78%, #0f172a), var(--error-accent));
}

.error-state__visual::before {
    content: "";
    position: absolute;
    width: 330px;
    height: 330px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
}

.error-state__status {
    position: absolute;
    top: 24px;
    left: 26px;
    font-size: clamp(4.2rem, 9vw, 7.5rem);
    line-height: 1;
    font-weight: 900;
    letter-spacing: -0.09em;
    opacity: 0.16;
}

.error-state__icon {
    position: relative;
    z-index: 2;
    width: 126px;
    height: 126px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, 0.32);
    border-radius: 38px;
    background: rgba(255, 255, 255, 0.14);
    box-shadow: 0 24px 55px rgba(15, 23, 42, 0.22);
    transform: rotate(-5deg);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
}

.error-state__icon svg {
    width: 70px;
    height: 70px;
    fill: none;
    stroke: currentColor;
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.error-state__orbit {
    position: absolute;
    width: 220px;
    height: 220px;
    border: 1px dashed rgba(255, 255, 255, 0.42);
    border-radius: 50%;
    animation: errorOrbit 18s linear infinite;
}

.error-state__orbit::after {
    content: "";
    position: absolute;
    top: 20px;
    right: 22px;
    width: 13px;
    height: 13px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 0 24px rgba(255, 255, 255, 0.8);
}

.error-state__content {
    align-self: center;
    padding: clamp(32px, 5vw, 58px);
}

.error-state__eyebrow {
    margin: 0 0 12px;
    color: var(--error-accent);
    font-size: 0.76rem;
    font-weight: 900;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.error-state__content h1 {
    margin: 0;
    color: #0f172a;
    font-size: clamp(2.1rem, 5vw, 4rem);
    line-height: 1.02;
    letter-spacing: -0.06em;
}

.error-state__message {
    margin: 22px 0 0;
    color: #334155;
    font-size: 1.05rem;
    line-height: 1.7;
}

.error-state__detail {
    margin: 14px 0 0;
    padding-left: 14px;
    border-left: 3px solid var(--error-accent);
    color: #64748b;
    font-size: 0.88rem;
    line-height: 1.55;
}

.error-state__explanation,
.error-state__guidance {
    margin-top: 18px;
    padding: 15px 17px;
    border: 1px solid #dbe3ee;
    border-radius: 17px;
    background: color-mix(in srgb, var(--error-accent-soft) 38%, #ffffff);
}

.error-state__explanation > span,
.error-state__guidance > span {
    display: block;
    margin-bottom: 6px;
    color: var(--error-accent);
    font-size: 0.7rem;
    font-weight: 900;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.error-state__explanation p {
    margin: 0;
    color: #475569;
    font-size: 0.86rem;
    line-height: 1.55;
}

.error-state__guidance ul {
    display: grid;
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.error-state__guidance li {
    position: relative;
    padding-left: 20px;
    color: #475569;
    font-size: 0.84rem;
    line-height: 1.45;
}

.error-state__guidance li::before {
    content: "✓";
    position: absolute;
    left: 0;
    color: var(--error-accent);
    font-weight: 900;
}

.error-state__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-top: 30px;
}

.error-state__action {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 11px;
    min-height: 50px;
    padding: 0 19px;
    overflow: hidden;
    border: 1px solid transparent;
    border-radius: 16px;
    font-size: 0.88rem;
    font-weight: 850;
    line-height: 1;
    letter-spacing: -0.01em;
    text-decoration: none;
    cursor: pointer;
    isolation: isolate;
    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease,
        border-color 0.2s ease,
        background 0.2s ease;
}

.error-state__action::before {
    content: "";
    flex: 0 0 auto;
    width: 19px;
    height: 19px;
    background: currentColor;
    -webkit-mask: center / contain no-repeat;
    mask: center / contain no-repeat;
}

.error-state__action--arrow::before {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12h14M13 6l6 6-6 6'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12h14M13 6l6 6-6 6'/%3E%3C/svg%3E");
    order: 2;
}

.error-state__action--modules::before {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Crect x='3' y='3' width='7' height='7' rx='2'/%3E%3Crect x='14' y='3' width='7' height='7' rx='2'/%3E%3Crect x='3' y='14' width='7' height='7' rx='2'/%3E%3Crect x='14' y='14' width='7' height='7' rx='2'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Crect x='3' y='3' width='7' height='7' rx='2'/%3E%3Crect x='14' y='3' width='7' height='7' rx='2'/%3E%3Crect x='3' y='14' width='7' height='7' rx='2'/%3E%3Crect x='14' y='14' width='7' height='7' rx='2'/%3E%3C/svg%3E");
}

.error-state__action--home::before {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m3 11 9-8 9 8'/%3E%3Cpath d='M5 10v10h14V10M9 20v-6h6v6'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m3 11 9-8 9 8'/%3E%3Cpath d='M5 10v10h14V10M9 20v-6h6v6'/%3E%3C/svg%3E");
}

.error-state__action--login::before {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10 17l5-5-5-5M15 12H3'/%3E%3Cpath d='M14 3h5a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-5'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10 17l5-5-5-5M15 12H3'/%3E%3Cpath d='M14 3h5a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-5'/%3E%3C/svg%3E");
}
.error-state__actions .finea-action-btn--primary {
    color: #ffffff;
    background:
        linear-gradient(135deg, color-mix(in srgb, var(--error-accent) 82%, #0f172a), var(--error-accent));
    box-shadow:
        0 13px 28px color-mix(in srgb, var(--error-accent) 27%, transparent),
        inset 0 1px rgba(255, 255, 255, 0.24);
}

.error-state__actions .finea-action-btn--secondary {
    color: #334155;
    border-color: #dbe3ee;
    background: rgba(255, 255, 255, 0.8);
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06);
}

.error-state__action:hover {
    transform: translateY(-2px);
}

.error-state__actions .finea-action-btn--primary:hover {
    box-shadow:
        0 17px 34px color-mix(in srgb, var(--error-accent) 34%, transparent),
        inset 0 1px rgba(255, 255, 255, 0.3);
}

.error-state__actions .finea-action-btn--secondary:hover {
    color: var(--error-accent);
    border-color: #cbd5e1;
    background: color-mix(in srgb, var(--error-accent-soft) 35%, #ffffff);
}

.error-state__action:active {
    transform: translateY(0) scale(0.98);
}

.error-state__action:focus-visible {
    outline: 0;
    box-shadow:
        0 0 0 4px color-mix(in srgb, var(--error-accent) 18%, transparent),
        0 13px 28px color-mix(in srgb, var(--error-accent) 22%, transparent);
}

.error-state__signature {
    position: absolute;
    bottom: 14px;
    margin: 0;
    color: #94a3b8;
    font-size: 0.72rem;
    font-weight: 700;
}

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

@media (max-width: 760px) {
    .error-state { align-items: start; padding-top: 24px; }
    .error-state__card { grid-template-columns: 1fr; border-radius: 28px; }
    .error-state__visual { min-height: 230px; }
    .error-state__visual::before { width: 250px; height: 250px; }
    .error-state__status { font-size: 5rem; }
    .error-state__icon { width: 98px; height: 98px; border-radius: 30px; }
    .error-state__icon svg { width: 54px; height: 54px; }
    .error-state__orbit { width: 170px; height: 170px; }
    .error-state__content { padding: 32px 26px 38px; }
    .error-state__actions { display: grid; }
    .error-state__action { width: 100%; min-height: 52px; }
    .error-state__signature { position: static; margin-top: 18px; text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
    .error-state__orbit { animation: none; }
}
