/* ZTI AGENCY — styles de la connexion, de l'admin et de l'espace client */
:root {
  --noir: #0E0E0E; --blanc: #F2F0EB; --vert: #D4FF3F;
  --gris: #C9C6BE; --muted: #9A978F; --ligne: #2A2A28; --surface: #161615; --surface2: #1E1E1C;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--noir); color: var(--blanc);
  font-family: "Archivo", system-ui, sans-serif; font-size: 15px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button { font: inherit; cursor: pointer; }
h1, h2, h3 { margin: 0; }
.muted { color: var(--muted); font-size: 13px; }
.eyebrow { margin: 0; font-size: 12px; font-weight: 700; letter-spacing: 0.18em; text-transform: uppercase; color: var(--vert); }
.display { font-weight: 900; font-stretch: 125%; letter-spacing: -0.02em; line-height: 1; }
[hidden] { display: none !important; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 20px; border-radius: 999px; border: 0;
  font-weight: 700; text-decoration: none; white-space: nowrap;
  transition: transform 0.15s ease, background 0.15s ease, color 0.15s ease, opacity 0.15s;
}
.btn:hover { transform: translateY(-1px); }
.btn:disabled { opacity: 0.5; transform: none; cursor: default; }
.btn--vert { background: var(--vert); color: var(--noir); }
.btn--ligne { background: transparent; color: var(--blanc); border: 1px solid #55534F; }
.btn--ligne:hover { border-color: var(--blanc); }
.btn--small { min-height: 36px; padding: 0 14px; font-size: 13px; }
.btn--ghost { background: transparent; color: var(--gris); padding: 0 10px; }
.btn--ghost:hover { color: var(--blanc); }
.btn--danger { background: transparent; color: #FF8A7A; border: 1px solid #5A2E28; }
.btn--danger:hover { background: #FF8A7A; color: var(--noir); border-color: #FF8A7A; }

label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--gris); }
input, textarea, select {
  min-height: 44px; padding: 10px 14px; border-radius: 10px;
  background: var(--surface2); color: var(--blanc); border: 1px solid #3A3A38; font: inherit;
}
textarea { resize: vertical; min-height: 90px; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--vert); outline-offset: 1px; border-color: transparent; }
.error { margin: 0; color: #FF8A7A; font-size: 14px; min-height: 1.2em; }

.badge {
  display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border-radius: 999px;
  font-size: 12px; font-weight: 700; white-space: nowrap;
}
.badge--wait { background: #2E2B20; color: #F2D88A; }
.badge--run { background: #1E2A36; color: #9CCBFF; }
.badge--done { background: #26301A; color: var(--vert); }
.dot { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--vert); color: var(--noir); font-size: 11px; font-weight: 800; }

/* ---------- Connexion / invitation ---------- */
.auth { min-height: 100%; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.auth__side {
  position: relative; overflow: hidden; background: var(--vert); color: var(--noir);
  padding: 48px; display: flex; flex-direction: column; justify-content: space-between;
}
.auth__side .display { font-size: clamp(2.5rem, 5vw, 4.5rem); }
.auth__side img { width: 140px; transform: perspective(700px) rotateY(-24deg); filter: drop-shadow(18px 18px 0 rgba(14,14,14,0.15)); }
.auth__main { display: flex; align-items: center; justify-content: center; padding: 48px 32px; }
.auth__card { width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 18px; }
.auth__card h1 { font-size: 2rem; }
.auth__card form { display: flex; flex-direction: column; gap: 14px; }
.auth__back { font-size: 14px; color: var(--muted); }
@media (max-width: 820px) {
  .auth { grid-template-columns: 1fr; }
  .auth__side { padding: 28px; gap: 24px; }
  .auth__side img { width: 80px; }
}

/* ---------- Coque des espaces ---------- */
.app { min-height: 100%; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px 24px; border-bottom: 1px solid var(--ligne); background: rgba(14,14,14,0.85);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand img { width: 26px; }
.brand span { font-weight: 800; font-stretch: 125%; letter-spacing: 0.04em; }
.brand em { font-style: normal; color: var(--vert); font-size: 12px; font-weight: 700; letter-spacing: 0.14em; margin-left: 6px; }
.topbar__right { display: flex; align-items: center; gap: 12px; }
.who { font-size: 14px; color: var(--gris); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--ligne); overflow-x: auto; }
.tab {
  background: none; border: 0; color: var(--muted); padding: 14px 16px; font-weight: 700; font-size: 14px;
  border-bottom: 2px solid transparent; white-space: nowrap; display: inline-flex; align-items: center; gap: 8px;
}
.tab:hover { color: var(--blanc); }
.tab[aria-selected="true"] { color: var(--blanc); border-bottom-color: var(--vert); }

.panel { padding: 24px 0; }
.card { background: var(--surface); border: 1px solid var(--ligne); border-radius: 16px; padding: 20px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.row--between { justify-content: space-between; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.empty { padding: 32px; text-align: center; color: var(--muted); border: 1px dashed #3A3A38; border-radius: 16px; }

/* Travaux */
.project { display: flex; flex-direction: column; gap: 10px; }
.project__head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 12px; }
.project h3 { font-size: 1.15rem; font-weight: 800; }
.project p { margin: 0; color: var(--gris); white-space: pre-wrap; }
.steps { display: flex; gap: 4px; }
.steps i { flex: 1; height: 4px; border-radius: 2px; background: var(--ligne); }
.steps i.on { background: var(--vert); }

/* Fichiers */
.files { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.file {
  display: flex; flex-wrap: wrap; align-items: center; gap: 14px;
  padding: 12px 14px; background: var(--surface2); border-radius: 12px;
}
.file__icon { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--ligne); color: var(--vert); font-weight: 800; }
.file__main { flex: 1 1 200px; display: flex; flex-direction: column; min-width: 0; }
.file__main strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file__money { display: flex; align-items: center; gap: 10px; }

/* Discussion */
.chat { display: flex; flex-direction: column; height: min(640px, calc(100vh - 220px)); min-height: 380px; }
.chat__msgs { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding: 8px 4px 16px; }
.msg { max-width: min(560px, 82%); display: flex; flex-direction: column; gap: 4px; }
.msg p { margin: 0; padding: 10px 14px; border-radius: 16px; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg time { font-size: 11px; color: var(--muted); }
.msg--me { align-self: flex-end; align-items: flex-end; }
.msg--me p { background: var(--vert); color: var(--noir); border-bottom-right-radius: 4px; }
.msg--them { align-self: flex-start; }
.msg--them p { background: var(--surface2); border-bottom-left-radius: 4px; }
.msg--sys { align-self: center; align-items: center; max-width: 90%; text-align: center; }
.msg--sys span { font-size: 13px; color: var(--gris); background: transparent; border: 1px solid var(--ligne); padding: 6px 12px; border-radius: 999px; }
.chat__form { display: flex; gap: 10px; align-items: flex-end; padding-top: 12px; border-top: 1px solid var(--ligne); }
.chat__form textarea { flex: 1; min-height: 46px; max-height: 160px; }

/* ---------- Admin ---------- */
.admin { flex: 1; display: grid; grid-template-columns: 300px minmax(0, 1fr); min-height: 0; }
.side { border-right: 1px solid var(--ligne); padding: 20px 16px; display: flex; flex-direction: column; gap: 14px; }
.side__list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; overflow-y: auto; }
.client-btn {
  width: 100%; text-align: left; background: none; border: 0; color: var(--blanc);
  padding: 12px; border-radius: 12px; display: flex; align-items: center; gap: 12px;
}
.client-btn:hover { background: var(--surface2); }
.client-btn[aria-current="true"] { background: var(--surface2); outline: 1px solid #3A3A38; }
.avatar { width: 36px; height: 36px; flex: none; border-radius: 50%; background: var(--ligne); color: var(--vert); display: grid; place-items: center; font-weight: 800; font-size: 14px; }
.client-btn__txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.client-btn__txt strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.main { padding: 24px 32px; min-width: 0; }
.main__head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 8px; }
.main__head h1 { font-size: 2rem; }

dialog {
  border: 1px solid var(--ligne); border-radius: 18px; background: var(--surface); color: var(--blanc);
  padding: 24px; width: min(480px, calc(100vw - 32px));
}
dialog::backdrop { background: rgba(0,0,0,0.6); backdrop-filter: blur(4px); }
dialog form { display: flex; flex-direction: column; gap: 14px; }
.copy { display: flex; gap: 8px; }
.copy input { flex: 1; font-size: 13px; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; z-index: 100;
  background: var(--blanc); color: var(--noir); padding: 12px 18px; border-radius: 12px; font-weight: 600;
  transition: opacity 0.3s, transform 0.3s;
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }
.toast--err { background: #FF8A7A; }

/* ---------- Espace client ---------- */
.client-wrap { width: 100%; max-width: 1080px; margin: 0 auto; padding: 32px 24px; }
.hello { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 20px; }
.hello h1 { font-size: clamp(2rem, 4vw, 3rem); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 8px; }
.stat { background: var(--surface); border: 1px solid var(--ligne); border-radius: 16px; padding: 16px 18px; }
.stat strong { display: block; font-size: 1.8rem; font-weight: 900; font-stretch: 125%; }

@media (max-width: 860px) {
  .admin { grid-template-columns: 1fr; }
  .side { border-right: 0; border-bottom: 1px solid var(--ligne); }
  .side__list { flex-direction: row; overflow-x: auto; }
  .client-btn { width: auto; min-width: 200px; }
  .main { padding: 20px 16px; }
  .who { display: none; }
}
