:root {
  --ip-orange: #E86B12;
  --ip-orange-dark: #C4550A;
  --ip-orange-soft: #FFF4EB;
  --ip-ink: #141414;
  --ip-muted: #6B7280;
  --ip-line: #ECECEC;
  --ip-surface: #FFFFFF;
  --ip-go: #1B6B8A;
  --ip-pro: #8A1C2C;
  --ip-store: #178A78;
  --ip-radius: 18px;
  --ip-font: "DM Sans", system-ui, sans-serif;
  --ip-display: "Outfit", "DM Sans", sans-serif;
  --ip-shadow: 0 12px 40px rgba(20, 20, 20, 0.06);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--ip-font);
  color: var(--ip-ink);
  background:
    radial-gradient(900px 420px at 85% -5%, rgba(232, 107, 18, 0.12), transparent 60%),
    radial-gradient(700px 380px at 0% 20%, rgba(232, 107, 18, 0.06), transparent 55%),
    #FAFAF8;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font: inherit; }

.apps-shell { display: flex; min-height: 100vh; }

/* Drawer overlay */
.apps-drawer-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(15, 15, 15, 0.45);
  z-index: 35;
  backdrop-filter: blur(2px);
}
body.apps-sidebar-open .apps-drawer-backdrop { display: block; }

.apps-sidebar {
  width: 272px;
  flex-shrink: 0;
  background: #fff;
  border-right: 1px solid var(--ip-line);
  padding: 28px 18px;
  display: none;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 40;
}
.apps-sidebar__brand {
  display: flex; gap: 12px; align-items: center; margin-bottom: 32px; padding: 0 6px;
}
.apps-sidebar__brand img,
.apps-logo-sm {
  width: 44px; height: 44px; border-radius: 12px; object-fit: cover;
  box-shadow: 0 4px 14px rgba(232, 107, 18, 0.2);
}
.apps-sidebar__brand strong {
  display: block; font-family: var(--ip-display); font-size: 16px; letter-spacing: -0.02em;
}
.apps-sidebar__brand span { color: var(--ip-muted); font-size: 12px; }
.apps-sidebar__nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.apps-sidebar__nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 14px; border-radius: 12px; color: #4B5563; font-weight: 500; font-size: 14px;
  transition: background .15s ease, color .15s ease;
}
.apps-sidebar__nav a .nav-ico {
  width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center;
  background: #F3F4F6; font-size: 13px; flex-shrink: 0;
}
.apps-sidebar__nav a.is-active,
.apps-sidebar__nav a:hover {
  background: var(--ip-orange-soft); color: var(--ip-orange);
}
.apps-sidebar__nav a.is-active .nav-ico,
.apps-sidebar__nav a:hover .nav-ico { background: #FFE4CC; }
.apps-sidebar__foot {
  font-size: 12px; color: var(--ip-muted); padding: 16px 10px 4px;
  border-top: 1px solid var(--ip-line); margin-top: 16px;
}

.apps-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.apps-topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; gap: 14px;
}
.apps-topbar__brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.apps-topbar__brand img {
  width: 42px; height: 42px; border-radius: 12px; object-fit: cover; flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(232, 107, 18, 0.18);
}
.apps-topbar__brand strong {
  display: block; color: var(--ip-orange); font-family: var(--ip-display);
  font-size: 17px; letter-spacing: -0.02em;
}
.apps-topbar__brand small { color: var(--ip-muted); font-size: 12px; }
.apps-topbar__desktop { display: none; width: 100%; align-items: center; gap: 16px; }
.apps-topbar__desktop h1 {
  font-family: var(--ip-display); font-size: 22px; margin: 0; white-space: nowrap; letter-spacing: -0.03em;
}
.apps-search { flex: 1; }
.apps-search input {
  width: 100%; border: 1px solid var(--ip-line); border-radius: 999px;
  padding: 12px 18px; font: inherit; background: #fff;
}
.apps-menu-btn {
  width: 42px; height: 42px; border-radius: 999px; border: 1px solid var(--ip-line);
  background: #fff; font-size: 18px; cursor: pointer; flex-shrink: 0;
}

.apps-content {
  padding: 0 20px 128px;
  max-width: 1120px; width: 100%; margin: 0 auto;
}
.apps-footer {
  display: none; gap: 18px; padding: 20px 28px; color: var(--ip-muted); font-size: 13px;
  border-top: 1px solid var(--ip-line); margin-top: auto;
}
.apps-bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; background: rgba(255,255,255,0.96);
  border-top: 1px solid var(--ip-line); display: grid; grid-template-columns: repeat(3, 1fr);
  padding: 8px 6px calc(8px + env(safe-area-inset-bottom, 0px));
  z-index: 30; backdrop-filter: blur(10px);
}
.apps-bottom-nav a {
  text-align: center; padding: 10px 6px; font-size: 12px; color: var(--ip-muted); font-weight: 600;
  line-height: 1.2;
}
.apps-bottom-nav a.is-active { color: var(--ip-orange); }

