/**
 * Leadnist Design System — couche visuelle uniquement
 * Linear / Stripe / Raycast inspired. Aucune logique métier.
 *
 * Grille 8px · radius 12 / 16 · jaune = CTA + actif seulement
 */
@import url('https://fonts.googleapis.com/css2?family=Instrument+Sans:wght@400;500;600;700&display=swap');

:root {
    /* Spacing scale (8px) */
    --space-1: 8px;
    --space-2: 16px;
    --space-3: 24px;
    --space-4: 32px;
    --space-5: 48px;
    --space-6: 64px;

    /* Radius — uniquement 12 et 16 */
    --radius-sm: 12px;
    --radius: 16px;
    --radius-lg: 16px;

    /* Surfaces */
    --main-bg: #09090b;
    --header-bg: rgba(9, 9, 11, 0.82);
    --card-bg: #121214;
    --card-bg-elevated: #161618;
    --surface-hover: rgba(255, 255, 255, 0.04);

    /* Sidebar sombre premium */
    --sidebar-bg: #0a0a0b;
    --sidebar-item-bg: transparent;
    --sidebar-item-border: transparent;
    --sidebar-item-hover-bg: rgba(255, 255, 255, 0.04);
    --sidebar-item-text: #a1a1aa;
    --sidebar-item-text-hover: #fafafa;
    --sidebar-active-bg: rgba(255, 255, 255, 0.055);
    --sidebar-width: 248px;

    /* Accent — usage rare */
    --accent: #eab308;
    --accent-hover: #f5c400;
    --accent-soft: rgba(234, 179, 8, 0.12);

    /* Text hierarchy */
    --text: #fafafa;
    --text-muted: #a1a1aa;
    --text-faint: #71717a;

    --border: rgba(255, 255, 255, 0.07);
    --border-strong: rgba(255, 255, 255, 0.12);
    --input-bg: rgba(255, 255, 255, 0.035);

    /* Shadows — discrètes */
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.28);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.4);
    --shadow-float: 0 12px 40px rgba(0, 0, 0, 0.35);

    --font: 'Instrument Sans', system-ui, -apple-system, sans-serif;
    --ease: cubic-bezier(0.16, 1, 0.3, 1);
    --duration: 180ms;
}

/* ——— Base ——— */
body {
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.55;
    letter-spacing: -0.01em;
    background: var(--main-bg);
    color: var(--text);
}

/* Typographie */
.header h1,
h1 {
    font-size: 1.35rem;
    font-weight: 650;
    letter-spacing: -0.03em;
    color: var(--text);
}

h2, .card-title {
    font-size: 0.95rem;
    font-weight: 650;
    letter-spacing: -0.02em;
    color: var(--text);
}

h3 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text);
}

.text-muted,
.post-list .post-meta {
    color: var(--text-muted);
    font-size: 0.8125rem;
}

/* ——— Header ——— */
.header {
    background: var(--header-bg);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    padding: var(--space-2) var(--space-3);
}

.content {
    padding: var(--space-3);
}

/* ——— Sidebar produit (Cursor / Linear / Arc) ——— */
.sidebar {
    width: var(--sidebar-width, 248px);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    background: var(--sidebar-bg);
    border-right: 1px solid rgba(255, 255, 255, 0.045);
    padding: 0;
}

@media (min-width: 769px) {
    .sidebar {
        position: sticky;
        top: 0;
        height: 100vh;
        height: 100dvh;
        transform: none;
        border-bottom: none;
    }
}

.sidebar-toggle {
    background: #121214;
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow-md);
}

.sidebar-brand {
    padding: 28px 22px 20px;
    margin: 0;
}

.sidebar-brand-link {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
}

.sidebar-brand-logo {
    display: none !important;
}

.sidebar-brand-text { display: none; }

.sidebar-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding: 0 12px 16px;
    margin: 0;
    gap: 0;
    max-height: none;
}

.sidebar-nav__scroll {
    flex: 1;
    overflow: auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding-bottom: 12px;
}

