/* =========================================================================
   CONTROL PANEL — feuille de style
   Esthétique « centre de commande » : sombre, accents ambrés, mono technique.
   ========================================================================= */

:root {
    --bg:            #0a0d12;
    --surface:       #11161d;
    --surface-2:     #161c25;
    --surface-3:     #1b222c;
    --border:        #1f2730;
    --border-bright: #2b3645;

    --text:          #e9eef3;
    --text-dim:      #8b97a5;
    --text-faint:    #5c6775;

    --accent:        #ff9f1c;
    --accent-soft:   rgba(255, 159, 28, 0.12);
    --accent-line:   rgba(255, 159, 28, 0.45);
    --accent-hover:  #ffb347;

    --green:         #34d399;
    --green-soft:    rgba(52, 211, 153, 0.14);
    --amber:         #fbbf24;
    --amber-soft:    rgba(251, 191, 36, 0.14);
    --red:           #f87171;
    --blue:          #60a5fa;
    --blue-soft:     rgba(96, 165, 250, 0.14);

    --radius:        14px;
    --radius-sm:     10px;

    --font-sans: 'Archivo', system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', ui-monospace, monospace;

    --shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.7);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    font-family: var(--font-sans);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

body.login-body { background: #000; }

a { color: inherit; text-decoration: none; }
svg { display: block; }

/* Base commune de TOUS les champs texte : sombres par défaut, quelle que soit
   la classe (et même sans attribut type). Specificité 0 via :where → toujours
   surchargeable. Empêche tout champ « blanc » non stylé. */
input:where(:not([type="checkbox"], [type="radio"], [type="range"], [type="file"], [type="color"], [type="submit"], [type="button"], [type="reset"], [type="image"])),
select,
textarea {
    padding: 12px 14px;
    background: var(--bg);
    border: 1px solid var(--border-bright);
    border-radius: var(--radius-sm);
    color: var(--text);
    color-scheme: dark;
    font-family: var(--font-sans);
    font-size: 0.94rem;
    box-sizing: border-box;
}
input:where(:not([type="checkbox"], [type="radio"], [type="range"], [type="file"], [type="color"], [type="submit"], [type="button"], [type="reset"], [type="image"]))::placeholder,
textarea::placeholder { color: var(--text-faint); }
input:where(:not([type="checkbox"], [type="radio"], [type="range"], [type="file"], [type="color"], [type="submit"], [type="button"], [type="reset"], [type="image"])):focus,
select:focus,
textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }

/* ---- Décor de fond : grille discrète ----------------------------------- */

.bg-grid {
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.022) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.022) 1px, transparent 1px);
    background-size: 44px 44px;
    mask-image: radial-gradient(ellipse 80% 80% at 50% 0%, #000 40%, transparent 100%);
    pointer-events: none;
    z-index: 0;
}

/* ---- Marque (nom), partagée -------------------------------------------- */

.brand { display: flex; align-items: center; gap: 14px; }

.brand__text { display: flex; flex-direction: column; line-height: 1.15; }

.brand__name {
    font-weight: 800;
    font-size: 1.02rem;
    letter-spacing: 0.14em;
    color: var(--text);
}

.brand__sub {
    font-family: var(--font-mono);
    font-size: 0.66rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--text-faint);
    margin-top: 2px;
}

/* ---- Pastille de statut ------------------------------------------------ */

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--green);
    flex: none;
}

/* =========================================================================
   PAGE DE CONNEXION
   ========================================================================= */

.login-body {
    display: grid;
    place-items: center;
    padding: 24px;
    background: #000;
    min-height: 100vh;
}

.login-shell {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 420px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 22px;
    animation: rise 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
}
@keyframes rise {
    from { opacity: 0; transform: translateY(22px); }
    to   { opacity: 1; transform: translateY(0); }
}

.login-card {
    position: relative;
    width: 100%;
    background: #0e1117;
    border: 1px solid rgba(255, 159, 28, 0.18);
    border-radius: var(--radius);
    padding: 40px 34px 32px;
    overflow: hidden;
    box-shadow:
        0 0 0 1px rgba(0,0,0,0.6),
        0 32px 80px -20px rgba(0,0,0,0.9),
        0 0 60px -20px rgba(255, 159, 28, 0.07);
}
.login-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
    opacity: 0.6;
}

