/* =========================================================================
   FluxxyCorp — Design system
   ========================================================================= */
:root {
  /* surfaces (neutres, alignees sur le site) */
  --bg: #0a0a0b;
  --surface-1: #101012;
  --surface-2: #151517;
  --surface-3: #1d1d20;
  --elevated: #161618;
  /* borders */
  --border: rgba(255,255,255,.09);
  --border-strong: rgba(255,255,255,.17);
  /* text */
  --text: #f2f1ee;
  --muted: #9c9ba1;
  --faint: #68676c;
  /* accent (ambre, comme le site) */
  --accent: #ff5a1f;
  --accent-2: #ff7a45;
  --grad: linear-gradient(135deg, #ff5a1f 0%, #ff7a45 100%);
  --accent-soft: rgba(255,90,31,.14);
  /* status */
  --green: #34d399; --green-soft: rgba(52,211,153,.13);
  --red: #fb7185;   --red-soft: rgba(251,113,133,.13);
  --amber: #fbbf24; --amber-soft: rgba(251,191,36,.14);
  /* shape */
  --r-sm: 9px; --r: 13px; --r-lg: 18px; --r-xl: 24px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.3);
  --shadow: 0 10px 30px -12px rgba(0,0,0,.55);
  --shadow-lg: 0 24px 60px -20px rgba(0,0,0,.7);
  --ring: 0 0 0 3px rgba(255,90,31,.28);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: "IBM Plex Sans", system-ui, -apple-system, sans-serif;
  background: var(--bg); color: var(--text);
  font-size: 14px; line-height: 1.5; letter-spacing: -.01em;
  display: flex; width: 100%; height: 100%;
  -webkit-font-smoothing: antialiased;
}
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(700px 400px at 85% -5%, rgba(255,90,31,.14), transparent 60%),
    radial-gradient(600px 500px at -5% 110%, rgba(255,122,69,.08), transparent 55%);
}
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
::selection { background: rgba(255,90,31,.35); }
.hidden { display: none !important; }

/* scrollbars */
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
*::-webkit-scrollbar-thumb:hover { background: #2b3047; background-clip: padding-box; }

/* =========================== AUTH ====================================== */
.auth-screen { width: 100%; height: 100%; display: grid; grid-template-columns: 1.05fr 1fr; }
.auth-aside { position: relative; overflow: hidden; padding: 56px;
  display: flex; align-items: center; background: linear-gradient(160deg, #151517, #0a0a0b); }
.auth-glow { position: absolute; width: 520px; height: 520px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,90,31,.5), transparent 65%);
  filter: blur(40px); bottom: -160px; left: -120px; opacity: .55; }
.auth-aside-inner { position: relative; z-index: 1; max-width: 440px; }
.auth-aside h2 { font-size: 34px; font-weight: 800; letter-spacing: -.03em; margin: 30px 0 16px; line-height: 1.2; }
.auth-feats { list-style: none; margin-top: 28px; display: flex; flex-direction: column; gap: 14px; }
.auth-feats li { display: flex; align-items: center; gap: 12px; color: #c7cbdb; font-size: 14px; }
.auth-feats .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--grad); box-shadow: 0 0 12px var(--accent); }
.auth-main { display: grid; place-items: center; padding: 40px; background: var(--bg); }
.auth-card { width: 100%; max-width: 380px; }
.auth-card h1 { font-size: 26px; font-weight: 700; letter-spacing: -.02em; }
.mb-lg { margin-bottom: 26px; }
.tabs { display: flex; gap: 4px; background: var(--surface-1); padding: 4px; border-radius: 12px;
  border: 1px solid var(--border); margin-bottom: 22px; }
.tab { flex: 1; background: none; border: none; color: var(--muted); padding: 9px; border-radius: 9px;
  cursor: pointer; font-size: 13.5px; font-weight: 500; font-family: inherit; transition: .18s; }
