/* ==========================================================================
   XAlpha — design system
   Sombre par défaut, clair au choix. Bords fins, densité maîtrisée,
   aucune dépendance externe.
   ========================================================================== */

/* --- Jetons : thème sombre (défaut) ------------------------------------- */
:root {
    --bg:            #0b0d11;
    --bg-grid:       #0e1116;
    --surface:       #12151b;
    --surface-2:     #171b22;
    --surface-3:     #1d222b;
    --border:        #232833;
    --border-strong: #2f3644;

    --text:          #e6e9ef;
    --text-dim:      #99a1b0;
    --text-faint:    #6b7383;

    --accent:        #5b7cfa;
    --accent-hover:  #6f8cff;
    --accent-soft:   rgba(91,124,250,.14);
    --accent-ring:   rgba(91,124,250,.35);

    --pos:           #26c281;
    --pos-soft:      rgba(38,194,129,.13);
    --neg:           #f0526b;
    --neg-soft:      rgba(240,82,107,.13);
    --warn:          #e6a44a;
    --warn-soft:     rgba(230,164,74,.13);
    --info:          #4aa8e6;
    --info-soft:     rgba(74,168,230,.13);

    --shadow:        0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.28);
    --shadow-sm:     0 1px 2px rgba(0,0,0,.35);

    --r-sm: 6px;
    --r:    9px;
    --r-lg: 14px;

    --sidebar-w: 232px;
    --topbar-h:  56px;

    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Mono", Menlo, Consolas, monospace;

    color-scheme: dark;
}

/* --- Jetons : thème clair ----------------------------------------------- */
[data-theme="light"] {
    --bg:            #f6f7f9;
    --bg-grid:       #eef0f4;
    --surface:       #ffffff;
    --surface-2:     #fafbfc;
    --surface-3:     #f2f4f7;
    --border:        #e3e6ec;
    --border-strong: #cfd4de;

    --text:          #10131a;
    --text-dim:      #5c6474;
    --text-faint:    #8b93a3;

    --accent:        #3b5bdb;
    --accent-hover:  #2f4bc4;
    --accent-soft:   rgba(59,91,219,.09);
    --accent-ring:   rgba(59,91,219,.28);

    --pos:           #0f9d63;
    --pos-soft:      rgba(15,157,99,.10);
    --neg:           #d92d4e;
    --neg-soft:      rgba(217,45,78,.10);
    --warn:          #b87413;
    --warn-soft:     rgba(184,116,19,.11);
    --info:          #1a7fbd;
    --info-soft:     rgba(26,127,189,.10);

    --shadow:        0 1px 2px rgba(16,19,26,.06), 0 8px 24px rgba(16,19,26,.07);
    --shadow-sm:     0 1px 2px rgba(16,19,26,.07);

    color-scheme: light;
}

/* --- Réinitialisation ---------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html, body { height: 100%; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: 20px; }
h2 { font-size: 16px; }
h3 { font-size: 14px; }
p  { margin: 0 0 10px; }

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; }

code, .mono, kbd { font-family: var(--mono); font-size: .92em; }

:focus-visible {
    outline: 2px solid var(--accent-ring);
    outline-offset: 2px;
    border-radius: 3px;
}

::selection { background: var(--accent-soft); }

/* Barres de défilement discrètes */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border: 3px solid var(--bg);
    border-radius: 6px;
}