.login-card__head { margin-bottom: 26px; }

.login-card__label {
    margin-top: 20px;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 0.18em;
    color: var(--text-faint);
}

/* Alerte d'erreur */
.alert {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 14px;
    margin-bottom: 18px;
    border-radius: var(--radius-sm);
    background: rgba(248, 113, 113, 0.1);
    border: 1px solid rgba(248, 113, 113, 0.3);
    color: #fca5a5;
    font-size: 0.85rem;
    animation: shake 0.4s;
}
.alert svg { width: 18px; height: 18px; flex: none; }
@keyframes shake {
    10%, 90% { transform: translateX(-1px); }
    20%, 80% { transform: translateX(2px); }
    30%, 50%, 70% { transform: translateX(-4px); }
    40%, 60% { transform: translateX(4px); }
}

/* Formulaire */
.login-form { display: flex; flex-direction: column; gap: 16px; }

.field { display: flex; flex-direction: column; gap: 7px; }

.field__label {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    color: var(--text-dim);
}

.field__wrap { position: relative; display: flex; align-items: center; }

.field__icon {
    position: absolute;
    left: 13px;
    width: 17px;
    height: 17px;
    color: var(--text-faint);
    pointer-events: none;
    transition: color 0.2s;
}

.field input,
.callerid-form input {
    width: 100%;
    padding: 13px 14px 13px 40px;
    background: var(--bg);
    border: 1px solid var(--border-bright);
    border-radius: var(--radius-sm);
    color: var(--text);
    color-scheme: dark;
    font-family: var(--font-sans);
    font-size: 0.94rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.field input::placeholder,
.callerid-form input::placeholder { color: var(--text-faint); }
.field input:focus,
.callerid-form input:focus {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
    border-color: var(--accent);
}
.field__wrap:focus-within .field__icon { color: var(--accent); }

.btn-login {
    margin-top: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    padding: 13px;
    border: none;
    border-radius: var(--radius-sm);
    background: var(--accent);
    color: #1a1206;
    font-family: var(--font-sans);
    font-weight: 700;
    font-size: 0.95rem;
    letter-spacing: 0.01em;
    cursor: pointer;
    transition: transform 0.15s, background 0.2s;
}
.btn-login svg { width: 18px; height: 18px; transition: transform 0.2s; }
.btn-login:hover {
    background: var(--accent-hover);
}
.btn-login:hover svg { transform: translateX(3px); }
.btn-login:active { transform: translateY(1px); }

.login-card__foot {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--text-dim);
}
.login-card__foot-id { margin-left: auto; color: var(--text-faint); }

.login-alt {
    margin-top: 18px;
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-dim);
}
.login-alt a {
    color: var(--accent);
    font-weight: 600;
}
.login-alt a:hover { color: var(--accent-hover); }

.login-copy {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 0.05em;
    color: var(--text-faint);
}

/* =========================================================================
   APPLICATION (TABLEAU DE BORD)
   ========================================================================= */

.layout {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: 248px 1fr;
    min-height: 100vh;
}

/* ---- Barre latérale ---------------------------------------------------- */

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 22px 16px;
}

.sidebar__brand {
    padding: 6px 8px 22px;
    border-bottom: 1px solid var(--border);
}

.nav { margin-top: 22px; display: flex; flex-direction: column; gap: 4px; flex: 1; }

.nav__heading {
    font-family: var(--font-mono);
    font-size: 0.66rem;
    letter-spacing: 0.16em;
    color: var(--text-faint);
    padding: 0 8px 10px;
}

.nav__item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-dim);
    font-size: 0.9rem;
    font-weight: 500;
    transition: background 0.18s, color 0.18s;
    position: relative;
}
.nav__item svg { width: 18px; height: 18px; flex: none; }
.nav__item:hover { background: var(--surface-2); color: var(--text); }

.nav__item.is-active {
    background: var(--accent-soft);
    color: var(--accent);
}
.nav__item.is-active::before {
    content: "";
    position: absolute;
    left: -16px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 22px;
    border-radius: 0 3px 3px 0;
    background: var(--accent);
}