.sidebar-nav__footer {
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
    border-bottom: none;
    box-shadow: none;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sidebar-section {
    margin: 18px 12px 8px;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #52525b;
}

.sidebar-section:first-child {
    margin-top: 4px;
}

.sidebar-link {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 44px;
    padding: 0 14px 0 16px;
    border-radius: 11px;
    color: var(--sidebar-item-text);
    text-decoration: none;
    font-size: 0.96875rem; /* ~15.5px */
    font-weight: 500;
    letter-spacing: -0.01em;
    background: transparent;
    border: 1px solid transparent;
    box-shadow: none;
    transition: background 180ms var(--ease), color 180ms var(--ease), border-color 180ms var(--ease), box-shadow 180ms var(--ease);
}

.sidebar-link:visited {
    color: var(--sidebar-item-text);
}

.sidebar-link:hover {
    background: rgba(255, 255, 255, 0.035);
    color: #f4f4f5;
    text-decoration: none;
}

.sidebar-link.is-active {
    background: rgba(234, 179, 8, 0.14) !important;
    border-color: rgba(234, 179, 8, 0.28) !important;
    box-shadow: none !important;
    color: #eab308 !important;
    font-weight: 650 !important;
}

.sidebar-link.is-active::before {
    content: none;
}

.sidebar-link .nav-ico {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: inherit;
    opacity: 0.78;
}

.sidebar-link .nav-ico svg {
    width: 18px;
    height: 18px;
    display: block;
}

.sidebar-link:hover .nav-ico {
    opacity: 1;
}

.sidebar-link.is-active .nav-ico {
    opacity: 1 !important;
    color: #eab308 !important;
}

.sidebar-link span:not(.nav-ico):not(.hexa-unread-badge) {
    flex: 1;
    min-width: 0;
}

.sidebar-link--logout {
    color: #71717a;
}

.sidebar-link--logout:hover {
    color: #fafafa;
}

.sidebar-link--warn {
    color: #eab308;
}

.hexa-unread-badge {
    margin-left: auto;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--accent);
    color: #0a0a0b;
    font-size: 0.68rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Groupes repliables Linear */
.sidebar-group {
    display: block;
    margin: 2px 0;
}
.sidebar-group__summary {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 44px;
    padding: 0 12px 0 16px;
    border-radius: 11px;
    color: var(--sidebar-item-text);
    font-size: 0.96875rem;
    font-weight: 500;
    cursor: pointer;
    user-select: none;
    border: 1px solid transparent;
    transition: background 180ms var(--ease), color 180ms var(--ease);
}
.sidebar-group__summary::-webkit-details-marker { display: none; }
.sidebar-group__summary .nav-ico:last-child {
    margin-left: auto;
    width: 16px;
    height: 16px;
    opacity: 0.45;
    transition: transform 180ms var(--ease);
}
.sidebar-group__summary .nav-ico:last-child svg {
    width: 14px;
    height: 14px;
}
.sidebar-group[open] > .sidebar-group__summary .nav-ico:last-child {
    transform: rotate(90deg);
}
.sidebar-group__summary:hover {
    background: rgba(255, 255, 255, 0.035);
    color: #f4f4f5;
}
.sidebar-subnav {
    display: flex;
    flex-direction: column;
    gap: 1px;
    padding: 2px 0 8px 0;
    margin: 0 0 0 8px;
    border-left: 1px solid rgba(255, 255, 255, 0.06);
}
.sidebar-sublink {
    display: block;
    padding: 8px 12px 8px 20px;
    margin-left: 0;
    border-radius: 8px;
    color: #71717a !important;
    text-decoration: none;
    font-size: 0.84rem;
    font-weight: 450;
    line-height: 1.35;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    transition: background 180ms var(--ease), color 180ms var(--ease);
}
.sidebar-sublink:visited { color: #71717a !important; }
.sidebar-sublink:hover {
    background: rgba(255, 255, 255, 0.035) !important;
    color: #e4e4e7 !important;
    text-decoration: none;
}
.sidebar-sublink.is-active {
    background: rgba(234, 179, 8, 0.14) !important;
    color: #eab308 !important;
    font-weight: 650 !important;
    box-shadow: inset 2px 0 0 #eab308 !important;
}
.sidebar-group__summary.is-open-active {
    background: rgba(234, 179, 8, 0.14) !important;
    border-color: rgba(234, 179, 8, 0.28) !important;
    color: #eab308 !important;
    font-weight: 650 !important;
}
.sidebar-group__summary.is-open-active .nav-ico:first-child {
    color: #eab308 !important;
    opacity: 1 !important;
}

.sidebar-quotas {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    margin: 16px 12px 0;
    padding: 12px;
}

.sidebar-nav-label {
    color: var(--text-faint);
    padding: 18px 14px 8px;
    font-weight: 600;
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

/* ——— Cards ——— */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: var(--space-3);
    margin-bottom: var(--space-2);
    transition: border-color var(--duration) var(--ease), box-shadow var(--duration) var(--ease), transform var(--duration) var(--ease);
}

.card:hover {
    border-color: var(--border-strong);
    box-shadow: var(--shadow-float);
}

.card-title {
    margin: 0 0 var(--space-2);
    font-weight: 650;
}

/* ——— Buttons ——— */
.btn {
    padding: 10px 16px;
    font-size: 0.8125rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    transition:
        background var(--duration) var(--ease),
        border-color var(--duration) var(--ease),
        color var(--duration) var(--ease),
        box-shadow var(--duration) var(--ease),
        transform 100ms ease;
}

.btn:active {
    transform: scale(0.98);
}

.btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.btn:disabled,
.btn[disabled] {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
}

.btn-primary {
    background: var(--accent);
    color: #111;
    border-color: transparent;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.btn-primary:hover {
    background: var(--accent-hover);
    color: #111;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    border-color: var(--border-strong);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.18);
}

.btn-ghost,
.btn.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    border-color: transparent;
}

.btn-ghost:hover,
.btn.btn-ghost:hover {
    background: var(--surface-hover);
    color: var(--text);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.75rem;
    border-radius: var(--radius-sm);
}

/* ——— Forms ——— */
input[type="email"],
input[type="password"],
input[type="text"],
input[type="tel"],
input[type="number"],
input[type="url"],
input[type="search"],
input[type="datetime-local"],
input[type="date"],
input[type="time"],
textarea,
select,
.form-control {
    min-height: 44px;
    padding: 10px 14px;
    font-size: 0.875rem;
    font-family: inherit;
    color: var(--text);
    background: var(--input-bg);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    transition: border-color var(--duration) var(--ease), box-shadow var(--duration) var(--ease);
}

textarea {
    min-height: 96px;
}

input::placeholder,
textarea::placeholder {
    color: var(--text-faint);
    opacity: 1;
}

input:focus,
textarea:focus,
select:focus,
.form-control:focus {
    outline: none;
    border-color: rgba(234, 179, 8, 0.45);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 6px;
}

/* ——— Lists / tables ——— */
.post-list li {
    padding: 14px 16px;
    background: var(--card-bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    transition: background var(--duration) var(--ease), border-color var(--duration) var(--ease);
}

.post-list li:hover {
    background: rgba(255, 255, 255, 0.035);
    border-color: var(--border-strong);
}

table {
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
}

table th {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-faint);
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    text-align: left;
}

table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 0.875rem;
    vertical-align: middle;
}

table tbody tr {
    transition: background var(--duration) var(--ease);
}

table tbody tr:hover {
    background: var(--surface-hover);
}

/* Badges */
.badge,
.status-badge,
.ui-badge,
.ci-impact-badge,
.dash-action-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: 8px;
    font-size: 0.7rem;
    font-weight: 650;
    letter-spacing: 0.02em;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-muted);
}

