/* ============================================================
   Suivi de production — styles de l'application
   Composants repris du design system Soléna Énergie.
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: var(--lh-normal);
  color: var(--text-body);
  background: var(--surface-page);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  color: var(--text-strong);
  margin: 0;
  line-height: var(--lh-snug);
  letter-spacing: var(--ls-tight);
  font-weight: var(--fw-bold);
}

p { margin: 0; }
a { color: var(--forest-700); text-decoration: none; transition: color var(--dur-fast) var(--ease-out); }
a:hover { color: var(--leaf-600); }
button { font: inherit; }

.eyebrow {
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  letter-spacing: var(--ls-caps);
  text-transform: uppercase;
  color: var(--leaf-600);
}
.muted { color: var(--text-muted); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Button ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  height: 46px; padding: 0 22px;
  font-family: var(--font-display); font-weight: var(--fw-semibold); font-size: var(--fs-body);
  line-height: 1; letter-spacing: var(--ls-snug); white-space: nowrap;
  border-radius: var(--radius-pill); cursor: pointer;
  transition: background var(--dur-base) var(--ease-out), border-color var(--dur-base) var(--ease-out), transform var(--dur-fast) var(--ease-out), box-shadow var(--dur-base) var(--ease-out);
  background: var(--color-primary); color: var(--text-inverse); border: 2px solid var(--color-primary);
}
.btn:hover { background: var(--color-primary-hover); border-color: var(--color-primary-hover); color: var(--text-inverse); box-shadow: var(--shadow-sm); }
.btn:active { transform: translateY(1px); }
.btn--secondary { background: transparent; color: var(--color-primary); border-color: var(--border-default); }
.btn--secondary:hover { background: transparent; color: var(--color-primary); border-color: var(--color-primary); }
.btn--ghost { background: transparent; color: var(--color-primary); border-color: transparent; }
.btn--ghost:hover { background: var(--surface-brand-soft); color: var(--color-primary); border-color: transparent; }
.btn--danger { background: var(--danger-500); border-color: var(--danger-500); }
.btn--danger:hover { background: #b53a2d; border-color: #b53a2d; }
.btn--sm { height: 38px; padding: 0 16px; font-size: var(--fs-sm); gap: 8px; }
.btn--full { width: 100%; }
.btn[disabled] { opacity: .45; cursor: not-allowed; box-shadow: none; }

/* ---------- IconButton ---------- */
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 42px; height: 42px; padding: 0;
  border-radius: var(--radius-circle); cursor: pointer;
  background: transparent; color: var(--color-primary); border: 2px solid transparent;
  transition: background var(--dur-base) var(--ease-out), color var(--dur-base) var(--ease-out), border-color var(--dur-base) var(--ease-out);
}
.icon-btn:hover { background: var(--surface-brand-soft); color: var(--color-primary); }
.icon-btn--secondary { background: var(--surface-card); border-color: var(--border-default); }
.icon-btn--sm { width: 34px; height: 34px; }
.icon-btn.is-disabled, .icon-btn[disabled] { opacity: .45; cursor: not-allowed; pointer-events: none; }
button.icon-btn[disabled] { pointer-events: auto; }
button.icon-btn[disabled]:hover { background: transparent; }

/* ---------- Badge ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px;
  font-family: var(--font-body); font-weight: var(--fw-bold); font-size: var(--fs-xs);
  letter-spacing: var(--ls-wide); line-height: 1.4; text-transform: uppercase; white-space: nowrap;
  border-radius: var(--radius-pill);
  background: var(--leaf-100); color: var(--forest-700);
}
.badge--leaf-solid { background: var(--leaf-500); color: var(--forest-900); }
.badge--forest { background: #dde8e0; color: var(--forest-800); }
.badge--forest-solid { background: var(--forest-700); color: var(--neutral-0); }
.badge--neutral { background: var(--neutral-100); color: var(--neutral-700); }
.badge--neutral-solid { background: var(--neutral-700); color: var(--neutral-0); }
.badge--sun { background: #fdf0d3; color: #8a6410; }
.badge--sun-solid { background: var(--sun-500); color: var(--neutral-900); }
.badge--danger { background: #f8ded9; color: #a5271a; }

/* ---------- Input ---------- */
.field { display: flex; flex-direction: column; gap: 6px; font-family: var(--font-body); min-width: 0; }
.field__label { font-size: var(--fs-sm); font-weight: var(--fw-semibold); color: var(--text-body); }
.field__required { color: var(--danger-500); margin-left: 3px; }
.field__control {
  display: flex; align-items: center; gap: 10px; padding: 0 14px; height: 46px;
  background: var(--surface-card); border: 1.5px solid var(--border-default); border-radius: var(--radius-md);
  transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}
