/* M. Otrello — Thème moderne avec mode sombre/clair */
/* Palette: tons chauds café, dégradés animés vagues */

/* ============================================================
   THÈME SOMBRE (défaut)
   ============================================================ */
:root {
  --espresso: #1a1410;
  --coffee: #2a1f17;
  --mocha: #3d2e22;
  --latte: #6b5340;
  --crema: #9a8270;
  --cream: #d4c4b0;
  --foam: #f0e8dc;
  --accent: #c08552;
  --accent-dark: #a06a3e;
  --accent-light: #e6c9a8;
  --accent-glow: rgba(192, 133, 82, 0.15);
  --success: #7ba968;
  --success-light: rgba(123, 169, 104, 0.12);
  --danger: #d4654a;
  --danger-light: rgba(212, 101, 74, 0.12);
  --warning: #e0a856;
  --warning-light: rgba(224, 168, 86, 0.12);
  --info: #7a9cc6;
  --info-light: rgba(122, 156, 198, 0.12);
  --text: #f0e8dc;
  --text-light: #d4c4b0;
  --text-muted: #9a8270;
  --bg: #1a1410;
  --bg-elevated: #221a13;
  --card-bg: #2a1f17;
  --card-bg-hover: #332a20;
  --border: #3d2e22;
  --border-light: #4a3a2c;
  --border-dark: #5a4636;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4);
  --radius: 14px;
  --radius-sm: 10px;
  --radius-xs: 7px;
  --gradient-accent: linear-gradient(135deg, var(--accent), var(--accent-dark));
  --gradient-sidebar: linear-gradient(180deg, #1a1410, #2a1f17);
  --gradient-card: linear-gradient(135deg, var(--card-bg), var(--bg-elevated));
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);

  /* Vagues animées — couches de couleur */
  --wave-1: rgba(192, 133, 82, 0.08);
  --wave-2: rgba(122, 156, 198, 0.06);
  --wave-3: rgba(123, 169, 104, 0.05);
  --wave-4: rgba(224, 168, 86, 0.06);
  --wave-overlay: rgba(0, 0, 0, 0.2);
}

/* ============================================================
   THÈME CLAIR
   ============================================================ */
