/* ============ Inter (self-hosted) ============ */
@font-face {
  font-family: 'Inter';
  src: url('/fonts/inter-var.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* ================================================================
   THÈMES — chaque famille a une variante dark + light
   discord (défaut) · aurora · midnight · nord · dracula
   ================================================================ */

:root,
:root[data-theme='discord'] {
  --bg: #313338;
  --sidebar-bg: #2b2d31;
  --glass: #2b2d31;
  --glass2: #3f4147;
  --border: rgba(255, 255, 255, 0.06);
  --border2: rgba(255, 255, 255, 0.16);
  --text: #dbdee1;
  --muted: #9ba2ab;
  --muted2: #9b9fa7;
  --content-text: #dbdee1;
  --dcontent: #dbdee1;
  --accent: #5865f2;
  --accent2: #4752c4;
  --accent-text: #c9cdfb;
  --accent-soft-bg: rgba(88, 101, 242, 0.2);
  --selection-bg: rgba(88, 101, 242, 0.55);
  --grad: linear-gradient(135deg, #5865f2 0%, #4752c4 100%);
  --grad-soft: linear-gradient(135deg, rgba(88, 101, 242, 0.3), rgba(71, 82, 196, 0.24));
  --green: #4ade80;
  --red: #f87878;
  --yellow: #fbbf24;
  --input-bg: #1e1f22;
  --logs-bg: #1e1f22;
  --modal-bg: #2b2d31;
  --dropdown-bg: #383a40;
  --toast-bg: #2b2d31;
  --switch-track: #1e1f22;
  --aurora-opacity: 0;
  --aurora1: transparent;
  --aurora2: transparent;
  --aurora3: transparent;
  --noise-opacity: 0;
  --shadow-card: 0 8px 28px rgba(0, 0, 0, 0.22);
  --glow-accent: rgba(88, 101, 242, 0.5);
  --title-grad: linear-gradient(120deg, #f2f3f5 30%, #b5bac1 100%);
  --selfmsg-bg: rgba(88, 101, 242, 0.08);
  --selfmsg-border: rgba(88, 101, 242, 0.6);
  --reply-bg: rgba(88, 101, 242, 0.1);
  --reply-border: rgba(88, 101, 242, 0.6);
  --target-bg: rgba(88, 101, 242, 0.14);
  --target-border: rgba(88, 101, 242, 0.6);
  --radius: 14px;
}

:root[data-theme='discord'][data-mode='light'] {
  --bg: #ffffff;
  --sidebar-bg: #e3e5e8;
  --glass: #f2f3f5;
  --glass2: #ebedef;
  --border: rgba(6, 6, 7, 0.08);
  --border2: rgba(6, 6, 7, 0.2);
  --text: #060607;
  --muted: #5c5e66;
  --muted2: #6d7076;
  --content-text: #313338;
  --dcontent: #2e3338;
  --grad-soft: linear-gradient(135deg, rgba(88, 101, 242, 0.14), rgba(71, 82, 196, 0.1));
  --yellow: #906000;
  --red: #cf222e;
  --green: #187733;
  --accent-soft-bg: rgba(88, 101, 242, 0.12);
  --selection-bg: rgba(88, 101, 242, 0.25);
  --accent-text: #4752c4;
  --input-bg: #ffffff;
  --logs-bg: #f2f3f5;
  --modal-bg: #ffffff;
  --dropdown-bg: #ffffff;
  --toast-bg: #ffffff;
  --switch-track: #d4d7dc;
  --shadow-card: 0 6px 24px rgba(6, 6, 7, 0.08);
  --glow-accent: rgba(88, 101, 242, 0.4);
  --title-grad: linear-gradient(120deg, #060607 30%, #4e5058 100%);
}

:root[data-theme='aurora'] {
  --bg: #05060b;
  --sidebar-bg: rgba(8, 10, 17, 0.72);
  --glass: rgba(255, 255, 255, 0.032);
  --glass2: rgba(255, 255, 255, 0.055);
  --border: rgba(255, 255, 255, 0.07);
  --border2: rgba(255, 255, 255, 0.16);
  --text: #f3f5fb;
  --muted: #9aa3ba;
  --muted2: #737c93;
  --content-text: #cdd3e1;
  --dcontent: #dcdfe9;
  --accent: #00d4ff;
  --accent2: #7b5cff;
  --accent-soft-bg: rgba(0, 212, 255, 0.12);
  --selection-bg: rgba(0, 212, 255, 0.35);
  --accent-text: #00d4ff;
  --grad: linear-gradient(135deg, #00d4ff 0%, #7b5cff 100%);
  --grad-soft: linear-gradient(135deg, rgba(0, 212, 255, 0.16), rgba(123, 92, 255, 0.16));
  --green: #34d399;
  --red: #fb7185;
  --yellow: #fbbf24;
  --input-bg: rgba(5, 6, 11, 0.6);
  --logs-bg: rgba(3, 4, 8, 0.8);
  --modal-bg: rgba(16, 19, 30, 0.92);
  --dropdown-bg: rgba(13, 16, 25, 0.92);
  --toast-bg: rgba(18, 22, 34, 0.92);
  --switch-track: rgba(255, 255, 255, 0.1);
  --aurora-opacity: 1;
  --aurora1: rgba(0, 212, 255, 0.17);
  --aurora2: rgba(123, 92, 255, 0.16);
  --aurora3: rgba(0, 113, 255, 0.1);
  --noise-opacity: 0.028;
  --shadow-card: 0 10px 40px rgba(0, 0, 0, 0.35);
  --glow-accent: rgba(0, 212, 255, 0.55);
  --title-grad: linear-gradient(120deg, #ffffff 30%, #b8c6ff 100%);
  --selfmsg-bg: linear-gradient(90deg, rgba(0, 150, 255, 0.07), rgba(123, 92, 255, 0.04));
  --selfmsg-border: rgba(0, 190, 255, 0.5);
  --reply-bg: linear-gradient(90deg, rgba(0, 150, 255, 0.09), rgba(123, 92, 255, 0.05));
  --reply-border: rgba(0, 190, 255, 0.55);
  --target-bg: linear-gradient(90deg, rgba(0, 150, 255, 0.12), rgba(123, 92, 255, 0.08));
  --target-border: rgba(0, 190, 255, 0.5);
  --radius: 16px;
}

:root[data-theme='aurora'][data-mode='light'] {
  --bg: #eef1f7;
  --sidebar-bg: rgba(255, 255, 255, 0.75);
  --glass: rgba(255, 255, 255, 0.62);
  --glass2: rgba(255, 255, 255, 0.88);
  --border: rgba(15, 23, 42, 0.08);
  --border2: rgba(15, 23, 42, 0.2);
  --text: #111a2e;
  --muted: #5b6474;
  --muted2: #646c7d;
  --content-text: #37415a;
  --dcontent: #2a3247;
  --accent: #0091d5;
  --accent2: #6b4ee6;
  --accent-soft-bg: rgba(0, 145, 213, 0.12);
  --selection-bg: rgba(0, 145, 213, 0.22);
  --accent-text: #006bbd;
  --grad: linear-gradient(135deg, #0091d5 0%, #6b4ee6 100%);
  --grad-soft: linear-gradient(135deg, rgba(0, 145, 213, 0.13), rgba(107, 78, 230, 0.13));
  --green: #0b7a55;
  --red: #d81c45;
  --yellow: #a25a05;
  --input-bg: rgba(255, 255, 255, 0.9);
  --logs-bg: #f6f8fc;
  --modal-bg: rgba(255, 255, 255, 0.94);
  --dropdown-bg: rgba(255, 255, 255, 0.97);
  --toast-bg: rgba(255, 255, 255, 0.95);
  --switch-track: rgba(15, 23, 42, 0.12);
  --aurora-opacity: 0.6;
  --aurora1: rgba(0, 212, 255, 0.12);
  --aurora2: rgba(123, 92, 255, 0.1);
  --aurora3: rgba(0, 113, 255, 0.07);
  --noise-opacity: 0.02;
  --shadow-card: 0 8px 30px rgba(15, 23, 42, 0.07);
  --glow-accent: rgba(0, 145, 213, 0.35);
  --title-grad: linear-gradient(120deg, #0b1220 30%, #3d4c7d 100%);
  --selfmsg-bg: linear-gradient(90deg, rgba(0, 145, 213, 0.07), rgba(107, 78, 230, 0.05));
  --selfmsg-border: rgba(0, 145, 213, 0.45);
  --reply-bg: linear-gradient(90deg, rgba(0, 145, 213, 0.08), rgba(107, 78, 230, 0.05));
  --reply-border: rgba(0, 145, 213, 0.5);
  --target-bg: linear-gradient(90deg, rgba(0, 145, 213, 0.1), rgba(107, 78, 230, 0.07));
  --target-border: rgba(0, 145, 213, 0.5);
}

:root[data-theme='midnight'] {
  --bg: #010206;
  --sidebar-bg: rgba(1, 2, 7, 0.88);
  --glass: rgba(255, 255, 255, 0.016);
  --glass2: rgba(255, 255, 255, 0.032);
  --border: rgba(255, 255, 255, 0.05);
  --border2: rgba(255, 255, 255, 0.14);
  --text: #e8ebf5;
  --muted: #7c849c;
  --muted2: #6e778f;
  --content-text: #b9c0d4;
  --dcontent: #c8cede;
  --accent: #00d4ff;
  --accent2: #7b5cff;
  --accent-soft-bg: rgba(0, 212, 255, 0.1);
  --selection-bg: rgba(0, 212, 255, 0.32);
  --accent-text: #00d4ff;
  --grad: linear-gradient(135deg, #00d4ff 0%, #7b5cff 100%);
  --grad-soft: linear-gradient(135deg, rgba(0, 212, 255, 0.1), rgba(123, 92, 255, 0.1));
  --green: #34d399;
  --red: #fb7185;
  --yellow: #fbbf24;
  --input-bg: rgba(0, 0, 0, 0.5);
  --logs-bg: rgba(0, 0, 0, 0.6);
  --modal-bg: rgba(4, 6, 12, 0.94);
  --dropdown-bg: rgba(8, 10, 18, 0.94);
  --toast-bg: rgba(4, 6, 12, 0.92);
  --switch-track: rgba(255, 255, 255, 0.07);
  --aurora-opacity: 0.35;
  --aurora1: rgba(0, 212, 255, 0.08);
  --aurora2: rgba(123, 92, 255, 0.08);
  --aurora3: rgba(0, 113, 255, 0.05);
  --noise-opacity: 0.022;
  --shadow-card: 0 12px 44px rgba(0, 0, 0, 0.55);
  --glow-accent: rgba(0, 212, 255, 0.4);
  --title-grad: linear-gradient(120deg, #eef1fa 30%, #93a3d8 100%);
  --selfmsg-bg: linear-gradient(90deg, rgba(0, 150, 255, 0.05), rgba(123, 92, 255, 0.03));
  --selfmsg-border: rgba(0, 190, 255, 0.4);
  --reply-bg: linear-gradient(90deg, rgba(0, 150, 255, 0.06), rgba(123, 92, 255, 0.04));
  --reply-border: rgba(0, 190, 255, 0.4);
  --target-bg: linear-gradient(90deg, rgba(0, 150, 255, 0.08), rgba(123, 92, 255, 0.06));
  --target-border: rgba(0, 190, 255, 0.4);
  --radius: 16px;
}

:root[data-theme='midnight'][data-mode='light'] {
  --bg: #f2f4f9;
  --sidebar-bg: rgba(255, 255, 255, 0.8);
  --glass: rgba(255, 255, 255, 0.7);
  --glass2: rgba(240, 243, 250, 0.95);
  --border: rgba(20, 28, 46, 0.07);
  --border2: rgba(20, 28, 46, 0.18);
  --text: #131a2c;
  --muted: #5e6678;
  --muted2: #646c7d;
  --content-text: #39415a;
  --dcontent: #2c344b;
  --accent: #0091d5;
  --accent2: #6b4ee6;
  --accent-soft-bg: rgba(0, 145, 213, 0.12);
  --selection-bg: rgba(0, 145, 213, 0.22);
  --accent-text: #006bbd;
  --grad: linear-gradient(135deg, #0091d5 0%, #6b4ee6 100%);
  --grad-soft: linear-gradient(135deg, rgba(0, 145, 213, 0.1), rgba(107, 78, 230, 0.1));
  --green: #0b7c56;
  --red: #d31b44;
  --yellow: #a55a05;
  --input-bg: #ffffff;
  --logs-bg: #f4f6fb;
  --modal-bg: rgba(255, 255, 255, 0.96);
  --dropdown-bg: rgba(255, 255, 255, 0.98);
  --toast-bg: rgba(255, 255, 255, 0.96);
  --switch-track: rgba(20, 28, 46, 0.1);
  --aurora-opacity: 0.4;
  --aurora1: rgba(0, 145, 213, 0.08);
  --aurora2: rgba(107, 78, 230, 0.07);
  --aurora3: rgba(0, 113, 255, 0.05);
  --noise-opacity: 0.015;
  --shadow-card: 0 6px 26px rgba(20, 28, 46, 0.08);
  --glow-accent: rgba(0, 145, 213, 0.3);
  --title-grad: linear-gradient(120deg, #131a2c 30%, #46527d 100%);
}

:root[data-theme='nord'] {
  --bg: #2e3440;
  --sidebar-bg: #2b3140;
  --glass: #333a4a;
  --glass2: #3b4252;
  --border: rgba(216, 222, 233, 0.08);
  --border2: rgba(216, 222, 233, 0.18);
  --text: #eceff4;
  --muted: #9aa5b8;
  --muted2: #969ead;
  --content-text: #d8dee9;
  --dcontent: #e5e9f0;
  --accent: #88c0d0;
  --accent2: #81a1c1;
  --accent-soft-bg: rgba(136, 192, 208, 0.14);
  --selection-bg: rgba(136, 192, 208, 0.4);
  --accent-text: #88c0d0;
  --grad: linear-gradient(135deg, #88c0d0 0%, #81a1c1 100%);
  --grad-soft: linear-gradient(135deg, rgba(136, 192, 208, 0.14), rgba(129, 161, 193, 0.14));
  --green: #a3be8c;
  --red: #d79985;
  --yellow: #ebcb8b;
  --input-bg: #242933;
  --logs-bg: #242933;
  --modal-bg: #333a4a;
  --dropdown-bg: #3b4252;
  --toast-bg: #333a4a;
  --switch-track: #242933;
  --aurora-opacity: 0.7;
  --aurora1: rgba(136, 192, 208, 0.1);
  --aurora2: rgba(180, 142, 173, 0.09);
  --aurora3: rgba(129, 161, 193, 0.07);
  --noise-opacity: 0.024;
  --shadow-card: 0 10px 36px rgba(0, 0, 0, 0.3);
  --glow-accent: rgba(136, 192, 208, 0.45);
  --title-grad: linear-gradient(120deg, #eceff4 30%, #a7b8cc 100%);
  --selfmsg-bg: rgba(136, 192, 208, 0.08);
  --selfmsg-border: rgba(136, 192, 208, 0.5);
  --reply-bg: rgba(136, 192, 208, 0.09);
  --reply-border: rgba(136, 192, 208, 0.5);
  --target-bg: rgba(136, 192, 208, 0.12);
  --target-border: rgba(136, 192, 208, 0.55);
  --radius: 14px;
}

:root[data-theme='nord'][data-mode='light'] {
  --bg: #eceff4;
  --sidebar-bg: #e5e9f0;
  --glass: rgba(255, 255, 255, 0.65);
  --glass2: rgba(235, 239, 244, 0.95);
  --border: rgba(46, 52, 64, 0.09);
  --border2: rgba(46, 52, 64, 0.2);
  --text: #2e3440;
  --muted: #5b6779;
  --muted2: #5e6980;
  --content-text: #3b4252;
  --dcontent: #2e3440;
  --accent: #4c7ea0;
  --accent2: #5e81ac;
  --accent-soft-bg: rgba(94, 129, 172, 0.14);
  --selection-bg: rgba(94, 129, 172, 0.25);
  --accent-text: #3f6d94;
  --grad: linear-gradient(135deg, #5e81ac 0%, #81a1c1 100%);
  --grad-soft: linear-gradient(135deg, rgba(94, 129, 172, 0.14), rgba(136, 192, 208, 0.14));
  --green: #417646;
  --red: #b83e47;
  --yellow: #8a6308;
  --input-bg: #ffffff;
  --logs-bg: #f5f7fa;
  --modal-bg: rgba(255, 255, 255, 0.95);
  --dropdown-bg: rgba(255, 255, 255, 0.98);
  --toast-bg: rgba(255, 255, 255, 0.96);
  --switch-track: rgba(46, 52, 64, 0.12);
  --aurora-opacity: 0.5;
  --aurora1: rgba(94, 129, 172, 0.1);
  --aurora2: rgba(180, 142, 173, 0.09);
  --aurora3: rgba(136, 192, 208, 0.07);
  --noise-opacity: 0.02;
  --shadow-card: 0 8px 28px rgba(46, 52, 64, 0.08);
  --glow-accent: rgba(94, 129, 172, 0.4);
  --title-grad: linear-gradient(120deg, #2e3440 30%, #5e81ac 100%);
  --selfmsg-bg: rgba(94, 129, 172, 0.08);
  --selfmsg-border: rgba(94, 129, 172, 0.45);
  --reply-bg: rgba(94, 129, 172, 0.09);
  --reply-border: rgba(94, 129, 172, 0.45);
  --target-bg: rgba(94, 129, 172, 0.12);
  --target-border: rgba(94, 129, 172, 0.5);
}

:root[data-theme='dracula'] {
  --bg: #282a36;
  --sidebar-bg: #21222c;
  --glass: #2d2f3d;
  --glass2: #343746;
  --border: rgba(248, 248, 242, 0.07);
  --border2: rgba(248, 248, 242, 0.17);
  --text: #f8f8f2;
  --muted: #a3a7c2;
  --muted2: #8992b6;
  --content-text: #e2e2dc;
  --dcontent: #f8f8f2;
  --accent: #bd93f9;
  --accent2: #ff79c6;
  --accent-soft-bg: rgba(189, 147, 249, 0.16);
  --selection-bg: rgba(189, 147, 249, 0.4);
  --accent-text: #bd93f9;
  --grad: linear-gradient(135deg, #bd93f9 0%, #ff79c6 100%);
  --grad-soft: linear-gradient(135deg, rgba(189, 147, 249, 0.15), rgba(255, 121, 198, 0.15));
  --green: #50fa7b;
  --red: #ff6767;
  --yellow: #f1fa8c;
  --input-bg: #21222c;
  --logs-bg: #1e2029;
  --modal-bg: #2d2f3d;
  --dropdown-bg: #343746;
  --toast-bg: #2d2f3d;
  --switch-track: #1e2029;
  --aurora-opacity: 0.65;
  --aurora1: rgba(189, 147, 249, 0.12);
  --aurora2: rgba(255, 121, 198, 0.1);
  --aurora3: rgba(139, 233, 253, 0.07);
  --noise-opacity: 0.026;
  --shadow-card: 0 10px 38px rgba(0, 0, 0, 0.4);
  --glow-accent: rgba(189, 147, 249, 0.5);
  --title-grad: linear-gradient(120deg, #f8f8f2 30%, #bd93f9 100%);
  --selfmsg-bg: rgba(189, 147, 249, 0.08);
  --selfmsg-border: rgba(189, 147, 249, 0.5);
  --reply-bg: rgba(189, 147, 249, 0.09);
  --reply-border: rgba(189, 147, 249, 0.5);
  --target-bg: rgba(189, 147, 249, 0.12);
  --target-border: rgba(189, 147, 249, 0.55);
  --radius: 14px;
}

:root[data-theme='dracula'][data-mode='light'] {
  --bg: #f8f8f2;
  --sidebar-bg: #eeeeee;
  --glass: rgba(255, 255, 255, 0.7);
  --glass2: rgba(240, 240, 235, 0.95);
  --border: rgba(40, 42, 54, 0.09);
  --border2: rgba(40, 42, 54, 0.22);
  --text: #282a36;
  --muted: #56619b;
  --muted2: #686e87;
  --content-text: #44475a;
  --dcontent: #282a36;
  --accent: #7c3aed;
  --accent2: #d63384;
  --accent-soft-bg: rgba(124, 58, 237, 0.12);
  --selection-bg: rgba(124, 58, 237, 0.22);
  --accent-text: #6d28d9;
  --grad: linear-gradient(135deg, #7c3aed 0%, #d63384 100%);
  --grad-soft: linear-gradient(135deg, rgba(124, 58, 237, 0.12), rgba(214, 51, 132, 0.12));
  --green: #0b7a55;
  --red: #cd1a41;
  --yellow: #9d5604;
  --input-bg: #ffffff;
  --logs-bg: #f1f1ea;
  --modal-bg: rgba(255, 255, 255, 0.96);
  --dropdown-bg: rgba(255, 255, 255, 0.98);
  --toast-bg: rgba(255, 255, 255, 0.96);
  --switch-track: rgba(40, 42, 54, 0.12);
  --aurora-opacity: 0.5;
  --aurora1: rgba(124, 58, 237, 0.08);
  --aurora2: rgba(214, 51, 132, 0.07);
  --aurora3: rgba(139, 233, 253, 0.06);
  --noise-opacity: 0.02;
  --shadow-card: 0 8px 28px rgba(40, 42, 54, 0.09);
  --glow-accent: rgba(124, 58, 237, 0.35);
  --title-grad: linear-gradient(120deg, #282a36 30%, #7c3aed 100%);
  --selfmsg-bg: rgba(124, 58, 237, 0.07);
  --selfmsg-border: rgba(124, 58, 237, 0.45);
  --reply-bg: rgba(124, 58, 237, 0.08);
  --reply-border: rgba(124, 58, 237, 0.45);
  --target-bg: rgba(124, 58, 237, 0.1);
  --target-border: rgba(124, 58, 237, 0.5);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14.5px;
  line-height: 1.5;
  letter-spacing: -0.011em;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  transition: background 0.3s ease, color 0.3s ease;
}

::selection { background: var(--grad-soft); }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 10px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--muted2); background-clip: content-box; }

:focus-visible { outline: 2px solid var(--glow-accent); outline-offset: 2px; border-radius: 8px; }

/* ============ Aurora + bruit ============ */
.aurora { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; opacity: var(--aurora-opacity); transition: opacity 0.4s ease; }
.aurora span { position: absolute; border-radius: 50%; will-change: transform; }
.aurora .a1 {
  width: 55vw; height: 55vw; top: -22vw; left: -12vw;
  background: radial-gradient(circle, var(--aurora1) 0%, transparent 68%);
  animation: drift1 28s var(--ease) infinite alternate;
}
.aurora .a2 {
  width: 48vw; height: 48vw; bottom: -20vw; right: -10vw;
  background: radial-gradient(circle, var(--aurora2) 0%, transparent 68%);
  animation: drift2 34s var(--ease) infinite alternate;
}
.aurora .a3 {
  width: 36vw; height: 36vw; top: 30%; left: 42%;
  background: radial-gradient(circle, var(--aurora3) 0%, transparent 70%);
  animation: drift3 40s var(--ease) infinite alternate;
}
@keyframes drift1 { to { transform: translate(9vw, 7vh) scale(1.18); } }
@keyframes drift2 { to { transform: translate(-8vw, -9vh) scale(1.12); } }
@keyframes drift3 { to { transform: translate(6vw, -6vh) scale(0.9); } }

.noise {
  position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: var(--noise-opacity);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

@media (prefers-reduced-motion: reduce) {
  .aurora span { animation: none !important; }
  * { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

/* ============ Layout ============ */
.app { position: relative; z-index: 1; display: flex; height: 100vh; overflow: hidden; }

.main { position: relative; z-index: 1; flex: 1; overflow-y: auto; padding: 28px 34px 60px; scroll-behavior: smooth; }

/* ============ Sidebar ============ */
.sidebar {
  position: relative; z-index: 2;
  width: 250px; min-width: 250px;
  background: var(--sidebar-bg);
  backdrop-filter: blur(24px) saturate(150%);
  -webkit-backdrop-filter: blur(24px) saturate(150%);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  padding: 20px 14px 16px; gap: 6px;
}

.brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 20px; }
.brand-logo {
  width: 42px; height: 42px; border-radius: 13px;
  background: var(--grad);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 21px; color: #fff;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.35);
  transition: transform 0.3s var(--spring), box-shadow 0.3s ease;
}
.brand:hover .brand-logo { transform: rotate(-6deg) scale(1.06); }
.brand-name { display: block; font-weight: 750; font-size: 15.5px; letter-spacing: -0.02em; }
.brand-sub { display: block; font-size: 11px; color: var(--muted2); margin-top: 1px; }

.nav { display: flex; flex-direction: column; gap: 3px; flex: 1; overflow-y: auto; overflow-x: hidden; padding: 2px; margin: -2px; }
.nav-item {
  position: relative;
  display: flex; align-items: center; gap: 11px;
  padding: 9.5px 13px;
  border-radius: 12px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 550;
  font-size: 14px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: color 0.18s ease, background 0.18s ease, border-color 0.18s ease, transform 0.18s var(--ease);
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; opacity: 0.85; transition: opacity 0.18s ease; }
.nav-item:hover { color: var(--text); background: var(--glass2); transform: translateX(3px); }
.nav-item:hover svg { opacity: 1; }
.nav-item.active {
  color: var(--text);
  background: var(--grad-soft);
  border-color: var(--glow-accent);
}
.nav-item.active::before {
  content: ""; position: absolute; left: -1px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 55%; border-radius: 4px;
  background: var(--grad);
}
.nav-item .nav-badge {
  margin-left: auto; font-size: 11px; font-weight: 700; color: var(--muted);
  background: var(--glass2); border: 1px solid var(--border2);
  padding: 1px 8px; border-radius: 20px;
}

.nav-sub {
  display: flex; flex-direction: column; gap: 2px;
  margin: 3px 0 8px 18px; padding-left: 9px;
  border-left: 1px solid var(--border);
  animation: subin 0.25s var(--ease) both;
}
@keyframes subin { from { opacity: 0; transform: translateX(-6px); } }
.nav-sub-item {
  color: var(--muted); text-decoration: none;
  font-size: 14px; font-weight: 500;
  padding: 6.5px 11px; border-radius: 9px;
  transition: all 0.15s ease;
  display: flex; align-items: center; gap: 6px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.nav-sub-item:hover { color: var(--text); background: var(--glass2); transform: translateX(3px); }
.nav-sub-item.active { color: var(--accent-text); background: var(--grad-soft); font-weight: 600; }
.nav-sub-item .st-dot { width: 7px; height: 7px; }

.sidebar-bottom { display: flex; flex-direction: column; gap: 8px; padding-top: 12px; border-top: 1px solid var(--border); }
.points-card {
  display: flex; align-items: center; gap: 11px;
  background: var(--grad-soft);
  border: 1px solid var(--glow-accent);
  border-radius: 13px; padding: 11px 13px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.points-card:hover { border-color: var(--accent); }
.points-icon { color: var(--accent); font-size: 17px; }
.points-value { font-weight: 800; font-size: 16px; display: block; line-height: 1.15; letter-spacing: -0.02em; }
.points-label { font-size: 11px; color: var(--muted); }

.account { display: flex; align-items: center; gap: 10px; padding: 7px 6px 2px; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--glass2); color: var(--muted);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 15px;
  background-size: cover; background-position: center;
  border: 2px solid var(--border2);
  flex-shrink: 0;
  transition: box-shadow 0.2s ease;
}
.account:hover .avatar { box-shadow: 0 0 0 2px var(--glow-accent); }
.account-name { display: block; font-weight: 650; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 130px; }
.account-status { display: flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--muted); }
.side-actions { margin-left: auto; display: flex; gap: 4px; }

.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.dot-on { background: var(--green); }
.dot-off { background: var(--red); }
.dot-mid { background: var(--yellow); }

/* ============ Page head ============ */
.page-head { margin-bottom: 22px; display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; flex-wrap: wrap; animation: fadeup 0.3s var(--ease) both; }
.page-title {
  font-size: 23px; font-weight: 800; letter-spacing: -0.03em;
  background: var(--title-grad);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.page-sub { color: var(--muted); font-size: 13px; margin-top: 4px; }
.head-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.autosave-indicator {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12px; font-weight: 600; color: var(--muted);
  border: 1px solid var(--border); border-radius: 999px;
  background: var(--glass2); padding: 6px 11px;
  white-space: nowrap;
}
.autosave-indicator .st-dot { margin: 0; }
.autosave-indicator.error { color: var(--red); border-color: rgba(248, 113, 113, 0.45); }

@keyframes fadeup { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ============ Cartes verre ============ */
.card {
  position: relative;
  background: var(--glass);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-card), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  transition: border-color 0.25s ease, transform 0.25s var(--ease), box-shadow 0.25s ease;
}
.card:hover { border-color: var(--border2); }
.card h3 { font-size: 14.5px; font-weight: 700; margin-bottom: 16px; padding-bottom: 11px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 8px; letter-spacing: -0.01em; }
.card h3 .hint { font-weight: 450; color: var(--muted2); font-size: 12px; }

.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: 1fr 1fr; }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1100px) {
  .grid.cols-4 { grid-template-columns: repeat(2, 1fr); }
  .grid.cols-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 820px) {
  .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; }
  .sidebar { width: 70px; min-width: 70px; padding: 14px 8px; }
  .brand-text, .account-info, .points-info, .nav-item span.lbl { display: none; }
  .nav-item { justify-content: center; }
  .nav-sub { display: none; }
  .main { padding: 20px 16px 50px; }
}

/* ============ Stats ============ */
.stat-card {
  position: relative; overflow: hidden;
  background: var(--glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 17px 19px;
  transition: border-color 0.25s ease, transform 0.25s var(--ease), box-shadow 0.25s ease;
  animation: fadeup 0.35s var(--ease) both;
}
.stat-card:nth-child(2) { animation-delay: 0.04s; }
.stat-card:nth-child(3) { animation-delay: 0.08s; }
.stat-card:nth-child(4) { animation-delay: 0.12s; }
.stat-card:hover { transform: translateY(-2px); border-color: var(--border2); box-shadow: var(--shadow-card); }
.stat-card::before {
  content: ""; position: absolute; top: 0; left: 14px; right: 14px; height: 1px;
  background: var(--grad);
  opacity: 0.7;
}
.stat-value { font-size: 27px; font-weight: 800; letter-spacing: -0.04em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-label { color: var(--muted); font-size: 12.5px; margin-top: 3px; }
.stat-trend { font-size: 11.5px; color: var(--muted2); margin-top: 6px; }

/* ============ Boutons ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  background: var(--glass2); color: var(--text);
  border: 1px solid var(--border2);
  padding: 8.5px 15px; border-radius: 11px;
  font-size: 13px; font-weight: 600; font-family: inherit;
  cursor: pointer; transition: all 0.18s var(--ease);
  text-decoration: none;
}
.btn:hover { border-color: var(--glow-accent); background: var(--glass2); transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(0.98); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.btn-primary {
  background: var(--grad); border: none; color: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}
.btn-primary:hover { transform: translateY(-1px); filter: saturate(1.12); box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25); }
.btn-primary:active { transform: scale(0.98); }
.btn-danger { background: rgba(251, 113, 133, 0.1); border-color: rgba(251, 113, 133, 0.4); color: var(--red); }
.btn-danger:hover { border-color: var(--red); color: #fff; background: rgba(251, 113, 133, 0.16); }
.btn-sm { padding: 5.5px 11px; font-size: 12px; border-radius: 9px; }
.btn-icon { padding: 6px 9px; }

/* ============ Inputs ============ */
.input, .select, .textarea {
  width: 100%;
  background: var(--input-bg);
  border: 1px solid var(--border2);
  color: var(--text);
  border-radius: 11px;
  padding: 9.5px 13px;
  font-size: 13.5px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--glow-accent);
  box-shadow: 0 0 0 3px var(--glass2);
}
.input::placeholder, .textarea::placeholder { color: var(--muted2); }
.textarea { resize: vertical; min-height: 70px; }
.select { cursor: pointer; }
.select option { background: var(--dropdown-bg); color: var(--text); }
.field { margin-bottom: 14px; }
.field > label:not(.switch) { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 5px; letter-spacing: 0.01em; }
.field .help { font-size: 11.5px; color: var(--muted2); margin-top: 5px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
@media (max-width: 700px) { .field-row, .field-row-3 { grid-template-columns: 1fr; } }

/* ============ Switch ============ */
.switch { display: inline-flex !important; align-items: center; gap: 9px; cursor: pointer; user-select: none; position: relative; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; pointer-events: none; }
.switch .track {
  display: inline-block;
  width: 40px; height: 22px; border-radius: 20px;
  background: var(--switch-track);
  border: 1px solid var(--border2);
  position: relative;
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  flex-shrink: 0;
}
.switch .track::after {
  content: ""; position: absolute; top: 2.5px; left: 3px;
  width: 15px; height: 15px; border-radius: 50%;
  background: #dfe4f0;
  transition: left 0.25s var(--spring), background 0.2s ease, width 0.2s var(--spring);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}
.switch input:checked + .track {
  background: var(--grad);
  border-color: transparent;
  
}
.switch input:checked + .track::after { left: 21px; background: #fff; }
.switch:active .track::after { width: 18px; }
.switch input:checked:active + .track::after { left: 18px; }
.switch .sw-label { font-size: 13px; font-weight: 600; }

/* ============ Badges ============ */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 700;
  padding: 2.5px 9px; border-radius: 20px;
  background: var(--glass2); border: 1px solid var(--border2); color: var(--muted);
  letter-spacing: 0.01em;
}
.badge.blue { background: rgba(0, 170, 255, 0.13); border-color: rgba(0, 170, 255, 0.4); color: #6fc3ff; }
.badge.green { background: rgba(52, 211, 153, 0.12); border-color: rgba(52, 211, 153, 0.4); color: var(--green); }
.badge.red { background: rgba(251, 113, 133, 0.12); border-color: rgba(251, 113, 133, 0.4); color: var(--red); }
.badge.yellow { background: rgba(251, 191, 36, 0.12); border-color: rgba(251, 191, 36, 0.4); color: var(--yellow); }
.badge.purple { background: rgba(139, 92, 246, 0.14); border-color: rgba(139, 92, 246, 0.45); color: #c4b5fd; }

[data-mode='light'] .badge.blue { color: #0369a1; }
[data-mode='light'] .badge.purple { color: #6d28d9; }

/* ============ Bannières d'état ============ */
.banner {
  display: flex; align-items: center; gap: 12px;
  border-radius: 14px; padding: 14px 18px; margin-bottom: 16px;
  border: 1px solid var(--border); background: var(--glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  flex-wrap: wrap;
  animation: fadeup 0.3s var(--ease) both;
}
.banner .banner-icon { font-size: 20px; }
.banner.green { border-color: rgba(52, 211, 153, 0.35); background: rgba(52, 211, 153, 0.05); }
.banner.red { border-color: rgba(251, 113, 133, 0.35); background: rgba(251, 113, 133, 0.05); }
.banner.yellow { border-color: rgba(251, 191, 36, 0.32); background: rgba(251, 191, 36, 0.05); }
.banner-title { font-weight: 700; }
.banner-sub { color: var(--muted); font-size: 12.5px; }
.banner .spacer { flex: 1; }

/* ============ Graphique ============ */
.chart { display: flex; align-items: flex-end; gap: 6px; height: 145px; padding-top: 10px; }
.chart .bar-wrap { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.chart .bar {
  width: 100%; max-width: 34px;
  background: var(--grad);
  border-radius: 7px 7px 3px 3px;
  min-height: 3px;
  position: relative;
  opacity: 0.85;
  transition: opacity 0.15s ease, box-shadow 0.15s ease, transform 0.15s var(--ease);
  transform-origin: bottom;
}
.chart .bar:hover { opacity: 1; transform: scaleY(1.02); }
.chart .bar.muted-bar { background: var(--border2); }
.chart .bar-day { font-size: 10px; color: var(--muted2); font-variant-numeric: tabular-nums; }
.chart .bar-tip {
  position: absolute; bottom: calc(100% + 7px); left: 50%; transform: translateX(-50%);
  background: var(--dropdown-bg); border: 1px solid var(--border2);
  padding: 4px 9px; border-radius: 8px; font-size: 11px;
  white-space: nowrap; display: none; z-index: 5;
  box-shadow: var(--shadow-card);
  color: var(--text);
}
.chart .bar:hover .bar-tip { display: block; }

/* ============ Listes top ============ */
.top-list { display: flex; flex-direction: column; gap: 10px; }
.top-row { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.top-row .rank { color: var(--muted2); font-size: 11px; width: 16px; font-weight: 800; font-variant-numeric: tabular-nums; }
.top-row .name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-row .bar-line { flex: 1; height: 6px; background: var(--switch-track); border-radius: 5px; overflow: hidden; }
.top-row .bar-line i { display: block; height: 100%; background: var(--grad); border-radius: 5px; }
.top-row .count { color: var(--muted); font-size: 12px; min-width: 34px; text-align: right; font-variant-numeric: tabular-nums; }

/* ============ Vue Discord ============ */
.discord-layout { display: flex; flex-direction: column; height: calc(100vh - 112px); }
.discord-toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.discord-toolbar .select { width: auto; min-width: 240px; }
.msgs-pane {
  flex: 1; overflow-y: auto;
  background: var(--glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 6px 10px;
  box-shadow: var(--shadow-card);
}
.day-sep { display: flex; align-items: center; gap: 12px; margin: 14px 18px; color: var(--muted2); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; }
.day-sep::before, .day-sep::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.dmsg { display: flex; gap: 13px; padding: 5px 18px; position: relative; border-radius: 10px; }
.dmsg:hover { background: var(--glass2); }
.dmsg.continued { padding-top: 1px; padding-bottom: 1px; }
.dmsg .davatar {
  width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 15px; color: #fff; margin-top: 2px;
  background-size: cover; background-position: center;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}
.dmsg .dbody { min-width: 0; flex: 1; }
.dmsg .dhead { display: flex; align-items: baseline; gap: 8px; }
.dmsg .dauthor { font-weight: 700; font-size: 14px; }
.dmsg .dbot-tag {
  font-size: 9px; font-weight: 800; letter-spacing: 0.06em;
  background: var(--grad); color: #fff;
  border-radius: 5px; padding: 1.5px 6px; vertical-align: 2px;
}
.dmsg .dtime { font-size: 11px; color: var(--muted2); font-variant-numeric: tabular-nums; }
.dmsg .dcontent { font-size: 14px; color: var(--dcontent); word-wrap: break-word; white-space: pre-wrap; }
.dmsg .dcontent a { color: var(--accent); }
.dmsg.self-msg .dcontent { color: var(--text); }
.dmsg.self-msg {
  background: var(--selfmsg-bg);
  border-left: 2px solid var(--selfmsg-border);
  margin-left: 16px; padding-left: 14px; border-radius: 6px;
}
.dmsg .dreply-ref {
  font-size: 11.5px; color: var(--muted2); margin-bottom: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dmsg .dreply-ref b { color: var(--muted); }
.dmsg .dattach img { max-width: 320px; max-height: 220px; border-radius: 10px; margin-top: 5px; display: block; border: 1px solid var(--border); }
.dmsg .msg-actions {
  position: absolute; right: 14px; top: -12px;
  background: var(--dropdown-bg); border: 1px solid var(--border2);
  border-radius: 9px; padding: 2px;
  display: none; gap: 2px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--shadow-card);
}
.dmsg:hover .msg-actions { display: flex; }
.msg-actions button {
  background: none; border: none; color: var(--muted); cursor: pointer;
  padding: 4px 9px; border-radius: 6px; font-size: 13px; font-family: inherit;
}
.msg-actions button:hover { background: var(--grad-soft); color: var(--accent); }

.compose { margin-top: 12px; }
.reply-banner {
  display: flex; align-items: center; gap: 8px;
  background: var(--glass2); border: 1px solid var(--border2);
  border-bottom: none; border-radius: 11px 11px 0 0;
  padding: 7px 12px; font-size: 12.5px; color: var(--muted);
}
.reply-banner .x { margin-left: auto; cursor: pointer; color: var(--muted); background: none; border: none; font-size: 14px; }
.compose-box { display: flex; gap: 10px; }
.compose-box textarea {
  flex: 1; background: var(--input-bg); border: 1px solid var(--border2);
  border-radius: 11px; color: var(--text); padding: 11px 14px;
  font-family: inherit; font-size: 14px; resize: none; height: 46px; outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}
.compose-box textarea:focus { border-color: var(--glow-accent); box-shadow: 0 0 0 3px var(--glass2); }
.compose-hint { font-size: 11px; color: var(--muted2); margin-top: 6px; }
.empty-state { text-align: center; color: var(--muted); padding: 60px 20px; }
.empty-state .big { font-size: 34px; margin-bottom: 10px; }

/* ============ Historique ============ */
.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; align-items: center; }
.filters .input { width: 260px; }
.filters .select { width: auto; }
.hrow {
  display: flex; align-items: flex-start; gap: 13px;
  background: var(--glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: 13px; padding: 13px 16px; margin-bottom: 9px;
  cursor: pointer;
  transition: border-color 0.18s ease, transform 0.18s var(--ease), box-shadow 0.18s ease;
}
.hrow:hover { border-color: var(--glow-accent); transform: translateX(3px); box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15); }
.hrow .htime { color: var(--muted2); font-size: 11.5px; min-width: 96px; padding-top: 2px; font-variant-numeric: tabular-nums; }
.hrow .hbody { flex: 1; min-width: 0; }
.hrow .hhead { display: flex; gap: 8px; align-items: center; margin-bottom: 3px; flex-wrap: wrap; }
.hrow .hauthor { font-weight: 700; font-size: 13.5px; }
.hrow .hchannel { color: var(--muted2); font-size: 11.5px; }
.hrow .hcontent { font-size: 13.5px; color: var(--content-text); word-break: break-word; }
.hrow .hreply {
  margin-top: 8px; padding: 8px 12px;
  background: var(--reply-bg);
  border-left: 3px solid var(--reply-border);
  border-radius: 7px; font-size: 13px; color: var(--text); word-break: break-word;
}
.hrow .hreply .rlabel { font-size: 10.5px; color: var(--accent-text); font-weight: 700; display: block; margin-bottom: 2px; }
.pager { display: flex; gap: 8px; align-items: center; justify-content: center; margin-top: 16px; }
.pager .pageinfo { color: var(--muted); font-size: 12.5px; }

.ctx-wrap { max-width: 880px; }
.ctx-line { display: flex; gap: 12px; padding: 9px 14px; border-radius: 10px; font-size: 13.5px; }
.ctx-line .ctime { color: var(--muted2); font-size: 11.5px; min-width: 90px; padding-top: 2px; }
.ctx-line .cauthor { font-weight: 700; min-width: 110px; max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ctx-line .ccontent { flex: 1; word-break: break-word; color: var(--content-text); }
.ctx-line.target {
  background: var(--target-bg);
  border: 1px solid var(--target-border);
  margin: 6px 0;
}
.ctx-arrow-row { display: flex; gap: 8px; justify-content: center; padding: 10px 0; }

/* ============ Mémoire ============ */
.mem-card {
  background: var(--glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: 13px; padding: 14px 16px; margin-bottom: 10px;
  transition: border-color 0.18s ease, transform 0.18s var(--ease);
}
.mem-card:hover { border-color: var(--border2); transform: translateY(-1px); }
.mem-head { display: flex; align-items: center; gap: 9px; margin-bottom: 7px; flex-wrap: wrap; }
.mem-subject { font-weight: 700; font-size: 13.5px; }
.mem-content { font-size: 13.5px; color: var(--content-text); white-space: pre-wrap; word-break: break-word; }
.mem-foot { display: flex; gap: 6px; align-items: center; margin-top: 11px; }
.mem-date { color: var(--muted2); font-size: 11px; margin-left: auto; }
.mem-form { background: var(--glass2); border-radius: 13px; padding: 16px; margin-bottom: 14px; }

/* ============ Boutique ============ */
.shop-hero {
  position: relative; overflow: hidden;
  background: var(--grad-soft);
  border: 1px solid var(--glow-accent);
  border-radius: 20px;
  padding: 38px 30px; text-align: center; margin-bottom: 16px;
}
.shop-hero .shop-icon { font-size: 44px; margin-bottom: 12px; display: inline-block; animation: floaty 3.5s ease-in-out infinite; }
@keyframes floaty { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
.shop-hero h2 { font-size: 22px; margin-bottom: 6px; letter-spacing: -0.02em; }
.shop-hero p { color: var(--muted); font-size: 13.5px; max-width: 520px; margin: 0 auto 18px; }

/* ============ Logs ============ */
.logs-box {
  background: var(--logs-bg); border: 1px solid var(--border);
  border-radius: 12px; padding: 12px 14px;
  font-family: Consolas, "Cascadia Mono", "Courier New", monospace;
  font-size: 11.5px; max-height: 260px; overflow-y: auto; line-height: 1.75;
}
.logs-box .l-info { color: var(--green); }
.logs-box .l-warn { color: var(--yellow); }
.logs-box .l-error { color: var(--red); }
.logs-box .l-debug { color: var(--muted2); }
.logs-box .l-time { color: var(--muted2); margin-right: 8px; }

.card.mb-0 { margin-bottom: 0; }

/* ============ Dropdowns modèles/providers ============ */
.model-drop {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0;
  background: var(--dropdown-bg);
  backdrop-filter: blur(24px) saturate(150%);
  -webkit-backdrop-filter: blur(24px) saturate(150%);
  border: 1px solid var(--border2);
  border-radius: 13px; padding: 10px; z-index: 60;
  box-shadow: var(--shadow-card);
  display: none;
  animation: dropin 0.16s var(--ease) both;
}
@keyframes dropin { from { opacity: 0; transform: translateY(-5px) scale(0.985); } }
.model-drop .input { margin-bottom: 8px; }
.model-drop-list { max-height: 400px; overflow-y: auto; }
.model-item {
  padding: 7.5px 12px; border-radius: 9px;
  font-size: 13px; cursor: pointer; color: var(--content-text);
  transition: background 0.1s ease, color 0.1s ease;
  display: flex; align-items: center;
}
.model-item:hover { background: var(--grad-soft); color: var(--text); }
.model-item.active { background: var(--grad-soft); color: var(--accent-text); }
.model-empty { padding: 14px; color: var(--muted); font-size: 12.5px; text-align: center; }
.model-drop-count { font-size: 11px; color: var(--muted2); margin-top: 7px; text-align: right; font-variant-numeric: tabular-nums; }

.provider-btn { display: flex; align-items: center; justify-content: space-between; gap: 8px; cursor: pointer; font-family: inherit; text-align: left; }

.st-dot {
  display: inline-block; width: 10px; height: 10px;
  border-radius: 50%; flex-shrink: 0; vertical-align: -1px;
}
.st-ok { background: var(--green); }
.st-warn { background: var(--yellow); }
.st-error { background: var(--red); }
.st-none { background: var(--muted2); }
#provider-btn-label .st-dot, #provider-drop-list .st-dot { margin-right: 2px; }

/* ============ Assistant ============ */
.assist-step { display: flex; gap: 11px; align-items: flex-start; margin-bottom: 10px; font-size: 13.5px; }
.step-num {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--grad); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 800; flex-shrink: 0;
}
.snippet-box {
  background: var(--logs-bg); border: 1px solid var(--border2);
  border-radius: 10px; padding: 10px 12px;
  font-family: Consolas, "Cascadia Mono", monospace;
  font-size: 11px; color: var(--muted);
  word-break: break-all; max-height: 150px; overflow-y: auto;
  margin-top: 4px; user-select: all;
}
.assist-user { display: flex; align-items: center; gap: 12px; padding: 10px 12px; background: rgba(52, 211, 153, 0.07); border: 1px solid rgba(52, 211, 153, 0.3); border-radius: 13px; }
.assist-user img, .assist-user .avatar { width: 38px; height: 38px; border-radius: 50%; }
.guild-list {
  max-height: 340px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 3px;
  border: 1px solid var(--border); border-radius: 11px;
  padding: 6px;
}
.guild-row {
  display: flex; align-items: center; gap: 10px;
  padding: 7.5px 10px; border-radius: 9px; cursor: pointer;
  transition: background 0.12s ease;
}
.guild-row:hover { background: var(--glass2); }
.guild-row input { accent-color: var(--accent2); width: 16px; height: 16px; flex-shrink: 0; }
.guild-row img { width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0; }
.guild-row .g-name { font-weight: 600; font-size: 13.5px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.guild-row .g-meta { color: var(--muted2); font-size: 11.5px; flex-shrink: 0; }
.assist-toolbar { display: flex; gap: 8px; align-items: center; margin-top: 9px; flex-wrap: wrap; }

.settings-wrap { max-width: 1760px; }
.settings-wrap .card { padding: 24px 28px; }
.settings-wrap .field { margin-bottom: 16px; }
.field-row-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
@media (max-width: 1200px) { .field-row-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 700px) { .field-row-4 { grid-template-columns: 1fr; } }
.settings-wrap .field-row, .settings-wrap .field-row-3 { gap: 14px; }

/* ============ Supervision ============ */
.pa-card {
  background: var(--glass2);
  border: 1px solid var(--border);
  border-radius: 13px; padding: 14px 16px; margin-bottom: 12px;
  animation: fadeup 0.25s var(--ease) both;
}
.pa-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.pa-msg {
  background: var(--input-bg); border: 1px solid var(--border);
  border-radius: 9px; padding: 9px 12px;
  font-size: 13px; color: var(--content-text);
  white-space: pre-wrap; word-break: break-word;
}
.nav-badge.badge-pending {
  background: rgba(251, 191, 36, 0.16);
  border-color: rgba(251, 191, 36, 0.55);
  color: var(--yellow);
}

.score-bar { height: 5px; background: var(--switch-track); border-radius: 4px; overflow: hidden; margin: 8px 0; }
.score-bar i { display: block; height: 100%; border-radius: 4px; }
.score-bar .sf-green { background: var(--green); }
.score-bar .sf-yellow { background: var(--yellow); }
.score-bar .sf-red { background: var(--red); }

/* ============ Modal ============ */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(2, 3, 6, 0.72);
  display: flex; align-items: center; justify-content: center; z-index: 90;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: fadein 0.2s ease both;
}
@keyframes fadein { from { opacity: 0; } }
.modal {
  background: var(--modal-bg);
  backdrop-filter: blur(28px) saturate(150%);
  -webkit-backdrop-filter: blur(28px) saturate(150%);
  border: 1px solid var(--border2);
  border-radius: 20px; padding: 24px; width: min(580px, 92vw);
  max-height: 86vh; overflow-y: auto;
  box-shadow: var(--shadow-card), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  animation: modalin 0.25s var(--spring) both;
}
@keyframes modalin { from { opacity: 0; transform: translateY(14px) scale(0.97); } }
.modal h3 { margin-bottom: 14px; }
.modal-actions { display: flex; gap: 9px; justify-content: flex-end; margin-top: 16px; }
.assist-modal { position: relative; width: min(980px, 96vw); max-height: 92vh; }
.assist-modal h3 { padding-right: 38px; }
.assist-close-x {
  position: absolute; top: 12px; right: 12px; z-index: 2;
  width: 32px; height: 32px; border-radius: 9px;
  border: 1px solid var(--border); background: var(--input-bg); color: var(--muted);
  cursor: pointer; font-size: 20px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  transition: color 0.12s ease, background 0.12s ease, border-color 0.12s ease;
}
.assist-close-x:hover { color: var(--text); border-color: var(--border2); background: var(--glass2); }

/* Mode navigateur intégré : grande fenêtre 70-80 % de l'écran */
.assist-modal-browser {
  width: min(1800px, 94vw);
  height: min(94vh, 1120px);
  max-height: 94vh;
  padding: 18px 22px;
  display: flex; flex-direction: column;
  overflow: auto;
}
.assist-modal-browser h3 { margin-bottom: 8px; padding-right: 40px; }
.assist-modal-browser .assist-tabs { margin-bottom: 8px; }
.assist-modal-browser #assist-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.assist-modal-browser #assist-panel-browser { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.assist-modal-browser .ab-note { margin-bottom: 6px; }
.assist-modal-browser .ab-frame { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.assist-modal-browser .ab-stage { flex: 1; min-height: 240px; aspect-ratio: auto; }
.assist-modal-browser .ab-actions { margin-top: 8px; }
.assist-modal-browser .modal-actions { display: none; }

.assist-tabs {
  display: flex; gap: 4px; border-bottom: 1px solid var(--border);
  margin-bottom: 14px;
}
.assist-tab {
  background: none; border: none; border-bottom: 2px solid transparent;
  color: var(--muted); padding: 8px 12px; font: inherit; font-size: 13px;
  font-weight: 700; cursor: pointer; transition: color 0.12s ease, border-color 0.12s ease;
}
.assist-tab:hover { color: var(--text); }
.assist-tab.active { color: var(--text); border-bottom-color: var(--accent); }

.ab-note { margin-bottom: 10px; }
.ab-frame {
  border: 1px solid var(--border2); border-radius: 12px;
  overflow: hidden; background: #05070b;
}
.ab-toolbar {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 9px; background: var(--glass2);
  border-bottom: 1px solid var(--border);
}
.ab-btn {
  width: 28px; height: 28px; flex-shrink: 0;
  border-radius: 7px; border: 1px solid var(--border);
  background: var(--input-bg); color: var(--text);
  cursor: pointer; font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.ab-btn:hover { background: var(--glass2); border-color: var(--border2); }
.ab-url {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 7px;
  font-size: 12px; color: var(--muted);
  background: var(--input-bg); border: 1px solid var(--border);
  border-radius: 7px; padding: 6px 10px;
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.ab-url span:last-child { overflow: hidden; text-overflow: ellipsis; }
.ab-stage {
  position: relative; aspect-ratio: 16 / 10;
  background: #05070b; outline: none;
  cursor: default; user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
  overflow: hidden;
}
.ab-stage img {
  width: 100%; height: 100%; display: block;
  object-fit: contain; pointer-events: none;
  -webkit-user-drag: none;
}
.ab-overlay {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 12px;
  background: rgba(5, 7, 11, 0.86); color: var(--muted);
  font-size: 13px; text-align: center; padding: 24px;
}
.ab-actions {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-top: 12px; flex-wrap: wrap;
}
@media (max-width: 700px) {
  .assist-modal { padding: 16px; }
  .assist-modal-browser { width: 96vw; height: 94vh; padding: 12px; }
  .assist-modal-browser h3 { font-size: 17px; }
  .assist-modal-browser .ab-note { display: none; }
  .ab-actions .btn { width: 100%; justify-content: center; }
}

/* ============ Toasts ============ */
.toasts { position: fixed; bottom: 22px; right: 22px; display: flex; flex-direction: column; gap: 9px; z-index: 100; }
.toast {
  background: var(--toast-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border2);
  border-left: 3px solid var(--accent);
  border-radius: 12px; padding: 12px 17px;
  font-size: 13px; font-weight: 600;
  box-shadow: var(--shadow-card);
  animation: toastin 0.3s var(--spring) both;
  max-width: 380px;
}
.toast.error { border-left-color: var(--red); }
.toast.success { border-left-color: var(--green); }
@keyframes toastin { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }

.spin {
  display: inline-block; width: 14px; height: 14px; vertical-align: -2px;
  border: 2px solid var(--border2); border-top-color: var(--accent);
  border-radius: 50%; animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============ Skeletons ============ */
.skeleton {
  border-radius: 10px;
  background: var(--glass2);
  animation: shimmer 1.4s linear infinite;
}
@keyframes shimmer { to { opacity: 0.5; } }

/* ============ View transitions ============ */
::view-transition-old(root) { animation: vt-out 0.16s ease both; }
::view-transition-new(root) { animation: vt-in 0.22s var(--ease) both; }
@keyframes vt-out { to { opacity: 0; transform: translateY(-7px); } }
@keyframes vt-in { from { opacity: 0; transform: translateY(9px); } }

/* ============ Sélecteur de thèmes ============ */
.theme-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 12px; margin-bottom: 6px; }
.theme-card {
  position: relative; text-align: left;
  background: var(--glass); border: 1px solid var(--border2);
  border-radius: 14px; padding: 14px 15px; cursor: pointer;
  font-family: inherit; color: var(--text);
  transition: all 0.18s var(--ease);
}
.theme-card:hover { transform: translateY(-2px); border-color: var(--glow-accent); }
.theme-card.selected { border-color: var(--accent); box-shadow: 0 0 0 3px var(--glass2); }
.theme-card .t-name { font-weight: 700; font-size: 13.5px; display: flex; align-items: center; justify-content: space-between; }
.theme-card .t-name .check { color: var(--accent); opacity: 0; transition: opacity 0.15s ease; }
.theme-card.selected .t-name .check { opacity: 1; }
.theme-card .t-desc { font-size: 11.5px; color: var(--muted); margin-top: 4px; }
.theme-card .t-palette { display: flex; gap: 5px; margin-top: 10px; }
.theme-card .t-palette i { width: 18px; height: 18px; border-radius: 6px; border: 1px solid rgba(255, 255, 255, 0.1); }

.mode-seg { display: inline-flex; background: var(--glass2); border: 1px solid var(--border2); border-radius: 12px; padding: 4px; gap: 4px; }
.mode-seg button {
  background: none; border: none; color: var(--muted);
  padding: 7px 16px; border-radius: 9px; cursor: pointer;
  font-family: inherit; font-size: 13px; font-weight: 600;
  transition: all 0.15s ease;
}
.mode-seg button:hover { color: var(--text); }
.mode-seg button.active { background: var(--grad); color: #fff; }

/* ============ Utilitaires ============ */
.text-muted { color: var(--muted); }
.text-small { font-size: 12px; }
.mt-0 { margin-top: 0; } .mb-0 { margin-bottom: 0; }
.link { color: var(--accent-text); text-decoration: none; transition: color 0.12s ease; }
.link:hover { text-decoration: underline; }

/* ============ Sessions actives ============ */
.session-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; margin-bottom: 6px;
  border: 1px solid var(--border); border-radius: 9px;
  font-size: 12px;
}
.session-row .s-date { color: var(--muted2); font-variant-numeric: tabular-nums; flex-shrink: 0; }
.session-row .s-ip { color: var(--muted); flex-shrink: 0; }
.session-row .s-ua {
  flex: 1; min-width: 0;
  color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.session-row .s-exp { color: var(--muted2); flex-shrink: 0; font-variant-numeric: tabular-nums; }
