/* ── Thème sombre (défaut) ───────────────────────────── */
:root,
[data-theme="dark"] {
  --bg:        #080c14;
  --panel:     #0e1520;
  --panel2:    #131d2e;
  --line:      #1e2d45;
  --text:      #e8edf5;
  --muted:     #6b80a0;
  --blue:      #4a9eff;
  --blue2:     #2272cc;
  --red:       #ff4d5a;
  --gold:      #c9a227;
  --grey:      #8a9ab5;
  --shadow:    0 18px 45px rgba(0,0,0,.38);
  --input-bg:  #0a1020;
  --drop-bg:   #080c14;
  --chip-bg:   #111e33;
  --deep-bg:   #07090f;
  --toast-bg:  #0e1a2e;
  --toast-br:  #1e3560;
  --drop-border: #1e3560;
  --green:     var(--blue);
  --green2:    var(--blue2);
  --amber:     var(--gold);
  color-scheme: dark;
}

/* ── Thème clair ─────────────────────────────────────── */
[data-theme="light"] {
  --bg:        #f0f2f5;
  --panel:     #ffffff;
  --panel2:    #e8ecf2;
  --line:      #d0d8e4;
  --text:      #111827;
  --muted:     #6b7280;
  --blue:      #2563eb;
  --blue2:     #1d4ed8;
  --red:       #dc2626;
  --gold:      #b45309;
  --grey:      #6b7280;
  --shadow:    0 4px 24px rgba(0,0,0,.10);
  --input-bg:  #ffffff;
  --drop-bg:   #f5f7fa;
  --chip-bg:   #e2e8f0;
  --deep-bg:   #edf0f4;
  --toast-bg:  #1e293b;
  --toast-br:  #334155;
  --drop-border: #c8d5e8;
  --green:     var(--blue);
  --green2:    var(--blue2);
  --amber:     var(--gold);
  color-scheme: light;
}

