/* ============================================================
   MONPASS — Style v3.0 (Support des organisations)
   Police : Geist + JetBrains Mono (via Google Fonts)
   Palette : dark navy / accent indigo / teal
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Geist:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;600&display=swap');

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  /* Surfaces */
  --bg:     #07090f;
  --bg2:    #0b0f1a;
  --surf:   #101520;
  --surf2:  #161d2e;
  --surf3:  #1c2538;
  --surf4:  #212c40;

  /* Borders */
  --bd:     rgba(255,255,255,0.055);
  --bdh:    rgba(255,255,255,0.10);
  --bd2:    rgba(255,255,255,0.15);

  /* Accent */
  --acc:    #5b8df6;
  --acc2:   #7c5cbf;
  --acc3:   #38d9a9;
  --acc-g:  rgba(91,141,246,0.14);

  /* Semantic */
  --ok:     #10b981;
  --warn:   #f59e0b;
  --dan:    #f05252;

  /* Text */
  --t1:     #eef2ff;
  --t2:     #8b9bbf;
  --t3:     #4d5d7a;

  /* Layout */
  --sw:     234px;
  --th:     60px;

  /* Radius */
  --r:      10px;
  --rl:     16px;
  --rx:     22px;

  /* Shadows */
  --sh-sm:  0 2px 8px rgba(0,0,0,0.45);
  --sh:     0 8px 32px rgba(0,0,0,0.55);
  --sh-lg:  0 20px 60px rgba(0,0,0,0.65);
  --sh-glow: 0 0 40px rgba(91,141,246,0.12);

  /* Fonts */
  --font:   'Geist', -apple-system, BlinkMacSystemFont, sans-serif;
  --mono:   'JetBrains Mono', 'Fira Code', monospace;
}

html { font-size: 15px; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--t1);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.hidden { display: none !important; }
.mt-sm  { margin-top: 0.5rem; }

/* ============================================================
   ANIMATED BACKGROUND
   ============================================================ */
.animated-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}
#bg-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.noise-overlay {
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
  opacity: 0.5;
}

/* ============================================================
   APP SHELL
   ============================================================ */
#app { position: relative; z-index: 1; }

.screen { min-height: 100vh; }

/* ============================================================
   AUTH SCREEN
   ============================================================ */
#login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 2rem;
}

