/*
 * SW Dashboard — feuille de styles applicative.
 *
 * Charte (annexe 15.1 du cahier des charges) + shell applicatif + composants,
 * portés fidèlement depuis dashboard-mockup.html. Aucune dépendance à un
 * framework CSS. Classes sémantiques BEM-like.
 */

/* ============================== CHARTE ============================== */
:root {
  --primary:          #550815; /* Titres, sidebar, accents principaux */
  --accent:           #8B2F3A; /* CTA secondaires, filets, mentions importantes */
  --alert:            #D02027; /* Urgences et accents très ponctuels uniquement */
  --body:             #2A2424; /* Texte courant (jamais noir pur) */
  --secondary:        #7A7066; /* Texte secondaire, légendes */
  --light:            #F5EFE6; /* Fond encadrés, lignes totaux */
  --border:           #D9CFC0; /* Bordures subtiles cartes/tableaux */
  --white:            #FFFFFF; /* Fond cards */
  --bg:               #FAF7F2; /* Fond app cream très léger */
  --sidebar-bg:       #2A1116; /* Sidebar gauche sombre */
  --sidebar-text:     #F5EFE6;
  --sidebar-text-dim: rgba(245, 239, 230, 0.55);
  --sidebar-hover:    rgba(245, 239, 230, 0.08);
  --sidebar-active:   rgba(208, 32, 39, 0.18);
}

/* ============================== RESET / BASE ============================== */
*,
*::before,
*::after {
  box-sizing: border-box;
}

* {
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
}

body {
  font-family: Arial, sans-serif;
  font-size: 14px;
  line-height: 1.55;
  color: var(--body);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
}

img {
  max-width: 100%;
  height: auto;
}

.hidden {
  display: none !important;
}

/* ============================== LOGIN ============================== */
.login {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--light) 0%, var(--bg) 50%, #EBE1D2 100%);
  padding: 24px;
}
.login__card {
  background: var(--white);
  border-radius: 6px;
  box-shadow: 0 8px 40px rgba(85, 8, 21, 0.12);
  width: 100%;
  max-width: 420px;
  padding: 40px 36px 32px;
  border-top: 4px solid var(--primary);
}
.login__brand {
  text-align: center;
  margin-bottom: 28px;
}
.login__wordmark {
  font-size: 26px;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: -0.5px;
}
.login__wordmark::after { content: "_"; color: var(--alert); }
.login__tagline {
  font-size: 11px;
  color: var(--secondary);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-top: 6px;
}
.login h1 {
  font-size: 19px;
  color: var(--primary);
  margin-bottom: 6px;
  text-align: center;
  font-weight: 700;
}
.login__sub {
  font-size: 13px;
  color: var(--secondary);
  text-align: center;
  margin-bottom: 26px;
}
.login__field { margin-bottom: 14px; }
.login__field label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  color: var(--secondary);
  letter-spacing: 1px;
  margin-bottom: 6px;
  font-weight: 700;
}
.login__field input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: Arial, sans-serif;
  font-size: 14px;
  color: var(--body);
  background: var(--white);
  transition: border-color 0.15s;
}
.login__field input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(85, 8, 21, 0.08);
}
.login__cta {
  width: 100%;
  background: var(--primary);
  color: var(--white);
  border: 0;
  padding: 12px;
  font-family: Arial, sans-serif;
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  border-radius: 4px;
  cursor: pointer;
  margin-top: 12px;
  transition: background 0.15s;
}
.login__cta:hover { background: #420610; }
.login__remember {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--secondary);
  margin-top: 12px;
}
.login__forgot {
  text-align: center;
  margin-top: 16px;
  font-size: 12px;
}
.login__forgot a { color: var(--accent); text-decoration: none; }
.login__forgot a:hover { text-decoration: underline; }
.login__error {
  background: rgba(208, 32, 39, 0.08);
  border: 1px solid var(--alert);
  color: var(--alert);
  font-size: 12px;
  padding: 10px 12px;
  border-radius: 4px;
  margin-bottom: 18px;
}
.login__notice {
  background: var(--light);
  border: 1px solid var(--border);
  color: var(--body);
  font-size: 12px;
  padding: 10px 12px;
  border-radius: 4px;
  margin-bottom: 18px;
}
.login__footer {
  text-align: center;
  font-size: 10px;
  color: var(--secondary);
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  line-height: 1.7;
}