:root[data-theme="light"] {
  --espresso: #3d2e22;
  --coffee: #6b5340;
  --mocha: #8a6f56;
  --latte: #a08870;
  --crema: #7a6555;
  --cream: #5a4636;
  --foam: #2a1f17;
  --accent: #a06a3e;
  --accent-dark: #8a5a32;
  --accent-light: #6b4520;
  --accent-glow: rgba(160, 106, 62, 0.12);
  --success: #5a8a4a;
  --success-light: rgba(90, 138, 74, 0.1);
  --danger: #c0503a;
  --danger-light: rgba(192, 80, 58, 0.1);
  --warning: #c09040;
  --warning-light: rgba(192, 144, 64, 0.1);
  --info: #5a7ca6;
  --info-light: rgba(90, 124, 166, 0.1);
  --text: #2a1f17;
  --text-light: #4a3a2c;
  --text-muted: #8a7a68;
  --bg: #f5efe6;
  --bg-elevated: #ede5d8;
  --card-bg: #fff8ef;
  --card-bg-hover: #f0e8dc;
  --border: #d4c4b0;
  --border-light: #c4b4a0;
  --border-dark: #b4a490;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.12);
  --gradient-sidebar: linear-gradient(180deg, #ede5d8, #f5efe6);
  --gradient-card: linear-gradient(135deg, #fff8ef, #ede5d8);

  --wave-1: rgba(192, 133, 82, 0.12);
  --wave-2: rgba(122, 156, 198, 0.08);
  --wave-3: rgba(123, 169, 104, 0.07);
  --wave-4: rgba(224, 168, 86, 0.08);
  --wave-overlay: rgba(255, 255, 255, 0.15);
}

/* ============================================================
   THÈMES PROJET — remplacent le thème du site sur les pages projet
   ============================================================ */
:root[data-project-theme="matcha"] {
  --espresso: #161e14; --coffee: #1e2a1c; --mocha: #2a3a26;
  --latte: #4a6440; --crema: #7a9a6e; --cream: #c4d8b8; --foam: #eef5e8;
  --accent: #7ba968; --accent-dark: #5a8a4a; --accent-light: #a8c898;
  --accent-glow: rgba(123, 169, 104, 0.15);
  --success: #7ba968; --success-light: rgba(123, 169, 104, 0.12);
  --danger: #d4654a; --danger-light: rgba(212, 101, 74, 0.12);
  --warning: #e0a856; --warning-light: rgba(224, 168, 86, 0.12);
  --info: #7a9cc6; --info-light: rgba(122, 156, 198, 0.12);
  --text: #eef5e8; --text-light: #c4d8b8; --text-muted: #7a9a6e;
  --bg: #161e14; --bg-elevated: #1e2a1c; --card-bg: #243020; --card-bg-hover: #2a3a26;
  --border: #2a3a26; --border-light: #34482e; --border-dark: #445a3a;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.3); --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4);
  --gradient-accent: linear-gradient(135deg, var(--accent), var(--accent-dark));
  --gradient-sidebar: linear-gradient(180deg, #161e14, #1e2a1c);
  --gradient-card: linear-gradient(135deg, var(--card-bg), var(--bg-elevated));
  --wave-1: rgba(123, 169, 104, 0.08); --wave-2: rgba(122, 156, 198, 0.06);
  --wave-3: rgba(224, 168, 86, 0.05); --wave-4: rgba(123, 169, 104, 0.06);
  --wave-overlay: rgba(0, 0, 0, 0.2);
}

:root[data-project-theme="ube"] {
  --espresso: #18141e; --coffee: #221c2a; --mocha: #2e2540;
  --latte: #4a3a64; --crema: #7a6a92; --cream: #c8b8d8; --foam: #f0eaf5;
  --accent: #9a7fb8; --accent-dark: #7d5fa0; --accent-light: #c4a8e0;
  --accent-glow: rgba(154, 127, 184, 0.15);
  --success: #7ba968; --success-light: rgba(123, 169, 104, 0.12);
  --danger: #d4654a; --danger-light: rgba(212, 101, 74, 0.12);
  --warning: #e0a856; --warning-light: rgba(224, 168, 86, 0.12);
  --info: #7a9cc6; --info-light: rgba(122, 156, 198, 0.12);
  --text: #f0eaf5; --text-light: #c8b8d8; --text-muted: #7a6a92;
  --bg: #18141e; --bg-elevated: #221c2a; --card-bg: #28203a; --card-bg-hover: #2e2540;
  --border: #2e2540; --border-light: #3a2e50; --border-dark: #4a3a64;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.3); --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4);
  --gradient-accent: linear-gradient(135deg, var(--accent), var(--accent-dark));
  --gradient-sidebar: linear-gradient(180deg, #18141e, #221c2a);
  --gradient-card: linear-gradient(135deg, var(--card-bg), var(--bg-elevated));
  --wave-1: rgba(154, 127, 184, 0.08); --wave-2: rgba(122, 156, 198, 0.06);
  --wave-3: rgba(123, 169, 104, 0.05); --wave-4: rgba(224, 168, 86, 0.06);
  --wave-overlay: rgba(0, 0, 0, 0.2);
}

:root[data-project-theme="chocolat-blanc"] {
  --espresso: #1e1c16; --coffee: #2a2620; --mocha: #3a3428;
  --latte: #5a5040; --crema: #8a7a60; --cream: #d8c8a8; --foam: #faf6e8;
  --accent: #d4b85a; --accent-dark: #b89a3e; --accent-light: #e8d888;
  --accent-glow: rgba(212, 184, 90, 0.15);
  --success: #7ba968; --success-light: rgba(123, 169, 104, 0.12);
  --danger: #d4654a; --danger-light: rgba(212, 101, 74, 0.12);
  --warning: #e0a856; --warning-light: rgba(224, 168, 86, 0.12);
  --info: #7a9cc6; --info-light: rgba(122, 156, 198, 0.12);
  --text: #faf6e8; --text-light: #d8c8a8; --text-muted: #8a7a60;
  --bg: #1e1c16; --bg-elevated: #2a2620; --card-bg: #302a22; --card-bg-hover: #3a3428;
  --border: #3a3428; --border-light: #4a4030; --border-dark: #5a5040;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.3); --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4);
  --gradient-accent: linear-gradient(135deg, var(--accent), var(--accent-dark));
  --gradient-sidebar: linear-gradient(180deg, #1e1c16, #2a2620);
  --gradient-card: linear-gradient(135deg, var(--card-bg), var(--bg-elevated));
  --wave-1: rgba(212, 184, 90, 0.08); --wave-2: rgba(122, 156, 198, 0.06);
  --wave-3: rgba(123, 169, 104, 0.05); --wave-4: rgba(224, 168, 86, 0.06);
  --wave-overlay: rgba(0, 0, 0, 0.2);
}

:root[data-project-theme="monster-white"] {
  --espresso: #1a1a1e; --coffee: #242428; --mocha: #303038;
  --latte: #505058; --crema: #808088; --cream: #c0c0c8; --foam: #f0f0f0;
  --accent: #88a8c8; --accent-dark: #6889a8; --accent-light: #b8d0e8;
  --accent-glow: rgba(136, 168, 200, 0.15);
  --success: #7ba968; --success-light: rgba(123, 169, 104, 0.12);
  --danger: #d4654a; --danger-light: rgba(212, 101, 74, 0.12);
  --warning: #e0a856; --warning-light: rgba(224, 168, 86, 0.12);
  --info: #7a9cc6; --info-light: rgba(122, 156, 198, 0.12);
  --text: #f0f0f0; --text-light: #c0c0c8; --text-muted: #808088;
  --bg: #1a1a1e; --bg-elevated: #242428; --card-bg: #2a2a30; --card-bg-hover: #303038;
  --border: #303038; --border-light: #3a3a42; --border-dark: #4a4a52;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.3); --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4);
  --gradient-accent: linear-gradient(135deg, var(--accent), var(--accent-dark));
  --gradient-sidebar: linear-gradient(180deg, #1a1a1e, #242428);
  --gradient-card: linear-gradient(135deg, var(--card-bg), var(--bg-elevated));
  --wave-1: rgba(136, 168, 200, 0.08); --wave-2: rgba(122, 156, 198, 0.06);
  --wave-3: rgba(123, 169, 104, 0.05); --wave-4: rgba(224, 168, 86, 0.06);
  --wave-overlay: rgba(0, 0, 0, 0.2);
}

/* ============================================================
   THÈMES PROJET — variantes claires
   ============================================================ */
:root[data-theme="light"][data-project-theme="matcha"] {
  --espresso: #2a3a26; --coffee: #4a6440; --mocha: #5a7a4e;
  --latte: #6a8a5e; --crema: #5a7a4e; --cream: #3a5a30; --foam: #1e2a1c;
  --accent: #5a8a4a; --accent-dark: #4a7a3a; --accent-light: #3a5a30;
  --accent-glow: rgba(90, 138, 74, 0.12);
  --success: #5a8a4a; --success-light: rgba(90, 138, 74, 0.1);
  --danger: #c0503a; --danger-light: rgba(192, 80, 58, 0.1);
  --warning: #c09040; --warning-light: rgba(192, 144, 64, 0.1);
  --info: #5a7ca6; --info-light: rgba(90, 124, 166, 0.1);
  --text: #1e2a1c; --text-light: #3a4a30; --text-muted: #6a8a5e;
  --bg: #eef5e8; --bg-elevated: #e0ece0; --card-bg: #f5faf0; --card-bg-hover: #e8f0e0;
  --border: #c4d8b8; --border-light: #b4c8a8; --border-dark: #a4b898;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.08); --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.12);
  --gradient-sidebar: linear-gradient(180deg, #e0ece0, #eef5e8);
  --gradient-card: linear-gradient(135deg, #f5faf0, #e0ece0);
  --wave-1: rgba(90, 138, 74, 0.12); --wave-2: rgba(90, 124, 166, 0.08);
  --wave-3: rgba(90, 138, 74, 0.07); --wave-4: rgba(192, 144, 64, 0.08);
  --wave-overlay: rgba(255, 255, 255, 0.15);
}

:root[data-theme="light"][data-project-theme="ube"] {
  --espresso: #2e2540; --coffee: #4a3a64; --mocha: #5a4a74;
  --latte: #6a5a84; --crema: #6a5a84; --cream: #3a2e50; --foam: #221c2a;
  --accent: #7d5fa0; --accent-dark: #6d4f90; --accent-light: #4a3a64;
  --accent-glow: rgba(125, 95, 160, 0.12);
  --success: #5a8a4a; --success-light: rgba(90, 138, 74, 0.1);
  --danger: #c0503a; --danger-light: rgba(192, 80, 58, 0.1);
  --warning: #c09040; --warning-light: rgba(192, 144, 64, 0.1);
  --info: #5a7ca6; --info-light: rgba(90, 124, 166, 0.1);
  --text: #221c2a; --text-light: #3a2e50; --text-muted: #6a5a84;
  --bg: #f0eaf5; --bg-elevated: #e4dcee; --card-bg: #f8f4fc; --card-bg-hover: #ece4f4;
  --border: #c8b8d8; --border-light: #b8a8c8; --border-dark: #a898b8;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.08); --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.12);
  --gradient-sidebar: linear-gradient(180deg, #e4dcee, #f0eaf5);
  --gradient-card: linear-gradient(135deg, #f8f4fc, #e4dcee);
  --wave-1: rgba(125, 95, 160, 0.12); --wave-2: rgba(90, 124, 166, 0.08);
  --wave-3: rgba(90, 138, 74, 0.07); --wave-4: rgba(192, 144, 64, 0.08);
  --wave-overlay: rgba(255, 255, 255, 0.15);
}

:root[data-theme="light"][data-project-theme="chocolat-blanc"] {
  --espresso: #3a3428; --coffee: #5a5040; --mocha: #6a6048;
  --latte: #7a7060; --crema: #7a7060; --cream: #4a4030; --foam: #2a2620;
  --accent: #b89a3e; --accent-dark: #a08a2e; --accent-light: #5a5040;
  --accent-glow: rgba(184, 154, 62, 0.12);
  --success: #5a8a4a; --success-light: rgba(90, 138, 74, 0.1);
  --danger: #c0503a; --danger-light: rgba(192, 80, 58, 0.1);
  --warning: #c09040; --warning-light: rgba(192, 144, 64, 0.1);
  --info: #5a7ca6; --info-light: rgba(90, 124, 166, 0.1);
  --text: #2a2620; --text-light: #4a4030; --text-muted: #7a7060;
  --bg: #faf6e8; --bg-elevated: #f0ead8; --card-bg: #fffcf0; --card-bg-hover: #f4eedc;
  --border: #d8c8a8; --border-light: #c8b898; --border-dark: #b8a888;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.08); --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.12);
  --gradient-sidebar: linear-gradient(180deg, #f0ead8, #faf6e8);
  --gradient-card: linear-gradient(135deg, #fffcf0, #f0ead8);
  --wave-1: rgba(184, 154, 62, 0.12); --wave-2: rgba(90, 124, 166, 0.08);
  --wave-3: rgba(90, 138, 74, 0.07); --wave-4: rgba(192, 144, 64, 0.08);
  --wave-overlay: rgba(255, 255, 255, 0.15);
}

:root[data-theme="light"][data-project-theme="monster-white"] {
  --espresso: #303038; --coffee: #505058; --mocha: #606068;
  --latte: #707078; --crema: #707078; --cream: #4a4a52; --foam: #242428;
  --accent: #6889a8; --accent-dark: #5879a0; --accent-light: #404048;
  --accent-glow: rgba(104, 137, 168, 0.12);
  --success: #5a8a4a; --success-light: rgba(90, 138, 74, 0.1);
  --danger: #c0503a; --danger-light: rgba(192, 80, 58, 0.1);
  --warning: #c09040; --warning-light: rgba(192, 144, 64, 0.1);
  --info: #5a7ca6; --info-light: rgba(90, 124, 166, 0.1);
  --text: #242428; --text-light: #4a4a52; --text-muted: #707078;
  --bg: #f0f0f0; --bg-elevated: #e4e4e8; --card-bg: #f8f8f8; --card-bg-hover: #ececf0;
  --border: #c0c0c8; --border-light: #b0b0b8; --border-dark: #a0a0a8;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.08); --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.12);
  --gradient-sidebar: linear-gradient(180deg, #e4e4e8, #f0f0f0);
  --gradient-card: linear-gradient(135deg, #f8f8f8, #e4e4e8);
  --wave-1: rgba(104, 137, 168, 0.12); --wave-2: rgba(90, 124, 166, 0.08);
  --wave-3: rgba(90, 138, 74, 0.07); --wave-4: rgba(192, 144, 64, 0.08);
  --wave-overlay: rgba(255, 255, 255, 0.15);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
a { text-decoration: none; color: inherit; }

/* ============================================================
   FOND ANIMÉ — VAGUES DE DÉGRADÉS
   ============================================================ */
body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  background: var(--bg);
  position: relative;
  overflow-x: hidden;
}

/* Couche de vagues animées en arrière-plan fixe */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(ellipse 80% 60% at 20% 30%, var(--wave-1), transparent 60%),
    radial-gradient(ellipse 70% 50% at 80% 20%, var(--wave-2), transparent 55%),
    radial-gradient(ellipse 60% 70% at 60% 80%, var(--wave-3), transparent 60%),
    radial-gradient(ellipse 50% 50% at 30% 70%, var(--wave-4), transparent 50%);
  background-size: 200% 200%, 180% 180%, 220% 220%, 160% 160%;
  background-repeat: no-repeat;
  animation: wave-drift 20s ease-in-out infinite;
}

/* Couche de vagues secondaire, plus lente */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse 60% 40% at 70% 50%, var(--wave-1), transparent 50%),
    radial-gradient(ellipse 50% 60% at 25% 60%, var(--wave-4), transparent 50%),
    radial-gradient(ellipse 70% 50% at 50% 10%, var(--wave-2), transparent 55%);
  background-size: 250% 250%, 200% 200%, 180% 180%;
  background-repeat: no-repeat;
  animation: wave-drift2 28s ease-in-out infinite reverse;
  opacity: 0.7;
}

@keyframes wave-drift {
  0%, 100% {
    background-position: 0% 0%, 100% 0%, 50% 100%, 0% 50%;
  }
  25% {
    background-position: 30% 20%, 70% 30%, 60% 70%, 20% 60%;
  }
  50% {
    background-position: 50% 50%, 50% 50%, 50% 50%, 50% 50%;
  }
  75% {
    background-position: 20% 30%, 80% 20%, 40% 60%, 30% 40%;
  }
}

@keyframes wave-drift2 {
  0%, 100% {
    background-position: 0% 100%, 100% 0%, 50% 50%;
  }
  33% {
    background-position: 40% 60%, 60% 40%, 30% 70%;
  }
  66% {
    background-position: 60% 30%, 30% 70%, 70% 20%;
  }
}

/* ============================================================
   LOGOS — TAILLES AGRANDIES
   ============================================================ */
.brand-logo { width: 40px; height: 40px; filter: brightness(0) invert(1) opacity(0.95); }
.inline-logo { width: 36px; height: 36px; vertical-align: middle; filter: brightness(0) invert(1); }
.badge-logo { width: 18px; height: 18px; vertical-align: middle; filter: brightness(0) invert(1); margin-right: 4px; }
.empty-logo { width: 80px; height: 80px; filter: brightness(0) invert(0.4); }
.auth-logo { width: 56px; height: 56px; vertical-align: middle; filter: brightness(0) invert(1); margin-right: 10px; }

/* En mode clair, le logo noir reste visible tel quel */
:root[data-theme="light"] .brand-logo { filter: none; }
:root[data-theme="light"] .inline-logo { filter: none; }
:root[data-theme="light"] .badge-logo { filter: none; }
:root[data-theme="light"] .empty-logo { filter: none; opacity: 0.5; }
:root[data-theme="light"] .auth-logo { filter: none; }

/* Les thèmes projet en mode sombre : logos inversés */
:root[data-project-theme]:not([data-theme="light"]) .brand-logo { filter: brightness(0) invert(1) opacity(0.95); }
:root[data-project-theme]:not([data-theme="light"]) .inline-logo { filter: brightness(0) invert(1); }
:root[data-project-theme]:not([data-theme="light"]) .badge-logo { filter: brightness(0) invert(1); }
:root[data-project-theme]:not([data-theme="light"]) .empty-logo { filter: brightness(0) invert(0.4); }
:root[data-project-theme]:not([data-theme="light"]) .auth-logo { filter: brightness(0) invert(1); }

/* ============================================================
   LAYOUT
   ============================================================ */
.app-layout { display: flex; min-height: 100vh; }
.auth-main { flex: 1; min-height: 100vh; }
.sidebar {
  width: 240px;
  background: var(--gradient-sidebar);
  color: var(--cream);
  padding: 0;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  border-right: 1px solid var(--border);
  backdrop-filter: blur(8px);
}
.sidebar-brand {
  padding: 22px 24px;
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}
.sidebar nav { padding: 12px 0; flex: 1; overflow-y: auto; }
.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 24px;
  color: var(--crema);
  text-decoration: none;
  font-size: 0.95rem;
  transition: var(--transition);
  position: relative;
}
.sidebar nav a:hover { background: rgba(255,255,255,0.04); color: var(--foam); }
:root[data-theme="light"] .sidebar nav a:hover { background: rgba(0,0,0,0.04); }
.sidebar nav a.active {
  background: var(--accent-glow);
  color: var(--foam);
  border-left: 3px solid var(--accent);
}
.sidebar-user {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--crema);
}
.sidebar-user-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.sidebar-logout {
  margin-top: 10px;
  width: 100%;
  color: var(--crema) !important;
  border-color: var(--border-light) !important;
  justify-content: center;
}
.sidebar-logout:hover {
  background: var(--danger-light) !important;
  color: var(--danger) !important;
  border-color: var(--danger) !important;
}

/* Bouton toggle thème */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 10px 16px;
  margin-top: 8px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  background: var(--card-bg);
  color: var(--text-light);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
}
.theme-toggle:hover {
  background: var(--card-bg-hover);
  border-color: var(--accent);
  color: var(--accent-light);
}
.theme-toggle .theme-icon { font-size: 1.1rem; }

.main-content { flex: 1; padding: 32px; overflow-y: auto; max-width: 1400px; }
.main-content:has(.chat-layout) {
  max-width: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--gradient-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}
.card-hover { transition: var(--transition); }
.card-hover:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
  border-color: var(--border-dark);
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  font-family: inherit;
}
.btn-primary { background: var(--gradient-accent); color: var(--foam); }
.btn-primary:hover { box-shadow: 0 4px 16px var(--accent-glow); transform: translateY(-1px); }
.btn-accent { background: var(--gradient-accent); color: var(--foam); }
.btn-accent:hover { box-shadow: 0 4px 16px var(--accent-glow); transform: translateY(-1px); }
.btn-ghost { background: transparent; color: var(--text-light); border: 1px solid var(--border-light); }
.btn-ghost:hover { background: var(--card-bg-hover); border-color: var(--border-dark); color: var(--foam); }
.btn-danger { background: var(--danger); color: var(--foam); }
.btn-danger:hover { opacity: 0.85; box-shadow: 0 4px 16px var(--danger-light); }
.btn-success { background: var(--success); color: var(--espresso); }
.btn-success:hover { opacity: 0.85; }
.btn-sm { padding: 6px 14px; font-size: 0.85rem; }
.btn-xs { padding: 4px 10px; font-size: 0.78rem; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ============================================================
   FORMS
   ============================================================ */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; font-weight: 600; color: var(--text-light); font-size: 0.9rem; }
input, textarea, select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-family: inherit;
  background: var(--bg-elevated);
  color: var(--text);
  transition: var(--transition);
}
input::placeholder, textarea::placeholder { color: var(--text-muted); }
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
textarea { resize: vertical; min-height: 80px; }

/* ============================================================
   AUTH PAGES
   ============================================================ */
.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}
.auth-card {
  background: var(--gradient-card);
  border: 1px solid var(--border-light);
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
  padding: 48px 56px;
  max-width: 560px;
  width: 100%;
  backdrop-filter: blur(12px);
}
.auth-card h1 { color: var(--foam); margin-bottom: 8px; font-size: 2.4rem; display: flex; align-items: center; }
.auth-card input { padding: 14px 18px; font-size: 1.05rem; }
.auth-card .btn { padding: 14px 24px; font-size: 1.05rem; }
.auth-card .subtitle { color: var(--text-muted); margin-bottom: 28px; font-size: 1.05rem; }
.auth-error {
  background: var(--danger-light);
  color: var(--danger);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-size: 0.9rem;
  border: 1px solid rgba(212,101,74,0.25);
}
.auth-success {
  background: var(--success-light);
  color: var(--success);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-size: 0.9rem;
  border: 1px solid rgba(123,169,104,0.25);
}

/* ============================================================
   PROJECT GRID
   ============================================================ */
.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; }
.project-card { cursor: pointer; }
.project-card h3 { color: var(--foam); margin-bottom: 8px; }
.project-card .blend-badge {
  display: inline-flex;
  align-items: center;
  background: var(--card-bg-hover);
  color: var(--accent-light);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 12px;
  border: 1px solid var(--border);
}
.role-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
}
.role-product_owner { background: rgba(192,133,82,0.2); color: var(--accent-light); }
.role-scrum_master { background: rgba(122,156,198,0.2); color: var(--info); }
.role-dev { background: rgba(123,169,104,0.2); color: var(--success); }
.badge-admin { background: var(--accent); color: var(--espresso); }

/* ============================================================
   TABS
   ============================================================ */
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--border); margin-bottom: 24px; }
.tab {
  padding: 10px 20px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  font-family: inherit;
  transition: var(--transition);
}
.tab:hover { color: var(--text-light); }
.tab.active { color: var(--accent-light); border-bottom-color: var(--accent); }

/* ============================================================
   KANBAN / BOARD OVERVIEW
   ============================================================ */
.kanban { display: flex; gap: 16px; overflow-x: auto; padding-bottom: 12px; }
.kanban-col { min-width: 260px; flex: 1; background: var(--card-bg); border-radius: var(--radius); padding: 16px; border: 1px solid var(--border); }
.kanban-col h4 { color: var(--text-light); margin-bottom: 12px; font-size: 0.9rem; text-transform: uppercase; letter-spacing: 0.5px; display: flex; justify-content: space-between; align-items: center; }
.kanban-col .col-count { background: var(--mocha); color: var(--foam); border-radius: 10px; padding: 2px 8px; font-size: 0.75rem; }
.story-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin-bottom: 10px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: var(--transition);
}
.story-card:hover { border-color: var(--accent); box-shadow: 0 4px 16px var(--accent-glow); }
.story-card .story-title { font-weight: 600; color: var(--text); font-size: 0.9rem; margin-bottom: 6px; }
.story-card .story-meta { display: flex; justify-content: space-between; align-items: center; font-size: 0.75rem; color: var(--text-muted); gap: 4px; }
.story-points { background: var(--accent); color: var(--espresso); border-radius: 50%; width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center; font-size: 0.75rem; font-weight: 700; flex-shrink: 0; }

