/* ============================================================
   MINEPAT – style.css  (version robuste cross-browser)
   ============================================================ */

/* ─── 1. Reset universel ────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  border: 0;
  font-size: 100%;
  font: inherit;
  vertical-align: baseline;
}
html {
  -webkit-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
  font-size: 15px;
  scroll-behavior: smooth;
}
body {
  font-family: 'Segoe UI', Arial, Helvetica, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: #424242;
  background: #f5f5f5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a            { color: inherit; text-decoration: none; }
img          { display: block; max-width: 100%; height: auto; }
ul, ol       { list-style: none; }
table        { border-collapse: collapse; border-spacing: 0; }
input, select, button, textarea {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  color: inherit;
  background: transparent;
  outline: none;
}
button { cursor: pointer; }

/* ─── 2. Variables CSS ──────────────────────────────────────── */
:root {
  --green-dark:  #1b5e20;
  --green:       #2e7d32;
  --green-light: #43a047;
  --gold:        #f9a825;
  --gray-100:    #f5f5f5;
  --gray-200:    #eeeeee;
  --gray-300:    #e0e0e0;
  --gray-600:    #757575;
  --gray-800:    #424242;
  --white:       #ffffff;
  --shadow-sm:   0 1px 4px rgba(0,0,0,.10);
  --shadow:      0 2px 8px rgba(0,0,0,.12);
  --shadow-lg:   0 8px 24px rgba(0,0,0,.15);
  --radius:      10px;
  --header-h:    64px;
}

