:root {
    --spg-bg-page: #f7f6f4;
    --spg-text-main: #1e293b;
    --spg-text-muted: #64748b;
    --spg-card-bg: #ffffff;
    --spg-card-border: #e2e8f0;
    --spg-btn-bg: #f59e0b;
    --spg-btn-hover: #d97706;
    --spg-btn-active: #b45309;
    --spg-btn-text: #0f172a;
    --spg-focus-ring: rgba(245, 158, 11, 0.25);
    --spg-input-border: #cbd5e1;
    --spg-input-border-focus: #f59e0b;
}

body {
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--spg-text-main);
    background-color: var(--spg-bg-page);
    min-height: 100vh;
    margin: 0;
    overflow-x: hidden;
}

/* ==========================================================================
   Page de connexion (isolée)
   ========================================================================== */
.login-page {
    background-color: var(--spg-bg-page);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem 1rem;
}

.login-card {
    width: 100%;
    max-width: 510px;
    background-color: var(--spg-card-bg);
    border: 1px solid var(--spg-card-border);
    border-radius: 1rem;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 4px 10px -3px rgba(0, 0, 0, 0.02);
    overflow: hidden;
}

.login-card-header {
    background-color: #ffffff;
    padding: 1.75rem 2rem 0.875rem 2rem;
    text-align: center;
}

.login-logos-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.125rem;
    padding: 0;
}

.login-logo-container {
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

.login-logo-spg-container {
    width: 105px;
    height: 38px;
    flex-shrink: 0;
}

.login-logo-spg {
    width: 126px;
    max-width: none;
    height: auto;
    display: block;
    flex-shrink: 0;
    transform: translateY(1px);
}

.login-logo-pneu-container {
    width: 180px;
    height: 38px;
    flex-shrink: 0;
}

.login-logo-pneu {
    width: 211px;
    max-width: none;
    height: auto;
    display: block;
    flex-shrink: 0;
    transform: translateY(-0.5px);
}

.login-logos-divider {
    width: 1px;
    height: 28px;
    background-color: #e2e8f0;
    flex-shrink: 0;
}

.login-titles {
    margin-top: 1rem;
}

.login-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--spg-text-main);
    letter-spacing: -0.015em;
    margin-bottom: 0.35rem;
    line-height: 1.25;
}

.login-subtitle {
    font-size: 0.9rem;
    color: var(--spg-text-muted);
    margin-bottom: 0;
    line-height: 1.45;
}

.login-card-body {
    padding: 1.25rem 2rem 2rem 2rem;
}

.login-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: #334155;
    margin-bottom: 0.375rem;
    display: block;
}

.login-input {
    font-size: 0.95rem;
    border-radius: 0.5rem;
    border: 1px solid var(--spg-input-border);
    padding: 0.625rem 0.875rem;
    color: var(--spg-text-main);
    background-color: #ffffff;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.login-input:focus {
    border-color: var(--spg-input-border-focus);
    box-shadow: 0 0 0 0.2rem var(--spg-focus-ring);
    outline: 0;
}

/* Password group toggle button */
.login-password-group {
    position: relative;
    display: flex;
    align-items: stretch;
    width: 100%;
}

.login-password-input {
    border-top-right-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
    border-right: 0;
}

.login-toggle-btn {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    border-top-right-radius: 0.5rem;
    border-bottom-right-radius: 0.5rem;
    border: 1px solid var(--spg-input-border);
    border-left: 0;
    background-color: #ffffff;
    color: #64748b;
    padding: 0 0.875rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
}

.login-toggle-btn:hover {
    color: #1e293b;
    background-color: #f8fafc;
}

.login-password-group:focus-within .login-password-input,
.login-password-group:focus-within .login-toggle-btn {
    border-color: var(--spg-input-border-focus);
}

.login-toggle-btn:focus-visible {
    outline: 2px solid var(--spg-btn-bg);
    outline-offset: 1px;
    z-index: 3;
}

