:root {
    --bg-soft: #f4f7fc;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --line-soft: #dbe5f5;
    --primary: #1d4ed8;
}

/* Densité Full HD (~1920×1080) : base un peu plus compacte que le 16px navigateur.
   La PWA mobile garde 16px via :has(.mob-pwa-route). */
html {
    font-size: 14.5px;
}

html:has(body.mob-pwa-route) {
    font-size: 16px;
}

html,
body {
    font-family: "Inter", "Segoe UI", Roboto, Arial, sans-serif;
    background: var(--bg-soft);
    color: var(--text-main);
}

h1:focus {
    outline: none;
}

a,
.btn-link {
    color: var(--primary);
}

h1,
h2,
h3,
h4,
h5,
h6 {
    color: #0b1220;
    font-weight: 700;
}

.card {
    border: 1px solid var(--line-soft);
    border-radius: 8px;
    box-shadow: 0 3px 10px rgba(15, 23, 42, 0.04);
    overflow: hidden;
}

.card-header {
    border-bottom: 1px solid rgba(219, 229, 245, 0.8);
}

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

.table thead th {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #334155;
    border-bottom-width: 1px;
}

.table > :not(caption) > * > * {
    border-color: #e5edf9;
}

.table-hover tbody tr:hover {
    background: rgba(29, 78, 216, 0.06);
}

.btn {
    border-radius: 7px;
    font-weight: 600;
    font-size: 0.84rem;
    padding: 0.28rem 0.58rem;
}

.btn-primary {
    color: #fff;
    background-color: #1b6ec2;
    border-color: #1861ac;
    border: 1px solid;
}

.btn-primary:hover {
    filter: brightness(1.02);
}

.form-control,
.form-select,
.input-group-text {
    border-radius: 8px;
    border-color: #d0ddf0;
}

.form-control:focus,
.form-select:focus {
    border-color: #93c5fd;
    box-shadow: 0 0 0 0.2rem rgba(37, 99, 235, 0.17);
}

.badge {
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.72rem;
    padding: 0.25rem 0.55rem;
    line-height: 1;
}

.alert {
    border-radius: 12px;
    border: 1px solid transparent;
}

.content {
    padding-top: 1rem;
}

/* Pages : titre homogène (ERP sobre) */
.app-page-title {
    margin: 0 0 0.75rem 0 !important;
    font-size: 1.08rem;
    font-weight: 800;
    letter-spacing: -0.01em;
    color: #0b1220;
}

.app-page-title small {
    margin-left: 0.4rem;
    font-size: 0.82em;
    font-weight: 600;
    color: #64748b !important;
}

.app-page-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.55rem;
    margin-bottom: 0.55rem;
}

/* Bandeau titre commun (Navigation Documents, Accueil, Agenda, etc.) */
.dv-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    flex-wrap: wrap;
    gap: 6px;
}
.dv-topbar-title {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 1.08rem;
    font-weight: 800;
    letter-spacing: -0.01em;
    color: #0b1220;
}
.dv-topbar-title i {
    color: #2e5a45;
    font-size: 0.92rem;
}
.dv-topbar-subtitle {
    font-size: 0.8em;
    font-weight: 600;
    color: #64748b;
}
.dv-topbar-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
}
.dv-btn-action {
    background: #fff;
    border: 1px solid #dce8e2;
    color: #1f3f2f;
    border-radius: 7px;
    font-size: 0.78rem;
    font-weight: 500;
    padding: 4px 10px;
    transition: background 0.15s, border-color 0.15s;
}
.dv-btn-action:hover {
    background: #eaf3ee;
    border-color: #b5d4c4;
    color: #163528;
}
.dv-btn-primary {
    background: #1b8a5a;
    border: 1px solid #1b8a5a;
    color: #fff;
    border-radius: 7px;
    font-size: 0.78rem;
    font-weight: 500;
    padding: 4px 10px;
    transition: background 0.15s;
}
.dv-btn-primary:hover {
    background: #146b45;
    border-color: #146b45;
    color: #fff;
}
.dv-btn-ghost {
    background: transparent;
    border: 1px solid transparent;
    color: #486a59;
    border-radius: 7px;
    padding: 5px 9px;
    transition: background 0.15s;
}
.dv-btn-ghost:hover {
    background: #eaf3ee;
    color: #163528;
}

