/* DarFlow — accès à distance (mobile d'abord). Charte : blanc, anthracite, vert profond, or. */
:root {
  --g9: #00302d; --g8: #003936; --g7: #044742; --g6: #0b5c55; --g1: #e4efec; --g0: #f1f7f5;
  --o7: #9a6f35; --o6: #bb8949; --o5: #c9a066; --o1: #f6ecdc; --o0: #fbf6ee;
  --bg: #f7f6f2; --card: #ffffff; --ink: #1c2422; --ink2: #47524f; --ink3: #75807d; --ink4: #a3aba9;
  --line: #e7e3da; --line2: #f0ede6;
  --red: #b42318; --redbg: #fdecea; --orange: #b54708; --orangebg: #fef4e6; --blue: #175cd3; --bluebg: #eaf1fd; --ok: #067647; --okbg: #e7f6ee;
  --r: 14px; --rs: 10px; --sh: 0 1px 2px rgba(16,24,20,.05), 0 2px 8px rgba(16,24,20,.05);
  --top: 56px; --nav: 64px;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Noto Sans Arabic', Arial, sans-serif;
  font-size: 15px; color: var(--ink); background: var(--bg);
  -webkit-text-size-adjust: 100%;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body, #root { margin: 0; min-height: 100%; }
body { background: var(--bg); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -.2px; }
h1 { font-size: 22px; } h2 { font-size: 17px; } h3 { font-size: 15px; }
:focus-visible { outline: 2px solid var(--o6); outline-offset: 2px; }
.muted { color: var(--ink3); } .small { font-size: 13px; } .tiny { font-size: 12px; }
.num { font-variant-numeric: tabular-nums; }
.row { display: flex; align-items: center; gap: 10px; } .row.wrap { flex-wrap: wrap; } .grow { flex: 1; min-width: 0; }
.stack > * + * { margin-top: 12px; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Pages d'accès / connexion ---------- */
.gate { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 16px 40px;
  background: radial-gradient(1200px 500px at 50% -10%, var(--g1), transparent 70%), var(--bg); }
.gate .card { width: 100%; max-width: 400px; padding: 26px 22px; }
.brand { display: flex; align-items: center; gap: 12px; justify-content: center; margin-bottom: 22px; }
.brand img { width: 40px; height: 50px; object-fit: contain; }
.brand .wm { font-size: 26px; font-weight: 750; color: var(--g7); letter-spacing: -.5px; line-height: 1; }
.brand .wm b { color: var(--o6); }
.brand .sub { font-size: 12px; color: var(--ink3); margin-top: 4px; letter-spacing: .3px; }
.gate h1 { text-align: center; margin-bottom: 4px; }
.gate .lead { text-align: center; color: var(--ink3); margin: 0 0 18px; font-size: 14px; }
.gate .foot { margin-top: 18px; text-align: center; font-size: 12px; color: var(--ink4); max-width: 400px; }

/* ---------- Champs, boutons ---------- */
label.f { display: block; font-size: 13px; font-weight: 600; color: var(--ink2); margin-bottom: 12px; }
label.f > span { display: block; margin-bottom: 6px; }
.in { width: 100%; height: 46px; border: 1px solid var(--line); border-radius: var(--rs); background: #fff; padding: 0 14px; font-size: 16px; }
textarea.in { height: auto; min-height: 84px; padding: 10px 14px; resize: vertical; }
.in:focus { border-color: var(--g6); outline: none; box-shadow: 0 0 0 3px var(--g1); }
.in.code { text-transform: uppercase; letter-spacing: 2px; font-weight: 650; text-align: center; font-size: 20px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 46px; padding: 0 18px; border-radius: var(--rs); border: 1px solid var(--line);
  background: #fff; font-weight: 600; cursor: pointer; white-space: nowrap; }
.btn:active { transform: translateY(1px); }
.btn.pri { background: var(--g7); border-color: var(--g7); color: #fff; }
.btn.pri:hover { background: var(--g8); }
.btn.gold { background: var(--o6); border-color: var(--o6); color: #fff; }
.btn.danger { color: var(--red); border-color: #f2c8c3; }
.btn.block { width: 100%; }
.btn.sm { height: 36px; padding: 0 12px; font-size: 14px; }
.btn[disabled] { opacity: .55; pointer-events: none; }
.link { background: none; border: 0; color: var(--g7); font-weight: 600; cursor: pointer; padding: 6px 0; }
.err { background: var(--redbg); color: var(--red); border-radius: var(--rs); padding: 10px 12px; font-size: 14px; margin-bottom: 12px; }
.note { background: var(--o0); border: 1px solid var(--o1); color: var(--o7); border-radius: var(--rs); padding: 10px 12px; font-size: 13.5px; }

/* ---------- Coque de l'application ---------- */
.top { position: sticky; top: 0; z-index: 20; height: var(--top); display: flex; align-items: center; gap: 10px; padding: 0 16px;
  background: rgba(255,255,255,.92); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); }
.top img { width: 24px; height: 30px; object-fit: contain; }
.top .pn { font-weight: 700; font-size: 15px; line-height: 1.15; }
.top .pu { font-size: 12px; color: var(--ink3); }
.pill { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 99px; font-size: 12px; font-weight: 650; white-space: nowrap; }
.pill::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.on { background: var(--okbg); color: var(--ok); } .pill.off { background: var(--redbg); color: var(--red); } .pill.wait { background: var(--orangebg); color: var(--orange); }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--g7); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px; border: 0; cursor: pointer; }
.banner { position: sticky; top: var(--top); z-index: 19; background: var(--red); color: #fff; padding: 10px 16px; font-size: 13.5px; }
.banner.warn { background: var(--orange); }
main.page { padding: 16px 16px calc(var(--nav) + 28px); max-width: 1100px; margin: 0 auto; }
.ptitle { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 4px 0 14px; }
.ptitle .muted { font-size: 13px; margin-top: 2px; }

.bnav { position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; height: calc(var(--nav) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: rgba(255,255,255,.96); backdrop-filter: blur(10px); border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(6, 1fr); }
.bnav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 11px; font-weight: 600; color: var(--ink3); text-decoration: none; }
.bnav a svg { width: 22px; height: 22px; }
.bnav a.on { color: var(--g7); }
.bnav a.on svg { color: var(--o6); }

/* ---------- Cartes, KPI, listes ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--sh); }
.card.pad { padding: 16px; }
.card h2 { margin-bottom: 10px; }
.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 14px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; box-shadow: var(--sh); min-width: 0; }
.kpi .l { font-size: 12px; color: var(--ink3); font-weight: 600; text-transform: uppercase; letter-spacing: .4px; }
.kpi .v { font-size: 24px; font-weight: 750; margin-top: 4px; letter-spacing: -.5px; }
.kpi .s { font-size: 12.5px; color: var(--ink3); margin-top: 2px; }
.kpi.wide { grid-column: 1 / -1; }
.kpi.hero { grid-column: 1 / -1; background: linear-gradient(135deg, var(--g7), var(--g9)); color: #fff; border: 0; }
.kpi.hero .l, .kpi.hero .s { color: #cfe3de; }
.kpi.hero .v { color: #fff; }
.bar { height: 8px; border-radius: 99px; background: rgba(255,255,255,.18); margin-top: 10px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--o5); border-radius: 99px; }
.alerts { margin-bottom: 14px; }
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: var(--rs); font-size: 13.5px; margin-bottom: 6px; }
.alert.warn { background: var(--orangebg); color: var(--orange); } .alert.error { background: var(--redbg); color: var(--red); } .alert.info { background: var(--bluebg); color: var(--blue); }
.list { list-style: none; margin: 0; padding: 0; }
.list > li { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-top: 1px solid var(--line2); cursor: pointer; }
.list > li:first-child { border-top: 0; }
.list > li:active { background: var(--g0); }
.list .t { font-weight: 650; }
.list .m { font-size: 13px; color: var(--ink3); }
.list .r { text-align: right; flex: none; }
.empty { padding: 22px 14px; text-align: center; color: var(--ink3); font-size: 14px; }
.sec { margin-bottom: 14px; }
.sec > h2 { display: flex; align-items: center; justify-content: space-between; padding: 14px 14px 6px; margin: 0; font-size: 15px; }
.badge { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 6px; font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.b-CONFIRMED { background: var(--bluebg); color: var(--blue); } .b-OPTION { background: var(--o1); color: var(--o7); }
.b-CHECKED_IN { background: var(--okbg); color: var(--ok); } .b-CHECKED_OUT { background: #eef0ef; color: var(--ink2); }
.b-CANCELLED, .b-NO_SHOW { background: var(--redbg); color: var(--red); }
.src { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 12px; scrollbar-width: none; }
.chip { flex: none; height: 34px; padding: 0 14px; border-radius: 99px; border: 1px solid var(--line); background: #fff; font-weight: 600; font-size: 13.5px; cursor: pointer; }
.chip.on { background: var(--g7); border-color: var(--g7); color: #fff; }
.search { position: relative; margin-bottom: 12px; }
.search .in { padding-left: 40px; }
.search svg { position: absolute; left: 13px; top: 13px; width: 20px; height: 20px; color: var(--ink4); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; font-size: 14px; }
.kv dt { color: var(--ink3); } .kv dd { margin: 0; text-align: right; font-weight: 600; }
.tot { display: flex; justify-content: space-between; padding: 8px 0; border-top: 1px dashed var(--line); font-weight: 700; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl td, .tbl th { padding: 9px 14px; border-top: 1px solid var(--line2); text-align: left; }
.tbl th { font-size: 12px; color: var(--ink3); font-weight: 600; text-transform: uppercase; letter-spacing: .3px; border-top: 0; }
.tbl td.n, .tbl th.n { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- Planning ---------- */
.plan { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.plan table { border-collapse: separate; border-spacing: 0; font-size: 12.5px; }
.plan th, .plan td { height: 42px; min-width: 46px; border-bottom: 1px solid var(--line2); border-left: 1px solid var(--line2); text-align: center; padding: 0; position: relative; }
.plan th { font-weight: 600; color: var(--ink3); height: 46px; background: #fff; position: sticky; top: 0; z-index: 2; }
.plan th.we, .plan td.we { background: #faf9f6; }
.plan th.today { color: var(--g7); }
.plan th.today::after { content: ''; position: absolute; left: 6px; right: 6px; bottom: 0; height: 3px; background: var(--o5); border-radius: 3px; }
.plan .room { position: sticky; left: 0; z-index: 3; background: #fff; text-align: left; padding: 0 10px; min-width: 92px; font-weight: 650; border-left: 0; box-shadow: 1px 0 0 var(--line); }
.plan .room small { display: block; font-weight: 500; color: var(--ink4); font-size: 11px; }
.plan .bk { position: absolute; top: 6px; bottom: 6px; left: 50%; z-index: 1; border-radius: 7px; color: #fff; font-weight: 650; font-size: 11.5px; padding: 0 7px;
  display: flex; align-items: center; white-space: nowrap; overflow: hidden; cursor: pointer; box-shadow: 0 1px 2px rgba(0,0,0,.15); }
.plan .bk.CHECKED_OUT { opacity: .55; } .plan .bk.OPTION { background-image: repeating-linear-gradient(45deg, rgba(255,255,255,.18) 0 6px, transparent 6px 12px); }

/* ---------- Feuille (détail) ---------- */
.sheet-bg { position: fixed; inset: 0; z-index: 50; background: rgba(0,30,28,.45); display: flex; align-items: flex-end; justify-content: center; animation: fade .15s; }
.sheet { width: 100%; max-width: 640px; max-height: 92vh; overflow: auto; background: var(--bg); border-radius: 18px 18px 0 0; padding: 8px 16px calc(24px + env(safe-area-inset-bottom)); animation: up .2s ease-out; }
.sheet .grab { width: 40px; height: 5px; border-radius: 9px; background: var(--line); margin: 4px auto 12px; }
.sheet .hd { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 14px; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }
.toast { position: fixed; left: 50%; bottom: calc(var(--nav) + 18px); transform: translateX(-50%); z-index: 60; background: var(--ink); color: #fff; padding: 11px 16px; border-radius: 12px; font-size: 14px; box-shadow: 0 8px 24px rgba(0,0,0,.2); max-width: 92vw; }
.toast.err { background: var(--red); }
.spin { width: 26px; height: 26px; border: 3px solid var(--g1); border-top-color: var(--g7); border-radius: 50%; animation: rot .8s linear infinite; margin: 30px auto; }
@keyframes rot { to { transform: rotate(360deg); } }
.menu { position: absolute; right: 12px; top: calc(var(--top) - 4px); z-index: 40; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 32px rgba(0,40,36,.18); min-width: 220px; padding: 6px; }
.menu button { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 10px 12px; border-radius: 8px; cursor: pointer; font-weight: 550; }
.menu button:hover { background: var(--g0); }
.menu .who { padding: 10px 12px; border-bottom: 1px solid var(--line2); margin-bottom: 4px; font-size: 13px; }

/* ---------- Bureau ---------- */
@media (min-width: 760px) {
  .kpis { grid-template-columns: repeat(4, 1fr); }
  .kpi.hero { grid-column: span 2; }
  .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
  .bnav { top: var(--top); bottom: auto; height: 50px; padding: 0 calc(50% - 400px); border-top: 0; border-bottom: 1px solid var(--line); position: sticky; }
  .bnav a { flex-direction: row; font-size: 13.5px; gap: 7px; }
  .bnav a svg { width: 18px; height: 18px; }
  main.page { padding-bottom: 40px; }
  .toast { bottom: 28px; }
  .sheet-bg { align-items: center; }
  .sheet { border-radius: 18px; }
}
