:root {
  /* Brand — bleu marine maritime */
  --ds-brand-50:  #eef4ff;
  --ds-brand-100: #dbe7ff;
  --ds-brand-500: #3a63e8;
  --ds-brand-600: #2848cc;  /* primaire */
  --ds-brand-700: #1f3aa3;

  /* Neutres slate */
  --ds-slate-50:  #f8fafc;
  --ds-slate-100: #f1f5f9;
  --ds-slate-400: #94a3b8;
  --ds-slate-500: #64748b;
  --ds-slate-700: #334155;
  --ds-slate-900: #0f172a;

  /* Sémantique */
  --ds-success-50: #ecfdf5; --ds-success-700: #047857;
  --ds-warning-50: #fffbeb; --ds-warning-700: #b45309;
  --ds-info-50:    #eff6ff; --ds-info-700:    #1d4ed8;
  --ds-danger-50:  #fef2f2; --ds-danger-700:  #b91c1c;

  /* Surfaces */
  --ds-bg: #f6f8fb;
  --ds-surface: #ffffff;
  --ds-border: #e5e9f0;

  /* Type — JetBrains Mono pour les références */
  --ds-font-mono: "JetBrains Mono", ui-monospace, monospace;

  /* === Alias rétrocompatibles avec l'ancien système === */
  --color-primary: var(--ds-brand-600);
  --color-primary-dark: var(--ds-brand-700);
  --color-primary-light: var(--ds-brand-500);
  --bg-app: var(--ds-bg);
  --bg-sidebar: #0d1729; /* sidebar marine plus douce */
  --text-primary: var(--ds-slate-900);
  --text-secondary: var(--ds-slate-500);
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-app);
    color: var(--text-primary);
    margin: 0;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-heading);
    color: var(--text-primary);
    font-weight: 600;
}

/* Layout Utilities */
.cc-layout {
    display: flex;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    position: relative;
}

.cc-sidebar {
    width: 280px;
    background-color: var(--bg-sidebar);
    background-image: linear-gradient(180deg, var(--bg-sidebar) 0%, #0a0e1e 100%);
    color: var(--text-on-dark);
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.2);
    position: fixed;
    top: 0;
    left: -280px;
    height: 100vh;
    z-index: 1000;
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.cc-sidebar::-webkit-scrollbar {
    width: 6px;
}

.cc-sidebar::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
}

.cc-sidebar.open {
    left: 0;
}

.cc-sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
    z-index: 999;
    display: none;
}

.cc-sidebar-overlay.show {
    display: block;
}

.cc-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100%;
    overflow-y: auto;
    background-color: var(--bg-app);
    transition: margin-left 0.3s ease;
}

.cc-header {
    height: 64px;
    min-height: 64px;
    background-color: var(--bg-surface);
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    padding: 0 16px;
    justify-content: space-between;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.cc-content {
    padding: 16px;
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
}

/* Responsive Overrides */
@media (min-width: 992px) {
    .cc-sidebar {
        position: static;
        width: 260px;
        min-width: 260px;
        left: 0;
    }

    .cc-sidebar-overlay {
        display: none !important;
    }

    .cc-header {
        padding: 0 24px;
    }

    .d-lg-none {
        display: none !important;
    }
}

@media (max-width: 991.98px) {
    .cc-sidebar {
        width: 280px;
        left: -280px;
    }

    .cc-sidebar.open {
        left: 0;
    }

    .cc-header {
        position: sticky;
        top: 0;
        width: 100%;
        z-index: 50;
    }
}

/* Ultrawide support */
@media (min-width: 1900px) {
    .cc-content {
        max-width: 1600px;
    }
}

/* Card Component */
.cc-card {
    background: var(--bg-surface);
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-sm);
    padding: 20px;
    margin-bottom: 20px;
    position: relative;
}

/* Simulated dropdown for Blazor without Bootstrap JS */
.cc-dropdown-container {
    position: relative;
    display: inline-block;
}

