/* ═══════════════════════════════════════════════
   Comptabilité — feuille de style
   Toutes les couleurs, polices et arrondis sont des variables
   pilotées depuis Administration › Personnalisation.
   ═══════════════════════════════════════════════ */
:root {
  --bg: #0b0c14;
  --surface: #12141f;
  --surface2: #191c2a;
  --border: #252939;
  --text: #eef0f7;
  --muted: #8b91a8;
  --nav: #0e1019;
  --primary: #ffd60a;
  --on-primary: #111216;
  --accent: #6d68f0;
  --on-accent: #ffffff;
  --success: #22c55e;
  --danger: #ef4444;
  --warning: #f59e0b;

  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-heading: 'Manrope', var(--font);
  --font-num: var(--font);
  --fs: 14px;
  --radius: 12px;
  --radius-sm: 8px;
  --heading-weight: 700;
  --heading-transform: none;
  --heading-spacing: -.01em;
  --app-dim: .82;
  --app-blur: 0px;
  --login-dim: .55;
  --login-blur: 0px;

  /* Dérivés */
  --line: var(--border);
  --line-soft: color-mix(in srgb, var(--border) 60%, transparent);
  --hover: color-mix(in srgb, var(--text) 5%, transparent);
  --primary-soft: color-mix(in srgb, var(--primary) 14%, transparent);
  --primary-line: color-mix(in srgb, var(--primary) 45%, transparent);
  --success-soft: color-mix(in srgb, var(--success) 13%, transparent);
  --danger-soft: color-mix(in srgb, var(--danger) 13%, transparent);
  --warning-soft: color-mix(in srgb, var(--warning) 14%, transparent);
  --field: color-mix(in srgb, var(--bg) 55%, var(--surface));
  --shadow: 0 1px 2px rgba(0, 0, 0, .18), 0 8px 24px -12px rgba(0, 0, 0, .45);
  --shadow-lg: 0 24px 60px -20px rgba(0, 0, 0, .6);
  --sidebar-w: 256px;
  --tabbar-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);

  /* Alias (compatibilité CSS personnalisé) */
  --blue-2: var(--primary); --red-2: var(--danger); --green: var(--success); --amber: var(--warning); --mono: var(--font-num);
  color-scheme: dark;
}
:root[data-mode=light] { --shadow: 0 1px 2px rgba(16, 18, 30, .06), 0 8px 24px -14px rgba(16, 18, 30, .18); --shadow-lg: 0 24px 60px -24px rgba(16, 18, 30, .35); }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; min-height: 100%; overflow-x: clip; }
* { scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--text) 18%, transparent) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--text) 16%, transparent); border-radius: 8px; }
body {
  font-family: var(--font); font-size: var(--fs); line-height: 1.5; color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; -webkit-tap-highlight-color: transparent;
}
body.no-scroll { overflow: hidden; }
[hidden] { display: none !important; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { font-family: var(--font-heading); font-weight: var(--heading-weight); text-transform: var(--heading-transform); letter-spacing: var(--heading-spacing); margin: 0; line-height: 1.2; }
p { margin: 0; }
img { max-width: 100%; }
::selection { background: var(--primary); color: var(--on-primary); }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.muted { color: var(--muted); }
.small { font-size: .86em; }
.num, .money { font-family: var(--font-num); font-variant-numeric: tabular-nums; }
.money { font-weight: 600; white-space: nowrap; }
.pos { color: var(--success) !important; }
.neg { color: var(--danger) !important; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row-end { justify-content: flex-end; }
.nowrap { flex-wrap: nowrap; }
.spacer { flex: 1; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.grid { display: grid; gap: 16px; }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-form { grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr); align-items: start; }
.grid > *, .form-2 > *, .field { min-width: 0; }
.mobile-only { display: none !important; }
.note { font-size: .88em; color: var(--muted); line-height: 1.6; }
.note b { color: var(--text); font-weight: 600; }
.section-title { display: flex; align-items: baseline; gap: 12px; margin: 28px 0 12px; }
.section-title h2 { font-size: 1.12em; }
.section-title .muted { font-size: .88em; }
.mt { margin-top: 16px; }
.mb { margin-bottom: 16px; }

/* Fond d'écran de l'application */
.app-bg { position: fixed; inset: 0; z-index: -1; background: var(--bg) center / cover no-repeat; }
.app-bg.has-img { filter: blur(var(--app-blur)); transform: scale(1.04); }
.app-bg.has-img::after { content: ''; position: absolute; inset: 0; background: var(--bg); opacity: var(--app-dim); }
body:has(#login:not([hidden])) .app-bg { display: none; }

/* ─────────── Connexion ─────────── */
.login { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 32px 16px; position: relative; overflow: hidden; isolation: isolate; }
.login-bg {
  position: absolute; inset: 0; z-index: -1;
  background:
    radial-gradient(900px 520px at 50% -10%, color-mix(in srgb, var(--primary) 16%, transparent), transparent 65%),
    radial-gradient(700px 500px at 100% 100%, color-mix(in srgb, var(--accent) 18%, transparent), transparent 60%),
    var(--bg);
  background-size: cover; background-position: center;
}
.login-bg.has-img { filter: blur(var(--login-blur)); transform: scale(1.05); }
.login-bg.has-img::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, color-mix(in srgb, var(--bg) 40%, transparent), var(--bg)); opacity: var(--login-dim); }
.login-card {
  width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 16px;
  background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--line); border-radius: calc(var(--radius) + 6px); padding: 36px 30px 30px; box-shadow: var(--shadow-lg);
}
.login-logo { width: 112px; height: 112px; object-fit: contain; margin: 0 auto; }
.login-head { text-align: center; display: grid; gap: 6px; }
.login-head h1 { font-size: 1.55em; }
.login-card .status-pill { align-self: center; }

/* ─────────── Structure ─────────── */
.shell { display: flex; min-height: 100vh; min-height: 100dvh; }
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0; position: sticky; top: 0; height: 100vh; height: 100dvh;
  background: var(--nav); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 18px 12px 14px; overflow-y: auto; z-index: 40;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 16px; }
