:root {
  --bg: #0f1216; --panel: #171c22; --panel2: #1e252d; --line: #2a333d;
  --txt: #e8edf2; --muted: #93a1b0; --green: #27ae60; --orange: #e08a1e;
  --red: #e0533d; --accent: #0b6647; --accent2: #12a06e;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--txt);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
h2 { font-size: 15px; letter-spacing: .3px; color: var(--muted); text-transform: uppercase; margin: 0 0 12px; }
.muted { color: var(--muted); }
.center { text-align: center; }
.num { text-align: right; }

/* Topbar */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; padding-top: calc(12px + env(safe-area-inset-top));
  background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.logo {
  display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 7px;
  background: var(--accent); color: #fff; font-weight: 800;
}
.top-right { display: flex; align-items: center; gap: 14px; }
.live { color: var(--muted); font-size: 12px; }
.live.on { color: var(--green); }
.btn-ghost {
  color: var(--muted); text-decoration: none; border: 1px solid var(--line);
  padding: 6px 12px; border-radius: 8px; background: transparent; cursor: pointer; font-size: 14px;
}
.btn-ghost:hover { color: var(--txt); border-color: var(--muted); }

main { max-width: 1100px; margin: 0 auto; padding: 20px 16px 48px; }
section { margin-bottom: 28px; }

/* Tuiles magasins */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.tile {
  background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--muted);
  border-radius: 12px; padding: 14px;
}
.tile.ok { border-left-color: var(--green); }
.tile.warn { border-left-color: var(--orange); }
.tile.mute { border-left-color: #3a444f; }
.tile .code { font-weight: 700; font-size: 16px; }
.tile .nom { color: var(--muted); font-size: 12px; margin-bottom: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .row { display: flex; justify-content: space-between; font-size: 13px; margin-top: 4px; }
.tile .big { font-size: 22px; font-weight: 700; }
.pct-ok { color: var(--green); } .pct-warn { color: var(--orange); } .pct-bad { color: var(--red); }

/* Filtres */
.filters { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.controls { display: flex; gap: 8px; flex-wrap: wrap; }
select, input[type=date] {
  background: var(--panel2); color: var(--txt); border: 1px solid var(--line);
  border-radius: 8px; padding: 7px 10px; font-size: 14px;
}

/* Table */
.table-wrap { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 10px 12px; text-align: left; white-space: nowrap; }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .3px; border-bottom: 1px solid var(--line); }
tbody tr { border-bottom: 1px solid var(--line); }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--panel2); }
.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.s-approved { background: rgba(39,174,96,.15); color: #4cd787; }
.s-refused  { background: rgba(224,83,61,.15); color: #ff7d68; }
.s-cancelled, .s-indeterminate { background: rgba(224,138,30,.15); color: #f0a846; }
.s-error { background: rgba(224,83,61,.2); color: #ff7d68; }
.mono { font-variant-numeric: tabular-nums; }

/* Login */
.login-body { display: grid; place-items: center; min-height: 100vh; }
.login-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
  padding: 28px; width: min(340px, 90vw); display: flex; flex-direction: column; gap: 12px; text-align: center;
}
.login-card .brand { justify-content: center; font-size: 18px; margin-bottom: 2px; }
.login-card input { background: var(--panel2); color: var(--txt); border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; font-size: 15px; }
.login-card button, main button:not(.btn-ghost) {
  background: var(--accent); color: #fff; border: none; border-radius: 10px; padding: 11px; font-size: 15px; font-weight: 600; cursor: pointer;
}
.login-card button:hover { background: var(--accent2); }
.err { color: var(--red); font-size: 13px; margin: 0; }

@media (max-width: 560px) {
  th.hide-sm, td.hide-sm { display: none; }
}