/* --- Utilitaires --------------------------------------------------------- */
.row      { display: flex; align-items: center; gap: 10px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.col      { display: flex; flex-direction: column; gap: 10px; }
.wrap     { flex-wrap: wrap; }
.grow     { flex: 1 1 auto; min-width: 0; }
.right    { margin-left: auto; }
.center   { text-align: center; }
.ta-right { text-align: right; }
.nowrap   { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hidden   { display: none !important; }

.dim   { color: var(--text-dim); }
.faint { color: var(--text-faint); }
.pos   { color: var(--pos); }
.neg   { color: var(--neg); }
.warnc { color: var(--warn); }

.xs { font-size: 11px; }
.sm { font-size: 12px; }
.lg { font-size: 16px; }
.xl { font-size: 22px; }
.b  { font-weight: 600; }

.mt0 { margin-top: 0; }
.mt1 { margin-top: 8px; }
.mt2 { margin-top: 16px; }
.mt3 { margin-top: 24px; }
.mb1 { margin-bottom: 8px; }
.mb2 { margin-bottom: 16px; }
.mb3 { margin-bottom: 24px; }

.tabular { font-variant-numeric: tabular-nums; }

/* --- Squelette d'application --------------------------------------------- */
.app {
    display: grid;
    grid-template-columns: var(--sidebar-w) 1fr;
    min-height: 100vh;
}

.sidebar {
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    height: var(--topbar-h);
    padding: 0 16px;
    border-bottom: 1px solid var(--border);
    flex: 0 0 auto;
}
.brand-mark {
    width: 26px; height: 26px;
    border-radius: 7px;
    background: linear-gradient(135deg, var(--accent), #8b5cf6);
    display: grid; place-items: center;
    color: #fff; font-weight: 700; font-size: 13px;
    flex: 0 0 auto;
}
.brand-name { font-weight: 650; letter-spacing: -.02em; font-size: 15px; }
.brand-tag {
    font-size: 9px; text-transform: uppercase; letter-spacing: .09em;
    color: var(--text-faint); border: 1px solid var(--border);
    padding: 1px 5px; border-radius: 4px;
}

.nav { padding: 10px 8px; display: flex; flex-direction: column; gap: 1px; flex: 1 1 auto; }
.nav-label {
    font-size: 10px; text-transform: uppercase; letter-spacing: .09em;
    color: var(--text-faint); padding: 14px 8px 5px;
}
.nav a {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 10px; border-radius: var(--r-sm);
    color: var(--text-dim); font-size: 13px; font-weight: 500;
    text-decoration: none;
    transition: background .12s, color .12s;
}
.nav a:hover { background: var(--surface-3); color: var(--text); text-decoration: none; }
.nav a.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav a.on svg { color: var(--accent); }
.nav svg { width: 16px; height: 16px; flex: 0 0 auto; opacity: .9; }
.nav .badge-count {
    margin-left: auto; background: var(--neg); color: #fff;
    font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 9px;
    min-width: 18px; text-align: center;
}

.sidebar-foot { padding: 10px; border-top: 1px solid var(--border); flex: 0 0 auto; }

.main { display: flex; flex-direction: column; min-width: 0; }

.topbar {
    height: var(--topbar-h);
    border-bottom: 1px solid var(--border);
    background: color-mix(in srgb, var(--bg) 85%, transparent);
    backdrop-filter: blur(8px);
    display: flex; align-items: center; gap: 12px;
    padding: 0 20px;
    position: sticky; top: 0; z-index: 20;
}

.content { padding: 20px; flex: 1 1 auto; }
.content-narrow { max-width: 880px; margin: 0 auto; }

/* --- Cartes -------------------------------------------------------------- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r);
    overflow: hidden;
}
.card-head {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: 10px;
}
.card-head h2, .card-head h3 { font-size: 13px; font-weight: 600; }
.card-body { padding: 16px; }
.card-foot { padding: 10px 16px; border-top: 1px solid var(--border); background: var(--surface-2); }

.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* Deux colonnes de largeurs inégales : liste + détail, ou contenu + panneau.
   Définies ici plutôt qu'en style direct sur la page, sinon aucune règle
   d'adaptation ne pourrait les empiler sur un petit écran. */
.split-side { display: grid; gap: 14px; align-items: start;
              grid-template-columns: 330px minmax(0, 1fr); }

/* Zones défilantes d'une liste et de son fil de discussion. */
.list-scroll   { max-height: 70vh; overflow-y: auto; }
.thread-scroll { max-height: 52vh; overflow-y: auto; }
.split-wide { display: grid; gap: 14px;
              grid-template-columns: 1.6fr minmax(0, 1fr); }

/* --- Tuiles de statistique ----------------------------------------------- */
.stat {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r);
    padding: 14px 16px;
    display: flex; flex-direction: column; gap: 5px;
    min-width: 0;
}
.stat-label {
    font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
    color: var(--text-faint); font-weight: 600;
    display: flex; align-items: center; gap: 6px;
}
.stat-value {
    font-size: 23px; font-weight: 620; letter-spacing: -.02em;
    font-variant-numeric: tabular-nums; line-height: 1.15;
}
.stat-sub { font-size: 12px; color: var(--text-dim); }

/* --- Badges -------------------------------------------------------------- */
.badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 2px 8px; border-radius: 20px;
    font-size: 11px; font-weight: 600; line-height: 1.6;
    border: 1px solid transparent; white-space: nowrap;
}
.badge-ok   { background: var(--pos-soft);    color: var(--pos);    border-color: color-mix(in srgb, var(--pos) 22%, transparent); }
.badge-err  { background: var(--neg-soft);    color: var(--neg);    border-color: color-mix(in srgb, var(--neg) 22%, transparent); }
.badge-warn { background: var(--warn-soft);   color: var(--warn);   border-color: color-mix(in srgb, var(--warn) 22%, transparent); }
.badge-info { background: var(--info-soft);   color: var(--info);   border-color: color-mix(in srgb, var(--info) 22%, transparent); }
.badge-mut  { background: var(--surface-3);   color: var(--text-dim); border-color: var(--border); }
.badge-acc  { background: var(--accent-soft); color: var(--accent); border-color: color-mix(in srgb, var(--accent) 22%, transparent); }

.dot { width: 7px; height: 7px; border-radius: 50%; flex: 0 0 auto; background: var(--text-faint); }
.dot-ok   { background: var(--pos); box-shadow: 0 0 0 3px var(--pos-soft); }
.dot-err  { background: var(--neg); box-shadow: 0 0 0 3px var(--neg-soft); }
.dot-warn { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft); }