/* ============================================================
   STATUS BADGES
   ============================================================ */
.status-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
}
.status-todo { background: var(--card-bg-hover); color: var(--text-muted); border: 1px solid var(--border); }
.status-in_progress { background: var(--warning-light); color: var(--warning); border: 1px solid rgba(224,168,86,0.3); }
.status-review { background: var(--info-light); color: var(--info); border: 1px solid rgba(122,156,198,0.3); }
.status-done { background: var(--success-light); color: var(--success); border: 1px solid rgba(123,169,104,0.3); }

/* ============================================================
   NESTED HIERARCHY (Iteration > Epic > US)
   ============================================================ */
.nested-item {
  background: var(--gradient-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.nested-item-header {
  padding: 16px 20px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: var(--transition);
  user-select: none;
}
.nested-item-header:hover { background: var(--card-bg-hover); }
.nested-item-header .chevron { font-size: 0.8rem; color: var(--text-muted); transition: transform 0.2s; }
.nested-item-header .chevron.open { transform: rotate(90deg); }
.nested-item-body { padding: 0 20px 20px; }
.nested-children { margin-top: 12px; padding-left: 20px; border-left: 3px solid var(--border-light); }

.iteration-header { border-left: 4px solid var(--accent); }
.epic-header { border-left: 4px solid var(--mocha); }
.us-header { border-left: 4px solid var(--latte); }

.iteration-meta, .epic-meta { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 4px; font-size: 0.82rem; color: var(--text-muted); }
.iteration-dates { background: var(--card-bg-hover); padding: 2px 10px; border-radius: var(--radius-xs); }
.epic-count, .us-count { background: var(--mocha); color: var(--foam); border-radius: 10px; padding: 2px 8px; font-size: 0.72rem; font-weight: 600; }

/* ============================================================
   CHAT
   ============================================================ */
.chat-layout {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  background: var(--bg-elevated);
}
.chat-sidebar {
  width: 220px;
  background: var(--gradient-sidebar);
  color: var(--cream);
  padding: 0;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
}
.chat-sidebar .server-name { padding: 16px; font-weight: 700; border-bottom: 1px solid var(--border); font-size: 0.95rem; }
.chat-sidebar .channel { padding: 10px 16px; cursor: pointer; display: flex; align-items: center; gap: 8px; font-size: 0.9rem; color: var(--crema); transition: var(--transition); }
.chat-sidebar .channel:hover { background: rgba(255,255,255,0.04); color: var(--foam); }
:root[data-theme="light"] .chat-sidebar .channel:hover { background: rgba(0,0,0,0.04); }
.chat-sidebar .channel.active { background: var(--accent-glow); color: var(--foam); }
.chat-sidebar .channel .hash { opacity: 0.5; }
.chat-main { flex: 1; display: flex; flex-direction: column; background: var(--bg-elevated); }
.chat-header {
  padding: 14px 22px;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  color: var(--text);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--card-bg);
}
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 18px 22px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.chat-message { display: flex; gap: 12px; margin-bottom: 14px; }
.chat-message .avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--gradient-accent); color: var(--espresso); display: flex; align-items: center; justify-content: center; font-weight: 700; flex-shrink: 0; overflow: hidden; }
.chat-message .avatar img { width: 100%; height: 100%; object-fit: cover; }
.chat-message .msg-body { flex: 1; }
.chat-message .msg-header { display: flex; gap: 8px; align-items: baseline; margin-bottom: 2px; }
.chat-message .msg-author { font-weight: 700; color: var(--text); font-size: 0.9rem; }
.chat-message .msg-time { font-size: 0.75rem; color: var(--text-muted); }
.chat-message .msg-content { color: var(--text-light); font-size: 0.92rem; }
.chat-message .msg-content.deleted { color: var(--text-muted); font-style: italic; }
.chat-message .msg-delete { font-size: 0.75rem; color: var(--danger); cursor: pointer; margin-left: 8px; opacity: 0; }
.chat-message:hover .msg-delete { opacity: 0.7; }
.chat-input { padding: 12px 20px; border-top: 1px solid var(--border); display: flex; gap: 10px; }
.chat-input input { flex: 1; }