.hero-title {
  font-family: var(--ip-display);
  font-size: clamp(28px, 7vw, 40px);
  margin: 2px 0 6px; letter-spacing: -0.035em; line-height: 1.1;
}
.hero-sub { color: var(--ip-muted); margin: 0 0 14px; font-size: 15px; line-height: 1.45; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: 14px; padding: 14px 18px; font-weight: 600; font-size: 15px;
  border: 1px solid transparent; cursor: pointer; transition: transform .12s ease, background .15s ease, box-shadow .15s ease;
}
.btn:active { transform: scale(0.98); }
.btn-primary {
  background: var(--ip-orange); color: #fff;
  box-shadow: 0 8px 20px rgba(232, 107, 18, 0.28);
}
.btn-primary:hover { background: var(--ip-orange-dark); }
.btn-outline {
  background: #fff; color: var(--ip-orange); border-color: #F0C8A0;
}
.btn-outline:hover { background: var(--ip-orange-soft); }
.btn-ghost {
  background: #fff; color: var(--ip-ink); border-color: #E5E7EB;
}
.btn-block { width: 100%; }
.btn-sm { padding: 10px 12px; font-size: 12px; border-radius: 10px; white-space: nowrap; }

.app-icon {
  width: 64px; height: 64px; border-radius: 16px; flex-shrink: 0;
  overflow: hidden; background: #fff;
  box-shadow: 0 6px 18px rgba(0,0,0,0.08);
  border: 1px solid rgba(0,0,0,0.04);
}
.app-icon img { width: 100%; height: 100%; object-fit: cover; }
.app-icon--sm { width: 48px; height: 48px; border-radius: 13px; }
.app-icon--lg { width: 72px; height: 72px; border-radius: 18px; }