/* ============================== APP SHELL ============================== */
.app {
  display: grid;
  grid-template-columns: 248px 1fr;
  min-height: 100vh;
}

/* SIDEBAR */
.sidebar {
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  padding: 22px 14px 14px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid rgba(0, 0, 0, 0.2);
}
.sidebar__brand {
  padding: 0 8px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 16px;
}
.sidebar__wordmark {
  font-size: 20px;
  font-weight: 700;
  color: var(--white);
  letter-spacing: -0.3px;
  text-decoration: none;
}
.sidebar__wordmark::after { content: "_"; color: var(--alert); }
.sidebar__tagline {
  font-size: 10px;
  color: var(--sidebar-text-dim);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-top: 3px;
}
.sidebar__section-label {
  font-size: 10px;
  color: var(--sidebar-text-dim);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  padding: 14px 10px 6px;
}
.sidebar__nav {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.sidebar__item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 10px;
  border-radius: 4px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.12s;
  border-left: 2px solid transparent;
}
.sidebar__item:hover { background: var(--sidebar-hover); }
.sidebar__item.is-active {
  background: var(--sidebar-active);
  border-left-color: var(--alert);
  font-weight: 700;
}
.sidebar__item.is-disabled {
  color: var(--sidebar-text-dim);
  cursor: not-allowed;
}
.sidebar__item.is-disabled:hover { background: transparent; }
.sidebar__icon {
  width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
}
.sidebar__badge {
  margin-left: auto;
  font-size: 9px;
  background: rgba(245, 239, 230, 0.15);
  color: var(--sidebar-text-dim);
  padding: 2px 6px;
  border-radius: 8px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.sidebar__subnav {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin: 1px 0 2px;
  padding-left: 27px;
}
.sidebar__subitem {
  display: block;
  padding: 7px 10px;
  border-radius: 4px;
  color: var(--sidebar-text-dim);
  text-decoration: none;
  font-size: 12.5px;
  transition: background 0.12s, color 0.12s;
  border-left: 2px solid transparent;
}
.sidebar__subitem:hover {
  background: var(--sidebar-hover);
  color: var(--sidebar-text);
}
.sidebar__subitem.is-active {
  background: var(--sidebar-active);
  border-left-color: var(--alert);
  color: var(--sidebar-text);
  font-weight: 700;
}
.sidebar__footer {
  margin-top: auto;
  padding: 14px 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.sidebar__user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 4px;
  cursor: pointer;
  border-radius: 4px;
  text-decoration: none;
}
.sidebar__user:hover { background: var(--sidebar-hover); }
.sidebar__avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}
.sidebar__user-info { overflow: hidden; flex: 1; min-width: 0; }
.sidebar__user-name {
  font-size: 12px;
  color: var(--white);
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar__user-mail {
  font-size: 10px;
  color: var(--sidebar-text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* MAIN AREA */
.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--bg);
}
.topbar {
  padding: 14px 32px;
  background: var(--white);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 56px;
}
.topbar__toggle {
  display: none;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--primary);
  font-size: 16px;
  line-height: 1;
  padding: 6px 10px;
  border-radius: 4px;
  cursor: pointer;
}
.breadcrumb {
  flex: 1;
  font-size: 12px;
  color: var(--secondary);
}
.breadcrumb a { color: var(--secondary); text-decoration: none; cursor: pointer; }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb__sep { margin: 0 8px; color: var(--border); }
.breadcrumb__current { color: var(--primary); font-weight: 700; }

.topbar__actions { display: flex; gap: 10px; align-items: center; }
.topbar__btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--body);
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
  font-family: Arial, sans-serif;
  text-decoration: none;
  transition: all 0.15s;
}
.topbar__btn:hover {
  background: var(--light);
  border-color: var(--primary);
  color: var(--primary);
}

/* CONTENT */
.content {
  padding: 32px 40px 60px;
  flex: 1;
  overflow-y: auto;
}

.view__header { margin-bottom: 28px; }
.view__eyebrow {
  font-size: 11px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 1.8px;
  font-weight: 700;
  margin-bottom: 6px;
}
.view__title {
  font-size: 28px;
  color: var(--primary);
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 8px;
}
.view__lead { font-size: 14px; color: var(--secondary); max-width: 680px; }

