:root{
  --chart-text:#0f172a;
  --chart-grid:rgba(15,23,42,0.08);
}

.dark{
  --chart-text:#e2e8f0;
  --chart-grid:rgba(255,255,255,0.08);
}

body{
  margin:0;
  padding:20px 10px 40px;
  min-height:100vh;
  font-family:Arial,sans-serif;
}

body.dark{
  background:#0f172a;
  color:white;
}

body.light{
  background:#f1f5f9;
  color:#111;
}

/* =========================
   HEADER
========================= */
.header{
  position:relative;
  text-align:center;
  margin-bottom:25px;
}

.header h1{
  margin:0;
  font-size:28px;
}

.header-subtitle, .day-length{
  margin-top:6px;
  font-size:14px;
  opacity:.7;
}

.menu-btn{
  position:absolute;
  top:0;
  right:0;
  font-size:24px;
  cursor:pointer;
  padding:5px 10px;
}

/* =========================
   MENU
========================= */
.menu {
  width:max-content;
  min-width:unset;
  position: fixed;
  top: 60px;
  right: 15px;
  background: #1e293b;
  border-radius: 10px;
  padding: 10px;
  display: none;
  flex-direction: column;
  gap: 0px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.4);
  z-index: 1000;
}

.menu a,
.menu button {
  display:flex;
  align-items:center;
  gap:10px;
  width:100%;
  margin:0;
  padding:8px 10px;
  font-family:inherit;
  font-size:15px;
  font-weight:500;
  line-height:1;
  background:none;
  border:none;
  color:white;
  text-decoration:none;
  cursor:pointer;
  box-sizing:border-box;
}

.menu a:hover,
.menu button:hover {
  background: rgba(255,255,255,0.1);
  border-radius: 6px;
}

body.light .menu{
  background:#ffffff;
  border:1px solid rgba(0,0,0,0.06);
  box-shadow:0 10px 30px rgba(0,0,0,0.12);
}

body.light .menu a,
body.light .menu button{
  color:#111;
}

body.light .menu a:hover,
body.light .menu button:hover{
  background:rgba(0,0,0,0.05);
}

/* =========================
   CARD & CONTAINER
========================= */
.card{
  background:#1e293b;
  border-radius:22px;
  padding:15px 15px;
  margin:10px 0;
  box-shadow:0 10px 25px rgba(0,0,0,0.30);
  overflow:hidden;
  font-size:14px;
  text-align:left;
}

body.light .card{
  background:#ffffff;
  color:#111;
  box-shadow:0 5px 15px rgba(0,0,0,0.1);
}

.home-container{
  width:100%;
  max-width:900px;
  margin:0 auto;
}

.title-icon{
  width:40px;
  height:40px;
  vertical-align:-6px;
  margin-right:8px;
}

/* =========================
   CONTROLS & TABLE
========================= */
.controls-bar {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
  margin-bottom: 15px;
  align-items: center;
  font-size: 14px;
}

.controls-bar select {
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid #94a3b8;
  background: #334155;
  color: white;
  font-family: inherit;
}

body.light .controls-bar select {
  background: #ffffff;
  color: #111;
}

.analysis-table {
  width: 100%;
  table-layout: fixed; /* Force les colonnes à garder une largeur proportionnelle et équilibrée */
  border-collapse: collapse;
  margin-top: 10px;
  font-size: 13px;
  text-align: center;
}

/* Fixer une largeur propre pour la première colonne des mois */
.analysis-table th:first-child,
.analysis-table td:first-child {
  width: 90px; 
}


.analysis-table th, .analysis-table td {
  padding: 8px 6px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

body.light .analysis-table th, body.light .analysis-table td {
  border-bottom: 1px solid rgba(0,0,0,0.1);
}

.analysis-table th {
  font-weight: 600;
  opacity: 0.8;
}

/* --- Styles pour les onglets de la page d'analyse --- */
.tabs-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 15px;
}
body.light .tabs-bar {
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.tab-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 8px 16px;
  border-radius: 8px;
  color: inherit;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  transition: all 0.2s;
}
body.light .tab-btn {
  background: rgba(0, 0, 0, 0.03);
  border: 1px solid rgba(0, 0, 0, 0.1);
}

.tab-btn.active {
  background: #f97316;
  border-color: #f97316;
  color: white;
}

/* --- Styles pour le récapitulatif global --- */
.global-recap-box {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
  background: rgba(255, 255, 255, 0.03);
  padding: 15px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}
body.light .global-recap-box {
  background: rgba(0, 0, 0, 0.02);
  border: 1px solid rgba(0, 0, 0, 0.06);
}

.recap-item {
  text-align: center;
}

.recap-value {
  font-size: 18px;
  font-weight: bold;
  margin-top: 4px;
}

/* --- Style Dashboard Pro (Thème Sombre / Clair) --- */
.home-container {
  max-width: 1400px !important;
  margin: 0 auto;
  padding: 10px;
}
.dashboard-main-card {
  background: rgba(25, 30, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 16px;
  padding: 25px;
  backdrop-filter: blur(10px);
}
body.light .dashboard-main-card {
  background: rgba(240, 242, 245, 0.8);
  border: 1px solid rgba(0, 0, 0, 0.06);
}
.dash-main-title {
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 5px;
  color: #ffffff;
}
body.light .dash-main-title {
  color: #1a1a1a;
}
.dash-main-subtitle {
  font-size: 13px;
  opacity: 0.6;
  margin-bottom: 25px;
}
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 20px;
}
.dash-card {
  background: #1e222d;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 20px;
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s ease, border-color 0.2s ease;
}
.dash-card:hover {
  border-color: rgba(52, 152, 219, 0.4);
}
body.light .dash-card {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  color: #2c3e50;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
}
.dash-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 15px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 12px;
  color: #3498db;
}
body.light .dash-title {
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  color: #2980b9;
}
.dash-date-sub {
  font-size: 13px;
  opacity: 0.7;
  margin-bottom: 15px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.dash-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  font-size: 14px;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.04);
  padding-bottom: 8px;
}
body.light .dash-row {
  border-bottom: 1px dashed rgba(0, 0, 0, 0.04);
}
.dash-row:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}
.dash-value {
  font-weight: bold;
}
.dash-sub-val {
  font-size: 12px;
  opacity: 0.6;
  font-weight: normal;
}
.dash-loading {
  opacity: 0.6;
  text-align: center;
  padding: 30px;
  font-style: italic;
}
.dash-footer {
  text-align: center;
  padding: 20px 10px;
  margin-top: 40px;
  font-size: 13px;
  opacity: 0.5;
  font-family: sans-serif;
}
