/**
 * Licence Manager — UI professionnelle (2025)
 * Plus Jakarta Sans + JetBrains Mono
 */

:root {
    --lh-font: "Plus Jakarta Sans", system-ui, sans-serif;
    --lh-mono: "JetBrains Mono", ui-monospace, monospace;
    --lh-ink: #0f172a;
    --lh-ink-soft: #334155;
    --lh-muted: #64748b;
    --lh-line: #e2e8f0;
    --lh-line-strong: #cbd5e1;
    --lh-surface: #ffffff;
    --lh-canvas: #f1f5f9;
    --lh-canvas2: #e8eef5;
    --lh-accent: #4f46e5;
    --lh-accent-hover: #4338ca;
    --lh-accent-soft: #eef2ff;
    --lh-accent2: #06b6d4;
    --lh-sidebar: #0b1220;
    --lh-sidebar2: #111b2e;
    --lh-success: #059669;
    --lh-success-bg: #ecfdf5;
    --lh-warn: #d97706;
    --lh-warn-bg: #fffbeb;
    --lh-danger: #dc2626;
    --lh-danger-bg: #fef2f2;
    --lh-radius: 14px;
    --lh-radius-sm: 10px;
    --lh-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
    --lh-shadow-lg: 0 12px 40px -12px rgba(15, 23, 42, 0.12);
    --lh-ring: 0 0 0 3px rgba(79, 70, 229, 0.22);
}

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

html {
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: var(--lh-font);
    color: var(--lh-ink);
}

body.lh-app {
    margin: 0;
    min-height: 100vh;
    background-color: var(--lh-canvas);
    background-image:
        radial-gradient(ellipse 80% 50% at 0% -20%, rgba(79, 70, 229, 0.09), transparent),
        radial-gradient(ellipse 60% 40% at 100% 0%, rgba(6, 182, 212, 0.07), transparent);
    background-attachment: fixed;
}

/* ——— Sidebar ——— */
.lh-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 268px;
    z-index: 1040;
    display: flex;
    flex-direction: column;
    background: linear-gradient(165deg, var(--lh-sidebar) 0%, var(--lh-sidebar2) 100%);
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: 4px 0 32px rgba(2, 6, 23, 0.35);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

.lh-sidebar__brand {
    padding: 1.35rem 1.25rem 1.1rem;
}

.lh-logo {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    text-decoration: none;
    color: inherit;
}

.lh-logo:hover {
    color: inherit;
    opacity: 0.92;
}

.lh-logo__mark {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    color: #fff;
    background: linear-gradient(135deg, var(--lh-accent) 0%, #6366f1 45%, var(--lh-accent2) 100%);
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.45);
}

.lh-logo__text {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}

.lh-logo__name {
    font-weight: 800;
    font-size: 1.05rem;
    letter-spacing: -0.03em;
    color: #f8fafc;
}

.lh-logo__tag {
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: #94a3b8;
}

.lh-sidebar__nav {
    flex: 1;
    padding: 0.5rem 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.lh-nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.9rem;
    border-radius: 11px;
    font-size: 0.9rem;
    font-weight: 600;
    color: #94a3b8;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
}

.lh-nav-link i {
    width: 1.25rem;
    text-align: center;
    opacity: 0.85;
}

.lh-nav-link:hover {
    color: #e2e8f0;
    background: rgba(255, 255, 255, 0.06);
}

.lh-nav-link.is-active {
    color: #fff;
    background: linear-gradient(90deg, rgba(79, 70, 229, 0.35) 0%, rgba(79, 70, 229, 0.12) 100%);
    box-shadow: inset 0 0 0 1px rgba(99, 102, 241, 0.35);
}

.lh-sidebar__footer {
    padding: 1rem 1.1rem 1.25rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.lh-sidebar__links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    margin-bottom: 1rem;
}

.lh-sidebar__links a {
    font-size: 0.78rem;
    font-weight: 600;
    color: #64748b;
    text-decoration: none;
}

.lh-sidebar__links a:hover {
    color: #cbd5e1;
}