/* Bandeau d'erreur d'accès (sw_error=access) */
.access-notice {
  background: rgba(208, 32, 39, 0.08);
  border: 1px solid var(--alert);
  color: var(--alert);
  font-size: 13px;
  padding: 12px 16px;
  border-radius: 4px;
  margin-bottom: 24px;
}

/* HOME : welcome card */
.welcome-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 28px 32px;
  margin-bottom: 28px;
  border-left: 4px solid var(--primary);
}
.welcome-card h2 { color: var(--primary); font-size: 18px; margin-bottom: 8px; }
.welcome-card p { color: var(--body); margin-bottom: 0; }

.quick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 36px;
}
.quick-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 20px 22px;
  cursor: pointer;
  transition: all 0.15s;
  border-top: 3px solid var(--accent);
  text-decoration: none;
  display: block;
}
.quick-card:hover {
  border-top-color: var(--primary);
  box-shadow: 0 4px 16px rgba(85, 8, 21, 0.08);
  transform: translateY(-2px);
}
.quick-card.is-soon { opacity: 0.55; cursor: not-allowed; }
.quick-card.is-soon:hover { transform: none; box-shadow: none; border-top-color: var(--accent); }
.quick-card__label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--secondary);
  margin-bottom: 4px;
}
.quick-card__title { font-size: 17px; color: var(--primary); font-weight: 700; margin-bottom: 8px; }
.quick-card__desc { font-size: 12px; color: var(--body); line-height: 1.5; }
.quick-card__pill {
  display: inline-block;
  font-size: 9px;
  background: var(--light);
  color: var(--accent);
  padding: 3px 8px;
  border-radius: 8px;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-top: 10px;
  font-weight: 700;
}

.section-title {
  font-size: 12px;
  color: var(--secondary);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 14px;
  font-weight: 700;
}

