/* =========================================================
   Page « Comptes & liaisons » (gestion club)
   Relation adhérent ↔ comptes : carte par adhérent + drawer.
   ========================================================= */

/* ---- En-tête ---- */
.al-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.1rem;
}
.al-lead {
    color: var(--text-muted);
    font-size: 0.9rem;
    max-width: 62ch;
    margin: 0.2rem 0 0;
}

/* ---- KPIs ---- */
.al-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.8rem; margin-bottom: 1.2rem; }
@media (max-width: 720px) { .al-kpis { grid-template-columns: 1fr 1fr; } }
.al-kpi {
    display: flex; flex-direction: column; gap: 0.15rem;
    background: var(--surface-2); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 0.75rem 0.95rem;
}
.al-kpi .k-l { font-size: 0.74rem; color: var(--text-muted); }
.al-kpi .k-n { font-size: 1.5rem; font-weight: 700; line-height: 1.1; color: var(--text); }
.al-kpi.gold .k-n { color: var(--gold-strong); }
.al-kpi.warn { border-color: rgba(224, 171, 51, 0.4); }
.al-kpi.warn .k-n { color: var(--warning); }

/* ---- Barre recherche + segments ---- */
.al-toolbar { display: flex; flex-wrap: wrap; gap: 0.7rem 1rem; align-items: center; margin-bottom: 1rem; }
.al-search { position: relative; flex: 1 1 240px; min-width: 200px; }
.al-search svg { position: absolute; left: 0.7rem; top: 50%; transform: translateY(-50%); color: var(--text-faint); }
.al-search input {
    width: 100%; background: var(--surface-3); border: 1px solid var(--border-strong); color: var(--text);
    border-radius: var(--radius-sm); padding: 0.5rem 0.7rem 0.5rem 2.2rem; font: inherit; font-size: 0.88rem;
}
.al-search input::placeholder { color: var(--text-faint); }
.al-search input:focus { outline: none; border-color: var(--gold); }

.al-segmented { display: inline-flex; flex-wrap: wrap; background: var(--surface-1); border: 1px solid var(--border); border-radius: 999px; padding: 3px; }
.al-segmented button {
    font: inherit; font-size: 0.8rem; font-weight: 600; color: var(--text-muted);
    background: transparent; border: 0; cursor: pointer; padding: 0.34rem 0.8rem; border-radius: 999px; white-space: nowrap;
}
.al-segmented button.active { color: var(--gold-strong); background: var(--gold-soft); }
.al-segmented button .c { opacity: 0.7; }

/* ---- Liste / carte relation ---- */
.al-list { display: flex; flex-direction: column; gap: 0.7rem; }
.al-card {
    display: grid; grid-template-columns: minmax(200px, 240px) 1fr auto; gap: 1.1rem; align-items: start;
    background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 1rem 1.1rem; transition: border-color 0.15s ease;
}
.al-card:hover { border-color: var(--border-strong); }
.al-card[hidden] { display: none; }
@media (max-width: 820px) { .al-card { grid-template-columns: 1fr; gap: 0.85rem; } }

/* col 1 — adhérent */
.al-member { display: flex; align-items: center; gap: 0.7rem; }
.al-av {
    flex: 0 0 auto; width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center;
    background: var(--gold-soft); color: var(--gold-strong); font-weight: 700; font-size: 0.85rem; border: 1px solid var(--border-strong);
}
.al-name { font-weight: 600; }
.al-sub { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.05rem; word-break: break-word; }

/* col 2 — comptes */
.al-accounts { display: flex; flex-direction: column; gap: 0.7rem; min-width: 0; }
.al-slot-label {
    font-size: 0.68rem; letter-spacing: 0.06em; text-transform: uppercase; font-weight: 600;
    color: var(--text-faint); margin-bottom: 0.35rem; display: flex; align-items: center; gap: 0.4rem;
}
.al-qmark {
    width: 14px; height: 14px; border-radius: 50%; border: 1px solid var(--text-faint);
    font-size: 0.62rem; display: inline-grid; place-items: center; color: var(--text-faint); cursor: help;
}