/* ── Thème automatique (suit le système) ────────────── */
@media (prefers-color-scheme: light) {
  [data-theme="auto"] {
    --bg:        #f0f2f5;
    --panel:     #ffffff;
    --panel2:    #e8ecf2;
    --line:      #d0d8e4;
    --text:      #111827;
    --muted:     #6b7280;
    --blue:      #2563eb;
    --blue2:     #1d4ed8;
    --red:       #dc2626;
    --gold:      #b45309;
    --grey:      #6b7280;
    --shadow:    0 4px 24px rgba(0,0,0,.10);
    --input-bg:  #ffffff;
    --drop-bg:   #f5f7fa;
    --chip-bg:   #e2e8f0;
    --deep-bg:   #edf0f4;
    --toast-bg:  #1e293b;
    --toast-br:  #334155;
    --drop-border: #c8d5e8;
    color-scheme: light;
  }
}
@media (prefers-color-scheme: dark) {
  [data-theme="auto"] {
    --bg:        #080c14;
    --panel:     #0e1520;
    --panel2:    #131d2e;
    --line:      #1e2d45;
    --text:      #e8edf5;
    --muted:     #6b80a0;
    --blue:      #4a9eff;
    --blue2:     #2272cc;
    --red:       #ff4d5a;
    --gold:      #c9a227;
    --grey:      #8a9ab5;
    --shadow:    0 18px 45px rgba(0,0,0,.38);
    --input-bg:  #0a1020;
    --drop-bg:   #080c14;
    --chip-bg:   #111e33;
    --deep-bg:   #07090f;
    --toast-bg:  #0e1a2e;
    --toast-br:  #1e3560;
    --drop-border: #1e3560;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  min-height: 100vh;
  transition: background .25s, color .25s;
}
/* Gradient décoratif sombre seulement */
[data-theme="dark"] body,
[data-theme="auto"] body {
  background:
    radial-gradient(circle at 85% 0%, rgba(74,158,255,.06), transparent 30%),
    var(--bg);
}
@media (prefers-color-scheme: dark) {
  [data-theme="auto"] body {
    background:
      radial-gradient(circle at 85% 0%, rgba(74,158,255,.06), transparent 30%),
      var(--bg);
  }
}

/* Surcharges thème clair */
[data-theme="light"] .field input,
[data-theme="light"] .field select,
[data-theme="light"] .field textarea { background: var(--input-bg); color: var(--text); }
[data-theme="light"] .card { background: linear-gradient(180deg, #ffffff, #f5f7fa); }
[data-theme="light"] .sidebar { background: rgba(240,242,245,.97); }
[data-theme="light"] .topbar { background: rgba(240,242,245,.85); }
[data-theme="light"] .auth-box { background: var(--panel); }
[data-theme="light"] .sticky-note { border-color: rgba(0,0,0,.12); }
[data-theme="light"] .logo { background: #111; }
[data-theme="light"] .report-kpi { background: var(--panel2); }
[data-theme="light"] .lib-item-cover { background: var(--panel2); }
[data-theme="light"] .lib-item-cover-placeholder { color: var(--muted); }
[data-theme="light"] .sticky-note-content { color: var(--text); opacity: .85; }
/* Report KPI cards sombre explicitement sombre dans le PDF téléchargeable */
@media screen {
  [data-theme="light"] .report-kpi b { color: var(--text); }
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

/* ─── OTP PANEL ─────────────────────────────────────── */
.otp-info {
  display: flex; align-items: flex-start; gap: 12px;
  background: rgba(74,158,255,.06); border: 1px solid rgba(74,158,255,.2);
  border-radius: 12px; padding: 14px; margin-bottom: 20px;
}
.otp-info svg { flex-shrink: 0; margin-top: 2px; }
.otp-info p { margin: 0; font-size: 13px; color: var(--muted); line-height: 1.5; }
.otp-info p strong { color: var(--text); }
.otp-inputs {
  display: flex; gap: 8px; justify-content: center; margin-bottom: 8px;
}
.otp-digit {
  width: 44px; height: 52px; border-radius: 10px;
  border: 1.5px solid var(--line); background: var(--input-bg);
  color: var(--text); font-size: 22px; font-weight: 800;
  text-align: center; outline: none; transition: border-color .15s;
}
.otp-digit:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(74,158,255,.12); }
.otp-resend { text-align: center; font-size: 12px; color: var(--muted); margin: 14px 0 4px; }
.otp-resend-btn {
  background: none; border: none; color: var(--blue); font-size: 12px;
  cursor: pointer; text-decoration: underline; padding: 0;
}
.otp-resend-btn:disabled { color: var(--muted); cursor: default; text-decoration: none; }
.otp-back-btn {
  background: none; border: none; color: var(--muted); font-size: 12px;
  cursor: pointer; display: block; margin: 8px auto 0; padding: 0;
}
.otp-back-btn:hover { color: var(--text); }

/* ─── AUTH OVERLAY ──────────────────────────────────── */
#authOverlay {
  position: fixed; inset: 0; z-index: 500;
  background: radial-gradient(circle at 60% 30%, rgba(74,158,255,.07), transparent 50%), var(--bg);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.auth-box {
  width: 100%; max-width: 420px;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 20px; padding: 36px; box-shadow: var(--shadow);
}
.auth-logo {
  width: 72px; height: 72px; border-radius: 16px;
  background: #000;
  display: grid; place-items: center;
  box-shadow: 0 10px 28px rgba(0,0,0,.5);
  margin-bottom: 20px; overflow: hidden;
}
.auth-box h1 { font-size: 22px; margin: 0 0 4px; }
.auth-box p  { color: var(--muted); font-size: 12px; margin: 0 0 24px; }
.auth-tabs   { display: flex; gap: 6px; margin-bottom: 20px; }
.auth-tab {
  flex: 1; padding: 9px; border-radius: 10px; border: 1px solid var(--line);
  background: transparent; color: var(--muted); font-weight: 700;
}
.auth-tab.active { background: var(--panel2); color: var(--text); border-color: var(--blue2); }
.auth-error { color: var(--red); font-size: 12px; margin-top: -6px; margin-bottom: 8px; min-height: 16px; }

/* ─── APP LAYOUT ────────────────────────────────────── */
.app {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
  transition: grid-template-columns .25s ease;
}
.app.sidebar-collapsed { grid-template-columns: 62px 1fr; }

.sidebar {
  position: sticky; top: 0; height: 100vh;
  padding: 0; border-right: 1px solid var(--line);
  background: rgba(8,12,20,.90); backdrop-filter: blur(18px);
  overflow-y: auto; overflow-x: hidden;
  width: 240px;
  transition: width .25s ease, padding .25s ease;
  scrollbar-width: thin; scrollbar-color: var(--line) transparent;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: var(--line); border-radius: 4px; }

/* sidebar-inner occupe toute la hauteur et pousse le footer en bas */
.sidebar-inner {
  display: flex; flex-direction: column;
  min-height: 100%;
  padding: 24px 16px 16px;
  box-sizing: border-box;
}
/* Zone sections (tout sauf le footer) prend l'espace disponible */
.sidebar-sections {
  flex: 1;
}
.app.sidebar-collapsed .sidebar { width: 62px; }
.app.sidebar-collapsed .sidebar-inner { padding: 16px 10px 16px; }

/* Brand */
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 24px; }
.brand-text { flex: 1; min-width: 0; overflow: hidden; transition: opacity .2s, width .2s; }
.app.sidebar-collapsed .brand-text { opacity: 0; width: 0; pointer-events: none; }
/* En mode réduit : logo + toggle empilés verticalement et centrés */
.app.sidebar-collapsed .brand {
  flex-direction: column; gap: 8px; padding-bottom: 20px;
  align-items: center; justify-content: center;
}
.logo {
  width: 42px; height: 42px; border-radius: 13px;
  background: #000;
  display: grid; place-items: center;
  box-shadow: 0 10px 28px rgba(0,0,0,.4); flex-shrink: 0; overflow: hidden;
}
/* Image du logo dans les deux contextes */
.logo-img {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.brand strong { font-size: 16px; }
.brand span   { display: block; color: var(--muted); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; }

/* Toggle button */
.sidebar-toggle {
  flex-shrink: 0; width: 26px; height: 26px; border-radius: 7px;
  border: 1px solid var(--line); background: transparent; color: var(--muted);
  display: grid; place-items: center;
  cursor: pointer; transition: transform .25s ease;
}
.sidebar-toggle svg { width: 16px; height: 16px; transition: transform .25s ease; }
.sidebar-toggle:hover { background: var(--panel2); color: var(--text); border-color: var(--blue2); }
.app.sidebar-collapsed .sidebar-toggle { transform: rotate(180deg); margin: 0; }

.nav { display: grid; gap: 6px; }
.nav button {
  display: flex; align-items: center; gap: 11px; width: 100%;
  border: 0; border-radius: 12px; padding: 11px 12px;
  background: transparent; color: var(--muted); text-align: left;
}
.nav button:hover, .nav button.active { background: var(--panel2); color: var(--text); }
.nav .ico {
  width: 22px; height: 22px; flex-shrink: 0;
  display: grid; place-items: center;
}
.nav .ico svg { width: 19px; height: 19px; display: block; }
.nav-label { transition: opacity .15s, max-width .25s; overflow: hidden; white-space: nowrap; max-width: 160px; }
.app.sidebar-collapsed .nav-label { opacity: 0; max-width: 0; }
.app.sidebar-collapsed .nav button {
  justify-content: center;
  padding: 11px 0;
  gap: 0;
}

/* Collapsed: hide text-only elements */
.app.sidebar-collapsed .sidebar-text { display: none; }
.app.sidebar-collapsed .accounts-list { display: none; }
.app.sidebar-collapsed .strategies-list { display: none; }
.app.sidebar-collapsed .sidebar-section-head { justify-content: center; }
.app.sidebar-collapsed .sidebar-foot {
  left: 6px; right: 6px; padding: 10px 6px;
}
.app.sidebar-collapsed .sidebar-foot button { padding: 7px 0; justify-content: center; }
/* Hide + buttons, show a divider line instead */
/* ─── SIDEBAR SECTIONS ──────────────────────────────── */
.sidebar-section { margin-bottom: 4px; }

.sidebar-section-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 7px 8px; border-radius: 10px; cursor: pointer;
  user-select: none;
  transition: background .15s;
}
.sidebar-section-head:hover { background: var(--panel2); }
.sidebar-section-label {
  font-size: 10px; text-transform: uppercase; letter-spacing: .12em;
  color: var(--muted); font-weight: 700;
}
.section-head-actions {
  display: flex; align-items: center; gap: 5px;
}
/* Chevron */
.section-chevron {
  width: 14px; height: 14px; flex-shrink: 0;
  color: var(--muted); transition: transform .2s ease;
}
.sidebar-section.collapsed .section-chevron { transform: rotate(-90deg); }

/* Collapsible body */
.sidebar-section-body {
  overflow: hidden;
  max-height: 600px;
  transition: max-height .25s ease, opacity .2s ease;
  opacity: 1;
  padding-bottom: 8px;
}
.sidebar-section.collapsed .sidebar-section-body {
  max-height: 0;
  opacity: 0;
  padding-bottom: 0;
}

/* Hide sections controls when sidebar is collapsed */
.app.sidebar-collapsed .sidebar-section-head {
  justify-content: center; cursor: default; pointer-events: none;
}
.app.sidebar-collapsed .sidebar-section-head:hover { background: transparent; }
.app.sidebar-collapsed .sidebar-section-body { max-height: 0 !important; opacity: 0 !important; padding-bottom: 0; }
.app.sidebar-collapsed .section-chevron { display: none; }
.app.sidebar-collapsed .sidebar-section-head::after {
  content: ''; display: block; width: 28px; height: 1px;
  background: var(--line); border-radius: 1px;
}

.btn-icon {
  width: 26px; height: 26px; border-radius: 7px; border: 1px solid var(--line);
  background: transparent; color: var(--muted); display: grid; place-items: center;
  padding: 0;
}
.btn-icon svg { width: 14px; height: 14px; }
.btn-icon:hover { background: var(--panel2); color: var(--text); border-color: var(--blue2); }

/* ─── ACCOUNTS LIST ─────────────────────────────────── */
.accounts-list { display: grid; gap: 4px; }

.account-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 11px; border: 1px solid transparent;
  background: transparent; color: var(--muted); text-align: left; width: 100%;
  cursor: pointer;
}
.account-item:hover { background: var(--panel2); color: var(--text); }
.account-item.active {
  background: var(--panel2); color: var(--text);
  border-color: var(--blue2);
}
/* shared item icon (accounts + strategies) */
.item-ico {
  width: 16px; height: 16px; flex-shrink: 0;
  color: var(--muted); display: block;
  transition: color .15s;
}
.account-item:hover .item-ico,
.account-item.active .item-ico { color: var(--blue); }
.strategy-item:hover .item-ico,
.strategy-item.active .item-ico { color: var(--gold); }
.account-item .acc-info { flex: 1; min-width: 0; }
.account-item .acc-name {
  font-size: 13px; font-weight: 700; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.account-item .acc-broker { font-size: 10px; color: var(--muted); margin-top: 1px; }
.account-item .acc-edit {
  opacity: 0; width: 20px; height: 20px; border-radius: 6px; border: 0;
  background: rgba(255,255,255,.06); color: var(--muted); font-size: 12px;
  display: grid; place-items: center; flex-shrink: 0;
}
.account-item:hover .acc-edit, .account-item.active .acc-edit { opacity: 1; }
.account-item .acc-edit:hover { background: rgba(255,255,255,.12); color: var(--text); }

.accounts-empty {
  padding: 12px 10px; color: var(--muted); font-size: 12px; font-style: italic;
}

/* ─── STRATEGIES LIST (sidebar) ─────────────────────── */
.strategies-list { display: grid; gap: 4px; }
.strategy-item {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px; border-radius: 11px; border: 1px solid transparent;
  background: transparent; color: var(--muted); text-align: left; width: 100%; cursor: pointer;
}
.strategy-item:hover  { background: var(--panel2); color: var(--text); }
.strategy-item.active {
  background: var(--panel2); color: var(--text);
  border-color: rgba(201,162,39,.4);
}
.strategy-item .strat-name {
  flex: 1; font-size: 12px; font-weight: 600; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.strategy-item .strat-edit {
  opacity: 0; width: 18px; height: 18px; border-radius: 5px; border: 0;
  background: rgba(255,255,255,.06); color: var(--muted); font-size: 11px;
  display: grid; place-items: center; flex-shrink: 0;
}
.strategy-item:hover .strat-edit { opacity: 1; }
.strategy-item .strat-edit:hover { background: rgba(255,255,255,.12); color: var(--text); }
.strategies-empty { padding: 10px; color: var(--muted); font-size: 12px; font-style: italic; }
.app.sidebar-collapsed .strategies-list { display: none; }

/* ─── STRATEGY MODAL ────────────────────────────────── */
.strategy-examples-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(90px,1fr)); gap: 8px;
  margin-top: 4px;
}
.strategy-example-item {
  position: relative; border-radius: 8px; overflow: hidden;
  border: 1px solid var(--line); background: var(--input-bg);
}
.strategy-example-item img {
  width: 100%; height: 64px; object-fit: cover; display: block; cursor: pointer;
}
.strategy-example-item .ex-remove {
  position: absolute; top: 3px; right: 3px;
  width: 18px; height: 18px; border-radius: 50%;
  background: rgba(0,0,0,.8); color: #fff; border: none;
  font-size: 10px; display: grid; place-items: center; cursor: pointer;
  opacity: 0; transition: opacity .15s;
}
.strategy-example-item:hover .ex-remove { opacity: 1; }

/* ─── SIDEBAR PROFILE BUTTON ────────────────────────── */
.sidebar-profile-btn {
  display: flex; align-items: center; gap: 10px; width: 100%;
  background: transparent; border: none; cursor: pointer;
  padding: 0; text-align: left; border-radius: 11px;
  transition: background .15s; color: var(--text);
}
.sidebar-profile-btn:hover { background: rgba(255,255,255,.05); }
.sidebar-avatar {
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
  background: var(--panel2); border: 1.5px solid var(--line);
  display: grid; place-items: center; overflow: hidden;
}
.sidebar-avatar svg { width: 20px; height: 20px; color: var(--muted); }
.sidebar-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sidebar-profile-info { display: flex; flex-direction: column; min-width: 0; }
.sidebar-profile-name { font-size: 13px; font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-profile-sub  { font-size: 10px; color: var(--muted); }
.app.sidebar-collapsed .sidebar-foot { padding: 8px 6px; }
.app.sidebar-collapsed .sidebar-profile-btn { justify-content: center; }

/* ─── PROFILE VIEW ───────────────────────────────────── */
.profile-layout { display: grid; grid-template-columns: 1fr 340px; gap: 20px; align-items: start; }
.profile-card { padding: 24px; }
.profile-avatar-wrap { display: flex; align-items: center; gap: 16px; margin-bottom: 24px; }
.profile-avatar-large {
  width: 72px; height: 72px; border-radius: 50%; flex-shrink: 0;
  background: var(--panel2); border: 2px solid var(--line);
  display: grid; place-items: center; overflow: hidden;
}
.profile-avatar-large svg { width: 36px; height: 36px; color: var(--muted); }
.profile-avatar-large img { width: 100%; height: 100%; object-fit: cover; display: block; }
.profile-username { font-size: 20px; font-weight: 800; }
.profile-email    { font-size: 12px; color: var(--muted); margin-top: 2px; }
.profile-info-list { display: grid; gap: 10px; }
.profile-info-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 0; border-bottom: 1px dashed var(--line);
}
.profile-info-row:last-child { border: 0; padding-bottom: 0; }
.profile-info-row .pir-label { font-size: 12px; color: var(--muted); }
.profile-info-row .pir-value { font-size: 13px; font-weight: 600; }
/* Actions col */
.profile-actions-col { display: grid; gap: 10px; }
.profile-action-btn {
  display: flex; align-items: center; gap: 14px;
  width: 100%; padding: 16px; border-radius: 14px;
  background: var(--panel2); border: 1px solid var(--line);
  color: var(--text); cursor: pointer; text-align: left;
  transition: border-color .15s, background .15s;
}
.profile-action-btn:hover { border-color: var(--blue2); background: rgba(74,158,255,.05); }
.profile-action-btn.danger { border-color: #5a2030; }
.profile-action-btn.danger:hover { background: rgba(255,77,90,.06); border-color: var(--red); }
.profile-action-btn > svg:first-child { width: 20px; height: 20px; flex-shrink: 0; color: var(--blue); }
.profile-action-btn.danger > svg:first-child { color: var(--red); }
.profile-action-btn > div { flex: 1; }
.profile-action-btn > div strong { display: block; font-size: 13px; font-weight: 700; }
.profile-action-btn > div span { font-size: 11px; color: var(--muted); }
.chevron-r { width: 16px; height: 16px; color: var(--muted); flex-shrink: 0; }
@media (max-width: 860px) { .profile-layout { grid-template-columns: 1fr; } }
/* Avatar upload */
.avatar-upload-wrap { display: flex; align-items: center; gap: 14px; padding: 4px 0 8px; }
.avatar-upload-wrap .profile-avatar-large { width: 64px; height: 64px; }

/* Confirmations */
.confirmations-wrap {
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--input-bg); padding: 10px; display: grid; gap: 8px;
}
.confirmations-tags { display: flex; flex-wrap: wrap; gap: 6px; min-height: 24px; }
.conf-tag {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 600;
  cursor: pointer; user-select: none; transition: background .15s, border-color .15s;
  border: 1px solid var(--line); background: var(--panel2); color: var(--muted);
}
.conf-tag.selected {
  background: rgba(74,158,255,.15); border-color: var(--blue); color: var(--blue);
}
.conf-tag .conf-del {
  font-size: 10px; color: var(--muted); margin-left: 2px; line-height: 1;
}
.conf-tag.selected .conf-del { color: var(--blue); }
.confirmations-add { display: flex; gap: 7px; }
.confirmations-add input {
  flex: 1; border: 1px solid var(--line); border-radius: 8px;
  background: var(--drop-bg); color: var(--text); padding: 7px 10px; font: inherit; font-size: 12px;
}
.confirmations-add input:focus { border-color: var(--blue2); outline: none; }

/* ─── STRATEGY DETAIL VIEW ──────────────────────────── */
.strategy-view-content { display: grid; gap: 16px; }
.sv-full { grid-column: 1 / -1; }
.sv-block {
  background: var(--panel2); border: 1px solid var(--line);
  border-radius: 12px; padding: 16px;
}
.sv-block-label {
  font-size: 10px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted); font-weight: 700; margin-bottom: 8px;
}
.sv-block-text { color: var(--text); font-size: 13px; line-height: 1.6; white-space: pre-wrap; }
.sv-two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.sv-advantages { border-color: rgba(74,158,255,.25); }
.sv-advantages .sv-block-label { color: var(--blue); }
.sv-drawbacks  { border-color: rgba(255,77,90,.25); }
.sv-drawbacks  .sv-block-label { color: var(--red); }
.sv-examples-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(120px,1fr)); gap: 8px;
}
.sv-examples-grid img {
  width: 100%; aspect-ratio: 16/9; object-fit: cover;
  border-radius: 8px; border: 1px solid var(--line); cursor: pointer; display: block;
}
.sv-examples-grid img:hover { opacity: .85; }
.sv-confs { display: flex; flex-wrap: wrap; gap: 6px; }
.sv-conf-tag {
  padding: 4px 12px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: rgba(74,158,255,.12); border: 1px solid var(--blue2); color: var(--blue);
}

