/* Cadre des pages index : encre ardoise et accent orange, lisible en clair et en sombre. */

.lw-index {
    --lw-ink: #1e293b;
    --lw-muted: #475569;
    --lw-line: #e2e8f0;
    --lw-paper: #ffffff;
    --lw-soft: #f8fafc;
    --lw-accent: #ea580c;
    --lw-accent-soft: #ffedd5;
    --lw-accent-ink: #9a3412;
    width: 100%;
    margin: 0;
    padding: 0;
    color: var(--lw-ink);
}

.dark .lw-index {
    --lw-ink: #f1f5f9;
    --lw-muted: #cbd5e1;
    --lw-line: rgba(148, 163, 184, 0.28);
    --lw-paper: #0e1726;
    --lw-soft: rgba(148, 163, 184, 0.12);
    --lw-accent-soft: rgba(234, 88, 12, 0.18);
    --lw-accent-ink: #fdba74;
}

.lw-index-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--lw-line);
}

.lw-index-title {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    margin: 0;
    font-size: 1.5rem;
    line-height: 1.25;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--lw-ink);
}

.lw-index-title::before,
.lw-index h1::before {
    content: "";
    width: 0.45rem;
    height: 1.15rem;
    border-radius: 2px;
    background: #f97316;
    flex: none;
}

.lw-index h1 {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.lw-index h1 + p,
.lw-index p.text-white-dark {
    max-width: 65ch;
    line-height: 1.5;
    color: var(--lw-muted);
}

.lw-index-sub {
    margin: 0.35rem 0 0;
    max-width: 65ch;
    font-size: 0.9375rem;
    line-height: 1.5;
    color: var(--lw-muted);
}

.lw-index-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
}

.lw-index-alert {
    margin-bottom: 1rem;
    padding: 0.85rem 1rem;
    border-radius: 0.75rem;
    border: 1px solid transparent;
    font-size: 0.9375rem;
    line-height: 1.5;
    font-weight: 600;
}

.lw-index-alert--success {
    color: #064e3b;
    background: #ecfdf5;
    border-color: #6ee7b7;
}

.lw-index-alert--error {
    color: #7f1d1d;
    background: #fef2f2;
    border-color: #fca5a5;
}

.lw-index-alert--warning {
    color: #7c2d12;
    background: #fff7ed;
    border-color: #fdba74;
}

.lw-index-note {
    margin-bottom: 1rem;
    font-size: 0.9375rem;
    line-height: 1.55;
    color: var(--lw-muted);
}

/* Bandeau des actions groupées, affiché quand des lignes sont cochées. */
.lw-index-bulk {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.625rem 1rem;
    border: 1px solid var(--lw-line);
    border-radius: 0.5rem;
    background: var(--lw-soft);
    color: var(--lw-ink);
}

.lw-index-bulk[x-cloak] {
    display: none;
}

.lw-index-bulk-count {
    font-size: 0.875rem;
    font-weight: 700;
}

.lw-index-bulk-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.lw-stat-label {
    margin: 0 0 0.25rem;
    font-size: 0.8125rem;
    font-weight: 700;
    line-height: 1.4;
    color: var(--lw-muted);
}

.lw-stat-meta {
    margin-top: 0.25rem;
    font-size: 0.875rem;
    line-height: 1.45;
    color: var(--lw-muted);
}

.lw-stat-link {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    margin-top: 0.35rem;
    font-size: 0.875rem;
    font-weight: 700;
    color: #047857;
}

.dark .lw-stat-link {
    color: #6ee7b7;
}

.lw-dash-field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-width: min(100%, 16rem);
}

.lw-dash-field label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--lw-muted);
}

.lw-index-pill {
    display: inline-flex;
    align-items: center;
    min-height: 1.5rem;
    padding: 0 0.5rem;
    border-radius: 999px;
    background: var(--lw-soft);
    color: var(--lw-ink);
    font-size: 0.75rem;
    font-weight: 700;
}

.lw-disclose {
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    font-weight: 700;
    text-align: start;
    cursor: pointer;
}

.lw-disclose-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 0.5rem;
    background: transparent;
    color: var(--lw-muted);
    cursor: pointer;
}

