@font-face { font-family: "Manrope"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/manrope-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Manrope"; font-style: normal; font-weight: 600; font-display: swap; src: url("fonts/manrope-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Manrope"; font-style: normal; font-weight: 700; font-display: swap; src: url("fonts/manrope-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Manrope"; font-style: normal; font-weight: 800; font-display: swap; src: url("fonts/manrope-latin-800-normal.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 500; font-display: swap; src: url("fonts/jetbrains-mono-latin-500-normal.woff2") format("woff2"); }

:root {
  --ground: #F4F3EF;
  --ink: #13213A;
  --muted: #4A5368;
  --line: #CFD3DB;
  --line2: #DDE0E6;
  --card: #FFFFFF;
  --accent: #1D3A6B;
  --amber: #F2B544;
  --amber-bg: #FBEFD9;
  --amber-ink: #7A4F0C;
  --blue-bg: #E7ECF5;
  --danger: #9C3A16;
  --ok: #2F7A55;
  --note: #ECEAE3;
  --font: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
body.dark { background: var(--ink); color: #fff; }

.wrap {
  max-width: 440px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  padding: max(28px, env(safe-area-inset-top)) 22px max(28px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 18px;
}

h1 { margin: 0; font-size: 28px; line-height: 1.2; font-weight: 800; letter-spacing: -0.02em; }
h2.section { margin: 8px 0 -6px; font-size: 13px; font-weight: 800; letter-spacing: 0.08em; color: var(--muted); text-transform: uppercase; }
p { margin: 0; }
a { color: var(--accent); font-weight: 700; }
body.dark a { color: var(--amber); }
.lead { font-size: 15px; line-height: 22px; color: var(--muted); }
body.dark .lead { color: #C3CBDB; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.tight { margin-top: -10px; }
.center { text-align: center; }
.right { align-self: flex-end; }
.mono { font-family: var(--mono); }
.spacer { flex: 1 1 auto; min-height: 8px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.grow { flex: 1 1 auto; display: flex; flex-direction: column; }
form.grow { gap: 16px; }

:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }

/* Barre du haut */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; }
.toplabel { font-size: 15px; font-weight: 700; color: var(--muted); margin-right: auto; }
.step { font-size: 13px; font-weight: 700; color: var(--muted); margin-left: auto; }
.iconbtn {
  width: 44px; height: 44px; border-radius: 12px; background: var(--card);
  display: inline-flex; align-items: center; justify-content: center; color: var(--ink);
  border: 1px solid var(--line2); flex-shrink: 0;
}
.iconbtn.round { width: 48px; height: 48px; border-radius: 50%; }
body.dark .iconbtn { background: #24345A; border-color: #24345A; color: #fff; }
.lockbtn {
  height: 44px; padding: 0 14px; border-radius: 12px; background: var(--ink); color: #fff !important;
  display: inline-flex; align-items: center; gap: 8px; text-decoration: none; font-size: 14px;
}
.lockbtn .ic { color: var(--amber); }
.hello { font-size: 24px; font-weight: 800; letter-spacing: -0.02em; }

/* Logo et héros */
.logo {
  width: 72px; height: 72px; border-radius: 22px; background: var(--accent); color: var(--amber);
  display: inline-flex; align-items: center; justify-content: center;
}
.logo.small { width: 44px; height: 44px; border-radius: 14px; }
.brand { font-size: 15px; font-weight: 800; letter-spacing: 0.2em; color: var(--muted); text-transform: uppercase; }
.hero { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 12px; }
.hero.top { margin-top: 32px; }
.bubble {
  width: 104px; height: 104px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
}
.bubble.amber { background: var(--amber-bg); color: var(--amber-ink); }
.bubble.red { background: #F6E1D8; color: var(--danger); }
body.dark .bubble.red { background: #4A2A26; color: #F5B7A0; }
.amber-ic { color: var(--amber); }

/* Messages */
.flash { padding: 12px 14px; border-radius: 12px; font-size: 14px; font-weight: 600; background: var(--blue-bg); color: var(--accent); }
.flash.ok { background: #E3EFE8; color: #1F5A3D; }
.flash.error { background: #F6E1D8; color: var(--danger); }
body.dark .flash { background: #24345A; color: #fff; }
.note {
  display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-radius: 14px;
  background: var(--note); font-size: 13px; line-height: 18px; color: var(--muted);
}
.note .ic { flex-shrink: 0; }
.note.plain { background: none; padding: 0; }
.note.plain.center { justify-content: center; }
.note.dark { background: #24345A; color: #DCE3EF; }
.note.dark .ic { color: var(--amber); }
.pill { padding: 6px 12px; border-radius: 999px; font-size: 13px; font-weight: 700; }
.pill.warn { background: #3A2A2A; color: #F5B7A0; }
.warntext { font-size: 13px; font-weight: 700; color: var(--danger); }
.signature { text-align: center; font-size: 13px; font-weight: 700; letter-spacing: 0.03em; color: var(--muted); }

/* Champs */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; font-weight: 700; color: var(--muted); }
input[type=text], input[type=email], input[type=password], input[type=search], select, textarea {
  width: 100%; height: 52px; padding: 0 16px; border: 1px solid var(--line); border-radius: 14px;
  background: var(--card); font: inherit; font-size: 16px; color: var(--ink);
}
textarea { height: auto; padding: 14px 16px; line-height: 22px; resize: vertical; }
select { appearance: none; -webkit-appearance: none; font-weight: 700; font-size: 15px; background: var(--ground); }
input:focus, select:focus, textarea:focus { outline: none; border: 2px solid var(--accent); }
.hint { font-size: 12px; color: var(--muted); }
.meter { display: flex; gap: 4px; margin-top: 4px; }
.meter span { flex: 1; height: 4px; border-radius: 2px; background: var(--line2); }
.meter[data-level="1"] span:nth-child(-n+1) { background: var(--danger); }
.meter[data-level="2"] span:nth-child(-n+2) { background: #C9821B; }
.meter[data-level="3"] span:nth-child(-n+3) { background: var(--ok); }
.meter[data-level="4"] span { background: var(--ok); }
.inputwrap {
  display: flex; align-items: center; gap: 8px; height: 52px; padding: 0 6px 0 0;
  border: 1px solid var(--line); border-radius: 14px; background: var(--card);
}
.inputwrap:focus-within { border: 2px solid var(--accent); }
.inputwrap input { border: none; height: 48px; background: transparent; }
.inputwrap input:focus { border: none; }

/* Boutons */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 56px;
  padding: 0 20px; border: none; border-radius: 16px; background: var(--accent); color: #fff !important;
  font: inherit; font-size: 16px; font-weight: 800; text-decoration: none; cursor: pointer;
}
.btn:active { transform: scale(0.99); }
.btn.amber { background: var(--amber); color: var(--ink) !important; }
.btn.outline-danger { background: transparent; border: 1px solid #B4471F; color: var(--danger) !important; min-height: 52px; }
.linkbtn {
  background: none; border: none; padding: 8px; font: inherit; font-size: 14px; font-weight: 700;
  color: var(--accent); cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
}
.linkbtn.danger { color: var(--danger); }
.link { font-size: 14px; }
.mini {
  width: 44px; height: 40px; border: none; border-radius: 10px; background: var(--ground); color: var(--ink);
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0;
}
.mini.light { background: var(--card); }
.mini.done { background: #E3EFE8; color: var(--ok); }

/* Accueil */
.tile {
  min-height: 168px; padding: 24px; border-radius: 24px; background: var(--card); border: 1px solid var(--line2);
  color: var(--ink) !important; text-decoration: none; display: flex; flex-direction: column; justify-content: space-between; gap: 22px;
}
.tile.primary { background: var(--accent); border-color: var(--accent); color: #fff !important; }
.tile-ic { width: 52px; height: 52px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.tile-ic.sm { width: 40px; height: 40px; border-radius: 12px; }
.tile-ic.amber { background: var(--amber); color: var(--ink); }
.tile-ic.sm.amber { background: var(--amber-bg); color: var(--amber-ink); }
.tile-ic.blue { background: var(--blue-bg); color: var(--accent); }
.tile-txt { display: flex; flex-direction: column; gap: 4px; }
.tile-txt strong { font-size: 21px; line-height: 26px; font-weight: 800; }
.tile-txt span { font-size: 14px; color: var(--muted); }
.tile.primary .tile-txt span { color: #D5DCEA; }

/* Clavier */
.pinform { align-items: center; justify-content: flex-end; }
.pin { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 14px; flex: 1; }
.dots { display: flex; gap: 16px; padding: 8px 0; }
.dots span { width: 14px; height: 14px; border-radius: 50%; border: 2px solid #8A91A1; }
.dots span.on { background: var(--accent); border-color: var(--accent); }
body.dark .dots span { border-color: #8C97B0; }
body.dark .dots span.on { background: var(--amber); border-color: var(--amber); }
.dots.shake { animation: shake 0.35s; }
@keyframes shake { 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }
.pin-hint { min-height: 20px; font-size: 13px; color: var(--muted); text-align: center; }
body.dark .pin-hint { color: #C3CBDB; }
.keys { margin-top: auto; display: grid; grid-template-columns: repeat(3, 78px); gap: 16px 28px; justify-content: center; }
.key {
  width: 78px; height: 78px; border-radius: 50%; border: 1px solid var(--line2); background: var(--card);
  font: inherit; font-size: 30px; font-weight: 600; color: var(--ink); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; touch-action: manipulation; user-select: none;
}
.key:active { background: var(--line2); }
body.dark .key { background: #2A3B61; border-color: #2A3B61; color: #fff; }
body.dark .key:active { background: #3A4D78; }
.key.del { background: transparent; border-color: transparent; }
.key.text { background: transparent; border-color: transparent; font-size: 13px; font-weight: 700; text-align: center; text-decoration: none; }
@media (prefers-reduced-motion: reduce) { .dots.shake { animation: none; } }

/* Cartes, liste */
.card { padding: 16px; border-radius: 18px; background: var(--card); border: 1px solid var(--line2); }
.search {
  display: flex; align-items: center; gap: 10px; height: 48px; padding: 0 14px; border: 1px solid var(--line);
  border-radius: 14px; background: var(--card); color: var(--muted);
}
.search input { border: none; height: 44px; padding: 0; background: transparent; }
.search input:focus { border: none; }
.list { display: flex; flex-direction: column; gap: 12px; }
.entry, .panel { border-radius: 18px; background: var(--card); border: 1px solid var(--line2); }
.entry[open], .panel[open] { border: 2px solid var(--accent); }
.entry summary, .panel summary {
  list-style: none; display: flex; align-items: center; gap: 12px; padding: 14px 16px; cursor: pointer; min-height: 72px;
}
.entry summary::-webkit-details-marker, .panel summary::-webkit-details-marker { display: none; }
.entry[open] .chev, .panel[open] .chev { transform: rotate(90deg); }
.chev { margin-left: auto; color: var(--muted); display: inline-flex; transition: transform 0.15s; }
.avatar {
  width: 44px; height: 44px; border-radius: 12px; background: var(--blue-bg); color: var(--accent); flex-shrink: 0;
  font-weight: 800; font-size: 18px; display: inline-flex; align-items: center; justify-content: center;
}
.entry[open] .avatar { background: var(--accent); color: #fff; }
.avatar.big { width: 64px; height: 64px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 22px; }
.entry-txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.entry-txt strong { font-size: 16px; font-weight: 800; }
.entry-txt span { font-size: 14px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.entry-body, .panel form { padding: 0 16px 16px; display: flex; flex-direction: column; gap: 12px; }
.secretrow {
  display: flex; align-items: center; gap: 6px; min-height: 48px; padding: 4px 4px 4px 14px; border-radius: 12px; background: var(--ground);
}
.secretrow.plain { background: none; padding-left: 0; }
.secretrow .small { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.secret { flex: 1; min-width: 0; font-size: 16px; overflow-wrap: anywhere; }
.notebox { color: var(--muted); overflow-wrap: anywhere; }
.entry form { align-items: flex-start; }
.empty { display: flex; flex-direction: column; gap: 16px; align-items: center; text-align: center; padding: 40px 0; color: var(--muted); }
.me { display: flex; align-items: center; gap: 16px; }
.steps { margin: 0; padding: 16px 16px 16px 36px; border-radius: 16px; background: var(--note); font-size: 13px; line-height: 18px; color: var(--muted); display: flex; flex-direction: column; gap: 8px; }
.ic { flex-shrink: 0; }
.hidden { display: none !important; }
