/* AFRITECH Sentinel — système visuel inspiré des interfaces Apple / One UI */
:root {
  --bg: #FFFFFF;
  --surface: #FFFFFF;
  --surface-2: #F5F5F7;
  --glass: rgba(255, 255, 255, 0.72);
  --line: rgba(60, 60, 67, 0.12);
  --text: #1D1D1F;
  --text-2: #6E6E73;
  --text-3: #A1A1A6;
  --accent: #0A5CFF;
  --accent-soft: rgba(10, 92, 255, 0.10);
  --green: #1FB954;
  --green-soft: rgba(31, 185, 84, 0.12);
  --red: #FF3B30;
  --red-soft: rgba(255, 59, 48, 0.10);
  --orange: #FF9500;
  --orange-soft: rgba(255, 149, 0, 0.12);
  --purple: #8E5CF7;
  --gray-soft: rgba(142, 142, 147, 0.14);
  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.04), 0 4px 16px rgba(0, 0, 0, 0.04);
  --shadow-2: 0 10px 40px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.06);
  --radius: 20px;
  --radius-sm: 14px;
  --ease: cubic-bezier(0.32, 0.72, 0, 1);
  --spring: cubic-bezier(0.34, 1.36, 0.64, 1);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
}
:root[data-theme="dark"] {
    --bg: #000000;
    --surface: #1C1C1E;
    --surface-2: #2C2C2E;
    --glass: rgba(28, 28, 30, 0.72);
    --line: rgba(84, 84, 88, 0.36);
    --text: #F5F5F7;
    --text-2: #98989D;
    --text-3: #636366;
    --accent: #3D86FF;
    --accent-soft: rgba(61, 134, 255, 0.16);
    --green: #30D158;
    --green-soft: rgba(48, 209, 88, 0.16);
    --red: #FF453A;
    --red-soft: rgba(255, 69, 58, 0.16);
    --orange: #FF9F0A;
    --orange-soft: rgba(255, 159, 10, 0.16);
    --gray-soft: rgba(142, 142, 147, 0.2);
    --shadow-1: none;
    --shadow-2: 0 10px 40px rgba(0, 0, 0, 0.6);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  font-family: Inter, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  font-feature-settings: "cv11", "ss01", "tnum";
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.011em;
  overscroll-behavior-y: none;
}
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
a { color: var(--accent); text-decoration: none; }
svg { display: block; }
::selection { background: var(--accent-soft); }

