/* ════════════════════════════════════════════════════════════════
   app.css — Outil pré-devis Clôture Béton Déco
   Thème : topbar anthracite · fond sable · cards blanches · CTA orange
   ════════════════════════════════════════════════════════════════ */

/* ─── VARIABLES ─────────────────────────────────────────────────── */
:root {
  --cbd-anthracite:  #2C2C2A;
  --cbd-brun:        #3D3830;
  --cbd-gris-chaud:  #7A7469;
  --cbd-sable-md:    #EDE8DE;
  --cbd-sable:       #F0EBE0;
  --cbd-sable-clair: #FAF7F2;
  --cbd-orange:      #FF6B00;
  --cbd-orange-dk:   #E55F00;
  --cbd-blanc:       #FFFFFF;
  --cbd-border:      #D9D4CA;
  --cbd-border-lite: #EDE8E0;
  --cbd-texte:       #2C2C2A;
  --cbd-texte-muted: #7A7469;
  --cbd-vert:        #10b981;
  --cbd-vert-dk:     #059669;
  --cbd-bleu:        #1e40af;
  --cbd-rouge:       #ef4444;
}

/* ─── RESET ──────────────────────────────────────────────────────── */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Segoe UI', sans-serif;
  background: var(--cbd-sable-md);
  min-height: 100vh;
  color: var(--cbd-texte);
}

/* ─── TOPBAR ─────────────────────────────────────────────────────── */
.topbar {
  background: var(--cbd-anthracite);
  color: white;
  padding: 0 20px;
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
  height: 52px;
}

.topbar-brand {
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  letter-spacing: -.2px;
  color: var(--cbd-sable);
}

.topbar-nav {
  display: flex;
  align-items: stretch;
  gap: 0;
}

.topbar-nav a {
  color: rgba(240,235,224,.65);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  display: flex;
  align-items: center;
  padding: 0 16px;
  border-bottom: 3px solid transparent;
  transition: all .15s;
  white-space: nowrap;
}

.topbar-nav a:hover {
  color: var(--cbd-sable);
  background: rgba(255,255,255,.07);
}

