:root {
  --bg: #f6f3ee; --panel: #fffdf9; --panel-2: #f0ebe3; --fg: #1d1a16; --muted: #6f675d; --line: #e4ddd2;
  --accent: #c2410c; --accent-ink: #fff; --accent-soft: #fbe6da;
  --ok: #15803d; --ok-soft: #dcf3e3; --bad: #b91c1c; --bad-soft: #fbe1e1; --warn: #a16207;
  --serif: "Fraunces", Georgia, "Times New Roman", serif; --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --r: 14px; --shadow: 0 1px 2px rgb(0 0 0 / .04), 0 8px 24px rgb(0 0 0 / .05);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12110f; --panel: #1b1a17; --panel-2: #24221e; --fg: #f1ece4; --muted: #a39b8f; --line: #2f2c27;
    --accent: #f08a4b; --accent-ink: #1b1209; --accent-soft: #3a2417;
    --ok: #4ade80; --ok-soft: #173622; --bad: #f87171; --bad-soft: #3b1b1b; --warn: #facc15;
    --shadow: 0 1px 2px rgb(0 0 0 / .3); color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 15px/1.5 var(--sans); }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.wrap { max-width: 1040px; margin: 0 auto; padding: 20px 16px 64px; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 22px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; }
.logo { width: 34px; height: 34px; border-radius: 10px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-family: var(--serif); font-size: 18px; }
.hello { font-family: var(--serif); font-size: clamp(1.6rem, 4vw, 2.2rem); font-weight: 400; margin: 0; letter-spacing: -0.01em; }
.sub { color: var(--muted); font-size: 13px; }
.h2 { font-family: var(--serif); font-weight: 400; font-size: 1.45rem; margin: 0; }
.eyebrow { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.section { margin-top: 34px; display: flex; flex-direction: column; gap: 14px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; border-bottom: 1px solid var(--line); padding-bottom: 8px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; box-shadow: var(--shadow); min-width: 0; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.grid-2 { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.big { font-family: var(--serif); font-size: clamp(2.4rem, 7vw, 3.6rem); line-height: 1.05; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.mid { font-family: var(--serif); font-size: 1.8rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.btn { border: 1px solid var(--line); background: var(--panel); border-radius: 999px; padding: 8px 16px; cursor: pointer; }
.btn:hover { background: var(--panel-2); }
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; font-weight: 600; }
.btn-primary:hover { background: var(--accent); filter: brightness(1.06); }
.btn-xl { font-size: 1.1rem; padding: 16px 28px; border-radius: 16px; min-width: 260px; }
.btn-stop { background: var(--fg); color: var(--bg); border-color: transparent; font-weight: 600; }
.btn-stop:hover { background: var(--fg); filter: brightness(1.15); }
.btn:disabled { opacity: .55; cursor: wait; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; color: var(--muted); }
.input, textarea.input, select.input { width: 100%; border: 1px solid var(--line); background: var(--bg); border-radius: 10px; padding: 10px 12px; }
.input:focus, .btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
textarea.input { min-height: 110px; resize: vertical; }
.err { color: var(--bad); font-size: 14px; min-height: 1.2em; }
.login { max-width: 380px; margin: 10vh auto 0; display: flex; flex-direction: column; gap: 16px; }
.login .card { display: flex; flex-direction: column; gap: 14px; }

/* Shift */
.shift { position: relative; overflow: hidden; display: grid; gap: 22px; grid-template-columns: minmax(0, 1fr); padding: 28px; }
.shift::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--line); }
.shift.on::before { background: var(--ok); }
.state { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); }
.on .dot { background: var(--ok); box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 60%, transparent); animation: pulse 2s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 10px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
@media (prefers-reduced-motion: reduce) { .on .dot { animation: none; } }
.timer { font-family: var(--serif); font-size: clamp(3rem, 11vw, 5.2rem); line-height: 1; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px 18px; }
.kpi { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.kpi span { font-size: 12px; color: var(--muted); }
.kpi b { font-size: 1.2rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.kpi b.hl { font-family: var(--serif); font-weight: 400; font-size: 1.7rem; color: var(--accent); }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.note { font-size: 13px; color: var(--muted); }
.done { background: var(--ok-soft); border-radius: 12px; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.done h3 { margin: 0; font-family: var(--serif); font-weight: 400; font-size: 1.3rem; }

/* Paie */
.pay { display: flex; flex-direction: column; gap: 8px; }
.pay .big { color: var(--accent); }
.bars { display: flex; align-items: flex-end; gap: 8px; height: 110px; margin-top: 6px; }
.bar { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; height: 100%; justify-content: flex-end; }
.bar i { display: block; width: 100%; max-width: 46px; border-radius: 6px 6px 2px 2px; background: color-mix(in srgb, var(--accent) 35%, transparent); min-height: 2px; }
.bar.cur i { background: var(--accent); }
.bar small { font-size: 11px; color: var(--muted); white-space: nowrap; }
.bar em { font-style: normal; font-size: 11px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 999px; font-size: 12px; background: var(--panel-2); color: var(--muted); white-space: nowrap; }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.acc { background: var(--accent-soft); color: var(--accent); }
.chip.bad { background: var(--bad-soft); color: var(--bad); }

/* Stats */
.tile { display: flex; flex-direction: column; gap: 4px; }
.tile .mid { color: var(--fg); }
.spark { width: 100%; height: 90px; display: block; }

/* Historique */
.shifts { display: flex; flex-direction: column; gap: 10px; }
.srow { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 16px; align-items: start; }
.srow .when strong { display: block; font-weight: 600; }
.srow .when span { color: var(--muted); font-size: 13px; }
.srow .amt { text-align: right; }
.srow .amt b { font-family: var(--serif); font-weight: 400; font-size: 1.5rem; font-variant-numeric: tabular-nums; }
.srow .chips { grid-column: 1 / -1; display: flex; gap: 6px; flex-wrap: wrap; }
.comment { grid-column: 1 / -1; font-size: 14px; background: var(--panel-2); border-radius: 10px; padding: 10px 12px; white-space: pre-wrap; overflow-wrap: anywhere; }
.comment.empty { color: var(--muted); font-style: italic; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; font-size: 13px; }
.srow > .linkbtn, .srow > .actions, .srow > textarea { grid-column: 1 / -1; justify-self: start; }
.srow > textarea { justify-self: stretch; }
.done .btn { align-self: flex-start; min-width: 120px; }
.wallet { display: inline-flex; align-items: center; gap: 8px; }
code, code.wallet { font: 12.5px/1.4 ui-monospace, "Cascadia Mono", Consolas, monospace; background: var(--panel-2); border-radius: 6px; padding: 2px 6px; overflow-wrap: anywhere; }
.note code.wallet { display: inline; }
.empty-state { color: var(--muted); padding: 18px 0; }

/* Admin */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r); background: var(--panel); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 500; white-space: nowrap; }
td.r, th.r { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
.form-row { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); align-items: end; }
.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--fg); color: var(--bg); padding: 10px 18px; border-radius: 999px; font-size: 14px; box-shadow: var(--shadow); z-index: 10; }