/* ─── En-tête commun 2 lignes (cf. Médical / Suivi dépenses) ────────────── */
.nh-page-header {
    background: #fff;
    border: 1px solid #dce8e2;
    border-radius: 8px;
    padding: 0.45rem 0.85rem 0.4rem;
    margin-bottom: 0.55rem;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

/* Ligne 1 : titre + boutons côte à côte */
.nh-ph-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Bloc icône + titre (ligne 1 gauche) */
.nh-ph-title {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.98rem;
    font-weight: 800;
    letter-spacing: -0.01em;
    color: #0b1220;
    line-height: 1.2;
}
.nh-ph-title i {
    font-size: 0.92rem;
    color: #1b8a5a;
    flex-shrink: 0;
}

/* Boutons (ligne 1 droite) */
.nh-ph-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
}

/* Ligne 2 : sous-titre / description */
.nh-ph-sub {
    margin: 0;
    font-size: 0.74rem;
    font-weight: 500;
    color: #64748b;
    line-height: 1.35;
}

/* Note d'upload / info inline sous le header */
.nh-page-header-note {
    margin: 0.15rem 0 0;
    font-size: 0.74rem;
    line-height: 1.35;
}

.valid.modified:not([type="checkbox"]) {
    outline: 1px solid #16a34a;
}

.invalid {
    outline: 1px solid #dc2626;
}

.validation-message {
    color: #dc2626;
}

#blazor-error-ui {
    background: #fff4cc;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

/* ----------------------------
   Theme complémentaire (UI)
   ---------------------------- */

