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

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.82rem;
    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: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    padding: 0.32rem 0.65rem;
}

.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 1rem 0 !important;
    font-size: 1.18rem;
    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;
}

.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)
   ---------------------------- */

.content-with-sidebar {
    padding: 0 !important;
}

.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);
}

/* ----------------------------
   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;
}