/* ---------- Structure ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 260px; flex-shrink: 0; position: sticky; top: 0; height: 100vh;
  padding: 22px 14px; display: flex; flex-direction: column; gap: 4px;
  border-right: 1px solid var(--line); background: var(--glass);
  backdrop-filter: saturate(180%) blur(24px); -webkit-backdrop-filter: saturate(180%) blur(24px);
}
.brand { display: flex; align-items: center; gap: 11px; padding: 6px 10px 22px; }
.brand img { width: 36px; height: 36px; border-radius: 10px; box-shadow: 0 4px 14px rgba(10, 92, 255, .35); }
.brand b { font-size: 16px; font-weight: 700; letter-spacing: -0.02em; display: block; }
.brand small { color: var(--text-2); font-size: 12px; font-weight: 500; }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px;
  color: var(--text); font-weight: 500; transition: background .2s var(--ease), transform .15s;
}
.nav-item svg { width: 20px; height: 20px; color: var(--text-2); }
.nav-item:hover { background: var(--gray-soft); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav-item.active svg { color: var(--accent); }
.sidebar .spacer { flex: 1; }
.me { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 14px; }
.me:hover { background: var(--gray-soft); }
.me .txt { min-width: 0; }
.me .txt b { display: block; font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me .txt small { color: var(--text-2); font-size: 12px; }

.main { flex: 1; min-width: 0; }
.page { max-width: 1120px; margin: 0 auto; padding: 34px 36px 60px; animation: entree .45s var(--ease); }
@keyframes entree { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.tabbar { display: none; }

/* ---------- En-têtes ---------- */
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 26px; }
.head .eyebrow { color: var(--text-2); font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 4px; }
.head h1 { font-size: 34px; line-height: 1.1; margin: 0; font-weight: 800; letter-spacing: -0.035em; }
.head .actions { display: flex; gap: 10px; }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--accent); font-weight: 500; margin-bottom: 14px; }
.back svg { width: 18px; height: 18px; }
.section-title { display: flex; justify-content: space-between; align-items: center; margin: 32px 4px 12px; }
.section-title h2 { font-size: 20px; margin: 0; font-weight: 700; letter-spacing: -0.025em; }
.section-title a, .section-title button { color: var(--accent); font-weight: 500; font-size: 14.5px; }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding: 0 18px; border-radius: 999px; font-weight: 600; font-size: 14.5px;
  transition: transform .15s var(--ease), opacity .2s, background .2s; white-space: nowrap; user-select: none;
}
.btn:active { transform: scale(0.96); }
.btn svg { width: 18px; height: 18px; }
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 6px 18px rgba(10, 92, 255, .28); }
.btn-primary:hover { filter: brightness(1.06); }
.btn-soft { background: var(--accent-soft); color: var(--accent); }
.btn-gray { background: var(--gray-soft); color: var(--text); }
.btn-danger { background: var(--red-soft); color: var(--red); }
.btn-block { width: 100%; height: 50px; font-size: 16px; border-radius: 14px; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.icon-btn { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: var(--gray-soft); color: var(--text); transition: transform .15s; }
.icon-btn:active { transform: scale(.92); }
.icon-btn svg { width: 19px; height: 19px; }

/* ---------- Cartes ---------- */
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-1); }
.card-pad { padding: 20px; }
.grid { display: grid; gap: 16px; }
.stats { grid-template-columns: repeat(4, 1fr); }
.stat { padding: 18px 20px; position: relative; overflow: hidden; transition: transform .25s var(--ease); }
.stat:hover { transform: translateY(-2px); }
.stat .ico { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; margin-bottom: 14px; }
.stat .ico svg { width: 19px; height: 19px; }
.stat .val { font-size: 30px; font-weight: 800; letter-spacing: -0.04em; line-height: 1; }
.stat .lbl { color: var(--text-2); font-size: 13.5px; font-weight: 500; margin-top: 6px; }
.t-blue { background: var(--accent-soft); color: var(--accent); }
.t-green { background: var(--green-soft); color: var(--green); }
.t-red { background: var(--red-soft); color: var(--red); }
.t-orange { background: var(--orange-soft); color: var(--orange); }
.t-gray { background: var(--gray-soft); color: var(--text-2); }
.t-purple { background: rgba(142, 92, 247, .13); color: var(--purple); }

