/* ================================================================
   VITI-Gest — demo-style.css
   Chrome visuel calqué sur l'application réelle (barre latérale
   sombre + contenu clair), utilisé uniquement par demo.html.
   Ne pas modifier style.css (site marketing) depuis ici.
   ================================================================ */

:root {
  --sb-bg:        #1C2B20;
  --sb-active:    #2D4030;
  --sb-hover:     #253428;
  --sb-border:    rgba(255,255,255,0.08);
  --sb-text:      #FFFFFF;
  --sb-muted:     rgba(255,255,255,0.50);
  --sb-accent:    #6BAF72;
  --sb-width:     258px;

  --hd-bg:        #FFFFFF;
  --hd-border:    #E0E4DF;

  --page-bg:      #F3F6F3;
  --page-title:   #3A6840;

  --card-bg:      #FFFFFF;
  --card-border:  #DFE3DF;
  --card-shadow:  0 1px 4px rgba(0,0,0,0.07);

  --tbl-head-bg:  #F7FAF7;
  --tbl-border:   #DFE3DF;
  --tbl-hover:    #EEF3EE;

  --badge-go:     #3A6840;
  --font:         -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: #222;
  background: var(--page-bg);
}

/* ---- Bandeau démo ---- */
.demo-notice {
  background: var(--sb-bg);
  color: rgba(255,255,255,0.88);
  font-size: 0.875rem;
  text-align: center;
  padding: 9px 16px;
  position: relative;
  z-index: 50;
}
.demo-notice a {
  color: rgba(255,255,255,0.75);
  text-decoration: underline;
  margin-left: 10px;
}
.demo-notice a:hover { color: #fff; }

/* ---- Mise en page principale ---- */
.app-wrap {
  display: flex;
  height: calc(100vh - 38px);
  overflow: hidden;
}

/* ---- Barre latérale ---- */
.sidebar {
  width: var(--sb-width);
  min-width: var(--sb-width);
  background: var(--sb-bg);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  flex-shrink: 0;
}

.sb-logo {
  display: flex;
  align-items: center;
  padding: 16px 18px 14px;
  border-bottom: 1px solid var(--sb-border);
  text-decoration: none;
}

.sb-wordmark {
  height: 24px;
  width: auto;
  display: block;
}

.sb-nav {
  flex: 1;
  padding: 6px 0;
  list-style: none;
}

.sb-item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 10px 18px;
  color: rgba(255,255,255,0.78);
  font-size: 0.9rem;
  font-family: var(--font);
  font-weight: 400;
  background: transparent;
  border: none;
  border-left: 3px solid transparent;
  text-align: left;
  cursor: pointer;
  transition: background 0.1s;
}

.sb-item:hover {
  background: var(--sb-hover);
  color: #fff;
}

.sb-item.active {
  background: var(--sb-active);
  color: #fff;
  border-left-color: var(--sb-accent);
  font-weight: 500;
}

.sb-icon {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  opacity: 0.65;
}

.sb-item.active .sb-icon,
.sb-item:hover .sb-icon {
  opacity: 1;
}

.sb-footer {
  padding: 12px 18px;
  border-top: 1px solid var(--sb-border);
  font-size: 0.72rem;
  color: var(--sb-muted);
  text-align: center;
  line-height: 1.7;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* ---- Zone principale ---- */
.main-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* ---- En-tête ---- */
.app-header {
  background: var(--hd-bg);
  border-bottom: 1px solid var(--hd-border);
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  gap: 16px;
}

.app-header-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #111;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  font-size: 0.86rem;
}

.connected-label { color: #777; }

.username { font-weight: 600; color: #222; }

.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--badge-go);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.btn-deconnect {
  background: #2C3B2C;
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 5px 13px;
  font-size: 0.83rem;
  font-family: var(--font);
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  line-height: 1.5;
}
.btn-deconnect:hover { background: var(--sb-bg); }

.lang-tag {
  border: 1px solid #D8DDD8;
  border-radius: 3px;
  padding: 2px 7px;
  font-size: 0.82rem;
  color: #555;
}

/* ---- Zone de contenu ---- */
.content-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 22px 26px 32px;
  background: var(--page-bg);
}

