/* Pointeuse — feuille de style unique. Mobile d'abord, mode sombre automatique. */
:root {
  --bg: #f3f0e8;
  --surface: #fffdf8;
  --surface-2: #f8f5ee;
  --ink: #1c1b17;
  --muted: #6e695d;
  --line: #e3ddd0;
  --accent: #2448c9;
  --accent-ink: #ffffff;
  --accent-soft: #e4e9fb;
  --out: #1c1b17;
  --out-ink: #fffdf8;
  --pos: #1d7044;
  --pos-soft: #dff0e5;
  --neg: #b8322a;
  --neg-soft: #f8e1de;
  --warn: #9a5b00;
  --warn-soft: #fbedd3;
  --radius: 18px;
  --shadow: 0 1px 0 rgba(28, 27, 23, .04), 0 8px 24px -12px rgba(28, 27, 23, .18);
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111210;
    --surface: #1a1b18;
    --surface-2: #22231f;
    --ink: #f1eee6;
    --muted: #9c978a;
    --line: #2e2f2a;
    --accent: #7d97ff;
    --accent-ink: #0d1330;
    --accent-soft: #1f2747;
    --out: #f1eee6;
    --out-ink: #111210;
    --pos: #5fcf8f;
    --pos-soft: #183324;
    --neg: #ff8a7d;
    --neg-soft: #3a1d1a;
    --warn: #f0b555;
    --warn-soft: #3a2c12;
    --shadow: 0 1px 0 rgba(0, 0, 0, .3), 0 10px 30px -14px rgba(0, 0, 0, .6);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.45 var(--font); font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
body.modal-open { overflow: hidden; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
h1, h2, h3 { margin: 0; letter-spacing: -.01em; }
.muted { color: var(--muted); }
.center { text-align: center; margin: -4px 0 12px; }

.app { max-width: 560px; margin: 0 auto; padding: env(safe-area-inset-top, 0px) 16px calc(92px + var(--safe-b)); }

/* ---- barre du haut ---- */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 2px 6px; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; letter-spacing: -.02em; font-size: 17px; }
.logo { width: 22px; height: 22px; border-radius: 50%; border: 2.5px solid var(--ink); position: relative; }
.logo::after { content: ""; position: absolute; left: 50%; top: 3px; width: 2.5px; height: 7px; background: var(--accent); border-radius: 2px; transform: translateX(-50%); }
.status { font-size: 12.5px; color: var(--muted); padding: 4px 10px; border-radius: 99px; background: var(--surface); border: 1px solid var(--line); white-space: nowrap; }
.status-online { color: var(--pos); }
.status-offline, .status-auth { color: var(--warn); background: var(--warn-soft); border-color: transparent; }

/* ---- onglets ---- */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: grid; grid-template-columns: repeat(4, 1fr);
  max-width: 560px; margin: 0 auto;
  padding: 6px 8px calc(8px + var(--safe-b));
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
}
.tabs a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0; font-size: 11.5px; color: var(--muted); border-radius: 12px; }
.tabs a svg { width: 22px; height: 22px; }
.tabs a.active { color: var(--ink); font-weight: 600; }
.tabs a.active svg { color: var(--accent); }

/* ---- cartes ---- */
.card { background: var(--surface); border-radius: var(--radius); padding: 16px; margin: 12px 0; box-shadow: var(--shadow); border: 1px solid var(--line); }
.card.flush { padding: 4px 0; overflow: hidden; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 10px; }
.card h2 { font-size: 15px; }
.link { color: var(--accent); font-weight: 600; font-size: 14px; }
.empty { color: var(--muted); margin: 4px 0; font-size: 15px; }
.kv { display: flex; align-items: center; justify-content: space-between; padding: 7px 0; font-size: 15px; }
.kv b small { color: var(--muted); font-weight: 500; }
.kv.sub { color: var(--muted); font-size: 14px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 8px 0; }
.page-title { font-size: 26px; margin: 10px 2px 4px; letter-spacing: -.02em; }

.chip { display: inline-block; min-width: 54px; text-align: center; padding: 2px 8px; border-radius: 99px; font-size: 13px; font-weight: 650; }
.chip.pos { color: var(--pos); background: var(--pos-soft); }
.chip.neg { color: var(--neg); background: var(--neg-soft); }
.chip.zero { color: var(--muted); background: var(--surface-2); }
.chip.ghost { color: var(--muted); background: transparent; }
.chip.big { font-size: 15px; padding: 3px 10px; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 6px; background: var(--accent-soft); color: var(--accent); font-size: 12.5px; font-weight: 600; margin-right: 6px; }
.badge-line { margin: 10px 0 0; color: var(--muted); font-size: 14px; }

