/* Alternativ eAgency — charte : bleu nuit #1E2A38, vert #1A9C82, sable #C9A96E */
:root {
  --navy: #1E2A38;
  --navy-2: #26354a;
  --navy-3: #2f405a;
  --green: #12A594;
  --green-2: #22b596;
  --sand: #C9A96E;
  --bg: #121a24;
  --card: #1E2A38;
  --card-2: #253343;
  --line: rgba(255,255,255,.08);
  --text: #eef2f6;
  --muted: #94a3b8;
  --danger: #e5484d;
  --neon: #2BE4A8;
  --display: Unbounded, Inter, system-ui, sans-serif;
  --radius: 18px;
  --shadow: 0 10px 30px rgba(0,0,0,.35);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  background:
    linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px) 0 0 / 56px 56px,
    linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px) 0 0 / 56px 56px,
    radial-gradient(1200px 600px at 80% -10%, rgba(26,156,130,.18), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(201,169,110,.10), transparent 60%),
    #0f1620;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  padding-bottom: env(safe-area-inset-bottom);
}
h1 { font-size: 24px; font-weight: 800; letter-spacing: -.02em; margin: 0 0 4px; }
h2 { font-size: 18px; font-weight: 700; margin: 0 0 12px; }
p { margin: 0; }
.muted { color: var(--muted); }
.tiny { font-size: 12px; }
.center { text-align: center; }
[hidden] { display: none !important; }