.brand img { width: 42px; height: 42px; object-fit: contain; flex-shrink: 0; }
.brand-text { min-width: 0; display: grid; }
.brand strong { font-family: var(--font-heading); font-weight: var(--heading-weight); font-size: 1.04em; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand small { color: var(--muted); font-size: .8em; }
.side-status { margin: 0 4px 10px; }
.nav { flex: 1; display: flex; flex-direction: column; gap: 1px; }
.nav-title { font-size: .7em; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); padding: 18px 12px 6px; font-weight: 600; }
.nav-link {
  display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: var(--radius-sm);
  color: color-mix(in srgb, var(--text) 78%, var(--muted)); font-weight: 500; position: relative; transition: background .15s, color .15s;
}
.nav-link svg { width: 18px; height: 18px; flex-shrink: 0; color: var(--muted); transition: color .15s; }
.nav-link:hover { background: var(--hover); color: var(--text); }
.nav-link.active { background: var(--surface2); color: var(--text); font-weight: 600; }
.nav-link.active svg { color: var(--primary); }
.nav-link.active::before { content: ''; position: absolute; left: -12px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: var(--primary); }
.nav-link .count { margin-left: auto; font-size: .75em; font-weight: 700; background: var(--warning-soft); color: var(--warning); padding: 1px 7px; border-radius: 99px; }
.side-foot { display: grid; gap: 10px; padding-top: 12px; border-top: 1px solid var(--line); margin-top: 12px; }
.side-foot > small { padding: 0 8px; font-size: .78em; }
.side-user { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: var(--radius-sm); transition: background .15s; }
.side-user:hover { background: var(--hover); }
.side-user .avatar { width: 34px; height: 34px; }
.side-user b { display: block; font-size: .92em; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user small { color: var(--muted); font-size: .8em; }
.side-user > span:last-child { min-width: 0; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 14px; padding: 14px 32px; min-height: 68px;
  background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}
.topbar-logo { display: none; width: 30px; height: 30px; object-fit: contain; }
.topbar-title { flex: 1; min-width: 0; display: grid; }
.topbar-title h1 { font-size: 1.3em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-title > span { font-size: .85em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.back-link { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: .82em; font-weight: 500; }
.back-link svg { width: 14px; height: 14px; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.view { padding: 28px 32px 64px; max-width: 1440px; width: 100%; margin: 0 auto; animation: fade .22s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } }

/* Barre d'onglets mobile */
.tabbar { display: none; }

/* Statut ouvert / fermé */
.status-pill {
  display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px 5px 10px; border-radius: 99px; font-size: .8em; font-weight: 700;
  letter-spacing: .04em; text-transform: uppercase; border: 1px solid transparent; white-space: nowrap;
}
.status-pill::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.status-pill.open { color: var(--success); background: var(--success-soft); border-color: color-mix(in srgb, var(--success) 30%, transparent); }
.status-pill.open::before { animation: pulse 2s infinite; }
.status-pill.closed { color: var(--danger); background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--success) 60%, transparent); } 100% { box-shadow: 0 0 0 8px transparent; } }
.side-status .status-pill { width: 100%; justify-content: center; padding: 8px 12px; }

.duty-btn.on { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.duty-btn.off { color: var(--success); border-color: color-mix(in srgb, var(--success) 35%, transparent); }

/* ─────────── Boutons ─────────── */
.btn {
  font: inherit; font-weight: 600; font-size: .93em; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 15px; min-height: 38px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface2); color: var(--text);
  cursor: pointer; transition: background .15s, border-color .15s, filter .15s, transform .1s; white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.btn:hover { border-color: color-mix(in srgb, var(--text) 22%, var(--border)); background: color-mix(in srgb, var(--surface2) 85%, var(--text)); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn-primary:hover { background: var(--primary); border-color: var(--primary); filter: brightness(1.08); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger); border-color: var(--danger); filter: brightness(1.08); }
.btn-success { background: var(--success); border-color: var(--success); color: #fff; }
.btn-success:hover { background: var(--success); border-color: var(--success); filter: brightness(1.08); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--hover); border-color: transparent; }
.btn-sm { padding: 6px 11px; min-height: 32px; font-size: .86em; }
.btn-lg { padding: 12px 20px; min-height: 46px; font-size: 1em; }
.btn-block { width: 100%; }
.btn-icon { padding: 0; width: 34px; height: 34px; min-height: 34px; }
.btn-icon.del:hover { border-color: var(--danger); color: var(--danger); background: var(--danger-soft); }
.icon-btn {
  width: 38px; height: 38px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface);
  color: var(--text); display: inline-grid; place-items: center; cursor: pointer; transition: .15s; flex-shrink: 0; padding: 0;
}
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn:hover { background: var(--surface2); }
.icon-btn.ghost { border-color: transparent; background: transparent; }
.icon-btn.ghost:hover { background: var(--hover); }
.icon-btn .avatar { width: 100%; height: 100%; border-radius: inherit; }

/* ─────────── Composants ─────────── */
.avatar {
  --av: var(--accent);
  width: 36px; height: 36px; border-radius: 50%; display: inline-grid; place-items: center; flex-shrink: 0; overflow: hidden;
  font-weight: 700; font-size: .8em; color: #fff; letter-spacing: .02em;
  background: color-mix(in srgb, var(--av) 70%, #000);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.who .avatar { width: 32px; height: 32px; }
.who b { font-weight: 600; }
.who > div { min-width: 0; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); container-type: inline-size; }
.card-pad { padding: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); flex-wrap: wrap; min-height: 62px; }
.card-head h2, .card-head h3 { font-size: 1.02em; display: flex; align-items: center; gap: 10px; }
.card-head .sub { color: var(--muted); font-size: .85em; font-weight: 400; }
.card-foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.card-flat { box-shadow: none; }

/* Indicateurs */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.kpi { container-type: inline-size; position: relative; padding: 18px 18px 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); min-width: 0; }
.kpi-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.kpi-label { font-size: .8em; color: var(--muted); font-weight: 500; }
.kpi-ico { width: 30px; height: 30px; border-radius: var(--radius-sm); display: grid; place-items: center; background: var(--surface2); color: var(--muted); flex-shrink: 0; }
.kpi-ico svg { width: 16px; height: 16px; }
.kpi-value { font-family: var(--font-num); font-variant-numeric: tabular-nums; font-size: clamp(1.15em, 11.5cqi, 1.65em); font-weight: 700; margin-top: 10px; line-height: 1.15; letter-spacing: -.02em; overflow-wrap: anywhere; }
.kpi-sub { font-size: .8em; color: var(--muted); margin-top: 6px; }
.kpi-sub b { color: var(--text); font-weight: 600; }
.kpi.is-pos .kpi-value { color: var(--success); }
.kpi.is-neg .kpi-value { color: var(--danger); }
.kpi.feature { background: linear-gradient(160deg, color-mix(in srgb, var(--primary) 10%, var(--surface)) 0%, var(--surface) 60%); border-color: color-mix(in srgb, var(--primary) 28%, var(--border)); }
.kpi.feature .kpi-ico { background: var(--primary-soft); color: var(--primary); }
.kpi.big { grid-column: span 2; }
.kpi.big .kpi-value { font-size: clamp(1.4em, 8cqi, 2.1em); }

