/* ORYZE Sourcing — fond noir profond, violet électrique, verre translucide (Revolut / Liquid Glass) */
:root {
  --bg: #050507;
  --text: #F4F2FA;
  --muted: #9A95AD;
  --faint: #5E5972;
  --line: rgba(255, 255, 255, 0.08);
  --line-hi: rgba(255, 255, 255, 0.14);
  --glass: rgba(22, 19, 32, 0.55);
  --glass-hi: rgba(255, 255, 255, 0.06);
  --violet: #8B5CF6;
  --violet-hi: #B794FF;
  --violet-deep: #6D28D9;
  --violet-glow: rgba(139, 92, 246, 0.35);
  --green: #34D399;
  --amber: #FBBF24;
  --red: #F87171;
  --blue: #60A5FA;
  --radius: 22px;
  --sidebar: 248px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* Lueurs violettes de fond */
.glow { position: fixed; border-radius: 50%; filter: blur(90px); pointer-events: none; z-index: 0; }
.glow-a { width: 620px; height: 620px; top: -260px; right: -160px; background: rgba(124, 58, 237, 0.22); }
.glow-b { width: 520px; height: 520px; bottom: -280px; left: 120px; background: rgba(91, 33, 182, 0.16); }

.glass {
  background: var(--glass);
  border: 1px solid var(--line);
  backdrop-filter: blur(28px) saturate(160%);
  -webkit-backdrop-filter: blur(28px) saturate(160%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 10px 40px rgba(0, 0, 0, 0.35);
}

/* ---------- Barre latérale (Mac) ---------- */
.sidebar {
  position: fixed; inset: 14px auto 14px 14px; width: var(--sidebar);
  border-radius: 26px; padding: 22px 14px; display: flex; flex-direction: column; gap: 22px; z-index: 5;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; font-weight: 800;
  background: linear-gradient(140deg, var(--violet-hi), var(--violet-deep));
  box-shadow: 0 6px 22px var(--violet-glow);
}
.brand-name { font-weight: 750; letter-spacing: .18em; font-size: 15px; }
.brand-sub { color: var(--muted); font-size: 12px; letter-spacing: .04em; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 14px; border: 0;
  background: none; color: var(--muted); text-align: left; transition: background .2s var(--ease), color .2s;
}
.nav-item:hover { background: var(--glass-hi); color: var(--text); }
.nav-item.active { background: rgba(139, 92, 246, 0.16); color: var(--text); box-shadow: inset 0 0 0 1px rgba(139, 92, 246, 0.35); }
.nav-item.active svg { color: var(--violet-hi); }
.nav-item .soon { margin-left: auto; font-size: 10.5px; color: var(--faint); letter-spacing: .02em; }
.nav-item[disabled] { cursor: default; }
.nav-item[disabled]:hover { background: none; color: var(--muted); }

.side-card { margin-top: auto; border-radius: 18px; padding: 14px; background: rgba(255,255,255,0.03); border: 1px solid var(--line); }
.side-card .k { color: var(--muted); font-size: 12px; }
.side-card .v { font-weight: 650; font-size: 15px; margin-top: 2px; }
.side-card .row { display: flex; justify-content: space-between; margin-top: 10px; font-size: 13px; color: var(--muted); }
.side-card .row b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------- Contenu ---------- */
.main { position: relative; z-index: 1; margin-left: calc(var(--sidebar) + 28px); padding: 34px 36px 60px 18px; max-width: 1500px; }
.top { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
h1 { font-size: 32px; letter-spacing: -.02em; margin: 0; font-weight: 720; }
.sub { color: var(--muted); margin: 4px 0 0; }
.progress { border-radius: 18px; padding: 12px 16px; min-width: 230px; }
.progress .lbl { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); }
.progress .lbl b { color: var(--text); font-variant-numeric: tabular-nums; }
.bar { height: 6px; border-radius: 6px; background: rgba(255,255,255,0.07); margin-top: 8px; overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--violet-deep), var(--violet-hi)); transition: width .5s var(--ease); }

