/* Concept : pointeuse de cuisine. Papier froid, encre verte très sombre, heures en chasse fixe.
   Un seul geste fort : le gros bouton de pointage sur téléphone. Le reste reste calme. */
:root {
  --bg: #edf1ee; --surface: #ffffff; --surface2: #f4f7f5; --ink: #14201b; --muted: #58675f; --line: #d5ddd8;
  --accent: #0d6b4c; --accent-ink: #ffffff; --accent-soft: #d9eee5;
  --warn: #8f5400; --warn-soft: #fbeed1; --bad: #a3302a; --bad-soft: #f8e0dd;
  --c-x: #58675f; --c-f: #8f5400; --c-v: #1f5fa8; --c-m: #7a3fa0; --c-a: #a3302a; --c-d: #2f6b6e;
  --f-display: 'IBM Plex Sans Condensed', 'Arial Narrow', system-ui, sans-serif;
  --f-body: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --f-mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --radius: 10px;
  --accent-text: var(--accent); --f-serif: var(--f-display); --serif-style: normal; --logo: var(--ink);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1310; --surface: #151d19; --surface2: #1b2520; --ink: #e7eeea; --muted: #97a59e; --line: #28342e;
    --accent: #3fc592; --accent-ink: #06261a; --accent-soft: #14392b;
    --warn: #e6aa4b; --warn-soft: #3a2d12; --bad: #f08076; --bad-soft: #3f1e1b;
    --c-x: #97a59e; --c-f: #e6aa4b; --c-v: #6fa8ee; --c-m: #c395e6; --c-a: #f08076; --c-d: #6fc3c6;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d1310; --surface: #151d19; --surface2: #1b2520; --ink: #e7eeea; --muted: #97a59e; --line: #28342e;
  --accent: #3fc592; --accent-ink: #06261a; --accent-soft: #14392b;
  --warn: #e6aa4b; --warn-soft: #3a2d12; --bad: #f08076; --bad-soft: #3f1e1b;
  --c-x: #97a59e; --c-f: #e6aa4b; --c-v: #6fa8ee; --c-m: #c395e6; --c-a: #f08076; --c-d: #6fc3c6;
  color-scheme: dark;
}
/* ---- La Cavale : crème, brou de noix, genévrier. Jost + Cormorant Garamond italique ---- */
:root[data-rest="cavale"] {
  --bg: #f1e7d3; --surface: #f8f2e5; --surface2: #e9dec8; --ink: #2e211a; --muted: #6b5e52; --line: #d9cdb5;
  --accent: #4f6b4f; --accent-ink: #f1e7d3; --accent-soft: #dde3cf; --accent-text: #4f6b4f;
  --warn: #7a4322; --warn-soft: #efd9bc; --bad: #9b3a2b; --bad-soft: #f0d6cc;
  --c-x: #6b5e52; --c-f: #8f5128; --c-v: #4f6b4f; --c-m: #6b3e22; --c-a: #9b3a2b; --c-d: #7a6a45;
  --logo: #2e211a; --f-display: 'Jost', 'Century Gothic', Arial, sans-serif; --f-body: 'Jost', 'Century Gothic', Arial, sans-serif;
  --f-serif: 'Cormorant Garamond', Georgia, serif; --serif-style: italic;
}
@media (prefers-color-scheme: dark) {
  :root[data-rest="cavale"]:not([data-theme="light"]) {
    --bg: #2e211a; --surface: #3a2b22; --surface2: #43332a; --ink: #f1e7d3; --muted: #bdae98; --line: #54443a;
    --accent: #8fb08f; --accent-ink: #2e211a; --accent-soft: #2f4033; --accent-text: #8fb08f;
    --warn: #e0a56e; --warn-soft: #4a3420; --bad: #ee8a78; --bad-soft: #4a2620;
    --c-x: #bdae98; --c-f: #e0a56e; --c-v: #9bbb9b; --c-m: #d9b79b; --c-a: #ee8a78; --c-d: #cdbe8f; --logo: #f1e7d3;
    color-scheme: dark;
  }
}
:root[data-rest="cavale"][data-theme="dark"] {
  --bg: #2e211a; --surface: #3a2b22; --surface2: #43332a; --ink: #f1e7d3; --muted: #bdae98; --line: #54443a;
  --accent: #8fb08f; --accent-ink: #2e211a; --accent-soft: #2f4033; --accent-text: #8fb08f;
  --warn: #e0a56e; --warn-soft: #4a3420; --bad: #ee8a78; --bad-soft: #4a2620;
  --c-x: #bdae98; --c-f: #e0a56e; --c-v: #9bbb9b; --c-m: #d9b79b; --c-a: #ee8a78; --c-d: #cdbe8f; --logo: #f1e7d3;
  color-scheme: dark;
}
/* ---- L'Alambic : crème, brun sombre, cuivre. Polices de la charte (Champagne & Limousines, Butler) remplacées par Quicksand et Playfair Display ---- */
:root[data-rest="alambic"] {
  --bg: #f7e4ce; --surface: #fbf1e4; --surface2: #f0dac1; --ink: #342c27; --muted: #6a4b38; --line: #e0c9ac;
  --accent: #a9532f; --accent-ink: #fff6ea; --accent-soft: #f2d3b8; --accent-text: #9a4a28;
  --warn: #7d5214; --warn-soft: #f3ddb0; --bad: #a8362a; --bad-soft: #f3d0c6;
  --c-x: #6a4b38; --c-f: #96611f; --c-v: #6f6a3c; --c-m: #7a3f2e; --c-a: #a8362a; --c-d: #7a6a52;
  --logo: #342c27; --f-display: 'Quicksand', 'Century Gothic', Arial, sans-serif; --f-body: 'Quicksand', 'Century Gothic', Arial, sans-serif;
  --f-serif: 'Playfair Display', Georgia, serif; --serif-style: normal;
}
@media (prefers-color-scheme: dark) {
  :root[data-rest="alambic"]:not([data-theme="light"]) {
    --bg: #342c27; --surface: #3e352f; --surface2: #483e37; --ink: #f7e4ce; --muted: #c9b196; --line: #5a4d44;
    --accent: #d0744b; --accent-ink: #2a1f1a; --accent-soft: #4d3328; --accent-text: #e08a5f;
    --warn: #e3b25f; --warn-soft: #4a3a1d; --bad: #f08a78; --bad-soft: #4a2822;
    --c-x: #c9b196; --c-f: #e3b25f; --c-v: #c2bd7e; --c-m: #e0a58f; --c-a: #f08a78; --c-d: #cdb892; --logo: #f7e4ce;
    color-scheme: dark;
  }
}
:root[data-rest="alambic"][data-theme="dark"] {
  --bg: #342c27; --surface: #3e352f; --surface2: #483e37; --ink: #f7e4ce; --muted: #c9b196; --line: #5a4d44;
  --accent: #d0744b; --accent-ink: #2a1f1a; --accent-soft: #4d3328; --accent-text: #e08a5f;
  --warn: #e3b25f; --warn-soft: #4a3a1d; --bad: #f08a78; --bad-soft: #4a2822;
  --c-x: #c9b196; --c-f: #e3b25f; --c-v: #c2bd7e; --c-m: #e0a58f; --c-a: #f08a78; --c-d: #cdb892; --logo: #f7e4ce;
  color-scheme: dark;
}
* { box-sizing: border-box; }
body { background: var(--bg); color: var(--ink); font-family: var(--f-body); font-size: 15px; line-height: 1.45;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); padding-block: 16px 40px; }
h1, h2, h3 { font-family: var(--f-display); font-weight: 600; letter-spacing: .01em; margin: 0; text-wrap: balance; }
h2 { font-size: 20px; } h3 { font-size: 16px; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.mono, .num { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.wrap { max-width: 1180px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.narrow { max-width: 520px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; min-width: 0; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.row.between { justify-content: space-between; }
.grow { flex: 1 1 auto; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.small { font-size: 13px; }
.xs { font-size: 12px; }

/* logos (dessinés dans la charte : fichiers d'origine, jamais retapés) */
.logo { display: block; background: var(--logo); -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat; -webkit-mask-size: contain; mask-size: contain; -webkit-mask-position: left center; mask-position: left center; flex: none; }
.logo.cavale { width: 176px; aspect-ratio: 900 / 245; -webkit-mask-image: url(/img/cavale.png); mask-image: url(/img/cavale.png); }
.logo.alambic { width: 196px; aspect-ratio: 800 / 201; -webkit-mask-image: url(/img/alambic.png); mask-image: url(/img/alambic.png); }
.brandwrap { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; min-width: 0; }
.brandwrap .sub { font-family: var(--f-display); font-weight: 500; font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--accent-text); border-left: 1px solid var(--line); padding-left: 14px; }
@media (max-width: 560px) { .brandwrap { gap: 6px; } .brandwrap .sub { border-left: 0; padding-left: 0; width: 100%; } }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; padding: 3px; background: var(--surface); flex-wrap: wrap; }
.seg button { border: 0; background: transparent; padding: 6px 14px; border-radius: 999px; font-weight: 500; display: inline-flex; gap: 8px; align-items: center; }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot.cavale { background: #4f6b4f; box-shadow: 0 0 0 1.5px #f1e7d3; } .dot.alambic { background: #c16540; box-shadow: 0 0 0 1.5px #f7e4ce; }
.rest-pick { border: 2px solid var(--line); background: var(--surface); border-radius: 14px; padding: 18px 16px; display: flex; justify-content: center; }
.rest-pick[aria-pressed="true"] { border-color: var(--accent); }
.rest-pick .logo { width: 150px; -webkit-mask-position: center; mask-position: center; }
/* barre du haut */
.top { display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: center; justify-content: space-between; }
.brand { font-family: var(--f-display); font-weight: 700; font-size: 22px; letter-spacing: .02em; }
.brand span { color: var(--accent-text); }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tab { border: 0; background: transparent; padding: 8px 14px; border-radius: 8px; font-weight: 500; color: var(--muted); }
.tab[aria-current="page"] { background: var(--ink); color: var(--bg); }
.tab .badge { margin-left: 6px; }
.badge { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 10px; background: var(--bad); color: #fff; font-size: 12px; text-align: center; line-height: 20px; }

/* boutons */
.btn { border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 8px 14px; font-weight: 500; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.danger { color: var(--bad); }
.btn.sm { padding: 5px 10px; font-size: 13px; }
.btn[disabled] { opacity: .5; cursor: default; }
.link { background: none; border: 0; padding: 0; color: var(--accent-text); text-decoration: underline; text-underline-offset: 2px; }

/* champs */
label.f { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); min-width: 0; }
input[type=text], input[type=time], input[type=date], input[type=number], input[type=email], input[type=password], select {
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; min-width: 0; width: 100%; color: var(--ink); }
input.num-in { font-family: var(--f-mono); text-align: right; width: 96px; padding: 5px 8px; }
input[readonly] { background: var(--surface2); }

/* pastilles */
.chip { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 500; white-space: nowrap;
  --chip: var(--muted); color: var(--chip); background: color-mix(in srgb, var(--chip) 14%, var(--surface)); border: 1px solid color-mix(in srgb, var(--chip) 30%, var(--surface)); }
.chip.x { --chip: var(--c-x); } .chip.f { --chip: var(--c-f); } .chip.v { --chip: var(--c-v); }
.chip.m { --chip: var(--c-m); } .chip.a { --chip: var(--c-a); } .chip.d { --chip: var(--c-d); }
.chip.ok { --chip: var(--accent-text); } .chip.warn { --chip: var(--warn); } .chip.bad { --chip: var(--bad); }

/* tableaux */
.scroll { overflow-x: auto; max-width: 100%; }
table.tbl { border-collapse: collapse; width: 100%; font-size: 14px; }
.tbl th { text-align: left; font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl td.r, .tbl th.r { text-align: right; }
.tbl tr.click { cursor: pointer; }
.tbl tr.click:hover td { background: var(--surface2); }
.tbl tr.we td { background: var(--surface2); }
.tbl tr.today td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.tbl tfoot td { font-weight: 600; border-bottom: 0; }
.pos { color: var(--accent-text); } .neg { color: var(--bad); }

/* tuiles de soldes */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tile .k { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.tile .v { font-family: var(--f-mono); font-size: 24px; font-weight: 500; font-variant-numeric: tabular-nums; }
.tile .h { font-size: 12px; color: var(--muted); }

/* mois */
.months { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 4px; }
.mbtn { border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 6px 2px; display: flex; flex-direction: column; align-items: center; gap: 0; min-width: 0; }
.mbtn b { font-weight: 500; font-size: 13px; }
.mbtn i { font-style: normal; font-family: var(--f-mono); font-size: 11px; color: var(--muted); }
.mbtn[aria-current="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.mbtn[aria-current="true"] i { color: inherit; opacity: .75; }
@media (max-width: 720px) { .months { grid-template-columns: repeat(6, minmax(0, 1fr)); } }

/* pointage employé */
.punch-card { display: flex; flex-direction: column; gap: 14px; padding: 18px 16px; }
.date-l { font-family: var(--f-serif); font-style: var(--serif-style); font-size: 24px; line-height: 1.1; }
.clock { font-family: var(--f-mono); font-size: clamp(44px, 16vw, 68px); font-weight: 500; letter-spacing: -.02em; line-height: 1; font-variant-numeric: tabular-nums; }
.status-l { font-size: 15px; }
.big { width: 100%; min-height: 104px; border: 0; border-radius: 18px; font-family: var(--f-display); font-weight: 700; font-size: 30px; letter-spacing: .03em; text-transform: uppercase;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; box-shadow: 0 5px 0 rgba(0,0,0,.28); transition: transform .05s, box-shadow .05s; }
.big small { font-family: var(--f-body); font-size: 13px; font-weight: 400; text-transform: none; letter-spacing: 0; opacity: .85; }
.big:active { transform: translateY(4px); box-shadow: 0 1px 0 rgba(0,0,0,.28); }
.big.in { background: var(--accent); color: var(--accent-ink); }
.big.out { background: var(--ink); color: var(--bg); }
.big[disabled] { opacity: .6; }
.big.done { background: var(--surface2); color: var(--muted); box-shadow: none; border: 1px dashed var(--line); min-height: 72px; font-size: 20px; }
.shifts { display: flex; flex-direction: column; gap: 6px; }
.shift { display: flex; justify-content: space-between; gap: 12px; padding: 8px 12px; background: var(--surface2); border-radius: 8px; }

/* liste compacte du mois (téléphone) */
.dlist { display: flex; flex-direction: column; }
.drow { display: grid; grid-template-columns: 54px 1fr auto; gap: 8px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--line); }
.drow:last-child { border-bottom: 0; }
.dl { font-weight: 500; white-space: nowrap; } .ds { min-width: 0; } .dt { font-weight: 500; }
/* fenêtres */
#layer .scrim { position: fixed; inset: 0; background: rgba(8, 14, 11, .55); display: flex; align-items: flex-start; justify-content: center; padding: 24px 16px; overflow-y: auto; z-index: 20; }
.modal { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; width: 100%; max-width: 560px; padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(20px + env(safe-area-inset-bottom, 0px)); background: var(--ink); color: var(--bg);
  padding: 10px 14px; border-radius: 10px; display: flex; gap: 14px; align-items: center; z-index: 30; max-width: calc(100vw - 32px); box-shadow: 0 6px 24px rgba(0,0,0,.3); }
.toast button { background: none; border: 0; color: inherit; text-decoration: underline; padding: 0; }
.banner { padding: 10px 14px; border-radius: var(--radius); background: var(--warn-soft); color: var(--warn); display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.empty { text-align: center; padding: 28px 16px; color: var(--muted); }
.empty h3 { color: var(--ink); margin-bottom: 6px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 520px) { .two.keep { grid-template-columns: 1fr; } }
hr { border: 0; border-top: 1px solid var(--line); width: 100%; margin: 0; }
@media (prefers-reduced-motion: reduce) { .big { transition: none; } }
/* ---- restaurants sans charte intégrée : couleur d'accent choisie par l'employeur ---- */
:root[data-rest="custom"] {
  --accent: var(--custom, #0d6b4c); --accent-ink: var(--custom-ink, #ffffff);
  --accent-soft: color-mix(in srgb, var(--accent) 16%, var(--surface)); --accent-text: color-mix(in srgb, var(--accent) 80%, var(--ink));
}
@media (prefers-color-scheme: dark) {
  :root[data-rest="custom"]:not([data-theme="light"]) { --accent: color-mix(in srgb, var(--custom, #3fc592) 72%, #ffffff); --accent-ink: #101010; --accent-text: var(--accent); }
}
.brand-text { font-family: var(--f-display); font-weight: 700; font-size: 22px; letter-spacing: .02em; }
.rest-pick .brand-text { font-size: 18px; }
.dot.custom { background: var(--dotc, #888); box-shadow: 0 0 0 1.5px var(--surface); }
.auth { max-width: 420px; margin: 8vh auto 0; }
.pre { white-space: pre-wrap; word-break: break-all; font-family: var(--f-mono); font-size: 12px; background: var(--surface2); border: 1px solid var(--line); border-radius: 8px; padding: 10px; user-select: all; }
.logrow { display: grid; grid-template-columns: 150px 1fr; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
@media (max-width: 560px) { .logrow { grid-template-columns: 1fr; } }
.sel-all { user-select: all; }