.al-acct { display: flex; align-items: center; gap: 0.6rem; background: var(--surface-3); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0.5rem 0.7rem; }
.al-acct-av { flex: 0 0 auto; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-1); color: var(--text-muted); font-weight: 700; font-size: 0.72rem; border: 1px solid var(--border-strong); }
.al-acct-id { min-width: 0; }
.al-acct-name { font-weight: 600; font-size: 0.86rem; }
.al-acct-mail { font-size: 0.76rem; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.al-spacer { flex: 1 1 auto; }
.al-tag { font-size: 0.68rem; font-weight: 600; border-radius: 999px; padding: 0.1rem 0.55rem; white-space: nowrap; }
.al-tag.identity { color: var(--gold-strong); background: var(--gold-soft); border: 1px solid rgba(230, 201, 138, 0.4); }

.al-acct.empty { border-style: dashed; border-color: var(--border-strong); background: transparent; justify-content: space-between; gap: 0.6rem; flex-wrap: wrap; }
.al-empty-txt { font-size: 0.82rem; color: var(--text-faint); }
.al-badge-invite { font-size: 0.7rem; font-weight: 600; color: var(--warning); background: var(--warning-soft); border: 1px solid rgba(224, 171, 51, 0.4); border-radius: 999px; padding: 0.12rem 0.55rem; }

/* boutons « mini » in-card (Inviter / Relancer) */
.al-mini {
    display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.76rem; font-weight: 600;
    color: var(--gold-strong); background: var(--gold-soft); border: 1px solid rgba(230, 201, 138, 0.4);
    border-radius: var(--radius-sm); padding: 0.26rem 0.6rem; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.al-mini:hover { color: var(--gold-strong); background: var(--surface-2-hov); }
.al-mini.ghost { color: var(--text-muted); background: transparent; border-color: var(--border-strong); }
.al-mini.ghost:hover { color: var(--gold-strong); background: var(--gold-soft); }

/* délégués */
.al-delegs { display: flex; flex-wrap: wrap; gap: 0.45rem; align-items: center; }
.al-deleg { display: inline-flex; align-items: center; gap: 0.45rem; background: var(--surface-3); border: 1px solid var(--border); border-radius: 999px; padding: 0.2rem 0.55rem 0.2rem 0.55rem; }
.al-deleg-av { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-1); color: var(--text-muted); font-weight: 700; font-size: 0.62rem; }
.al-deleg-name { font-size: 0.8rem; font-weight: 500; }
.al-role { font-size: 0.66rem; font-weight: 700; border-radius: 999px; padding: 0.08rem 0.45rem; }
.al-role.manager { color: var(--gold-strong); background: var(--gold-soft); }
.al-role.relative { color: var(--text); background: var(--hover); }
.al-role.guest { color: var(--text-faint); background: var(--hover); }
.al-none { font-size: 0.8rem; color: var(--text-faint); }
.al-add {
    display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.78rem; font-weight: 600;
    color: var(--gold); background: transparent; border: 1px dashed var(--border-strong); border-radius: 999px;
    padding: 0.22rem 0.6rem; cursor: pointer;
}
.al-add:hover { color: var(--gold-strong); border-color: var(--gold); background: var(--gold-soft); }

/* col 3 — actions */
.al-actions { display: flex; align-items: center; gap: 0.4rem; justify-content: flex-end; }
.al-kebab { position: relative; }
.al-kebab-btn { width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--border); background: var(--surface-3); color: var(--text-muted); cursor: pointer; font-size: 1.1rem; line-height: 1; }
.al-kebab-btn:hover { color: var(--gold-strong); background: var(--gold-soft); }
.al-kebab-menu {
    position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; min-width: 210px;
    background: var(--surface-1); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
    box-shadow: var(--shadow); padding: 0.35rem; display: none;
}
.al-kebab.open .al-kebab-menu { display: block; }
.al-kebab-item {
    display: flex; width: 100%; align-items: center; gap: 0.55rem; background: transparent; border: 0;
    color: var(--text); font: inherit; font-size: 0.82rem; text-align: left; padding: 0.45rem 0.55rem;
    border-radius: 8px; cursor: pointer; text-decoration: none;
}
.al-kebab-item:hover { background: var(--surface-2); color: var(--text); }
.al-kebab-item.danger { color: #f3a6a1; }
.al-kebab-sep { height: 1px; background: var(--border); margin: 0.3rem 0.2rem; }
.al-kebab-hint { display: block; font-size: 0.68rem; color: var(--text-faint); padding: 0.1rem 0.55rem 0.25rem; }

/* ---- Légende ---- */
.al-legend {
    margin-top: 1.7rem; font-size: 0.85rem; color: var(--text-muted);
    border-left: 3px solid var(--gold); background: var(--surface-1);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0; padding: 1rem 1.1rem;
}
.al-legend h3 { margin: 0 0 0.55rem; font-size: 0.95rem; color: var(--text); }
.al-legend dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 0.4rem 0.8rem; }
.al-legend dt { white-space: nowrap; }
.al-legend b { color: var(--gold-strong); font-weight: 600; }
@media (max-width: 540px) { .al-legend dl { grid-template-columns: 1fr; gap: 0.1rem 0; } .al-legend dd { margin: 0 0 0.6rem; } }