/* ---- Aujourd'hui ---- */
.hero { text-align: center; padding: 8px 0 4px; }
.hero.small { padding: 18px 0 6px; }
.hero-date { color: var(--muted); margin: 6px 0 0; font-size: 15px; }
.dial { position: relative; width: min(64vw, 240px); aspect-ratio: 1; margin: 10px auto 6px; }
.ring { width: 100%; height: 100%; }
.ring-bg { fill: none; stroke: var(--line); stroke-width: 12; }
.ring-fg { fill: none; stroke: var(--accent); stroke-width: 12; stroke-linecap: round; transition: stroke-dashoffset .6s cubic-bezier(.2, .8, .2, 1); }
.ring-fg.over { stroke: var(--pos); }
.dial-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.dial-v { font-size: clamp(40px, 12vw, 54px); font-weight: 720; letter-spacing: -.04em; line-height: 1; }
.dial-t { color: var(--muted); font-size: 15px; margin-top: 6px; }
.hero-status { margin: 4px 0 0; font-size: 16px; display: flex; align-items: center; justify-content: center; gap: 8px; }
.hero-hint { margin: 2px 0 14px; color: var(--muted); font-size: 15px; min-height: 1.45em; }
.hero-hint .chip { margin-left: 4px; }
.pulse { width: 9px; height: 9px; border-radius: 50%; background: var(--pos); box-shadow: 0 0 0 0 color-mix(in srgb, var(--pos) 60%, transparent); animation: pulse 1.8s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 9px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
.big-num { font-size: 52px; font-weight: 720; letter-spacing: -.04em; margin: 2px 0; }
.big-num.pos { color: var(--pos); } .big-num.neg { color: var(--neg); }

.punch {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  padding: 20px 22px; border-radius: 20px; font-size: 19px; font-weight: 700; letter-spacing: -.01em;
  background: var(--accent); color: var(--accent-ink);
  box-shadow: 0 10px 24px -10px color-mix(in srgb, var(--accent) 70%, transparent);
  transition: transform .08s ease, filter .15s;
}
.punch small { font-size: 15px; font-weight: 600; opacity: .8; }
.punch.out { background: var(--out); color: var(--out-ink); box-shadow: 0 10px 24px -12px rgba(0, 0, 0, .5); }
.punch:active { transform: scale(.98); filter: brightness(.95); }

.slots { list-style: none; margin: 0; padding: 0; }
.slots li { display: flex; justify-content: space-between; padding: 9px 0; border-top: 1px solid var(--line); font-size: 16px; }
.slots li:first-child { border-top: 0; }
.slots i { color: var(--muted); font-style: normal; margin: 0 2px; }
.slots em { color: var(--pos); font-style: normal; font-weight: 600; }

.strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 6px; margin-bottom: 8px; }
.sd { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 2px; border-radius: 12px; background: var(--surface-2); }
.sd .chip { min-width: 0; font-size: 11.5px; padding: 1px 6px; white-space: nowrap; }
.sd-wd { font-size: 12px; color: var(--muted); text-transform: capitalize; }
.sd-v { font-weight: 650; font-size: 14.5px; }
.sd.is-today { outline: 2px solid var(--accent); outline-offset: -2px; }
.sd.is-future .sd-v { color: var(--muted); }

.alert { display: flex; gap: 10px; align-items: center; width: 100%; text-align: left; margin: 10px 0 0; padding: 12px 14px; border-radius: 14px; background: var(--warn-soft); color: var(--warn); font-size: 14.5px; }

/* ---- Semaine ---- */
.pager { display: flex; align-items: center; justify-content: space-between; margin: 10px 0 8px; }
.pager-title { text-align: center; }
.pager-title h1 { font-size: 24px; letter-spacing: -.02em; }
.pager-title p { margin: 0; color: var(--muted); font-size: 14px; }
.icon-btn { display: inline-grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; background: var(--surface); border: 1px solid var(--line); }
.icon-btn.sm { width: 36px; height: 36px; }
.icon-btn.sm svg { width: 18px; height: 18px; }

