/* Design inspiré : palette sombre + accent or, Poppins, cartes glass */
:root {
  --bg: #0B0B0F;
  --bg2: #12121A;
  --gold: #F5C451;
  --goldSoft: #FFF0C9;
  --accent: var(--gold);
  --accent2: var(--goldSoft);
  --card: rgba(255,255,255,0.06);
  --glass: rgba(255,255,255,0.12);
  --border: rgba(255,255,255,0.12);
  --text: #F3F4F6;
  --muted: #B3B7C0;
  --success: #4dff88;
  --error: #ff6a6a;
  --pos-color: var(--success);
  --neg-color: var(--error);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Poppins', sans-serif;
  font-size: 14px;
  line-height: 1.5;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  background-image:
    radial-gradient(70vw 35vh at 90% 5%, rgba(245,196,81,0.06) 0%, transparent 55%),
    radial-gradient(60vw 30vh at 10% 20%, rgba(255,240,201,0.05) 0%, transparent 50%);
  background-repeat: no-repeat;
  background-attachment: fixed;
}

a { color: var(--accent); text-decoration: none; transition: color 0.2s ease; }
a:hover { color: var(--goldSoft); }

/* ——— Nav ——— */
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.5rem;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
  position: relative;
}
.brand {
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--text);
  letter-spacing: -0.02em;
}
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255,255,255,0.05);
  color: var(--text);
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}
.nav-toggle:hover { background: rgba(255,255,255,0.08); border-color: rgba(245,196,81,0.25); }
.nav-toggle-bar {
  display: block;
  width: 20px;
  height: 2px;
  background: currentColor;
  border-radius: 1px;
  margin: 0 auto;
  transition: transform 0.2s, opacity 0.2s;
}
.nav.nav-open .nav-toggle-bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav.nav-open .nav-toggle-bar:nth-child(2) { opacity: 0; }
.nav.nav-open .nav-toggle-bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
.nav-links,
.nav-links-desktop { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.nav-links a,
.nav-links-desktop a {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.4rem 0.7rem;
  border-radius: 10px;
  border: 1px solid transparent;
  transition: color 0.2s, background 0.2s, border-color 0.2s;
}
.nav-links a:hover,
.nav-links-desktop a:hover {
  color: var(--text);
  background: rgba(255,255,255,0.05);
  border-color: rgba(245,196,81,0.2);
}
.nav-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 100001;
  -webkit-tap-highlight-color: transparent;
  transition: opacity 0.2s ease;
}
.nav-backdrop.is-open { display: block; }
body.nav-menu-open { overflow: hidden; }

/* Drawer (mobile) — hors de la nav, au-dessus du contenu */
.nav-drawer {
  display: none;
}
@media (min-width: 769px) {
  .nav-drawer,
  .nav-backdrop { display: none !important; }
  .nav-links-desktop { display: flex; }
}

.main { padding: 1.5rem; max-width: 1200px; margin: 0 auto; min-width: 0; }
.page-bonus .main { max-width: 1600px; padding: 1.5rem 2rem; }
.main h1 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  margin: 0 0 1rem 0;
}
.muted { color: var(--muted); font-size: 0.9rem; }

/* ——— Flash ——— */
.flash { margin-bottom: 1rem; }
.flash-error {
  color: var(--neg-color);
  padding: 0.6rem 1rem;
  background: rgba(255,106,106,0.12);
  border: 1px solid rgba(255,106,106,0.3);
  border-radius: 12px;
  font-size: 0.9rem;
}
.flash-success {
  color: var(--pos-color);
  padding: 0.6rem 1rem;
  background: rgba(77,255,136,0.12);
  border: 1px solid rgba(77,255,136,0.3);
  border-radius: 12px;
  font-size: 0.9rem;
}

/* ——— Card ——— */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.25rem;
  margin-bottom: 1rem;
  backdrop-filter: blur(10px);
}
.card h2 { margin: 0 0 1rem 0; font-size: 1.1rem; color: var(--muted); font-weight: 600; }