.cc-dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    z-index: 1050;
    display: none;
    min-width: 200px;
    padding: 6px 0;
    margin: 4px 0 0;
    font-size: 0.9rem;
    color: #1a202c;
    text-align: left;
    list-style: none;
    background-color: #ffffff;
    background-clip: padding-box;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15), 0 2px 8px rgba(0, 0, 0, 0.08);
}

.cc-dropdown-menu.show {
    display: block;
}

.cc-dropdown-item {
    display: block;
    width: 100%;
    padding: 8px 16px;
    clear: both;
    font-weight: 500;
    font-size: 0.85rem;
    color: #334155;
    text-align: inherit;
    white-space: nowrap;
    background-color: transparent;
    border: 0;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.12s, color 0.12s;
}

.cc-dropdown-item:hover {
    background-color: #f1f5f9;
    color: var(--ds-brand-600);
}

.cc-dropdown-item.text-danger {
    color: #dc3545;
}

.cc-dropdown-item.text-danger:hover {
    background-color: #fef2f2;
    color: #b91c1c;
}

.cc-dropdown-item.text-success {
    color: #047857;
}

.cc-dropdown-item.text-success:hover {
    background-color: #ecfdf5;
    color: #065f46;
}


/* Sidebar Navigation */
.cc-sidebar .nav-link {
    color: rgba(255, 255, 255, 0.7) !important;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    border-radius: var(--border-radius-sm);
    margin: 4px 12px;
    transition: all 0.2s;
}

.cc-sidebar .nav-link:hover {
    background: rgba(255, 255, 255, 0.05);
    color: white !important;
}

.cc-sidebar .nav-link.active {
    background: var(--color-primary);
    color: white !important;
    box-shadow: 0 4px 12px rgba(48, 79, 254, 0.3);
}

.cc-sidebar .oi {
    width: 24px;
    font-size: 1.1rem;
    margin-right: 12px;
}

/* Tabs */
.nav-tabs {
    border-bottom: 2px solid #e2e8f0;
}

.nav-tabs .nav-link {
    border: none;
    color: var(--text-secondary);
    font-weight: 500;
    padding: 12px 24px;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
}

.nav-tabs .nav-link:hover {
    color: var(--color-primary);
    border-bottom: 2px solid #e2e8f0;
}

.nav-tabs .nav-link.active {
    color: var(--color-primary) !important;
    background: transparent !important;
    border-bottom: 2px solid var(--color-primary);
}

/* Visibility Fix for Blazor Collapse */
@media (min-width: 992px) {
    .cc-sidebar .collapse {
        display: block !important;
    }
}

/* Hide spin buttons for numeric inputs */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type=number] {
    -moz-appearance: textfield;
}

/* ============================================================
   Composants DS — Buttons
   ============================================================ */
.ds-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px; border-radius: 8px;
  font-size: 13px; font-weight: 500; border: 1px solid transparent;
  cursor: pointer; transition: all 0.15s; white-space: nowrap;
  letter-spacing: -0.005em; line-height: 1.2; font-family: inherit;
}
.ds-btn-primary { background: var(--ds-brand-600); color: white; box-shadow: 0 1px 2px rgba(40,72,204,0.2); }
.ds-btn-primary:hover { background: var(--ds-brand-700); }
.ds-btn-secondary { background: var(--ds-surface); color: var(--ds-slate-900); border-color: var(--ds-border); }
.ds-btn-secondary:hover { background: var(--ds-slate-50); border-color: var(--ds-slate-400); }
.ds-btn-ghost { background: transparent; color: var(--ds-slate-500); }
.ds-btn-ghost:hover { background: var(--ds-slate-100); color: var(--ds-slate-900); }
.ds-btn-danger { background: var(--ds-danger-50); color: var(--ds-danger-700); border-color: rgba(239,68,68,0.2); }
.ds-btn-danger:hover { background: var(--ds-danger-700); color: white; }
.ds-btn-sm { padding: 4px 8px; font-size: 12px; }
.ds-btn-icon { padding: 6px; }