.two { grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); align-items: start; }
.two > * { min-width: 0; }
.hero {
  padding: 24px; display: flex; align-items: center; gap: 26px;
  background: linear-gradient(135deg, #0A5CFF 0%, #0039B3 100%); color: #fff; border-radius: 24px; overflow: hidden; position: relative;
}
.hero::after { content: ""; position: absolute; right: -60px; top: -80px; width: 260px; height: 260px; border-radius: 50%; background: radial-gradient(circle, rgba(255,255,255,.18), transparent 65%); }
.hero h3 { margin: 0 0 6px; font-size: 22px; letter-spacing: -0.03em; }
.hero p { margin: 0; opacity: .85; font-size: 14.5px; }
.hero .pill { background: rgba(255,255,255,.16); color: #fff; margin-top: 14px; }
.ring { position: relative; width: 108px; height: 108px; flex-shrink: 0; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 10; stroke-linecap: round; }
.ring .bgc { stroke: rgba(255,255,255,.2); }
.ring .fgc { stroke: #fff; transition: stroke-dashoffset 1.2s var(--ease); }
.ring .pct { position: absolute; inset: 0; display: grid; place-items: center; font-size: 24px; font-weight: 800; letter-spacing: -0.04em; }
.ring .pct small { display: block; font-size: 11px; font-weight: 500; opacity: .8; letter-spacing: 0; text-align: center; margin-top: -2px; }

/* ---------- Listes ---------- */
.list { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-1); overflow: hidden; }
.row {
  display: flex; align-items: center; gap: 14px; padding: 13px 18px; position: relative;
  transition: background .15s; width: 100%; text-align: left; color: var(--text);
}
.row + .row::before { content: ""; position: absolute; top: 0; left: 68px; right: 0; height: 1px; background: var(--line); }
.row.plain + .row.plain::before { left: 18px; }
button.row:hover, a.row:hover { background: var(--surface-2); }
button.row:active, a.row:active { background: var(--gray-soft); }
.row .body { flex: 1; min-width: 0; }
.row .title { font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .sub { color: var(--text-2); font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .end { display: flex; align-items: center; gap: 8px; color: var(--text-3); flex-shrink: 0; }
.row .end svg { width: 16px; height: 16px; }
.avatar {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex-shrink: 0;
  font-weight: 700; font-size: 15px; letter-spacing: -0.02em; color: #fff;
}
.avatar.t-blue { color: var(--accent); } .avatar.t-green { color: var(--green); } .avatar.t-red { color: var(--red); }
.avatar.t-orange { color: var(--orange); } .avatar.t-gray { color: var(--text-2); } .avatar.t-purple { color: var(--purple); }
.avatar.lg { width: 64px; height: 64px; border-radius: 18px; font-size: 24px; }
.avatar svg { width: 20px; height: 20px; }
.empty { text-align: center; padding: 48px 24px; color: var(--text-2); }
.empty svg { width: 44px; height: 44px; margin: 0 auto 12px; color: var(--text-3); }
.empty b { display: block; color: var(--text); font-size: 17px; margin-bottom: 4px; }

/* ---------- Pastilles ---------- */
.pill { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.dot.live { box-shadow: 0 0 0 0 currentColor; animation: pouls 2s infinite; }
@keyframes pouls { 0% { box-shadow: 0 0 0 0 rgba(31,185,84,.5); } 70% { box-shadow: 0 0 0 7px rgba(31,185,84,0); } 100% { box-shadow: 0 0 0 0 rgba(31,185,84,0); } }

/* ---------- Recherche & filtres ---------- */
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.search { flex: 1; min-width: 220px; position: relative; }
.search svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--text-2); }
.search input {
  width: 100%; height: 42px; border-radius: 12px; border: 0; background: var(--gray-soft);
  padding: 0 14px 0 38px; outline: none; transition: box-shadow .2s, background .2s;
}
.search input:focus { background: var(--surface); box-shadow: 0 0 0 3px var(--accent-soft), 0 0 0 1px var(--accent); }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 14px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  height: 34px; padding: 0 14px; border-radius: 999px; background: var(--surface); box-shadow: var(--shadow-1), inset 0 0 0 1px var(--line);
  font-size: 13.5px; font-weight: 500; white-space: nowrap; transition: all .2s var(--ease);
}
.chip.on { background: var(--text); color: var(--bg); box-shadow: none; }
.segmented { display: inline-flex; background: var(--gray-soft); border-radius: 11px; padding: 3px; gap: 2px; margin-bottom: 18px; max-width: 100%; overflow-x: auto; }
.segmented button { height: 32px; padding: 0 16px; border-radius: 9px; font-size: 13.5px; font-weight: 500; color: var(--text-2); transition: all .25s var(--ease); white-space: nowrap; }
.segmented button.on { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: 0 2px 8px rgba(0,0,0,.08); }

/* ---------- Fiche ---------- */
.profile { display: flex; align-items: center; gap: 18px; margin-bottom: 22px; }
.profile h1 { font-size: 28px; margin: 0; font-weight: 800; letter-spacing: -0.03em; line-height: 1.15; }
.profile .meta { color: var(--text-2); margin-top: 4px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.kv { display: grid; grid-template-columns: repeat(2, 1fr); }
.kv > div { padding: 14px 18px; border-bottom: 1px solid var(--line); min-width: 0; }
.kv > div:nth-child(odd) { border-right: 1px solid var(--line); }
.kv dt { color: var(--text-2); font-size: 12.5px; font-weight: 500; margin-bottom: 3px; }
.kv dd { margin: 0; font-weight: 600; word-break: break-word; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 13.5px; letter-spacing: 0; }
.status-hero { padding: 22px; display: flex; align-items: center; gap: 16px; }
.status-hero .big { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; }
.status-hero .big svg { width: 28px; height: 28px; }
.status-hero h3 { margin: 0; font-size: 19px; letter-spacing: -0.02em; }
.status-hero p { margin: 2px 0 0; color: var(--text-2); font-size: 14px; }

/* ---------- Feuilles (modales) ---------- */
.backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.32); z-index: 80; opacity: 0; transition: opacity .3s var(--ease); backdrop-filter: blur(2px); }
.backdrop.show { opacity: 1; }
.sheet {
  position: fixed; z-index: 90; left: 50%; top: 50%; width: min(560px, calc(100vw - 32px)); max-height: min(86vh, 860px);
  background: var(--surface); border-radius: 26px; box-shadow: var(--shadow-2); display: flex; flex-direction: column;
  transform: translate(-50%, -46%) scale(.96); opacity: 0; transition: transform .42s var(--spring), opacity .25s;
}
.sheet.show { transform: translate(-50%, -50%) scale(1); opacity: 1; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px 8px; gap: 12px; }
.sheet-head h3 { margin: 0; font-size: 19px; font-weight: 700; letter-spacing: -0.025em; }
.sheet-body { padding: 8px 20px 20px; overflow-y: auto; }
.sheet-foot { padding: 12px 20px calc(18px + var(--safe-b)); display: flex; gap: 10px; border-top: 1px solid var(--line); }
.sheet-foot .btn { flex: 1; height: 48px; border-radius: 14px; }
.grabber { display: none; }

/* ---------- Formulaires ---------- */
.form-group { background: var(--surface-2); border-radius: 14px; margin-bottom: 14px; overflow: hidden; }
.field { display: flex; flex-direction: column; padding: 9px 14px; position: relative; }
.field + .field { border-top: 1px solid var(--line); }
.field label { font-size: 12px; color: var(--text-2); font-weight: 500; }
.field input, .field select, .field textarea {
  border: 0; outline: 0; background: transparent; padding: 3px 0 2px; font-size: 15.5px; width: 100%; -webkit-appearance: none; appearance: none;
}
.field textarea { resize: vertical; min-height: 64px; }
.field select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%238e8e93' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 2px center; padding-right: 20px; }
.field:focus-within { background: var(--accent-soft); }
.field:focus-within label { color: var(--accent); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; }
.row2 > .field + .field { border-top: 0; border-left: 1px solid var(--line); }
.row2 + .field, .field + .row2, .row2 + .row2 { border-top: 1px solid var(--line); }
.hint { color: var(--text-2); font-size: 12.5px; margin: -6px 6px 14px; }
.group-label { font-size: 12.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--text-2); margin: 18px 6px 8px; }
.type-picker { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 14px; }
.type-picker button {
  border-radius: 14px; background: var(--surface-2); padding: 12px 4px 10px; display: flex; flex-direction: column; align-items: center; gap: 6px;
  font-size: 11.5px; font-weight: 600; color: var(--text-2); transition: all .2s var(--ease); box-shadow: inset 0 0 0 1.5px transparent;
}
.type-picker button svg { width: 22px; height: 22px; }
.type-picker button.on { background: var(--accent-soft); color: var(--accent); box-shadow: inset 0 0 0 1.5px var(--accent); }
.type-picker button:active { transform: scale(.95); }
.secret { background: var(--orange-soft); border-radius: 14px; padding: 14px 16px; margin-bottom: 8px; }
.secret b { display: block; font-size: 13px; color: var(--orange); margin-bottom: 4px; }
.secret .mono { font-size: 20px; font-weight: 700; letter-spacing: .04em; }

