:root {
    --app-sidebar-width: 256px;
    --app-header-height: 72px;
    --app-background: #f5f7fa;
    --app-surface: #ffffff;
    --app-border: #e3e7ed;
    --app-text: #20252b;
    --app-muted: #6c757d;
    --app-primary: #0d6efd;
    --app-primary-hover: #0b5ed7;
    --app-primary-soft: #eaf2ff;
    --app-sidebar-hover: #f3f5f7;
    --app-radius-sm: 0.375rem;
    --app-radius: 0.625rem;
    --app-radius-lg: 0.875rem;
    --app-shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.04), 0 1px 3px rgba(16, 24, 40, 0.08);
}

/* Base */

html {
    position: relative;
    min-height: 100%;
    font-size: 14px;
}

@media (min-width: 768px) {
    html {
        font-size: 16px;
    }
}

body {
    min-height: 100vh;
    margin: 0;
    color: var(--app-text);
    background-color: var(--app-background);
}

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

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

.min-w-0 {
    min-width: 0;
}

/* Accessibilité et focus */

.btn:focus,
.btn:active:focus,
.btn-link.nav-link:focus,
.form-control:focus,
.form-select:focus,
.form-check-input:focus,
.ts-control.focus {
    border-color: rgba(13, 110, 253, 0.5);
    box-shadow: 0 0 0 0.1rem #ffffff, 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* Structure générale */

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

.app-main {
    width: 100%;
    min-width: 0;
}

/* Sidebar */

.app-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 1030;
    width: var(--app-sidebar-width);
    height: 100vh;
    flex-direction: column;
    overflow-y: auto;
    background-color: var(--app-surface);
    border-right: 1px solid var(--app-border);
}

.app-sidebar-brand {
    min-height: var(--app-header-height);
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--app-border);
}

.app-brand-link {
    color: inherit;
    text-decoration: none;
}

    .app-brand-link:hover {
        color: inherit;
    }

.app-brand-name {
    display: block;
    color: var(--app-text);
    font-size: 1.1rem;
    font-weight: 700;
    line-height: 1.2;
}

.app-brand-context {
    display: block;
    margin-top: 0.2rem;
    color: var(--app-muted);
    font-size: 0.78rem;
    line-height: 1.2;
}

/* Navigation */

.app-sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 1rem;
}

.app-nav-link {
    min-height: 44px;
    padding: 0.65rem 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: #4c5661;
    text-decoration: none;
    border-radius: var(--app-radius);
    font-size: 0.94rem;
    font-weight: 500;
    transition: color 120ms ease, background-color 120ms ease;
}

    .app-nav-link:hover {
        color: var(--app-text);
        background-color: var(--app-sidebar-hover);
    }

    .app-nav-link.active {
        color: var(--app-primary);
        background-color: var(--app-primary-soft);
    }

    .app-nav-link:focus-visible {
        outline: 3px solid rgba(13, 110, 253, 0.2);
        outline-offset: 2px;
    }

.app-nav-icon {
    width: 24px;
    min-width: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    line-height: 1;
}

/* Bas de sidebar */

.app-sidebar-footer {
    margin-top: auto;
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--app-border);
}

.app-sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.app-user-label,
.app-header-user-label {
    color: var(--app-muted);
    font-size: 0.75rem;
    line-height: 1.2;
}

.app-user-name,
.app-header-user-name {
    margin-top: 0.15rem;
    color: var(--app-text);
    font-size: 0.88rem;
    font-weight: 600;
    line-height: 1.2;
}

.app-user-avatar {
    width: 40px;
    height: 40px;
    min-width: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    background-color: var(--app-primary);
    border-radius: 50%;
    font-size: 0.95rem;
    font-weight: 700;
}

/* Header */

.app-header {
    position: sticky;
    top: 0;
    z-index: 1020;
    min-height: var(--app-header-height);
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: rgba(255, 255, 255, 0.96);
    border-bottom: 1px solid var(--app-border);
    backdrop-filter: blur(8px);
}

.app-page-title {
    margin: 0;
    color: var(--app-text);
    font-size: 1.25rem;
    font-weight: 650;
    line-height: 1.2;
}

.app-page-subtitle {
    margin-top: 0.2rem;
    color: var(--app-muted);
    font-size: 0.8rem;
    line-height: 1.2;
}