.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 22px; flex-wrap: wrap; }
.search { display: flex; align-items: center; gap: 8px; padding: 0 14px; border-radius: 14px; height: 42px; flex: 1 1 260px; max-width: 360px; color: var(--muted); }
.search input { border: 0; background: none; outline: none; width: 100%; color: var(--text); }
.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  height: 38px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line); background: rgba(255,255,255,0.03);
  color: var(--muted); white-space: nowrap; transition: all .2s var(--ease); font-size: 14px;
}
.chip:hover { color: var(--text); border-color: var(--line-hi); }
.chip.on { color: var(--text); background: rgba(139, 92, 246, 0.2); border-color: rgba(139, 92, 246, 0.5); }
.chip .n { color: var(--faint); margin-left: 6px; font-variant-numeric: tabular-nums; }
.chip.on .n { color: var(--violet-hi); }
.select { height: 42px; border-radius: 14px; padding: 0 14px; margin-left: auto; outline: none; }

/* ---------- Cartes prospects ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 16px; }
.card, .stat, .who, .crm, .status-btn { min-width: 0; }
body { overflow-x: hidden; }
.card {
  position: relative; border-radius: var(--radius); padding: 18px; display: flex; flex-direction: column; gap: 14px;
  transition: transform .25s var(--ease), border-color .25s; animation: rise .4s var(--ease) both;
}
.card:hover { border-color: var(--line-hi); transform: translateY(-2px); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.head { display: flex; align-items: center; gap: 13px; }
.avatar {
  width: 54px; height: 54px; border-radius: 50%; flex: none; object-fit: cover; background: #1a1625;
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 3.5px rgba(139, 92, 246, 0.55);
}
.avatar.ph { display: grid; place-items: center; font-weight: 700; font-size: 19px; color: var(--violet-hi);
  background: linear-gradient(140deg, rgba(139,92,246,.28), rgba(109,40,217,.12)); }
.who { min-width: 0; flex: 1; }
.handle { font-weight: 650; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.name { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.type {
  flex: none; display: flex; flex-direction: column; align-items: center; justify-content: center;
  width: 58px; height: 58px; border-radius: 17px; line-height: 1;
}
.type .t { font-size: 10px; letter-spacing: .12em; text-transform: uppercase; opacity: .8; }
.type .d { font-size: 24px; font-weight: 780; margin-top: 3px; }
.type-1 { background: rgba(139, 92, 246, 0.1); border: 1px solid rgba(139, 92, 246, 0.45); color: var(--violet-hi); }
.type-2 { background: linear-gradient(145deg, #A47BFF, #6D28D9); color: #fff; box-shadow: 0 8px 26px var(--violet-glow); }
.type-3 { background: linear-gradient(145deg, #F0ABFC, #A21CAF); color: #fff; box-shadow: 0 8px 26px rgba(192, 38, 211, .35); }
.type-x { background: rgba(255,255,255,0.05); border: 1px solid var(--line); color: var(--muted); }

.flag { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); font-size: 11px; letter-spacing: .06em;
  text-transform: uppercase; color: var(--amber); background: rgba(251, 191, 36, 0.1); border: 1px solid rgba(251,191,36,.3);
  padding: 3px 9px; border-radius: 99px; }
.card.revoir { padding-top: 38px; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat { background: rgba(255,255,255,0.03); border: 1px solid var(--line); border-radius: 14px; padding: 9px 11px; min-width: 0; }
.stat .k { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat .v { font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.stat .v small { color: var(--faint); font-weight: 500; font-size: 11.5px; }

.note { color: #D6D1E4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin: -2px 0 0; }
.signal { display: flex; gap: 8px; align-items: baseline; font-size: 13px; color: var(--muted); margin-top: -8px; }
.signal .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--violet-hi); flex: none; transform: translateY(-1px); }
.signal span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Statut commercial */
.crm { display: flex; gap: 8px; }
.status-btn {
  flex: 1; display: flex; align-items: center; gap: 9px; height: 40px; padding: 0 12px; border-radius: 13px;
  background: rgba(255,255,255,0.04); border: 1px solid var(--line); text-align: left; transition: border-color .2s;
}
.status-btn:hover { border-color: var(--line-hi); }
.status-btn .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.status-btn .lbl { flex: 1; font-weight: 550; font-size: 14px; }
.status-btn .k { color: var(--faint); font-size: 12px; }
.status-btn svg { width: 15px; height: 15px; color: var(--muted); }
.quick {
  height: 40px; padding: 0 14px; border-radius: 13px; border: 1px solid rgba(139, 92, 246, 0.45);
  background: rgba(139, 92, 246, 0.12); color: var(--violet-hi); font-weight: 600; font-size: 14px; white-space: nowrap;
  display: flex; align-items: center; gap: 6px; transition: background .2s;
}
.quick:hover { background: rgba(139, 92, 246, 0.22); }
.quick svg { width: 15px; height: 15px; }

