/* ORYKA Central — console d'administration (§16). Même design system que la caisse : Inter, bleu nuit, vert pétrole. */
@font-face { font-family: Inter; font-weight: 400; font-display: swap; src: url(fonts/inter-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: Inter; font-weight: 500; font-display: swap; src: url(fonts/inter-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family: Inter; font-weight: 600; font-display: swap; src: url(fonts/inter-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: Inter; font-weight: 700; font-display: swap; src: url(fonts/inter-latin-700-normal.woff2) format("woff2"); }

:root {
  --navy: #0F2D5B; --teal: #00B89B; --sky: #3B82F6; --gold: #F4B400; --coral: #FF6B6B; --violet: #7C3AED;
  --bg: #F3F6FA; --surface: #FFFFFF; --surface-2: #F5F7FA; --text: #101827; --muted: #64707F; --line: #E3E8EF;
  --side: #0F2D5B; --side-text: #C2CDE2; --bar: #00967F; --grid: #E8EDF3;
  --teal-soft: rgba(0,184,155,.12); --sky-soft: rgba(59,130,246,.12); --gold-soft: rgba(244,180,0,.18);
  --coral-soft: rgba(255,107,107,.15); --slate-soft: rgba(100,112,127,.14);
  --ok: #0E8A74; --warn: #9A6B00; --bad: #D33E3E;
  --shadow: 0 1px 2px rgba(16,24,39,.05), 0 2px 8px rgba(16,24,39,.06);
  --shadow-lg: 0 10px 30px rgba(15,45,91,.14);
  --ease: cubic-bezier(.2,.8,.2,1);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0E1626; --surface: #162238; --surface-2: #1B2943; --text: #F1F4F8; --muted: #9AA6B8; --line: #26344F;
    --side: #0A1428; --side-text: #AEB9CF; --bar: #18A88F; --grid: #22314B; --ok: #3FD0B2; --warn: #F4B400; --bad: #FF7B7B;
    --shadow: none; --shadow-lg: 0 10px 30px rgba(0,0,0,.35); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0E1626; --surface: #162238; --surface-2: #1B2943; --text: #F1F4F8; --muted: #9AA6B8; --line: #26344F;
  --side: #0A1428; --side-text: #AEB9CF; --bar: #18A88F; --grid: #22314B; --ok: #3FD0B2; --warn: #F4B400; --bad: #FF7B7B;
  --shadow: none; --shadow-lg: 0 10px 30px rgba(0,0,0,.35); color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font: 14px/1.45 Inter, system-ui, sans-serif; background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
button:disabled { opacity: .5; cursor: not-allowed; }
a { color: var(--sky); }
[hidden] { display: none !important; }
.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: scale(.96) translateY(6px); } }
@keyframes grow { from { transform: scaleY(0); } }
@keyframes growx { from { transform: scaleX(0); } }
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- Connexion ---------- */
.login { min-height: 100%; display: grid; grid-template-columns: 1.05fr 1fr; }
.login-art { background: radial-gradient(120% 90% at 10% 0%, #1B4C8F 0%, var(--navy) 55%, #08193A 100%); color: #fff; padding: 56px;
  display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.login-art::after { content: ""; position: absolute; right: -120px; bottom: -120px; width: 420px; height: 420px; border-radius: 50%;
  background: radial-gradient(circle, rgba(0,184,155,.35), transparent 65%); }
.login-art h1 { font-size: 40px; line-height: 1.1; margin: 0 0 14px; letter-spacing: -.5px; }
.login-art p { color: #C9D7EE; max-width: 460px; font-size: 16px; margin: 0; }
.brand { display: flex; align-items: center; gap: 12px; font-weight: 700; letter-spacing: 2px; font-size: 18px; }
.brand img { width: 40px; height: 40px; }
.login-points { display: grid; gap: 14px; position: relative; z-index: 1; }
.login-points div { display: flex; gap: 12px; align-items: center; color: #DCE6F7; animation: rise .5s var(--ease) both; }
.login-points div:nth-child(2) { animation-delay: .08s; } .login-points div:nth-child(3) { animation-delay: .16s; }
.login-points .i { color: var(--teal); }
.login-form { display: grid; place-items: center; padding: 32px 20px; }
.login-card { width: min(400px, 100%); animation: pop .4s var(--ease) both; }
.login-card h2 { font-size: 26px; margin: 0 0 6px; }
.login-card .muted { margin: 0 0 24px; }
@media (max-width: 860px) { .login { grid-template-columns: 1fr; } .login-art { padding: 28px 20px; } .login-art h1 { font-size: 28px; } .login-points { display: none; } }

/* ---------- Champs et boutons ---------- */
label { display: block; font-size: 13px; font-weight: 500; color: var(--muted); margin: 14px 0 6px; }
.field { width: 100%; height: 42px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); outline: none;
  transition: border-color .15s, box-shadow .15s; }
textarea.field { height: auto; min-height: 84px; padding: 10px 12px; resize: vertical; }
.field:focus { border-color: var(--sky); box-shadow: 0 0 0 3px var(--sky-soft); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 10px;
  font-weight: 600; transition: transform .15s var(--ease), box-shadow .15s, background .15s, filter .15s; white-space: nowrap; }
.btn:hover:not(:disabled) { transform: translateY(-1px); }
.btn:active:not(:disabled) { transform: translateY(0) scale(.98); }
.btn-primary { background: var(--teal); color: #fff; box-shadow: 0 4px 14px rgba(0,184,155,.3); }
.btn-primary:hover:not(:disabled) { filter: brightness(1.05); box-shadow: 0 6px 18px rgba(0,184,155,.38); }
.btn-navy { background: var(--navy); color: #fff; }
.btn-ghost { background: var(--surface); border: 1px solid var(--line); }
.btn-ghost:hover:not(:disabled) { border-color: var(--sky); box-shadow: var(--shadow); }
.btn-danger { background: var(--coral-soft); color: var(--bad); }
.btn-block { width: 100%; height: 46px; margin-top: 20px; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn .spin { animation: spin .8s linear infinite; }
.msg { margin-top: 12px; padding: 10px 12px; border-radius: 10px; font-size: 13px; animation: fade .2s both; }
.msg.err { background: var(--coral-soft); color: var(--bad); } .msg.ok { background: var(--teal-soft); color: var(--ok); }

/* ---------- Coque ---------- */
.shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100%; }
.side { background: var(--side); color: var(--side-text); padding: 20px 14px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; }
.side .brand { color: #fff; padding: 4px 8px 22px; font-size: 16px; }
.side .brand small { display: block; font-size: 10px; letter-spacing: 1.5px; color: var(--teal); font-weight: 600; }
.nav { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: var(--side-text); text-align: left; width: 100%;
  transition: background .15s, color .15s, transform .15s var(--ease); position: relative; }
.nav:hover { background: rgba(255,255,255,.07); color: #fff; transform: translateX(2px); }
.nav.on { background: rgba(59,130,246,.22); color: #fff; }
.nav.on::before { content: ""; position: absolute; left: -14px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--teal); }
.nav .count { margin-left: auto; background: var(--coral); color: #fff; font-size: 11px; font-weight: 700; border-radius: 999px; padding: 1px 7px; }
.side-foot { margin-top: auto; padding: 12px 8px 0; border-top: 1px solid rgba(255,255,255,.08); font-size: 12px; }
.main { min-width: 0; }
.top { display: flex; align-items: center; gap: 12px; padding: 18px 28px; position: sticky; top: 0; z-index: 5;
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); }
.top h1 { font-size: 22px; margin: 0; letter-spacing: -.2px; }
.top .crumb { color: var(--muted); font-size: 13px; }
.top .grow { flex: 1; }
.me { display: flex; align-items: center; gap: 10px; padding: 5px 12px 5px 5px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); }
.avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-size: 12px; font-weight: 700; background: var(--navy); }
.icon-btn { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--line);
  transition: transform .15s var(--ease), border-color .15s; }
.icon-btn:hover { transform: translateY(-1px); border-color: var(--sky); }
.view { padding: 4px 28px 40px; animation: rise .35s var(--ease) both; }
.menu-btn { display: none; }
@media (max-width: 980px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 20; left: 0; width: 250px; transform: translateX(-100%); transition: transform .25s var(--ease); }
  .side.open { transform: none; box-shadow: var(--shadow-lg); }
  .menu-btn { display: grid; }
  .top, .view { padding-left: 16px; padding-right: 16px; }
  .me #meName { display: none; }
  .me { padding: 4px; }
  .top h1 { font-size: 18px; }
}

/* ---------- Cartes, indicateurs ---------- */
.grid { display: grid; gap: 16px; }
.kpis { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); margin-bottom: 16px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 18px; box-shadow: var(--shadow);
  animation: rise .4s var(--ease) both; animation-delay: calc(var(--i, 0) * 50ms); transition: transform .2s var(--ease), box-shadow .2s; min-width: 0; }
.card.hover:hover, .kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.card h3 { margin: 0 0 12px; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.card h3 .grow { flex: 1; }
.kpi .lbl { color: var(--muted); font-size: 13px; display: flex; align-items: center; gap: 8px; }
.kpi .lbl .i { color: var(--teal); }
.kpi .val { font-size: 28px; font-weight: 700; margin-top: 6px; letter-spacing: -.5px; font-variant-numeric: tabular-nums; }
.kpi .sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.cols-2 { grid-template-columns: 1.6fr 1fr; }
.cols-even { grid-template-columns: 1fr 1fr; }
@media (max-width: 1100px) { .cols-2, .cols-even { grid-template-columns: 1fr; } }
.muted { color: var(--muted); }
.empty { color: var(--muted); padding: 22px 6px; text-align: center; }
.skel { height: 90px; border-radius: 14px; background: linear-gradient(90deg, var(--surface) 25%, var(--surface-2) 50%, var(--surface) 75%);
  background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }

/* ---------- Badges et statuts (toujours icône/texte, jamais la couleur seule) ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.b-ok { background: var(--teal-soft); color: var(--ok); } .b-warn { background: var(--gold-soft); color: var(--warn); }
.b-bad { background: var(--coral-soft); color: var(--bad); } .b-info { background: var(--sky-soft); color: var(--sky); }
.b-mute { background: var(--slate-soft); color: var(--muted); }

/* ---------- Tableaux ---------- */
.table-wrap { overflow-x: auto; margin: 0 -18px -18px; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .4px;
  padding: 10px 18px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 12px 18px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr { transition: background .12s; }
tbody tr.link { cursor: pointer; }
tbody tr.link:hover { background: var(--surface-2); }
tbody tr.link:hover td:first-child b { color: var(--sky); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar .field { max-width: 320px; height: 38px; }
.toolbar .grow { flex: 1; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-size: 13px; transition: all .15s var(--ease); }
.chip:hover { border-color: var(--sky); }
.chip.on { background: var(--navy); color: #fff; border-color: var(--navy); }

/* ---------- Graphique ---------- */
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: 220px; overflow: visible; }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 11px; }
.chart .bar { fill: var(--bar); transform-origin: bottom; transform-box: fill-box; animation: grow .6s var(--ease) both; transition: opacity .15s; }
.chart .hit { fill: transparent; cursor: default; }
.chart .hit:hover + .bar, .chart g.on .bar { opacity: 1; }
.chart:hover .bar { opacity: .55; }
.chart g.on .bar { opacity: 1; }
.chart .tip { position: absolute; pointer-events: none; background: var(--navy); color: #fff; padding: 8px 10px; border-radius: 8px; font-size: 12px;
  white-space: nowrap; transform: translate(-50%, -110%); box-shadow: var(--shadow-lg); transition: opacity .12s; }
.chart .tip b { display: block; font-size: 14px; }

/* ---------- Fiche client ---------- */
.head-card { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.head-card .big-avatar { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; font-size: 20px; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, var(--navy), #1F5BB0); }
.head-card h2 { margin: 0; font-size: 22px; }
.head-card .grow { flex: 1; min-width: 200px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 13.5px; }
.kv:last-child { border-bottom: 0; } .kv span { color: var(--muted); } .kv b { text-align: right; }
.lag { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; }
.lag .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.lag.fresh { color: var(--ok); } .lag.late { color: var(--warn); } .lag.stale { color: var(--bad); }
.code { font-family: ui-monospace, Consolas, monospace; font-size: 26px; letter-spacing: 3px; font-weight: 700; text-align: center; padding: 16px;
  border-radius: 12px; background: var(--surface-2); border: 1px dashed var(--line); margin: 12px 0; user-select: all; }

/* ---------- Formules ---------- */
.plans { grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); }
.plan { position: relative; overflow: hidden; }
.plan::before { content: ""; position: absolute; inset: 0 0 auto; height: 4px; background: var(--c, var(--teal)); }
.plan h3 { font-size: 18px; }
.feat { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 8px; border: 1px solid var(--line); margin-top: 6px; cursor: pointer;
  transition: background .15s, transform .15s var(--ease); user-select: none; }
.feat:hover { transform: translateX(3px); }
.feat input { accent-color: var(--teal); width: 16px; height: 16px; }
.feat.on { background: var(--teal-soft); border-color: transparent; }
.price-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ---------- Fenêtre, notifications ---------- */
.overlay { position: fixed; inset: 0; background: rgba(8,20,40,.5); display: grid; place-items: center; z-index: 50; padding: 16px; animation: fade .15s both; }
.modal { width: min(520px, 100%); max-height: calc(100vh - 32px); overflow: auto; background: var(--surface); border-radius: 16px; padding: 22px;
  box-shadow: var(--shadow-lg); animation: pop .25s var(--ease) both; }
.modal h3 { margin: 0 0 4px; font-size: 18px; }
.modal .row { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }
.modal .two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.toasts { position: fixed; right: 18px; bottom: 18px; display: grid; gap: 8px; z-index: 60; }
.toast { background: var(--navy); color: #fff; padding: 12px 16px; border-radius: 12px; box-shadow: var(--shadow-lg); min-width: 260px; max-width: 380px;
  animation: pop .25s var(--ease) both; display: flex; gap: 10px; align-items: flex-start; }
.toast.err { background: var(--bad); }
.toast small { display: block; opacity: .8; }

/* ---------- Gestion à distance ---------- */
.tabs { display: flex; gap: 4px; padding: 4px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); width: fit-content; max-width: 100%; overflow-x: auto; margin-bottom: 16px; }
.tab { padding: 8px 14px; border-radius: 9px; font-weight: 600; color: var(--muted); white-space: nowrap; display: inline-flex; gap: 8px; align-items: center; transition: background .15s, color .15s; }
.tab:hover { color: var(--text); }
.tab.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(15,45,91,.12); }
.tab .n { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--gold-soft); color: var(--text); font-size: 11.5px; display: inline-grid; place-items: center; }
.switch { position: relative; width: 40px; height: 23px; flex: none; display: inline-block; margin: 0; cursor: pointer; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; border-radius: 12px; background: var(--line); transition: background .2s; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 17px; height: 17px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s; }
.switch input:checked + span { background: var(--teal); }
.switch input:checked + span::after { transform: translateX(17px); }
.switch input:focus-visible + span { outline: 2px solid var(--sky); outline-offset: 2px; }
.price-in { width: 120px; height: 36px; text-align: right; font-variant-numeric: tabular-nums; }
.price-in.changed { border-color: var(--gold); background: var(--gold-soft); }
.row-actions { display: inline-flex; gap: 6px; align-items: center; justify-content: flex-end; }
.pending-tag { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; color: var(--muted); }
.pending-tag .i { width: 13px; height: 13px; animation: spin 1.6s linear infinite; }
.level { display: inline-flex; align-items: center; gap: 8px; min-width: 150px; }
.level .bar { flex: 1; height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.level .bar i { display: block; height: 100%; border-radius: 3px; background: var(--teal); transform-origin: left; animation: growx .6s ease both; }
.level.low .bar i { background: var(--gold); } .level.out .bar i { background: var(--coral); }
.promos { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.promo { display: flex; flex-direction: column; gap: 8px; }
.promo .top-line { display: flex; align-items: center; gap: 10px; }
.promo .top-line b { flex: 1; font-size: 15px; }
.promo .val { font-size: 22px; font-weight: 700; color: var(--teal); }
.promo.off { opacity: .62; }
.days { display: flex; gap: 6px; flex-wrap: wrap; }
.days label { margin: 0; }
.days input { display: none; }
.days span { display: inline-grid; place-items: center; width: 40px; height: 34px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); font-weight: 600; cursor: pointer; transition: background .15s, color .15s; }
.days input:checked + span { background: var(--teal); border-color: var(--teal); color: #fff; }
.snapshot-note { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.est-select { width: auto; min-width: 220px; }
@media (max-width: 720px) { .price-in { width: 96px; } .level { min-width: 110px; } }
@media (max-width: 720px) { .hide-sm { display: none; } .view .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } .kpi .val { font-size: 22px; } }
.progress { height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; margin-top: 12px; }
.progress i { display: block; height: 100%; width: 0; background: var(--teal); transition: width .2s; }

/* Paiements Wave */
.mono { font-family: ui-monospace, Consolas, monospace; letter-spacing: .3px; }
.warn-card { display: flex; gap: 12px; align-items: flex-start; border-left: 4px solid var(--warn); margin-bottom: 16px; }
.warn-card > svg.i { color: var(--warn); flex: none; margin-top: 2px; }