.auth-wrapper {
  display: grid;
  grid-template-columns: 1fr 1fr;
  max-width: 960px;
  width: 100%;
  background: var(--surf);
  border: 1px solid var(--bd);
  border-radius: var(--rx);
  overflow: hidden;
  box-shadow: var(--sh-lg), var(--sh-glow);
  animation: slideUp .5s cubic-bezier(.16,1,.3,1) both;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(28px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Art panel */
.auth-side-art {
  background: linear-gradient(155deg,
    rgba(91,141,246,.10) 0%,
    rgba(124,92,191,.13) 50%,
    rgba(56,217,169,.07) 100%);
  border-right: 1px solid var(--bd);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem 2.5rem;
  position: relative;
  overflow: hidden;
}
.auth-side-art::before {
  content: '';
  position: absolute;
  width: 320px; height: 320px;
  background: radial-gradient(circle, rgba(91,141,246,.08), transparent 70%);
  top: 50%; left: 50%;
  transform: translate(-50%,-50%);
}
.art-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2.5rem;
  position: relative;
  z-index: 1;
}

/* Vault animation */
.vault-visual {
  position: relative;
  width: 180px; height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.vault-ring {
  position: absolute;
  border-radius: 50%;
  border: 1px solid;
  animation: spin linear infinite;
}
.vault-ring.outer  { width:180px;height:180px;border-color:rgba(91,141,246,.18);animation-duration:22s; }
.vault-ring.middle { width:130px;height:130px;border-color:rgba(124,92,191,.25);border-style:dashed;animation-duration:15s;animation-direction:reverse; }
.vault-ring.inner  { width:88px;height:88px;border-color:rgba(56,217,169,.2);animation-duration:9s; }
@keyframes spin { to { transform: rotate(360deg); } }

.vault-core {
  width: 60px; height: 60px;
  background: linear-gradient(135deg, var(--acc), var(--acc2));
  border-radius: 18px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem; color: #fff;
  box-shadow: 0 0 32px rgba(91,141,246,.4);
  z-index: 1;
}

.orbit-dot {
  position: absolute;
  border-radius: 50%;
  animation: orbit linear infinite;
}
.dot-1 { width:8px;height:8px;background:var(--acc);animation-duration:6s;top:0;left:50%;margin-left:-4px;transform-origin:4px 90px; }
.dot-2 { width:7px;height:7px;background:var(--acc2);animation-duration:10s;animation-direction:reverse;top:50%;right:0;transform-origin:-65px 3.5px; }
.dot-3 { width:6px;height:6px;background:var(--acc3);animation-duration:8s;bottom:0;left:50%;transform-origin:3px -90px; }
@keyframes orbit { to { transform: rotate(360deg); } }

.art-text { text-align: center; }
.art-text h2 {
  font-size: 1.55rem;
  font-weight: 800;
  line-height: 1.25;
  margin-bottom: .65rem;
  letter-spacing: -.3px;
}
.art-text h2 em {
  font-style: normal;
  background: linear-gradient(135deg, var(--acc), var(--acc3));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.art-text p { color: var(--t2); font-size: .88rem; line-height: 1.7; }

.security-badges { display: flex; gap: .45rem; flex-wrap: wrap; justify-content: center; }
.badge {
  padding: .3rem .8rem;
  border: 1px solid var(--bdh);
  border-radius: 100px;
  font-size: .72rem;
  color: var(--t2);
  display: flex;
  align-items: center;
  gap: .4rem;
  background: rgba(255,255,255,.03);
  backdrop-filter: blur(4px);
}
.badge i { color: var(--acc3); }

/* Form panel */
.auth-container {
  padding: 3rem 2.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

.logo { display: flex; align-items: center; gap: 1rem; }
.logo-mark {
  width: 50px; height: 50px;
  background: linear-gradient(135deg, var(--acc), var(--acc2));
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem; font-weight: 800; color: #fff;
  box-shadow: 0 8px 24px rgba(91,141,246,.35);
  letter-spacing: 0;
}
.logo-mark.sm { width:34px;height:34px;font-size:1rem;border-radius:10px; }
.logo h1 { font-size: 1.6rem; font-weight: 800; letter-spacing: -.4px; line-height: 1; margin-bottom: .2rem; }
.tagline { color: var(--t3); font-size: .82rem; }

/* Tabs */
.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  background: var(--bg2);
  padding: 4px;
  border-radius: var(--r);
  border: 1px solid var(--bd);
}
.tab {
  padding: .7rem;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: calc(var(--r) - 3px);
  font-family: var(--font);
  font-weight: 600;
  font-size: .875rem;
  color: var(--t3);
  display: flex; align-items: center; justify-content: center; gap: .5rem;
  transition: all .2s;
}
.tab.active { background: var(--surf2); color: var(--t1); box-shadow: var(--sh-sm); }
.tab:hover:not(.active) { color: var(--t2); }

/* Auth form inputs */
.auth-form { display: flex; flex-direction: column; gap: .7rem; }

.input-group {
  position: relative;
  display: flex;
  align-items: center;
}
.input-icon {
  position: absolute;
  left: .9rem;
  color: var(--t3);
  font-size: .875rem;
  z-index: 1;
  pointer-events: none;
}
.auth-form input {
  width: 100%;
  padding: .825rem 2.6rem;
  background: var(--bg2);
  border: 1px solid var(--bd);
  border-radius: var(--r);
  font-family: var(--font);
  font-size: .9rem;
  color: var(--t1);
  transition: border-color .2s, box-shadow .2s;
}
.auth-form input::placeholder { color: var(--t3); }
.auth-form input:focus {
  outline: none;
  border-color: var(--acc);
  box-shadow: 0 0 0 3px rgba(91,141,246,.12);
}
.input-action {
  position: absolute;
  right: .7rem;
  background: none; border: none;
  color: var(--t3); cursor: pointer;
  padding: .35rem; border-radius: 6px;
  transition: color .2s;
  z-index: 1;
}
.input-action:hover { color: var(--acc); }

.btn-auth {
  width: 100%;
  padding: .875rem;
  background: linear-gradient(135deg, var(--acc), var(--acc2));
  border: none;
  border-radius: var(--r);
  font-family: var(--font);
  font-size: .9rem; font-weight: 700;
  color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: .7rem;
  transition: all .2s;
  box-shadow: 0 6px 20px rgba(91,141,246,.3);
  margin-top: .25rem;
  letter-spacing: -.1px;
}
.btn-auth:hover { transform: translateY(-2px); box-shadow: 0 10px 30px rgba(91,141,246,.4); }
.btn-auth:active { transform: translateY(0); }
.btn-auth:disabled { opacity: .55; cursor: not-allowed; transform: none; }

/* Strength meter */
.strength-meter { display: flex; flex-direction: column; gap: .3rem; }
.strength-bar { height: 4px; background: var(--surf3); border-radius: 2px; overflow: hidden; }
.strength-bar.lg { height: 6px; }
.strength-fill {
  height: 100%; width: 0%;
  border-radius: 2px;
  transition: width .4s cubic-bezier(.4,0,.2,1), background .4s;
}
.strength-label { font-size: .72rem; color: var(--t3); }

/* ============================================================
   MAIN LAYOUT
   ============================================================ */
#main-screen { display: flex; min-height: 100vh; }

/* ---- Sidebar ---- */
.sidebar {
  width: var(--sw);
  background: var(--bg2);
  border-right: 1px solid var(--bd);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 200;
  transition: transform .3s cubic-bezier(.4,0,.2,1);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: 0 1.1rem;
  height: var(--th);
  border-bottom: 1px solid var(--bd);
  flex-shrink: 0;
}
.sidebar-app-name {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -.3px;
}

.sidebar-nav {
  flex: 1;
  padding: .75rem .6rem;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .65rem .85rem;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: var(--r);
  color: var(--t3);
  font-family: var(--font);
  font-size: .875rem;
  font-weight: 500;
  width: 100%;
  text-align: left;
  transition: all .15s;
}
.nav-item i { width: 17px; text-align: center; font-size: .9rem; }
.nav-item span:last-of-type { flex: 1; }
.nav-item:hover { background: var(--surf2); color: var(--t2); }
.nav-item.active { background: rgba(91,141,246,.12); color: var(--acc); font-weight: 600; }

.nav-count {
  background: var(--surf3);
  color: var(--t3);
  border-radius: 100px;
  padding: .1rem .5rem;
  font-size: .72rem;
  font-weight: 700;
  min-width: 22px;
  text-align: center;
}
.nav-item.active .nav-count { background: rgba(91,141,246,.2); color: var(--acc); }

.nav-divider {
  height: 1px;
  background: var(--bd);
  margin: 8px 12px;
}

.nav-section-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  font-size: 11px;
  font-weight: 600;
  color: var(--t3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.nav-section-action {
  background: none;
  border: none;
  color: var(--t3);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  transition: all 0.2s;
}
.nav-section-action:hover {
  background: var(--surf2);
  color: var(--acc);
}

.nav-empty {
  padding: 8px 16px;
  font-size: 12px;
  color: var(--t3);
  text-align: center;
  cursor: default;
}

.nav-badge {
  font-size: 10px;
  background: var(--acc);
  color: white;
  padding: 0 8px;
  border-radius: 10px;
  margin-left: auto;
  opacity: 0.7;
}

.sidebar-footer {
  padding: .75rem .6rem;
  border-top: 1px solid var(--bd);
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-shrink: 0;
}
.user-pill {
  flex: 1;
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .45rem .75rem;
  background: var(--surf2);
  border-radius: var(--r);
  border: 1px solid var(--bd);
  min-width: 0;
}
.user-avatar-sm {
  width: 26px; height: 26px;
  background: linear-gradient(135deg, var(--acc), var(--acc2));
  border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  font-size: .75rem; font-weight: 700; color: #fff;
  flex-shrink: 0;
}
.user-pill span { font-size: .82rem; font-weight: 500; color: var(--t2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.logout-btn {
  background: rgba(240,82,82,.08);
  border: 1px solid rgba(240,82,82,.18);
  color: var(--dan);
  padding: .5rem;
  border-radius: var(--r);
  cursor: pointer;
  display: flex; align-items: center;
  transition: all .2s;
  font-size: .9rem;
}
.logout-btn:hover { background: rgba(240,82,82,.16); transform: translateY(-1px); }

/* ---- Main area ---- */
.main-area {
  margin-left: var(--sw);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* ---- Topbar ---- */
.topbar {
  height: var(--th);
  background: rgba(11,15,26,.85);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--bd);
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 0 1.5rem;
  position: sticky; top: 0; z-index: 100;
}
.topbar-left  { display: flex; align-items: center; gap: 1rem; flex: 0 0 auto; }
.topbar-center{ flex: 1; display: flex; justify-content: center; }
.topbar-right { display: flex; align-items: center; gap: .75rem; flex: 0 0 auto; }

.sidebar-toggle {
  background: none; border: none;
  color: var(--t3); cursor: pointer;
  padding: .45rem; border-radius: var(--r);
  font-size: .95rem;
  display: none;
  transition: color .2s;
}
.sidebar-toggle:hover { color: var(--t1); }

.breadcrumb {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -.25px;
  color: var(--t1);
  display: flex;
  align-items: center;
  gap: 6px;
}

.breadcrumb-vault {
  color: var(--acc);
}

.breadcrumb-separator {
  color: var(--t3);
  opacity: 0.5;
}

.breadcrumb-section {
  color: var(--t2);
}

.search-container {
  position: relative;
  width: 100%;
  max-width: 420px;
  display: flex;
  align-items: center;
}
.search-icon { position: absolute; left: .85rem; color: var(--t3); font-size: .8rem; pointer-events: none; }
#search {
  width: 100%;
  padding: .6rem 3rem .6rem 2.4rem;
  background: var(--surf2);
  border: 1px solid var(--bd);
  border-radius: var(--r);
  font-family: var(--font);
  font-size: .875rem;
  color: var(--t1);
  transition: all .2s;
}
#search::placeholder { color: var(--t3); }
#search:focus { outline: none; border-color: var(--acc); box-shadow: 0 0 0 3px rgba(91,141,246,.1); }
.search-kbd {
  position: absolute; right: .7rem;
  background: var(--surf3);
  border: 1px solid var(--bdh);
  border-radius: 5px;
  padding: .12rem .45rem;
  font-size: .68rem;
  color: var(--t3);
  pointer-events: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--acc), var(--acc2));
  border: none;
  border-radius: var(--r);
  padding: .6rem 1.15rem;
  color: #fff;
  font-family: var(--font);
  font-size: .85rem; font-weight: 700;
  cursor: pointer;
  display: flex; align-items: center; gap: .5rem;
  transition: all .2s;
  box-shadow: 0 4px 14px rgba(91,141,246,.28);
  white-space: nowrap;
  letter-spacing: -.1px;
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(91,141,246,.4); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn-primary.full { width: 100%; justify-content: center; padding: .875rem; }

.btn-secondary {
  background: var(--surf3);
  border: 1px solid var(--bd);
  border-radius: var(--r);
  padding: .6rem 1.15rem;
  color: var(--t2);
  font-family: var(--font);
  font-size: .85rem; font-weight: 500;
  cursor: pointer;
  transition: all .2s;
}
.btn-secondary:hover { background: var(--surf2); color: var(--t1); }

/* ============================================================
   CONTENT
   ============================================================ */
.main-content { padding: 1.75rem 2rem; }

.content-section { display: none; animation: fadeIn .3s ease; }
.content-section.active { display: block; }
@keyframes fadeIn { from { opacity:0; transform:translateY(6px); } to { opacity:1; transform:translateY(0); } }

.section-intro { margin-bottom: 1.5rem; display: flex; flex-direction: column; gap: .9rem; }

.section-title h2 {
  font-size: 1.65rem;
  font-weight: 800;
  letter-spacing: -.45px;
  margin-bottom: .2rem;
}
.section-subtitle { color: var(--t3); font-size: .875rem; }

.stats-row { display: flex; gap: .6rem; align-items: center; margin-top: .4rem; flex-wrap: wrap; }
.stat-chip {
  display: flex; align-items: center; gap: .4rem;
  background: var(--surf2);
  border: 1px solid var(--bd);
  border-radius: 100px;
  padding: .25rem .8rem;
  font-size: .78rem; color: var(--t2);
}
.stat-chip i { color: var(--acc); font-size: .72rem; }

.filter-bar { display: flex; gap: .5rem; flex-wrap: wrap; }
.filter-btn {
  padding: .35rem 1rem;
  border: 1px solid var(--bd);
  background: var(--surf2);
  border-radius: 100px;
  color: var(--t3);
  font-family: var(--font);
  font-size: .78rem; font-weight: 500;
  cursor: pointer;
  transition: all .2s;
}
.filter-btn:hover { border-color: rgba(91,141,246,.4); color: var(--acc); }
.filter-btn.active {
  background: rgba(91,141,246,.12);
  border-color: rgba(91,141,246,.35);
  color: var(--acc);
  font-weight: 600;
}

/* ============================================================
   PASSWORD CARDS
   ============================================================ */
.password-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
  gap: 1.1rem;
}

.password-card {
  background: var(--surf);
  border: 1px solid var(--bd);
  border-radius: var(--rl);
  padding: 1.35rem;
  transition: all .25s cubic-bezier(.4,0,.2,1);
  position: relative;
  overflow: hidden;
  cursor: default;
  animation: fadeIn .3s ease;
}
.password-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--acc), var(--acc2));
  opacity: 0;
  transition: opacity .25s;
}
.password-card:hover {
  border-color: var(--bdh);
  background: var(--surf2);
  transform: translateY(-3px);
  box-shadow: 0 12px 38px rgba(0,0,0,.35), var(--sh-glow);
}
.password-card:hover::before { opacity: 1; }

