:root {
  --nk-bg: #04091d;
  --nk-bg-soft: #0b1021;
  --nk-paper: #f9fafb;
  --nk-card: #ffffff;
  --nk-accent: #ffcc00;
  --nk-accent-2: #1a1d38;
  --nk-ink: #04091d;
  --nk-muted: #7c8597;
  --nk-line: rgba(255, 255, 255, 0.08);
  --nk-border: rgba(4, 9, 29, 0.08);
  --nk-shadow: none;
  --nk-shadow-strong: none;
  --nk-radius: 24px;
}

* { box-sizing: border-box; }
html { 
  scroll-behavior: smooth; 
  height: 100%;
}
body {
  margin: 0;
  padding: 0;
  color: var(--nk-ink);
  font-family: Inter, Arial, sans-serif;
  overflow-x: hidden;
  overscroll-behavior: none; /* Bloque l'effet élastique sur mobile */
  width: 100vw;
  height: 100%;
}

button, input, textarea, select { font: inherit; }
a { color: inherit; text-decoration: none; }

button, input, select, textarea, .queue-item__title, strong { 
  font-weight: 500; 
}

h1, h2, h3, 
.report-splits strong, 
.report-total strong {
  font-weight: 700; 
}

.bottom-safe { padding-bottom: calc(5.75rem + env(safe-area-inset-bottom)); }

.nk-grid-bg {
  min-height: 100%;
  background-color: var(--nk-bg);
  background-image:
    linear-gradient(rgba(43, 83, 181, 0.18) 1px, transparent 1px),
    linear-gradient(90deg, rgba(43, 83, 181, 0.18) 1px, transparent 1px);
  background-size: 48px 48px, 48px 48px;
}

.nk-admin-shell {
  min-height: 100%;
  background: #f4f6fb;
}

.nk-hero-shell { position: relative; overflow: hidden; }

.mobile-app,
.admin-app {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: clamp(1rem, 2vw, 1.5rem);
  overflow-x: hidden;
}

.screen { display: none; }
.screen--active { display: block; }

.hero-card,
.panel,
.modal-card {
  border-radius: var(--nk-radius);
}

.hero-card {
  padding: clamp(1.35rem, 2.5vw, 2rem);
  color: #fff;
  margin-bottom: 1rem;
}