.page-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--page-title);
  margin-bottom: 14px;
}

/* ---- Panneaux ---- */
.panel { display: none; }
.panel.active { display: block; }

/* ---- Toolbar de panneau (year selector, etc.) ---- */
.panel-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.panel-toolbar-label {
  font-size: 0.82rem;
  color: #777;
}

.year-select {
  padding: 4px 10px;
  border: 1px solid #D0D5D0;
  border-radius: 4px;
  font-size: 0.875rem;
  font-family: var(--font);
  background: #fff;
  color: #333;
  pointer-events: none;
  appearance: none;
}

/* ---- Tableau de bord : carte ---- */
.map-block {
  background: #B8C9AF;
  border: 1px solid var(--card-border);
  border-radius: 4px;
  height: 300px;
  position: relative;
  overflow: hidden;
  margin-bottom: 18px;
}

.map-block svg { width: 100%; height: 100%; display: block; }

.map-toolbar {
  position: absolute;
  top: 10px;
  left: 10px;
  display: flex;
  gap: 6px;
  align-items: center;
}

.map-seg {
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 4px;
  display: flex;
  overflow: hidden;
}

.map-seg-btn {
  padding: 4px 13px;
  font-size: 0.8rem;
  font-family: var(--font);
  background: transparent;
  border: none;
  cursor: default;
  font-weight: 500;
  color: #555;
  white-space: nowrap;
}

.map-seg-btn + .map-seg-btn {
  border-left: 1px solid #ccc;
}

.map-seg-btn.active {
  background: var(--badge-go);
  color: #fff;
}

.map-zoom {
  position: absolute;
  bottom: 10px;
  left: 10px;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 4px;
  display: flex;
  flex-direction: column;
}

.map-zoom-btn {
  width: 28px;
  height: 24px;
  font-size: 1rem;
  line-height: 1;
  text-align: center;
  background: transparent;
  border: none;
  cursor: default;
  color: #444;
  font-family: var(--font);
}

.map-zoom-btn + .map-zoom-btn { border-top: 1px solid #ccc; }

.map-secteur {
  position: absolute;
  top: 10px;
  right: 10px;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 4px;
  padding: 4px 12px;
  font-size: 0.8rem;
  color: #555;
  font-family: var(--font);
  white-space: nowrap;
}

.map-legend {
  position: absolute;
  bottom: 10px;
  right: 10px;
  background: rgba(255,255,255,0.92);
  border: 1px solid #ccc;
  border-radius: 4px;
  padding: 8px 12px;
  font-size: 0.78rem;
  min-width: 110px;
}

.map-legend-title { font-weight: 600; margin-bottom: 5px; }

.leg-row {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 3px;
}

.leg-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ---- Cartes de statistiques (dashboard) ---- */
.stat-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 18px;
}

.stat-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 4px;
  padding: 14px 18px;
}