.app-menu-button {
    width: 42px;
    height: 42px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Contenu */

.app-content {
    width: 100%;
    padding: 1.5rem;
}

/* Composants globaux */

.app-card {
    background-color: var(--app-surface);
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius-lg);
    box-shadow: var(--app-shadow-sm);
}

.app-card-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--app-border);
}

.app-card-body {
    padding: 1.25rem;
}

.app-section-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 650;
}

.app-section-description {
    margin: 0.25rem 0 0;
    color: var(--app-muted);
    font-size: 0.875rem;
}

/* Tables */

.table {
    --bs-table-bg: transparent;
}

    .table > :not(caption) > * > * {
        padding: 0.8rem 0.75rem;
        vertical-align: middle;
    }

    .table thead th {
        color: #59636e;
        font-size: 0.8rem;
        font-weight: 650;
        text-transform: uppercase;
        letter-spacing: 0.025em;
        border-bottom-width: 1px;
    }

/* Formulaires */

.form-label {
    margin-bottom: 0.4rem;
    color: #495057;
    font-size: 0.875rem;
    font-weight: 600;
}

.form-control,
.form-select,
.ts-control {
    min-height: 42px;
    border-color: #d8dde3;
    border-radius: var(--app-radius);
}

/* Offcanvas mobile */

.app-mobile-sidebar {
    width: min(290px, 90vw);
}

.app-mobile-sidebar-header {
    min-height: var(--app-header-height);
    border-bottom: 1px solid var(--app-border);
}

/* Desktop */

@media (min-width: 992px) {
    .app-main {
        margin-left: var(--app-sidebar-width);
    }
}

/* Grands écrans */

@media (min-width: 1200px) {
    .app-content {
        padding: 2rem;
    }
}

/* Mobile */

@media (max-width: 575.98px) {
    .app-header {
        min-height: 64px;
        padding: 0.65rem 1rem;
    }

    .app-content {
        padding: 1rem;
    }

    .app-page-title {
        font-size: 1.1rem;
    }

    .app-card-body {
        padding: 1rem;
    }
}
/* Tables */

.app-data-table {
    margin-bottom: 0;
    border-collapse: separate;
    border-spacing: 0 .45rem;
}

    .app-data-table thead th {
        padding: 0.75rem 1rem;
        color: var(--app-muted);
        background-color: transparent;
        border: 0;
        font-size: 0.78rem;
        font-weight: 500;
        text-transform: none;
        letter-spacing: 0;
    }

    .app-data-table tbody tr {
        background-color: var(--app-surface);
        box-shadow: var(--app-shadow-sm);
    }

    .app-data-table tbody td {
        padding: 1rem;
        background-color: var(--app-surface);
        border-top: 1px solid var(--app-border);
        border-bottom: 1px solid var(--app-border);
    }

        .app-data-table tbody td:first-child {
            border-left: 1px solid var(--app-border);
            border-radius: var(--app-radius) 0 0 var(--app-radius);
        }

        .app-data-table tbody td:last-child {
            border-right: 1px solid var(--app-border);
            border-radius: 0 var(--app-radius) var(--app-radius) 0;
        }

    .app-data-table tbody tr:hover td {
        background-color: #fbfcfe;
    }

.app-table-primary {
    color: var(--app-text);
    font-weight: 600;
}

.app-table-secondary {
    color: #59636e;
}

.app-table-code {
    color: #3f4852;
    font-size: 0.875rem;
    font-weight: 600;
}

.app-table-empty {
    color: var(--app-muted);
    font-size: 0.875rem;
    font-style: italic;
}

.auth-page {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    padding: 2rem;
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius-lg);
    box-shadow: var(--app-shadow-sm);
}

/* Panneau de filtres */

.app-filter-panel {
    padding: 1.25rem;
    background-color: var(--app-surface);
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius);
    box-shadow: var(--app-shadow-sm);
}

