/* Pointeuse DB Services — thème repris de db.services */
:root {
  --green-900: #14306a; --green-700: #1b4796; --green-600: #1d55b8; --green-500: #2560cc; --green-300: #5f90e6;
  --green-100: #e1eaf9; --green-50: #eff4fc;
  --ink: #4a5170; --text: #262b3a; --muted: #6b7288; --bg: #f4f7fc; --border: #dde5f2;
  --amber-bg: #fff6e0; --amber-line: #f1dea6; --amber: #8a6100;
  --red-bg: #fdecea; --red-line: #f3c2bd; --red: #a32619;
  --gradient: linear-gradient(135deg, var(--green-700) 0%, var(--green-500) 55%, var(--green-300) 100%);
  --shadow: 0 1px 2px rgba(38, 43, 58, .04), 0 8px 28px rgba(38, 43, 58, .08);
  --radius: 18px;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; font-family: 'Poppins', system-ui, -apple-system, 'Segoe UI', sans-serif; color: var(--text); background: var(--bg); line-height: 1.55; -webkit-text-size-adjust: 100%; min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1; }
a { color: var(--green-700); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; color: var(--text); }
h1 { font-size: clamp(1.5rem, 3.4vw, 2.1rem); font-weight: 700; }
h2 { font-size: 1.2rem; font-weight: 600; }
h3 { font-size: 1rem; font-weight: 600; }
p { margin: 0 0 1em; }
.wrap { width: min(1180px, 100% - 32px); margin: 0 auto; }
.wrap.narrow { width: min(560px, 100% - 32px); }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.mt { margin-top: 24px; }

/* En-tête */
.top { position: sticky; top: 0; z-index: 20; background: rgba(255, 255, 255, .94); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.top::after { content: ""; display: block; height: 3px; background: var(--gradient); }
.top .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); font-weight: 600; }
.brand img { height: 38px; width: auto; display: block; }
.brand .tag { font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; color: var(--green-700); border-left: 2px solid var(--border); padding-left: 12px; }
.links { display: flex; gap: 10px; align-items: center; }