/* ─── SIDEBAR FOOT ──────────────────────────────────── */
.sidebar-foot {
  margin-top: auto;
  padding-top: 16px;
}
.sidebar-foot .sidebar-profile-btn {
  background: var(--panel2); border: 1px solid var(--line);
  border-radius: 14px; padding: 12px;
}
.sidebar-foot .sidebar-profile-btn:hover {
  border-color: var(--blue2); background: rgba(74,158,255,.06);
}
.sidebar-foot b             { color: var(--blue); display: block; margin-bottom: 4px; }
.sidebar-foot .user-email   { color: var(--muted); font-size: 11px; word-break: break-all; }
.sidebar-foot button        { margin-top: 0; }

.main { min-width: 0; }
.topbar {
  height: 76px; padding: 0 28px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: rgba(8,12,20,.65); backdrop-filter: blur(14px);
  position: sticky; top: 0; z-index: 20;
}
.topbar h1 { font-size: 18px; margin: 0; }
.topbar p  { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
.actions   { display: flex; gap: 9px; align-items: center; }

/* ─── BUTTONS ───────────────────────────────────────── */
.btn {
  border: 1px solid var(--line); background: var(--panel); color: var(--text);
  padding: 10px 14px; border-radius: 11px; font-weight: 700;
}
.btn:hover        { border-color: #2a4060; }
.btn.primary      { background: linear-gradient(135deg, var(--blue), var(--blue2)); color: #fff; border: 0; }
.btn.primary:hover{ opacity: .9; }
.btn.danger       { color: #ffd0d2; border-color: #5a2030; }
.btn.small        { padding: 7px 10px; font-size: 12px; }

/* ─── CONTENT / VIEWS ───────────────────────────────── */
.content  { padding: 26px; max-width: 1500px; margin: auto; }
.view     { display: none; }
.view.active { display: block; }

.hero   { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin-bottom: 20px; }
.hero h2 { font-size: 28px; margin: 0 0 5px; }
.hero p  { color: var(--muted); margin: 0; }

/* ─── CARDS / GRIDS ─────────────────────────────────── */
.grid  { display: grid; gap: 16px; }
.cards { grid-template-columns: repeat(auto-fill, minmax(140px,1fr)); margin-bottom: 16px; }

/* ─── EQUITY FILTER ─────────────────────────────────── */
.equity-filters { display: flex; gap: 2px; }
.eq-filter {
  padding: 3px 9px; border-radius: 6px; font-size: 11px; font-weight: 700;
  border: 1px solid var(--line); background: transparent; color: var(--muted);
  cursor: pointer; transition: background .12s, color .12s;
}
.eq-filter:hover  { background: var(--panel2); color: var(--text); }
.eq-filter.active { background: rgba(74,158,255,.12); border-color: var(--blue2); color: var(--blue); }

/* ─── RESULT SPLIT (donut + barres) ─────────────────── */
.result-split {
  display: grid; grid-template-columns: 140px 1fr; gap: 14px; align-items: center;
}
.donut-sm { width: 140px !important; height: 140px !important; display: block !important; flex-shrink: 0; }
.result-bars-side { display: flex; flex-direction: column; gap: 0; min-width: 0; }

/* ─── RESULT BARS ────────────────────────────────────── */
.result-bars { display: grid; gap: 0; }
.result-bar-row {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 0; border-bottom: 1px dashed var(--line);
  cursor: pointer; transition: background .1s; border-radius: 4px;
}
.result-bar-row:last-child { border: 0; }
.result-bar-row:hover { background: rgba(255,255,255,.02); }
.rb-label { font-size: 11px; font-weight: 700; width: 58px; flex-shrink: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rb-label.win  { color: var(--blue); }
.rb-label.loss { color: var(--red); }
.rb-label.be   { color: var(--grey); }
.rb-bar-wrap { flex: 1; background: var(--panel2); border-radius: 4px; height: 10px; overflow: hidden; }
.rb-bar { height: 100%; border-radius: 4px; transition: width .4s ease; }
.rb-bar.win  { background: var(--blue); }
.rb-bar.loss { background: var(--red); }
.rb-bar.be   { background: var(--grey); }
.rb-r    { font-size: 11px; font-weight: 800; width: 50px; text-align: right; flex-shrink: 0; }
.rb-r.win  { color: var(--blue); }
.rb-r.loss { color: var(--red); }
.rb-r.be   { color: var(--grey); }
/* Totaux en bas */
.result-bars-footer {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 0 4px; font-size: 11px; color: var(--muted);
}
.result-bars-footer strong { font-size: 13px; font-weight: 800; }
.rb-legend { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.rb-leg-item { display: flex; align-items: center; gap: 4px; font-size: 11px; color: var(--muted); }
.rb-leg-dot { width: 8px; height: 8px; border-radius: 50%; }
.card  {
  background: linear-gradient(180deg, rgba(14,21,32,.97), rgba(10,16,26,.97));
  border: 1px solid var(--line); border-radius: 17px; box-shadow: var(--shadow);
}
.metric       { padding: 16px; }
.metric .label { color: var(--muted); font-size: 12px; }
.metric .value { font-size: 25px; font-weight: 850; margin-top: 5px; }
.metric .sub   { font-size: 11px; color: var(--muted); margin-top: 3px; }

.good { color: var(--blue)  !important; }
.bad  { color: var(--red)   !important; }
.warn { color: var(--gold)  !important; }

.two   { grid-template-columns: minmax(0,1.65fr) minmax(310px,.8fr); }
.three { grid-template-columns: repeat(3, minmax(0,1fr)); }

.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 17px 18px; border-bottom: 1px solid var(--line);
}
.panel-head h3   { margin: 0; font-size: 15px; }
.panel-head span { color: var(--muted); font-size: 12px; }
.panel-body { padding: 18px; }

canvas.chart { width: 100%; height: 260px; display: block; }

.empty {
  min-height: 220px; display: grid; place-items: center;
  text-align: center; color: var(--muted); padding: 30px;
}
.empty b { display: block; color: var(--text); font-size: 16px; margin-bottom: 5px; }

.stat-list { display: grid; gap: 12px; }
.stat-row  {
  display: flex; justify-content: space-between;
  padding-bottom: 10px; border-bottom: 1px dashed var(--line);
}
.stat-row:last-child { border: 0; padding: 0; }
.stat-row span { color: var(--muted); }
.stat-row b    { font-variant-numeric: tabular-nums; }

/* ─── UPLOAD / ADD TRADE ────────────────────────────── */
.upload-layout { grid-template-columns: minmax(0,1.5fr) minmax(340px,.8fr); align-items: start; }
.drop {
  border: 1.5px dashed var(--drop-border); border-radius: 17px; min-height: 500px;
  background: var(--drop-bg); position: relative; overflow: hidden; display: grid; place-items: center;
}
.drop.drag        { border-color: var(--blue); box-shadow: inset 0 0 0 2px rgba(74,158,255,.12); }
.drop canvas      { display: none; width: 100%; height: auto; }
.drop.has-image canvas    { display: block; }
.drop.has-image .drop-copy { display: none; }
.drop-copy { text-align: center; padding: 40px; color: var(--muted); }
.drop-copy .big { font-size: 42px; margin-bottom: 10px; }
.drop-copy b    { display: block; color: var(--text); font-size: 17px; }

.detect-badge {
  position: absolute; left: 14px; top: 14px;
  padding: 9px 12px; border-radius: 11px;
  background: rgba(8,12,20,.90); border: 1px solid var(--line);
  backdrop-filter: blur(8px); display: none;
}
.detect-badge.show { display: block; }
.detect-badge b    { color: var(--blue); }

.form-card    { padding: 18px; }
.form-card h3 { margin: 0 0 4px; }
.form-card > p { margin: 0 0 17px; color: var(--muted); font-size: 12px; }

.form { display: grid; gap: 13px; }
.row  { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field label {
  display: block; color: var(--muted); font-size: 11px;
  margin-bottom: 6px; text-transform: uppercase; letter-spacing: .07em;
}
.field input, .field select, .field textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 10px;
  background: var(--input-bg); color: var(--text); padding: 10px 11px; outline: none;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--blue2); box-shadow: 0 0 0 3px rgba(74,158,255,.10);
}
.field textarea { min-height: 80px; resize: vertical; }

.outcomes { display: grid; grid-template-columns: repeat(auto-fit, minmax(88px,1fr)); gap: 7px; }
.outcome  {
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--input-bg); color: var(--muted); padding: 9px 5px; font-weight: 700;
}
.outcome.active[data-value="win"]     { background: rgba(74,158,255,.12); border-color: var(--blue); color: var(--blue); }
.outcome.active[data-value="loss"]    { background: rgba(255,77,90,.12);  border-color: var(--red);  color: var(--red);  }
.outcome.active[data-value="be"]      { background: rgba(138,154,181,.12); border-color: var(--grey); color: var(--grey); }
.outcome.active[data-value="custom"]  { background: rgba(201,162,39,.12); border-color: var(--gold); color: var(--gold); }
.outcome.active[data-value="managed"] { background: rgba(201,162,39,.18); border-color: var(--gold); color: #e8c84a; }
.outcome.active[data-value="open"]    { background: rgba(201,162,39,.12); border-color: var(--gold); color: var(--gold); }

.detect-result {
  border: 1px solid var(--drop-border); background: rgba(74,158,255,.07);
  border-radius: 13px; padding: 13px; margin-bottom: 14px;
}
.detect-result strong { font-size: 25px; color: var(--blue); }
.detect-result small  { color: var(--muted); display: block; }

.privacy { display: flex; gap: 8px; color: var(--muted); font-size: 11px; margin-top: 10px; }

/* ─── TRADE MULTISELECT ──────────────────────────────── */
.trade-select-wrap {
  position: relative; border: 1px solid var(--line); border-radius: 10px;
  background: var(--input-bg); cursor: pointer; transition: border-color .15s;
}
/* ─── ACCOUNT MANAGER (settings) ────────────────────── */
.acc-mgr-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px,1fr)); gap: 10px; }
.acc-mgr-item {
  display: flex; align-items: center; gap: 12px;
  background: var(--panel2); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px;
  transition: border-color .15s;
}
.acc-mgr-item.hidden-acc { opacity: .5; }
.acc-mgr-item { cursor: pointer; }
.acc-mgr-item:hover { border-color: var(--blue2); }
/* Preview metrics grid */
.acc-preview-kpis {
  display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; margin-bottom: 16px;
}
.acc-preview-kpi {
  background: var(--panel2); border: 1px solid var(--line); border-radius: 11px; padding: 12px 14px;
}
.acc-preview-kpi .apk-label { font-size: 10px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 700; }
.acc-preview-kpi .apk-value { font-size: 18px; font-weight: 900; margin-top: 4px; }
.acc-preview-kpi .apk-sub   { font-size: 11px; color: var(--muted); margin-top: 2px; }
.acc-preview-divider { height: 1px; background: var(--line); margin: 16px 0; }
.acc-preview-header {
  display: flex; align-items: center; gap: 14px;
  padding: 0 0 16px; border-bottom: 1px solid var(--line); margin-bottom: 16px;
}
.acc-preview-icon {
  width: 44px; height: 44px; border-radius: 12px; flex-shrink: 0;
  background: rgba(74,158,255,.12); color: var(--blue); display: grid; place-items: center;
}
.acc-preview-icon svg { width: 22px; height: 22px; }
.acc-preview-title { font-size: 18px; font-weight: 900; }
.acc-preview-meta  { font-size: 12px; color: var(--muted); margin-top: 2px; }
.acc-mgr-icon {
  width: 36px; height: 36px; border-radius: 9px; flex-shrink: 0;
  display: grid; place-items: center;
  background: rgba(74,158,255,.12); color: var(--blue);
}
.acc-mgr-icon svg { width: 18px; height: 18px; }
.acc-mgr-info { flex: 1; min-width: 0; }
.acc-mgr-name { font-size: 14px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acc-mgr-sub  { display: flex; align-items: baseline; gap: 8px; margin-top: 2px; flex-wrap: wrap; }
.acc-mgr-total { font-size: 15px; font-weight: 900; }
.acc-mgr-total.pos { color: var(--blue); }
.acc-mgr-total.neg { color: var(--red); }
.acc-mgr-total.loading { font-size: 12px; color: var(--muted); font-weight: 400; }
.acc-mgr-cap  { font-size: 11px; color: var(--muted); }
.acc-mgr-meta { display: flex; gap: 10px; font-size: 11px; color: var(--muted); margin-top: 3px; flex-wrap: wrap; }
.acc-mgr-badge {
  font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 999px;
  background: rgba(201,162,39,.12); border: 1px solid rgba(201,162,39,.3); color: var(--gold);
}
.acc-mgr-actions { display: flex; gap: 5px; flex-shrink: 0; }
.acc-mgr-btn {
  width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--line);
  background: transparent; color: var(--muted); display: grid; place-items: center; cursor: pointer;
  transition: background .12s, color .12s, border-color .12s;
}
.acc-mgr-btn:hover { background: var(--panel); color: var(--text); border-color: var(--blue2); }
.acc-mgr-btn.danger:hover { border-color: var(--red); color: var(--red); }
.acc-mgr-btn svg { width: 14px; height: 14px; }
.acc-mgr-empty { padding: 20px; text-align: center; color: var(--muted); font-size: 13px; }

.trade-select-wrap:focus-within { border-color: var(--blue2); box-shadow: 0 0 0 3px rgba(74,158,255,.10); }
.trade-select-pills {
  display: flex; flex-wrap: wrap; gap: 5px; padding: 8px 11px; min-height: 42px;
  align-items: center;
}
.trade-select-placeholder { color: var(--muted); font-size: 13px; }
.trade-pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: rgba(74,158,255,.15); border: 1px solid var(--blue2); color: var(--blue);
  cursor: pointer; user-select: none;
}
.trade-pill.conf { background: rgba(201,162,39,.12); border-color: rgba(201,162,39,.35); color: var(--gold); }
.trade-pill-remove { font-size: 13px; line-height: 1; opacity: .7; }
.trade-pill-remove:hover { opacity: 1; }
.trade-select-dropdown {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 50;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: var(--shadow); overflow: hidden; max-height: 200px; overflow-y: auto;
}
.trade-select-option {
  display: flex; align-items: center; gap: 9px; padding: 9px 13px;
  font-size: 13px; cursor: pointer; transition: background .12s;
  user-select: none;
}
.trade-select-option:hover { background: var(--panel2); }
.trade-select-option.selected { color: var(--blue); }
.trade-select-option.selected .tso-check { opacity: 1; }
.tso-check { width: 16px; height: 16px; border-radius: 50%; border: 1.5px solid var(--blue); display: grid; place-items: center; flex-shrink: 0; opacity: 0; }
.tso-check::after { content: '✓'; font-size: 10px; color: var(--blue); }
.tso-empty { padding: 12px; text-align: center; color: var(--muted); font-size: 12px; }