.field__control:focus-within { border-color: var(--leaf-500); box-shadow: var(--shadow-focus); }
.field__control input, .field__control select {
  flex: 1; min-width: 0; border: none; outline: none; background: transparent;
  font-family: var(--font-body); font-size: var(--fs-body); color: var(--text-strong);
}
.field__control select { height: 100%; width: 100%; cursor: pointer; }
.field__control select:disabled { cursor: not-allowed; color: var(--text-muted); }
.field__control:has(:disabled) { background: var(--surface-sunken); }
.field__hint { font-size: var(--fs-xs); color: var(--text-muted); }
.field__error { font-size: var(--fs-xs); color: var(--danger-500); }
.field--error .field__control { border-color: var(--danger-500); box-shadow: none; }

/* ---------- Checkbox ---------- */
.checkbox { display: inline-flex; align-items: center; gap: 10px; font-size: var(--fs-body); color: var(--text-body); cursor: pointer; }
.checkbox__box { position: relative; display: inline-flex; width: 22px; height: 22px; }
.checkbox__box input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.checkbox__mark {
  display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px;
  border-radius: var(--radius-xs); border: 2px solid var(--border-strong); background: var(--surface-card);
  transition: all var(--dur-fast) var(--ease-out); pointer-events: none;
}
.checkbox__mark svg { opacity: 0; transition: opacity var(--dur-fast) var(--ease-out); }
.checkbox__box input:checked + .checkbox__mark { border-color: var(--leaf-500); background: var(--leaf-500); }
.checkbox__box input:checked + .checkbox__mark svg { opacity: 1; }
.checkbox__box input:focus-visible + .checkbox__mark { box-shadow: var(--shadow-focus); }