.topbar-nav a.active {
  color: white;
  border-bottom-color: var(--cbd-orange);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-user {
  font-size: 12px;
  color: rgba(240,235,224,.7);
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-logout {
  color: rgba(240,235,224,.7);
  font-size: 12px;
  text-decoration: none;
  border: 1px solid rgba(240,235,224,.25);
  border-radius: 6px;
  padding: 4px 10px;
  transition: all .15s;
}

.topbar-logout:hover {
  background: rgba(255,255,255,.1);
  color: white;
  border-color: rgba(255,255,255,.4);
}

/* ─── BADGE NIVEAU ───────────────────────────────────────────────── */
.badge-niveau {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 700;
  vertical-align: middle;
}
.badge-pro    { background: #dbeafe; color: #1e40af; }
.badge-negoce { background: #fef3c7; color: #92400e; }
.badge-public { background: #f1f5f9; color: #374151; }

/* ─── CONTENEUR ──────────────────────────────────────────────────── */
.container {
  max-width: 760px;
  margin: 0 auto;
  padding: 24px 16px;
}

/* ─── CARD ───────────────────────────────────────────────────────── */
.card {
  background: var(--cbd-blanc);
  border-radius: 14px;
  padding: 22px;
  margin-bottom: 16px;
  box-shadow: 0 1px 4px rgba(44,44,42,0.07);
  border: 1px solid var(--cbd-border);
}

.card-titre {
  font-size: 14px;
  font-weight: 700;
  color: var(--cbd-texte);
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--cbd-border-lite);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ─── ALERTS ─────────────────────────────────────────────────────── */
.alert {
  padding: 12px 15px;
  border-radius: 10px;
  margin-bottom: 16px;
  font-size: 13px;
  line-height: 1.6;
}
.alert-err     { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.alert-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.alert-info    { background: #fff7ed; color: #9a3412; border: 1px solid #fed7aa; }

/* ─── BOUTONS ────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: opacity .15s, background .15s;
  white-space: nowrap;
}
.btn:hover    { opacity: .88; }
.btn-orange   { background: var(--cbd-orange);  color: white; }
.btn-orange:hover { background: var(--cbd-orange-dk); opacity: 1; }
.btn-vert     { background: var(--cbd-vert);    color: white; }
.btn-vert:hover   { background: var(--cbd-vert-dk);  opacity: 1; }
.btn-bleu     { background: var(--cbd-bleu);    color: white; }
.btn-gris     { background: var(--cbd-sable);   color: var(--cbd-texte); border: 1px solid var(--cbd-border); }
.btn-rouge    { background: var(--cbd-rouge);   color: white; }
.btn-sm       { padding: 6px 12px; font-size: 12px; }
.btn-block    { width: 100%; justify-content: center; padding: 14px; font-size: 14px; }

/* ─── FORMULAIRES ────────────────────────────────────────────────── */
.form-group { margin-bottom: 14px; }

label.lbl {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--cbd-texte-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 5px;
}

input[type=text],
input[type=email],
input[type=password],
input[type=number],
select,
textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--cbd-border);
  border-radius: 8px;
  font-size: 13px;
  color: var(--cbd-texte);
  background: var(--cbd-sable-clair);
  transition: border-color .2s;
  font-family: inherit;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--cbd-orange);
  box-shadow: 0 0 0 3px rgba(255,107,0,.1);
  background: white;
}

textarea { resize: vertical; min-height: 70px; }

/* ─── TABLEAU ────────────────────────────────────────────────────── */
table.t {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

table.t thead tr { background: var(--cbd-sable-clair); }

table.t thead th {
  font-size: 10px;
  font-weight: 700;
  color: var(--cbd-texte-muted);
  text-transform: uppercase;
  letter-spacing: .4px;
  padding: 9px 10px;
  text-align: left;
  border-bottom: 2px solid var(--cbd-border);
}
table.t thead th.r { text-align: right; }
table.t thead th.c { text-align: center; }

table.t tbody td {
  padding: 10px;
  border-bottom: 1px solid var(--cbd-border-lite);
  vertical-align: middle;
}
table.t tbody td.r { text-align: right; font-weight: 600; color: var(--cbd-vert-dk); }
table.t tbody td.c { text-align: center; }
table.t tbody tr:last-child td { border-bottom: none; }
table.t tbody tr:hover td { background: var(--cbd-sable-clair); }

table.t input.qte {
  width: 60px;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--cbd-bleu);
  border: 1px solid #bfdbfe;
  border-radius: 6px;
  background: #eff6ff;
  padding: 5px;
}

/* ─── TOTAUX ─────────────────────────────────────────────────────── */
.totaux { margin-left: auto; width: 250px; }

.totaux-ligne {
  display: flex;
  justify-content: space-between;
  padding: 7px 0;
  border-bottom: 1px solid var(--cbd-border-lite);
  font-size: 13px;
}

.totaux-ligne.ttc {
  border: none;
  border-top: 2px solid var(--cbd-border);
  margin-top: 4px;
  padding-top: 11px;
}

.totaux-ligne.ttc .lib { font-size: 15px; font-weight: 800; }
.totaux-ligne.ttc .val { font-size: 18px; font-weight: 900; color: var(--cbd-vert-dk); }

/* ─── CHIPS ──────────────────────────────────────────────────────── */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }

.chip {
  padding: 7px 13px;
  border-radius: 7px;
  border: 1.5px solid var(--cbd-border);
  background: white;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  color: var(--cbd-texte-muted);
  transition: all .15s;
}

.chip:hover   { border-color: var(--cbd-orange); color: var(--cbd-orange); }
.chip.actif   { background: var(--cbd-orange); border-color: var(--cbd-orange); color: white; }

/* ─── MODAL ──────────────────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(44,44,42,.55);
  z-index: 200;
  align-items: flex-end;
  justify-content: center;
}
.modal-overlay.open { display: flex; }

.modal-card {
  background: white;
  border-radius: 20px 20px 0 0;
  padding: 28px 24px 36px;
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-titre { font-size: 17px; font-weight: 700; margin-bottom: 6px; color: var(--cbd-texte); }
.modal-sous  { font-size: 12px; color: var(--cbd-texte-muted); margin-bottom: 18px; line-height: 1.6; }
.modal-btns  { display: flex; gap: 10px; margin-top: 16px; }

/* ─── SÉPARATEUR ─────────────────────────────────────────────────── */
hr.sep { border: none; border-top: 1px solid var(--cbd-border-lite); margin: 14px 0; }

/* ─── CONFIGURATEUR — spécifique ─────────────────────────────────── */
.grille-modeles {
  display: grid;
  grid-template-columns: repeat(2,1fr);
  gap: 10px;
  margin-bottom: 14px;
}

.carte-modele {
  border: 2px solid var(--cbd-border);
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  transition: border-color .15s;
}
.carte-modele:hover,
.carte-modele.actif { border-color: var(--cbd-orange); }
.carte-modele input[type=radio] { display: none; }

.carte-couleur {
  aspect-ratio: 4 / 3;
  overflow: hidden;
}

.carte-couleur img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.carte-badge {
  padding: 7px;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  color: white;
}

.bloc-ligne {
  border: 1px solid var(--cbd-border);
  border-radius: 12px;
  padding: 18px;
  margin-bottom: 12px;
  background: white;
}

.bloc-ligne-titre {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  font-weight: 700;
  color: var(--cbd-texte);
  margin-bottom: 14px;
}

.btn-suppr {
  background: none;
  border: none;
  color: var(--cbd-rouge);
  font-size: 13px;
  cursor: pointer;
}

.btn-add {
  width: 100%;
  border: 2px dashed var(--cbd-orange);
  background: transparent;
  color: var(--cbd-orange);
  border-radius: 12px;
  padding: 13px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 12px;
  transition: background .15s;
}
.btn-add:hover { background: rgba(255,107,0,.06); }

/* ─── PROFIL — spécifique ────────────────────────────────────────── */
.profil-bloc {
  background: white;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 14px;
  box-shadow: 0 1px 4px rgba(44,44,42,.05);
  border: 1px solid var(--cbd-border);
}

.profil-bloc-titre {
  font-size: 14px;
  font-weight: 700;
  color: var(--cbd-texte);
  padding-bottom: 10px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--cbd-border-lite);
}

.info-ligne {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 11px 0;
  border-bottom: 1px solid var(--cbd-sable-clair);
  gap: 12px;
}
.info-ligne:last-child { border-bottom: none; }
.info-label  { font-size: 13px; color: var(--cbd-texte-muted); flex: 1; }
.info-valeur { font-size: 14px; color: var(--cbd-texte); font-weight: 500; flex: 2; text-align: right; word-break: break-word; }

.logo-img  { max-width: 160px; max-height: 64px; border-radius: 6px; border: 1px solid var(--cbd-border); object-fit: contain; }
.logo-vide { font-size: 12px; color: var(--cbd-border); font-style: italic; }

.marge-row   { display: flex; align-items: center; gap: 14px; margin-top: 14px; flex-wrap: wrap; }
.marge-input { width: 90px; padding: 11px 13px; border: 2px solid var(--cbd-border); border-radius: 8px; font-size: 16px; font-weight: 600; color: var(--cbd-texte); background: var(--cbd-sable-clair); text-align: center; }
.marge-input:focus { outline: none; border-color: var(--cbd-orange); box-shadow: 0 0 0 3px rgba(255,107,0,.1); }
.marge-calcul      { font-size: 13px; color: var(--cbd-texte-muted); }
.marge-calcul span { font-weight: 700; color: var(--cbd-texte); }
.btn-marge         { padding: 11px 22px; background: var(--cbd-vert); color: white; border: none; border-radius: 10px; font-size: 14px; font-weight: 700; cursor: pointer; }
.btn-marge:hover   { background: var(--cbd-vert-dk); }
.btn-marge:disabled { background: #d1fae5; cursor: default; }

.btn-deconnexion       { display: block; width: 100%; padding: 16px; border: 2px solid var(--cbd-rouge); background: white; color: var(--cbd-rouge); border-radius: 12px; font-size: 15px; font-weight: 600; cursor: pointer; text-align: center; margin-top: 4px; text-decoration: none; }
.btn-deconnexion:hover { background: #fef2f2; }

/* ─── LIGNE PRÉDEVIS (liste) ─────────────────────────────────────── */
.ligne-predevis:hover td { background: var(--cbd-sable-clair) !important; cursor: pointer; }

/* ─── RESPONSIVE ─────────────────────────────────────────────────── */
@media(max-width: 540px) {
  .topbar-nav a span.nav-label { display: none; }
  .topbar-user { display: none; }
  .totaux { width: 100%; }
  .grille-modeles { grid-template-columns: 1fr 1fr; }
}