.app-body {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.content-with-sidebar {
    padding: 0 !important;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.document-card {
    cursor: pointer;
    transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.document-card:hover {
    transform: none;
    box-shadow: 0 10px 22px rgba(15, 23, 42, 0.06);
}

.card.border-warning {
    border-left: 0 !important;
}

.card.border-danger {
    border-left: 0 !important;
}

.card.border-success {
    border-left: 0 !important;
}

.card.border-primary {
    border-left: 0 !important;
}

/* Modales (DocumentEditModal / DocumentViewModal / etc.) */
.modal-content {
    border-radius: 14px;
    border: 1px solid rgba(226, 232, 240, 0.95);
    box-shadow: 0 14px 40px rgba(15, 23, 42, 0.12);
    overflow: hidden;
}

.modal-header {
    background: #f8fafc;
    border-bottom: 1px solid rgba(226, 232, 240, 0.95);
}

.modal-footer {
    border-top: 1px solid rgba(226, 232, 240, 0.95);
    background: #f8fafc;
}

.modal-header .btn-close {
    border-radius: 10px;
}

iframe {
    border-radius: 12px;
}

/* Onglets bootstrap : style plus moderne */
.nav-tabs {
    border-bottom: 1px solid rgba(219, 229, 245, 0.85);
}

.nav-tabs .nav-link {
    border-radius: 12px;
    border: 1px solid transparent;
    color: #334155;
    font-weight: 700;
}

.nav-tabs .nav-link.active {
    color: #1d4ed8;
    background: rgba(148, 163, 184, 0.12);
    border-color: rgba(148, 163, 184, 0.35);
}

/* Boutons outline : harmonisation */
.btn-outline-primary {
    border-color: rgba(148, 163, 184, 0.45);
    color: #334155;
}

.btn-outline-primary:hover {
    background: rgba(148, 163, 184, 0.12);
    border-color: rgba(148, 163, 184, 0.75);
}

.btn-outline-danger {
    border-color: rgba(239, 68, 68, 0.28);
    color: #991b1b;
}

.btn-outline-danger:hover {
    background: rgba(239, 68, 68, 0.08);
    border-color: rgba(239, 68, 68, 0.35);
}

.btn-outline-secondary {
    border-color: rgba(148, 163, 184, 0.45);
}

.action-icon-group .btn {
    min-width: 32px;
    border-radius: 8px !important;
    padding: 0.22rem 0.46rem;
}

.action-icon-group .btn + .btn {
    margin-left: 0.2rem;
}

.action-icon-group .btn i {
    font-size: 0.82rem;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1;
    padding: 0.28rem 0.58rem;
    border: 1px solid transparent;
}

.status-pill--pending {
    background: #fff4de;
    color: #8a5a00;
    border-color: #f1d79f;
}

.status-pill--inprogress {
    background: #e8f1ff;
    color: #1f4e8c;
    border-color: #b9d2f6;
}

.status-pill--done {
    background: #e8f6ee;
    color: #226a46;
    border-color: #b9dfc9;
}

.status-pill--overdue {
    background: #fdecec;
    color: #992f2f;
    border-color: #efbcbc;
}

.status-pill--archived {
    background: #eef1f4;
    color: #566273;
    border-color: #d1d9e2;
}

/* ----------------------------
   Corporate ERP tuning
   ---------------------------- */

body {
    line-height: 1.35;
}

.card-header {
    padding-top: 0.45rem;
    padding-bottom: 0.45rem;
}

.card-body {
    padding: 0.55rem;
}

.card-footer {
    padding: 0.4rem 0.5rem;
}

/* Tables : plus “ERP” (dense + lisible) */
.table {
    font-size: 0.92rem;
}

.table-sm {
    font-size: 0.88rem;
}

.table thead th {
    background: rgba(219, 229, 245, 0.35);
}

.table tbody td {
    vertical-align: middle;
}

/* Badges : moins “flashy”, plus pro */
.badge.bg-primary,
.badge.bg-success,
.badge.bg-danger,
.badge.bg-warning,
.badge.bg-info,
.badge.bg-secondary {
    background-color: rgba(148, 163, 184, 0.10) !important;
    border: 1px solid rgba(148, 163, 184, 0.28) !important;
    color: #334155 !important;
    font-weight: 600;
}

/* Focus : corporate + accessible */
.form-control:focus,
.form-select:focus {
    box-shadow: 0 0 0 0.2rem rgba(37, 99, 235, 0.15);
}

/* Empty states */
.text-center.py-4,
.text-center.py-5 {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
}

/* KPI cards: reduce visual footprint across pages */
.card.bg-primary.text-white,
.card.bg-success.text-white,
.card.bg-warning.text-white,
.card.bg-info.text-white,
.card.bg-danger.text-white,
.card.bg-secondary.text-white {
    border-radius: 8px;
    min-height: 82px;
}

.card.bg-primary.text-white .card-body,
.card.bg-success.text-white .card-body,
.card.bg-warning.text-white .card-body,
.card.bg-info.text-white .card-body,
.card.bg-danger.text-white .card-body,
.card.bg-secondary.text-white .card-body {
    padding: 0.45rem 0.5rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.card.bg-primary.text-white h2,
.card.bg-success.text-white h2,
.card.bg-warning.text-white h2,
.card.bg-info.text-white h2,
.card.bg-danger.text-white h2,
.card.bg-secondary.text-white h2,
.card.bg-primary.text-white h3,
.card.bg-success.text-white h3,
.card.bg-warning.text-white h3,
.card.bg-info.text-white h3,
.card.bg-danger.text-white h3,
.card.bg-secondary.text-white h3 {
    font-size: 0.96rem;
    margin-bottom: 0;
    font-weight: 700;
    line-height: 1.2;
}

.card.bg-primary.text-white h5,
.card.bg-success.text-white h5,
.card.bg-warning.text-white h5,
.card.bg-info.text-white h5,
.card.bg-danger.text-white h5,
.card.bg-secondary.text-white h5 {
    font-size: 0.72rem;
    margin-bottom: 0.1rem;
    font-weight: 700;
}

.card.bg-primary.text-white .fa-2x,
.card.bg-success.text-white .fa-2x,
.card.bg-warning.text-white .fa-2x,
.card.bg-info.text-white .fa-2x,
.card.bg-danger.text-white .fa-2x,
.card.bg-secondary.text-white .fa-2x {
    font-size: 0.9rem;
    margin-bottom: 0.12rem !important;
}

/* Cartes de contenu/listes : rectangles moins hauts */
.document-card .card-body {
    padding: 0.45rem;
}

.document-card .card-title {
    margin-bottom: 0.3rem;
    font-size: 0.9rem;
}

/* FullCalendar : zone visible même avant chargement JS */
.agenda-calendar-card .card-body {
    overflow-x: auto;
}

.agenda-fc-host {
    min-height: 520px;
}

.agenda-fc-host .fc {
    --fc-border-color: var(--line-soft);
}

/* ──────────────────────────────────────────────────────────
   Variables DocumentsVues / NavigationDocuments
   ────────────────────────────────────────────────────────── */
:root {
    --dv-sidebar-bg: #f8fbf9;
    --dv-sidebar-border: #dce8e2;
    --dv-node-hover: #eaf3ee;
    --dv-node-active-bg: #dff0e6;
    --dv-node-active-text: #104a2f;
    --dv-node-active-border: #1b8a5a;
    --dv-section-fg: #5c7a6b;
    --dv-panel-header-bg: #ffffff;
    --dv-panel-header-border: #dce8e2;
    --dv-accent: #1b8a5a;
    --dv-accent-light: #eef5f1;
    --dv-radius: 8px;
    --dv-shadow: 0 1px 4px rgba(27,138,90,.07), 0 4px 16px rgba(0,0,0,.05);
}

.mobile-app-install-card .mobile-app-qr {
    background: #fff;
    padding: 0.35rem;
}

.ged-col-badge {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 7px;
    border-radius: 8px;
    font-size: 0.65rem;
    font-weight: 700;
    background: #e0e7ff;
    color: #3730a3;
    vertical-align: middle;
    white-space: nowrap;
}

.ged-col-file-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 8px 10px;
    border-bottom: 1px solid #e4ede9;
    background: #f7faf8;
}

.ged-col-file-row {
    display: flex;
    align-items: center;
    gap: 6px;
    border-radius: 6px;
    padding: 2px 4px;
}

.ged-col-file-row.is-active {
    background: #dff0e6;
}

.ged-col-file-name {
    flex: 1;
    min-width: 0;
    text-align: left;
    border: 0;
    background: transparent;
    font-size: 0.82rem;
    padding: 4px 6px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ged-col-file-name:hover {
    color: #104a2f;
}

.dv-row-folder .dv-doc-icon {
    color: #d97706;
}

.dv-row-nested .dv-cell-name {
    padding-left: 1.75rem;
}

.ged-col-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 6px 10px;
    border-bottom: 1px solid #e4ede9;
    background: #f8fafc;
    flex-shrink: 0;
}

.ged-col-tab {
    border: 1px solid #d7e3dc;
    background: #fff;
    color: #334155;
    border-radius: 8px;
    padding: 4px 10px;
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1.3;
    cursor: pointer;
}

.ged-col-tab.is-active {
    background: #1b8a5a;
    border-color: #1b8a5a;
    color: #fff;
}

.ged-col-tab-add {
    position: relative;
    overflow: hidden;
    color: #1b8a5a;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.ged-col-add-label:empty {
    display: none;
}

.ged-col-file {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.ged-col-tabs-error {
    padding: 4px 10px;
    font-size: 0.75rem;
    color: #b91c1c;
}

.pdf-sign-overlay {
    background: rgba(15, 23, 42, 0.55);
    z-index: 1080;
}

.pdf-sign-dialog {
    max-width: 1100px;
}

.pdf-sign-body {
    padding: 12px 16px;
}

.pdf-sign-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 280px;
    gap: 16px;
    min-height: 520px;
}

.pdf-sign-stage-wrap {
    min-width: 0;
    background: #e8eef5;
    border-radius: 8px;
    padding: 8px;
}

.pdf-sign-root,
.pdf-sign-stage {
    position: relative;
    width: 100%;
}

.pdf-sign-stage canvas {
    display: block;
    width: 100%;
    height: auto;
    background: #fff;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.12);
}

.pdf-sign-stamp {
    position: absolute;
    display: none;
    cursor: move;
    user-select: none;
    pointer-events: auto;
}

.pdf-sign-pad {
    width: 100%;
    height: 120px;
    border: 1px dashed #94a3b8;
    border-radius: 8px;
    background: #fff;
    touch-action: none;
}

@media (max-width: 900px) {
    .pdf-sign-layout {
        grid-template-columns: 1fr;
        min-height: 0;
    }
}

.agenda-weekday-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.agenda-weekday-chip {
    width: 2.15rem;
    height: 2.15rem;
    border-radius: 999px;
    border: 1px solid #cfe5da;
    background: #fff;
    color: #1a3d2e;
    font-weight: 700;
    font-size: 0.78rem;
    padding: 0;
}

.agenda-weekday-chip.is-on {
    background: #1b8a5a;
    border-color: #1b8a5a;
    color: #fff;
}

.agenda-rec-end {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.9rem;
    margin: 0;
}

.agenda-section-label {
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #5c7a6b;
    margin: 1rem 0 0.65rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.agenda-section-card {
    background: #f7fbf9;
    border: 1px solid #e3efe8;
    border-radius: 12px;
    padding: 1rem 1rem 0.85rem;
    margin-bottom: 1rem;
}

@media (max-width: 575.98px) {
    .mobile-app-install-card .mobile-app-qr {
        width: 180px;
        height: 180px;
    }
}
