:root {
  color-scheme: dark;
  --paper: #0B0F0C;
  --card: #121712;
  --raised: #192119;
  --ink: #F5F7F5;
  --muted: #AEB7AE;
  --green: #49B62F;
  --accent: #58C33A;
  --button: #2E7D22;
  --button-hover: #286C1E;
  --button-active: #235D1A;
  --green-tint: #162615;
  --line: #273127;
  --control-line: #647660;
  --warning: #F28C00;
  --danger: #963B32;
  --error-background: #2B1715;
  --error-text: #FFD7D1;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  color: var(--ink);
  background: var(--paper);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); }
button, input, summary { font: inherit; }
button, a, input, summary { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; min-width: 44px; min-height: 48px; border: 1px solid transparent; border-radius: 8px; font-weight: 650; padding: 12px 18px; color: var(--ink); background: var(--raised); }
button:disabled { opacity: .48; cursor: wait; }
input { width: 100%; min-width: 0; border: 1.5px solid var(--control-line); border-radius: 8px; background: var(--paper); padding: 14px 15px; font-size: 18px; color: var(--ink); min-height: 54px; caret-color: var(--accent); }
input::placeholder { color: var(--muted); opacity: 1; }
input:autofill { -webkit-text-fill-color: var(--ink); box-shadow: 0 0 0 1000px var(--paper) inset; caret-color: var(--accent); }
input:focus, button:focus-visible, a:focus-visible, summary:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
input:focus { border-color: var(--accent); }
::selection { background: var(--button); color: var(--ink); }
label { display: block; font-size: 14px; font-weight: 700; margin-bottom: 9px; }
a { color: inherit; }
h1 { font-size: clamp(30px, 6vw, 43px); line-height: 1.15; letter-spacing: -1.3px; margin: 10px 0 14px; overflow-wrap: anywhere; }
h2 { font-size: 19px; line-height: 1.3; margin: 26px 0 14px; }
p { line-height: 1.55; }
form > .primary { width: 100%; margin-top: 22px; }
form > label:not(:first-child) { margin-top: 22px; }
[hidden] { display: none !important; }
.topbar { max-width: 840px; margin: auto; display: flex; align-items: center; justify-content: space-between; padding: 23px 28px; border-top: 3px solid var(--green); border-bottom: 1px solid var(--line); gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-size: 21px; font-weight: 760; letter-spacing: -.6px; min-height: 44px; }
.brand-light { font-weight: 440; }
.mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 6px; border: 1px solid var(--green); background: var(--green-tint); color: var(--accent); font-size: 25px; }
.identity { background: var(--raised); border-color: var(--control-line); padding: 9px 13px; font-size: 13px; min-height: 44px; }
main { max-width: 704px; margin: auto; padding: 32px 24px 12px; min-height: calc(100dvh - 160px); }
.eyebrow { font-size: 11px; letter-spacing: 1.8px; font-weight: 750; color: var(--green); }
.intro { font-size: 16px; color: var(--muted); margin: 0 0 30px; }
.muted-heading { color: var(--muted); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 24px; margin: 20px 0; }
.login-card { margin-top: 38px; border-top: 2px solid var(--green); }
.login-foot { font-size: 12px; color: var(--muted); display: flex; gap: 8px; align-items: center; justify-content: center; padding: 14px 0; }
.dot { width: 6px; height: 6px; background: var(--green); border-radius: 100%; }
/* Le vert sombre conserve le contraste du texte blanc ; le vert vif souligne les actions. */
.primary { background: var(--button); border-color: var(--green); color: var(--ink); display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.primary:hover { background: var(--button-hover); border-color: var(--accent); }
.primary:active { background: var(--button-active); }
.secondary { background: var(--green-tint); color: var(--ink); border-color: var(--green); }
.text-button { background: transparent; color: var(--accent); font-size: 14px; width: 100%; margin-top: 12px; }
.danger { background: var(--danger); color: var(--ink); border-color: var(--error-text); }
.hint { font-size: 12px; color: var(--muted); margin: 8px 0 0; }
.back { display: inline-block; margin: 0 0 24px; font-size: 13px; text-decoration: none; padding: 5px 0; color: var(--accent); }
.list { margin: 20px 0; }
.list-link { display: flex; justify-content: space-between; align-items: center; gap: 12px; text-decoration: none; background: var(--card); border: 1px solid var(--line); border-left: 3px solid var(--green); padding: 18px; border-radius: 10px; margin: 10px 0; min-height: 82px; overflow-wrap: anywhere; }
.list-link:hover { background: var(--raised); }
.list-link strong { display: block; font-size: 16px; margin-bottom: 5px; }
.list-link small { color: var(--muted); font-size: 12px; }
.list-link .arrow { font-size: 22px; color: var(--accent); }
.empty { color: var(--muted); font-size: 14px; padding: 15px 0; }
summary { cursor: pointer; min-height: 44px; line-height: 1.5; font-weight: 650; font-size: 14px; padding: 10px 0; }
summary::marker { color: var(--accent); }
details[open] > summary { margin-bottom: 18px; }
.signed-field { display: flex; gap: 10px; }
.signed-field button { flex: 0 0 60px; padding: 12px 8px; white-space: nowrap; background: var(--green-tint); border-color: var(--green); font-size: 20px; }
.sheet-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sheet-heading h1 { font-size: 29px; letter-spacing: -.7px; }
.badge { font-size: 11px; font-weight: 650; background: var(--green-tint); border: 1px solid var(--green); color: var(--ink); padding: 7px 10px; border-radius: 6px; white-space: nowrap; }
.badge.done { background: var(--raised); border-color: var(--control-line); }
.tabs { display: flex; gap: 5px; background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 5px; margin: 16px 0 25px; }
.tabs button { flex: 1; background: transparent; color: var(--muted); min-height: 44px; font-size: 14px; padding: 9px; }
.tabs button[aria-pressed=true] { background: var(--green-tint); border-color: var(--green); color: var(--ink); }
.progress-meta { display: flex; justify-content: space-between; font-size: 12px; gap: 10px; color: var(--muted); }
#save-state { color: var(--accent); }
progress { display: block; width: 100%; height: 6px; border: 0; border-radius: 3px; margin: 10px 0 22px; background: var(--line); }
progress::-webkit-progress-bar { background: var(--line); border-radius: 3px; }
progress::-webkit-progress-value { background: var(--green); border-radius: 3px; }
progress::-moz-progress-bar { background: var(--green); border-radius: 3px; }
.entry-card { margin-top: 0; padding: 25px; text-align: center; border-top: 2px solid var(--green); }
.entry-card .eyebrow { font-size: 10px; }
.pair { font-size: 35px; letter-spacing: -1px; margin: 14px 0 26px; font-variant-numeric: tabular-nums; }
.pair span { color: var(--green); margin: 0 8px; }
.entry-card label { font-weight: 500; color: var(--muted); }
.big-number { text-align: center; font-size: 54px; font-weight: 650; line-height: 1.2; height: 90px; letter-spacing: 1px; background: var(--paper); border-color: var(--green); font-variant-numeric: tabular-nums; }
.entry-card > .primary { font-size: 18px; min-height: 56px; }
.summary-message { font-size: 14px; color: var(--muted); margin-bottom: 18px; }
.summary-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.summary-actions button { flex: 1; justify-content: center; font-size: 14px; }
.table-card { border: 1px solid var(--line); background: var(--card); border-radius: 10px; overflow: hidden; margin-top: 20px; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th { text-align: left; font-size: 11px; background: var(--green-tint); padding: 13px 14px; font-weight: 700; }
th:last-child, td:last-child { text-align: right; }
td { padding: 10px 14px; border-top: 1px solid var(--line); font-size: 15px; }
td:last-child { font-weight: 700; overflow-wrap: anywhere; max-width: 170px; }
tbody tr:nth-child(even) { background: var(--raised); }
td button { background: var(--green-tint); color: var(--accent); padding: 7px 12px; min-height: 44px; text-decoration: underline; text-decoration-color: var(--green); text-underline-offset: 4px; border-color: var(--green); border-radius: 6px; }
td:first-child { color: var(--muted); width: 20%; }
.metadata { font-size: 12px; color: var(--muted); padding: 14px 0; line-height: 1.9; }
.metadata p { margin: 3px 0; }
.notice { border: 1px solid var(--warning); border-left-width: 3px; background: var(--error-background); color: var(--error-text); padding: 15px; border-radius: 8px; font-size: 14px; line-height: 1.5; margin-bottom: 18px; overflow-wrap: anywhere; }
.notice.success { background: var(--green-tint); color: var(--ink); border-color: var(--green); }
.refresh-panel { margin-bottom: 22px; }
.refresh-panel p { font-size: 12px; color: var(--muted); }
.loading { font-size: 14px; color: var(--muted); }
.app-footer { max-width: 704px; margin: auto; padding: 25px 24px 30px; font-size: 10px; color: var(--muted); letter-spacing: 1px; text-align: center; }
.footer-tagline { display: flex; gap: 9px; justify-content: center; }
.copyright { margin: 8px 0 0; font-size: 12px; letter-spacing: normal; }
dialog { width: min(92vw, 500px); border: 1px solid var(--control-line); border-top: 2px solid var(--green); border-radius: 12px; padding: 25px; color: var(--ink); background: var(--card); box-shadow: 0 30px 90px #0009; }
dialog::backdrop { background: #000b; }
dialog h2 { margin-top: 0; }
dialog ul { max-height: 35vh; overflow: auto; padding-left: 22px; font-size: 14px; }
.dialog-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.view-links { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.view-links .back { min-height: 44px; display: inline-flex; align-items: center; margin-bottom: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
@media (max-width: 420px) {
  .topbar { padding: 16px 20px; }
  .brand { font-size: 19px; }
  main { padding: 25px 18px 10px; }
  .card { padding: 20px; }
  .entry-card { padding: 22px 18px; }
  .sheet-heading h1 { font-size: 25px; }
  .pair { font-size: 31px; }
  .summary-actions { flex-direction: column; }
  th, td { padding-left: 10px; padding-right: 10px; }
  .identity { font-size: 12px; padding: 8px 10px; }
}
@media (max-height: 650px) {
  #entry-panel .entry-card { padding-top: 14px; padding-bottom: 12px; }
  .pair { margin: 8px 0 12px; font-size: 29px; }
  .big-number { height: 68px; font-size: 42px; }
  .entry-card > .primary { margin-top: 12px; min-height: 48px; }
  .entry-card .text-button { margin-top: 3px; }
  .tabs { margin-bottom: 15px; }
}
@media (prefers-reduced-motion: no-preference) {
  button { transition: background .12s ease, border-color .12s ease; }
}