.tab:hover { color: var(--text); }
.tab.active { background: var(--surface-3); color: #fff; box-shadow: var(--shadow-sm); }
.auth-form label { margin-top: 16px; }
.auth-err { color: var(--red); min-height: 20px; margin-top: 14px; font-size: 13px; }
.auth-note { margin-top: 18px; font-size: 12.5px; }
.full { width: 100%; }
.lg { padding: 12px 18px; font-size: 14.5px; }
.auth-form .btn { margin-top: 24px; }

/* =========================== SIDEBAR =================================== */
.app { display: flex; width: 100%; height: 100%; }
.sidebar { width: 256px; flex-shrink: 0; background: var(--surface-1);
  border-right: 1px solid var(--border); display: flex; flex-direction: column; padding: 20px 16px; }
.brand { display: flex; align-items: center; gap: 13px; padding: 4px 6px 22px; }
.brand.big { padding: 0; }
.logo { width: 42px; height: 42px; border-radius: 13px; flex-shrink: 0; background: var(--grad);
  display: grid; place-items: center; font-weight: 800; font-size: 17px; color: #fff;
  box-shadow: 0 6px 18px -4px rgba(255,90,31,.6); letter-spacing: -.02em; }
.brand.big .logo { width: 48px; height: 48px; }
.brand-name { font-weight: 700; font-size: 16.5px; letter-spacing: -.02em; }
.brand.big .brand-name { font-size: 20px; }
.brand-text { min-width: 0; }
.org-switch-wrap { margin-top: 3px; }
.org-switcher { background: transparent; border: none; color: var(--muted); font-size: 12px;
  font-family: inherit; max-width: 165px; cursor: pointer; padding: 1px 2px; border-radius: 5px; }
.org-switcher:hover { color: var(--text); }
.org-switcher option { background: var(--surface-2); color: var(--text); }

.nav { display: flex; flex-direction: column; gap: 3px; margin-top: 4px; }
.nav-item { display: flex; align-items: center; gap: 12px; background: none; border: none;
  color: var(--muted); padding: 10px 12px; border-radius: 11px; cursor: pointer;
  font-size: 14px; font-weight: 500; font-family: inherit; text-align: left;
  width: 100%; transition: .16s; position: relative; }
.nav-item svg { width: 19px; height: 19px; }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: #ffc9b0; }
.nav-item.active::before { content: ""; position: absolute; left: -16px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 20px; border-radius: 0 4px 4px 0; background: var(--grad); }

.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.me { display: flex; align-items: center; gap: 11px; background: var(--surface-2);
  padding: 10px; border-radius: 12px; border: 1px solid var(--border); }
.me .title { font-size: 13.5px; font-weight: 600; }
.me .sub { font-size: 11.5px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* =========================== MAIN ===================================== */
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding: 20px 30px; border-bottom: 1px solid var(--border); }
.topbar h1 { font-size: 21px; font-weight: 700; letter-spacing: -.025em; }
.muted { color: var(--muted); font-size: 13px; }
.topbar-actions { display: flex; gap: 10px; align-items: center; }
.search { position: relative; display: flex; align-items: center; }
.search svg { position: absolute; left: 12px; width: 16px; height: 16px; color: var(--faint); pointer-events: none; }
.search input { padding-left: 36px; width: 240px; }
.content { padding: 30px; overflow-y: auto; flex: 1; animation: fade .35s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* =========================== BUTTONS ================================== */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--surface-2); color: var(--text); border: 1px solid var(--border);
  padding: 9px 15px; border-radius: var(--r-sm); cursor: pointer; font-size: 13px;
  font-weight: 500; font-family: inherit; transition: .16s; white-space: nowrap; }