/* ============================================================
   OTRELLO CARD (profil)
   ============================================================ */
.otrello-card {
  border-radius: 18px;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  max-width: 420px;
  position: relative;
  border: 1px solid var(--border-light);
}
.otrello-card-avatar {
  width: 80px; height: 80px; border-radius: 50%;
  margin-bottom: 16px;
  background: var(--gradient-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem; font-weight: 700; color: var(--espresso);
  overflow: hidden;
}
.otrello-card-avatar img { width: 100%; height: 100%; object-fit: cover; }
.otrello-card-body { padding: 24px; background: var(--gradient-card); }
.otrello-card-body h2 { color: var(--foam); margin-bottom: 4px; }
.otrello-card-body .bio { color: var(--text-light); font-size: 0.9rem; margin-top: 12px; }

/* ============================================================
   UTILITIES
   ============================================================ */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-4 { gap: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.mt-4 { margin-top: 16px; }
.mt-8 { margin-top: 32px; }
.w-full { width: 100%; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 0.85rem; }
.text-center { text-align: center; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.checkbox-list { display: flex; flex-wrap: wrap; gap: 8px; }

/* Assignee chips (checkboxes with avatar) */
.assignee-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px 6px 6px; border-radius: 24px;
  border: 1px solid var(--border); background: var(--bg-elevated);
  cursor: pointer; transition: var(--transition); user-select: none;
}
.assignee-chip:hover { border-color: var(--accent); }
.assignee-chip-checked {
  border-color: var(--accent); background: var(--accent-glow);
}
.assignee-chip-input { display: none; }
.assignee-chip-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--gradient-accent); color: var(--espresso);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.72rem; flex-shrink: 0;
}
.assignee-chip-checked .assignee-chip-avatar {
  box-shadow: 0 0 0 2px var(--accent);
}
.assignee-chip-name { font-size: 0.82rem; font-weight: 500; color: var(--text); }

