/* Solyvr — compact black / Amazon orange theme. Scope: active KDP module only.
   Keep all data, state classes, handlers and native table scrolling intact.
   Local system fonts avoid an external dependency. Mobile is the base layout. */
:is(.kdp-shell, .kdp-login-shell) {
    --sol-font: "Segoe UI", Inter, ui-sans-serif, system-ui, -apple-system, sans-serif;
    --sol-bg: #0b0b0c;
    --sol-panel: #151516;
    --sol-panel-raised: #202022;
    --sol-line: #333336;
    --sol-text: #ededee;
    --sol-muted: #b0b0b6;
    --sol-accent: #ff9900;
    /* Palette du Dashboard (décidée le 2026-10-09) */
    --dash-orange: #F1AF3D;
    --dash-ads: #E9A333;
    --dash-organique: #65ABE1;
    --dash-positif: #60DCAD;
    --dash-negatif: #ED938F;
    --bg-base: var(--sol-bg);
    --bg-card: var(--sol-panel);
    --bg-card2: var(--sol-panel-raised);
    --text-1: var(--sol-text);
    --text-2: var(--sol-muted);
    --text-3: var(--sol-muted);
    --cyan: var(--sol-accent);
    --font: var(--sol-font);
    --mono: var(--sol-font);
    color-scheme: dark;
    background: var(--sol-bg);
    color: var(--sol-text);
    font: 15px/1.5 var(--sol-font);
    font-variant-numeric: tabular-nums;
    min-height: 100vh;
}
.kdp-shell .kdp-main { min-width: 0; }
.kdp-shell :is(.diag-page,.vp-page,.fp-page,.ge-page,.gp-page,.hn-page,.ir-page,.ira-page,.rp-page,.rv-page) {
    color: var(--sol-text);
    font-family: var(--sol-font);
    min-width: 0;
}
.kdp-shell :is(.diag-title,.vp-title,.fp-title,.ge-title,.gp-title,.hn-title,.ir-title,.ira-title,.rp-title,.rv-title),
.kdp-login-shell .kdp-login-title {
    color: var(--sol-text);
    font-size: clamp(1.3rem, 1.1rem + .5vw, 1.55rem);
    font-weight: 650;
    letter-spacing: -.035em;
    line-height: 1.2;
}
.kdp-shell :is(.diag-subtitle,.vp-subtitle,.fp-subtitle,.ge-subtitle,.gp-subtitle,.hn-subtitle,.ir-subtitle,.ira-subtitle,.rp-subtitle,.rv-subtitle) {
    font-size: .875rem;
    line-height: 1.6;
    color: var(--sol-muted);
    margin-top: .45rem;
}
.kdp-shell :is(.diag-card,.vp-card,.fp-card,.ge-card,.gp-panel,.hn-exec-card,.ir-card,.ira-marketplace,.rv-card,.camp-card,.diag-placement-card),
.kdp-login-shell .kdp-login-card {
    background: var(--sol-panel);
    border-color: var(--sol-line);
    border-radius: 10px;
    box-shadow: 0 10px 30px #00000018;
}
.kdp-shell :is(.fp-modal,.ge-modal,.gp-modal,.fiche-drawer,.diag-m-panel) {
    background: var(--sol-panel);
    border-color: var(--sol-line);
    color: var(--sol-text);
}
.kdp-shell :is(.fp-modal,.ge-modal,.gp-modal) { max-height: calc(100dvh - 32px); overflow-y: auto; }
.kdp-shell :is(.diag-pilier,.ge-event-card,.hn-stat-card,.ir-rapport-card,.ir-timeline-card) {
    background: var(--sol-panel);
    border-radius: 10px;
}
/* Font size applies to actual labels, not icon pseudo-elements. */
.kdp-shell :is(.diag-resume-label,.diag-m-label,.diag-pm-label,.hn-stat-label,.ir-param-label,.ir-mat-card-label,.fp-label,.ge-label,.rv-label,.gp-panel-section-label) {
    color: var(--sol-muted);
    font-size: .75rem;
    line-height: 1.5;
    text-transform: none;
    letter-spacing: .01em;
    font-weight: 500;
}
.kdp-shell :is(.diag-resume-note,.diag-m-sublabel,.diag-bsr-date,.diag-cmp-plage,.diag-hint,.vp-hint,.gp-hint) {
    font-size: .8rem;
    line-height: 1.55;
}
.kdp-shell :is(.diag-resume-val,.hn-stat-val,.ir-mat-card-val) { font-size: 1.15rem; font-weight: 650; letter-spacing: -.025em; }
.kdp-shell .diag-resume-val-empty { font-size: .875rem; }
.kdp-shell .diag-m-val { font-size: .95rem; font-weight: 600; }
.kdp-shell .diag-m { border-radius: 7px; padding: 9px 11px; gap: 3px; min-width: 0; }
.kdp-shell .diag-m-secondaire { background: transparent; }
.kdp-shell .diag-pilier-header { flex-wrap: wrap; gap: 10px; }
.kdp-shell .diag-pilier-nom { font-size: 1.05rem; }
.kdp-shell .diag-piliers-grid { grid-template-columns: minmax(0,1fr); gap: 16px; }
.kdp-shell .diag-metriques-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
.kdp-shell .diag-resume-row { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.kdp-shell .diag-resume-item { min-width: 0; padding: 10px 12px; border-radius: 8px; border-color: var(--sol-line); }
.kdp-shell .diag-resume-item:hover { border-color: #55555a; }
.kdp-shell :is(.diag-table,.vp-table,.rv-table) { background: var(--sol-panel); color: var(--sol-text); font-size: .875rem; }
.kdp-shell :is(.diag-th,.vp-table th,.rv-th) { background: var(--sol-panel-raised); color: #c2c2c8; font-size: .75rem; padding: 12px; border-color: var(--sol-line); }
.kdp-shell :is(.diag-td,.vp-table td,.rv-td) { padding: 7px 10px; border-color: var(--sol-line); }
.kdp-shell :is(.diag-table-wrap,.vp-table-wrap,.rv-table-wrap) { max-width: 100%; border-color: var(--sol-line); }
.kdp-shell .rv-td { color: var(--sol-text); font-size: .85rem; }
.kdp-shell .rv-col-number { color: #ceced2; }
.kdp-shell .rv-col-money { color: #6fe2b4; }
.kdp-shell .rv-col-pct { color: #91baff; }
.kdp-shell .rv-tr:nth-child(even) { background: #19191b; }
.kdp-shell .rv-tr:hover { background: #252528; }
.kdp-shell .rv-tr { border-color: var(--sol-line); }
.kdp-shell :is(input:not([type=checkbox]):not([type=radio]),select,textarea),
.kdp-login-shell .kdp-login-input {
    font-family: var(--sol-font);
    font-size: 1rem;
    min-height: 44px;
    max-width: 100%;
    border-radius: 9px;
}
.kdp-shell :is(input,textarea)::placeholder { color: #aaaab0; }
.kdp-shell :is(.diag-btn-calculer,.vp-btn-actualiser,.fp-btn-primary,.ge-btn-primary,.gp-btn-sauvegarder,.ir-btn-primary,.ira-btn-primary,.rv-btn-charger,.rp-btn),
.kdp-login-shell .kdp-login-btn {
    background: var(--sol-accent);
    color: #211400;
    border-color: var(--sol-accent);
    border-radius: 9px;
    font-size: .9rem;
    font-weight: 650;
    min-height: 44px;
    padding: 10px 16px;
}
.kdp-shell :is(.diag-btn-calculer,.vp-btn-actualiser,.fp-btn-primary,.ge-btn-primary,.gp-btn-sauvegarder,.ir-btn-primary,.ira-btn-primary,.rv-btn-charger,.rp-btn):hover:not(:disabled),
.kdp-login-shell .kdp-login-btn:hover:not(:disabled) { background: #ffb347; color: #211400; }
.kdp-shell :is(.diag-raccourci,.vp-raccourci,.diag-tab) { min-height: 44px; font-size: .875rem; }
.kdp-shell :is(.diag-tab-actif,.diag-link,.vp-link) { color: var(--sol-accent); border-bottom-color: var(--sol-accent); }
.kdp-shell :is(.diag-raccourci-actif,.vp-raccourci-actif) { color: var(--sol-accent); background: #302316; border-color: #a56a18; }
.kdp-shell .diag-controls { display: flex; flex-direction: column; align-items: stretch; gap: 8px; padding: 12px; }
.kdp-shell .diag-controls > * { min-width: 0; grid-area: auto; }
.kdp-shell .diag-controls > .diag-select { width: 100%; max-width: none; }
.kdp-shell .diag-raccourcis { display: flex; flex-wrap: wrap; gap: 6px; }
.kdp-shell .diag-raccourci { flex: 1 1 auto; padding: 8px 10px; }
.kdp-shell .diag-dates { display: flex; width: 100%; min-width: 0; }
.kdp-shell .diag-input-date { flex: 1 1 0; min-width: 0; width: 0; }
.kdp-shell .diag-cmp-toggle { flex-wrap: wrap; padding: 4px 6px; gap: 6px; }
.kdp-shell .diag-cmp-select { flex: 1 1 150px; min-width: 0; }
.kdp-shell .diag-cmp-plage { flex-wrap: wrap; white-space: normal; }
.kdp-shell .diag-btn-calculer { width: 100%; justify-content: center; }
.kdp-shell .vp-controls { flex-wrap: wrap; gap: 12px; }
.kdp-shell :is(.ir-toolbar,.rv-controls) { gap: 12px; }
.kdp-shell .kdp-nav { background: #111112; border-color: var(--sol-line); }
.kdp-shell .kdp-nav-brand { color: var(--sol-text); letter-spacing: -.02em; }
.kdp-shell .kdp-nav-link { color: #b9b9bf; min-height: 44px; display: flex; align-items: center; border-radius: 9px; }
.kdp-shell .kdp-nav-link:hover,
.kdp-shell .kdp-nav-link.active { color: var(--sol-accent); background: #302316; }
.kdp-shell .kdp-nav-logout { color: var(--sol-muted); min-height: 44px; }
.kdp-login-shell .kdp-login-card { max-width: 400px; padding: 30px 24px; }
.kdp-login-shell .kdp-login-label { font-size: .8rem; text-transform: none; color: var(--sol-muted); }
.kdp-login-shell .kdp-login-subtitle { font-size: .875rem; line-height: 1.6; }
:is(.kdp-shell,.kdp-login-shell) :focus-visible { outline: 2px solid var(--sol-accent); outline-offset: 3px; }
@media (min-width: 640px) {
    /* auto-fill, pas auto-fit : auto-fit étire les cartes existantes pour combler les
       colonnes vides d'une ligne moins chargée, donc 3 lignes de 6/7/5 cartes finissent
       avec des largeurs de carte différentes et des colonnes qui ne s'alignent jamais
       entre les lignes. auto-fill garde les colonnes en trop vides à la place — même
       nombre de colonnes, même largeur de carte, sur les 3 lignes (toutes dans le même
       conteneur .diag-page). */
    .kdp-shell .diag-resume-row { grid-template-columns: repeat(auto-fill,minmax(145px,1fr)); }
    .kdp-shell .diag-controls { flex-direction: row; flex-wrap: wrap; align-items: center; }
    .kdp-shell .diag-controls > .diag-select { flex: 1 1 300px; width: auto; }
    .kdp-shell .diag-dates { width: auto; flex: 1 1 285px; }
    .kdp-shell .diag-btn-calculer { width: auto; margin-left: 0; }
    .kdp-shell :is(input:not([type=checkbox]):not([type=radio]),select,textarea) { font-size: .9rem; }
}
@media (min-width: 1000px) {
    .kdp-shell .diag-piliers-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
    .kdp-shell :is(.diag-card,.vp-card) { padding: 12px 14px; }
}
/* Compact desktop controls; retain comfortable touch targets on mobile. */
@media (min-width: 768px) and (pointer: fine) {
    .kdp-shell .diag-cmp-toggle { flex-wrap: nowrap; }
    .kdp-shell .diag-cmp-select { flex: 0 1 auto; width: auto; }
    .kdp-shell :is(input:not([type=checkbox]):not([type=radio]),select,textarea) {
        min-height: 34px;
        font-size: .82rem;
    }
    .kdp-shell :is(.diag-btn-calculer,.vp-btn-actualiser,.fp-btn-primary,.ge-btn-primary,.gp-btn-sauvegarder,.ir-btn-primary,.ira-btn-primary,.rv-btn-charger,.rp-btn) {
        min-height: 34px;
        padding: 6px 12px;
        font-size: .82rem;
    }
    .kdp-shell :is(.diag-raccourci,.vp-raccourci,.diag-tab,.kdp-nav-link,.kdp-nav-logout) {
        min-height: 34px;
        font-size: .82rem;
    }
    .kdp-shell .diag-raccourci { padding: 5px 9px; }
}
/* Neutral surfaces include inputs and nested metric cards. Semantic alert
   borders and green/red results remain unchanged. */
.kdp-shell :is(.diag-select,.diag-input-date,.diag-cmp-select,.vp-input-date,.fp-input,.ge-input,.ge-select,.gp-input-valeur,.ir-input,.ira-marketplace-select,.rv-input,.rv-select),
.kdp-login-shell .kdp-login-input { background: var(--sol-panel-raised); border-color: var(--sol-line); }
.kdp-shell :is(.diag-m,.fiche-drawer-head,.diag-bsr-rating) { background: var(--sol-panel-raised); }
.kdp-shell .diag-m-secondaire { background: transparent; }
.kdp-shell .diag-m:hover { background: #29292c; border-color: #55555a; }
.kdp-shell .diag-pilier-header { padding: 12px 14px; }
.kdp-shell .diag-pilier-body { padding: 10px 14px 14px; }
.kdp-shell .diag-metriques-grid { gap: 8px; }
.kdp-shell .diag-m-sublabel { font-size: .72rem; line-height: 1.4; }
.kdp-shell .diag-resume-row { gap: 10px; }
.kdp-shell .diag-resume-item { gap: 3px; }
.kdp-shell :is(.diag-subtitle,.vp-subtitle,.fp-subtitle,.ge-subtitle,.gp-subtitle,.hn-subtitle,.ir-subtitle,.ira-subtitle,.rp-subtitle,.rv-subtitle) { font-size: .8rem; }
@media (prefers-reduced-motion: reduce) {
    :is(.kdp-shell,.kdp-login-shell) *, :is(.kdp-shell,.kdp-login-shell) *::before, :is(.kdp-shell,.kdp-login-shell) *::after {
        transition: none !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important;
    }
}