.app-filter-header {
    margin-bottom: 1rem;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.app-filter-title {
    margin: 0;
    color: var(--app-text);
    font-size: 1rem;
    font-weight: 650;
}

.app-filter-description {
    margin: 0.2rem 0 0;
    color: var(--app-muted);
    font-size: 0.85rem;
}

@media (max-width: 575.98px) {
    .app-filter-header {
        align-items: stretch;
        flex-direction: column;
    }

        .app-filter-header .btn {
            width: 100%;
        }
}

.customer-nav {
    display: flex;
    gap: 1.5rem;
    overflow-x: auto;
    border-bottom: 1px solid var(--app-border);
}

.customer-nav-link {
    position: relative;
    padding: 0.75rem 0;
    color: var(--app-muted);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    white-space: nowrap;
}
    .customer-nav-link:hover {
        color: var(--app-text);
    }
    .customer-nav-link.active {
        color: var(--app-primary);
    }
        .customer-nav-link.active::after {
            content: "";
            position: absolute;
            right: 0;
            bottom: -1px;
            left: 0;
            height: 2px;
            background-color: var(--app-primary);
        }
.agreement-level-card {
    height: 100%;
    padding: 1rem;
    text-align: left;
    background: var(--bs-body-bg);
    border: 1px solid var(--app-border);
    border-radius: 6px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

    .agreement-level-card:hover {
        border-color: var(--app-primary);
    }

    .agreement-level-card.selected {
        border-color: var(--app-primary);
        box-shadow: 0 0 0 1px var(--app-primary);
    }
#youtrust-signature-container {
    width: 100%;
    height: calc(100vh - 130px);
    min-height: 700px;
}
#youtrust-signature-container iframe {
    width: 100% !important;
    height: 100% !important;
    border: 0;
}

/* Thème du site principal — isolé de l'Area APM */
.app-site {
    --app-sidebar-width: 260px;
    --app-header-height: 80px;
    --app-background: #ffffff;
    --app-surface: #f7f9fb;
    --app-border: #dce4ea;
    --app-text: #101418;
    --app-muted: #667783;
    --app-primary: #18a9e3;
    --app-primary-hover: #078dc5;
    --app-primary-soft: #e4f5fc;
    --app-sidebar-hover: #f2f8fb;
    --app-radius: 10px;
    --app-radius-lg: 16px;
    --app-shadow-sm: 0 2px 5px rgba(44, 62, 72, 0.1);
    font-family: Arial, Helvetica, sans-serif;
    background: var(--app-background);
}

.app-site .app-sidebar {
    background: #fff;
    border-right-color: #d9e2e8;
}

.app-site .app-sidebar-brand {
    min-height: 112px;
    padding: 28px 24px 22px;
    align-items: flex-start;
    justify-content: center;
    flex-direction: column;
    border-bottom: 0;
}

.app-sidebar-greeting {
    color: #65747e;
    font-size: .8rem;
    text-transform: uppercase;
}

.app-sidebar-customer {
    max-width: 100%;
    margin-top: 7px;
    color: #667783;
    font-size: 1.05rem;
    font-weight: 700;
}

.app-site .app-sidebar-nav {
    gap: 0;
    padding: 0;
}

.app-site .app-nav-link {
    min-height: 64px;
    padding: 14px 24px;
    gap: 14px;
    color: #71838f;
    border-bottom: 1px solid #edf1f3;
    border-left: 4px solid transparent;
    border-radius: 0;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.55;
}

.app-site .app-nav-link:hover {
    color: var(--app-primary-hover);
    background: #f3fafd;
}

.app-site .app-nav-link.active {
    color: var(--app-primary);
    background: var(--app-primary-soft);
    border-left-color: #42b9e8;
}

.app-site .app-nav-icon {
    width: 24px;
    min-width: 24px;
    color: #83939c;
    font-size: 1.15rem;
}

.app-site .app-nav-link.active .app-nav-icon {
    color: var(--app-primary);
}

.app-site .app-header {
    height: var(--app-header-height);
    min-height: var(--app-header-height);
    padding: 0 24px 0 38px;
    background: #fff;
    border-bottom-color: #dce4ea;
    backdrop-filter: none;
}

.app-header-brand-group,
.app-header-actions {
    height: 100%;
    display: flex;
    align-items: center;
}

.app-header-brand-group {
    gap: 18px;
}

.app-site .app-menu-button {
    width: 24px;
    height: 42px;
    color: #101418;
    border: 0;
    font-size: 1.45rem;
}

.app-header-brand {
    color: #75828a;
    text-decoration: none;
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -.045em;
    line-height: 1;
}

.app-header-brand:hover {
    color: #75828a;
}

.app-brand-connect {
    color: #36ace0;
}

.app-header-context {
    margin-left: 2px;
    padding-left: 20px;
    display: flex;
    flex-direction: column;
    color: #6b7a84;
    border-left: 1px solid #d9e0e4;
    font-size: .75rem;
    line-height: 1.2;
}

