/* ============================================================
   Coworking virtuel — styles
   Palette sombre, chaleureuse (bureau feutré). Vanilla, sans framework.
   ============================================================ */
:root{
  --bg:#0d1017;
  --panel:#161b26;
  --panel-2:#1e2634;
  --line:#2b3446;
  --text:#e7ecf5;
  --muted:#94a2bd;
  --brand:#6ea8ff;
  --brand-2:#8f7bff;
  --accent:#ffcf70;
  --danger:#ff6b6b;
  --ok:#5fd39a;
  --radius:16px;
  --shadow:0 18px 50px rgba(0,0,0,.45);
}

*{ box-sizing:border-box; margin:0; padding:0; }
html,body{ height:100%; }
body{
  font-family:system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;
  color:var(--text); background:var(--bg);
  min-height:100%; overflow-x:hidden; -webkit-font-smoothing:antialiased;
}

.bg{ position:fixed; inset:0; z-index:0;
  background:
    radial-gradient(60% 55% at 20% 12%, rgba(110,168,255,.16), transparent 60%),
    radial-gradient(55% 50% at 85% 20%, rgba(143,123,255,.16), transparent 60%),
    radial-gradient(70% 60% at 50% 110%, rgba(255,207,112,.08), transparent 60%),
    var(--bg);
}

.screen{ position:relative; z-index:2; min-height:100vh;
  display:flex; flex-direction:column; align-items:center; justify-content:center;
  gap:26px; padding:40px 20px; text-align:center; }

.hidden{ display:none !important; }

/* ---------- marque ---------- */
.brand{ display:flex; flex-direction:column; align-items:center; gap:8px; }
.brand-logo{ font-size:56px; filter:drop-shadow(0 8px 20px rgba(0,0,0,.5)); }
h1{ font-size:clamp(30px,6vw,52px); font-weight:800; letter-spacing:-.02em; color:var(--text); }
.tagline{ color:var(--muted); font-size:clamp(14px,2.4vw,17px); max-width:34ch; }

/* ---------- cartes ---------- */
.card{ width:min(420px,92vw); background:var(--panel);
  border:1px solid var(--line); border-radius:var(--radius);
  box-shadow:var(--shadow); padding:26px; }

.auth-card{ display:flex; flex-direction:column; gap:18px; }

/* ---------- onglets ---------- */
.tabs{ display:flex; gap:6px; padding:5px; background:var(--panel-2);
  border:1px solid var(--line); border-radius:12px; }
.tab{ flex:1; padding:10px; border:0; border-radius:8px; cursor:pointer;
  background:transparent; color:var(--muted); font-weight:600; font-size:15px;
  transition:all .15s ease; }