/* Assignee avatars (display only, on cards and detail modals) */
.assignee-avatars { display: inline-flex; align-items: center; flex-wrap: nowrap; gap: 4px; min-width: 0; overflow: hidden; }
.assignee-pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px 2px 2px; border-radius: 20px;
  background: var(--bg-elevated); border: 1px solid var(--border);
  line-height: 1;
  overflow: hidden;
  flex-shrink: 1;
  min-width: 0;
}
.assignee-pill .user-avatar { width: 28px; height: 28px; font-size: 0.7rem; }
.assignee-pill-avatar {
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--gradient-accent); color: var(--espresso);
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.58rem; flex-shrink: 0;
}
.assignee-pill-name { font-size: 0.72rem; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.assignee-pill-extra {
  background: var(--border-dark); color: var(--foam);
  font-size: 0.68rem; font-weight: 600;
  padding: 2px 8px;
}
.assignee-pill-extra .assignee-pill-avatar { display: none; }
.assignee-empty { font-size: 0.72rem; color: var(--text-muted); font-style: italic; }
.list { list-style: none; }
.list li { padding: 12px 0; border-bottom: 1px solid var(--border); }
.list li:last-child { border-bottom: none; }
.empty-state { text-align: center; padding: 48px 20px; color: var(--text-muted); }
.empty-state .icon { font-size: 3rem; margin-bottom: 12px; }
.empty-state h2 { color: var(--accent-light); margin-bottom: 8px; }
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6);
  display: flex; align-items: center; justify-content: center; z-index: 100;
  backdrop-filter: blur(4px);
}
:root[data-theme="light"] .modal-overlay { background: rgba(0,0,0,0.3); }
.modal {
  background: var(--gradient-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 28px 32px;
  max-width: 580px; width: 90%;
  box-shadow: var(--shadow-lg);
  max-height: 90vh; overflow-y: auto;
  animation: modal-in 0.2s ease-out;
}
@keyframes modal-in {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.modal h2 { color: var(--foam); margin-bottom: 20px; font-size: 1.25rem; }
.modal h3 { margin-bottom: 4px; }
.section-title { color: var(--foam); font-size: 1.3rem; margin-bottom: 20px; }
.page-title { color: var(--foam); font-size: 1.8rem; margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.page-subtitle { color: var(--text-muted); margin-bottom: 24px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.blend-badge {
  display: inline-flex;
  align-items: center;
  background: var(--card-bg-hover);
  color: var(--accent-light);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  border: 1px solid var(--border);
}

/* Detail modal fields */
.detail-field { margin-bottom: 14px; }
.detail-field .label { font-weight: 600; color: var(--text-muted); font-size: 0.78rem; margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.04em; }
.detail-field .value { color: var(--text); font-size: 0.92rem; }
.detail-box { background: var(--bg-elevated); border-radius: var(--radius-sm); padding: 14px 16px; white-space: pre-wrap; font-size: 0.9rem; color: var(--text-light); border: 1px solid var(--border); line-height: 1.5; }
.readonly-parent { background: var(--bg-elevated); border-radius: var(--radius-sm); padding: 10px 14px; font-size: 0.9rem; color: var(--text); border: 1px solid var(--border); font-weight: 500; }

/* Scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border-dark); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--latte); }

/* ============================================================
   NESTED LIST (Iterations > Epics > US)
   ============================================================ */
.nested-list { display: flex; flex-direction: column; gap: 8px; }
.flex-1 { flex: 1; }
.item-title { font-weight: 600; font-size: 0.95rem; color: var(--text); }

/* ============================================================
   MEMBRES
   ============================================================ */
.card-list { display: flex; flex-direction: column; gap: 12px; }
.member-card {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--gradient-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 20px;
  box-shadow: var(--shadow); flex-wrap: wrap; gap: 12px;
  transition: var(--transition);
}
.member-card:hover { border-color: var(--border-dark); }
.member-info { display: flex; align-items: center; gap: 12px; }
.member-avatar {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--gradient-accent); color: var(--espresso);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.9rem; flex-shrink: 0;
}
.member-name { font-weight: 600; font-size: 0.95rem; color: var(--text); }
.member-email { font-size: 0.82rem; color: var(--text-muted); }
.member-controls { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.member-controls select {
  padding: 6px 12px; border: 1px solid var(--border-dark);
  border-radius: var(--radius-xs); background: var(--bg-elevated);
  font-size: 0.85rem; color: var(--text); cursor: pointer;
}
.checkbox-label {
  display: flex; align-items: center; gap: 6px;
  font-size: 0.85rem; color: var(--text); cursor: pointer;
}
.checkbox-label input { width: 16px; height: 16px; accent-color: var(--accent); }

/* Toggle bouton "Voir mes US" */
.mine-toggle {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 14px; font-size: 0.85rem; font-weight: 600;
  border-radius: 999px; cursor: pointer; user-select: none;
  background: transparent; color: var(--text-light);
  border: 1px solid var(--border-light);
  transition: all 0.2s ease;
}
.mine-toggle:hover { background: var(--card-bg-hover); border-color: var(--border-dark); color: var(--foam); }
.mine-toggle.active {
  background: var(--gradient-accent); color: var(--foam);
  border-color: transparent;
  box-shadow: 0 2px 12px var(--accent-glow);
}
.mine-toggle .mine-toggle-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--text-muted); transition: background 0.2s ease;
  flex-shrink: 0;
}
.mine-toggle.active .mine-toggle-dot { background: var(--foam); }

/* Bouton + minimaliste pour ajouter */
.add-mini {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border-radius: 6px;
  font-size: 1.1rem; font-weight: 600; line-height: 1;
  background: transparent; color: var(--text-muted);
  border: 1px dashed var(--border-light);
  cursor: pointer; transition: all 0.15s ease;
  flex-shrink: 0;
}
.add-mini:hover {
  background: var(--card-bg-hover); color: var(--accent);
  border-color: var(--accent); border-style: solid;
}
.add-mini-row {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 0;
}
.add-mini-row .add-mini-label {
  font-size: 0.78rem; color: var(--text-muted);
}

/* Bouton crayon (modifier) */
.edit-pencil {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 5px;
  font-size: 0.85rem; line-height: 1;
  background: transparent; color: var(--text-muted);
  border: none; cursor: pointer;
  transition: all 0.15s ease; flex-shrink: 0;
}
.edit-pencil:hover {
  background: var(--card-bg-hover); color: var(--accent);
}
.view-sheet {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 5px;
  font-size: 0.85rem; line-height: 1;
  background: transparent; color: var(--text-muted);
  border: none; cursor: pointer;
  transition: all 0.15s ease; flex-shrink: 0;
}
.view-sheet:hover {
  background: var(--card-bg-hover); color: var(--mocha);
}

/* ============================================================
   CHAT (style fluide)
   ============================================================ */
.chat-server-header {
  padding: 18px 22px; font-weight: 700; font-size: 1rem;
  color: var(--foam); display: flex; align-items: center; gap: 8px;
  border-bottom: 1px solid var(--border);
  background: rgba(0,0,0,0.2);
}
:root[data-theme="light"] .chat-server-header { background: rgba(0,0,0,0.04); }
.channel-list { flex: 1; overflow-y: auto; padding: 10px; }
.channel-item {
  display: block; width: 100%; text-align: left;
  padding: 9px 14px; border: none; background: transparent;
  color: var(--text-muted); font-size: 0.88rem; cursor: pointer;
  border-radius: var(--radius-sm); transition: var(--transition);
}
.channel-item:hover { background: rgba(255,255,255,0.04); color: var(--text-light); }
:root[data-theme="light"] .channel-item:hover { background: rgba(0,0,0,0.04); }
.channel-item.active { background: var(--accent-glow); color: var(--foam); font-weight: 600; }
.channel-create {
  margin: 10px; width: calc(100% - 20px);
  color: var(--text-muted) !important;
  border: 1px dashed var(--border-light) !important;
}
.channel-create:hover { color: var(--accent-light) !important; border-color: var(--accent) !important; }

.chat-input-bar {
  display: flex; gap: 10px; padding: 14px 18px;
  border-top: 1px solid var(--border);
  background: var(--card-bg);
}
.chat-input {
  flex: 1; padding: 12px 16px;
  border: 1px solid var(--border-dark); border-radius: 24px;
  background: var(--bg-elevated); font-size: 0.9rem; color: var(--text);
  transition: var(--transition);
}
.chat-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }

/* Messages */
.message {
  display: flex; gap: 12px; padding: 6px 18px;
  border-radius: var(--radius-sm);
  transition: background 0.12s;
}
.message:hover { background: rgba(255,255,255,0.03); }
:root[data-theme="light"] .message:hover { background: rgba(0,0,0,0.03); }
.message-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--gradient-accent); color: var(--espresso);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.75rem; flex-shrink: 0;
  overflow: hidden;
}
.message-avatar-img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.message-body { flex: 1; min-width: 0; }
.message-header { display: flex; align-items: baseline; gap: 8px; margin-bottom: 2px; }
.message-author { font-weight: 600; font-size: 0.88rem; color: var(--text); }
.message-time { font-size: 0.72rem; color: var(--text-muted); }
.message-content { font-size: 0.9rem; color: var(--text-light); line-height: 1.5; word-wrap: break-word; }
.message-deleted .message-content { font-style: italic; color: var(--text-muted); }