/* PROJETS GRID */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
}
.project-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 22px;
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
  text-decoration: none;
  display: block;
}
.project-card:hover { border-color: var(--primary); box-shadow: 0 4px 16px rgba(85, 8, 21, 0.08); }
.project-card__badge {
  position: absolute;
  top: 14px;
  right: 14px;
  font-size: 9px;
  background: #2E7D4F;
  color: var(--white);
  padding: 2px 8px;
  border-radius: 8px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: 700;
}
.project-card__name { font-size: 17px; color: var(--primary); font-weight: 700; margin-bottom: 4px; padding-right: 60px; }
.project-card__url { font-size: 12px; color: var(--secondary); margin-bottom: 14px; }
.project-card__meta {
  display: flex;
  gap: 18px;
  font-size: 11px;
  color: var(--secondary);
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.project-card__meta strong { color: var(--primary); display: block; font-size: 14px; margin-bottom: 2px; font-weight: 700; }

/* SPLIT VIEW (sidebar mois + contenu) */
.split {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 0;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  min-height: 600px;
}
.months { background: var(--light); border-right: 1px solid var(--border); padding: 14px 0; }
.months__label {
  font-size: 10px;
  color: var(--secondary);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  padding: 6px 18px 10px;
  font-weight: 700;
}
.months__year {
  font-size: 11px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 14px 18px 6px;
  font-weight: 700;
  border-top: 1px solid var(--border);
  margin-top: 8px;
}
.months__year:first-of-type { border-top: 0; margin-top: 0; }
.month-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 18px;
  cursor: pointer;
  font-size: 13px;
  color: var(--body);
  border-left: 2px solid transparent;
  transition: all 0.12s;
  text-decoration: none;
}
.month-item:hover { background: rgba(85, 8, 21, 0.04); color: var(--primary); }
.month-item.is-active {
  background: var(--white);
  border-left-color: var(--alert);
  color: var(--primary);
  font-weight: 700;
}
.month-item__pill {
  font-size: 9px;
  background: rgba(85, 8, 21, 0.08);
  color: var(--accent);
  padding: 2px 6px;
  border-radius: 6px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.month-item.is-active .month-item__pill { background: var(--accent); color: var(--white); }
.month-item.is-draft { color: var(--secondary); }
.month-item.is-draft .month-item__pill { background: transparent; border: 1px dashed var(--border); color: var(--secondary); }

.split__content { padding: 28px 32px 32px; overflow-y: auto; }

.empty-state { text-align: center; padding: 60px 30px; color: var(--secondary); }
.empty-state__icon { font-size: 36px; color: var(--border); margin-bottom: 14px; }
.empty-state__title { font-size: 16px; color: var(--primary); margin-bottom: 6px; font-weight: 700; }
.empty-state__cta {
  display: inline-block;
  margin-top: 16px;
  background: var(--primary);
  color: var(--white);
  text-decoration: none;
  padding: 9px 16px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* REPORT VIEW */
.report-header { padding-bottom: 18px; margin-bottom: 22px; border-bottom: 1px solid var(--border); }
.report-header__eyebrow {
  font-size: 10px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 1.8px;
  font-weight: 700;
  margin-bottom: 5px;
}
.report-header h1 { font-size: 24px; color: var(--primary); font-weight: 700; margin-bottom: 6px; letter-spacing: -0.3px; }
.report-header__meta { font-size: 12px; color: var(--secondary); }

.en-bref-mini {
  background: var(--light);
  border-top: 2px solid var(--primary);
  border-bottom: 1px solid var(--secondary);
  padding: 18px 22px;
  margin-bottom: 24px;
}
.en-bref-mini__label {
  font-size: 10px;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  font-weight: 700;
  margin-bottom: 10px;
}
.en-bref-mini p { font-size: 13px; margin-bottom: 8px; }
.en-bref-mini p:last-child { margin-bottom: 0; }
.en-bref-mini strong { color: var(--primary); }

.editorial h2 {
  font-size: 17px;
  color: var(--primary);
  font-weight: 700;
  margin-top: 24px;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.editorial h2:first-child { margin-top: 0; }
.editorial p { margin-bottom: 10px; font-size: 13px; }
.editorial ul { margin: 8px 0 12px 18px; }
.editorial li { margin-bottom: 4px; font-size: 13px; }
.editorial table { border-collapse: collapse; width: 100%; margin: 12px 0; font-size: 13px; }
.editorial th, .editorial td { border: 1px solid var(--border); padding: 8px 10px; text-align: left; }
.editorial th { background: var(--light); color: var(--primary); }

/* ============================== PAGE PROJET (widget GA4 + prestations) ============================== */
.ga4-widget {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 22px 24px;
  margin-bottom: 28px;
}
.ga4-widget__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.ga4-widget__title { font-size: 18px; color: var(--primary); font-weight: 700; }
.ga4-widget__updated { font-size: 11px; color: var(--secondary); white-space: nowrap; }
.ga4-widget .sw-scorecards { margin-bottom: 20px; }
.ga4-widget__placeholder {
  background: var(--light);
  border: 1px dashed var(--border);
  border-radius: 4px;
  padding: 26px 20px;
  text-align: center;
  font-size: 13px;
  color: var(--secondary);
}

.prestations-section { margin-bottom: 8px; }

.prestation-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
}
.prestation-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-top: 3px solid var(--primary);
  border-radius: 6px;
  padding: 20px 22px;
  position: relative;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  transition: all 0.15s;
}
a.prestation-card { cursor: pointer; }
a.prestation-card:hover { border-color: var(--primary); box-shadow: 0 4px 16px rgba(85, 8, 21, 0.08); }

.prestation-card__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.prestation-card__name { font-size: 17px; color: var(--primary); font-weight: 700; }
.prestation-card__badge {
  font-size: 9px;
  background: var(--secondary);
  color: var(--white);
  padding: 2px 8px;
  border-radius: 8px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: 700;
  white-space: nowrap;
}
.prestation-card__tagline { font-size: 12px; color: var(--secondary); margin-bottom: 14px; line-height: 1.5; }
.prestation-card__meta {
  display: flex;
  gap: 18px;
  font-size: 11px;
  color: var(--secondary);
  padding-top: 12px;
  margin-top: auto;
  border-top: 1px solid var(--border);
}
.prestation-card__meta strong { color: var(--primary); display: block; font-size: 14px; margin-bottom: 2px; font-weight: 700; }
.prestation-card__cta {
  margin-top: 12px;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}
.prestation-card__note { font-size: 12px; color: var(--secondary); margin-top: auto; line-height: 1.5; }
.prestation-card__upsell {
  display: inline-block;
  margin-top: 12px;
  background: var(--primary);
  color: var(--white);
  text-decoration: none;
  padding: 8px 14px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  align-self: flex-start;
}
.prestation-card__upsell:hover { background: var(--accent); }
.prestation-card__upsell { border: 0; cursor: pointer; font-family: inherit; line-height: 1.2; }
.prestation-card__upsell-form { margin: 0; }

/* Notices de retour (demande de devis) */
.prestation-notice {
  padding: 10px 14px;
  border-radius: 4px;
  font-size: 13px;
  line-height: 1.5;
  margin-bottom: 18px;
}
.prestation-notice--ok { background: var(--light); color: var(--primary); border: 1px solid var(--border); }
.prestation-notice--error { background: #FBE9EA; color: var(--alert); border: 1px solid var(--alert); }

/* États dérivés */
.prestation-card--coming { border-top-color: var(--accent); }
.prestation-card--coming .prestation-card__badge { background: var(--accent); }
.prestation-card--ended { border-top-color: var(--secondary); }
.prestation-card--unsubscribed {
  background: var(--bg);
  border-top-color: var(--border);
  opacity: 0.92;
}
.prestation-card--unsubscribed .prestation-card__name { color: var(--secondary); }

/* PAGE-TYPE : historique d'évolution + sélection mois */
.type-months { margin-bottom: 8px; }

/* Historique d'une prestation (graphe d'évolution multi-mois). */
.sw-history {
  margin-bottom: 28px;
  padding: 18px 20px 16px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.sw-history__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.sw-history__pills { display: flex; flex-wrap: wrap; gap: 6px; }
.sw-history__pill {
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  color: var(--secondary);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 13px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.sw-history__pill:hover { color: var(--primary); border-color: var(--accent); }
.sw-history__pill.is-active {
  color: var(--white);
  background: var(--primary);
  border-color: var(--primary);
}
.sw-history__toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}
.sw-history__windows { display: inline-flex; gap: 2px; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 2px; }
.sw-history__win {
  font: inherit;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--secondary);
  background: transparent;
  border: 0;
  border-radius: 6px;
  padding: 5px 11px;
  cursor: pointer;
}
.sw-history__win:hover { color: var(--primary); }
.sw-history__win.is-active { color: var(--white); background: var(--accent); }
.sw-history__controls {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}
.sw-history__range {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--body);
}
.sw-history__range-label {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.sw-history__range select {
  font: inherit;
  font-size: 12px;
  color: var(--body);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 6px;
  cursor: pointer;
}
.sw-history__range select:focus { border-color: var(--accent); outline: none; }
.sw-history__range-sep { color: var(--secondary); }
.sw-history__range-reset {
  font: inherit;
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  background: transparent;
  border: 0;
  padding: 4px 6px;
  cursor: pointer;
}
.sw-history__range-reset:hover { text-decoration: underline; }
.sw-history__compare {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  color: var(--body);
  cursor: pointer;
  user-select: none;
}
.sw-history__compare input { accent-color: var(--accent); cursor: pointer; }
.sw-history__compare.is-disabled { opacity: 0.45; cursor: not-allowed; }
.sw-history__compare.is-disabled input { cursor: not-allowed; }
.sw-history__chart { margin-top: 4px; }
.sw-chart__swatch--ghost { opacity: 0.6; }

.month-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
}
.month-grid__year {
  grid-column: 1 / -1;
  font-size: 11px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 700;
  margin-top: 6px;
}
.month-grid__year:first-child { margin-top: 0; }
.month-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
  border-radius: 4px;
  padding: 14px 16px;
  text-decoration: none;
  transition: all 0.15s;
  display: block;
}
.month-card:hover { border-color: var(--primary); box-shadow: 0 4px 14px rgba(85, 8, 21, 0.08); }
.month-card__date { display: block; font-size: 14px; color: var(--primary); font-weight: 700; }
.month-card__ref { display: block; font-size: 11px; color: var(--secondary); margin-top: 3px; }