@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }
.dot-live { animation: pulse 2s ease-in-out infinite; }

/* --- Tableaux ------------------------------------------------------------ */
.table-wrap { overflow-x: auto; }

table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl th {
    text-align: left; font-weight: 600; font-size: 11px;
    text-transform: uppercase; letter-spacing: .05em;
    color: var(--text-faint);
    padding: 9px 14px;
    border-bottom: 1px solid var(--border);
    background: var(--surface-2);
    white-space: nowrap;
    position: sticky; top: 0;
}
table.tbl td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
table.tbl tbody tr:last-child td { border-bottom: 0; }
table.tbl tbody tr { transition: background .1s; }
table.tbl tbody tr:hover { background: var(--surface-2); }
table.tbl td.num, table.tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.tbl.compact td { padding: 7px 12px; }

.row-click { cursor: pointer; }

/* --- Boutons ------------------------------------------------------------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    padding: 7px 13px;
    border-radius: var(--r-sm);
    border: 1px solid var(--border-strong);
    background: var(--surface-2);
    color: var(--text);
    font-family: inherit; font-size: 13px; font-weight: 500;
    cursor: pointer;
    transition: background .12s, border-color .12s, opacity .12s;
    white-space: nowrap;
    text-decoration: none;
}
.btn:hover { background: var(--surface-3); text-decoration: none; color: var(--text); }
.btn:active { transform: translateY(.5px); }
.btn:disabled, .btn.is-busy { opacity: .55; cursor: not-allowed; }
.btn svg { width: 15px; height: 15px; }

.btn-primary {
    background: var(--accent); border-color: var(--accent); color: #fff;
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }

.btn-danger { background: var(--neg); border-color: var(--neg); color: #fff; }
.btn-danger:hover { background: color-mix(in srgb, var(--neg) 85%, #000); color: #fff; }

.btn-ghost { background: transparent; border-color: transparent; color: var(--text-dim); }
.btn-ghost:hover { background: var(--surface-3); color: var(--text); }

.btn-sm { padding: 4px 9px; font-size: 12px; }
.btn-sm svg { width: 13px; height: 13px; }
.btn-icon { padding: 6px; }
.btn-block { width: 100%; }

/* --- Formulaires --------------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.field > label {
    font-size: 12px; font-weight: 600; color: var(--text-dim);
    display: flex; align-items: center; gap: 6px;
}
.field .hint { font-size: 11px; color: var(--text-faint); }

input[type="text"], input[type="password"], input[type="email"],
input[type="number"], input[type="date"], input[type="search"],
select, textarea {
    width: 100%;
    padding: 8px 11px;
    background: var(--bg-grid);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-sm);
    color: var(--text);
    font-family: inherit;
    font-size: 13px;
    transition: border-color .12s, box-shadow .12s;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-ring);
}
input::placeholder, textarea::placeholder { color: var(--text-faint); }
input:disabled, select:disabled, textarea:disabled { opacity: .6; cursor: not-allowed; }
textarea { resize: vertical; min-height: 78px; line-height: 1.5; }

select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%2399a1b0' stroke-width='1.6'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 9px center;
    background-size: 15px;
    padding-right: 30px;
}

.check { display: flex; align-items: flex-start; gap: 9px; cursor: pointer; font-size: 13px; }
.check input[type="checkbox"] {
    width: 16px; height: 16px; margin: 1px 0 0; accent-color: var(--accent); cursor: pointer; flex: 0 0 auto;
}

.input-group { display: flex; gap: 6px; align-items: center; }
.input-group input { flex: 1 1 auto; }

/* --- Messages ------------------------------------------------------------ */
.alert {
    padding: 10px 13px;
    border-radius: var(--r-sm);
    border: 1px solid;
    font-size: 13px;
    display: flex; align-items: flex-start; gap: 9px;
    margin-bottom: 14px;
}
.alert svg { width: 16px; height: 16px; flex: 0 0 auto; margin-top: 1px; }
.alert-err  { background: var(--neg-soft);  border-color: color-mix(in srgb, var(--neg) 30%, transparent);  color: var(--neg); }
.alert-ok   { background: var(--pos-soft);  border-color: color-mix(in srgb, var(--pos) 30%, transparent);  color: var(--pos); }
.alert-warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 30%, transparent); color: var(--warn); }
.alert-info { background: var(--info-soft); border-color: color-mix(in srgb, var(--info) 30%, transparent); color: var(--info); }