/* ============================================================
   ACTIONS SUR LES MESSAGES (clic gauche)
   ============================================================ */
/* Un message est cliquable : il ouvre ses détails */
.message-row { cursor: pointer; }

/* Message caché « pour moi » */
.message-hidden .message-content-hidden {
  font-style: italic; color: var(--text-muted);
}
.message-hidden .message-attachment { display: none; }

/* Mention « modifié » dans l'en-tête */
.message-edited { font-size: 0.68rem; color: var(--text-muted); font-style: italic; }

/* Édition en place d'un message */
.msg-edit { margin-top: 4px; }
.msg-edit .edit-input {
  width: 100%; box-sizing: border-box;
  padding: 10px 12px; font-size: 0.9rem; color: var(--text);
  background: var(--bg-elevated); border: 1px solid var(--accent);
  border-radius: var(--radius-sm); resize: vertical; min-height: 60px;
}
.msg-edit .edit-input:focus { outline: none; box-shadow: 0 0 0 3px var(--accent-glow); }
.msg-edit-actions { display: flex; gap: 8px; margin-top: 6px; }

/* Bandeau « vous êtes muet » + erreurs ponctuelles du chat */
.mute-banner {
  margin: 8px 18px 0; padding: 10px 14px;
  border: 1px solid var(--danger); border-radius: var(--radius-sm);
  background: var(--danger-light); color: var(--text);
  font-size: 0.85rem;
}
.chat-error { margin: 8px 18px 0; }

/* Badge « muet » dans la liste des membres */
.member-muted-badge {
  margin-left: auto; align-self: center;
  font-size: 0.65rem; font-weight: 700; text-transform: uppercase;
  padding: 2px 8px; border-radius: 999px;
  background: var(--danger-light); color: var(--danger);
}

/* Modale de détails d'un message */
.msg-details { display: flex; flex-direction: column; gap: 14px; }
.msg-details-head { display: flex; gap: 12px; align-items: center; }
.msg-details-meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.msg-details-author { font-weight: 700; color: var(--text); font-size: 0.95rem; }
.msg-details-sub { font-size: 0.78rem; color: var(--text-muted); }
.msg-details-content {
  padding: 10px 12px; border-radius: var(--radius-sm);
  background: var(--card-bg); font-size: 0.9rem;
}
.msg-details-gone { font-style: italic; color: var(--text-muted); }
.msg-details-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.msg-details-hint { font-size: 0.72rem; color: var(--text-muted); margin: 0; }