/* ============================== RAPPORT MAISON (composants) ============================== */
.sw-report { margin-bottom: 8px; }

.sw-report__section { margin-bottom: 30px; }
.sw-report__section:last-child { margin-bottom: 0; }

.sw-report__eyebrow {
  font-size: 10px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 1.8px;
  font-weight: 700;
  margin-bottom: 12px;
}
.sw-report__title {
  font-size: 17px;
  color: var(--primary);
  font-weight: 700;
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.sw-report__source {
  margin-top: 10px;
  font-size: 10px;
  color: var(--secondary);
  font-style: italic;
  text-align: right;
}
.sw-report__source::before { content: "\2139\00a0"; font-style: normal; }
.sw-report__methodo {
  margin-top: 24px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  line-height: 1.6;
  color: var(--secondary);
}
.sw-report__methodo strong { color: var(--body); }

/* Deux colonnes (Top requêtes / Top pages) */
.sw-report__cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}
.sw-report__col { min-width: 0; } /* autorise le rétrécissement → le scroll/wrap de la table fonctionne */
.sw-report__col .sw-report__eyebrow { margin-bottom: 8px; }

/* Sous-titre interne à une section (ex. « Évolution des positions ») */
.sw-report__subtitle {
  margin: 20px 0 10px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--accent);
}

