* { box-sizing: border-box; }
body { font-family: system-ui, -apple-system, sans-serif; margin: 0; background: #f0f6fa; color: #1c2b36; }

/* HEADER */
header { background: linear-gradient(135deg, #0066a1, #00a3d9); color: white; padding: 15px 24px; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; position: relative; }
.logo { display: flex; align-items: center; gap: 12px; }
.brand-name { font-size: 1.4em; font-weight: 800; }
.brand-name span { color: #a6e6ff; }
.brand-tagline { font-size: .8em; opacity: .85; }
.main-nav { display: flex; gap: 20px; margin-right: 20px; margin-left: auto; }
.nav-link { color: white; text-decoration: none; font-weight: 600; opacity: 0.7; transition: opacity 0.2s; cursor: pointer; }
.nav-link:hover, .nav-link.active { opacity: 1; border-bottom: 2px solid white; }
.lang-selector select { background: white; border: none; border-radius: 4px; padding: 4px; }
.version { position: absolute; top: 8px; right: 12px; font-size: .75em; background: rgba(0,0,0,.2); padding: 2px 8px; border-radius: 10px; }

/* CONTENU */
.disclaimer { max-width: 1200px; margin: 16px auto 0; padding: 12px; background: #fff6e0; border-left: 4px solid #ffb700; border-radius: 6px; font-size: .9em; }
main { max-width: 1200px; margin: 20px auto; padding: 0 16px; display: flex; flex-direction: column; gap: 20px; }
.page-title { color: #0066a1; text-align: center; margin-bottom: 20px; }
.card { background: white; border-radius: 10px; padding: 20px; box-shadow: 0 2px 8px rgba(0,0,0,.06); margin-bottom: 20px;}
.card h2 { margin-top: 0; font-size: 1.15em; color: #0066a1; border-bottom: 2px solid #e0ecf3; padding-bottom: 8px; }
.card h3 { font-size: 1em; color: #333; margin-top: 20px; }

/* SOUS-ONGLETS */
.sub-tabs { display: flex; gap: 10px; margin-bottom: 20px; border-bottom: 2px solid #e0ecf3; padding-bottom: 10px; }
.sub-tab-btn { background: none; border: none; padding: 10px 20px; font-size: 1em; font-weight: 600; color: #666; cursor: pointer; border-radius: 6px 6px 0 0; transition: all 0.2s; }
.sub-tab-btn:hover { background: #f0f6fa; color: #0066a1; }
.sub-tab-btn.active { color: #0066a1; border-bottom: 3px solid #0066a1; background: #eef8ff; }

/* BOUTON INSTALLATION */
.btn-install { background: linear-gradient(135deg, #00a3d9, #0066a1); color: white; border: none; padding: 12px 24px; border-radius: 30px; font-size: 1.1em; font-weight: 600; cursor: pointer; box-shadow: 0 4px 15px rgba(0, 102, 161, 0.3); transition: transform 0.2s, box-shadow 0.2s; }
.btn-install:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0, 102, 161, 0.4); }

/* GRILLES */
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-bottom: 16px; }
label { display: flex; flex-direction: column; font-size: .9em; font-weight: 500; gap: 4px; }
input, select, textarea { padding: 8px; border: 1px solid #bcd4e0; border-radius: 6px; font-size: 1em; font-family: inherit; }
input[readonly] { background: #eef4f8; }

/* INFO SOUS CHAMPS */
.field-with-info { display: flex; flex-direction: column; gap: 2px; }
.field-info { margin: 2px 0 0 0; font-size: 0.65em; color: #666; font-style: italic; line-height: 1.2; }
.field-info strong { color: #0066a1; font-style: normal; font-weight: 600; }

/* RESULTATS */
.results-inline { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; background: #eef8ff; padding: 14px; border-radius: 8px; }
.results-inline > div { display: flex; justify-content: space-between; font-size: .95em; }
.results-inline b { color: #0066a1; }
.results-inline .total { grid-column: 1 / -1; border-top: 1px dashed #bcd4e0; padding-top: 8px; font-weight: 600; }

/* ALERTES */
.alert-box { margin: 10px 0; }
.alert-success { background: #e6f9ed; border-left: 4px solid #0b8a3e; padding: 12px; color: #0b8a3e; border-radius: 4px; font-weight: bold; margin-bottom: 10px; font-size: 0.95em; }
.alert-danger { background: #ffe6e6; border-left: 4px solid #d8002a; padding: 12px; color: #8a0018; border-radius: 4px; font-weight: bold; margin-bottom: 10px; font-size: 0.95em; }
.alert-warning { background: #fff0e0; border-left: 4px solid #ff8800; padding: 12px; color: #8a4400; border-radius: 4px; font-weight: bold; margin-bottom: 10px; font-size: 0.95em; }
.alert-info { background: #eef8ff; border-left: 4px solid #00a3d9; padding: 12px; color: #0066a1; border-radius: 4px; font-weight: bold; margin-bottom: 10px; font-size: 0.95em; }

/* LIGNES CIRCUITS */
.quick-add-bar { display: flex; gap: 10px; margin-bottom: 15px; flex-wrap: wrap; }
.btn-add-type { background: #eef8ff; color: #0066a1; border: 2px solid #00a3d9; padding: 8px 16px; border-radius: 6px; cursor: pointer; font-weight: 600; transition: all 0.2s; }
.btn-add-type:hover { background: #00a3d9; color: white; }

.lines-list { margin-bottom: 10px; display: flex; flex-direction: column; gap: 8px; }
.table-headers { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr 0.5fr; gap: 8px; text-align: center; font-size: 0.75em; font-weight: bold; color: #0066a1; margin-bottom: 5px; padding: 0 10px; }
.table-headers span { display: flex; align-items: center; justify-content: center; line-height: 1.1; }
.line-row { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr 0.5fr; gap: 8px; align-items: center; background: #f8fbfd; padding: 10px; border-radius: 6px; border: 1px solid #e0ecf3; }
.line-row input, .line-row select { width: 100%; padding: 6px; font-size: 0.9em; }

.btn-add { background: #00a3d9; color: white; border: none; padding: 8px 14px; border-radius: 6px; cursor: pointer; font-weight: 600; margin-top: 10px; }
.btn-add:hover { background: #0089b8; }
.btn-remove { background: #ff5566; color: white; border: none; padding: 6px; border-radius: 6px; cursor: pointer; height: 100%; }

/* TABLEAUX */
.table-wrap { overflow-x: auto; margin-top: 10px; }
table { width: 100%; border-collapse: collapse; font-size: .9em; }
th, td { border: 1px solid #d6e4ec; padding: 8px; text-align: right; }
th { background: #e6f2f9; text-align: center; }
td:first-child { text-align: left; }

/* COURBE */
.chart-wrap { background: #fafcfe; border: 1px solid #d6e4ec; border-radius: 8px; padding: 12px; margin: 12px 0; overflow-x: auto; }
canvas { max-width: 100%; height: auto; }

/* FORMULAIRE CONTACT */
.contact-form { display: flex; flex-direction: column; gap: 15px; margin-top: 15px; }
.contact-form textarea { resize: vertical; min-height: 120px; width: 100%; }
.contact-form button { align-self: flex-start; }
.success { color: #0b8a3e; font-weight: bold; }
.danger { color: #d8002a; font-weight: bold; }

/* DOCUMENTATION */
.formula-box { background: #eef8ff; border-left: 4px solid #0066a1; padding: 12px 16px; font-family: 'Courier New', monospace; font-size: 1.05em; font-weight: bold; color: #0066a1; border-radius: 4px; margin: 10px 0; }
.docs-list { list-style: none; padding: 0; }
.docs-list li { padding: 12px 0; border-bottom: 1px solid #e0ecf3; line-height: 1.6; }
.docs-list li:last-child { border-bottom: none; }
.docs-list b { color: #0066a1; }

/* BOUTON PDF & FOOTER */
.btn-print { background: #0066a1; color: white; padding: 12px 24px; border: none; border-radius: 8px; font-size: 1em; cursor: pointer; }
.btn-print:hover { background: #0089b8; }
footer { text-align: center; padding: 24px; font-size: .85em; color: #555; background: #e8f1f7; margin-top: 30px; }
.footer-main { display: flex; justify-content: center; align-items: center; gap: 10px; margin-bottom: 8px; }
.footer-brand { font-weight: 800; color: #0066a1; }

/* RESPONSIVE MOBILE */
@media (max-width: 900px) {
  .table-headers { display: none !important; }
  .line-row { display: flex !important; flex-direction: column !important; gap: 10px; background: #fff; border: 1px solid #bcd4e0; padding: 15px; border-radius: 8px; box-shadow: 0 2px 4px rgba(0,0,0,0.05); margin-bottom: 15px; }
  .input-group { display: flex !important; flex-direction: column !important; width: 100% !important; gap: 4px; }
  .input-group input, .input-group select { width: 100% !important; padding: 10px !important; font-size: 0.9em !important; box-sizing: border-box !important; text-align: center; }
  .input-group input::placeholder { color: #888; font-weight: bold; }
  .btn-remove { width: 100% !important; padding: 10px !important; margin-top: 5px; }
}



/* Lien d'installation discret */
#installBtn {
  color: #0066a1;
  font-size: 0.85em;
  text-decoration: underline;
  cursor: pointer;
  opacity: 0.8;
  transition: opacity 0.2s;
}
#installBtn:hover {
  opacity: 1;
}

/* Pop-up d'installation */
#installPopup {
  animation: slideUp 0.3s ease-out;
}
@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}