/* ——— Buttons ——— */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  padding: 0.5rem 1rem;
  border-radius: 10px;
  font-weight: 600;
  font-size: 14px;
  font-family: inherit;
  border: 1px solid rgba(245,196,81,0.25);
  cursor: pointer;
  transition: transform 0.06s ease, filter 0.2s ease, box-shadow 0.2s ease, color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
  background: var(--bg2);
  color: var(--text);
  text-decoration: none;
}
.btn:hover { filter: brightness(1.05); }
.btn:active { transform: scale(0.98); }
.btn-secondary {
  background: rgba(255,255,255,0.06);
  border-color: var(--border);
}
.btn-secondary:hover { border-color: rgba(245,196,81,0.3); }
.btn-danger { background: rgba(255,106,106,0.2); border-color: rgba(255,106,106,0.4); color: #ff8a8e; }
.btn-danger:hover { background: var(--error); color: #fff; border-color: var(--error); }
.btn-discord {
  background: #5865f2;
  border-color: #4752c4;
  color: #fff;
  text-decoration: none;
  min-height: 44px;
  padding: 0.6rem 1.2rem;
}
.btn-discord:hover { background: #4752c4; color: #fff; filter: brightness(1.08); }
.login-divider { text-align: center; margin: 1rem 0; color: var(--muted); font-size: 0.9rem; }

/* ——— Forms & inputs ——— */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; margin-bottom: 0.35rem; color: var(--muted); font-size: 0.9rem; font-weight: 500; }
.form-group input,
.input {
  width: 100%;
  max-width: 280px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.06);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}
.form-group input::placeholder,
.input::placeholder { color: rgba(243,244,246,0.5); }
.form-group input:focus,
.input:focus {
  border-color: rgba(245,196,81,0.5);
  box-shadow: 0 0 0 2px rgba(245,196,81,0.2);
  background: rgba(255,255,255,0.075);
}

/* ——— Tables ——— */
.table-scroll-hint {
  display: none;
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0 0 0.5rem 0;
  text-align: center;
}
@media (max-width: 768px) {
  .table-scroll-hint { display: block; }
}
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 16px;
  overflow: hidden;
}
.table-wrap table { width: 100%; min-width: 600px; border-collapse: collapse; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 0.7rem 1rem; text-align: left; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; background: rgba(0,0,0,0.2); }
tr:hover { background: rgba(255,255,255,0.02); }

/* ——— Drop zone, login, pct (global) ——— */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: 16px;
  padding: 2rem;
  text-align: center;
  transition: border-color 0.2s, background 0.2s;
  cursor: pointer;
  margin-bottom: 1rem;
}
.drop-zone.dragover { border-color: rgba(245,196,81,0.5); background: rgba(245,196,81,0.06); }
.drop-zone input[type="file"] { display: none; }
.drop-zone .hint { color: var(--muted); font-size: 0.9rem; margin-top: 0.5rem; }

.login-box { max-width: 360px; margin: 3rem auto; }
.login-box h1 { margin-bottom: 1.5rem; font-size: 1.5rem; font-weight: 700; }

