/* Pages de compte IncoBrowser (app.incobrowser.com).
   Même direction artistique que la vitrine (site/index.html) et le logiciel (ui.html) :
   noir et blanc, cartes blanches à ombre douce, Inter + JetBrains Mono auto-hébergées.
   CSP stricte côté serveur : aucun style inline, aucune ressource externe. */

@font-face { font-family: "Inter"; src: url("/assets/fonts/inter.woff2") format("woff2"); font-weight: 400 700; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("/assets/fonts/jetbrains-mono.woff2") format("woff2"); font-weight: 400 500; font-display: swap; }

:root {
  --ink: #17181b;
  --ink-2: #3f4248;
  --ink-hover: #2a2c31;
  --muted: #84878e;
  --faint: #c4c6cb;
  --line: #ebebee;
  --line-2: #f0f0f2;
  --bg: #f5f5f6;
  --panel: #ffffff;
  --hover: #f7f7f8;
  --soft: rgba(23, 24, 27, .05);
  --red: #e5484d;
  --red-ink: #c4343a;
  --red-50: #fdeeee;
  --green: #2f9e66;
  --green-50: #eaf6ef;
  --amber: #a86a12;
  --amber-50: #fbf3e4;
  --shadow: 0 1px 2px rgba(17, 18, 22, .06), 0 0 0 1px rgba(17, 18, 22, .05);
  --shadow-lg: 0 24px 48px -16px rgba(17, 18, 22, .14), 0 0 0 1px rgba(17, 18, 22, .06);
  --ring: 0 0 0 3px rgba(23, 24, 27, .08);
  --r: 12px;
  --mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
  color-scheme: light;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  font-family: Inter, "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow-wrap: anywhere;
}
a { color: inherit; }
svg { display: block; flex-shrink: 0; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; }
button:disabled { cursor: default; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

/* ---------- en-tête / pied ---------- */
.top {
  display: flex; align-items: center; gap: 16px;
  width: 100%; max-width: 1120px; margin: 0 auto;
  height: 64px; padding: 0 24px;
}
.logo { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; font-size: 17px; letter-spacing: -.02em; text-decoration: none; border-radius: 8px; }
.logo-mark { width: 28px; height: 28px; border-radius: 8px; background: var(--ink); display: grid; place-items: center; }
.top-end { margin-left: auto; display: flex; align-items: center; gap: 8px; min-width: 0; }
.top-end .hint { font-size: 14px; color: var(--muted); white-space: nowrap; }

.foot {
  width: 100%; max-width: 1120px; margin: 0 auto;
  padding: 24px 24px 32px;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px 18px;
  font-size: 13px; color: var(--muted);
}
.foot a { text-decoration: none; color: var(--ink-2); border-radius: 4px; }
.foot a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }

/* ---------- zone centrale ---------- */
.main { flex: 1; width: 100%; display: flex; justify-content: center; align-items: flex-start; padding: 32px 24px 24px; }
.main.center { align-items: center; padding-top: 16px; }
.narrow { width: 100%; max-width: 420px; }
.wide { width: 100%; max-width: 720px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }

.card { background: var(--panel); border-radius: 16px; box-shadow: var(--shadow); padding: 32px; }
.card + .card { margin-top: 0; }
.card-lg { box-shadow: var(--shadow-lg); }

h1 { font-size: 26px; line-height: 1.2; font-weight: 600; letter-spacing: -.03em; }
h2 { font-size: 17px; line-height: 1.3; font-weight: 600; letter-spacing: -.015em; }
.sub { margin-top: 8px; color: var(--ink-2); font-size: 15px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: var(--mono); font-size: .92em; }
.center-text { text-align: center; }
.gap-top { margin-top: 24px; }
.gap-top-sm { margin-top: 16px; }
.stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.wide > *, .stack > * { min-width: 0; }
.narrow-card { width: 100%; max-width: 440px; margin: 0 auto; }
.card > .alert, .card > noscript > .alert { margin-top: 18px; }
.card > .alert + .btn { margin-top: 16px; }
[tabindex="-1"]:focus { outline: none; }
h2 .muted { font-weight: 500; }
.code-404 { font-size: 13px; font-weight: 500; color: var(--muted); letter-spacing: .08em; margin-bottom: 10px; }