/* Submit Button */
.login-btn-primary {
    background-color: var(--spg-btn-bg);
    border: 1px solid #d97706;
    color: var(--spg-btn-text);
    font-weight: 600;
    font-size: 1rem;
    padding: 0.675rem 1.25rem;
    border-radius: 0.5rem;
    width: 100%;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.08);
    transition: background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.login-btn-primary:hover {
    background-color: var(--spg-btn-hover);
    border-color: var(--spg-btn-active);
    color: #000000;
}

.login-btn-primary:active {
    background-color: var(--spg-btn-active);
    border-color: #92400e;
    color: #ffffff;
}

.login-btn-primary:focus-visible {
    outline: 0;
    box-shadow: 0 0 0 0.25rem var(--spg-focus-ring);
}

/* Error Alert */
.login-alert {
    border-radius: 0.5rem;
    font-size: 0.9rem;
    padding: 0.75rem 1rem;
    margin-bottom: 1.25rem;
    border: 1px solid #fecaca;
    background-color: #fef2f2;
    color: #991b1b;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

/* Footer note */
.login-footer-note {
    font-size: 0.8125rem;
    color: var(--spg-text-muted);
    text-align: center;
    margin-top: 1.5rem;
    margin-bottom: 0;
}

@media (max-width: 480px) {
    .login-card-header {
        padding: 1.5rem 1.25rem 0.75rem 1.25rem;
    }
    .login-card-body {
        padding: 1rem 1.25rem 1.5rem 1.25rem;
    }
    .login-logos-wrapper {
        gap: 0.875rem;
    }
    .login-logo-spg-container {
        width: 95px;
        height: 34px;
    }
    .login-logo-spg {
        width: 114px;
    }
    .login-logo-pneu-container {
        width: 158px;
        height: 34px;
    }
    .login-logo-pneu {
        width: 185px;
    }
    .login-logos-divider {
        height: 24px;
    }
    .login-title {
        font-size: 1.2rem;
    }
}

/* ==========================================================================
   Espace Authentifié & Layout Tableau de bord
   ========================================================================== */

.app-layout {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: var(--spg-bg-page);
}

@media (min-width: 992px) {
    .app-layout {
        flex-direction: row;
    }
}

/* --- Brand Logos Header (Sidebar & Mobile) --- */
.app-brand-logos {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
}

.brand-logo-spg-wrap {
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: visible;
}

.brand-logo-spg {
    max-height: 48px;
    max-width: 110px;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
}

.brand-logos-divider {
    width: 1px;
    height: 36px;
    background-color: var(--spg-card-border);
    flex-shrink: 0;
}

.brand-logo-pneu-wrap {
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: visible;
}

.brand-logo-pneu {
    max-height: 52px;
    max-width: 140px;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
}

/* --- Sidebar Desktop (~240px) --- */
.app-sidebar {
    width: 240px;
    min-width: 240px;
    max-width: 240px;
    height: 100vh;
    position: sticky;
    top: 0;
    background-color: #ffffff;
    border-right: 1px solid var(--spg-card-border);
    display: flex;
    flex-direction: column;
    z-index: 1020;
}

.app-sidebar-header {
    padding: 1.25rem 1rem;
    border-bottom: 1px solid var(--spg-card-border);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: visible;
}

.app-sidebar-nav {
    flex: 1 1 auto;
    padding: 1rem 0.75rem;
    overflow-y: auto;
}

.app-nav-list {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.app-nav-item {
    width: 100%;
}

.app-nav-link {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.625rem 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--spg-text-main);
    text-decoration: none;
    transition: all 0.15s ease-in-out;
    border: 1px solid transparent;
}

.app-nav-link.active {
    background-color: #fffbeb;
    color: #92400e;
    font-weight: 600;
    border-color: #fde68a;
}

.app-nav-link.active .app-nav-icon {
    color: #d97706;
}

.app-nav-link.is-disabled {
    color: #94a3b8;
    cursor: not-allowed;
    user-select: none;
    opacity: 0.85;
}

.app-nav-link.is-disabled .app-nav-icon {
    color: #cbd5e1;
}

.app-nav-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    flex-shrink: 0;
}