/* Bandeau d'accueil */
.welcome { display: flex; align-items: center; gap: 20px; padding: 22px 24px; margin-bottom: 18px; flex-wrap: wrap; }
.welcome-status { display: flex; align-items: center; gap: 16px; flex: 1; min-width: 240px; }
.status-orb { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; }
.status-orb svg { width: 24px; height: 24px; }
.status-orb.open { background: var(--success-soft); color: var(--success); box-shadow: 0 0 0 6px color-mix(in srgb, var(--success) 8%, transparent); }
.status-orb.closed { background: var(--danger-soft); color: var(--danger); box-shadow: 0 0 0 6px color-mix(in srgb, var(--danger) 8%, transparent); }
.welcome h2 { font-size: 1.45em; }
.welcome h2 .open { color: var(--success); }
.welcome h2 .closed { color: var(--danger); }
.welcome p { color: var(--muted); font-size: .9em; margin-top: 2px; }
.avatar-stack { display: flex; align-items: center; }
.avatar-stack .avatar { width: 34px; height: 34px; border: 2px solid var(--surface); margin-left: -8px; }
.avatar-stack .avatar:first-child { margin-left: 0; }
.avatar-stack .more { margin-left: 8px; font-size: .85em; color: var(--muted); }
.period-line { display: flex; gap: 8px 18px; flex-wrap: wrap; color: var(--muted); font-size: .86em; margin: 0 0 14px; }
.period-line b { color: var(--text); font-weight: 600; }

/* Tableaux */
.table-wrap { overflow: visible; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 16px; text-align: left; vertical-align: middle; overflow-wrap: break-word; }
thead th { font-size: .74em; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; border-bottom: 1px solid var(--line); white-space: nowrap; }
tbody tr { border-bottom: 1px solid var(--line-soft); transition: background .12s; }
tbody tr:last-child { border-bottom: 0; }
tbody tr:hover { background: var(--hover); }
td.r, th.r { text-align: right; }
td small.muted { font-size: .82em; }
.nowrap-cell { white-space: nowrap; }
tfoot td { font-weight: 700; border-top: 1px solid var(--line); background: color-mix(in srgb, var(--surface2) 50%, transparent); }
tr.clickable { cursor: pointer; }
.plate {
  display: inline-block; font-family: var(--font-num); font-weight: 700; font-size: .84em; letter-spacing: .08em; white-space: nowrap;
  padding: 2px 8px; border-radius: 4px; background: #f6f6f2; color: #1d2150; border: 1px solid #c9ccd8;
}
.empty { padding: 40px 20px; text-align: center; color: var(--muted); display: grid; justify-items: center; gap: 10px; font-size: .92em; }
.empty svg { width: 32px; height: 32px; opacity: .45; }
.bar { height: 5px; border-radius: 5px; background: var(--surface2); overflow: hidden; min-width: 90px; margin-top: 6px; }
.bar i { display: block; height: 100%; border-radius: 5px; background: var(--primary); }
.rank { font-family: var(--font-num); font-weight: 700; color: var(--muted); width: 22px; display: inline-block; }
.rank.r1 { color: var(--primary); }

/* Badges */
.badge {
  --c: var(--primary);
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 99px; font-size: .76em; font-weight: 600; white-space: nowrap;
  background: color-mix(in srgb, var(--c) 14%, transparent); color: color-mix(in srgb, var(--c) 82%, var(--text));
  border: 1px solid color-mix(in srgb, var(--c) 26%, transparent);
}
.badge svg { width: 12px; height: 12px; }
.badge.red { --c: var(--danger); }
.badge.green { --c: var(--success); }
.badge.amber { --c: var(--warning); }
.badge.accent { --c: var(--accent); }
.badge.gray { --c: var(--muted); }
.badges { display: flex; gap: 6px; flex-wrap: wrap; }

/* Formulaires */
.form { display: grid; gap: 16px; }
.form-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: .84em; font-weight: 600; color: color-mix(in srgb, var(--text) 85%, var(--muted)); }
.field > span em { font-style: normal; color: var(--muted); font-weight: 400; }
.field > small { color: var(--muted); font-size: .8em; }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--field); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 10px 12px; width: 100%; min-width: 0; outline: none; transition: border-color .15s, box-shadow .15s; min-height: 42px;
}
textarea { resize: vertical; line-height: 1.5; }
input::placeholder, textarea::placeholder { color: color-mix(in srgb, var(--muted) 75%, transparent); }
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
select { appearance: none; -webkit-appearance: none; padding-right: 36px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238b91a8' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; }
input[type=color] { padding: 3px; height: 42px; width: 52px; cursor: pointer; flex-shrink: 0; }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; min-height: 0; accent-color: var(--primary); padding: 0; flex-shrink: 0; }
input[type=range] { padding: 0; min-height: 0; accent-color: var(--primary); border: 0; background: transparent; box-shadow: none; }
input[type=file] { padding: 8px; }
.input-money { position: relative; }
.input-money input { padding-right: 34px; font-family: var(--font-num); font-weight: 600; }
.input-money::after { content: var(--cur, '$'); position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); font-weight: 600; pointer-events: none; }
.input-money.pct::after { content: '%'; }
.check {
  display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; border-radius: var(--radius-sm); border: 1px solid var(--line);
  background: var(--field); cursor: pointer; transition: .15s;
}
.check:hover { border-color: color-mix(in srgb, var(--text) 20%, var(--border)); }
.check:has(input:checked) { border-color: var(--primary-line); background: var(--primary-soft); }
.check b { display: block; font-size: .92em; font-weight: 600; }
.check small { color: var(--muted); font-size: .82em; }
.perm-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.form-error { color: var(--danger); background: var(--danger-soft); border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent); padding: 10px 12px; border-radius: var(--radius-sm); font-size: .9em; }