/* ---------- Connexion ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; position: relative; overflow: hidden; }
.login::before {
  content: ""; position: absolute; inset: -30%; z-index: -1;
  background: radial-gradient(40% 40% at 25% 25%, rgba(10,92,255,.20), transparent 70%), radial-gradient(35% 35% at 80% 70%, rgba(142,92,247,.16), transparent 70%);
  animation: derive 18s ease-in-out infinite alternate;
}
@keyframes derive { to { transform: translate(4%, -3%) rotate(6deg); } }
.login-card { width: 100%; max-width: 400px; text-align: center; animation: entree .6s var(--ease); }
.login-card img { width: 72px; height: 72px; border-radius: 20px; margin: 0 auto 20px; box-shadow: 0 14px 40px rgba(10,92,255,.4); }
.login-card h1 { font-size: 30px; margin: 0; letter-spacing: -0.035em; font-weight: 800; }
.login-card p { color: var(--text-2); margin: 6px 0 28px; }
.login-card .form-group { text-align: left; }
.login-card .foot { color: var(--text-3); font-size: 12.5px; margin-top: 26px; }
.error { color: var(--red); font-size: 14px; min-height: 20px; margin: 4px 0 10px; }

/* ---------- Toast ---------- */
#toast-root { position: fixed; left: 50%; top: calc(16px + var(--safe-t)); transform: translateX(-50%); z-index: 120; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  background: var(--glass); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  color: var(--text); padding: 11px 18px; border-radius: 999px; box-shadow: var(--shadow-2); font-weight: 600; font-size: 14px;
  display: flex; align-items: center; gap: 8px; animation: toastIn .45s var(--spring); border: 1px solid var(--line);
}
.toast svg { width: 18px; height: 18px; }
.toast.out { animation: toastOut .3s var(--ease) forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-14px) scale(.9); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-10px) scale(.95); } }

