*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; background: #e8e3db; }
* { scrollbar-width: none; }
*::-webkit-scrollbar { display: none; }

/* ── Shell ── */
.app-shell {
  width: 100%;
  max-width: 430px;
  height: 100vh;
  height: 100dvh;
  background: white;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  margin: 0 auto;
}
@media (min-width: 500px) {
  body { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
  .app-shell {
    height: min(900px, calc(100vh - 40px));
    border-radius: 36px;
    box-shadow: 0 24px 80px rgba(0,0,0,0.2), 0 0 0 1px rgba(0,0,0,0.07);
  }
}

/* ── Header ── */
.gs-header {
  padding: 14px 20px 0;
  flex-shrink: 0;
  background: white;
}
.gs-logo-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}
.gs-logomark { display: block; flex-shrink: 0; }
.gs-title-row {
  display: flex;
  align-items: baseline;
  gap: 5px;
}
.gs-gresi {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 800;
  font-size: 30px;
  color: #4A7AC7;
  letter-spacing: 0.5px;
}
.gs-sorties {
  font-family: 'Caveat', cursive;
  font-weight: 700;
  font-size: 25px;
  color: #E63946;
}
.gs-subtitle {
  font-family: 'Caveat', cursive;
  font-size: 13px;
  color: #b0a899;
  margin-top: -1px;
}

/* ── Filter pills ── */
.gs-filters {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 12px 0 14px;
  margin-right: -20px;
}
.gs-filters::after { content: ''; width: 20px; flex-shrink: 0; }
.gs-pill {
  padding: 6px 14px;
  border-radius: 22px;
  flex-shrink: 0;
  cursor: pointer;
  background: #f2f0ed;
  color: #888;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: background 160ms ease, color 160ms ease;
}
.gs-pill:active { transform: scale(0.97); }
.gs-pill--active { background: #E63946; color: white; }

.gs-divider { height: 1px; background: #f2f0ec; flex-shrink: 0; }

/* ── Event list ── */
.gs-list {
  flex: 1;
  overflow-y: auto;
  padding-bottom: 20px;
}
.gs-empty {
  font-family: 'Caveat', cursive;
  font-size: 16px;
  color: #b0a899;
  text-align: center;
  padding: 48px 20px;
}

/* ── Day group ── */
.gs-day-group { }
.gs-day-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 16px 10px;
}
.gs-day-label {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 17px;
  color: #111;
  letter-spacing: 0.5px;
  flex-shrink: 0;
  white-space: nowrap;
}
.gs-day-line { flex: 1; height: 1px; background: #f0f0f0; }
.gs-day-count {
  font-family: 'Caveat', cursive;
  font-size: 13px;
  color: #bbb;
  flex-shrink: 0;
}
.gs-cards { padding: 0 16px; }

/* ── Event card ── */
.gs-card {
  display: block;
  background: white;
  border: 1.5px solid #f0f0f0;
  border-left-width: 4px;
  border-radius: 12px;
  margin-bottom: 8px;
  padding: 12px 14px;
  box-shadow: 0 1px 6px rgba(0,0,0,0.05);
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  transition: background 120ms ease, transform 120ms ease;
}
.gs-card:hover  { background: #fdfcfb; }
.gs-card:active { background: #f8f6f2; transform: scale(0.993); }

.gs-card-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: #111;
  line-height: 1.35;
  margin-bottom: 8px;
}
.gs-card-meta { display: flex; gap: 12px; flex-wrap: wrap; }
.gs-meta-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 12px;
  color: #888;
}
.gs-meta-item svg { display: block; flex-shrink: 0; }

/* ── Detail page ── */
.detail-shell {
  width: 100%;
  max-width: 430px;
  height: 100vh;
  height: 100dvh;
  background: white;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  margin: 0 auto;
  position: relative;
}
@media (min-width: 500px) {
  .detail-shell {
    height: min(900px, calc(100vh - 40px));
    border-radius: 36px;
    box-shadow: 0 24px 80px rgba(0,0,0,0.2), 0 0 0 1px rgba(0,0,0,0.07);
  }
}
.detail-back {
  padding: 12px 16px 8px;
  flex-shrink: 0;
}
.detail-back a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  font-family: 'Caveat', cursive;
  font-size: 17px;
  color: #4A7AC7;
}
.detail-hero {
  margin: 0 16px;
  border-radius: 16px;
  padding: 18px 20px 20px;
  background: #E63946;
  flex-shrink: 0;
}
.detail-hero-meta {
  font-family: 'Caveat', cursive;
  font-size: 14px;
  color: rgba(255,255,255,0.82);
  margin-bottom: 6px;
}
.detail-hero-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 800;
  font-size: 24px;
  color: white;
  line-height: 1.25;
  letter-spacing: 0.2px;
}
.detail-badge {
  display: inline-block;
  margin-top: 12px;
  background: rgba(255,255,255,0.22);
  border-radius: 20px;
  padding: 4px 12px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 12px;
  font-weight: 600;
  color: white;
  letter-spacing: 0.2px;
}
.detail-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 20px 100px;
}
.detail-info-row {
  display: flex;
  gap: 13px;
  margin-bottom: 15px;
  align-items: flex-start;
}
.detail-info-icon {
  width: 18px;
  flex-shrink: 0;
  margin-top: 2px;
  display: flex;
  justify-content: center;
}
.detail-info-label {
  font-family: 'Caveat', cursive;
  font-size: 12px;
  color: #c0b8ae;
  line-height: 1;
  margin-bottom: 2px;
}
.detail-info-value {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 14px;
  font-weight: 500;
  color: #111;
  line-height: 1.4;
}
.detail-sep { height: 1px; background: #f2f0ec; margin: 6px 0 16px; }
.detail-desc {
  font-family: 'Caveat', cursive;
  font-size: 15px;
  color: #777;
  line-height: 1.75;
}
.detail-source {
  display: inline-block;
  margin-top: 14px;
  font-family: 'Caveat', cursive;
  font-size: 14px;
  color: #4A7AC7;
  text-decoration: none;
}
.detail-cta {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 10px 16px 16px;
  background: white;
  border-top: 1px solid #f2f0ec;
}
.detail-share {
  width: 100%;
  background: #4A7AC7;
  color: white;
  border: none;
  border-radius: 14px;
  padding: 14px 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.3px;
  transition: transform 120ms ease, opacity 120ms ease;
}
.detail-share:active { transform: scale(0.98); opacity: 0.9; }
.detail-toast {
  position: absolute;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%);
  background: #111;
  color: white;
  border-radius: 10px;
  padding: 9px 18px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 200ms ease;
}
.detail-toast.visible { opacity: 1; }