.password-card-header {
  display: flex; align-items: flex-start; gap: .9rem;
  margin-bottom: 1.1rem;
}
.site-icon {
  width: 44px; height: 44px; min-width: 44px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.25rem; font-weight: 800; color: #fff;
  flex-shrink: 0;
}
.card-info { flex: 1; min-width: 0; }
.password-card h3 {
  font-size: .975rem; font-weight: 700; letter-spacing: -.15px;
  margin-bottom: .18rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.password-card .username { color: var(--t3); font-size: .8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.password-card .url a {
  color: var(--acc); text-decoration: none; font-size: .75rem;
  display: inline-flex; align-items: center; gap: .25rem; opacity: .65;
  transition: opacity .2s;
}
.password-card .url a:hover { opacity: 1; }

.category-tag {
  display: inline-flex; align-items: center; gap: .3rem;
  background: rgba(91,141,246,.09);
  border: 1px solid rgba(91,141,246,.18);
  color: var(--acc);
  padding: .2rem .65rem;
  border-radius: 100px;
  font-size: .7rem; font-weight: 600;
  margin-bottom: .7rem;
}

.card-meta {
  display: flex; align-items: center; gap: 1rem;
  padding-top: .7rem;
  border-top: 1px solid var(--bd);
  flex-wrap: wrap;
}
.card-date { font-size: .72rem; color: var(--t3); display: flex; align-items: center; gap: .3rem; }
.card-org { font-size: .72rem; color: var(--acc); display: flex; align-items: center; gap: .3rem; }

.password-actions { display: flex; gap: .45rem; margin-top: 1.1rem; flex-wrap: wrap; }
.password-actions button {
  flex: 1;
  padding: .5rem;
  border: 1px solid var(--bd);
  background: var(--surf3);
  border-radius: var(--r);
  color: var(--t3);
  cursor: pointer;
  font-size: .75rem; font-weight: 500; font-family: var(--font);
  display: flex; align-items: center; justify-content: center; gap: .35rem;
  transition: all .15s;
  min-width: 60px;
}
.password-actions .btn-copy:hover { background: rgba(16,185,129,.12); border-color: rgba(16,185,129,.25); color: var(--ok); }
.password-actions .btn-view:hover { background: rgba(245,158,11,.12); border-color: rgba(245,158,11,.25); color: var(--warn); }
.password-actions .btn-edit:hover { background: rgba(91,141,246,.12); border-color: rgba(91,141,246,.25); color: var(--acc); }
.password-actions .btn-share:hover { background: rgba(99,102,241,.12); border-color: rgba(99,102,241,.25); color: #818cf8; }
.password-actions .btn-history:hover { background: rgba(245,158,11,.12); border-color: rgba(245,158,11,.25); color: var(--warn); }
.password-actions .btn-delete:hover { background: rgba(240,82,82,.12); border-color: rgba(240,82,82,.25); color: var(--dan); }

/* Empty / loading */
.loading-state, .no-passwords, .no-totp-accounts {
  grid-column: 1 / -1;
  text-align: center;
  padding: 4rem 2rem;
  color: var(--t3);
}
.spinner {
  width: 38px; height: 38px;
  border: 2.5px solid var(--bd);
  border-top-color: var(--acc);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  margin: 0 auto 1rem;
}
.no-passwords i, .no-totp-accounts i { font-size: 2.75rem; margin-bottom: 1rem; opacity: .25; }
.no-passwords h3, .no-totp-accounts h3 { font-size: 1.15rem; color: var(--t2); margin-bottom: .4rem; }

/* ============================================================
   2FA / TOTP
   ============================================================ */
.totp-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.1rem;
}

.totp-card {
  background: var(--surf);
  border: 1px solid var(--bd);
  border-radius: var(--rl);
  padding: 1.35rem;
  transition: all .25s;
  animation: fadeIn .3s ease;
}
.totp-card:hover { border-color: var(--bdh); background: var(--surf2); transform: translateY(-2px); box-shadow: var(--sh); }

.totp-card-header { display: flex; align-items: center; gap: .85rem; margin-bottom: 1.1rem; }
.totp-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem; font-weight: 800; color: #fff;
  font-family: var(--font);
  flex-shrink: 0;
}
.totp-info h3 { font-size: .95rem; font-weight: 600; }
.totp-info .account-name { font-size: .78rem; color: var(--t3); }

.totp-code-wrap { margin: .9rem 0; }
.totp-code-display {
  font-family: var(--mono);
  font-size: 1.95rem; font-weight: 600;
  letter-spacing: .22em;
  text-align: center;
  color: var(--acc);
  padding: .7rem;
  background: rgba(91,141,246,.06);
  border: 1px solid rgba(91,141,246,.14);
  border-radius: var(--r);
  cursor: pointer;
  transition: all .2s;
  user-select: all;
}
.totp-code-display:hover { background: rgba(91,141,246,.11); }

.totp-timer {
  display: flex; align-items: center; gap: .55rem;
  margin-top: .65rem;
  font-size: .75rem; color: var(--t3);
}
.timer-bar { flex: 1; height: 3px; background: var(--surf3); border-radius: 2px; overflow: hidden; }
.timer-progress { height: 100%; background: var(--ok); transition: width 1s linear, background .5s; }

.totp-actions { display: flex; gap: .45rem; margin-top: .9rem; }
.totp-actions button {
  flex: 1;
  padding: .5rem;
  border: 1px solid var(--bd);
  background: var(--surf3);
  border-radius: var(--r);
  color: var(--t3);
  font-family: var(--font);
  font-size: .75rem; font-weight: 500;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: .35rem;
  transition: all .15s;
}
.copy-totp-btn:hover { background: rgba(16,185,129,.12); border-color: rgba(16,185,129,.25); color: var(--ok); }
.delete-totp-btn:hover { background: rgba(240,82,82,.12); border-color: rgba(240,82,82,.25); color: var(--dan); }

/* ============================================================
   GENERATOR
   ============================================================ */
.generator-panel {
  background: var(--surf);
  border: 1px solid var(--bd);
  border-radius: var(--rl);
  padding: 2rem;
  max-width: 660px;
  display: flex; flex-direction: column; gap: 1.65rem;
}

.generated-display {
  background: var(--bg2);
  border: 1px solid var(--bd);
  border-radius: var(--r);
  padding: 1.1rem 1.25rem;
  display: flex; align-items: center; gap: 1rem;
  min-height: 68px;
}
.generated-display code {
  font-family: var(--mono);
  font-size: 1.05rem; color: var(--t1);
  flex: 1; word-break: break-all; line-height: 1.5;
}
.gen-actions { display: flex; gap: .45rem; flex-shrink: 0; }
.gen-btn {
  background: var(--surf2); border: 1px solid var(--bd);
  border-radius: var(--r);
  color: var(--t2); padding: .55rem;
  cursor: pointer; font-size: .875rem;
  display: flex; align-items: center;
  transition: all .2s;
}
.gen-btn:hover { background: var(--surf3); color: var(--t1); }

.strength-display { display: flex; flex-direction: column; gap: .4rem; }

.generator-controls { display: flex; flex-direction: column; gap: 1.15rem; }
.control-row { display: flex; flex-direction: column; gap: .5rem; }
.control-row label {
  font-size: .875rem; color: var(--t2);
  display: flex; justify-content: space-between; align-items: center;
}
.control-row label strong { color: var(--acc); font-size: .95rem; }
.control-row input[type="range"] {
  width: 100%;
  -webkit-appearance: none;
  height: 4px; border-radius: 2px;
  background: var(--surf3);
  outline: none; cursor: pointer;
}
.control-row input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 17px; height: 17px;
  border-radius: 50%;
  background: var(--acc); cursor: pointer;
  box-shadow: 0 0 8px rgba(91,141,246,.4);
}