.sidebar__foot { padding-top: 16px; border-top: 1px solid var(--border); }

.sys-status {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 11px 12px;
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    border: 1px solid var(--border);
}
.sys-status > div { display: flex; flex-direction: column; line-height: 1.3; }
.sys-status__title { font-size: 0.82rem; font-weight: 600; color: var(--text); }
.sys-status__sub {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    color: var(--text-faint);
}

/* ---- Zone principale --------------------------------------------------- */

.main { display: flex; flex-direction: column; min-width: 0; }

.topbar {
    position: sticky;
    top: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 30px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
}

.topbar__crumb {
    font-family: var(--font-mono);
    font-size: 0.66rem;
    letter-spacing: 0.16em;
    color: var(--text-faint);
}
.topbar__title {
    font-size: 1.22rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    margin-top: 2px;
}

.topbar__right { display: flex; align-items: center; gap: 14px; }

.clock {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    line-height: 1.25;
    padding-right: 14px;
    border-right: 1px solid var(--border);
}
.clock__time {
    font-family: var(--font-mono);
    font-size: 0.96rem;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: 0.04em;
}
.clock__date {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    color: var(--text-faint);
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 6px 12px 6px 6px;
    border-radius: 999px;
    background: var(--surface-2);
    border: 1px solid var(--border);
}
.user-chip__avatar {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--accent);
    color: #1a1206;
    font-weight: 800;
    font-size: 0.85rem;
}
.user-chip__name { font-size: 0.86rem; font-weight: 600; }

.btn-logout {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 14px;
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text-dim);
    font-size: 0.84rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.18s;
}
.btn-logout svg { width: 16px; height: 16px; }
.btn-logout:hover {
    color: var(--red);
    border-color: rgba(248, 113, 113, 0.4);
    background: rgba(248, 113, 113, 0.08);
}

/* ---- Contenu ----------------------------------------------------------- */

.content { padding: 28px 30px 44px; max-width: 1280px; width: 100%; margin: 0 auto; }

.welcome {
    color: var(--text-dim);
    font-size: 0.96rem;
    margin-bottom: 24px;
}
.welcome strong { color: var(--text); font-weight: 700; }

/* Cartes statistiques */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 22px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    transition: transform 0.2s, border-color 0.2s;
}
.stat-card:hover { transform: translateY(-3px); border-color: var(--border-bright); }

.stat-card__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
}
.stat-card__icon {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: var(--accent-soft);
    color: var(--accent);
}
.stat-card__icon svg { width: 19px; height: 19px; }

.stat-card__delta {
    display: flex;
    align-items: center;
    gap: 3px;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 999px;
}
.stat-card__delta svg { width: 13px; height: 13px; }
.stat-card__delta.is-up   { color: var(--green); background: var(--green-soft); }
.stat-card__delta.is-down { color: var(--green); background: var(--green-soft); }

.stat-card__value {
    font-size: 1.7rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1;
}
.stat-card__label {
    margin-top: 7px;
    font-size: 0.82rem;
    color: var(--text-dim);
}

/* Panneaux (deux colonnes) */
.panels {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.panel__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 17px 20px;
    border-bottom: 1px solid var(--border);
}
.panel__title { font-size: 0.98rem; font-weight: 700; }
.panel__tag {
    font-family: var(--font-mono);
    font-size: 0.66rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-faint);
    padding: 3px 9px;
    border-radius: 999px;
    border: 1px solid var(--border);
}

.panel__body { padding: 20px; display: flex; flex-direction: column; gap: 18px; }

/* Jauges de ressources */
.meter__row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 8px;
}
.meter__label { font-size: 0.86rem; color: var(--text-dim); }
.meter__pct {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text);
}
.meter__track {
    height: 7px;
    border-radius: 99px;
    background: var(--bg);
    overflow: hidden;
}
.meter__fill {
    display: block;
    height: 100%;
    width: var(--pct);
    border-radius: 99px;
    background: var(--green);
    transform-origin: left;
    animation: fill 1s cubic-bezier(0.16, 1, 0.3, 1) both;
}
@keyframes fill { from { transform: scaleX(0); } to { transform: scaleX(1); } }