/* Modale de mute */
.mute-modal { display: flex; flex-direction: column; gap: 12px; }
.mute-modal-sub { margin: 0; font-size: 0.9rem; color: var(--text-light); }
.mute-presets { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.mute-preset {
  padding: 6px 12px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--border); background: transparent; color: var(--text-light);
  font-size: 0.8rem; transition: var(--transition);
}
.mute-preset:hover { border-color: var(--accent); color: var(--accent-light); }
.mute-preset.active { border-color: var(--accent); background: var(--accent-glow); color: var(--foam); font-weight: 600; }
.mute-modal input[type="number"] {
  width: 100%; padding: 10px 12px; font-size: 0.9rem;
  background: var(--bg-elevated); color: var(--text);
  border: 1px solid var(--border-dark); border-radius: var(--radius-sm);
  box-sizing: border-box;
}

/* ============================================================
   BOARD OVERVIEW (itérations en colonnes, boîte dans boîte)
   ============================================================ */
.board-overview {
  display: flex;
  gap: 18px;
  overflow-x: auto;
  padding-bottom: 16px;
  align-items: flex-start;
}
.board-col {
  min-width: 300px;
  max-width: 340px;
  flex-shrink: 0;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: var(--shadow);
}
.board-col-backlog {
  background: var(--bg-elevated);
  border-style: dashed;
}
.board-col-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--border-light);
}
.board-col-header h4 {
  color: var(--text-light);
  font-size: 0.95rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.board-col-header h4 .status-badge {
  margin-left: 6px;
  margin-top: 4px;
}
.board-col-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Epic = boîte imbriquée dans la colonne */
.board-epic {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}
.board-epic-header {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.board-epic-title {
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--text);
  flex: 1;
  min-width: 0;
}
.board-epic-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-left: 4px;
  border-left: 2px solid var(--border);
  margin-left: 2px;
}

/* US = boîte imbriquée dans l'epic */
.board-us {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  cursor: pointer;
  transition: var(--transition);
}
.board-us:hover {
  border-color: var(--accent);
  box-shadow: 0 2px 12px var(--accent-glow);
  transform: translateY(-1px);
}
.board-us .story-title { font-size: 0.82rem; margin-bottom: 6px; font-weight: 500; color: var(--text); }
.board-us .story-meta { display: flex; justify-content: space-between; align-items: center; font-size: 0.7rem; gap: 6px; }
.board-us-loose {
  border-left: 3px solid var(--latte);
}

.board-add-btn, .board-add-epic {
  align-self: flex-start;
  opacity: 0.5;
}
.board-add-btn:hover, .board-add-epic:hover { opacity: 1; }
.board-add-epic {
  margin-top: 4px;
  border-style: dashed !important;
}

/* ============================================================
   PROFILE PAGE
   ============================================================ */
.profile-page { max-width: 1000px; }
.profile-header { margin-bottom: 28px; }

.profile-layout {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 28px;
  align-items: flex-start;
}
@media (max-width: 800px) {
  .profile-layout { grid-template-columns: 1fr; }
}

.profile-preview-col {
  position: sticky;
  top: 32px;
}
@media (max-width: 800px) {
  .profile-preview-col { position: static; }
}

.profile-form-col {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.profile-form-card { padding: 28px; }
.profile-form-divider {
  height: 1px;
  background: var(--border);
  margin: 24px 0 20px;
}
.profile-subsection {
  color: var(--text-light);
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.color-picker-row {
  display: flex;
  gap: 10px;
  align-items: center;
}
.color-input {
  width: 50px !important;
  height: 42px !important;
  padding: 4px !important;
  border-radius: var(--radius-sm);
  cursor: pointer;
  flex-shrink: 0;
}
.color-text {
  flex: 1;
  font-family: 'Courier New', monospace;
}

.profile-success {
  background: var(--success-light);
  color: var(--success);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-size: 0.9rem;
  border: 1px solid rgba(123,169,104,0.25);
}

/* Securite : section repliable */
.profile-security-card { padding: 0; overflow: hidden; }
.profile-security-toggle {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 20px 24px;
  border: none;
  background: none;
  color: var(--foam);
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: var(--transition);
}
.profile-security-toggle:hover { background: var(--card-bg-hover); }
.profile-security-toggle .chevron {
  font-size: 0.9rem;
  color: var(--text-muted);
  transition: transform 0.2s;
  transform: rotate(90deg);
}
.profile-security-toggle .chevron.open {
  transform: rotate(270deg);
}
.profile-security-body {
  padding: 0 24px 24px;
  border-top: 1px solid var(--border);
}
.profile-security-body form { margin-top: 20px; }

/* ============================================================
   NUMÉROTATION DES ITÉRATIONS / EPICS / US
   ============================================================ */
.board-col-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  padding: 0 8px;
  border-radius: 8px;
  background: var(--gradient-accent);
  color: var(--foam);
  font-size: 0.85rem;
  font-weight: 700;
  margin-right: 8px;
  flex-shrink: 0;
}

.iter-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  padding: 0 7px;
  border-radius: 7px;
  background: var(--gradient-accent);
  color: var(--foam);
  font-size: 0.8rem;
  font-weight: 700;
  margin-right: 8px;
  flex-shrink: 0;
}

/* ============================================================
   DRAG-AND-DROP — feedback visuel
   ============================================================ */
.nested-item[draggable="true"],
.story-card[draggable="true"] {
  cursor: grab;
}

.nested-item[draggable="true"]:active,
.story-card[draggable="true"]:active {
  cursor: grabbing;
}

.nested-item.dragging,
.story-card.dragging {
  opacity: 0.4;
}

.nested-item.drag-over,
.story-card.drag-over {
  outline: 2px dashed var(--accent);
  outline-offset: -2px;
  background: var(--accent-glow);
}

/* Board columns drag-over */
.board-col.drag-over {
  outline: 2px dashed var(--accent);
  outline-offset: -2px;
}

/* ============================================================
   SWAP — bouton + menu déroulant
   ============================================================ */
.swap-btn {
  flex-shrink: 0;
  opacity: 0.7;
  transition: var(--transition);
}
.swap-btn:hover {
  opacity: 1;
}
.swap-select {
  margin-left: 6px;
  padding: 4px 8px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-light);
  background: var(--card-bg);
  color: var(--text);
  font-size: 0.85rem;
  cursor: pointer;
  max-width: 200px;
  outline: none;
}
.swap-select:focus {
  border-color: var(--accent);
}
.swap-select option {
  background: var(--card-bg);
  color: var(--text);
  padding: 4px;
}

/* ===== Admin user management ===== */
.admin-table {
  width: 100%;
  border-collapse: collapse;
}
.admin-table th,
.admin-table td {
  text-align: left;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
}
.admin-table th {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  opacity: 0.7;
}
.admin-table tbody tr:hover {
  background: var(--hover);
}
.admin-user-cell {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 500;
}
.admin-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.admin-actions {
  display: flex;
  gap: 0.4rem;
}
.avatar-edit-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}
.avatar-edit-row input { flex: 1; }

.hidden { display: none !important; }