.options-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; }
.option-toggle {
  display: flex; align-items: center; gap: .65rem;
  font-size: .82rem; color: var(--t2); cursor: pointer;
}
.option-toggle input[type="checkbox"] { display: none; }
.toggle-track {
  width: 34px; height: 19px;
  background: var(--surf3); border-radius: 100px;
  position: relative; transition: background .2s; flex-shrink: 0;
}
.toggle-track::after {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 13px; height: 13px;
  background: var(--t3); border-radius: 50%;
  transition: all .2s;
}
.option-toggle input:checked + .toggle-track { background: var(--acc); }
.option-toggle input:checked + .toggle-track::after { left: 18px; background: #fff; }

.presets { }
.presets-label { font-size: .78rem; color: var(--t3); margin-bottom: .7rem; }
.presets-row { display: flex; gap: .45rem; flex-wrap: wrap; }
.preset-chip {
  padding: .35rem 1rem;
  background: var(--surf2); border: 1px solid var(--bd);
  border-radius: 100px; color: var(--t2);
  font-size: .78rem; font-weight: 500;
  cursor: pointer; font-family: var(--font);
  transition: all .2s;
}
.preset-chip:hover { border-color: rgba(91,141,246,.4); color: var(--acc); background: rgba(91,141,246,.08); }

/* ============================================================
   AUDIT
   ============================================================ */
.audit-panel { display: flex; flex-direction: column; gap: 1.1rem; }

.audit-score-card {
  background: var(--surf);
  border: 1px solid var(--bd);
  border-radius: var(--rl);
  padding: 2rem;
  display: flex; align-items: center; gap: 2.25rem;
}
.score-ring { position: relative; width: 115px; height: 115px; flex-shrink: 0; }
.score-svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.score-track { fill: none; stroke: var(--surf3); stroke-width: 8; }
.score-progress {
  fill: none; stroke: var(--acc); stroke-width: 8; stroke-linecap: round;
  transition: stroke-dashoffset 1s cubic-bezier(.4,0,.2,1), stroke .5s;
}
.score-value {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.65rem; font-weight: 800; letter-spacing: -.5px;
}
.score-details h3 { font-size: 1.15rem; font-weight: 700; margin-bottom: .4rem; }
.score-details p { color: var(--t3); font-size: .875rem; margin-bottom: .9rem; }

.audit-results { display: flex; flex-direction: column; gap: .9rem; }
.audit-category {
  background: var(--surf);
  border: 1px solid var(--bd);
  border-radius: var(--rl);
  overflow: hidden;
}
.audit-category-header {
  display: flex; align-items: center; gap: .65rem;
  padding: .9rem 1.15rem;
  border-bottom: 1px solid var(--bd);
}
.audit-category-header i { color: var(--warn); width: 17px; font-size: .875rem; }
.audit-category-header h4 { flex: 1; font-size: .875rem; font-weight: 600; }
.audit-count {
  background: var(--surf3); color: var(--t2);
  border-radius: 100px; padding: .1rem .6rem;
  font-size: .7rem; font-weight: 700;
}
.audit-items { padding: .35rem; }
.audit-item {
  padding: .55rem .75rem;
  border-radius: var(--r);
  font-size: .82rem; color: var(--t2);
  display: flex; align-items: center; gap: .45rem;
}
.audit-item:hover { background: var(--surf2); }
.audit-item i { color: var(--t3); width: 15px; font-size: .72rem; }

/* ============================================================
   MODALS
   ============================================================ */
.modal {
  position: fixed; inset: 0; z-index: 500;
  display: flex; align-items: center; justify-content: center;
  padding: 1.5rem;
  opacity: 0; visibility: hidden;
  transition: all .25s;
}
.modal.active { opacity: 1; visibility: visible; }
.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,.72);
  backdrop-filter: blur(8px);
  cursor: pointer;
}
.modal-content {
  background: var(--surf);
  border: 1px solid var(--bdh);
  border-radius: var(--rx);
  padding: 2rem;
  width: 100%; max-width: 540px;
  max-height: 90vh; overflow-y: auto;
  position: relative; z-index: 1;
  box-shadow: var(--sh-lg);
  transform: scale(.94);
  transition: transform .25s cubic-bezier(.16,1,.3,1);
}
.modal.active .modal-content { transform: scale(1); }

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.65rem;
  padding-bottom: 1.15rem;
  border-bottom: 1px solid var(--bd);
}
.modal-header h2 {
  font-size: 1.1rem; font-weight: 700; letter-spacing: -.2px;
  display: flex; align-items: center; gap: .55rem;
}
.modal-header h2 i { color: var(--acc); }
.modal-close {
  background: none; border: none; color: var(--t3);
  cursor: pointer; padding: .35rem; border-radius: 7px;
  font-size: .875rem; transition: all .2s;
}
.modal-close:hover { background: rgba(240,82,82,.1); color: var(--dan); }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-group { display: flex; flex-direction: column; gap: .35rem; margin-bottom: .9rem; }
.form-group label { font-size: .8rem; font-weight: 600; color: var(--t2); }
.form-group input,
.form-group select,
.form-group textarea {
  padding: .7rem .95rem;
  background: var(--bg2);
  border: 1px solid var(--bd);
  border-radius: var(--r);
  font-family: var(--font);
  font-size: .875rem; color: var(--t1);
  transition: all .2s;
}
.form-group input::placeholder,
.form-group textarea::placeholder { color: var(--t3); }
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--acc);
  box-shadow: 0 0 0 3px rgba(91,141,246,.1);
}
.form-group select option { background: var(--surf); }
.form-group textarea { resize: vertical; min-height: 78px; }