.lh-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.lh-user__avatar {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    color: #fff;
    background: linear-gradient(135deg, #6366f1, var(--lh-accent2));
    border: 2px solid rgba(255, 255, 255, 0.12);
}

.lh-user__meta {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}

.lh-user__name {
    font-size: 0.82rem;
    font-weight: 700;
    color: #f1f5f9;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lh-user__out {
    font-size: 0.72rem;
    font-weight: 600;
    color: #64748b;
    text-decoration: none;
}

.lh-user__out:hover {
    color: #f87171;
}

/* ——— Main ——— */
.lh-main {
    margin-left: 268px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.lh-topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.85rem 1.75rem;
    background: rgba(255, 255, 255, 0.72);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid rgba(226, 232, 240, 0.9);
}

.lh-topbar__menu {
    flex-shrink: 0;
    display: none;
}

.lh-icon-btn {
    width: 40px;
    height: 40px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 11px;
    border: 1px solid var(--lh-line);
    background: var(--lh-surface);
    color: var(--lh-muted);
}

.lh-icon-btn:hover {
    border-color: var(--lh-line-strong);
    color: var(--lh-ink);
    background: #f8fafc;
}

.lh-icon-btn--sm {
    width: 32px;
    height: 32px;
    font-size: 0.82rem;
}

.lh-icon-btn--danger {
    color: #b91c1c;
}

.lh-icon-btn--danger:hover {
    color: #991b1b;
    border-color: #fecaca;
    background: #fef2f2;
}

details.lh-details {
    padding: 0;
}

details.lh-details > summary {
    list-style: none;
    cursor: pointer;
    padding: 1rem 1.5rem;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem 1rem;
}

details.lh-details > summary::-webkit-details-marker {
    display: none;
}

.lh-details__summary-title {
    font-size: 0.82rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--lh-muted);
}

.lh-details__summary-hint {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--lh-muted);
}

details.lh-details[open] > summary {
    border-bottom: 1px solid var(--lh-line);
}

.lh-details__body {
    padding: 1.25rem 1.5rem 1.35rem;
}

.lh-license-gen-hint {
    margin-top: -0.25rem;
}

.lh-topbar__search {
    flex: 1;
    max-width: 420px;
    position: relative;
}

.lh-topbar__search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.85rem;
    color: var(--lh-muted);
    pointer-events: none;
}

.lh-topbar__input {
    width: 100%;
    border: 1px solid var(--lh-line);
    border-radius: 12px;
    padding: 0.55rem 1rem 0.55rem 2.65rem;
    font-size: 0.88rem;
    font-weight: 500;
    background: rgba(255, 255, 255, 0.95);
    transition: border-color 0.15s, box-shadow 0.15s;
}

.lh-topbar__input:focus {
    outline: none;
    border-color: var(--lh-accent);
    box-shadow: var(--lh-ring);
}

.lh-btn-accent {
    flex-shrink: 0;
    font-weight: 700;
    font-size: 0.88rem;
    padding: 0.55rem 1.15rem;
    border-radius: 11px;
    border: none;
    color: #fff;
    background: linear-gradient(135deg, var(--lh-accent) 0%, #6366f1 100%);
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.35);
}

.lh-btn-accent:hover {
    color: #fff;
    filter: brightness(1.06);
    transform: translateY(-1px);
}

.lh-content {
    flex: 1;
    padding: 1.75rem 1.75rem 2.5rem;
    max-width: 1280px;
    width: 100%;
    margin: 0 auto;
}

/* ——— Page title ——— */
.lh-page-head {
    margin-bottom: 1.75rem;
}

.lh-page-head h1,
.lh-page-head .lh-title {
    font-size: clamp(1.35rem, 2.5vw, 1.65rem);
    font-weight: 800;
    letter-spacing: -0.04em;
    color: var(--lh-ink);
    margin: 0 0 0.35rem;
}

.lh-page-head .lh-lead {
    margin: 0;
    font-size: 0.92rem;
    color: var(--lh-muted);
    font-weight: 500;
    max-width: 52rem;
}

.page-header {
    margin-bottom: 1.75rem;
}

.page-header h1,
.page-header .h3,
.page-header h2 {
    font-size: clamp(1.35rem, 2.5vw, 1.65rem);
    font-weight: 800;
    letter-spacing: -0.04em;
    color: var(--lh-ink);
    margin: 0 0 0.35rem;
}

.lh-muted {
    color: var(--lh-muted);
}

/* ——— Cards ——— */
.lh-card,
.card-simple {
    background: var(--lh-surface);
    border: 1px solid var(--lh-line);
    border-radius: var(--lh-radius);
    padding: 1.35rem 1.5rem;
    box-shadow: var(--lh-shadow);
}

.lh-card__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.1rem;
    padding-bottom: 0.85rem;
    border-bottom: 1px solid var(--lh-line);
}

.lh-card__title {
    margin: 0;
    font-size: 0.82rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--lh-muted);
}

/* ——— Stats ——— */
.lh-stat {
    background: var(--lh-surface);
    border: 1px solid var(--lh-line);
    border-radius: var(--lh-radius);
    padding: 1.15rem 1.25rem;
    box-shadow: var(--lh-shadow);
    height: 100%;
    position: relative;
    overflow: hidden;
}

.lh-stat::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    border-radius: 4px 0 0 4px;
    background: var(--lh-accent);
    opacity: 0.9;
}

