/* ==========================================================================
   HealthPredict AI — design system
   All colors and fonts come from CSS variables populated by the layout from
   config('healthpredict.*'). Do NOT hardcode hex values in this file.
   ========================================================================== */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    background: var(--hp-background);
    color: #0F172A;
    font-family: var(--hp-body-font);
    font-size: 14.5px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    /* Prevent horizontal scrollbar caused by off-screen elements */
    overflow-x: hidden;
}

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

h1, h2, h3, h4, h5, h6 {
    font-family: var(--hp-heading-font);
    color: var(--hp-primary);
    margin: 0 0 .35rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}
h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.15rem; }

p { margin: 0 0 .75rem; }

.label-muted {
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.06em;
    color: var(--hp-text-muted);
    font-weight: 600;
}

/* ==========================================================================
   Top loading bar
   ========================================================================== */

.hp-loader {
    position: fixed;
    top: 0; left: 0;
    height: 3px;
    width: 0;
    background: linear-gradient(90deg, var(--hp-secondary), var(--hp-accent));
    box-shadow: 0 0 8px rgba(45, 169, 160, .5);
    z-index: 9999;
    transition: width .35s ease, opacity .25s ease;
    opacity: 0;
    pointer-events: none;
}
.hp-loader.is-active { opacity: 1; }

/* ==========================================================================
   Page transition
   ========================================================================== */

.hp-page {
    animation: hp-fade-in .25s ease both;
}
.hp-page.is-leaving {
    animation: hp-fade-out .2s ease both;
}
@keyframes hp-fade-in {
    /* Fade-only — never finish with a `transform` applied, otherwise the
       resulting containing block breaks position:fixed children (modal,
       searchable-select panel) and offsets FullCalendar drag mirrors. */
    from { opacity: 0; }
    to   { opacity: 1; }
}
@keyframes hp-fade-out {
    from { opacity: 1; }
    to   { opacity: 0; }
}

/* ==========================================================================
   Auth layout — two-column hero + form (matches screenshot)
   ========================================================================== */

.hp-auth {
    min-height: 100vh;
    background:
        radial-gradient(circle at 15% 10%, rgba(45, 169, 160, .07), transparent 50%),
        radial-gradient(circle at 85% 90%, rgba(26, 143, 184, .07), transparent 50%),
        var(--hp-background);
    padding: 3rem 2rem 1.5rem;
    display: flex; flex-direction: column;
}
.hp-auth-grid {
    flex: 1;
    width: 100%;
    max-width: 1180px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: center;
}
@media (max-width: 900px) {
    .hp-auth { padding: 2rem 1rem; }
    .hp-auth-grid { grid-template-columns: 1fr; gap: 2rem; }
    .hp-auth-hero { display: none; }
}

.hp-auth-hero h1 {
    font-family: var(--hp-heading-font);
    font-size: clamp(1.9rem, 3.2vw, 2.6rem);
    line-height: 1.18;
    color: var(--hp-primary);
    margin: 1.75rem 0 1rem;
    font-weight: 600;
}
.hp-auth-hero h1 em {
    font-style: italic;
    color: var(--hp-secondary);
}
.hp-auth-hero p {
    color: var(--hp-text-muted);
    font-size: 14.5px;
    line-height: 1.65;
    max-width: 520px;
}
.hp-auth-metrics {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .75rem;
    margin-top: 1.75rem;
    max-width: 460px;
}
.hp-auth-metric {
    background: rgba(255,255,255,.7);
    backdrop-filter: blur(6px);
    border: 1px solid var(--hp-card-border);
    border-radius: 12px;
    padding: 1rem 1.1rem;
}
.hp-auth-metric.is-accent {
    border-color: rgba(94, 191, 184, .45);
}
.hp-auth-metric-label {
    font-size: 10px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--hp-text-muted);
    margin-bottom: 4px;
    font-weight: 600;
}
.hp-auth-metric.is-accent .hp-auth-metric-label { color: var(--hp-secondary); }
.hp-auth-metric-value {
    font-family: var(--hp-heading-font);
    font-size: 1.7rem;
    color: var(--hp-primary);
    font-weight: 600;
    line-height: 1.05;
}
.hp-auth-metric-caption {
    font-size: 11.5px;
    color: var(--hp-text-muted);
    margin-top: 4px;
}

.hp-auth-card {
    width: 100%;
    max-width: 480px;
    margin-left: auto;
    background: #fff;
    border: 1px solid var(--hp-card-border);
    border-radius: 18px;
    padding: 2.5rem 2.25rem;
    box-shadow: 0 24px 60px -32px rgba(20, 40, 80, .35);
}
.hp-auth-kicker {
    font-size: 11px;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--hp-secondary);
    font-weight: 700;
    margin-bottom: .5rem;
}
.hp-auth-card h2 {
    font-family: var(--hp-heading-font);
    font-size: 1.75rem;
    color: var(--hp-primary);
    margin: 0 0 .5rem;
    font-weight: 600;
}
.hp-auth-subtitle {
    color: var(--hp-text-muted);
    margin: 0 0 1.75rem;
    font-size: 14px;
}
.hp-auth-footer {
    text-align: center;
    color: var(--hp-text-muted);
    font-size: 11px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    padding: 2rem 0 0;
}

/* Form input with leading icon + trailing eye toggle */
.hp-input-wrap {
    position: relative;
}
.hp-input-wrap > svg.hp-input-icon {
    position: absolute; left: .85rem; top: 50%; transform: translateY(-50%);
    width: 16px; height: 16px;
    color: var(--hp-text-muted);
    pointer-events: none;
}
.hp-input-wrap .form-control {
    padding-left: 2.5rem;
}
.hp-input-wrap .hp-input-toggle {
    position: absolute; right: .65rem; top: 50%; transform: translateY(-50%);
    background: transparent; border: 0; padding: .25rem;
    color: var(--hp-text-muted); cursor: pointer;
}
.hp-input-wrap .hp-input-toggle:hover { color: var(--hp-primary); }
.hp-input-wrap .hp-input-toggle svg { width: 16px; height: 16px; }

.hp-auth-error {
    background: rgba(220, 38, 38, .06);
    border: 1px solid rgba(220, 38, 38, .2);
    color: var(--hp-danger);
    padding: .65rem .85rem;
    border-radius: 9px;
    font-size: 13px;
    display: flex; align-items: flex-start; gap: .5rem;
    margin-top: -.25rem; margin-bottom: 1rem;
}

/* ==========================================================================
   App layout (sidebar + topbar + content)
   ========================================================================== */

.hp-app {
    display: grid;
    grid-template-columns: 248px 1fr;
    grid-template-rows: 64px 1fr;
    grid-template-areas:
        "sidebar topbar"
        "sidebar content";
    min-height: 100vh;
    transition: grid-template-columns .25s ease;
}
.hp-app.is-sidebar-collapsed { grid-template-columns: 70px 1fr; }
.hp-sidebar { grid-area: sidebar; background: var(--hp-primary); color: #E2E8F0; }
.hp-topbar  { grid-area: topbar;  background: #fff; border-bottom: 1px solid var(--hp-card-border); }
.hp-content { grid-area: content; padding: 1.75rem 2rem; min-width: 0; }

/* Mobile: collapse the grid + slide sidebar in as an overlay drawer. */
.hp-mobile-toggle { display: none; }
.hp-mobile-backdrop {
    display: none;
    position: fixed; inset: 0;
    background: rgba(20, 40, 80, .45);
    z-index: 60;
}
.hp-app.is-mobile-open .hp-mobile-backdrop { display: block; }

@media (max-width: 768px) {
    .hp-app, .hp-app.is-sidebar-collapsed {
        grid-template-columns: 1fr;
        grid-template-rows: 64px 1fr;
        grid-template-areas:
            "topbar"
            "content";
        /* Prevent horizontal overflow from off-screen sidebar */
        overflow-x: hidden;
    }
    /* Pull sidebar completely out of document flow on mobile —
       fixed + translate keeps it hidden without affecting page width */
    .hp-sidebar {
        position: fixed;
        top: 0; left: 0; bottom: 0;
        width: 280px;
        z-index: 70;
        transform: translateX(-100%);
        transition: transform .25s ease;
        box-shadow: 2px 0 16px rgba(0,0,0,.18);
        /* Ensure the inner sticky context doesn't expand the page */
        overflow: hidden;
    }
    .hp-sidebar-inner {
        height: 100%;
        position: relative;
        overflow-y: auto;
    }
    .hp-app.is-mobile-open .hp-sidebar { transform: translateX(0); }
    .hp-content { padding: 1rem 1rem 2.5rem; }
    .hp-mobile-toggle {
        display: inline-flex;
        align-items: center; justify-content: center;
        width: 38px; height: 38px;
        border: 1px solid var(--hp-card-border);
        background: #fff;
        border-radius: 8px;
        cursor: pointer;
        margin-right: .5rem;
    }
    .hp-mobile-toggle svg { width: 18px; height: 18px; color: var(--hp-primary); }
    .hp-topbar-search { max-width: none; }
    .hp-sidebar-handle { display: none; }
    .hp-page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: .75rem;
    }
    .hp-page-header-actions { width: 100%; flex-wrap: wrap; }
}

/* Sidebar */
.hp-sidebar-inner {
    display: flex; flex-direction: column;
    height: 100vh; position: sticky; top: 0;
    padding: 1.1rem .9rem;
}
.hp-sidebar-brand {
    display: flex; align-items: center; gap: .55rem;
    padding: .15rem .4rem 1rem;
    border-bottom: 1px solid rgba(255,255,255,.08);
    margin-bottom: .9rem;
    min-width: 0;
}
.hp-sidebar-brand-link {
    display: flex; align-items: center; gap: .65rem;
    flex: 1; min-width: 0;
    color: inherit; text-decoration: none;
    overflow: hidden;
}
.hp-sidebar-brand-mark {
    width: 34px; height: 34px;
    border-radius: 9px;
    background: linear-gradient(135deg, var(--hp-secondary), var(--hp-accent));
    display: grid; place-items: center;
    color: #fff;
    font-family: var(--hp-heading-font);
    font-weight: 700;
}
.hp-sidebar-brand-text {
    color: #fff;
    font-family: var(--hp-heading-font);
    font-weight: 600;
    line-height: 1.1;
}
.hp-sidebar-brand-text small {
    display: block;
    color: rgba(255,255,255,.55);
    font-size: 11px;
    font-family: var(--hp-body-font);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    margin-top: 2px;
}
.hp-sidebar-section {
    color: rgba(255,255,255,.45);
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 1rem .65rem .35rem;
    font-weight: 600;
}
.hp-sidebar-link {
    display: flex; align-items: center; gap: .65rem;
    padding: .55rem .65rem;
    color: rgba(255,255,255,.78);
    border-radius: 8px;
    font-size: 13.5px;
    margin-bottom: 2px;
    transition: background .15s ease, color .15s ease;
}
.hp-sidebar-link:hover {
    background: rgba(255,255,255,.06);
    color: #fff;
}
.hp-sidebar-link.is-active {
    background: rgba(45, 169, 160, .15);
    color: #fff;
    box-shadow: inset 3px 0 0 var(--hp-secondary);
}
.hp-sidebar-link svg { width: 18px; height: 18px; flex-shrink: 0; }
.hp-sidebar-link .hp-sidebar-chevron {
    margin-left: auto;
    width: 14px; height: 14px;
    transition: transform .15s ease;
    opacity: .7;
}
.hp-sidebar-group.is-open > .hp-sidebar-link .hp-sidebar-chevron {
    transform: rotate(90deg);
}
.hp-sidebar-children {
    overflow: hidden;
    max-height: 0;
    transition: max-height .25s ease;
}
.hp-sidebar-group.is-open .hp-sidebar-children {
    max-height: 500px;
}
.hp-sidebar-children .hp-sidebar-link {
    padding-left: 2.4rem;
    font-size: 12.5px;
    color: rgba(255,255,255,.62);
}
.hp-sidebar-children .hp-sidebar-link.is-active {
    background: rgba(45, 169, 160, .12);
    color: #fff;
    box-shadow: none;
}
.hp-sidebar-children .hp-sidebar-link::before {
    content: "";
    width: 4px; height: 4px;
    background: rgba(255,255,255,.35);
    border-radius: 50%;
    margin-right: .4rem;
    flex-shrink: 0;
}
.hp-sidebar-spacer { flex: 1; }
.hp-sidebar-scroll {
    flex: 1;
    overflow-y: auto;
    margin: 0 -.5rem;
    padding: 0 .5rem;
}
.hp-sidebar-scroll::-webkit-scrollbar { width: 4px; }
.hp-sidebar-scroll::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 4px; }

/* position:relative needed for the collapse handle's absolute positioning —
   but must NOT apply on mobile where the sidebar is position:fixed. */
@media (min-width: 769px) {
    .hp-sidebar { position: relative; }
}

/* Half-circle handle that hangs off the sidebar's right edge — visible in
   both expanded and collapsed states. */
.hp-sidebar-handle {
    position: absolute;
    top: 28px;
    right: -12px;
    width: 24px; height: 24px;
    border-radius: 50%;
    background: var(--hp-primary);
    border: 1px solid rgba(255,255,255,.18);
    color: #fff;
    cursor: pointer;
    display: inline-flex;
    align-items: center; justify-content: center;
    z-index: 6;
    box-shadow: 0 2px 6px rgba(0,0,0,.18);
    transition: background .15s ease;
}
.hp-sidebar-handle:hover { background: var(--hp-secondary); }
.hp-sidebar-handle svg { width: 12px; height: 12px; transition: transform .2s ease; }
.is-sidebar-collapsed .hp-sidebar-handle svg { transform: rotate(180deg); }

/* Collapsed mode tweaks */
.is-sidebar-collapsed .hp-sidebar-section,
.is-sidebar-collapsed .hp-sidebar-link span,
.is-sidebar-collapsed .hp-sidebar-chevron,
.is-sidebar-collapsed .hp-sidebar-children { display: none; }

/* Hide the logo wordmark + the vertical separator before it. */
.is-sidebar-collapsed .hp-logo > div { display: none !important; }

.is-sidebar-collapsed .hp-sidebar-link {
    justify-content: center;
    padding-left: .5rem;
    padding-right: .5rem;
}
.is-sidebar-collapsed .hp-sidebar-brand {
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
}
.is-sidebar-collapsed .hp-sidebar-brand-link { justify-content: center; }
.is-sidebar-collapsed .hp-sidebar-group {
    position: relative;
}
.is-sidebar-collapsed .hp-sidebar-group:hover > .hp-sidebar-children {
    display: block;
    position: absolute;
    left: 100%;
    top: 0;
    background: var(--hp-primary);
    border-radius: 8px;
    padding: .35rem .25rem;
    min-width: 220px;
    margin-left: .35rem;
    z-index: 50;
    box-shadow: 0 18px 40px -22px rgba(0,0,0,.5);
    max-height: none;
}
.is-sidebar-collapsed .hp-sidebar-group:hover > .hp-sidebar-children .hp-sidebar-link {
    display: flex;
    justify-content: flex-start;
    padding-left: .85rem;
    padding-right: .85rem;
}
.is-sidebar-collapsed .hp-sidebar-group:hover > .hp-sidebar-children .hp-sidebar-link span {
    display: inline;
}