.tab.is-active{ background:var(--brand); color:#0b1220; box-shadow:0 4px 14px rgba(110,168,255,.35); }

/* ---------- formulaires ---------- */
.auth-form{ display:flex; flex-direction:column; gap:14px; text-align:left; }
label{ display:flex; flex-direction:column; gap:6px; font-size:13px; color:var(--muted); font-weight:600; }
input{ padding:12px 14px; border-radius:10px; border:1px solid var(--line);
  background:var(--panel-2); color:var(--text); font-size:15px; outline:none;
  transition:border-color .15s ease, box-shadow .15s ease; }
input:focus{ border-color:var(--brand); box-shadow:0 0 0 3px rgba(110,168,255,.18); }
.select{ padding:12px 14px; border-radius:10px; border:1px solid var(--line);
  background:var(--panel-2); color:var(--text); font-size:15px; outline:none; cursor:pointer; }
.select:focus{ border-color:var(--brand); box-shadow:0 0 0 3px rgba(110,168,255,.18); }

/* ---------- boutons ---------- */
.btn{ padding:12px 18px; border-radius:10px; border:1px solid var(--line);
  background:var(--panel-2); color:var(--text); font-size:15px; font-weight:700;
  cursor:pointer; transition:transform .1s ease, filter .15s ease, background .15s ease; }
.btn:hover{ filter:brightness(1.1); }
.btn:active{ transform:translateY(1px); }
.btn-primary{ background:linear-gradient(120deg,var(--brand),var(--brand-2));
  color:#0b1220; border:0; box-shadow:0 8px 22px rgba(110,168,255,.3); }

/* ---------- divers ---------- */
.error{ color:var(--danger); font-size:14px; min-height:18px; }
.muted{ color:var(--muted); font-size:15px; }

/* ---------- écran connecté ---------- */
.home-head{ width:min(760px,94vw); display:flex; align-items:center; justify-content:space-between; gap:12px; }
.home-head h2{ font-size:24px; }
.btn-ghost{ background:transparent; }
a{ color:var(--brand); }
.opt{ color:var(--muted); font-weight:400; font-size:12px; }

/* éditeur de poste/fonction */
.role-editor{ width:min(760px,94vw); display:flex; align-items:flex-end; gap:12px; padding:16px 20px; }
.role-editor label{ flex:1; }
.role-editor .btn{ white-space:nowrap; }
.role-saved{ color:var(--ok); font-size:13px; min-width:80px; }

.picker-card{ width:min(760px,94vw); display:flex; flex-direction:column; gap:16px; }
.picker-layout{ display:flex; gap:20px; align-items:stretch; }
@media (max-width:640px){ .picker-layout{ flex-direction:column; align-items:center; } }

.preview{ flex:0 0 200px; display:flex; flex-direction:column; align-items:center; gap:4px;
  background:var(--panel-2); border:1px solid var(--line); border-radius:12px; padding:16px; }
#avatar-preview{ width:180px; height:200px; image-rendering:auto; }
.preview-name{ font-weight:700; font-size:17px; }
.preview-author{ font-size:13px; }

.gallery-wrap{ flex:1; min-width:0; display:flex; flex-direction:column; gap:10px; }
.picker-title{ font-weight:700; text-align:left; }
.gallery{ display:grid; grid-template-columns:repeat(auto-fill,minmax(76px,1fr)); gap:10px;
  max-height:300px; overflow-y:auto; padding:2px; }
.gallery-item{ aspect-ratio:1; padding:6px; cursor:pointer;
  background:var(--panel-2); border:2px solid var(--line); border-radius:12px;
  display:flex; align-items:center; justify-content:center;
  transition:border-color .12s ease, transform .12s ease, background .12s ease; }
.gallery-item:hover{ transform:translateY(-2px); border-color:var(--brand-2); }
.gallery-item.is-selected{ border-color:var(--brand); background:rgba(110,168,255,.12);
  box-shadow:0 0 0 3px rgba(110,168,255,.18); }
.gallery-item img,
.gallery-item canvas{ max-width:100%; max-height:100%; object-fit:contain; }

/* onglets d'avatar + navigateur petdex */
.avatar-tabs{ display:flex; gap:6px; margin-bottom:10px; }
.atab{ flex:1; padding:8px; border:1px solid var(--line); border-radius:9px; cursor:pointer;
  background:var(--panel-2); color:var(--muted); font-weight:600; font-size:14px; transition:all .12s ease; }
.atab.is-active{ background:var(--brand); color:#0b1220; border-color:var(--brand); }
.petdex-search{ width:100%; margin-bottom:8px; }
.petdex-status{ font-size:12px; margin-bottom:8px; }

.credits{ font-size:13px; text-align:left; }

/* ---------- lobby ---------- */
.lobby-card{ width:min(680px,94vw); display:flex; flex-direction:column; gap:14px; }
.lobby-actions{ display:flex; flex-direction:column; gap:10px; }
.inline-form{ display:flex; gap:8px; width:100%; }
.inline-form input{ flex:1; min-width:0; }
#create-theme{ flex:0 0 auto; }
.rooms-list{ display:flex; flex-direction:column; gap:8px; max-height:44vh; overflow-y:auto; }
.rooms-list .empty{ text-align:center; padding:18px; }
.room-row{ display:flex; align-items:center; justify-content:space-between; gap:12px;
  padding:12px 14px; background:var(--panel-2); border:1px solid var(--line); border-radius:12px; }
.room-meta{ display:flex; flex-direction:column; align-items:flex-start; gap:2px; min-width:0; }
.room-name{ font-weight:700; }
.room-code{ font-size:13px; letter-spacing:.12em; }
.room-right{ display:flex; align-items:center; gap:12px; }
.room-count{ font-size:14px; color:var(--muted); white-space:nowrap; }

/* ---------- bureau (office) ---------- */
.screen-full{ position:fixed; inset:0; z-index:5; }
#office-canvas{ display:block; width:100%; height:100%; touch-action:none; }
.office-hud{ position:fixed; top:14px; left:14px; right:14px; z-index:6;
  display:flex; align-items:center; justify-content:space-between; gap:12px; pointer-events:none; }
.office-hud > *{ pointer-events:auto; }
.hud-room{ display:flex; align-items:center; gap:10px;
  background:rgba(22,27,38,.82); border:1px solid var(--line); border-radius:12px; padding:8px 14px;
  backdrop-filter:blur(6px); }
.hud-room #hud-room-name{ font-weight:700; }
.hud-code{ font-size:13px; letter-spacing:.14em; color:var(--accent);
  background:rgba(255,207,112,.12); padding:2px 8px; border-radius:7px; }
.hud-right{ display:flex; align-items:center; gap:10px;
  background:rgba(22,27,38,.82); border:1px solid var(--line); border-radius:12px; padding:6px 8px 6px 14px;
  backdrop-filter:blur(6px); }
.hud-count{ font-size:14px; color:var(--muted); white-space:nowrap; }
.office-hint{ position:fixed; bottom:14px; left:50%; transform:translateX(-50%); z-index:6;
  font-size:13px; background:rgba(22,27,38,.7); padding:6px 14px; border-radius:20px;
  border:1px solid var(--line); backdrop-filter:blur(6px); }

/* ---------- tuiles vidéo ---------- */
.tiles{ position:fixed; top:70px; right:14px; z-index:6;
  display:flex; flex-direction:column; gap:10px; max-height:70vh; overflow-y:auto; }
.tile{ position:relative; width:200px; aspect-ratio:4/3; border-radius:12px; overflow:hidden;
  background:#000; border:1px solid var(--line); box-shadow:var(--shadow); transition:opacity .2s ease; }
.tile video{ width:100%; height:100%; object-fit:cover; background:#000; }
.tile-self{ border-color:var(--brand); }
.tile-label{ position:absolute; left:8px; bottom:8px; font-size:12px; font-weight:600;
  color:#fff; background:rgba(0,0,0,.55); padding:2px 8px; border-radius:7px; }

/* ---------- chat ---------- */
.chat{ position:fixed; bottom:78px; left:14px; z-index:6; width:min(320px,80vw);
  display:flex; flex-direction:column; gap:8px; }
.chat-log{ display:flex; flex-direction:column; gap:5px; max-height:34vh; overflow-y:auto;
  padding-right:4px; }
.chat-line{ background:rgba(22,27,38,.82); border:1px solid var(--line); border-radius:10px;
  padding:6px 10px; font-size:14px; backdrop-filter:blur(6px); max-width:100%; word-break:break-word; }
.chat-line.me{ border-color:rgba(110,168,255,.5); }
.chat-who{ font-weight:700; color:var(--brand); margin-right:6px; }
.chat-form{ display:flex; gap:6px; }
.chat-form input{ flex:1; min-width:0; background:rgba(22,27,38,.9); }
.chat-form .btn{ padding:10px 14px; }

/* ---------- barre de contrôle ---------- */
.controls{ position:fixed; bottom:16px; right:14px; z-index:6; display:flex; gap:10px; }
.ctrl{ width:52px; height:52px; border-radius:50%; border:1px solid var(--line);
  background:rgba(22,27,38,.9); font-size:22px; cursor:pointer; line-height:1;
  display:flex; align-items:center; justify-content:center; transition:all .15s ease;
  filter:grayscale(.4) opacity(.8); }
.ctrl:hover{ transform:translateY(-2px); }
.ctrl.is-on{ background:var(--brand); border-color:var(--brand); filter:none;
  box-shadow:0 6px 18px rgba(110,168,255,.4); }
.media-hint{ position:fixed; bottom:80px; right:14px; z-index:7; color:var(--danger);
  font-size:13px; background:rgba(22,27,38,.9); padding:8px 12px; border-radius:10px;
  border:1px solid var(--danger); }

/* ---------- compte-rendu ---------- */
#btn-meeting.is-rec{ background:var(--danger); color:#fff; border-color:var(--danger); }
.meeting-panel{ position:fixed; top:70px; right:14px; z-index:6; width:min(320px,84vw);
  display:flex; flex-direction:column; gap:8px;
  background:rgba(22,27,38,.92); border:1px solid var(--line); border-radius:12px;
  padding:12px; backdrop-filter:blur(6px); box-shadow:var(--shadow); }
.meeting-head{ display:flex; align-items:center; gap:8px; }
.rec-dot{ width:10px; height:10px; border-radius:50%; background:var(--danger);
  box-shadow:0 0 0 0 rgba(255,107,107,.6); animation:rec 1.4s ease-out infinite; }
@keyframes rec{ 0%{ box-shadow:0 0 0 0 rgba(255,107,107,.5);} 100%{ box-shadow:0 0 0 8px rgba(255,107,107,0);} }
#meeting-notes{ width:100%; min-height:160px; resize:vertical; padding:10px; border-radius:10px;
  border:1px solid var(--line); background:var(--panel-2); color:var(--text); font-size:14px;
  font-family:inherit; outline:none; }
#meeting-notes:focus{ border-color:var(--brand); box-shadow:0 0 0 3px rgba(110,168,255,.18); }
.transcript-head{ display:flex; align-items:center; justify-content:space-between; font-size:13px; font-weight:600; margin-top:2px; }
.transcript-head .muted{ font-weight:400; font-size:11px; }
.transcript-live{ max-height:120px; overflow-y:auto; display:flex; flex-direction:column; gap:3px;
  background:var(--panel-2); border:1px solid var(--line); border-radius:8px; padding:8px; font-size:13px; }
.transcript-live:empty::after{ content:'La transcription apparaîtra ici (micro requis).'; color:var(--muted); font-size:12px; }
.tr-line b{ color:var(--brand); }
.meeting-foot{ font-size:12px; }
.meeting-toast{ position:fixed; bottom:80px; left:50%; transform:translateX(-50%); z-index:9;
  background:var(--panel); border:1px solid var(--ok); border-radius:10px; padding:10px 16px;
  font-size:14px; box-shadow:var(--shadow); }
.meeting-toast a{ color:var(--brand); font-weight:600; }

/* ---------- modale ---------- */
.modal{ position:fixed; inset:0; z-index:10; display:flex; align-items:center; justify-content:center;
  background:rgba(5,6,15,.6); padding:20px; }
.modal-card{ width:min(560px,94vw); max-height:80vh; overflow:auto; background:var(--panel);
  border:1px solid var(--line); border-radius:var(--radius); box-shadow:var(--shadow); padding:20px; }
.modal-head{ display:flex; align-items:center; justify-content:space-between; margin-bottom:14px; }
.history-list{ display:flex; flex-direction:column; gap:8px; }
.history-row{ display:flex; align-items:center; justify-content:space-between; gap:12px;
  padding:10px 12px; background:var(--panel-2); border:1px solid var(--line); border-radius:10px; }
.history-meta{ display:flex; flex-direction:column; min-width:0; }
.history-title{ font-weight:700; }
.history-sub{ font-size:12px; }