.meter--warn .meter__fill { background: var(--amber); }
.meter--warn .meter__pct  { color: var(--amber); }
.meter--crit .meter__fill { background: var(--red); }

/* Journal d'activité */
.log { list-style: none; }
.log__item {
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
}
.log__item:last-child { border-bottom: none; }

.log__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex: none;
    background: var(--text-faint);
}
.log__dot--ok   { background: var(--green); }
.log__dot--info { background: var(--blue); }
.log__dot--warn { background: var(--amber); }

.log__text { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.log__what { font-size: 0.88rem; color: var(--text); }
.log__who {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-faint);
}
.log__when {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--text-dim);
    white-space: nowrap;
}

/* ---- Animation d'apparition -------------------------------------------- */

.reveal { animation: reveal 0.6s cubic-bezier(0.16, 1, 0.3, 1) both; animation-delay: var(--d, 0ms); }
@keyframes reveal {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* =========================================================================
   RESPONSIVE
   ========================================================================= */

@media (max-width: 980px) {
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
    .panels { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
    .layout { grid-template-columns: 1fr; }
    .sidebar {
        position: static;
        height: auto;
        flex-direction: row;
        align-items: center;
        flex-wrap: wrap;
        gap: 10px 18px;
        padding: 14px 16px;
    }
    .sidebar__brand { border-bottom: none; padding: 0; }
    .nav {
        flex-direction: row;
        flex-wrap: wrap;
        margin-top: 0;
        gap: 4px;
        flex: 1 1 100%;
    }
    .nav__heading { display: none; }
    .nav__item.is-active::before { display: none; }
    .nav__item { padding: 10px; }
    .sidebar__foot { display: none; }

    .topbar { padding: 14px 18px; flex-wrap: wrap; }
    .btn-logout span { display: none; }
    .clock { display: none; }
    .content { padding: 20px 18px 36px; }
}

@media (max-width: 460px) {
    .stat-grid { grid-template-columns: 1fr; }
}

/* =========================================================================
   COMPOSANTS — gestion clients VOIP
   ========================================================================= */

/* ---- Helpers ----------------------------------------------------------- */
.mono     { font-family: var(--font-mono); font-size: 0.86rem; }
.mono-sm  { font-family: var(--font-mono); font-size: 0.76rem; }
.text-dim   { color: var(--text-dim); }
.text-faint { color: var(--text-faint); }
code {
    font-family: var(--font-mono);
    font-size: 0.82em;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 5px;
    padding: 1px 6px;
    color: var(--accent);
}

/* ---- Boutons ----------------------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 10px 16px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-family: var(--font-sans);
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: transform 0.14s, filter 0.18s, background 0.18s, border-color 0.18s, color 0.18s;
}
.btn svg { width: 16px; height: 16px; }
.btn:active { transform: translateY(1px); }

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

.btn--ghost {
    background: var(--surface-2);
    border-color: var(--border);
    color: var(--text-dim);
}
.btn--ghost:hover { color: var(--text); border-color: var(--border-bright); background: var(--surface-3); }

.btn--danger {
    background: rgba(248, 113, 113, 0.08);
    border-color: rgba(248, 113, 113, 0.25);
    color: var(--red);
}
.btn--danger:hover { background: rgba(248, 113, 113, 0.16); border-color: rgba(248, 113, 113, 0.5); }

.btn--sm { padding: 7px 12px; font-size: 0.8rem; }
.btn--sm svg { width: 14px; height: 14px; }
.btn--icon { padding: 8px; }
.btn--icon svg { width: 16px; height: 16px; }
.btn.is-disabled { opacity: 0.4; pointer-events: none; }

.link-btn {
    background: none;
    border: none;
    color: var(--accent);
    font-family: var(--font-mono);
    font-size: 0.72rem;
    cursor: pointer;
    padding: 0;
    text-decoration: underline;
    text-underline-offset: 2px;
}
.link-btn:hover { color: var(--accent-hover); }

/* ---- En-tête de page --------------------------------------------------- */
.page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 22px;
}
.page-head__title { font-size: 1.15rem; font-weight: 700; }
.page-head__sub { margin-top: 3px; font-size: 0.84rem; color: var(--text-dim); }

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-family: var(--font-mono);
    font-size: 0.76rem;
    color: var(--text-dim);
    margin-bottom: 18px;
    transition: color 0.18s;
}
.back-link svg { width: 15px; height: 15px; }
.back-link:hover { color: var(--accent); }