.password-input-wrap { position: relative; }
.password-input-wrap input { padding-right: 8rem; }
.password-input-btns {
  position: absolute; right: .5rem; top: 50%; transform: translateY(-50%);
  display: flex; gap: .25rem;
}
.password-input-btns button {
  background: none; border: none; color: var(--t3);
  cursor: pointer; padding: .35rem; border-radius: 6px;
  font-size: .825rem; transition: all .2s;
}
.password-input-btns button:hover { background: var(--surf3); color: var(--t1); }

.form-actions {
  display: flex; gap: .65rem; justify-content: flex-end;
  padding-top: 1.15rem;
  border-top: 1px solid var(--bd);
  margin-top: .35rem;
}

.totp-add-info {
  background: rgba(91,141,246,.07);
  border: 1px solid rgba(91,141,246,.18);
  border-radius: var(--r);
  padding: .7rem 1rem;
  font-size: .82rem; color: var(--t2);
  margin-bottom: 1.4rem;
  display: flex; align-items: flex-start; gap: .55rem; line-height: 1.5;
}
.totp-add-info i { color: var(--acc); margin-top: .1rem; flex-shrink: 0; }

/* Detail modal */
.detail-body { display: flex; flex-direction: column; gap: .85rem; }
.detail-field {
  display: flex; flex-direction: column; gap: .25rem;
  padding: .8rem .95rem;
  background: var(--bg2);
  border-radius: var(--r);
  border: 1px solid var(--bd);
}
.detail-field label {
  font-size: .68rem; font-weight: 700; color: var(--t3);
  text-transform: uppercase; letter-spacing: .06em;
}
.detail-field .field-value {
  font-size: .9rem; color: var(--t1);
  display: flex; align-items: center; justify-content: space-between; gap: .5rem;
}
.detail-field .field-value code { font-family: var(--mono); }
.copy-field-btn {
  background: none; border: none; color: var(--t3);
  cursor: pointer; padding: .25rem; border-radius: 4px;
  font-size: .78rem; transition: all .2s; flex-shrink: 0;
}
.copy-field-btn:hover { color: var(--acc); }