.day-row { display: grid; grid-template-columns: 46px 1fr auto; gap: 12px; align-items: center; width: 100%; text-align: left; padding: 12px 16px; border-top: 1px solid var(--line); }
.day-row:first-child { border-top: 0; }
.day-row:active { background: var(--surface-2); }
.day-row.is-today { background: color-mix(in srgb, var(--accent-soft) 55%, transparent); }
.day-row.is-future { opacity: .6; }
.dr-date { display: flex; flex-direction: column; align-items: center; line-height: 1.1; }
.dr-date b { font-size: 12px; color: var(--muted); text-transform: capitalize; font-weight: 600; }
.dr-date span { font-size: 21px; font-weight: 700; letter-spacing: -.02em; }
.dr-slots { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 14.5px; min-width: 0; }
.slot { white-space: nowrap; }
.warn { color: var(--warn); font-size: 13px; display: inline-flex; align-items: center; gap: 4px; }
.warn svg { width: 15px; height: 15px; }
.dr-num { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.dr-num b { font-size: 16px; }
.dr-num small { color: var(--muted); font-size: 12.5px; }

.actions { display: grid; gap: 10px; margin: 14px 0; }
.actions.inline { grid-template-columns: 1fr 1fr; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 13px 16px; border-radius: 14px; font-weight: 650; font-size: 15.5px; background: var(--ink); color: var(--bg); border: 1px solid var(--ink); }
.btn.ghost { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn.danger { background: var(--surface); color: var(--neg); border-color: var(--neg-soft); }
.btn.full { width: 100%; margin-top: 10px; }
.btn.file { position: relative; overflow: hidden; }
.btn.file input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* ---- Historique ---- */
.group-head { display: flex; align-items: baseline; justify-content: space-between; margin: 20px 2px 0; }
.group-head h2 { font-size: 15px; color: var(--muted); font-weight: 650; }
.wk { display: grid; grid-template-columns: 1fr 70px auto; align-items: center; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--line); }
.wk:first-child { border-top: 0; }
.wk-l { display: flex; flex-direction: column; line-height: 1.25; }
.wk-l span { color: var(--muted); font-size: 13.5px; }
.wk-l em { font-style: normal; font-weight: 600; font-size: 11.5px; color: var(--accent); margin-left: 4px; }
.wk-bar { height: 6px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.wk-bar i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.wk-bar i.pos { background: var(--pos); } .wk-bar i.neg { background: var(--neg); }
.wk-n { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }

/* ---- Réglages ---- */
.form h2 { margin-bottom: 8px; }
.form label { display: flex; flex-direction: column; gap: 5px; font-size: 14px; color: var(--muted); margin: 10px 0; }
.form label small { font-weight: 400; }
.form input:not([type=checkbox]):not([type=file]), .form textarea, .mark-edit select, .sheet input, .sheet select {
  width: 100%; padding: 11px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); font-size: 16px;
}
.form textarea { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 14px; resize: vertical; }
.form .btn { width: 100%; margin-top: 6px; }
.help { color: var(--muted); font-size: 14px; margin: 0 0 6px; }
.login { margin-top: 24px; }
.login-error { color: var(--neg); min-height: 1.2em; }
.help code { background: var(--surface-2); padding: 1px 5px; border-radius: 5px; font-size: 13px; }
.targets { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.targets label { margin: 4px 0; }
.targets input { padding: 9px 6px !important; text-align: center; }
.check { flex-direction: row !important; align-items: center; gap: 10px !important; color: var(--ink) !important; font-size: 15.5px !important; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }
.sched { list-style: none; padding: 0; margin: 12px 0 0; }
.sched li { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-top: 1px solid var(--line); font-size: 14.5px; }
.sched li span { flex: 1; }
details { margin-top: 12px; }
summary { cursor: pointer; font-weight: 600; font-size: 15px; padding: 6px 0; }
.foot { text-align: center; color: var(--muted); font-size: 12.5px; }

/* ---- éditeur de journée ---- */
.modal { position: fixed; inset: 0; z-index: 30; background: rgba(10, 10, 8, .45); display: flex; align-items: flex-end; justify-content: center; animation: fade .15s; }
.modal[hidden] { display: none; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(24px); opacity: .4; } }
.sheet { width: 100%; max-width: 560px; max-height: 92vh; overflow: auto; background: var(--surface); border-radius: 22px 22px 0 0; padding: 18px 18px calc(18px + var(--safe-b)); animation: rise .2s cubic-bezier(.2, .8, .2, 1); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.sheet-head h2 { font-size: 19px; }
.sheet-sum { display: flex; align-items: center; gap: 14px; margin: 10px 0 4px; color: var(--muted); font-size: 14.5px; flex-wrap: wrap; }
.sheet-sum b { color: var(--ink); }
.sheet h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 18px 0 8px; }
.se { display: grid; grid-template-columns: 1fr auto 1fr auto; gap: 8px; align-items: center; margin-bottom: 8px; }
.se span { color: var(--muted); }
.mark-edit { display: grid; grid-template-columns: 1.3fr 1fr; gap: 8px; margin-bottom: 8px; }
.sheet input:disabled, .sheet select:disabled { opacity: .45; }

/* ---- toast ---- */
.toast {
  position: fixed; left: 50%; bottom: calc(86px + var(--safe-b)); z-index: 40;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  display: flex; align-items: center; gap: 14px; width: max-content; max-width: calc(100% - 32px);
  padding: 12px 16px; border-radius: 14px; background: var(--ink); color: var(--bg); font-size: 15px;
  transition: opacity .2s, transform .2s; box-shadow: 0 12px 30px -10px rgba(0, 0, 0, .45);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast span { flex: 1; }
.toast button { color: var(--accent-soft); font-weight: 700; white-space: nowrap; }
@media (prefers-color-scheme: dark) { .toast span { flex: 1; }
.toast button { color: var(--accent-ink); } }

/* ---- relevé ---- */
body.is-report { background: var(--surface-2); }
body.is-report .app { max-width: 900px; padding-bottom: 40px; }
.report-bar { position: sticky; top: 0; z-index: 5; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 12px 0; background: var(--surface-2); }
.report-bar .btn { padding: 10px 14px; font-size: 14.5px; }
.report-bar .btn:last-child { margin-left: auto; }
.report-bar .check { display: flex; font-size: 14px; }
.report { overflow-x: auto; background: #fff; color: #111; border-radius: 6px; padding: 32px 30px; box-shadow: var(--shadow); font-size: 13.5px; }
.r-head { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; border-bottom: 2px solid #111; padding-bottom: 14px; margin-bottom: 18px; }
.r-kicker { text-transform: uppercase; letter-spacing: .12em; font-size: 11px; margin: 0 0 4px; color: #555; }
.r-head h1 { font-size: 24px; letter-spacing: -.02em; }
.r-head p { margin: 4px 0 0; color: #333; }
.r-head dl { display: grid; grid-template-columns: auto auto; gap: 3px 14px; margin: 0; align-content: start; }
.r-head dt { color: #666; } .r-head dd { margin: 0; font-weight: 600; }
.r-table { width: 100%; border-collapse: collapse; }
.r-table th, .r-table td { padding: 7px 8px; border-bottom: 1px solid #ddd; text-align: left; vertical-align: top; }
.r-table th { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: #555; border-bottom: 1.5px solid #111; }
.r-table .n { text-align: right; white-space: nowrap; }
.r-table .nw { white-space: nowrap; }
.r-table tr.future td { color: #999; }
.r-table tr.sub td { background: #f3f3f3; font-weight: 600; font-size: 12.5px; }
.r-table tfoot td { font-weight: 700; border-top: 2px solid #111; border-bottom: 0; padding-top: 10px; }
.r-balance { margin: 16px 0 0; }
.r-sign { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 34px; }
.r-sign div { border: 1px solid #bbb; border-radius: 4px; height: 88px; padding: 8px 10px; }
.r-sign span { font-size: 11.5px; color: #555; }
.r-foot { margin-top: 22px; font-size: 11px; color: #777; }
.report .muted { color: #999; }

@media (max-width: 600px) {
  .report { padding: 20px 14px; font-size: 12.5px; }
  .r-table th, .r-table td { padding: 6px 4px; }
  .r-table th { font-size: 9.5px; letter-spacing: .02em; }
  .r-head h1 { font-size: 20px; }
}

@media print {
  @page { size: A4; margin: 14mm; }
  body, body.is-report { background: #fff; }
  .no-print, .tabs, .top, .toast, .modal { display: none !important; }
  .app, body.is-report .app { max-width: none; padding: 0; margin: 0; }
  .report { box-shadow: none; border-radius: 0; padding: 0; font-size: 11.5pt; }
  .r-table tr { break-inside: avoid; }
  .r-sign { break-inside: avoid; }
}

@media (min-width: 720px) {
  .app { padding-top: 8px; }
  .dial { width: 220px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