/* ——— Login page (Streamline Agency) ——— */
body.login-page { display: flex; flex-direction: column; min-height: 100vh; }
body.login-page .nav { justify-content: center; }
body.login-page .nav-links,
body.login-page .nav-links-desktop { display: none; }
body.login-page .main { flex: 1; display: flex; align-items: center; justify-content: center; padding: 2rem 1.5rem; }
.login-page-wrap { width: 100%; max-width: 420px; margin: 0 auto; text-align: center; }
.login-hero { margin-bottom: 2rem; }
.login-title {
  font-size: clamp(1.75rem, 5vw, 2.5rem);
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text);
  margin: 0 0 0.25rem 0;
  line-height: 1.15;
  text-transform: uppercase;
}
.login-subtitle {
  font-size: clamp(1.1rem, 3vw, 1.35rem);
  font-weight: 600;
  color: var(--gold);
  letter-spacing: 0.08em;
  margin: 0;
  text-transform: uppercase;
}
.login-message {
  margin-bottom: 1.5rem;
  padding: 1.25rem 1.5rem;
  border-radius: 16px;
  text-align: center;
}
.login-message-icon { font-size: 2rem; display: block; margin-bottom: 0.5rem; }
.login-message-title { font-size: 1.1rem; font-weight: 700; margin: 0 0 0.5rem 0; color: var(--text); }
.login-message-text { margin: 0 0 0.35rem 0; font-size: 0.95rem; color: var(--muted); }
.login-message-text strong { color: var(--gold); }
.login-message-hint { margin: 0.75rem 0 0 0; font-size: 0.85rem; color: var(--muted); opacity: 0.9; }
.login-error {
  background: rgba(255, 106, 106, 0.12);
  border: 1px solid rgba(255, 106, 106, 0.35);
  color: #ff8a8e;
}
.login-access-denied {
  background: rgba(245, 196, 81, 0.08);
  border: 1px solid rgba(245, 196, 81, 0.25);
  color: var(--muted);
}
.login-card { padding: 1.75rem; }
.login-card-label { font-size: 0.9rem; color: var(--muted); margin: 0 0 1.25rem 0; }
.btn-discord-large {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  min-height: 52px;
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  width: 100%;
  max-width: 320px;
}
.btn-discord-icon { width: 24px; height: 24px; flex-shrink: 0; }