/* Interrupteur */
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch i { width: 40px; height: 23px; border-radius: 99px; background: var(--surface2); border: 1px solid var(--line); position: relative; transition: .2s; flex-shrink: 0; }
.switch i::after { content: ''; position: absolute; top: 2px; left: 2px; width: 17px; height: 17px; border-radius: 50%; background: var(--muted); transition: .2s; }
.switch input:checked + i { background: var(--success); border-color: var(--success); }
.switch input:checked + i::after { left: 19px; background: #fff; }
.switch input:focus-visible + i { outline: 2px solid var(--primary); outline-offset: 2px; }
.switch span { font-size: .88em; font-weight: 500; }

/* Sélecteur à tuiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 8px; }
.tile {
  position: relative; padding: 12px 10px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--field);
  cursor: pointer; text-align: center; transition: .15s; font-weight: 600; font-size: .9em; display: grid; justify-items: center; gap: 4px;
}
.tile input { position: absolute; opacity: 0; pointer-events: none; }
.tile .t-ico { font-size: 1.35em; line-height: 1; }
.tile .t-ico svg { width: 20px; height: 20px; }
.tile small { color: var(--muted); font-weight: 400; font-size: .82em; }
.tile:hover { border-color: color-mix(in srgb, var(--text) 22%, var(--border)); }
.tile:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 0 0 1px var(--primary) inset; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { padding: 5px 11px; border-radius: 99px; border: 1px solid var(--line); background: var(--field); color: var(--text); font: inherit; font-size: .82em; cursor: pointer; font-weight: 500; }
.chip:hover { border-color: var(--primary-line); background: var(--primary-soft); }
.seg { display: inline-flex; padding: 3px; background: var(--field); border: 1px solid var(--line); border-radius: var(--radius-sm); gap: 2px; flex-wrap: wrap; max-width: 100%; }
.seg button { font: inherit; font-weight: 600; font-size: .84em; padding: 6px 12px; border-radius: calc(var(--radius-sm) - 2px); border: 0; background: transparent; color: var(--muted); cursor: pointer; white-space: nowrap; }
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--surface2); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, .25); }

/* Tarifs */
.price-card { overflow: hidden; }
.price-card .pc-head { padding: 16px 18px; display: flex; align-items: center; gap: 12px; border-bottom: 1px solid var(--line); }
.price-card .pc-ico { width: 38px; height: 38px; border-radius: var(--radius-sm); display: grid; place-items: center; font-size: 1.2em; background: var(--surface2); }
.price-card h3 { font-size: 1em; }
.price-line { display: flex; align-items: center; gap: 10px; padding: 11px 18px; border-bottom: 1px solid var(--line-soft); }
.price-line:last-child { border-bottom: 0; }
.price-line .pl-label { flex: 1; color: color-mix(in srgb, var(--text) 85%, var(--muted)); }
.price-line .pl-price { font-family: var(--font-num); font-weight: 700; }
.price-line .pl-price.free { color: var(--success); }

/* Calculatrice */
.calc-screen { background: var(--field); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; text-align: right; margin-bottom: 12px; }
.calc-screen .expr { font-family: var(--font-num); color: var(--muted); min-height: 20px; font-size: .9em; word-break: break-all; }
.calc-screen .res { font-family: var(--font-num); font-size: 2em; font-weight: 700; word-break: break-all; }
.calc-keys { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.calc-keys button { font: inherit; font-family: var(--font-num); font-size: 1.15em; font-weight: 600; padding: 13px 0; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface2); color: var(--text); cursor: pointer; transition: .1s; }
.calc-keys button:hover { border-color: color-mix(in srgb, var(--text) 22%, var(--border)); }
.calc-keys button:active { transform: scale(.97); }
.calc-keys .op { color: var(--primary); }
.calc-keys .eq { background: var(--primary); color: var(--on-primary); border-color: transparent; }
.calc-keys .clr { color: var(--danger); }
.sim-line { display: grid; grid-template-columns: 1fr 104px; gap: 10px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--line-soft); }
.sim-line input { text-align: center; font-family: var(--font-num); font-weight: 600; }
.sum-box {
  margin-top: 4px; padding: 14px 16px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--field); border: 1px solid var(--line);
}
.sum-box b { font-weight: 600; }
.sum-box small { color: var(--muted); }
.sum-box strong { font-family: var(--font-num); font-size: 1.5em; color: var(--success); white-space: nowrap; }

/* Équipe / paies */
.team-card { padding: 18px; display: flex; flex-direction: column; gap: 14px; transition: border-color .15s, transform .15s; }
a.team-card:hover, .team-card .team-link:hover { border-color: color-mix(in srgb, var(--text) 22%, var(--border)); }
.team-card .who .avatar { width: 42px; height: 42px; }
.team-card .who b { font-size: 1.02em; }
.mini-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.mini-stats div { background: var(--field); border: 1px solid var(--line-soft); border-radius: var(--radius-sm); padding: 8px 10px; min-width: 0; }
.mini-stats small { display: block; font-size: .72em; color: var(--muted); font-weight: 500; }
.mini-stats b { font-family: var(--font-num); font-size: .9em; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.pay-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 12px; border-top: 1px solid var(--line-soft); }
.pay-row .money { font-size: 1.1em; }
.team-card.paid { border-color: color-mix(in srgb, var(--success) 35%, var(--border)); }