/* ---- Drawer ---- */
.al-overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.5); opacity: 0; pointer-events: none; transition: opacity 0.2s ease; z-index: 1040; }
.al-overlay.open { opacity: 1; pointer-events: auto; }
.al-drawer {
    position: fixed; top: 0; right: 0; height: 100%; width: min(440px, 100%);
    background: var(--surface-1); border-left: 1px solid var(--border-strong); box-shadow: var(--shadow);
    transform: translateX(100%); transition: transform 0.22s ease; z-index: 1050;
    display: flex; flex-direction: column;
}
.al-drawer.open { transform: translateX(0); }
.al-drawer-form { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.al-drawer-head { padding: 1.1rem 1.2rem; border-bottom: 1px solid var(--border); display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.al-drawer-head h2 { margin: 0; font-size: 1.05rem; font-weight: 600; }
.al-drawer-head p { margin: 0.2rem 0 0; font-size: 0.8rem; color: var(--text-muted); }
.al-drawer-close { background: transparent; border: 0; color: var(--text-muted); font-size: 1.4rem; line-height: 1; cursor: pointer; }
.al-drawer-close:hover { color: var(--text); }
.al-drawer-body { padding: 1.1rem 1.2rem; overflow: auto; flex: 1 1 auto; }
.al-drawer-foot { padding: 0.9rem 1.2rem; border-top: 1px solid var(--border); display: flex; gap: 0.6rem; justify-content: flex-end; }

.al-field { margin-bottom: 1.2rem; }
.al-field[hidden] { display: none; }
.al-field label,
.al-field-label { display: block; font-size: 0.74rem; font-weight: 600; color: var(--text-muted); margin-bottom: 0.4rem; }
.al-field .form-select,
.al-field .form-control {
    width: 100%; background: var(--surface-3); border: 1px solid var(--border-strong); color: var(--text);
    border-radius: var(--radius-sm); padding: 0.5rem 0.7rem; font: inherit; font-size: 0.88rem;
}
.al-field .form-select:focus,
.al-field .form-control:focus { outline: none; border-color: var(--gold); box-shadow: none; }

/* radios de rôle façon cartes */
.al-roles { display: flex; flex-direction: column; gap: 0.5rem; }
.al-role-opt {
    display: flex; gap: 0.7rem; align-items: flex-start; border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm); padding: 0.65rem 0.75rem; cursor: pointer; transition: 0.15s ease; margin: 0;
}
.al-role-opt:hover { border-color: var(--gold); background: var(--gold-soft); }
.al-role-opt:has(input:checked) { border-color: var(--gold); background: var(--gold-soft); }
.al-role-opt input { margin-top: 0.2rem; accent-color: var(--gold); }
.al-role-text { display: flex; flex-direction: column; }
.al-role-text .rt { font-weight: 600; font-size: 0.86rem; color: var(--text); }
.al-role-text .rd { font-size: 0.76rem; color: var(--text-muted); margin-top: 0.1rem; }

.al-switch-note {
    font-size: 0.78rem; color: var(--text-faint); background: var(--surface-3);
    border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); padding: 0.6rem 0.7rem;
}
.al-switch-note a { font-weight: 600; }