/* ---- Formulaires ------------------------------------------------------- */
.field input,
.callerid-form input { padding: 12px 14px; }    /* défaut sans icône */
.login-form .field input { padding-left: 40px; } /* la page login garde l'icône */
.field input.has-icon,
.callerid-form input.has-icon { padding-left: 40px; }

.field__wrap > svg {
    position: absolute;
    left: 13px;
    width: 17px;
    height: 17px;
    color: var(--text-faint);
    pointer-events: none;
    transition: color 0.2s;
}
.field__wrap:focus-within > svg { color: var(--accent); }

.field select {
    width: 100%;
    padding: 12px 14px;
    background: var(--bg);
    border: 1px solid var(--border-bright);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 0.92rem;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238b97a5' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
}
.field select:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }

.field__hint {
    font-size: 0.74rem;
    color: var(--text-faint);
    line-height: 1.5;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px 18px;
    padding: 22px;
}
.field--wide { grid-column: 1 / -1; }
.form-actions {
    grid-column: 1 / -1;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 4px;
}

/* ---- Panneau repliable (nouveau client) -------------------------------- */
.collapsible {
    display: grid;
    grid-template-rows: 0fr;
    opacity: 0;
    transition: grid-template-rows 0.32s ease, opacity 0.25s ease, margin 0.3s ease;
    margin-bottom: 0;
}
.collapsible > * { overflow: hidden; }
.collapsible.is-open {
    grid-template-rows: 1fr;
    opacity: 1;
    margin-bottom: 18px;
}

/* ---- Tableaux ---------------------------------------------------------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th {
    text-align: left;
    font-family: var(--font-mono);
    font-size: 0.66rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-faint);
    font-weight: 500;
    padding: 13px 20px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.table td {
    padding: 13px 20px;
    border-bottom: 1px solid var(--border);
    font-size: 0.88rem;
    vertical-align: middle;
}
.table tbody tr { transition: background 0.14s; }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: none; }
.table__right { text-align: right; }
.table--compact th, .table--compact td { padding: 10px 16px; font-size: 0.82rem; }

.cell-client { display: flex; align-items: center; gap: 11px; }
.cell-client__avatar {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    flex: none;
    border-radius: 8px;
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 700;
    font-size: 0.82rem;
}
.cell-client__name { display: block; font-weight: 600; color: var(--text); }
.cell-client__sub { display: block; font-family: var(--font-mono); font-size: 0.7rem; color: var(--text-faint); }

.row-actions { display: inline-flex; align-items: center; gap: 8px; }
.row-actions form { display: inline-flex; }

/* ---- Badges ------------------------------------------------------------ */
.badge {
    display: inline-flex;
    align-items: center;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.03em;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid transparent;
}
.badge--ok    { color: var(--green); background: var(--green-soft); border-color: rgba(52, 211, 153, 0.25); }
.badge--muted { color: var(--text-dim); background: var(--surface-3); border-color: var(--border); }
.badge--warn  { color: var(--amber); background: var(--amber-soft); border-color: rgba(251, 191, 36, 0.25); }

/* ---- États vides ------------------------------------------------------- */
.empty { text-align: center; padding: 52px 24px; }
.empty--sm { padding: 36px 20px; }
.empty__icon {
    display: inline-grid;
    place-items: center;
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text-faint);
    margin-bottom: 14px;
}
.empty__icon svg { width: 24px; height: 24px; }
.empty__title { font-weight: 700; font-size: 1rem; margin-bottom: 5px; }
.empty__text { color: var(--text-dim); font-size: 0.86rem; margin-bottom: 16px; }
.empty__text:last-child { margin-bottom: 0; }