/* ─── JOURNAL VIEW TOGGLE ───────────────────────────── */
.journal-view-toggle {
  display: flex; gap: 2px; background: var(--panel2);
  border: 1px solid var(--line); border-radius: 10px; padding: 3px;
}
.jvt-btn {
  width: 32px; height: 32px; border-radius: 8px; border: none;
  background: transparent; color: var(--muted);
  display: grid; place-items: center; cursor: pointer; transition: background .15s, color .15s;
}
.jvt-btn svg { width: 16px; height: 16px; }
.jvt-btn:hover { color: var(--text); }
.jvt-btn.active { background: var(--panel); color: var(--blue); box-shadow: 0 1px 4px rgba(0,0,0,.15); }

/* ─── JOURNAL CALENDAR VIEW ─────────────────────────── */
#journalCalView { display: flex; flex-direction: column; gap: 14px; }

/* KPI bar — compacte, une seule ligne scrollable */
.jcal-kpi-bar {
  display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px;
  scrollbar-width: none;
}
.jcal-kpi-bar::-webkit-scrollbar { display: none; }
.jcal-kpi {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 9px 13px; flex-shrink: 0; min-width: 110px;
}
.jcal-kpi-label { font-size: 9px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; }
.jcal-kpi-value { font-size: 16px; font-weight: 900; margin-top: 3px; }
.jcal-kpi-value.pos { color: #22c55e; }
.jcal-kpi-value.neg { color: var(--red); }

/* Layout 2 colonnes : grille | panneau jour */
.jcal-layout { display: grid; grid-template-columns: 1fr 300px; gap: 14px; align-items: start; }
@media (max-width: 900px) { .jcal-layout { grid-template-columns: 1fr; } }

/* Header navigation */
.jcal-header {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 2px;
}
.jcal-header h3 { margin: 0; font-size: 22px; font-weight: 900; color: var(--text); }
.jcal-nav-btns { display: flex; gap: 8px; }
.jcal-nav-btn {
  padding: 7px 14px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--panel); color: var(--muted); font-size: 12px; font-weight: 700;
  cursor: pointer; transition: background .12s, color .12s, border-color .12s;
}
.jcal-nav-btn:hover { background: var(--panel2); color: var(--text); border-color: var(--blue2); }
.jcal-nav-btn.today-btn { color: var(--blue); border-color: var(--blue2); }

