/* =========================================================================
   Family NAS — feuille de style
   Design system aligné sur amalgame.me : tokens (rayons/ombres/transition),
   palette crème/encre + accents, polices Inter / Space Grotesk / JetBrains Mono.
   Thème : clair par défaut, sombre auto (prefers-color-scheme) + bascule
   manuelle persistée (data-theme sur <html>).
   ========================================================================= */

:root {
  color-scheme: light dark;

  /* Marque */
  --ink:      #1A1A2E;
  --cream:    #F7F4EE;
  --blue:     #3B82F6;
  --cyan:     #06B6D4;
  --amber:    #F59E0B;
  --rose:     #EC4899;
  --green:    #10B981;

  /* Sémantiques (clair) — neutre & minimal (zinc + indigo) */
  --bg-page:      #FAFAFA;
  --bg-card:      #FFFFFF;
  --bg-subtle:    #F4F4F5;
  --bg-deep:      #18181B;
  --fg-primary:   #18181B;
  --fg-secondary: #3F3F46;
  --fg-muted:     #71717A;
  --fg-on-deep:   #FAFAFA;
  --rule:         #E4E4E7;
  --rule-strong:  #D4D4D8;
  --accent:       #4F46E5;
  --accent-hover: #4338CA;
  --accent-ring:  rgba(79,70,229,0.22);
  --danger:       #DC2626;
  --danger-soft:  #FEE2E2;

  --shadow-sm: 0 1px 2px rgba(24,24,27,0.05), 0 1px 1px rgba(24,24,27,0.04);
  --shadow-md: 0 2px 4px rgba(24,24,27,0.05), 0 1px 2px rgba(24,24,27,0.05);
  --shadow-lg: 0 10px 24px rgba(24,24,27,0.10), 0 2px 6px rgba(24,24,27,0.06);

  --radius-sm:   6px;
  --radius-md:   8px;
  --radius-lg:   12px;
  --radius-pill: 999px;
  --transition:  0.16s ease;
}