/* --- Notifications transitoires ------------------------------------------ */
.toasts {
    position: fixed; bottom: 18px; right: 18px; z-index: 200;
    display: flex; flex-direction: column; gap: 8px; max-width: 340px;
}
.toast {
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-left: 3px solid var(--accent);
    border-radius: var(--r-sm);
    padding: 10px 13px;
    box-shadow: var(--shadow);
    font-size: 13px;
    animation: toast-in .18s ease-out;
}
.toast.ok  { border-left-color: var(--pos); }
.toast.err { border-left-color: var(--neg); }
@keyframes toast-in { from { opacity: 0; transform: translateX(12px); } to { opacity: 1; transform: none; } }

/* --- Fenêtres modales ---------------------------------------------------- */
.modal-back {
    position: fixed; inset: 0; z-index: 100;
    background: rgba(0,0,0,.55);
    backdrop-filter: blur(3px);
    display: grid; place-items: center;
    padding: 20px;
    animation: fade .14s ease-out;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.modal {
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow);
    width: 100%; max-width: 540px;
    max-height: 88vh;
    display: flex; flex-direction: column;
    animation: modal-in .16s ease-out;
}
.modal.wide { max-width: 800px; }
@keyframes modal-in { from { opacity: 0; transform: translateY(8px) scale(.99); } to { opacity: 1; transform: none; } }

.modal-head {
    padding: 14px 18px; border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: 10px; flex: 0 0 auto;
}
.modal-body { padding: 18px; overflow-y: auto; flex: 1 1 auto; }
.modal-foot {
    padding: 12px 18px; border-top: 1px solid var(--border);
    display: flex; gap: 8px; justify-content: flex-end; flex: 0 0 auto;
    background: var(--surface-2);
}

/* --- Onglets ------------------------------------------------------------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.tab {
    padding: 8px 13px; font-size: 13px; font-weight: 500;
    color: var(--text-dim); cursor: pointer;
    border: 0; background: none; font-family: inherit;
    border-bottom: 2px solid transparent; margin-bottom: -1px;
    transition: color .12s, border-color .12s;
}
.tab:hover { color: var(--text); }
.tab.on { color: var(--accent); border-bottom-color: var(--accent); }

/* --- État vide et chargement --------------------------------------------- */
.empty {
    padding: 44px 20px; text-align: center; color: var(--text-faint);
}
.empty svg { width: 34px; height: 34px; opacity: .35; margin-bottom: 10px; }
.empty-title { font-size: 14px; font-weight: 600; color: var(--text-dim); margin-bottom: 3px; }

.skel {
    background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.3s infinite;
    border-radius: 4px;
    height: 12px;
}
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

.spinner {
    width: 15px; height: 15px;
    border: 2px solid var(--border-strong);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin .7s linear infinite;
    display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --- Bascule de thème ---------------------------------------------------- */
.theme-btn {
    width: 32px; height: 32px;
    display: grid; place-items: center;
    border: 1px solid var(--border);
    background: var(--surface-2);
    border-radius: var(--r-sm);
    cursor: pointer; color: var(--text-dim);
    transition: color .12s, background .12s;
}
.theme-btn:hover { color: var(--text); background: var(--surface-3); }
.theme-btn svg { width: 16px; height: 16px; }
[data-theme="light"] .icon-moon { display: none; }
.icon-sun { display: none; }
[data-theme="light"] .icon-sun { display: block; }

/* --- Pages d'authentification -------------------------------------------- */
.auth-page {
    min-height: 100vh;
    display: grid; place-items: center;
    padding: 20px;
    background:
        radial-gradient(1000px 500px at 50% -10%, var(--accent-soft), transparent 65%),
        var(--bg);
}
.auth-card {
    width: 100%; max-width: 396px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 30px;
    box-shadow: var(--shadow);
}
.auth-brand {
    display: flex; align-items: center; justify-content: center;
    gap: 10px; margin-bottom: 6px;
}
.auth-brand .brand-mark { width: 32px; height: 32px; font-size: 15px; }
.auth-brand .brand-name { font-size: 19px; }
.auth-sub { text-align: center; color: var(--text-dim); font-size: 13px; margin-bottom: 24px; }
.auth-foot { text-align: center; margin-top: 20px; font-size: 11px; color: var(--text-faint); }

/* --- Barre de progression ------------------------------------------------ */
.bar {
    height: 5px; background: var(--surface-3);
    border-radius: 3px; overflow: hidden;
}
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 3px; transition: width .3s; }
.bar > i.pos { background: var(--pos); }
.bar > i.neg { background: var(--neg); }
.bar > i.warn { background: var(--warn); }