/* Grille du calendrier — pleine largeur */
.jcal-main { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.jcal-day-names {
  display: grid; grid-template-columns: repeat(7,1fr);
  background: var(--panel2); border-bottom: 1px solid var(--line);
}
.jcal-day-name {
  text-align: center; font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .08em; color: var(--muted); padding: 10px 0;
}
.jcal-grid { display: grid; grid-template-columns: repeat(7,1fr); border-left: 1px solid var(--line); }

/* Cellule */
.jcal-cell {
  min-height: 80px; padding: 6px 8px; cursor: pointer;
  border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 3px;
  transition: filter .12s;
  position: relative;
}
.jcal-cell:hover { filter: brightness(1.08); }
.jcal-cell.other-month { opacity: .25; pointer-events: none; }

/* Couleur de fond selon P&L du jour */
.jcal-cell.day-win  { background: rgba(34,197,94,.10); }
.jcal-cell.day-loss { background: rgba(255,77,90,.10); }
.jcal-cell.day-be   { background: var(--panel); }
.jcal-cell.day-empty { background: var(--panel); }
.jcal-cell.today    { outline: 2px solid var(--blue); outline-offset: -2px; }
.jcal-cell.selected { outline: 2px solid var(--gold); outline-offset: -2px; }

.jcal-cell-num {
  font-size: 13px; font-weight: 700; color: var(--muted); line-height: 1;
}
/* P&L grand */
.jcal-cell-pnl {
  font-size: 15px; font-weight: 900; line-height: 1.1;
}
.jcal-cell-pnl.pos { color: #22c55e; }
.jcal-cell-pnl.neg { color: var(--red); }

/* Chips symboles */
.jcal-chips { display: flex; flex-wrap: wrap; gap: 3px; margin-top: auto; }
.jcal-trade-chip {
  font-size: 10px; font-weight: 700; padding: 2px 6px; border-radius: 4px;
  white-space: nowrap;
}
.jcal-trade-chip.win  { background: rgba(34,197,94,.18); color: #22c55e; }
.jcal-trade-chip.loss { background: rgba(255,77,90,.18); color: var(--red); }
.jcal-trade-chip.be   { background: rgba(138,154,181,.15); color: var(--grey); }
.jcal-trade-chip.open { background: rgba(201,162,39,.15); color: var(--gold); }
.jcal-trade-chip.more { background: var(--panel2); color: var(--muted); }

/* Panel détail jour — colonne droite sticky */
.jcal-day-panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px; overflow: hidden;
  position: sticky; top: 20px;
}
.jcal-day-head {
  padding: 12px 16px; border-bottom: 1px solid var(--line);
  font-size: 13px; font-weight: 800; color: var(--text); display: flex; justify-content: space-between;
}
.jcal-day-close { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 16px; }
.jcal-day-summary {
  display: grid; grid-template-columns: repeat(3,1fr); border-bottom: 1px solid var(--line);
}
.jcal-sum-item { padding: 10px 14px; text-align: center; border-right: 1px solid var(--line); }
.jcal-sum-item:last-child { border-right: 0; }
.jcal-sum-label { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.jcal-sum-value { font-size: 17px; font-weight: 800; margin-top: 3px; }
.jcal-day-trades { display: flex; flex-direction: column; max-height: 400px; overflow-y: auto; }
.jcal-trade-row {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  cursor: pointer; transition: background .12s;
}
.jcal-trade-row:hover { background: var(--panel2); }
.jcal-trade-thumb { width: 48px; height: 30px; border-radius: 5px; object-fit: cover; flex-shrink: 0; border: 1px solid var(--line); }
.jcal-trade-thumb-ph { width: 48px; height: 30px; border-radius: 5px; background: var(--panel2); flex-shrink: 0; border: 1px solid var(--line); display: grid; place-items: center; }
.jcal-trade-thumb-ph svg { width: 16px; height: 16px; color: var(--muted); }
.jcal-trade-info { flex: 1; min-width: 0; }
.jcal-trade-market { font-size: 12px; font-weight: 700; }
.jcal-trade-meta { font-size: 10px; color: var(--muted); }
.jcal-trade-result { font-size: 14px; font-weight: 900; flex-shrink: 0; }

/* ─── JOURNAL TABLE ─────────────────────────────────── */
.table-wrap { overflow: auto; }
.table      { width: 100%; border-collapse: collapse; min-width: 930px; }
.table th {
  font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); text-align: left; padding: 12px;
  border-bottom: 1px solid var(--line);
}
.table td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.td-actions { white-space: nowrap; }
.row-actions { display: flex; gap: 5px; align-items: center; }
.table tr:hover td { background: rgba(255,255,255,.012); }
.thumb { width: 66px; height: 40px; border-radius: 7px; object-fit: cover; border: 1px solid var(--line); cursor: pointer; }
.tag   { display: inline-flex; align-items: center; padding: 4px 8px; border-radius: 999px; background: var(--chip-bg); color: var(--grey); font-size: 11px; }
.rpos  { color: var(--blue); font-weight: 800; }
.rneg  { color: var(--red);  font-weight: 800; }

/* ─── REPORTS ───────────────────────────────────────── */
.report-controls { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; }
.report-preview  { padding: 24px; }
.report-title {
  display: flex; justify-content: space-between; gap: 20px;
  align-items: start; padding-bottom: 18px; border-bottom: 1px solid var(--line);
}
.report-title h2 { margin: 0; }
.report-title p  { color: var(--muted); margin: 5px 0 0; }
.report-kpis { display: grid; grid-template-columns: repeat(5,1fr); gap: 10px; margin: 18px 0; }
.report-kpi  { padding: 13px; border: 1px solid var(--line); border-radius: 12px; background: var(--input-bg); }
.report-kpi span { display: block; color: var(--muted); font-size: 11px; }
.report-kpi b    { font-size: 20px; }
.insight {
  border-left: 3px solid var(--gold);
  background: rgba(201,162,39,.06);
  border-radius: 0 12px 12px 0; padding: 13px 14px; margin: 10px 0;
}

/* ─── SETTINGS ──────────────────────────────────────── */
.settings-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }

/* Theme switcher */
.theme-switcher {
  display: flex; gap: 10px; margin-top: 4px;
}
.theme-btn {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 14px 10px; border-radius: 14px; cursor: pointer;
  border: 2px solid var(--line); background: var(--panel2); color: var(--muted);
  transition: border-color .15s, background .15s, color .15s;
  font-size: 12px; font-weight: 700;
}
.theme-btn svg { width: 22px; height: 22px; }
.theme-btn:hover { border-color: var(--blue2); color: var(--text); }
.theme-btn.active { border-color: var(--blue); background: rgba(74,158,255,.1); color: var(--blue); }
[data-theme="light"] .theme-btn.active { border-color: var(--blue); background: rgba(37,99,235,.08); color: var(--blue); }

/* ─── MODAL ─────────────────────────────────────────── */
.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,.75);
  display: none; place-items: center; z-index: 100; padding: 20px;
}
.modal.show { display: grid; }
.modal-box  {
  max-width: 1100px; width: 100%; max-height: 90vh; overflow: auto;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 18px; box-shadow: var(--shadow);
}
.modal-head {
  position: sticky; top: 0; display: flex; justify-content: space-between;
  align-items: center; background: var(--panel); padding: 14px 17px;
  border-bottom: 1px solid var(--line); z-index: 2;
}
.modal-img { width: 100%; display: block; }