/* ============================================================
   Composants DS — Typography
   ============================================================ */
.ds-h1 { font-size: 22px; font-weight: 600; letter-spacing: -0.4px; margin: 0 0 2px; }

/* ============================================================
   Composants DS — Pill / Badge
   ============================================================ */
.ds-pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 500; letter-spacing: 0.01em;
  background: var(--ds-slate-100); color: var(--ds-slate-700);
  border: 1px solid var(--ds-border);
}
.ds-pill-success { background: var(--ds-success-50); color: var(--ds-success-700); border-color: rgba(16,185,129,0.2); }
.ds-pill-warn    { background: var(--ds-warning-50); color: var(--ds-warning-700); border-color: rgba(245,158,11,0.2); }
.ds-pill-danger  { background: var(--ds-danger-50);  color: var(--ds-danger-700);  border-color: rgba(239,68,68,0.2); }
.ds-pill-info    { background: var(--ds-info-50);    color: var(--ds-info-700);    border-color: rgba(59,130,246,0.2); }
.ds-pill-brand   { background: var(--ds-brand-50);   color: var(--ds-brand-700);   border-color: var(--ds-brand-100); }

.ds-dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.ds-dot-success { background: #10b981; }
.ds-dot-warn    { background: #f59e0b; }
.ds-dot-danger  { background: #ef4444; }
.ds-dot-info    { background: #3b82f6; }
.ds-dot-muted   { background: var(--ds-slate-400); }

/* ============================================================
   Composants DS — Avatar
   ============================================================ */
.ds-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--ds-brand-100); color: var(--ds-brand-700);
  font-size: 12px; font-weight: 600; border: 1px solid var(--ds-brand-200);
  flex-shrink: 0;
}
.ds-avatar-sm { width: 24px; height: 24px; font-size: 10px; }
.ds-avatar-lg { width: 40px; height: 40px; font-size: 14px; }

/* ============================================================
   Composants DS — Icon wrapper
   ============================================================ */
.cc-icon {
  display: inline-flex; align-items: center; justify-content: center;
  vertical-align: middle; flex-shrink: 0;
}
.cc-icon svg { width: 100%; height: 100%; }

/* ============================================================
   Composants DS — Inputs
   ============================================================ */
.ds-input {
  width: 100%; padding: 7px 10px; border-radius: 8px;
  border: 1px solid var(--ds-border); background: var(--ds-surface);
  font-size: 13px; color: var(--ds-slate-900); font-family: inherit; transition: all 0.15s;
}
.ds-input:focus { outline: none; border-color: var(--ds-brand-500); box-shadow: 0 0 0 3px rgba(40,72,204,0.18); }
.ds-input::placeholder { color: var(--ds-slate-400); }
.ds-label {
  display: block; font-size: 11px; font-weight: 500;
  color: var(--ds-slate-500); text-transform: uppercase;
  letter-spacing: 0.04em; margin-bottom: 4px;
}

/* ============================================================
   Composants DS — Tabs (underlined)
   ============================================================ */
.ds-tabs {
  display: flex; gap: 4px;
  border-bottom: 1px solid var(--ds-border); padding: 0 4px;
}
.ds-tab {
  padding: 10px 14px; font-size: 13px; font-weight: 500;
  color: var(--ds-slate-500); border: none; background: none;
  cursor: pointer; border-bottom: 2px solid transparent;
  margin-bottom: -1px; transition: all 0.15s; font-family: inherit;
}
.ds-tab:hover { color: var(--ds-slate-900); }
.ds-tab.active { color: var(--ds-brand-700); border-bottom-color: var(--ds-brand-600); font-weight: 600; }

/* ============================================================
   Composants DS — List (ProjetsList variation A)
   ============================================================ */
.ds-list { background: white; border: 1px solid var(--ds-border); border-radius: 10px; overflow: hidden; }
.ds-list-header,
.ds-list-row {
  display: grid;
  grid-template-columns: 24px 1.8fr 1.2fr 1fr 0.9fr 0.7fr 40px;
  gap: 12px; padding: 10px 16px; align-items: center;
}
.ds-list-header {
  background: var(--ds-slate-50); border-bottom: 1px solid var(--ds-border);
  font-size: 11px; font-weight: 600; color: var(--ds-slate-400);
  text-transform: uppercase; letter-spacing: 0.04em;
}
.ds-list-row { padding: 14px 16px; cursor: pointer; border-bottom: 1px solid var(--ds-slate-100); }
.ds-list-row:last-child { border-bottom: none; }
.ds-list-row:hover { background: var(--ds-slate-50); }
.ds-row-name { font-size: 13px; font-weight: 500; color: var(--ds-slate-900); }
.ds-row-ref { font-family: var(--ds-font-mono); font-size: 11px; color: var(--ds-slate-400); }
.ds-tnum { font-variant-numeric: tabular-nums; font-weight: 600; font-size: 13px; }

/* ============================================================
   Composants DS — Progress bar (ProjetsList)
   ============================================================ */
.ds-progress {
  height: 4px; background: var(--ds-slate-100); border-radius: 2px; overflow: hidden; margin-top: 4px;
}
.ds-progress-fill { height: 100%; background: var(--ds-brand-500); border-radius: 2px; transition: width 0.3s; }
.ds-progress-fill.ok { background: #10b981; }

/* ============================================================
   Composants DS — Stepper (WorkflowStepper)
   ============================================================ */
.ds-stepper { display: flex; align-items: center; gap: 0; }
.ds-stepper-item {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  flex-shrink: 0;
}
.ds-stepper-bullet {
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600;
  background: var(--ds-slate-100); color: var(--ds-slate-500);
  border: 1.5px solid var(--ds-border); transition: all 0.2s;
}
.ds-stepper-label { font-size: 11px; font-weight: 500; color: var(--ds-slate-500); text-align: center; max-width: 90px; line-height: 1.2; }
.ds-stepper-line { flex: 1; height: 1.5px; background: var(--ds-border); min-width: 20px; margin: 0 4px; margin-bottom: 16px; }
.ds-stepper-line.done { background: var(--ds-brand-400); }
.ds-stepper-item.done .ds-stepper-bullet { background: var(--ds-brand-600); border-color: var(--ds-brand-600); color: white; }
.ds-stepper-item.done .ds-stepper-label { color: var(--ds-brand-700); }
.ds-stepper-item.active .ds-stepper-bullet { background: var(--ds-brand-600); border-color: var(--ds-brand-600); color: white; box-shadow: 0 0 0 4px rgba(40,72,204,0.18); }
.ds-stepper-item.active .ds-stepper-label { color: var(--ds-brand-700); font-weight: 600; }

/* ============================================================
   Composants DS — Detail layout (ProjetDetail variation B)
   ============================================================ */
.ds-detail-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 0 14px; gap: 12px;
}
.statut-clickable {
  display: inline-flex; align-items: center; cursor: pointer;
  padding: 2px 4px; margin-left: -4px; border-radius: 6px;
  transition: background 0.15s;
}
.statut-clickable:hover { background: var(--ds-slate-100); }
.ds-detail-emprunteurs { font-size: 14px; font-weight: 500; color: var(--ds-slate-700); margin-bottom: 12px; }
.ds-detail-grid {
  display: grid;
  grid-template-columns: 260px 1fr 280px;
  gap: 16px; align-items: start;
}
@media (max-width: 1200px) {
  .ds-detail-grid { grid-template-columns: 1fr; }
}
.ds-detail-rail, .ds-detail-aside { display: flex; flex-direction: column; gap: 12px; }
.ds-detail-main { display: flex; flex-direction: column; gap: 12px; }

/* ============================================================
   Navigation — cc-nav (sidebar links)
   ============================================================ */
.cc-nav { list-style: none; padding: 8px 0; margin: 0; }
.cc-nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 14px; margin: 1px 8px;
  border-radius: 6px;
  color: rgba(255,255,255,0.6);
  font-size: 13px; font-weight: 500;
  position: relative; transition: all 0.15s;
  text-decoration: none; cursor: pointer; background: none; border: none; width: calc(100% - 16px); text-align: left;
  font-family: inherit;
}
.cc-nav-link:hover { background: rgba(255,255,255,0.05); color: white; text-decoration: none; }
.cc-nav-link.active { background: rgba(255,255,255,0.08); color: white; }
.cc-nav-link.active::before {
  content: ""; position: absolute; left: -8px;
  top: 8px; bottom: 8px; width: 3px;
  background: var(--ds-brand-400); border-radius: 0 2px 2px 0;
}
.cc-nav-badge {
  margin-left: auto; background: var(--ds-brand-500); color: white;
  font-size: 10px; font-weight: 600; padding: 1px 6px;
  border-radius: 10px; min-width: 18px; text-align: center;
}
.cc-nav-section {
  padding: 12px 22px 4px; font-size: 10px; font-weight: 700;
  color: rgba(255,255,255,0.3); text-transform: uppercase; letter-spacing: 0.08em;
}
.cc-brand-name { font-size: 14px; font-weight: 600; color: white; line-height: 1.2; }
.cc-brand-tag  { font-size: 11px; color: rgba(255,255,255,0.45); font-weight: 400; }
.cc-brand-tile { width: 36px; height: 36px; border-radius: 8px; overflow: hidden; display: flex; align-items: center; justify-content: center; }
.cc-brand-tile img { width: 100%; height: 100%; object-fit: contain; }

/* ============================================================
   Bootstrap 4 overrides — align with new design tokens
   ============================================================ */
.btn-primary { background: var(--ds-brand-600); border-color: var(--ds-brand-600); }
.btn-primary:hover, .btn-primary:focus { background: var(--ds-brand-700); border-color: var(--ds-brand-700); }
.btn-outline-primary { color: var(--ds-brand-600); border-color: var(--ds-brand-600); }
.btn-outline-primary:hover { background: var(--ds-brand-600); border-color: var(--ds-brand-600); }
.badge-primary { background: var(--ds-brand-600); }
.form-control {
  border-color: var(--ds-border); font-size: 13px;
  border-radius: 7px; padding: 7px 10px;
}
.form-control:focus {
  border-color: var(--ds-brand-500);
  box-shadow: 0 0 0 3px rgba(40,72,204,0.18);
}

/* Premium Accordion Styling */
.cc-accordion {
    background: var(--bg-surface);
    border: 1px solid #edf2f7;
    border-radius: var(--border-radius-lg) !important;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
    margin-bottom: 12px;
    transition: all 0.2s ease;
}

.cc-accordion:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    border-color: #e2e8f0;
}

.cc-accordion-header {
    margin: 0;
    padding: 0;
    background: #fcfdfe;
}

.cc-accordion-button {
    width: 100%;
    padding: 14px 20px !important;
    background: transparent !important;
    border: none !important;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    font-size: 0.875rem !important; /* Smaller font as requested */
    font-weight: 600;
    color: var(--text-primary);
    text-align: left;
    transition: background 0.2s;
}

.cc-accordion-button:hover {
    background: rgba(48, 79, 254, 0.02) !important;
}

.cc-accordion-button:not(.collapsed) {
    color: var(--color-primary);
    background: rgba(48, 79, 254, 0.03) !important;
    border-bottom: 1px solid #edf2f7 !important;
}

.cc-accordion-content {
    padding: 20px;
    background: white;
}