.lw-disclose-icon svg {
    transition: transform 200ms ease;
}

.lw-index form label {
    letter-spacing: 0;
    text-transform: none;
}

.lw-index-filters form > div:has(.btn) select {
    width: auto;
    min-width: 11rem;
}

.dark .lw-index-alert--success {
    color: #d1fae5;
    background: rgba(6, 78, 59, 0.55);
    border-color: rgba(110, 231, 183, 0.35);
}

.dark .lw-index-alert--error {
    color: #fecaca;
    background: rgba(127, 29, 29, 0.35);
    border-color: rgba(252, 165, 165, 0.35);
}

.dark .lw-index-alert--warning {
    color: #ffedd5;
    background: rgba(124, 45, 18, 0.4);
    border-color: rgba(253, 186, 116, 0.4);
}

.lw-index-filters {
    --lw-ink: #1f2937;
    --lw-muted: #6b7280;
    --lw-line: #e5e7eb;
    --lw-soft: #ffffff;
    margin-bottom: 1.25rem;
    border: 1px solid var(--lw-line);
    border-radius: 0.75rem;
    background: var(--lw-paper);
    overflow: hidden;
}

.dark .lw-index-filters {
    --lw-ink: #e0e6ed;
    --lw-muted: #888ea8;
    --lw-line: #1b2e4b;
    --lw-soft: #0e1726;
}

.lw-index-filters-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    min-height: 44px;
    padding: 0.65rem 1rem;
    border: 0;
    background: var(--lw-soft);
    color: inherit;
    font: inherit;
    text-align: start;
    cursor: pointer;
}

.lw-index-filters.is-open .lw-index-filters-bar {
    border-bottom: 1px solid var(--lw-line);
}

.lw-index-filters-chevron {
    margin-left: auto;
    flex-shrink: 0;
    transition: transform 0.15s ease;
}

.lw-index-filters.is-open .lw-index-filters-chevron {
    transform: rotate(180deg);
}

.lw-index-filter-panel[x-cloak] {
    display: none;
}

.lw-index-filters-label {
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--lw-ink);
}

.lw-index-count {
    display: inline-flex;
    align-items: center;
    min-height: 1.5rem;
    padding: 0 0.55rem;
    border-radius: 999px;
    background: var(--lw-accent-soft);
    color: var(--lw-accent-ink);
    font-size: 0.75rem;
    font-weight: 700;
}

.lw-index-filter-panel {
    padding: 1rem;
}

.lw-index-filters form {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.75rem 1rem;
}

.lw-index-filters form > div {
    flex: 1 1 11rem;
    min-width: min(100%, 11rem);
}

.lw-index-filters form > div:has(input[type="text"]),
.lw-index-filters form > div:has(input[type="search"]),
.lw-index-filters form > div:has(input[type="date"]) {
    flex: 2 1 16rem;
}

.lw-index-filters form > div:has(.btn) {
    flex: 0 1 auto;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
}

.lw-index-filters label {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 0.8125rem;
    font-weight: 600;
    line-height: 1.4;
    letter-spacing: 0;
    text-transform: none;
    color: var(--lw-muted);
}

.lw-index-filters .form-input,
.lw-index-filters .form-select,
.lw-index-filters input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
.lw-index-filters select {
    width: 100%;
    min-height: 44px;
    font-size: 1rem;
}

.lw-index-filters p {
    margin: 0 0 0.75rem;
    font-size: 0.9375rem;
    line-height: 1.5;
    color: var(--lw-muted);
}

.lw-index-stats {
    margin-bottom: 1.25rem;
}

.lw-index-panel {
    margin-top: 0.25rem;
    max-width: 100%;
}

.lw-index .datatable-container,
.lw-index-table-scroll {
    overflow-x: auto;
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
}

/* Nom + pastilles d'une ligne : chaque pastille reste d'un seul tenant et passe à la ligne entière. */
.lw-badge-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem 0.375rem;
}

.lw-badge-row .badge {
    margin: 0;
    white-space: nowrap;
}

.lw-index .btn,
.lw-index button,
.lw-index a.btn,
.lw-index [role="button"] {
    cursor: pointer;
}