/* ─── CONFIRM MODAL ─────────────────────────────────── */
.confirm-box {
  max-width: 380px; text-align: center; padding: 32px 28px;
  border-radius: 20px;
}
.confirm-icon {
  width: 56px; height: 56px; border-radius: 50%; margin: 0 auto 18px;
  background: rgba(255,77,90,.12); border: 1.5px solid rgba(255,77,90,.25);
  display: grid; place-items: center; color: var(--red);
}
.confirm-icon svg { width: 26px; height: 26px; }
.confirm-title {
  font-size: 17px; font-weight: 800; margin: 0 0 8px; color: var(--text);
}
.confirm-message {
  font-size: 13px; color: var(--muted); line-height: 1.5; margin: 0 0 24px;
}
.confirm-actions { display: flex; gap: 10px; justify-content: center; }
.confirm-actions .btn { min-width: 100px; }

/* ─── IMAGE VIEWER (z-index > tous les autres modals) ── */
.image-viewer {
  position: fixed; inset: 0; z-index: 400;
  display: none; align-items: center; justify-content: center;
  padding: 20px;
}
.image-viewer.show { display: flex; }
.image-viewer-backdrop {
  position: absolute; inset: 0; background: rgba(0,0,0,.88);
  cursor: pointer;
}
.image-viewer-box {
  position: relative; z-index: 1;
  max-width: min(1200px, 96vw); width: 100%;
  display: flex; flex-direction: column; gap: 0;
  border-radius: 14px; overflow: hidden;
  box-shadow: 0 24px 60px rgba(0,0,0,.6);
}
.image-viewer-head {
  display: flex; justify-content: space-between; align-items: center;
  background: rgba(14,21,32,.96); padding: 10px 14px;
  border-bottom: 1px solid var(--line);
}
.image-viewer-counter { color: var(--muted); font-size: 12px; }
.image-viewer-body {
  display: flex; align-items: center;
  background: var(--deep-bg); position: relative;
}
.image-viewer-img {
  flex: 1; min-width: 0; display: block;
  max-height: 82vh; width: 100%; object-fit: contain;
}
.image-viewer-nav {
  flex-shrink: 0; width: 44px; height: 44px;
  background: rgba(14,21,32,.85); border: 1px solid var(--line);
  border-radius: 50%; color: var(--text);
  display: grid; place-items: center; cursor: pointer;
  position: absolute; top: 50%; transform: translateY(-50%);
  transition: background .15s, opacity .15s;
  z-index: 2;
}
.image-viewer-nav:hover { background: var(--panel2); border-color: var(--blue2); }
.image-viewer-nav.prev { left: 12px; }
.image-viewer-nav.next { right: 12px; }
.image-viewer-nav svg { width: 18px; height: 18px; }
.image-viewer-nav[disabled] { opacity: .25; pointer-events: none; }
.image-viewer-action {
  width: 32px; height: 32px; border-radius: 8px;
  border: 1px solid var(--line); background: transparent; color: var(--muted);
  display: grid; place-items: center; cursor: pointer; transition: background .15s, color .15s;
}
.image-viewer-action:hover { background: var(--panel2); color: var(--text); border-color: var(--blue2); }
.image-viewer-action svg { width: 16px; height: 16px; }
/* Légende — bande sous l'image, ne cache pas l'image */
.image-viewer-caption {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: linear-gradient(transparent, rgba(0,0,0,.72));
  color: #e8edf5; font-size: 13px; padding: 28px 56px 12px;
  text-align: center; pointer-events: none;
  line-height: 1.5;
}

/* ─── TOAST ─────────────────────────────────────────── */
.toast {
  position: fixed; right: 24px; bottom: 24px;
  background: var(--toast-bg); border: 1px solid var(--drop-border); color: var(--text);
  padding: 12px 15px; border-radius: 12px; box-shadow: var(--shadow);
  transform: translateY(120px); opacity: 0; transition: .25s; z-index: 200;
}
.toast.show { transform: none; opacity: 1; }

/* ─── LOADING SPINNER ───────────────────────────────── */
.spinner {
  display: inline-block; width: 18px; height: 18px;
  border: 2px solid var(--line); border-top-color: var(--blue);
  border-radius: 50%; animation: spin .6s linear infinite; vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── STATUS BADGES ─────────────────────────────────── */
.status-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 700;
}
.status-badge.open {
  background: rgba(201,162,39,.15); border: 1px solid var(--gold);
  color: var(--gold);
}
.status-badge.open::before { content: '●'; font-size: 8px; animation: pulse 1.4s ease-in-out infinite; }
.status-badge.done {
  background: rgba(74,158,255,.10); border: 1px solid var(--blue2);
  color: var(--grey);
}
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .3; } }

/* ─── EDIT STATUS BAR ────────────────────────────────── */
.edit-status-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-radius: 11px; background: rgba(201,162,39,.06);
  border: 1px solid rgba(201,162,39,.18); margin-bottom: 18px;
}
.edit-status-bar.done {
  background: rgba(74,158,255,.06); border-color: rgba(74,158,255,.18);
}

/* ─── CAPTURES SECTION ───────────────────────────────── */
.captures-section {
  border: 1px solid var(--line); border-radius: 13px; padding: 14px;
}
.captures-section-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 12px; font-size: 13px; font-weight: 700;
}
.captures-slots {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px;
}
/* Slot — conteneur vertical */
.capture-slot {
  border: 1.5px dashed var(--line); border-radius: 12px; background: var(--deep-bg);
  display: flex; flex-direction: column; overflow: hidden;
}
.capture-slot-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 11px; border-bottom: 1px solid var(--line);
}
.capture-slot-head .slot-label {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .07em; color: var(--muted);
}
.capture-slot-head .slot-badge {
  padding: 2px 8px; border-radius: 999px; font-size: 10px; font-weight: 700;
}
.capture-slot-head .slot-badge.analyse  { background: rgba(138,154,181,.12); color: var(--grey); border: 1px solid #283448; }
.capture-slot-head .slot-badge.position { background: rgba(74,158,255,.12);  color: var(--blue); border: 1px solid var(--blue2); }
.capture-slot-head .slot-badge.gestion  { background: rgba(201,162,39,.12);  color: var(--gold); border: 1px solid rgba(201,162,39,.3); }
.capture-slot-head .slot-badge.sortie   { background: rgba(255,77,90,.10);   color: var(--red);  border: 1px solid rgba(255,77,90,.3); }

/* Zone de dépôt (position = single, autres = multi) */
.capture-slot-drop {
  min-height: 90px; display: flex; align-items: center; justify-content: center;
  text-align: center; color: var(--muted); font-size: 12px; cursor: pointer; padding: 10px;
}
.capture-slot-drop:hover { background: rgba(255,255,255,.02); }
.capture-slot-drop.drag  { background: rgba(74,158,255,.05); }
.capture-slot-drop .slot-empty-ico { font-size: 22px; display: block; margin-bottom: 5px; opacity: .35; }
/* Image unique (slot position) */
.capture-slot-drop.single img {
  width: 100%; max-height: 140px; object-fit: cover; display: block; border-radius: 6px; cursor: pointer;
}
/* Grille multi-images */
.slot-multi-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 6px; padding: 10px; width: 100%;
}
.slot-multi-item {
  position: relative; border-radius: 7px; overflow: hidden;
  border: 1px solid var(--line); background: var(--input-bg);
}
.slot-multi-item img {
  width: 100%; height: 68px; object-fit: cover; display: block; cursor: pointer;
}
.slot-multi-item .slot-img-remove {
  position: absolute; top: 3px; right: 3px;
  width: 18px; height: 18px; border-radius: 50%;
  background: rgba(0,0,0,.75); color: #fff; border: none;
  font-size: 10px; display: grid; place-items: center; cursor: pointer; opacity: 0;
  transition: opacity .15s;
}
.slot-multi-item:hover .slot-img-remove { opacity: 1; }
.slot-multi-add {
  height: 68px; border-radius: 7px; border: 1.5px dashed var(--line);
  background: transparent; color: var(--muted); font-size: 20px;
  display: grid; place-items: center; cursor: pointer;
}
.slot-multi-add:hover { border-color: var(--blue2); color: var(--blue); }

/* Caption sous les images multi */
.capture-slot-caption {
  padding: 0 10px 9px;
}
.capture-slot-caption input {
  width: 100%; border: 1px solid var(--line); border-radius: 8px;
  background: var(--drop-bg); color: var(--text); padding: 6px 9px; font: inherit; font-size: 12px;
}
.capture-slot-caption input:focus { border-color: var(--blue2); outline: none; }