/* ——— Dashboard KPIs (Stripe-like) ——— */
.dash-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: var(--space-2);
    margin-bottom: var(--space-2);
}

.dash-kpi-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--space-3) var(--space-2);
    box-shadow: var(--shadow);
    transition: border-color var(--duration) var(--ease), box-shadow var(--duration) var(--ease), transform var(--duration) var(--ease);
    min-height: 120px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.dash-kpi-card:hover {
    border-color: var(--border-strong);
    box-shadow: var(--shadow-float);
    transform: translateY(-1px);
}

.dash-kpi-icon {
    font-size: 0.85rem;
    opacity: 0.55;
    margin-bottom: 4px;
}

.dash-kpi-value {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.04em;
    line-height: 1.1;
    color: #fff;
}

.dash-kpi-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
}

.dash-kpi-hint {
    font-size: 0.7rem;
    color: var(--text-faint);
    margin-top: auto;
}

.dash-hero {
    border: 1px solid var(--border);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), var(--card-bg));
}

.dash-hero-title {
    font-size: 1.25rem;
    font-weight: 650;
    letter-spacing: -0.03em;
}

.dash-hero-eyebrow {
    font-size: 0.7rem;
    font-weight: 650;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--accent);
}

.dash-panels {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--space-2);
}

.dash-health-ring {
    /* keep existing --pct mechanism; soften look */
    filter: saturate(0.95);
}

/* ——— Charts canvas wrappers ——— */
.chart-card,
.chart-wrap {
    border-radius: var(--radius);
}

.chart-wrap {
    padding: var(--space-2);
}

/* ——— Commercial / SEO noise reduction ——— */
.ci-metric-card,
.ci-alert {
    border-radius: var(--radius);
    border-color: var(--border);
    background: var(--card-bg);
}

.ci-metric-value {
    letter-spacing: -0.04em;
}

/* ——— Micro-interactions ——— */
@media (prefers-reduced-motion: no-preference) {
    .card,
    .btn,
    .dash-kpi-card,
    .sidebar-nav a,
    .post-list li {
        will-change: transform;
    }
}

/* Links in content: less yellow noise */
a:not(.btn):not(.sidebar-nav a):not(.sidebar-brand-link) {
    color: var(--text);
    text-decoration: underline;
    text-decoration-color: rgba(234, 179, 8, 0.35);
    text-underline-offset: 3px;
}
a:not(.btn):not(.sidebar-nav a):not(.sidebar-brand-link):hover {
    color: var(--accent);
    text-decoration-color: var(--accent);
}