/* Avis */
.avis-lbl { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-bottom: -6px; }
.avis-lbl b { color: var(--text); font-weight: 600; }
.avis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; padding: 4px; border-radius: 14px; background: rgba(0,0,0,0.25); border: 1px solid var(--line); }
.avis button {
  height: 34px; border-radius: 10px; border: 0; background: none; color: var(--muted); font-size: 13px; font-weight: 550;
  transition: background .2s var(--ease), color .2s;
}
.avis button:hover { color: var(--text); background: rgba(255,255,255,0.05); }
.avis button.on[data-v="excellent"] { background: rgba(139, 92, 246, 0.85); color: #fff; }
.avis button.on[data-v="bon"] { background: rgba(52, 211, 153, 0.2); color: var(--green); }
.avis button.on[data-v="moyen"] { background: rgba(251, 191, 36, 0.18); color: var(--amber); }
.avis button.on[data-v="mauvais"] { background: rgba(248, 113, 113, 0.2); color: var(--red); }
.motif { display: none; flex-direction: column; gap: 8px; }
.motif.open { display: flex; animation: rise .25s var(--ease) both; }
.motif .sugg { display: flex; flex-wrap: wrap; gap: 6px; }
.motif .sugg button { font-size: 12px; padding: 5px 10px; border-radius: 99px; border: 1px solid var(--line); background: rgba(255,255,255,.03); color: var(--muted); }
.motif .sugg button:hover { color: var(--text); border-color: var(--line-hi); }
.motif .row { display: flex; gap: 6px; }
.motif input { flex: 1; height: 38px; border-radius: 12px; border: 1px solid rgba(248,113,113,.35); background: rgba(0,0,0,.3); padding: 0 12px; outline: none; }
.motif input:focus { border-color: var(--red); }
.motif .ok { height: 38px; padding: 0 14px; border-radius: 12px; border: 0; background: var(--red); color: #1a0606; font-weight: 650; }
.saved-motif { font-size: 12.5px; color: var(--red); margin-top: -8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.open-ig {
  display: flex; align-items: center; justify-content: center; gap: 9px; height: 46px; border-radius: 15px;
  text-decoration: none; color: #fff; font-weight: 650;
  background: linear-gradient(135deg, #9B6BFF, #6D28D9); box-shadow: 0 8px 24px var(--violet-glow), inset 0 1px 0 rgba(255,255,255,.25);
  transition: transform .2s var(--ease), box-shadow .2s;
}
.open-ig:hover { transform: translateY(-1px); box-shadow: 0 12px 30px rgba(139, 92, 246, .5), inset 0 1px 0 rgba(255,255,255,.25); }
.open-ig:active { transform: scale(.98); }

.empty { color: var(--muted); text-align: center; padding: 60px 0; }

/* Menu des statuts */
.menu { position: fixed; z-index: 50; border-radius: 18px; padding: 6px; width: 230px; max-height: 70vh; overflow: auto;
  background: rgba(24, 20, 35, 0.92); animation: pop .18s var(--ease) both; }
@keyframes pop { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: none; } }
.menu button { width: 100%; display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 0; border-radius: 12px; background: none; text-align: left; font-size: 14px; }
.menu button:hover, .menu button.cur { background: rgba(255,255,255,0.06); }
.menu button .dot { width: 8px; height: 8px; border-radius: 50%; }
.menu button svg { margin-left: auto; width: 15px; height: 15px; color: var(--violet-hi); }

.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 60; padding: 11px 18px; border-radius: 14px;
  background: rgba(30, 25, 44, .95); border: 1px solid var(--line-hi); font-size: 14px; animation: pop .2s var(--ease) both; }
.toast.err { border-color: rgba(248,113,113,.5); color: var(--red); }

/* ---------- Connexion ---------- */
.login { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px;
  background: radial-gradient(circle at 70% 10%, rgba(124,58,237,.28), transparent 55%), var(--bg); }
.login-card { width: 100%; max-width: 360px; border-radius: 28px; padding: 30px 24px; display: flex; flex-direction: column; gap: 12px; text-align: center; }
.login-card h2 { margin: 8px 0 0; font-size: 22px; }
.login-card .sub { margin: -6px 0 10px; }
.brand-mark.big { width: 56px; height: 56px; border-radius: 18px; font-size: 22px; margin: 0 auto; }
.login-card input { height: 50px; border-radius: 15px; border: 1px solid var(--line); background: rgba(0,0,0,.35); padding: 0 16px; outline: none; font-size: 16px; }
.login-card input:focus { border-color: rgba(139, 92, 246, .7); }
.login-card .open-ig { border: 0; width: 100%; font-size: 16px; }
.login-card .open-ig:disabled { opacity: .6; }
.login-err { color: var(--red); font-size: 13.5px; min-height: 18px; margin: 0; }
.logout { margin-top: 12px; width: 100%; height: 34px; border-radius: 11px; border: 1px solid var(--line); background: none; color: var(--muted); font-size: 13px; }
.logout:hover { color: var(--text); border-color: var(--line-hi); }

/* ---------- Barre du bas (iPhone) ---------- */
.tabbar { display: none; }

@media (max-width: 900px) {
  .sidebar { display: none; }
  .main { margin: 0; padding: calc(18px + env(safe-area-inset-top)) 14px calc(110px + env(safe-area-inset-bottom)); }
  h1 { font-size: 28px; }
  .top { flex-direction: column; align-items: stretch; gap: 14px; margin-bottom: 16px; }
  .progress { min-width: 0; }
  .toolbar { gap: 8px; }
  .search { max-width: none; flex-basis: 100%; height: 46px; }
  .chips { flex: 1 1 100%; order: 2; }
  .select { margin-left: 0; flex: 1 1 100%; order: 1; height: 42px; }
  .grid { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .card:hover { transform: none; }
  .status-btn, .quick { height: 46px; }
  .avis button { height: 40px; font-size: 14px; }
  .open-ig { height: 52px; font-size: 16px; }
  .tabbar {
    display: flex; position: fixed; z-index: 20; left: 12px; right: 12px; bottom: calc(10px + env(safe-area-inset-bottom));
    border-radius: 26px; padding: 8px; justify-content: space-around; background: rgba(18, 15, 27, 0.72);
  }
  .tab { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 0; border: 0; background: none;
    color: var(--faint); font-size: 10.5px; border-radius: 18px; }
  .tab svg { width: 22px; height: 22px; }
  .tab.active { color: var(--text); background: rgba(139, 92, 246, 0.18); }
  .tab.active svg { color: var(--violet-hi); }
  .menu { left: 10px !important; right: 10px; bottom: calc(96px + env(safe-area-inset-bottom)); top: auto !important; width: auto; }
  .menu button { padding: 13px 14px; font-size: 15px; }
  .toast { bottom: calc(100px + env(safe-area-inset-bottom)); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