@media (pointer: coarse) {
    .lw-index .btn,
    .lw-index button,
    .lw-index a.btn,
    .lw-index [role="button"] {
        min-height: 44px;
    }
}

.lw-index-thumb,
.lw-index-media {
    width: 2rem;
    height: 2rem;
    border-radius: 0.375rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    margin-right: 0.5rem;
}

.lw-index-thumb {
    object-fit: cover;
    display: inline-block;
}

.lw-index-media {
    background: #1e293b;
    color: #f8fafc;
}

.lw-index-media--empty {
    background: var(--lw-soft);
    color: var(--lw-muted);
}

.lw-index a:focus-visible,
.lw-index button:focus-visible,
.lw-index input:focus-visible,
.lw-index select:focus-visible,
.lw-index textarea:focus-visible,
.lw-index [role="button"]:focus-visible {
    outline: 2px solid var(--lw-accent);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    .lw-index *,
    .lw-index *::before,
    .lw-index *::after {
        transition: none !important;
        animation: none !important;
        scroll-behavior: auto !important;
    }
}

/* Onglets soulignés (paramètres, comptabilité), repris de users-account-settings.html (Vristo).
   Un onglet est un bouton (aria-selected) ou un lien vers une autre page (aria-current="page"). */
.lw-tabs {
    display: flex;
    gap: 0.25rem;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
    scrollbar-color: var(--lw-line) transparent;
    box-shadow: inset 0 -1px 0 var(--lw-line);
}

.lw-tab {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
    min-height: 48px;
    padding: 0 0.875rem;
    border: 0;
    border-bottom: 2px solid transparent;
    background: none;
    color: var(--lw-muted);
    font-size: 0.9375rem;
    font-weight: 600;
    white-space: nowrap;
    text-decoration: none;
    cursor: pointer;
    transition: color 180ms ease, border-color 180ms ease;
}

.lw-tab:hover {
    color: var(--lw-ink);
    border-bottom-color: var(--lw-line);
}

.lw-tab[aria-selected="true"],
.lw-tab[aria-current="page"] {
    color: var(--lw-accent-ink);
    border-bottom-color: var(--lw-accent);
}

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

.lw-tab-count {
    min-width: 1.5rem;
    padding: 0 0.45rem;
    border-radius: 999px;
    background: var(--lw-soft);
    color: var(--lw-muted);
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1.5rem;
    text-align: center;
    transition: background-color 180ms ease, color 180ms ease;
}

.lw-tab[aria-selected="true"] .lw-tab-count {
    background: var(--lw-accent-soft);
    color: var(--lw-accent-ink);
}

@media (pointer: coarse) {
    .lw-tabs {
        scrollbar-width: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .lw-tab,
    .lw-tab-count {
        transition: none;
    }
}

/* Puces : périodes usuelles des états comptables, filtres de lignes du grand livre. */
.lw-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.lw-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    min-height: 36px;
    padding: 0 0.875rem;
    border: 1px solid var(--lw-line);
    border-radius: 999px;
    background: var(--lw-paper);
    color: var(--lw-muted);
    font-size: 0.8125rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease;
}

.lw-chip:hover {
    color: var(--lw-ink);
    background: var(--lw-soft);
}

.lw-chip[aria-current="true"],
.lw-chip[aria-pressed="true"] {
    border-color: var(--lw-accent);
    background: var(--lw-accent-soft);
    color: var(--lw-accent-ink);
}

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

.lw-chip-count {
    min-width: 1.4rem;
    padding: 0 0.4rem;
    border-radius: 999px;
    background: var(--lw-soft);
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1.4rem;
    text-align: center;
}

.lw-period {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.25rem;
}

.lw-period-form {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.75rem;
}

/* Barre de part, reprise de Nkapsala. */
.lw-usage {
    height: 0.5rem;
    overflow: hidden;
    border-radius: 9999px;
    background: var(--lw-soft, #f1f5f9);
    box-shadow: inset 0 0 0 1px var(--lw-line, #e2e8f0);
}

.lw-usage > span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: #00ab55;
}

.lw-usage > span.is-over {
    background: #e2a03f;
}