.lh-stat--cyan::before {
    background: var(--lh-accent2);
}

.lh-stat--amber::before {
    background: #f59e0b;
}

.lh-stat--rose::before {
    background: #f43f5e;
}

.lh-stat__icon {
    width: 40px;
    height: 40px;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    margin-bottom: 0.75rem;
    background: var(--lh-accent-soft);
    color: var(--lh-accent);
}

.lh-stat--cyan .lh-stat__icon {
    background: #ecfeff;
    color: #0891b2;
}

.lh-stat--amber .lh-stat__icon {
    background: var(--lh-warn-bg);
    color: var(--lh-warn);
}

.lh-stat--rose .lh-stat__icon {
    background: #fff1f2;
    color: #e11d48;
}

.lh-stat__val {
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: -0.04em;
    line-height: 1;
    color: var(--lh-ink);
}

.lh-stat__lbl {
    margin-top: 0.35rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--lh-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-box {
    background: var(--lh-surface);
    border: 1px solid var(--lh-line);
    border-radius: var(--lh-radius);
    padding: 1.15rem 1.25rem;
    box-shadow: var(--lh-shadow);
    height: 100%;
    position: relative;
    overflow: hidden;
}

.stat-box::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    border-radius: 4px 0 0 4px;
    background: var(--lh-accent);
}

.stat-box .val {
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: -0.04em;
    line-height: 1;
    color: var(--lh-ink);
}

.stat-box .lbl {
    margin-top: 0.35rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--lh-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ——— Tables ——— */
.lh-table-wrap {
    margin: 0 -0.25rem;
    border-radius: var(--lh-radius-sm);
    border: 1px solid var(--lh-line);
    overflow: hidden;
}

.table.lh-table-simple {
    margin: 0;
    font-size: 0.875rem;
}

.table.lh-table-simple thead th {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--lh-muted);
    background: #f8fafc;
    border-bottom: 1px solid var(--lh-line);
    padding: 0.75rem 1rem;
    white-space: nowrap;
}

.table.lh-table-simple tbody td {
    padding: 0.85rem 1rem;
    vertical-align: middle;
    border-color: #f1f5f9;
}

.table.lh-table-simple tbody tr:hover td {
    background: #fafbfc;
}

.lh-mono {
    font-family: var(--lh-mono);
    font-size: 0.8rem;
    font-weight: 500;
    letter-spacing: -0.02em;
    color: var(--lh-ink-soft);
}

/* ——— Badges ——— */
.badge-status {
    padding: 0.28rem 0.65rem;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.badge-status .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.badge-active {
    background: var(--lh-success-bg);
    color: #047857;
}

.badge-active .dot {
    background: var(--lh-success);
}

.badge-inactive {
    background: #f1f5f9;
    color: #475569;
}

.badge-inactive .dot {
    background: #94a3b8;
}

.badge-revoked {
    background: var(--lh-danger-bg);
    color: #b91c1c;
}

.badge-revoked .dot {
    background: var(--lh-danger);
}

.project-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.55rem;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 700;
}

.project-badge.p1 {
    background: #eef2ff;
    color: #4338ca;
}

.project-badge.p2 {
    background: #fae8ff;
    color: #86198f;
}

.project-badge.p3 {
    background: var(--lh-success-bg);
    color: #047857;
}

.project-badge.p4 {
    background: #fff7ed;
    color: #c2410c;
}

/* ——— Expiry ——— */
.lh-expiry {
    font-size: 0.84rem;
    font-weight: 600;
}

.lh-exp-none {
    color: var(--lh-muted);
    font-weight: 500;
}

.lh-exp-ok {
    color: var(--lh-ink-soft);
}

.lh-exp-soon {
    color: var(--lh-warn);
}

.lh-exp-past {
    color: var(--lh-danger);
}

/* ——— Association mono / multi asso (colonne association_mode) ——— */
.lh-assoc {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.25rem 0.55rem;
    border-radius: 8px;
    white-space: nowrap;
}

.lh-assoc--solo {
    background: #f1f5f9;
    color: #475569;
}

.lh-assoc--multi {
    background: #eef2ff;
    color: #4338ca;
}

/* Badge « poste » (dérivé de max_activations) */
.lh-poste-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.25rem 0.55rem;
    border-radius: 8px;
    white-space: nowrap;
}

.lh-poste-tag--mono {
    background: #ecfdf5;
    color: #047857;
}

.lh-poste-tag--multi {
    background: #fff7ed;
    color: #c2410c;
}

/* ——— Alerts ——— */
.lh-alert {
    padding: 0.75rem 1rem;
    border-radius: var(--lh-radius-sm);
    font-size: 0.88rem;
    font-weight: 500;
    border: 1px solid transparent;
}