/* ─── VIEW TRADE MODAL ───────────────────────────────── */
.view-trade-box { max-width: 920px; }
.view-trade-body { padding: 24px; display: grid; gap: 24px; }
.view-trade-meta {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(130px,1fr)); gap: 10px;
}
.view-meta-item {
  background: var(--input-bg); border: 1px solid var(--line); border-radius: 11px; padding: 11px 13px;
}
.view-meta-item .vm-label { font-size: 10px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin-bottom: 4px; }
.view-meta-item .vm-value { font-size: 15px; font-weight: 800; }
.view-trade-slots {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px;
}
.view-slot {
  border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--deep-bg);
}
.view-slot-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 13px; border-bottom: 1px solid var(--line);
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em;
}
.view-slot-head .slot-label { color: var(--muted); }
.view-slot-empty { padding: 28px; text-align: center; color: var(--muted); font-size: 12px; }
/* Grille d'images en view */
.view-slot-imgs {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(160px,1fr)); gap: 1px;
}
.view-slot-imgs img {
  width: 100%; aspect-ratio: 16/9; object-fit: cover; cursor: pointer; display: block;
}
.view-slot-imgs img:hover { opacity: .88; }
/* Single image (position) */
.view-slot-single img {
  width: 100%; max-height: 220px; object-fit: cover; display: block; cursor: pointer;
}
.view-slot-caption { padding: 8px 12px; color: var(--muted); font-size: 12px; font-style: italic; }
.view-journal-blocks {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px;
}
.view-notes-block {
  background: rgba(201,162,39,.06); border: 1px solid rgba(201,162,39,.2);
  border-radius: 11px; padding: 14px 16px;
}
.view-notes-block .vn-label {
  font-size: 10px; text-transform: uppercase; letter-spacing: .07em;
  color: var(--gold); margin-bottom: 8px; font-weight: 700;
}
.view-notes-block .vn-text { color: var(--text); white-space: pre-wrap; line-height: 1.6; font-size: 13px; }
/* Variante rouge — erreur */
.view-block-red {
  background: rgba(255,77,90,.05); border-color: rgba(255,77,90,.25);
}
.view-block-red .vn-label { color: var(--red); }
/* Variante grise — émotion */
.view-block-grey {
  background: rgba(138,154,181,.06); border-color: rgba(138,154,181,.2);
}
.view-block-grey .vn-label { color: var(--grey); }
/* Variante bleue — leçon */
.view-block-blue {
  background: rgba(74,158,255,.05); border-color: rgba(74,158,255,.2);
}
.view-block-blue .vn-label { color: var(--blue); }
/* Tag émotion */
.vn-emotion-tag {
  display: inline-block; padding: 4px 12px; border-radius: 999px;
  background: rgba(138,154,181,.14); border: 1px solid rgba(138,154,181,.25);
  color: var(--text); font-size: 13px; font-weight: 700;
}

/* ─── RESPONSIVE ────────────────────────────────────── */
@media (max-width: 1150px) {
  .cards { grid-template-columns: repeat(3,1fr); }
  .two, .upload-layout { grid-template-columns: 1fr; }
  .report-kpis { grid-template-columns: repeat(3,1fr); }
}
@media (max-width: 780px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { height: auto; position: static; border-right: 0; border-bottom: 1px solid var(--line); }
  .brand { padding-bottom: 12px; }
  .nav { grid-template-columns: repeat(5,1fr); overflow: auto; }
  .nav button { font-size: 0; justify-content: center; }
  .nav .ico { font-size: 18px; }
  .sidebar-foot { display: none; }
  .topbar { padding: 0 15px; }
  .content { padding: 16px; }
  .cards { grid-template-columns: repeat(2,1fr); }
  .row, .three, .settings-grid { grid-template-columns: 1fr; }
  .report-kpis { grid-template-columns: repeat(2,1fr); }
  .hero { align-items: start; flex-direction: column; }
}

/* ─── LIBRARY READER — plein écran (PDF) ────────────── */
.lib-reader-modal {
  position: fixed; inset: 0; z-index: 350;
  display: none; flex-direction: column;
  background: rgba(0,0,0,.92);
}
.lib-reader-modal.show { display: flex; }
.lib-reader-box {
  display: flex; flex-direction: column; width: 100%; height: 100%;
}
.lib-reader-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 16px; background: var(--panel); border-bottom: 1px solid var(--line);
  flex-shrink: 0; z-index: 1;
}
.lib-reader-title { font-size: 14px; font-weight: 700; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 60vw; }
.lib-reader-body { flex: 1; overflow: hidden; display: flex; flex-direction: column; }
.lib-reader-body iframe { flex: 1; width: 100%; height: 100%; border: none; background: #fff; }

/* ─── MINI-PLAYER FLOTTANT (Audio + eBook) ───────────── */
.mini-player {
  position: fixed; bottom: 20px; right: 24px;
  z-index: 300; display: none;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 16px; box-shadow: 0 8px 32px rgba(0,0,0,.5);
  width: 340px; overflow: hidden;
  transition: transform .25s ease, opacity .25s ease;
}
.mini-player.show { display: block; }
.mini-player.minimized { transform: translateY(calc(100% - 48px)); }
/* Header du mini-player */
.mini-player-head {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; cursor: pointer;
  border-bottom: 1px solid var(--line);
  background: var(--panel2);
}
.mini-player-type-icon {
  width: 32px; height: 32px; border-radius: 8px; flex-shrink: 0;
  display: grid; place-items: center;
}
.mini-player-type-icon.audio { background: rgba(201,162,39,.15); color: var(--gold); }
.mini-player-type-icon.ebook { background: rgba(74,158,255,.15);  color: var(--blue); }
.mini-player-type-icon svg { width: 16px; height: 16px; }
.mini-player-info { flex: 1; min-width: 0; }
.mini-player-title { font-size: 12px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-player-sub   { font-size: 10px; color: var(--muted); }
.mini-player-controls { display: flex; gap: 5px; align-items: center; flex-shrink: 0; }
.mini-player-controls button {
  width: 26px; height: 26px; border-radius: 7px;
  border: 1px solid var(--line); background: transparent; color: var(--muted);
  display: grid; place-items: center; cursor: pointer; font-size: 13px;
}
.mini-player-controls button:hover { background: var(--panel); color: var(--text); }
/* Corps audio */
.mini-player-body { padding: 12px; }
.mini-player-body audio { width: 100%; }
/* Corps eBook */
.mini-player-ebook { height: 480px; display: flex; flex-direction: column; }
.mini-player-ebook iframe { flex: 1; width: 100%; border: none; background: #fff; }

/* ─── NOTES ─────────────────────────────────────────── */
.notes-board {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px;
  align-items: start;
}
.sticky-note {
  border-radius: 14px; padding: 16px; display: flex; flex-direction: column; gap: 10px;
  border: 1px solid rgba(255,255,255,.08); box-shadow: var(--shadow);
  min-height: 160px;
}
.sticky-note-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.sticky-note-title { font-size: 14px; font-weight: 700; flex: 1; word-break: break-word; }
.sticky-note-edit {
  flex-shrink: 0; width: 26px; height: 26px; border-radius: 7px;
  border: 1px solid rgba(255,255,255,.1); background: rgba(255,255,255,.06);
  color: var(--muted); display: grid; place-items: center; cursor: pointer; font-size: 13px;
}
.sticky-note-edit:hover { background: rgba(255,255,255,.12); color: var(--text); }
.sticky-note-content { font-size: 13px; color: rgba(232,237,245,.8); line-height: 1.55; flex: 1; white-space: pre-wrap; word-break: break-word; }
.sticky-note-date { font-size: 10px; color: rgba(107,128,160,.7); }
/* Color picker */
.note-color-picker { display: flex; gap: 8px; flex-wrap: wrap; }
.note-color {
  width: 26px; height: 26px; border-radius: 50%; border: 2px solid transparent; cursor: pointer;
  transition: border-color .15s;
}
.note-color.active, .note-color:hover { border-color: var(--text); }

/* ─── TODO ───────────────────────────────────────────── */
.todos-board {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; align-items: start;
}
.todo-list-card { background: var(--panel2); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.todo-list-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 14px; border-bottom: 1px solid var(--line);
}
.todo-list-head-title { font-size: 14px; font-weight: 700; flex: 1; cursor: pointer; }
.todo-list-head-title:hover { color: var(--blue); }
.todo-list-actions { display: flex; gap: 5px; }
.todo-list-actions button {
  width: 24px; height: 24px; border-radius: 6px; border: 1px solid var(--line);
  background: transparent; color: var(--muted); display: grid; place-items: center; cursor: pointer; font-size: 12px;
}
.todo-list-actions button:hover { background: var(--panel); color: var(--text); }
.todo-items { padding: 10px 14px; display: grid; gap: 6px; max-height: 320px; overflow-y: auto; }
.todo-item { display: flex; align-items: center; gap: 9px; }
.todo-item input[type=checkbox] { width: 16px; height: 16px; cursor: pointer; flex-shrink: 0; accent-color: var(--blue); }
.todo-item-text { flex: 1; font-size: 13px; word-break: break-word; cursor: pointer; }
.todo-item-text.done { text-decoration: line-through; color: var(--muted); }
.todo-item-del { opacity: 0; width: 18px; height: 18px; border-radius: 4px; border: none; background: transparent; color: var(--red); font-size: 14px; cursor: pointer; display: grid; place-items: center; }
.todo-item:hover .todo-item-del { opacity: 1; }
.todo-add-item { display: flex; gap: 7px; padding: 10px 14px; border-top: 1px solid var(--line); align-items: center; }
.todo-add-item input[type=text], .todo-add-item input:not([type=date]) { flex: 1; border: 1px solid var(--line); border-radius: 8px; background: var(--drop-bg); color: var(--text); padding: 6px 9px; font: inherit; font-size: 13px; }
.todo-add-item input:focus { border-color: var(--blue2); outline: none; }
.todo-add-item button { flex-shrink: 0; padding: 6px 10px; }
.todo-add-date { flex-shrink: 0; width: 36px; border: 1px solid var(--line); border-radius: 8px; background: var(--drop-bg); color: transparent; padding: 6px 4px; font: inherit; font-size: 11px; cursor: pointer; }
.todo-add-date:focus, .todo-add-date:valid { color: var(--muted); width: auto; }
.todo-add-date::-webkit-calendar-picker-indicator { filter: invert(.5); cursor: pointer; }
.todo-progress { height: 3px; background: var(--line); }
.todo-progress-bar { height: 100%; background: var(--blue); transition: width .3s; border-radius: 0 2px 2px 0; }

/* ─── TODO LAYOUT avec calendrier ───────────────────── */
.todo-layout {
  display: grid; grid-template-columns: 280px 1fr; gap: 20px; align-items: start;
}
@media (max-width: 900px) { .todo-layout { grid-template-columns: 1fr; } }

/* Colonne calendrier */
.todo-calendar-col { display: flex; flex-direction: column; gap: 14px; position: sticky; top: 20px; }
.todo-cal-card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 16px; overflow: hidden;
}
.todo-cal-nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border-bottom: 1px solid var(--line);
  font-size: 14px; font-weight: 700;
}
.todo-cal-nav button {
  width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--line);
  background: transparent; color: var(--muted); display: grid; place-items: center; cursor: pointer;
}
.todo-cal-nav button svg { width: 16px; height: 16px; }
.todo-cal-nav button:hover { background: var(--panel2); color: var(--text); border-color: var(--blue2); }
.todo-cal-grid {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 0;
  padding: 10px 8px 8px;
}
.cal-day-name {
  text-align: center; font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--muted); padding: 4px 0 8px;
}
.cal-day {
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  padding: 5px 2px; border-radius: 8px; cursor: pointer; min-height: 40px; position: relative;
  transition: background .12s;
}
.cal-day:hover { background: var(--panel2); }
.cal-day.other-month .cal-day-num { color: var(--muted); opacity: .4; }
.cal-day-num { font-size: 13px; font-weight: 600; line-height: 1; }
.cal-day.today .cal-day-num {
  background: var(--blue); color: #fff;
  width: 24px; height: 24px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
}
.cal-day.selected { background: rgba(74,158,255,.12); }
.cal-day.selected .cal-day-num { color: var(--blue); }
/* Indicateurs de tâches sous le numéro */
.cal-dots { display: flex; gap: 2px; margin-top: 3px; }
.cal-dot {
  width: 5px; height: 5px; border-radius: 50%; flex-shrink: 0;
}
.cal-dot.due  { background: var(--gold); }
.cal-dot.done { background: var(--blue); opacity: .6; }
.todo-cal-legend {
  display: flex; align-items: center; gap: 5px; padding: 8px 14px;
  font-size: 10px; color: var(--muted); border-top: 1px solid var(--line);
}