.tabs { background: #fff; border-bottom: 1px solid var(--border); }
.tabs .wrap { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.tabs a { display: inline-flex; align-items: center; gap: 8px; padding: 13px 14px; text-decoration: none; color: var(--muted); font-weight: 500; font-size: .93rem; border-bottom: 3px solid transparent; white-space: nowrap; }
.tabs a:hover { color: var(--ink); }
.tabs a.on { color: var(--green-700); border-bottom-color: var(--green-500); }
.tabs a.right { margin-left: auto; }
.ic { width: 18px; height: 18px; flex: none; }

/* Boutons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; font: inherit; font-weight: 600; font-size: .92rem; padding: 11px 18px; border-radius: 12px; border: 1px solid transparent; cursor: pointer; text-decoration: none; transition: transform .15s, box-shadow .15s, background .15s; white-space: nowrap; }
.btn:hover { transform: translateY(-1px); }
.btn-green { background: var(--green-500); color: #fff; box-shadow: 0 6px 18px rgba(37, 96, 204, .3); }
.btn-green:hover { background: var(--green-600); }
.btn-ink { background: var(--ink); color: #fff; box-shadow: 0 6px 18px rgba(74, 81, 112, .26); }
.btn-ink:hover { background: #3c4260; }
.btn-ghost { background: #fff; color: var(--ink); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--green-300); }
.btn-danger { background: #fff; color: var(--red); border-color: var(--red-line); }
.btn-danger:hover { background: var(--red-bg); }
.btn-sm { padding: 7px 12px; font-size: .84rem; border-radius: 10px; }
.btn-block { display: flex; width: 100%; }
.btn[disabled], .btn.disabled { opacity: .5; pointer-events: none; }

/* Bandeau de page */
.hero { background: var(--gradient); color: #fff; position: relative; overflow: hidden; }
.hero::after { content: ""; position: absolute; width: 380px; height: 380px; right: -120px; top: -200px; border-radius: 50%; background: rgba(255, 255, 255, .07); }
.hero .wrap { position: relative; padding: 30px 0 34px; z-index: 1; }
.hero h1 { color: #fff; margin-bottom: .25em; }
.hero p { margin: 0; color: rgba(255, 255, 255, .88); max-width: 60ch; }
.hero .eyebrow { display: inline-block; font-size: .78rem; letter-spacing: .1em; text-transform: uppercase; background: rgba(255, 255, 255, .16); padding: 4px 12px; border-radius: 99px; margin-bottom: 12px; }
.hero.compact .wrap { padding: 22px 0 26px; }

/* Cartes & grilles */
.card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.card + .card { margin-top: 20px; }
.card h2 .ic { vertical-align: -3px; margin-right: 8px; color: var(--green-600); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.card-head h2 { margin: 0; }
.grid { display: grid; gap: 18px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 900px) { .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 620px) { .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; } }
.page { padding: 28px 0 56px; }
.page > .wrap > * + * { margin-top: 20px; }

.stat { display: flex; gap: 14px; align-items: center; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); }
.stat .ico { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 14px; background: var(--green-100); color: var(--green-700); flex: none; }
.stat.warn .ico { background: var(--amber-bg); color: var(--amber); }
.stat.ink .ico { background: #e9ebf3; color: var(--ink); }
.stat .n { font-size: 1.7rem; font-weight: 700; line-height: 1; }
.stat .l { font-size: .84rem; color: var(--muted); margin-top: 4px; }

/* Badges / alertes */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 99px; font-size: .78rem; font-weight: 600; background: var(--green-100); color: var(--green-700); white-space: nowrap; }
.badge.warn { background: var(--amber-bg); color: var(--amber); }
.badge.red { background: var(--red-bg); color: var(--red); }
.badge.ink { background: #e9ebf3; color: var(--ink); }
.badge.mute { background: #eef0f3; color: var(--muted); }
.alert { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 14px; border: 1px solid var(--green-300); background: var(--green-50); color: var(--green-900); margin-bottom: 18px; }
.alert.warn { background: var(--amber-bg); border-color: var(--amber-line); color: var(--amber); }
.alert.err { background: var(--red-bg); border-color: var(--red-line); color: var(--red); }

/* Formulaires */
form.stack { display: grid; gap: 16px; }
label { display: block; font-weight: 600; font-size: .9rem; color: var(--ink); margin-bottom: 6px; }
input[type=text], input[type=password], input[type=date], input[type=time], input[type=number], select, textarea { font: inherit; font-size: 16px; width: 100%; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: #fff; color: var(--text); transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--green-500); box-shadow: 0 0 0 4px rgba(37, 96, 204, .16); }
textarea { min-height: 110px; resize: vertical; }
.check { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: #fff; font-weight: 500; cursor: pointer; margin: 0; }
.check input { width: 20px; height: 20px; accent-color: var(--green-500); flex: none; }
.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.filters > div { min-width: 160px; flex: 1 1 160px; }
.inline { display: inline; }

/* Tableaux */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 14px; background: #fff; }
table.data { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.data th { text-align: left; font-size: .76rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); background: var(--green-50); padding: 11px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.data td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover td { background: #f8faff; }
table.data tr.group td { background: var(--green-100); color: var(--green-900); font-weight: 600; }
table.data tr.total td { background: var(--green-50); font-weight: 600; }
.empty { text-align: center; color: var(--muted); padding: 34px 16px; }

/* Navigation de période */
.period { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.period .label { font-weight: 600; color: var(--ink); min-width: 220px; text-align: center; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: #fff; }
.seg a { padding: 9px 16px; text-decoration: none; color: var(--muted); font-weight: 600; font-size: .88rem; }
.seg a.on { background: var(--ink); color: #fff; }

/* Écrans agent (mobile d'abord) */
.kiosk { min-height: 100vh; }
.kiosk-card { background: #fff; border-radius: 24px; padding: 30px 26px; box-shadow: 0 30px 60px rgba(15, 30, 65, .18); text-align: center; }
.kiosk-card .big { width: 76px; height: 76px; border-radius: 22px; margin: 0 auto 16px; display: grid; place-items: center; color: #fff; background: var(--gradient); box-shadow: 0 10px 24px rgba(37, 96, 204, .35); }
.kiosk-card .big.warn { background: linear-gradient(135deg, #b98200, #e0a52a); box-shadow: 0 10px 24px rgba(185, 130, 0, .3); }
.kiosk-card .big.err { background: linear-gradient(135deg, #a32619, #d4503f); box-shadow: 0 10px 24px rgba(163, 38, 25, .3); }
.kiosk-card .big svg { width: 38px; height: 38px; }
.kiosk-card .kv { text-align: left; background: var(--green-50); border: 1px solid var(--border); border-radius: 14px; padding: 12px 16px; margin: 18px 0; font-size: .93rem; }
.kiosk-card .kv div { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; }
.kiosk-card .kv span:first-child { color: var(--muted); }
.kiosk-card .kv span:last-child { font-weight: 600; text-align: right; }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 4px solid var(--green-100); border-top-color: var(--green-500); animation: spin .9s linear infinite; margin: 0 auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.actions { display: grid; gap: 12px; }
.actions.two { grid-template-columns: 1fr 1fr; }
.btn-xl { padding: 18px 20px; font-size: 1.05rem; border-radius: 16px; }

/* Badges QR */
.qr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.qr-card { border: 1px dashed #b3c2dc; border-radius: 14px; padding: 14px; text-align: center; background: #fff; break-inside: avoid; }
.qr-card .qr { display: grid; place-items: center; min-height: 130px; }
.qr-card .qr canvas, .qr-card .qr img { max-width: 100%; height: auto; }
.qr-card b { display: block; font-size: .95rem; }
.qr-card small { color: var(--muted); }

/* Pied */
footer { background: #12213d; color: #b3c2dc; padding: 24px 0 calc(22px + env(safe-area-inset-bottom)); font-size: .86rem; }
footer .wrap { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
footer a { color: #cfe0ff; }

@media (max-width: 640px) {
  .brand .tag { display: none; }
  .period .label { min-width: 0; flex: 1 1 100%; order: -1; }
  .actions.two { grid-template-columns: 1fr; }
}
@media print {
  .top, .tabs, footer, .no-print { display: none !important; }
  body { background: #fff; }
  .page { padding: 0; }
  .card, .stat { box-shadow: none; }
}

[hidden] { display: none !important; }

.grid > .card + .card, .grid > .card, .grid > .stat { margin-top: 0; }

/* Listes longues (badges) : ~20 lignes visibles puis ascenseur, en-tête figé */
.badge-scroll { max-height: 922px; overflow-y: auto; overscroll-behavior: contain; }
.badge-scroll table.data thead th { position: sticky; top: 0; z-index: 1; height: 40px; box-shadow: 0 1px 0 var(--border); }
.badge-scroll table.data td { height: 44px; padding-top: 0; padding-bottom: 0; }