.btn:hover { border-color: var(--border-strong); background: var(--surface-3); transform: translateY(-1px); }
.btn:active { transform: none; }
.btn svg { width: 16px; height: 16px; }
.btn.primary { background: var(--grad); border: none; color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { color: var(--red); border-color: rgba(251,113,133,.3); background: var(--red-soft); }
.btn.danger:hover { background: rgba(251,113,133,.2); border-color: var(--red); }
.btn.small { padding: 6px 11px; font-size: 12px; border-radius: 8px; }
.icon-btn { display: grid; place-items: center; width: 32px; height: 32px; background: none;
  border: none; color: var(--muted); cursor: pointer; border-radius: 8px; transition: .16s; }
.icon-btn:hover { background: var(--surface-3); color: var(--text); }

/* =========================== CARDS / GRID ============================= */
.grid { display: grid; gap: 16px; }
.cols-2 { grid-template-columns: repeat(2, 1fr); }
.cols-3 { grid-template-columns: repeat(3, 1fr); }
.cols-4 { grid-template-columns: repeat(4, 1fr); }
.card { background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: 20px; transition: .18s; }
.card h3 { font-size: 15px; font-weight: 600; letter-spacing: -.01em; margin-bottom: 4px; }
.stat { position: relative; overflow: hidden; }
.stat .stat-ico { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent-2); margin-bottom: 14px; }
.stat .stat-ico svg { width: 19px; height: 19px; }
.stat .big { font-size: 30px; font-weight: 700; letter-spacing: -.03em; line-height: 1; }
.stat .label { color: var(--muted); font-size: 13px; margin-top: 6px; }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 4px 0 18px; }
.section-head h2 { font-size: 17px; font-weight: 650; letter-spacing: -.02em; }

/* clickable project card */
.pcard { cursor: pointer; }
.pcard:hover { border-color: var(--border-strong); transform: translateY(-3px); box-shadow: var(--shadow); }
.pcard .pico { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent-2); margin-bottom: 14px; }

/* =========================== ROWS ===================================== */
.row { display: flex; align-items: center; gap: 13px; padding: 13px 15px; border: 1px solid var(--border);
  border-radius: var(--r); background: var(--surface-1); margin-bottom: 9px; transition: .15s; }