/* Répartition par appareil : donut + scorecards côte à côte, alignés au centre */
.sw-report__cols--device { align-items: center; }

/* Position locale (pack Google Maps) — encadré mis en avant */
.sw-report__localrank {
  margin-top: 12px;
  padding: 12px 16px;
  background: var(--light);
  border-left: 3px solid var(--accent);
  border-radius: 4px;
  font-size: 14px;
  color: var(--body);
}
.sw-report__localrank strong { color: var(--primary); font-size: 16px; }

/* SCORECARDS */
.sw-scorecards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}
.sw-scorecards--2 { grid-template-columns: repeat(2, 1fr); }
.sw-scorecards--3 { grid-template-columns: repeat(3, 1fr); }
.sw-scorecards--5 { grid-template-columns: repeat(5, 1fr); }
.sw-scorecards--6 { grid-template-columns: repeat(6, 1fr); }
.sw-scorecards + .sw-scorecards { margin-top: 14px; }
.sw-scorecard {
  background: var(--white);
  border: 1px solid var(--border);
  border-top: 3px solid var(--primary);
  border-radius: 4px;
  padding: 14px 16px;
}
.sw-scorecard__label {
  font-size: 11px;
  color: var(--secondary);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: 700;
  margin-bottom: 8px;
}
.sw-scorecard__value {
  font-size: 24px;
  color: var(--primary);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.3px;
}

/* DELTA (Δ vs N-1) */
.sw-delta {
  display: inline-block;
  margin-top: 8px;
  font-size: 12px;
  font-weight: 700;
}
.sw-delta--up   { color: var(--ok, #2F7A4D); }
.sw-delta--down { color: var(--alert); }
.sw-delta--flat { color: var(--secondary); }

/* GRAPHES SVG */
.sw-chart { margin: 0; position: relative; }
.sw-chart__svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}
.sw-chart--line .sw-chart__svg { cursor: crosshair; }

/* Graduation Y (axes gauche/droite) */
.sw-chart__ylabel { font-size: 10px; font-family: Arial, sans-serif; opacity: 0.9; }

/* Curseur vertical + infobulle au survol (valeurs par mois) */
.sw-chart__cursor {
  position: absolute;
  width: 1px;
  background: var(--accent);
  opacity: 0.55;
  pointer-events: none;
  z-index: 3;
}
.sw-chart__tip {
  position: absolute;
  pointer-events: none;
  z-index: 4;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 7px 10px;
  font-size: 11.5px;
  line-height: 1.55;
  box-shadow: 0 3px 12px rgba(42, 17, 22, 0.14);
  white-space: nowrap;
}
.sw-chart__tip-x { font-weight: 700; color: var(--primary); margin-bottom: 3px; }
.sw-chart__tip-row { color: var(--body); }
.sw-chart__tip-row strong { color: var(--primary); }
.sw-chart__tip-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.sw-chart--line .sw-chart__svg,
.sw-chart--bars .sw-chart__svg { height: 230px; }
.sw-chart__svg--donut { width: 180px; height: 180px; max-width: 100%; }
.sw-chart--donut { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }

.sw-chart__xlabel { font-size: 11px; fill: var(--secondary); font-family: Arial, sans-serif; }
.sw-chart__barval { font-size: 11px; fill: var(--primary); font-weight: 700; font-family: Arial, sans-serif; }
.sw-chart__center-value { font-size: 22px; fill: var(--primary); font-weight: 700; font-family: Arial, sans-serif; }
.sw-chart__center-label { font-size: 9px; fill: var(--secondary); text-transform: uppercase; letter-spacing: 1px; font-family: Arial, sans-serif; }

.sw-chart__legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin-top: 12px;
  font-size: 12px;
  color: var(--body);
}
.sw-chart__key { display: inline-flex; align-items: center; gap: 6px; }
.sw-chart__swatch { display: inline-block; width: 12px; height: 12px; border-radius: 2px; }