.app-nav-text {
    flex-grow: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.badge-soon {
    font-size: 0.6875rem;
    font-weight: 600;
    padding: 0.2rem 0.45rem;
    background-color: #f1f5f9;
    color: #64748b;
    border-radius: 9999px;
    letter-spacing: 0.02em;
    border: 1px solid #e2e8f0;
}

/* Sidebar Footer & User Profile */
.app-sidebar-footer {
    padding: 0.875rem 0.75rem;
    border-top: 1px solid var(--spg-card-border);
    background-color: #fafaf9;
    margin-top: auto;
}

.user-profile-card {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    margin-bottom: 0.75rem;
}

.user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background-color: #1e293b;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.775rem;
    flex-shrink: 0;
}

.user-details {
    overflow: hidden;
    flex-grow: 1;
}

.user-name {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--spg-text-main);
    line-height: 1.25;
}

.user-role-line {
    margin-top: 0.2rem;
}

.badge-role-pneu {
    background-color: #fef3c7;
    color: #92400e;
    font-size: 0.6875rem;
    font-weight: 600;
    padding: 0.175rem 0.45rem;
    border-radius: 0.375rem;
    border: 1px solid #fde68a;
    display: inline-block;
}

.badge-role-achat {
    background-color: #e0f2fe;
    color: #075985;
    font-size: 0.6875rem;
    font-weight: 600;
    padding: 0.175rem 0.45rem;
    border-radius: 0.375rem;
    border: 1px solid #bae6fd;
    display: inline-block;
}

.btn-sidebar-logout {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 0.45rem 0.625rem;
    border-radius: 0.375rem;
    font-size: 0.8125rem;
    color: #dc2626;
    text-decoration: none;
    background-color: #ffffff;
    border: 1px solid #fee2e2;
    font-weight: 500;
    transition: all 0.15s ease-in-out;
}

.btn-sidebar-logout:hover {
    background-color: #fef2f2;
    color: #b91c1c;
    border-color: #fca5a5;
}

.btn-sidebar-logout:focus-visible {
    outline: 2px solid #dc2626;
    outline-offset: 1px;
}

/* --- Mobile Topbar (< 992px) --- */
.app-mobile-bar {
    min-height: 64px;
    height: auto;
    background-color: #ffffff;
    border-bottom: 1px solid var(--spg-card-border);
    padding: 0.5rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 1030;
    gap: 0.5rem;
}

.app-mobile-brand {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    justify-content: center;
    overflow: visible;
}

.app-mobile-toggle {
    padding: 0.375rem;
    border-radius: 0.375rem;
    border: 1px solid var(--spg-card-border);
    background-color: #ffffff;
    color: var(--spg-text-main);
    display: flex;
    align-items: center;
    justify-content: center;
}

.app-mobile-toggle:focus-visible {
    outline: 2px solid var(--spg-btn-bg);
}

.app-offcanvas-sidebar {
    width: 280px;
    max-width: 85vw;
}

/* --- Main Layout Wrapper & Desktop Header --- */
.app-main-wrapper {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.app-header {
    height: 60px;
    background-color: #ffffff;
    border-bottom: 1px solid var(--spg-card-border);
    padding: 0 1.75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 1010;
}

.app-header-badge-space {
    font-size: 0.775rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--spg-text-muted);
}

.app-header-right {
    display: flex;
    align-items: center;
}

.app-header-user {
    display: flex;
    align-items: center;
    font-size: 0.875rem;
    color: var(--spg-text-main);
}

.app-header-divider {
    width: 1px;
    height: 20px;
    background-color: var(--spg-card-border);
    margin: 0 1.25rem;
}

.app-header-logout {
    display: flex;
    align-items: center;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--spg-text-muted);
    text-decoration: none;
    padding: 0.375rem 0.625rem;
    border-radius: 0.375rem;
    transition: all 0.15s ease-in-out;
}

.app-header-logout:hover {
    color: #dc2626;
    background-color: #fef2f2;
}

.app-header-logout:focus-visible {
    outline: 2px solid #dc2626;
    outline-offset: 1px;
}