.nk-public-card {
  background: rgba(4, 9, 29, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: var(--nk-shadow-strong);
}

.nk-public-card-light,
.panel,
.modal-card,
.nk-admin-card {
  background: #fff;
  border: 1px solid rgba(4, 9, 29, 0.12);
  box-shadow: var(--nk-shadow);
}

.hero-card h1,
.section-head h2,
.section-head h3,
.admin-topbar h2,
.report-card__head h3 {
  margin: 0;
  font-family: 'Barlow Condensed', sans-serif;
  letter-spacing: 0.01em;
}

.hero-card h1 { 
  font-size: clamp(1.5rem, 8vw, 3.35rem); 
  line-height: 1.1; 
  max-width: 100%; 
  word-wrap: break-word;
  hyphens: auto;
}

h1, h2, h3, p, span {
  word-wrap: break-word;
}

.hero-card p { max-width: 54ch; color: rgba(255,255,255,0.82); line-height: 1.55; margin: 0.8rem 0 0; }

.hero-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 1rem;
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  color: #fff;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-weight: 300;
}
.hero-pill--accent { background: var(--nk-accent); color: var(--nk-ink); }
.hero-pill--dark { background: var(--nk-bg); color: #fff; }

.panel {
  padding: clamp(1rem, 2vw, 1.4rem);
  margin-bottom: 1rem;
}
.login-panel { padding: clamp(1.15rem, 2vw, 1.6rem); }

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.section-head--compact { margin-bottom: 0.75rem; }

.section-kicker,
.eyebrow {
  display: block;
  margin-bottom: 0.35rem;
  color: var(--nk-muted);
  font-size: 0.76rem;
  font-weight: 300;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.field { display: flex; flex-direction: column; gap: 0.42rem; margin-bottom: 0.95rem; }
.field span { color: #445067; font-weight: 300; font-size: 0.92rem; }
.field input {
  width: 100%;
  border: 1px solid rgba(4, 9, 29, 0.15);
  border-radius: 16px;
  padding: 0.95rem 1rem;
  background: #f8fafc;
  transition: 180ms ease;
}
.field input:focus {
  border-color: #1d4ed8;
  outline: none;
  background: #fff;
}

.checkbox-line {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin: 0.4rem 0 1rem;
  color: #445067;
}
.checkbox-line input { width: 1rem; height: 1rem; }

.btn {
  border: 0;
  border-radius: 18px;
  cursor: pointer;
  transition: transform 180ms ease, opacity 180ms ease, background 180ms ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

.btn--primary {
  background: var(--nk-accent);
  color: var(--nk-ink);
  font-weight: 500;
}
.btn--xl { width: 100%; padding: 1rem 1.1rem; }
.btn--fab {
  width: 100%;
  padding: 1rem 1.1rem;
  font-family: 'Barlow Condensed', sans-serif;
  letter-spacing: 0.04em;
  font-size: 1.25rem;
}
.btn--ghost {
  background: transparent;
  color: var(--nk-ink);
  border: 1px solid rgba(4, 9, 29, 0.15);
}
.btn--sm { padding: 0.7rem 0.95rem; }
.btn--danger {
  background: #fff1f2;
  color: #be123c;
  border: 1px solid #fecdd3;
  font-weight: 500;
}

.helper,
.text-link,
.empty-state p,
.report-card__head p,
.report-footer span,
.queue-item__meta,
#queueMessage {
  color: var(--nk-muted);
}
.text-link { font-weight: 500; }

.top-appbar,
.admin-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}
.top-appbar { color: #fff; }
.admin-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  padding: 0.8rem 0;
  margin-bottom: 1.25rem;
  background: #f4f6fb;
}
.admin-actions { display: flex; gap: 0.75rem; flex-wrap: wrap; }

.queue-panel { text-align: center; }

.status-dot,
.mini-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.45rem 0.7rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 500;
}
.status-dot { background: #ecfccb; color: #3f6212; }
.status-dot.is-pending { background: #fef3c7; color: #92400e; }
.mini-badge { background: #eef2ff; color: #3730a3; }

.reports-list { display: grid; gap: 1rem; }
.empty-state {
  padding: 1.4rem;
  border-radius: 20px;
  background: #fff;
  border: 1px dashed rgba(4, 9, 29, 0.15);
  text-align: center;
}
.empty-state.compact { padding: 1rem; }

.report-card {
  border-radius: 24px;
  background: #ffffff;
  border: 1px solid rgba(4, 9, 29, 0.12);
  padding: 1rem;
  box-shadow: var(--nk-shadow);
}
.report-card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}
.report-badge {
  display: inline-flex;
  padding: 0.4rem 0.65rem;
  border-radius: 999px;
  background: rgba(255, 204, 0, 0.16);
  color: #8a6b00;
  font-size: 0.74rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}
.report-total {
  min-width: 110px;
  text-align: right;
}
.report-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}
.report-metric {
  padding: 0.95rem;
  border-radius: 18px;
  background: #fff;
  border: 1px solid rgba(4, 9, 29, 0.12);
}
.report-metric--accent {
  background: #071226;
  color: #fff;
}
.report-metric--accent span,
.report-metric--accent small { color: rgba(255,255,255,0.72); }

.report-splits {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-top: 0.75rem;
}
.report-splits div,
.queue-item {
  padding: 0.85rem;
  border-radius: 18px;
  background: rgba(4, 9, 29, 0.03);
}
.report-splits strong { display: block; margin: 0.2rem 0; font-family: 'Barlow Condensed', sans-serif; font-size: 1.25rem; }
.report-splits small { color: var(--nk-muted); }
.report-metric span, .report-splits span { color: var(--nk-muted); font-size: 0.82rem; }
.report-metric strong, .report-total strong { display: block; margin-top: 0.35rem; font-family: 'Barlow Condensed', sans-serif; font-size: 1.5rem; }

.report-footer {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top: 1px solid rgba(4, 9, 29, 0.08);
}

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 0.75rem;
  transform: translateX(-50%);
  width: min(calc(100% - 1.5rem), 520px);
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  padding: 0.65rem;
  border-radius: 22px;
  background: var(--nk-bg);
  border: 1px solid rgba(255,255,255,0.15);
  box-shadow: var(--nk-shadow-strong);
}
.bottom-nav__item {
  border: 0;
  border-radius: 18px;
  background: transparent;
  color: rgba(255,255,255,0.66);
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  font-size: clamp(0.7rem, 3.5vw, 0.9rem);
  text-align: center;
}
.bottom-nav__item.is-active {
  background: var(--nk-accent);
  color: var(--nk-ink);
}

.content-tab { display: none; }
.content-tab.is-active { display: block; }

.admin-entry {
  position: fixed;
  right: 1rem;
  bottom: calc(1rem + env(safe-area-inset-bottom));
  width: 42px;
  height: 42px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  color: rgba(255,255,255,0.8);
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.2);
}