/* ============================================================
   TOAST
   ============================================================ */
#toast-container {
  position: fixed; top: 1.25rem; right: 1.25rem;
  z-index: 9999;
  display: flex; flex-direction: column; gap: .45rem;
  pointer-events: none;
}
.toast {
  background: var(--surf2);
  border: 1px solid var(--bd);
  border-radius: var(--rl);
  padding: .8rem 1.15rem;
  display: flex; align-items: center; gap: .65rem;
  font-size: .875rem;
  box-shadow: var(--sh);
  animation: toastIn .3s cubic-bezier(.16,1,.3,1);
  min-width: 260px; max-width: 360px;
  pointer-events: all;
}
.toast.success { border-left: 3px solid var(--ok); }
.toast.error   { border-left: 3px solid var(--dan); }
.toast.info    { border-left: 3px solid var(--acc); }
.toast.warning { border-left: 3px solid var(--warn); }
.toast i { font-size: .95rem; flex-shrink: 0; }
.toast.success i { color: var(--ok); }
.toast.error   i { color: var(--dan); }
.toast.info    i { color: var(--acc); }
.toast.warning i { color: var(--warn); }
.toast span { flex: 1; color: var(--t1); line-height: 1.4; }
.toast.out { animation: toastOut .3s ease forwards; }