/* ---------- Chargement ---------- */
.skel { background: linear-gradient(90deg, var(--gray-soft) 25%, var(--surface-2) 50%, var(--gray-soft) 75%); background-size: 200% 100%; animation: shimmer 1.3s infinite; border-radius: 12px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.spinner { width: 18px; height: 18px; border: 2.2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: tourne .7s linear infinite; }
@keyframes tourne { to { transform: rotate(360deg); } }
.bars { display: flex; flex-direction: column; gap: 12px; }
.bar-row { display: grid; grid-template-columns: 120px 1fr 34px; align-items: center; gap: 12px; font-size: 13.5px; }
.bar-row .track { height: 8px; border-radius: 99px; background: var(--gray-soft); overflow: hidden; }
.bar-row .fill { height: 100%; border-radius: 99px; background: var(--accent); width: 0; transition: width 1s var(--ease); }
.bar-row b { text-align: right; }

/* ---------- Mobile (style One UI / iOS) ---------- */
@media (max-width: 860px) {
  .sidebar { display: none; }
  .page { padding: calc(14px + var(--safe-t)) 16px calc(100px + var(--safe-b)); }
  .head { flex-direction: column; align-items: stretch; gap: 14px; margin-bottom: 18px; }
  .head h1 { font-size: 32px; }
  .head .actions { justify-content: flex-start; }
  .stats { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .stat { padding: 16px; }
  .stat .val { font-size: 26px; }
  .two { grid-template-columns: minmax(0, 1fr); }
  .row .end > svg { display: none; }
  .row { padding: 12px 14px; gap: 12px; }
  .row + .row::before { left: 66px; }
  .hero .pill { white-space: normal; height: auto; padding: 5px 10px; }
  .hero { padding: 20px; gap: 18px; }
  .ring { width: 92px; height: 92px; }
  .kv { grid-template-columns: 1fr; }
  .kv > div:nth-child(odd) { border-right: 0; }
  .type-picker { grid-template-columns: repeat(4, 1fr); }
  .tabbar {
    display: flex; position: fixed; left: 12px; right: 12px; bottom: calc(10px + var(--safe-b)); z-index: 50; height: 64px;
    background: var(--glass); backdrop-filter: saturate(180%) blur(24px); -webkit-backdrop-filter: saturate(180%) blur(24px);
    border-radius: 22px; box-shadow: var(--shadow-2); border: 1px solid var(--line); padding: 0 6px;
  }
  .tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--text-2); font-size: 10.5px; font-weight: 600; border-radius: 16px; transition: color .2s, transform .15s; }
  .tabbar a svg { width: 23px; height: 23px; }
  .tabbar a.active { color: var(--accent); }
  .tabbar a:active { transform: scale(.9); }
  .sheet {
    left: 0; right: 0; top: auto; bottom: 0; width: 100%; max-height: 92vh; border-radius: 26px 26px 0 0;
    transform: translateY(100%); opacity: 1; transition: transform .5s var(--ease);
  }
  .sheet.show { transform: translateY(0); }
  .grabber { display: block; width: 38px; height: 5px; border-radius: 99px; background: var(--text-3); opacity: .5; margin: 8px auto 0; }
  .fab {
    position: fixed; right: 20px; bottom: calc(88px + var(--safe-b)); z-index: 40; width: 56px; height: 56px; border-radius: 18px;
    background: var(--accent); color: #fff; display: grid; place-items: center; box-shadow: 0 10px 28px rgba(10,92,255,.45);
    transition: transform .2s var(--spring);
  }
  .fab:active { transform: scale(.9); }
  .fab svg { width: 26px; height: 26px; }
  .hide-m { display: none !important; }
  .bar-row { grid-template-columns: 100px 1fr 28px; }
}
@media (min-width: 861px) { .fab { display: none; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
.pill svg { width: 14px; height: 14px; flex-shrink: 0; }

/* ===== Raffinements v2 (accessibilité, fluidité, mobile premium) ===== */
body { font-size: 16px; }
a, button, [role="button"], .chip, select { cursor: pointer; }
:focus { outline: none; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 12px; }
.field :focus-visible { outline: none; }
.icon-btn { width: 44px; height: 44px; }
.chip { height: 40px; padding: 0 16px; }
.segmented button { height: 36px; }
.row { min-height: 60px; }
.btn { height: 44px; }
.row, .card, .chip, .nav-item, .btn, .icon-btn { transition: background .2s var(--ease), transform .2s var(--ease), box-shadow .2s var(--ease), color .2s; }
.stat:active, .row:active, .card.stat:active { transform: scale(.985); }

/* Apparition en cascade */
.cascade > * { animation: monte .5s var(--ease) both; animation-delay: calc(var(--i, 0) * 45ms); }
@keyframes monte { from { opacity: 0; transform: translateY(12px) scale(.985); } to { opacity: 1; transform: none; } }

/* Transitions entre écrans (View Transitions API) */
::view-transition-old(root) { animation: vtOut .22s var(--ease) both; }
::view-transition-new(root) { animation: vtIn .38s var(--ease) both; }
@keyframes vtOut { to { opacity: 0; transform: scale(.985); } }
@keyframes vtIn { from { opacity: 0; transform: translateY(14px); } }

/* Indicateur de fraîcheur des données */
.live { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.live .dot { color: var(--green); }
.live.stale .dot { color: var(--orange); animation: none; }

/* Titre compact au défilement (mobile) */
.mini-head {
  position: fixed; top: 0; left: 0; right: 0; z-index: 45; height: calc(52px + var(--safe-t)); padding-top: var(--safe-t);
  display: none; align-items: center; justify-content: center; font-weight: 700; font-size: 16px; letter-spacing: -0.02em;
  background: var(--glass); backdrop-filter: saturate(180%) blur(24px); -webkit-backdrop-filter: saturate(180%) blur(24px);
  border-bottom: 1px solid var(--line); opacity: 0; transform: translateY(-8px); transition: opacity .25s var(--ease), transform .25s var(--ease); pointer-events: none;
}
.mini-head.on { opacity: 1; transform: none; }

/* Tirer pour actualiser */
.ptr { position: fixed; left: 50%; top: calc(10px + var(--safe-t)); z-index: 60; width: 40px; height: 40px; margin-left: -20px; border-radius: 50%;
  background: var(--surface); box-shadow: var(--shadow-2); display: grid; place-items: center; color: var(--accent); opacity: 0; transform: translateY(-60px); pointer-events: none; }
.ptr svg { width: 20px; height: 20px; }
.ptr.go svg { animation: tourne .8s linear infinite; }

@media (max-width: 860px) {
  .mini-head { display: flex; }
  .head h1 { font-size: 34px; }
}
@media (prefers-reduced-motion: reduce) { .cascade > * { animation: none; } ::view-transition-old(root), ::view-transition-new(root) { animation: none; } }

/* ===== Fond blanc (v3) : cartes délimitées par une bordure fine ===== */
:root:not([data-theme="dark"]) .card, :root:not([data-theme="dark"]) .list { box-shadow: 0 0 0 1px rgba(0,0,0,.06), 0 6px 24px rgba(0,0,0,.04); }
:root:not([data-theme="dark"]) .chip { box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); }
:root:not([data-theme="dark"]) .sidebar { background: #FAFAFC; }
:root:not([data-theme="dark"]) .search input { background: #F2F2F5; }
:root:not([data-theme="dark"]) .sheet { box-shadow: 0 0 0 1px rgba(0,0,0,.06), 0 20px 60px rgba(0,0,0,.18); }
:root[data-theme="dark"] .sidebar { background: rgba(28,28,30,.72); }
.theme-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.theme-pick button { border-radius: 18px; padding: 12px; background: var(--surface-2); box-shadow: inset 0 0 0 2px transparent; text-align: center; font-weight: 600; font-size: 14px; color: var(--text); transition: box-shadow .2s var(--ease), transform .15s; }
.theme-pick button.on { box-shadow: inset 0 0 0 2px var(--accent); color: var(--accent); }
.theme-pick button:active { transform: scale(.97); }
.theme-pick .apercu { height: 86px; border-radius: 12px; margin-bottom: 10px; display: flex; flex-direction: column; gap: 6px; padding: 10px; box-sizing: border-box; }
.theme-pick .apercu i { display: block; height: 12px; border-radius: 6px; }