/* Profil */
.profile-head { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; padding: 22px; }
.profile-head .avatar { width: 64px; height: 64px; font-size: 1.15em; }
.profile-head h2 { font-size: 1.45em; }
.avatar-edit { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.avatar-edit .avatar { width: 88px; height: 88px; font-size: 1.5em; }

/* Planning */
.duty-card { display: flex; align-items: center; gap: 20px; padding: 22px; flex-wrap: wrap; }
.duty-status { flex: 1; min-width: 200px; display: grid; gap: 2px; }
.duty-status h3 { font-size: 1.3em; }
.duty-clock { font-family: var(--font-num); font-size: 2em; font-weight: 700; color: var(--success); line-height: 1.1; }
.on-duty-list { display: flex; flex-wrap: wrap; gap: 8px; padding: 16px 20px; }
.on-duty-item { display: flex; align-items: center; gap: 10px; padding: 6px 14px 6px 6px; border-radius: 99px; background: var(--success-soft); border: 1px solid color-mix(in srgb, var(--success) 25%, transparent); }
.on-duty-item .avatar { width: 28px; height: 28px; }
.on-duty-item small { color: var(--success); font-family: var(--font-num); }
.week-grid { display: grid; grid-template-columns: 180px repeat(7, minmax(0, 1fr)) 80px; }
.week-grid > div { min-width: 0; padding: 10px 12px; border-bottom: 1px solid var(--line-soft); border-right: 1px solid var(--line-soft); font-size: .86em; overflow-wrap: anywhere; }
.week-grid > div:nth-child(9n) { border-right: 0; }
.week-grid .wh { font-size: .74em; text-transform: uppercase; letter-spacing: .06em; font-weight: 600; color: var(--muted); }
.week-grid .wh.today { color: var(--primary); }
.shift { display: block; margin: 2px 0; padding: 3px 7px; border-radius: 5px; background: var(--primary-soft); border-left: 2px solid var(--primary); font-family: var(--font-num); font-size: .9em; white-space: nowrap; }
.shift.live { background: var(--success-soft); border-left-color: var(--success); }
.week-list { display: none; }

/* Ouvertures */
.days { display: grid; gap: 10px; }
.day { display: grid; grid-template-columns: 150px minmax(0, 1fr) 90px; gap: 16px; align-items: center; padding: 14px 20px; border-bottom: 1px solid var(--line-soft); }
.day:last-child { border-bottom: 0; }
.day-name b { display: block; font-weight: 600; text-transform: capitalize; }
.day-name small { color: var(--muted); }
.day-total { text-align: right; font-family: var(--font-num); font-weight: 700; }
.day.closed-day .day-total { color: var(--muted); font-weight: 500; }
.timeline { position: relative; height: 28px; border-radius: 6px; background: var(--field); border: 1px solid var(--line-soft); overflow: hidden; }
.timeline i { position: absolute; top: 3px; bottom: 3px; border-radius: 4px; background: var(--success); opacity: .85; min-width: 3px; }
.timeline i.live { background: repeating-linear-gradient(45deg, var(--success) 0 6px, color-mix(in srgb, var(--success) 70%, #fff) 6px 12px); }
.timeline .tick { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--line-soft); }
.intervals { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.interval { font-family: var(--font-num); font-size: .82em; padding: 2px 8px; border-radius: 5px; background: var(--success-soft); color: color-mix(in srgb, var(--success) 85%, var(--text)); white-space: nowrap; }
.interval.live { font-weight: 700; }
.hours-scale { display: flex; justify-content: space-between; font-size: .7em; color: var(--muted); font-family: var(--font-num); margin-top: 4px; }

/* Archives */
.archive-item { display: flex; align-items: center; gap: 16px; padding: 16px 20px; border-bottom: 1px solid var(--line-soft); flex-wrap: wrap; }
.archive-item:last-child { border-bottom: 0; }
.archive-item .a-ico { width: 40px; height: 40px; border-radius: var(--radius-sm); display: grid; place-items: center; background: var(--surface2); color: var(--muted); }
.archive-item .a-ico svg { width: 18px; height: 18px; }
.archive-item .a-main { flex: 1; min-width: 200px; }
.archive-item .a-main b { font-weight: 600; }
.archive-item .a-nums { display: flex; gap: 24px; flex-wrap: wrap; }
.archive-item .a-nums small { display: block; font-size: .74em; color: var(--muted); }
.danger-zone { border: 1px solid color-mix(in srgb, var(--danger) 35%, var(--border)); border-radius: var(--radius); padding: 20px; background: color-mix(in srgb, var(--danger) 6%, var(--surface)); display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.danger-zone > div { flex: 1; min-width: 220px; }
.danger-zone h3 { font-size: 1.05em; color: var(--danger); }
.danger-zone p { margin-top: 4px; color: var(--muted); font-size: .9em; }

/* Crafts */
.shots { display: grid; grid-template-columns: 1fr; gap: 10px; }
.shot {
  position: relative; display: grid; grid-template-columns: minmax(0, 1fr) 176px; border: 1px dashed color-mix(in srgb, var(--text) 22%, var(--border)); border-radius: var(--radius-sm);
  background: var(--field); cursor: pointer; overflow: hidden; transition: border-color .15s, background .15s; min-height: 104px;
}
.shot.done { border-style: solid; }
.shot:hover, .shot.drag, .shot.selected { border-color: var(--primary); }
.shot.selected { box-shadow: 0 0 0 3px var(--primary-soft); }
.shot input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.shot-head { display: flex; gap: 10px; align-items: flex-start; padding: 12px; }
.shot-num { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--surface2); font-weight: 700; font-size: .8em; flex-shrink: 0; }
.shot.done .shot-num { background: var(--success); color: #fff; }
.shot-head b { display: block; font-size: .88em; font-weight: 600; line-height: 1.3; }
.shot-head small { display: block; color: var(--muted); font-size: .78em; line-height: 1.4; margin-top: 3px; }
.shot-drop { display: grid; place-content: center; justify-items: center; gap: 4px; padding: 12px; color: var(--muted); font-size: .8em; text-align: center; border-left: 1px dashed var(--line); }
.shot-drop svg { width: 22px; height: 22px; }
.shot img { width: 100%; height: 100%; min-height: 104px; object-fit: cover; display: block; border-left: 1px solid var(--line); }
.shot .shot-x { position: absolute; top: 8px; right: 8px; width: 28px; height: 28px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, .65); color: #fff; display: grid; place-items: center; cursor: pointer; }
.shot .shot-x svg { width: 14px; height: 14px; }
.craft-list { display: grid; }
.craft-item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 14px 20px; border-bottom: 1px solid var(--line-soft); cursor: pointer; transition: background .12s; }
.craft-item:last-child { border-bottom: 0; }
.craft-item:hover { background: var(--hover); }
.thumbs { display: flex; gap: 4px; }
.thumbs img { width: 52px; height: 38px; object-fit: cover; border-radius: 5px; border: 1px solid var(--line); background: var(--surface2); display: block; }
.craft-item b { font-weight: 600; }
.craft-meta { color: var(--muted); font-size: .84em; }
.craft-side { text-align: right; display: grid; gap: 4px; justify-items: end; }
.craft-shots { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.craft-shots figure { margin: 0; cursor: zoom-in; }
.craft-shots img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; border-radius: var(--radius-sm); border: 1px solid var(--line); display: block; }
.craft-shots figcaption { font-size: .78em; color: var(--muted); margin-top: 5px; }
.steps { display: grid; gap: 4px; counter-reset: s; margin: 0; padding: 0; list-style: none; }

/* Personnalisation */
.presets { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.preset { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px; cursor: pointer; background: var(--field); text-align: left; font: inherit; color: var(--text); display: grid; gap: 10px; transition: .15s; }
.preset:hover { border-color: color-mix(in srgb, var(--text) 25%, var(--border)); }
.preset.on { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary) inset; }
.preset b { font-weight: 600; font-size: .9em; }
.swatches { display: flex; height: 22px; border-radius: 5px; overflow: hidden; border: 1px solid rgba(127, 127, 127, .25); }
.swatches i { flex: 1; }
.color-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.color-field { display: flex; align-items: center; gap: 10px; padding: 8px; border: 1px solid var(--line-soft); border-radius: var(--radius-sm); background: var(--field); }
.color-field > div { flex: 1; min-width: 0; }
.color-field b { display: block; font-size: .86em; font-weight: 600; }
.color-field small { color: var(--muted); font-size: .76em; display: block; line-height: 1.3; }
.color-field input[type=text] { font-family: var(--font-num); font-size: .85em; padding: 4px 8px; min-height: 30px; margin-top: 4px; text-transform: lowercase; }
.range-field { display: grid; gap: 6px; }
.range-field > div { display: flex; justify-content: space-between; font-size: .84em; font-weight: 600; }
.range-field output { font-family: var(--font-num); color: var(--muted); font-weight: 500; }
.bg-preview { width: 100%; aspect-ratio: 16 / 9; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--field) center / cover no-repeat; display: grid; place-items: center; color: var(--muted); font-size: .85em; position: relative; overflow: hidden; }
.bg-preview svg { width: 26px; height: 26px; opacity: .6; }
.logo-preview { width: 120px; height: 120px; object-fit: contain; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--field); padding: 10px; flex-shrink: 0; }
.font-sample { font-size: 1.4em; padding: 14px 16px; border-radius: var(--radius-sm); background: var(--field); border: 1px solid var(--line-soft); display: grid; gap: 4px; }
.font-sample h3 { font-size: 1.1em; }
.font-sample p { font-size: .62em; color: var(--muted); }
.font-sample .num { font-size: .9em; font-weight: 700; }
.save-bar {
  position: sticky; bottom: 16px; z-index: 20; margin-top: 18px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 12px 16px; border-radius: var(--radius); background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(12px);
  border: 1px solid var(--line); box-shadow: var(--shadow-lg);
}

/* Modales */
.modal-back {
  position: fixed; inset: 0; z-index: 100; background: rgba(5, 6, 12, .62); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  display: grid; place-items: center; padding: 24px 16px; animation: fade .16s ease;
}
.modal-back.closing { opacity: 0; transition: opacity .15s; }
.modal {
  width: 100%; max-width: 600px; max-height: calc(100dvh - 48px); display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line); border-radius: calc(var(--radius) + 4px); box-shadow: var(--shadow-lg); overflow: hidden;
}
.modal.wide { max-width: 1080px; }
.modal-grip { display: none; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); flex-shrink: 0; }
.modal-head h3 { font-size: 1.08em; min-width: 0; overflow-wrap: anywhere; }
.modal-body { padding: 20px; overflow-y: auto; overscroll-behavior: contain; container-type: inline-size; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--line); flex-shrink: 0; flex-wrap: wrap; }
.confirm-text { line-height: 1.6; }
.sheet-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.sheet-item { display: grid; justify-items: center; gap: 8px; padding: 16px 8px; border-radius: var(--radius); background: var(--field); border: 1px solid var(--line-soft); text-align: center; font-size: .84em; font-weight: 600; }
.sheet-item svg { width: 22px; height: 22px; color: var(--primary); }
.sheet-item:active { background: var(--surface2); }
.sheet-list { display: grid; }
.sheet-list a, .sheet-list button { display: flex; align-items: center; gap: 14px; padding: 13px 4px; border: 0; border-bottom: 1px solid var(--line-soft); background: none; color: var(--text); font: inherit; font-weight: 500; text-align: left; cursor: pointer; width: 100%; }
.sheet-list a:last-child, .sheet-list button:last-child { border-bottom: 0; }
.sheet-list svg { width: 20px; height: 20px; color: var(--muted); }
.sheet-list .chev { margin-left: auto; width: 16px; height: 16px; }
.sheet-list .danger, .sheet-list .danger svg { color: var(--danger); }
.sheet-title { font-size: .72em; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 600; margin: 18px 0 2px; }
.sheet-title:first-child { margin-top: 0; }