/* --- Main Content Area --- */
.app-main {
    flex: 1 1 auto;
    padding: 1.25rem 1rem;
}

@media (min-width: 768px) {
    .app-main {
        padding: 1.75rem 1.5rem;
    }
}

@media (min-width: 1200px) {
    .app-main {
        padding: 2rem 2.25rem;
    }
}

.app-content-container {
    max-width: 1320px;
    margin: 0 auto;
    padding: 0;
}

.dash-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* --- Dashboard Page Header --- */
.dash-page-header {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

@media (min-width: 576px) {
    .dash-page-header {
        flex-direction: row;
        align-items: flex-start;
        justify-content: space-between;
    }
}

.dash-page-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--spg-text-main);
    letter-spacing: -0.02em;
    margin-bottom: 0.25rem;
    line-height: 1.25;
}

.dash-page-subtitle {
    font-size: 0.925rem;
    color: var(--spg-text-muted);
    margin-bottom: 0;
}

.action-btn-wrapper {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
}

@media (min-width: 576px) {
    .action-btn-wrapper {
        align-items: flex-end;
    }
}

.btn-spg-primary {
    background-color: var(--spg-btn-bg);
    border: 1px solid #d97706;
    color: var(--spg-btn-text);
    font-weight: 600;
    font-size: 0.9375rem;
    padding: 0.55rem 1.15rem;
    border-radius: 0.5rem;
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
    transition: all 0.15s ease-in-out;
}

.btn-spg-primary:hover {
    background-color: var(--spg-btn-hover);
    border-color: var(--spg-btn-active);
    color: #000000;
}

.btn-spg-primary:active {
    background-color: var(--spg-btn-active);
    border-color: #92400e;
    color: #ffffff;
}

.btn-spg-primary:disabled,
.btn-spg-primary.disabled {
    opacity: 0.7;
    cursor: not-allowed;
    background-color: #fde68a;
    border-color: #f59e0b;
    color: #78350f;
    box-shadow: none;
}

.btn-spg-primary:focus-visible {
    outline: 0;
    box-shadow: 0 0 0 0.25rem var(--spg-focus-ring);
}

.action-btn-hint {
    font-size: 0.775rem;
    color: var(--spg-text-muted);
    font-style: italic;
}

/* --- KPI Cards Grid --- */
.dash-kpi-card {
    background-color: #ffffff;
    border: 1px solid var(--spg-card-border);
    border-radius: 0.75rem;
    padding: 1.125rem 1.25rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
    display: flex;
    flex-direction: column;
    height: 100%;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.dash-kpi-card:hover {
    border-color: #cbd5e1;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.04);
}

.dash-kpi-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.dash-kpi-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #475569;
    line-height: 1.35;
}

.dash-kpi-icon-pill {
    width: 32px;
    height: 32px;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.icon-pill-pending {
    background-color: #eff6ff;
    color: #2563eb;
}

.icon-pill-ordered {
    background-color: #f5f3ff;
    color: #7c3aed;
}

.icon-pill-recall {
    background-color: #fff7ed;
    color: #ea580c;
}

.icon-pill-sales {
    background-color: #f0fdf4;
    color: #16a34a;
}

.dash-kpi-value {
    font-size: 2.25rem;
    font-weight: 700;
    color: var(--spg-text-main);
    line-height: 1;
    margin-bottom: 0.75rem;
    letter-spacing: -0.02em;
}

.dash-kpi-footer {
    margin-top: auto;
    padding-top: 0.5rem;
    border-top: 1px solid #f1f5f9;
}

.dash-kpi-footnote {
    font-size: 0.75rem;
    color: #94a3b8;
    line-height: 1.25;
    display: block;
}

.dash-kpi-global-note {
    font-size: 0.8125rem;
    color: var(--spg-text-muted);
    margin-top: 0.875rem;
    margin-bottom: 0;
    display: flex;
    align-items: center;
}

.pilotage-commercial-form {
    min-width: 0;
}

.pilotage-commercial-form .form-select,
.pilotage-commercial-form .form-control {
    min-width: 0;
}

/* --- Work Zones Cards --- */
.dash-card {
    background-color: #ffffff;
    border: 1px solid var(--spg-card-border);
    border-radius: 0.75rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
    overflow: hidden;
}

.dash-card-priority {
    border-left: 4px solid #f59e0b;
}

.dash-card-header {
    padding: 1.125rem 1.25rem;
    border-bottom: 1px solid var(--spg-card-border);
    background-color: #ffffff;
}

.dash-card-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--spg-text-main);
    letter-spacing: -0.01em;
}