/* Sombre : valeurs partagées entre l'auto (OS) et la bascule manuelle. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg-page:      #09090B;
    --bg-card:      #18181B;
    --bg-subtle:    #27272A;
    --bg-deep:      #18181B;
    --fg-primary:   #FAFAFA;
    --fg-secondary: #D4D4D8;
    --fg-muted:     #A1A1AA;
    --fg-on-deep:   #FAFAFA;
    --rule:         #27272A;
    --rule-strong:  #3F3F46;
    --accent:       #818CF8;
    --accent-hover: #A5B4FC;
    --accent-ring:  rgba(129,140,248,0.28);
    --danger:       #F87171;
    --danger-soft:  #3A1D1D;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.40);
    --shadow-md: 0 2px 6px rgba(0,0,0,0.45);
    --shadow-lg: 0 14px 30px rgba(0,0,0,0.60);
  }
}
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg-page:      #09090B;
  --bg-card:      #18181B;
  --bg-subtle:    #27272A;
  --bg-deep:      #18181B;
  --fg-primary:   #FAFAFA;
  --fg-secondary: #D4D4D8;
  --fg-muted:     #A1A1AA;
  --fg-on-deep:   #FAFAFA;
  --rule:         #27272A;
  --rule-strong:  #3F3F46;
  --accent:       #818CF8;
  --accent-hover: #A5B4FC;
  --accent-ring:  rgba(129,140,248,0.28);
  --danger:       #F87171;
  --danger-soft:  #3A1D1D;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.40);
  --shadow-md: 0 2px 6px rgba(0,0,0,0.45);
  --shadow-lg: 0 14px 30px rgba(0,0,0,0.60);
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
button { font: inherit; color: inherit; cursor: pointer; }
ul { list-style: none; margin: 0; padding: 0; }

body {
  font-family: 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg-page); color: var(--fg-primary);
  font-size: 15px; line-height: 1.6;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  transition: background-color var(--transition), color var(--transition);
}
h1, h2, h3 { font-family: 'Space Grotesk', system-ui, sans-serif; letter-spacing: -0.02em; }

/* ── Header ── */
header {
  display: flex; align-items: center; gap: .8rem;
  padding: max(.7rem, env(safe-area-inset-top)) max(1.4rem, env(safe-area-inset-right)) .7rem max(1.4rem, env(safe-area-inset-left));
  background: var(--bg-card); color: var(--fg-primary);
  border-bottom: 1px solid var(--rule);
}
header .logo { font-size: 1.4rem; line-height: 1; }
header h1 { font-size: 1.2rem; margin: 0; font-weight: 600; color: var(--fg-primary); }
#who { margin-left: auto; color: var(--fg-muted); font-size: .88rem; }
#who:empty { display: none; }
#who:empty + #theme { margin-left: auto; }
.icon-btn {
  display: inline-flex; align-items: center; gap: .45rem;
  background: transparent; color: var(--fg-secondary);
  border: 1px solid var(--rule); border-radius: var(--radius-pill);
  padding: .42rem .8rem; font-size: .85rem; font-weight: 500;
  transition: background var(--transition), border-color var(--transition);
}
.icon-btn:hover { background: var(--bg-subtle); border-color: var(--rule-strong); }
.usermenu-wrap { position: relative; margin-left: auto; }   /* avatar-menu collé à droite */
.usermenu-btn { border: 0; background: transparent; padding: 0; border-radius: 50%; cursor: pointer; line-height: 0; transition: box-shadow var(--transition); }
.usermenu-btn:hover, .usermenu-btn:focus-visible { box-shadow: 0 0 0 3px var(--accent-ring); outline: none; }
/* Recherche dans le bandeau (Contacts) : entre le titre et l'avatar. */
.hdr-search { flex: 1 1 8rem; min-width: 0; max-width: 26rem; margin: 0 .3rem; padding: .4rem .7rem; }
.hdr-search[hidden] { display: none; }
/* Indicateur global d'actions hors-ligne en attente (taper = forcer la synchro). */
.pending-ind { flex: none; border: 0; background: var(--amber); color: #1a1a2e; border-radius: var(--radius-pill); padding: .25rem .6rem; font-size: .78rem; font-weight: 700; cursor: pointer; white-space: nowrap; }
.pending-ind[hidden] { display: none; }
/* Formulaire de connexion (plein écran, sur 401). */
.login-ov { position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center; background: var(--bg-page); padding: max(1.4rem, env(safe-area-inset-top)) 1.4rem 1.4rem; }
.login-card { width: 100%; max-width: 340px; display: flex; flex-direction: column; gap: .7rem; background: var(--bg-card); border: 1px solid var(--rule); border-radius: var(--radius-lg); padding: 1.7rem 1.4rem; box-shadow: var(--shadow-lg); }
.login-card h2 { margin: 0 0 .2rem; text-align: center; }
.login-card .hint { margin: 0 0 .4rem; text-align: center; }
.login-card input { padding: .6rem .8rem; border: 1px solid var(--rule-strong); border-radius: var(--radius-md); background: var(--bg-page); color: var(--fg-primary); font-size: 1rem; box-sizing: border-box; }
.login-card .btn-primary { margin-top: .3rem; justify-content: center; }
.login-err { color: var(--danger); font-size: .88rem; margin: 0; text-align: center; }
.login-or { display: flex; align-items: center; gap: .6rem; color: var(--fg-muted); font-size: .82rem; margin: .2rem 0; }
.login-or::before, .login-or::after { content: ""; flex: 1; height: 1px; background: var(--rule); }
.login-pk { justify-content: center; }
/* Onglet « Empreinte » des paramètres */
.settings-passkeys { display: flex; flex-direction: column; gap: .8rem; }
.settings-passkeys .btn-primary { align-self: flex-start; }
.passkey-list { list-style: none; margin: .2rem 0 0; padding: 0; display: flex; flex-direction: column; gap: .5rem; }
.passkey-item { display: flex; align-items: center; gap: .8rem; padding: .6rem .8rem; border: 1px solid var(--rule); border-radius: var(--radius-md); background: var(--bg-card); }
.passkey-meta { display: flex; flex-direction: column; gap: .15rem; flex: 1; min-width: 0; }
.passkey-name { font-weight: 600; }
.passkey-date { font-size: .8rem; color: var(--fg-muted); }
.usermenu-pop { position: absolute; right: 0; top: 100%; margin-top: .4rem; min-width: 14rem; background: var(--bg-card); border: 1px solid var(--rule-strong); border-radius: var(--radius-md); box-shadow: var(--shadow-lg); padding: .3rem; display: flex; flex-direction: column; gap: .1rem; z-index: 60; }
.usermenu-pop[hidden] { display: none; }   /* le display:flex ci-dessus écrase sinon l'attribut hidden */
.usermenu-item { text-align: left; border: 0; background: transparent; color: var(--fg-primary); padding: .55rem .7rem; border-radius: var(--radius-sm); font-size: .9rem; width: 100%; }
.usermenu-item:hover { background: var(--bg-subtle); }
.settings-checks { display: flex; flex-direction: column; gap: .55rem; margin: .9rem 0; }
.settings-prof { display: flex; align-items: center; gap: 1rem; margin: .2rem 0 .8rem; }
/* Modale Paramètres : onglets Utilisateur / Signature / Configuration */
#settings-body { max-width: none; }   /* Paramètres : pleine largeur de page */
/* Administration & Paramètres prennent toute la largeur (tableaux/matrices larges) */
main:has(> #admin:not([hidden])),
main:has(> #settings:not([hidden])) { max-width: none; }
/* Onglets en pilules, comme les boutons d'Administration. */
.settings-tabs { display: flex; flex-wrap: wrap; gap: .35rem; border-bottom: 1px solid var(--rule); margin: .3rem 0 1.1rem; padding-bottom: .7rem; }
.settings-tab { flex: none; background: transparent; border: 1px solid var(--rule-strong); border-radius: var(--radius-pill); padding: .4rem .9rem; font-size: .9rem; font-weight: 500; color: var(--fg-secondary); cursor: pointer; white-space: nowrap; }
.settings-tab:hover { background: var(--bg-subtle); }
.settings-tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.settings-panel { display: flex; flex-direction: column; }
.settings-panel[hidden] { display: none; }   /* sinon display:flex écrase l'attribut hidden → tous visibles */
.conf-conn { display: flex; flex-direction: column; gap: 1.1rem; }
.conf-sec h4 { margin: 0 0 .2rem; font-size: .95rem; }
.conf-sec .conn { margin: .2rem 0 0; }
.usermenu-head { display: flex; align-items: center; gap: .7rem; padding: .5rem .6rem .7rem; border-bottom: 1px solid var(--rule); margin-bottom: .2rem; }
.usermenu-id { min-width: 0; display: flex; flex-direction: column; }
.usermenu-id strong { font-size: .95rem; }
.usermenu-id .hint { font-size: .8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 12rem; }
.recip-chip { cursor: grab; }
.recip-chip:active { cursor: grabbing; }
.recip-box.drag { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
#theme { padding: .42rem .6rem; font-size: 1rem; }

#burger { display: none; padding: .42rem .6rem; font-size: 1.05rem; }

/* ── Layout deux colonnes (volet + contenu) ── */
#layout { display: flex; align-items: stretch; min-height: calc(100vh - 60px); }
#side {
  width: 264px; flex: none; background: var(--bg-card);
  border-right: 1px solid var(--rule); padding: .9rem .7rem;
  display: flex; flex-direction: column; gap: .4rem;
  position: sticky; top: 0; align-self: flex-start; height: calc(100vh - 60px); overflow-y: auto;
}
.side-foot { margin-top: auto; padding-top: .6rem; border-top: 1px solid var(--rule); }
.side-link {
  display: flex; align-items: center; gap: .5rem; width: 100%;
  border: 0; background: transparent; color: var(--fg-secondary);
  padding: .55rem .6rem; border-radius: var(--radius-sm); font-size: .92rem; font-weight: 500;
}
.side-link:hover { background: var(--bg-subtle); transform: none; box-shadow: none; }
.side-link.active { background: var(--fg-primary); color: var(--bg-card); }

/* Arbre des dossiers */
#search { width: 100%; box-sizing: border-box; margin-bottom: .7rem; padding: .45rem .6rem; border: 1px solid var(--rule-strong); border-radius: var(--radius-md); background: var(--bg-card); color: inherit; font-size: .9rem; }
#tree, .children { list-style: none; margin: 0; padding: 0; }
.children { margin-left: .7rem; padding-left: .35rem; border-left: 1px solid var(--rule); }
.children[hidden] { display: none; }
.node-row {
  display: flex; align-items: center; gap: .2rem; cursor: pointer;
  padding: .4rem .45rem; border-radius: var(--radius-sm);
  font-size: .9rem; color: var(--fg-secondary); user-select: none;
  transition: background var(--transition);
}
.node-row:hover { background: var(--bg-subtle); }
.node-row.active { background: var(--accent); color: #fff; }
.node-row.root { font-weight: 600; color: var(--fg-primary); }
.node-row.root.active { color: #fff; }
.twisty {
  width: 1.1rem; flex: none; text-align: center; font-size: .62rem;
  color: var(--fg-muted); border-radius: 4px; padding: .15rem 0;
}
.node-row.active .twisty { color: rgba(255,255,255,.85); }
.twisty:hover { background: rgba(127,127,127,.18); }
.twisty.leaf { visibility: hidden; }
.tw-icon { flex: none; font-size: .95rem; }
.tw-name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

#backdrop { display: none; }

/* ── Contenu ── */
main { flex: 1; min-width: 0; margin: 1.4rem; max-width: 940px; }
section {
  background: var(--bg-card); border: 1px solid var(--rule);
  border-radius: var(--radius-lg); padding: 1.3rem 1.4rem; margin-bottom: 1.2rem;
  box-shadow: var(--shadow-sm);
}
h2 { margin: 0 0 1rem; font-size: 1.25rem; }
h3 { margin: 1.4rem 0 .7rem; font-size: 1.02rem; }

#bar { display: flex; align-items: center; gap: .6rem; margin-bottom: .9rem; flex-wrap: wrap; }
/* Contacts (desktop) : barre d'actions en SIDEBAR gauche (comme Mail), liste à droite. */
#contacts .contact-app { display: flex; gap: 1rem; align-items: flex-start; }
#contacts #bar {
  flex-direction: column; align-items: stretch; flex-wrap: nowrap;
  width: 13rem; flex: none; gap: .5rem; margin: 0;
  border-right: 1px solid var(--rule); padding-right: 1rem;
}
#contacts #bar .grow { display: none; }
#contacts #bar #crumb { font-weight: 600; color: var(--fg-secondary); margin-bottom: .15rem; }
#contacts #bar .btn { width: 100%; box-sizing: border-box; justify-content: center; }
.contact-main { flex: 1; min-width: 0; }
/* Calendrier (desktop) : « Nouvel événement » + vues en SIDEBAR gauche ; grille à droite. */
#calendar .cal-app { display: flex; gap: 1rem; align-items: flex-start; }
#cal-side { display: flex; flex-direction: column; align-items: stretch; width: 13rem; flex: none; gap: .5rem; }
#cal-side .btn { width: 100%; box-sizing: border-box; justify-content: center; }
#cal-side .cal-views { display: flex; flex-direction: column; gap: .25rem; }
.cal-main { flex: 1; min-width: 0; }
@media (max-width: 760px) {   /* mobile : la sidebar calendrier devient un tiroir (hamburger) */
  #calendar { padding-bottom: calc(50px + env(safe-area-inset-bottom)); }
  #calendar .cal-app { display: block; }
  #cal-side {
    position: fixed; top: 0; left: 0; z-index: 41;
    height: calc(100dvh - 50px - env(safe-area-inset-bottom)); width: 80%; max-width: 290px;
    background: var(--bg-card); box-shadow: var(--shadow-lg); border-right: 1px solid var(--rule);
    padding: max(.9rem, env(safe-area-inset-top)) .8rem .8rem;
    transform: translateX(-100%); transition: transform var(--transition); overflow-y: auto;
  }
  #cal-side.open { transform: translateX(0); }
  #cal-backdrop { position: fixed; inset: 0; z-index: 40; background: rgba(8,8,15,.5); }
  #cal-backdrop[hidden] { display: none; }
}
/* Mobile : la barre Contacts devient un TIROIR gauche (recherche + actions),
   ouvert par le hamburger — comme Fichiers/Mail ; la liste passe pleine largeur. */
@media (max-width: 760px) {
  #contacts { padding-bottom: calc(50px + env(safe-area-inset-bottom)); }
  #contacts .contact-app { display: block; }   /* #bar devient un tiroir hors flux */
  #contacts #bar {
    position: fixed; top: 0; left: 0; z-index: 41; margin: 0;
    height: calc(100dvh - 50px - env(safe-area-inset-bottom));
    width: 80%; max-width: 290px;
    flex-direction: column; align-items: stretch; flex-wrap: nowrap; gap: .5rem;
    background: var(--bg-card); box-shadow: var(--shadow-lg); border-right: 1px solid var(--rule);
    padding: max(.9rem, env(safe-area-inset-top)) .8rem .8rem;
    transform: translateX(-100%); transition: transform var(--transition); overflow-y: auto;
  }
  #contacts #bar.open { transform: translateX(0); }
  #contacts #bar #crumb, #contacts #bar .grow { display: none; }
  #contacts #bar #contact-add { order: -1; width: 100%; justify-content: center; }   /* primaire en haut, comme « Écrire » */
  #contacts #bar #contact-search { flex: none; width: 100%; max-width: none; }   /* sinon flex:1 le fait grandir verticalement dans le tiroir */
  #contacts #bar #contact-import, #contacts #bar #contact-export { width: 100%; justify-content: center; }
  #contact-backdrop { position: fixed; inset: 0; z-index: 40; background: rgba(8,8,15,.5); }
  #contact-backdrop[hidden] { display: none; }
}
.grow { flex: 1; }
#crumb { font-family: 'Space Grotesk', system-ui, sans-serif; font-weight: 600; font-size: 1.05rem; color: var(--fg-primary); word-break: break-all; }
#crumb a { color: var(--accent); text-decoration: none; cursor: pointer; }
#crumb a:hover { color: var(--accent-hover); text-decoration: underline; }
#crumb .sep { color: var(--fg-muted); margin: 0 .4rem; font-weight: 400; }

/* ── Boutons ── */
button, .btn {
  display: inline-flex; align-items: center; gap: .5rem;
  border: 1px solid var(--rule-strong); background: var(--bg-card); color: var(--fg-primary);
  padding: .5rem .9rem; border-radius: var(--radius-md); font-size: .88rem; font-weight: 500;
  text-decoration: none;
  transition: background var(--transition), color var(--transition), border-color var(--transition), box-shadow var(--transition), transform .08s ease;
}
button:hover, .btn:hover { background: var(--bg-subtle); border-color: var(--rule-strong); }
button:active, .btn:active { background: var(--bg-subtle); }
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ── Listes (fichiers / comptes) ── */
#list li, .accounts li {
  display: flex; align-items: center; gap: .7rem;
  padding: .65rem .6rem; border-radius: var(--radius-sm);
  border-bottom: 1px solid var(--rule); transition: background var(--transition);
}
#list li:last-child, .accounts li:last-child { border-bottom: 0; }
#list li:hover, .accounts li:hover { background: var(--bg-subtle); }
#list .name { flex: 1; cursor: pointer; word-break: break-all; }
#list .name.dir { font-weight: 600; }
#list .size { color: var(--fg-muted); font-size: .8rem; font-family: 'JetBrains Mono', monospace; width: 6em; text-align: right; flex-shrink: 0; }
#list .date { color: var(--fg-muted); font-size: .8rem; font-family: 'JetBrains Mono', monospace; white-space: nowrap; width: 9.5em; text-align: right; flex-shrink: 0; }
#dirsize { color: var(--fg-muted); font-size: .85rem; font-family: 'JetBrains Mono', monospace; white-space: nowrap; }
.icon { width: 1.5rem; text-align: center; font-size: 1.1rem; }
#list li button, .accounts li button { padding: .35rem .6rem; }

/* ── Console domaines & comptes (admin) ── */
#domains { list-style: none; padding: 0; margin: 0 0 1rem; display: flex; flex-direction: column; gap: 1rem; }
.domain-card { border: 1px solid var(--rule-strong); border-radius: var(--radius-md); padding: .9rem 1rem; background: var(--bg-subtle); }
.domain-head { display: flex; flex-wrap: wrap; align-items: center; gap: .8rem; }
.domain-head > strong { font-family: 'Space Grotesk', sans-serif; font-size: 1.05rem; }
.domain-head .svc { margin-left: auto; }
.domain-head .del { margin-left: .4rem; }
.svc { display: inline-flex; flex-wrap: wrap; gap: .15rem .7rem; }
.svc .check { font-size: .9rem; }
.accounts { list-style: none; padding: 0; margin: .7rem 0 .3rem; }
.acc-name { flex: 1; font-weight: 500; word-break: break-all; }
.acc-name .badge { margin-left: .4rem; }
.addacc { margin-top: .3rem; gap: .45rem; }
.addacc input[type=text], .addacc input:not([type]) { flex: 1; min-width: 8rem; }
.del { color: var(--danger); border-color: var(--danger); background: transparent; }
/* Zone DNS (admin) */
.dns-domfield { display: flex; flex-direction: column; gap: .25rem; max-width: 22rem; margin: .4rem 0 .2rem; }
.dns-domfield > span { font-size: .8rem; color: var(--fg-muted); font-weight: 600; }
.dns-domsel { padding: .5rem .7rem; border: 1px solid var(--rule-strong); border-radius: var(--radius-md); background: var(--bg-page); color: var(--fg-primary); font-size: 1rem; }
.dns-mailnote { margin: .2rem 0 .6rem; }
.domain-redirects { margin-top: .8rem; padding-top: .7rem; border-top: 1px solid var(--rule); }
.redir-head { font-weight: 600; margin-bottom: .2rem; }
.redir-list { list-style: none; margin: .3rem 0; padding: 0; display: flex; flex-direction: column; gap: .35rem; }
.redir-item { display: flex; align-items: center; gap: .6rem; }
.redir-item code { font-family: 'JetBrains Mono', monospace; font-size: .82rem; }
.redir-add { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; margin-top: .4rem; }
.redir-add input { flex: 1 1 9rem; min-width: 0; }
.redir-at { white-space: nowrap; }
.dns-status { width: 1.6rem; text-align: center; font-weight: 700; font-size: 1rem; }
.dns-zone tr.dns-ok   .dns-status { color: var(--success, #16a34a); }
.dns-zone tr.dns-warn .dns-status { color: var(--warning, #d97706); }
.dns-zone tr.dns-bad  .dns-status { color: var(--danger); }
.dns-zone tr.dns-checking .dns-status { opacity: .6; }
.dns-zone tr.dns-ok   td:first-child { box-shadow: inset 3px 0 0 var(--success, #16a34a); }
.dns-zone tr.dns-warn td:first-child { box-shadow: inset 3px 0 0 var(--warning, #d97706); }
.dns-zone tr.dns-bad  td:first-child { box-shadow: inset 3px 0 0 var(--danger); }
.dns-zone { width: 100%; border-collapse: collapse; margin: .6rem 0; }
.dns-zone th { text-align: left; color: var(--fg-muted); font-size: .78rem; font-weight: 600; padding: .3rem .5rem; border-bottom: 1px solid var(--rule); }
.dns-zone td { padding: .55rem .5rem; border-bottom: 1px solid var(--rule); vertical-align: top; }
.dns-zone code { font-family: 'JetBrains Mono', monospace; font-size: .8rem; word-break: break-all; }
.dns-type { font-weight: 700; color: var(--accent); white-space: nowrap; }
.dns-val code { display: block; }
.dns-note { display: block; margin-top: .25rem; }
@media (max-width: 760px) {   /* table → carte par enregistrement */
  .dns-zone, .dns-zone tbody, .dns-zone tr, .dns-zone td { display: block; width: auto; }
  .dns-zone .dns-head { display: none; }
  .dns-zone tr { border: 1px solid var(--rule-strong); border-radius: var(--radius-md); padding: .5rem .6rem; margin-bottom: .6rem; }
  .dns-zone td { border: 0; padding: .15rem .2rem; }
  .dns-type { color: var(--accent); }
}
/* Admin sur mobile : cartes pleine largeur, lignes/formulaires qui s'empilent. */
@media (max-width: 760px) {
  #admin-body, #admin-nav { padding-bottom: env(safe-area-inset-bottom); }
  .domain-card { padding: .8rem .8rem; }
  .accounts li, #list li { flex-wrap: wrap; row-gap: .3rem; }
  .acc-name { flex-basis: 60%; }
  .domain-head > strong { flex-basis: 100%; }
  .domain-head .svc, .svc { margin-left: 0; width: 100%; }
  .adddomain2 { max-width: none; }
  .addacc { flex-wrap: wrap; }
  .addacc input[type=text], .addacc input:not([type]) { flex: 1 1 100%; min-width: 0; }
}
.del:hover { background: var(--danger); color: #fff; border-color: var(--danger); }
.badge {
  font-size: .66rem; font-weight: 700; text-transform: uppercase; letter-spacing: .5px;
  background: var(--accent); color: #fff; padding: .15rem .5rem; border-radius: var(--radius-pill);
}

/* ── Formulaire d'ajout/reset ── */
form { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
input[type=text], input:not([type]), input[type=password], input[type=email],
input[type=tel], input[type=date], input[type=time], input[type=datetime-local],
input[type=search], input[type=number], select, textarea {
  padding: .55rem .75rem; border: 1px solid var(--rule-strong); border-radius: var(--radius-md);
  background: var(--bg-page); color: var(--fg-primary); font-size: .92rem; font-family: inherit;
  transition: border-color var(--transition), box-shadow var(--transition);
}
select { cursor: pointer; }
/* Widgets date/heure natifs : icône cliquable + accordée au thème. */
input[type=date]::-webkit-calendar-picker-indicator,
input[type=time]::-webkit-calendar-picker-indicator { cursor: pointer; opacity: .6; }
input[type=date]:hover::-webkit-calendar-picker-indicator,
input[type=time]:hover::-webkit-calendar-picker-indicator { opacity: 1; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); outline: none; }
input::placeholder { color: var(--fg-muted); }
form label { display: inline-flex; align-items: center; gap: .4rem; color: var(--fg-secondary); font-size: .9rem; }
.hint { color: var(--fg-muted); font-size: .82rem; margin: .8rem 0 0; }
#empty { color: var(--fg-muted); text-align: center; padding: 1.6rem 0; }

/* ── Overlay d'attente (opérations longues) ── */
.busy-ov { position: fixed; inset: 0; z-index: 100; background: rgba(8,8,15,.45); backdrop-filter: blur(2px); display: flex; align-items: center; justify-content: center; }
.busy-box { background: var(--bg-card); color: var(--fg-primary); border: 1px solid var(--rule); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); padding: 1.5rem 1.9rem; display: flex; flex-direction: column; align-items: center; gap: .9rem; font-size: .95rem; }
.spinner { width: 2.2rem; height: 2.2rem; border: 3px solid var(--rule-strong); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Toast ── */
#msg {
  position: fixed; bottom: 1.4rem; left: 50%; transform: translateX(-50%) translateY(10px);
  background: var(--bg-deep); color: var(--fg-on-deep); padding: .7rem 1.2rem;
  border-radius: var(--radius-md); opacity: 0; pointer-events: none; max-width: 90%;
  box-shadow: var(--shadow-lg); font-size: .9rem; font-weight: 500;
  transition: opacity var(--transition), transform var(--transition);
}
#msg.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── Drag & drop ── */
#files.drag { outline: 2px dashed var(--accent); outline-offset: -10px; background: var(--bg-subtle); }
#files.drag::after {
  content: "Déposez les fichiers ici"; display: block; text-align: center;
  color: var(--accent); padding: .8rem; font-weight: 600; font-family: 'Space Grotesk', sans-serif;
}

/* ── Boîte de dialogue (mot de passe) ── */
#modal {
  position: fixed; inset: 0; background: rgba(8,8,15,.55); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; z-index: 50;
  animation: fade .15s ease;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.dialog {
  background: var(--bg-card); color: var(--fg-primary); border: 1px solid var(--rule);
  border-radius: var(--radius-lg); padding: 1.5rem; width: min(460px, 92%);
  box-shadow: var(--shadow-lg);
  max-height: 90vh; overflow-y: auto; -webkit-overflow-scrolling: touch;
}
.dialog h3 {
  margin: -1.5rem -1.5rem .6rem; padding: 1.1rem 1.5rem .8rem; font-size: 1.15rem; word-break: break-word;
  position: sticky; top: -1.5rem; background: var(--bg-card); border-bottom: 1px solid var(--rule);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0; z-index: 1;
}
.dialog .row { display: flex; gap: .6rem; margin: 1rem 0; }
/* Champ mono/large réservé au dialogue mot de passe (.row), pas aux formulaires. */
.dialog .row input {
  flex: 1; font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 1.05rem; letter-spacing: .04em;
}
/* Barre d'actions collée en bas pendant le défilement de la modale. */
.dialog .actions {
  display: flex; justify-content: flex-end; gap: .6rem;
  position: sticky; bottom: -1.5rem; margin: 1rem -1.5rem -1.5rem; padding: 1rem 1.5rem;
  background: var(--bg-card); border-top: 1px solid var(--rule);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ── Déplacement : surbrillance de cible (glisser-déposer) ── */
#list li.drop, .node-row.drop {
  background: color-mix(in srgb, var(--accent) 22%, transparent);
  outline: 2px dashed var(--accent); outline-offset: -2px; border-radius: var(--radius-sm);
}
/* ── Déplacement : sélecteur de dossier ── */
.movetree { list-style: none; margin: 1rem 0; padding: 0; max-height: 50vh; overflow: auto;
  border: 1px solid var(--rule); border-radius: var(--radius-md); }
.movetree ul { list-style: none; margin: 0; padding-left: 1.1rem; }
.movenode { padding: .4rem .55rem; border-radius: var(--radius-sm); cursor: pointer;
  font-size: .92rem; user-select: none; }
.movenode:hover { background: var(--bg-subtle); }
.movenode.sel { background: color-mix(in srgb, var(--accent) 25%, transparent); font-weight: 600; }

/* ── Dialogue cases à cocher (membres de groupe) ── */
.checks { display: flex; flex-wrap: wrap; gap: .5rem 1rem; margin: 1rem 0; max-height: 55vh; overflow: auto; }
.check { display: inline-flex; align-items: center; gap: .35rem; font-size: .95rem; cursor: pointer; }
#groups li strong { font-family: 'Space Grotesk', sans-serif; }

/* ── Dialogue de partage ── */
.emails {
  width: 100%; margin: .8rem 0; padding: .6rem .7rem; border: 1px solid var(--rule-strong);
  border-radius: var(--radius-md); background: var(--bg-page); color: var(--fg-primary);
  font-family: inherit; font-size: .92rem; resize: vertical;
}
/* Icône 🔗 : neutre = partageable ; « shared » = partage actif (pastille). */
.shb.shared {
  background: var(--accent); border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 30%, transparent);
}
.shb.shared:hover { background: var(--accent); }

.dialog h4 { margin: .9rem 0 .2rem; font-size: .95rem; color: var(--fg-secondary); }
.modal-shares { margin: 0 0 .4rem; max-height: 30vh; overflow: auto; }
.modal-shares li { display: flex; align-items: center; gap: .4rem; padding: .45rem .2rem; border-bottom: 1px solid var(--rule); flex-wrap: wrap; }
.modal-shares li:last-child { border-bottom: 0; }
.modal-shares button { padding: .3rem .55rem; font-size: .82rem; }
.shareout { display: flex; flex-direction: column; gap: .6rem; margin: .4rem 0; max-height: 40vh; overflow: auto; }
.shareres { background: var(--bg-subtle); border-radius: var(--radius-sm); padding: .5rem .6rem; font-size: .88rem; }
.linkrow { display: flex; gap: .4rem; margin-top: .35rem; }
.linkrow input { flex: 1; font-family: ui-monospace, monospace; font-size: .82rem; }

/* ── Miniatures (photos) ── */
.thumb {
  width: 44px; height: 44px; flex: none; object-fit: cover;
  border-radius: var(--radius-sm); background: var(--bg-subtle);
  border: 1px solid var(--rule); cursor: pointer;
}

/* ── Visionneuse photo (lightbox) ── */
#lightbox {
  position: fixed; inset: 0; z-index: 60; padding: 1rem;
  background: rgba(8,8,15,.93); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  animation: fade .15s ease;
}
#pdfview {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(8,8,15,.93); backdrop-filter: blur(4px);
  display: flex; flex-direction: column; animation: fade .15s ease;
}
#pdfview .pdf-bar {
  display: flex; align-items: center; gap: .6rem; padding: .6rem .9rem;
  background: var(--bg-card); border-bottom: 1px solid var(--border);
}
#pdfview .pdf-name { flex: 1; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#pdfview .pdf-frame { flex: 1; width: 100%; border: 0; background: #525659; }
#pdfview .viewer-center { flex: 1; display: flex; align-items: center; justify-content: center; padding: 1rem; overflow: auto; }
#pdfview .viewer-media { max-width: 94vw; max-height: 82vh; }
#pdfview audio.viewer-media { width: min(620px, 92vw); }
#pdfview .viewer-text { flex: 1; margin: 0; padding: 1rem 1.2rem; overflow: auto; background: var(--bg-card); color: inherit; font-family: ui-monospace, monospace; font-size: .85rem; line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
#pdfview .viewer-rich { flex: 1; overflow: auto; padding: 1.4rem 1.8rem; background: var(--bg-card); color: inherit; line-height: 1.6; }
#pdfview .viewer-rich img { max-width: 100%; height: auto; }
#pdfview .viewer-rich table, #pdfview .csvtbl { border-collapse: collapse; margin: .5rem 0; font-size: .85rem; }
#pdfview .viewer-rich td, #pdfview .viewer-rich th, #pdfview .csvtbl td, #pdfview .csvtbl th { border: 1px solid var(--border); padding: .25rem .5rem; text-align: left; vertical-align: top; }
#pdfview .csvtbl th, #pdfview .viewer-rich th { background: var(--bg-subtle); font-weight: 600; }
#lightbox figure {
  margin: 0; display: flex; flex-direction: column; align-items: center; gap: .8rem;
  max-width: 94vw; max-height: 90vh;
}
#lightbox img {
  max-width: 94vw; max-height: 82vh; object-fit: contain;
  border-radius: var(--radius-md); box-shadow: var(--shadow-lg); background: #0008;
}
#lightbox figcaption {
  color: #fff; font-size: .9rem; font-weight: 500; opacity: .9;
  font-family: 'Space Grotesk', sans-serif;
}
.lb-btn {
  position: absolute; display: inline-flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,.12); color: #fff; border: 1px solid rgba(255,255,255,.3);
  border-radius: var(--radius-pill); cursor: pointer; text-decoration: none;
  transition: background var(--transition);
}
.lb-btn:hover { background: rgba(255,255,255,.26); color: #fff; transform: none; box-shadow: none; }
.lb-close { top: 1rem; right: 1rem; width: 2.4rem; height: 2.4rem; font-size: 1.1rem; }
.lb-dl    { bottom: 1rem; right: 1rem; width: 2.4rem; height: 2.4rem; font-size: 1.2rem; }
.lb-nav {
  top: 50%; transform: translateY(-50%); width: 3rem; height: 3rem; font-size: 2rem;
  border-radius: 50%;
}
.lb-prev { left: 1rem; }
.lb-next { right: 1rem; }

/* ── Mobile : le volet devient un tiroir ── */
@media (max-width: 760px) {
  #burger { display: inline-flex; }
  header h1 { font-size: 1.05rem; }
  #logout .t { display: none; }
  #side {
    position: fixed; top: 0; left: 0; z-index: 40;
    height: calc(100dvh - 50px - env(safe-area-inset-bottom));   /* finit au-dessus de la bottom-nav */
    padding-top: max(.9rem, env(safe-area-inset-top));
    transform: translateX(-100%); transition: transform var(--transition);
    box-shadow: var(--shadow-lg); width: 80%; max-width: 300px;
  }
  #side.open { transform: translateX(0); }
  #backdrop { display: block; position: fixed; inset: 0; z-index: 39;
    background: rgba(8,8,15,.5); }
  #backdrop[hidden] { display: none; }
  main { margin: 1rem .8rem; }
  section { padding: 1.1rem; }
}