/* Visionneuse */
.lightbox { position: fixed; inset: 0; z-index: 300; background: rgba(0, 0, 0, .92); display: grid; place-items: center; padding: 20px; animation: fade .15s; }
.lightbox figure { margin: 0; max-width: 100%; max-height: 100%; display: grid; gap: 10px; justify-items: center; }
.lightbox img { max-width: min(1400px, 100%); max-height: calc(100dvh - 90px); border-radius: 8px; object-fit: contain; }
.lightbox figcaption { color: #e6e6e6; font-size: .9em; display: flex; gap: 14px; }
.lightbox figcaption span { color: #9a9a9a; }
.lb-btn { position: absolute; width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .12); color: #fff; display: grid; place-items: center; cursor: pointer; }
.lb-btn svg { width: 22px; height: 22px; }
.lb-close { top: 16px; right: 16px; }
.lb-prev { left: 16px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 16px; top: 50%; transform: translateY(-50%); }

/* Notifications */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 400; display: flex; flex-direction: column; gap: 8px; max-width: calc(100vw - 32px); }
.toast {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: var(--radius-sm); min-width: 260px; max-width: 420px;
  background: var(--surface2); border: 1px solid var(--line); box-shadow: var(--shadow-lg); font-weight: 500; font-size: .92em; animation: slide .2s ease; transition: opacity .3s;
}
.toast.out { opacity: 0; }
.toast svg { width: 18px; height: 18px; flex-shrink: 0; color: var(--success); }
.toast.err svg { color: var(--danger); }
@keyframes slide { from { opacity: 0; transform: translateY(8px); } }

.loader { display: grid; place-items: center; padding: 90px; }
.loader i { width: 30px; height: 30px; border-radius: 50%; border: 2.5px solid var(--line); border-top-color: var(--primary); animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Administration */
.admin-tabs { display: flex; flex-wrap: wrap; gap: 4px; padding: 14px 32px 0; max-width: 1440px; width: 100%; margin: 0 auto; border-bottom: 1px solid transparent; }
.admin-tab {
  display: inline-flex; align-items: center; gap: 7px; padding: 7px 12px; border-radius: var(--radius-sm); color: var(--muted);
  white-space: nowrap; font-weight: 500; font-size: .9em; transition: .15s; border: 1px solid transparent;
}
.admin-tab svg { width: 15px; height: 15px; }
.admin-tab:hover { color: var(--text); background: var(--hover); }
.admin-tab.active { color: var(--text); background: var(--surface); border-color: var(--line); box-shadow: var(--shadow); }
.admin-tab.active svg { color: var(--primary); }
.admin-tab .count { font-size: .78em; font-weight: 700; background: var(--warning-soft); color: var(--warning); padding: 0 6px; border-radius: 99px; }
.admin-menu { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.admin-menu a { display: grid; gap: 10px; padding: 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); font-weight: 600; font-size: .9em; }
.admin-menu a svg { width: 22px; height: 22px; color: var(--primary); }
.copy-box {
  cursor: pointer; font-family: var(--font-num); font-size: 1.6em; font-weight: 700; letter-spacing: .1em; text-align: center;
  padding: 16px; border: 1px dashed var(--primary-line); border-radius: var(--radius); background: var(--field); transition: .15s; user-select: all; overflow-wrap: anywhere;
}
.copy-box:hover { background: var(--primary-soft); }
.copy-box.copied { border-color: var(--success); color: var(--success); }
.copy-hint { text-align: center; font-size: .8em; color: var(--muted); margin-top: 6px; }
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); margin-right: 6px; vertical-align: middle; opacity: .6; }
.status-dot.on { background: var(--success); opacity: 1; box-shadow: 0 0 0 3px var(--success-soft); }

