/* ================================================================
   WriteYourScore Hub — Theme v2 (Modern Clean)
   Inspiré du design Z-Trib : fond clair, cartes blanches, accents vifs
   Dark mode conservé — Light mode modernisé
   ================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Barlow+Condensed:ital,wght@0,600;0,700;0,800;0,900;1,800;1,900&family=Barlow:wght@300;400;500;600;700&family=Inter:wght@400;500;600;700&display=swap');

/* ════════════════════════════════════════════════════════
   VARIABLES — MODE SOMBRE (défaut)
   ════════════════════════════════════════════════════════ */
:root {
  /* Structure */
  --black:    #0b0d10;
  --dark:     #111318;
  --surface:  #16191f;
  --card:     #1c2028;
  --border:   #272c38;
  --border2:  #323849;

  /* Accents */
  --gold:     #f5c400;
  --gold-dim: rgba(245,196,0,.12);
  --orange:   #ff6b35;
  --white:    #eef0f4;
  --muted:    #6b7280;
  --muted2:   #4b5563;

  /* Sémantique */
  --green:     #10b981;
  --green-dim: rgba(16,185,129,.12);
  --red:       #ef4444;
  --red-dim:   rgba(239,68,68,.12);
  --blue:      #3b82f6;
  --blue-dim:  rgba(59,130,246,.12);
  --purple:    #8b5cf6;
  --purple-dim:rgba(139,92,246,.12);

  --success: var(--green);
  --danger:  var(--red);
  --text:    var(--white);

  /* Layout */
  --topbar-h:  56px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.3);
  --shadow-md: 0 4px 16px rgba(0,0,0,.4);
  --shadow-lg: 0 8px 40px rgba(0,0,0,.5);
}

/* ════════════════════════════════════════════════════════
   VARIABLES — MODE CLAIR (inspiré Z-Trib)
   ════════════════════════════════════════════════════════ */
[data-theme="light"] {
  --black:    #f4f6f9;
  --dark:     #eaecf1;
  --surface:  #ffffff;
  --card:     #ffffff;
  --border:   #e5e8ef;
  --border2:  #d1d5de;

  --gold:     #d4a000;
  --gold-dim: rgba(212,160,0,.1);
  --orange:   #f97316;
  --white:    #111827;
  --muted:    #6b7280;
  --muted2:   #9ca3af;

  --green:     #059669;
  --green-dim: rgba(5,150,105,.1);
  --red:       #dc2626;
  --red-dim:   rgba(220,38,38,.1);
  --blue:      #2563eb;
  --blue-dim:  rgba(37,99,235,.1);
  --purple:    #7c3aed;
  --purple-dim:rgba(124,58,237,.1);

  --text: #111827;

  --shadow-sm: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 4px 16px rgba(0,0,0,.08);
  --shadow-lg: 0 8px 40px rgba(0,0,0,.12);
}

/* ════════════════════════════════════════════════════════
   BASE
   ════════════════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  height: 100%;
}
body {
  min-height: 100%;
  background: var(--black);
  color: var(--text);
  font-family: 'Inter', 'Barlow', sans-serif;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Mode clair : fond légèrement grisé comme Z-Trib */
[data-theme="light"] html,
[data-theme="light"] body,
html[data-theme="light"],
body[data-theme="light"] {
  background: #f4f6f9;
  color: var(--text);
}

/* ════════════════════════════════════════════════════════
   LAYOUT
   ════════════════════════════════════════════════════════ */

