/* ================================================================
   COREPORTAL — Thème client
   Inspiré de dolifactory.com + référence SharePoint Design System
   ================================================================ */

/* ── Variables CSS ── */
:root {
    --hp-primary: #0042E0;
    --hp-primary-dark: #0035B5;
    --hp-primary-light: #4D7FFF;
    --hp-dark: #1a1a2e;
    --hp-dark-2: #16213e;
    --hp-accent: #00c9a7;
    --hp-accent-light: #00e6be;
    --hp-white: #ffffff;
    --hp-gray-50: #f8f9fc;
    --hp-gray-100: #f0f2f7;
    --hp-gray-200: #e2e6ef;
    --hp-gray-300: #c9cfdd;
    --hp-gray-400: #9aa3b8;
    --hp-gray-500: #6b7894;
    --hp-gray-600: #4a5568;
    --hp-gray-700: #2d3748;
    --hp-gray-800: #1a202c;
    --hp-success: #10b981;
    --hp-warning: #f59e0b;
    --hp-danger: #ef4444;
    --hp-info: #3b82f6;
    --hp-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --hp-font-mono: 'JetBrains Mono', 'Fira Code', monospace;
    --hp-radius-sm: 6px;
    --hp-radius: 10px;
    --hp-radius-lg: 16px;
    --hp-radius-xl: 20px;
    --hp-shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --hp-shadow: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -1px rgba(0,0,0,0.04);
    --hp-shadow-md: 0 10px 25px -3px rgba(0,0,0,0.08), 0 4px 6px -2px rgba(0,0,0,0.04);
    --hp-shadow-lg: 0 20px 40px -4px rgba(0,0,0,0.1);
    --hp-transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Reset & Base ── */
* { box-sizing: border-box; }

body.dolifactory-portal {
    font-family: var(--hp-font);
    background-color: var(--hp-gray-50);
    color: var(--hp-gray-700);
    line-height: 1.6;
    margin: 0;
    padding: 0;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--hp-primary); text-decoration: none; transition: var(--hp-transition); }
a:hover { color: var(--hp-primary-dark); }

/* Force colors sur les liens-boutons et boutons */
a.hp-btn, a.hp-btn:visited { text-decoration: none; }
a.hp-btn-primary, a.hp-btn-primary:visited, a.hp-btn-primary:hover { color: #fff !important; }
a.hp-btn-outline, a.hp-btn-outline:visited { color: var(--hp-gray-700) !important; }
a.hp-btn-outline:hover { color: var(--hp-primary) !important; }
a.hp-btn-success, a.hp-btn-success:visited, a.hp-btn-success:hover { color: #fff !important; }
a.hp-btn-danger, a.hp-btn-danger:visited, a.hp-btn-danger:hover { color: #fff !important; }

/* ── Navbar ── */
.hp-navbar {
    background: var(--hp-white);
    border-bottom: 1px solid var(--hp-gray-200);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: var(--hp-shadow-sm);
}

.hp-navbar-inner {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    height: 64px;
}

.hp-navbar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--hp-dark);
}

.hp-navbar-brand img {
    height: 36px;
    width: auto;
}

.hp-navbar-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.hp-nav-item a {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: var(--hp-radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--hp-gray-600);
    transition: var(--hp-transition);
    white-space: nowrap;
}

.hp-nav-item a:hover,
.hp-nav-item.active a {
    background: var(--hp-primary) !important;
    color: #ffffff !important;
}

.hp-nav-item a i { font-size: 0.95rem; }

.hp-navbar-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.hp-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--hp-primary), var(--hp-primary-light));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.85rem;
}

.hp-user-name {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--hp-gray-700);
}

.hp-user-company {
    font-size: 0.75rem;
    color: var(--hp-gray-400);
}

/* ── Mobile menu ── */
.hp-menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--hp-gray-700);
    cursor: pointer;
    padding: 8px;
}

@media (max-width: 1024px) {
    .hp-menu-toggle { display: block; }
    .hp-navbar-nav {
        display: none;
        position: absolute;
        top: 64px;
        left: 0;
        right: 0;
        background: var(--hp-white);
        flex-direction: column;
        padding: 16px;
        border-bottom: 1px solid var(--hp-gray-200);
        box-shadow: var(--hp-shadow-md);
    }
    .hp-navbar-nav.open { display: flex; }
    .hp-nav-item a { padding: 12px 16px; }
}