.dash-card-subtitle {
    font-size: 0.8125rem;
    color: var(--spg-text-muted);
    margin-top: 0.15rem;
}

.dash-section-icon-badge {
    width: 32px;
    height: 32px;
    border-radius: 0.375rem;
    background-color: #fffbeb;
    color: #d97706;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.dash-card-body {
    padding: 1.25rem;
}

/* --- Empty States --- */
.dash-empty-state {
    text-align: center;
    padding: 2rem 1.25rem;
    max-width: 520px;
    margin: 0 auto;
}

.empty-state-icon {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background-color: #f8fafc;
    color: #94a3b8;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    border: 1px dashed #cbd5e1;
}

.empty-state-icon-table {
    width: 44px;
    height: 44px;
    margin-bottom: 0.75rem;
}

.empty-state-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--spg-text-main);
    margin-bottom: 0.35rem;
}

.empty-state-text {
    font-size: 0.85rem;
    color: var(--spg-text-muted);
    line-height: 1.5;
    margin-bottom: 0;
}

/* --- Responsive Table --- */
.dash-table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 0 0 0.75rem 0.75rem;
}

.dimension-column {
    width: 140px;
    min-width: 140px;
}

.dimension-value {
    display: block;
    white-space: nowrap;
    font-weight: 600;
}

.dimension-type {
    display: block;
    margin-top: 0.25rem;
    white-space: nowrap;
}

.dash-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    min-width: 600px;
}

.dash-table thead th {
    background-color: #f8fafc;
    color: #475569;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.75rem 1.25rem;
    border-bottom: 1px solid var(--spg-card-border);
    white-space: nowrap;
}

.dash-table tbody td {
    padding: 1rem 1.25rem;
    font-size: 0.875rem;
    color: var(--spg-text-main);
    border-bottom: 1px solid #f1f5f9;
}

/* ==========================================================================
   Formulaires & Pages de saisie
   ========================================================================== */

.form-page-container {
    max-width: 920px;
    margin: 0 auto;
}

.form-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: #334155;
    margin-bottom: 0.375rem;
    display: block;
}

.required-label::after {
    content: ' *';
    color: #dc2626;
    font-weight: 700;
}