/* Topbar fixe en haut (desktop + mobile) */
.topbar-shell {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 52px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  padding: 0 14px;
  gap: 12px;
  z-index: 200;
  flex-shrink: 0;
}
[data-theme="light"] .topbar-shell {
  background: #ffffff;
  border-bottom: 1px solid #e5e8ef;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}

/* Layout : tout le contenu sous la topbar */
.layout {
  display: flex;
  flex-direction: row;
  padding-top: 52px;
}

/* ════════════════════════════════════════════════════════
   SIDEBAR  — masquée par défaut, toggle au clic
   ════════════════════════════════════════════════════════ */
.sidebar {
  display: flex !important;
  flex-direction: column;
  width: 240px;
  min-width: 240px;
  position: fixed;
  top: 52px;
  bottom: 0;          /* bottom:0 = hauteur réelle sans barre navigateur */
  left: -260px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  box-shadow: none;
  z-index: 190;
  overflow: hidden;
  transition: left .22s cubic-bezier(.4,0,.2,1), box-shadow .22s;
}
.sidebar.open {
  left: 0;
  box-shadow: 4px 0 24px rgba(0,0,0,.3);
}
[data-theme="light"] .sidebar { background: #ffffff; border-right-color: #e5e8ef; }
[data-theme="light"] .sidebar.open { box-shadow: 4px 0 16px rgba(0,0,0,.1); }

/* Overlay derrière la sidebar */
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  top: 52px;
  background: rgba(0,0,0,.4);
  backdrop-filter: blur(1px);
  z-index: 189;
}
.sidebar-overlay.open { display: block; }

/* ── Topbar brand + bouton hamburger ── */
.brand {
  display: flex;
  align-items: center;
  text-decoration: none;
  flex-shrink: 0;
  overflow: hidden;
}
.brand-logo {
  display: block;
  width: 32px !important;
  height: 32px !important;
  min-width: 32px;
  min-height: 32px;
  max-width: 32px;
  max-height: 32px;
  object-fit: contain;
  flex-shrink: 0;
  border-radius: 6px;
}
.brand-name {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 900;
  font-size: 1.05rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--white);
  margin-left: 8px;
  white-space: nowrap;
}
[data-theme="light"] .brand-name { color: var(--text); }

.topbar-hamburger {
  background: none; border: none; cursor: pointer;
  width: 36px; height: 36px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); transition: background .15s, color .15s;
  flex-shrink: 0;
}
.topbar-hamburger:hover { background: rgba(255,255,255,.07); color: var(--white); }
[data-theme="light"] .topbar-hamburger:hover { background: #f0f2f5; color: #111827; }
.topbar-hamburger.active { color: var(--gold); }
[data-theme="light"] .topbar-hamburger.active { color: var(--blue); }

.topbar-right {
  margin-left: auto;
  display: flex; align-items: center; gap: 8px;
}

/* Theme toggle (topbar) */
.theme-toggle {
  display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); cursor: pointer;
  font-size: .9rem; color: var(--muted); transition: all .15s;
}
.theme-toggle:hover { border-color: var(--gold); color: var(--gold); background: var(--gold-dim); }
[data-theme="light"] .theme-toggle:hover { border-color: var(--blue); color: var(--blue); background: var(--blue-dim); }
.theme-toggle-icon { pointer-events: none; }