/* ── Panneaux de connexion (Calendrier / Contacts / Mail) ── */
.conn { border-collapse: collapse; margin: 1rem 0; }
.conn td { padding: .5rem .9rem; border-bottom: 1px solid var(--rule); vertical-align: top; }
.conn td:first-child { color: var(--fg-muted); white-space: nowrap; font-size: .9rem; }
.conn code { font-family: 'JetBrains Mono', monospace; font-size: .9rem; word-break: break-all; }

/* ── Menu en haut (services : Fichier · Calendrier · Contact · Mail) ── */
header { flex-wrap: wrap; }
#topnav { display: flex; gap: .25rem; margin-left: 1rem; flex-wrap: wrap; }
.topnav-link {
  position: relative;
  display: inline-flex; align-items: center; gap: .4rem;
  background: transparent; color: var(--fg-secondary);
  border: 1px solid transparent; border-radius: var(--radius-pill);
  padding: .45rem .95rem; font-size: .92rem; font-weight: 500;
  transition: background var(--transition), color var(--transition);
}
.topnav-link:hover { background: var(--bg-subtle); }
.topnav-link.active { background: var(--bg-subtle); color: var(--accent); font-weight: 600; }
.nav-badge { flex: none; font-size: .7rem; font-weight: 700; line-height: 1.45; background: var(--accent); color: #fff; border-radius: var(--radius-pill); padding: 0 .38rem; min-width: 1.2rem; text-align: center; }
.topnav-link.active .nav-badge { background: var(--accent); color: #fff; }
@media (max-width: 760px) {
  /* Bottom-nav fixe, atteignable au pouce. Le top-nav sort du flux du header
     (position: fixed) et se colle en bas, icône au-dessus du label. */
  #topnav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
    order: initial; width: auto; margin: 0; gap: 0; flex-wrap: nowrap;
    background: var(--bg-card); border-top: 1px solid var(--rule);
    box-shadow: 0 -1px 4px rgba(24,24,27,0.07);
    padding-bottom: env(safe-area-inset-bottom);   /* home indicator iOS */
  }
  .topnav-link {
    flex: 1 1 0; flex-direction: column; gap: .12rem;
    border-radius: 0; padding: .45rem .2rem;
    min-height: 50px; justify-content: center; text-align: center;
    font-size: .66rem; font-weight: 500; color: var(--fg-muted);
  }
  .topnav-link .ni { font-size: 1.35rem; line-height: 1; }
  .topnav-link:hover { background: transparent; }
  .topnav-link.active { background: transparent; color: var(--accent); font-weight: 600; }
  #topnav .nav-badge {   /* pastille mail : coin haut-droit de l'icône */
    position: absolute; top: .32rem; left: 50%; margin-left: .3rem;
    min-width: 1.05rem; font-size: .62rem;
  }
  /* le contenu défile sans passer sous la bottom-nav */
  body { padding-bottom: calc(50px + env(safe-area-inset-bottom)); }
}

