/* =================================================================
   CQ_UI — Bootstrap 5 Design System
   Clean rebuild on Bootstrap 5.3 — loads AFTER bootstrap.min.css
   ================================================================= */

/* ------------------------------------------------------------------
   1. CSS Variables (BS5 override + app-specific tokens)
   ------------------------------------------------------------------ */
:root {
    /* Bootstrap variable overrides */
    --bs-primary:              #2563eb;
    --bs-primary-rgb:          37,99,235;
    --bs-link-color:           #2563eb;
    --bs-link-hover-color:     #1d4ed8;
    --bs-body-bg:              #f1f5f9;
    --bs-body-color:           #1e293b;
    --bs-body-font-family:     'Inter', system-ui, -apple-system, sans-serif;
    --bs-border-color:         #e2e8f0;
    --bs-border-radius:        .5rem;
    --bs-border-radius-sm:     .375rem;
    --bs-border-radius-lg:     .75rem;
    --bs-border-radius-xl:     1rem;
    --bs-card-bg:              #ffffff;
    --bs-card-border-color:    #e2e8f0;
    --bs-card-cap-bg:          #ffffff;

    /* App tokens */
    --primary-color:    #2563eb;
    --primary-dark:     #1d4ed8;
    --primary-light:    rgba(37,99,235,.1);
    --success-color:    #22c55e;
    --warning-color:    #f59e0b;
    --danger-color:     #ef4444;
    --info-color:       #06b6d4;

    --body-bg:          #f1f5f9;
    --card-bg:          #ffffff;
    --sidebar-bg:       linear-gradient(180deg,#1e293b 0%,#0f172a 100%);
    --sidebar-width:    250px;
    --border-color:     #e2e8f0;
    --input-bg:         #ffffff;
    --input-border:     #e2e8f0;
    --text-primary:     #1e293b;
    --text-secondary:   #64748b;
    --text-muted:       #94a3b8;
    --bg-light:         #f8fafc;

    --shadow-sm:  0 1px 3px rgba(0,0,0,.06);
    --shadow-md:  0 4px 12px rgba(0,0,0,.08);
    --shadow-lg:  0 10px 24px rgba(0,0,0,.10);
    --shadow-xl:  0 20px 40px rgba(0,0,0,.12);

    --radius-sm:  .375rem;
    --radius-md:  .5rem;
    --radius-lg:  .75rem;
    --radius-xl:  1rem;

    --transition-fast: .15s ease;
    --transition-base: .2s ease;
    --transition-slow: .3s ease;

    --z-sticky:   100;
    --z-dropdown: 1000;
    --z-sidebar:  1010;
    --z-modal:    2000;
    --z-toast:    3000;

    --focus-ring: 0 0 0 3px rgba(37,99,235,.3);

    /* Short aliases */
    --primary:   #2563eb;
    --secondary: #64748b;
    --success:   #22c55e;
    --warning:   #f59e0b;
    --danger:    #ef4444;
    --info:      #06b6d4;

    /* Backward-compat aliases used by inline page styles */
    --secondary-color: #64748b;
    --bg-hover:        rgba(37,99,235,.04);
    --primary-rgb:     37,99,235;
    --text-color:      var(--text-primary);
    --text-dark:       #1e293b;
    --border-radius:   .5rem;
    --text-right:      right;
}

/* Dark mode */
[data-theme="dark"] {
    --body-bg:        #0f172a;
    --card-bg:        #1e293b;
    --border-color:   #334155;
    --input-bg:       #1e293b;
    --input-border:   #475569;
    --text-primary:   #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted:     #64748b;
    --bg-light:       #1e293b;
    --shadow-sm:      0 1px 3px rgba(0,0,0,.3);
    --shadow-md:      0 4px 12px rgba(0,0,0,.35);
    --bs-body-bg:     #0f172a;
    --bs-body-color:  #f1f5f9;
    --bs-card-bg:     #1e293b;
    --bs-border-color:#334155;

    /* Backward-compat aliases — dark overrides */
    --secondary-color: #94a3b8;
    --bg-hover:        rgba(37,99,235,.08);
    --text-color:      var(--text-primary);
    --text-dark:       #f1f5f9;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --body-bg:        #0f172a;
        --card-bg:        #1e293b;
        --border-color:   #334155;
        --input-bg:       #1e293b;
        --input-border:   #475569;
        --text-primary:   #f1f5f9;
        --text-secondary: #94a3b8;
        --text-muted:     #64748b;
        --bg-light:       #1e293b;
        --secondary-color: #94a3b8;
        --bg-hover:        rgba(37,99,235,.08);
        --text-color:      var(--text-primary);
        --text-dark:       #f1f5f9;
    }
}

/* ------------------------------------------------------------------
   2. Base
   ------------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }

html {
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--bs-body-font-family);
    background-color: var(--body-bg);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    max-width: 100vw;
}

a { color: var(--primary-color); text-decoration: none; transition: color var(--transition-fast); }
a:hover { color: var(--primary-dark); }

:focus-visible { outline: 2px solid var(--primary-color); outline-offset: 2px; }
:focus:not(:focus-visible) { outline: none; }

/* Body scroll lock when sidebar is open */
body.sidebar-scroll-lock { overflow: hidden; }

@media (prefers-reduced-motion: reduce) {
    *,*::before,*::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

.skip-to-content {
    position: absolute; top: -100%; left: 1rem; z-index: 9999;
    padding: .75rem 1.5rem; background: var(--primary-color); color: #fff;
    border-radius: var(--radius-md); font-weight: 600; transition: top var(--transition-fast);
}
.skip-to-content:focus { top: 1rem; color: #fff; }

::-webkit-scrollbar           { width: 6px; height: 6px; }
::-webkit-scrollbar-track     { background: transparent; }
::-webkit-scrollbar-thumb     { background: var(--border-color); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover{ background: var(--text-muted); }

/* ------------------------------------------------------------------
   3. App Shell Layout
   ------------------------------------------------------------------ */
.wrapper {
    display: flex;
    min-height: 100vh;
    max-width: 100vw;
    overflow-x: clip; /* clip prevents horizontal scroll without creating a new stacking context (unlike hidden) */
}

/* ── Sidebar ──
   Mobile-first: sidebar is OFF-SCREEN by default on every viewport.
   @media (min-width:1025px) below brings it back for desktop.
   This means no margin-left fighting, no !important needed anywhere. */
.sidebar {
    width: 280px; max-width: 85vw;
    background: var(--sidebar-bg);
    color: #fff;
    position: fixed;
    top: 0; left: 0; height: 100vh;
    overflow-y: auto; overflow-x: hidden;
    z-index: var(--z-sidebar);
    display: flex; flex-direction: column;
    /* Hidden off-screen to the left by default */
    transform: translateX(-110%);
    will-change: transform;
    box-shadow: none;
    transition: transform var(--transition-slow), width var(--transition-slow), box-shadow var(--transition-slow);
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,.12) transparent;
    flex-shrink: 0;
}
/* Open state (toggled by JS on all breakpoints ≤1024px) */
.sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-xl);
}