/* User avatar (topbar) */
.user-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--gold-dim); border: 2px solid rgba(245,196,0,.3);
  display: flex; align-items: center; justify-content: center;
  font-size: .75rem; font-weight: 700; color: var(--gold);
  overflow: hidden; flex-shrink: 0; cursor: pointer; padding: 0;
  transition: border-color .15s, box-shadow .15s;
}
.user-avatar:hover { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-dim); }
[data-theme="light"] .user-avatar { border-color: var(--blue-dim); color: var(--blue); background: var(--blue-dim); }
[data-theme="light"] .user-avatar:hover { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-dim); }
.user-avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ── Sidebar intérieur ── */
.sidebar-user {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px; border-bottom: 1px solid var(--border);
  cursor: pointer; transition: background .15s;
}
.sidebar-user:hover { background: rgba(255,255,255,.04); }
[data-theme="light"] .sidebar-user:hover { background: #f4f6f9; }
.sidebar-user-info { min-width: 0; flex: 1; }
.sidebar-user-name {
  font-size: .8rem; font-weight: 600; color: var(--white);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
[data-theme="light"] .sidebar-user-name { color: #111827; }
.sidebar-user-sub { font-size: .68rem; color: var(--muted); margin-top: 1px; }

/* Nav */
.sidebar-nav { flex: 1; display: flex; flex-direction: column; padding: 8px 8px; gap: 1px; overflow-y: auto; overflow-x: hidden; min-height: 0; scrollbar-width: thin; scrollbar-color: var(--border2) transparent; }

/* Section repliable */
.sidebar-section {
  margin-top: 4px;
}
.sidebar-section-toggle {
  display: flex; align-items: center; gap: 8px;
  width: 100%; padding: 6px 8px;
  background: none; border: none; cursor: pointer;
  font-size: .65rem; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--muted2);
  border-radius: var(--radius-sm);
  transition: color .15s;
  font-family: 'Inter', sans-serif;
}
.sidebar-section-toggle:hover { color: var(--muted); }
.sidebar-section-arrow {
  margin-left: auto; font-size: .55rem;
  transition: transform .2s; color: var(--muted2);
}
.sidebar-section.open .sidebar-section-arrow { transform: rotate(90deg); }
.sidebar-section-items {
  display: none; flex-direction: column; gap: 1px;
}
.sidebar-section.open .sidebar-section-items { display: flex; }

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; font-size: .82rem; font-weight: 500;
  color: var(--muted); text-decoration: none; cursor: pointer;
  transition: color .15s, background .15s;
  border: none; background: none; white-space: nowrap;
  width: 100%; position: relative; border-radius: var(--radius-sm);
}
.nav-item:hover { color: var(--white); background: rgba(255,255,255,.06); }
[data-theme="light"] .nav-item:hover { color: #111827; background: rgba(17,24,39,.06); }
.nav-item.active { color: var(--gold); background: var(--gold-dim); font-weight: 600; }
[data-theme="light"] .nav-item.active { color: var(--blue); background: var(--blue-dim); }
.nav-item.active::before {
  content: ''; position: absolute;
  left: 0; top: 5px; bottom: 5px; width: 3px;
  background: var(--gold); border-radius: 0 3px 3px 0;
}
[data-theme="light"] .nav-item.active::before { background: var(--blue); }
.nav-icon { font-size: .95rem; width: 18px; text-align: center; flex-shrink: 0; }
.nav-label { flex: 1; }

/* Sidebar footer — toujours visible en bas */
.sidebar-footer {
  padding: 10px 8px; border-top: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 1px;
  flex-shrink: 0;           /* ne rétrécit jamais */
}

/* Dropdown user */
.user-dropdown {
  display: none; position: fixed; min-width: 200px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-md); box-shadow: var(--shadow-lg);
  z-index: 9999; overflow: hidden;
}
.user-dropdown-header { padding: 12px 14px 10px; }
.udh-name { font-size: .84rem; font-weight: 600; color: var(--white); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.udh-email { font-size: .7rem; color: var(--muted); margin-top: 2px; }
.user-dropdown-divider { height: 1px; background: var(--border); }
.user-dropdown-item {
  display: flex; align-items: center; gap: 9px;
  width: 100%; padding: 10px 14px; font-size: .82rem;
  font-family: 'Inter', 'Barlow', sans-serif; font-weight: 500;
  color: var(--muted); background: none; border: none;
  cursor: pointer; text-align: left; text-decoration: none;
  transition: background .12s, color .12s;
}
.user-dropdown-item:hover { background: rgba(255,255,255,.04); color: var(--white); }
[data-theme="light"] .user-dropdown-item:hover { background: #f4f6f9; color: var(--text); }
.user-dropdown-logout:hover { color: var(--red); background: var(--red-dim); }

/* Legacy masqués */
.topbar { display: none !important; }
.mob-bar { display: none !important; }
.mob-overlay { display: none !important; }

/* ════════════════════════════════════════════════════════
   MAIN CONTENT
   ════════════════════════════════════════════════════════ */
.main { flex: 1; min-width: 0; overflow-x: hidden; }
.main-inner { padding: 28px 40px; max-width: 1440px; margin: 0 auto; }

@media (max-width: 900px) { .main-inner { padding: 20px 24px; } }
@media (max-width: 560px) { .main-inner { padding: 14px 14px; } }


/* ════════════════════════════════════════════════════════
   DESKTOP (≥ 900px) : sidebar pousse le contenu
   ════════════════════════════════════════════════════════ */
@media (min-width: 900px) {
  .sidebar-overlay { display: none !important; }
  .main { transition: margin-left .22s cubic-bezier(.4,0,.2,1); }
  body.sidebar-open .main { margin-left: 240px; }
}
/* ════════════════════════════════════════════════════════
   PAGE HEADER
   ════════════════════════════════════════════════════════ */
.page-header { margin-bottom: 32px; }
.page-back {
  display: inline-flex; align-items: center; gap: 7px;
  color: var(--muted); font-size: .78rem; text-decoration: none;
  margin-bottom: 16px; transition: color .15s;
  letter-spacing: .04em; text-transform: uppercase; font-weight: 600;
}
.page-back:hover { color: var(--white); }
[data-theme="light"] .page-back:hover { color: var(--text); }
.page-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 900; font-style: italic;
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  text-transform: uppercase;
  letter-spacing: -.01em;
  line-height: 1; color: var(--white);
}
.page-sub { color: var(--muted); margin-top: 8px; font-size: .88rem; font-weight: 400; }

/* ════════════════════════════════════════════════════════
   ALERTS
   ════════════════════════════════════════════════════════ */
.alert {
  padding: 13px 18px;
  border-radius: var(--radius-sm);
  font-size: .87rem;
  margin-bottom: 20px;
  display: flex; align-items: center; gap: 10px;
}
.alert-success { background: var(--green-dim); border: 1px solid rgba(16,185,129,.25); color: var(--green); }
.alert-error   { background: var(--red-dim);   border: 1px solid rgba(239,68,68,.25);  color: var(--red); }
.alert-warn    { background: var(--gold-dim);   border: 1px solid rgba(245,196,0,.25);  color: var(--gold); }
.alert-info    { background: var(--blue-dim);   border: 1px solid rgba(59,130,246,.25); color: var(--blue); }

/* ════════════════════════════════════════════════════════
   SECTIONS
   ════════════════════════════════════════════════════════ */
.section { margin-bottom: 48px; }
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 18px; flex-wrap: wrap; gap: 10px;
}
.section-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 800; font-size: 1.1rem;
  text-transform: uppercase; letter-spacing: .05em;
  display: flex; align-items: center; gap: 10px;
  color: var(--white);
}
[data-theme="light"] .section-title { color: #111827; }
.section-badge {
  background: var(--border); color: var(--muted);
  font-size: .68rem; padding: 2px 8px;
  border-radius: 999px; font-family: 'Inter', sans-serif; font-weight: 500;
}

/* ════════════════════════════════════════════════════════
   BUTTONS
   ════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: .82rem; font-weight: 600;
  font-family: 'Inter', 'Barlow Condensed', sans-serif;
  letter-spacing: .02em;
  cursor: pointer; border: none;
  text-decoration: none;
  transition: all .15s;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary {
  background: var(--gold);
  color: #111827;
  box-shadow: 0 1px 3px rgba(245,196,0,.3);
}
.btn-primary:hover { box-shadow: 0 4px 16px rgba(245,196,0,.35); }
[data-theme="light"] .btn-primary {
  background: var(--blue);
  color: #ffffff;
  box-shadow: 0 1px 3px rgba(37,99,235,.3);
}
[data-theme="light"] .btn-primary:hover {
  box-shadow: 0 4px 16px rgba(37,99,235,.35);
  background: #1d4ed8;
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}
.btn-ghost:hover { color: var(--white); border-color: var(--border2); background: rgba(255,255,255,.04); }
[data-theme="light"] .btn-ghost:hover { color: var(--text); background: #f4f6f9; }

.btn-teal   { background: var(--green-dim); color: var(--green); border: 1px solid rgba(16,185,129,.2); }
.btn-teal:hover { background: rgba(16,185,129,.18); }
.btn-danger { background: var(--red-dim); color: var(--red); border: 1px solid rgba(239,68,68,.25); }
.btn-danger:hover { background: rgba(239,68,68,.22); }
.btn-warn   { background: var(--gold-dim); color: var(--gold); border: 1px solid rgba(245,196,0,.25); }
.btn-warn:hover { background: rgba(245,196,0,.18); }
.btn-blue   { background: var(--blue-dim); color: var(--blue); border: 1px solid rgba(59,130,246,.25); }
.btn-blue:hover { background: rgba(59,130,246,.18); }
.btn-sm { padding: 6px 12px; font-size: .76rem; }

/* ════════════════════════════════════════════════════════
   CARDS — style Z-Trib
   ════════════════════════════════════════════════════════ */
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; }