/* ── Main Content ── */
.hp-main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px;
    min-height: calc(100vh - 64px - 80px);
}

/* ── Page Header ── */
.hp-page-header {
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--hp-gray-200);
}

.hp-page-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--hp-dark);
    margin: 0 0 4px 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.hp-page-title i { color: var(--hp-primary); }

.hp-page-desc {
    font-size: 0.95rem;
    color: var(--hp-gray-500);
    margin: 0;
}

/* ── Hero Section (Home) ── */
.hp-hero {
    background: linear-gradient(135deg, var(--hp-primary) 0%, var(--hp-dark-2) 100%);
    border-radius: var(--hp-radius-xl);
    padding: 48px 40px;
    margin-bottom: 32px;
    color: white;
    position: relative;
    overflow: hidden;
}

.hp-hero::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(255,255,255,0.06) 0%, transparent 70%);
    border-radius: 50%;
}

.hp-hero h1 {
    font-size: 2rem;
    font-weight: 700;
    margin: 0 0 8px 0;
    position: relative;
    z-index: 1;
}

.hp-hero p {
    font-size: 1.05rem;
    opacity: 0.85;
    margin: 0;
    position: relative;
    z-index: 1;
}

/* ── Cards Dashboard (Home) ── */
.hp-dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.hp-dash-card {
    background: var(--hp-white);
    border-radius: var(--hp-radius-lg);
    padding: 24px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
    box-shadow: var(--hp-shadow);
    transition: var(--hp-transition);
    border: 1px solid var(--hp-gray-100);
    cursor: pointer;
    text-decoration: none;
    color: inherit;
}

.hp-dash-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--hp-shadow-lg);
    border-color: var(--hp-primary);
}

a.hp-dash-card, a.hp-dash-card:visited, a.hp-dash-card:hover {
    color: var(--hp-gray-700) !important;
    text-decoration: none;
}
a.hp-dash-card:hover .hp-dash-card-title { color: var(--hp-primary); }

.hp-dash-card-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--hp-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    color: white;
}