/* Tâches du jour sélectionné */
.todo-day-tasks {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 14px; padding: 14px;
}
.todo-day-label {
  font-size: 12px; font-weight: 700; color: var(--blue);
  text-transform: uppercase; letter-spacing: .06em; margin-bottom: 10px;
}
.todo-day-item {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 0; border-bottom: 1px dashed var(--line); font-size: 13px;
}
.todo-day-item:last-child { border: 0; padding-bottom: 0; }
.todo-day-item input[type=checkbox] { accent-color: var(--blue); flex-shrink: 0; }
.todo-day-item-text { flex: 1; }
.todo-day-item-text.done { text-decoration: line-through; color: var(--muted); }
.todo-day-item-list { font-size: 10px; color: var(--muted); margin-left: auto; white-space: nowrap; }
.todo-day-empty { font-size: 12px; color: var(--muted); text-align: center; padding: 12px 0; }

/* Date picker dans les items */
.todo-item-date {
  font-size: 10px; color: var(--muted); background: var(--panel2);
  border: 1px solid var(--line); border-radius: 5px; padding: 1px 5px;
  cursor: pointer; white-space: nowrap; flex-shrink: 0;
}
.todo-item-date.overdue { color: var(--red); border-color: var(--red); background: rgba(255,77,90,.08); }
.todo-item-date.due-today { color: var(--gold); border-color: var(--gold); background: rgba(201,162,39,.08); }

/* ─── LIBRARY ────────────────────────────────────────── */
.library-board { display: grid; gap: 20px; }
.lib-category-block { margin-bottom: 32px; }
.lib-category-title {
  font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted);
  font-weight: 700; margin-bottom: 14px; padding-bottom: 6px; border-bottom: 1px solid var(--line);
}
/* ── Grille style Apple Books ── */
.lib-items-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 18px; }

.lib-item {
  position: relative; display: flex; flex-direction: column; gap: 0;
  cursor: pointer; border-radius: 10px; overflow: visible;
}
.lib-item:hover .lib-item-cover { transform: translateY(-3px); box-shadow: 0 12px 32px rgba(0,0,0,.5); }

/* Couverture */
.lib-item-cover {
  width: 100%; aspect-ratio: 2/3; border-radius: 10px; overflow: hidden;
  background: var(--panel2); border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center;
  transition: transform .2s ease, box-shadow .2s ease;
  box-shadow: 0 4px 16px rgba(0,0,0,.35);
  position: relative;
}
.lib-item-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* Couverture audio — carré */
.lib-item-cover.audio { aspect-ratio: 1/1; }
/* Couverture placeholder (pas encore générée) */
.lib-item-cover-placeholder {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; width: 100%; height: 100%; color: var(--muted);
}
.lib-item-cover-placeholder svg { width: 36px; height: 36px; }
.lib-item-cover-placeholder .lib-cover-label { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; }

/* Badge NEW / statut — coin bas gauche de la couverture */
.lib-item-badge {
  position: absolute; bottom: 8px; left: 8px;
  padding: 2px 8px; border-radius: 999px; font-size: 10px; font-weight: 800;
}
.lib-item-badge.new     { background: var(--blue);  color: #fff; }
.lib-item-badge.reading { background: var(--gold);  color: #000; }
.lib-item-badge.done    { background: rgba(74,158,255,.9); color: #fff; }

/* Bouton ··· — coin haut droit */
.lib-item-menu-btn {
  position: absolute; top: 6px; right: 6px;
  width: 28px; height: 28px; border-radius: 50%;
  background: rgba(8,12,20,.75); backdrop-filter: blur(6px);
  border: 1px solid rgba(255,255,255,.1); color: var(--text);
  display: grid; place-items: center; cursor: pointer; font-size: 14px;
  opacity: 0; transition: opacity .15s;
}
.lib-item:hover .lib-item-menu-btn { opacity: 1; }

/* Menu contextuel */
.lib-context-menu {
  position: fixed; z-index: 400;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: var(--shadow);
  padding: 6px; min-width: 180px; display: none;
}
.lib-context-menu.show { display: block; }
.lib-ctx-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 8px; cursor: pointer;
  font-size: 13px; color: var(--text); background: none; border: none; width: 100%;
  text-align: left;
}
.lib-ctx-item:hover { background: var(--panel2); }
.lib-ctx-item svg { width: 16px; height: 16px; flex-shrink: 0; color: var(--muted); }
.lib-ctx-item.danger { color: var(--red); }
.lib-ctx-item.danger svg { color: var(--red); }
.lib-ctx-separator { height: 1px; background: var(--line); margin: 4px 0; }

/* Titre + statut sous la couverture */
.lib-item-info { padding: 8px 2px 0; }
.lib-item-title {
  font-size: 12px; font-weight: 600; line-height: 1.3;
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; word-break: break-word; color: var(--text);
}
.lib-item-meta { font-size: 10px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Status select compact */
.lib-status-select {
  display: none; /* géré via menu contextuel */
}
/* Toolbar filtre + recherche */
.lib-toolbar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-bottom: 18px; padding: 10px 14px; background: var(--panel2);
  border: 1px solid var(--line); border-radius: 12px;
}
.lib-search {
  flex: 1; min-width: 160px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--drop-bg); color: var(--text); padding: 7px 11px; font: inherit; font-size: 13px;
}
.lib-search:focus { border-color: var(--blue2); outline: none; }
.lib-filters { display: flex; gap: 5px; }
.lib-filter {
  padding: 5px 12px; border-radius: 999px; font-size: 12px; font-weight: 700;
  border: 1px solid var(--line); background: transparent; color: var(--muted); cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.lib-filter:hover  { background: var(--panel); color: var(--text); }
.lib-filter.active { background: rgba(74,158,255,.12); border-color: var(--blue2); color: var(--blue); }
/* Mark-as dropdown inline */
.lib-status-select {
  font-size: 11px; padding: 4px 6px; border-radius: 7px; border: 1px solid var(--line);
  background: var(--drop-bg); color: var(--text); cursor: pointer;
}
.lib-status-select:focus { outline: none; border-color: var(--blue2); }
/* Library upload drop zone */
.lib-drop-zone {
  border: 1.5px dashed var(--line); border-radius: 12px; background: var(--deep-bg);
  padding: 28px; text-align: center; cursor: pointer; color: var(--muted); font-size: 13px;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  transition: border-color .15s, background .15s;
}
.lib-drop-zone:hover, .lib-drop-zone.drag { border-color: var(--blue); background: rgba(74,158,255,.04); }

@media print {
  body { background: white; color: #111; }
  .sidebar, .topbar, .no-print { display: none !important; }
  .app { display: block; }
  .content { padding: 0; }
  .card { box-shadow: none; border-color: #ddd; background: white; }
  .report-preview { color: #111; }
  .report-kpi { background: #fafafa; border-color: #ddd; }
  .insight { background: #f5f4ed; border-left-color: #c9a227; }
  .report-title p, .report-kpi span { color: #666; }
}
