:root {
  --bg: #141320;
  --surface: #1c1a27;
  --surface2: #232030;
  --border: #332f45;
  --text: #ececf1;
  --muted: #9b96ab;
  --accent: #8b5cf6;
  --accent-dark: #7c3aed;
  --soft: #2b2440;
  --danger: #f87171;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 10px 28px rgba(0, 0, 0, .5);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

.hidden { display: none !important; }

.boot {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: var(--bg);
  text-align: center;
  padding: 24px;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--accent), #9333ea);
  position: relative;
  flex: none;
}
.brand-mark::after {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 3px;
  background:
    radial-gradient(circle at 30% 30%, #fff 0 3px, transparent 3px),
    radial-gradient(circle at 70% 30%, #fff 0 3px, transparent 3px),
    radial-gradient(circle at 30% 70%, #fff 0 3px, transparent 3px),
    radial-gradient(circle at 70% 70%, #fff 0 3px, transparent 3px);
}

/* ---------- Auth ---------- */
.auth {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand h1 { font-size: 1.4rem; margin: 0; }
.ext { color: var(--accent); }

.auth-sub { margin: 0 0 6px; color: var(--muted); font-size: .92rem; }

.auth-card label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: .85rem;
  color: var(--muted);
}

.auth-card input {
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: 9px;
  font-size: .95rem;
  background: var(--surface2);
  color: var(--text);
}
.auth-card input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 0;
  background: #2b2738;
}

.btn-primary {
  margin-top: 6px;
  padding: 12px;
  border: 0;
  border-radius: 9px;
  background: var(--accent);
  color: #fff;
  font-size: .95rem;
  font-weight: 600;
  cursor: pointer;
}
.btn-primary:hover { background: var(--accent-dark); }
.btn-primary:disabled { opacity: .6; cursor: progress; }

.auth-error {
  margin: 0;
  min-height: 1.1em;
  color: var(--danger);
  font-size: .85rem;
}

.auth-msg {
  margin: 0;
  color: #4ade80;
  font-size: .85rem;
}
.auth-msg:empty { display: none; }

.auth-toggle {
  margin: 4px 0 0;
  text-align: center;
  font-size: .85rem;
  color: var(--muted);
}

.link-btn {
  border: 0;
  background: none;
  padding: 0;
  margin-left: 4px;
  color: var(--accent);
  font-size: inherit;
  font-weight: 600;
  cursor: pointer;
}
.link-btn:hover { text-decoration: underline; }

/* ---------- Topbar ---------- */
.topbar {
  height: 60px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  font-weight: 700;
  font-size: 1.05rem;
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
}
.user-email { color: var(--muted); font-size: .88rem; }

.btn-ghost {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  padding: 8px 14px;
  border-radius: 8px;
  font-size: .85rem;
  cursor: pointer;
}
.btn-ghost:hover { background: var(--bg); }

/* ---------- Content ---------- */
.content {
  max-width: 1100px;
  margin: 0 auto;
  padding: 36px 24px;
}
.content-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 26px;
  flex-wrap: wrap;
}
.content-head h2 { margin: 0; font-size: 1.5rem; }

#tool-search {
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 9px;
  font-size: .9rem;
  min-width: 240px;
  background: var(--surface);
}
#tool-search:focus { outline: 2px solid var(--accent); }

/* ---------- App grid ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 18px;
}

.tool-groups { display: block; }

.cat-title {
  margin: 30px 0 14px;
  font-size: .82rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 12px;
}
.cat-title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}
.cat-title:first-child { margin-top: 4px; }

.tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}
.tile:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
  border-color: #5b4b7e;
}
.tile.soon { cursor: default; opacity: .65; }
.tile.soon:hover { transform: none; box-shadow: none; border-color: var(--border); }

.tile-icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-size: 1.7rem;
  background: var(--soft);
  color: var(--accent);
}
.tile-name { font-weight: 600; font-size: .98rem; }
.tile-desc { font-size: .8rem; color: var(--muted); line-height: 1.35; }
.tile-badge {
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--accent);
  background: var(--soft);
  padding: 3px 8px;
  border-radius: 999px;
}

.empty {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--muted);
  padding: 60px 0;
}

@media (max-width: 520px) {
  .topbar { padding: 0 16px; }
  .user-email { display: none; }
  .content { padding: 24px 16px; }
}

/* ============== Modale "Gérer mes apps" ============== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal.hidden { display: none; }
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .6);
}
.modal-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: min(560px, 100%);
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .5);
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}
.modal-head h3 { margin: 0; font-size: 1.05rem; font-weight: 700; }
.modal-sub {
  margin: 0;
  padding: 12px 18px 4px;
  color: var(--muted);
  font-size: .88rem;
}
.modal-list {
  overflow-y: auto;
  padding: 8px 12px;
  flex: 1;
}
.modal-list .cat-title {
  margin: 12px 6px 6px;
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
}
.modal-list .app-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  user-select: none;
  border: 1px solid transparent;
}
.modal-list .app-row:hover {
  background: var(--soft);
  border-color: var(--border);
}
.modal-list .app-row.checked { background: var(--soft); border-color: var(--accent); }
.modal-list .app-icon {
  flex: 0 0 36px;
  height: 36px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--bg);
  font-size: 1.1rem;
}
.modal-list .app-meta { flex: 1; min-width: 0; }
.modal-list .app-name { font-weight: 600; font-size: .94rem; }
.modal-list .app-desc {
  font-size: .78rem;
  color: var(--muted);
  line-height: 1.3;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.modal-list .app-check {
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
  border-radius: 4px;
  border: 2px solid var(--muted);
  display: grid;
  place-items: center;
  font-size: .9rem;
  color: #fff;
}
.modal-list .app-row.checked .app-check {
  background: var(--accent);
  border-color: var(--accent);
}
.modal-list .app-row.checked .app-check::before { content: "✓"; }
.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 18px;
  border-top: 1px solid var(--border);
}

/* ---- Panel admin (apps privées) ---- */
.admin-app {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  margin: 10px 6px;
  background: var(--bg);
}
.admin-app-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.admin-app-head .icon {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: var(--soft);
  display: grid;
  place-items: center;
  font-size: 1rem;
}
.admin-app-head .name { font-weight: 600; }
.admin-app-head .desc { font-size: .78rem; color: var(--muted); }
.admin-add {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}
.admin-add input {
  flex: 1;
  padding: 7px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: .88rem;
}
.admin-users {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.admin-user-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px 4px 10px;
  border-radius: 999px;
  background: var(--soft);
  border: 1px solid var(--border);
  font-size: .82rem;
}
.admin-user-chip button {
  border: 0;
  background: transparent;
  color: var(--danger);
  cursor: pointer;
  padding: 0 6px;
  font-size: 1rem;
  line-height: 1;
}
.admin-empty {
  color: var(--muted);
  font-size: .82rem;
  font-style: italic;
}
.hidden { display: none !important; }

/* ===================== LANDING PAGE ===================== */
.landing { display: block; min-height: 100vh; color: var(--text); }

.landing-nav {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 32px;
  background: rgba(20, 19, 32, 0.85);
  backdrop-filter: saturate(180%) blur(10px);
  -webkit-backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.landing-nav-brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 700; font-size: 1.15rem;
}
.landing-nav-right { display: flex; align-items: center; gap: 14px; }
.nav-link {
  color: var(--muted); text-decoration: none;
  font-size: .92rem; font-weight: 500; transition: color .15s;
}
.nav-link:hover { color: var(--text); }

.hero {
  max-width: 1100px; margin: 0 auto;
  padding: 96px 32px 80px; text-align: center;
}
.hero h1 {
  font-size: clamp(2.2rem, 5vw, 3.8rem); line-height: 1.1;
  margin: 0 0 24px; font-weight: 800; letter-spacing: -0.02em;
}
.hero-gradient {
  background: linear-gradient(135deg, var(--accent) 0%, #a78bfa 60%, #c4b5fd 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-sub {
  font-size: 1.15rem; color: var(--muted);
  max-width: 640px; margin: 0 auto 36px; line-height: 1.6;
}
.hero-cta {
  display: flex; gap: 12px; justify-content: center;
  flex-wrap: wrap; margin-bottom: 40px;
}
.btn-primary.big, .btn-ghost.big {
  padding: 14px 28px; font-size: 1rem; border-radius: 12px;
}
.btn-ghost.big {
  border: 1px solid var(--border); background: transparent;
  color: var(--text); cursor: pointer; font-family: inherit;
  font-weight: 600; transition: background .15s, border-color .15s;
}
.btn-ghost.big:hover { background: var(--surface); border-color: var(--accent); }
.hero-badges {
  display: flex; justify-content: center; gap: 24px;
  flex-wrap: wrap; color: var(--muted); font-size: .88rem;
}

.audience-tag {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--accent);
  font-size: .82rem;
  font-weight: 600;
  letter-spacing: .02em;
  margin: 0 auto 18px;
  text-align: center;
}
.audience-tag.pro { background: rgba(251,191,36,.15); color: var(--warn, #fbbf24); }
.section { max-width: 1100px; margin: 0 auto; padding: 80px 32px; text-align: center; }
.section > .audience-tag { display: block; width: max-content; }
.features, .features-pro, .reasons { text-align: left; }

.section-pro {
  max-width: none;
  background: linear-gradient(180deg, transparent 0%, rgba(251,191,36,.04) 50%, transparent 100%);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding-left: max(32px, calc((100vw - 1100px) / 2));
  padding-right: max(32px, calc((100vw - 1100px) / 2));
}
.features-pro {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
  max-width: 720px;
  margin: 0 auto;
}
.feature-more {
  background: linear-gradient(135deg, var(--soft) 0%, var(--surface2) 100%);
  border-style: dashed;
}
.feature-more h3 { color: var(--accent); }
.section-alt {
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin: 40px 0; max-width: none;
  padding-left: max(32px, calc((100vw - 1100px) / 2));
  padding-right: max(32px, calc((100vw - 1100px) / 2));
}
.section-title {
  font-size: clamp(1.6rem, 3.5vw, 2.4rem);
  margin: 0 0 12px; text-align: center;
  font-weight: 700; letter-spacing: -0.01em;
}
.section-sub {
  text-align: center; color: var(--muted);
  max-width: 600px; margin: 0 auto 48px; font-size: 1.02rem;
}

.features {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 18px;
}
.feature {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; padding: 22px 20px;
  transition: transform .2s, border-color .2s, background .2s;
}
.feature:hover {
  transform: translateY(-3px);
  border-color: var(--accent); background: var(--surface2);
}
.feature-icon {
  width: 48px; height: 48px; border-radius: 12px;
  background: var(--soft); display: grid; place-items: center;
  font-size: 1.7rem; margin-bottom: 14px;
}
.feature h3 { margin: 0 0 8px; font-size: 1.1rem; font-weight: 700; }
.feature p { margin: 0; color: var(--muted); font-size: .9rem; line-height: 1.5; }

.reasons {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
}
.reason {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 14px; padding: 26px 22px; position: relative;
}
.reason-num {
  font-size: 2.4rem; font-weight: 800; color: var(--accent);
  opacity: .35; line-height: 1; margin-bottom: 8px;
}
.reason h3 { margin: 0 0 10px; font-size: 1.1rem; font-weight: 700; }
.reason p { margin: 0; color: var(--muted); font-size: .92rem; line-height: 1.55; }

.cta-final {
  text-align: center; padding: 80px 32px;
  max-width: 720px; margin: 0 auto;
}
.cta-final h2 {
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  margin: 0 0 12px; font-weight: 700;
}
.cta-final p { color: var(--muted); margin: 0 0 32px; font-size: 1.05rem; }

.landing-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding: 28px 32px; border-top: 1px solid var(--border);
  background: var(--surface); flex-wrap: wrap; gap: 12px;
}
.footer-text { color: var(--muted); font-size: .82rem; }

.auth-back {
  position: absolute; top: 14px; left: 14px;
  background: transparent; border: 1px solid var(--border); color: var(--text);
  width: 34px; height: 34px; border-radius: 8px; cursor: pointer;
  font-size: 1.1rem; font-family: inherit; text-decoration: none;
  display: grid; place-items: center; transition: background .15s;
  z-index: 2;
}
.auth-back:hover { background: var(--surface); }
.auth-card { position: relative; }
/* Centre le brand et le décale du bouton retour */
.auth-card .brand {
  justify-content: center;
  margin-top: 16px;
}

/* Bouton Google */
.btn-google {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; padding: 11px 16px; margin-bottom: 6px;
  background: #fff; color: #1f1f1f;
  border: 1px solid var(--border); border-radius: 10px;
  font-family: inherit; font-size: .95rem; font-weight: 600;
  cursor: pointer; transition: background .15s, box-shadow .15s;
}
.btn-google:hover { background: #f5f5f5; box-shadow: 0 2px 8px rgba(0,0,0,.15); }
.btn-google:disabled { opacity: .6; cursor: not-allowed; }
.btn-google svg { flex-shrink: 0; }

/* Séparateur "ou" */
.auth-sep {
  display: flex; align-items: center; gap: 12px;
  margin: 14px 0 6px;
  color: var(--muted); font-size: .82rem;
}
.auth-sep::before, .auth-sep::after {
  content: ""; flex: 1; height: 1px; background: var(--border);
}

/* Lien "Mot de passe oublié" */
.auth-forgot {
  text-align: center;
  margin: 8px 0 6px;
}
.auth-forgot .link-btn {
  font-size: .85rem;
  color: var(--muted);
}
.auth-forgot .link-btn:hover { color: var(--accent); }

@media (max-width: 700px) {
  .landing-nav { padding: 12px 18px; }
  .nav-link { display: none; }
  .hero { padding: 60px 20px 40px; }
  .hero-badges { gap: 12px; font-size: .82rem; }
  .section { padding: 60px 20px; }
  .section-alt { padding-left: 20px; padding-right: 20px; }
  .cta-final { padding: 60px 20px; }
  .landing-footer { padding: 22px 20px; flex-direction: column; text-align: center; }
}