.app-head { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 18px; }
.app-meta h2, .app-meta h3 {
  margin: 0 0 4px; font-family: var(--ip-display); font-size: 20px; letter-spacing: -0.02em;
}
.app-meta p { margin: 0; color: var(--ip-muted); font-size: 14px; }
.app-meta .meta-line { margin-top: 8px; font-size: 13px; color: #8A8A8A; }

.card-public {
  background: linear-gradient(165deg, #FFF7F0 0%, #FFFFFF 55%);
  border: 1px solid #F3D9BF;
  border-radius: 22px;
  padding: 18px;
  box-shadow: var(--ip-shadow);
  margin-bottom: 18px;
}
.actions { display: grid; gap: 10px; }
.trust {
  display: flex; align-items: center; gap: 8px; margin-top: 12px;
  color: #1F7A3F; font-size: 13px; font-weight: 600;
}
.trust::before {
  content: ""; width: 18px; height: 18px; border-radius: 999px; flex-shrink: 0;
  background: #1F7A3F center/10px no-repeat
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath fill='none' stroke='%23fff' stroke-width='2' d='M2 6l3 3 5-5'/%3E%3C/svg%3E");
  box-shadow: inset 0 0 0 4px #E8F7EE;
}

.section-head { margin: 4px 0 12px; }
.section-head h2 {
  margin: 0 0 4px; font-family: var(--ip-display); font-size: 20px;
  letter-spacing: -0.02em; display: flex; align-items: center; gap: 10px;
}
.section-head p { margin: 0; color: var(--ip-muted); font-size: 14px; }

.pro-list { display: grid; gap: 10px; margin: 0 0 4px; }
.pro-row {
  display: flex; align-items: center; gap: 12px;
  background: #fff; border: 1px solid var(--ip-line); border-radius: 16px;
  padding: 12px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.03);
}
.pro-row .grow { flex: 1; min-width: 0; }
.pro-row .grow strong { display: block; font-size: 15px; }
.pro-row .grow span { color: var(--ip-muted); font-size: 13px; }

.pro-cta {
  margin-top: 16px;
  margin-bottom: 4px;
  padding-top: 0;
}
.pro-cta .btn { min-height: 48px; }

.security-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  background: linear-gradient(120deg, #FFF4EB, #FFFFFF);
  border: 1px solid #F3D9BF;
  border-radius: 18px; padding: 20px 22px;
  margin-bottom: 24px;
}
.security-banner h2 { margin: 0 0 4px; font-size: 18px; font-family: var(--ip-display); }
.security-banner p { margin: 0; color: var(--ip-muted); font-size: 14px; }

.badge-ok {
  display: inline-flex; align-items: center; gap: 6px;
  background: #E8F7EE; color: #1F7A3F; border-radius: 999px;
  padding: 8px 12px; font-size: 13px; font-weight: 600; white-space: nowrap;
}
.badge-public { background: #E8F7EE; color: #1F7A3F; }
.badge-private { background: #EEF3F8; color: #1E5A8A; }
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  border-radius: 999px; padding: 5px 10px; font-size: 12px; font-weight: 600;
}

.grid-apps {
  display: grid; gap: 16px;
  grid-template-columns: 1fr;
}
.app-card {
  background: #fff; border: 1px solid var(--ip-line); border-radius: 18px; padding: 18px;
  box-shadow: 0 4px 18px rgba(0,0,0,0.03);
}
.app-card .badge { margin: 4px 0 14px; }

.desktop-panel {
  display: none;
  background: #fff; border: 1px solid var(--ip-line); border-radius: 18px; padding: 20px;
  box-shadow: var(--ip-shadow);
}

.hf-mark {
  text-align: center; margin: 20px 0 8px; color: var(--ip-muted); font-size: 13px;
}
.hf-mark img {
  width: 28px; height: 28px; margin: 0 auto 8px; border-radius: 8px; opacity: .9;
}

.auth-card {
  max-width: 420px; margin: 12px auto 32px; background: #fff;
  border: 1px solid var(--ip-line); border-radius: 22px; padding: 28px;
  box-shadow: var(--ip-shadow);
}
.auth-card .brand-row {
  display: flex; align-items: center; gap: 12px; margin-bottom: 18px;
}
.auth-card .brand-row img {
  width: 48px; height: 48px; border-radius: 14px; object-fit: cover;
}
.auth-card h1 { margin: 0 0 8px; font-family: var(--ip-display); font-size: 26px; letter-spacing: -0.03em; }
.auth-card p { color: var(--ip-muted); margin: 0 0 22px; line-height: 1.45; }
.form-field { margin-bottom: 14px; }
.form-field label { display: block; font-size: 13px; margin-bottom: 6px; font-weight: 600; }
.form-field input {
  width: 100%; border: 1px solid var(--ip-line); border-radius: 12px;
  padding: 13px 14px; font: inherit; background: #FAFAFA;
}
.form-field input:focus {
  outline: none; border-color: #F0C8A0; background: #fff;
  box-shadow: 0 0 0 3px rgba(232, 107, 18, 0.12);
}
.form-error { color: #B42318; font-size: 13px; margin-top: 6px; }
.apps-alert {
  background: #FEF3F2; color: #B42318; border-radius: 12px; padding: 12px 14px; margin-bottom: 16px;
}
.apps-alert--ok { background: #E8F7EE; color: #1F7A3F; }

.pro-welcome h1 { font-family: var(--ip-display); font-size: 28px; margin: 0 0 4px; letter-spacing: -0.03em; }
.pro-welcome p { color: var(--ip-muted); margin: 0 0 22px; }
.secure-chip {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--ip-orange); border: 1px solid #F3D9BF; background: #fff;
  border-radius: 999px; padding: 8px 12px; font-size: 13px; font-weight: 600;
  margin-bottom: 16px;
}
.guide-steps { display: grid; gap: 12px; counter-reset: step; }
.guide-step {
  background: #fff; border: 1px solid var(--ip-line); border-radius: 14px; padding: 16px;
  display: flex; gap: 12px; align-items: flex-start;
}
.guide-step::before {
  counter-increment: step; content: counter(step);
  width: 28px; height: 28px; border-radius: 999px; background: var(--ip-orange);
  color: #fff; display: grid; place-items: center; font-weight: 700; flex-shrink: 0;
}

/* Ne pas forcer display:initial — ça écrasait grid/flex (.pro-list, etc.) */
.desktop-only { display: none !important; }

@media (min-width: 960px) {
  .apps-sidebar { display: flex; }
  .apps-drawer-backdrop { display: none !important; }
  .mobile-only { display: none !important; }
  .desktop-only { display: revert !important; }
  .apps-topbar__desktop.desktop-only { display: flex !important; }
  .apps-bottom-nav { display: none; }
  .apps-content {
    padding: 24px 28px 40px;
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 24px;
    align-items: start;
  }
  .apps-content > .span-all { grid-column: 1 / -1; }
  .apps-content-single { display: block !important; }
  .apps-footer { display: flex; }
  .grid-apps { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .desktop-panel { display: block; }
  .actions { grid-template-columns: 1fr; }
}

@media (max-width: 959px) {
  body.apps-sidebar-open .apps-sidebar {
    display: flex; position: fixed; inset: 0 auto 0 0; z-index: 40;
    box-shadow: 16px 0 48px rgba(0,0,0,.18);
    animation: slideIn .2s ease;
  }
}

@keyframes slideIn {
  from { transform: translateX(-12px); opacity: .6; }
  to { transform: translateX(0); opacity: 1; }
}