.row:hover { border-color: var(--border-strong); background: var(--surface-2); }
.row .grow { flex: 1; min-width: 0; }
.row .title { font-weight: 600; font-size: 13.5px; }
.row .sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.row-ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: var(--surface-3); color: var(--muted); flex-shrink: 0; }
.avatar { width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0; display: grid; place-items: center;
  font-weight: 700; font-size: 13px; color: #fff; box-shadow: inset 0 0 0 1px rgba(255,255,255,.12); }
.avatar-stack { display: flex; }
.avatar-stack .avatar { margin-left: -8px; box-shadow: inset 0 0 0 1px rgba(255,255,255,.12), 0 0 0 2px var(--surface-1); }
.avatar-stack .avatar:first-child { margin-left: 0; }

.badge { font-size: 11px; font-weight: 600; padding: 4px 10px; border-radius: 20px;
  background: var(--surface-3); border: 1px solid var(--border); color: var(--muted); }
.badge.role-owner { background: rgba(255,90,31,.16); color: #ffc9b0; border-color: rgba(255,90,31,.35); }
.badge.role-admin { background: rgba(96,165,250,.14); color: #bcdcff; border-color: rgba(96,165,250,.3); }
.badge.role-dev   { background: var(--green-soft); color: #a7f3d0; border-color: rgba(52,211,153,.3); }
.badge.role-beta  { background: var(--amber-soft); color: #ffe3a3; border-color: rgba(251,191,36,.3); }
.chip.locked { cursor: default; opacity: .92; display: inline-flex; align-items: center; gap: 5px; }
.chip svg { vertical-align: -2px; }
.vis-chips { margin-top: 4px; }
.row select.role-sel { width: auto; min-width: 132px; padding: 7px 10px; }
.task.done .title { text-decoration: line-through; color: var(--muted); }
.badge.tag-badge { background: rgba(255,90,31,.14); color: #ffc9b0; border-color: rgba(255,90,31,.32);
  display: inline-flex; align-items: center; gap: 4px; }
.badge.tag-badge svg { width: 11px; height: 11px; }

.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip { font-size: 12.5px; font-weight: 500; padding: 6px 13px; border-radius: 20px; background: var(--surface-2);
  border: 1px solid var(--border); cursor: pointer; transition: .15s; }
.chip:hover { border-color: var(--border-strong); }
.chip.on { background: var(--grad); border-color: transparent; color: #fff; }

/* =========================== FORMS ==================================== */
label { display: block; font-size: 13px; font-weight: 500; margin: 14px 0 7px; color: var(--muted); }
input[type=text], input[type=email], input[type=password], textarea, select {
  width: 100%; background: var(--surface-1); border: 1px solid var(--border); color: var(--text);
  padding: 11px 13px; border-radius: var(--r-sm); font-family: inherit; font-size: 13.5px; transition: .15s; }
input::placeholder, textarea::placeholder { color: var(--faint); }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); background: var(--bg); }
input:disabled { opacity: .5; }
textarea { resize: vertical; min-height: 90px; font-family: "IBM Plex Mono", "Consolas", monospace; font-size: 12.5px; line-height: 1.6; }
.field { position: relative; }

/* =========================== MODAL ==================================== */
.modal-overlay { position: fixed; inset: 0; background: rgba(6,7,12,.6); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  display: grid; place-items: center; z-index: 50; padding: 24px; animation: fade .2s ease; }
.modal { background: var(--elevated); border: 1px solid var(--border-strong); border-radius: var(--r-lg);
  width: 100%; max-width: 660px; box-shadow: var(--shadow-lg); max-height: 92vh; overflow: auto;
  animation: pop .26s cubic-bezier(.2,.9,.3,1.2); }
@keyframes pop { from { opacity: 0; transform: scale(.96) translateY(10px); } to { opacity: 1; transform: none; } }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 22px;
  border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--elevated); z-index: 1; }
.modal-head h3 { font-size: 16px; font-weight: 650; letter-spacing: -.01em; }
.modal-body { padding: 22px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; flex-wrap: wrap; }

/* =========================== FILES / DIFF ============================= */
.file-line { display: flex; align-items: center; gap: 12px; padding: 11px 13px; border-radius: 11px;
  border: 1px solid var(--border); background: var(--surface-1); margin-bottom: 8px; transition: .15s; }
.file-line:hover { background: var(--surface-2); border-color: var(--border-strong); }

/* code editor with gutter */
.editor { display: flex; background: #0b0d16; border: 1px solid var(--border); border-radius: var(--r-sm);
  overflow: hidden; transition: .15s; }
.editor:focus-within { border-color: var(--accent); box-shadow: var(--ring); }
.editor .gutter { flex-shrink: 0; padding: 11px 10px 11px 14px; text-align: right; color: var(--faint);
  font-family: "IBM Plex Mono", monospace; font-size: 12.5px; line-height: 1.6; -webkit-user-select: none; user-select: none;
  background: rgba(255,255,255,.02); overflow: hidden; min-width: 42px; }
.editor .code-input { flex: 1; background: transparent; border: none; box-shadow: none !important;
  color: var(--text); padding: 11px 14px; font-family: "IBM Plex Mono", monospace; font-size: 12.5px;
  line-height: 1.6; resize: none; outline: none; min-height: inherit; white-space: pre; tab-size: 4; }
.editor .code-input:focus { background: transparent; }

.copy-row { display: flex; align-items: center; gap: 10px; background: #0b0d16; border: 1px solid var(--border);
  border-radius: var(--r-sm); padding: 8px 8px 8px 14px; }
.copy-row code { flex: 1; font-family: "IBM Plex Mono", monospace; font-size: 12.5px; color: #c9cee0;
  overflow-x: auto; white-space: nowrap; }

.modal.wide { max-width: 940px; }
.toast { display: flex; align-items: center; gap: 8px; }
.toast svg { width: 16px; height: 16px; }

.code-box { background: #0b0d16; border: 1px solid var(--border); border-radius: var(--r);
  font-family: "IBM Plex Mono", "Consolas", monospace; font-size: 12.5px; overflow: auto; max-height: 380px; }
.code-box header { padding: 9px 14px; border-bottom: 1px solid var(--border); color: var(--faint);
  font-size: 11.5px; font-weight: 500; position: sticky; top: 0; background: #0b0d16; letter-spacing: .02em; }
.diff-line { display: flex; padding: 1.5px 14px; white-space: pre-wrap; word-break: break-word; }
.diff-line .ln { width: 32px; color: var(--faint); -webkit-user-select: none; user-select: none; flex-shrink: 0; }
.diff-line .mark { width: 16px; flex-shrink: 0; }
.diff-add { background: var(--green-soft); } .diff-add .mark { color: var(--green); }
.diff-del { background: var(--red-soft); } .diff-del .mark { color: var(--red); }
.diff-ctx { color: #c9cee0; } .diff-ctx .mark { color: var(--faint); }
.diff-conflict { background: var(--amber-soft); } .diff-conflict .mark { color: var(--amber); }
.tag { font-size: 11px; font-weight: 500; padding: 3px 9px; border-radius: 7px; background: var(--surface-2);
  border: 1px solid var(--border); font-family: "IBM Plex Mono", monospace; }

.timeline { position: relative; padding-left: 28px; }
.timeline::before { content:""; position:absolute; left: 10px; top: 6px; bottom: 6px; width: 2px; background: var(--border-strong); }
.commit-node { position: relative; margin-bottom: 18px; }
.commit-node::before { content:""; position:absolute; left: -22px; top: 5px; width: 13px; height: 13px;
  border-radius: 50%; background: var(--grad); border: 3px solid var(--elevated); box-shadow: 0 0 0 1px var(--border-strong); }

.editor-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.callout { border: 1px solid var(--border); border-radius: var(--r); padding: 16px 18px; background: var(--surface-2); }
.callout.warn { border-color: rgba(251,191,36,.35); background: var(--amber-soft); }
.callout.info { border-left: 3px solid var(--accent); }

/* =========================== UTILS ==================================== */
.flex { display: flex; gap: 10px; align-items: center; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.mt { margin-top: 16px; } .mb { margin-bottom: 16px; }
.empty { text-align: center; color: var(--muted); padding: 48px 20px; }
.empty svg { width: 40px; height: 40px; color: var(--faint); margin-bottom: 12px; stroke-width: 1.5; }
.empty .t { font-weight: 600; color: var(--text); margin-bottom: 4px; }
.spin { text-align: center; color: var(--faint); padding: 60px; }
.spin::after { content: ""; display: inline-block; width: 22px; height: 22px; border-radius: 50%;
  border: 2.5px solid var(--surface-3); border-top-color: var(--accent); animation: rot .7s linear infinite; vertical-align: middle; }
@keyframes rot { to { transform: rotate(360deg); } }

.toast { position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%); background: var(--surface-3);
  border: 1px solid var(--border-strong); color: var(--text); padding: 13px 20px; border-radius: 12px;
  box-shadow: var(--shadow-lg); z-index: 60; max-width: 90%; font-size: 13.5px; font-weight: 500;
  animation: toastin .3s cubic-bezier(.2,.9,.3,1.2); }
@keyframes toastin { from { opacity: 0; transform: translate(-50%, 14px); } to { opacity: 1; transform: translateX(-50%); } }
.toast.err { background: var(--red-soft); border-color: var(--red); color: #ffd9df; }
.toast.ok { border-color: rgba(52,211,153,.4); }

@media (max-width: 980px) {
  .auth-screen { grid-template-columns: 1fr; } .auth-aside { display: none; }
  .cols-3, .cols-4 { grid-template-columns: 1fr 1fr; }
  .editor-grid { grid-template-columns: 1fr; }
  .sidebar { width: 76px; } .nav-item span, .brand-text, .me .title, .me .sub { display: none; }
  .nav-item { justify-content: center; }
}

/* --------- Barre de chargement (import de fichiers) --------- */
.upload-progress { margin-top: 16px; }
.upbar {
  height: 10px; border-radius: 999px; overflow: hidden;
  background: var(--surface-3); border: 1px solid var(--border);
}
.upbar-fill {
  height: 100%; width: 0%; border-radius: 999px;
  background: var(--grad); transition: width .15s ease;
}
.upbar-label { margin-top: 7px; font-size: 12.5px; color: var(--muted); }