/* ─── 3. Page login ─────────────────────────────────────────── */
.login-page {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-align: center;
  -ms-flex-align: center;
  align-items: center;
  -webkit-box-pack: center;
  -ms-flex-pack: center;
  justify-content: center;
  min-height: 100vh;
  position: relative;
}
.login-bg {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 0;
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
  -webkit-filter: brightness(.4) saturate(.7);
  filter: brightness(.4) saturate(.7);
}
.login-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 1;
  background: rgba(0,40,0,.4);
}
.login-card {
  position: relative;
  z-index: 2;
  background: #ffffff;
  border-radius: 16px;
  padding: 2.5rem 3rem;
  width: 100%;
  max-width: 460px;
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
}
.login-logo            { text-align: center; margin-bottom: 1rem; }
.login-logo img        { margin: 0 auto; height: 72px; width: auto; object-fit: contain; }
.login-title           { text-align: center; font-size: 1.1rem; font-weight: 700; color: #1b5e20; margin-bottom: .25rem; }
.login-subtitle        { text-align: center; font-size: .82rem; color: #757575; margin-bottom: 1.5rem; }
.login-form .form-group{ margin-bottom: 1.1rem; }
.login-form label      { display: block; font-weight: 600; margin-bottom: .3rem; font-size: .87rem; }
.login-form input {
  display: block;
  width: 100%;
  padding: .6rem .9rem;
  border: 1.5px solid #e0e0e0;
  border-radius: 8px;
  background: #fff;
  -webkit-transition: border-color .2s;
  transition: border-color .2s;
}
.login-form input:focus { border-color: #2e7d32; }
.input-eye              { position: relative; }
.input-eye input        { padding-right: 2.8rem; }
.eye-btn {
  position: absolute;
  right: .7rem;
  top: 50%;
  -webkit-transform: translateY(-50%);
  transform: translateY(-50%);
  background: none;
  border: none;
  color: #757575;
  cursor: pointer;
  padding: 0;
}
.btn-login {
  display: block;
  width: 100%;
  padding: .75rem;
  background: #2e7d32;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-weight: 700;
  font-size: 1rem;
  margin-top: .5rem;
  cursor: pointer;
  -webkit-transition: background .2s;
  transition: background .2s;
}
.btn-login:hover { background: #1b5e20; }

/* ─── 4. Alertes ────────────────────────────────────────────── */
.alert {
  padding: .7rem 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  font-size: .88rem;
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  gap: .5rem;
  -webkit-box-align: center;
  -ms-flex-align: center;
  align-items: center;
}
.alert-danger  { background: #ffebee; color: #c62828; border-left: 4px solid #c62828; }
.alert-success { background: #e8f5e9; color: #1b5e20; border-left: 4px solid #2e7d32; }
.alert-warning { background: #fff8e1; color: #f57f17; border-left: 4px solid #f9a825; }

/* ─── 5. Header ─────────────────────────────────────────────── */
.site-header {
  position: -webkit-sticky;
  position: sticky;
  top: 0;
  z-index: 100;
  background: #1b5e20;
  color: #fff;
  height: var(--header-h);
  box-shadow: 0 2px 12px rgba(0,0,0,.25);
}
.header-inner {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-align: center;
  -ms-flex-align: center;
  align-items: center;
  gap: 1rem;
  padding: 0 1.5rem;
  height: 100%;
  max-width: 1400px;
  margin: 0 auto;
}
.header-brand {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-align: center;
  -ms-flex-align: center;
  align-items: center;
  gap: .8rem;
  -ms-flex-negative: 0;
  flex-shrink: 0;
  text-decoration: none;
}
.header-brand img        { height: 40px; width: auto; -webkit-filter: brightness(10); filter: brightness(10); }
.header-brand-text       { display: -webkit-box; display: -ms-flexbox; display: flex; -webkit-box-orient: vertical; -webkit-box-direction: normal; -ms-flex-direction: column; flex-direction: column; }
.brand-main              { font-size: 1rem; font-weight: 800; letter-spacing: .5px; color: #fff; }
.brand-sub               { font-size: .68rem; opacity: .85; color: #fff; }
.main-nav {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  gap: .2rem;
  margin-left: 1rem;
  -webkit-box-flex: 1;
  -ms-flex: 1;
  flex: 1;
}
.nav-link {
  padding: .4rem .85rem;
  border-radius: 6px;
  font-size: .87rem;
  font-weight: 500;
  color: rgba(255,255,255,.85);
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-align: center;
  -ms-flex-align: center;
  align-items: center;
  gap: .4rem;
  text-decoration: none;
  -webkit-transition: background .15s;
  transition: background .15s;
  white-space: nowrap;
}
.nav-link:hover, .nav-link.active { background: rgba(255,255,255,.18); color: #fff; }
.header-user {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-align: center;
  -ms-flex-align: center;
  align-items: center;
  gap: .8rem;
  margin-left: auto;
  font-size: .86rem;
  -ms-flex-negative: 0;
  flex-shrink: 0;
}
.user-name  { opacity: .9; color: #fff; white-space: nowrap; }
.btn-logout {
  padding: .35rem .85rem;
  background: rgba(255,255,255,.15);
  border-radius: 6px;
  color: #fff;
  font-size: .82rem;
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-align: center;
  -ms-flex-align: center;
  align-items: center;
  gap: .4rem;
  text-decoration: none;
  -webkit-transition: background .15s;
  transition: background .15s;
  white-space: nowrap;
}
.btn-logout:hover       { background: rgba(255,255,255,.28); }
.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: #fff;
  font-size: 1.3rem;
  cursor: pointer;
  padding: .3rem;
  margin-left: auto;
}

/* ─── 6. Contenu principal ──────────────────────────────────── */
.main-content {
  max-width: 1300px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}
.page-header {
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid #e0e0e0;
}
.page-header h1 {
  font-size: 1.6rem;
  font-weight: 800;
  color: #1b5e20;
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-align: center;
  -ms-flex-align: center;
  align-items: center;
  gap: .5rem;
}
.page-subtitle  { color: #757575; margin-top: .3rem; font-size: .93rem; }
.breadcrumb     { font-size: .82rem; color: #757575; margin-bottom: .4rem; }
.breadcrumb a   { color: #2e7d32; text-decoration: none; }
.section-title  {
  font-size: 1.1rem; font-weight: 700; margin: 2rem 0 1rem;
  color: #1b5e20;
  display: -webkit-box; display: -ms-flexbox; display: flex;
  -webkit-box-align: center; -ms-flex-align: center; align-items: center;
  gap: .5rem;
}

/* ─── 7. Stat cards ─────────────────────────────────────────── */
.stats-row {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -ms-flex-wrap: wrap;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 2rem;
}
.stat-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 1.2rem;
  box-shadow: var(--shadow);
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  gap: 1rem;
  -webkit-box-align: center;
  -ms-flex-align: center;
  align-items: center;
  -webkit-box-flex: 1;
  -ms-flex: 1 1 200px;
  flex: 1 1 200px;
  min-width: 180px;
}
.stat-icon {
  width: 50px;
  height: 50px;
  border-radius: 12px;
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-align: center;
  -ms-flex-align: center;
  align-items: center;
  -webkit-box-pack: center;
  -ms-flex-pack: center;
  justify-content: center;
  color: #fff;
  font-size: 1.3rem;
  -ms-flex-negative: 0;
  flex-shrink: 0;
}
.stat-value { font-size: 1.5rem; font-weight: 800; color: #1b5e20; }
.stat-label { font-size: .8rem; color: #757575; margin-top: .1rem; }

/* ─── 8. Grille filières ────────────────────────────────────── */
.products-grid {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -ms-flex-wrap: wrap;
  flex-wrap: wrap;
  gap: 1.2rem;
}
.product-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 1.4rem;
  box-shadow: var(--shadow);
  border-top: 4px solid var(--card-color, #2e7d32);
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-orient: vertical;
  -webkit-box-direction: normal;
  -ms-flex-direction: column;
  flex-direction: column;
  gap: .6rem;
  -webkit-box-flex: 1;
  -ms-flex: 1 1 260px;
  flex: 1 1 260px;
  max-width: 340px;
  text-decoration: none;
  color: inherit;
  -webkit-transition: -webkit-transform .15s, box-shadow .15s;
  transition: transform .15s, box-shadow .15s;
}
.product-card:hover { -webkit-transform: translateY(-3px); transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.product-card-header {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-pack: justify;
  -ms-flex-pack: justify;
  justify-content: space-between;
  -webkit-box-align: flex-start;
  -ms-flex-align: flex-start;
  align-items: flex-start;
}
.product-icon {
  width: 46px; height: 46px;
  border-radius: 12px;
  background: var(--card-color, #2e7d32);
  color: #fff;
  display: -webkit-box; display: -ms-flexbox; display: flex;
  -webkit-box-align: center; -ms-flex-align: center; align-items: center;
  -webkit-box-pack: center; -ms-flex-pack: center; justify-content: center;
  font-size: 1.3rem;
  -ms-flex-negative: 0; flex-shrink: 0;
}
.product-badges {
  display: -webkit-box; display: -ms-flexbox; display: flex;
  gap: .4rem; -ms-flex-wrap: wrap; flex-wrap: wrap;
}
.product-name   { font-size: 1.1rem; font-weight: 700; color: #424242; }
.product-desc   { font-size: .83rem; color: #757575; -webkit-box-flex: 1; -ms-flex: 1; flex: 1; }
.product-footer {
  display: -webkit-box; display: -ms-flexbox; display: flex;
  -webkit-box-pack: justify; -ms-flex-pack: justify; justify-content: space-between;
  -webkit-box-align: center; -ms-flex-align: center; align-items: center;
  margin-top: .5rem;
}
.see-more { font-size: .83rem; color: #2e7d32; font-weight: 600; }

/* ─── 9. Badges ─────────────────────────────────────────────── */
.badge       { display: inline-block; padding: .2rem .6rem; border-radius: 20px; font-size: .73rem; font-weight: 600; white-space: nowrap; }
.badge-prod  { background: #e8f5e9; color: #1b5e20; }
.badge-import{ background: #e3f2fd; color: #0d47a1; }
.badge-exo   { display: inline-block; background: #fff8e1; color: #f57f17; font-size: .72rem; padding: .15rem .45rem; border-radius: 4px; font-weight: 600; }
.model-tag   { display: inline-block; font-size: .75rem; background: #eeeeee; padding: .15rem .5rem; border-radius: 4px; color: #757575; }

/* ─── 10. Boutons navigation rapide ─────────────────────────── */
.quick-nav {
  display: -webkit-box; display: -ms-flexbox; display: flex;
  gap: 1rem; -ms-flex-wrap: wrap; flex-wrap: wrap;
  margin-top: 2rem;
}
.quick-btn {
  display: -webkit-inline-box; display: -ms-inline-flexbox; display: inline-flex;
  -webkit-box-align: center; -ms-flex-align: center; align-items: center;
  gap: .5rem;
  padding: .75rem 1.4rem;
  background: #2e7d32; color: #fff;
  border-radius: 8px; font-weight: 600;
  text-decoration: none;
  -webkit-transition: background .15s; transition: background .15s;
}
.quick-btn:hover { background: #1b5e20; }

/* ─── 11. Cards ─────────────────────────────────────────────── */
.card          { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 1.5rem; overflow: hidden; }
.card-header   {
  padding: 1rem 1.4rem;
  background: #f5f5f5;
  border-bottom: 1px solid #e0e0e0;
  display: -webkit-box; display: -ms-flexbox; display: flex;
  -webkit-box-pack: justify; -ms-flex-pack: justify; justify-content: space-between;
  -webkit-box-align: center; -ms-flex-align: center; align-items: center;
  -ms-flex-wrap: wrap; flex-wrap: wrap;
  gap: .5rem;
}
.card-header h2 {
  font-size: 1rem; font-weight: 700; color: #1b5e20;
  display: -webkit-box; display: -ms-flexbox; display: flex;
  -webkit-box-align: center; -ms-flex-align: center; align-items: center;
  gap: .5rem;
}
.card-body { padding: 1.4rem; }

/* ─── 12. Contrôles graphique ───────────────────────────────── */
.chart-controls {
  display: -webkit-box; display: -ms-flexbox; display: flex;
  gap: .4rem; -ms-flex-wrap: wrap; flex-wrap: wrap;
}
.btn-sm {
  display: inline-block;
  padding: .3rem .75rem;
  border-radius: 6px;
  font-size: .8rem;
  background: #eeeeee;
  border: 1px solid #e0e0e0;
  cursor: pointer;
  -webkit-transition: background .15s, color .15s; transition: background .15s, color .15s;
  color: #424242;
}
.btn-sm.active, .btn-sm:hover { background: #2e7d32; color: #fff; border-color: #2e7d32; }

/* ─── 13. Tableaux ──────────────────────────────────────────── */
.table-wrap    { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.data-table    { width: 100%; border-collapse: collapse; font-size: .87rem; }
.data-table th {
  background: #1b5e20; color: #fff;
  padding: .6rem .85rem; text-align: left; white-space: nowrap;
  font-weight: 600;
}
.data-table td          { padding: .55rem .85rem; border-bottom: 1px solid #eeeeee; }
.data-table tr:hover td { background: #f5f5f5; }
.data-table tr.proj-row td { background: #fffde7; font-style: italic; }

/* ─── 14. Formulaires ───────────────────────────────────────── */
.form-group         { margin-bottom: 1rem; }
.form-group label   { display: block; font-weight: 600; margin-bottom: .3rem; font-size: .87rem; color: #424242; }
.form-group input,
.form-group select  {
  display: block;
  width: 100%;
  padding: .55rem .85rem;
  border: 1.5px solid #e0e0e0;
  border-radius: 8px;
  background: #fff;
  color: #424242;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  -webkit-transition: border-color .2s; transition: border-color .2s;
}
.form-group select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23757575' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .75rem center;
  padding-right: 2.2rem;
}
.form-group input:focus,
.form-group select:focus { border-color: #2e7d32; box-shadow: 0 0 0 3px rgba(46,125,50,.12); }
.unit { font-weight: normal; color: #757575; font-size: .8rem; }
hr    { border: none; border-top: 1px solid #e0e0e0; margin: 1rem 0; }

.btn-primary {
  display: -webkit-inline-box; display: -ms-inline-flexbox; display: inline-flex;
  -webkit-box-align: center; -ms-flex-align: center; align-items: center;
  gap: .5rem;
  padding: .65rem 1.4rem;
  background: #2e7d32; color: #fff;
  border: none; border-radius: 8px;
  font-weight: 700; cursor: pointer;
  -webkit-transition: background .15s; transition: background .15s;
}
.btn-primary:hover { background: #1b5e20; }
.btn-secondary {
  display: -webkit-inline-box; display: -ms-inline-flexbox; display: inline-flex;
  -webkit-box-align: center; -ms-flex-align: center; align-items: center;
  gap: .5rem;
  padding: .65rem 1.4rem;
  background: #eeeeee; color: #424242;
  border: 1.5px solid #e0e0e0; border-radius: 8px;
  font-weight: 700; cursor: pointer;
  -webkit-transition: background .15s; transition: background .15s;
}
.btn-secondary:hover { background: #e0e0e0; }

/* ─── 15. Deux colonnes ─────────────────────────────────────── */
.two-col {
  display: -webkit-box; display: -ms-flexbox; display: flex;
  gap: 1.5rem; -ms-flex-wrap: wrap; flex-wrap: wrap;
  -webkit-box-align: start; -ms-flex-align: start; align-items: flex-start;
}
.two-col > .card {
  -webkit-box-flex: 1; -ms-flex: 1 1 320px; flex: 1 1 320px;
}

/* ─── 16. Scénarios ─────────────────────────────────────────── */
.product-selector {
  display: -webkit-box; display: -ms-flexbox; display: flex;
  gap: .6rem; -ms-flex-wrap: wrap; flex-wrap: wrap;
}
.product-pill {
  display: -webkit-inline-box; display: -ms-inline-flexbox; display: inline-flex;
  -webkit-box-align: center; -ms-flex-align: center; align-items: center;
  gap: .4rem;
  padding: .5rem 1.1rem;
  border-radius: 20px;
  background: #eeeeee;
  font-weight: 600; font-size: .87rem;
  border: 2px solid transparent;
  text-decoration: none; color: #424242;
  -webkit-transition: all .15s; transition: all .15s;
}
.product-pill:hover  { background: #e0e0e0; }
.product-pill.active { background: var(--pill-color, #2e7d32); color: #fff; }

.scenario-layout {
  display: -webkit-box; display: -ms-flexbox; display: flex;
  gap: 1.5rem; -ms-flex-wrap: wrap; flex-wrap: wrap;
}
.scenario-controls {
  -webkit-box-flex: 0; -ms-flex: 0 0 300px; flex: 0 0 300px;
  min-width: 260px;
  display: -webkit-box; display: -ms-flexbox; display: flex;
  -webkit-box-orient: vertical; -webkit-box-direction: normal;
  -ms-flex-direction: column; flex-direction: column;
  gap: .7rem;
}
.scenario-controls h3 { font-size: .95rem; font-weight: 700; color: #1b5e20; }
.help-text            { font-size: .82rem; color: #757575; }
.years-tabs {
  display: -webkit-box; display: -ms-flexbox; display: flex;
  gap: .4rem; -ms-flex-wrap: wrap; flex-wrap: wrap;
}
.year-tab {
  padding: .3rem .75rem; border-radius: 6px; font-size: .8rem;
  background: #eeeeee; border: 1px solid #e0e0e0; cursor: pointer;
  color: #424242;
  -webkit-transition: all .15s; transition: all .15s;
}
.year-tab.active { background: #1b5e20; color: #fff; border-color: #1b5e20; }
.year-inputs     { display: -webkit-box; display: -ms-flexbox; display: flex; -webkit-box-orient: vertical; -webkit-box-direction: normal; -ms-flex-direction: column; flex-direction: column; gap: .5rem; }
.scenario-chart-wrap { -webkit-box-flex: 1; -ms-flex: 1 1 300px; flex: 1 1 300px; min-height: 280px; }
.empty-state     { text-align: center; padding: 3rem; color: #757575; }

/* ─── 17. Footer ────────────────────────────────────────────── */
.site-footer {
  background: #1b5e20; color: rgba(255,255,255,.78);
  text-align: center; padding: 1.1rem 1.5rem;
  margin-top: 3rem; font-size: .82rem;
}
.footer-inner {
  display: -webkit-box; display: -ms-flexbox; display: flex;
  -webkit-box-pack: justify; -ms-flex-pack: justify; justify-content: space-between;
  -ms-flex-wrap: wrap; flex-wrap: wrap;
  gap: .5rem; max-width: 1300px; margin: 0 auto;
}

/* ─── 18. Responsive ────────────────────────────────────────── */
@media (max-width: 768px) {
  .main-nav {
    display: none;
    -webkit-box-orient: vertical; -webkit-box-direction: normal;
    -ms-flex-direction: column; flex-direction: column;
    position: absolute; top: var(--header-h); left: 0; right: 0;
    background: #1b5e20; padding: .5rem; z-index: 200;
  }
  .main-nav.open  { display: -webkit-box; display: -ms-flexbox; display: flex; }
  .nav-toggle     { display: block; }
  .header-user    { display: none; }
  .brand-sub      { display: none; }
  .site-header    { position: relative; }
  .main-content   { padding: 1.2rem 1rem; }
  .login-card     { padding: 2rem 1.2rem; margin: 1rem; }
  .scenario-controls { -webkit-box-flex: 1; -ms-flex: 1 1 100%; flex: 1 1 100%; }
  .product-card   { max-width: 100%; }
  .stat-card      { -webkit-box-flex: 1; -ms-flex: 1 1 140px; flex: 1 1 140px; }
}
@media (max-width: 480px) {
  .page-header h1 { font-size: 1.3rem; }
  .stat-value     { font-size: 1.2rem; }
  .two-col > .card{ -webkit-box-flex: 1; -ms-flex: 1 1 100%; flex: 1 1 100%; }
}

/* ============================================================
   Correctif responsive global – version finale multi-écrans
   Objectif : affichage propre sur mobile, tablette, laptop et desktop
   ============================================================ */
html, body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}
body {
  display: flex;
  flex-direction: column;
}
.main-content {
  width: 100%;
  flex: 1 0 auto;
}
.site-footer {
  flex-shrink: 0;
}
.card, .stat-card, .product-card, .scenario-controls, .scenario-chart-wrap, .form-card {
  min-width: 0;
}
.card-body, .card-header, .page-header, .product-card, .stat-card {
  overflow-wrap: anywhere;
  word-break: normal;
}
.header-inner {
  width: 100%;
  min-width: 0;
}
.header-brand {
  min-width: 0;
}
.header-brand-text {
  min-width: 0;
}
.brand-main, .brand-sub, .user-name {
  overflow: hidden;
  text-overflow: ellipsis;
}
.main-nav {
  min-width: 0;
  justify-content: center;
}
.header-user {
  min-width: 0;
}
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  align-items: stretch;
}
.product-card {
  width: 100%;
  max-width: none;
}
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
}
.stat-card {
  width: 100%;
}
.quick-nav {
  align-items: stretch;
}
.quick-btn, .btn-primary, .btn-secondary, .btn-sm, .product-pill, .nav-link, .btn-logout {
  min-height: 40px;
}
.chart-wrap, .scenario-chart-wrap {
  position: relative;
  width: 100%;
  min-height: 300px;
}
.card-body > canvas,
.scenario-chart-wrap > canvas {
  display: block;
  width: 100% !important;
  max-width: 100%;
  height: 300px !important;
}
.scenario-layout {
  display: grid;
  grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
  align-items: start;
}
.scenario-controls {
  width: 100%;
}
.scenario-actions {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  margin-top: .5rem;
}
.scenario-results {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.table-wrap,
.card-body.table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.data-table {
  min-width: 640px;
}
.form-group input,
.form-group select,
.login-form input,
textarea {
  min-width: 0;
  max-width: 100%;
}
.footer-inner {
  align-items: center;
}

@media (max-width: 1100px) {
  :root { --header-h: auto; }
  .site-header {
    height: auto;
    min-height: 64px;
  }
  .header-inner {
    min-height: 64px;
    padding: .65rem 1rem;
    flex-wrap: wrap;
  }
  .main-nav {
    order: 3;
    flex: 1 1 100%;
    margin-left: 0;
    justify-content: flex-start;
    overflow-x: auto;
    padding-bottom: .1rem;
    scrollbar-width: thin;
  }
  .nav-link {
    flex: 0 0 auto;
  }
  .header-user {
    margin-left: auto;
  }
}

@media (max-width: 900px) {
  .scenario-layout {
    grid-template-columns: 1fr;
  }
  .scenario-chart-wrap {
    min-height: 280px;
  }
  .card-body > canvas,
  .scenario-chart-wrap > canvas {
    height: 280px !important;
  }
}

@media (max-width: 768px) {
  :root { --header-h: 62px; }
  .site-header {
    position: sticky;
    height: var(--header-h);
    min-height: var(--header-h);
  }
  .header-inner {
    min-height: var(--header-h);
    flex-wrap: nowrap;
    padding: 0 .85rem;
  }
  .main-nav {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: var(--header-h);
    left: 0;
    right: 0;
    max-height: calc(100vh - var(--header-h));
    overflow-y: auto;
    background: #1b5e20;
    padding: .75rem;
    z-index: 200;
    transform: translateY(-115%);
    opacity: 0;
    pointer-events: none;
    transition: transform .2s ease, opacity .2s ease;
    box-shadow: 0 10px 24px rgba(0,0,0,.25);
  }
  .main-nav.open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }
  .nav-link {
    width: 100%;
    justify-content: flex-start;
    padding: .85rem 1rem;
    border-radius: 8px;
  }
  .nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    flex: 0 0 auto;
  }
  .header-user {
    display: none;
  }
  .brand-sub {
    display: none;
  }
  .header-brand img {
    height: 36px;
  }
  .brand-main {
    max-width: calc(100vw - 120px);
  }
  .main-content {
    padding: 1.1rem .85rem;
  }
  .page-header {
    margin-bottom: 1.2rem;
  }
  .page-header h1 {
    align-items: flex-start;
    line-height: 1.25;
  }
  .card-header {
    padding: .9rem 1rem;
    align-items: flex-start;
  }
  .card-body {
    padding: 1rem;
  }
  .stats-row,
  .products-grid {
    gap: .85rem;
  }
  .quick-nav {
    flex-direction: column;
    gap: .75rem;
  }
  .quick-btn,
  .btn-primary,
  .btn-secondary {
    width: 100%;
    justify-content: center;
  }
  .product-selector {
    flex-direction: column;
  }
  .product-pill {
    width: 100%;
    justify-content: flex-start;
    border-radius: 10px;
  }
  .years-tabs {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .year-tab {
    width: 100%;
  }
  .scenario-actions {
    flex-direction: column;
  }
  .footer-inner {
    justify-content: center;
    text-align: center;
  }
}

@media (max-width: 520px) {
  html { font-size: 14px; }
  .login-page {
    align-items: flex-start;
    padding: 1rem 0;
  }
  .login-card {
    width: calc(100% - 1.5rem);
    margin: 1rem auto;
    padding: 1.5rem 1rem;
    border-radius: 14px;
  }
  .login-logo img {
    height: 60px;
  }
  .stat-card {
    padding: 1rem;
  }
  .stat-icon {
    width: 44px;
    height: 44px;
  }
  .product-card {
    padding: 1rem;
  }
  .product-card-header,
  .product-footer {
    gap: .75rem;
    flex-direction: column;
    align-items: flex-start;
  }
  .chart-wrap, .scenario-chart-wrap {
    min-height: 240px;
  }
  .card-body > canvas,
  .scenario-chart-wrap > canvas {
    height: 240px !important;
  }
  .data-table {
    min-width: 560px;
    font-size: .82rem;
  }
  .data-table th,
  .data-table td {
    padding: .5rem .65rem;
  }
  .years-tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 360px) {
  .brand-main {
    font-size: .9rem;
  }
  .header-brand img {
    height: 32px;
  }
  .main-content {
    padding-left: .65rem;
    padding-right: .65rem;
  }
  .card-body {
    padding: .85rem;
  }
}
.mobile-logout { display: none; }
@media (max-width: 768px) { .mobile-logout { display: flex; } }