.hp-dash-card-icon.bg-primary { background: linear-gradient(135deg, var(--hp-primary), var(--hp-primary-light)); }
.hp-dash-card-icon.bg-success { background: linear-gradient(135deg, #059669, var(--hp-success)); }
.hp-dash-card-icon.bg-warning { background: linear-gradient(135deg, #d97706, var(--hp-warning)); }
.hp-dash-card-icon.bg-danger { background: linear-gradient(135deg, #dc2626, var(--hp-danger)); }
.hp-dash-card-icon.bg-info { background: linear-gradient(135deg, #2563eb, var(--hp-info)); }
.hp-dash-card-icon.bg-accent { background: linear-gradient(135deg, #0891b2, var(--hp-accent)); }
.hp-dash-card-icon.bg-purple { background: linear-gradient(135deg, #7c3aed, #a78bfa); }
.hp-dash-card-icon.bg-indigo { background: linear-gradient(135deg, #4338ca, #6366f1); }

.hp-dash-card-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--hp-dark);
}

.hp-dash-card-count {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--hp-dark);
    line-height: 1;
}

.hp-dash-card-subtitle {
    font-size: 0.8rem;
    color: var(--hp-gray-400);
}

/* ── Cards génériques ── */
.hp-card {
    background: var(--hp-white);
    border-radius: var(--hp-radius-lg);
    box-shadow: var(--hp-shadow);
    border: 1px solid var(--hp-gray-100);
    overflow: hidden;
}

.hp-card-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--hp-gray-100);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.hp-card-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--hp-dark);
}

.hp-card-body { padding: 24px; }
.hp-card-body.p-0 { padding: 0; }

/* ── Tableaux ── */
.hp-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.hp-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.875rem;
}

.hp-table thead th {
    background: var(--hp-gray-50);
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--hp-gray-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--hp-gray-200);
    white-space: nowrap;
    position: sticky;
    top: 0;
}

.hp-table thead th a {
    color: inherit;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.hp-table thead th a:hover { color: var(--hp-primary); }

.hp-table tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--hp-gray-100);
    vertical-align: middle;
    color: var(--hp-gray-700);
}

.hp-table tbody tr { transition: var(--hp-transition); }
.hp-table tbody tr:hover { background: var(--hp-gray-50); }
.hp-table tbody tr:last-child td { border-bottom: none; }

.hp-table .hp-ref-link {
    font-weight: 600;
    color: var(--hp-primary) !important;
}
.hp-table .hp-ref-link:hover { color: var(--hp-primary-dark) !important; text-decoration: underline; }

/* Fix tab links */
a.hp-tab, a.hp-tab:visited { color: var(--hp-gray-500) !important; text-decoration: none; }
a.hp-tab:hover { color: var(--hp-gray-700) !important; }
a.hp-tab.active, a.hp-tab.active:visited { color: var(--hp-primary) !important; }

/* ── Badges ── */
.hp-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;
}

.badge-success { background: #ecfdf5; color: #065f46; }
.badge-warning { background: #fffbeb; color: #92400e; }
.badge-danger { background: #fef2f2; color: #991b1b; }
.badge-info { background: #eff6ff; color: #1e40af; }
.badge-secondary { background: var(--hp-gray-100); color: var(--hp-gray-600); }
.badge-primary { background: #eef2ff; color: #3730a3; }

/* ── Boutons ── */
.hp-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border-radius: var(--hp-radius-sm);
    font-size: 0.875rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: var(--hp-transition);
    text-decoration: none;
    line-height: 1.4;
}

.hp-btn:hover { transform: translateY(-1px); box-shadow: var(--hp-shadow); }
.hp-btn:active { transform: translateY(0); }

.hp-btn-primary { background: var(--hp-primary); color: #fff !important; }
.hp-btn-primary:hover { background: var(--hp-primary-dark); color: #fff !important; }

.hp-btn-outline {
    background: var(--hp-white);
    border: 1.5px solid var(--hp-gray-300);
    color: var(--hp-gray-700) !important;
}
.hp-btn-outline:hover { border-color: var(--hp-primary); color: var(--hp-primary) !important; background: var(--hp-gray-50); }

.hp-btn-success { background: var(--hp-success); color: #fff !important; }
.hp-btn-success:hover { background: #059669; color: #fff !important; }
.hp-btn-danger { background: var(--hp-danger); color: #fff !important; }
.hp-btn-danger:hover { background: #dc2626; color: #fff !important; }
.hp-btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.hp-btn-xs { padding: 4px 8px; font-size: 0.75rem; }
.hp-btn-icon { padding: 8px 10px; }

/* ── Formulaires / Filtres ── */
.hp-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px;
    padding: 16px 24px;
    background: var(--hp-gray-50);
    border-bottom: 1px solid var(--hp-gray-100);
}

.hp-filter-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.hp-filter-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--hp-gray-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.hp-input, .hp-select {
    padding: 8px 12px;
    border: 1.5px solid var(--hp-gray-200);
    border-radius: var(--hp-radius-sm);
    font-size: 0.875rem;
    font-family: var(--hp-font);
    color: var(--hp-gray-700);
    background: var(--hp-white);
    transition: var(--hp-transition);
    min-width: 160px;
}

.hp-input:focus, .hp-select:focus {
    outline: none;
    border-color: var(--hp-primary);
    box-shadow: 0 0 0 3px rgba(0, 66, 224, 0.12);
}

.hp-input-search {
    padding-left: 36px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%239aa3b8' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 10px center;
}

/* ── Tabs de filtrage statut ── */
.hp-tabs {
    display: flex;
    gap: 4px;
    padding: 4px;
    background: var(--hp-gray-100);
    border-radius: var(--hp-radius);
    width: fit-content;
}

.hp-tab {
    padding: 8px 18px;
    border-radius: var(--hp-radius-sm);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--hp-gray-500);
    background: transparent;
    border: none;
    cursor: pointer;
    transition: var(--hp-transition);
    text-decoration: none;
    white-space: nowrap;
}

.hp-tab:hover { color: var(--hp-gray-700); }
.hp-tab.active {
    background: var(--hp-white);
    color: var(--hp-primary);
    box-shadow: var(--hp-shadow-sm);
    font-weight: 600;
}

/* ── Pagination ── */
.hp-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-top: 1px solid var(--hp-gray-100);
    flex-wrap: wrap;
    gap: 12px;
}

.hp-pagination-info { font-size: 0.85rem; color: var(--hp-gray-500); }

.hp-pagination-links {
    display: flex;
    gap: 4px;
}

.hp-pagination-links a,
.hp-pagination-links span {
    padding: 6px 12px;
    border-radius: var(--hp-radius-sm);
    font-size: 0.85rem;
    font-weight: 500;
    border: 1px solid var(--hp-gray-200);
    color: var(--hp-gray-600);
    transition: var(--hp-transition);
}

.hp-pagination-links a:hover { border-color: var(--hp-primary); color: var(--hp-primary); }
.hp-pagination-links span.active { background: var(--hp-primary); color: white; border-color: var(--hp-primary); }

/* ── Stats Cards MO ── */
.hp-stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.hp-stat-card {
    background: var(--hp-white);
    border-radius: var(--hp-radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: var(--hp-shadow-sm);
    border: 1px solid var(--hp-gray-100);
}

.hp-stat-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--hp-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.hp-stat-value { font-size: 1.5rem; font-weight: 800; color: var(--hp-dark); line-height: 1; }
.hp-stat-label { font-size: 0.8rem; color: var(--hp-gray-400); margin-top: 2px; }

/* ── Detail Card (MO / Stock) ── */
.hp-detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
}

.hp-detail-item label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--hp-gray-400);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.hp-detail-item .value {
    font-size: 1rem;
    font-weight: 500;
    color: var(--hp-dark);
}

/* ── Progress bar ── */
.hp-progress {
    height: 8px;
    background: var(--hp-gray-100);
    border-radius: 4px;
    overflow: hidden;
}

.hp-progress-bar {
    height: 100%;
    border-radius: 4px;
    transition: width 0.6s ease;
}

.hp-progress-bar.bg-primary { background: var(--hp-primary); }
.hp-progress-bar.bg-success { background: var(--hp-success); }
.hp-progress-bar.bg-warning { background: var(--hp-warning); }

/* ── Messages flash ── */
.hp-alert {
    padding: 14px 20px;
    border-radius: var(--hp-radius);
    margin-bottom: 16px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 0.9rem;
}

.hp-alert-success { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.hp-alert-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.hp-alert-warning { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }

/* ── Login Page ── */
.hp-login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--hp-dark) 0%, var(--hp-dark-2) 50%, var(--hp-primary) 100%);
    padding: 24px;
}

.hp-login-card {
    background: var(--hp-white);
    border-radius: var(--hp-radius-xl);
    box-shadow: var(--hp-shadow-lg);
    width: 100%;
    max-width: 420px;
    padding: 40px;
}

.hp-login-logo {
    text-align: center;
    margin-bottom: 32px;
}

.hp-login-logo img { max-height: 48px; }

.hp-login-title {
    text-align: center;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--hp-dark);
    margin-bottom: 8px;
}

.hp-login-subtitle {
    text-align: center;
    font-size: 0.9rem;
    color: var(--hp-gray-400);
    margin-bottom: 32px;
}

.hp-login-form .hp-form-group {
    margin-bottom: 20px;
}

.hp-login-form label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--hp-gray-600);
    margin-bottom: 6px;
}

.hp-login-form .hp-input {
    width: 100%;
    padding: 12px 16px;
    font-size: 0.95rem;
}

.hp-login-form .hp-btn {
    width: 100%;
    justify-content: center;
    padding: 14px;
    font-size: 1rem;
}

/* ── Footer ── */
.hp-footer {
    background: var(--hp-white);
    border-top: 1px solid var(--hp-gray-200);
    padding: 20px 24px;
    text-align: center;
}

.hp-footer-inner {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 0.85rem;
    color: var(--hp-gray-400);
}

.hp-footer a { color: var(--hp-primary); }
.hp-footer a:hover { text-decoration: underline; }

/* ── Empty state ── */
.hp-empty-state {
    text-align: center;
    padding: 60px 24px;
}

.hp-empty-state i {
    font-size: 3rem;
    color: var(--hp-gray-300);
    margin-bottom: 16px;
}

.hp-empty-state h4 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--hp-gray-500);
    margin-bottom: 8px;
}

.hp-empty-state p {
    font-size: 0.9rem;
    color: var(--hp-gray-400);
}

/* ── Qty indicator ── */
.hp-qty-positive { color: var(--hp-success); font-weight: 600; }
.hp-qty-negative { color: var(--hp-danger); font-weight: 600; }
.hp-qty-zero { color: var(--hp-gray-400); }

/* ── Responsive ── */
@media (max-width: 768px) {
    .hp-main { padding: 16px; }
    .hp-hero { padding: 32px 24px; }
    .hp-hero h1 { font-size: 1.5rem; }
    .hp-dashboard-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
    .hp-dash-card { padding: 18px; }
    .hp-dash-card-count { font-size: 1.3rem; }
    .hp-card-header { padding: 14px 16px; }
    .hp-card-body { padding: 16px; }
    .hp-filters { padding: 12px 16px; }
    .hp-table { font-size: 0.8rem; }
    .hp-table thead th, .hp-table tbody td { padding: 10px 12px; }
    .hp-detail-grid { grid-template-columns: 1fr 1fr; }
    .hp-page-title { font-size: 1.3rem; }
    .hp-stats-row { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 480px) {
    .hp-dashboard-grid { grid-template-columns: 1fr; }
    .hp-detail-grid { grid-template-columns: 1fr; }
    .hp-stats-row { grid-template-columns: 1fr; }
    .hp-navbar-user .hp-user-name,
    .hp-navbar-user .hp-user-company { display: none; }
}

/* ── Print ── */
@media print {
    .hp-navbar, .hp-footer, .hp-filters, .hp-pagination, .hp-btn { display: none !important; }
    .hp-main { padding: 0; max-width: 100%; }
    .hp-card { box-shadow: none; border: 1px solid #ddd; }
    .hp-table { font-size: 10pt; }
}

/* ===== Menus déroulants par thème (CorePortal 1.4) ===== */
.hp-nav-group { position: relative; }
.hp-nav-caret { font-size: .65em; margin-left: 4px; transition: transform .15s; }
.hp-nav-group.open .hp-nav-caret { transform: rotate(180deg); }
.hp-nav-dropdown {
    display: none; position: absolute; top: 100%; left: 0; z-index: 300;
    min-width: 220px; background: #fff; border-radius: 10px; padding: 6px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, .18); list-style: none; margin: 0;
}
/* pont invisible : pas de trou de survol entre le déclencheur et le panneau */
.hp-nav-dropdown::before { content: ''; position: absolute; top: -12px; left: 0; right: 0; height: 12px; }
.hp-nav-group.open > .hp-nav-dropdown { display: block; }
@media (min-width: 921px) {
    .hp-nav-group:hover > .hp-nav-dropdown { display: block; }
    .hp-nav-dropdown { margin-top: 6px; }
}
/* Spécificité renforcée : prime sur les règles du designer (.hp-nav-item.active a) */
.hp-navbar .hp-nav-item .hp-nav-dropdown li a {
    display: flex; align-items: center; gap: 9px; padding: 10px 13px; border-radius: 7px;
    color: #1e293b !important; font-weight: 500; background: transparent !important;
}
.hp-navbar .hp-nav-item .hp-nav-dropdown li a:hover { background: #eff6ff !important; color: var(--hp-primary, #1e3a8a) !important; }
.hp-navbar .hp-nav-item .hp-nav-dropdown li.active a { background: var(--hp-primary, #1e3a8a) !important; color: #fff !important; }
.hp-navbar .hp-nav-item .hp-nav-dropdown li a i { width: 18px; text-align: center; }
@media (max-width: 920px) {
    .hp-navbar .hp-nav-item .hp-nav-dropdown li a { color: inherit !important; }
    .hp-navbar .hp-nav-item .hp-nav-dropdown li.active a { background: rgba(255,255,255,.18) !important; }
}
@media (max-width: 920px) {
    .hp-nav-group .hp-nav-dropdown { position: static; box-shadow: none; background: rgba(255,255,255,.07); margin: 0 0 4px 14px; }
}

/* ===== Cartes moules (CorePortal 1.4) ===== */
.cp-mould-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.cp-mould-card {
    background: #fff; border-radius: 12px; overflow: hidden;
    box-shadow: 0 1px 4px rgba(15, 23, 42, .08); transition: box-shadow .15s, transform .15s;
    border-left: 4px solid #16a34a; display: flex; flex-direction: column;
}
.cp-mould-card:hover { box-shadow: 0 8px 22px rgba(15, 23, 42, .14); transform: translateY(-2px); }
.cp-mould-card.st-0 { border-left-color: #64748b; }
.cp-mould-card.st-2 { border-left-color: #b45309; }
.cp-mould-card.st-3 { border-left-color: #dc2626; }
.cp-mould-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; padding: 14px 16px 4px; }
.cp-mould-ref { font-size: 1.12em; font-weight: 800; color: #0f172a; letter-spacing: .2px; }
.cp-mould-label {
    color: #475569; font-size: .85em; line-height: 1.35; padding: 0 16px; min-height: 2.4em;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.cp-mould-chip { display: inline-block; background: #f1f5f9; color: #334155; border-radius: 6px; padding: 1px 8px; font-size: .74em; font-weight: 600; margin: 6px 16px 0; }
.cp-mould-gauge { padding: 10px 16px 0; }
.cp-mould-gauge .g-head { display: flex; justify-content: space-between; font-size: .8em; color: #64748b; margin-bottom: 4px; }
.cp-mould-gauge .g-head strong { color: #0f172a; }
.cp-mould-bar { background: #e2e8f0; border-radius: 6px; height: 12px; overflow: hidden; position: relative; }
.cp-mould-bar > div { height: 100%; border-radius: 6px; min-width: 3px; }
.cp-mould-cycles { font-size: .76em; color: #94a3b8; margin-top: 3px; }
.cp-mould-meta { margin: 10px 16px 14px; border-top: 1px solid #f1f5f9; padding-top: 8px; font-size: .84em; flex: 1; }
.cp-mould-meta .m-row { display: flex; justify-content: space-between; padding: 3px 0; }
.cp-mould-meta .m-row .m-l { color: #64748b; }
.cp-mould-meta .m-row .m-v { font-weight: 600; color: #1e293b; text-align: right; }
.cp-badge { border-radius: 8px; padding: 2px 10px; font-size: .74em; font-weight: 700; color: #fff; white-space: nowrap; }

/* ===== Tri des moules + cartes cliquables (CorePortal 1.5) ===== */
.cp-sort-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0 0 14px; }
.cp-sort-label { color: #64748b; font-size: .85em; font-weight: 600; }
.cp-sort-chip {
    display: inline-block; padding: 5px 12px; border-radius: 20px; font-size: .82em; font-weight: 600;
    background: #f1f5f9; color: #334155; text-decoration: none; transition: all .12s;
}
.cp-sort-chip:hover { background: #e2e8f0; }
.cp-sort-chip.active { background: var(--hp-primary, #1e3a8a); color: #fff; }
.cp-mould-link { text-decoration: none; color: inherit; display: block; }
.cp-mould-link .cp-mould-card { cursor: pointer; height: 100%; }
.cp-mould-link:hover .cp-mould-ref { color: var(--hp-primary, #1e3a8a); }

/* ===== Aération de la fiche moule (CorePortal 1.5.1) ===== */
.cp-fiche .hp-card { padding: 20px 24px; }
.cp-fiche .hp-table th { padding: 11px 16px; }
.cp-fiche .hp-table td { padding: 12px 16px; line-height: 1.45; }
.cp-fiche h2 { margin-bottom: 12px !important; }


/* ===== Mise en page Traçabilité (CorePortal 1.5.2) ===== */
.cp-lot-banner { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 16px; align-items: center; }
.cp-lot-chip {
    font-family: monospace; font-size: 1.25em; font-weight: 800; letter-spacing: .5px;
    background: #0f172a; color: #fff; border-radius: 8px; padding: 6px 14px; display: inline-block;
}
.cp-lot-stat { text-align: center; }
.cp-lot-stat .n { font-size: 2em; font-weight: 800; line-height: 1; color: #0f172a; }
.cp-lot-stat .l { font-size: .78em; color: #64748b; }
.cp-of-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.cp-of-head .cp-of-ref { font-size: 1.1em; font-weight: 800; color: #0f172a; }
.cp-of-qty { background: #f1f5f9; color: #334155; border-radius: 6px; padding: 2px 10px; font-size: .8em; font-weight: 700; }

/* ===== Filtres, sélecteur d'affichage, liste & tableau moules (CorePortal 1.6) ===== */
.cp-filter-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.cp-filter-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.cp-f-input, .cp-f-select {
    padding: 8px 11px; border: 1px solid #cbd5e1; border-radius: 8px; font-size: .88em; background: #fff;
}
.cp-f-input { min-width: 210px; }
.cp-f-reset { color: #64748b; font-size: .84em; text-decoration: none; }
.cp-f-reset:hover { color: #dc2626; }
.cp-display-switch { display: flex; gap: 4px; background: #f1f5f9; border-radius: 9px; padding: 4px; }
.cp-display-switch a {
    display: flex; align-items: center; justify-content: center; width: 34px; height: 30px;
    border-radius: 7px; color: #64748b; text-decoration: none; transition: all .12s;
}
.cp-display-switch a:hover { color: var(--hp-primary, #1e3a8a); }
.cp-display-switch a.active { background: #fff; color: var(--hp-primary, #1e3a8a); box-shadow: 0 1px 3px rgba(15,23,42,.15); }
.cp-count { margin-left: auto; color: #94a3b8; font-size: .82em; font-weight: 600; }

/* liste : une vignette par ligne */
.cp-mould-listview { display: flex; flex-direction: column; gap: 10px; }
.cp-mould-row {
    display: flex; align-items: center; gap: 20px; background: #fff; border-radius: 12px;
    border-left: 4px solid #16a34a; padding: 14px 18px; box-shadow: 0 1px 4px rgba(15,23,42,.08);
    transition: box-shadow .15s, transform .15s;
}
.cp-mould-row:hover { box-shadow: 0 6px 18px rgba(15,23,42,.13); transform: translateX(3px); }
.cp-mould-row.st-0 { border-left-color: #64748b; }
.cp-mould-row.st-2 { border-left-color: #b45309; }
.cp-mould-row.st-3 { border-left-color: #dc2626; }
.cp-mould-row .r-id { flex: 1; min-width: 220px; }
.cp-mould-row .r-label { color: #475569; font-size: .85em; margin-top: 3px; }
.cp-mould-row .r-gauge { width: 220px; }
.cp-mould-row .r-meta { display: flex; flex-direction: column; gap: 3px; font-size: .82em; color: #64748b; min-width: 170px; }
.cp-mould-row .r-go { color: #cbd5e1; font-size: 1.1em; }
.cp-mould-row:hover .r-go { color: var(--hp-primary, #1e3a8a); }
@media (max-width: 760px) { .cp-mould-row { flex-wrap: wrap; } .cp-mould-row .r-gauge { width: 100%; } }

/* tableau */
.cp-mould-table .cp-row-link { cursor: pointer; }
.cp-mould-table .cp-row-link:hover td { background: #eff6ff; }

/* ===== Filtres, toggle de vue, mode liste (CorePortal 1.6) ===== */
.cp-filter-bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.cp-f-input { padding: 8px 11px; border: 1px solid #cbd5e1; border-radius: 7px; font-size: .9em; background: #fff; }
.cp-view-toggle { margin-left: auto; display: inline-flex; border: 1px solid #cbd5e1; border-radius: 8px; overflow: hidden; }
.cp-view-toggle a { padding: 8px 12px; color: #64748b; background: #fff; transition: all .12s; }
.cp-view-toggle a:hover { background: #f1f5f9; }
.cp-view-toggle a.active { background: var(--hp-primary, #1e3a8a); color: #fff; }
.cp-mould-listwrap { display: flex; flex-direction: column; gap: 10px; }
.cp-mould-row {
    flex-direction: row !important; align-items: center; gap: 18px; padding: 12px 18px;
}
.cp-mould-row .r-id { flex: 1.4; min-width: 200px; }
.cp-mould-row .r-label { color: #475569; font-size: .85em; line-height: 1.3; }
.cp-mould-row .r-gauge { flex: 1; min-width: 170px; }
.cp-mould-row .r-meta { flex: 1; min-width: 170px; font-size: .84em; color: #475569; display: flex; flex-direction: column; gap: 2px; }
.cp-mould-row .r-meta i { width: 16px; color: #94a3b8; }
.cp-mould-row .r-status { min-width: 90px; text-align: right; }
@media (max-width: 760px) { .cp-mould-row { flex-wrap: wrap; } .cp-mould-row .r-status { text-align: left; } }
.cp-row-link { cursor: pointer; }
.cp-row-link:hover td { background: #eff6ff; }