/* Topbar */
.hp-topbar-inner {
    height: 100%;
    padding: 0 1.5rem;
    display: flex; align-items: center; gap: 1rem;
}
.hp-topbar-search {
    flex: 1;
    max-width: 480px;
    position: relative;
}
.hp-topbar-search input {
    width: 100%;
    border: 1px solid var(--hp-card-border);
    background: var(--hp-background);
    padding: .55rem .9rem .55rem 2.2rem;
    border-radius: 9px;
    font-size: 13.5px;
    outline: none;
}
.hp-topbar-search input:focus {
    border-color: var(--hp-accent);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(26, 143, 184, .12);
}
.hp-topbar-search svg {
    position: absolute; left: .7rem; top: 50%;
    transform: translateY(-50%);
    width: 16px; height: 16px; color: var(--hp-text-muted);
}
.hp-topbar-spacer { flex: 1; }
.hp-topbar-actions { display: flex; align-items: center; gap: .5rem; }

/* Mega-search panel */
.hp-mega-search { position: relative; }
.hp-mega-panel {
    position: absolute;
    top: calc(100% + 6px);
    left: 0; right: 0;
    background: #fff;
    border: 1px solid var(--hp-card-border);
    border-radius: 12px;
    box-shadow: 0 24px 50px -28px rgba(20, 40, 80, .35);
    padding: .35rem;
    z-index: 250;
    max-height: 480px;
    overflow-y: auto;
    display: none;
}
.hp-mega-search.is-open .hp-mega-panel { display: block; }
.hp-mega-group + .hp-mega-group { border-top: 1px solid var(--hp-card-border); margin-top: .25rem; padding-top: .25rem; }
.hp-mega-group-title {
    font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase;
    color: var(--hp-text-muted); font-weight: 600;
    padding: .55rem .65rem .15rem;
}
.hp-mega-item {
    display: flex; align-items: center; gap: .65rem;
    padding: .5rem .65rem;
    border-radius: 7px;
    cursor: pointer;
    color: #1F2937;
    font-size: 13px;
    border: 0; background: transparent;
    width: 100%; text-align: left;
    font-family: inherit;
}
.hp-mega-item:hover, .hp-mega-item.is-focused {
    background: rgba(45, 169, 160, .1);
    color: var(--hp-primary);
}
.hp-mega-item-kind {
    width: 22px; height: 22px;
    border-radius: 6px;
    background: rgba(45, 169, 160, .12);
    color: var(--hp-secondary);
    display: grid; place-items: center;
    font-size: 10px; font-weight: 700;
    flex-shrink: 0;
}
.hp-mega-item-kind.is-c { background: rgba(20, 40, 80, .08);  color: var(--hp-primary); }
.hp-mega-item-kind.is-d { background: rgba(217, 119, 6, .12); color: var(--hp-warning); }
.hp-mega-item-kind.is-m { background: rgba(45, 169, 160, .12); color: var(--hp-secondary); }
.hp-mega-item-kind.is-u { background: rgba(26, 143, 184, .12); color: var(--hp-accent); }
.hp-mega-item-label { flex: 1; min-width: 0; }
.hp-mega-item-label > div:last-child { font-size: 11.5px; color: var(--hp-text-muted); }
.hp-mega-empty {
    padding: 1.25rem; text-align: center;
    color: var(--hp-text-muted); font-size: 13px;
}
.hp-mega-hint {
    padding: .85rem 1rem;
    color: var(--hp-text-muted);
    font-size: 12.5px;
}

/* Icon button used by topbar for language / notifications etc. */
.hp-icon-btn {
    background: #fff;
    border: 1px solid var(--hp-card-border);
    width: 36px; height: 36px;
    border-radius: 9px;
    display: inline-flex; align-items: center; justify-content: center;
    color: var(--hp-text-muted);
    cursor: pointer;
    transition: border-color .15s ease, color .15s ease;
}
.hp-icon-btn:hover { border-color: var(--hp-secondary); color: var(--hp-primary); }
.hp-icon-btn svg { width: 16px; height: 16px; }

/* Notification bell badge */
.hp-notif-trigger { position: relative; }
.hp-notif-badge {
    position: absolute; top: -4px; right: -4px;
    min-width: 18px; height: 18px; padding: 0 4px;
    background: var(--hp-danger); color: #fff;
    border: 2px solid #fff; border-radius: 999px;
    font-size: 10px; font-weight: 700; line-height: 14px;
    display: inline-flex; align-items: center; justify-content: center;
}
.hp-notif-row {
    display: flex; gap: .65rem; align-items: flex-start;
    padding: .65rem .9rem; border-bottom: 1px solid var(--hp-card-border);
    color: inherit; text-decoration: none; cursor: pointer;
}
.hp-notif-row:last-child { border-bottom: none; }
.hp-notif-row:hover { background: rgba(45,169,160,.04); }
.hp-notif-row.is-unread { background: rgba(45,169,160,.06); }
.hp-notif-dot {
    width: 7px; height: 7px; border-radius: 50%;
    background: var(--hp-secondary); margin-top: .45rem; flex-shrink: 0;
}
.hp-notif-row:not(.is-unread) .hp-notif-dot { background: transparent; }
.hp-notif-title { font-weight: 600; color: var(--hp-primary); font-size: 13px; line-height: 1.3; }
.hp-notif-body { font-size: 12px; color: var(--hp-text-muted); line-height: 1.4; margin-top: 2px; }
.hp-notif-time { font-size: 11px; color: var(--hp-text-muted); margin-top: 3px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

/* Generic dropdown anchored to the right of its trigger */
.hp-dropdown { position: relative; display: inline-flex; }
.hp-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px); right: 0;
    min-width: 220px;
    background: #fff;
    border: 1px solid var(--hp-card-border);
    border-radius: 10px;
    box-shadow: 0 18px 40px -22px rgba(20, 40, 80, .35);
    padding: .35rem;
    z-index: 200;
    display: none;
    max-height: 360px;
    overflow-y: auto;
}
.hp-dropdown.is-open .hp-dropdown-menu { display: block; }
.hp-dropdown-item {
    display: flex; align-items: center; gap: .55rem;
    width: 100%;
    padding: .5rem .65rem;
    border-radius: 7px;
    background: transparent; border: 0;
    text-align: left;
    cursor: pointer;
    font-size: 13px;
    color: #1F2937;
    font-family: inherit;
}
.hp-dropdown-item:hover { background: rgba(45, 169, 160, .08); color: var(--hp-primary); }
.hp-dropdown-item.is-active { background: rgba(45, 169, 160, .15); color: var(--hp-primary); font-weight: 600; }
.hp-dropdown-section {
    font-size: 10px; letter-spacing: 0.08em;
    text-transform: uppercase; color: var(--hp-text-muted);
    padding: .55rem .65rem .25rem;
    font-weight: 600;
}
.hp-dropdown-divider {
    height: 1px;
    background: var(--hp-card-border);
    margin: .25rem 0;
}

/* Site picker pill in topbar */
.hp-site-picker {
    display: inline-flex; align-items: center; gap: .5rem;
    padding: .35rem .65rem .35rem .55rem;
    border-radius: 9px;
    border: 1px solid var(--hp-card-border);
    background: #fff;
    cursor: pointer;
    font-size: 13px;
    color: var(--hp-primary);
    font-weight: 500;
    line-height: 1.1;
}
.hp-site-picker:hover { border-color: var(--hp-secondary); }
.hp-site-picker .hp-site-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--hp-secondary);
}
.hp-site-picker .hp-site-meta {
    font-size: 10.5px; color: var(--hp-text-muted);
    text-transform: uppercase; letter-spacing: 0.05em;
    font-weight: 600;
}
.hp-site-picker svg { width: 12px; height: 12px; opacity: .6; margin-left: .25rem; }

/* Site picker dropdown — search + filiale groups */
.hp-site-menu { min-width: 320px; max-width: 360px; padding-bottom: .35rem; }
.hp-site-search {
    display: flex; align-items: center; gap: .45rem;
    margin: .25rem .6rem .35rem;
    padding: .42rem .65rem;
    border: 1px solid var(--hp-card-border);
    border-radius: 10px;
    background: #FAFCFD;
    transition: border-color .15s, background-color .15s;
}
.hp-site-search:focus-within {
    border-color: var(--hp-secondary);
    background: #FFFFFF;
}
.hp-site-search svg { color: var(--hp-text-muted); flex-shrink: 0; }
.hp-site-search input {
    flex: 1;
    border: 0; outline: 0; background: transparent;
    font-size: 13px; color: var(--hp-text-strong);
    font-family: inherit;
}
.hp-site-list {
    max-height: 360px;
    overflow-y: auto;
    padding: 0 .25rem;
}
.hp-site-group { padding: .15rem 0 .25rem; }
.hp-site-group + .hp-site-group { border-top: 1px solid var(--hp-card-border); margin-top: .25rem; }
.hp-site-group-head {
    font-size: 10.5px; font-weight: 700; letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--hp-text-muted);
    padding: .45rem .85rem .25rem;
}
.hp-site-empty {
    padding: 1rem .85rem;
    text-align: center;
    color: var(--hp-text-muted);
    font-size: 12.5px;
    font-style: italic;
}