/* ── Alignement à droite du groupe admin/thème/déconnexion ── */
#topnav { margin-right: auto; }   /* pousse who + ⚙️ + thème + déconnexion à droite */
#who { margin-left: 0; }

/* ── App Contacts ── */
/* Contacts en cartes de visite (cliquables → édition). */
#contactlist { list-style: none; padding: 0; margin: .6rem 0 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: .7rem; }
.contact-card {
  display: flex; align-items: center; gap: .8rem; cursor: pointer;
  background: var(--bg-card); border: 1px solid var(--rule); border-radius: var(--radius-lg);
  padding: .8rem .9rem; box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition), border-color var(--transition);
}
.contact-card:hover, .contact-card:focus-visible { box-shadow: var(--shadow-md); border-color: var(--rule-strong); outline: none; }
.contact-card .avatar { width: 3rem; height: 3rem; font-size: 1.05rem; }
.contact-card .cc-org { color: var(--fg-muted); font-size: .84rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.contact-card .cc-line { color: var(--fg-secondary); font-size: .82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.avatar { width: 2.2rem; height: 2.2rem; flex: none; border-radius: 50%; background: var(--accent); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; overflow: hidden; }
.avatar.photo { background: var(--bg-subtle); }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar.lg { width: 4.5rem; height: 4.5rem; font-size: 1.6rem; }
.contact-photo-box { display: flex; align-items: center; gap: 1rem; margin: .2rem 0 .6rem; }
.contact-photo-btns { display: flex; flex-wrap: wrap; gap: .5rem; }
.c-info { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.c-info strong { word-break: break-word; }
.conn-sync { margin-top: 1.6rem; }
.conn-sync summary { cursor: pointer; color: var(--fg-muted); font-size: .9rem; padding: .3rem 0; }

/* ── Champ de formulaire dans les dialogues ── */
.field { display: flex; flex-direction: column; gap: .25rem; margin: .7rem 0; }
.field span { font-size: .85rem; color: var(--fg-muted); }
.field input { width: 100%; box-sizing: border-box; }
.field textarea { width: 100%; box-sizing: border-box; resize: vertical; font: inherit; padding: .55rem .75rem; border: 1px solid var(--rule-strong); border-radius: var(--radius-md); background: var(--bg-page); color: var(--fg-primary); }

/* ── App Contacts : formulaire riche (multi-valeurs) ── */
#contact-search { flex: 1; min-width: 8rem; max-width: 22rem; }
.dialog .multi-block { margin: .8rem 0 .2rem; }
.dialog .multi-block h4 { margin: 0 0 .35rem; }
.multi-row { display: flex; gap: .5rem; align-items: center; margin: .3rem 0; }
.multi-row select { flex: none; width: 8rem; }
.multi-row input { flex: 1; min-width: 0; }
button.del.icon { flex: none; padding: .35rem .55rem; line-height: 1; }
.btn-sm { font-size: .82rem; padding: .3rem .6rem; }

/* ── App Calendrier ── */
.cal-title { font-family: 'Space Grotesk', sans-serif; font-weight: 600; font-size: 1.05rem; text-transform: capitalize; }
.cal-views { display: inline-flex; }
.cal-views .cal-viewbtn { border-radius: 0; }
.cal-views .cal-viewbtn:first-child { border-radius: var(--radius-md) 0 0 var(--radius-md); }
.cal-views .cal-viewbtn:last-child { border-radius: 0 var(--radius-md) var(--radius-md) 0; }
.cal-views .cal-viewbtn + .cal-viewbtn { border-left: 0; }
.cal-viewbtn.active, .cal-viewbtn.active:hover { background: var(--accent); color: #fff; border-color: var(--accent); }

/* Vue mois */
.cal-month { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; background: var(--rule); border: 1px solid var(--rule); border-radius: var(--radius-md); overflow: hidden; }
.cal-wd { background: var(--bg-subtle); text-align: center; padding: .4rem; font-size: .8rem; font-weight: 600; color: var(--fg-muted); }
.cal-cell { background: var(--bg-card); min-height: 5.5rem; padding: .3rem; cursor: pointer; display: flex; flex-direction: column; gap: .15rem; }
.cal-cell:hover { background: var(--bg-subtle); }
.cal-cell.oom { background: var(--bg-page); }
.cal-cell.oom .cal-day { color: var(--fg-muted); }
.cal-day { font-size: .82rem; font-weight: 600; width: 1.5rem; height: 1.5rem; display: inline-flex; align-items: center; justify-content: center; }
.cal-cell.today .cal-day { background: var(--accent); color: #fff; border-radius: 50%; }
.cal-ev { background: var(--accent); color: #fff; font-size: .72rem; line-height: 1.3; padding: .1rem .35rem; border-radius: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.cal-ev.allday { background: color-mix(in srgb, var(--accent) 80%, #000); }
.cal-ev:hover { filter: brightness(1.1); }

/* Vues semaine / jour — grille horaire */
.tg { --axisw: 3.4rem; --hour-h: 42px; border: 1px solid var(--rule); border-radius: var(--radius-md); overflow: hidden; }
.tg-head, .tg-allrow, .tg-body { display: grid; grid-template-columns: var(--axisw) repeat(var(--ndays), 1fr); }
.tg-head { border-bottom: 1px solid var(--rule); }
.tg-dayhead { text-align: center; padding: .4rem .2rem; font-size: .82rem; cursor: pointer; border-left: 1px solid var(--rule); }
.tg-dayhead:hover { background: var(--bg-subtle); }
.tg-dow { color: var(--fg-muted); text-transform: capitalize; }
.tg-dnum { font-weight: 700; margin-left: .25rem; }
.tg-dayhead.today .tg-dnum { background: var(--accent); color: #fff; border-radius: var(--radius-pill); padding: 0 .4rem; }
.tg-allrow { border-bottom: 1px solid var(--rule); background: var(--bg-page); }
.tg-axislabel { font-size: .66rem; color: var(--fg-muted); padding: .25rem .3rem; text-align: right; align-self: center; }
.tg-allcol { border-left: 1px solid var(--rule); padding: .15rem; display: flex; flex-direction: column; gap: .12rem; cursor: pointer; min-height: 1.5rem; }
.tg-body { max-height: 62vh; overflow-y: auto; }
.tg-axis { display: flex; flex-direction: column; }
.tg-hourlabel { height: var(--hour-h); font-size: .66rem; color: var(--fg-muted); text-align: right; padding-right: .3rem; }
.tg-col { position: relative; border-left: 1px solid var(--rule); cursor: pointer; }
.tg-hour { height: var(--hour-h); border-top: 1px solid var(--rule); }
.tg-hour:first-child { border-top: 0; }
.tg-ev { position: absolute; background: var(--accent); color: #fff; border-radius: 5px; padding: .08rem .3rem; font-size: .72rem; line-height: 1.2; overflow: hidden; cursor: pointer; box-shadow: var(--shadow-sm); }
.tg-ev b { font-weight: 600; }
.tg-ev:hover { filter: brightness(1.1); z-index: 2; }

.row2 { display: flex; gap: .7rem; }
.row2 .field { flex: 1; }
@media (max-width: 760px) { .cal-cell { min-height: 3.6rem; } .cal-ev { font-size: .64rem; } .cal-day { width: 1.3rem; height: 1.3rem; } .tg { --axisw: 2.6rem; } }

/* ── Webmail ── */
#maillist { list-style: none; padding: 0; margin: .4rem 0 0; }
#maillist li { display: flex; align-items: center; gap: .8rem; padding: .65rem .5rem; border-bottom: 1px solid var(--rule); cursor: pointer; }
#maillist li:last-child { border-bottom: 0; }
#maillist li:hover { background: var(--bg-subtle); }
#maillist .c-info { flex: 1; min-width: 0; }
#maillist .c-info strong { display: block; font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#maillist .c-info span { font-size: .85rem; color: var(--fg-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.mail-date { white-space: nowrap; flex: none; font-size: .78rem; }
.mail-rowdel { flex: none; opacity: 0; transition: opacity var(--transition); padding: .25rem .45rem; }
#maillist li:hover .mail-rowdel, #maillist li:focus-within .mail-rowdel { opacity: 1; }
@media (hover: none) { .mail-rowdel { opacity: 1; } }
.dialog.wide { max-width: 640px; width: 92vw; }
.mail-body { white-space: pre-wrap; word-break: break-word; background: var(--bg-page); border: 1px solid var(--rule); border-radius: var(--radius-sm); padding: .8rem; max-height: 50vh; overflow: auto; font-family: inherit; font-size: .92rem; margin: .6rem 0; }
.mail-compose-body { width: 100%; box-sizing: border-box; resize: vertical; font-family: inherit; font-size: .92rem; padding: .55rem .75rem; border: 1px solid var(--rule-strong); border-radius: var(--radius-md); background: var(--bg-page); color: var(--fg-primary); }
/* ── Apps (Fichier, Calendrier, Contact, Mail) en pleine page ── */
/* Quand une de ces apps est active : on enlève le cap 940px + les marges →
   bord à bord, pleine hauteur. Admin/Partages gardent la mise en page en carte. */
main:has(> #files:not([hidden])),
main:has(> #calendar:not([hidden])),
main:has(> #contacts:not([hidden])),
main:has(> #mail:not([hidden])) { max-width: none; margin: 0; }
main > #files, main > #calendar, main > #contacts, main > #mail {
  margin: 0; border-radius: 0; border-left: 0; border-right: 0; border-top: 0; box-shadow: none; min-height: calc(100vh - 60px);
}
main > #mail:not([hidden]) { display: flex; flex-direction: column; }   /* :not([hidden]) sinon le display:flex écrase l'attribut hidden → Mail visible partout */
.mail-app { display: flex; gap: 1rem; align-items: stretch; flex: 1; min-height: 0; }
main:has(> #mail:not([hidden])) .mail-nav { border-right: 1px solid var(--rule); padding-right: 1rem; }
.mail-nav { width: 13rem; flex: none; display: flex; flex-direction: column; gap: .4rem; }
.mail-compose-btn { width: 100%; justify-content: center; }
.mail-foldernav { display: flex; flex-direction: column; gap: .1rem; }
.mail-foldernav li { display: block; }
.mail-folder { display: flex; align-items: center; gap: .4rem; width: 100%; text-align: left; border: 0; background: transparent; color: var(--fg-secondary); padding: .5rem .65rem; border-radius: var(--radius-md); font-size: .9rem; font-weight: 500; }
.mf-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mf-count { flex: none; font-size: .75rem; color: var(--fg-muted); }
.mf-badge { flex: none; font-size: .72rem; font-weight: 700; background: var(--accent); color: #fff; border-radius: var(--radius-pill); padding: 0 .4rem; min-width: 1.3rem; text-align: center; }
.mail-folder.has-unread .mf-label { font-weight: 700; color: var(--fg-primary); }
.mail-folder.active .mf-count { color: rgba(255,255,255,.85); }
.mail-folder.active .mf-badge { background: #fff; color: var(--accent); }
.mail-folder:hover { background: var(--bg-subtle); }
.mail-folder.active, .mail-folder.active:hover { background: var(--accent); color: #fff; }
.mail-newfolder { align-self: flex-start; color: var(--fg-muted); }
.mail-main { flex: 1; min-width: 0; }
.mail-head { display: flex; align-items: center; gap: .5rem; margin-bottom: .8rem; padding-bottom: .7rem; border-bottom: 1px solid var(--rule); flex-wrap: wrap; }
.mail-subject { margin: 0; font-size: 1.1rem; }
.mail-move { font-size: .82rem; padding: .3rem .5rem; }
.mail-folders-toggle { display: none; }   /* bouton 📁 : visible sur mobile uniquement */
@media (max-width: 760px) {
  main > #mail { padding-bottom: calc(50px + env(safe-area-inset-bottom)); }
  .mail-app { display: block; }   /* mail-nav passe en tiroir hors flux → mail-main pleine largeur */
  /* mail-nav = TIROIR gauche caché par défaut (dossiers déjà rendus comme en desktop) */
  .mail-nav {
    position: fixed; top: 0; left: 0; z-index: 41;
    height: calc(100dvh - 50px - env(safe-area-inset-bottom));   /* finit au-dessus de la bottom-nav */
    width: 80%; max-width: 290px;
    background: var(--bg-card); box-shadow: var(--shadow-lg);
    padding: max(.9rem, env(safe-area-inset-top)) .8rem .8rem;
    transform: translateX(-100%); transition: transform var(--transition);
    overflow-y: auto; gap: .45rem;
  }
  .mail-nav.open { transform: translateX(0); }
  main:has(> #mail:not([hidden])) .mail-nav { border-right: 1px solid var(--rule); padding-right: .8rem; }
  #mail-backdrop { position: fixed; inset: 0; z-index: 40; background: rgba(8,8,15,.5); }
  #mail-backdrop[hidden] { display: none; }
  .mail-folders-toggle { display: inline-flex; }
  /* Vue lecture : barre d'actions compacte (sinon les boutons débordent). */
  .mail-head { gap: .35rem; }
  .mail-head .btn-sm { padding: .35rem .5rem; font-size: .8rem; }
}
/* Barre de mise en forme du composer */
.mail-toolbar { display: flex; flex-wrap: wrap; gap: .25rem; align-items: center; margin: .2rem 0 .4rem; padding: .35rem; border: 1px solid var(--rule); border-radius: var(--radius-md) var(--radius-md) 0 0; background: var(--bg-subtle); }
.mail-tbtn { min-width: 2rem; padding: .3rem .5rem; font-size: .9rem; line-height: 1; }
.mail-tsel { padding: .3rem .4rem; font-size: .82rem; }
.mail-editor { min-height: 12rem; max-height: 45vh; overflow-y: auto; padding: .7rem .85rem; border: 1px solid var(--rule-strong); border-top: 0; border-radius: 0 0 var(--radius-md) var(--radius-md); background: var(--bg-page); color: var(--fg-primary); font-size: .95rem; line-height: 1.5; }
.mail-editor:focus { outline: none; border-color: var(--rule-strong); }
.mail-editor a { color: var(--accent); }
/* Composer : libellés À/Cc/Cci/Objet alignés à gauche, en regard du champ */
.mail-main .field { flex-direction: row; align-items: flex-start; gap: .7rem; margin: .5rem 0; }
.mail-main .field > span { flex: none; width: 3rem; text-align: right; padding-top: .55rem; }
.mail-main .field > input, .mail-main .field > .recip-wrap { flex: 1; min-width: 0; }
/* Destinataires en chips + autocomplétion */
.recip-field .recip-wrap { position: relative; width: 100%; }
.recip-box { display: flex; flex-wrap: wrap; gap: .3rem; align-items: center; width: 100%; box-sizing: border-box; padding: .3rem .4rem; border: 1px solid var(--rule-strong); border-radius: var(--radius-md); background: var(--bg-page); min-height: 2.4rem; transition: border-color var(--transition), box-shadow var(--transition); }
.recip-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.recip-input { flex: 1; min-width: 8rem; border: 0 !important; background: transparent !important; padding: .2rem !important; box-shadow: none !important; font-size: .92rem; }
.recip-input:focus { outline: none; box-shadow: none !important; }
.recip-chip { display: inline-flex; align-items: center; gap: .25rem; background: color-mix(in srgb, var(--accent) 14%, var(--bg-card)); color: var(--fg-primary); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); border-radius: var(--radius-pill); padding: .1rem .25rem .1rem .6rem; font-size: .85rem; max-width: 100%; }
.recip-chip .del.icon { padding: .05rem .3rem; font-size: .72rem; border: 0; background: transparent; color: var(--fg-muted); }
.recip-chip .del.icon:hover { color: var(--danger); background: transparent; }
.recip-menu { position: absolute; top: 100%; left: 0; right: 0; z-index: 20; background: var(--bg-card); border: 1px solid var(--rule-strong); border-radius: var(--radius-md); box-shadow: var(--shadow-lg); margin-top: .2rem; max-height: 16rem; overflow-y: auto; }
.recip-opt { padding: .45rem .7rem; cursor: pointer; display: flex; gap: .5rem; align-items: baseline; }
.recip-opt:hover { background: var(--bg-subtle); }
.recip-opt strong { font-weight: 600; font-size: .9rem; }
/* Non lus : pastille + gras */
.mail-dot { width: .5rem; height: .5rem; border-radius: 50%; flex: none; background: transparent; }
#maillist li.unread .mail-dot { background: var(--accent); }
#maillist li.unread .c-info strong { font-weight: 700; color: var(--fg-primary); }
#maillist li:not(.unread) .c-info strong { font-weight: 500; color: var(--fg-secondary); }
/* Pièces jointes */
.mail-atts { display: flex; flex-wrap: wrap; gap: .4rem; margin: .6rem 0; }
.mail-att { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-attrow { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin: .2rem 0 .4rem; }
.mail-attchip { display: inline-flex; align-items: center; gap: .25rem; background: var(--bg-subtle); border: 1px solid var(--rule); border-radius: var(--radius-pill); padding: .15rem .25rem .15rem .6rem; font-size: .82rem; }
.mail-attchip .del.icon { padding: .1rem .35rem; font-size: .75rem; }
/* Corps HTML d'un mail (sanitizé) */
.mail-html { white-space: normal; }
.mail-html img { max-width: 100%; height: auto; }
.mail-html a { color: var(--accent); }

/* ── Administration : sous-onglets par service ── */
#admin-nav { display: flex; flex-wrap: wrap; gap: .35rem; margin: .3rem 0 1.1rem; border-bottom: 1px solid var(--rule); padding-bottom: .7rem; }
.admin-tab {
  background: transparent; border: 1px solid var(--rule-strong); border-radius: var(--radius-pill);
  padding: .4rem .9rem; font-size: .9rem; font-weight: 500; color: var(--fg-secondary);
  transition: background var(--transition), color var(--transition);
}
.admin-tab:hover { background: var(--bg-subtle); }
.admin-tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }
#admin-body > .domain-card { margin-bottom: .9rem; }
.adddomain2 { align-items: stretch; flex-direction: column; gap: .55rem; border: 1px solid var(--rule-strong); border-radius: var(--radius-md); padding: .9rem 1rem; background: var(--bg-subtle); margin-bottom: 1.2rem; max-width: 32rem; }
.adddomain2 .field { display: flex; flex-direction: column; gap: .25rem; align-items: stretch; }
.adddomain2 .field span { font-size: .82rem; color: var(--fg-secondary); }
.adddomain2 .field input { width: 100%; box-sizing: border-box; }
.adddomain2 .btn-primary { align-self: flex-start; }
.dom-preview { font-family: 'JetBrains Mono', monospace; font-size: .82rem; color: var(--fg-primary); min-height: 1.1em; word-break: break-all; }
.admin-bar { margin-bottom: 1rem; }
.badge.super { background: #7c3aed; color: #fff; }
#modal .dialog .field { display: flex; flex-direction: column; gap: .25rem; align-items: stretch; margin: .2rem 0; }
#modal .dialog .field span { font-size: .82rem; color: var(--fg-secondary); }
#modal .dialog .field input { width: 100%; box-sizing: border-box; }
#modal .dialog .field input[readonly] { opacity: .65; cursor: not-allowed; }
.badge.web { background: var(--bg-card); color: var(--fg-secondary); border: 1px solid var(--rule-strong); text-transform: none; letter-spacing: 0; font-weight: 500; }
.grouplist { list-style: none; padding: 0; margin: 0 0 .6rem; }
.grouplist li { display: flex; align-items: center; gap: .5rem; padding: .55rem .2rem; border-bottom: 1px solid var(--rule); }
.grouplist li:last-child { border-bottom: 0; }
.groups-sub { margin-top: .8rem; padding-top: .7rem; border-top: 1px dashed var(--rule-strong); }
.groups-sub-h { font-weight: 600; font-size: .92rem; color: var(--fg-secondary); margin-bottom: .4rem; }
