/* ==========================================================================
   Chronos — modals de configuration (Paramètres, personnalisation, catégories…)
   S'appuie sur la coque `.mp` de manage_policies.css, préfixe `st-` pour le reste.
   ========================================================================== */

#modal-scroll-container:has(.mp.st) {
    width: min(620px, calc(100vw - 40px));
    max-width: none;
    max-height: min(90vh, 860px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #14161b;
    border: 1px solid rgba(255, 255, 255, 0.11);
    border-radius: 22px;
    box-shadow: 0 40px 100px -20px rgba(0, 0, 0, 0.8);
}
#modal-scroll-container:has(.mp.st) #modal-content { display: flex; flex-direction: column; min-height: 0; flex: 1; }
#modal-scroll-container:has(#table-customization-form), #modal-scroll-container:has(#project-colorization-form) { width: min(680px, calc(100vw - 40px)); }

form.mp.st { margin: 0; }
.st-body { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 26px 18px; display: flex; flex-direction: column; gap: 22px; }
.st-body > * { flex: none; }
.mp.st .mp-foot { gap: 10px; }

/* ---------- Sections ------------------------------------------------------ */

.st-sec-title { margin: 0 0 8px; font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--mp-faint); }
.st-card { padding: 4px 16px; background: rgba(255, 255, 255, 0.035); border: 1px solid var(--mp-line); border-radius: 14px; }
.st-line { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 52px; padding: 10px 0; }
.st-line + .st-line { border-top: 1px solid var(--mp-line); }
.st-line > .st-lbl { min-width: 0; }
.st-lbl b { display: block; font-size: 13.5px; font-weight: 600; color: #fff; }
.st-lbl small { display: block; margin-top: 1px; font-size: 12px; color: var(--mp-muted); }

/* ---------- Page d'accueil des paramètres --------------------------------- */

.st-nav { display: flex; flex-direction: column; gap: 8px; }
.st-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 14px; width: 100%; padding: 12px 14px; text-align: left; color: var(--mp-text); background: rgba(255, 255, 255, 0.035); border: 1px solid var(--mp-line); border-radius: 14px; cursor: pointer; transition: background-color 0.12s ease, border-color 0.12s ease, transform 0.1s ease; }
.st-row:hover { background: rgba(255, 255, 255, 0.07); border-color: rgba(255, 255, 255, 0.16); }
.st-row:active { transform: scale(0.992); }
.st-row:focus-visible { outline: 2px solid var(--mp-accent); outline-offset: 2px; }
.st-ico { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; font-size: 19px; color: var(--tone, #a9c5ff); background: color-mix(in srgb, var(--tone, #7aa7ff) 15%, transparent); border: 1px solid color-mix(in srgb, var(--tone, #7aa7ff) 30%, transparent); border-radius: 11px; }
.st-txt b { display: block; font-size: 14.5px; font-weight: 700; color: #fff; }
.st-txt small { display: block; margin-top: 1px; font-size: 12.5px; color: var(--mp-muted); }
.st-go { font-size: 20px; color: var(--mp-faint); transition: transform 0.12s ease, color 0.12s ease; }
.st-row:hover .st-go { color: #fff; transform: translateX(2px); }
.st-row.st-warn:hover { border-color: rgba(248, 113, 113, 0.5); }

/* ---------- Champs --------------------------------------------------------- */

.mp.st input[type="number"], .mp.st input[type="text"] { height: 38px; padding: 0 12px; font-size: 13.5px; color: var(--mp-text); background: #0e1014; border: 1px solid var(--mp-line); border-radius: 11px; outline: none; transition: border-color 0.15s, box-shadow 0.15s; }
.mp.st input[type="number"] { width: 84px; text-align: center; margin: 0; }
.mp.st input[type="number"]:focus, .mp.st input[type="text"]:focus { border-color: var(--mp-accent); box-shadow: 0 0 0 3px rgba(122, 167, 255, 0.18); }

/* pastille de couleur (Pickr remplace .color-preview par son bouton) */
.mp.st .pickr { display: inline-flex; }
.mp.st .pickr .pcr-button, .mp.st .color-preview { width: 32px; height: 32px; padding: 0; border: 1px solid rgba(255, 255, 255, 0.25) !important; border-radius: 10px; cursor: pointer; }
.mp.st .pickr .pcr-button::before, .mp.st .pickr .pcr-button::after { border-radius: 9px; }
.mp.st .color-preview { margin: 0; background-image: repeating-conic-gradient(rgba(255, 255, 255, 0.14) 0% 25%, transparent 0% 50%); background-size: 10px 10px; }
.pcr-app { border: 1px solid rgba(0, 0, 0, 0.15); border-radius: 12px; box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55); }

/* interrupteurs en grille (colonnes visibles) */
.st-switches { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.st-sw { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 42px; padding: 0 12px 0 14px; font-size: 13.5px; font-weight: 500; color: var(--mp-text); background: rgba(255, 255, 255, 0.035); border: 1px solid var(--mp-line); border-radius: 12px; cursor: pointer; transition: background-color 0.12s ease, border-color 0.12s ease; }
.st-sw:hover { background: rgba(255, 255, 255, 0.06); }
.st-sw:has(input:checked) { border-color: rgba(52, 211, 153, 0.35); }
@media (max-width: 560px) { .st-switches { grid-template-columns: 1fr; } }

/* ---------- Fond d'écran (galerie existante, restylée) ---------------------- */

.mp.st .wallpaper-upload-btn { height: 32px; padding: 0 12px; font-size: 12.5px; color: var(--mp-text); background: rgba(255, 255, 255, 0.07); border: 1px solid var(--mp-line); border-radius: 10px; }
.mp.st .wallpaper-upload-btn:hover { background: rgba(255, 255, 255, 0.13); }
.mp.st .wallpaper-gallery { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); max-height: 250px; padding: 4px 4px 4px 0; gap: 10px; }
.mp.st .wallpaper-tile { border-radius: 12px; border-width: 2px; }
.mp.st .wallpaper-tile.selected { border-color: var(--mp-accent); box-shadow: 0 0 0 3px rgba(122, 167, 255, 0.28); }
.mp.st .wallpaper-tile.wallpaper-none { border-color: var(--mp-line); }

/* ---------- Colorisation des projets / catégories -------------------------- */

.st-proj { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 10px 12px 10px 16px; background: rgba(255, 255, 255, 0.035); border: 1px solid var(--mp-line); border-radius: 14px; }
.st-proj b { font-size: 14px; font-weight: 600; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-proj .st-hint { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--mp-muted); flex: none; }
.st-projects { display: flex; flex-direction: column; gap: 8px; }

.st-add { display: flex; gap: 8px; }
.st-add input { flex: 1; min-width: 0; height: 40px !important; }
.st-add .mp-primary { height: 40px; }

.st-cat { grid-template-columns: minmax(0, 1fr) auto; border-left-color: var(--mp-accent); padding: 10px 12px 10px 16px; }
.st-cat .mp-name { font-weight: 600; }
.st-cat .st-cat-input { display: none; width: 100%; height: 34px; }
.st-cat .st-acts-edit { display: none; gap: 4px; }
.st-cat.is-editing .mp-name, .st-cat.is-editing .mp-acts-main, .st-cat.is-editing .mp-acts-confirm { display: none; }
.st-cat.is-editing .st-cat-input { display: block; }
.st-cat.is-editing .st-acts-edit { display: flex; }
.st-cat .mp-actions { min-height: 34px; }
.st-save-ic { color: #86efac; }
.st-save-ic:hover { color: #bbf7d0; background: rgba(34, 197, 94, 0.2); border-color: rgba(34, 197, 94, 0.45); }

@media (max-width: 640px) {
    .st-body { padding: 4px 18px 16px; }
}

/* ---------- dégradé de fond (Personnalisation globale) ---------- */
.grad-preview { height: 64px; margin: 12px 0 4px; border: 1px solid var(--mp-line); border-radius: 12px; }
.grad-preview.is-empty { background: repeating-conic-gradient(rgba(255, 255, 255, 0.07) 0% 25%, transparent 0% 50%) 0 0 / 14px 14px; }
.grad-select { height: 34px; padding: 0 10px; font-size: 13px; color: var(--mp-text); background: #0e1014; border: 1px solid var(--mp-line); border-radius: 10px; outline: none; }
.grad-angle { display: flex; align-items: center; gap: 10px; }
.grad-angle input[type="range"] { width: 130px; accent-color: var(--mp-accent); }
.grad-angle output { min-width: 40px; text-align: right; font-size: 12.5px; color: var(--mp-muted); font-variant-numeric: tabular-nums; }
.grad-presets { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.grad-chip { display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 12px 0 5px; font-size: 12.5px; color: var(--mp-text); cursor: pointer; background: rgba(255, 255, 255, 0.05); border: 1px solid var(--mp-line); border-radius: 99px; }
.grad-chip:hover { color: #fff; border-color: var(--mp-accent); }
.grad-chip span { width: 20px; height: 20px; border: 1px solid rgba(255, 255, 255, 0.2); border-radius: 50%; }
.grad-chip span.none { background: repeating-conic-gradient(rgba(255, 255, 255, 0.2) 0% 25%, transparent 0% 50%) 0 0 / 8px 8px; }
.st-note { margin: 8px 2px 0; font-size: 12px; color: var(--mp-muted); }