.hp-user-menu {
    display: flex; align-items: center; gap: .65rem;
    padding: .25rem .55rem .25rem .35rem;
    border-radius: 9px;
    cursor: pointer;
    border: 1px solid transparent;
    background: transparent;
    font-family: inherit;
}
.hp-user-menu:hover { border-color: var(--hp-card-border); background: #fff; }
.hp-icon-btn-danger {
    background: #fff;
    border: 1px solid var(--hp-card-border);
    width: 36px; height: 36px;
    border-radius: 9px;
    display: inline-flex; align-items: center; justify-content: center;
    color: var(--hp-danger);
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease;
}
.hp-icon-btn-danger:hover {
    background: rgba(220, 38, 38, .08);
    border-color: var(--hp-danger);
}
.hp-icon-btn-danger svg { width: 16px; height: 16px; }
.hp-user-avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--hp-primary), var(--hp-accent));
    color: #fff;
    display: grid; place-items: center;
    font-weight: 600; font-size: 13px;
}
.hp-user-info { line-height: 1.15; }
.hp-user-name { font-size: 13px; font-weight: 600; color: #0F172A; }
.hp-user-role { font-size: 11px; color: var(--hp-text-muted); }

/* ==========================================================================
   Cards
   ========================================================================== */

.card {
    background: #fff;
    border: 1px solid var(--hp-card-border);
    border-radius: 14px;
    box-shadow: 0 1px 0 rgba(20, 40, 80, .02), 0 12px 28px -22px rgba(20, 40, 80, .15);
    overflow: hidden;
}
.card + .card { margin-top: 1.25rem; }
.card-header {
    padding: 1.1rem 1.25rem .65rem;
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.card-header h2, .card-header h3 { margin: 0; }
.card-body { padding: 1rem 1.25rem 1.25rem; }
.card-footer {
    padding: .85rem 1.25rem;
    border-top: 1px solid var(--hp-card-border);
    background: #FAFCFD;
    display: flex; justify-content: flex-end; gap: .5rem;
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn {
    display: inline-flex; align-items: center; gap: .45rem;
    padding: .55rem 1rem;
    border-radius: 9px;
    font-size: 13.5px;
    font-weight: 600;
    line-height: 1.1;
    border: 1px solid transparent;
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease, color .15s ease, transform .05s ease;
    text-decoration: none;
    font-family: inherit;
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 0; box-shadow: 0 0 0 3px rgba(26, 143, 184, .25); }

.btn-primary {
    background: var(--hp-primary);
    color: #fff;
}
.btn-primary:hover { background: #1c365f; color: #fff; }

.btn-secondary {
    background: #fff;
    color: var(--hp-secondary);
    border-color: var(--hp-secondary);
}
.btn-secondary:hover { background: rgba(45,169,160,.08); color: var(--hp-secondary); }

.btn-danger {
    background: #fff;
    color: var(--hp-danger);
    border-color: var(--hp-danger);
}
.btn-danger:hover { background: rgba(220, 38, 38, .07); }

.btn-ghost {
    background: transparent;
    color: var(--hp-text-muted);
}
.btn-ghost:hover { color: var(--hp-primary); background: rgba(20, 40, 80, .05); }

.btn-block { width: 100%; justify-content: center; }

/* ==========================================================================
   Forms
   ========================================================================== */

.form-group { margin-bottom: 1rem; }
.form-label {
    display: block;
    font-size: 12.5px;
    font-weight: 600;
    color: #1F2937;
    margin-bottom: .35rem;
}
.form-label .req { color: var(--hp-danger); margin-left: 2px; }
.form-control {
    width: 100%;
    padding: .6rem .85rem;
    border: 1px solid var(--hp-card-border);
    border-radius: 9px;
    background: #fff;
    font-size: 13.5px;
    color: #0F172A;
    font-family: inherit;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.form-control:focus {
    outline: 0;
    border-color: var(--hp-accent);
    box-shadow: 0 0 0 3px rgba(26, 143, 184, .15);
}
.form-error {
    margin-top: .35rem;
    color: var(--hp-danger);
    font-size: 12.5px;
    min-height: 1em;
}
.form-group.has-error .form-control { border-color: var(--hp-danger); box-shadow: 0 0 0 3px rgba(220, 38, 38, .12); }

/* ==========================================================================
   Stepper (multi-step forms)
   ========================================================================== */
.hp-stepper {
    display: flex; align-items: center; gap: .85rem;
    margin-bottom: 1.75rem;
}
.hp-stepper-dot {
    display: inline-flex; align-items: center; gap: .65rem;
    background: transparent; border: 0;
    cursor: pointer;
    padding: 0; font-family: inherit;
    color: var(--hp-text-muted);
}
.hp-stepper-dot[disabled] { cursor: not-allowed; opacity: .55; }
.hp-stepper-num {
    width: 30px; height: 30px;
    border-radius: 50%;
    border: 2px solid var(--hp-card-border);
    background: #fff;
    color: var(--hp-text-muted);
    font-weight: 700; font-size: 13px;
    display: grid; place-items: center;
    flex-shrink: 0;
    transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.hp-stepper-label {
    font-size: 13px; font-weight: 600; color: var(--hp-text-muted);
}
.hp-stepper-dot.is-active .hp-stepper-num,
.hp-stepper-dot.is-done   .hp-stepper-num {
    background: var(--hp-secondary); border-color: var(--hp-secondary); color: #fff;
}
.hp-stepper-dot.is-active .hp-stepper-label,
.hp-stepper-dot.is-done   .hp-stepper-label {
    color: var(--hp-primary);
}
.hp-stepper-bar {
    flex: 1; height: 2px;
    background: var(--hp-card-border);
    border-radius: 2px;
    transition: background .25s ease;
}
.hp-stepper-bar.is-done { background: var(--hp-secondary); }

.hp-step-pane { display: none; animation: hp-fade-in .22s ease both; }
.hp-step-pane.is-active { display: block; }

/* Repeatable rows (expositions, symptoms, ATCD, imagery) */
.hp-repeat {
    display: grid;
    gap: .65rem;
}
.hp-repeat-row {
    display: grid;
    gap: .65rem;
    align-items: start;
}
.hp-repeat-row .form-group { margin-bottom: 0; }
.hp-repeat-actions { display: flex; gap: .5rem; align-items: center; margin-top: .35rem; }

.hp-chip-input {
    display: flex; gap: .35rem; align-items: center;
    padding: .35rem .55rem .35rem .75rem;
    border-radius: 999px;
    background: rgba(45, 169, 160, .1);
    color: var(--hp-secondary);
    border: 1px solid rgba(45, 169, 160, .25);
    font-size: 12.5px; font-weight: 500;
}
.hp-chip-input button {
    background: transparent; border: 0; padding: 2px;
    color: inherit; cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 50%;
    line-height: 1;
}
.hp-chip-input button:hover { background: rgba(45,169,160,.18); }

.hp-section-title {
    font-family: var(--hp-heading-font);
    font-size: 1.05rem;
    color: var(--hp-primary);
    font-weight: 600;
    margin: 0 0 .25rem;
}
.hp-section-subtitle {
    color: var(--hp-text-muted);
    font-size: 12.5px;
    margin: 0 0 1.1rem;
}

.hp-file-drop {
    border: 1.5px dashed var(--hp-card-border);
    border-radius: 10px;
    padding: 1rem;
    background: var(--hp-background);
    display: flex; align-items: center; gap: .85rem;
    color: var(--hp-text-muted);
    font-size: 13px;
}
.hp-file-drop input[type="file"] { display: block; font-size: 12px; }

/* ==========================================================================
   Dossier — left identity card + right tabs
   ========================================================================== */
.hp-dossier-grid {
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr);
    gap: 1.25rem;
    align-items: flex-start;
}
.hp-dossier-grid > main { min-width: 0; }
@media (max-width: 1100px) {
    .hp-dossier-grid { grid-template-columns: 1fr; }
}
.hp-dossier-aside {
    position: sticky; top: 1rem;
}
.hp-dossier-avatar {
    width: 72px; height: 72px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--hp-primary), var(--hp-accent));
    color: #fff;
    display: grid; place-items: center;
    font-family: var(--hp-heading-font);
    font-weight: 600; font-size: 1.6rem;
    letter-spacing: 0.02em;
    margin-bottom: .75rem;
}
.hp-dossier-meta-row {
    display: flex; align-items: center; gap: .55rem;
    padding: .55rem 0;
    font-size: 13px; color: var(--hp-text-muted);
    border-top: 1px solid var(--hp-card-border);
}
.hp-dossier-meta-row:first-of-type { border-top: 0; padding-top: 0; }
.hp-dossier-meta-row svg { width: 14px; height: 14px; flex-shrink: 0; }
.hp-dossier-meta-row strong { color: #1F2937; font-weight: 600; }

.hp-tabs-bar {
    display: flex; align-items: center; gap: .25rem;
    border-bottom: 1px solid var(--hp-card-border);
    overflow-x: auto;
    overflow-y: hidden;
    margin-bottom: 1rem;
    padding-bottom: 0;
    position: sticky;
    top: 0;
    z-index: 5;
    background: var(--hp-background);
    scrollbar-width: thin;
    flex-wrap: nowrap;
    max-width: 100%;
    /* allow trackpad/wheel horizontal scroll */
    overscroll-behavior-x: contain;
    /* Note: previous mask-image fade was breaking click hit-testing on the
       first/last tab buttons in some browsers — removed. */
}
.hp-tabs-bar::-webkit-scrollbar { height: 4px; }
.hp-tabs-bar::-webkit-scrollbar-thumb { background: var(--hp-card-border); border-radius: 4px; }
.hp-tabs-wrap {
    position: relative;
}
.hp-tabs-wrap::before,
.hp-tabs-wrap::after {
    content: ''; position: absolute; top: 0; bottom: 8px; width: 24px;
    pointer-events: none;
    z-index: 6;
    transition: opacity .15s ease;
    opacity: 0;
}
.hp-tabs-wrap::before { left: 0; background: linear-gradient(to right, var(--hp-background), transparent); }
.hp-tabs-wrap::after  { right: 0; background: linear-gradient(to left,  var(--hp-background), transparent); }
.hp-tabs-wrap.has-scroll-left::before  { opacity: 1; }
.hp-tabs-wrap.has-scroll-right::after { opacity: 1; }
.hp-tab-btn {
    background: transparent; border: 0;
    padding: .85rem 1rem;
    margin-bottom: -1px;
    border-bottom: 2px solid transparent;
    font-family: inherit;
    font-size: 13.5px; font-weight: 500;
    color: var(--hp-text-muted);
    cursor: pointer;
    display: inline-flex; align-items: center; gap: .5rem;
    white-space: nowrap;
    border-radius: 8px 8px 0 0;
    transition: color .15s, background-color .15s, border-color .15s;
}
.hp-tab-btn:hover { color: var(--hp-primary); background: rgba(20, 184, 166, .05); }
.hp-tab-btn.is-active {
    color: var(--hp-primary);
    border-bottom-color: var(--hp-secondary);
    font-weight: 600;
    background: rgba(20, 184, 166, .06);
}
.hp-tab-btn svg { width: 16px; height: 16px; flex-shrink: 0; opacity: .8; }
.hp-tab-btn.is-active svg { opacity: 1; color: var(--hp-secondary); }
.hp-tab-count {
    font-size: 11px; font-weight: 700;
    background: var(--hp-card-border);
    color: var(--hp-text-muted);
    padding: 1px 7px;
    border-radius: 999px;
    line-height: 1.4;
}
.hp-tab-btn.is-active .hp-tab-count {
    background: var(--hp-secondary);
    color: #FFFFFF;
}
/* Sparkle suffix for the AI/Scoring tab — second visible svg (kept after the label) */
.hp-tab-btn[data-tab-go="scoring"]::after {
    content: '';
    width: 12px; height: 12px;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232DA9A0' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'><path d='M12 3l1.5 4.5L18 9l-4.5 1.5L12 15l-1.5-4.5L6 9l4.5-1.5z'/></svg>");
    background-size: contain; background-repeat: no-repeat;
    opacity: .8;
}
.hp-tab-pane { display: none; animation: hp-fade-in .22s ease both; }
.hp-tab-pane.is-active { display: block; }

/* Section head with a primary action (used in dossier tabs) */
.hp-section-head {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 1rem; flex-wrap: wrap;
    margin-bottom: 1rem;
}
.hp-section-head .hp-section-title { margin-bottom: 0; }
.hp-section-head .hp-section-subtitle { margin-top: 4px; }

/* Consultation timeline (Clinique tab) */
.hp-consult-list { display: flex; flex-direction: column; gap: 1rem; }
.hp-consult-item {
    display: grid;
    grid-template-columns: 92px 1fr;
    gap: 1rem;
    padding: 1rem;
    border: 1px solid var(--hp-card-border);
    border-radius: 12px;
    background: #FAFCFD;
    transition: border-color .15s, box-shadow .15s;
}
.hp-consult-item:hover { border-color: var(--hp-secondary); box-shadow: 0 4px 12px rgba(15, 30, 55, .04); }
.hp-consult-date {
    text-align: center;
    border-right: 1px solid var(--hp-card-border);
    padding-right: 1rem;
}
.hp-consult-date-day {
    font-family: var(--hp-heading-font);
    font-size: 16px; font-weight: 700;
    color: var(--hp-primary);
    line-height: 1.1;
}
.hp-consult-date-year { font-size: 11px; color: var(--hp-text-muted); margin-top: 2px; }
.hp-consult-date-time {
    font-size: 11px; font-weight: 600;
    color: var(--hp-secondary);
    margin-top: .5rem;
    font-variant-numeric: tabular-nums;
}
.hp-consult-head {
    display: flex; justify-content: space-between; align-items: center;
    gap: .75rem; flex-wrap: wrap;
    margin-bottom: .75rem;
}
.hp-consult-motif { font-weight: 700; color: var(--hp-primary); font-size: 14px; }
.hp-consult-prac { font-size: 12px; color: var(--hp-text-muted); }
.hp-consult-block { margin-bottom: .65rem; font-size: 13.5px; line-height: 1.5; }
.hp-consult-block:last-child { margin-bottom: 0; }
.hp-consult-block .label-muted { margin-bottom: 2px; }

/* Imagerie card with Synapse-style preview pane */
.hp-img-card {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: stretch;
    gap: 1rem;
    padding: 1rem;
    border: 1px solid var(--hp-card-border);
    border-radius: 12px;
    background: #FFFFFF;
}
.hp-img-card-thumb {
    width: 64px;
    background: linear-gradient(135deg, #142850, #0f1f3a);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    color: rgba(255, 255, 255, .85);
}
/* Imagerie : preview + report two-column layout (matches the demo screenshot) */
.hp-img-detail {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) 1fr;
    gap: 1.25rem;
    margin-top: 1rem;
}
@media (max-width: 768px) {
    .hp-img-detail { grid-template-columns: 1fr; }
}

/* Larger Synapse-style preview pane for items flagged with a real preview */
.hp-img-preview {
    background: #0F1B2D;
    border-radius: 12px;
    color: #fff;
    aspect-ratio: 4 / 3;
    position: relative;
    overflow: hidden;
    display: flex; align-items: center; justify-content: center;
    font-family: var(--hp-heading-font);
    font-weight: 700;
    letter-spacing: .15em;
    border: 1px solid #1A2B47;
    margin-top: .75rem;
}
.hp-img-preview::before, .hp-img-preview::after {
    position: absolute; top: 12px;
    color: #4ADE80; font-weight: 800; font-size: 18px;
}
.hp-img-preview::before { content: 'R'; left: 14px; }
.hp-img-preview::after  { content: 'L'; right: 14px; }
.hp-img-preview .hp-img-preview-rec {
    position: absolute; top: 12px; right: 36px;
    width: 8px; height: 8px;
    background: #EF4444; border-radius: 50%;
}
.hp-img-preview-svg {
    width: 60%; opacity: .85; max-width: 360px;
}
.hp-ai-badge {
    display: inline-block;
    background: rgba(20, 184, 166, .12);
    color: #0E7C70;
    border: 1px solid rgba(20, 184, 166, .35);
    border-radius: 6px;
    padding: 2px 8px;
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    margin-left: .5rem;
}

/* Exposition row layout (mimicking demo) */
.hp-expo-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    align-items: center;
    gap: 1.5rem;
    padding: 1.25rem 0;
    border-bottom: 1px solid var(--hp-card-border);
}
.hp-expo-row:last-child { border-bottom: 0; }
.hp-expo-agent-name { font-family: var(--hp-heading-font); font-size: 1.1rem; font-weight: 700; color: var(--hp-primary); }
.hp-expo-agent-epi { font-size: 13px; color: var(--hp-text-muted); margin-top: 4px; }
.hp-expo-intensity-label { font-weight: 600; color: var(--hp-text-strong); margin-top: 6px; font-size: 13.5px; }
.hp-expo-duree-val {
    font-family: var(--hp-heading-font);
    font-size: 1.6rem; font-weight: 700;
    color: var(--hp-primary);
    margin-top: 4px;
}
.hp-expo-duree-val span { font-size: 14px; color: var(--hp-text-muted); margin-left: 4px; font-weight: 500; }
@media (max-width: 720px) {
    .hp-expo-row { grid-template-columns: 1fr; gap: .75rem; }
}

/* Intensité segmented bar (Exposition tab) */
.hp-intensity-bar {
    display: inline-flex; gap: 3px;
    margin-top: 4px;
}
.hp-intensity-seg {
    width: 22px; height: 6px;
    border-radius: 2px;
    background: #E5E7EB;
}
.hp-intensity-bar[data-level="1"] .hp-intensity-seg:nth-child(-n+1) { background: #FBBF24; }
.hp-intensity-bar[data-level="2"] .hp-intensity-seg:nth-child(-n+2) { background: #F59E0B; }
.hp-intensity-bar[data-level="3"] .hp-intensity-seg:nth-child(-n+3) { background: #F97316; }
.hp-intensity-bar[data-level="4"] .hp-intensity-seg                 { background: #DC2626; }

/* Documents tile grid (mini) — reused later by full library */
.hp-doc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: .75rem;
}
.hp-doc-tile {
    background: #FFFFFF;
    border: 1px solid var(--hp-card-border);
    border-radius: 12px;
    padding: 1rem .75rem;
    text-align: center;
    cursor: pointer;
    font-family: inherit;
    transition: transform .15s, border-color .15s, box-shadow .15s;
}
.hp-doc-tile:hover {
    transform: translateY(-2px);
    border-color: var(--hp-secondary);
    box-shadow: 0 8px 20px -10px rgba(15, 30, 55, .25);
}
.hp-doc-tile-icon {
    position: relative;
    color: var(--hp-secondary);
    margin-bottom: .5rem;
}
.hp-doc-tile-icon svg { display: block; margin: 0 auto; }
.hp-doc-tile-type {
    position: absolute;
    bottom: -2px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--hp-primary);
    color: #FFFFFF;
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: .04em;
    padding: 1px 6px;
    border-radius: 4px;
}
.hp-doc-tile-name {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--hp-primary);
    line-height: 1.3;
    margin-bottom: 4px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.hp-doc-tile-date { font-size: 11px; color: var(--hp-text-muted); }

/* Historique timeline */
.hp-timeline { position: relative; padding-left: 1.5rem; }
.hp-timeline::before {
    content: '';
    position: absolute; left: 6px; top: 0; bottom: 0;
    width: 2px; background: var(--hp-card-border);
}
.hp-timeline-month-head {
    font-size: 11px; font-weight: 700; letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--hp-text-muted);
    background: var(--hp-background);
    display: inline-block;
    padding: .25rem .5rem;
    margin-left: -1.5rem;
    margin-bottom: .5rem;
    position: relative; z-index: 1;
}
.hp-timeline-item {
    position: relative;
    display: grid;
    grid-template-columns: 80px 1fr;
    gap: .75rem;
    padding: .65rem 0;
    align-items: flex-start;
}
.hp-timeline-dot {
    position: absolute;
    left: -1.45rem;
    top: 1rem;
    width: 12px; height: 12px;
    border-radius: 50%;
    background: var(--hp-secondary);
    border: 2px solid var(--hp-background);
    z-index: 1;
}
.hp-timeline-item.is-cons .hp-timeline-dot  { background: var(--hp-secondary); }
.hp-timeline-item.is-exam .hp-timeline-dot  { background: #6366F1; }
.hp-timeline-item.is-decl .hp-timeline-dot  { background: #DC2626; }
.hp-timeline-item.is-apt  .hp-timeline-dot  { background: #059669; }
.hp-timeline-item.is-doc  .hp-timeline-dot  { background: #94A3B8; }
.hp-timeline-item.is-note .hp-timeline-dot  { background: #D97706; }
.hp-timeline-item.is-alrt .hp-timeline-dot  { background: #F97316; }
.hp-timeline-item.is-embch .hp-timeline-dot { background: var(--hp-primary); }
.hp-timeline-time {
    text-align: right;
    font-size: 11.5px;
    color: var(--hp-text-muted);
    line-height: 1.4;
    padding-top: 1px;
}
.hp-timeline-day { display: block; font-weight: 600; color: var(--hp-text-strong); }
.hp-timeline-hour { font-variant-numeric: tabular-nums; }
.hp-timeline-event { font-size: 13.5px; color: var(--hp-text-strong); line-height: 1.45; }
.hp-timeline-tag {
    display: inline-block;
    font-size: 10px; font-weight: 700;
    text-transform: uppercase; letter-spacing: .05em;
    padding: 1px 7px;
    border-radius: 999px;
    margin-right: .35rem;
    background: var(--hp-card-border);
    color: var(--hp-text-muted);
}
.hp-timeline-item.is-cons .hp-timeline-tag  { background: rgba(20, 184, 166, .15);  color: #0E7C70; }
.hp-timeline-item.is-exam .hp-timeline-tag  { background: rgba(99, 102, 241, .14);  color: #4F46E5; }
.hp-timeline-item.is-decl .hp-timeline-tag  { background: rgba(220, 38, 38, .14);   color: #B91C1C; }
.hp-timeline-item.is-apt  .hp-timeline-tag  { background: rgba(5, 150, 105, .14);   color: #047857; }
.hp-timeline-item.is-doc  .hp-timeline-tag  { background: rgba(148, 163, 184, .25); color: #475569; }
.hp-timeline-item.is-note .hp-timeline-tag  { background: rgba(217, 119, 6, .13);   color: #B45309; }
.hp-timeline-item.is-alrt .hp-timeline-tag  { background: rgba(249, 115, 22, .15);  color: #C2410C; }
.hp-timeline-item.is-embch .hp-timeline-tag { background: rgba(20, 40, 80, .12);    color: var(--hp-primary); }
.hp-timeline-user { font-size: 11.5px; color: var(--hp-text-muted); margin-top: 2px; }

/* CSS tooltip — [data-hp-tooltip] */
[data-hp-tooltip] { position: relative; }
[data-hp-tooltip]::after {
    content: attr(data-hp-tooltip);
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
    background: var(--hp-primary);
    color: #fff;
    font-size: 11.5px;
    font-family: var(--hp-font-body);
    font-weight: 500;
    padding: .25rem .55rem;
    border-radius: 6px;
    pointer-events: none;
    opacity: 0;
    transition: opacity .15s ease;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(20,40,80,.18);
}
[data-hp-tooltip]:hover::after { opacity: 1; }

/* User mention floating card */
#hp-user-card {
    position: fixed;
    z-index: 9999;
    width: 260px;
    background: #fff;
    border: 1px solid var(--hp-card-border);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(20,40,80,.13), 0 2px 8px rgba(20,40,80,.07);
    padding: 1rem 1.1rem 1rem;
    pointer-events: none;
    opacity: 0;
    transform: translateY(6px);
    transition: opacity .16s ease, transform .16s ease;
    font-family: var(--hp-font-body);
}
#hp-user-card.is-visible {
    opacity: 1;
    transform: translateY(0);
}
#hp-user-card .hpuc-header {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin-bottom: .75rem;
    padding-bottom: .75rem;
    border-bottom: 1px solid var(--hp-card-border);
}
#hp-user-card .hpuc-avatar {
    width: 40px; height: 40px; flex-shrink: 0;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--hp-primary), var(--hp-accent));
    color: #fff;
    display: grid; place-items: center;
    font-weight: 700; font-size: 14px;
    letter-spacing: .02em;
}
#hp-user-card .hpuc-name {
    font-size: 13.5px;
    font-weight: 700;
    color: var(--hp-primary);
    line-height: 1.2;
}
#hp-user-card .hpuc-username {
    font-size: 11.5px;
    color: var(--hp-text-muted);
    margin-top: 1px;
}
#hp-user-card .hpuc-row {
    display: flex;
    align-items: flex-start;
    gap: .5rem;
    font-size: 12px;
    color: #374151;
    margin-bottom: .4rem;
    line-height: 1.35;
}
#hp-user-card .hpuc-row:last-child { margin-bottom: 0; }
#hp-user-card .hpuc-icon {
    width: 16px; height: 16px; flex-shrink: 0;
    color: var(--hp-text-muted);
    margin-top: 1px;
}
#hp-user-card .hpuc-label {
    font-size: 10.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--hp-text-muted);
    margin-bottom: .05rem;
}
#hp-user-card .hpuc-val {
    color: #1E293B;
}

/* Scoring tab — extended IA layout */
.hp-ai-card {
    background: linear-gradient(135deg, var(--hp-primary), #1c365f);
    color: #FFFFFF;
    border: 0;
    border-radius: 14px;
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
}
.hp-ai-card::after {
    content: '';
    position: absolute; right: -40px; top: -40px;
    width: 180px; height: 180px;
    background: radial-gradient(circle, rgba(20, 184, 166, .35), transparent 70%);
    pointer-events: none;
}
.hp-ai-card-kicker {
    font-size: 10.5px; letter-spacing: .1em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, .7);
    font-weight: 700;
}
.hp-ai-card-score {
    font-family: var(--hp-heading-font);
    font-size: 2.4rem; font-weight: 700;
    margin-top: .25rem; line-height: 1;
}
.hp-ai-card-meta { font-size: 13px; color: rgba(255, 255, 255, .8); margin-top: .35rem; }
.hp-ai-card-bar {
    height: 8px; border-radius: 4px;
    background: rgba(255, 255, 255, .15);
    margin-top: 1rem; overflow: hidden;
}
.hp-ai-card-bar-fill {
    height: 100%; border-radius: 4px;
    background: linear-gradient(90deg, var(--hp-secondary), #4ADE80);
}
.hp-ai-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-top: 1.25rem;
}
.hp-ai-block {
    background: #FFFFFF;
    border: 1px solid var(--hp-card-border);
    border-radius: 12px;
    padding: 1rem;
}
.hp-ai-block h4 {
    margin: 0 0 .65rem;
    font-size: 13px; font-weight: 700;
    color: var(--hp-primary);
}
.hp-ai-factor {
    display: flex; justify-content: space-between; align-items: center;
    padding: .35rem 0;
    border-bottom: 1px solid var(--hp-card-border);
    font-size: 13px;
}
.hp-ai-factor:last-child { border-bottom: 0; }
.hp-ai-factor-weight {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--hp-text-muted);
}
.hp-ai-factor-weight.is-high { color: var(--hp-danger); }
.hp-ai-factor-weight.is-med { color: var(--hp-warning); }
.hp-ai-recos { margin: 0; padding-left: 1.1rem; font-size: 13px; line-height: 1.6; color: var(--hp-text-strong); }
.hp-ai-recos li { margin-bottom: .35rem; }

.hp-stat-tile {
    background: #fff;
    border: 1px solid var(--hp-card-border);
    border-radius: 10px;
    padding: .75rem 1rem;
}
.hp-stat-tile .label-muted { font-size: 10px; }
.hp-stat-tile .v {
    font-family: var(--hp-heading-font);
    font-size: 1.4rem;
    color: var(--hp-primary);
    font-weight: 600;
    line-height: 1.1;
    margin-top: 2px;
}

/* ==========================================================================
   Searchable select (Select2-style, vanilla)
   ========================================================================== */
.hp-ss { position: relative; }
.hp-ss-toggle {
    width: 100%;
    text-align: left;
    background: #fff;
    border: 1px solid var(--hp-card-border);
    border-radius: 9px;
    padding: .55rem .85rem;
    font-size: 13.5px;
    font-family: inherit;
    color: #0F172A;
    cursor: pointer;
    display: flex; align-items: center; gap: .5rem;
    min-height: 38px;
}
.hp-ss-toggle:focus, .hp-ss.is-open .hp-ss-toggle {
    outline: 0;
    border-color: var(--hp-accent);
    box-shadow: 0 0 0 3px rgba(26, 143, 184, .12);
}
.hp-ss-value { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hp-ss-placeholder { color: var(--hp-text-muted); }
.hp-ss-caret {
    width: 12px; height: 12px;
    color: var(--hp-text-muted);
    flex-shrink: 0;
    transition: transform .15s ease;
}
.hp-ss.is-open .hp-ss-caret { transform: rotate(180deg); }
.hp-ss-clear {
    background: transparent; border: 0; padding: 0;
    color: var(--hp-text-muted); cursor: pointer;
    line-height: 1; font-size: 14px;
}
.hp-ss-clear:hover { color: var(--hp-danger); }
.hp-ss-panel {
    position: fixed;
    top: 0; left: 0;
    width: var(--hp-ss-width, 240px);
    background: #fff;
    border: 1px solid var(--hp-card-border);
    border-radius: 9px;
    box-shadow: 0 18px 40px -10px rgba(20, 40, 80, .25);
    /* Must be above .hp-modal-backdrop (9998) and the confirm modal (9998) */
    z-index: 10000;
    display: none;
    max-height: 280px;
    overflow: hidden;
    flex-direction: column;
}
.hp-ss.is-open .hp-ss-panel { display: flex; }
.hp-ss-search {
    border: 0;
    border-bottom: 1px solid var(--hp-card-border);
    padding: .55rem .85rem;
    font-size: 13px;
    outline: none;
    background: #FCFDFE;
    width: 100%;
    box-sizing: border-box;
}
.hp-ss-list {
    overflow-y: auto;
    flex: 1;
    padding: .25rem;
}
.hp-ss-option {
    padding: .5rem .65rem;
    border-radius: 6px;
    font-size: 13px;
    color: #1F2937;
    cursor: pointer;
}
.hp-ss-option:hover, .hp-ss-option.is-focused { background: rgba(45, 169, 160, .1); color: var(--hp-primary); }
.hp-ss-option.is-selected { background: rgba(45, 169, 160, .18); color: var(--hp-primary); font-weight: 600; }
.hp-ss-empty { padding: 1rem; text-align: center; font-size: 13px; color: var(--hp-text-muted); }

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}
.form-check {
    display: inline-flex; align-items: center; gap: .5rem;
    font-size: 13px; color: var(--hp-text-muted);
    cursor: pointer;
}
.form-check input { accent-color: var(--hp-secondary); }

/* ==========================================================================
   Data table component (partials/data-table.blade.php)
   ========================================================================== */

.hp-table-wrap {
    background: #fff;
    border: 1px solid var(--hp-card-border);
    border-radius: 14px;
    box-shadow: 0 1px 0 rgba(20, 40, 80, .02), 0 12px 28px -22px rgba(20, 40, 80, .15);
    overflow: hidden;
}
.hp-table-toolbar {
    padding: 1rem 1.1rem;
    display: flex; align-items: center; gap: .75rem;
    flex-wrap: wrap;
    border-bottom: 1px solid var(--hp-card-border);
    background: #FCFDFE;
}
.hp-table-search {
    position: relative;
    flex: 1;
    min-width: 220px;
    max-width: 360px;
}
.hp-table-search input {
    width: 100%;
    padding: .5rem .85rem .5rem 2.1rem;
    border: 1px solid var(--hp-card-border);
    border-radius: 8px;
    font-size: 13px;
    background: #fff;
    outline: none;
}
.hp-table-search input:focus { border-color: var(--hp-accent); box-shadow: 0 0 0 3px rgba(26,143,184,.12); }
.hp-table-search svg {
    position: absolute; left: .65rem; top: 50%;
    transform: translateY(-50%); width: 14px; height: 14px;
    color: var(--hp-text-muted);
}
.hp-pill-group { display: inline-flex; align-items: center; gap: .35rem; flex-wrap: wrap; }
.hp-pill {
    background: #fff;
    border: 1px solid var(--hp-card-border);
    color: var(--hp-text-muted);
    border-radius: 999px;
    padding: .3rem .75rem;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: border-color .15s ease, color .15s ease, background .15s ease;
}
.hp-pill:hover { border-color: var(--hp-secondary); color: var(--hp-primary); }
.hp-pill.is-active {
    background: var(--hp-primary);
    color: #fff;
    border-color: var(--hp-primary);
}
.hp-pill-count {
    margin-left: .35rem;
    font-size: 11px;
    color: rgba(255,255,255,.7);
}
.hp-pill:not(.is-active) .hp-pill-count { color: var(--hp-text-muted); }

.hp-table-spacer { flex: 1; }
.hp-table-meta {
    color: var(--hp-text-muted);
    font-size: 12px;
}

.hp-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}
.hp-table thead th {
    text-align: left;
    padding: .75rem 1rem;
    background: #FCFDFE;
    color: var(--hp-text-muted);
    font-weight: 600;
    font-size: 11px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    border-bottom: 1px solid var(--hp-card-border);
    user-select: none;
}
.hp-table thead th[data-sortable] { cursor: pointer; }
.hp-table thead th[data-sortable]:hover { color: var(--hp-primary); }
.hp-table thead th .hp-sort-arrow {
    display: inline-block;
    margin-left: .35rem;
    opacity: .35;
    font-size: 10px;
    transition: opacity .15s ease;
}
.hp-table thead th.is-sorted-asc .hp-sort-arrow,
.hp-table thead th.is-sorted-desc .hp-sort-arrow { opacity: 1; color: var(--hp-secondary); }

.hp-table tbody td {
    padding: .85rem 1rem;
    border-bottom: 1px solid var(--hp-card-border);
    color: #1F2937;
    vertical-align: middle;
}
.hp-table tbody tr:last-child td { border-bottom: 0; }
.hp-table tbody tr { transition: background .12s ease; }
.hp-table tbody tr:hover { background: rgba(45, 169, 160, .04); }
.hp-table tbody tr.is-clickable { cursor: pointer; }

.hp-cell-primary { font-weight: 600; color: var(--hp-primary); }
.hp-cell-secondary {
    font-size: 12px;
    color: var(--hp-text-muted);
    margin-top: 2px;
}
.hp-chips { display: inline-flex; flex-wrap: wrap; gap: .3rem; }
.hp-chip {
    background: rgba(45, 169, 160, .1);
    color: var(--hp-secondary);
    border: 1px solid rgba(45, 169, 160, .25);
    padding: .15rem .5rem;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 500;
}
.hp-chip-amber { background: rgba(217, 119, 6, .1);  color: var(--hp-warning); border-color: rgba(217, 119, 6, .25); }
.hp-chip-red   { background: rgba(220, 38, 38, .08); color: var(--hp-danger);  border-color: rgba(220, 38, 38, .22); }
.hp-chip-slate { background: rgba(100, 116, 139, .1); color: var(--hp-text-muted); border-color: rgba(100,116,139,.22); }

.hp-row-actions {
    display: inline-flex; gap: .25rem;
    justify-content: flex-end;
    align-items: center;
    white-space: nowrap;
}
.hp-row-actions .hp-icon-btn {
    width: 28px; height: 28px;
    border-color: transparent;
    background: transparent;
    color: var(--hp-text-muted);
}
.hp-row-actions .hp-icon-btn:hover {
    background: #F1F5F8;
    color: var(--hp-primary);
    border-color: var(--hp-card-border);
}
.hp-row-actions .hp-icon-btn.is-danger:hover {
    background: rgba(220, 38, 38, .08);
    color: var(--hp-danger);
    border-color: rgba(220, 38, 38, .25);
}
.hp-row-actions .hp-icon-btn svg { width: 14px; height: 14px; }

.hp-table-empty {
    padding: 3rem 1.5rem;
    text-align: center;
    color: var(--hp-text-muted);
    font-size: 14px;
}

.hp-table-footer {
    padding: .75rem 1.1rem;
    border-top: 1px solid var(--hp-card-border);
    display: flex; justify-content: space-between; align-items: center;
    gap: 1rem; flex-wrap: wrap;
    background: #FCFDFE;
    font-size: 12px;
    color: var(--hp-text-muted);
}
.hp-table-footer .hp-icon-btn { width: 30px; height: 30px; }
.hp-table-footer .hp-icon-btn[disabled] { opacity: .35; cursor: not-allowed; }
.hp-table-page-size {
    border: 1px solid var(--hp-card-border);
    background: #fff;
    border-radius: 7px;
    padding: .25rem .45rem;
    font-size: 12px;
    color: var(--hp-primary);
    font-weight: 600;
    cursor: pointer;
}
.hp-table-page-size:focus { outline: none; border-color: var(--hp-secondary); }

/* ==========================================================================
   Page header (used by every authenticated page above its main card)
   ========================================================================== */
.hp-page-header {
    display: flex; justify-content: space-between; align-items: flex-end;
    gap: 1rem; margin-bottom: 1.5rem; flex-wrap: wrap;
}
.hp-page-header h1 { margin: 0; }
.hp-page-header-actions {
    display: inline-flex; align-items: center; gap: .5rem;
    flex-wrap: wrap; justify-content: flex-end;
}
.hp-page-header-actions .btn-ghost {
    color: var(--hp-text-muted);
}
.hp-page-header-actions .btn-ghost:hover {
    color: var(--hp-primary);
    background: #F1F5F8;
}
@media print {
    .hp-sidebar, .hp-topbar, .hp-page-header-actions, .hp-row-actions, .hp-table-toolbar, .hp-table-footer { display: none !important; }
    .hp-app, .hp-content { display: block !important; }
}
.hp-page-header .hp-page-kicker {
    text-transform: uppercase;
    font-size: 11px;
    color: var(--hp-text-muted);
    letter-spacing: 0.06em;
    font-weight: 600;
    margin-bottom: 4px;
}
.hp-page-header .hp-page-subtitle {
    color: var(--hp-text-muted);
    margin-top: .25rem;
    font-size: 14px;
}

/* ==========================================================================
   KPI cards
   ========================================================================== */
.hp-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-bottom: 1.25rem;
}
.hp-kpi {
    background: #fff;
    border: 1px solid var(--hp-card-border);
    border-radius: 14px;
    padding: 1.1rem 1.25rem;
    box-shadow: 0 1px 0 rgba(20, 40, 80, .02), 0 12px 28px -22px rgba(20, 40, 80, .12);
    position: relative;
    overflow: hidden;
}
.hp-kpi::before {
    content: "";
    position: absolute; top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--hp-secondary);
}
.hp-kpi.is-danger::before  { background: var(--hp-danger); }
.hp-kpi.is-warning::before { background: var(--hp-warning); }
.hp-kpi.is-accent::before  { background: var(--hp-accent); }
.hp-kpi-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--hp-text-muted);
    font-weight: 600;
}
.hp-kpi-value {
    font-family: var(--hp-heading-font);
    font-size: 2rem;
    color: var(--hp-primary);
    margin: .35rem 0 .15rem;
    font-weight: 600;
}
.hp-kpi-caption {
    font-size: 12px;
    color: var(--hp-text-muted);
}