.form-input {
    font-size: 0.95rem;
    border-radius: 0.5rem;
    border: 1px solid var(--spg-input-border);
    padding: 0.55rem 0.85rem;
    color: var(--spg-text-main);
    background-color: #ffffff;
    width: 100%;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-input:focus {
    border-color: var(--spg-input-border-focus);
    box-shadow: 0 0 0 0.2rem var(--spg-focus-ring);
    outline: 0;
}

.form-input.is-invalid {
    border-color: #ef4444;
    box-shadow: 0 0 0 0.2rem rgba(239, 68, 68, 0.15);
}

.form-text {
    font-size: 0.775rem;
    color: var(--spg-text-muted);
    margin-top: 0.25rem;
}

.invalid-feedback {
    display: block;
    font-size: 0.8125rem;
    color: #dc2626;
    margin-top: 0.35rem;
}

/* Form error lists styling */
ul:has(> li.invalid-feedback) {
    list-style: none;
    padding-left: 0;
    margin-bottom: 0;
}

/* --- Badges personnalisés --- */
.badge-status-new {
    background-color: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.25rem 0.55rem;
    border-radius: 0.375rem;
    display: inline-block;
}

.badge-status-contacted {
    background-color: #ecfdf5;
    color: #047857;
    border: 1px solid #a7f3d0;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.25rem 0.55rem;
    border-radius: 0.375rem;
    display: inline-block;
}

.badge-status-followup {
    background-color: #fff7ed;
    color: #c2410c;
    border: 1px solid #fed7aa;
}

.badge-status-unreachable {
    background-color: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

.badge-status-sale {
    background-color: #ecfdf5;
    color: #047857;
    border: 1px solid #a7f3d0;
}

.badge-status-lost {
    background-color: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

.badge-statut {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    max-width: 100%;
    padding: 0.3rem 0.55rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    border: 1px solid transparent;
}

.badge-statut-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 0.875rem;
    height: 0.875rem;
    min-width: 0.875rem;
    flex: 0 0 0.875rem;
}

.badge-statut-icon > svg {
    display: block;
    width: 100%;
    height: 100%;
    max-width: 0.875rem;
    max-height: 0.875rem;
}

.badge-statut-label {
    display: inline-block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

.badge-status-new { background: #eff6ff; color: #1e3a8a; border-color: #93c5fd; }
.badge-status-viewed { background: #f1f5f9; color: #334155; border-color: #cbd5e1; }
.badge-status-purchase-planned { background: #ffedd5; color: #9a3412; border-color: #fdba74; }
.badge-status-ordered { background: #f3e8ff; color: #6b21a8; border-color: #d8b4fe; }
.badge-status-purchase-declined { background: #fff1f2; color: #9f1239; border-color: #fda4af; }
.badge-status-ready { background: #ccfbf1; color: #115e59; border-color: #5eead4; }
.badge-status-contacted { background: #cffafe; color: #155e75; border-color: #67e8f9; }
.badge-status-unreachable { background: #fee2e2; color: #991b1b; border-color: #fca5a5; }
.badge-status-followup { background: #fef3c7; color: #78350f; border-color: #fcd34d; }
.badge-status-sale { background: #dcfce7; color: #14532d; border-color: #86efac; }
.badge-status-lost { background: #fecaca; color: #7f1d1d; border-color: #f87171; }

.commercial-closure {
    border: 1px solid #fed7aa;
    border-left: 4px solid #d97706;
    border-radius: 0.75rem;
    background: #fffdf7;
    padding: 1.25rem;
}

.commercial-closure-header h2 {
    color: var(--spg-text-main);
    font-size: 1.1rem;
    margin-bottom: 0.25rem;
}

.commercial-closure-header p {
    color: var(--spg-text-muted);
    margin-bottom: 1rem;
}

.closure-choices {
    border: 0;
    padding: 0;
    margin: 0 0 1rem;
}

.closure-choices > legend {
    float: none;
    width: 100%;
}

.closure-choice {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    min-height: 74px;
    padding: 0.9rem 1rem;
    margin-bottom: 0.6rem;
    border: 1px solid var(--spg-card-border);
    border-radius: 0.6rem;
    background: #ffffff;
    cursor: pointer;
}

.closure-choice-sale { border-left: 4px solid #10b981; }
.closure-choice-lost { border-left: 4px solid #ef4444; }

.closure-choice:has(input:checked) {
    box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.16);
    background: #fffbeb;
}

.closure-choice:has(input:focus-visible) {
    outline: 2px solid var(--spg-btn-bg);
    outline-offset: 2px;
}

.closure-choice input {
    margin-top: 0.25rem;
}

.closure-choice span {
    display: grid;
    gap: 0.25rem;
}

.closure-choice small,
.closure-motif > small {
    color: var(--spg-text-muted);
}

.closure-motif {
    max-width: 680px;
}

.closure-actions {
    margin-top: 1rem;
}

@media (max-width: 575.98px) {
    .commercial-closure {
        padding: 1rem;
    }

    .closure-actions .btn {
        width: 100%;
        min-height: 42px;
    }
}

.badge-warranty {
    background-color: #fff4d6;
    color: #7a4b00;
    border: 1px solid #f2c66d;
    font-size: 0.6875rem;
    font-weight: 700;
    padding: 0.15rem 0.4rem;
    border-radius: 0.375rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    display: inline-block;
}

/* ==========================================================================
   Filtres et Recherche (Demandes)
   ========================================================================== */

.filter-form {
    width: 100%;
    min-width: 0;
}

.historique-filter-grid {
    display: grid;
    grid-template-columns: minmax(0, 2.2fr) minmax(160px, 1fr) minmax(160px, 1fr) minmax(160px, 1fr) minmax(220px, auto);
    gap: 1rem;
    align-items: end;
    width: 100%;
    min-width: 0;
}

.historique-filter-field,
.historique-filter-actions {
    min-width: 0;
}

.historique-filter-field .form-control,
.historique-filter-field .form-select {
    width: 100%;
    min-width: 0;
}

.historique-filter-actions {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    gap: 0.5rem;
    min-width: 0;
    width: 100%;
}

.historique-filter-actions .btn {
    width: 100%;
    min-width: 0;
    white-space: nowrap;
}

.filter-label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: #475569;
    margin-bottom: 0.25rem;
}

@media (max-width: 1199.98px) {
    .historique-filter-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .historique-filter-search {
        grid-column: 1 / -1;
    }

    .historique-filter-actions {
        grid-column: 1 / -1;
        min-width: 0;
    }
}

@media (max-width: 767.98px) {
    .historique-filter-grid {
        grid-template-columns: 1fr;
    }

    .historique-filter-actions {
        display: flex;
        flex-direction: column;
        width: 100%;
    }
}

@media (max-width: 575.98px) {
    .historique-filter-grid {
        grid-template-columns: 1fr;
    }

    .historique-filter-actions {
        display: grid;
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }

    .historique-filter-actions .btn {
        width: 100%;
        flex-basis: auto;
    }
}

.filter-btn-submit {
    font-weight: 500;
    padding: 0.55rem 1rem;
    border-radius: 0.5rem;
}

.filter-btn-reset {
    padding: 0.55rem 0.75rem;
    border-radius: 0.5rem;
    color: #64748b;
    border-color: var(--spg-card-border);
}

.recall-table {
    min-width: 1080px;
}

.recall-table th:last-child,
.recall-table td:last-child {
    min-width: 245px;
}

.recall-actions {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.4rem;
    min-width: 220px;
}

.recall-actions .btn {
    white-space: normal;
    text-align: center;
}

.call-result-choices {
    border: 0;
    padding: 0;
    margin: 0 0 1.25rem;
}

.call-result-choices > legend {
    float: none;
    width: 100%;
    margin-bottom: 0.65rem;
}

.call-result-choice {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    width: 100%;
    padding: 0.9rem 1rem;
    margin-bottom: 0.6rem;
    border: 1px solid var(--spg-card-border);
    border-radius: 0.6rem;
    background: #ffffff;
    cursor: pointer;
    transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

.call-result-choice:hover {
    border-color: #f59e0b;
    background: #fffdf7;
}

.call-result-choice:has(input:checked) {
    border-color: #d97706;
    background: #fffbeb;
    box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.14);
}

.call-result-choice:has(input:focus-visible) {
    outline: 2px solid var(--spg-btn-bg);
    outline-offset: 2px;
}

.call-result-choice input {
    flex: 0 0 auto;
    margin-top: 0.22rem;
}

.call-result-choice-content {
    display: grid;
    gap: 0.2rem;
    line-height: 1.35;
}

.call-result-choice-content strong {
    color: var(--spg-text-main);
}

.call-result-choice-content span {
    color: var(--spg-text-muted);
    font-size: 0.85rem;
}

.call-field-hint {
    color: var(--spg-text-muted);
    font-size: 0.8rem;
    margin: -0.35rem 0 1rem;
}

.call-form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    margin-top: 1.25rem;
}

.call-form-actions .btn {
    min-height: 42px;
}

.call-form-actions .btn-primary {
    min-width: 190px;
}

.confirmation-panel,
.table-responsive {
    max-width: 100%;
}

.table-responsive {
    overflow-x: auto;
    overflow-y: visible;
}

.table-responsive table {
    white-space: normal;
}

.show-page-container .table th,
.show-page-container .table td {
    vertical-align: top;
}

.show-page-container .table td:last-child {
    white-space: normal;
    overflow-wrap: anywhere;
}

.history-note {
    min-width: 180px;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.decisions-filter-actions {
    min-width: 205px;
}

.decisions-filter-actions .btn {
    white-space: nowrap;
}

.dash-card-priority .recall-actions {
    min-width: 215px;
}

@media (max-width: 575.98px) {
    .dash-page-title {
        overflow-wrap: anywhere;
    }

    .recall-table {
        min-width: 1080px;
    }

    .recall-actions {
        min-width: 220px;
    }

    .call-form-actions {
        flex-direction: column-reverse;
    }

    .call-form-actions .btn,
    .call-form-actions .btn-primary {
        width: 100%;
        min-width: 0;
    }

    .call-result-choice {
        padding: 0.85rem;
    }
}

.filter-btn-reset:hover {
    background-color: #f1f5f9;
    color: var(--spg-text-main);
    border-color: #cbd5e1;
}

/* --- Bouton Consulter dans les tableaux --- */
.btn-consult {
    font-size: 0.8125rem;
    padding: 0.3rem 0.65rem;
    border-radius: 0.375rem;
    color: #475569;
    border-color: var(--spg-card-border);
    background-color: #ffffff;
    transition: all 0.15s ease-in-out;
    white-space: nowrap;
}

.btn-consult:hover {
    background-color: var(--spg-primary);
    color: #ffffff;
    border-color: var(--spg-primary);
}

/* ==========================================================================
   Pagination
   ========================================================================== */

.pagination-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--spg-card-border);
    background-color: #ffffff;
    border-radius: 0 0 0.75rem 0.75rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.pagination {
    gap: 0.25rem;
}

.pagination .page-item .page-link {
    font-size: 0.875rem;
    font-weight: 500;
    color: #475569;
    border: 1px solid var(--spg-card-border);
    border-radius: 0.375rem;
    padding: 0.375rem 0.75rem;
    background-color: #ffffff;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
}

.pagination .page-item .page-link:hover {
    background-color: #f1f5f9;
    color: var(--spg-text-main);
    border-color: #cbd5e1;
}

.pagination .page-item.active .page-link {
    background-color: var(--spg-primary);
    color: #ffffff;
    border-color: var(--spg-primary);
    font-weight: 600;
}

.pagination .page-item.disabled .page-link {
    color: #94a3b8;
    background-color: #f8fafc;
    border-color: var(--spg-card-border);
}

/* ==========================================================================
   Fiche détaillée (Demande Show)
   ========================================================================== */

.show-page-container {
    max-width: 1040px;
    margin: 0 auto;
}

.detail-grid {
    display: grid;
    gap: 1rem;
    margin-bottom: 0;
}

.detail-row {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #f8fafc;
}

.detail-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

@media (min-width: 576px) {
    .detail-row {
        flex-direction: row;
        align-items: baseline;
        justify-content: space-between;
    }
}

.detail-label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: #64748b;
    margin-bottom: 0;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.detail-value {
    font-size: 0.95rem;
    color: var(--spg-text-main);
    margin-bottom: 0;
    font-weight: 500;
}

.detail-dimension {
    color: var(--spg-primary);
    font-size: 1.05rem;
}

.detail-non-renseigne {
    color: #94a3b8;
    font-style: italic;
    font-weight: 400;
    font-size: 0.875rem;
}

.detail-comment {
    font-size: 0.925rem;
    line-height: 1.6;
    color: #334155;
    background-color: #f8fafc;
    border: 1px solid var(--spg-card-border);
    border-radius: 0.5rem;
    padding: 1rem 1.25rem;
    white-space: pre-wrap;
    word-break: break-word;
}

.form-input:focus-visible,
.form-select:focus-visible,
.btn:focus-visible,
.page-link:focus-visible {
    outline: 2px solid var(--spg-btn-bg);
    outline-offset: 2px;
}

.app-nav-link:focus-visible {
    outline: 2px solid var(--spg-btn-bg);
    outline-offset: 2px;
}