/* --- Graphiques ---------------------------------------------------------- */
.chart { width: 100%; display: block; overflow: visible; }
.chart .grid-line { stroke: var(--border); stroke-width: 1; }
.chart .axis-text { fill: var(--text-faint); font-size: 10px; font-family: var(--font); }
.chart .line-pos { stroke: var(--pos); stroke-width: 1.75; fill: none; stroke-linejoin: round; stroke-linecap: round; }
.chart .line-neg { stroke: var(--neg); stroke-width: 1.75; fill: none; stroke-linejoin: round; stroke-linecap: round; }
.chart .line-acc { stroke: var(--accent); stroke-width: 1.75; fill: none; stroke-linejoin: round; stroke-linecap: round; }

/* --- Messagerie ---------------------------------------------------------- */
.thread { display: flex; flex-direction: column; gap: 12px; padding: 4px; }
.msg { max-width: 76%; display: flex; flex-direction: column; gap: 4px; }
.msg-in  { align-self: flex-start; }
.msg-out { align-self: flex-end; align-items: flex-end; }
.msg-bubble {
    padding: 9px 13px; border-radius: 12px; font-size: 13px;
    border: 1px solid var(--border); background: var(--surface-2);
    white-space: pre-wrap; word-break: break-word; line-height: 1.5;
}
.msg-out .msg-bubble { background: var(--accent); border-color: var(--accent); color: #fff; }
.msg-meta { font-size: 10px; color: var(--text-faint); padding: 0 3px; }

/* --- Bloc de code / clé ------------------------------------------------- */
.keybox {
    font-family: var(--mono); font-size: 12px;
    background: var(--bg-grid); border: 1px solid var(--border-strong);
    border-radius: var(--r-sm); padding: 11px 13px;
    word-break: break-all; line-height: 1.6;
    display: flex; align-items: center; gap: 10px;
}
.keybox .grow { user-select: all; }

/* --- Adaptation aux petits écrans ---------------------------------------- */
@media (max-width: 1100px) {
    .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
    .app { grid-template-columns: 1fr; }
    .sidebar {
        position: fixed; z-index: 90; left: 0; top: 0;
        width: var(--sidebar-w);
        transform: translateX(-100%);
        transition: transform .2s ease;
        box-shadow: var(--shadow);
    }
    .sidebar.open { transform: none; }
    .g2, .g3, .g4,
    .split-side, .split-wide { grid-template-columns: 1fr; }
    .content { padding: 14px; }
    .topbar { padding: 0 14px; }
    .hide-sm { display: none !important; }

    /* Une liste et son détail empilés : la liste est raccourcie pour que le
       détail reste atteignable sans défilement interminable. */
    .list-scroll { max-height: 34vh; }
    .thread-scroll { max-height: 46vh; }

    /* Les fenêtres occupent l'écran plutôt que de flotter au centre. */
    .modal-back { padding: 8px; align-items: flex-start; }
    .modal { max-height: 94vh; }
    .modal-foot { flex-wrap: wrap; }
    .modal-foot .btn { flex: 1 1 auto; }

    /* Les champs passent en pleine largeur, empilés. */
    .input-group { flex-direction: column; align-items: stretch; }
    .input-group .btn { width: 100%; }

    /* iOS agrandit la page dès qu'un champ descend sous 16 px. */
    input[type="text"], input[type="password"], input[type="email"],
    input[type="number"], input[type="date"], input[type="search"],
    select, textarea { font-size: 16px; }

    .stat-value { font-size: 20px; }
    h1 { font-size: 17px; }

    /* Cibles tactiles : un bouton doit rester attrapable au pouce. */
    .btn { min-height: 36px; }
    .nav a { padding: 11px 10px; }
}
@media (min-width: 861px) {
    .only-sm { display: none !important; }
}

@media print {
    .sidebar, .topbar, .btn { display: none !important; }
    .app { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