/* ==========================================================================
   Charts
   ========================================================================== */
.hp-charts-grid {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 1.25rem;
    margin-bottom: 1.25rem;
}
.hp-charts-grid .card { margin: 0; }
@media (max-width: 1100px) {
    .hp-charts-grid { grid-template-columns: 1fr; }
}
.hp-chart-frame {
    position: relative;
    width: 100%;
}
.hp-chart-frame canvas { max-width: 100%; }
.hp-chart-toggles {
    display: inline-flex; flex-wrap: wrap; gap: .35rem;
    align-items: center;
}
.hp-chart-toggle {
    background: #fff;
    border: 1px solid var(--hp-card-border);
    border-radius: 999px;
    padding: .25rem .65rem .25rem .55rem;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--hp-text-muted);
    cursor: pointer;
    display: inline-flex; align-items: center; gap: .35rem;
    line-height: 1.2;
}
.hp-chart-toggle .dot {
    width: 8px; height: 8px; border-radius: 50%; display: inline-block;
}
.hp-chart-toggle.is-off { opacity: .35; text-decoration: line-through; }
.hp-chart-toggle:hover { border-color: var(--hp-secondary); }

/* Switch toggle (slider) */
.hp-switch {
    position: relative;
    display: inline-flex; align-items: center; gap: .55rem;
    cursor: pointer;
    font-size: 12.5px;
    color: var(--hp-text-muted);
    user-select: none;
}
.hp-switch input { display: none; }
.hp-switch-track {
    width: 32px; height: 18px;
    background: #E2E8F0;
    border-radius: 999px;
    position: relative;
    transition: background .15s ease;
}
.hp-switch-track::after {
    content: "";
    position: absolute;
    top: 2px; left: 2px;
    width: 14px; height: 14px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0,0,0,.2);
    transition: transform .15s ease;
}
.hp-switch input:checked + .hp-switch-track { background: var(--hp-secondary); }
.hp-switch input:checked + .hp-switch-track::after { transform: translateX(14px); }