@keyframes toastIn  { from { opacity:0; transform:translateX(16px); } to { opacity:1; transform:translateX(0); } }
@keyframes toastOut { to { opacity:0; transform:translateX(16px); } }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1120px) {
  :root { --sw: 58px; }
  .sidebar-logo span:not(.logo-mark),
  .sidebar-app-name,
  .nav-item > span,
  .nav-count,
  .user-pill span,
  .nav-section-label span,
  .nav-empty { display: none; }
  .sidebar-logo { justify-content: center; padding: 0; }
  .nav-item { justify-content: center; padding: .8rem; }
  .nav-item i { width: auto; }
  .user-pill { justify-content: center; padding: .45rem; }
  .sidebar-footer { flex-direction: column; align-items: center; }
  .nav-section-label { justify-content: center; padding: 8px 0; }
  .nav-section-action { padding: 4px; }
}

@media (max-width: 768px) {
  .auth-wrapper { grid-template-columns: 1fr; }
  .auth-side-art { display: none; }
  .sidebar { transform: translateX(-100%); width: var(--sw); }
  .sidebar.open { transform: translateX(0); --sw: 234px; }
  .sidebar.open .sidebar-logo span:not(.logo-mark),
  .sidebar.open .sidebar-app-name,
  .sidebar.open .nav-item > span,
  .sidebar.open .nav-count,
  .sidebar.open .user-pill span,
  .sidebar.open .nav-section-label span,
  .sidebar.open .nav-empty { display: initial; }
  .sidebar.open .nav-item { justify-content: flex-start; }
  .sidebar.open .sidebar-footer { flex-direction: row; align-items: center; }
  .sidebar.open .nav-section-label { justify-content: space-between; padding: 8px 16px; }
  .main-area { margin-left: 0; }
  .sidebar-toggle { display: flex; }
  .form-row { grid-template-columns: 1fr; }
  .password-grid, .totp-grid { grid-template-columns: 1fr; }
  .options-grid { grid-template-columns: 1fr; }
  .topbar { padding: 0 1rem; gap: .75rem; }
  .search-kbd { display: none; }
  .audit-score-card { flex-direction: column; align-items: flex-start; }
  .main-content { padding: 1.25rem; }
}

@media (max-width: 480px) {
  .btn-primary span { display: none; }
  .auth-container { padding: 1.75rem 1.25rem; }
  .modal-content { padding: 1.4rem; }
  .generator-panel { padding: 1.4rem; }
  .password-actions button { font-size: .7rem; padding: .4rem; }
}