/* ---------- Switch ---------- */
.switch { position: relative; display: inline-flex; width: 46px; height: 26px; flex: none; cursor: pointer; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch__track { width: 46px; height: 26px; border-radius: var(--radius-pill); background: var(--neutral-300); transition: background var(--dur-base) var(--ease-out); }
.switch__thumb { position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: var(--radius-circle); background: #fff; box-shadow: var(--shadow-sm); transition: left var(--dur-base) var(--ease-out); }
.switch input:checked ~ .switch__track { background: var(--leaf-500); }
.switch input:checked ~ .switch__thumb { left: 23px; }
.switch input:focus-visible ~ .switch__track { box-shadow: var(--shadow-focus); }

/* ---------- Alert ---------- */
.alert {
  display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px;
  border-radius: var(--radius-md); font-size: var(--fs-sm); color: var(--neutral-700); line-height: var(--lh-normal);
  background: #e8f1f9; border: 1px solid #bcd6ee;
}
.alert--success { background: var(--leaf-100); border-color: var(--leaf-300); }
.alert--warning { background: #fdf3dc; border-color: #f5d98a; }
.alert--danger { background: #fae4e0; border-color: #f0b6ad; }

/* ---------- Card / StatCard ---------- */
.card {
  background: var(--surface-card); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs); padding: 24px; display: flex; flex-direction: column; gap: 16px; min-width: 0;
}
.card__title { font-weight: var(--fw-semibold); font-size: var(--fs-lead); color: var(--text-strong); letter-spacing: normal; }
.stat-card {
  display: flex; flex-direction: column; gap: 10px;
  background: var(--surface-card); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg);
  padding: var(--space-5); box-shadow: var(--shadow-xs);
}
.stat-card__figure { display: flex; align-items: baseline; gap: 6px; }
.stat-card__value { font-family: var(--font-display); font-weight: var(--fw-extrabold); font-size: var(--fs-h2); line-height: 1; color: var(--forest-700); letter-spacing: var(--ls-tight); }
.stat-card__unit { font-family: var(--font-display); font-weight: var(--fw-semibold); font-size: var(--fs-h4); color: var(--leaf-500); }
.stat-card--sun .stat-card__unit { color: var(--sun-500); }
.stat-card--forest .stat-card__unit { color: var(--forest-700); }
.stat-card__meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.stat-card__label { font-size: var(--fs-sm); color: var(--text-muted); }
.stat-card__trend { font-size: var(--fs-xs); font-weight: var(--fw-bold); color: var(--leaf-600); }

/* ---------- Segmented control ---------- */
.segmented { display: flex; gap: 4px; padding: 4px; background: var(--surface-card); border: 1px solid var(--border-subtle); border-radius: var(--radius-pill); }
.segmented__item {
  border: 0; padding: 8px 18px; border-radius: var(--radius-pill); background: transparent; color: var(--forest-700);
  font-family: var(--font-display); font-weight: var(--fw-semibold); font-size: var(--fs-sm); cursor: pointer; white-space: nowrap;
}
.segmented__item:hover { color: var(--forest-700); background: var(--surface-brand-soft); }
.segmented__item.is-active, .segmented__item.is-active:hover { background: var(--forest-700); color: #fff; }
.segmented--sm { gap: 2px; padding: 3px; background: var(--surface-page); }
.segmented--sm .segmented__item { padding: 6px 14px; font-size: var(--fs-xs); }
.segmented--form { flex-wrap: wrap; align-self: flex-start; }
.segmented--form .segmented__item { padding: 7px 14px; font-size: var(--fs-xs); }

/* ============================================================
   Connexion
   ============================================================ */
.auth { min-height: 100vh; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); }
.auth__hero {
  background: var(--gradient-hero); color: #fff; padding: clamp(32px, 5vw, 64px);
  display: flex; flex-direction: column; justify-content: space-between; gap: 48px;
}
.auth__hero img { width: 170px; display: block; }
.auth__pitch { display: flex; flex-direction: column; gap: 16px; max-width: 460px; }
.auth__pitch .eyebrow { color: var(--leaf-200); }
.auth__pitch h1 { color: #fff; font-size: var(--fs-h2); line-height: 1.1; text-wrap: pretty; }
.auth__pitch p { color: var(--leaf-100); line-height: 1.5; text-wrap: pretty; }
.auth__legal { font-size: var(--fs-xs); color: var(--leaf-200); }
.auth__panel { padding: clamp(32px, 5vw, 64px); display: flex; align-items: center; justify-content: center; }
.auth__form { width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 20px; }
.auth__heading { display: flex; flex-direction: column; gap: 6px; }
.auth__heading h2 { font-size: var(--fs-h3); }
.auth__heading div { font-size: var(--fs-sm); color: var(--text-muted); }
.auth__row { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.link-button { border: 0; padding: 0; background: none; cursor: pointer; font-size: var(--fs-sm); font-weight: var(--fw-semibold); color: var(--forest-700); }
.link-button:hover { color: var(--leaf-600); }
.auth__footnote { font-size: var(--fs-xs); color: var(--text-muted); text-align: center; }

/* ============================================================
   Application : barre latérale + contenu
   ============================================================ */
.app { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }

.sidebar {
  background: var(--forest-900); color: #fff; padding: 24px 20px;
  display: flex; flex-direction: column; gap: 24px;
  position: sticky; top: 0; align-self: start; height: 100vh; overflow-y: auto;
}
.sidebar__logo { width: 150px; display: block; }
.sidebar nav { display: flex; flex-direction: column; gap: 4px; }
.sidebar__section { font-size: var(--fs-xs); font-weight: var(--fw-bold); letter-spacing: var(--ls-caps); text-transform: uppercase; color: var(--leaf-300); padding: 0 12px 8px; }
.sidebar__section + .nav-item, .sidebar__section:first-child { margin-top: 0; }
.nav-item + .sidebar__section { padding-top: 14px; }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: var(--radius-md);
  background: transparent; color: var(--leaf-100);
  font-family: var(--font-display); font-weight: var(--fw-medium); font-size: var(--fs-sm);
  transition: background var(--dur-base) var(--ease-out);
}
.nav-item:hover { color: #fff; background: rgba(255,255,255,.06); }
.nav-item.is-active { background: rgba(255,255,255,.12); color: #fff; }
.nav-item__dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.nav-item__icon { flex: none; margin-left: -4px; }
.nav-item__label { flex: 1; }
.nav-item__meta { font-family: var(--font-body); font-size: var(--fs-xs); color: var(--leaf-300); }
.sidebar__status { margin-top: auto; display: flex; flex-direction: column; gap: 6px; font-size: var(--fs-xs); color: var(--leaf-200); line-height: 1.5; }
.sidebar__status div:first-child { display: flex; align-items: center; gap: 8px; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--leaf-400); box-shadow: 0 0 0 4px rgba(121,192,105,.25); }
.sidebar__status div:last-child { color: var(--neutral-400); }

.user-menu { position: relative; }
.user-menu__toggle {
  width: 100%; display: flex; align-items: center; gap: 10px; padding: 10px;
  border: 1px solid rgba(255,255,255,.14); border-radius: var(--radius-md);
  background: transparent; color: #fff; cursor: pointer; text-align: left;
}
.user-menu__toggle:hover, .user-menu.is-open .user-menu__toggle, .user-menu__toggle.is-active { background: rgba(255,255,255,.1); }
.avatar {
  width: 36px; height: 36px; flex: none; border-radius: 50%; background: var(--leaf-500); color: var(--forest-900);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: var(--fw-bold); font-size: var(--fs-sm);
}
.user-menu__who { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.user-menu__who span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-menu__name { font-family: var(--font-display); font-weight: var(--fw-semibold); font-size: var(--fs-sm); }
.user-menu__role { font-size: var(--fs-xs); color: var(--leaf-200); }
.user-menu__chevron { flex: none; color: var(--leaf-200); }
.user-menu__panel {
  position: absolute; left: 0; right: 0; bottom: calc(100% + 8px);
  background: var(--surface-card); border-radius: var(--radius-md); box-shadow: var(--shadow-lg);
  padding: 6px; display: none; flex-direction: column; gap: 2px; z-index: 10;
}
.user-menu.is-open .user-menu__panel { display: flex; }
.user-menu__email { padding: 10px 12px 8px; font-size: var(--fs-xs); color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border: 0;
  border-radius: var(--radius-sm); background: transparent; color: var(--text-strong);
  font-family: var(--font-body); font-size: var(--fs-sm); font-weight: var(--fw-semibold); cursor: pointer; text-align: left;
}
.menu-item:hover { background: var(--surface-brand-soft); color: var(--text-strong); }
.menu-item--danger { color: var(--danger-500); }
.menu-item--danger:hover { background: #fae4e0; color: var(--danger-500); }

.main { padding: 32px clamp(20px, 3vw, 44px) 56px; display: flex; flex-direction: column; gap: 24px; min-width: 0; }

.page-header { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 20px; }
.page-header__titles { display: flex; flex-direction: column; gap: 6px; }
.page-header h1 { font-size: var(--fs-h2); line-height: 1.1; }
.page-header__sub { font-size: var(--fs-sm); color: var(--text-muted); }

.flash { margin-bottom: -8px; }

/* ---------- Sélecteur de période ---------- */
.period-picker { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.period-nav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.date-chip {
  position: relative; display: flex; align-items: center; gap: 8px; min-width: 210px; justify-content: center;
  padding: 7px 14px; border-radius: var(--radius-pill); background: var(--surface-card); border: 1px solid var(--border-subtle);
  font-family: var(--font-display); font-weight: var(--fw-semibold); font-size: var(--fs-sm); color: var(--forest-700); cursor: pointer;
}
.date-chip input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; border: 0; padding: 0; }

/* ---------- Bandeau centrale ---------- */
.plant-hero {
  background: var(--gradient-hero); border-radius: var(--radius-xl); padding: 28px 32px; color: #fff;
  display: flex; flex-wrap: wrap; gap: 24px; align-items: center; justify-content: space-between;
}
.plant-hero__tags { display: flex; flex-direction: column; gap: 10px; }
.plant-hero__tags > div:first-child { display: flex; gap: 8px; flex-wrap: wrap; }
.plant-hero__place { font-size: var(--fs-sm); color: var(--leaf-100); }
.plant-hero__facts { display: flex; gap: 40px; flex-wrap: wrap; }
.plant-hero__fact { display: flex; flex-direction: column; gap: 4px; }
.plant-hero__fact div:first-child { font-size: var(--fs-xs); color: var(--leaf-200); letter-spacing: var(--ls-wide); text-transform: uppercase; font-weight: var(--fw-bold); }
.plant-hero__fact div:last-child { font-family: var(--font-display); font-weight: var(--fw-semibold); font-size: var(--fs-lead); }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; }
.dashboard-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 560px), 1fr)); gap: 16px; align-items: start; }

/* ---------- Graphique ---------- */
.chart-card { grid-column: 1 / -1; gap: 28px; }
.chart-card__head { display: flex; flex-wrap: wrap; gap: 16px; justify-content: space-between; align-items: flex-start; }
.chart-card__head h2 { font-weight: var(--fw-semibold); font-size: var(--fs-h4); letter-spacing: normal; }
.chart-card__tooltip { font-size: var(--fs-sm); color: var(--text-muted); min-height: 21px; }
.chart-card__tools { display: flex; flex-direction: column; align-items: flex-end; gap: 12px; }
.legend { display: flex; flex-wrap: wrap; gap: 16px; font-size: var(--fs-sm); color: var(--neutral-600); }
.legend__item { display: flex; align-items: center; gap: 8px; }
.legend__swatch { width: 14px; border-radius: 3px; }

.chart { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 8px; margin-top: 16px; }
.chart__axis { position: relative; height: 260px; }
.chart__tick { position: absolute; right: 0; transform: translateY(50%); font-size: var(--fs-xs); color: var(--text-muted); white-space: nowrap; }
.chart__plot { position: relative; height: 260px; min-width: 0; }
.chart__plot--curve { cursor: crosshair; }
.chart__grid { position: absolute; left: 0; right: 0; border-top: 1px dashed var(--border-subtle); }
.chart__svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.chart__now {
  position: absolute; top: -4px; transform: translateX(-50%); background: var(--forest-700); color: #fff;
  font-size: var(--fs-xs); font-weight: var(--fw-bold); padding: 2px 8px; border-radius: var(--radius-pill); white-space: nowrap;
}
.chart__hover-line { position: absolute; top: 0; bottom: 0; border-left: 1px dashed var(--forest-900); pointer-events: none; }
.chart__hover-dot { position: absolute; width: 10px; height: 10px; margin: 0 0 -5px -5px; border-radius: 50%; background: #fff; border: 2.5px solid; pointer-events: none; }
.chart__hover-box {
  position: absolute; top: 28px; background: var(--surface-card); border: 1px solid var(--border-subtle); box-shadow: var(--shadow-md);
  border-radius: var(--radius-md); padding: 10px 12px; display: flex; flex-direction: column; gap: 4px;
  pointer-events: none; white-space: nowrap; z-index: 2;
}
.chart__hover-time { font-family: var(--font-display); font-weight: var(--fw-bold); font-size: var(--fs-sm); color: var(--text-strong); }
.chart__hover-row { display: flex; align-items: center; gap: 8px; font-size: var(--fs-xs); color: var(--neutral-600); }
.chart__hover-row span:first-child { width: 10px; height: 3px; border-radius: 2px; }
.chart__hover-row span:nth-child(2) { flex: 1; }
.chart__hover-row span:last-child { font-weight: var(--fw-bold); color: var(--text-strong); margin-left: 12px; }
.chart__bars { position: absolute; inset: 0; display: flex; align-items: flex-end; }
.chart__bar {
  flex: 1; min-width: 0; height: 100%; position: relative; display: flex; flex-direction: column; justify-content: flex-end;
  border-radius: 6px 6px 0 0; cursor: default;
}
a.chart__bar { cursor: pointer; }
.chart__bar:hover { background: var(--surface-sunken); }
.chart__bar-target { position: absolute; left: -3px; right: -3px; border-top: 2px solid var(--forest-900); }
.chart__bar-segment:first-of-type { border-radius: 4px 4px 0 0; }
.chart__bar-segment { box-sizing: border-box; }
.chart__x { display: flex; font-size: var(--fs-xs); color: var(--text-muted); }
.chart__x div { flex: 1; min-width: 0; white-space: nowrap; overflow: visible; }

/* ---------- Cartes centrales (vue d'ensemble) ---------- */
.plant-card {
  background: var(--surface-card); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); box-shadow: var(--shadow-xs);
  padding: 24px; display: flex; flex-direction: column; gap: 20px; color: inherit;
  transition: transform var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-out);
}
.plant-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); color: inherit; }
.plant-card__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.plant-card__id { display: flex; gap: 14px; align-items: center; }
.plant-card__tile { width: 48px; height: 48px; border-radius: var(--radius-md); display: flex; align-items: center; justify-content: center; flex: none; }
.plant-card__tile--solaire { background: #fdf0d3; color: #8a6410; }
.plant-card__tile--hydro { background: var(--leaf-100); color: var(--forest-600); }
.plant-card__tile--stockage { background: var(--leaf-100); color: var(--leaf-600); }
.plant-card h3 { font-weight: var(--fw-semibold); font-size: var(--fs-h4); letter-spacing: normal; }
.plant-card__sub { font-size: var(--fs-sm); color: var(--text-muted); }
.plant-card__power { display: flex; flex-direction: column; gap: 8px; }
.plant-card__power > div:first-child { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.plant-card__value { font-family: var(--font-display); font-weight: var(--fw-extrabold); font-size: var(--fs-h3); color: var(--forest-700); letter-spacing: var(--ls-tight); }
.plant-card__unit { font-family: var(--font-display); font-weight: var(--fw-semibold); color: var(--leaf-600); margin-left: 6px; }
.gauge { height: 8px; background: var(--surface-sunken); border-radius: var(--radius-pill); overflow: hidden; }
.gauge div { height: 100%; border-radius: var(--radius-pill); transition: width var(--dur-slow) var(--ease-out); }
.plant-card__stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: 12px; padding-top: 16px; border-top: 1px solid var(--border-subtle); }
.stat { display: flex; flex-direction: column; gap: 2px; }
.stat div:first-child { font-size: var(--fs-xs); color: var(--text-muted); }
.stat div:last-child { font-family: var(--font-display); font-weight: var(--fw-semibold); color: var(--text-strong); }

/* ---------- Fiche centrale ---------- */
.conditions { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.condition { background: var(--surface-page); border-radius: var(--radius-md); padding: 16px; display: flex; flex-direction: column; gap: 6px; }
.condition div:first-child { font-size: var(--fs-xs); color: var(--text-muted); }
.condition__value { font-family: var(--font-display); font-weight: var(--fw-bold); font-size: var(--fs-h4); color: var(--forest-700); }
.condition__unit { font-size: var(--fs-sm); color: var(--neutral-600); margin-left: 5px; }
.log { gap: 8px; }
.log .card__title { margin-bottom: 8px; }
.log__row { display: grid; grid-template-columns: 72px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 0; border-top: 1px solid var(--border-subtle); }
.log__date { font-size: var(--fs-xs); color: var(--text-muted); font-weight: var(--fw-bold); }
.log__title { font-size: var(--fs-sm); color: var(--text-body); }
.empty { font-size: var(--fs-sm); color: var(--text-muted); padding: 12px 0; border-top: 1px solid var(--border-subtle); }

/* ---------- Profil ---------- */
.profile-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); gap: 16px; align-items: start; }
.profile-card { padding: 28px; gap: 24px; }
.profile-id { display: flex; align-items: center; gap: 18px; }
.avatar--lg { width: 72px; height: 72px; background: var(--leaf-100); color: var(--forest-700); font-size: var(--fs-h4); }
.profile-id__name { font-family: var(--font-display); font-weight: var(--fw-bold); font-size: var(--fs-h4); color: var(--text-strong); }
.profile-id__meta { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; font-size: var(--fs-sm); color: var(--text-muted); }
.profile-rows { display: flex; flex-direction: column; }
.profile-row { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 12px; padding: 12px 0; border-top: 1px solid var(--border-subtle); font-size: var(--fs-sm); }
.profile-row div:first-child { color: var(--text-muted); }
.profile-row div:last-child { color: var(--text-strong); font-weight: var(--fw-semibold); overflow-wrap: anywhere; }
.actions { display: flex; gap: 12px; flex-wrap: wrap; }
.site-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--border-subtle); color: inherit; }
.site-row:hover { color: inherit; background: var(--surface-page); }
.site-row__dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.site-row__text { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.site-row__text span:first-child { font-family: var(--font-display); font-weight: var(--fw-semibold); color: var(--text-strong); }
.site-row__text span:last-child { font-size: var(--fs-xs); color: var(--text-muted); }
.notif { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.notif__label { font-size: var(--fs-sm); font-weight: var(--fw-semibold); color: var(--text-strong); }
.notif__hint { font-size: var(--fs-xs); color: var(--text-muted); }

/* ---------- Administration ---------- */
.admin-card { background: var(--surface-card); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); box-shadow: var(--shadow-xs); display: flex; flex-direction: column; min-width: 0; }
.admin-card__head { padding: 20px 24px; display: flex; flex-wrap: wrap; gap: 16px; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border-subtle); }
.admin-card__head h2 { font-weight: var(--fw-semibold); font-size: var(--fs-h4); letter-spacing: normal; }
.admin-card__tools { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.admin-card__tools .field { width: 260px; }
.table-scroll { overflow-x: auto; }
.table { display: flex; flex-direction: column; }
.table__row { display: grid; gap: 16px; padding: 14px 24px; align-items: center; border-top: 1px solid var(--border-subtle); font-size: var(--fs-sm); }
.table__row:hover { background: var(--surface-page); }
.table__row--head, .table__row--head:hover { padding: 12px 24px; background: var(--surface-page); border-top: 0; font-size: var(--fs-xs); font-weight: var(--fw-bold); letter-spacing: var(--ls-wide); text-transform: uppercase; color: var(--text-muted); }
.table--plants { min-width: 1100px; }
.table--plants .table__row { grid-template-columns: minmax(160px, 1.3fr) minmax(150px, 1.1fr) 170px 100px 200px minmax(120px, 1fr) 130px 76px; }
.table--users { min-width: 900px; }
.table--users .table__row { grid-template-columns: minmax(180px, 1.3fr) minmax(200px, 1.3fr) minmax(160px, 1fr) 150px 150px 76px; }
.cell-name { display: flex; align-items: center; gap: 10px; min-width: 0; }
.cell-name span:last-child { font-family: var(--font-display); font-weight: var(--fw-semibold); color: var(--text-strong); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.cell-num { font-variant-numeric: tabular-nums; color: var(--text-strong); }
.cell-prm { letter-spacing: .02em; }
.cell-right { text-align: right; }
.cell-stack { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cell-stack span:first-child { color: var(--text-strong); font-weight: var(--fw-semibold); font-variant-numeric: tabular-nums; }
.cell-stack span:last-child { font-size: var(--fs-xs); color: var(--text-muted); }
.cell-ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-actions { display: flex; gap: 4px; justify-content: flex-end; }
.table__empty { padding: 40px 24px; text-align: center; font-size: var(--fs-sm); color: var(--text-muted); border-top: 1px solid var(--border-subtle); }

/* ---------- Fenêtres modales ---------- */
.modal { position: fixed; inset: 0; background: rgba(12,49,23,.45); display: flex; align-items: center; justify-content: center; padding: 24px; z-index: 50; }
.modal__close-area { position: absolute; inset: 0; }
.modal__dialog {
  position: relative; width: 100%; max-width: 560px; max-height: calc(100vh - 48px); overflow-y: auto;
  background: var(--surface-card); border-radius: var(--radius-xl); box-shadow: var(--shadow-lg);
  padding: 28px; display: flex; flex-direction: column; gap: 18px;
}
.modal__dialog--sm { max-width: 440px; gap: 16px; }
.modal__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.modal__head h2 { font-size: var(--fs-h4); }
.modal__text { font-size: var(--fs-sm); color: var(--text-body); line-height: 1.5; }
.modal__actions { display: flex; justify-content: flex-end; gap: 12px; flex-wrap: wrap; padding-top: 4px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 16px; }
.contract-box { display: flex; flex-direction: column; gap: 14px; padding: 18px; background: var(--surface-page); border-radius: var(--radius-lg); }
.contract-box__title { font-family: var(--font-display); font-weight: var(--fw-semibold); color: var(--text-strong); }
.contract-box__sub { font-size: var(--fs-xs); color: var(--text-muted); }
.contract-box [hidden] { display: none !important; }
.contract-box .form-grid { gap: 14px; }

@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  .period-picker { align-items: flex-start; }
}