.sidebar-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,.08);
    flex-shrink: 0;
}
.sidebar-logo {
    display: flex; align-items: center; gap: .75rem;
    font-size: 1.0625rem; font-weight: 700; color: #fff; text-decoration: none;
}
.sidebar-logo i { font-size: 1.5rem; color: #60a5fa; }

.sidebar-menu { padding: .625rem 0; flex: 1; overflow-y: auto; }

.menu-label {
    padding: .5rem 1.25rem;
    font-size: .625rem; text-transform: uppercase; letter-spacing: .09em;
    color: rgba(255,255,255,.38); font-weight: 600; margin-top: .25rem;
}

.menu-item {
    display: flex; align-items: center; gap: .75rem;
    padding: .5625rem 1.25rem;
    color: rgba(255,255,255,.68); text-decoration: none;
    transition: all var(--transition-fast);
    border-left: 3px solid transparent;
    font-size: .8125rem; font-weight: 500;
    white-space: nowrap; overflow: hidden;
}
.menu-item:hover   { background: rgba(255,255,255,.06); color: #fff; }
.menu-item.active  { background: rgba(37,99,235,.22); color: #fff; border-left-color: #60a5fa; }
.menu-item i       { font-size: .9375rem; width: 1.125rem; text-align: center; flex-shrink: 0; }

.workflow-step {
    display: inline-flex; align-items: center; justify-content: center;
    width: 1.0625rem; height: 1.0625rem; font-size: .5625rem; font-weight: 700;
    border-radius: 50%; background: rgba(37,99,235,.28); color: #93c5fd;
    margin-right: .125rem; flex-shrink: 0; line-height: 1;
}
.menu-item.active .workflow-step { background: rgba(96,165,250,.3); color: #fff; }

.menu-badge {
    margin-left: auto; background: var(--danger-color); color: #fff;
    font-size: .625rem; padding: .1rem .4rem; border-radius: 9999px; font-weight: 700;
}
.menu-live-badge {
    margin-left: auto; min-width: 19px; height: 19px; padding: 0 5px;
    background: var(--danger-color); color: #fff; font-size: .625rem; font-weight: 700;
    border-radius: 10px; display: inline-flex; align-items: center; justify-content: center;
    animation: badgePulse 2s infinite;
}
@keyframes badgePulse {
    0%,100% { box-shadow: 0 0 0 0 rgba(239,68,68,.4); }
    50%      { box-shadow: 0 0 0 4px rgba(239,68,68,0); }
}

.sidebar-footer {
    padding: .875rem 1.25rem 3rem; border-top: 1px solid rgba(255,255,255,.07);
    margin-top: auto; flex-shrink: 0;
}
.sidebar-version { font-size: .625rem; color: rgba(255,255,255,.28); text-align: center; }

/* Sidebar collapse toggle */
.sidebar-collapse-btn {
    position: absolute; bottom: 1rem; left: 50%; transform: translateX(-50%);
    background: rgba(255,255,255,.07); border: none; color: rgba(255,255,255,.45);
    width: 32px; height: 32px; border-radius: 7px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all var(--transition-fast); font-size: .875rem; z-index: 1;
}
.sidebar-collapse-btn:hover { background: rgba(255,255,255,.14); color: #fff; }

/* Collapsed state */
.sidebar.collapsed { width: 64px; }
.sidebar.collapsed .sidebar-logo span,
.sidebar.collapsed .menu-label,
.sidebar.collapsed .menu-item span,
.sidebar.collapsed .menu-badge,
.sidebar.collapsed .sidebar-version { opacity: 0; width: 0; overflow: hidden; }
.sidebar.collapsed .sidebar-header  { padding: 1.25rem .625rem; justify-content: center; }
.sidebar.collapsed .sidebar-logo    { justify-content: center; }
.sidebar.collapsed .menu-item       { justify-content: center; padding: .6875rem; border-left: none; }
.sidebar.collapsed .menu-item i     { width: auto; }
.sidebar.collapsed .menu-label      { height: 0; padding: 0; margin: 0; }
.sidebar.collapsed .sidebar-footer  { padding: .625rem .5rem 3rem; }
.sidebar.collapsed .sidebar-collapse-btn i { transform: rotate(180deg); }

/* Tooltip on collapsed items */
.sidebar.collapsed .menu-item { position: relative; }
.sidebar.collapsed .menu-item::after {
    content: attr(data-tooltip); position: absolute; left: calc(100% + 8px); top: 50%;
    transform: translateY(-50%); background: #1e293b; color: #fff; padding: .3rem .7rem;
    border-radius: 6px; font-size: .6875rem; white-space: nowrap;
    opacity: 0; visibility: hidden; transition: opacity .15s; pointer-events: none; z-index: 1001;
}
.sidebar.collapsed .menu-item:hover::after { opacity: 1; visibility: visible; }

/* Sidebar overlay — uses visibility+opacity so the fade transition fires correctly.
   display:none would kill transitions; visibility:hidden keeps the element in the
   render tree but invisible, allowing opacity to animate on .show toggle. */
.sidebar-overlay {
    visibility: hidden; opacity: 0;
    position: fixed; inset: 0;
    background: rgba(0,0,0,.45); backdrop-filter: blur(2px);
    z-index: calc(var(--z-sidebar) - 1);
    transition: opacity var(--transition-slow), visibility var(--transition-slow);
    pointer-events: none;
}
.sidebar-overlay.show {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
}

/* ── Main content ──
   Mobile-first: NO margin-left. The sidebar is off-screen, so the
   main content fills the full viewport width. Desktop adds the offset. */
.main-content {
    flex: 1;
    margin-left: 0;
    min-height: 100vh;
    display: flex; flex-direction: column;
    overflow-x: hidden;
    min-width: 0; /* prevents flex child blowout */
    max-width: 100%; /* prevent overflow beyond parent */
    /* width: 100% removed — flex:1 handles sizing.
       width:100% + margin-left caused content to overflow viewport on desktop. */
    transition: margin-left var(--transition-slow);
}

/* ── Top Header ── */
.top-header {
    background: var(--card-bg); padding: .8125rem 1.75rem;
    display: flex; align-items: center; justify-content: space-between;
    box-shadow: var(--shadow-sm); position: sticky; top: 0;
    z-index: calc(var(--z-sticky) + 1); border-bottom: 1px solid var(--border-color); flex-shrink: 0;
}
.header-left  { display: flex; align-items: center; gap: .875rem; }
.header-right { display: flex; align-items: center; gap: .5rem; }

/* Mobile-first: hamburger visible on all screens by default, hidden on desktop */
.sidebar-toggle {
    display: flex; align-items: center; justify-content: center;
    background: none; border: none; font-size: 1.25rem;
    color: var(--text-secondary); cursor: pointer; padding: .4375rem .5rem;
    border-radius: var(--radius-md); transition: all var(--transition-base); line-height: 1;
}
.sidebar-toggle:hover { background: var(--bg-light); color: var(--text-primary); }

.breadcrumb {
    display: flex; align-items: center; gap: .3rem;
    font-size: .775rem; color: var(--text-secondary);
    background: none; padding: 0; margin: 0; flex-wrap: wrap;
}
.breadcrumb a { color: var(--primary-color); }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb i { font-size: .55rem; opacity: .45; }

.header-icon-btn {
    position: relative; background: none; border: none; font-size: 1.0625rem;
    color: var(--text-secondary); cursor: pointer; padding: .4375rem;
    border-radius: var(--radius-md); transition: all var(--transition-base);
    line-height: 1; display: flex; align-items: center; justify-content: center;
}
.header-icon-btn:hover { background: var(--bg-light); color: var(--text-primary); }

.notification-badge {
    position: absolute; top: 2px; right: 2px;
    width: 15px; height: 15px; background: var(--danger-color); color: #fff;
    font-size: .5rem; border-radius: 50%; display: flex; align-items: center;
    justify-content: center; font-weight: 700; line-height: 1;
}

.user-btn {
    display: flex; align-items: center; gap: .5rem;
    background: none; border: none; cursor: pointer;
    padding: .3125rem .5rem; border-radius: var(--radius-md); transition: background var(--transition-base);
}
.user-btn:hover { background: var(--bg-light); }

.user-avatar {
    width: 34px; height: 34px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: #fff; border-radius: 50%; display: flex; align-items: center;
    justify-content: center; font-weight: 700; font-size: .75rem; flex-shrink: 0;
}
.user-info { text-align: left; }
.user-name { font-weight: 600; font-size: .775rem; color: var(--text-primary); line-height: 1.3; }
.user-role { font-size: .625rem; color: var(--text-secondary); line-height: 1.2; }

/* ── Page Content ── */
.page-content {
    flex: 1; padding: 1.625rem 1.875rem;
    animation: fadeInPage .22s ease;
}
@keyframes fadeInPage {
    from { opacity: 0; transform: translateY(5px); }
    to   { opacity: 1; transform: translateY(0); }
}

.page-header {
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: 1rem; margin-bottom: 1.625rem;
}
.page-title    { font-size: 1.3125rem; font-weight: 700; color: var(--text-primary); line-height: 1.25; }
.page-subtitle { font-size: .8rem; color: var(--text-secondary); margin-top: .25rem; }

/* ------------------------------------------------------------------
   4. Cards
   ------------------------------------------------------------------ */
.card {
    background: var(--card-bg); border: 1px solid var(--border-color);
    border-radius: var(--radius-lg); box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition-base), transform var(--transition-base); overflow: hidden;
}
.card.clickable { cursor: pointer; }
.card.clickable:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }

.card-header {
    padding: 1rem 1.375rem; border-bottom: 1px solid var(--border-color);
    background: var(--card-bg); display: flex; align-items: center;
    justify-content: space-between; flex-wrap: wrap; gap: .625rem;
}
.card-title  { font-size: .9rem; font-weight: 600; color: var(--text-primary); margin: 0; }
.card-body   { padding: 1.375rem; }
.card-footer { padding: .8125rem 1.375rem; border-top: 1px solid var(--border-color); background: var(--bg-light); }

/* ------------------------------------------------------------------
   5. Stat Cards
   ------------------------------------------------------------------ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(200px,100%), 1fr));
    gap: 1.125rem; margin-bottom: 1.625rem;
}
.stat-card {
    background: var(--card-bg); border-radius: var(--radius-lg); padding: 1.25rem;
    box-shadow: var(--shadow-sm); border: 1px solid var(--border-color);
    display: flex; align-items: flex-start; gap: .875rem;
    transition: all var(--transition-base); overflow: hidden;
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.stat-icon {
    width: 44px; height: 44px; border-radius: var(--radius-md);
    display: flex; align-items: center; justify-content: center; font-size: 1.125rem; flex-shrink: 0;
}
.stat-icon.primary { background: rgba(37,99,235,.1);  color: var(--primary-color); }
.stat-icon.success { background: rgba(34,197,94,.1);  color: var(--success-color); }
.stat-icon.warning { background: rgba(245,158,11,.1); color: var(--warning-color); }
.stat-icon.danger  { background: rgba(239,68,68,.1);  color: var(--danger-color); }
.stat-icon.info    { background: rgba(6,182,212,.1);  color: var(--info-color); }

.stat-content { flex: 1; min-width: 0; }
.stat-value   { font-size: 1.625rem; font-weight: 700; color: var(--text-primary); line-height: 1.2; word-break: break-word; }
.stat-label   { font-size: .775rem; color: var(--text-secondary); margin-top: .1875rem; }
.stat-trend   { font-size: .7rem; margin-top: .3125rem; display: flex; align-items: center; gap: .2rem; }
.stat-trend.up   { color: var(--success-color); }
.stat-trend.down { color: var(--danger-color); }

/* ------------------------------------------------------------------
   6. Tables
   ------------------------------------------------------------------ */
.table-container {
    overflow-x: auto; -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-lg); border: 1px solid var(--border-color);
    background: var(--card-bg); width: 100%; box-sizing: border-box;
}
.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td { padding: .8125rem .9375rem; text-align: left; border-bottom: 1px solid var(--border-color); }
.data-table th {
    font-weight: 600; font-size: .65rem; text-transform: uppercase; letter-spacing: .07em;
    color: var(--text-secondary); background: var(--bg-light); position: sticky; top: 0; z-index: 1; white-space: nowrap;
}
.data-table th[data-sort]           { cursor: pointer; user-select: none; }
.data-table th[data-sort]:hover     { color: var(--primary-color); }
.data-table th[data-sort]::after    { content: '⇅'; margin-left: .3rem; opacity: .3; font-size: .6rem; }
.data-table th[data-sort].asc::after  { content: '↑'; opacity: 1; }
.data-table th[data-sort].desc::after { content: '↓'; opacity: 1; }
.data-table tbody tr { transition: background var(--transition-fast); }
.data-table tbody tr:hover { background: var(--primary-light); }
.data-table tbody tr:last-child td { border-bottom: none; }

/* ------------------------------------------------------------------
   7. Badges
   ------------------------------------------------------------------ */
.badge {
    display: inline-flex; align-items: center; padding: .175rem .55rem;
    font-size: .65rem; font-weight: 600; border-radius: 9999px; gap: .25rem; line-height: 1.4;
}
.badge-primary   { background: rgba(37,99,235,.12);  color: var(--primary-color); }
.badge-success   { background: rgba(34,197,94,.12);  color: #16a34a; }
.badge-warning   { background: rgba(245,158,11,.12); color: #d97706; }
.badge-danger    { background: rgba(239,68,68,.12);  color: #dc2626; }
.badge-info      { background: rgba(6,182,212,.12);  color: #0891b2; }
.badge-secondary { background: rgba(100,116,139,.1); color: var(--text-secondary); }

/* ------------------------------------------------------------------
   8. Buttons
   ------------------------------------------------------------------ */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
    padding: .5rem 1.0625rem; font-size: .875rem; font-weight: 500;
    border-radius: var(--radius-md); cursor: pointer; transition: all var(--transition-base);
    text-decoration: none; white-space: nowrap; user-select: none;
    line-height: 1.4; border: 1px solid transparent;
}
.btn:focus-visible { box-shadow: var(--focus-ring); }
.btn:disabled,[disabled] { opacity: .55; cursor: not-allowed; pointer-events: none; }
.btn-sm { padding: .28125rem .625rem; font-size: .775rem; }
.btn-lg { padding: .6875rem 1.375rem; font-size: .9375rem; }

.btn-primary   { background: var(--primary-color); color: #fff; border-color: var(--primary-color); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: #fff; }
.btn-success   { background: var(--success-color); color: #fff; border-color: var(--success-color); }
.btn-success:hover { background: #16a34a; border-color: #16a34a; color: #fff; }
.btn-warning   { background: var(--warning-color); color: #fff; border-color: var(--warning-color); }
.btn-warning:hover { background: #d97706; border-color: #d97706; color: #fff; }
.btn-danger    { background: var(--danger-color); color: #fff; border-color: var(--danger-color); }
.btn-danger:hover  { background: #dc2626; border-color: #dc2626; color: #fff; }
.btn-info      { background: var(--info-color); color: #fff; border-color: var(--info-color); }
.btn-info:hover    { background: #0891b2; border-color: #0891b2; color: #fff; }
.btn-secondary { background: var(--text-secondary); color: #fff; border-color: var(--text-secondary); }
.btn-secondary:hover { background: #475569; border-color: #475569; color: #fff; }
.btn-outline   { background: transparent; border-color: var(--border-color); color: var(--text-secondary); }
.btn-outline:hover  { background: var(--bg-light); color: var(--text-primary); }
.btn-icon      { width: 34px; height: 34px; padding: 0; border-radius: var(--radius-md); }
.btn-print {
    background: none; border: 1px solid var(--border-color); color: var(--text-muted);
    padding: .4rem .6875rem; border-radius: var(--radius-md); cursor: pointer;
    transition: all var(--transition-base); display: inline-flex; align-items: center; gap: .4rem; font-size: .775rem;
}
.btn-print:hover { background: var(--bg-light); color: var(--text-primary); }

/* ------------------------------------------------------------------
   9. Forms
   ------------------------------------------------------------------ */
.form-group   { margin-bottom: 1rem; }
.form-label   { display: block; font-size: .8rem; font-weight: 500; color: var(--text-primary); margin-bottom: .375rem; }
.form-label.required::after { content: '*'; color: var(--danger-color); margin-left: .2rem; }

.form-control, .form-select {
    width: 100%; padding: .5rem .8125rem; font-size: .875rem;
    border: 1px solid var(--input-border); border-radius: var(--radius-md);
    background: var(--input-bg); color: var(--text-primary);
    transition: border-color var(--transition-base), box-shadow var(--transition-base);
    font-family: inherit; line-height: 1.5;
}
.form-control:hover, .form-select:hover { border-color: var(--text-secondary); }
.form-control:focus, .form-select:focus { outline: none; border-color: var(--primary-color); box-shadow: var(--focus-ring); }
.form-control:disabled, .form-control[readonly] { opacity: .6; cursor: not-allowed; background: var(--bg-light); }
.form-control.is-invalid { border-color: var(--danger-color); }
.invalid-feedback { font-size: .7rem; color: var(--danger-color); margin-top: .1875rem; }

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%2364748b'%3E%3Cpath d='M7 10l5 5 5-5H7z'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right .7rem center;
    background-size: 1.0625rem; padding-right: 2.125rem; cursor: pointer;
}

.form-textarea { min-height: 88px; resize: vertical; }
.form-text     { display: block; font-size: .6875rem; color: var(--text-secondary); margin-top: .25rem; }

.form-actions {
    display: flex; align-items: center; justify-content: flex-end;
    gap: .625rem; padding-top: .875rem; border-top: 1px solid var(--border-color); margin-top: 1.125rem;
}

.form-row { display: flex; flex-wrap: wrap; gap: .875rem; }
.form-row .form-group { flex: 1; min-width: 170px; }

.password-wrapper { position: relative; }
.password-wrapper .form-control { padding-right: 2.625rem; }
.password-toggle {
    position: absolute; right: .6875rem; top: 50%; transform: translateY(-50%);
    background: none; border: none; color: var(--text-secondary);
    cursor: pointer; padding: .175rem; font-size: .875rem; z-index: 2;
}
.password-toggle:hover { color: var(--text-primary); }

.search-input { position: relative; }
.search-input i { position: absolute; left: .8125rem; top: 50%; transform: translateY(-50%); color: var(--text-secondary); pointer-events: none; }
.search-input input { padding-left: 2.25rem; }

.filters-bar {
    display: flex; flex-wrap: wrap; gap: .75rem;
    margin-bottom: 1.125rem; padding: .875rem 1rem;
    background: var(--card-bg); border-radius: var(--radius-lg); border: 1px solid var(--border-color);
}
.filter-item       { flex: 1; min-width: 170px; }
.filter-item.filter-sm   { flex: 0 0 130px; min-width: 100px; }
.filter-item.filter-md   { flex: 0 0 180px; min-width: 130px; }
.filter-item.filter-auto { flex: 0 0 auto; }

.date-range-wrap { display: flex; align-items: center; gap: .375rem; }
.date-range-wrap input[type="date"] {
    padding: .375rem .6875rem; font-size: .775rem;
    border: 1px solid var(--input-border); border-radius: var(--radius-md);
    background: var(--input-bg); color: var(--text-primary); font-family: inherit;
}
.date-range-wrap input[type="date"]:focus { outline: none; border-color: var(--primary-color); box-shadow: var(--focus-ring); }
.date-sep { color: var(--text-muted); font-size: .75rem; flex-shrink: 0; }

/* ------------------------------------------------------------------
   10. Dropdown
   ------------------------------------------------------------------ */
.dropdown { position: relative; }
.notification-wrapper { position: relative; }
.dropdown-menu {
    display: block !important; /* override Bootstrap 5's display:none — we use opacity/visibility */
    position: absolute; top: calc(100% + 5px); right: 0;
    background: var(--card-bg); border-radius: var(--radius-md); box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color); min-width: 190px; padding: .3125rem 0;
    z-index: var(--z-dropdown); opacity: 0; visibility: hidden;
    transform: translateY(5px); transition: all var(--transition-base); pointer-events: none;
}
.dropdown.open .dropdown-menu { opacity: 1; visibility: visible; transform: translateY(0); pointer-events: auto; }
.dropdown-item {
    display: flex; align-items: center; gap: .625rem; padding: .5rem .875rem;
    color: var(--text-primary); text-decoration: none; font-size: .8125rem;
    transition: background var(--transition-fast); cursor: pointer;
    border: none; background: none; width: 100%; text-align: left;
}
.dropdown-item:hover { background: var(--bg-light); color: var(--text-primary); }
.dropdown-item.danger { color: var(--danger-color); }
.dropdown-item.danger:hover { background: rgba(239,68,68,.05); }
.dropdown-divider { height: 1px; background: var(--border-color); margin: .3125rem 0; }

/* ------------------------------------------------------------------
   11. Modal
   ------------------------------------------------------------------ */
.modal-backdrop {
    position: fixed; inset: 0; background: rgba(0,0,0,.5); backdrop-filter: blur(2px);
    display: flex; align-items: center; justify-content: center;
    z-index: var(--z-modal); padding: 1rem;
    opacity: 0; visibility: hidden; transition: all var(--transition-slow);
}
.modal-backdrop.show { opacity: 1; visibility: visible; }
.modal {
    background: var(--card-bg); border-radius: var(--radius-xl); box-shadow: var(--shadow-xl);
    max-width: 560px; width: 100%; max-height: 90vh; overflow: hidden;
    transform: scale(.92); transition: transform var(--transition-slow);
    display: flex; flex-direction: column;
}
.modal-backdrop.show .modal { transform: scale(1); }
.modal-lg { max-width: 760px; }
.modal-header {
    padding: 1.0625rem 1.375rem; border-bottom: 1px solid var(--border-color);
    display: flex; align-items: center; justify-content: space-between; flex-shrink: 0;
}
.modal-title { font-size: 1rem; font-weight: 600; }
.modal-close {
    background: none; border: none; font-size: 1.125rem; color: var(--text-secondary);
    cursor: pointer; padding: .175rem; border-radius: var(--radius-sm); line-height: 1;
}
.modal-close:hover { background: var(--bg-light); }
.modal-body  { padding: 1.375rem; overflow-y: auto; flex: 1; }
.modal-footer {
    padding: .8125rem 1.375rem; border-top: 1px solid var(--border-color);
    display: flex; justify-content: flex-end; gap: .625rem; flex-shrink: 0;
}

/* ------------------------------------------------------------------
   12. Toast Notifications
   ------------------------------------------------------------------ */
.toast-container {
    position: fixed; top: 1rem; right: 1rem; z-index: var(--z-toast);
    display: flex; flex-direction: column; gap: .5rem; pointer-events: none;
}
.toast {
    background: var(--card-bg); border-radius: var(--radius-md); box-shadow: var(--shadow-lg);
    padding: .8125rem 1rem; display: flex; align-items: flex-start; gap: .625rem;
    min-width: 260px; max-width: 360px; animation: slideToast .22s ease;
    pointer-events: auto; border-left: 4px solid var(--border-color);
}
.toast-success { border-left-color: var(--success-color); }
.toast-error   { border-left-color: var(--danger-color); }
.toast-warning { border-left-color: var(--warning-color); }
.toast-info    { border-left-color: var(--info-color); }
@keyframes slideToast { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.toast-icon { font-size: 1rem; }
.toast-success .toast-icon { color: var(--success-color); }
.toast-error   .toast-icon { color: var(--danger-color); }
.toast-warning .toast-icon { color: var(--warning-color); }
.toast-info    .toast-icon { color: var(--info-color); }
.toast-content { flex: 1; }
.toast-title   { font-weight: 600; font-size: .775rem; }
.toast-message { font-size: .7rem; color: var(--text-secondary); margin-top: .15rem; }
.toast-close   { background: none; border: none; color: var(--text-secondary); cursor: pointer; font-size: .875rem; line-height: 1; }

/* ------------------------------------------------------------------
   13. Pagination
   ------------------------------------------------------------------ */
.pagination { display: flex; align-items: center; justify-content: space-between; padding: .75rem 0; flex-wrap: wrap; gap: .625rem; }
.pagination-info { font-size: .775rem; color: var(--text-secondary); }
.pagination-controls { display: flex; gap: .3rem; }
.page-btn {
    width: 32px; height: 32px; display: flex; align-items: center; justify-content: center;
    border: 1px solid var(--border-color); border-radius: var(--radius-md);
    background: var(--card-bg); color: var(--text-secondary); cursor: pointer;
    transition: all var(--transition-fast); font-size: .775rem;
}
.page-btn:hover:not(:disabled) { background: var(--bg-light); color: var(--text-primary); }
.page-btn.active               { background: var(--primary-color); border-color: var(--primary-color); color: #fff; }
.page-btn:disabled             { opacity: .45; cursor: not-allowed; }

/* ------------------------------------------------------------------
   14. Progress
   ------------------------------------------------------------------ */
.progress { height: 6px; background: var(--border-color); border-radius: 9999px; overflow: hidden; }
.progress-bar { height: 100%; border-radius: 9999px; transition: width .35s ease; }
.progress-bar.bg-success   { background: var(--success-color); }
.progress-bar.bg-warning   { background: var(--warning-color); }
.progress-bar.bg-danger    { background: var(--danger-color); }
.progress-bar.bg-info      { background: var(--info-color); }
.progress-bar.bg-primary   { background: var(--primary-color); }
.progress-bar.bg-purple    { background: #8b5cf6; }
.progress-bar.bg-teal      { background: #14b8a6; }
.progress-bar.bg-secondary { background: #94a3b8; }

/* ------------------------------------------------------------------
   15. Timeline
   ------------------------------------------------------------------ */
.timeline { position: relative; padding-left: 1.75rem; }
.timeline::before { content: ''; position: absolute; left: .5rem; top: 0; bottom: 0; width: 2px; background: var(--border-color); }
.timeline-item { position: relative; padding-bottom: 1.25rem; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-dot {
    position: absolute; left: -1.375rem; top: .2rem; width: 10px; height: 10px;
    border-radius: 50%; background: var(--primary-color); border: 2px solid var(--card-bg); box-shadow: var(--shadow-sm);
}
.timeline-content { background: var(--bg-light); padding: .75rem; border-radius: var(--radius-md); }
.timeline-time  { font-size: .6875rem; color: var(--text-secondary); margin-bottom: .15rem; }
.timeline-title { font-weight: 600; font-size: .8125rem; }
.timeline-text  { font-size: .775rem; color: var(--text-secondary); margin-top: .15rem; }

/* ------------------------------------------------------------------
   16. Tabs
   ------------------------------------------------------------------ */
.tabs { display: flex; border-bottom: 2px solid var(--border-color); overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.tabs::-webkit-scrollbar { display: none; }
.tab-btn {
    padding: .5625rem 1.0625rem; font-size: .825rem; font-weight: 500; color: var(--text-secondary);
    background: none; border: none; border-bottom: 2px solid transparent; margin-bottom: -2px;
    cursor: pointer; white-space: nowrap; transition: all var(--transition-base); flex-shrink: 0;
}
.tab-btn:hover  { color: var(--primary-color); }
.tab-btn.active { color: var(--primary-color); border-bottom-color: var(--primary-color); }
.tab-content    { padding: 1.125rem 0; }
.tab-pane       { display: none; }
.tab-pane.active{ display: block; }

/* ------------------------------------------------------------------
   17. Empty State / Spinner / Skeleton
   ------------------------------------------------------------------ */
.empty-state       { text-align: center; padding: 2.25rem 1.25rem; }
.empty-state-icon  { font-size: 2.5rem; color: var(--border-color); margin-bottom: .75rem; }
.empty-state-title { font-size: .9375rem; font-weight: 600; color: var(--text-primary); margin-bottom: .3rem; }
.empty-state-text  { color: var(--text-secondary); font-size: .8125rem; margin-bottom: 1.125rem; }

.spinner { width: 36px; height: 36px; border: 3px solid var(--border-color); border-top-color: var(--primary-color); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.loading-overlay { position: fixed; inset: 0; background: rgba(255,255,255,.8); display: flex; align-items: center; justify-content: center; z-index: 4000; }
[data-theme="dark"] .loading-overlay { background: rgba(15,23,42,.8); }

.skeleton { background: linear-gradient(90deg, var(--bg-light) 25%, var(--border-color) 50%, var(--bg-light) 75%); background-size: 200% 100%; animation: shimmer 1.5s infinite; border-radius: 4px; }
.skeleton-text { height: .8125rem; margin-bottom: .375rem; border-radius: 4px; }
.skeleton-text.short  { width: 55%; }
.skeleton-text.medium { width: 80%; }
.skeleton-circle { width: 38px; height: 38px; border-radius: 50%; }
.skeleton-card   { height: 100px; border-radius: var(--radius-lg); }
@keyframes shimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }

/* ------------------------------------------------------------------
   18. Notification Panel
   ------------------------------------------------------------------ */
.notification-panel {
    position: absolute; top: calc(100% + 5px); right: 0;
    width: 320px; max-width: calc(100vw - 1.25rem);
    background: var(--card-bg); border-radius: var(--radius-lg); box-shadow: var(--shadow-xl);
    border: 1px solid var(--border-color); z-index: var(--z-dropdown);
    opacity: 0; visibility: hidden; transform: translateY(7px); transition: all var(--transition-base);
}
.notification-panel.show { opacity: 1; visibility: visible; transform: translateY(0); }
.notification-header { padding: .8125rem .9375rem; border-bottom: 1px solid var(--border-color); display: flex; align-items: center; justify-content: space-between; }
.notification-list { max-height: 360px; overflow-y: auto; }
.notification-item { padding: .8125rem .9375rem; border-bottom: 1px solid var(--border-color); display: flex; gap: .625rem; cursor: pointer; transition: background var(--transition-fast); }
.notification-item:last-child { border-bottom: none; }
.notification-item:hover { background: var(--bg-light); }
.notification-item.unread { background: rgba(37,99,235,.04); }
.notification-icon { width: 32px; height: 32px; border-radius: 50%; background: var(--bg-light); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.notification-content { flex: 1; min-width: 0; }
.notification-title { font-weight: 600; font-size: .775rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.notification-text  { font-size: .7rem; color: var(--text-secondary); margin-top: .1rem; display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.notification-time  { font-size: .625rem; color: var(--text-secondary); margin-top: .175rem; }

/* ------------------------------------------------------------------
   19. Status Progress
   ------------------------------------------------------------------ */
.status-progress { display: flex; align-items: center; margin: 1.125rem 0; overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: .2rem; }
.status-step { flex: 1; text-align: center; position: relative; min-width: 55px; }
.status-step-dot { width: 28px; height: 28px; border-radius: 50%; background: var(--border-color); color: var(--text-muted); display: flex; align-items: center; justify-content: center; margin: 0 auto .2rem; font-size: .6875rem; position: relative; z-index: 1; transition: all .3s; }
.status-step.completed .status-step-dot { background: var(--success-color); color: #fff; }
.status-step.current   .status-step-dot { background: var(--primary-color); color: #fff; box-shadow: 0 0 0 4px rgba(37,99,235,.16); }
.status-step.rejected  .status-step-dot { background: var(--danger-color);  color: #fff; }
.status-step-label { font-size: .6rem; color: var(--text-muted); font-weight: 500; }
.status-step.completed .status-step-label, .status-step.current .status-step-label { color: var(--text-primary); font-weight: 600; }
.status-step-line { position: absolute; top: 14px; left: 50%; right: -50%; height: 3px; background: var(--border-color); z-index: 0; }
.status-step.completed .status-step-line { background: var(--success-color); }

/* ------------------------------------------------------------------
   20. SLA
   ------------------------------------------------------------------ */
.sla-indicator { display: inline-flex; align-items: center; gap: .375rem; font-size: .775rem; }
.sla-dot { width: 8px; height: 8px; border-radius: 50%; }
.sla-normal .sla-dot  { background: var(--success-color); }
.sla-proche .sla-dot  { background: var(--warning-color); animation: pulse 2s infinite; }
.sla-depasse .sla-dot { background: var(--danger-color);  animation: pulse 1s infinite; }
@keyframes pulse { 0%,100%{ opacity:1; } 50%{ opacity:.4; } }

.sla-countdown { display: flex; gap: .5rem; justify-content: center; margin: .3rem 0; }
.sla-countdown-unit { text-align: center; }
.sla-countdown-value { font-size: 1.25rem; font-weight: 800; line-height: 1; min-width: 40px; padding: .325rem; background: var(--bg-light); border-radius: 6px; display: block; font-variant-numeric: tabular-nums; }
.sla-countdown-label { font-size: .575rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); margin-top: .15rem; }
.sla-countdown.danger  .sla-countdown-value { background: rgba(239,68,68,.1);  color: var(--danger-color); }
.sla-countdown.warning .sla-countdown-value { background: rgba(245,158,11,.1); color: var(--warning-color); }
.sla-countdown.ok      .sla-countdown-value { background: rgba(34,197,94,.1);  color: var(--success-color); }

/* ------------------------------------------------------------------
   21. Dashboard Items
   ------------------------------------------------------------------ */
.dashboard-grid        { display: grid; grid-template-columns: repeat(2,1fr); gap: 1.375rem; align-items: start; }
.dashboard-grid-charts { display: grid; grid-template-columns: 2fr 1fr; gap: 1.375rem; margin-top: 1.375rem; align-items: start; }
.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(175px,100%), 1fr)); gap: 1.125rem; margin-bottom: 1.375rem; }

.db-kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(195px,1fr)); gap: .9375rem; margin-bottom: 1.375rem; }
.kpi-card {
    background: var(--card-bg); border-radius: var(--radius-lg); padding: 1.0625rem;
    display: flex; gap: .8125rem; align-items: flex-start;
    box-shadow: var(--shadow-sm); border: 1px solid var(--border-color);
    transition: transform var(--transition-base), box-shadow var(--transition-base);
    position: relative; overflow: hidden;
}
.kpi-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.kpi-card::after { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
.kpi-card.kpi-primary::after  { background: #2563eb; }
.kpi-card.kpi-success::after  { background: #22c55e; }
.kpi-card.kpi-warning::after  { background: #f59e0b; }
.kpi-card.kpi-danger::after   { background: #ef4444; }
.kpi-card.kpi-info::after     { background: #3b82f6; }
.kpi-card.kpi-purple::after   { background: #8b5cf6; }
.kpi-card.kpi-teal::after     { background: #14b8a6; }

.kpi-icon { width: 40px; height: 40px; border-radius: .5625rem; display: flex; align-items: center; justify-content: center; font-size: 1.0625rem; flex-shrink: 0; }
.kpi-primary .kpi-icon  { background: rgba(37,99,235,.1);  color: #2563eb; }
.kpi-success .kpi-icon  { background: rgba(34,197,94,.1);  color: #22c55e; }
.kpi-warning .kpi-icon  { background: rgba(245,158,11,.1); color: #f59e0b; }
.kpi-danger  .kpi-icon  { background: rgba(239,68,68,.1);  color: #ef4444; }
.kpi-info    .kpi-icon  { background: rgba(59,130,246,.1); color: #3b82f6; }
.kpi-purple  .kpi-icon  { background: rgba(139,92,246,.1); color: #8b5cf6; }
.kpi-teal    .kpi-icon  { background: rgba(20,184,166,.1); color: #14b8a6; }
.kpi-body  { flex: 1; min-width: 0; }
.kpi-value { font-size: 1.4375rem; font-weight: 700; line-height: 1.2; color: var(--text-primary); }
.kpi-label { font-size: .7rem; color: var(--text-secondary); margin-top: .1rem; }
.kpi-sub   { display: flex; flex-wrap: wrap; gap: .25rem; margin-top: .35rem; }
.kpi-badge { display: inline-flex; align-items: center; padding: .075rem .4rem; border-radius: 1rem; font-size: .625rem; font-weight: 500; white-space: nowrap; }
.kpi-badge.success { background: rgba(34,197,94,.12);  color: #16a34a; }
.kpi-badge.warning { background: rgba(245,158,11,.12); color: #d97706; }
.kpi-badge.danger  { background: rgba(239,68,68,.12);  color: #dc2626; }
.kpi-badge.info    { background: rgba(59,130,246,.12); color: #2563eb; }
.kpi-badge.muted   { background: rgba(100,116,139,.1); color: #64748b; }

.db-alerts-bar { display: flex; align-items: center; gap: .8125rem; background: linear-gradient(135deg,#ef4444,#dc2626); color: #fff; border-radius: var(--radius-lg); padding: .6875rem 1.0625rem; margin-bottom: 1.25rem; font-size: .8125rem; animation: alertPulse 3s ease-in-out infinite; }
@keyframes alertPulse { 0%,100%{ box-shadow:0 4px 12px rgba(239,68,68,.22); } 50%{ box-shadow:0 4px 20px rgba(239,68,68,.42); } }

.db-date-filter { display: flex; align-items: center; gap: .4rem; background: var(--card-bg); border: 1px solid var(--border-color); border-radius: var(--radius-md); padding: .25rem .6875rem; font-size: .775rem; }
.db-date-input  { border: none; background: transparent; font-size: .775rem; color: var(--text-primary); padding: .125rem .2rem; width: 120px; outline: none; }

.db-progress-grid  { display: grid; grid-template-columns: repeat(auto-fit, minmax(245px,1fr)); gap: 1.25rem; }
.db-progress-header{ display: flex; justify-content: space-between; align-items: center; margin-bottom: .35rem; }
.db-progress-label { font-size: .775rem; font-weight: 600; color: var(--text-primary); display: flex; align-items: center; gap: .3rem; }
.db-progress-value { font-size: .8125rem; font-weight: 700; color: var(--text-primary); }
.db-progress-bar-wrap { height: 6px; border-radius: 3px; background: var(--border-color); overflow: hidden; margin-bottom: .25rem; }
.db-progress-bar { height: 100%; transition: width .6s ease; }
.db-progress-bar.bg-success   { background: #22c55e; }
.db-progress-bar.bg-warning   { background: #f59e0b; }
.db-progress-bar.bg-danger    { background: #ef4444; }
.db-progress-bar.bg-info      { background: #3b82f6; }
.db-progress-bar.bg-purple    { background: #8b5cf6; }
.db-progress-bar.bg-teal      { background: #14b8a6; }
.db-progress-bar.bg-secondary { background: #94a3b8; }
.db-progress-legend { display: flex; flex-wrap: wrap; gap: .5rem; font-size: .6875rem; color: var(--text-secondary); }
.db-progress-legend .dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; margin-right: .175rem; vertical-align: middle; }

.db-charts-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 1.125rem; margin-bottom: 1.375rem; }

.db-alerts-list { display: flex; flex-direction: column; }
.db-alert-item  { display: flex; align-items: center; gap: .625rem; padding: .5625rem .8125rem; border-bottom: 1px solid var(--border-color); text-decoration: none; color: var(--text-primary); transition: background var(--transition-fast); font-size: .775rem; }
.db-alert-item:last-child { border-bottom: none; }
.db-alert-item:hover { background: var(--bg-light); color: var(--text-primary); }
.db-alert-icon-wrap { width: 28px; height: 28px; border-radius: .4375rem; display: flex; align-items: center; justify-content: center; font-size: .75rem; flex-shrink: 0; }
.db-alert-critical .db-alert-icon-wrap,
.db-alert-danger   .db-alert-icon-wrap { background: rgba(239,68,68,.1);  color: #dc2626; }
.db-alert-warning  .db-alert-icon-wrap { background: rgba(245,158,11,.1); color: #d97706; }
.db-alert-info     .db-alert-icon-wrap { background: rgba(59,130,246,.1); color: #2563eb; }
.db-alert-text  { flex: 1; line-height: 1.4; }
.db-alert-arrow { color: var(--text-secondary); font-size: .6875rem; flex-shrink: 0; }

.db-mini-progress { width: 70px; height: 5px; background: var(--border-color); border-radius: 3px; overflow: hidden; display: inline-block; vertical-align: middle; margin-right: .25rem; }
.db-mini-bar { height: 100%; border-radius: 3px; transition: width .4s; }
.db-mini-bar.bg-success { background: #22c55e; }
.db-mini-bar.bg-warning { background: #f59e0b; }
.db-mini-bar.bg-danger  { background: #ef4444; }

.db-quick-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px,1fr)); gap: .8125rem; }
.db-quick-card { display: flex; flex-direction: column; align-items: center; gap: .4rem; padding: 1rem .75rem; background: var(--card-bg); border: 1px solid var(--border-color); border-radius: var(--radius-lg); text-decoration: none; color: var(--text-primary); transition: all var(--transition-base); text-align: center; font-size: .775rem; font-weight: 500; }
.db-quick-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--primary-color); color: var(--primary-color); }
.db-quick-card i { font-size: 1.3125rem; color: var(--primary-color); }
.db-section-title { font-size: .875rem; font-weight: 600; margin-bottom: .8125rem; color: var(--text-primary); display: flex; align-items: center; gap: .4rem; }

/* ------------------------------------------------------------------
   22. Bulk Actions
   ------------------------------------------------------------------ */
.bulk-actions { display: none; align-items: center; gap: .8125rem; padding: .5625rem .8125rem; background: var(--primary-light); border-radius: var(--radius-md); margin-bottom: .8125rem; border: 1px solid var(--primary-color); }
.bulk-actions.active { display: flex; }
.bulk-count { font-weight: 600; font-size: .8125rem; color: var(--primary-color); }
.data-table .checkbox-cell { width: 36px; text-align: center; }
.data-table input[type="checkbox"] { width: 14px; height: 14px; accent-color: var(--primary-color); cursor: pointer; }

/* ------------------------------------------------------------------
   23. Command Palette
   ------------------------------------------------------------------ */
.command-palette-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.5); backdrop-filter: blur(4px); z-index: 9999; display: flex; align-items: flex-start; justify-content: center; padding-top: 13vh; opacity: 0; visibility: hidden; transition: opacity .2s, visibility .2s; }
.command-palette-overlay.open { opacity: 1; visibility: visible; }
.command-palette { background: var(--card-bg); border-radius: 13px; box-shadow: 0 25px 50px -12px rgba(0,0,0,.25), 0 0 0 1px var(--border-color); width: 100%; max-width: 600px; max-height: 450px; display: flex; flex-direction: column; overflow: hidden; transform: scale(.95) translateY(-7px); transition: transform .2s; }
.command-palette-overlay.open .command-palette { transform: scale(1) translateY(0); }
.command-palette-input-wrap { display: flex; align-items: center; gap: .625rem; padding: .8125rem 1.0625rem; border-bottom: 1px solid var(--border-color); }
.command-palette-input-wrap i { font-size: 1.0625rem; color: var(--text-muted); }
.command-palette-input { flex: 1; border: none; background: none; font-size: .9rem; color: var(--text-primary); outline: none; font-family: inherit; }
.command-palette-input::placeholder { color: var(--text-muted); }
.command-palette-kbd { font-size: .6rem; padding: .125rem .4rem; background: var(--bg-light); border: 1px solid var(--border-color); border-radius: 4px; color: var(--text-muted); }
.command-palette-results { overflow-y: auto; max-height: 330px; padding: .3rem; }
.command-palette-group { padding: .4rem .5625rem .175rem; font-size: .6rem; text-transform: uppercase; letter-spacing: .07em; color: var(--text-muted); font-weight: 600; }
.command-palette-item { display: flex; align-items: center; gap: .5625rem; padding: .4375rem .5625rem; border-radius: 6px; cursor: pointer; transition: background .1s; text-decoration: none; color: var(--text-primary); }
.command-palette-item:hover, .command-palette-item.active { background: var(--primary-light); }
.command-palette-item-icon { width: 32px; height: 32px; border-radius: 6px; display: flex; align-items: center; justify-content: center; font-size: .875rem; flex-shrink: 0; }
.command-palette-item-icon.remarque { background: rgba(239,68,68,.1); color: var(--danger-color); }
.command-palette-item-icon.plaque   { background: rgba(37,99,235,.1); color: var(--primary-color); }
.command-palette-item-icon.nav      { background: rgba(100,116,139,.1); color: var(--text-secondary); }
.command-palette-item-icon.user     { background: rgba(34,197,94,.1); color: var(--success-color); }
.command-palette-item-content { flex: 1; min-width: 0; }
.command-palette-item-title { font-weight: 500; font-size: .8125rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.command-palette-item-desc  { font-size: .6875rem; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.command-palette-footer { padding: .4375rem .8125rem; border-top: 1px solid var(--border-color); display: flex; align-items: center; gap: 1.125rem; font-size: .6rem; color: var(--text-muted); }
.command-palette-footer kbd { font-size: .575rem; padding: .1rem .275rem; background: var(--bg-light); border: 1px solid var(--border-color); border-radius: 3px; }
.command-palette-empty { text-align: center; padding: 1.75rem; color: var(--text-muted); }
.command-palette-empty i { font-size: 1.75rem; opacity: .38; margin-bottom: .3rem; }

/* ------------------------------------------------------------------
   24. Tooltips
   ------------------------------------------------------------------ */
[data-tip] { position: relative; }
[data-tip]::before { content: attr(data-tip); position: absolute; bottom: calc(100% + 5px); left: 50%; transform: translateX(-50%); background: #1e293b; color: #fff; padding: .225rem .5rem; border-radius: 5px; font-size: .625rem; white-space: nowrap; opacity: 0; visibility: hidden; transition: opacity .15s; pointer-events: none; z-index: 1001; }
[data-tip]:hover::before { opacity: 1; visibility: visible; }

/* ------------------------------------------------------------------
   25. Misc components
   ------------------------------------------------------------------ */
.sparkline-wrap { width: 70px; height: 20px; display: inline-flex; align-items: flex-end; gap: 2px; margin-top: .175rem; }
.sparkline-bar  { flex: 1; background: var(--primary-color); border-radius: 2px 2px 0 0; opacity: .5; min-height: 3px; }
.sparkline-bar:last-child { opacity: 1; }

.photo-preview     { max-width: 100%; border-radius: var(--radius-md); cursor: pointer; transition: transform .2s ease; }
.photo-preview:hover{ transform: scale(1.015); }
.photo-modal img   { max-width: 100%; max-height: 80vh; object-fit: contain; }

.session-timeout-warning { position: fixed; bottom: 1rem; left: 50%; transform: translateX(-50%); background: var(--warning-color); color: #1e293b; padding: .5625rem 1.25rem; border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); z-index: var(--z-toast); display: flex; align-items: center; gap: .625rem; font-weight: 500; font-size: .8125rem; animation: slideUpWarn .3s ease; }
@keyframes slideUpWarn { from { transform: translateX(-50%) translateY(100%); opacity: 0; } to { transform: translateX(-50%) translateY(0); opacity: 1; } }

/* ------------------------------------------------------------------
   26. Login Page
   ------------------------------------------------------------------ */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%); padding: 1.375rem; }
.login-card { background: var(--card-bg); border-radius: var(--radius-xl); box-shadow: var(--shadow-xl); width: 100%; max-width: 390px; padding: 2.125rem; }
.login-header  { text-align: center; margin-bottom: 1.625rem; }
.login-logo    { font-size: 2.125rem; color: var(--primary-color); margin-bottom: .625rem; }
.login-title   { font-size: 1.3125rem; font-weight: 700; color: var(--text-primary); }
.login-subtitle{ color: var(--text-secondary); margin-top: .3rem; font-size: .8125rem; }

/* ------------------------------------------------------------------
   27. Mobile bottom nav
   ------------------------------------------------------------------ */
.mobile-bottom-nav { display: none; position: fixed; bottom: 0; left: 0; right: 0; background: var(--card-bg); border-top: 1px solid var(--border-color); z-index: var(--z-sticky); padding: .1875rem 0; padding-bottom: env(safe-area-inset-bottom,.1875rem); box-shadow: 0 -2px 9px rgba(0,0,0,.065); }
.mobile-nav-item { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: .25rem .4375rem; color: var(--text-secondary); text-decoration: none; font-size: .5rem; font-weight: 500; gap: .075rem; border-radius: var(--radius-md); transition: color var(--transition-fast); position: relative; min-width: 46px; min-height: 46px; }
.mobile-nav-item i { font-size: 1.1rem; }
.mobile-nav-item.active, .mobile-nav-item:hover { color: var(--primary-color); }
.mobile-nav-badge { position: absolute; top: 0; right: 5px; width: 13px; height: 13px; background: var(--danger-color); color: #fff; font-size: .45rem; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; }

/* ------------------------------------------------------------------
   28. Utility classes
   ------------------------------------------------------------------ */
.text-center   { text-align: center !important; }
.text-end      { text-align: right !important; }
.text-right    { text-align: right !important; }  /* BS4 compat alias for app.js DataTable */
.text-muted    { color: var(--text-secondary) !important; }
.text-success  { color: var(--success-color) !important; }
.text-warning  { color: var(--warning-color) !important; }
.text-danger   { color: var(--danger-color) !important; }
.text-primary  { color: var(--primary-color) !important; }
.fw-bold       { font-weight: 600 !important; }
.fw-semibold   { font-weight: 500 !important; }
.d-none        { display: none !important; }
.d-flex        { display: flex !important; }
.d-block       { display: block !important; }
.d-inline-flex { display: inline-flex !important; }
.align-center  { align-items: center !important; }
.justify-between { justify-content: space-between !important; }
.flex-wrap     { flex-wrap: wrap !important; }
.gap-1         { gap: .25rem !important; }
.gap-2         { gap: .5rem !important; }
.gap-3         { gap: 1rem !important; }
.w-100         { width: 100% !important; }
.overflow-hidden { overflow: hidden !important; }
.text-truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cursor-pointer{ cursor: pointer !important; }
.pe-none       { pointer-events: none !important; }
.opacity-50    { opacity: .5 !important; }
.mt-1 { margin-top: .25rem !important; }
.mt-2 { margin-top: .5rem !important; }
.mt-3 { margin-top: 1rem !important; }
.mt-4 { margin-top: 1.5rem !important; }
.mb-1 { margin-bottom: .25rem !important; }
.mb-2 { margin-bottom: .5rem !important; }
.mb-3 { margin-bottom: 1rem !important; }
.mb-4 { margin-bottom: 1.5rem !important; }
.me-1 { margin-right: .25rem !important; }
.me-2 { margin-right: .5rem !important; }
.ms-auto { margin-left: auto !important; }
.p-0  { padding: 0 !important; }

/* Legacy grid (backward compat) */
.row { display: flex; flex-wrap: wrap; margin-left: -.75rem; margin-right: -.75rem; }
.row > [class*="col"] { padding-left: .75rem; padding-right: .75rem; width: 100%; }
.col-1  { flex: 0 0 8.333%;  max-width: 8.333%; }
.col-2  { flex: 0 0 16.666%; max-width: 16.666%; }
.col-3  { flex: 0 0 25%;     max-width: 25%; }
.col-4  { flex: 0 0 33.333%; max-width: 33.333%; }
.col-5  { flex: 0 0 41.666%; max-width: 41.666%; }
.col-6  { flex: 0 0 50%;     max-width: 50%; }
.col-7  { flex: 0 0 58.333%; max-width: 58.333%; }
.col-8  { flex: 0 0 66.666%; max-width: 66.666%; }
.col-9  { flex: 0 0 75%;     max-width: 75%; }
.col-10 { flex: 0 0 83.333%; max-width: 83.333%; }
.col-11 { flex: 0 0 91.666%; max-width: 91.666%; }
.col-12 { flex: 0 0 100%;    max-width: 100%; }
@media (min-width: 576px) { .col-sm-6{flex:0 0 50%;max-width:50%} .col-sm-12{flex:0 0 100%;max-width:100%} }
@media (min-width: 768px)  { .col-md-3{flex:0 0 25%;max-width:25%} .col-md-4{flex:0 0 33.333%;max-width:33.333%} .col-md-6{flex:0 0 50%;max-width:50%} .col-md-8{flex:0 0 66.666%;max-width:66.666%} .col-md-12{flex:0 0 100%;max-width:100%} }
@media (min-width: 992px)  { .col-lg-3{flex:0 0 25%;max-width:25%} .col-lg-4{flex:0 0 33.333%;max-width:33.333%} .col-lg-6{flex:0 0 50%;max-width:50%} .col-lg-8{flex:0 0 66.666%;max-width:66.666%} .col-lg-12{flex:0 0 100%;max-width:100%} }
@media (min-width: 1200px) { .col-xl-2{flex:0 0 16.666%;max-width:16.666%} .col-xl-3{flex:0 0 25%;max-width:25%} .col-xl-4{flex:0 0 33.333%;max-width:33.333%} .col-xl-6{flex:0 0 50%;max-width:50%} .col-xl-8{flex:0 0 66.666%;max-width:66.666%} .col-xl-12{flex:0 0 100%;max-width:100%} }

/* ------------------------------------------------------------------
   29. Responsive Breakpoints
   ------------------------------------------------------------------ */

/* ──────────────────────────────────────────────────────────────────
   DESKTOP layout (>= 1025px)
   The sidebar becomes permanently visible and the main content gets
   its margin-left back. Everything below 1025px uses the mobile-first
   base styles (sidebar hidden, margin-left: 0, toggle visible).
   ────────────────────────────────────────────────────────────────── */
@media (min-width: 1025px) {
    /* Sidebar: always visible on desktop, no transform needed */
    .sidebar {
        transform: none !important;
        width: var(--sidebar-width);
        box-shadow: none;
    }
    .sidebar.open {
        transform: none !important;
        box-shadow: none;
    }

    /* Main content: offset by sidebar width */
    .main-content { margin-left: var(--sidebar-width); }
    .sidebar.collapsed ~ .main-content { margin-left: 64px; }
    .sidebar.collapsed { width: 64px; }

    /* Hide the hamburger toggle on desktop */
    .sidebar-toggle { display: none !important; }

    /* Show the collapse button on desktop */
    .sidebar-collapse-btn { display: flex; }

    /* Hide the mobile bottom nav on desktop */
    .mobile-bottom-nav { display: none !important; }
    .page-content { padding-bottom: 1.625rem; }
}

/* ── ≤ 1024px: tablet landscape — grid adjustments only ── */
@media (max-width: 1024px) {
    .stats-grid { grid-template-columns: repeat(2,1fr); }
    .stats-row  { grid-template-columns: repeat(2,1fr); }
    .dashboard-grid { grid-template-columns: 1fr 1fr; }
    .dashboard-grid-charts { grid-template-columns: 1fr; }
    .db-charts-grid { grid-template-columns: 1fr 1fr; }
    .db-kpi-grid { grid-template-columns: repeat(3, 1fr); }
    .page-content { padding: 1.25rem 1.125rem; }

    /* Force main-content to not overflow on tablet */
    .main-content { max-width: 100vw; }
}

/* ── ≤ 768px: tablet portrait ── */
@media (max-width: 768px) {
    .page-content { padding: 1rem .625rem; }
    .top-header   { padding: .6875rem .75rem; }

    .page-header { flex-direction: column; align-items: flex-start; gap: .5rem; }
    .page-header .d-flex { width: 100%; flex-wrap: wrap; gap: .375rem; }
    .page-header > div:last-child { width: 100%; }
    .page-header .btn { width: 100%; justify-content: center; }

    .stats-grid         { grid-template-columns: repeat(2,1fr); gap: .75rem; }
    .stats-row          { grid-template-columns: repeat(2,1fr); gap: .75rem; }
    .db-kpi-grid        { grid-template-columns: repeat(2,1fr); gap: .625rem; }
    .dashboard-grid, .dashboard-grid-charts, .db-charts-grid { grid-template-columns: 1fr; gap: .75rem; }

    /* Date filter — stack on mobile */
    .db-date-filter { flex-wrap: wrap; padding: .25rem .5rem; gap: .25rem; }
    .db-date-input  { width: auto; min-width: 0; flex: 1; }

    /* KPI cards — ensure no overflow */
    .kpi-card    { padding: .875rem .75rem; gap: .625rem; }
    .kpi-icon    { width: 34px; height: 34px; font-size: .9375rem; }
    .kpi-value   { font-size: 1.1875rem; }
    .kpi-label   { font-size: .65rem; word-break: break-word; }
    .kpi-badge   { font-size: .575rem; padding: .05rem .3rem; }
    .kpi-sub     { gap: .2rem; }

    /* ── CRITICAL: Force ALL columns to stack on mobile ── */
    .row > [class*="col-"],
    .row > [class*="col"] {
        flex: 0 0 100% !important;
        max-width: 100% !important;
    }
    .row { gap: 0; } /* prevent double spacing when stacked */

    /* Filters bar — compact mobile layout */
    .filters-bar { flex-direction: column; gap: .5rem; padding: .75rem .75rem; }
    .filter-item { min-width: 100%; flex: 1 1 100%; }
    .filter-item.filter-sm,
    .filter-item.filter-md { flex: 1 1 100%; min-width: 100%; }
    .filter-item.filter-auto { flex: 1 1 100%; }

    /* Date range wraps on mobile */
    .date-range-wrap {
        flex-wrap: wrap;
        gap: .25rem;
    }
    .date-range-wrap input[type="date"] { flex: 1; min-width: 0; }

    .data-table th, .data-table td { padding: .5625rem .4375rem; }
    .data-table { font-size: .775rem; }

    .user-info, .user-btn .bi-chevron-down { display: none; }
    .breadcrumb { display: none; }

    /* Notification panel — full-width slide-down */
    .notification-panel {
        position: fixed; top: 54px; right: 0; left: 0;
        width: 100%; max-width: 100%;
        border-radius: 0 0 var(--radius-lg) var(--radius-lg);
        border-top: none;
    }

    .toast { min-width: 0; max-width: calc(100vw - 1.25rem); }
    .modal { width: 96%; }

    .form-row { flex-direction: column; }
    .form-row .form-group { min-width: 100%; }

    .pagination { flex-direction: column; align-items: center; }

    /* Mobile bottom nav */
    .mobile-bottom-nav { display: flex; justify-content: space-around; align-items: center; }
    .page-content { padding-bottom: calc(5rem + env(safe-area-inset-bottom, 0px)); } /* room for bottom nav + safe area */
    main { padding-bottom: 0; }

    /* Touch-friendly tap targets */
    .form-control, .form-select { min-height: 44px; font-size: 16px; } /* 16px prevents iOS zoom */
    .btn { min-height: 44px; }
    .btn-sm { min-height: 36px; font-size: .775rem; }

    /* Table action buttons stay compact */
    .data-table .btn   { min-height: 32px; padding: .2rem .5rem; }
    .data-table .btn-sm{ min-height: 28px; }

    .session-timeout-warning { left: .875rem; right: .875rem; transform: none; width: auto; }

    /* Card headers stack on narrow screens */
    .card-header { flex-wrap: wrap; gap: .5rem; }
    .card-header .ms-auto { margin-left: 0; }

    /* ── Eligibilité — tabs scroll on mobile ── */
    .elig-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        gap: 0;
        white-space: nowrap;
        flex-wrap: nowrap;
    }
    .elig-tabs::-webkit-scrollbar { display: none; }
    .elig-tab {
        padding: .5rem .875rem;
        font-size: .775rem;
        flex-shrink: 0;
        white-space: nowrap;
    }

    /* ── Map heights — shorter on mobile ── */
    #checkMap, #networkMap { height: 350px !important; }
    #lotMap { height: 280px !important; }

    /* ── Eligibilité dashboard KPIs — responsive grid ── */
    #dashKPIs { grid-template-columns: repeat(2, 1fr) !important; gap: .625rem !important; }

    /* ── Lot stats grid — responsive ── */
    #lotStats { grid-template-columns: repeat(2, 1fr) !important; }

    /* Stat-mini smaller on mobile */
    .stat-mini { padding: .75rem .5rem; }
    .stat-mini .val { font-size: 1.3em; }
    .stat-mini .lbl { font-size: .7em; }

    /* Card overflow protection + tighter margins on mobile */
    .card { margin-bottom: .75rem; max-width: 100%; box-sizing: border-box; overflow: hidden; }
    .card + .card { margin-top: 0; }
    .card-body { overflow-x: auto; }

    /* Page-specific grids that lack responsive rules — force mobile stacking */
    .detail-grid { grid-template-columns: 1fr !important; }
    .kpi-grid { grid-template-columns: repeat(2, 1fr) !important; gap: .75rem !important; }

    /* Alert bar — stack on mobile */
    .db-alerts-bar { flex-wrap: wrap; font-size: .75rem; padding: .625rem .875rem; }
    .db-alerts-bar .btn { width: 100%; margin-top: .375rem; text-align: center; justify-content: center; }

    /* Map containers — reduce height on mobile */
    [style*="height: 600px"],
    [style*="height:600px"] { height: 300px !important; }

    /* Charts grid — full width on mobile */
    .db-charts-grid { grid-template-columns: 1fr; }

    /* Progress grid — single column */
    .db-progress-grid { grid-template-columns: 1fr; }

    /* Badges in page header — wrap */
    .page-header .badge { font-size: .7rem; }

    /* Import zones — tighter on mobile */
    .import-zone { padding: 1.25rem; }
    .import-zone i { font-size: 2rem; }

    /* ── Override inline grid styles on mobile ── */
    /* 3-column inline grids → stack to 1 column */
    [style*="grid-template-columns: 1fr 1fr 1fr"],
    [style*="grid-template-columns:1fr 1fr 1fr"] {
        grid-template-columns: 1fr !important;
    }
    /* 5+ column inline grids → 2 columns */
    [style*="repeat(5,"],
    [style*="repeat(6,"],
    [style*="repeat(5, "],
    [style*="repeat(6, "] {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    /* Map containers — reduce 650px heights too */
    [style*="height: 650px"],
    [style*="height:650px"] { height: 350px !important; }

    /* Eligibilite stats grid */
    #statsGrid { grid-template-columns: repeat(3, 1fr) !important; }
}

/* ── ≤ 480px: small phones ── */
@media (max-width: 480px) {
    .page-content { padding: .5rem .375rem; }
    .top-header   { padding: .5rem .5rem; }
    .header-right { gap: .1875rem; }
    .header-icon-btn { padding: .375rem; }

    .card-body   { padding: .625rem; }
    .card-header { padding: .5625rem .625rem; flex-direction: column; align-items: flex-start; gap: .3rem; }
    .card-header .btn { width: 100%; justify-content: center; }

    .stat-card  { padding: .8125rem; gap: .625rem; }
    .stat-value { font-size: 1.4375rem; }
    .stats-grid { grid-template-columns: 1fr; gap: .5625rem; }
    .stats-row  { grid-template-columns: 1fr; gap: .5625rem; }
    .page-title { font-size: 1.0625rem; }

    /* KPI cards — tighter on very small phones */
    .db-kpi-grid { grid-template-columns: repeat(2, 1fr); gap: .5rem; }
    .kpi-card { padding: .625rem; gap: .5rem; }
    .kpi-icon { width: 30px; height: 30px; font-size: .8125rem; border-radius: .375rem; }
    .kpi-value { font-size: 1.0625rem; }
    .kpi-label { font-size: .6rem; }
    .kpi-badge { font-size: .5rem; padding: .025rem .25rem; }
    .kpi-sub { gap: .15rem; }

    /* KPI grid for pages with inline styles */
    .kpi-grid { grid-template-columns: 1fr !important; gap: .5rem !important; }

    /* Dropdowns slide up as bottom sheets on small phones */
    .dropdown-menu {
        position: fixed; top: auto; bottom: 0; left: 0; right: 0;
        min-width: 100%; border-radius: var(--radius-xl) var(--radius-xl) 0 0;
        max-height: 60vh; overflow-y: auto;
        padding-bottom: env(safe-area-inset-bottom, .5rem);
        transform: translateY(8px);
    }
    .dropdown.open .dropdown-menu { transform: translateY(0); }
    .dropdown-item { padding: .6875rem 1.0625rem; font-size: .875rem; min-height: 44px; }
    /* Overlay behind the bottom-sheet dropdown — uses a sibling div, NOT ::before,
       so it never creates a grey fullscreen lockscreen on its own */
    .dropdown-overlay {
        display: none; position: fixed; inset: 0;
        background: rgba(0,0,0,.32); z-index: calc(var(--z-dropdown) - 1);
    }
    .dropdown.open .dropdown-overlay { display: block; }

    .modal-backdrop { padding: 0; align-items: flex-end; }
    .modal { width: 100%; max-width: 100%; border-radius: 0; }
    .modal-backdrop.show .modal { border-radius: var(--radius-xl) var(--radius-xl) 0 0; max-height: 90vh; }

    .btn-lg { width: 100%; }
    .btn-label { display: none; }

    .db-kpi-grid { grid-template-columns: 1fr 1fr; gap: .5rem; }
    .kpi-value   { font-size: 1.0625rem; }

    .data-table th, .data-table td { padding: .4375rem .25rem; font-size: .6875rem; }
    .data-table .btn-sm { padding: .2rem .3rem; min-width: 26px; }

    .page-btn { width: 28px; height: 28px; font-size: .7rem; }
    .sparkline-wrap { display: none; }

    .command-palette { max-width: calc(100vw - .625rem); }
    .command-palette-overlay { padding-top: 3.5vh; align-items: flex-start; }
    .command-palette-kbd { display: none; }

    .toast-container { left: .4375rem; right: .4375rem; top: .4375rem; }
    .toast { min-width: 0; width: 100%; }

    .login-page { padding: .875rem; align-items: flex-start; padding-top: min(11vh, 55px); }
    .login-card { padding: 1.375rem; border-radius: var(--radius-lg); }
    .login-page .form-control { font-size: 16px; }

    /* ── Eligibilité — even tighter on phones ── */
    .elig-tab { padding: .4rem .625rem; font-size: .725rem; }
    #checkMap, #networkMap { height: 280px !important; }
    #lotMap { height: 220px !important; }
    #dashKPIs { grid-template-columns: 1fr 1fr !important; gap: .5rem !important; }
    #lotStats { grid-template-columns: 1fr 1fr !important; }

    /* Override inline grid styles on very small phones */
    [style*="repeat(5,"],
    [style*="repeat(6,"],
    [style*="repeat(5, "],
    [style*="repeat(6, "] {
        grid-template-columns: 1fr 1fr !important;
    }
    [style*="repeat(3,"],
    [style*="repeat(3, "] {
        grid-template-columns: 1fr 1fr !important;
    }
    #statsGrid { grid-template-columns: repeat(2, 1fr) !important; }

    /* Filters bar ultra-compact */
    .filters-bar { padding: .5rem .625rem; gap: .375rem; }
}

/* ------------------------------------------------------------------
   30. Print
   ------------------------------------------------------------------ */
@media print {
    .sidebar, .top-header, .sidebar-overlay, .toast-container,
    .loading-overlay, .modal-backdrop, .session-timeout-warning,
    .notification-panel, .bulk-actions, .pagination, .filters-bar,
    .btn:not(.btn-print), .sidebar-toggle, .header-right,
    .skip-to-content, .mobile-bottom-nav { display: none !important; }
    .main-content { margin-left: 0 !important; }
    .page-content { padding: 0 !important; animation: none !important; }
    body { background: #fff !important; color: #000 !important; font-size: 11pt; }
    .card { box-shadow: none !important; border: 1px solid #ddd !important; break-inside: avoid; }
    .stats-grid { grid-template-columns: repeat(2,1fr) !important; }
    .data-table th { background: #f0f0f0 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .badge { border: 1px solid currentColor; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ==================================================================
   31. SHARED COMPONENTS — Extracted from inline <style> blocks
   Eliminates duplication across 25+ PHP pages
   ================================================================== */

/* ── Info Table (plaques/view, pv/view, admin/parametres, remarques/view) ── */
.info-table { width: 100%; border-collapse: collapse; }
.info-table th { text-align: left; padding: .5rem .75rem; background: var(--bg-light); color: var(--text-secondary); font-size: .75rem; font-weight: 600; width: 35%; white-space: nowrap; border-bottom: 1px solid var(--border-color); vertical-align: top; }
.info-table td { padding: .5rem .75rem; color: var(--text-primary); font-size: .8125rem; border-bottom: 1px solid var(--border-color); }

/* ── Tabs (alternate implementation used in remarques, doe, attachements, eligibilite) ── */
.tabs-container { margin-bottom: 1rem; }
.tab {
    display: inline-flex; align-items: center; gap: .4rem;
    padding: .5625rem 1rem; font-size: .8125rem; font-weight: 500;
    color: var(--text-secondary); background: none; border: none; cursor: pointer;
    border-bottom: 2px solid transparent; transition: all var(--transition-base);
    position: relative; white-space: nowrap;
}
.tab:hover { color: var(--primary-color); }
.tab.active { color: var(--primary-color); border-bottom-color: var(--primary-color); }
.tab.active::after { content: ''; position: absolute; bottom: -2px; left: 0; right: 0; height: 2px; background: var(--primary-color); border-radius: 2px 2px 0 0; }
.tab-count {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 20px; height: 20px; padding: 0 .375rem;
    font-size: .65rem; font-weight: 600; border-radius: 10px;
    background: var(--bg-light); color: var(--text-secondary);
}
.tab.active .tab-count { background: rgba(37,99,235,.1); color: var(--primary-color); }

/* ── Checkbox label (remarques/index) ── */
.checkbox-label { display: flex; align-items: center; gap: .5rem; cursor: pointer; user-select: none; font-size: .8125rem; color: var(--text-secondary); }
.checkbox-label input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--primary-color); cursor: pointer; }
.checkmark { display: inline-block; width: 16px; height: 16px; border: 2px solid var(--border-color); border-radius: 4px; transition: all var(--transition-fast); }
.checkbox-label input:checked ~ .checkmark { background: var(--primary-color); border-color: var(--primary-color); }

/* ── Remarques Grid (remarques/index) ── */
.remarques-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px,1fr)); gap: 1rem; }
.remarque-card {
    background: var(--card-bg); border: 1px solid var(--border-color);
    border-radius: var(--radius-lg); padding: 1rem; cursor: pointer;
    transition: all var(--transition-base); position: relative; overflow: hidden;
    border-left: 4px solid var(--border-color);
}
.remarque-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.remarque-card[data-gravite="Critique"] { border-left-color: var(--danger-color); }
.remarque-card[data-gravite="Majeure"]  { border-left-color: var(--warning-color); }
.remarque-card[data-gravite="Mineure"]  { border-left-color: var(--info-color); }
.remarque-card-body { display: flex; flex-direction: column; gap: .5rem; }
.remarque-card-header { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.remarque-card-ref { font-weight: 600; font-size: .8125rem; color: var(--text-primary); }
.remarque-card-badges { display: flex; gap: .25rem; flex-wrap: wrap; }
.remarque-card-desc { font-size: .775rem; color: var(--text-secondary); line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.remarque-card-photos { display: flex; gap: .25rem; }
.remarque-card-photo { width: 40px; height: 40px; border-radius: var(--radius-sm); overflow: hidden; }
.remarque-card-photo img { width: 100%; height: 100%; object-fit: cover; }
.photo-count-badge { display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: var(--radius-sm); background: var(--bg-light); font-size: .65rem; color: var(--text-secondary); font-weight: 600; }
.remarque-card-photo-more { display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: var(--radius-sm); background: var(--bg-light); font-size: .65rem; color: var(--text-secondary); font-weight: 600; }
.remarque-card-position { font-size: .7rem; color: var(--text-muted); }
.remarque-card-meta { display: flex; flex-wrap: wrap; gap: .75rem; font-size: .7rem; color: var(--text-secondary); }
.remarque-card-meta-item { display: flex; align-items: center; gap: .25rem; }
.remarque-card-meta-item i { font-size: .75rem; color: var(--text-muted); }
.sla-badge { display: inline-flex; align-items: center; padding: .125rem .4rem; border-radius: 9999px; font-size: .6rem; font-weight: 600; }
.sla-badge.sla-ok      { background: rgba(34,197,94,.12); color: #16a34a; }
.sla-badge.sla-warning  { background: rgba(245,158,11,.12); color: #d97706; }
.sla-badge.sla-danger   { background: rgba(239,68,68,.12); color: #dc2626; }

/* ── File Upload Zone (remarques/create, doe/create) ── */
.file-upload-zone {
    border: 2px dashed var(--border-color); border-radius: var(--radius-lg);
    padding: 1.5rem; text-align: center; cursor: pointer;
    transition: all var(--transition-base); background: var(--bg-light);
}
.file-upload-zone:hover { border-color: var(--primary-color); background: rgba(37,99,235,.04); }
.file-upload-zone.dragover { border-color: var(--primary-color); background: rgba(37,99,235,.08); transform: scale(1.01); }
.file-upload-content { display: flex; flex-direction: column; align-items: center; gap: .5rem; }
.file-upload-content i { font-size: 2rem; color: var(--text-muted); }
.file-upload-content p { font-size: .8125rem; color: var(--text-secondary); margin: 0; }
.file-upload-preview { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .75rem; }
.photos-preview { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .75rem; }
.photo-preview { position: relative; width: 80px; height: 80px; border-radius: var(--radius-md); overflow: hidden; }
.photo-preview img { width: 100%; height: 100%; object-fit: cover; }
.photo-preview .remove-btn { position: absolute; top: 2px; right: 2px; width: 20px; height: 20px; border-radius: 50%; background: var(--danger-color); color: #fff; border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: .6rem; }

/* ── Gravite Selector (remarques/create) ── */
.gravite-selector { display: flex; gap: .75rem; flex-wrap: wrap; }
.gravite-option { flex: 1; min-width: 140px; }
.gravite-option input { position: absolute; opacity: 0; pointer-events: none; }
.gravite-content {
    display: flex; align-items: center; gap: .75rem; padding: .875rem;
    border: 2px solid var(--border-color); border-radius: var(--radius-lg);
    cursor: pointer; transition: all var(--transition-base); background: var(--card-bg);
}
.gravite-content i { font-size: 1.25rem; }
.gravite-label { font-weight: 600; font-size: .8125rem; }
.gravite-sla { font-size: .7rem; color: var(--text-secondary); }
.gravite-option input:checked + .gravite-content { border-width: 2px; box-shadow: var(--shadow-sm); }
.gravite-mineure input:checked + .gravite-content { border-color: var(--info-color); background: rgba(6,182,212,.06); }
.gravite-majeure input:checked + .gravite-content { border-color: var(--warning-color); background: rgba(245,158,11,.06); }
.gravite-critique input:checked + .gravite-content { border-color: var(--danger-color); background: rgba(239,68,68,.06); }

/* ── Btn Block (plaques/edit, plaques/view, remarques/view) ── */
.btn-block { display: flex; width: 100%; justify-content: center; }

/* ── Modal (alternate .modal.active pattern for admin/utilisateurs, admin/prestataires, attachements) ── */
.modal.active {
    opacity: 1; visibility: visible;
}
.modal-content {
    background: var(--card-bg); border-radius: var(--radius-xl); box-shadow: var(--shadow-xl);
    max-width: 560px; width: 100%; max-height: 90vh; overflow: hidden;
    display: flex; flex-direction: column;
}

/* ── Lightbox (remarques/view, attachements/index) ── */
.lightbox {
    position: fixed; inset: 0; background: rgba(0,0,0,.92); z-index: 9999;
    display: flex; align-items: center; justify-content: center;
    opacity: 0; visibility: hidden; transition: all var(--transition-slow);
}
.lightbox.active { opacity: 1; visibility: visible; }
.lightbox img { max-width: 92%; max-height: 88vh; object-fit: contain; border-radius: var(--radius-md); }
.lightbox-close {
    position: absolute; top: 1rem; right: 1rem; width: 40px; height: 40px;
    background: rgba(255,255,255,.15); border: none; color: #fff; border-radius: 50%;
    cursor: pointer; font-size: 1.25rem; display: flex; align-items: center;
    justify-content: center; transition: background var(--transition-fast);
}
.lightbox-close:hover { background: rgba(255,255,255,.3); }
.lightbox-nav {
    position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 44px;
    background: rgba(255,255,255,.12); border: none; color: #fff; border-radius: 50%;
    cursor: pointer; font-size: 1.25rem; display: flex; align-items: center;
    justify-content: center; transition: background var(--transition-fast);
}
.lightbox-nav:hover { background: rgba(255,255,255,.25); }
.lightbox-prev { left: 1rem; }
.lightbox-next { right: 1rem; }
.lightbox-caption { position: absolute; bottom: 1rem; left: 50%; transform: translateX(-50%); color: rgba(255,255,255,.8); font-size: .8125rem; text-align: center; max-width: 80%; }

/* ── Spin animation (plaques/view, eligibilite, doe/create, remarques/view) ── */
.spin { animation: spin .7s linear infinite; }

/* ── User Status Dot (admin/utilisateurs, admin/prestataires) ── */
.user-status { display: inline-flex; align-items: center; gap: .4rem; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-muted); }
.status-dot.active   { background: var(--success-color); }
.status-dot.inactive { background: var(--danger-color); }

/* ── Historique Timeline (pv/view, remarques/view) ── */
.historique-timeline { padding-left: 1.25rem; position: relative; }
.historique-timeline::before { content: ''; position: absolute; left: .75rem; top: 0; bottom: 0; width: 2px; background: var(--border-color); }
.historique-event { position: relative; padding-bottom: 1.25rem; padding-left: 1.5rem; }
.historique-event:last-child { padding-bottom: 0; }
.historique-icon {
    position: absolute; left: -1rem; top: .1rem; width: 26px; height: 26px;
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    font-size: .7rem; background: var(--bg-light); border: 2px solid var(--card-bg); z-index: 1;
}
.historique-body { background: var(--bg-light); padding: .625rem .875rem; border-radius: var(--radius-md); }
.historique-action { font-weight: 600; font-size: .8125rem; color: var(--text-primary); }
.historique-meta { font-size: .7rem; color: var(--text-secondary); margin-top: .15rem; }
.historique-details { font-size: .775rem; color: var(--text-secondary); margin-top: .3rem; }

/* ── Password Strength (profil.php) ── */
.password-strength { margin-top: .5rem; }
.strength-bar { height: 4px; background: var(--border-color); border-radius: 2px; overflow: hidden; }
.strength-fill { height: 100%; border-radius: 2px; transition: width .3s ease, background .3s ease; }
.strength-text { font-size: .7rem; color: var(--text-secondary); margin-top: .25rem; }

/* ── Profile Components (profil.php) ── */
.profile-card { background: var(--card-bg); border-radius: var(--radius-lg); border: 1px solid var(--border-color); overflow: hidden; }
.profile-header { text-align: center; padding: 1.5rem; background: linear-gradient(135deg, var(--primary-color), var(--primary-dark)); color: #fff; }
.profile-avatar { width: 72px; height: 72px; border-radius: 50%; background: rgba(255,255,255,.2); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 1.5rem; font-weight: 700; margin: 0 auto .75rem; border: 3px solid rgba(255,255,255,.3); }
.profile-header h3 { font-size: 1.125rem; font-weight: 600; margin: 0 0 .25rem; }
.profile-header p { opacity: .8; font-size: .8125rem; margin: 0; }
.profile-header .badge { background: rgba(255,255,255,.2); color: #fff; margin-top: .5rem; }
.profile-info { padding: 1rem 1.25rem; }
.profile-info-item { display: flex; align-items: center; gap: .75rem; padding: .625rem 0; border-bottom: 1px solid var(--border-color); font-size: .8125rem; }
.profile-info-item:last-child { border-bottom: none; }
.profile-info-item i { color: var(--text-muted); width: 18px; text-align: center; }
.personal-stat { text-align: center; padding: 1rem; }
.personal-stat:last-child { border-right: none; }
.personal-stat-value { font-size: 1.25rem; font-weight: 700; color: var(--text-primary); }
.personal-stat-label { font-size: .7rem; color: var(--text-secondary); margin-top: .15rem; }

/* ── Action Badge (admin/audit) ── */
.action-badge { display: inline-flex; align-items: center; padding: .15rem .5rem; border-radius: 9999px; font-size: .65rem; font-weight: 600; }
.action-connexion    { background: rgba(34,197,94,.12); color: #16a34a; }
.action-deconnexion  { background: rgba(100,116,139,.1); color: #64748b; }
.action-creation     { background: rgba(37,99,235,.12); color: #2563eb; }
.action-modification { background: rgba(245,158,11,.12); color: #d97706; }
.action-suppression  { background: rgba(239,68,68,.12); color: #dc2626; }
.action-validation   { background: rgba(34,197,94,.12); color: #16a34a; }
.action-rejet        { background: rgba(239,68,68,.12); color: #dc2626; }

/* ── PV Badges (pv/index) ── */
.pv-item { display: flex; align-items: center; gap: .875rem; padding: .75rem 0; border-bottom: 1px solid var(--border-color); text-decoration: none; color: var(--text-primary); transition: background var(--transition-fast); }
.pv-item:hover { background: var(--bg-light); margin: 0 -.875rem; padding-left: .875rem; padding-right: .875rem; border-radius: var(--radius-md); }
.pv-item:last-child { border-bottom: none; }
.pv-icon { width: 36px; height: 36px; border-radius: var(--radius-md); display: flex; align-items: center; justify-content: center; font-size: .875rem; flex-shrink: 0; }
.pv-icon.controle   { background: rgba(37,99,235,.1); color: var(--primary-color); }
.pv-icon.conformite { background: rgba(34,197,94,.1); color: var(--success-color); }
.badge-pv-brouillon    { background: rgba(100,116,139,.1); color: #64748b; }
.badge-pv-finalise     { background: rgba(37,99,235,.12); color: #2563eb; }
.badge-pv-signe-pp     { background: rgba(245,158,11,.12); color: #d97706; }
.badge-pv-signe-admin  { background: rgba(34,197,94,.12); color: #16a34a; }
.badge-pv-signe        { background: rgba(34,197,94,.15); color: #16a34a; }
.badge-pv-refuse-pp    { background: rgba(239,68,68,.12); color: #dc2626; }
.badge-pv-refuse-admin { background: rgba(239,68,68,.12); color: #dc2626; }

/* ── DOE Rows (doe/index) ── */
.doe-row { display: flex; align-items: center; gap: .875rem; padding: .75rem 0; border-bottom: 1px solid var(--border-color); text-decoration: none; color: var(--text-primary); transition: background var(--transition-fast); }
.doe-row:hover { background: var(--bg-light); }
.doe-icon { width: 38px; height: 38px; border-radius: var(--radius-md); display: flex; align-items: center; justify-content: center; font-size: 1rem; flex-shrink: 0; }
.doe-icon.pdf  { background: rgba(239,68,68,.1); color: #dc2626; }
.doe-icon.kmz  { background: rgba(34,197,94,.1); color: #16a34a; }
.doe-icon.dwg  { background: rgba(37,99,235,.1); color: #2563eb; }
.doe-icon.qgis { background: rgba(139,92,246,.1); color: #8b5cf6; }
.doe-icon.plan { background: rgba(245,158,11,.1); color: #d97706; }
.doe-info { flex: 1; min-width: 0; }
.doe-title { font-weight: 600; font-size: .8125rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doe-meta { font-size: .7rem; color: var(--text-secondary); margin-top: .1rem; }
.doe-plaque { font-size: .7rem; color: var(--text-muted); }
.doe-checklist-bar { height: 4px; background: var(--border-color); border-radius: 2px; width: 80px; overflow: hidden; }
.doe-checklist-fill { height: 100%; border-radius: 2px; background: var(--success-color); transition: width .3s; }
.doe-status { flex-shrink: 0; }

/* ── Existing Photos (recensement/edit) ── */
.existing-photos { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: .5rem; }
.existing-photo { position: relative; width: 100px; height: 100px; border-radius: var(--radius-md); overflow: hidden; border: 1px solid var(--border-color); }
.existing-photo img { width: 100%; height: 100%; object-fit: cover; }
.existing-photo .photo-actions { position: absolute; inset: 0; background: rgba(0,0,0,.5); display: flex; align-items: center; justify-content: center; opacity: 0; transition: opacity var(--transition-fast); }
.existing-photo:hover .photo-actions { opacity: 1; }
.existing-photo .photo-actions button { background: rgba(255,255,255,.2); border: none; color: #fff; width: 30px; height: 30px; border-radius: 50%; cursor: pointer; }
.existing-photo .photo-label { position: absolute; bottom: 0; left: 0; right: 0; padding: .15rem .25rem; background: rgba(0,0,0,.6); color: #fff; font-size: .55rem; text-align: center; }
.reject-banner { background: rgba(239,68,68,.1); border: 1px solid rgba(239,68,68,.3); border-radius: var(--radius-md); padding: .75rem 1rem; margin-bottom: 1rem; }
.reject-banner strong { color: var(--danger-color); }

/* ── Detail Grid (admin/prestataires) ── */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.detail-item { padding: .5rem 0; }
.detail-item label { font-size: .7rem; color: var(--text-secondary); display: block; margin-bottom: .15rem; }
.detail-item .detail-value { font-weight: 500; font-size: .8125rem; color: var(--text-primary); }
.detail-plaques { display: flex; flex-wrap: wrap; gap: .375rem; margin-top: .5rem; }
.plaque-chip { display: inline-flex; align-items: center; padding: .175rem .5rem; background: var(--bg-light); border: 1px solid var(--border-color); border-radius: 9999px; font-size: .7rem; font-weight: 500; color: var(--text-primary); }

/* ── Radio Card (pv/create) ── */
.radio-card { position: relative; }
.radio-card input[type="radio"] { position: absolute; opacity: 0; }
.radio-card:has(input:checked) {
    border-color: var(--primary-color);
    background: rgba(37,99,235,.04);
    box-shadow: 0 0 0 2px rgba(37,99,235,.15);
}
.element-category { background: var(--card-bg); border: 1px solid var(--border-color); border-radius: var(--radius-lg); padding: 1rem; margin-bottom: 1rem; }
.element-category:last-child { margin-bottom: 0; }
.element-cat-title { font-weight: 600; font-size: .875rem; color: var(--text-primary); margin-bottom: .75rem; display: flex; align-items: center; gap: .4rem; }
.element-item { display: flex; align-items: center; gap: .75rem; padding: .5rem 0; border-bottom: 1px solid var(--border-color); }
.element-item:last-child { border-bottom: none; }

/* ── SLA Config (admin/parametres) ── */
.sla-config-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; }
.sla-config-item { background: var(--card-bg); border: 1px solid var(--border-color); border-radius: var(--radius-lg); padding: 1rem; display: flex; align-items: center; gap: .75rem; }
.sla-config-item.sla-critique { border-left: 4px solid var(--danger-color); }
.sla-config-item.sla-majeure  { border-left: 4px solid var(--warning-color); }
.sla-config-item.sla-mineure  { border-left: 4px solid var(--info-color); }
.sla-icon { width: 36px; height: 36px; border-radius: var(--radius-md); display: flex; align-items: center; justify-content: center; font-size: 1rem; }
.sla-critique .sla-icon { background: rgba(239,68,68,.1); color: var(--danger-color); }
.sla-majeure .sla-icon  { background: rgba(245,158,11,.1); color: var(--warning-color); }
.sla-mineure .sla-icon  { background: rgba(6,182,212,.1); color: var(--info-color); }
.sla-info { flex: 1; }
.sla-input { width: 70px; padding: .375rem .5rem; font-size: .875rem; text-align: center; }
.checkbox-setting { display: flex; align-items: center; gap: .75rem; padding: .625rem 0; border-bottom: 1px solid var(--border-color); }
.checkbox-setting:last-child { border-bottom: none; }
.setting-info { flex: 1; }
.maintenance-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: .75rem; }
.maintenance-item { background: var(--card-bg); border: 1px solid var(--border-color); border-radius: var(--radius-lg); padding: 1rem; display: flex; align-items: center; gap: .75rem; }

/* ── DOE Plaque Items (plaques/view, pv/view) ── */
.doe-plaque-item { display: flex; align-items: center; gap: .75rem; padding: .625rem; border-bottom: 1px solid var(--border-color); text-decoration: none; color: var(--text-primary); transition: background var(--transition-fast); border-radius: var(--radius-md); }
.doe-plaque-item:hover { background: var(--bg-light); }
.doe-plaque-item:last-child { border-bottom: none; }
.doe-plaque-icon { width: 32px; height: 32px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; font-size: .875rem; background: var(--bg-light); color: var(--text-secondary); flex-shrink: 0; }

/* ── Stat Mini (plaques/view, eligibilite) ── */
.stat-mini { text-align: center; padding: .75rem .5rem; }
.stat-mini-value, .stat-mini .val { font-size: 1.25rem; font-weight: 700; color: var(--text-primary); }
.stat-mini-label, .stat-mini .lbl { font-size: .7rem; color: var(--text-secondary); margin-top: .15rem; }

/* ── Photos Grid (remarques/view, attachements) ── */
.photos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: .5rem; }
.photos-grid-lg { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: .625rem; }
.photo-item { position: relative; border-radius: var(--radius-md); overflow: hidden; aspect-ratio: 1; cursor: pointer; border: 1px solid var(--border-color); }
.photo-item:hover { box-shadow: var(--shadow-md); }
.photo-item img { width: 100%; height: 100%; object-fit: cover; transition: transform var(--transition-base); }
.photo-item:hover img { transform: scale(1.05); }
.photo-overlay { position: absolute; inset: 0; background: rgba(0,0,0,.4); display: flex; align-items: center; justify-content: center; opacity: 0; transition: opacity var(--transition-fast); }
.photo-item:hover .photo-overlay { opacity: 1; }
.photo-overlay i { color: #fff; font-size: 1.25rem; }
.photo-more { display: flex; align-items: center; justify-content: center; background: var(--bg-light); border-radius: var(--radius-md); font-size: .8125rem; color: var(--text-secondary); font-weight: 600; aspect-ratio: 1; cursor: pointer; border: 1px dashed var(--border-color); }
.empty-photos { text-align: center; padding: 1.5rem; color: var(--text-muted); }
.empty-photos i { font-size: 2rem; display: block; margin-bottom: .5rem; opacity: .4; }

/* ── Corrections Timeline (remarques/view) ── */
.corrections-timeline { display: flex; flex-direction: column; gap: .75rem; }
.correction-item { background: var(--bg-light); border-radius: var(--radius-lg); padding: 1rem; transition: box-shadow var(--transition-base); }
.correction-item:hover { box-shadow: var(--shadow-sm); }
.correction-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: .5rem; }
.correction-author { display: flex; align-items: center; gap: .5rem; }
.avatar-small { width: 28px; height: 28px; border-radius: 50%; background: var(--primary-light); color: var(--primary-color); display: flex; align-items: center; justify-content: center; font-size: .65rem; font-weight: 700; }
.correction-content p { font-size: .8125rem; color: var(--text-secondary); margin: .3rem 0; line-height: 1.5; }
.correction-photos { display: flex; flex-wrap: wrap; gap: .375rem; margin-top: .5rem; }
.correction-photo-item { width: 60px; height: 60px; border-radius: var(--radius-sm); overflow: hidden; cursor: pointer; position: relative; }
.correction-photo-item img { width: 100%; height: 100%; object-fit: cover; }
.correction-photo-item:hover { box-shadow: var(--shadow-sm); }
.correction-photo-item .photo-overlay { position: absolute; inset: 0; background: rgba(0,0,0,.3); display: flex; align-items: center; justify-content: center; opacity: 0; transition: opacity var(--transition-fast); }
.correction-photo-item:hover .photo-overlay { opacity: 1; }
.corrections-chip { display: inline-flex; align-items: center; gap: .3rem; padding: .15rem .5rem; border-radius: 9999px; font-size: .65rem; font-weight: 500; }

/* ── Alert boxes (remarques/view) ── */
.alert { padding: .75rem 1rem; border-radius: var(--radius-md); display: flex; align-items: flex-start; gap: .625rem; margin-bottom: 1rem; font-size: .8125rem; }
.alert-danger  { background: rgba(239,68,68,.08); color: #dc2626; border: 1px solid rgba(239,68,68,.15); }
.alert-warning { background: rgba(245,158,11,.08); color: #d97706; border: 1px solid rgba(245,158,11,.15); }
.alert-info    { background: rgba(37,99,235,.08); color: #2563eb; border: 1px solid rgba(37,99,235,.15); }
.alert-success { background: rgba(34,197,94,.08); color: #16a34a; border: 1px solid rgba(34,197,94,.15); }

/* ── Filter Buttons (pv/view, doe/view) ── */
.filter-btn {
    display: inline-flex; align-items: center; gap: .3rem;
    padding: .3rem .625rem; font-size: .75rem; font-weight: 500;
    border: 1px solid var(--border-color); border-radius: 9999px;
    background: var(--card-bg); color: var(--text-secondary);
    cursor: pointer; transition: all var(--transition-fast);
}
.filter-btn:hover { border-color: var(--primary-color); color: var(--primary-color); }
.filter-btn.active, .filter-btn.active-filter { background: var(--primary-color); border-color: var(--primary-color); color: #fff; }

/* ── Card Danger (plaques/edit) ── */
.card-danger { border-left: 4px solid var(--danger-color); }

/* ── Progress Stacked (plaques/view) ── */
.progress-stacked { display: flex; height: 6px; border-radius: 3px; overflow: hidden; background: var(--border-color); }
.progress-stacked .progress-bar { height: 100%; }

/* ── Command Palette Item Badge ── */
.command-palette-item-badge { margin-left: auto; flex-shrink: 0; }

/* ── Badge Status (attachements/index) ── */
.badge-status { display: inline-flex; align-items: center; padding: .15rem .5rem; border-radius: 9999px; font-size: .65rem; font-weight: 600; }
.badge-status.success { background: rgba(34,197,94,.12); color: #16a34a; }
.badge-status.warning { background: rgba(245,158,11,.12); color: #d97706; }
.badge-status.info    { background: rgba(37,99,235,.12); color: #2563eb; }
.badge-status.danger  { background: rgba(239,68,68,.12); color: #dc2626; }
.badge-status.default { background: var(--bg-light); color: var(--text-secondary); }

/* ── Correction Upload (remarques/view) ── */
.correction-upload-zone { border: 2px dashed var(--border-color); border-radius: var(--radius-md); padding: 1rem; text-align: center; cursor: pointer; transition: all var(--transition-base); }
.correction-upload-zone:hover { border-color: var(--primary-color); background: rgba(37,99,235,.04); }
.correction-previews { display: flex; flex-wrap: wrap; gap: .375rem; margin-top: .5rem; }
.correction-preview-item { position: relative; width: 60px; height: 60px; border-radius: var(--radius-sm); overflow: hidden; }
.correction-preview-item img { width: 100%; height: 100%; object-fit: cover; }
.correction-preview-item .remove-btn { position: absolute; top: 2px; right: 2px; width: 18px; height: 18px; border-radius: 50%; background: var(--danger-color); color: #fff; border: none; cursor: pointer; font-size: .5rem; display: flex; align-items: center; justify-content: center; }

/* ── Corrections Rejection Hint ── */
.correction-rejection-hint { background: rgba(239,68,68,.06); border: 1px solid rgba(239,68,68,.15); border-radius: var(--radius-md); padding: .625rem .875rem; font-size: .775rem; color: var(--danger-color); margin-bottom: .75rem; }

/* ── Pagination Bar (remarques/index) ── */
.pagination-bar { display: flex; align-items: center; justify-content: center; gap: .5rem; padding: .75rem 0; }
.pagination-bar .pagination-controls { display: flex; gap: .25rem; }
.pagination-bar .pagination-controls button { min-width: 32px; height: 32px; border: 1px solid var(--border-color); border-radius: var(--radius-md); background: var(--card-bg); color: var(--text-secondary); cursor: pointer; font-size: .775rem; transition: all var(--transition-fast); }
.pagination-bar .pagination-controls button:hover { background: var(--bg-light); }
.pagination-bar .pagination-controls button.active { background: var(--primary-color); border-color: var(--primary-color); color: #fff; }

/* ── Elegibility tabs (eligibilite/index) ── */
.elig-tabs { display: flex; gap: .25rem; margin-bottom: 1rem; }
.elig-tab { padding: .5rem 1rem; border: 1px solid var(--border-color); border-radius: var(--radius-md); background: var(--card-bg); color: var(--text-secondary); cursor: pointer; font-size: .8125rem; font-weight: 500; transition: all var(--transition-base); }
.elig-tab:hover { border-color: var(--primary-color); color: var(--primary-color); }
.elig-tab.active { background: var(--primary-color); border-color: var(--primary-color); color: #fff; }
.elig-panel { display: none; }
.elig-panel.active { display: block; }
.result-eligible { background: rgba(34,197,94,.06); border: 1px solid rgba(34,197,94,.2); border-radius: var(--radius-lg); padding: 1.25rem; text-align: center; }
.result-eligible h3 { color: var(--success-color); }
.result-non-eligible { background: rgba(239,68,68,.06); border: 1px solid rgba(239,68,68,.2); border-radius: var(--radius-lg); padding: 1.25rem; text-align: center; }
.result-non-eligible h3 { color: var(--danger-color); }
.pbo-marker-actif       { color: var(--success-color); }
.pbo-marker-sature      { color: var(--danger-color); }
.pbo-marker-construction{ color: var(--warning-color); }
.pbo-marker-inactif     { color: var(--text-muted); }
.import-zone { border: 2px dashed var(--border-color); border-radius: var(--radius-lg); padding: 2rem; text-align: center; cursor: pointer; transition: all var(--transition-base); }
.import-zone:hover, .import-zone.dragover { border-color: var(--primary-color); background: rgba(37,99,235,.04); }
.import-zone i { font-size: 2rem; color: var(--text-muted); display: block; margin-bottom: .5rem; }
.lot-result-table { width: 100%; border-collapse: collapse; font-size: .8125rem; }
.lot-result-table th, .lot-result-table td { padding: .5rem .75rem; border-bottom: 1px solid var(--border-color); text-align: left; }
.lot-result-table th { background: var(--bg-light); font-weight: 600; font-size: .75rem; color: var(--text-secondary); }
.lot-result-table tr.eligible { background: rgba(34,197,94,.05); }
.lot-result-table tr.non-eligible { background: rgba(239,68,68,.05); }

/* ── Attach tabs (attachements/index) ── */
.attach-tabs { display: flex; gap: .25rem; flex-wrap: wrap; margin-bottom: 1rem; border-bottom: 2px solid var(--border-color); padding-bottom: .25rem; }
.attach-tab { padding: .5rem .875rem; font-size: .8125rem; font-weight: 500; color: var(--text-secondary); background: none; border: none; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -3px; transition: all var(--transition-base); display: inline-flex; align-items: center; gap: .4rem; }
.attach-tab:hover { color: var(--primary-color); }
.attach-tab.active { color: var(--primary-color); border-bottom-color: var(--primary-color); }
.attach-tab .badge-count { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 .3rem; font-size: .6rem; font-weight: 600; border-radius: 9px; background: var(--bg-light); color: var(--text-secondary); }
.attach-tab.active .badge-count { background: rgba(37,99,235,.1); color: var(--primary-color); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Plaque Selector (shared) ── */
.plaque-selector { margin-bottom: 1rem; display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.plaque-selector select { max-width: 340px; }
.plaque-info-badge { display: inline-flex; align-items: center; gap: .3rem; padding: .25rem .625rem; background: var(--bg-light); border: 1px solid var(--border-color); border-radius: var(--radius-md); font-size: .775rem; }

/* ── Plaque Info Banner (shared — always visible on workflow pages) ── */
.plaque-info-banner {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .75rem 1.1rem;
    margin-bottom: 1.2rem;
    background: linear-gradient(135deg, #f0f4ff 0%, #e8f4fe 100%);
    border: 1px solid #c7d2fe;
    border-radius: var(--radius-lg);
    font-size: .88rem;
    transition: all var(--transition-base);
    position: relative;
    min-height: 54px;
}
.plaque-info-banner.visible {
    background: linear-gradient(135deg, #eef2ff 0%, #dbeafe 100%);
    border-color: #93c5fd;
}
.plaque-info-banner .banner-icon {
    width: 40px; height: 40px;
    border-radius: 10px;
    background: var(--primary-color);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}
.plaque-info-banner:not(.visible) .banner-icon {
    background: var(--text-muted);
    opacity: .5;
}
.plaque-info-banner .banner-code {
    font-weight: 700;
    color: var(--primary-color);
    font-family: 'SF Mono', SFMono-Regular, ui-monospace, monospace;
    font-size: .88rem;
    letter-spacing: .02em;
}
.plaque-info-banner .banner-name {
    color: var(--text-primary);
    font-weight: 600;
    font-size: .9rem;
}
.plaque-info-banner .banner-plaque-data {
    display: flex;
    align-items: center;
    gap: .5rem;
    flex: 1;
    min-width: 0;
}
.plaque-info-banner .banner-sep {
    color: var(--text-muted);
    font-size: .75rem;
}
/* Hide plaque data by default, show empty text */
.plaque-info-banner:not(.visible) .banner-code,
.plaque-info-banner:not(.visible) .banner-sep,
.plaque-info-banner:not(.visible) .banner-name { display: none; }
.plaque-info-banner.visible .banner-empty { display: none; }
.plaque-info-banner .banner-empty {
    color: var(--text-muted);
    font-size: .84rem;
    font-style: italic;
}
.plaque-info-banner .banner-workflow {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: .35rem;
    font-size: .72rem;
    color: var(--text-muted);
    font-weight: 500;
    white-space: nowrap;
}
.plaque-info-banner .banner-workflow .wf-step {
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(var(--primary-rgb), .08);
    color: var(--primary-color);
    font-weight: 600;
}
.plaque-info-banner .banner-workflow .wf-step.wf-active {
    background: var(--primary-color);
    color: #fff;
}
.plaque-info-banner .banner-workflow .wf-arrow {
    color: var(--border-color);
}
@media (max-width: 768px) {
    .plaque-info-banner { flex-wrap: wrap; gap: .5rem; }
    .plaque-info-banner .banner-workflow { width: 100%; margin-left: 0; overflow-x: auto; padding-top: .4rem; border-top: 1px solid var(--border-color); margin-top: .25rem; }
}

/* ── Equipment Grid (attachements) ── */
.equip-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: .75rem; }
.equip-card { background: var(--card-bg); border: 1px solid var(--border-color); border-radius: var(--radius-lg); padding: .875rem; position: relative; overflow: hidden; transition: all var(--transition-base); }
.equip-card:hover { box-shadow: var(--shadow-sm); }
.equip-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; }
.equip-card .equip-header { display: flex; align-items: center; gap: .5rem; margin-bottom: .5rem; }
.equip-card .equip-type { font-weight: 600; font-size: .8125rem; }
.equip-card .equip-count { font-size: 1.25rem; font-weight: 700; color: var(--text-primary); }
.equip-card .equip-status { font-size: .7rem; font-weight: 500; }
.equip-card .equip-status.done    { color: var(--success-color); }
.equip-card .equip-status.partial { color: var(--warning-color); }
.equip-card .equip-status.empty   { color: var(--text-muted); }

/* ── Photo Grid (attachements) ── */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .625rem; }
.photo-grid .photo-item { background: var(--card-bg); border: 1px solid var(--border-color); border-radius: var(--radius-md); overflow: hidden; }
.photo-grid .photo-item .photo-info { padding: .375rem .5rem; }
.photo-grid .photo-item .photo-label { font-size: .7rem; font-weight: 500; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.photo-grid .photo-item .photo-cat { font-size: .6rem; color: var(--text-muted); }
.photo-grid .photo-item .photo-actions { display: flex; gap: .25rem; padding: 0 .5rem .375rem; }
.photo-grid .photo-item.required { border-color: var(--warning-color); }
.photo-grid .photo-item.has-photo { border-color: var(--success-color); }

/* ── Checklist Table (attachements) ── */
.checklist-table { width: 100%; border-collapse: collapse; }
.checklist-cat-header { background: var(--bg-light); }
.checklist-cat-header td { padding: .5rem .75rem; font-weight: 600; font-size: .8125rem; color: var(--text-primary); }
.checklist-item td { padding: .375rem .75rem; border-bottom: 1px solid var(--border-color); font-size: .8125rem; }
.check-btn-group { display: flex; gap: .25rem; }
.check-btn { padding: .25rem .5rem; border: 1px solid var(--border-color); border-radius: var(--radius-sm); background: var(--card-bg); color: var(--text-secondary); cursor: pointer; font-size: .7rem; transition: all var(--transition-fast); }
.check-btn.conforme.active    { background: var(--success-color); border-color: var(--success-color); color: #fff; }
.check-btn.non-conforme.active{ background: var(--danger-color); border-color: var(--danger-color); color: #fff; }

/* ── BOQ Table (attachements) ── */
.boq-table { width: 100%; border-collapse: collapse; }
.boq-table th, .boq-table td { padding: .5rem .75rem; border-bottom: 1px solid var(--border-color); text-align: left; font-size: .8125rem; }
.boq-table th { background: var(--bg-light); font-weight: 600; font-size: .75rem; color: var(--text-secondary); }

/* ── Summary/Dash Grid (attachements) ── */
.summary-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.summary-card { background: var(--card-bg); border: 1px solid var(--border-color); border-radius: var(--radius-md); padding: .875rem; display: flex; align-items: center; gap: .625rem; transition: all var(--transition-base); }
.summary-card:hover { box-shadow: var(--shadow-sm); }
.summary-card .icon { width: 36px; height: 36px; border-radius: var(--radius-md); display: flex; align-items: center; justify-content: center; font-size: 1rem; flex-shrink: 0; }
.summary-card .info { flex: 1; }
.summary-card .info .value { font-size: 1.125rem; font-weight: 700; color: var(--text-primary); }
.summary-card .info .label { font-size: .7rem; color: var(--text-secondary); }
.dash-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.dash-card { background: var(--card-bg); border: 1px solid var(--border-color); border-radius: var(--radius-lg); padding: 1rem; }
.dash-card .dash-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: .5rem; }
.dash-card h4 { font-size: .875rem; font-weight: 600; margin: 0; }
.dash-card .dash-big  { font-size: 1.5rem; font-weight: 700; color: var(--text-primary); }
.dash-card .dash-sub  { font-size: .7rem; color: var(--text-secondary); }
.dash-card .dash-bar  { height: 6px; background: var(--border-color); border-radius: 3px; overflow: hidden; margin-top: .5rem; }
.dash-card .dash-bar-fill { height: 100%; border-radius: 3px; transition: width .3s; }

/* ── Progress Ring (attachements) ── */
.progress-ring { display: inline-flex; }

/* ── Toolbar (attachements) ── */
.toolbar { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin-bottom: .75rem; }
.filter-bar { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin-bottom: .75rem; }

/* ── Data Tooltip (attachements) ── */
[data-tooltip] { position: relative; }
[data-tooltip]::before { content: attr(data-tooltip); position: absolute; bottom: calc(100% + 5px); left: 50%; transform: translateX(-50%); background: #1e293b; color: #fff; padding: .225rem .5rem; border-radius: 5px; font-size: .625rem; white-space: nowrap; opacity: 0; visibility: hidden; transition: opacity .15s; pointer-events: none; z-index: 1001; }
[data-tooltip]:hover::before { opacity: 1; visibility: visible; }

/* ── KBD Hint (pv/view) ── */
.kbd-hint { font-size: .6rem; padding: .1rem .3rem; background: var(--bg-light); border: 1px solid var(--border-color); border-radius: 3px; color: var(--text-muted); font-family: monospace; }

/* ── Toggle Buttons (pv/view) ── */
.btn-group-toggle { display: inline-flex; gap: 2px; }
.toggle-btn { padding: .3rem .625rem; font-size: .75rem; border: 1px solid var(--border-color); background: var(--card-bg); color: var(--text-secondary); cursor: pointer; transition: all var(--transition-fast); }
.toggle-btn:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.toggle-btn:last-child  { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.toggle-conforme.active    { background: var(--success-color); border-color: var(--success-color); color: #fff; }
.toggle-non-conforme.active{ background: var(--danger-color); border-color: var(--danger-color); color: #fff; }
.btn-ghost { background: none; border: none; color: var(--text-secondary); cursor: pointer; padding: .3rem .5rem; border-radius: var(--radius-sm); font-size: .75rem; transition: all var(--transition-fast); }
.btn-ghost:hover { background: var(--bg-light); color: var(--text-primary); }

/* ── Score Circle (doe/view) ── */
.score-circle { position: relative; width: 100px; height: 100px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-direction: column; margin: 0 auto; }
.score-circle::before { content: ''; position: absolute; inset: 0; border-radius: 50%; border: 6px solid var(--border-color); }
.score-value { font-size: 1.5rem; font-weight: 800; line-height: 1; color: var(--text-primary); }
.score-unit  { font-size: .65rem; color: var(--text-secondary); }

/* ── Metric Card (doe/view) ── */
.metric-card { text-align: center; padding: .75rem .5rem; }
.metric-value { font-size: 1.25rem; font-weight: 700; color: var(--text-primary); }
.metric-label { font-size: .7rem; color: var(--text-secondary); margin-top: .1rem; }
.metric-bar { height: 4px; border-radius: 2px; background: var(--border-color); margin-top: .4rem; position: relative; overflow: hidden; }
.metric-bar::after { content: ''; position: absolute; left: 0; top: 0; height: 100%; border-radius: 2px; }
.mc-success .metric-value { color: var(--success-color); }
.mc-danger  .metric-value { color: var(--danger-color); }
.mc-warning .metric-value { color: var(--warning-color); }
.mc-muted   .metric-value { color: var(--text-muted); }

/* ── Checklist (doe/view) ── */
.checklist-category { margin-bottom: .75rem; border: 1px solid var(--border-color); border-radius: var(--radius-lg); overflow: hidden; }
.category-header { display: flex; align-items: center; gap: .625rem; padding: .75rem 1rem; background: var(--bg-light); cursor: pointer; transition: background var(--transition-fast); user-select: none; }
.category-header:hover { background: var(--border-color); }
.category-chevron { transition: transform var(--transition-fast); font-size: .8rem; color: var(--text-muted); }
.category-header.collapsed .category-chevron { transform: rotate(-90deg); }
.category-name { font-weight: 600; font-size: .8125rem; flex: 1; }
.category-count { font-size: .7rem; color: var(--text-secondary); }
.category-progress { width: 60px; height: 4px; border-radius: 2px; background: var(--border-color); overflow: hidden; }
.category-progress-fill { height: 100%; border-radius: 2px; background: var(--success-color); transition: width .3s; }
.category-bulk-btn { padding: .2rem .4rem; font-size: .65rem; border: 1px solid var(--border-color); border-radius: var(--radius-sm); background: var(--card-bg); color: var(--text-secondary); cursor: pointer; }
.checklist-item { display: flex; align-items: center; gap: .625rem; padding: .5rem 1rem; border-bottom: 1px solid var(--border-color); transition: background var(--transition-fast); }
.checklist-item:last-child { border-bottom: none; }
.checklist-item:hover { background: var(--bg-light); }
.checklist-item.item-conforme     { background: rgba(34,197,94,.04); }
.checklist-item.item-non-conforme { background: rgba(239,68,68,.04); }
.checklist-item.item-pending      { opacity: 1; /* default state */ }
.checklist-item.filtered-out      { display: none; }
.checklist-num { font-size: .7rem; font-weight: 600; color: var(--text-muted); width: 24px; text-align: center; }
.checklist-content { flex: 1; min-width: 0; }
.checklist-critere { font-size: .8125rem; color: var(--text-primary); }
.checklist-actions { display: flex; gap: .25rem; }
.checklist-btn { padding: .25rem .5rem; border: 1px solid var(--border-color); border-radius: var(--radius-sm); background: var(--card-bg); color: var(--text-secondary); cursor: pointer; font-size: .7rem; transition: all var(--transition-fast); }
.checklist-btn.conforme:hover, .checklist-btn.conforme.active    { background: var(--success-color); border-color: var(--success-color); color: #fff; }
.checklist-btn.non-conforme:hover, .checklist-btn.non-conforme.active { background: var(--danger-color); border-color: var(--danger-color); color: #fff; }

/* ── Badge Criticite (doe/view) ── */
.badge-criticite { display: inline-flex; padding: .15rem .4rem; border-radius: 9999px; font-size: .65rem; font-weight: 600; }
.badge-criticite.bloquant  { background: rgba(239,68,68,.12); color: #dc2626; }
.badge-criticite.important { background: rgba(245,158,11,.12); color: #d97706; }
.badge-criticite.mineur    { background: rgba(6,182,212,.12); color: #0891b2; }

/* ── Comment Section (doe/view) ── */
.comment-item { display: flex; gap: .625rem; padding: .75rem; border-bottom: 1px solid var(--border-color); }
.comment-item:last-child { border-bottom: none; }
.comment-avatar { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: .7rem; font-weight: 700; flex-shrink: 0; background: var(--primary-light); color: var(--primary-color); }
.comment-body { flex: 1; min-width: 0; }
.comment-header { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.comment-date { font-size: .65rem; color: var(--text-muted); }
.comment-text { font-size: .8125rem; color: var(--text-secondary); margin-top: .2rem; line-height: 1.5; }
.comment-attachment { display: inline-flex; align-items: center; gap: .25rem; padding: .2rem .5rem; background: var(--bg-light); border-radius: var(--radius-sm); font-size: .7rem; margin-top: .3rem; }
.comment-type-badge { display: inline-flex; padding: .1rem .35rem; border-radius: 4px; font-size: .55rem; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.type-commentaire  { background: rgba(37,99,235,.1); color: #2563eb; }
.type-annotation   { background: rgba(100,116,139,.1); color: #64748b; }
.type-validation   { background: rgba(34,197,94,.1); color: #16a34a; }
.type-rejet        { background: rgba(239,68,68,.1); color: #dc2626; }
.type-revision     { background: rgba(245,158,11,.1); color: #d97706; }
.comment-item.validation .comment-avatar { background: rgba(34,197,94,.15); color: #16a34a; }
.comment-item.rejet .comment-avatar      { background: rgba(239,68,68,.15); color: #dc2626; }
.comment-item.revision .comment-avatar   { background: rgba(245,158,11,.15); color: #d97706; }

/* ── Gravite Stats (reports/index) ── */
.gravite-stats { display: flex; gap: .75rem; flex-wrap: wrap; }
.gravite-stat-item { flex: 1; min-width: 140px; background: var(--card-bg); border-radius: var(--radius-lg); padding: .875rem; border: 1px solid var(--border-color); }
.gravite-stat-item.critique { border-left: 4px solid var(--danger-color); }
.gravite-stat-item.majeure  { border-left: 4px solid var(--warning-color); }
.gravite-stat-item.mineure  { border-left: 4px solid var(--info-color); }
.gravite-stat-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: .3rem; }
.gravite-stat-label { font-size: .75rem; font-weight: 600; color: var(--text-primary); }
.gravite-stat-value { font-size: 1.125rem; font-weight: 700; color: var(--text-primary); }
.gravite-stat-bar { height: 4px; border-radius: 2px; background: var(--border-color); overflow: hidden; margin-top: .35rem; }
.gravite-stat-progress { height: 100%; border-radius: 2px; transition: width .4s ease; }
.critique .gravite-stat-progress { background: var(--danger-color); }
.majeure .gravite-stat-progress  { background: var(--warning-color); }
.mineure .gravite-stat-progress  { background: var(--info-color); }

/* ── PP Performance (reports/index) ── */
.pp-performance-item { display: flex; align-items: center; gap: .75rem; padding: .5rem 0; border-bottom: 1px solid var(--border-color); }
.pp-performance-item:last-child { border-bottom: none; }
.pp-rank { width: 24px; height: 24px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: .65rem; font-weight: 700; background: var(--bg-light); color: var(--text-secondary); }
.pp-rank.gold   { background: rgba(245,158,11,.15); color: #d97706; }
.pp-rank.silver { background: rgba(100,116,139,.15); color: #64748b; }
.pp-rank.bronze { background: rgba(180,83,9,.15); color: #b45309; }
.pp-info { flex: 1; }
.pp-name { font-weight: 600; font-size: .8125rem; }
.pp-stats { font-size: .7rem; color: var(--text-secondary); }
.pp-score { font-weight: 700; font-size: .875rem; color: var(--text-primary); }

/* ── Export Buttons (reports/index) ── */
.export-buttons { display: flex; gap: .5rem; flex-wrap: wrap; }
.export-btn { display: flex; flex-direction: column; align-items: center; gap: .3rem; padding: .625rem 1rem; border: 1px solid var(--border-color); border-radius: var(--radius-lg); background: var(--card-bg); cursor: pointer; transition: all var(--transition-base); text-align: center; min-width: 80px; }
.export-btn:hover { border-color: var(--primary-color); box-shadow: var(--shadow-sm); }
.export-btn i { font-size: 1.25rem; color: var(--primary-color); }
.export-btn strong { font-size: .775rem; font-weight: 600; }
.export-btn span { font-size: .65rem; color: var(--text-secondary); }

/* ── Chart Legend (reports/index) ── */
.chart-legend { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .5rem; justify-content: center; }
.legend-item { display: flex; align-items: center; gap: .3rem; font-size: .7rem; color: var(--text-secondary); }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

/* ==================================================================
   32. ADDITIONAL RESPONSIVE RULES FOR SHARED COMPONENTS
   ================================================================== */

@media (max-width: 768px) {
    .remarques-grid { grid-template-columns: 1fr; }
    .gravite-selector { flex-direction: column; }
    .gravite-option { min-width: 100%; }
    .detail-grid { grid-template-columns: 1fr; }
    .sla-config-grid { grid-template-columns: 1fr; }
    .equip-grid { grid-template-columns: repeat(2, 1fr); }
    .photo-grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }
    .photos-grid { grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); }
    .photos-grid-lg { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
    .summary-grid { grid-template-columns: repeat(2, 1fr); }
    .dash-grid { grid-template-columns: 1fr; }
    .gravite-stats { flex-direction: column; }
    .export-buttons { justify-content: center; }
    .info-table th { width: auto; }
    .lightbox img { max-width: 96%; max-height: 80vh; }
    .lightbox-close { top: .5rem; right: .5rem; }
    .lightbox-nav { width: 36px; height: 36px; }
    .lightbox-prev { left: .5rem; }
    .lightbox-next { right: .5rem; }
    .existing-photos { gap: .5rem; }
    .existing-photo { width: 80px; height: 80px; }
}

@media (max-width: 480px) {
    .remarques-grid { grid-template-columns: 1fr; gap: .625rem; }
    .remarque-card { padding: .75rem; }
    .equip-grid { grid-template-columns: 1fr; }
    .photo-grid { grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); }
    .summary-grid { grid-template-columns: 1fr; }
    .tab { padding: .4rem .625rem; font-size: .75rem; }
    .tab-count { min-width: 18px; height: 18px; font-size: .6rem; }
    .attach-tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; flex-wrap: nowrap; scrollbar-width: none; }
    .attach-tabs::-webkit-scrollbar { display: none; }
    .attach-tab { flex-shrink: 0; font-size: .725rem; padding: .375rem .625rem; }
    .correction-photo-item { width: 50px; height: 50px; }
    .existing-photo { width: 70px; height: 70px; }
    .score-circle { width: 80px; height: 80px; }
    .score-value { font-size: 1.25rem; }
    .pp-performance-item { flex-wrap: wrap; gap: .5rem; }
}

/* ==================================================================
   33. MOBILE-SPECIFIC RESPONSIVE HELPERS
   ================================================================== */

/* Responsive grid helpers — stack on mobile */
.responsive-grid-3, .responsive-grid-2 { display: grid; gap: 1rem; }

/* Map containers — adaptive height on mobile */
.map-container { min-height: 200px; }

@media (max-width: 768px) {
    /* Responsive grids stack to fewer columns */
    .responsive-grid-3 { grid-template-columns: 1fr 1fr !important; gap: .625rem !important; }
    .responsive-grid-2 { grid-template-columns: 1fr !important; gap: .625rem !important; }

    /* Maps shorter on mobile */
    .map-container { height: 280px !important; }

    /* Action bars always wrap on mobile */
    .card-body[style*="display: flex"],
    .card-body[style*="display:flex"] { flex-wrap: wrap !important; }
}
@media (max-width: 480px) {
    .responsive-grid-3 { grid-template-columns: 1fr !important; }
}