/* ============================================================
   ORGANISATIONS — STYLES SPÉCIFIQUES
   ============================================================ */

/* Wrapper pour les éléments d'organisation dans le sidebar */
.org-item-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.org-item-wrapper .nav-item {
    flex: 1;
    padding-right: 80px;
}

/* Bouton Code d'invitation (QR code) */
.org-invite-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--t3);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    transition: all 0.2s;
    z-index: 1;
}

.org-invite-btn:hover {
    background: var(--surf2);
    color: var(--acc);
}

/* Bouton Gestion des membres (users-cog) */
.org-members-btn {
    position: absolute;
    right: 38px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--t3);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    transition: all 0.2s;
    z-index: 1;
}

.org-members-btn:hover {
    background: var(--surf2);
    color: var(--warn);
}

/* Responsive pour les boutons d'organisation */
@media (max-width: 1120px) {
    .org-item-wrapper .nav-item {
        padding-right: 8px;
    }
    .org-invite-btn,
    .org-members-btn {
        display: none;
    }
}

.sidebar.open .org-invite-btn,
.sidebar.open .org-members-btn {
    display: block;
}

@media (max-width: 768px) {
    .sidebar.open .org-invite-btn,
    .sidebar.open .org-members-btn {
        display: block;
    }
}

/* ============================================================
   HISTORIQUE
   ============================================================ */

/* Bouton Historique dans les actions des mots de passe */
.password-actions .btn-history {
    transition: all .15s;
}

.password-actions .btn-history:hover {
    background: rgba(245,158,11,.12);
    border-color: rgba(245,158,11,.25);
    color: var(--warn);
}

/* Corps de la modale d'historique */
#history-body {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

#history-body .audit-item {
    padding: 10px 12px;
    border-radius: 6px;
    background: var(--bg2);
    border: 1px solid var(--bd);
}

#history-body .audit-item:last-child {
    border-bottom: none;
}

/* ============================================================
   GESTION DES MEMBRES
   ============================================================ */

/* Élément membre dans la liste */
.member-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    border-bottom: 1px solid var(--bd);
}

.member-item:last-child {
    border-bottom: none;
}

.member-item .member-info {
    flex: 1;
}

.member-item .member-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Badge de rôle dans la liste des membres */
.member-role-badge {
    font-size: 10px;
    padding: 0 8px;
    border-radius: 10px;
    opacity: 0.7;
}

.member-role-badge.owner {
    background: var(--acc);
    color: white;
}

.member-role-badge.admin {
    background: var(--warn);
    color: white;
}

.member-role-badge.member {
    background: var(--t3);
    color: white;
}

/* ============================================================
   DEMANDES EN ATTENTE
   ============================================================ */

.pending-request-item {
    padding: 6px 12px;
    margin: 2px 8px;
    background: var(--surf2);
    border-radius: var(--r);
    border-left: 3px solid var(--warn);
    transition: all 0.2s;
}

.pending-request-item:hover {
    background: var(--surf3);
}

.pending-request-item .request-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
}

.pending-request-item .requester-name {
    font-weight: 600;
    color: var(--t1);
}

.pending-request-item .org-name {
    color: var(--t3);
    font-size: 10px;
    display: block;
}

.pending-request-item .request-actions {
    display: flex;
    gap: 4px;
}

.pending-request-item .btn-approve {
    background: var(--ok);
    border: none;
    color: #fff;
    border-radius: 4px;
    padding: 2px 8px;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s;
}

.pending-request-item .btn-approve:hover {
    transform: scale(1.1);
}

.pending-request-item .btn-reject {
    background: var(--dan);
    border: none;
    color: #fff;
    border-radius: 4px;
    padding: 2px 8px;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s;
}

.pending-request-item .btn-reject:hover {
    transform: scale(1.1);
}

/* ============================================================
   BREADCRUMB
   ============================================================ */

.breadcrumb-vault {
    color: var(--acc);
}

.breadcrumb-separator {
    color: var(--t3);
    opacity: 0.5;
}

.breadcrumb-section {
    color: var(--t2);
}

/* ============================================================
   SCROLLBAR PERSONNALISÉE
   ============================================================ */

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg2);
}

::-webkit-scrollbar-thumb {
    background: var(--surf3);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--surf4);
}

/* ============================================================
   ANIMATIONS SUPPLÉMENTAIRES
   ============================================================ */

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.pulse {
    animation: pulse 2s ease-in-out infinite;
}

/* ============================================================
   UTILITAIRES
   ============================================================ */

.text-center { text-align: center; }
.text-muted { color: var(--t3); }
.text-success { color: var(--ok); }
.text-warning { color: var(--warn); }
.text-danger { color: var(--dan); }
.text-primary { color: var(--acc); }

.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-col { display: flex; flex-direction: column; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }

.m-0 { margin: 0; }
.m-1 { margin: 4px; }
.m-2 { margin: 8px; }
.m-3 { margin: 12px; }
.m-4 { margin: 16px; }

.p-0 { padding: 0; }
.p-1 { padding: 4px; }
.p-2 { padding: 8px; }
.p-3 { padding: 12px; }
.p-4 { padding: 16px; }

.w-full { width: 100%; }
.h-full { height: 100%; }


.org-delete-btn {
    /* même style que .org-members-btn / .org-invite-btn, avec couleur danger au survol */
}
.org-delete-btn:hover {
    color: var(--dan);
    background: rgba(240, 82, 82, 0.1);
}