:root {
  --bg: #f4f6f4; --panel: #fff; --ink: #18221c; --muted: #5d6b62; --line: #dfe5e0; --soft: #eef3ef;
  --green: #1f7a4d; --green-ink: #fff; --green-soft: #e3f1e9; --red: #b42318; --amber: #b54708;
  --radius: 10px; --shadow: 0 1px 2px rgba(16, 40, 24, .06), 0 4px 16px rgba(16, 40, 24, .06);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; font-size: 15px; color: var(--ink); background: var(--bg);
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #111613; --panel: #18201b; --ink: #e6ede8; --muted: #9aa9a0; --line: #2a352e; --soft: #1e2822; --green: #3fae76; --green-ink: #06130b; --green-soft: #183326; --red: #f97066; --amber: #fdb022; --shadow: none; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); }
a { color: var(--green); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.5rem; margin: 0; } h1 small, h2 small, h3 small { color: var(--muted); font-weight: 500; font-size: .75em; margin-left: .4em; }
h2 { font-size: 1.2rem; margin: 0 0 .6rem; } h3 { font-size: 1rem; margin: 1.4rem 0 .5rem; display: flex; align-items: center; gap: .5rem; } h4 { margin: 1rem 0 .4rem; font-size: .9rem; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
code, pre { font-family: ui-monospace, "Cascadia Mono", Menlo, monospace; }
.muted { color: var(--muted); } .hint { color: var(--muted); font-size: .85rem; margin: .2rem 0; } .center { text-align: center; }
.warn { color: var(--red); } .note { background: var(--green-soft); padding: .6rem .9rem; border-radius: var(--radius); }

/* boutons et champs */
.btn { font: inherit; font-size: .9rem; border: 1px solid var(--line); background: var(--panel); color: var(--ink); border-radius: 8px; padding: .5rem .9rem; cursor: pointer; display: inline-flex; align-items: center; gap: .3rem; white-space: nowrap; }
.btn:hover { border-color: var(--green); } .btn:disabled { opacity: .6; cursor: wait; }
.btn.primary { background: var(--green); border-color: var(--green); color: var(--green-ink); font-weight: 600; }
.btn.danger { background: var(--red); border-color: var(--red); color: #fff; } .btn.danger.ghost { background: none; color: var(--red); }
.btn.ghost { background: none; } .btn.link { border: 0; background: none; color: var(--muted); }
.btn.small { padding: .3rem .6rem; font-size: .8rem; }
.icon { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 1.1rem; padding: .2rem .4rem; border-radius: 6px; }
.icon:hover { background: var(--soft); color: var(--ink); } .icon.small { font-size: .85rem; }
input, select, textarea { font: inherit; color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: .55rem .7rem; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--green); outline-offset: -1px; border-color: transparent; }
label { display: flex; flex-direction: column; gap: .3rem; font-size: .85rem; font-weight: 600; color: var(--muted); }
label small { font-weight: 400; }
.stack { display: flex; flex-direction: column; gap: .8rem; }
.row { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; } .row.end { justify-content: flex-end; margin-top: .4rem; }
.pw { position: relative; display: block; } .pw input { padding-right: 3.2rem; }
.meter { position: absolute; right: .6rem; top: 50%; width: 2.2rem; height: 6px; margin-top: -3px; border-radius: 3px; background: var(--line); }
.meter::after { content: ""; display: block; height: 100%; border-radius: 3px; width: 0; }
.meter.s1::after { width: 25%; background: var(--red); } .meter.s2::after { width: 50%; background: var(--amber); } .meter.s3::after { width: 75%; background: #6aa84f; } .meter.s4::after { width: 100%; background: var(--green); }
.spin { width: 1em; height: 1em; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: s .7s linear infinite; display: inline-block; }
@keyframes s { to { transform: rotate(1turn); } }
.tag { font-size: .72rem; padding: .1rem .45rem; border-radius: 99px; background: var(--soft); color: var(--muted); font-weight: 600; white-space: nowrap; }
.tag.ok { background: var(--green-soft); color: var(--green); }

/* écrans d'accès */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 1rem; background: radial-gradient(circle at 20% 0%, var(--green-soft), transparent 50%), var(--bg); }
.auth-card { background: var(--panel); border-radius: 16px; box-shadow: var(--shadow); padding: 2rem; width: min(440px, 100%); border: 1px solid var(--line); }
.auth-card h1 { margin: 1.2rem 0 .3rem; }
.code { font-size: 1.6rem; text-align: center; letter-spacing: .3em; }
.qr { width: 200px; margin: 1rem auto; background: #fff; padding: 6px; border-radius: 8px; } .qr svg { display: block; width: 100%; height: auto; }
.kit { background: var(--soft); padding: .8rem; border-radius: 8px; white-space: pre-wrap; word-break: break-all; font-size: .85rem; }

/* marque */
.brand { display: flex; align-items: center; gap: .55rem; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand b { display: block; font-size: 1.05rem; } .brand span { display: block; font-size: .72rem; color: var(--muted); }
.brand.big b { font-size: 1.4rem; }
.logo { width: 30px; height: 30px; fill: var(--green); stroke: var(--green); flex: none; }
.brand.big .logo { width: 38px; height: 38px; }

/* mise en page */
#app { min-height: 100vh; }
.top { position: fixed; inset: 0 0 auto 0; height: 58px; display: flex; align-items: center; gap: 1rem; padding: 0 1rem; background: var(--panel); border-bottom: 1px solid var(--line); z-index: 5; }
.top .search { flex: 1; max-width: 560px; } .top .who { margin-left: auto; display: flex; align-items: center; gap: .6rem; font-size: .85rem; color: var(--muted); }
.menu { display: none; }
.nav { position: fixed; top: 58px; bottom: 0; left: 0; width: 210px; padding: 1rem .6rem; border-right: 1px solid var(--line); background: var(--panel); display: flex; flex-direction: column; gap: 2px; z-index: 4; }
.nav a { padding: .55rem .8rem; border-radius: 8px; color: var(--ink); font-weight: 500; }
.nav a:hover { background: var(--soft); text-decoration: none; } .nav a.on { background: var(--green-soft); color: var(--green); font-weight: 700; }
.nav hr { border: 0; border-top: 1px solid var(--line); margin: .6rem .4rem; width: calc(100% - .8rem); }
.navfoot { margin-top: auto; font-size: .72rem; color: var(--muted); padding: .4rem .8rem; }
main { margin: 58px 0 0 210px; padding: 1.6rem 2rem 4rem; max-width: 1100px; }
.head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.crumb { font-size: .85rem; color: var(--muted); margin-bottom: .3rem; min-height: 1.2em; }
.filter { max-width: 360px; margin-bottom: 1rem; }
.empty { padding: 2rem; text-align: center; color: var(--muted); background: var(--panel); border: 1px dashed var(--line); border-radius: var(--radius); }

/* clients */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: .7rem; }
.card { display: flex; align-items: center; gap: .8rem; padding: .8rem 1rem; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink); }
.card:hover { border-color: var(--green); text-decoration: none; }
.ini { width: 40px; height: 40px; border-radius: 10px; background: var(--green-soft); color: var(--green); display: grid; place-items: center; font-weight: 700; flex: none; }
.cn { display: flex; flex-direction: column; min-width: 0; flex: 1; } .cn b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .cn small { color: var(--muted); }

/* accès */
.group { margin-bottom: .4rem; } .group h3 a { color: var(--ink); }
.items { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.items > .btn { margin: .6rem; }
.item { display: flex; align-items: center; gap: .8rem; padding: .65rem .9rem; border-top: 1px solid var(--line); }
.item:first-child { border-top: 0; } .item:hover { background: var(--soft); }
.fav { --brand: #6b7280; position: relative; width: 44px; height: 44px; border-radius: 11px; flex: none; display: grid; place-items: center; overflow: hidden;
  background: var(--brand); color: #fff; font-weight: 700; font-size: 1.1rem; }
.fav.has { background: transparent; }
.fav.has i { visibility: hidden; } .fav i { font-style: normal; }
.fav .ficon { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; border-radius: 10px; image-rendering: auto; }
.pe .fav { width: 40px; height: 40px; }
.fav .ficon.tiny { width: 32px; height: 32px; inset: 0; margin: auto; image-rendering: pixelated; border-radius: 4px; }
.fav.has:has(.tiny) { background: color-mix(in srgb, var(--brand) 14%, #fff); }
.iname { flex: 1; min-width: 0; display: flex; flex-direction: column; } .iname small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acts { display: flex; gap: .3rem; flex-wrap: wrap; justify-content: flex-end; }
.others { margin-top: 1.4rem; color: var(--muted); } .others summary { cursor: pointer; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .6rem; } .chip { padding: .3rem .7rem; border: 1px solid var(--line); border-radius: 99px; font-size: .85rem; color: var(--ink); background: var(--panel); }

/* fenêtres */
.overlay { position: fixed; inset: 0; background: rgba(10, 20, 14, .45); display: grid; place-items: center; padding: 1rem; z-index: 20; }
.dialog { background: var(--panel); border-radius: 14px; padding: 1.4rem; width: min(520px, 100%); max-height: calc(100vh - 2rem); overflow: auto; box-shadow: 0 20px 60px rgba(0, 0, 0, .25); }
.dialog.wide { width: min(860px, 100%); }
.kv { display: grid; grid-template-columns: 9rem 1fr; gap: .5rem 1rem; margin: 1rem 0; } .kv dt { color: var(--muted); font-size: .85rem; } .kv dd { margin: 0; word-break: break-word; } .pre { white-space: pre-wrap; }
.pick { max-height: 55vh; overflow: auto; margin: .6rem 0; }
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .4rem; }
.pe { text-align: left; font: inherit; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: .55rem .65rem; cursor: pointer; color: var(--ink); display: flex; align-items: center; gap: .6rem; transition: background .15s, border-color .15s; }
.pe > span:last-child { display: flex; flex-direction: column; min-width: 0; } .pe b { line-height: 1.25; }
.pe:hover { border-color: var(--green); } .pe small { color: var(--muted); font-size: .75rem; } .pe.done { background: var(--green-soft); } .pe.done small { color: var(--green); }
table { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
th, td { text-align: left; padding: .55rem .8rem; border-top: 1px solid var(--line); vertical-align: middle; font-size: .9rem; }
th { background: var(--soft); font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; border-top: 0; }
td small { display: block; color: var(--muted); font-size: .8rem; } td.acts { text-align: right; }
.acl select, .acl input { padding: .35rem .5rem; font-size: .85rem; }
.seen { max-height: 40vh; overflow: auto; padding-left: 1.2rem; } .seen small { color: var(--muted); }
#toasts { position: fixed; bottom: 1rem; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: .4rem; z-index: 30; }
.toast { background: var(--ink); color: var(--bg); padding: .6rem 1rem; border-radius: 8px; font-size: .9rem; box-shadow: var(--shadow); }
.toast.err { background: var(--red); color: #fff; }

/* téléphone */
@media (max-width: 860px) {
  .menu { display: block; } .top .who span { display: none; } .top { gap: .5rem; } .top .brand div { display: none; }
  .nav { transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow); }
  .menu-open .nav { transform: none; }
  main { margin-left: 0; padding: 1rem 1rem 4rem; }
  .item { flex-wrap: wrap; } .acts { width: 100%; justify-content: flex-start; }
  .kv { grid-template-columns: 1fr; } .kv dd { margin-bottom: .4rem; }
  .acl thead { display: none; } .acl tr { display: grid; grid-template-columns: 1fr 1fr; gap: .3rem; padding: .5rem 0; border-top: 1px solid var(--line); } .acl td { border: 0; padding: .2rem .5rem; } .acl td:first-child { grid-column: 1 / -1; }
}
.tag.warn { background: #fef0c7; color: #93370d; }
@media (prefers-color-scheme: dark) { .tag.warn { background: #4e1d09; color: #fec84b; } }
@media print {
  body > *:not(.overlay) { display: none !important; }
  .overlay { position: static; background: none; padding: 0; }
  .dialog { box-shadow: none; max-height: none; width: 100%; }
  .dialog .row { display: none; }
}

/* fond des tuiles et des lignes teinté par la couleur du logo */
.pe.tinted { background: color-mix(in srgb, var(--brand) 11%, var(--panel)); border-color: color-mix(in srgb, var(--brand) 35%, var(--line)); }
.pe.tinted:hover { background: color-mix(in srgb, var(--brand) 18%, var(--panel)); border-color: var(--brand); }
.pe.tinted.done { box-shadow: inset 0 0 0 2px var(--green); }
.item.tinted { background: color-mix(in srgb, var(--brand) 12%, var(--panel)); box-shadow: inset 4px 0 0 var(--brand); }
.item.tinted:hover { background: color-mix(in srgb, var(--brand) 19%, var(--panel)); }
.item.tinted + .item.tinted { border-top-color: color-mix(in srgb, var(--brand) 25%, var(--line)); }
.item.tinted .acts .btn { background: color-mix(in srgb, var(--panel) 85%, transparent); }

/* logo du site en filigrane, en arrière-plan de la tuile ou de la ligne */
.pe, .item { position: relative; isolation: isolate; overflow: hidden; }
.pe.tinted::after { content: ""; position: absolute; z-index: -1; pointer-events: none; background: var(--logo) center / contain no-repeat; opacity: .13; filter: saturate(1.2); }
.pe.tinted::after { width: 96px; height: 96px; right: -18px; bottom: -22px; transform: rotate(-12deg); }
@media (prefers-color-scheme: dark) { .pe.tinted::after { opacity: .18; } }