.stat-card-hd {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.stat-card-title {
  font-size: 0.92rem;
  font-weight: 600;
  color: #1A1A1A;
}

.count-badge {
  background: var(--badge-go);
  color: #fff;
  border-radius: 12px;
  padding: 1px 9px;
  font-size: 0.82rem;
  font-weight: 600;
  min-width: 26px;
  text-align: center;
}

.count-badge.muted { background: #9EB89E; }

.stat-items { list-style: none; }

.stat-items li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid var(--tbl-border);
  font-size: 0.86rem;
}

.stat-items li:last-child { border-bottom: none; }

.badge-pill {
  font-size: 0.73rem;
  font-weight: 500;
  padding: 1px 8px;
  border-radius: 10px;
}

.pill-go   { background: #E7F4E8; color: #2B6130; }
.pill-plan { background: #E7EEFF; color: #2B4BB0; }

/* ---- Tableaux de données ---- */
.section-title {
  font-size: 0.92rem;
  font-weight: 600;
  color: #1A1A1A;
  margin-bottom: 12px;
}

.data-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 18px;
}

.data-caption {
  padding: 9px 16px 5px;
  font-size: 0.78rem;
  color: #777;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th {
  text-align: left;
  padding: 9px 16px;
  font-size: 0.76rem;
  font-weight: 600;
  color: #333;
  background: var(--tbl-head-bg);
  border-bottom: 2px solid #C8CFC8;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

td {
  text-align: left;
  padding: 9px 16px;
  font-size: 0.875rem;
  border-bottom: 1px solid var(--tbl-border);
  color: #2A2A2A;
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--tbl-hover); }

/* ---- Filter bar ---- */
.filter-bar {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 4px;
  padding: 14px 16px;
  margin-bottom: 12px;
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
}

.filter-field {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.filter-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: #555;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.filter-input,
.filter-select {
  padding: 5px 9px;
  border: 1px solid #D0D5D0;
  border-radius: 3px;
  font-size: 0.875rem;
  font-family: var(--font);
  background: #fff;
  color: #333;
  pointer-events: none;
  min-width: 110px;
}

.filter-input-wide { min-width: 170px; }

.filter-actions {
  display: flex;
  gap: 8px;
  padding-bottom: 1px;
}

.btn-filter {
  padding: 5px 16px;
  background: var(--badge-go);
  color: #fff;
  border: none;
  border-radius: 3px;
  font-size: 0.875rem;
  font-family: var(--font);
  cursor: default;
  font-weight: 500;
}

.btn-reset {
  padding: 5px 12px;
  background: transparent;
  color: #666;
  border: 1px solid #D0D5D0;
  border-radius: 3px;
  font-size: 0.875rem;
  font-family: var(--font);
  cursor: default;
}

/* ---- Sort chips ---- */
.sort-chips {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.sort-label {
  font-size: 0.78rem;
  color: #888;
  margin-right: 2px;
}

.sort-chip {
  padding: 3px 12px;
  border: 1px solid #D0D5D0;
  border-radius: 14px;
  font-size: 0.82rem;
  background: #fff;
  color: #555;
  cursor: default;
}

.sort-chip.active {
  background: var(--badge-go);
  color: #fff;
  border-color: var(--badge-go);
}

/* ---- Plot cards grid ---- */
.plot-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 18px;
}

.plot-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 4px;
  padding: 14px 16px 12px;
}

.plot-card-hd {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 2px;
}

.plot-code {
  font-size: 0.72rem;
  font-weight: 700;
  color: #888;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.plot-area-m2 {
  font-size: 0.78rem;
  color: #888;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.plot-name {
  font-style: italic;
  font-size: 0.92rem;
  font-weight: 600;
  color: #1A1A1A;
  margin-bottom: 7px;
}

.plot-details {
  font-size: 0.78rem;
  color: #666;
  margin-bottom: 8px;
  line-height: 1.6;
}

.plot-details-sep {
  color: #bbb;
  margin: 0 4px;
}

.plot-badge {
  display: inline-block;
  font-size: 0.72rem;
  padding: 1px 8px;
  border-radius: 9px;
  background: #E7F4E8;
  color: #2B6130;
  font-weight: 500;
}

/* ---- Phyto subnav ---- */
.phyto-subnav {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.phyto-subnav-btn {
  padding: 7px 18px;
  border-radius: 4px;
  font-size: 0.875rem;
  font-family: var(--font);
  cursor: default;
  font-weight: 500;
  border: 1.5px solid var(--badge-go);
  background: var(--badge-go);
  color: #fff;
}

.phyto-subnav-btn.outline {
  background: transparent;
  color: var(--badge-go);
}

/* ---- Treatment sections ---- */
.treatment-section {
  margin-bottom: 24px;
}

.treatment-section-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: #1A1A1A;
  margin-bottom: 10px;
  padding-bottom: 7px;
  border-bottom: 2px solid #E0E6E0;
}

.treatment-group {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 4px;
  padding: 12px 16px;
  margin-bottom: 8px;
}

.treatment-group-hd {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 3px;
  gap: 12px;
}

.treatment-location {
  font-weight: 600;
  font-size: 0.9rem;
  color: #1A1A1A;
}

.treatment-product {
  font-size: 0.82rem;
  color: #555;
  margin-bottom: 7px;
}

.treatment-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.treatment-pills {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

.tpill {
  padding: 1px 8px;
  border-radius: 9px;
  font-size: 0.72rem;
  font-weight: 500;
  white-space: nowrap;
}

.tpill-grey  { background: #EAEAEA; color: #444; }
.tpill-drone { background: #E8F0FF; color: #2B4BB0; }
.tpill-qual  { background: #FFF4E0; color: #8B5E00; }
.tpill-bio   { background: #E7F4E8; color: #2B6130; }

.treatment-actions {
  display: flex;
  gap: 12px;
  flex-shrink: 0;
}

.treatment-link {
  font-size: 0.82rem;
  color: var(--badge-go);
  text-decoration: none;
  cursor: default;
}

.treatment-link.danger { color: #C0392B; }

/* ---- Vendanges stat badges ---- */
.vendanges-header-stats {
  display: flex;
  gap: 10px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.vd-stat-badge {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 4px;
  padding: 10px 18px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 140px;
}

.vd-stat-label {
  font-size: 0.75rem;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.vd-stat-value {
  font-size: 1.15rem;
  font-weight: 700;
  color: #1A1A1A;
  font-variant-numeric: tabular-nums;
}

/* ---- Vendanges icon cards ---- */
.vendanges-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 22px;
}

.vendanges-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 4px;
  padding: 22px 16px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  cursor: default;
}

.vendanges-card-icon {
  width: 44px;
  height: 44px;
  background: #E7F4E8;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.vendanges-card-icon svg {
  display: block;
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  color: var(--badge-go);
  overflow: visible;
}

.vendanges-card-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: #222;
  text-align: center;
}

/* ---- Personnel sub-nav ---- */
.personnel-tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid #DFE3DF;
  margin-bottom: 16px;
}

.personnel-tab {
  padding: 7px 18px;
  font-size: 0.875rem;
  font-family: var(--font);
  background: transparent;
  border: none;
  cursor: default;
  color: #666;
  font-weight: 500;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  white-space: nowrap;
}

.personnel-tab.active {
  color: var(--badge-go);
  border-bottom-color: var(--badge-go);
  font-weight: 600;
}

/* ---- Personnel stat blocks ---- */
.personnel-stat-blocks {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-top: 14px;
}

.personnel-stat-block {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 4px;
  overflow: hidden;
}

.personnel-stat-block-hd {
  padding: 9px 16px 8px;
  background: var(--tbl-head-bg);
  border-bottom: 2px solid #C8CFC8;
  font-size: 0.76rem;
  font-weight: 600;
  color: #333;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.personnel-stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 16px;
  border-bottom: 1px solid var(--tbl-border);
  font-size: 0.875rem;
}

.personnel-stat-row:last-child { border-bottom: none; }
.personnel-stat-row:hover { background: var(--tbl-hover); }

.personnel-stat-name { color: #333; }

.personnel-stat-val {
  font-weight: 600;
  color: #1A1A1A;
  font-variant-numeric: tabular-nums;
}

/* ---- Footer ---- */
.app-footer {
  background: var(--hd-bg);
  border-top: 1px solid var(--hd-border);
  padding: 9px 26px;
  font-size: 0.78rem;
  color: #999;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.app-footer a {
  color: #777;
  text-decoration: none;
  margin-left: 14px;
}

.app-footer a:hover { color: var(--badge-go); }

/* ---- Responsive minimal ---- */
@media (max-width: 900px) {
  .plot-grid { grid-template-columns: repeat(2, 1fr); }
  .vendanges-cards { grid-template-columns: repeat(2, 1fr); }
  .personnel-stat-blocks { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
  .sidebar { display: none; }
  .stat-row { grid-template-columns: 1fr; }
  .plot-grid { grid-template-columns: 1fr; }
  .vendanges-cards { grid-template-columns: repeat(2, 1fr); }
  .app-header-title { font-size: 0.92rem; }
}