/* TABLEAUX DE DONNÉES */
.sw-dtable-wrap {
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.sw-dtable {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
/* Les colonnes texte (Page, Requête, Mot-clé) coupent les longues URLs au lieu
   de forcer la table à déborder. */
.sw-dtable td.sw-dtable--left {
  overflow-wrap: anywhere;
  word-break: break-word;
}
.sw-dtable th,
.sw-dtable td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}
.sw-dtable__th {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--primary);
  background: var(--light);
  font-weight: 700;
}
.sw-dtable tbody tr:last-child td { border-bottom: 0; }
.sw-dtable tbody tr:hover { background: rgba(85, 8, 21, 0.03); }
.sw-dtable--right { text-align: right; }
.sw-dtable--left { text-align: left; }
.sw-dtable td.sw-dtable--right { font-variant-numeric: tabular-nums; }
.sw-dtable__empty { font-size: 12px; color: var(--secondary); font-style: italic; }

/* FOOTER */
.app-footer {
  padding: 14px 32px;
  background: var(--white);
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 10px;
  color: var(--secondary);
}

/* ============================== RESPONSIVE ============================== */
/* Drawer overlay (masqué en desktop) */
.sw-drawer-overlay { display: none; }

/* Tablette : sidebar en drawer rétractable */
@media (max-width: 1023px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 248px;
    z-index: 60;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
  }
  body.sw-drawer-open .sidebar { transform: none; }
  .sw-drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 55;
  }
  body.sw-drawer-open .sw-drawer-overlay { display: block; }
  .topbar__toggle { display: inline-flex; align-items: center; justify-content: center; }
}

/* Mobile : pleine largeur, sidebar mois empilée au-dessus du rapport */
@media (max-width: 767px) {
  .topbar { padding: 12px 16px; }
  .content { padding: 20px 16px 48px; }
  .view__title { font-size: 24px; }
  .split { grid-template-columns: 1fr; }
  .months {
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }
  .split__content { padding: 22px 18px; }
  .app-footer { padding: 12px 16px; }

  /* Rapport maison : grilles repliées sur une colonne */
  .sw-scorecards { grid-template-columns: 1fr 1fr; }
  .sw-report__cols { grid-template-columns: 1fr; gap: 22px; }

  /* Page projet / page-type */
  .ga4-widget { padding: 18px 16px; }
  .ga4-widget__head { flex-direction: column; gap: 4px; }
  .prestation-grid { grid-template-columns: 1fr; }
  .month-grid { grid-template-columns: 1fr 1fr; }
}

/* Tablette : scorecards en 2 colonnes (4 trop serrées) */
@media (min-width: 768px) and (max-width: 1100px) {
  .sw-scorecards { grid-template-columns: repeat(2, 1fr); }
}

/* Formulaire de suggestion d'amélioration (page Aide) */
.sw-suggest-form { margin-top: 14px; }
.sw-suggest-form__label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--primary);
  margin: 12px 0 5px;
}
.sw-suggest-form__optional { font-weight: 400; color: var(--secondary); text-transform: none; }
.sw-suggest-form__input,
.sw-suggest-form__textarea {
  width: 100%;
  font-family: Arial, sans-serif;
  font-size: 14px;
  color: var(--body);
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 10px 12px;
  box-sizing: border-box;
}
.sw-suggest-form__textarea { resize: vertical; min-height: 110px; line-height: 1.55; }
.sw-suggest-form__input:focus,
.sw-suggest-form__textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(139, 47, 58, 0.15);
}
.sw-suggest-form__submit {
  margin-top: 14px;
  background: var(--primary);
  color: var(--white);
  border: 0;
  padding: 11px 20px;
  font-family: Arial, sans-serif;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s;
}
.sw-suggest-form__submit:hover { background: #420610; }