/* ==========================================================================
   Badges
   ========================================================================== */

.badge {
    display: inline-flex; align-items: center;
    padding: .2rem .55rem;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.02em;
    line-height: 1.4;
}
.badge-urgent       { background: rgba(220, 38, 38, .1);  color: var(--hp-danger); }
.badge-a-surveiller { background: rgba(217, 119, 6, .12); color: var(--hp-warning); }
.badge-suivi-actif  { background: rgba(45, 169, 160, .12); color: var(--hp-secondary); }
.badge-archive      { background: rgba(100, 116, 139, .15); color: var(--hp-text-muted); }

/* ==========================================================================
   Toasts
   ========================================================================== */

.hp-toast-container {
    position: fixed;
    top: 1rem; right: 1rem;
    z-index: 10000;
    display: flex; flex-direction: column; gap: .5rem;
    max-width: 360px;
}
.hp-toast {
    background: #fff;
    border: 1px solid var(--hp-card-border);
    border-left: 3px solid var(--hp-secondary);
    border-radius: 10px;
    padding: .75rem 1rem;
    box-shadow: 0 14px 30px -18px rgba(20, 40, 80, .35);
    font-size: 13.5px;
    color: #0F172A;
    animation: hp-toast-in .25s ease;
}
.hp-toast.is-success { border-left-color: var(--hp-success); }
.hp-toast.is-error   { border-left-color: var(--hp-danger);  }
.hp-toast.is-warning { border-left-color: var(--hp-warning); }
@keyframes hp-toast-in {
    from { opacity: 0; transform: translateX(15px); }
    to   { opacity: 1; transform: translateX(0); }
}

/* ==========================================================================
   Modal (confirm)
   ========================================================================== */

.hp-modal-backdrop {
    position: fixed; inset: 0;
    background: rgba(15, 23, 42, .35);
    display: none;
    align-items: center; justify-content: center;
    z-index: 9998;
    animation: hp-fade-in .12s ease;
}
.hp-modal-backdrop.is-open { display: flex; }
.hp-modal {
    background: #fff;
    border-radius: 14px;
    width: 100%;
    max-width: 440px;
    margin: 1rem;
    box-shadow: 0 30px 60px -25px rgba(15, 23, 42, .5);
    overflow: hidden;
}
.hp-modal-header { padding: 1.1rem 1.25rem .25rem; }
.hp-modal-body   { padding: .25rem 1.25rem 1.1rem; color: var(--hp-text-muted); font-size: 14px; }
.hp-modal-footer {
    padding: .85rem 1.25rem;
    border-top: 1px solid var(--hp-card-border);
    background: #FAFCFD;
    display: flex; justify-content: flex-end; gap: .5rem;
}

/* Documents library — tile grid + slide-in viewer */
.hp-doc-library {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
}
.hp-doc-card {
    background: var(--hp-card-bg);
    border: 1px solid var(--hp-card-border);
    border-radius: 14px;
    padding: 0;
    overflow: hidden;
    text-align: left;
    cursor: pointer;
    font-family: inherit;
    color: inherit;
    transition: transform .15s, box-shadow .15s, border-color .15s;
    display: flex; flex-direction: column;
}
.hp-doc-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 26px -16px rgba(15, 30, 55, .25);
    border-color: var(--hp-secondary);
}
.hp-doc-card-thumb {
    aspect-ratio: 4 / 3;
    background: #F1F5F8;
    color: var(--hp-secondary);
    display: flex; align-items: center; justify-content: center;
    position: relative;
    overflow: hidden;
}
.hp-doc-card-thumb.is-pdf {
    background: linear-gradient(135deg, #FEF2F2, #FEE2E2);
    color: #DC2626;
}
.hp-doc-card-thumb.is-image {
    background: #0F1B2D;
    padding: 0;
}
.hp-doc-card-thumb img {
    width: 100%; height: 100%; object-fit: cover; display: block;
}
.hp-doc-card-badge {
    position: absolute;
    top: 8px; right: 8px;
    background: rgba(20, 40, 80, .85);
    color: #FFFFFF;
    font-size: 10px; font-weight: 700; letter-spacing: .04em;
    padding: 2px 7px;
    border-radius: 4px;
}
.hp-doc-card-thumb.is-pdf .hp-doc-card-badge { background: #DC2626; }
.hp-doc-card-body {
    padding: .85rem 1rem 1rem;
    display: flex; flex-direction: column; gap: .4rem;
    flex: 1;
}
.hp-doc-card-name {
    font-weight: 700;
    color: var(--hp-primary);
    font-size: 13.5px;
    line-height: 1.35;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.hp-doc-card-meta {
    display: flex; align-items: center; gap: .5rem;
    font-size: 11.5px;
    color: var(--hp-text-muted);
    margin-top: 2px;
}
.hp-doc-card-size { font-variant-numeric: tabular-nums; }
.hp-doc-card-foot {
    display: flex; justify-content: space-between; align-items: center;
    margin-top: auto;
    padding-top: .35rem;
    border-top: 1px dashed var(--hp-card-border);
    font-size: 11px;
    color: var(--hp-text-muted);
}

/* Document/Image viewer (rendered inside hp-modal-shell, size=sheet) */
.hp-viewer { display: flex; flex-direction: column; height: 100%; padding: 0 !important; }
.hp-viewer-meta {
    padding: .65rem 1.25rem;
    color: var(--hp-text-muted);
    font-size: 12.5px;
    border-bottom: 1px solid var(--hp-card-border);
    background: #FAFCFD;
}
.hp-viewer-stage {
    flex: 1;
    background: #1F2937;
    overflow: auto;
    display: flex; align-items: center; justify-content: center;
    min-height: 60vh;
}
.hp-viewer-stage.is-pdf iframe {
    width: 100%; height: 100%;
    border: 0;
    background: #FFFFFF;
}
.hp-viewer-stage.is-image img {
    max-width: 100%; max-height: 100%;
    display: block;
}
.hp-viewer-toolbar {
    padding: .85rem 1.25rem;
    border-top: 1px solid var(--hp-card-border);
    background: #FAFCFD;
    display: flex; gap: .5rem; justify-content: flex-end;
}
.hp-modal-shell-body:has(.hp-viewer) > * { padding: 0; }

/* Split viewer — left info pane + right stage. Used when the trigger
   provides structured `data-viewer-info` (JSON array of {label, value}). */
.hp-viewer--split {
    flex-direction: row;
    align-items: stretch;
}
.hp-viewer-info {
    flex: 0 0 280px;
    background: #FAFCFD;
    border-right: 1px solid var(--hp-card-border);
    padding: 1rem 1.1rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: .75rem;
}
.hp-viewer-info-row { display: flex; flex-direction: column; gap: 2px; }
.hp-viewer-info-label {
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--hp-text-muted);
}
.hp-viewer-info-value {
    font-size: 13px;
    color: var(--hp-primary);
    word-break: break-word;
}
.hp-viewer-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}
@media (max-width: 768px) {
    .hp-viewer--split { flex-direction: column; }
    .hp-viewer-info { flex: 0 0 auto; max-height: 35vh; border-right: 0; border-bottom: 1px solid var(--hp-card-border); }
}

/* Tableaux MP — index card grid + slide-in detail */
.hp-mp-toolbar {
    display: flex; align-items: center; flex-wrap: wrap; gap: .75rem 1rem;
    padding: .85rem 1rem;
    background: var(--hp-card-bg);
    border: 1px solid var(--hp-card-border);
    border-radius: 16px;
    box-shadow: var(--hp-card-shadow);
    margin-bottom: 1rem;
}
.hp-mp-search {
    display: flex; align-items: center; gap: .45rem;
    padding: .42rem .65rem;
    border: 1px solid var(--hp-card-border);
    border-radius: 10px;
    background: #FAFCFD;
    flex: 1; min-width: 240px;
    transition: border-color .15s, background-color .15s;
}
.hp-mp-search:focus-within { border-color: var(--hp-secondary); background: #FFFFFF; }
.hp-mp-search svg { color: var(--hp-text-muted); flex-shrink: 0; width: 16px; height: 16px; }
.hp-mp-search input { border: 0; outline: 0; background: transparent; flex: 1; min-width: 0; font-size: 13.5px; color: var(--hp-text-strong); font-family: inherit; }

.hp-mp-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
    gap: 1rem;
}
.hp-mp-card {
    position: relative;
    text-decoration: none;
    color: inherit;
    transition: transform .15s, box-shadow .15s, border-color .15s;
    cursor: pointer;
    overflow: hidden;
}
.hp-mp-card-link {
    position: absolute;
    inset: 0;
    z-index: 1;
}
.hp-mp-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 28px -16px rgba(15, 30, 55, .25);
    border-color: var(--hp-secondary);
}
.hp-mp-card-head {
    display: flex; align-items: center; gap: .65rem;
    margin-bottom: .65rem;
}
.hp-mp-card-icon {
    width: 38px; height: 38px;
    border-radius: 10px;
    background: linear-gradient(135deg, rgba(20, 184, 166, .12), rgba(99, 102, 241, .12));
    display: inline-flex; align-items: center; justify-content: center;
    color: var(--hp-secondary);
}
.hp-mp-card-icon svg { width: 20px; height: 20px; }
.hp-mp-card-num { flex: 1; }
.hp-mp-card-num-val {
    font-family: var(--hp-heading-font);
    font-size: 1.6rem; font-weight: 700;
    color: var(--hp-primary);
    line-height: 1;
}
.hp-mp-card-num-suf { font-size: .8rem; color: var(--hp-secondary); margin-left: 4px; }
.hp-mp-card-delai {
    align-self: flex-start;
    background: rgba(99, 102, 241, .1);
    color: #4F46E5;
    border-color: rgba(99, 102, 241, .2);
}
.hp-mp-card-edit {
    position: absolute;
    top: .55rem;
    right: .55rem;
    z-index: 2;
    width: 28px; height: 28px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 6px;
    border: 1px solid var(--hp-card-border);
    background: #FFFFFF;
    color: var(--hp-text-muted);
    cursor: pointer;
    transition: all .15s ease;
    opacity: 0;
}
.hp-mp-card:hover .hp-mp-card-edit { opacity: 1; }
.hp-mp-card-edit:hover {
    color: var(--hp-secondary);
    border-color: var(--hp-secondary);
}
.hp-mp-card-title {
    font-weight: 700;
    color: var(--hp-primary);
    font-size: 14.5px;
    line-height: 1.35;
    margin-bottom: .25rem;
}
.hp-mp-card-cat {
    font-size: 11.5px;
    color: var(--hp-text-muted);
    text-transform: uppercase;
    letter-spacing: .04em;
    font-weight: 600;
}
.hp-mp-card-paths {
    margin: .35rem 0 0;
    padding-left: 1rem;
    color: var(--hp-text-muted);
    font-size: 13px;
    line-height: 1.55;
}
.hp-mp-empty {
    padding: 3rem;
    text-align: center;
    color: var(--hp-text-muted);
    background: var(--hp-card-bg);
    border: 1px dashed var(--hp-card-border);
    border-radius: 14px;
}