.app-header-context strong {
    margin-top: 2px;
    color: #35abe0;
    font-size: .9rem;
    text-transform: uppercase;
}

.app-site .app-header-actions {
    margin-right: -24px;
    padding: 0 24px;
    gap: 20px;
    color: #fff;
    background: #87949a;
}

.app-language {
    padding-bottom: 5px;
    border-bottom: 1px solid rgba(255, 255, 255, .75);
    font-size: .83rem;
    white-space: nowrap;
}

.app-language .bi {
    margin-left: 4px;
    font-size: .65rem;
}

.app-account-button {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    background: transparent;
    border: 1px solid #fff;
    border-radius: 50%;
    font-size: 1rem;
}

.app-account-menu {
    min-width: 220px;
}

.app-site .app-content {
    padding: 40px;
    background: #fff;
}

.app-content-heading {
    margin-bottom: 24px;
}

.app-site .app-page-title {
    color: #080a0b;
    font-size: 1.55rem;
    font-weight: 700;
    letter-spacing: -.025em;
}

.app-site .app-page-subtitle {
    margin-top: 6px;
    color: #3f505a;
    font-size: .82rem;
}

.app-site .app-card {
    background: var(--app-surface);
    border-color: var(--app-border);
    border-radius: var(--app-radius-lg);
    box-shadow: var(--app-shadow-sm);
}

.app-site .card {
    background: var(--app-surface);
    border-color: var(--app-border);
    border-radius: var(--app-radius-lg);
    box-shadow: var(--app-shadow-sm);
}

.app-site .list-group-item {
    border-color: #e3e9ed;
}

.app-site .list-group-item.active {
    background: var(--app-primary);
    border-color: var(--app-primary);
}

.app-site .app-card-header {
    padding: 24px 25px 14px;
    border-bottom: 0;
}

.app-site .app-card-body {
    padding: 14px 25px 25px;
}

.app-site .app-section-title {
    color: #11171b;
    font-size: 1.05rem;
    font-weight: 700;
}

.app-site .app-section-description {
    color: #53636d;
    font-size: .82rem;
}

.app-site .app-data-table {
    border-collapse: collapse;
    border-spacing: 0;
}

.app-site .app-data-table thead th {
    padding: 12px 0;
    color: #0f171b;
    border-bottom: 1px solid #e7ecef;
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
}

.app-site .app-data-table tbody tr {
    background: transparent;
    box-shadow: none;
}

.app-site .app-data-table tbody td,
.app-site .app-data-table tbody td:first-child,
.app-site .app-data-table tbody td:last-child {
    padding: 15px 0;
    background: transparent;
    border: 0;
    border-bottom: 1px solid #edf1f3;
    border-radius: 0;
}

.app-site .app-data-table tbody tr:hover td {
    background: rgba(255, 255, 255, .55);
}

.app-site .btn-primary {
    background: #078eca;
    border-color: #078eca;
    box-shadow: 0 2px 4px rgba(7, 142, 202, .18);
}

.app-site .btn-primary:hover {
    background: #087eb2;
    border-color: #087eb2;
}

.app-site .btn-outline-primary {
    color: #078eca;
    border-color: #078eca;
}

.app-site .form-control,
.app-site .form-select,
.app-site .ts-control {
    min-height: 44px;
    background-color: #fff;
    border-color: #d6e0e6;
    border-radius: 9px;
}

.app-site .badge {
    padding: .35em .9em;
    border-radius: 999px;
    font-weight: 500;
}

@media (max-width: 991.98px) {
    .app-site .app-header {
        padding-left: 18px;
    }

    .app-site .app-header-brand {
        font-size: 1.55rem;
    }

    .app-site .app-header-context {
        display: none;
    }

    .app-site .app-content {
        padding: 28px 22px;
    }

    .app-site .app-mobile-sidebar .app-sidebar-nav {
        padding: 0;
    }
}

@media (max-width: 575.98px) {
    .app-site .app-header {
        height: 64px;
        min-height: 64px;
        padding-right: 14px;
    }

    .app-site .app-header-actions {
        margin-right: -14px;
        padding: 0 14px;
    }

    .app-site .app-language {
        display: none;
    }

    .app-site .app-content {
        padding: 22px 14px;
    }

    .app-site .app-page-title {
        font-size: 1.3rem;
    }

    .app-site .app-card-header,
    .app-site .app-card-body {
        padding-right: 18px;
        padding-left: 18px;
    }
}