/* ===== User avatar component ===== */
.user-avatar {
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  flex-shrink: 0;
  overflow: hidden;
  width: 36px;
  height: 36px;
  font-size: 0.85rem;
  color: var(--foam);
}
.user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.user-avatar.sm { width: 28px; height: 28px; font-size: 0.7rem; }
.user-avatar.lg { width: 64px; height: 64px; font-size: 1.2rem; }
.user-avatar.xl { width: 96px; height: 96px; font-size: 1.6rem; }

/* ============================================================
   CHAT TEMPS RÉEL (badges, pièces jointes, visio, membres)
   ============================================================ */

/* Indicateur de connexion temps réel */
.live-indicator {
  margin-left: auto; font-size: 0.7rem; font-weight: 600;
  padding: 3px 10px; border-radius: 12px;
  background: rgba(255,80,80,0.15); color: #ff8f8f;
}
.live-indicator.online { background: rgba(80,255,160,0.15); color: #6fe3a1; }
:root[data-theme="light"] .live-indicator { background: rgba(220,60,60,0.12); color: #c05050; }
:root[data-theme="light"] .live-indicator.online { background: rgba(40,170,90,0.12); color: #218a52; }

/* Canaux : nom + badges (appel en cours, non-lus) */
.channel-item {
  display: flex; align-items: center; gap: 6px;
}
.channel-hash { opacity: 0.55; }
.channel-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.voice-badge {
  font-size: 0.68rem; font-weight: 700; padding: 2px 7px;
  border-radius: 10px; background: rgba(80,255,160,0.18); color: #6fe3a1;
}
:root[data-theme="light"] .voice-badge { background: rgba(40,170,90,0.15); color: #218a52; }
.unread-badge {
  font-size: 0.68rem; font-weight: 700; padding: 2px 7px;
  border-radius: 10px; background: var(--danger, #e05b5b); color: #fff;
}

/* Barre de saisie : pièce jointe */
.chat-attach-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 10px 14px; border: 1px solid var(--border-dark); border-radius: 24px;
  background: var(--bg-elevated); color: var(--text-muted);
  font-size: 0.82rem; cursor: pointer; user-select: none;
  transition: var(--transition); white-space: nowrap;
}
.chat-attach-btn:hover { color: var(--accent-light); border-color: var(--accent); }
.chat-file-input { display: none; }
.attachment-chip {
  position: relative; display: flex; align-items: center;
  padding: 4px; border-radius: 12px;
  background: var(--accent-glow);
}
.attachment-chip-img { width: 44px; height: 44px; object-fit: cover; border-radius: 8px; display: block; }
.attachment-chip-x {
  position: absolute; top: -6px; right: -6px;
  width: 18px; height: 18px; border-radius: 50%; border: none;
  background: var(--danger, #e05b5b); color: #fff;
  font-size: 0.7rem; line-height: 1; cursor: pointer;
}

/* Contenu des messages : liens et images */
.message-content .msg-link { color: var(--accent-light); text-decoration: none; word-break: break-all; }
.message-content .msg-link:hover { text-decoration: underline; }
.msg-image {
  display: block; max-width: 360px; max-height: 260px;
  border-radius: var(--radius); margin-top: 6px;
  border: 1px solid var(--border);
}
.message-attachment { margin-top: 2px; }
.msg-delete {
  border: none; background: transparent; cursor: pointer;
  color: var(--text-muted); font-size: 0.72rem; padding: 0 4px;
  opacity: 0; transition: var(--transition);
}
.msg-delete:hover { color: var(--danger, #e05b5b); opacity: 1 !important; }
.message:hover .msg-delete { opacity: 0.75; }

/* Panneau des membres */
.chat-members {
  width: 220px; border-left: 1px solid var(--border);
  background: var(--card-bg); overflow-y: auto; padding: 14px;
  display: flex; flex-direction: column; gap: 4px;
}
.chat-members-title {
  font-weight: 700; font-size: 0.78rem; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--text-muted);
  margin-bottom: 10px; display: flex; align-items: center; gap: 6px;
}
.chat-members-count {
  background: var(--accent-glow); color: var(--accent-light);
  padding: 1px 8px; border-radius: 10px; font-size: 0.7rem;
}
.chat-member {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 8px; border-radius: var(--radius-sm);
}
.chat-member:hover { background: rgba(255,255,255,0.03); }
:root[data-theme="light"] .chat-member:hover { background: rgba(0,0,0,0.03); }
.chat-member-info { display: flex; flex-direction: column; min-width: 0; }
.chat-member-info > span:first-child {
  font-size: 0.85rem; color: var(--text-light);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.member-role { font-size: 0.68rem; color: var(--text-muted); }

/* Actions d'en-tête (appel vocal/vidéo) */
.chat-header {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.chat-header-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.voice-controls { display: flex; align-items: center; gap: 8px; }
.voice-controls .btn.off { opacity: 0.55; text-decoration: line-through; }
.btn-danger {
  background: var(--danger, #e05b5b); color: #fff; border: none;
}

/* Panneau visioconférence */
.voice-panel { border-bottom: 1px solid var(--border); background: rgba(0,0,0,0.25); }
:root[data-theme="light"] .voice-panel { background: rgba(0,0,0,0.04); }
.voice-grid {
  display: flex; flex-wrap: wrap; gap: 10px; padding: 12px 18px;
  justify-content: center;
}
.voice-tile {
  position: relative; width: 220px; height: 150px;
  border-radius: var(--radius); overflow: hidden;
  background: #1a1a1a; border: 1px solid var(--border);
}
.voice-video { width: 100%; height: 100%; object-fit: cover; display: block; }
.voice-video.local { transform: scaleX(-1); } /* effet miroir sur sa propre caméra */
.voice-name {
  position: absolute; left: 8px; bottom: 6px;
  padding: 2px 8px; border-radius: 8px;
  background: rgba(0,0,0,0.55); color: #fff;
  font-size: 0.72rem; font-weight: 600; pointer-events: none;
}

/* Pièces jointes : carte fichier + chip avec nom */
.msg-file {
  display: inline-flex; align-items: center; gap: 12px;
  margin-top: 6px; padding: 10px 14px;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--card-bg);
  text-decoration: none; max-width: 360px;
  transition: var(--transition);
}
.msg-file:hover { border-color: var(--accent); background: var(--accent-glow); }
.msg-file-ext {
  flex-shrink: 0; min-width: 44px; padding: 8px 6px;
  border-radius: var(--radius-sm); text-align: center;
  background: var(--accent-glow); color: var(--accent-light);
  font-size: 0.68rem; font-weight: 800; letter-spacing: 0.03em;
}
.msg-file-labels { display: flex; flex-direction: column; min-width: 0; }
.msg-file-name {
  font-size: 0.85rem; color: var(--text-light); font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.msg-file-dl { font-size: 0.72rem; color: var(--accent-light); }
.attachment-chip-name {
  max-width: 160px; padding: 8px 12px;
  font-size: 0.8rem; color: var(--text-light);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Saisie multi-lignes : textarea à hauteur adaptative */
textarea.chat-input {
  resize: none; overflow-y: auto;
  min-height: 46px; max-height: 180px;
  font-family: inherit; line-height: 1.45;
  border-radius: 14px;
}
/* Les sauts de ligne des messages s'affichent */
.message-content { white-space: pre-wrap; }
/* Les boutons gardent leur hauteur et restent alignés en haut quand le textarea grandit */
.chat-input-bar { align-items: flex-start; }

/* Sur le chat : hauteur exacte du viewport, seule la zone de messages scrolle.
   La barre de saisie et les boutons restent donc toujours visibles. */
.app-layout:has(.chat-layout) {
  height: 100vh;
  min-height: 100vh;
  overflow: hidden;
}
.chat-main { min-height: 0; }