/* MP detail layout */
.hp-mp-detail { display: flex; flex-direction: column; gap: 1rem; }
.hp-mp-detail-headline {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}
.hp-mp-detail-delai {
    font-family: var(--hp-heading-font);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--hp-primary);
    margin-top: .25rem;
}
.hp-mp-detail-list {
    margin: .5rem 0 0;
    padding-left: 1.1rem;
    color: var(--hp-text-strong);
    font-size: 14px;
    line-height: 1.65;
}
.hp-mp-detail-list li { padding: 2px 0; }

/* Reusable modal shell (HP.modal.open) — supports center modal + right side-sheet */
.hp-modal-shell[hidden] { display: none !important; }
.hp-modal-shell .hp-modal-flex {
    display: flex; flex-direction: column;
    max-height: calc(100vh - 2rem);
}
.hp-modal-shell-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--hp-card-border);
}
.hp-modal-shell-header h3 {
    margin: 0;
    font-size: 16px; font-weight: 700;
    color: var(--hp-primary);
}
.hp-modal-close { width: 30px; height: 30px; }
.hp-modal-shell-body {
    padding: 0;
    overflow-y: auto;
    color: var(--hp-text-strong);
    font-size: 14px;
    flex: 1;
}
.hp-modal-shell-body > * { padding: 1rem 1.25rem; }
.hp-modal-shell-body .card { box-shadow: none; border: 0; border-radius: 0; }
.hp-modal-shell-body .card + .card { border-top: 1px solid var(--hp-card-border); }
.hp-modal-shell-body .hp-page-header { display: none; } /* hide page header inside modal */
.hp-modal-shell-body .hp-stepper { padding-top: 1rem; }
.hp-modal-loading {
    text-align: center; padding: 2rem;
    color: var(--hp-text-muted);
    font-style: italic;
}

/* Size variants */
.hp-modal-shell[data-size="md"] .hp-modal-flex   { max-width: 560px; }
.hp-modal-shell[data-size="lg"] .hp-modal-flex   { max-width: 820px; }
.hp-modal-shell[data-size="xl"] .hp-modal-flex   { max-width: 1080px; }

/* Right-edge side-sheet variant */
.hp-modal-shell[data-size="sheet"] {
    align-items: stretch;
    justify-content: flex-end;
}
.hp-modal-shell[data-size="sheet"] .hp-modal-flex {
    width: 100%;
    max-width: 720px;
    height: 100vh;
    max-height: 100vh;
    margin: 0;
    border-radius: 0;
    animation: hp-sheet-in .25s ease;
}
@keyframes hp-sheet-in {
    from { transform: translateX(40px); opacity: 0; }
    to   { transform: translateX(0);    opacity: 1; }
}

/* ==========================================================================
   Agenda — toolbar, calendar grid, kanban
   ========================================================================== */

.hp-agenda-toolbar {
    display: flex; align-items: center; flex-wrap: wrap; gap: .75rem 1rem;
    padding: .85rem 1rem;
    background: var(--hp-card-bg);
    border: 1px solid var(--hp-card-border);
    border-radius: 16px;
    box-shadow: var(--hp-card-shadow);
    margin-bottom: 1rem;
}
.hp-agenda-views {
    display: inline-flex;
    background: #F1F5F8;
    border-radius: 999px;
    padding: 4px;
    gap: 2px;
}
.hp-agenda-view-btn {
    display: inline-flex; align-items: center; gap: .35rem;
    padding: .42rem .85rem;
    border-radius: 999px;
    font-size: 13px; font-weight: 600;
    color: var(--hp-text-muted);
    text-decoration: none;
    transition: background-color .15s, color .15s;
}
.hp-agenda-view-btn:hover { color: var(--hp-primary); }
.hp-agenda-view-btn.is-active {
    background: #FFFFFF;
    color: var(--hp-primary);
    box-shadow: 0 1px 2px rgba(15, 30, 55, .08);
}
.hp-agenda-periods { display: inline-flex; gap: .35rem; flex-wrap: wrap; }
.hp-agenda-nav {
    display: inline-flex; align-items: center; gap: .5rem;
    margin-left: auto;
}
.hp-agenda-heading {
    font-weight: 700; color: var(--hp-text-strong);
    margin-left: .25rem;
    min-width: 9rem;
    text-transform: capitalize;
}
.hp-pill.is-ghost {
    background: transparent;
    color: var(--hp-text-muted);
}
.hp-agenda-jump {
    display: inline-flex; gap: .35rem;
}
.hp-agenda-jump select {
    border: 1px solid var(--hp-card-border);
    background: #FFFFFF;
    border-radius: 10px;
    padding: .42rem .65rem;
    font-size: 13px;
    color: var(--hp-text-strong);
}