.instance-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px 22px;
  position: relative;
  overflow: hidden;
  transition: box-shadow .2s, transform .2s, border-color .2s;
  box-shadow: var(--shadow-sm);
}
[data-theme="light"] .instance-card { box-shadow: 0 1px 4px rgba(0,0,0,.06); }
.instance-card::before {
  content:''; position:absolute; top:0; left:0; right:0; height:3px;
  background: var(--gold);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}
.instance-card.invited::before { background: var(--blue); }
.instance-card:hover {
  border-color: var(--border2);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.instance-card-header { display:flex; align-items:flex-start; justify-content:space-between; margin-bottom:14px; }
.instance-icon {
  width:42px; height:42px;
  background: var(--gold-dim);
  border: 1px solid rgba(245,196,0,.15);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem;
}
.instance-card.invited .instance-icon { background: var(--blue-dim); border-color: rgba(59,130,246,.2); }
.card-badges { display: flex; gap: 5px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.instance-name {
  font-family:'Barlow Condensed',sans-serif; font-weight:800;
  font-size:1.1rem; text-transform:uppercase; letter-spacing:.03em; margin-bottom:4px;
}
.instance-meta { font-size:.78rem; color:var(--muted); margin-top:8px; }
.instance-actions { display:flex; gap:7px; margin-top:16px; flex-wrap:wrap; }

/* Card générique */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  transition: box-shadow .2s, transform .2s;
}
[data-theme="light"] .card {
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.card:hover {
  box-shadow: var(--shadow-md);
}

/* ════════════════════════════════════════════════════════
   BADGES — couleurs vives style Z-Trib
   ════════════════════════════════════════════════════════ */
.badge {
  padding: 3px 9px;
  border-radius: 999px;
  font-size: .68rem; font-weight: 600;
  font-family: 'Inter', sans-serif;
  letter-spacing: .03em;
  white-space: nowrap;
}
.badge-active    { background: var(--green-dim); color: var(--green); border: 1px solid rgba(16,185,129,.25); }
.badge-pending   { background: var(--gold-dim);  color: var(--gold);  border: 1px solid rgba(245,196,0,.25); }
.badge-suspended { background: var(--red-dim);   color: var(--red);   border: 1px solid rgba(239,68,68,.25); }
.badge-demo      { background: var(--gold-dim);  color: var(--gold);  border: 1px solid rgba(245,196,0,.25); }
.badge-local     { background: rgba(139,92,246,.15); color: #a78bfa;  border: 1px solid rgba(139,92,246,.25); }
.badge-invite    { background: rgba(59,130,246,.12); color: #60a5fa;  border: 1px solid rgba(59,130,246,.25); }
.badge-pro       { background: var(--green-dim); color: var(--green); border: 1px solid rgba(16,185,129,.25); }
.badge-read      { background: var(--blue-dim);  color: var(--blue);  border: 1px solid rgba(59,130,246,.25); }
.badge-write     { background: var(--purple-dim);color: var(--purple);border: 1px solid rgba(139,92,246,.25); }
.badge-owner     { background: var(--gold-dim);  color: var(--gold);  border: 1px solid rgba(245,196,0,.25); }
.badge-update    { background: rgba(249,115,22,.12); color: var(--orange); border: 1px solid rgba(249,115,22,.25); }
.badge-green     { background: var(--green-dim); color: var(--green); border: 1px solid rgba(16,185,129,.25); }
.badge-blue      { background: var(--blue-dim);  color: var(--blue);  border: 1px solid rgba(59,130,246,.25); }

/* ════════════════════════════════════════════════════════
   EMPTY STATE
   ════════════════════════════════════════════════════════ */
.empty-state {
  background: var(--card);
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  padding: 52px 32px;
  text-align: center;
}
.empty-state .empty-icon { font-size: 2.5rem; margin-bottom: 16px; }
.empty-state h3 {
  font-family:'Barlow Condensed',sans-serif; font-weight:800;
  font-size:1.2rem; text-transform:uppercase; margin-bottom:8px;
}
.empty-state p { color: var(--muted); font-size: .88rem; margin-bottom: 24px; }

/* ════════════════════════════════════════════════════════
   STATS ROW — style Z-Trib (cartes individuelles avec icône colorée)
   ════════════════════════════════════════════════════════ */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px 22px;
  box-shadow: var(--shadow-sm);
  display: flex; align-items: flex-start; gap: 14px;
  transition: box-shadow .2s, transform .15s;
}
[data-theme="light"] .stat-card { box-shadow: 0 1px 4px rgba(0,0,0,.06); }
.stat-card:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }

.stat-icon {
  width: 42px; height: 42px; flex-shrink: 0;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem;
}
.stat-icon-gold   { background: var(--gold-dim);   color: var(--gold); }
.stat-icon-green  { background: var(--green-dim);  color: var(--green); }
.stat-icon-blue   { background: var(--blue-dim);   color: var(--blue); }
.stat-icon-red    { background: var(--red-dim);    color: var(--red); }
.stat-icon-purple { background: var(--purple-dim); color: var(--purple); }
.stat-icon-orange { background: rgba(249,115,22,.12); color: var(--orange); }

.stat-body { min-width: 0; }
.stat-val {
  font-family:'Barlow Condensed',sans-serif; font-weight:900;
  font-size:2rem; color: var(--white); line-height:1;
}
[data-theme="light"] .stat-val { color: #111827; }
.stat-lbl {
  font-size:.72rem; letter-spacing:.04em;
  text-transform:uppercase; color:var(--muted); margin-top:4px;
  font-weight: 600;
}
.stat-trend {
  font-size: .7rem; font-weight: 600; margin-top: 4px;
  display: flex; align-items: center; gap: 3px;
}
.stat-trend.up   { color: var(--green); }
.stat-trend.down { color: var(--red); }
.stat-trend.flat { color: var(--muted); }

/* ════════════════════════════════════════════════════════
   TABLES
   ════════════════════════════════════════════════════════ */
.table-wrap {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
[data-theme="light"] .table-wrap { box-shadow: 0 1px 4px rgba(0,0,0,.06); }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; }
th {
  text-align:left; padding:12px 18px;
  font-size:.7rem; color:var(--muted); font-weight:600;
  text-transform:uppercase; letter-spacing:.06em;
  border-bottom:1px solid var(--border);
  white-space:nowrap;
  font-family:'Inter',sans-serif;
  background: var(--surface);
}
[data-theme="light"] th { background: #f8f9fb; }
td {
  padding:14px 18px;
  border-bottom:1px solid var(--border);
  vertical-align:middle; font-size:.87rem;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255,255,255,.025); }
[data-theme="light"] tr:hover td { background: #f8f9fb; }

.member-name { display:flex; align-items:center; gap:11px; }
.member-avatar {
  width:34px; height:34px; border-radius:50%;
  background: var(--blue-dim);
  display:flex; align-items:center; justify-content:center;
  font-size:.75rem; font-weight:700; color:var(--blue);
  overflow:hidden; flex-shrink:0;
}
[data-theme="light"] .member-avatar { background: var(--blue-dim); color: var(--blue); }
.member-avatar img { width:100%; height:100%; object-fit:cover; }
.member-txt strong { display:block; font-size:.85rem; font-weight:600; }
.member-txt span { font-size:.75rem; color:var(--muted); }

/* ════════════════════════════════════════════════════════
   MODALS
   ════════════════════════════════════════════════════════ */
.modal-overlay {
  position:fixed; inset:0; z-index:200;
  background:rgba(0,0,0,.6); backdrop-filter:blur(8px);
  display:flex; align-items:center; justify-content:center;
  padding:24px; opacity:0; pointer-events:none; transition:opacity .2s;
}
.modal-overlay.open { opacity:1; pointer-events:all; }
.modal {
  background:var(--surface); border:1px solid var(--border);
  border-radius:var(--radius-lg); padding:32px;
  width:100%; max-width:460px;
  transform:translateY(16px); transition:transform .2s;
  max-height:90vh; overflow-y:auto; position:relative;
  box-shadow: var(--shadow-lg);
}
[data-theme="light"] .modal { background: #ffffff; }
.modal-overlay.open .modal { transform:translateY(0); }
.modal-top-bar {
  height:3px; background:var(--gold);
  position:absolute; top:0; left:0; right:0;
  border-radius:var(--radius-lg) var(--radius-lg) 0 0;
}
.modal-top-bar.danger { background:var(--red); }
.modal-top-bar.warn   { background:var(--orange); }
.modal-top-bar.info   { background:var(--blue); }
.modal-top-bar.green  { background:var(--green); }
.modal-title {
  font-family:'Barlow Condensed',sans-serif; font-weight:900;
  font-size:1.4rem; text-transform:uppercase; letter-spacing:.03em; margin-bottom:6px;
}
.modal-sub { color:var(--muted); font-size:.85rem; margin-bottom:24px; line-height:1.6; }
.modal-actions { display:flex; justify-content:flex-end; gap:10px; margin-top:24px; }

/* ════════════════════════════════════════════════════════
   FORMS
   ════════════════════════════════════════════════════════ */
.form-group { margin-bottom: 18px; }
.form-label {
  display:block; font-size:.72rem; font-weight:600;
  letter-spacing:.06em; text-transform:uppercase;
  margin-bottom:7px; color:var(--muted);
  font-family:'Inter',sans-serif;
}
.form-input {
  width:100%; padding:10px 14px;
  background:var(--black); border:1px solid var(--border);
  border-radius:var(--radius-sm); color:var(--white);
  font-family:'Inter','Barlow',sans-serif; font-size:.9rem;
  transition:border-color .15s, box-shadow .15s; outline:none;
}
[data-theme="light"] .form-input { background:#f8f9fb; color:#111827; }
.form-input:focus {
  border-color:var(--gold);
  box-shadow:0 0 0 3px var(--gold-dim);
}
[data-theme="light"] .form-input:focus {
  border-color:var(--blue);
  box-shadow:0 0 0 3px var(--blue-dim);
}
.form-select {
  appearance:none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%236b7280' viewBox='0 0 24 24'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat:no-repeat; background-position:right 12px center; background-size:20px;
  padding-right:40px; background-color:var(--black);
}
[data-theme="light"] .form-select { background-color:#f8f9fb; }
.fi-inline {
  padding:5px 28px 5px 10px; background:var(--black); border:1px solid var(--border);
  border-radius:var(--radius-sm); color:var(--white);
  font-family:'Inter',sans-serif; font-size:.78rem; outline:none; appearance:none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%236b7280' viewBox='0 0 24 24'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat:no-repeat; background-position:right 6px center; background-size:18px;
  cursor:pointer; transition:border-color .15s;
}
[data-theme="light"] .fi-inline { background-color:#f8f9fb; color:#111827; }

/* ════════════════════════════════════════════════════════
   NOTICES
   ════════════════════════════════════════════════════════ */
.notice {
  display:flex; align-items:center; gap:12px;
  padding:14px 18px; border-radius:var(--radius-sm);
  margin-bottom:24px; font-size:.87rem;
}
.notice-expired  { background:var(--red-dim);   border:1px solid rgba(239,68,68,.25);   color:var(--red); flex-wrap:wrap; justify-content:space-between; }
.notice-valid    { background:var(--green-dim); border:1px solid rgba(16,185,129,.2);   color:var(--green); }
.notice-role-read  { background:var(--blue-dim);   border:1px solid rgba(59,130,246,.2);  color:var(--blue); }
.notice-role-write { background:var(--purple-dim); border:1px solid rgba(139,92,246,.2);  color:var(--purple); }

/* ════════════════════════════════════════════════════════
   LANG BTN
   ════════════════════════════════════════════════════════ */
.inst-lang-btn {
  display:inline-flex; align-items:center; gap:5px;
  padding:5px 10px; background:var(--surface); border:1px solid var(--border);
  border-radius:var(--radius-sm); cursor:pointer; font-size:.75rem;
  color:var(--text); white-space:nowrap; transition:border-color .15s;
}
.inst-lang-btn:hover { border-color:var(--gold); }
.inst-lang-btn img { width:16px; height:12px; border-radius:1px; flex-shrink:0; }

/* ════════════════════════════════════════════════════════
   RESPONSIVE
   ════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  .col-hide-mobile { display:none; }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .grid-cards { grid-template-columns:1fr; }
  .page-title { font-size:1.8rem; }
  .modal { padding:24px 18px; }
}

/* ════════════════════════════════════════════════════════
   UTILITIES
   ════════════════════════════════════════════════════════ */
.text-gold   { color:var(--gold); }
.text-green  { color:var(--green); }
.text-red    { color:var(--red); }
.text-muted  { color:var(--muted); }
.text-white  { color:var(--white); }
.text-blue   { color:var(--blue); }
.fw-600 { font-weight:600; }
.fw-700 { font-weight:700; }
.fw-800 { font-weight:800; }
.font-cond {
  font-family:'Barlow Condensed',sans-serif;
  font-weight:900; text-transform:uppercase; letter-spacing:.04em;
}
code {
  font-family:monospace; background:var(--border);
  padding:2px 6px; border-radius:3px; font-size:.82em;
}

/* ════════════════════════════════════════════════════════
   SCROLLBAR — style discret
   ════════════════════════════════════════════════════════ */
::-webkit-scrollbar { width:6px; height:6px; }
::-webkit-scrollbar-track { background:transparent; }
::-webkit-scrollbar-thumb { background:var(--border2); border-radius:3px; }
::-webkit-scrollbar-thumb:hover { background:var(--muted2); }