.icon-badge {
  width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center;
  background: var(--soft); color: var(--ink); margin-bottom: 18px;
}
.icon-badge.ok { background: var(--green-50); color: var(--green); }
.icon-badge.bad { background: var(--red-50); color: var(--red); }

/* ---------- formulaires ---------- */
.form { display: grid; gap: 16px; margin-top: 24px; }
.field { display: grid; gap: 6px; }
.label-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
label, .label { font-size: 14px; font-weight: 500; color: var(--ink); }
.label-row a { font-size: 13px; color: var(--ink-2); text-decoration: none; border-radius: 4px; }
.label-row a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }

.inp {
  width: 100%; height: 44px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--panel);
  font-size: 15px; outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.inp::placeholder { color: var(--faint); }
.inp:hover { border-color: #dcdce0; }
.inp:focus { border-color: var(--ink); box-shadow: var(--ring); }
.inp[aria-invalid="true"] { border-color: var(--red); }
.inp[aria-invalid="true"]:focus { box-shadow: 0 0 0 3px rgba(229, 72, 77, .14); }
.inp:disabled { background: var(--hover); color: var(--muted); }

.pwd { position: relative; }
.pwd .inp { padding-right: 88px; }
.pwd-toggle {
  position: absolute; top: 6px; right: 6px; height: 32px; padding: 0 10px; border-radius: 7px;
  font-size: 13px; font-weight: 500; color: var(--ink-2);
  transition: background-color .15s ease, color .15s ease;
}
.pwd-toggle:hover { background: var(--soft); color: var(--ink); }

.field-err { font-size: 13px; color: var(--red-ink); line-height: 1.4; }
.field-err:empty { display: none; }
.field-hint { font-size: 13px; color: var(--muted); line-height: 1.4; }

/* indicateur de solidité du mot de passe */
.meter { display: flex; align-items: center; gap: 10px; }
.meter-bars { flex: 1; display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.meter-bars i { height: 4px; border-radius: 99px; background: var(--line); transition: background-color .2s ease; }
.meter[data-level="1"] .meter-bars i:nth-child(-n+1) { background: var(--red); }
.meter[data-level="2"] .meter-bars i:nth-child(-n+2) { background: var(--ink-2); }
.meter[data-level="3"] .meter-bars i { background: var(--green); }
.meter-txt { font-size: 12.5px; color: var(--muted); min-width: 88px; text-align: right; white-space: nowrap; }
.meter[data-level="1"] .meter-txt { color: var(--red-ink); }
.meter[data-level="3"] .meter-txt { color: var(--green); }

/* messages */
.alert {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 11px 14px; border-radius: 10px;
  font-size: 14px; line-height: 1.45;
  background: var(--red-50); color: var(--red-ink);
}
.alert svg { margin-top: 2px; }
.alert.info { background: var(--soft); color: var(--ink-2); }
.alert.ok { background: var(--green-50); color: #22744b; }
.alert.warn { background: var(--amber-50); color: var(--amber); }

/* ---------- boutons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  height: 44px; padding: 0 18px; border-radius: 10px;
  font-size: 15px; font-weight: 500; line-height: 1; text-decoration: none; white-space: nowrap;
  transition: background-color .15s ease, box-shadow .15s ease, transform .12s ease, opacity .15s ease, color .15s ease;
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn-dark { background: var(--ink); color: #fff; box-shadow: 0 1px 2px rgba(17, 18, 22, .2); }
.btn-dark:hover:not(:disabled) { background: var(--ink-hover); }
.btn-dark:disabled { background: #5d5f65; }
.btn-light { background: var(--panel); color: var(--ink); box-shadow: var(--shadow); }
.btn-light:hover:not(:disabled) { background: var(--hover); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover:not(:disabled) { background: var(--red-ink); }
.btn-danger:disabled { opacity: .7; }
.btn-ghost-danger { color: var(--red-ink); box-shadow: inset 0 0 0 1px #f3c9cb; background: var(--panel); }
.btn-ghost-danger:hover:not(:disabled) { background: var(--red-50); }
.btn-sm { height: 36px; padding: 0 14px; font-size: 14px; border-radius: 9px; }
.btn-xs { height: 32px; padding: 0 12px; font-size: 13.5px; border-radius: 8px; }
.btn-block { width: 100%; }
.btn .spin {
  width: 14px; height: 14px; border-radius: 50%;
  border: 1.7px solid currentColor; border-right-color: transparent;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.link-btn {
  font-size: 14px; color: var(--ink-2); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--faint);
  border-radius: 4px; padding: 2px 0;
}
.link-btn:hover { color: var(--ink); text-decoration-color: currentColor; }
.links { margin-top: 22px; display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 14px; font-size: 14px; color: var(--muted); }
.links a { color: var(--ink); font-weight: 500; text-decoration: none; border-radius: 4px; }
.links a:hover { text-decoration: underline; text-underline-offset: 3px; }

.sep { display: flex; align-items: center; gap: 12px; margin: 20px 0; font-size: 13px; color: var(--muted); }
.sep::before, .sep::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.legal { margin-top: 18px; font-size: 13px; color: var(--muted); line-height: 1.5; }
.store-note {
  display: flex; gap: 10px; align-items: flex-start;
  margin-top: 4px; padding: 12px 14px; border-radius: 10px; background: var(--soft);
  font-size: 13px; color: var(--ink-2); line-height: 1.5;
}
.store-note svg { margin-top: 1px; color: var(--ink); }

/* ---------- état de chargement de page ---------- */
.page-loading { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 48px 0; color: var(--muted); font-size: 14px; }
.page-loading .spin {
  width: 16px; height: 16px; border-radius: 50%;
  border: 1.8px solid currentColor; border-right-color: transparent;
  animation: spin .7s linear infinite;
}

/* ---------- page Compte ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 0 4px 4px; }
.sec-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.sec-head p { width: 100%; }
.acct { display: flex; align-items: center; gap: 14px; margin-top: 18px; min-width: 0; }
.avatar {
  width: 44px; height: 44px; border-radius: 12px; background: var(--ink); color: #fff;
  display: grid; place-items: center; font-weight: 600; font-size: 17px; text-transform: uppercase; flex-shrink: 0;
}
.avatar.has-img { background: var(--soft); overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.acct-txt { min-width: 0; }
.acct-name,
.acct-email { font-weight: 600; font-size: 16px; letter-spacing: -.01em; overflow-wrap: anywhere; line-height: 1.35; }
.acct-name:not([hidden]) + .acct-email { font-weight: 400; font-size: 14px; letter-spacing: 0; color: var(--muted); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.tag {
  display: inline-flex; align-items: center; gap: 5px;
  height: 22px; padding: 0 8px; border-radius: 99px;
  font-size: 12px; font-weight: 500; background: var(--soft); color: var(--ink-2); white-space: nowrap;
}
.tag.ok { background: var(--green-50); color: #22744b; }
.tag.warn { background: var(--amber-50); color: var(--amber); }
.tag.dark { background: var(--ink); color: #fff; }

.verify-txt { flex: 1; min-width: 0; display: grid; gap: 10px; }
.verify-act { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; }
.verify-act .btn { color: var(--ink); }
#resend-msg { font-size: 13px; }
#resend-msg:empty { display: none; }

.dl-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 18px; }
.dl-btn { justify-content: flex-start; height: 56px; padding: 0 16px; gap: 12px; }
.dl-btn span { display: grid; gap: 3px; text-align: left; line-height: 1.1; }
.dl-btn small { font-size: 12px; font-weight: 400; color: rgba(255, 255, 255, .62); }
.dl-btn.btn-light small { color: var(--muted); }

.devices { list-style: none; margin-top: 14px; border-top: 1px solid var(--line-2); }
.device { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line-2); min-width: 0; }
.device:last-child { border-bottom: 0; padding-bottom: 2px; }
.device-ico { width: 38px; height: 38px; border-radius: 10px; background: var(--soft); display: grid; place-items: center; flex-shrink: 0; }
.device-txt { flex: 1; min-width: 0; }
.device-name { font-weight: 500; display: flex; align-items: center; flex-wrap: wrap; gap: 2px 8px; min-width: 0; line-height: 1.4; }
.device-name span:first-child { overflow-wrap: anywhere; min-width: 0; }
.device-meta { font-size: 13px; color: var(--muted); }
.device.out { opacity: 0; transform: translateX(12px); transition: opacity .2s ease, transform .2s ease; }
.empty { padding: 22px 0 6px; text-align: center; color: var(--muted); font-size: 14px; }
.empty b { display: block; color: var(--ink-2); font-weight: 500; margin-bottom: 2px; }

.danger-zone { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.danger-zone > div { flex: 1 1 280px; min-width: 0; }

/* ---------- page Autoriser ---------- */
.auth-pc { text-align: center; }
.auth-pc .icon-badge { margin: 0 auto 18px; width: 52px; height: 52px; border-radius: 14px; }
.pc-name { font-family: var(--mono); font-weight: 500; font-size: .95em; background: var(--soft); padding: 1px 7px; border-radius: 6px; overflow-wrap: anywhere; word-break: break-word; }
.who {
  display: flex; align-items: center; gap: 12px; text-align: left;
  margin: 22px 0 20px; padding: 12px 14px; border-radius: 12px; background: var(--hover); box-shadow: inset 0 0 0 1px var(--line);
}
.who .avatar { width: 36px; height: 36px; border-radius: 10px; font-size: 15px; }
.who-txt { min-width: 0; flex: 1; }
.who-txt small { display: block; font-size: 12px; color: var(--muted); }
.who-txt b { display: block; font-weight: 600; overflow-wrap: anywhere; }
.perm { list-style: none; display: grid; gap: 8px; text-align: left; margin: 0 0 22px; font-size: 14px; color: var(--ink-2); }
.perm li { display: flex; gap: 10px; align-items: flex-start; }
.perm svg { margin-top: 3px; color: var(--ink); }
.auth-actions { display: grid; gap: 12px; justify-items: center; }
.auth-pc .alert { text-align: left; }
.auth-pc h1 .pc-name { font-size: .82em; }

/* ---------- boîte de dialogue ---------- */
dialog.dlg {
  margin: auto; border: 0; padding: 0; background: var(--panel); color: var(--ink);
  width: min(440px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); overflow: auto;
  border-radius: 16px; box-shadow: var(--shadow-lg);
}
dialog.dlg::backdrop { background: rgba(17, 18, 22, .38); }
dialog.dlg[open] { animation: dlg-in .18s ease; }
@keyframes dlg-in { from { opacity: 0; transform: translateY(8px) scale(.98); } }
.dlg-body { padding: 26px 26px 8px; }
.dlg-body p { margin-top: 8px; color: var(--ink-2); font-size: 14.5px; }
.dlg-body .form { margin-top: 18px; }
.dlg-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 18px 26px 24px; flex-wrap: wrap; }

/* ---------- responsive ---------- */
@media (max-width: 600px) {
  .top { padding: 0 16px; height: 60px; }
  .top-end .hint { display: none; }
  .main { padding: 16px 16px 16px; }
  .main.center { padding-top: 8px; }
  .card { padding: 24px 20px; border-radius: 14px; }
  h1 { font-size: 23px; }
  .dl-grid { grid-template-columns: 1fr; }
  .dlg-body { padding: 22px 20px 6px; }
  .dlg-foot { padding: 16px 20px 20px; }
  .dlg-foot .btn { flex: 1 1 auto; }
  .foot { padding: 20px 16px 28px; }
}
@media (max-width: 600px) {
  .device { gap: 12px; align-items: flex-start; }
  .device-ico { display: none; }
  .device .btn { margin-top: 2px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .btn .spin, .page-loading .spin { animation: spin 1.6s linear infinite !important; }
}