.pct-buttons { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1rem; }
.pct-buttons a, .pct-buttons span { padding: 0.45rem 0.85rem; border-radius: 10px; font-size: 0.9rem; font-weight: 500; transition: background 0.2s, color 0.2s, border-color 0.2s; }
.pct-buttons a {
  background: rgba(255,255,255,0.06);
  color: var(--text);
  border: 1px solid transparent;
}
.pct-buttons a:hover { background: rgba(245,196,81,0.15); border-color: rgba(245,196,81,0.25); }
.pct-buttons a.active { background: var(--gold); color: #0B0B0F; border-color: var(--gold); }

.upload-result { margin-top: 0.75rem; font-size: 0.9rem; }
.upload-result.ok { color: var(--pos-color); }
.upload-result.err { color: var(--neg-color); }

/* ——— Bonus page ——— */
.bonus-desc { color: var(--muted); font-size: 0.9rem; margin-bottom: 1.25rem; max-width: 720px; line-height: 1.5; }
.bonus-sync-hint { display: inline-block; margin-top: 0.35rem; font-size: 0.8rem; color: var(--gold); opacity: 0.9; }

.bonus-hero {
  margin-bottom: 1.5rem;
}
.bonus-hero-toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 1.25rem; margin-bottom: 1rem;
  padding: 1rem 1.5rem; background: var(--card); border: 1px solid var(--border); border-radius: 16px;
  backdrop-filter: blur(10px);
}
.page-bonus .bonus-hero-toolbar { justify-content: space-between; gap: 1.5rem; }
.bonus-hero-label { color: var(--muted); font-size: 0.82rem; font-weight: 600; margin-right: 0.35rem; white-space: nowrap; }
.bonus-hero-tranche { display: flex; align-items: center; flex-wrap: wrap; gap: 0.35rem; }
.bonus-hero-pcts { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.bonus-pct {
  padding: 0.4rem 0.75rem; border-radius: 10px; font-size: 0.88rem; font-weight: 500; text-decoration: none;
  background: rgba(0,0,0,0.35); color: var(--text); border: 1px solid rgba(255,255,255,0.2);
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.bonus-pct:hover { background: rgba(245,196,81,0.2); border-color: rgba(245,196,81,0.4); color: var(--goldSoft); }
.bonus-pct.is-active { background: var(--gold); color: #0B0B0F; border-color: var(--gold); }

.bonus-hero-search { min-width: 220px; flex-shrink: 0; }
.page-bonus .bonus-hero-search { margin-left: auto; }
.bonus-hero-input {
  width: 100%; max-width: 280px; padding: 0.5rem 0.85rem;
  border: 1px solid rgba(255,255,255,0.14); border-radius: 12px; background: rgba(255,255,255,0.06);
  color: var(--text); font-size: 0.9rem; font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
.bonus-hero-input::placeholder { color: var(--muted); }
.bonus-hero-input:focus {
  outline: none; border-color: rgba(245,196,81,0.5); box-shadow: 0 0 0 2px rgba(245,196,81,0.2);
  background: rgba(255,255,255,0.075);
}

.bonus-hero-filters { display: flex; align-items: center; flex-wrap: wrap; gap: 0.35rem; }
.bonus-hero-filter-pills { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.bonus-pill {
  padding: 0.35rem 0.65rem; border-radius: 8px; font-size: 0.82rem; font-weight: 500; font-family: inherit;
  background: rgba(0,0,0,0.35); border: 1px solid rgba(255,255,255,0.2); color: var(--text);
  cursor: pointer; transition: background 0.2s, border-color 0.2s, color 0.2s;
}
.bonus-pill:hover { background: rgba(0,0,0,0.5); border-color: rgba(245,196,81,0.4); color: var(--goldSoft); }
.bonus-pill.is-active { background: var(--gold); border-color: var(--gold); color: #0B0B0F; }

.bonus-hero-summary {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1.25rem;
}
.page-bonus .bonus-hero-summary { gap: 1.5rem; }
@media (max-width: 640px) { .bonus-hero-summary { grid-template-columns: 1fr; } }
.bonus-hero-stat {
  padding: 1rem 1.25rem; background: var(--card); border: 1px solid var(--border); border-radius: 16px;
  display: flex; flex-direction: column; gap: 0.25rem; backdrop-filter: blur(10px);
}
.bonus-hero-stat-label { font-size: 0.75rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600; }
.bonus-hero-stat-value { font-size: 1.4rem; font-weight: 700; color: var(--text); }
.bonus-hero-stat-sub { font-size: 0.8rem; color: var(--muted); margin-top: 0.15rem; }
.bonus-hero-stat-pieces { color: var(--gold); }
.bonus-hero-stat-envoye { border-color: rgba(77,255,136,0.35); background: rgba(77,255,136,0.06); }
.bonus-hero-stat-envoye .bonus-hero-stat-value { color: var(--pos-color); }
.bonus-hero-stat-non-envoye { border-color: rgba(255,106,106,0.3); background: rgba(255,106,106,0.06); }
.bonus-hero-stat-non-envoye .bonus-hero-stat-value { color: #ff8a8e; }
.bonus-hero-stat-economie { border-color: rgba(245,196,81,0.35); background: rgba(245,196,81,0.08); }
.bonus-hero-stat-economie .bonus-hero-stat-value { color: var(--gold); }
.bonus-hero-stat-pas-bonus { border-color: rgba(167,139,250,0.35); background: rgba(167,139,250,0.08); }
.bonus-hero-stat-pas-bonus .bonus-hero-stat-value { color: #c4b5fd; }

.bonus-table-card {
  background: var(--card); border: 1px solid var(--border); border-radius: 16px; overflow: hidden;
  backdrop-filter: blur(10px);
}
.bonus-table-scroll { overflow-x: auto; }
.bonus-table { width: 100%; border-collapse: collapse; min-width: 900px; table-layout: fixed; }
.page-bonus .bonus-table { table-layout: auto; min-width: 0; }
.bonus-table thead { position: sticky; top: 0; z-index: 2; background: rgba(0,0,0,0.4); box-shadow: 0 1px 0 var(--border); }
.bonus-table th {
  padding: 0.75rem 0.85rem; font-size: 0.78rem; color: var(--muted); font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.04em; text-align: left; white-space: nowrap;
}
.bonus-table td { padding: 0.6rem 0.85rem; font-size: 0.9rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.bonus-table tbody tr:hover { background: rgba(255,255,255,0.02); }
.bonus-table tbody tr:last-child td { border-bottom: none; }

.bonus-th-creator { min-width: 120px; }
.bonus-th-num, .bonus-td-num { text-align: right; white-space: nowrap; }
.bonus-th-total, .bonus-td-total { text-align: right; background: rgba(245,196,81,0.08); color: var(--gold); font-weight: 700; }
.bonus-th-total { background: rgba(245,196,81,0.12); color: var(--gold) !important; }
.bonus-td-creator { font-weight: 600; }
.bonus-td-manque { color: var(--muted); font-size: 0.85rem; }

.bonus-inline-form { margin: 0; display: block; }
.bonus-inline-input {
  width: 100%; min-width: 0; padding: 0.4rem 0.5rem; border-radius: 8px; font-size: 0.85rem; font-family: inherit;
  border: 1px solid var(--border); background: rgba(255,255,255,0.06); color: var(--text);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.bonus-inline-input:focus {
  outline: none; border-color: rgba(245,196,81,0.5); box-shadow: 0 0 0 2px rgba(245,196,81,0.15);
}
.bonus-input-num { width: 5rem; text-align: right; }

.bonus-td-status { min-width: 280px; width: 280px; }
.page-bonus .bonus-td-status { min-width: 300px; width: auto; }
.bonus-status-btns { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; }
.bonus-status-form { display: inline-block; margin: 0; }
.btn-status {
  padding: 0.35rem 0.6rem; border: none; border-radius: 8px; font-size: 0.78rem; font-weight: 600;
  cursor: pointer; font-family: inherit; transition: opacity 0.2s, filter 0.2s, box-shadow 0.2s;
}
.btn-status:hover { opacity: 0.95; filter: brightness(1.1); }
.btn-status.is-active { box-shadow: 0 0 0 2px rgba(255,255,255,0.5); }
.btn-pas-valide { background: rgba(255,106,106,0.25); color: #ff8a8e; }
.btn-pas-valide:hover { background: var(--error); color: #fff; }
.btn-pas-valide.is-active { background: var(--error); color: #fff; }
.btn-envoye { background: rgba(77,255,136,0.25); color: #6ee7b7; }
.btn-envoye:hover { background: var(--pos-color); color: #0B0B0F; }
.btn-envoye.is-active { background: var(--pos-color); color: #0B0B0F; }
.btn-attente { background: rgba(74,184,255,0.25); color: #7dd3fc; }
.btn-attente:hover { background: #4AB8FF; color: #0B0B0F; }
.btn-attente.is-active { background: #4AB8FF; color: #0B0B0F; }
.btn-pas-bonus { background: rgba(167,139,250,0.25); color: #c4b5fd; }
.btn-pas-bonus:hover { background: #a78bfa; color: #fff; }
.btn-pas-bonus.is-active { background: #a78bfa; color: #fff; }

.bonus-tr-valid { background: rgba(77,255,136,0.18); border-left: 3px solid rgba(77,255,136,0.6); }
.bonus-tr-invalid { background: rgba(255,106,106,0.18); border-left: 3px solid rgba(255,106,106,0.6); }
.bonus-tr-envoye { background: rgba(77,255,136,0.25); border-left: 3px solid #4dff88; }
.bonus-tr-attente { background: rgba(74,184,255,0.2); border-left: 3px solid #4AB8FF; }
.bonus-tr-non { background: rgba(167,139,250,0.2); border-left: 3px solid #a78bfa; }
.bonus-tr-valid:hover, .bonus-tr-invalid:hover, .bonus-tr-envoye:hover, .bonus-tr-attente:hover, .bonus-tr-non:hover {
  filter: brightness(1.05);
}

/* ——— Imports ——— */
.imports-desc { color: var(--muted); margin-bottom: 1.5rem; font-size: 0.95rem; max-width: 560px; }
.import-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.25rem; }
@media (max-width: 720px) { .import-grid { grid-template-columns: 1fr; } }
.import-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  backdrop-filter: blur(10px);
}
.import-card-header { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.import-card-header h2 { margin: 0; font-size: 1.1rem; color: var(--text); font-weight: 600; }
.import-card-badge {
  font-size: 0.75rem; padding: 0.2rem 0.5rem; border-radius: 8px;
  background: rgba(245,196,81,0.15); color: var(--gold); font-weight: 600;
}
.import-card-desc { margin: 0; color: var(--muted); font-size: 0.85rem; }
.import-card-deposit { min-height: 2.5rem; }
.deposit-empty { margin: 0; color: var(--muted); font-size: 0.9rem; }
.deposit-info { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; font-size: 0.9rem; padding: 0.5rem 0; }
.deposit-filename { font-weight: 600; color: var(--text); }
.deposit-meta { color: var(--gold); }
.deposit-label { color: var(--muted); font-size: 0.85rem; }
.deposit-info .btn-delete { margin-left: auto; padding: 0.25rem 0.5rem; font-size: 0.8rem; }
.import-label-input {
  width: 100%; max-width: 100%; padding: 0.5rem 0.75rem;
  border: 1px solid rgba(255,255,255,0.14); border-radius: 12px;
  background: rgba(255,255,255,0.06); color: var(--text); font-size: 0.9rem; font-family: inherit;
}
.import-label-input:focus {
  outline: none; border-color: rgba(245,196,81,0.5); box-shadow: 0 0 0 2px rgba(245,196,81,0.2);
}
.import-card .drop-zone { margin: 0; padding: 1.25rem; border-radius: 12px; }
.import-card .upload-result { margin-top: 0.25rem; }

/* ——— Dashboard ——— */
.dashboard-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.dashboard-card { display: flex; flex-direction: column; gap: 0.25rem; }
.dashboard-label { font-size: 0.8rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600; }
.dashboard-value { font-size: 1.5rem; font-weight: 700; color: var(--text); }
.dashboard-pieces { color: var(--gold); }
.dashboard-paye { color: var(--success); }
.dashboard-inline-stats { display: flex; gap: 2rem; flex-wrap: wrap; margin-top: 1rem; }

/* ——— Historique ——— */
.historique-save-form { margin-bottom: 1.5rem; }
.historique-list { margin-top: 1rem; }
.historique-ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.historique-item { margin: 0; display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.historique-link {
  flex: 1; min-width: 0;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 1rem 1.25rem; background: var(--card); border: 1px solid var(--border); border-radius: 16px;
  text-decoration: none; color: var(--text); transition: border-color 0.2s, background 0.2s;
}
.historique-link:hover { border-color: rgba(245,196,81,0.4); background: rgba(255,255,255,0.08); }
.historique-delete-form { flex-shrink: 0; margin: 0; }
.historique-delete-form .btn { min-height: 36px; padding: 0.4rem 0.75rem; font-size: 0.85rem; }
.historique-label { font-weight: 600; font-size: 1.1rem; }
.historique-meta { font-size: 0.9rem; color: var(--muted); }
.historique-table-card {
  background: var(--card); border: 1px solid var(--border); border-radius: 16px; overflow: hidden;
  margin-top: 1rem; backdrop-filter: blur(10px);
}
.historique-table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.historique-table { width: 100%; border-collapse: collapse; min-width: 800px; }
.historique-table thead { background: rgba(0,0,0,0.4); }
.historique-table th {
  padding: 0.75rem 0.85rem; font-size: 0.78rem; color: var(--muted); font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.04em; text-align: left;
}
.historique-table td { padding: 0.6rem 0.85rem; font-size: 0.9rem; border-bottom: 1px solid var(--border); }
.historique-table tbody tr:last-child td { border-bottom: none; }
.historique-th-creator { min-width: 120px; }
.historique-th-num, .historique-td-num { text-align: right; }
.historique-th-total, .historique-td-total { text-align: right; background: rgba(245,196,81,0.08); color: var(--gold); font-weight: 700; }
.historique-th-total { background: rgba(245,196,81,0.12); color: var(--gold) !important; }
.historique-td-creator { font-weight: 600; }
.historique-td-manque { color: var(--muted); font-size: 0.85rem; }
.historique-status-badge {
  display: inline-block; padding: 0.25rem 0.5rem; border-radius: 6px; font-size: 0.8rem; font-weight: 600;
}
.historique-row.bonus-tr-valid .historique-status-badge { background: rgba(77,255,136,0.25); color: #6ee7b7; }
.historique-row.bonus-tr-invalid .historique-status-badge { background: rgba(255,106,106,0.25); color: #ff8a8e; }
.historique-row.bonus-tr-envoye .historique-status-badge { background: rgba(77,255,136,0.35); color: #4dff88; }
.historique-row.bonus-tr-attente .historique-status-badge { background: rgba(74,184,255,0.25); color: #7dd3fc; }
.historique-row.bonus-tr-non .historique-status-badge { background: rgba(167,139,250,0.25); color: #c4b5fd; }
.historique-empty { text-align: center; color: var(--muted); padding: 1.5rem !important; }

/* ——— Responsive / Mobile ——— */
@media (max-width: 768px) {
  .nav {
    flex-wrap: nowrap;
    padding: 0.6rem 1rem;
    gap: 0.5rem;
    align-items: center;
    justify-content: space-between;
    z-index: 10000;
  }
  .nav-toggle { display: flex; }
  .nav-links-desktop { display: none; }
  .nav-drawer {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(280px, 85vw);
    max-width: 320px;
    background: var(--bg2);
    border-right: 1px solid var(--border);
    box-shadow: 4px 0 24px rgba(0,0,0,0.35);
    z-index: 100002;
    transform: translateX(-100%);
    transition: transform 0.25s ease-out;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .nav-drawer.is-open {
    transform: translateX(0);
  }
  .nav-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    background: var(--card);
  }
  .nav-drawer-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
  }
  .nav-drawer-close {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: none;
    border-radius: 10px;
    background: rgba(255,255,255,0.06);
    color: var(--text);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    transition: background 0.2s;
  }
  .nav-drawer-close:hover { background: rgba(255,255,255,0.1); }
  .nav-drawer-links {
    display: flex;
    flex-direction: column;
    padding: 0.75rem;
    gap: 0.25rem;
  }
  .nav-drawer-links a {
    color: var(--muted);
    padding: 0.85rem 1rem;
    font-size: 1rem;
    min-height: 48px;
    display: flex;
    align-items: center;
    border-radius: 12px;
    transition: color 0.2s, background 0.2s;
  }
  .nav-drawer-links a:hover {
    color: var(--text);
    background: rgba(255,255,255,0.05);
  }
  .brand { font-size: 1.1rem; }

  .main { padding: 1rem; padding-bottom: max(1rem, env(safe-area-inset-bottom)); }
  .page-bonus .main { padding: 1rem; padding-bottom: max(1rem, env(safe-area-inset-bottom)); }
  .main h1 { font-size: 1.3rem; margin-bottom: 0.75rem; }

  .bonus-desc { font-size: 0.85rem; margin-bottom: 1rem; }
  .bonus-sync-hint { display: block; margin-top: 0.5rem; }

  .bonus-hero-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
    padding: 1rem;
  }
  .page-bonus .bonus-hero-toolbar { justify-content: flex-start; }
  .bonus-hero-tranche { flex-wrap: wrap; }
  .bonus-hero-search { margin-left: 0; min-width: 0; width: 100%; }
  .bonus-hero-input { max-width: none; width: 100%; }
  .bonus-hero-filters { flex-wrap: wrap; }
  .bonus-hero-filter-pills { flex-wrap: wrap; }

  .bonus-hero-summary { gap: 1rem; }
  .bonus-hero-stat { padding: 0.85rem 1rem; }
  .bonus-hero-stat-value { font-size: 1.25rem; }

  .bonus-table-card { margin-left: 0; margin-right: 0; }
  .bonus-table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0;
    padding: 0;
    border-radius: 12px;
  }
  .bonus-table { min-width: 780px; font-size: 0.85rem; }
  .bonus-table th, .bonus-table td { padding: 0.5rem 0.6rem; font-size: 0.82rem; }
  .bonus-td-status { min-width: 280px; }
  .bonus-status-btns {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
  }
  .bonus-status-form { display: inline-block; margin: 0; }
  .bonus-status-form .btn-status {
    min-width: 4.2em;
    min-height: 44px;
    padding: 0.5rem 0.6rem;
    font-size: 0.78rem;
    white-space: nowrap;
  }
  .bonus-inline-input { min-height: 44px; }
  .bonus-input-num { width: 4.5rem; }

  .table-wrap {
    margin-left: 0;
    margin-right: 0;
    padding: 0;
    border-radius: 12px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .table-wrap table { min-width: 640px; font-size: 0.85rem; }
  .table-wrap th, .table-wrap td { padding: 0.55rem 0.65rem; white-space: nowrap; }
  .table-wrap td:first-child { white-space: normal; }

  .pct-buttons { flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1rem; }
  .pct-buttons a, .pct-buttons span { min-height: 44px; padding: 0.5rem 0.75rem; font-size: 0.9rem; }

  .import-grid { grid-template-columns: 1fr; gap: 1rem; }
  .import-card { padding: 1rem; }
  .dashboard-stats { grid-template-columns: 1fr 1fr; gap: 0.75rem; }
  .dashboard-value { font-size: 1.3rem; }
  .dashboard-inline-stats { gap: 1rem; }
  .card { padding: 1rem; }
  .form-group input, .input { max-width: none; }
  .login-box { margin: 2rem 1rem; padding: 0 0.5rem; }
}

@media (max-width: 480px) {
  body { font-size: 15px; }
  .nav { padding: 0.5rem 0.75rem; }
  .brand { font-size: 1rem; }
  .nav-links a,
.nav-links-desktop a { padding: 0.65rem 1rem; font-size: 0.9rem; min-height: 48px; }

  .main { padding: 0.75rem; }
  .page-bonus .main { padding: 0.75rem; }
  .main h1 { font-size: 1.2rem; }

  .bonus-hero-toolbar { padding: 0.75rem; }
  .bonus-pct { padding: 0.45rem 0.65rem; font-size: 0.82rem; min-height: 44px; }
  .bonus-pill { padding: 0.45rem 0.6rem; font-size: 0.8rem; min-height: 44px; }

  .bonus-hero-summary { grid-template-columns: 1fr; gap: 0.75rem; }
  .bonus-hero-stat { padding: 0.75rem; }
  .bonus-hero-stat-value { font-size: 1.2rem; }

  .bonus-table-card { margin-left: 0; margin-right: 0; }
  .bonus-table-scroll { margin: 0; padding: 0; }
  .bonus-table { min-width: 700px; }
  .bonus-table th { font-size: 0.75rem; padding: 0.45rem 0.5rem; }
  .bonus-table td { font-size: 0.8rem; padding: 0.45rem 0.5rem; }
  .bonus-td-status { min-width: 280px; }
  .bonus-status-form .btn-status { min-width: 4em; padding: 0.5rem 0.55rem; font-size: 0.75rem; }

  .table-wrap { margin-left: 0; margin-right: 0; padding: 0; }
  .table-wrap table { min-width: 600px; font-size: 0.8rem; }
  .table-wrap th, .table-wrap td { padding: 0.5rem 0.55rem; }

  .dashboard-stats { grid-template-columns: 1fr; gap: 0.5rem; }
  .dashboard-value { font-size: 1.25rem; }
  .btn { min-height: 48px; padding: 0.6rem 1rem; font-size: 15px; }
  .drop-zone { padding: 1.25rem; }
  .flash-error, .flash-success { padding: 0.5rem 0.75rem; font-size: 0.85rem; }
}

/* Touch: zones cliquables plus grandes sur tactile */
@media (hover: none) and (pointer: coarse) {
  .nav-links a,
.nav-links-desktop a { min-height: 44px; display: inline-flex; align-items: center; }
  .bonus-pct { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; }
  .bonus-pill { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; }
  .btn-status { min-height: 44px; }
  .form-group input, .input { min-height: 48px; font-size: 16px; }
}
