/* =========================================================
   AMOTRA GUYANE — Portail (espaces client / sous-traitant)
   ========================================================= */
:root {
  --navy: #0A2A4A;
  --navy-deep: #071E36;
  --navy-soft: #113a61;
  --gold: #B4673B;
  --gold-light: #D98E64;
  --ink: #1a2733;
  --muted: #5b6b7a;
  --line: #e5eaf0;
  --bg: #ffffff;
  --bg-alt: #f5f7fa;
  --ok: #1e7d4f;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 10px 30px rgba(10, 42, 74, .08);
  --font: "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, Helvetica, Arial, sans-serif;
}
* , *::before, *::after { box-sizing: border-box; }
body { margin: 0; font-family: var(--font); color: var(--ink); background: var(--bg-alt); line-height: 1.6; -webkit-font-smoothing: antialiased; }
a { color: inherit; }
.container { width: min(100% - 2.5rem, 1080px); margin-inline: auto; }

/* En-tête portail */
.portal-header { background: var(--navy-deep); color: #fff; }
.portal-header .container { display: flex; align-items: center; justify-content: space-between; height: 66px; }
.brand { display: inline-flex; align-items: center; gap: .6rem; font-weight: 700; color: #fff; text-decoration: none; }
.brand-mark { width: 38px; height: 38px; background: var(--navy) url('../img/icone-blanc.svg') no-repeat center / 62%; border-radius: 9px; box-shadow: inset 0 0 0 1.5px rgba(217,142,100,.55); font-size: 0; color: transparent; }
.brand-text { font-size: 1.05rem; letter-spacing: .02em; }
.brand-text em { color: var(--gold); font-style: normal; }
.portal-header .right { display: flex; align-items: center; gap: 1rem; font-size: .92rem; }
.link-btn { background: none; border: 1px solid rgba(255,255,255,.3); color: #fff; padding: .4rem .9rem; border-radius: 999px; cursor: pointer; font: inherit; font-size: .88rem; }
.link-btn:hover { border-color: var(--gold); color: var(--gold-light); }

/* Boutons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; padding: .7rem 1.3rem; border-radius: 999px; font-weight: 600; border: 1.5px solid transparent; cursor: pointer; font: inherit; text-decoration: none; transition: .15s; }
.btn-gold { background: var(--gold); color: var(--navy-deep); }
.btn-gold:hover { background: var(--gold-light); }
.btn-block { width: 100%; }

/* --- Page connexion --- */
.login-wrap { min-height: calc(100vh - 66px); display: grid; place-items: center; padding: 2rem 0; }
.login-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 2.2rem; width: min(100% - 2.5rem, 440px); }
.login-card h1 { font-size: 1.5rem; color: var(--navy); margin: 0 0 .3rem; }
.login-card .sub { color: var(--muted); margin: 0 0 1.6rem; font-size: .98rem; }
.field { margin-bottom: 1.1rem; }
.field label { display: block; font-weight: 600; font-size: .9rem; color: var(--navy); margin-bottom: .35rem; }
.field input { width: 100%; padding: .8rem .9rem; font: inherit; letter-spacing: .06em; text-transform: uppercase; border: 1.5px solid var(--line); border-radius: var(--radius-sm); }
.field input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201,162,75,.18); }
.hint { font-size: .85rem; color: var(--muted); margin: .4rem 0 0; }
.msg { margin: 0 0 1rem; padding: .7rem .9rem; border-radius: var(--radius-sm); font-size: .9rem; display: none; }
.msg.error { display: block; background: #fdecec; color: #a12; border: 1px solid #f3c9c9; }
.msg.info { display: block; background: #eef4fb; color: var(--navy); border: 1px solid #cfe0f2; }

/* --- Tableau de bord --- */
.dash { padding: 2rem 0 4rem; }
.dash-hello { margin: 0 0 .3rem; color: var(--navy); font-size: 1.6rem; }
.dash-sub { color: var(--muted); margin: 0 0 2rem; }
.dash h2 { color: var(--navy); font-size: 1.25rem; margin: 2.2rem 0 1rem; display: flex; align-items: center; gap: .5rem; }
.count { background: var(--navy); color: var(--gold); font-size: .78rem; font-weight: 700; padding: .1rem .55rem; border-radius: 999px; }
.state { color: var(--muted); background: #fff; border: 1px dashed var(--line); border-radius: var(--radius); padding: 1.5rem; text-align: center; }

.chantier { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; margin-bottom: 1.3rem; }
.chantier-head { display: flex; gap: 1rem; padding: 1.2rem 1.4rem; border-bottom: 1px solid var(--line); align-items: flex-start; }
.chantier-photo { width: 84px; height: 84px; border-radius: 10px; object-fit: cover; flex: none; background: var(--bg-alt); }
.chantier-code { font-size: .8rem; color: var(--gold); font-weight: 700; letter-spacing: .04em; }
.chantier-title { color: var(--navy); font-size: 1.15rem; font-weight: 700; margin: .1rem 0 .4rem; }
.tag { display: inline-block; font-size: .74rem; font-weight: 700; padding: .2rem .6rem; border-radius: 999px; background: #eef1f5; color: var(--navy); }
.progress { margin-top: .6rem; }
.progress-bar { height: 8px; border-radius: 999px; background: #e9eef4; overflow: hidden; }
.progress-bar > span { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), var(--gold-light)); }
.progress-label { font-size: .8rem; color: var(--muted); margin-top: .25rem; }
.fiche { white-space: pre-wrap; font-size: .93rem; color: var(--ink); padding: 1.1rem 1.4rem; margin: 0; }

.plan { display: flex; align-items: center; justify-content: space-between; gap: 1rem; background: #fff; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .9rem 1.1rem; margin-bottom: .7rem; flex-wrap: wrap; }
.plan-info { min-width: 0; }
.plan-objet { font-weight: 600; color: var(--navy); }
.plan-meta { font-size: .84rem; color: var(--muted); }
.plan-files { display: flex; gap: .5rem; flex-wrap: wrap; }
.dl { display: inline-flex; align-items: center; gap: .35rem; font-size: .86rem; font-weight: 600; color: var(--navy); border: 1.5px solid var(--line); padding: .45rem .8rem; border-radius: 999px; text-decoration: none; }
.dl:hover { border-color: var(--gold); color: var(--navy-deep); background: #fffdf6; }

/* Espace client — fiche */
.cbody { padding: 1.1rem 1.4rem 1.4rem; }
.next-step {
  background: linear-gradient(135deg, rgba(201,162,75,.14), rgba(201,162,75,.05));
  border: 1px solid rgba(201,162,75,.35); border-left: 4px solid var(--gold);
  border-radius: var(--radius-sm); padding: .8rem 1rem; margin-bottom: 1rem; color: var(--ink);
}
.next-step span { display: block; font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #9a7d2e; margin-bottom: .2rem; }
.infos { margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: .8rem 1.5rem; }
.infos > div { min-width: 0; }
.infos dt { font-size: .74rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.infos dd { margin: .15rem 0 0; color: var(--ink); font-size: .96rem; }

/* Formulaires du portail (dépôt devis, messages) */
.panel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.6rem; margin-bottom: 1.3rem; }
.panel textarea, .panel input, .panel select { width: 100%; padding: .7rem .85rem; font: inherit; border: 1.5px solid var(--line); border-radius: var(--radius-sm); background: #fff; }
.panel textarea:focus, .panel input:focus, .panel select:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201,162,75,.18); }
.panel textarea { resize: vertical; }
.msg-item { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 1rem 1.1rem; margin-bottom: .8rem; }
.msg-item .msg-subj { font-weight: 700; color: var(--navy); }
.msg-item .msg-body { color: var(--ink); white-space: pre-wrap; margin: .3rem 0; }
.msg-item .msg-reply { background: #f0f6ef; border-left: 3px solid var(--ok); border-radius: 8px; padding: .6rem .8rem; margin-top: .6rem; color: #1c3a2a; white-space: pre-wrap; }
.msg-item .msg-reply span { display: block; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--ok); margin-bottom: .2rem; }
.msg-item .msg-meta { font-size: .8rem; color: var(--muted); }
.form-row { display: grid; gap: .8rem; margin-bottom: .8rem; }
@media (min-width: 620px) { .form-row.two { grid-template-columns: 1fr 1fr; } }
.form-note { font-size: .85rem; color: var(--muted); margin: .5rem 0 0; }
.toast { padding: .7rem .9rem; border-radius: var(--radius-sm); font-size: .9rem; margin-bottom: 1rem; display: none; }
.toast.ok { display: block; background: #eef7f0; color: #1c6b3f; border: 1px solid #c9e6d3; }
.toast.err { display: block; background: #fdecec; color: #a12; border: 1px solid #f3c9c9; }

/* Sécurité mobile : pas de débordement horizontal sur les textes longs */
body { overflow-x: hidden; }
.fiche, .msg-body, .msg-reply, .plan-objet, .plan-meta, .infos dd, .chantier-title, .dl {
  overflow-wrap: anywhere;
  word-break: break-word;
}
.dl { max-width: 100%; }
.plan-info { flex: 1 1 200px; min-width: 0; }

.photos { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .7rem; }
.photos img { width: 92px; height: 92px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }

.loading { text-align: center; color: var(--muted); padding: 3rem 0; }
.spinner { width: 34px; height: 34px; border: 3px solid var(--line); border-top-color: var(--gold); border-radius: 50%; margin: 0 auto 1rem; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 560px) {
  .chantier-photo { width: 60px; height: 60px; }
  .plan { flex-direction: column; align-items: flex-start; }
  .infos { grid-template-columns: 1fr; }
  .portal-header .right #whoami { display: none; }
  .dash-hello { font-size: 1.35rem; }
}
