:root {
  color-scheme: light dark;
  --bg: #f6f7f9; --card: #fff; --tx: #1b1f24; --mut: #6b7280; --ac: #1d6fd8; --bd: #e3e6ea;
  --ok: #15803d; --bad: #b91c1c; --ombre: 0 1px 2px rgba(0, 0, 0, .04);
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #111418; --card: #1b2026; --tx: #eceff3; --mut: #9aa3ae; --ac: #5ea0f5; --bd: #2b323a; --ok: #4ade80; --bad: #f87171; }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--tx);
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  padding: env(safe-area-inset-top, 0) env(safe-area-inset-right, 0) calc(76px + env(safe-area-inset-bottom, 0)) env(safe-area-inset-left, 0);
}
body.login .nav, body.login #adr { display: none; }
.top, main { max-width: 720px; margin: 0 auto; padding: 0 12px; }
.top { padding-top: 12px; }
.ttl { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
h1 { font-size: 20px; margin: 4px 0 10px; }
h2 { font-size: 16px; margin: 0 0 8px; }
.st { font-size: 12px; color: var(--mut); white-space: nowrap; }
.st[data-k="err"], .st[data-k="off"] { color: var(--bad); font-weight: 600; }
.st[data-k="ok"] { color: var(--ok); }
#adr { margin-bottom: 12px; }

.card { background: var(--card); border: 1px solid var(--bd); border-radius: 12px; padding: 12px; margin-bottom: 12px; box-shadow: var(--ombre); }
.head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.head h2 { margin: 0; }
label { display: block; font-size: 13px; color: var(--mut); margin: 10px 0 3px; }
input, select, button {
  font: inherit; font-size: 16px; color: var(--tx); background: var(--bg);
  border: 1px solid var(--bd); border-radius: 8px; padding: 10px; width: 100%; min-height: 44px;
}
input:focus-visible, select:focus-visible, button:focus-visible, label.btn:focus-within { outline: 2px solid var(--ac); outline-offset: 1px; }
select.mini { width: auto; min-height: 36px; padding: 6px 8px; font-size: 14px; }
button { background: var(--ac); color: #fff; border: 0; font-weight: 600; cursor: pointer; margin-top: 10px; }
button:disabled { opacity: .6; cursor: progress; }
button.s, label.btn.s { background: var(--bg); color: var(--tx); border: 1px solid var(--bd); }
button.danger { background: var(--bad); }
button.x { width: auto; min-height: 32px; padding: 4px 8px; margin: 0; background: none; color: var(--bad); border: 0; font-weight: 500; font-size: 14px; }
button.lien { display: inline; width: auto; min-height: 0; padding: 0; margin: 0; background: none; color: var(--ac); text-decoration: underline; font-weight: 500; font-size: inherit; }
button.back { width: auto; margin: 0 0 10px; padding: 8px 14px; }
.row { display: flex; gap: 8px; }
.row > * { flex: 1; min-width: 0; }
.row.ctr { align-items: center; }
.row.ctr label { margin: 6px 0; font-size: 16px; color: var(--tx); }

label.btn {
  position: relative; overflow: hidden; display: flex; align-items: center; justify-content: center; gap: 6px;
  margin: 10px 0 0; padding: 10px; min-height: 44px; border: 1px solid var(--bd); border-radius: 8px;
  background: var(--bg); color: var(--tx); font-size: 16px; font-weight: 600; cursor: pointer; text-align: center;
}
label.btn.primary { background: var(--ac); color: #fff; border-color: var(--ac); }
input.cover { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; padding: 0; min-height: 0; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.actions > * { margin: 0; min-height: 56px; }

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tile {
  margin: 0; display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; gap: 6px;
  min-height: 76px; text-align: left; background: var(--bg); color: var(--tx); border: 1px solid var(--bd); font-weight: 500;
}
.tile b { font-weight: 600; }
.tile.all { border-color: var(--ac); }

.li { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--bd); gap: 10px; }
.li:last-child { border-bottom: 0; }
.li.hd { padding: 4px 0; }
.grow { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.m { color: var(--mut); font-size: 13px; }
.r { text-align: right; white-space: nowrap; }
.big { font-size: 28px; font-weight: 700; margin: 2px 0; }
.ok { color: var(--ok); }
.bad { color: var(--bad); }
.resume { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--bd); }
.vide-l { padding: 12px 0; }

.thb { width: 44px; height: 44px; min-height: 0; padding: 0; margin: 0; background: none; border: 0; flex: none; }
.th { width: 44px; height: 44px; object-fit: cover; border-radius: 6px; background: var(--bd); display: block; }
.th.vide { display: grid; place-items: center; flex: none; opacity: .5; }
.pvw { margin-top: 10px; display: flex; align-items: flex-end; gap: 8px; }
.preview { max-width: 60%; max-height: 220px; border-radius: 8px; border: 1px solid var(--bd); }

.tw { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
td, th { padding: 6px 4px; border-bottom: 1px solid var(--bd); text-align: right; white-space: nowrap; }
td:first-child, th:first-child { text-align: left; }
tr.tot td { font-weight: 700; border-bottom: 0; }
input.pc { width: 64px; min-height: 34px; padding: 4px 6px; text-align: right; font-size: 14px; }

.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: flex; background: var(--card);
  border-top: 1px solid var(--bd); padding: 0 env(safe-area-inset-right, 0) env(safe-area-inset-bottom, 0) env(safe-area-inset-left, 0);
}
.nav button { background: none; color: var(--mut); border: 0; border-radius: 0; margin: 0; padding: 8px 2px; font-size: 12px; font-weight: 500; min-height: 60px; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.nav button span { font-size: 20px; line-height: 1; }
.nav button.on { color: var(--ac); font-weight: 700; }

.ovl { position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, .5); display: flex; align-items: center; justify-content: center; padding: 20px; }
.ovl.noir { background: #000; flex-direction: column; padding: env(safe-area-inset-top, 0) 0 env(safe-area-inset-bottom, 0); }
.ovl.noir img, .ovl.noir video { flex: 1; min-height: 0; width: 100%; object-fit: contain; }
.ovl .lb { width: 100%; padding: 12px; }
.ovl .lb > * { margin: 0; }
.ovl .lb a.btn { text-decoration: none; }
.dlg { max-width: 360px; width: 100%; margin: 0; }
.dlg p { margin: 0 0 4px; }

#toasts { position: fixed; z-index: 60; left: 0; right: 0; top: calc(8px + env(safe-area-inset-top, 0)); display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; padding: 0 12px; }
.toast { pointer-events: auto; max-width: 560px; width: 100%; display: flex; align-items: center; gap: 8px; padding: 10px 6px 10px 14px; border-radius: 10px; background: var(--tx); color: var(--bg); box-shadow: 0 4px 16px rgba(0, 0, 0, .2); font-size: 14px; }
.toast span { flex: 1; }
.toast .x { color: inherit; }
.toast.err { background: var(--bad); color: #fff; }

#print { display: none; }
@media print {
  body { padding: 0; background: #fff; color: #000; }
  body > :not(#print) { display: none !important; }
  #print { display: block; font-size: 12px; }
  #print h1 { font-size: 18px; }
  #print h2 { font-size: 14px; margin-top: 16px; }
  #print table { font-size: 12px; }
  #print th { text-align: left; font-weight: 400; }
  #print td, #print th { border-color: #ccc; white-space: normal; }
}
table.sim { font-size: 13px; }
table.sim td, table.sim th { padding: 6px 2px; }
.note { background: var(--bg); border: 1px solid var(--bd); border-radius: 8px; padding: 8px 10px; }
form { margin: 0; }