/* ── Admin ── */
.admin-shell {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 16px 48px;
  font-family: 'Space Grotesk', sans-serif;
}
.admin-shell h1 {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 28px;
  font-weight: 800;
  color: #4A7AC7;
  margin-bottom: 24px;
}
.admin-shell h2 { font-size: 18px; margin-bottom: 12px; color: #111; }
.pending-list { list-style: none; display: flex; flex-direction: column; gap: 12px; }
.pending-card {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  padding: 14px;
}
.pending-info { flex: 1; font-size: 14px; line-height: 1.5; color: #333; }
.pending-info strong { color: #111; }
.pending-info a { color: #4A7AC7; font-size: 12px; }
.pending-actions { display: flex; flex-direction: column; gap: 8px; }
.btn-publish, .btn-reject {
  padding: 8px 14px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  width: 80px;
}
.btn-publish { background: #2e7d32; color: #fff; }
.btn-reject  { background: #c62828; color: #fff; }
.gs-empty-admin { color: #b0a899; font-style: italic; font-size: 14px; }

/* ── Monitoring scrapers ── */
.mon-section { margin-top: 36px; }

.mon-section details { border: 1px solid #e8e8e8; border-radius: 10px; overflow: hidden; }

.mon-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  cursor: pointer;
  list-style: none;
  user-select: none;
  background: #fafafa;
}
.mon-summary::-webkit-details-marker { display: none; }
.mon-summary::before {
  content: '▶';
  font-size: 10px;
  color: #999;
  transition: transform 200ms ease;
}
details[open] .mon-summary::before { transform: rotate(90deg); }

.mon-summary-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: #111;
  flex: 1;
}

/* Badges résumé */
.mon-badge {
  padding: 3px 10px;
  border-radius: 20px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 12px;
  font-weight: 600;
}
.mon-badge--ok    { background: #e8f5e9; color: #2e7d32; }
.mon-badge--alert { background: #fdecea; color: #c62828; }

/* Bouton "Lancer tous les scrapers" dans le summary */
.mon-run-form { margin-left: auto; }
.btn-run-scrapers {
  padding: 5px 14px;
  border: none;
  border-radius: 20px;
  background: #1a1a2e;
  color: #fff;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 150ms ease, opacity 150ms ease;
}
.btn-run-scrapers:hover  { background: #2d2d4e; }
.btn-run-scrapers:active { opacity: .7; }

/* Bouton "↺" relancer un seul scraper */
.mon-cell--actions { flex-direction: row; align-items: center; gap: 6px; flex-wrap: wrap; }
.mon-run-one-form  { display: inline; }
.btn-run-one {
  padding: 2px 7px;
  border: 1px solid #ccc;
  border-radius: 12px;
  background: #fff;
  color: #555;
  font-size: 13px;
  cursor: pointer;
  line-height: 1;
  transition: background 150ms ease, color 150ms ease;
}
.btn-run-one:hover  { background: #1a1a2e; color: #fff; border-color: #1a1a2e; }
.btn-run-one:active { opacity: .7; }

/* Grille des scrapers */
.mon-grid {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 13px;
}

.mon-row {
  display: grid;
  grid-template-columns: 2fr 2fr 1fr 1fr 1fr 1.5fr;
  gap: 0 8px;
  align-items: center;
  padding: 8px 16px;
  border-top: 1px solid #f2f0ec;
}

.mon-row--header {
  font-size: 11px;
  font-weight: 600;
  color: #aaa;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  background: #fafafa;
  padding: 6px 16px;
}

.mon-row--ok           { background: #fff; }
.mon-row--never        { background: #fff; color: #aaa; }
.mon-row--silent_break { background: #fffde7; }
.mon-row--error        { background: #fff8f8; }
.mon-row--repeat_error { background: #fdecea; }

.mon-cell { display: flex; flex-direction: column; gap: 1px; }
.mon-num  { font-variant-numeric: tabular-nums; }

.mon-source-name { font-weight: 600; color: #111; }
.mon-schedule    { font-size: 11px; color: #aaa; }
.mon-never       { color: #ccc; }

/* Badges statut inline */
.mon-status {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.mon-status--ok      { background: #e8f5e9; color: #2e7d32; }
.mon-status--never   { background: #f5f5f5; color: #9e9e9e; }
.mon-status--warn    { background: #fff8e1; color: #f57c00; cursor: help; }
.mon-status--error   { background: #fdecea; color: #c62828; cursor: help; }
.mon-status--repeat  { background: #c62828; color: #fff;    cursor: help; }

/* Ligne d'erreur dépliée */
.mon-error-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 4px 16px 10px 32px;
  background: #fff8f8;
  border-top: none;
}
.mon-error-label { font-size: 11px; font-weight: 600; color: #c62828; white-space: nowrap; padding-top: 2px; }
.mon-error-msg   { font-size: 11px; color: #555; word-break: break-all; white-space: pre-wrap; }

/* Responsive : masquer colonnes durée/insérés sur mobile */
@media (max-width: 600px) {
  .mon-row { grid-template-columns: 2fr 2fr 1fr 1.5fr; }
  .mon-row > :nth-child(4),
  .mon-row > :nth-child(5) { display: none; }
}

/* ── Stats ── */
.stats-section { margin-top: 36px; }
.stats-section h2 { font-size: 18px; margin-bottom: 16px; color: #111; }

.stats-kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 24px;
}
@media (max-width: 500px) {
  .stats-kpi-row { grid-template-columns: repeat(2, 1fr); }
}

.stats-kpi {
  background: #f9f9f9;
  border: 1px solid #ebebeb;
  border-radius: 10px;
  padding: 14px 16px;
  text-align: center;
}
.stats-kpi--green { border-color: #c8e6c9; background: #f1f8f1; }
.stats-kpi--amber { border-color: #ffe0b2; background: #fffaf4; }
.stats-kpi--red   { border-color: #ffcdd2; background: #fff5f5; }

.stats-kpi-label { font-size: 11px; font-weight: 600; color: #aaa; text-transform: uppercase; letter-spacing: 0.4px; margin-bottom: 4px; }
.stats-kpi-num   { font-family: 'Barlow Condensed', sans-serif; font-size: 32px; font-weight: 700; color: #111; line-height: 1; }
.stats-kpi--green .stats-kpi-num { color: #2e7d32; }
.stats-kpi--amber .stats-kpi-num { color: #e65100; }
.stats-kpi--red   .stats-kpi-num { color: #c62828; }

.stats-breakdown-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}
@media (max-width: 560px) {
  .stats-breakdown-row { grid-template-columns: 1fr; }
}

.stats-breakdown-block { display: flex; flex-direction: column; gap: 8px; }
.stats-breakdown-title { font-size: 12px; font-weight: 600; color: #aaa; text-transform: uppercase; letter-spacing: 0.4px; margin-bottom: 4px; }

.stats-bar-row { display: flex; align-items: center; gap: 8px; }
.stats-bar-label { font-size: 12px; color: #555; width: 120px; flex-shrink: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stats-bar-track { flex: 1; height: 6px; background: #f0f0f0; border-radius: 3px; overflow: hidden; }
.stats-bar-fill  { height: 100%; border-radius: 3px; min-width: 2px; transition: width 400ms ease; }
.stats-bar-fill--blue   { background: #4A7AC7; }
.stats-bar-fill--purple { background: #7B5EA7; }
.stats-bar-count { font-size: 12px; font-weight: 600; color: #555; width: 28px; text-align: right; flex-shrink: 0; }