/* Journal */
.audit-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px; align-items: start; padding: 12px 20px; border-bottom: 1px solid var(--line-soft); }
.audit-row:has(.audit-check) { grid-template-columns: auto auto minmax(0, 1fr) auto; }
.audit-row:last-child { border-bottom: 0; }
.audit-row.selected { background: var(--danger-soft); }
.audit-check { display: grid; place-items: center; height: 32px; cursor: pointer; }
.audit-ico { width: 32px; height: 32px; border-radius: var(--radius-sm); display: grid; place-items: center; background: var(--surface2); color: var(--muted); }
.audit-ico svg { width: 15px; height: 15px; }
.audit-ico.cat-customs, .audit-ico.cat-factures { color: var(--primary); }
.audit-ico.cat-crafts { color: var(--warning); }
.audit-ico.cat-service, .audit-ico.cat-statut { color: var(--success); }
.audit-ico.cat-cloture, .audit-ico.cat-logs { color: var(--danger); }
.audit-ico.cat-paie, .audit-ico.cat-membres { color: var(--accent); }
.audit-line { display: flex; gap: 8px; flex-wrap: wrap; align-items: baseline; }
.audit-line b { font-weight: 600; }
.audit-who { color: var(--muted); font-size: .88em; }
.audit-when { font-family: var(--font-num); font-size: .82em; color: var(--muted); text-align: right; white-space: nowrap; display: grid; }
.audit-when small { font-size: .9em; opacity: .8; }
.kv { display: flex; flex-wrap: wrap; gap: 4px 6px; margin-top: 6px; }
.kv span { font-size: .8em; padding: 1px 8px; border-radius: 5px; background: var(--field); border: 1px solid var(--line-soft); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kv span i { font-style: normal; color: var(--muted); margin-right: 3px; }

/* Espace Logs */
.logs-shell { min-height: 100vh; min-height: 100dvh; }
.logs-top { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 14px; padding: 12px 28px; background: color-mix(in srgb, var(--nav) 92%, transparent); backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
.logs-top img { width: 34px; height: 34px; object-fit: contain; }
.logs-top .brand-text strong { font-family: var(--font-heading); font-weight: var(--heading-weight); }
.logs-top .seg { margin-left: 12px; }
.logs-main { padding: 24px 28px 60px; max-width: 1200px; margin: 0 auto; }
.filters { display: grid; grid-template-columns: minmax(0, 1.2fr) repeat(2, minmax(0, 1fr)) repeat(2, minmax(0, .8fr)); gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.select-bar { display: flex; align-items: center; gap: 10px; padding: 10px 20px; border-bottom: 1px solid var(--line); background: var(--field); flex-wrap: wrap; font-size: .9em; }
.hook { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line-soft); align-items: center; }
.hook:last-child { border-bottom: 0; }
.hook b { font-weight: 600; }
.hook code { font-family: var(--font-num); font-size: .8em; color: var(--muted); overflow-wrap: anywhere; }
.howto { margin: 0; padding-left: 18px; display: grid; gap: 6px; color: var(--muted); font-size: .9em; }
.howto b { color: var(--text); font-weight: 600; }

/* Tableaux en cartes quand la place manque */
@container (max-width: 720px) {
  .table-wrap table, .table-wrap tbody, .table-wrap tfoot, .table-wrap tr, .table-wrap td { display: block; width: 100%; }
  .table-wrap thead { display: none; }
  .table-wrap tr { padding: 10px 16px; }
  .table-wrap td { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 5px 0; text-align: right; border: 0; }
  .table-wrap td::before { content: attr(data-label); font-size: .78em; color: var(--muted); font-weight: 500; text-align: left; flex-shrink: 0; }
  .table-wrap td[data-label=""]::before { content: none; }
  .table-wrap td[data-label=""] { justify-content: flex-end; }
  .table-wrap td .who, .table-wrap td > .row { justify-content: flex-end; }
  .table-wrap td input, .table-wrap td select, .table-wrap td .input-money { max-width: 62%; }
  .table-wrap td:first-child { font-weight: 600; }
  .week-grid { display: none; }
  .week-list { display: block; }
  .craft-item { grid-template-columns: minmax(0, 1fr) auto; }
  .craft-item .thumbs { grid-column: 1 / -1; order: 3; }
  .day { grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; padding: 14px 16px; }
  .day .day-bar { grid-column: 1 / -1; order: 3; }
  .audit-row { padding: 12px 16px; gap: 10px; }
  .audit-row { grid-template-columns: auto minmax(0, 1fr); }
  .audit-row:has(.audit-check) { grid-template-columns: auto auto minmax(0, 1fr); }
  .audit-when { grid-column: 2 / -1; text-align: left; display: flex; gap: 8px; }
  .audit-row:has(.audit-check) .audit-when { grid-column: 3 / -1; }
}
@container (max-width: 1000px) {
  .table-wrap.wide table, .table-wrap.wide tbody, .table-wrap.wide tfoot, .table-wrap.wide tr, .table-wrap.wide td { display: block; width: 100%; }
  .table-wrap.wide thead { display: none; }
  .table-wrap.wide tr { padding: 12px 16px; display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 2px 20px; }
  .table-wrap.wide td { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 5px 0; text-align: right; }
  .table-wrap.wide td::before { content: attr(data-label); font-size: .78em; color: var(--muted); font-weight: 500; text-align: left; }
  .table-wrap.wide td:first-child { grid-column: 1 / -1; padding-bottom: 8px; }
  .table-wrap.wide td:first-child::before, .table-wrap.wide td[data-label=""]::before { content: none; }
}

/* ─────────── Adaptation écran ─────────── */
@media (max-width: 1280px) {
  .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-form { grid-template-columns: 1fr; }
  .filters { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .filters > :first-child { grid-column: 1 / -1; }
}

/* Téléphone / tablette : navigation façon application */
@media (max-width: 1023px) {
  .desktop-only { display: none !important; }
  .mobile-only { display: inline-grid !important; }
  .sidebar { display: none; }
  .topbar { padding: 10px 16px; padding-top: calc(10px + env(safe-area-inset-top, 0px)); min-height: 60px; gap: 10px; }
  .topbar-logo { display: block; }
  .topbar-title h1 { font-size: 1.12em; }
  .topbar-right { gap: 8px; }
  .topbar-right .status-pill { padding: 4px 10px 4px 8px; font-size: .72em; }
  #topAvatar { border-radius: 50%; overflow: hidden; padding: 0; }
  #topAvatar .avatar { width: 100%; height: 100%; }
  .duty-btn { display: none !important; }
  .view { padding: 18px 16px calc(var(--tabbar-h) + var(--safe-b) + 28px); }
  .admin-tabs { display: none !important; }
  .g-2, .g-3 { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 14px; }
  .kpi-value { font-size: 1.3em; }
  .kpi.big { grid-column: 1 / -1; }
  .kpi.big .kpi-value { font-size: 1.75em; }
  .kpi-ico { width: 26px; height: 26px; }
  .toasts { left: 16px; right: 16px; bottom: calc(var(--tabbar-h) + var(--safe-b) + 12px); }
  .toast { min-width: 0; max-width: none; }
  .save-bar { bottom: calc(var(--tabbar-h) + var(--safe-b) + 10px); }

  .tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
    height: calc(var(--tabbar-h) + var(--safe-b)); padding-bottom: var(--safe-b);
    background: color-mix(in srgb, var(--nav) 94%, transparent); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
    border-top: 1px solid var(--line);
  }
  .tab {
    display: grid; justify-items: center; align-content: center; gap: 3px; color: var(--muted); font-size: .68em; font-weight: 600;
    border: 0; background: none; font-family: inherit; cursor: pointer; padding: 0; position: relative;
  }
  .tab svg { width: 22px; height: 22px; }
  .tab span { line-height: 1.2; }
  .tab.active { color: var(--text); }
  .tab.active svg { color: var(--primary); }
  .tab .count { position: absolute; top: 8px; left: calc(50% + 6px); min-width: 16px; height: 16px; padding: 0 4px; border-radius: 99px; background: var(--warning); color: #111; font-size: .85em; display: grid; place-items: center; }
  .tab-main span.plus { width: 44px; height: 44px; border-radius: 14px; background: var(--primary); color: var(--on-primary); display: grid; place-items: center; box-shadow: 0 6px 16px -6px var(--primary); margin-top: -4px; }
  .tab-main span.plus svg { color: var(--on-primary); width: 22px; height: 22px; }

  /* Feuilles depuis le bas */
  .modal-back { place-items: end stretch; padding: 0; padding-top: 40px; }
  .modal, .modal.wide { max-width: none; max-height: calc(100dvh - 24px); border-radius: 18px 18px 0 0; border-bottom: 0; animation: sheet .24s cubic-bezier(.2, .8, .2, 1); }
  .modal-grip { display: block; width: 38px; height: 4px; border-radius: 4px; background: color-mix(in srgb, var(--text) 22%, transparent); margin: 8px auto 0; flex-shrink: 0; }
  .modal-head { padding: 10px 16px 12px; }
  .modal-body { padding: 16px; }
  .modal-foot { padding: 12px 16px calc(12px + var(--safe-b)); }
  .modal-foot .btn { flex: 1; }
  @keyframes sheet { from { transform: translateY(40%); opacity: .4; } }
}

@media (max-width: 640px) {
  :root { --fs: 14px; }
  input, select, textarea { font-size: 16px; }
  .form-2, .form-3, .perm-grid { grid-template-columns: 1fr; }
  .card-head { padding: 14px 16px; min-height: 0; }
  .card-pad { padding: 16px; }
  .welcome { padding: 18px; }
  .welcome h2 { font-size: 1.25em; }
  .shot { grid-template-columns: 1fr; }
  .shot-head { padding-bottom: 0; }
  .shot-drop { padding: 12px; display: flex; justify-content: flex-start; border-left: 0; }
  .shot img { border-left: 0; border-top: 1px solid var(--line); margin-top: 12px; aspect-ratio: 16 / 9; height: auto; }
  .welcome .btn { width: 100%; }
  .craft-shots { grid-template-columns: 1fr; }
  .section-title { margin: 22px 0 10px; }
  .danger-zone .btn { width: 100%; }
  .logs-top { padding: 10px 16px; flex-wrap: wrap; }
  .logs-top .seg { margin-left: 0; order: 3; width: 100%; }
  .logs-top .seg button { flex: 1; }
  .logs-main { padding: 16px 16px 40px; }
  .filters { grid-template-columns: 1fr 1fr; padding: 14px 16px; }
  .sim-line { grid-template-columns: 1fr 88px; }
  .topbar-title > span { display: none; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