/* ---- Messages flash ---------------------------------------------------- */
.flash-stack { display: flex; flex-direction: column; gap: 10px; margin-bottom: 22px; }
.flash {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 13px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    border: 1px solid transparent;
    animation: reveal 0.4s ease both;
}
.flash svg { width: 18px; height: 18px; flex: none; }
.flash--success { background: var(--green-soft); border-color: rgba(52, 211, 153, 0.3); color: #6ee7b7; }
.flash--error   { background: rgba(248, 113, 113, 0.1); border-color: rgba(248, 113, 113, 0.3); color: #fca5a5; }
.flash--info    { background: var(--blue-soft); border-color: rgba(96, 165, 250, 0.3); color: #93c5fd; }

.inline-note {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 18px 20px;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.84rem;
}
.inline-note svg { width: 17px; height: 17px; flex: none; }
.inline-note--error { background: rgba(248, 113, 113, 0.08); border: 1px solid rgba(248, 113, 113, 0.25); color: #fca5a5; }

/* ---- Fiche client : disposition ---------------------------------------- */
.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1.15fr;
    gap: 16px;
    align-items: start;
}
.detail-col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

.info-list { padding: 8px 20px; }
.info-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}
.info-row:last-child { border-bottom: none; }
.info-row__label {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.04em;
    color: var(--text-faint);
}
.info-row__value { font-size: 0.88rem; text-align: right; }
.info-row__value--key { display: inline-flex; align-items: center; gap: 12px; }

.edit-block { border-top: 1px solid var(--border); }
.edit-block__summary {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 15px 20px;
    cursor: pointer;
    font-size: 0.86rem;
    font-weight: 600;
    color: var(--text-dim);
    list-style: none;
    transition: color 0.18s;
}
.edit-block__summary::-webkit-details-marker { display: none; }
.edit-block__summary svg { width: 16px; height: 16px; }
.edit-block__summary:hover { color: var(--text); }
.edit-block[open] .edit-block__summary { color: var(--accent); }

/* ---- Caller ID --------------------------------------------------------- */
.callerid-current {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    margin-bottom: 14px;
    border-radius: var(--radius-sm);
    background: var(--bg);
    border: 1px solid var(--border);
}
.callerid-current__label {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--text-faint);
}
.callerid-current__value { font-size: 1.05rem; font-weight: 700; }

.callerid-form { display: flex; gap: 10px; align-items: stretch; }
.callerid-form .field__wrap { flex: 1; }
.callerid-form input { width: 100%; }
.callerid-form .btn { flex: none; }

/* ---- Filtres journaux -------------------------------------------------- */
.logs-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    align-items: center;
}
.field__wrap--sm { position: relative; display: flex; align-items: center; flex: 1; min-width: 130px; }
.field__wrap--sm input { width: 100%; }

.input-sm, .field__wrap--sm input {
    padding: 9px 12px;
    background: var(--bg);
    border: 1px solid var(--border-bright);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 0.82rem;
    color-scheme: dark;
}
.field__wrap--sm input.has-icon { padding-left: 36px; }
.field__wrap--sm > svg { left: 11px; width: 15px; height: 15px; }
.input-sm:focus, .field__wrap--sm input:focus {
    outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent);
}

/* ---- Pagination -------------------------------------------------------- */
.pager {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 20px;
    border-top: 1px solid var(--border);
}
.pager__page {
    font-family: var(--font-mono);
    font-size: 0.76rem;
    color: var(--text-dim);
}

/* ---- Responsive (vues clients) ----------------------------------------- */
@media (max-width: 980px) {
    .detail-grid { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
    .form-grid { grid-template-columns: 1fr; }
    .page-head { flex-direction: column; align-items: stretch; }
    .callerid-form { flex-direction: column; align-items: stretch; }
    .callerid-form .btn { width: 100%; }
    .logs-filters { gap: 8px; }
    .input-sm { flex: 1; }
}


/* ---- Sous-titre de section (dans un formulaire) ------------------------ */
.form-subhead {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-faint);
}
.form-subhead svg { width: 15px; height: 15px; flex: none; color: var(--accent); }

.sip-help {
    padding: 2px 20px 16px;
    font-size: 0.78rem;
    color: var(--text-faint);
}