.lh-alert-success {
    background: var(--lh-success-bg);
    color: #065f46;
    border-color: #a7f3d0;
}

.lh-alert-error {
    background: var(--lh-danger-bg);
    color: #991b1b;
    border-color: #fecaca;
}

.lh-alert-info {
    background: #eff6ff;
    color: #1e40af;
    border-color: #bfdbfe;
}

.lh-alert-warn {
    background: var(--lh-warn-bg);
    color: #92400e;
    border-color: #fde68a;
}

/* ——— Filters ——— */
.filter-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.filter-tab {
    padding: 0.45rem 1rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    border: 1px solid var(--lh-line);
    background: var(--lh-surface);
    color: var(--lh-muted);
    text-decoration: none;
    transition: all 0.15s;
}

.filter-tab:hover {
    border-color: #c7d2fe;
    color: var(--lh-accent);
}

.filter-tab.active {
    background: var(--lh-ink);
    border-color: var(--lh-ink);
    color: #fff;
}

a.filter-tab.active {
    color: #fff;
}

/* ——— Software list (dashboard) ——— */
.lh-soft-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.lh-soft-list li {
    border-bottom: 1px solid #f1f5f9;
}

.lh-soft-list li:last-child {
    border-bottom: 0;
}

.lh-soft-list a {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.65rem 0.15rem;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--lh-ink);
    text-decoration: none;
    border-radius: 8px;
}

.lh-soft-list a:hover {
    background: #f8fafc;
    color: var(--lh-accent);
}

.lh-soft-list .lh-count {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--lh-muted);
}

/* ——— Project cards (GESTION) ——— */
.lh-soft-card {
    background: var(--lh-surface);
    border: 1px solid var(--lh-line);
    border-radius: var(--lh-radius);
    padding: 1.35rem;
    height: 100%;
    box-shadow: var(--lh-shadow);
    transition: box-shadow 0.2s, border-color 0.2s;
}

.lh-soft-card:hover {
    box-shadow: var(--lh-shadow-lg);
    border-color: #e0e7ff;
}

.lh-soft-card--clickable:hover {
    border-color: #c7d2fe;
}

.lh-soft-card__actions {
    position: relative;
    z-index: 2;
}

.lh-soft-card__head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.75rem;
}

.lh-soft-card__avatar {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1rem;
    color: #fff;
}

/* ——— Forms ——— */
.form-label {
    font-weight: 600;
    font-size: 0.82rem;
    color: var(--lh-ink-soft);
}

.form-control,
.form-select {
    border-radius: 11px;
    border-color: var(--lh-line);
    font-size: 0.9rem;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--lh-accent);
    box-shadow: var(--lh-ring);
}

.btn-primary {
    --bs-btn-bg: var(--lh-accent);
    --bs-btn-border-color: var(--lh-accent);
    --bs-btn-hover-bg: var(--lh-accent-hover);
    --bs-btn-hover-border-color: var(--lh-accent-hover);
    font-weight: 700;
    border-radius: 11px;
    padding: 0.5rem 1.1rem;
}

.btn-outline-secondary {
    border-radius: 11px;
    font-weight: 600;
}

/* ——— Auth ——— */
.auth-page {
    min-height: calc(100vh - 52px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1.25rem;
    background: var(--lh-canvas);
    background-image:
        radial-gradient(ellipse 70% 50% at 50% -20%, rgba(79, 70, 229, 0.12), transparent);
}

.auth-top {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--lh-line);
    padding: 0.85rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.brand-line {
    font-weight: 800;
    font-size: 1rem;
    letter-spacing: -0.02em;
    color: var(--lh-ink);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.brand-line:hover {
    color: var(--lh-accent);
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--lh-surface);
    border: 1px solid var(--lh-line);
    border-radius: var(--lh-radius);
    padding: 2rem;
    box-shadow: var(--lh-shadow-lg);
}

.auth-card h1 {
    font-weight: 800;
    letter-spacing: -0.03em;
    font-size: 1.35rem;
}

.table-row-hidden {
    display: none !important;
}

.copy-target.copied {
    outline: 2px solid var(--lh-success);
    outline-offset: 2px;
    border-radius: 6px;
}

/* ——— Mobile ——— */
@media (max-width: 991px) {
    .lh-sidebar {
        transform: translateX(-100%);
    }

    .lh-sidebar.is-open {
        transform: translateX(0);
    }

    .lh-main {
        margin-left: 0;
    }

    .lh-topbar__menu {
        display: inline-flex;
    }

    .lh-topbar__search {
        max-width: none;
    }

    .lh-content {
        padding: 1.25rem 1rem 2rem;
    }
}