.modal {
  border: 0;
  padding: 0;
  background: transparent;
  width: min(calc(100% - 1.5rem), 520px);
}
.modal--wide { width: min(calc(100% - 1.5rem), 720px); }
.modal::backdrop { background: rgba(4, 9, 29, 0.75); }
.modal-card { padding: 1rem; }

.icon-btn {
  width: 38px;
  height: 38px;
  border: 1px solid rgba(4, 9, 29, 0.15);
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
}

.grid-2,
.grid-3,
.admin-grid,
.queue-list,
.stack-form,
.modal-actions { display: grid; gap: 0.85rem; }
.modal-actions { grid-template-columns: 1fr 1fr; }

.queue-item {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  cursor: pointer;
  border: 1px solid transparent;
  overflow: hidden;
}
.queue-item:hover { border-color: rgba(4, 9, 29, 0.12); }
.queue-item__title { 
  font-weight: 500; 
  color: var(--nk-ink);
  word-break: break-all; 
  overflow-wrap: break-word;
}
.queue-item__side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.25rem;
  flex-shrink: 0;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(6.25rem + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(16px);
  opacity: 0;
  pointer-events: none;
  background: var(--nk-bg);
  color: #fff;
  padding: 0.85rem 1rem;
  border-radius: 14px;
  transition: 180ms ease;
  z-index: 50;
  border: 1px solid rgba(255,255,255,0.15);
}
.toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.hidden { display: none !important; }

@media (min-width: 768px) {
  .bottom-safe { padding-bottom: 2rem; }
  .admin-grid { grid-template-columns: 1fr 1.2fr; align-items: start; }
  .grid-2 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
  .queue-list { max-height: 65vh; overflow: auto; }
  .bottom-nav {
    position: static;
    transform: none;
    margin: 1rem auto 0;
  }
  .toast { bottom: 2rem; }
}

@media (max-width: 520px) {
  .report-grid,
  .report-splits,
  .modal-actions {
    grid-template-columns: 1fr;
  }
  
  .report-card__head {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .report-total { text-align: left; }
}

@media (max-width: 400px) {
  .mobile-app, .admin-app { padding: 0.75rem; }
  
  .hero-card, .panel, .login-panel, .report-card { 
    padding: 0.85rem; 
  }
  
  .bottom-nav {
    width: calc(100% - 1rem);
    padding: 0.5rem;
    gap: 0.5rem;
  }
  
  .bottom-nav__item {
    padding: 0.5rem;
  }
  
  .btn--xl, .btn--fab {
    padding: 0.85rem 1rem;
    font-size: 1.1rem;
  }
}