/* ---- Marque ---- */
.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.brand-mark {
  width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center;
  background: #12A594; color: #fff; padding: 9px;
  box-shadow: 0 6px 18px rgba(26,156,130,.35);
}
.brand-mark.small { width: 32px; height: 32px; border-radius: 10px; padding: 6px; }
.brand-mark svg { width: 100%; height: 100%; }
.brand-name .v, .topbar-title .v { color: #2BE4A8; }
.brand-kicker { font-size: 11px; letter-spacing: .18em; text-transform: uppercase; color: var(--sand); font-weight: 600; }
.brand-name { font-size: 20px; font-weight: 800; }
.brand-name span { color: var(--green-2); }

/* ---- Connexion ---- */
.screen { min-height: 100vh; }
.login-wrap { min-height: 100vh; display: grid; place-items: center; align-content: center; gap: 18px; padding: 24px 16px; }
.login-card {
  width: 100%; max-width: 420px; background: var(--card); border: 1px solid var(--line);
  border-radius: 24px; padding: 28px 24px; box-shadow: var(--shadow);
}
/* Visuel de connexion */
.login-hero { width: 100%; max-width: 420px; display: grid; justify-items: center; text-align: center; gap: 6px; }
.hero-svg { width: min(62vw, 240px); height: auto; }
.hero-text { display: none; }
.hero-title { font-size: 34px; font-weight: 800; letter-spacing: -.03em; line-height: 1.05; margin: 6px 0 10px; }
.orbit { transform-origin: 210px 210px; animation: spin 60s linear infinite; }
.orbit.slow { animation-duration: 90s; animation-direction: reverse; }
.node { animation: float 4s ease-in-out infinite; }
.node.n2 { animation-delay: -.7s; } .node.n3 { animation-delay: -1.4s; } .node.n4 { animation-delay: -2.1s; } .node.n5 { animation-delay: -2.8s; } .node.n6 { animation-delay: -3.5s; }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
@media (prefers-reduced-motion: reduce) { .orbit, .node, .hub-ring { animation: none; } }
@media (min-width: 900px) {
  .login-wrap { grid-template-columns: 1.1fr 1fr; gap: 48px; max-width: 1040px; margin: 0 auto; }
  .login-hero { max-width: none; justify-items: start; text-align: left; gap: 0; }
  .hero-svg { width: min(38vw, 420px); margin-bottom: 8px; }
  .hero-text { display: block; max-width: 440px; }
  .hero-text p { font-size: 15px; line-height: 1.5; }
  .login-card { justify-self: start; }
  #version-label { grid-column: 1 / -1; }
}
.login-card form { margin-top: 18px; display: grid; gap: 12px; }
#form-newpwd h2 { font-size: 16px; margin: 0; }

/* ---- Formulaires ---- */
label { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
input, select, textarea {
  width: 100%; font: inherit; color: var(--text); background: var(--navy-3);
  border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(26,156,130,.25); }
select option { color: #111; }
.form { display: grid; gap: 14px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 4px; }
.form-info { color: #5ee0c3; background: rgba(26,156,130,.12); border: 1px solid rgba(26,156,130,.35); padding: 10px 12px; border-radius: 10px; font-size: 13px; }
.form-error { color: #ffb4b6; background: rgba(229,72,77,.12); border: 1px solid rgba(229,72,77,.3); padding: 10px 12px; border-radius: 10px; font-size: 13px; }
fieldset.segment { border: 0; padding: 0; margin: 0; }
fieldset.segment legend { font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 8px; }
.seg-btns { display: flex; gap: 8px; }
.seg-btns label { flex: 1; }
.seg-btns input { position: absolute; opacity: 0; pointer-events: none; }
.seg-btns span {
  display: block; text-align: center; padding: 12px; border-radius: 12px; cursor: pointer;
  background: var(--navy-3); border: 1px solid var(--line); color: var(--text); font-weight: 600;
}
.seg-btns input:checked + span { background: var(--green); border-color: var(--green); }
.upload { display: grid; gap: 8px; }
.upload-label { font-size: 13px; font-weight: 600; color: var(--muted); }
.upload-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.preview { min-height: 0; }
.preview img, .preview .file-pill { display: block; }
.preview img { width: 100%; max-height: 180px; object-fit: cover; border-radius: 12px; border: 1px solid var(--line); }
.file-pill { padding: 10px 12px; border-radius: 10px; background: var(--navy-3); font-size: 13px; }

/* ---- Boutons ---- */
.btn {
  font: inherit; font-weight: 700; border: 0; border-radius: 12px; padding: 12px 18px; cursor: pointer;
  color: var(--text); background: var(--navy-3); transition: transform .08s, filter .15s; white-space: nowrap;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .55; cursor: wait; }
.btn-primary { background: linear-gradient(135deg, var(--green-2), var(--green)); color: #fff; box-shadow: 0 6px 16px rgba(26,156,130,.3); }
.btn-primary:hover { filter: brightness(1.06); }
.btn-soft { background: var(--navy-3); border: 1px solid var(--line); font-weight: 600; }
.btn-ghost { background: transparent; color: var(--muted); font-weight: 600; }
.btn-block { width: 100%; }

/* ---- Barre haute / basse ---- */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; background: rgba(18,26,36,.85); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line);
}
.topbar-brand { display: flex; align-items: center; gap: 10px; background: none; border: 0; color: var(--text); cursor: pointer; font: inherit; }
.topbar-title { font-weight: 600; } .topbar-title b { color: var(--green-2); }
.topbar-right { display: flex; align-items: center; gap: 8px; }
.user-chip { display: flex; align-items: center; gap: 10px; }
.user-meta { display: none; text-align: right; line-height: 1.1; }
.user-meta b { display: block; font-size: 13px; } .user-meta small { font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 800; color: var(--neon); border: 1.5px solid var(--neon); background: rgba(43,228,168,.08); }
.btn-icon { padding: 6px 8px; display: grid; place-items: center; } .btn-icon svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
@media (min-width: 640px) { .user-meta { display: block; } }
.view { max-width: 1040px; margin: 0 auto; padding: 20px 16px 96px; }
.bottombar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 20; display: flex; justify-content: space-around;
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom)); background: rgba(18,26,36,.92); backdrop-filter: blur(12px); border-top: 1px solid var(--line);
}
.nav-btn { flex: 1; max-width: 160px; background: none; border: 0; color: var(--muted); font: inherit; font-size: 11px; font-weight: 600; display: grid; justify-items: center; gap: 2px; padding: 6px; border-radius: 12px; cursor: pointer; }
.nav-btn .nav-ico { font-size: 18px; }
.nav-btn.active { color: var(--neon); background: rgba(43,228,168,.1); }
#screen-app { display: flex; flex-direction: column; }
@media (min-width: 900px) {
  .view { padding-bottom: 40px; order: 2; width: 100%; }
  .bottombar { order: 1; position: static; justify-content: center; gap: 8px; padding: 8px 16px; border-top: 0; border-bottom: 1px solid var(--line); background: transparent; backdrop-filter: none; }
  .nav-btn { display: flex; align-items: center; gap: 8px; font-size: 13px; padding: 8px 16px; max-width: none; flex: 0 0 auto; }
  .nav-btn .nav-ico { font-size: 15px; }
}

/* ---- Accueil ---- */
.home { display: grid; gap: 26px; }
.kicker { font-size: 11px; letter-spacing: .28em; text-transform: uppercase; color: var(--neon); font-weight: 700; margin-bottom: 10px; }
.hero-h1 { font-family: var(--display); font-size: clamp(26px, 4.2vw, 46px); font-weight: 800; line-height: 1.08; letter-spacing: -.01em; margin: 0 0 20px; }
.hero-h1 .accent { color: var(--neon); }
.stat-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 18px; }
.stat-tile { background: rgba(30,42,56,.75); border: 1px solid var(--line); border-radius: 14px; padding: 14px 14px 12px; }
.stat-tile b { display: block; font-family: var(--display); font-size: 26px; color: #fff; }
.stat-tile span { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.cta-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.btn-neon { background: var(--neon); color: #0c1a16; border-radius: 999px; box-shadow: 0 8px 24px rgba(43,228,168,.28); }
.btn-neon:hover { filter: brightness(1.05); }
.recent .recent-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.recent h2 { font-family: var(--display); font-size: 15px; margin: 0; }
.link { background: none; border: 0; color: var(--neon); font: inherit; font-weight: 700; font-size: 13px; cursor: pointer; }
.recent-list { display: grid; gap: 8px; }
.recent-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 13px; padding: 8px 0; border-top: 1px solid var(--line); }
.recent-row:first-child { border-top: 0; }
.recent-row small { color: var(--muted); display: block; }

/* Schéma radial */
.radial { position: relative; width: min(100%, 520px); aspect-ratio: 1; margin: 0 auto; }
.radial > svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.radial .spoke { stroke: var(--neon); stroke-opacity: .7; stroke-width: 2; stroke-dasharray: 7 9; vector-effect: non-scaling-stroke; animation: dash 1.4s linear infinite; }
.radial .spoke.off { stroke: #7f8fa3; stroke-opacity: .45; animation-duration: 3.2s; }
@keyframes dash { to { stroke-dashoffset: -32; } }
.radial .ring { fill: none; stroke: rgba(255,255,255,.1); stroke-width: 1; vector-effect: non-scaling-stroke; }
.hub-core { position: absolute; left: 50%; top: 50%; width: 36%; aspect-ratio: 1; transform: translate(-50%, -50%); border-radius: 50%; display: grid; place-content: center; text-align: center;
  background: radial-gradient(circle at 50% 35%, #1b2838, #0f1620 70%); border: 2px solid var(--neon); box-shadow: 0 0 0 10px rgba(43,228,168,.08), 0 0 60px rgba(43,228,168,.18); }
.hub-kicker { font-size: 9px; letter-spacing: .3em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.hub-name { font-family: var(--display); font-weight: 800; font-size: clamp(14px, 2.2vw, 24px); line-height: 1.05; margin-top: 4px; }
.hub-name .accent { color: var(--neon); display: block; }
.hub-agency { font-size: 10px; color: var(--sand); letter-spacing: .14em; text-transform: uppercase; font-weight: 700; margin-top: 6px; }
.rnode { position: absolute; width: 24%; aspect-ratio: 1; transform: translate(-50%, -50%); border-radius: 50%; display: grid; place-content: center; justify-items: center; gap: 2px; text-align: center;
  background: #1a2634; border: 1px solid var(--line); color: var(--text); font: inherit; cursor: default; padding: 0; transition: transform .15s, box-shadow .15s; }
.rnode .ico { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; color: #9fb0c3; }
.rnode .lbl { font-size: clamp(9px, 1.2vw, 12px); font-weight: 700; line-height: 1.1; padding: 0 8%; }
.rnode .sub { font-size: 8px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.rnode.live { cursor: pointer; border-color: var(--neon); background: rgba(43,228,168,.1); box-shadow: 0 0 30px rgba(43,228,168,.25); }
.rnode.live .ico { color: var(--neon); }
.rnode.live:hover { transform: translate(-50%, -50%) scale(1.06); }
.rnode.locked { opacity: .45; }
@media (min-width: 900px) { .home { grid-template-columns: 1.05fr 1fr; align-items: center; gap: 40px; } }
@media (max-width: 899px) { .home-right { order: -1; } .radial { width: min(100%, 360px); } }

/* ---- Cartes / pages ---- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.page-head { margin-bottom: 16px; }
.page-head.row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.list { display: grid; gap: 10px; }
.item { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; }
.item-title { font-weight: 700; }
.item-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.empty { color: var(--muted); text-align: center; padding: 24px; }

/* ---- Statuts ---- */
.status { font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; padding: 5px 9px; border-radius: 999px; white-space: nowrap; }
.status-nouvelle  { background: rgba(201,169,110,.18); color: var(--sand); }
.status-en_cours  { background: rgba(59,130,246,.18); color: #93c5fd; }
.status-accreditee{ background: rgba(26,156,130,.2); color: #5ee0c3; }
.status-refusee   { background: rgba(229,72,77,.18); color: #fda4a7; }

/* ---- Admin ---- */
.subnav { display: flex; gap: 6px; margin-bottom: 18px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 5px; width: fit-content; max-width: 100%; }
.subnav-btn { font: inherit; font-size: 13px; font-weight: 700; color: var(--muted); background: none; border: 0; padding: 9px 16px; border-radius: 10px; cursor: pointer; }
.subnav-btn.active { background: var(--green); color: #fff; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.btn-xs { padding: 7px 10px; font-size: 12px; border-radius: 9px; }
.btn-danger { background: rgba(229,72,77,.15); color: #fda4a7; border: 1px solid rgba(229,72,77,.35); }
.state { font-size: 11px; font-weight: 700; padding: 4px 8px; border-radius: 999px; }
.state-on { background: rgba(26,156,130,.2); color: #5ee0c3; }
.state-off { background: rgba(148,163,184,.18); color: var(--muted); }
textarea { resize: vertical; min-height: 90px; }
.dialog-wide { width: min(94vw, 600px); }
.tile.locked { opacity: .45; cursor: default; }
.tile.locked .tile-badge { color: var(--muted); border-color: rgba(148,163,184,.4); }

/* ---- Droits par rubrique (interrupteurs) ---- */
fieldset.perms { border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px 14px; margin: 0; }
fieldset.perms legend { font-size: 13px; font-weight: 600; color: var(--muted); padding: 0 6px; }
.perm-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
@media (max-width: 520px) { .perm-grid { grid-template-columns: 1fr; } }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; background: var(--navy-3); border: 1px solid var(--line); border-radius: 12px; cursor: pointer; font-size: 13px; font-weight: 600; color: var(--text); }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track { flex: 0 0 auto; width: 40px; height: 22px; border-radius: 999px; background: #3b4a60; position: relative; transition: background .15s; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch input:checked + .track { background: var(--green); }
.switch input:checked + .track::after { transform: translateX(18px); }
.switch.off { color: var(--muted); }
.switch .sw-label small { display: block; font-weight: 500; color: var(--muted); font-size: 11px; }

/* ---- Équipe / comptes ---- */
.member { display: grid; grid-template-columns: 1fr auto; gap: 10px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; }
.member.off { opacity: .6; }
.member-name { font-weight: 700; }
.member-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.perm-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.pchip { font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 999px; background: rgba(26,156,130,.16); color: #5ee0c3; }
.pchip.off { background: rgba(148,163,184,.12); color: var(--muted); text-decoration: line-through; }
.pchip.all { background: rgba(201,169,110,.16); color: var(--sand); }
.role-tag { font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: 3px 7px; border-radius: 999px; background: rgba(201,169,110,.16); color: var(--sand); margin-left: 6px; vertical-align: middle; }
.agency-group { margin-bottom: 18px; }
.agency-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 0 8px; padding: 0 4px; }
.agency-head h2 { margin: 0; font-size: 16px; }
.agency-head h2 small { color: var(--muted); font-weight: 500; font-size: 12px; margin-left: 8px; }
.member-actions { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.member-actions .row-actions { justify-content: flex-end; }
.form-actions .tiny { margin-right: auto; align-self: center; }
.filters { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.filters select { max-width: 200px; } .filters input { flex: 1; min-width: 200px; }
.table-wrap { padding: 0; overflow: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th, .table td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 700; background: var(--card-2); position: sticky; top: 0; }
.table td select { padding: 8px 10px; border-radius: 10px; font-size: 12px; }
.table a { color: var(--green-2); font-weight: 600; text-decoration: none; }
.dialog { background: var(--card); color: var(--text); border: 1px solid var(--line); border-radius: 20px; padding: 24px; width: min(92vw, 440px); }
.dialog::backdrop { background: rgba(0,0,0,.6); backdrop-filter: blur(4px); }

/* ---- Toast ---- */
.toast {
  position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); z-index: 50;
  background: var(--green); color: #fff; padding: 12px 18px; border-radius: 999px; font-weight: 600; font-size: 14px; box-shadow: var(--shadow);
}
.toast.error { background: var(--danger); }
@media (min-width: 900px) { .toast { bottom: 28px; } }
@media (max-width: 520px) { .grid-2 { grid-template-columns: 1fr; } h1 { font-size: 21px; } }