.hp-agenda-card { padding: 0; overflow: hidden; }
.hp-cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background: #ECF1F4;
    gap: 1px;
}
.hp-cal-weekday {
    background: #F8FAFC;
    text-align: center;
    padding: .55rem .25rem;
    font-size: 12px; font-weight: 700; letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--hp-text-muted);
}
.hp-cal-cell {
    background: #FFFFFF;
    min-height: 122px;
    padding: .4rem .45rem;
    display: flex; flex-direction: column; gap: .35rem;
    transition: background-color .15s;
}
.hp-cal-cell.is-out { background: #FAFCFD; }
.hp-cal-cell.is-out .hp-cal-day-num { color: #B6C2CB; }
.hp-cal-cell.is-today { background: rgba(20, 184, 166, .08); }
.hp-cal-day {
    display: flex; align-items: center; justify-content: space-between;
}
.hp-cal-day-num {
    width: 24px; height: 24px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 12.5px; font-weight: 700;
    color: var(--hp-text-strong);
    border-radius: 50%;
}
.hp-cal-cell.is-today .hp-cal-day-num {
    background: var(--hp-secondary);
    color: #FFFFFF;
}
.hp-cal-day-count {
    font-size: 10.5px; font-weight: 600;
    color: var(--hp-text-muted);
    background: #ECF1F4;
    border-radius: 999px;
    padding: 1px 7px;
}
.hp-cal-events { display: flex; flex-direction: column; gap: 3px; max-height: 86px; overflow: hidden; }
.hp-cal-event {
    display: flex; align-items: center; gap: .35rem;
    padding: 3px 6px;
    border-radius: 6px;
    font-size: 11.5px;
    text-decoration: none;
    background: rgba(20, 184, 166, .12);
    color: #0E7C70;
    border-left: 3px solid var(--hp-secondary);
    overflow: hidden;
}
.hp-cal-event:hover { filter: brightness(.97); }
.hp-cal-event.is-dragging { opacity: .35; }
.hp-cal-cell.is-drop {
    outline: 2px dashed var(--hp-secondary);
    outline-offset: -3px;
    background: rgba(20, 184, 166, .08);
}
.hp-kanban-card.is-dragging { opacity: .35; }
.hp-kanban-col-body.is-drop {
    background: rgba(20, 184, 166, .08);
    outline: 2px dashed var(--hp-secondary);
    outline-offset: -4px;
    border-radius: 10px;
}
.hp-cal-event.is-confirme { background: rgba(20, 184, 166, .14); color: #0E7C70; border-left-color: var(--hp-secondary); }
.hp-cal-event.is-realise  { background: rgba(99, 102, 241, .12); color: #4F46E5; border-left-color: #6366F1; }
.hp-cal-event.is-annule   { background: rgba(148, 163, 184, .18); color: #475569; border-left-color: #94A3B8; }
.hp-cal-event.is-absent   { background: rgba(244, 63, 94, .12); color: #BE123C; border-left-color: #F43F5E; }
.hp-cal-event-time { font-weight: 700; font-variant-numeric: tabular-nums; }
.hp-cal-event-label {
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Day & Week views — hourly rail */
.hp-day-head {
    display: flex; justify-content: space-between; align-items: center;
    padding: .85rem 1rem;
    background: #FAFCFD;
    border-bottom: 1px solid var(--hp-card-border);
}
.hp-day-head-label {
    font-family: var(--hp-heading-font);
    font-size: 1.1rem; font-weight: 700; color: var(--hp-primary);
    text-transform: capitalize;
}
.hp-day-head-count { font-size: 12.5px; color: var(--hp-text-muted); font-weight: 600; }
.hp-day-body {
    display: grid; grid-template-columns: 64px 1fr;
    height: 780px; overflow: auto;
    position: relative;
}
.hp-day-rail {
    border-right: 1px solid var(--hp-card-border);
    background: #FAFCFD;
}
.hp-day-hour {
    height: 60px;
    padding: 4px 6px 0 0;
    text-align: right;
    font-size: 10.5px;
    color: var(--hp-text-muted);
    font-variant-numeric: tabular-nums;
    box-sizing: border-box;
}
.hp-day-canvas {
    position: relative;
    background: #FFFFFF;
}
.hp-day-slot {
    position: absolute; left: 0; right: 0;
    height: 60px;
    border-bottom: 1px solid var(--hp-card-border);
}
.hp-day-event {
    position: absolute; left: 8px; right: 8px;
    padding: 6px 10px;
    border-radius: 8px;
    background: rgba(20, 184, 166, .14);
    color: #0E7C70;
    border-left: 3px solid var(--hp-secondary);
    text-decoration: none;
    overflow: hidden;
    font-size: 12px;
    display: flex; flex-direction: column; gap: 2px;
    transition: filter .15s, transform .15s;
    z-index: 2;
}
.hp-day-event:hover { filter: brightness(.97); transform: translateY(-1px); }
.hp-day-event.is-confirme { background: rgba(20, 184, 166, .18); border-left-color: var(--hp-secondary); }
.hp-day-event.is-realise  { background: rgba(99, 102, 241, .14); color: #4F46E5; border-left-color: #6366F1; }
.hp-day-event.is-annule   { background: rgba(148, 163, 184, .22); color: #475569; border-left-color: #94A3B8; }
.hp-day-event.is-absent   { background: rgba(244, 63, 94, .14); color: #BE123C; border-left-color: #F43F5E; }
.hp-day-event-time { font-weight: 700; font-variant-numeric: tabular-nums; }
.hp-day-event-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hp-day-event-type { font-size: 11px; color: inherit; opacity: .8; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hp-day-empty {
    text-align: center; padding: 3rem;
    color: var(--hp-text-muted);
    font-style: italic;
}

/* Week view */
.hp-week-grid {
    display: grid;
    grid-template-columns: 64px repeat(7, 1fr);
    grid-template-rows: auto 780px;
    overflow: auto;
}
.hp-week-rail-head {
    background: #FAFCFD;
    border-right: 1px solid var(--hp-card-border);
    border-bottom: 1px solid var(--hp-card-border);
}
.hp-week-col-head {
    padding: .65rem .5rem;
    text-align: center;
    background: #FAFCFD;
    border-bottom: 1px solid var(--hp-card-border);
    border-right: 1px solid var(--hp-card-border);
}
.hp-week-col-head:last-child { border-right: 0; }
.hp-week-col-day {
    font-size: 11.5px; font-weight: 700;
    color: var(--hp-text-muted);
    letter-spacing: .04em;
    text-transform: uppercase;
}
.hp-week-col-date {
    font-family: var(--hp-heading-font);
    font-size: 16px; font-weight: 700;
    color: var(--hp-primary);
    margin-top: 2px;
}
.hp-week-col-head.is-today {
    background: rgba(20, 184, 166, .08);
}
.hp-week-col-head.is-today .hp-week-col-date { color: var(--hp-secondary); }
.hp-week-rail {
    background: #FAFCFD;
    border-right: 1px solid var(--hp-card-border);
}
.hp-week-col {
    position: relative;
    background: #FFFFFF;
    border-right: 1px solid var(--hp-card-border);
}
.hp-week-col:last-child { border-right: 0; }

/* Kanban */
.hp-kanban {
    display: grid;
    grid-template-columns: repeat(5, minmax(220px, 1fr));
    gap: .85rem;
}
.hp-kanban-col {
    background: var(--hp-card-bg);
    border: 1px solid var(--hp-card-border);
    border-radius: 14px;
    box-shadow: var(--hp-card-shadow);
    display: flex; flex-direction: column;
    min-height: 240px;
}
.hp-kanban-col-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: .75rem .9rem;
    border-bottom: 1px solid var(--hp-card-border);
}
.hp-kanban-col-title { font-weight: 700; color: var(--hp-text-strong); font-size: 13px; }
.hp-kanban-col-count {
    background: #ECF1F4; color: var(--hp-text-muted);
    border-radius: 999px;
    padding: 1px 9px;
    font-size: 11.5px; font-weight: 700;
}
.hp-kanban-col.is-confirme .hp-kanban-col-count { background: rgba(20, 184, 166, .15); color: #0E7C70; }
.hp-kanban-col.is-realise  .hp-kanban-col-count { background: rgba(99, 102, 241, .14); color: #4F46E5; }
.hp-kanban-col.is-annule   .hp-kanban-col-count { background: rgba(148, 163, 184, .22); color: #475569; }
.hp-kanban-col.is-absent   .hp-kanban-col-count { background: rgba(244, 63, 94, .14); color: #BE123C; }
.hp-kanban-col-body {
    padding: .65rem;
    display: flex; flex-direction: column; gap: .55rem;
    flex: 1;
}
.hp-kanban-card {
    display: block;
    text-decoration: none;
    background: #F8FAFC;
    border: 1px solid var(--hp-card-border);
    border-radius: 10px;
    padding: .65rem .75rem;
    transition: transform .15s, box-shadow .15s, border-color .15s;
}
.hp-kanban-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(15, 30, 55, .08);
    border-color: var(--hp-secondary);
}
.hp-kanban-card-when {
    display: flex; align-items: center; gap: .4rem;
    font-size: 11.5px; color: var(--hp-text-muted); font-weight: 600;
}
.hp-kanban-card-time {
    background: var(--hp-primary); color: #FFFFFF;
    padding: 1px 7px;
    border-radius: 999px;
    font-variant-numeric: tabular-nums;
}
.hp-kanban-card-name { font-weight: 700; color: var(--hp-text-strong); margin-top: .35rem; font-size: 13.5px; }
.hp-kanban-card-meta { font-size: 12px; color: var(--hp-text-muted); margin-top: 2px; }
.hp-kanban-card-foot {
    margin-top: .5rem;
    display: flex; justify-content: space-between; align-items: center;
    font-size: 11.5px; color: var(--hp-text-muted);
}
.hp-kanban-card-mat { font-variant-numeric: tabular-nums; }
.hp-kanban-empty {
    text-align: center; padding: 1rem .5rem;
    color: var(--hp-text-muted);
    font-size: 12.5px;
    font-style: italic;
}

@media (max-width: 1280px) {
    .hp-kanban { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 768px) {
    .hp-kanban { grid-template-columns: 1fr; }
    .hp-cal-cell { min-height: 78px; }
}

/* ==========================================================================
   Document model builder + layout cards
   ========================================================================== */

.hp-builder-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
    gap: 1rem;
}
.hp-builder-pane { margin: 0; }
.hp-builder-body {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 13px;
    line-height: 1.55;
}
.hp-builder-actions {
    display: flex; gap: .5rem; justify-content: flex-end;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--hp-card-border);
}
.hp-builder-preview {
    background: #FAFAF7;
    border: 1px solid var(--hp-card-border);
    border-radius: 8px;
    padding: 1rem;
    min-height: 380px;
    display: flex; flex-direction: column;
}
.hp-builder-preview pre {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 12.5px;
    line-height: 1.5;
    color: var(--hp-text-strong);
    white-space: pre-wrap;
    margin: 0;
}
.hp-builder-preview-header {
    color: var(--hp-primary);
    padding-bottom: .75rem;
    border-bottom: 1px dashed var(--hp-card-border);
    margin-bottom: .75rem;
}
.hp-builder-preview-body { flex: 1; }
.hp-builder-preview-footer {
    color: var(--hp-text-muted);
    padding-top: .75rem;
    border-top: 1px dashed var(--hp-card-border);
    margin-top: .75rem;
}

/* Plannings — members × days grid */
.hp-planning {
    width: 100%;
    border-collapse: collapse;
    font-size: 12.5px;
    min-width: 1100px;
}
.hp-planning thead th {
    padding: .55rem .5rem;
    background: #FAFAF7;
    border-bottom: 1px solid var(--hp-card-border);
    font-weight: 700;
    color: var(--hp-text-muted);
    text-transform: uppercase;
    letter-spacing: .04em;
    font-size: 10.5px;
    text-align: center;
    position: sticky; top: 0;
}
.hp-planning-member-head {
    text-align: left !important;
    min-width: 200px;
    position: sticky; left: 0; z-index: 2;
    background: #FAFAF7 !important;
}
.hp-planning-day-head { min-width: 110px; }
.hp-planning-day-head.is-today { color: var(--hp-secondary); background: rgba(45, 169, 160, .08) !important; }
.hp-planning-day-head.is-weekend { background: #F1F4F8 !important; }
.hp-planning-day-short { font-size: 11px; }
.hp-planning-day-num { font-weight: 600; color: var(--hp-text-strong); margin-top: 2px; text-transform: none; letter-spacing: 0; font-size: 12px; }
.hp-planning tbody td {
    padding: .4rem .35rem;
    border-bottom: 1px solid var(--hp-card-border);
    vertical-align: top;
}
.hp-planning-member {
    position: sticky; left: 0;
    background: #FFFFFF;
    z-index: 1;
    min-width: 200px;
    padding: .65rem .75rem !important;
    border-right: 1px solid var(--hp-card-border);
}
.hp-planning-member-name { font-weight: 600; color: var(--hp-primary); font-size: 13px; }
.hp-planning-member-role { font-size: 11.5px; margin-top: 2px; }
.hp-planning-cell { text-align: center; }
.hp-planning-cell.is-today { background: rgba(45, 169, 160, .04); }
.hp-planning-cell.is-weekend { background: #FAFAF7; }
.hp-planning-empty { color: var(--hp-card-border); font-size: 14px; }
.hp-planning-off {
    display: inline-block;
    padding: .3rem .55rem;
    border-radius: 6px;
    background: #F1F4F8;
    color: var(--hp-text-muted);
    font-weight: 600;
    font-size: 11.5px;
}
.hp-planning-shift {
    display: block;
    width: 100%;
    padding: .35rem .5rem;
    border: 1px solid rgba(45, 169, 160, .25);
    background: rgba(45, 169, 160, .08);
    border-radius: 6px;
    text-align: left;
    cursor: pointer;
    transition: all .15s ease;
}
.hp-planning-shift:hover {
    border-color: var(--hp-secondary);
    background: rgba(45, 169, 160, .15);
}
.hp-planning-site {
    display: block;
    font-weight: 600;
    color: var(--hp-primary);
    font-size: 11.5px;
    line-height: 1.2;
}
.hp-planning-time {
    display: block;
    font-variant-numeric: tabular-nums;
    color: var(--hp-text-muted);
    font-size: 10.5px;
    margin-top: 2px;
}
.hp-planning-legend {
    display: flex; gap: 1.5rem;
    padding: .75rem 0;
    color: var(--hp-text-muted);
    font-size: 12px;
}
.hp-planning-dot {
    display: inline-block;
    width: 10px; height: 10px;
    border-radius: 3px;
    vertical-align: middle;
    margin-right: .35rem;
}
.hp-planning-dot.is-shift { background: rgba(45, 169, 160, .25); border: 1px solid var(--hp-secondary); }
.hp-planning-dot.is-off { background: #F1F4F8; border: 1px solid var(--hp-card-border); }
.hp-planning-dot.is-empty { border: 1px dashed var(--hp-card-border); }

.hp-history { list-style: none; padding: 0; margin: 0; position: relative; padding-left: 1.25rem; }
.hp-history::before {
    content: '';
    position: absolute; left: 4px; top: 4px; bottom: 4px;
    width: 2px; background: var(--hp-card-border);
}
.hp-history-item { position: relative; padding: .55rem 0; }
.hp-history-dot {
    position: absolute; left: -1.05rem; top: .85rem;
    width: 10px; height: 10px; border-radius: 50%;
    background: var(--hp-secondary);
    border: 2px solid #FFFFFF;
}
.hp-history-action { color: var(--hp-text-strong); font-size: 13.5px; }
.hp-history-meta { font-size: 12px; margin-top: 2px; }

.hp-layouts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}
.hp-layout-card {
    position: relative;
    margin: 0;
    transition: transform .15s, box-shadow .15s, border-color .15s;
    cursor: pointer;
}
.hp-layout-card:hover {
    border-color: var(--hp-secondary);
    transform: translateY(-2px);
}
.hp-layout-name {
    font-weight: 700;
    color: var(--hp-primary);
    font-size: 14px;
    margin-top: .25rem;
}
.hp-layout-desc {
    font-size: 12.5px;
    margin-bottom: .5rem;
}
.hp-layout-preview {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 11.5px;
    line-height: 1.4;
    color: var(--hp-text-muted);
    background: #FAFAF7;
    border: 1px dashed var(--hp-card-border);
    border-radius: 6px;
    padding: .5rem .65rem;
    margin: 0;
    max-height: 96px;
    overflow: hidden;
    white-space: pre-wrap;
}

@media (max-width: 992px) {
    .hp-builder-grid { grid-template-columns: 1fr; }
}

/* ==========================================================================
   Responsive
   ========================================================================== */

/* Dropzone — drag-and-drop file upload box. Shared across all upload surfaces. */
.hp-dropzone {
    position: relative;
    border: 2px dashed var(--hp-card-border);
    border-radius: 10px;
    background: var(--hp-background);
    padding: 1.5rem 1.25rem;
    text-align: center;
    transition: border-color .18s ease, background .18s ease;
    cursor: pointer;
}
.hp-dropzone:hover { border-color: var(--hp-secondary); background: #FFFFFF; }
.hp-dropzone.is-drag { border-color: var(--hp-secondary); background: rgba(45, 169, 160, .06); }
.hp-dropzone.is-error { border-color: var(--hp-danger); background: rgba(220, 38, 38, .04); }
.hp-dropzone-empty { display: flex; flex-direction: column; align-items: center; gap: .35rem; color: var(--hp-text-muted); }
.hp-dropzone-empty svg { color: var(--hp-secondary); }
.hp-dropzone-title { color: var(--hp-primary); font-weight: 600; font-size: 14px; }
.hp-dropzone-help { font-size: 12px; color: var(--hp-text-muted); }
.hp-dropzone-preview {
    display: flex;
    align-items: center;
    gap: .65rem;
    background: #fff;
    border-radius: 8px;
    padding: .5rem .75rem;
    text-align: left;
    border: 1px solid var(--hp-card-border);
}
.hp-dropzone-name { font-weight: 600; color: var(--hp-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Document visibility badges (private / shared / site / public). */
.hp-doc-visibility {
    display: inline-block;
    margin-left: .4rem;
    padding: 1px .45rem;
    border-radius: 4px;
    font-size: 10.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .03em;
    line-height: 1.45;
    vertical-align: middle;
}
.hp-doc-visibility-private { background: rgba(100, 116, 139, .12); color: var(--hp-text-muted); }
.hp-doc-visibility-shared  { background: rgba(217, 119, 6, .12); color: var(--hp-warning); }
.hp-doc-visibility-site    { background: rgba(26, 143, 184, .12); color: var(--hp-accent); }
.hp-doc-visibility-public  { background: rgba(5, 150, 105, .12); color: var(--hp-success); }

/* Bibliothèque layout — folder sidebar + document list. */
.hp-doc-layout {
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr);
    gap: 1.25rem;
    align-items: flex-start;
}
@media (max-width: 768px) {
    .hp-doc-layout { grid-template-columns: 1fr; }
}
.hp-doc-folders { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .15rem; }
.hp-doc-folders .hp-doc-folders { padding-left: 0; }
.hp-doc-folder {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .5rem .85rem;
    border-radius: 6px;
    color: var(--hp-primary);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 500;
    transition: background .15s ease;
}
.hp-doc-folder:hover { background: var(--hp-background); }
.hp-doc-folder.is-active { background: var(--hp-secondary); color: #fff; }
.hp-doc-folder.is-active svg { color: #fff; }
.hp-doc-folder .hp-doc-folder-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hp-doc-folder .hp-doc-visibility { font-size: 9.5px; padding: 1px 6px; opacity: .85; }
.hp-doc-folder.is-active .hp-doc-visibility { background: rgba(255, 255, 255, .22); color: #fff; }
.hp-doc-folder-edit {
    background: transparent; border: 0; padding: 2px; border-radius: 4px; color: inherit;
    opacity: 0; transition: opacity .15s ease, background .15s ease; cursor: pointer; line-height: 0;
}
.hp-doc-folder-row:hover .hp-doc-folder-edit { opacity: .7; }
.hp-doc-folder-edit:hover { opacity: 1 !important; background: rgba(0, 0, 0, .06); }
.hp-doc-folder.is-active .hp-doc-folder-edit:hover { background: rgba(255, 255, 255, .18); }

/* View-mode toggle (table / grid) on top of doc library. */
.hp-view-toggle {
    display: inline-flex;
    background: var(--hp-background);
    border: 1px solid var(--hp-card-border);
    border-radius: 6px;
    padding: 2px;
    gap: 2px;
}
.hp-view-toggle-btn {
    background: transparent;
    border: 0;
    padding: .25rem .5rem;
    border-radius: 4px;
    color: var(--hp-text-muted);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background .12s ease, color .12s ease;
}
.hp-view-toggle-btn:hover { color: var(--hp-primary); }
.hp-view-toggle-btn.is-active { background: #FFFFFF; color: var(--hp-primary); box-shadow: 0 1px 2px rgba(15, 30, 55, .08); }

/* Sortable table-header arrow + state. */
.hp-table th.is-sortable { cursor: pointer; user-select: none; white-space: nowrap; }
.hp-table th.is-sortable:hover { color: var(--hp-primary); }
.hp-sort-arrow {
    display: inline-block;
    width: 0;
    height: 0;
    margin-left: .35rem;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    opacity: .3;
    vertical-align: middle;
    transition: opacity .12s ease, transform .12s ease;
}
.hp-table th.is-sorted-asc .hp-sort-arrow { border-bottom: 5px solid var(--hp-primary); opacity: 1; }
.hp-table th.is-sorted-desc .hp-sort-arrow { border-top: 5px solid var(--hp-primary); opacity: 1; }
.hp-table th:not(.is-sorted-asc):not(.is-sorted-desc) .hp-sort-arrow { border-bottom: 5px solid currentColor; }

/* Document library tile/card grid (alt view of the index table). */
.hp-doc-library-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: .85rem;
    padding: 1rem;
}
.hp-doc-library-card {
    background: #FFFFFF;
    border: 1px solid var(--hp-card-border);
    border-radius: 12px;
    padding: 1rem .85rem;
    text-align: center;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.hp-doc-library-card:hover {
    transform: translateY(-2px);
    border-color: var(--hp-secondary);
    box-shadow: 0 8px 20px -10px rgba(15, 30, 55, .25);
}
.hp-doc-library-card-thumb {
    position: relative;
    width: 64px;
    height: 64px;
    border-radius: 12px;
    background: var(--hp-background);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: .65rem;
    color: var(--hp-secondary);
}
.hp-doc-library-card-ext {
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--hp-primary);
    color: #FFFFFF;
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: .04em;
    padding: 1px 6px;
    border-radius: 4px;
}
.hp-doc-library-card-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--hp-primary);
    line-height: 1.3;
    margin-bottom: .3rem;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.hp-doc-library-card-meta {
    font-size: 11.5px;
    color: var(--hp-text-muted);
    display: flex;
    gap: .25rem;
    align-items: center;
    justify-content: center;
}

/* Library card wrapper — positions the corner edit affordance over the card. */
.hp-doc-library-card-wrap {
    position: relative;
    display: flex;
}
.hp-doc-library-card-wrap > .hp-doc-library-card { width: 100%; }
.hp-doc-library-card-edit {
    position: absolute;
    top: .35rem;
    right: .35rem;
    width: 26px;
    height: 26px;
    border-radius: 6px;
    background: rgba(255, 255, 255, .85);
    color: var(--hp-text-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    opacity: 0;
    transition: opacity .12s ease, color .12s ease, background .12s ease;
    text-decoration: none;
}
.hp-doc-library-card-wrap:hover .hp-doc-library-card-edit { opacity: 1; }
.hp-doc-library-card-edit:hover { color: var(--hp-primary); background: #FFFFFF; }

/* Type icon coloring (inline next to file names in the table). */
.hp-doc-type-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: var(--hp-background);
    color: var(--hp-text-muted);
    flex-shrink: 0;
}
.hp-doc-type-icon-pdf,
.hp-doc-library-card-thumb.hp-doc-type-icon-pdf { color: var(--hp-danger); }
.hp-doc-type-icon-image,
.hp-doc-library-card-thumb.hp-doc-type-icon-image { color: var(--hp-accent); }
.hp-doc-type-icon-doc,
.hp-doc-library-card-thumb.hp-doc-type-icon-doc { color: var(--hp-secondary); }

/* Inline link-styled button — used to trigger viewers from inside a table cell
   without nesting interactive elements (which would break a11y). */
.hp-link-btn {
    background: transparent;
    border: 0;
    padding: 0;
    font: inherit;
    font-weight: 600;
    color: var(--hp-primary);
    cursor: pointer;
    text-align: left;
}
.hp-link-btn:hover { color: var(--hp-secondary); text-decoration: underline; }
.hp-link { color: var(--hp-secondary); text-decoration: none; font-weight: 600; }
.hp-link:hover { text-decoration: underline; }

/* Button group — chains adjacent buttons into a single visual unit. */
.hp-btn-group {
    display: inline-flex;
    align-items: stretch;
    border: 1px solid var(--hp-card-border);
    border-radius: 6px;
    overflow: hidden;
    background: #FFFFFF;
}
.hp-btn-group > .btn {
    border-radius: 0 !important;
    border: 0 !important;
    border-right: 1px solid var(--hp-card-border) !important;
    background: transparent !important;
    padding: .35rem .65rem !important;
    font-size: 12.5px;
}
.hp-btn-group > .btn:last-child { border-right: 0 !important; }
.hp-btn-group > .btn:hover { background: var(--hp-background) !important; }

/* Collaborateur import wizard — centered modal with stepper, panels, footer. */
.hp-import-wizard {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-height: 380px;
}
.hp-import-stepper {
    list-style: none;
    margin: 0 0 .25rem;
    padding: 0;
    display: flex;
    gap: .25rem;
    border-bottom: 1px solid var(--hp-card-border);
}
.hp-import-stepper li {
    flex: 1;
    text-align: center;
    padding: .55rem .35rem;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--hp-text-muted);
    border-bottom: 2px solid transparent;
    transition: color .12s ease, border-color .12s ease;
}
.hp-import-stepper li.is-done { color: var(--hp-secondary); }
.hp-import-stepper li.is-active { color: var(--hp-primary); border-bottom-color: var(--hp-primary); }
.hp-import-panel { min-height: 240px; padding: .25rem 0; }
.hp-import-footer {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding-top: .75rem;
    border-top: 1px solid var(--hp-card-border);
}
.hp-import-sheets { display: flex; flex-direction: column; gap: .35rem; margin-top: .75rem; }
.hp-import-sheet {
    display: flex; align-items: center; gap: .55rem;
    padding: .55rem .75rem;
    border: 1px solid var(--hp-card-border);
    border-radius: 6px;
    cursor: pointer;
}
.hp-import-sheet:has(input:checked) { border-color: var(--hp-primary); background: rgba(20, 40, 80, .04); }

.hp-import-map-table { width: 100%; border-collapse: collapse; }
.hp-import-map-table th,
.hp-import-map-table td { padding: .4rem .5rem; border-bottom: 1px solid var(--hp-card-border); vertical-align: middle; font-size: 13px; }
.hp-import-map-table th { text-align: left; font-weight: 600; color: var(--hp-primary); width: 40%; }
.hp-import-map-table td .form-control { font-size: 12.5px; padding: .35rem .5rem; }

.hp-import-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: .5rem;
}
.hp-import-stat {
    background: var(--hp-background);
    border-radius: 8px;
    padding: .65rem .75rem;
    text-align: center;
    border: 1px solid var(--hp-card-border);
}
.hp-import-stat strong { display: block; font-size: 1.4rem; font-weight: 700; color: var(--hp-primary); font-family: var(--hp-heading-font); }
.hp-import-stat span { font-size: 11.5px; color: var(--hp-text-muted); text-transform: uppercase; letter-spacing: .04em; }
.hp-import-stat.is-ok strong { color: var(--hp-success); }
.hp-import-stat.is-err strong { color: var(--hp-warning); }

.hp-progress {
    width: 100%;
    height: 8px;
    background: var(--hp-card-border);
    border-radius: 4px;
    overflow: hidden;
}
.hp-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--hp-secondary), var(--hp-accent));
    transition: width .25s ease;
}

/* Library card uses the same `hp-doc-library-card` class for both <a> and <button>
   triggers. Strip the default button chrome when applied to a button. */
button.hp-doc-library-card {
    font: inherit;
    cursor: pointer;
}

/* Generic empty state (illustrative SVG + heading + CTA). */
.hp-empty-state {
    text-align: center;
    padding: 3rem 1.25rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .35rem;
    color: var(--hp-text-muted);
}
.hp-empty-state-art {
    width: 96px;
    height: 96px;
    border-radius: 24px;
    background: var(--hp-background);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--hp-secondary);
    margin-bottom: .5rem;
}
.hp-empty-state h3 {
    font-family: var(--hp-heading-font);
    font-size: 1.25rem;
    color: var(--hp-primary);
    margin: .25rem 0 0;
}
.hp-empty-state p {
    margin: 0 0 1rem;
    font-size: 13.5px;
    max-width: 28rem;
}

/* Org chart (organigramme) — vertical tree of users. */
.hp-orgtree {
    list-style: none;
    margin: 0;
    padding-left: 1.5rem;
    position: relative;
}
.hp-orgtree > .hp-orgnode { padding-top: .35rem; padding-bottom: .35rem; }
.hp-orgnode {
    position: relative;
    padding-left: 1rem;
}
.hp-orgnode::before {
    content: "";
    position: absolute;
    left: 0; top: 0; bottom: 0;
    border-left: 1px dashed var(--hp-card-border);
}
.hp-orgnode::after {
    content: "";
    position: absolute;
    left: 0; top: 1.4rem;
    width: .9rem;
    border-top: 1px dashed var(--hp-card-border);
}
.hp-orgnode > .hp-orgcard {
    display: inline-block;
    padding: .55rem .85rem;
    border: 1px solid var(--hp-card-border);
    border-radius: 8px;
    background: #fff;
    text-decoration: none;
    color: inherit;
    min-width: 220px;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.hp-orgnode > .hp-orgcard:hover {
    border-color: var(--hp-secondary);
    box-shadow: 0 4px 14px rgba(45, 169, 160, .12);
}
.hp-orgcard-name { font-weight: 600; color: var(--hp-primary); }
.hp-orgcard-meta { font-size: 12px; color: var(--hp-text-muted); margin-top: 2px; }
.hp-orgcard-username { font-size: 11.5px; color: var(--hp-accent); margin-top: 2px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

/* Responsable chain (profile / user-show page). */
.hp-responsable-chain {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem;
    padding: .25rem 0;
}
.hp-responsable-chain .hp-chip { background: #F1F5F9; }
.hp-responsable-chain .hp-arrow {
    color: var(--hp-text-muted);
    font-size: 12px;
}

/* Dashboard two-column widget row (alerts + upcoming RDV). */
.hp-dash-lists-row {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 1.25rem;
    align-items: flex-start;
    margin-bottom: 1.25rem;
}

/* Drag-drop: document → folder. */
.hp-doc-dragging { opacity: .45; }
[data-drop-folder].hp-drop-over {
    background: rgba(45, 169, 160, .15) !important;
    outline: 2px dashed var(--hp-secondary);
    outline-offset: -2px;
    border-radius: 6px;
}

/* ==========================================================================
   Mobile optimisations — 768px and below
   ========================================================================== */

/* ---- Forms ---- */
@media (max-width: 768px) {
    /* Two-column form rows stack on mobile */
    .form-row { grid-template-columns: 1fr; }

    /* Dashboard widget row: stack alerts + RDV vertically */
    .hp-dash-lists-row { grid-template-columns: 1fr; }

    /* Stepper: hide labels, keep numbers */
    .hp-stepper-label { display: none; }
    .hp-stepper { gap: .4rem; }

    /* Table: make it horizontally scrollable (overrides the base overflow:hidden).
       overflow-y:clip keeps the vertical clipping for border-radius, while
       overflow-x:auto enables touch-scroll on the table. */
    .hp-table-wrap { overflow-x: auto; overflow-y: clip; -webkit-overflow-scrolling: touch; }
    .hp-table { min-width: 600px; }

    /* Table toolbar: stack search below pills on very small screens */
    .hp-table-toolbar { gap: .5rem; }
    .hp-table-search { min-width: 0; max-width: none; flex: 1 1 100%; }

    /* Toast: full-width on mobile */
    .hp-toast-container { left: .75rem; right: .75rem; max-width: none; }

    /* Modal shell: full-width with safe-area insets */
    .hp-modal-shell .hp-modal-flex {
        max-width: none !important;
        max-height: calc(100dvh - 1rem);
        margin: .5rem;
        border-radius: 16px;
    }

    /* Modals: full bottom-sheet style for side-sheet variant */
    .hp-modal-shell[data-size="sheet"] .hp-modal-flex {
        border-radius: 16px 16px 0 0;
        margin: auto 0 0;
        max-height: 90dvh;
    }

    /* Confirm modal */
    .hp-modal { max-width: calc(100vw - 2rem); }

    /* Topbar: compress site picker on very small screens */
    .hp-site-picker .hp-site-meta { display: none; }
    .hp-site-picker { padding: .3rem .45rem; }

    /* Topbar: hide user name, keep avatar */
    .hp-user-info { display: none; }

    /* Dropdowns: prevent overflow past viewport edge */
    .hp-dropdown-menu { max-width: calc(100vw - 1.5rem); }
    .hp-notif-menu { min-width: 0 !important; }
    .hp-site-menu { min-width: 0; max-width: calc(100vw - 1rem); }

    /* KPI grid: 2 columns minimum instead of 220px minimum */
    .hp-kpi-grid { grid-template-columns: repeat(2, 1fr); gap: .65rem; }

    /* Charts grid: single column (already done at 1100px, re-confirm for mobile) */
    .hp-charts-grid { grid-template-columns: 1fr; }

    /* Consultation item: stack date + content */
    .hp-consult-item {
        grid-template-columns: 1fr;
        gap: .5rem;
    }
    .hp-consult-date {
        display: flex; align-items: center; gap: .75rem;
        border-right: 0;
        border-bottom: 1px solid var(--hp-card-border);
        padding-right: 0;
        padding-bottom: .6rem;
        text-align: left;
    }

    /* Imagerie card: stack columns */
    .hp-img-card { grid-template-columns: auto 1fr; }

    /* Document layout: folder sidebar above docs list (already 1-col) */
    .hp-doc-layout { gap: .75rem; }

    /* Agenda toolbar: allow full wrapping */
    .hp-agenda-toolbar { gap: .5rem .65rem; padding: .65rem .75rem; }
    .hp-agenda-nav { margin-left: 0; width: 100%; justify-content: space-between; }
    .hp-agenda-views { flex-wrap: nowrap; }

    /* Planning table: enforce horizontal scroll */
    .hp-planning-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

    /* Builder grid (doc model): already 1-col at 992px */

    /* Card footer buttons: stack on small screens */
    .card-footer { flex-wrap: wrap; gap: .5rem; }

    /* HP import stats: 2-col instead of 3 */
    .hp-import-stats { grid-template-columns: 1fr 1fr; }

    /* Doc folder edit: always visible on touch (no hover state) */
    .hp-doc-folder-edit { opacity: .5; }
    .hp-doc-library-card-edit { opacity: 1; }
    .hp-mp-card-edit { opacity: 1; }

    /* Org tree: limit min-width of cards */
    .hp-orgnode > .hp-orgcard { min-width: 160px; }
    .hp-orgtree { padding-left: .9rem; }
}

/* ---- Very small phones (< 480px) ---- */
@media (max-width: 480px) {
    /* KPI: single column */
    .hp-kpi-grid { grid-template-columns: 1fr; }

    /* Import stats: single column */
    .hp-import-stats { grid-template-columns: 1fr; }

    /* Auth card: tighten padding */
    .hp-auth-card { padding: 1.75rem 1.25rem; }

    /* Page header h1 font size */
    .hp-page-header h1 { font-size: 1.45rem; }

    /* Table wrapper scrolling cue */
    .hp-table-wrap::after {
        content: '';
        position: absolute;
        top: 0; right: 0; bottom: 0;
        width: 24px;
        background: linear-gradient(to left, rgba(255,255,255,.7), transparent);
        pointer-events: none;
    }
    .hp-table-wrap { position: relative; }

    /* Topbar: shrink search to icon-only placeholder */
    .hp-topbar-search input { font-size: 13px; }
    .hp-topbar-inner { padding: 0 .75rem; gap: .5rem; }

    /* Doc library grid: 2 cards per row minimum */
    .hp-doc-library-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .65rem; }
}
