: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;
}