/* Suivi des fans */
a.btn { text-decoration: none; display: inline-flex; align-items: center; }
.fa-intro { margin: -8px 0 16px; max-width: 75ch; }
.fa-tools { display: flex; flex-direction: column; gap: 10px; position: sticky; top: 0; z-index: 2; background: var(--bg); padding: 8px 0; }
.fa-piles { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: thin; }
.fa-pile { flex: none; border: 1px solid var(--line); background: var(--panel); border-radius: 999px; padding: 7px 14px; cursor: pointer; font-size: 14px; white-space: nowrap; }
.fa-pile b { font-weight: 600; font-variant-numeric: tabular-nums; margin-left: 2px; color: var(--muted); }
.fa-pile.on { background: var(--fg); color: var(--bg); border-color: transparent; }
.fa-pile.on b { color: inherit; }
.fa-pile.hot:not(.on) { border-color: var(--bad); }
.fa-pile.hot:not(.on) b { color: var(--bad); }
.fa-filters { display: grid; grid-template-columns: minmax(0, 220px) minmax(0, 1fr); gap: 8px; }
.fa-list { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 440px), 1fr)); }
.fa-card { display: flex; flex-direction: column; gap: 12px; padding: 16px; position: relative; overflow: hidden; }
.fa-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--line); }
.fa-card.s-vendre::before { background: var(--accent); }
.fa-card.s-fideliser::before { background: var(--ok); }
.fa-card.s-relancer::before { background: var(--warn); }
.fa-card.lost { opacity: .85; }
.fa-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: start; }
.fa-who { display: flex; flex-direction: column; min-width: 0; }
.fa-who strong { font-size: 1.05rem; overflow-wrap: anywhere; }
.fa-who .muted, .fa-amt .muted { font-size: 12.5px; }
.fa-amt { text-align: right; display: flex; flex-direction: column; }
.fa-amt b { font-family: var(--serif); font-weight: 400; font-size: 1.6rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.fa-seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.fa-sbtn { border: 1px solid var(--line); background: var(--bg); border-radius: 10px; padding: 10px 6px; cursor: pointer; font-weight: 500; font-size: 14px; }
.fa-sbtn:hover { background: var(--panel-2); }
.fa-sbtn.vendre.on { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.fa-sbtn.fideliser.on { background: var(--ok); color: var(--panel); border-color: transparent; }
.fa-sbtn.relancer.on { background: var(--warn); color: var(--panel); border-color: transparent; }
.fa-rem { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; font-size: 13px; }
.fa-chipbtn { border: 1px solid var(--line); background: var(--panel); border-radius: 999px; padding: 4px 10px; cursor: pointer; font-size: 13px; }
.fa-chipbtn.on { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.fa-date { border: 1px solid var(--line); background: var(--panel); border-radius: 999px; padding: 3px 10px; font-size: 13px; }
.fa-notes { display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--line); padding-top: 10px; }
.fa-note { background: var(--panel-2); border-radius: 10px; padding: 8px 12px; display: flex; flex-wrap: wrap; gap: 2px 10px; align-items: baseline; }
.fa-note p { margin: 0; flex-basis: 100%; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; }
.fa-note .muted { font-size: 12px; }
.fa-notes > .linkbtn { align-self: flex-start; }
.fa-addnote { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.fa-addnote .input { padding: 8px 12px; }
.fa-sbtn:focus-visible, .fa-pile:focus-visible, .fa-chipbtn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
@media (max-width: 560px) { .fa-filters { grid-template-columns: 1fr; } .fa-sbtn { font-size: 13px; padding: 10px 4px; } }
@media (max-width: 560px) { .btn-xl { width: 100%; min-width: 0; } .shift { padding: 20px; } }
