@import url('https://fonts.googleapis.com/css2?family=Rajdhani:wght@500;600;700&family=Lora:ital,wght@0,400;0,600;0,700;1,400&family=Inter:wght@300;400;500;600&family=JetBrains+Mono:wght@400;500&display=swap');

/* ═══════════════════════════════════════════════════════════════
   MilkyLabs Design System
   Theme: warm dark paper — cozy writing desk with candlelight
   ═══════════════════════════════════════════════════════════════ */

:root {
  /* ── Backgrounds (warm near-black) ── */
  --bg-0:    #0f0e0b;
  --bg-1:    #161410;
  --bg-2:    #1d1b15;
  --bg-3:    #252218;
  --bg-4:    #2d2a1e;
  --bg-hover:#332f22;

  /* ── Borders ── */
  --border:       #2a2720;
  --border-light: #3a362a;

  /* ── Primary accent: warm honey gold ── */
  --accent:      #d4a843;
  --accent-dim:  rgba(212,168,67,0.12);
  --accent-glow: rgba(212,168,67,0.25);

  /* ── Secondary palette ── */
  --rose:       #d47a6a;
  --rose-dim:   rgba(212,122,106,0.12);
  --sky:        #6aadcc;
  --sky-dim:    rgba(106,173,204,0.12);
  --mint:       #7abf9e;
  --mint-dim:   rgba(122,191,158,0.12);
  --gold:       #d4a843;
  --gold-dim:   rgba(212,168,67,0.12);
  --red:        #d46a6a;
  --red-dim:    rgba(212,106,106,0.13);

  /* Aliases */
  --cyan:       var(--sky);
  --cyan-dim:   var(--sky-dim);
  --pink:       var(--rose);
  --pink-dim:   var(--rose-dim);
  --purple:     #b07ad4;
  --green:      var(--mint);

  /* ── Text (warm cream tones) ── */
  --text-0: #f2ead8;
  --text-1: #c8bca0;
  --text-2: #8a7e65;
  --text-3: #50473a;

  /* ── Layout ── */
  --sidebar-w: 232px;
  --topbar-h:  54px;

  /* ── Shape ── */
  --radius:    8px;
  --radius-lg: 14px;
  --radius-xl: 20px;

  /* ── Shadows (warm-tinted, brownish) ── */
  --shadow:        0 4px 20px rgba(10,8,4,.55);
  --shadow-lg:     0 10px 48px rgba(10,8,4,.65);
  --shadow-accent: 0 4px 18px rgba(212,168,67,0.28);
  --shadow-rose:   0 4px 20px rgba(212,122,106,0.18);

  /* ── Gradients ── */
  --grad-accent: linear-gradient(135deg, #d4a843 0%, #d47a6a 100%);
  --grad-sky:    linear-gradient(135deg, #6aadcc 0%, #7abf9e 100%);
  --grad-mint:   linear-gradient(135deg, #7abf9e 0%, #6aadcc 100%);
}

/* ── RESET ─────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: 'Inter', sans-serif;
  background: var(--bg-0);
  color: var(--text-1);
  font-size: 14px;
  line-height: 1.6;
  overflow: hidden;
}

/* ── SCROLLBAR ──────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #3a2e1e; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); }

/* ── LAYOUT ─────────────────────────────────────────────────────── */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: var(--topbar-h) 1fr;
  height: 100vh;
  overflow: hidden;
  transition: grid-template-columns 0.22s ease;
}

/* ── TOPBAR ─────────────────────────────────────────────────────── */
.topbar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px 0 0;
  background: var(--bg-1);
  border-bottom: 1px solid var(--border);
  position: relative;
  z-index: 100;
}

.topbar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  width: var(--sidebar-w);
  flex-shrink: 0;
  padding: 0 18px;
  height: 100%;
  border-right: 1px solid var(--border);
  transition: width 0.22s ease, padding 0.22s ease;
}

.logo-mark {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, #d4a843, #d47a6a);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Lora', serif;
  font-weight: 700;
  font-size: 16px;
  color: #0f0e0b;
  flex-shrink: 0;
  box-shadow: var(--shadow-accent);
}

.logo-text {
  font-family: 'Lora', serif;
  font-weight: 700;
  font-size: 17px;
  letter-spacing: 0.02em;
  background: linear-gradient(135deg, #d4a843, #d47a6a);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.logo-text span { -webkit-text-fill-color: transparent; }

.topbar-title {
  flex: 1;
  font-family: 'Inter', sans-serif;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-2);
  letter-spacing: 0.01em;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  padding-right: 4px;
}

/* ── SIDEBAR ─────────────────────────────────────────────────────── */
.sidebar {
  background: var(--bg-1);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  transition: width 0.22s ease;
}

.sidebar-section { padding: 6px 0; }

.sidebar-label {
  padding: 10px 18px 5px;
  font-family: 'Inter', sans-serif;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-3);
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 18px;
  color: var(--text-2);
  text-decoration: none;
  transition: all 0.18s ease;
  border-left: 2px solid transparent;
  font-size: 13.5px;
  font-weight: 400;
  border-radius: 0 10px 10px 0;
  margin-right: 8px;
}

.sidebar-link:hover {
  color: var(--text-0);
  background: var(--bg-hover);
}

.sidebar-link.active {
  color: var(--accent);
  background: var(--accent-dim);
  border-left-color: var(--accent);
  font-weight: 500;
}

.sidebar-link svg { width: 15px; height: 15px; flex-shrink: 0; opacity: 0.75; transition: opacity 0.18s; }
.sidebar-link:hover svg, .sidebar-link.active svg { opacity: 1; }

.sidebar-badge {
  margin-left: auto;
  background: var(--red);
  color: white;
  font-size: 10px;
  font-weight: 600;
  min-width: 18px; height: 18px;
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 5px;
}

.sidebar-user {
  margin-top: auto;
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ── MAIN CONTENT ────────────────────────────────────────────────── */
.main-content {
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--bg-0);
  background-image:
    radial-gradient(ellipse 80% 50% at 20% -10%, rgba(212,168,67,0.04) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 80% 110%, rgba(212,122,106,0.04) 0%, transparent 55%);
}

.page-wrap {
  padding: 28px 28px;
  max-width: 1400px;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 28px;
  gap: 16px;
}

.page-title {
  font-family: 'Lora', serif;
  font-size: 28px;
  font-weight: 700;
  color: var(--text-0);
  line-height: 1.15;
  letter-spacing: -0.01em;
}

.page-subtitle {
  font-size: 13px;
  color: var(--text-3);
  margin-top: 5px;
  font-weight: 400;
}

/* ── AVATAR ──────────────────────────────────────────────────────── */
.avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Inter', sans-serif;
  font-weight: 600; font-size: 13px;
  color: var(--bg-0);
  flex-shrink: 0;
  text-transform: uppercase;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.avatar-sm { width: 24px; height: 24px; font-size: 10px; }
.avatar-lg { width: 44px; height: 44px; font-size: 17px; }

/* ── ROLE BADGE ──────────────────────────────────────────────────── */
.role-badge {
  display: inline-flex; align-items: center;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 10px; font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-family: 'Inter', sans-serif;
}

/* ── CARDS ───────────────────────────────────────────────────────── */
.card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.card:hover { border-color: var(--border-light); }

.card-header {
  padding: 15px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  justify-content: space-between; gap: 12px;
}

.card-title {
  font-family: 'Inter', sans-serif;
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-3);
}

.card-body { padding: 18px 20px; }

/* ── BUTTONS ─────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius);
  border: none;
  font-family: 'Inter', sans-serif;
  font-size: 13px; font-weight: 500;
  cursor: pointer;
  transition: all 0.18s ease;
  text-decoration: none;
  white-space: nowrap; line-height: 1;
  position: relative;
}
.btn svg { width: 14px; height: 14px; flex-shrink: 0; }

.btn-primary {
  background: linear-gradient(135deg, #d4a843, #c49030);
  color: #0f0e0b;
  font-weight: 600;
  box-shadow: 0 4px 18px rgba(212,168,67,0.28);
}
.btn-primary:hover {
  filter: brightness(1.08);
  box-shadow: 0 6px 28px rgba(212,168,67,0.38);
  transform: translateY(-1px);
}
.btn-primary:active { transform: translateY(0); }

.btn-ghost {
  background: transparent;
  color: var(--text-2);
  border: 1px solid var(--border-light);
}
.btn-ghost:hover { background: var(--bg-hover); color: var(--text-0); border-color: var(--border-light); }

.btn-danger {
  background: var(--red-dim);
  color: var(--red);
  border: 1px solid rgba(212,106,106,0.35);
}
.btn-danger:hover { background: var(--red); color: white; }

.btn-success {
  background: var(--mint-dim);
  color: var(--mint);
  border: 1px solid rgba(122,191,158,0.35);
}
.btn-success:hover { background: var(--mint); color: var(--bg-0); }

.btn-sm { padding: 5px 12px; font-size: 12px; border-radius: 8px; }
.btn-sm svg { width: 12px; height: 12px; }

.btn-icon {
  padding: 7px;
  border-radius: 8px;
  background: transparent; border: none;
  color: var(--text-2); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}
.btn-icon:hover { background: var(--bg-hover); color: var(--text-0); }
.btn-icon svg { width: 16px; height: 16px; }

/* ── INPUTS ──────────────────────────────────────────────────────── */
.input {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-3);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  color: var(--text-0);
  font-family: 'Inter', sans-serif;
  font-size: 13.5px;
  transition: border-color 0.18s, box-shadow 0.18s;
  outline: none;
}
.input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.input::placeholder { color: var(--text-3); }
textarea.input { resize: vertical; min-height: 80px; line-height: 1.6; }

.input-group {
  display: flex; flex-direction: column; gap: 6px;
  margin-bottom: 16px;
}
.input-label {
  font-size: 12px; font-weight: 500;
  color: var(--text-2); letter-spacing: 0.02em;
}

select.input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%238a7e65' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14L2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
  cursor: pointer;
}

/* ── STATUS BADGES ───────────────────────────────────────────────── */
.status-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-family: 'Inter', sans-serif;
}
.status-open       { background: var(--sky-dim);               color: var(--sky);    border: 1px solid rgba(106,173,204,0.3);   }
.status-in_progress{ background: var(--accent-dim);            color: var(--accent); border: 1px solid rgba(212,168,67,0.3);    }
.status-review     { background: rgba(176,122,212,0.12);       color: var(--purple); border: 1px solid rgba(176,122,212,0.3);   }
.status-returned   { background: var(--rose-dim);              color: var(--rose);   border: 1px solid rgba(212,122,106,0.3);   }
.status-closed     { background: var(--mint-dim);              color: var(--mint);   border: 1px solid rgba(122,191,158,0.3);   }

.priority-low      { color: var(--sky);    }
.priority-normal   { color: var(--text-1); }
.priority-high     { color: var(--gold);   }
.priority-critical { color: var(--red);    }

/* ── STAT CARDS ──────────────────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 18px;
  position: relative; overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--border-light); }

.stat-card::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--grad-accent);
  border-radius: var(--radius-lg) 0 0 var(--radius-lg);
}
.stat-card::after {
  content: '';
  position: absolute;
  top: -40px; right: -40px;
  width: 120px; height: 120px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.04;
  pointer-events: none;
}

.stat-card.cyan::before  { background: var(--sky);    }
.stat-card.cyan::after   { background: var(--sky);    }
.stat-card.pink::before  { background: var(--rose);   }
.stat-card.pink::after   { background: var(--rose);   }
.stat-card.purple::before{ background: var(--purple); }
.stat-card.purple::after { background: var(--purple); }
.stat-card.green::before { background: var(--mint);   }
.stat-card.green::after  { background: var(--mint);   }
.stat-card.gold::before  { background: var(--gold);   }
.stat-card.gold::after   { background: var(--gold);   }

.stat-value {
  font-family: 'Lora', serif;
  font-size: 42px; font-weight: 700;
  color: var(--text-0);
  line-height: 1;
}

.stat-label {
  font-size: 12px; color: var(--text-3);
  margin-top: 5px; font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* ── TASK KANBAN ──────────────────────────────────────────────────── */
.kanban-board {
  display: grid;
  grid-template-columns: repeat(5, 284px);
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 20px;
}

.kanban-col {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  display: flex; flex-direction: column;
  max-height: calc(100vh - 160px);
}

.kanban-col-header {
  padding: 13px 16px;
  display: flex; align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.kanban-col-title {
  font-family: 'Inter', sans-serif;
  font-size: 11px; font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase;
}

.kanban-col-count {
  font-size: 11px; color: var(--text-3);
  background: var(--bg-3);
  padding: 2px 8px; border-radius: 20px;
}

.kanban-cards {
  overflow-y: auto;
  flex: 1; padding: 10px;
  display: flex; flex-direction: column; gap: 8px;
}

.task-card {
  background: var(--bg-3);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 13px;
  cursor: pointer;
  transition: all 0.18s ease;
  text-decoration: none; display: block;
  position: relative;
}
.task-card:hover {
  background: var(--bg-4);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: var(--border-light);
}

.task-card-title {
  font-size: 13.5px; font-weight: 500;
  color: var(--text-0); margin-bottom: 9px;
  line-height: 1.45;
}

.task-card-meta {
  display: flex; align-items: center;
  gap: 8px; flex-wrap: wrap;
}

.task-deadline {
  font-size: 11px; color: var(--text-3);
  display: flex; align-items: center; gap: 3px;
}
.task-deadline.overdue { color: var(--red);  }
.task-deadline.soon    { color: var(--gold); }

.task-card .priority-bar {
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px;
  border-radius: var(--radius) 0 0 var(--radius);
}

/* ── CHAT ─────────────────────────────────────────────────────────── */
.chat-layout {
  display: flex;
  height: calc(100vh - var(--topbar-h));
  overflow: hidden;
}

.chat-sidebar {
  width: 210px;
  flex-shrink: 0;
  background: var(--bg-1);
  border-right: 1px solid var(--border);
  overflow-y: auto; padding: 8px 0;
}

.chat-channel-link {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 16px;
  color: var(--text-2);
  text-decoration: none; font-size: 13.5px;
  transition: all 0.15s;
  border-radius: 0 8px 8px 0;
  margin-right: 8px;
}
.chat-channel-link:hover { color: var(--text-0); background: var(--bg-hover); }
.chat-channel-link.active { color: var(--text-0); background: var(--bg-3); }
.chat-channel-link svg { width: 14px; height: 14px; opacity: 0.6; flex-shrink: 0; }

.chat-main { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden; }

.chat-header {
  padding: 0 22px; height: 50px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px; flex-shrink: 0;
}

.chat-messages {
  flex: 1; overflow-y: auto;
  padding: 16px 22px;
  display: flex; flex-direction: column; gap: 2px;
}

.msg {
  display: flex; gap: 11px;
  padding: 7px 12px;
  border-radius: var(--radius);
  transition: background 0.12s;
}
.msg:hover { background: var(--bg-2); }

.msg-body { flex: 1; min-width: 0; }

.msg-header {
  display: flex; align-items: baseline;
  gap: 8px; margin-bottom: 2px;
}

.msg-author {
  font-weight: 600; font-size: 13.5px;
  color: var(--text-0);
}

.msg-time { font-size: 11px; color: var(--text-3); }

.msg-content {
  font-size: 13.5px; color: var(--text-1);
  line-height: 1.55; word-break: break-word;
}

.msg-reactions {
  display: flex; flex-wrap: wrap; gap: 4px;
  margin-top: 5px; min-height: 0;
}
.reaction-btn {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px;
  background: var(--bg-3);
  border: 1px solid var(--border-light);
  border-radius: 20px;
  font-size: 13px; color: var(--text-2);
  cursor: pointer; transition: all 0.15s;
  font-family: inherit;
  line-height: 1.4;
}
.reaction-btn:hover  { background: var(--bg-hover); border-color: var(--accent); color: var(--text-0); }
.reaction-btn.active { background: var(--accent-dim); border-color: var(--accent); color: var(--accent); font-weight: 600; }

/* ── Internal link chips ──────────────────────────────────── */
.int-link-chip {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--bg-3);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 5px 11px 5px 9px;
  margin: 4px 0 2px;
  text-decoration: none;
  color: var(--text-0);
  font-size: 12.5px;
  max-width: 340px;
  transition: background .15s, border-color .15s;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}
.int-link-chip::before {
  content: '';
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--accent);
  border-radius: var(--radius) 0 0 var(--radius);
}
.int-link-chip:hover {
  background: var(--bg-hover);
  border-color: var(--accent);
  color: var(--text-0);
}
.int-link-chip .chip-icon {
  font-size: 15px; line-height: 1; flex-shrink: 0;
}
.int-link-chip .chip-name {
  font-weight: 500;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  flex: 1;
}
.int-link-chip .chip-meta {
  font-size: 10.5px;
  color: var(--text-3);
  background: var(--bg-4);
  padding: 1px 6px;
  border-radius: 4px;
  flex-shrink: 0;
  white-space: nowrap;
}
.int-link-chip.type-task    { border-left-color: var(--gold); }
.int-link-chip.type-folder  { border-left-color: var(--sky); }
.int-link-chip.type-file    { border-left-color: var(--mint); }
.int-link-chip.type-channel { border-left-color: var(--rose); }
.int-link-chip.type-thread  { border-left-color: var(--purple); }
.int-link-chip.type-wiki    { border-left-color: #4ecdc4; }

.msg-content .int-link-chip { display: flex; }

.msg-content .msg-content-text:empty { display: none; }

.msg-content {
  display: flex; flex-direction: column; gap: 2px;
}

.msg-reply {
  background: var(--bg-3);
  border-left: 2px solid var(--accent);
  padding: 4px 10px;
  border-radius: 0 6px 6px 0;
  margin-bottom: 5px;
  font-size: 12px; color: var(--text-2);
}

.msg-attachments {
  display: flex; flex-wrap: wrap; gap: 8px; margin-top: 7px;
}

.msg-image {
  max-width: 360px; max-height: 260px;
  width: auto; height: auto;
  object-fit: contain; border-radius: var(--radius);
  cursor: zoom-in; transition: opacity 0.15s;
  display: block; background: var(--bg-3);
}
.msg-image:hover { opacity: 0.88; }

/* Image group — multiple images side by side */
.msg-img-group {
  display: flex; flex-wrap: wrap; gap: 4px; margin-top: 7px;
}
.msg-img-group .msg-image { max-width: 200px; max-height: 180px; }

/* Lightbox */
#img-lightbox {
  display: none; position: fixed; inset: 0;
  background: rgba(5,4,3,0.92); backdrop-filter: blur(8px);
  z-index: 2000; align-items: center; justify-content: center;
  cursor: zoom-out;
}
#img-lightbox.open { display: flex; }
#img-lightbox img {
  max-width: 92vw; max-height: 90vh;
  object-fit: contain; border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}
#img-lightbox-caption {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  font-size: 12px; color: var(--text-3); background: var(--bg-2);
  padding: 4px 12px; border-radius: 20px; pointer-events: none;
}

.msg-file {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-3);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 8px 12px;
  font-size: 12.5px; color: var(--text-1);
  text-decoration: none;
  transition: border-color 0.15s, color 0.15s;
}
.msg-file:hover { border-color: var(--accent); color: var(--accent); }

.chat-input-area {
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.chat-input-box {
  background: var(--bg-3);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  overflow: visible;   /* must be visible so sticker/gif pickers can escape */
  transition: border-color 0.18s, box-shadow 0.18s;
}
.chat-input-box:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.chat-input-attachments {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
}

.attach-preview {
  position: relative;
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--bg-4);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 4px 8px;
  font-size: 11.5px; color: var(--text-1);
}
/* Image attach — larger card */
.attach-preview.is-image {
  padding: 0; overflow: hidden; border-radius: var(--radius);
  flex-direction: column; align-items: flex-start;
}
.attach-preview.is-image img {
  width: auto; height: 100px; max-width: 150px;
  object-fit: cover; display: block; border-radius: 0;
}
.attach-preview.is-image .attach-img-name {
  font-size: 10.5px; color: var(--text-3); padding: 3px 8px 4px;
  max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.attach-preview img { width: 40px; height: 40px; object-fit: cover; border-radius: 5px; }

.attach-remove {
  cursor: pointer; color: var(--text-3);
  display: flex; align-items: center; transition: color 0.1s;
}
.attach-remove:hover { color: var(--red); }

.chat-input-row {
  display: flex; align-items: flex-end; gap: 0;
}

#chat-input {
  flex: 1; background: transparent; border: none; outline: none;
  color: var(--text-0); font-family: 'Inter', sans-serif;
  font-size: 13.5px; padding: 13px 16px;
  resize: none; max-height: 180px; line-height: 1.55;
}
#chat-input::placeholder { color: var(--text-3); }

.chat-input-actions {
  display: flex; align-items: center; padding: 8px; gap: 2px;
}

.typing-indicator {
  height: 18px; font-size: 11.5px;
  color: var(--text-3); padding: 0 6px;
  font-style: italic; transition: opacity 0.2s;
}

/* ── FILES ────────────────────────────────────────────────────────── */
.files-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 14px;
}

.folder-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  cursor: pointer; text-decoration: none;
  display: flex; flex-direction: column; gap: 10px;
  transition: all 0.18s ease;
  position: relative;
}
.folder-card:hover {
  border-color: var(--accent);
  background: var(--bg-3);
  transform: translateY(-2px);
  box-shadow: var(--shadow-accent);
}

.folder-icon {
  width: 42px; height: 42px;
  border-radius: var(--radius);
  display: flex; align-items: center;
  justify-content: center; font-size: 22px;
}

.folder-name {
  font-size: 13px; font-weight: 500;
  color: var(--text-0); word-break: break-word;
}

.file-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 12px; cursor: pointer;
  display: flex; flex-direction: column; gap: 8px;
  transition: all 0.18s ease; position: relative;
}
.file-card:hover { border-color: var(--border-light); background: var(--bg-3); }

.file-thumb {
  width: 100%; aspect-ratio: 16/9;
  object-fit: cover; border-radius: var(--radius);
  background: var(--bg-3);
}

.file-icon-placeholder {
  width: 100%; aspect-ratio: 16/9;
  background: var(--bg-3); border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 18px; font-weight: 700;
  letter-spacing: 0.04em; color: var(--text-3);
}

.file-name { font-size: 12.5px; color: var(--text-0); word-break: break-all; font-weight: 500; }
.file-meta-small { font-size: 11px; color: var(--text-3); }

.file-actions {
  display: flex; gap: 4px; opacity: 0;
  transition: opacity 0.15s;
  position: absolute; top: 8px; right: 8px;
}
.file-card:hover .file-actions { opacity: 1; }

/* ── CALENDAR ─────────────────────────────────────────────────────── */
.fc { --fc-border-color: var(--border) !important; }
.fc .fc-toolbar-title {
  font-family: 'Lora', serif !important;
  font-size: 22px !important; font-weight: 700 !important;
  color: var(--text-0) !important;
}
.fc .fc-button {
  background: var(--bg-3) !important;
  border-color: var(--border-light) !important;
  color: var(--text-1) !important;
  font-family: 'Inter', sans-serif !important;
  font-size: 12px !important;
  border-radius: 8px !important;
}
.fc .fc-button:hover { background: var(--bg-hover) !important; }
.fc .fc-button-active { background: var(--accent) !important; color: #0f0e0b !important; border-color: var(--accent) !important; }
.fc td, .fc th { border-color: var(--border) !important; }
.fc .fc-col-header-cell { background: var(--bg-2) !important; }
.fc .fc-col-header-cell-cushion {
  color: var(--text-2) !important; font-size: 11px !important;
  font-weight: 600 !important; letter-spacing: 0.08em !important;
  text-transform: uppercase !important; text-decoration: none !important;
}
.fc .fc-daygrid-day { background: var(--bg-1) !important; }
.fc .fc-daygrid-day:hover { background: var(--bg-2) !important; }
.fc .fc-daygrid-day-number { color: var(--text-2) !important; text-decoration: none !important; font-size: 12px !important; }
.fc .fc-day-today { background: rgba(212,168,67,0.06) !important; }
.fc .fc-event { border-radius: 6px !important; font-size: 11.5px !important; border: none !important; padding: 2px 7px !important; }

/* ── TASK DETAIL ──────────────────────────────────────────────────── */
.task-detail-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 20px; align-items: start;
}

.workflow-steps {
  display: flex; align-items: center;
  margin-bottom: 24px;
}

.wf-step {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 16px;
  font-size: 11.5px; font-weight: 600;
  font-family: 'Inter', sans-serif;
  letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--text-3);
  background: var(--bg-3); border: 1px solid var(--border);
  position: relative;
}
.wf-step:first-child { border-radius: var(--radius) 0 0 var(--radius); }
.wf-step:last-child  { border-radius: 0 var(--radius) var(--radius) 0; }

.wf-step.active {
  color: #0f0e0b;
  background: linear-gradient(135deg, #d4a843, #c49030);
  border-color: transparent; z-index: 1;
  box-shadow: var(--shadow-accent);
}
.wf-step.done { color: var(--mint); border-color: rgba(122,191,158,0.35); }

/* ── COMMENT THREAD ───────────────────────────────────────────────── */
.comment-item {
  display: flex; gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.comment-item:last-child { border-bottom: none; }
.comment-body { flex: 1; }

.comment-meta {
  font-size: 12px; color: var(--text-3);
  margin-bottom: 5px;
  display: flex; align-items: center; gap: 8px;
}

.comment-type-badge {
  font-size: 10px; font-weight: 700;
  font-family: 'Inter', sans-serif;
  letter-spacing: 0.07em; text-transform: uppercase;
  padding: 1px 7px; border-radius: 20px;
}
.comment-type-submit  { background: var(--accent-dim);          color: var(--accent);  }
.comment-type-return  { background: var(--rose-dim);            color: var(--rose);    }
.comment-type-close   { background: var(--mint-dim);            color: var(--mint);    }
.comment-type-comment { background: var(--bg-3);                color: var(--text-3);  }

/* ── NOTIFICATIONS PAGE ───────────────────────────────────────────── */
.notif-item {
  display: flex; gap: 13px; padding: 13px 18px;
  border-bottom: 1px solid var(--border);
  transition: background 0.12s;
  text-decoration: none; color: inherit;
}
.notif-item:hover { background: var(--bg-2); }
.notif-item.unread { background: var(--accent-dim); }

.notif-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent); margin-top: 5px; flex-shrink: 0;
}

.notif-title { font-size: 13.5px; font-weight: 500; color: var(--text-0); margin-bottom: 2px; }
.notif-body  { font-size: 12px; color: var(--text-2); }
.notif-time  { font-size: 11px; color: var(--text-3); margin-top: 4px; }

/* ── BREADCRUMBS ──────────────────────────────────────────────────── */
.breadcrumbs {
  display: flex; align-items: center; gap: 7px;
  font-size: 12.5px; color: var(--text-3);
  margin-bottom: 18px; flex-wrap: wrap;
}
.breadcrumbs a { color: var(--text-2); text-decoration: none; }
.breadcrumbs a:hover { color: var(--accent); }
.breadcrumbs .sep { color: var(--text-3); }
.breadcrumbs .current { color: var(--text-0); }

/* ── MODAL ────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(10,9,7,0.8);
  backdrop-filter: blur(8px);
  z-index: 500;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity 0.22s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }

.modal {
  background: var(--bg-2);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  width: min(560px, 95vw);
  max-height: 90vh; overflow-y: auto;
  box-shadow: var(--shadow-lg), 0 0 80px rgba(212,168,67,0.08);
}

.modal-overlay.open .modal {
  animation: modalIn 0.22s cubic-bezier(.34,1.56,.64,1) both;
}
@keyframes modalIn {
  from { transform: translateY(20px) scale(0.96); opacity: 0; }
  to   { transform: translateY(0) scale(1); opacity: 1; }
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.3; }
}

.modal-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-title {
  font-family: 'Lora', serif;
  font-size: 18px; font-weight: 700;
  color: var(--text-0);
}
.modal-body { padding: 22px; }

/* ── CODE VIEWER ──────────────────────────────────────────────────── */
.code-viewer {
  background: var(--bg-0); border-radius: var(--radius);
  font-family: 'JetBrains Mono', monospace;
  font-size: 12.5px; line-height: 1.7;
  color: var(--text-1); overflow: auto;
  padding: 16px; max-height: 70vh; white-space: pre;
}
/* Python / Ren'Py syntax colours */
.syn-keyword   { color: #d47a6a; font-weight: 600; }
.syn-builtin   { color: #6aadcc; }
.syn-string    { color: #7abf9e; }
.syn-comment   { color: var(--text-3); font-style: italic; }
.syn-number    { color: #d4a843; }
.syn-decorator { color: #b07ad4; }

/* ── NOTIF DROPDOWN ───────────────────────────────────────────────── */
.notif-dropdown {
  position: absolute; top: calc(100% + 10px); right: 0;
  width: 350px;
  background: var(--bg-2);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 300; overflow: hidden; display: none;
}
.notif-dropdown.open { display: block; }

.notif-drop-header {
  padding: 13px 18px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  font-family: 'Inter', sans-serif;
  font-size: 11px; font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-3);
}

/* ── FLASH ────────────────────────────────────────────────────────── */
.flash-container {
  position: fixed; bottom: 24px; right: 24px;
  z-index: 999; display: flex; flex-direction: column; gap: 10px;
}
.flash {
  padding: 11px 18px;
  border-radius: 20px;
  font-size: 13.5px; font-weight: 500;
  animation: slideUp 0.22s ease;
  max-width: 360px;
  box-shadow: var(--shadow-lg);
  transition: opacity 0.35s ease;
  border: 1px solid transparent;
  font-family: 'Inter', sans-serif;
}
.flash-error   { background: rgba(212,106,106,0.08); border-color: rgba(212,106,106,0.4); color: var(--red); }
.flash-success { background: rgba(122,191,158,0.08); border-color: rgba(122,191,158,0.4); color: var(--mint); }
.flash-info    { background: var(--bg-3); border-color: var(--border-light); color: var(--text-0); }
.flash-warning { background: rgba(212,168,67,0.08); border-color: rgba(212,168,67,0.4); color: var(--accent); }

@keyframes slideUp {
  from { transform: translateY(14px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

/* ── DROP ZONE ────────────────────────────────────────────────────── */
.drop-zone {
  border: 2px dashed var(--border-light);
  border-radius: var(--radius-lg);
  padding: 36px; text-align: center;
  color: var(--text-3); transition: all 0.18s; cursor: pointer;
}
.drop-zone.dragover {
  border-color: var(--accent);
  background: var(--accent-dim); color: var(--accent);
}
.drop-zone svg { width: 32px; height: 32px; margin-bottom: 10px; opacity: 0.45; }

/* ── TASK LIST VIEW ───────────────────────────────────────────────── */
.task-list { display: flex; flex-direction: column; gap: 3px; }

.task-list-item {
  display: grid;
  grid-template-columns: auto 1fr auto auto auto;
  align-items: center; gap: 14px;
  padding: 11px 16px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none; color: inherit;
  transition: all 0.14s;
}
.task-list-item:hover { background: var(--bg-3); border-color: var(--border-light); }

/* ── UTILS ────────────────────────────────────────────────────────── */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.text-muted { color: var(--text-3); }
.text-sm { font-size: 12px; }
.text-xs { font-size: 11px; }
.hidden { display: none !important; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.divider { height: 1px; background: var(--border); margin: 16px 0; }

/* ── ADMIN LINK ──────────────────────────────────────────────────── */
.sidebar-section .sidebar-link[href*="/admin"].active {
  color: var(--sky); background: var(--sky-dim); border-left-color: var(--sky);
}

/* ── CHECKBOX ROLE LABEL CHECKED ─────────────────────────────────── */
label:has(input[type=checkbox]:checked) { outline: 1px solid currentColor; }

/* ── ESCHTML helper (used in JS, not CSS — placeholder) ──────────── */

/* ═══════════════════════════════════════════════════════════════
   MESSENGER FEATURES
   ═══════════════════════════════════════════════════════════════ */

/* ── Channel header ────────────────────────────────────────────── */
.channel-header {
  display: flex; align-items: center; padding: 7px 18px;
  background: var(--bg-1); border-bottom: 1px solid var(--border);
  gap: 10px; flex-shrink: 0; min-height: 44px;
}
.channel-header-hash {
  font-size: 18px; font-weight: 700; color: var(--text-3);
  font-family: 'Rajdhani', sans-serif; flex-shrink: 0;
}
.channel-header-name {
  font-weight: 600; font-size: 14px; color: var(--text-0);
}
.channel-header-sep {
  width: 1px; height: 16px; background: var(--border-light); flex-shrink: 0;
}
.channel-header-topic {
  font-size: 12.5px; color: var(--text-2); flex: 1;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.channel-header-actions { display: flex; gap: 4px; margin-left: auto; flex-shrink: 0; }

/* ── Pinned message banner ─────────────────────────────────────── */
.pinned-banner {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 18px; background: var(--bg-3);
  border-bottom: 1px solid var(--border);
  font-size: 12px; color: var(--text-2);
  cursor: pointer; transition: background .15s; flex-shrink: 0;
}
.pinned-banner:hover { background: var(--bg-hover); }
.pinned-banner .pin-label {
  font-weight: 600; color: var(--accent); font-size: 11px;
  font-family: 'Rajdhani', sans-serif; text-transform: uppercase;
  letter-spacing: .08em; flex-shrink: 0;
}
.pinned-banner .pin-text {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1;
}

/* ── Date separator ────────────────────────────────────────────── */
.date-sep {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 0 6px; color: var(--text-3);
  font-size: 11px; font-family: 'Rajdhani', sans-serif;
  text-transform: uppercase; letter-spacing: .1em;
}
.date-sep::before, .date-sep::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}

/* ── Edited badge ──────────────────────────────────────────────── */
.msg-edited {
  font-size: 10px; color: var(--text-3); font-style: italic; margin-left: 5px;
}

/* ── Pin indicator on message ──────────────────────────────────── */
.msg-pin-badge {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 10px; color: var(--accent); margin-left: 6px;
}

/* ── Sticker ───────────────────────────────────────────────────── */
.msg-sticker {
  font-size: 64px; line-height: 1.05;
  display: inline-block; padding: 4px 0;
  cursor: default; user-select: none;
}

/* ── GIF ───────────────────────────────────────────────────────── */
.msg-gif-wrap img {
  max-width: 300px; max-height: 220px;
  border-radius: 10px; display: block;
  object-fit: contain; cursor: zoom-in;
}

/* ── Inline edit ───────────────────────────────────────────────── */
.msg-edit-wrap { margin-top: 4px; }
.msg-edit-textarea {
  width: 100%; min-height: 60px; max-height: 200px;
  background: var(--bg-3); border: 1px solid var(--accent);
  border-radius: var(--radius); padding: 8px 10px;
  color: var(--text-0); font-size: 13.5px; font-family: inherit;
  resize: vertical; outline: none; box-sizing: border-box;
}
.msg-edit-actions {
  display: flex; align-items: center; gap: 8px;
  margin-top: 5px; font-size: 11px; color: var(--text-3);
}
.msg-edit-actions .btn { padding: 3px 10px; font-size: 12px; }

/* ── Media picker (stickers / GIFs) ────────────────────────────── */
.media-picker-wrap { position: relative; }
.media-picker {
  position: absolute; bottom: calc(100% + 8px); right: 0;
  width: 320px; background: var(--bg-2);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 32px rgba(0,0,0,.45);
  z-index: 60; overflow: hidden;
  display: none; flex-direction: column;
}
.media-picker.visible { display: flex; }
.media-picker-tabs {
  display: flex; border-bottom: 1px solid var(--border);
  overflow-x: auto; flex-shrink: 0;
  scrollbar-width: none;
}
.media-picker-tabs::-webkit-scrollbar { display: none; }
.media-picker-tab {
  padding: 8px 11px; font-size: 19px; cursor: pointer;
  border-bottom: 2px solid transparent; flex-shrink: 0;
  background: none; border-top: none; border-left: none; border-right: none;
  transition: background .12s;
}
.media-picker-tab:hover { background: var(--bg-hover); }
.media-picker-tab.active { border-bottom-color: var(--accent); }
.media-picker-grid {
  display: grid; grid-template-columns: repeat(7, 1fr);
  gap: 2px; padding: 8px; overflow-y: auto; max-height: 224px;
  scrollbar-width: thin;
}
.media-picker-sticker {
  font-size: 28px; cursor: pointer; padding: 5px;
  text-align: center; border-radius: 6px;
  transition: background .1s; background: none; border: none; line-height: 1;
}
.media-picker-sticker:hover { background: var(--bg-hover); }

/* ── GIF picker ────────────────────────────────────────────────── */
.gif-picker {
  position: absolute; bottom: calc(100% + 8px); right: 0;
  width: 340px; background: var(--bg-2);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 32px rgba(0,0,0,.45);
  z-index: 60; overflow: hidden;
  display: none; flex-direction: column;
}
.gif-picker.visible { display: flex; }
.gif-search-wrap {
  padding: 8px 10px; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.gif-search-input {
  width: 100%; background: var(--bg-3); border: 1px solid var(--border-light);
  border-radius: var(--radius); padding: 6px 10px;
  color: var(--text-0); font-size: 13px; outline: none; box-sizing: border-box;
}
.gif-search-input:focus { border-color: var(--accent); }
.gif-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 4px; padding: 8px; overflow-y: auto; max-height: 280px;
  scrollbar-width: thin;
}
.gif-item { cursor: pointer; border-radius: 6px; overflow: hidden; position: relative; }
.gif-item img {
  width: 100%; height: 110px; object-fit: cover;
  display: block; transition: opacity .15s;
}
.gif-item:hover img { opacity: .85; }
.gif-no-key {
  grid-column: 1 / -1; text-align: center; padding: 30px 16px;
  color: var(--text-3); font-size: 12.5px; line-height: 1.7;
}
.gif-no-key a { color: var(--accent); }

/* ── Sidebar: channel add btn ──────────────────────────────────── */
.sidebar-section-hdr {
  display: flex; align-items: center;
  padding: 10px 14px 4px;
  font-size: 10px; font-weight: 700; letter-spacing: .15em;
  text-transform: uppercase; color: var(--text-3);
  font-family: 'Rajdhani', sans-serif;
}
.sidebar-section-hdr .add-ch-btn {
  margin-left: auto; background: none; border: none;
  color: var(--text-3); cursor: pointer; padding: 2px 4px;
  border-radius: 4px; transition: color .15s, background .15s;
  line-height: 1;
}
.sidebar-section-hdr .add-ch-btn:hover { color: var(--text-0); background: var(--bg-hover); }

.chat-channel-link { position: relative; }
.ch-gear {
  display: none; position: absolute; right: 8px; top: 50%;
  transform: translateY(-50%); background: none; border: none;
  color: var(--text-3); cursor: pointer; padding: 2px;
  border-radius: 4px; transition: color .15s;
}
.chat-channel-link:hover .ch-gear { display: flex; }
.ch-gear:hover { color: var(--text-0) !important; }

/* ── Modal ─────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.72);
  z-index: 200; display: none;
  align-items: center; justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal-box {
  background: var(--bg-2); border: 1px solid var(--border-light);
  border-radius: var(--radius-lg); padding: 28px;
  width: 420px; max-width: 95vw;
  box-shadow: 0 16px 48px rgba(0,0,0,.5);
}
.modal-title {
  font-size: 16px; font-weight: 700; color: var(--text-0);
  font-family: 'Lora', serif; margin-bottom: 20px;
}
.modal-field { margin-bottom: 14px; }
.modal-field label { display: block; font-size: 11px; color: var(--text-2); margin-bottom: 5px; text-transform: uppercase; letter-spacing: .08em; font-family: 'Rajdhani', sans-serif; font-weight: 600; }
.modal-field input, .modal-field select, .modal-field textarea {
  width: 100%; background: var(--bg-3); border: 1px solid var(--border-light);
  border-radius: var(--radius); padding: 8px 10px;
  color: var(--text-0); font-size: 13px; box-sizing: border-box; outline: none;
}
.modal-field input:focus, .modal-field select:focus, .modal-field textarea:focus {
  border-color: var(--accent);
}
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; }
.icon-picker { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.icon-opt {
  padding: 6px 10px; background: var(--bg-3); border: 1px solid var(--border-light);
  border-radius: var(--radius); cursor: pointer; font-size: 12px; color: var(--text-2);
  transition: all .15s;
}
.icon-opt:hover { border-color: var(--accent); color: var(--text-0); }
.icon-opt.selected { border-color: var(--accent); background: var(--accent-dim); color: var(--accent); }

/* ── Admin chat table ──────────────────────────────────────────── */
.ch-admin-row td { vertical-align: middle; }
.ch-admin-row:hover td { background: var(--bg-hover); }

/* ── Right panels (Members / Pinned) ───────────────────────────── */
.ch-right-panel {
  width: 240px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-1);
  border-left: 1px solid var(--border);
  height: calc(100vh - var(--topbar-h));
  overflow: hidden;
}

.ch-right-panel-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 700;
  font-family: 'Rajdhani', sans-serif;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-2);
}

.ch-right-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 10px 8px;
}
.ch-right-panel-body::-webkit-scrollbar { width: 4px; }
.ch-right-panel-body::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 2px; }

/* section label "В сети — 2" */
.ch-members-section {
  font-size: 10.5px;
  font-weight: 700;
  font-family: 'Rajdhani', sans-serif;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 6px 8px 4px;
}

/* member row */
.ch-member-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 5px 8px;
  border-radius: var(--radius);
  text-decoration: none;
  transition: background .12s;
  color: inherit;
}
.ch-member-row:hover { background: var(--bg-hover); }

.ch-member-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  gap: 1px;
}
.ch-member-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-0);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ch-member-role {
  font-size: 10.5px;
  font-family: 'Rajdhani', sans-serif;
  font-weight: 600;
  letter-spacing: .04em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* status dot positioned bottom-right of avatar */
.ch-member-status-dot {
  position: absolute;
  bottom: 0; right: 0;
  width: 9px; height: 9px;
  border-radius: 50%;
  border: 2px solid var(--bg-1);
}

/* pinned message card */
.ch-pinned-item {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 11px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.ch-pinned-item:hover { border-color: var(--accent); background: var(--bg-3); }


/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE — Mobile & Tablet
   ═══════════════════════════════════════════════════════════════ */

/* ── Sidebar overlay (mobile) ─────────────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 150;
  backdrop-filter: blur(2px);
}

/* ── Tablet & Mobile (≤ 900px) ────────────────────────────────── */
@media (max-width: 900px) {

  /* ── Sidebar: floating overlay (out of grid flow) ── */
  .app-shell {
    grid-template-columns: 1fr !important;  /* single content column */
  }
  .sidebar {
    position: fixed;
    top: 0; left: 0;
    height: 100vh;
    width: var(--sidebar-w);
    z-index: 200;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    box-shadow: var(--shadow-lg);
  }
  /* main-content fills the single column */
  .main-content { grid-column: 1 / -1; }
  .app-shell.mobile-sidebar-open .sidebar { transform: translateX(0); }
  .app-shell.mobile-sidebar-open .sidebar-overlay { display: block; }

  /* ── Topbar: slim down ── */
  .topbar { gap: 4px; padding: 0 10px 0 0; }

  /* Logo: icon only, no text, no fixed width */
  .topbar-logo {
    width: auto !important;
    min-width: unset !important;
    padding: 0 10px !important;
    border-right: none !important;
    flex-shrink: 0;
  }
  .logo-text { display: none; }

  /* Search: icon only */
  .topbar-search-btn { min-width: unset !important; padding: 7px 10px !important; }
  .topbar-search-btn span,
  .topbar-search-btn .search-kbd { display: none !important; }

  /* Title: shrink, allow overflow */
  .topbar-title { font-size: 12px; min-width: 0; }

  /* Actions: always visible at end */
  .topbar-actions { margin-left: auto; gap: 4px; flex-shrink: 0; }

  /* User chip: show only avatar */
  .topbar-username { display: none; }
  .topbar-chevron  { display: none; }
  .topbar-user-btn { padding: 4px 6px !important; gap: 0 !important; }

  /* Page */
  .page-wrap { padding: 12px; }

  /* Grids → 2 cols */
  .db-grid { grid-template-columns: 1fr 1fr !important; }

  /* Chat right panel: hide */
  .ch-right-panel { display: none !important; }

  /* Notification dropdown: wider */
  .notif-dropdown { width: 88vw; right: 0; }
}

/* ── Mobile only (≤ 600px) ────────────────────────────────────── */
@media (max-width: 600px) {
  /* Search: hide entirely */
  .topbar-search-btn { display: none !important; }

  /* Page */
  .page-wrap { padding: 8px; }

  /* All multi-col grids → 1 col */
  .db-grid,
  .file-grid { grid-template-columns: 1fr !important; }

  /* Profile page: stack */
  .profile-grid { grid-template-columns: 1fr !important; }

  /* Chat sidebar: hide */
  .chat-sidebar { display: none !important; }
  .chat-main { width: 100% !important; flex: 1; min-width: 0; }

  /* Modals: slide up from bottom */
  .modal-overlay { padding: 0; align-items: flex-end; }
  .modal {
    width: 100vw !important;
    max-width: 100vw !important;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0 !important;
    max-height: 92vh;
    overflow-y: auto;
  }

  /* Notification dropdown full width */
  .notif-dropdown { width: 96vw; right: -4px; left: unset; }

  /* Buttons in action panels */
  .status-actions-card .btn { width: 100%; justify-content: center; }
}

/* ── Very small (≤ 400px) ─────────────────────────────────────── */
@media (max-width: 400px) {
  .topbar-actions { gap: 2px; }
  #browser-notif-btn { display: none; } /* de-clutter on tiny screens */
}

/* ── AI messages ─────────────────────────────────────────────────── */
.msg-ai {
  border-left: 2px solid #7b61ff44;
  background: linear-gradient(90deg, #7b61ff08 0%, transparent 60%);
  border-radius: 0 var(--radius) var(--radius) 0;
}
.msg-ai .msg-content {
  color: var(--text-1);
}
.ai-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 9px;
  font-weight: 700;
  font-family: 'Rajdhani', sans-serif;
  letter-spacing: .06em;
  text-transform: uppercase;
  background: #7b61ff33;
  color: #b48eff;
}
.ai-typing-dots {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 0;
}
.ai-typing-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #7b61ff;
  animation: ai-dot-bounce 1.2s infinite ease-in-out;
}
.ai-typing-dots span:nth-child(2) { animation-delay: .2s; }
.ai-typing-dots span:nth-child(3) { animation-delay: .4s; }
@keyframes ai-dot-bounce {
  0%, 80%, 100% { transform: scale(0.7); opacity: .5; }
  40%            { transform: scale(1.1); opacity: 1;  }
}

/* ════════════════════════════════════════════════════════════════
   COMPREHENSIVE MOBILE STYLES  (appended)
   ════════════════════════════════════════════════════════════════ */

/* ── @ Mention dropdown ─────────────────────────────────────────── */
#mention-dropdown { scrollbar-width: thin; }

/* ── AI markdown rendering ──────────────────────────────────────── */
.ai-response .ai-heading {
  display: block;
  font-weight: 700;
  font-size: 13.5px;
  color: var(--text-0);
  margin: 6px 0 2px;
}
.ai-response .ai-li {
  display: block;
  padding-left: 10px;
  line-height: 1.7;
}
.ai-code-block {
  background: var(--bg-4);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  margin: 6px 0;
  overflow-x: auto;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  line-height: 1.6;
  white-space: pre;
}
.ai-inline-code {
  background: var(--bg-4);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1px 5px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px;
}

/* ════════════════════════════════════════════════════════
   TABLET  (<= 960px)
   ════════════════════════════════════════════════════════ */
@media (max-width: 960px) {
  .db-stats { grid-template-columns: repeat(2, 1fr) !important; }
  .db-main  { grid-template-columns: 1fr !important; }
  .db-greeting { flex-wrap: wrap; gap: 10px; }
  .task-detail-layout {
    grid-template-columns: 1fr !important;
  }
  .task-detail-layout > div:last-child { order: -1; }
  .kanban-board {
    grid-template-columns: repeat(5, 240px) !important;
  }
}

/* ════════════════════════════════════════════════════════
   MOBILE (<= 900px)
   ════════════════════════════════════════════════════════ */
@media (max-width: 900px) {

  /* Dashboard */
  .db-wrap { padding: 10px; gap: 12px; }
  .db-stats { grid-template-columns: repeat(2, 1fr) !important; gap: 8px; }
  .db-stat-card { padding: 14px 12px; }
  .db-main  { grid-template-columns: 1fr !important; gap: 12px; }
  .db-greeting { padding: 14px; }
  .db-greeting-name { font-size: 18px !important; }
  .db-alert { flex-direction: column; gap: 8px; padding: 12px 14px; }
  .db-alert > div:last-child { margin-left: 0 !important; }

  /* Kanban board: fixed-width cols, horizontal scroll */
  .kanban-board {
    grid-template-columns: repeat(5, 220px) !important;
    padding-bottom: 12px;
  }
  .kanban-col { min-width: 0; }
  .task-card-title { font-size: 12px !important; }

  /* Task list: collapse extra columns */
  .task-list > div[style*="grid-template-columns"] { display: none; }
  .task-list > a[style*="grid-template-columns"] {
    grid-template-columns: 6px 1fr auto !important;
    gap: 8px !important;
  }
  .task-list > a[style*="grid-template-columns"] > div:nth-child(3),
  .task-list > a[style*="grid-template-columns"] > span:nth-child(4),
  .task-list > a[style*="grid-template-columns"] > span:nth-child(5),
  .task-list > a[style*="grid-template-columns"] > span:nth-child(6) { display: none; }

  /* Task detail */
  .task-detail-layout {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }
  .task-detail-layout > div:last-child { order: -1; }
  .wf-step { padding: 6px 10px !important; font-size: 11px !important; }
  .wf-step svg { width: 10px !important; height: 10px !important; }
  .status-actions-card .btn { width: 100%; justify-content: center; }

  /* Admin */
  .page-header { flex-direction: column; align-items: flex-start !important; gap: 10px; }
  .page-header .btn { width: 100%; justify-content: center; }

  /* Chat */
  .chat-layout { grid-template-columns: 1fr !important; }
  .chat-sidebar { display: none !important; }
  .channel-header { padding: 8px 12px !important; flex-wrap: wrap; gap: 4px; }
  .channel-header-topic, .channel-header-sep { display: none !important; }
  .chat-input-area { padding: 6px 8px 8px !important; }
  .chat-messages { padding: 8px 10px !important; }

  /* Profile */
  .profile-grid, .profile-layout { grid-template-columns: 1fr !important; }

  /* Files */
  .files-layout { grid-template-columns: 1fr !important; }

  /* Calendar */
  .cal-layout { grid-template-columns: 1fr !important; }

  /* Notifications */
  .notif-item { gap: 8px !important; padding: 10px 8px !important; }

  /* General card padding */
  .card-header { padding: 12px 16px !important; }
}

/* ════════════════════════════════════════════════════════
   SMALL MOBILE (<= 600px)
   ════════════════════════════════════════════════════════ */
@media (max-width: 600px) {

  /* Dashboard: 1-col stats on tiny */
  .db-stats { grid-template-columns: 1fr 1fr !important; }

  /* Kanban: almost full width per column */
  .kanban-board {
    grid-template-columns: repeat(5, calc(100vw - 72px)) !important;
  }

  /* Task filter bar: stack */
  .tasks-filter-bar { flex-direction: column !important; align-items: stretch !important; }
  .tasks-filter-bar select,
  .tasks-filter-bar a.btn { width: 100% !important; justify-content: center; }

  /* Comments */
  .comment-item { gap: 8px !important; }
  .comment-meta { flex-wrap: wrap; gap: 4px !important; font-size: 11px !important; }
  .comment-type-badge { font-size: 9px !important; }

  /* Chat input: hide media pickers on tiny screens */
  #gif-wrap, #sticker-wrap { display: none !important; }
  .chat-input-row { gap: 4px !important; }
  #chat-input { font-size: 14px !important; } /* prevent iOS zoom */

  /* Modals: slide from bottom */
  .modal {
    width: 100vw !important;
    max-width: 100vw !important;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0 !important;
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    top: auto !important;
    transform: none !important;
    max-height: 90vh;
    overflow-y: auto;
  }
  .modal-overlay { align-items: flex-end !important; }

  /* Page + card padding */
  .page-wrap { padding: 8px !important; }
  .card-header { padding: 10px 12px !important; }

  /* Topbar: hide search bar */
  .topbar-search { display: none !important; }
  .topbar-actions { gap: 4px !important; }

  /* Workflow steps: allow scroll */
  [style*="overflow-x:auto"][style*="margin-bottom:20px"] {
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
  }

  /* Admin table: horizontal scroll */
  .card div[style*="overflow-x"] table { min-width: 540px; }
}

/* ════════════════════════════════════════════════════════
   EXTRA SMALL (<= 400px)
   ════════════════════════════════════════════════════════ */
@media (max-width: 400px) {
  .db-stats { grid-template-columns: 1fr !important; }
  .topbar-actions { gap: 2px; }
  #browser-notif-btn { display: none; }
  .wf-step { padding: 5px 7px !important; font-size: 9.5px !important; }
  .kanban-board { grid-template-columns: repeat(5, calc(100vw - 52px)) !important; }
}

/* ── Mobile channel switcher ────────────────────────────────────── */
@media (max-width: 900px) {
  .mobile-ch-btn { display: block !important; }

  /* Calendar: hide desktop sidebar, show mobile toggle */
  .cal-layout { grid-template-columns: 1fr !important; }
  .cal-sidebar { display: none !important; }
  .cal-upcoming-toggle { display: block !important; }
  #cal-upcoming-mobile.open { display: block !important; }

  /* Files: sort controls wrap below breadcrumbs */
  .files-toolbar { flex-wrap: wrap !important; }
  .files-sort-controls { width: 100%; overflow-x: auto; flex-wrap: nowrap !important; padding-bottom: 2px; }
  .files-sort-controls span { white-space: nowrap; }
}

@media (max-width: 600px) {
  /* Files: action buttons go full row */
  .files-toolbar > label,
  .files-toolbar > button { flex: 1; justify-content: center; }
}

/* ════════════════════════════════════════════════════════════════
   WIKI STYLES
   ════════════════════════════════════════════════════════════════ */

/* ── Index wrap ─────────────────────────────────────────────────── */
.wiki-index-wrap { max-width: 1200px; padding: 0 24px 60px; margin: 0 auto; }

/* ── Hero ────────────────────────────────────────────────────────── */
.wiki-hero {
  background: linear-gradient(135deg, #1a1510 0%, #0f1318 50%, #0e0f1a 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 32px;
  overflow: hidden;
  position: relative;
}
.wiki-hero::before {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at 20% 50%, rgba(212,168,67,.06) 0%, transparent 60%),
              radial-gradient(ellipse at 80% 50%, rgba(78,205,196,.04) 0%, transparent 60%);
  pointer-events: none;
}
.wiki-hero-inner {
  position: relative;
  display: flex; align-items: center; gap: 20px;
  padding: 28px 32px; flex-wrap: wrap;
}
.wiki-hero-icon {
  width: 64px; height: 64px;
  background: linear-gradient(135deg, rgba(212,168,67,.15), rgba(212,168,67,.05));
  border: 1px solid rgba(212,168,67,.25);
  border-radius: var(--radius-lg);
  display: flex; align-items: center; justify-content: center;
  color: var(--accent); flex-shrink: 0;
}
.wiki-hero-title {
  font-family: 'Lora', serif;
  font-size: 28px; font-weight: 700;
  color: var(--text-0); margin: 0 0 4px;
  letter-spacing: -.02em;
}
.wiki-hero-sub { font-size: 13px; color: var(--text-3); }
.wiki-hero-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.wiki-search-form { display: flex; align-items: center; background: var(--bg-3); border: 1px solid var(--border-light); border-radius: 24px; overflow: hidden; transition: border-color .15s; }
.wiki-search-form:focus-within { border-color: var(--accent); }
.wiki-search-input { background: transparent; border: none; outline: none; padding: 8px 14px; color: var(--text-0); font-size: 13.5px; width: 220px; font-family: 'Inter', sans-serif; }
.wiki-search-btn { background: transparent; border: none; cursor: pointer; padding: 8px 12px; color: var(--text-2); display: flex; align-items: center; transition: color .15s; }
.wiki-search-btn:hover { color: var(--accent); }

/* ── Section ─────────────────────────────────────────────────────── */
.wiki-section { margin-bottom: 36px; }
.wiki-section-hdr { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.wiki-section-title { font-family: 'Rajdhani', sans-serif; font-size: 11px; font-weight: 700; letter-spacing: .15em; text-transform: uppercase; color: var(--text-3); }

/* ── Categories grid ─────────────────────────────────────────────── */
.wiki-categories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}
.wiki-cat-card {
  display: flex; align-items: center; gap: 14px;
  padding: 16px;
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  text-decoration: none; color: inherit;
  transition: all .15s; cursor: pointer;
  position: relative; overflow: hidden;
}
.wiki-cat-card::before {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(135deg, var(--cat-color, var(--accent))08 0%, transparent 60%);
  border-radius: inherit;
}
.wiki-cat-card:hover { border-color: var(--cat-color, var(--accent)); transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,.2); }
.wiki-cat-add { border-style: dashed; background: transparent; }
.wiki-cat-add:hover { border-style: dashed; border-color: var(--accent); }
.wiki-cat-icon {
  width: 44px; height: 44px; border-radius: var(--radius);
  background: color-mix(in srgb, var(--cat-color, var(--accent)) 15%, transparent);
  border: 1px solid color-mix(in srgb, var(--cat-color, var(--accent)) 30%, transparent);
  display: flex; align-items: center; justify-content: center;
  color: var(--cat-color, var(--accent)); flex-shrink: 0;
}
.wiki-cat-info { flex: 1; min-width: 0; }
.wiki-cat-name { font-size: 13.5px; font-weight: 600; color: var(--text-0); margin-bottom: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wiki-cat-desc { font-size: 11.5px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-bottom: 2px; }
.wiki-cat-count { font-size: 11px; color: var(--text-3); }

/* ── Recent grid ─────────────────────────────────────────────────── */
.wiki-recent-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}
.wiki-recent-card {
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden;
  text-decoration: none; color: inherit;
  transition: all .15s; display: flex; flex-direction: column;
}
.wiki-recent-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,.2); }
.wiki-recent-img {
  height: 120px; background-size: cover; background-position: center top;
  flex-shrink: 0;
}
.wiki-recent-img-placeholder { display: flex; align-items: center; justify-content: center; }
.wiki-recent-body { padding: 12px 14px; }
.wiki-recent-cat { font-size: 10px; font-weight: 700; font-family: 'Rajdhani', sans-serif; text-transform: uppercase; letter-spacing: .08em; margin-bottom: 4px; }
.wiki-recent-title { font-size: 13.5px; font-weight: 600; color: var(--text-0); line-height: 1.35; margin-bottom: 6px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.wiki-recent-meta { font-size: 11px; color: var(--text-3); }

/* ── No-infobox layout (full width) ─────────────────────────────── */
.wiki-no-infobox { grid-template-columns: 1fr !important; }

/* ── Icon / Color pickers (modal) ────────────────────────────────── */
.wiki-icon-btn {
  width: 40px; height: 40px; border-radius: var(--radius);
  background: var(--bg-3); border: 1px solid var(--border-light);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--text-2); transition: all .12s;
}
.wiki-icon-btn:hover, .wiki-icon-btn.active { background: var(--accent-dim); border-color: var(--accent); color: var(--accent); }
.wiki-color-btn {
  width: 28px; height: 28px; border-radius: 50%;
  border: 3px solid transparent; cursor: pointer;
  transition: transform .12s, border-color .12s;
}
.wiki-color-btn:hover, .wiki-color-btn.active { border-color: var(--text-0); transform: scale(1.15); }

/* ── Mobile ──────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .wiki-index-wrap { padding: 0 12px 40px; }
  .wiki-hero-inner { padding: 20px 16px; }
  .wiki-hero-title { font-size: 22px; }
  .wiki-search-input { width: 160px; }
  .wiki-hero-actions { width: 100%; }
  .wiki-search-form { flex: 1; }
  .wiki-categories-grid { grid-template-columns: repeat(2, 1fr); }
  .wiki-recent-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .wiki-categories-grid { grid-template-columns: 1fr; }
  .wiki-recent-grid { grid-template-columns: 1fr; }
  .wiki-hero-icon { display: none; }
}

/* ═══════════════════════════════════════════════════════════════
   FUN ROOM v2 — Hub + Casino + RPG + Arcade
   ═══════════════════════════════════════════════════════════════ */

.fr-page { display: flex; flex-direction: column; gap: 20px; }

/* ── Hero header ──────────────────────────────────────────────── */
.fr-hero {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
}
.fr-hero-title {
  font-family: 'Rajdhani', sans-serif;
  font-size: 28px; font-weight: 800; color: var(--text-0);
}
.fr-hero-sub { font-size: 13px; color: var(--text-2); margin-top: 3px; }
.fr-hero-wallet {
  display: flex; align-items: center; gap: 12px;
  background: var(--bg-3); border: 1px solid var(--border-light);
  border-radius: var(--radius-lg); padding: 10px 18px;
}
.fr-wallet-icon { font-size: 24px; }
.fr-wallet-num  {
  font-family: 'Rajdhani',sans-serif; font-size: 22px;
  font-weight: 800; color: var(--gold);
}
.fr-wallet-label { font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: .6px; }

/* ── Hub cards grid ────────────────────────────────────────────── */
.fr-hub {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.fr-card {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; gap: 10px;
  padding: 28px 24px; border-radius: 20px;
  border: 1px solid rgba(255,255,255,0.06);
  text-decoration: none; color: var(--text-0);
  min-height: 260px;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  background: var(--bg-3);
}
.fr-card:hover { transform: translateY(-5px); }

/* Shine layer */
.fr-card-shine {
  position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse at 25% 0%, rgba(255,255,255,0.04) 0%, transparent 65%);
}

/* Casino — gold */
.fr-casino {
  background: linear-gradient(150deg, #1e1b10 0%, #252218 100%);
  border-color: rgba(212,168,67,0.2);
}
.fr-casino:hover { border-color: rgba(212,168,67,0.6); box-shadow: 0 10px 40px rgba(212,168,67,0.18); }

/* RPG — radioactive */
.fr-rpg {
  background: linear-gradient(150deg, #0e1a0f 0%, #141f14 100%);
  border-color: rgba(86,194,125,0.18);
}
.fr-rpg:hover { border-color: rgba(86,194,125,0.55); box-shadow: 0 10px 40px rgba(86,194,125,0.15); }

/* Arcade — neon blue */
.fr-arcade {
  background: linear-gradient(150deg, #0d1520 0%, #111a24 100%);
  border-color: rgba(106,173,204,0.18);
}
.fr-arcade:hover { border-color: rgba(106,173,204,0.55); box-shadow: 0 10px 40px rgba(106,173,204,0.15); }

/* Card internals */
.fr-card-top   { display: flex; align-items: flex-start; justify-content: space-between; }
.fr-card-emoji { font-size: 44px; line-height: 1; }
.fr-card-name  { font-family: 'Rajdhani',sans-serif; font-size: 24px; font-weight: 800; margin-top: 4px; }
.fr-card-desc  { font-size: 13px; color: var(--text-2); line-height: 1.55; flex: 1; }
.fr-card-games { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.fr-card-games span {
  display: inline-block; padding: 3px 8px; border-radius: 10px;
  background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.07);
  font-size: 11px; color: var(--text-2);
}
.fr-card-cta {
  margin-top: auto; display: flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 600; color: var(--text-2);
  transition: color 0.15s;
}
.fr-card:hover .fr-card-cta { color: var(--text-0); }
.fr-card-cta span { font-size: 16px; transition: transform 0.15s; }
.fr-card:hover .fr-card-cta span { transform: translateX(4px); }

/* Badges */
.fr-card-badge {
  font-size: 11px; font-weight: 700; padding: 4px 9px;
  border-radius: 12px; white-space: nowrap;
  display: flex; align-items: center; gap: 5px;
}
.casino-badge { background: rgba(212,168,67,0.12); color: var(--gold); border: 1px solid rgba(212,168,67,0.2); }
.rpg-badge    { background: rgba(86,194,125,0.1);  color: #56c27d;     border: 1px solid rgba(86,194,125,0.2); }
.rpg-badge-new { background: rgba(106,173,204,0.1); color: var(--sky); border: 1px solid rgba(106,173,204,0.2); font-size:11px; font-weight:700; padding:4px 9px; border-radius:12px; }
.arcade-badge  { background: rgba(106,173,204,0.1); color: var(--sky); border: 1px solid rgba(106,173,204,0.2); }
.fr-badge-dot  { width:6px; height:6px; border-radius:50%; background:var(--mint); animation: pulse-dot 2s infinite; }
.rpg-live-dot  { width:6px; height:6px; border-radius:50%; background:#56c27d; flex-shrink:0; animation: pulse-dot 2s infinite; }
@keyframes pulse-dot { 0%,100%{opacity:1;transform:scale(1)} 50%{opacity:.5;transform:scale(.7)} }

/* RPG status mini */
.fr-card-rpg-status { display: flex; flex-direction: column; gap: 4px; }
.fr-rpg-stat { font-size: 12px; color: var(--text-2); display: flex; align-items: center; gap: 6px; }

/* ── Stats bar ─────────────────────────────────────────────────── */
.fr-stats {
  display: flex; align-items: center; gap: 0;
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden;
}
.fr-stat { flex: 1; padding: 14px 20px; text-align: center; }
.fr-stat-sep { width: 1px; background: var(--border); align-self: stretch; flex-shrink: 0; }
.fr-stat-val   { font-family: 'Rajdhani',sans-serif; font-size: 22px; font-weight: 800; color: var(--text-0); }
.fr-stat-label { font-size: 11px; color: var(--text-3); margin-top: 2px; }

/* Hub mobile */
@media (max-width: 1100px) { .fr-hub { grid-template-columns: repeat(2,1fr); } }
@media (max-width: 680px)  { .fr-hub { grid-template-columns: 1fr; } }
@media (max-width: 600px)  {
  .fr-stats { flex-wrap: wrap; }
  .fr-stat  { min-width: 50%; }
  .fr-stat-sep { display: none; }
}

/* ═══════════════════════════════════════════════════════════════
   CASINO v2
   ═══════════════════════════════════════════════════════════════ */

/* Top bar */
.cas-topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 4px;
}
.cas-title { font-family:'Rajdhani',sans-serif; font-size:22px; font-weight:800; color:var(--text-0); }
.cas-back-btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 12px; border-radius: var(--radius);
  background: var(--bg-3); border: 1px solid var(--border-light);
  color: var(--text-2); font-size: 13px; text-decoration: none;
  transition: border-color 0.13s, color 0.13s;
}
.cas-back-btn:hover { border-color: var(--text-2); color: var(--text-0); }
.cas-wallet {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-3); border: 1px solid var(--border-light);
  border-radius: var(--radius-lg); padding: 7px 16px;
  font-family: 'Rajdhani',sans-serif; font-size: 16px; font-weight: 700;
  color: var(--gold);
}
.cas-daily-btn {
  padding: 7px 14px; border-radius: var(--radius-lg);
  background: rgba(122,191,158,0.12); border: 1px solid rgba(122,191,158,0.3);
  color: var(--mint); font-size: 13px; font-weight: 600; cursor: pointer;
  transition: all 0.13s;
}
.cas-daily-btn:hover:not(:disabled) { background: rgba(122,191,158,0.2); }
.cas-daily-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* Tab navigation */
.cas-tabs {
  display: flex; gap: 0;
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: 14px; padding: 4px; width: fit-content;
  margin-bottom: 16px;
}
.cas-tab {
  display: flex; align-items: center; gap: 7px;
  padding: 9px 22px; border-radius: 10px; border: none;
  background: transparent; color: var(--text-2);
  font-size: 14px; font-weight: 600; cursor: pointer;
  font-family: 'Inter',sans-serif; transition: all 0.15s;
}
.cas-tab-icon { font-size: 16px; }
.cas-tab:hover  { color: var(--text-0); background: var(--bg-3); }
.cas-tab.active { color: var(--text-0); background: var(--bg-4); box-shadow: 0 1px 8px rgba(0,0,0,.35); }

.cas-panel { animation: cas-fadein 0.2s ease; }
@keyframes cas-fadein { from{opacity:0;transform:translateY(5px)} to{opacity:1;transform:none} }

/* Shared bet controls */
.cas-bet-row {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.cas-bet-label { font-size: 13px; color: var(--text-2); flex-shrink: 0; }
.cas-bet-inp {
  width: 100px; padding: 8px 10px;
  background: var(--bg-0); border: 1px solid var(--border-light);
  border-radius: var(--radius); color: var(--text-0);
  font-size: 14px; font-family: 'Rajdhani',sans-serif; font-weight: 700;
}
.cas-bet-inp:focus { outline: none; border-color: var(--accent); }
.cas-presets { display: flex; gap: 4px; }
.cas-pre {
  padding: 6px 10px; border-radius: 8px;
  border: 1px solid var(--border-light); background: var(--bg-3);
  color: var(--text-2); font-size: 12px; font-weight: 700;
  cursor: pointer; font-family: 'Rajdhani',sans-serif; transition: all 0.12s;
}
.cas-pre:hover { border-color: var(--accent); color: var(--accent); }

.cas-result-msg {
  font-family: 'Rajdhani',sans-serif; font-size: 18px; font-weight: 800;
  min-height: 26px; text-align: center;
}
.cas-result-msg.win  { color: var(--mint); }
.cas-result-msg.lose { color: var(--rose); }
.cas-result-msg.push { color: var(--gold); }

.cas-main-btn {
  width: 100%; padding: 13px; border: none; border-radius: var(--radius-lg);
  font-family: 'Rajdhani',sans-serif; font-size: 17px; font-weight: 800;
  letter-spacing: 1px; cursor: pointer;
  transition: transform 0.12s, box-shadow 0.12s;
  margin-top: 12px;
}
.gold-btn  { background: var(--grad-accent); color: #0a0b0e; box-shadow: 0 4px 18px rgba(212,168,67,.3); }
.green-btn { background: linear-gradient(135deg,#2a6a3a,#3a9a5a); color: #fff; box-shadow: 0 4px 18px rgba(58,154,90,.3); }
.cas-main-btn:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 7px 28px rgba(212,168,67,.45); }
.cas-main-btn:disabled { opacity: .5; cursor: not-allowed; }

/* ── Slots ─────────────────────────────────────────────────────── */
.cas-game-area {
  display: flex; gap: 24px; align-items: flex-start;
  justify-content: center; flex-wrap: wrap;
}
.slots-machine {
  background: var(--bg-2); border: 2px solid var(--border-light);
  border-radius: 20px; padding: 28px 32px;
  min-width: 300px; max-width: 400px;
  text-align: center;
  box-shadow: inset 0 0 40px rgba(0,0,0,.3), var(--shadow);
}
.slots-title-bar {
  font-family: 'Rajdhani',sans-serif; font-size: 13px; font-weight: 800;
  letter-spacing: 3.5px; color: var(--gold); margin-bottom: 20px;
}
.slots-window {
  display: flex; align-items: center; justify-content: center; gap: 0;
  background: var(--bg-0); border-radius: var(--radius-lg);
  border: 2px solid var(--border-light); padding: 12px;
}
.slots-reel-col { width: 90px; height: 90px; display:flex; align-items:center; justify-content:center; }
.slots-reel {
  width: 80px; height: 80px; border-radius: var(--radius);
  background: var(--bg-3); display: flex; align-items: center; justify-content: center;
  transition: background 0.2s;
}
.slots-reel.reel-glow {
  background: rgba(122,191,158,0.14);
  animation: reel-pulse 0.85s ease-in-out;
}
@keyframes reel-pulse {
  0%,100%{ box-shadow: none; }
  50%    { box-shadow: 0 0 22px rgba(122,191,158,.7); }
}
.slots-sym { font-size: 46px; line-height: 1; transition: transform 0.1s; }
.slots-div { width: 2px; height: 56px; background: var(--border-light); margin: 0 2px; }

/* Payout table */
.slots-paytable {
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 16px 20px;
  min-width: 190px;
}
.pt-head {
  font-size: 10px; font-weight: 800; text-transform: uppercase;
  letter-spacing: 1.2px; color: var(--text-3); margin-bottom: 10px;
}
.pt-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 5px 0; font-size: 15px; border-bottom: 1px solid var(--border);
  color: var(--text-1);
}
.pt-row:last-child { border-bottom: none; }
.pt-row.top  span:last-child { color: var(--gold); font-family:'Rajdhani',sans-serif; font-weight:800; }
.pt-row.dim  { opacity: .5; }
.pt-row span:last-child { font-family:'Rajdhani',sans-serif; font-weight:700; font-size:14px; }
.pt-sep { height: 1px; background: var(--border-light); margin: 5px 0; }

/* ── Blackjack ─────────────────────────────────────────────────── */
.bj-game { display: flex; flex-direction: column; gap: 16px; max-width: 700px; margin: 0 auto; }

.bj-felt {
  background: #112a18; border: 2px solid #1e4a28;
  border-radius: 20px; padding: 24px 28px; position: relative;
  box-shadow: inset 0 0 50px rgba(0,0,0,.5), var(--shadow);
  min-height: 300px;
}
.bj-zone { margin-bottom: 12px; }
.bj-zone.player-zone { margin-bottom: 0; margin-top: 12px; }
.bj-zone-label {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1px; color: rgba(255,255,255,.4); margin-bottom: 10px;
}
.bj-val { display:inline-block; margin-left:8px;
  background:rgba(0,0,0,.4); border-radius:8px; padding:1px 8px;
  font-family:'Rajdhani',sans-serif; font-size:14px; color:#fff; }
.bj-val.bust { color: var(--rose); }
.bj-val.bj21 { color: var(--gold); }
.bj-cards-row { display: flex; flex-wrap: wrap; gap: 8px; min-height: 80px; }

/* Cards */
.bj-card {
  width: 64px; height: 90px; border-radius: 8px;
  background: #fff; border: 1px solid rgba(0,0,0,.15);
  display: flex; flex-direction: column; justify-content: space-between;
  padding: 5px; position: relative; flex-shrink: 0;
  box-shadow: 0 3px 10px rgba(0,0,0,.5);
  animation: card-deal .22s ease;
}
@keyframes card-deal {
  from { opacity:0; transform:scale(.7) rotate(-8deg); }
  to   { opacity:1; transform:none; }
}
.bj-card.red   { color: #c0392b; }
.bj-card.black { color: #1a1a1a; }
.bj-card.back  { background: #1a3a8f; border-color: rgba(255,255,255,.1); }
.bj-card-back-pat {
  position:absolute; inset:4px; border-radius:4px;
  background: repeating-linear-gradient(45deg, rgba(255,255,255,.08) 0, rgba(255,255,255,.08) 2px, transparent 2px, transparent 8px);
  border: 1px solid rgba(255,255,255,.15);
}
.bj-rank-tl { font-size:13px; font-weight:800; line-height:1; }
.bj-suit-center {
  position:absolute; top:50%; left:50%; transform:translate(-50%,-50%);
  font-size:22px; line-height:1;
}
.bj-rank-br { font-size:13px; font-weight:800; line-height:1; align-self:flex-end; transform:rotate(180deg); }

/* Result banner */
.bj-center-strip {
  position: absolute; top:50%; left:50%; transform: translate(-50%,-50%) scale(.7);
  padding: 12px 26px; border-radius: 14px; z-index: 5;
  font-family:'Rajdhani',sans-serif; font-size:22px; font-weight:800;
  background: var(--bg-0); white-space: nowrap;
  border: 2px solid var(--border-light);
  opacity: 0; transition: all .22s;
  pointer-events: none;
}
.bj-center-strip.bj-banner-win,
.bj-center-strip.bj-banner-blackjack { opacity:1; transform:translate(-50%,-50%) scale(1); color:var(--mint); border-color:var(--mint); }
.bj-center-strip.bj-banner-push      { opacity:1; transform:translate(-50%,-50%) scale(1); color:var(--sky); border-color:var(--sky); }
.bj-center-strip.bj-banner-lose,
.bj-center-strip.bj-banner-bust      { opacity:1; transform:translate(-50%,-50%) scale(1); color:var(--rose); border-color:var(--rose); }

/* BJ controls */
.bj-controls-panel {
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 16px 20px;
  display: flex; flex-direction: column; gap: 10px;
}
.bj-action-row { display: flex; gap: 8px; flex-wrap: wrap; }
.cas-action-btn {
  flex: 1; padding: 10px; border-radius: var(--radius);
  border: 1px solid var(--border-light); background: var(--bg-3);
  color: var(--text-1); font-size: 13px; font-weight: 600;
  cursor: pointer; font-family: 'Inter',sans-serif; transition: all .13s;
}
.cas-action-btn:hover:not(:disabled) { border-color: var(--text-1); color: var(--text-0); }
.cas-action-btn:disabled { opacity: .35; cursor: not-allowed; }
.bj-rule-hint {
  font-size: 11.5px; color: var(--text-3); line-height: 1.5;
  padding-top: 6px; border-top: 1px solid var(--border);
}

/* ── Roulette ──────────────────────────────────────────────────── */
.rou-game {
  display: flex; gap: 24px; align-items: flex-start;
  max-width: 800px; margin: 0 auto; flex-wrap: wrap;
}
.rou-left { display: flex; flex-direction: column; gap: 14px; min-width: 220px; flex-shrink: 0; }
.rou-right { flex: 1; min-width: 300px; }

.rou-ball-area { display: flex; align-items: center; gap: 16px; }
.rou-ball {
  width: 72px; height: 72px; border-radius: 50%; flex-shrink: 0;
  background: var(--bg-3); border: 2px solid var(--border-light);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Rajdhani',sans-serif; font-size: 26px; font-weight: 800;
  transition: all .4s;
}
.rou-ball.spinning { animation: rou-spin .1s linear infinite; }
@keyframes rou-spin { from{transform:rotate(0)} to{transform:rotate(360deg)} }
.rou-ball.red   { background:#7a1a1a; border-color:#c0392b; color:#fff; box-shadow:0 0 18px rgba(192,57,43,.5); }
.rou-ball.black { background:var(--bg-0); border-color:var(--border-light); color:var(--text-0); }
.rou-ball.green { background:#1a4a1a; border-color:var(--mint); color:var(--mint); box-shadow:0 0 18px rgba(122,191,158,.4); }
.rou-hint { font-size: 11px; color: var(--text-3); }

/* Roulette table */
.rou-table {
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 14px; overflow-x: auto;
}
.rou-top-row {
  display: flex; align-items: stretch; gap: 6px; margin-bottom: 6px;
}
.rou-side-bets { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.rou-num-grid {
  display: grid; grid-template-columns: repeat(12,1fr);
  gap: 3px; margin-bottom: 6px; min-width: 400px;
}
.rou-dozens { display: flex; gap: 4px; }
.rou-selected {
  margin-top: 8px; font-size: 13px; font-weight: 700;
  color: var(--gold); font-family: 'Rajdhani',sans-serif;
}

/* Roulette buttons */
.rb {
  padding: 7px 6px; border-radius: 6px;
  border: 1px solid var(--border-light); background: var(--bg-3);
  color: var(--text-1); font-size: 12px; font-weight: 700;
  cursor: pointer; font-family: 'Rajdhani',sans-serif;
  text-align: center; transition: all .12s;
}
.rb:hover    { transform: translateY(-1px); border-color: var(--text-2); }
.rb.red      { background:#5a1515; border-color:#8b2020; color:#ff6666; }
.rb.red:hover{ background:#7a1a1a; }
.rb.black    { background:var(--bg-0); }
.rb.green    { background:#1a3a1a; border-color:#2a5a2a; color:var(--mint); }
.rb.dz       { flex:1; padding:9px 6px; font-size:11px; }
.rb.sel      { border-color:var(--gold); box-shadow:0 0 10px rgba(212,168,67,.3); transform:translateY(-2px); }
.rb.landed   { box-shadow:0 0 14px rgba(212,168,67,.7); border-color:var(--gold); }
.rou-num     { min-width:30px; }

/* Toast */
.cas-toast {
  position:fixed; bottom:24px; right:24px; z-index:9999;
  padding:12px 20px; border-radius:var(--radius-lg);
  background:var(--bg-2); border:1px solid var(--border-light);
  font-size:14px; color:var(--text-0); box-shadow:var(--shadow-lg);
  transform:translateY(20px); opacity:0; transition:all .3s;
}
.cas-toast.show { transform:none; opacity:1; }
.cas-toast.win  { border-color:var(--mint); color:var(--mint); }
.cas-toast.err  { border-color:var(--rose); color:var(--rose); }

/* Casino mobile */
@media (max-width:700px) {
  .cas-tabs { width:100%; }
  .cas-tab  { flex:1; padding:8px 8px; font-size:12px; }
  .rou-num-grid { min-width:0; grid-template-columns:repeat(9,1fr); }
  .rou-game { flex-direction:column; }
}

/* ═══════════════════════════════════════════════════════════════
   ARCADE — Snake
   ═══════════════════════════════════════════════════════════════ */

.arc-topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 4px;
}
.arc-title { font-family:'Rajdhani',sans-serif; font-size:22px; font-weight:800; color:var(--text-0); }
.arc-scores-header { display: flex; gap: 10px; }
.arc-score-badge {
  padding: 6px 14px; border-radius: 20px;
  background: var(--bg-3); border: 1px solid var(--border-light);
  font-family: 'Rajdhani',sans-serif; font-size: 15px; font-weight: 700;
  color: var(--text-1);
}
.arc-score-badge.hi { color: var(--gold); border-color: rgba(212,168,67,.3); background: rgba(212,168,67,.06); }

.arc-layout {
  display: grid; grid-template-columns: 1fr 240px;
  gap: 16px; align-items: start;
}

/* ── Game column ─────────────────────────────────────────────── */
.arc-game-col { display: flex; flex-direction: column; gap: 12px; }

.arc-speed-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.arc-speed-label { font-size: 12px; color: var(--text-3); }
.arc-speed-btn {
  padding: 6px 14px; border-radius: 20px;
  border: 1px solid var(--border-light); background: var(--bg-3);
  color: var(--text-2); font-size: 12px; font-weight: 600; cursor: pointer;
  font-family: 'Inter',sans-serif; transition: all .13s;
}
.arc-speed-btn:hover  { border-color: var(--sky); color: var(--sky); }
.arc-speed-btn.active { border-color: var(--sky); color: var(--sky); background: rgba(106,173,204,.1); }

.arc-canvas-wrap {
  position: relative; align-self: start;
  border-radius: 12px; overflow: hidden;
  border: 2px solid var(--border-light);
  box-shadow: 0 0 40px rgba(86,194,125,.1);
  width: fit-content;
}
#snake-canvas {
  display: block;
  image-rendering: pixelated;
}
#snake-canvas.shake {
  animation: canvas-shake .5s ease;
}
@keyframes canvas-shake {
  0%,100%{ transform:none }
  20%{ transform:translateX(-6px) }
  40%{ transform:translateX(6px) }
  60%{ transform:translateX(-4px) }
  80%{ transform:translateX(4px) }
}

/* Overlays */
.arc-overlay {
  position: absolute; inset: 0;
  background: rgba(8,10,7,.85);
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(2px);
}
.arc-overlay-box {
  text-align: center; padding: 32px 28px;
  background: var(--bg-2); border: 1px solid var(--border-light);
  border-radius: 18px; box-shadow: var(--shadow-lg);
  min-width: 220px;
}
.arc-overlay-box.over  { border-color: var(--rose); }
.arc-overlay-box.pause { border-color: var(--sky); }
.arc-overlay-icon  { font-size: 48px; margin-bottom: 10px; }
.arc-overlay-title { font-family:'Rajdhani',sans-serif; font-size:24px; font-weight:800; color:var(--text-0); margin-bottom:6px; }
.arc-overlay-sub   { font-size: 12px; color: var(--text-3); }
.arc-overlay-score { font-family:'Rajdhani',sans-serif; font-size:20px; font-weight:700; color:var(--gold); margin-top:8px; }
.arc-record-badge  {
  display: inline-block; margin-top: 8px;
  padding: 5px 14px; border-radius: 20px;
  background: rgba(212,168,67,.12); border: 1px solid rgba(212,168,67,.3);
  color: var(--gold); font-size: 13px; font-weight: 700;
  animation: badge-pop .4s ease;
}
@keyframes badge-pop { from{transform:scale(.5);opacity:0} to{transform:none;opacity:1} }

.arc-play-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 28px; border-radius: 12px; border: none;
  background: linear-gradient(135deg,#3a8a4a,#56c27d);
  color: #fff; font-family:'Rajdhani',sans-serif;
  font-size: 16px; font-weight: 800; cursor: pointer;
  box-shadow: 0 4px 18px rgba(86,194,125,.3);
  transition: transform .13s;
}
.arc-play-btn:hover { transform: translateY(-2px); }

.arc-controls-hint {
  display: flex; gap: 16px; flex-wrap: wrap;
  font-size: 11px; color: var(--text-3);
}
.arc-controls-hint span::before { content: '•'; margin-right: 5px; }

/* ── Sidebar ─────────────────────────────────────────────────── */
.arc-sidebar { display: flex; flex-direction: column; gap: 12px; }

.arc-stat-panel {
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 14px 16px;
}
.arc-stat-title {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .8px; color: var(--text-3); margin-bottom: 10px;
}
.arc-stat-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 5px 0; font-size: 13px; color: var(--text-2);
  border-bottom: 1px solid var(--border);
}
.arc-stat-row:last-child { border-bottom: none; }
.arc-stat-val { font-family:'Rajdhani',sans-serif; font-size:15px; font-weight:700; color:var(--text-0); }

.arc-leaderboard {
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 14px 16px;
}
.arc-lb-title {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .8px; color: var(--text-3); margin-bottom: 10px;
}
.arc-lb-row {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 0; border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.arc-lb-row:last-child { border-bottom: none; }
.arc-lb-row.arc-lb-me { background: rgba(106,173,204,.06); border-radius: 6px; padding: 6px 6px; margin: 0 -6px; }
.arc-lb-rank  { font-size: 15px; flex-shrink: 0; width: 22px; text-align: center; }
.arc-lb-name  { flex: 1; color: var(--text-1); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.arc-lb-score { font-family:'Rajdhani',sans-serif; font-size:15px; font-weight:800; color:var(--gold); flex-shrink:0; }
.arc-lb-empty { font-size: 12px; color: var(--text-3); font-style: italic; }

.arc-tips {
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 12px 14px;
}
.arc-tips-title { font-size: 11px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: .7px; margin-bottom: 8px; }
.arc-tip { font-size: 12px; color: var(--text-3); padding: 3px 0; padding-left: 12px; position: relative; }
.arc-tip::before { content:'•'; position:absolute; left:0; color:var(--sky); }

/* Touch controls */
.arc-touch-btns {
  position: fixed; bottom: 20px; right: 16px;
  z-index: 100; display: flex; flex-direction: column; gap: 4px;
}
.arc-touch-row { display: flex; gap: 4px; justify-content: center; }
.arc-touch-btn {
  width: 48px; height: 48px; border-radius: 10px;
  border: 1px solid var(--border-light); background: rgba(10,10,10,.85);
  color: var(--text-1); font-size: 18px; cursor: pointer;
  backdrop-filter: blur(4px);
}

/* Arcade mobile */
@media (max-width: 800px) {
  .arc-layout { grid-template-columns: 1fr; }
  #snake-canvas { width: 100% !important; height: auto !important; max-width: 480px; }
  .arc-canvas-wrap { width: 100%; max-width: 480px; }
}

/* ═══════════════════════════════════════════════════════════════
   RPG styles kept from original
   ═══════════════════════════════════════════════════════════════ */
.rpg-new-card {
  max-width: 480px; margin: 40px auto;
  background: var(--bg-2);
  border: 1px solid rgba(180,142,255,0.25);
  border-radius: var(--radius-xl); padding: 48px 40px;
  text-align: center;
  box-shadow: 0 8px 40px rgba(0,0,0,0.4);
}
.rpg-new-icon  { font-size: 64px; margin-bottom: 16px; }
.rpg-new-title { font-family: 'Rajdhani', sans-serif; font-size: 28px; font-weight: 700; color: var(--text-0); margin-bottom: 12px; }
.rpg-new-desc  { font-size: 14px; color: var(--text-2); line-height: 1.6; margin-bottom: 32px; }
.rpg-new-form  { display: flex; flex-direction: column; gap: 12px; }
.rpg-new-label { font-size: 12px; color: var(--text-3); text-align: left; font-weight: 600; text-transform: uppercase; letter-spacing: 0.6px; }
.rpg-name-input {
  width: 100%; padding: 11px 14px; box-sizing: border-box;
  background: var(--bg-0); border: 1px solid var(--border-light);
  border-radius: var(--radius); color: var(--text-0);
  font-size: 16px; font-family: 'Rajdhani',sans-serif; font-weight: 600;
  text-align: center; transition: border-color 0.15s;
}
.rpg-name-input:focus { outline: none; border-color: var(--purple); }
.rpg-start-btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 13px 28px; border-radius: var(--radius-lg); border: none;
  background: linear-gradient(135deg, #7b42cc 0%, #b07ad4 100%);
  color: #fff; font-family: 'Rajdhani',sans-serif; font-size: 17px; font-weight: 700;
  cursor: pointer; transition: transform 0.15s, box-shadow 0.15s;
  box-shadow: 0 4px 18px rgba(180,142,255,0.3);
}
.rpg-start-btn:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 6px 28px rgba(180,142,255,.45); }
.rpg-start-btn:disabled { opacity: 0.6; cursor: not-allowed; }
.rpg-layout { display:grid; grid-template-columns:1fr 260px; gap:16px; height:calc(100vh - 140px); min-height:500px; }
.rpg-log-col { display:flex; flex-direction:column; background:var(--bg-2); border:1px solid var(--border); border-radius:var(--radius-lg); overflow:hidden; }
.rpg-log { flex:1; overflow-y:auto; padding:16px; display:flex; flex-direction:column; gap:14px; background:#0d0f0a; }
.rpg-log::-webkit-scrollbar { width:4px; }
.rpg-log::-webkit-scrollbar-thumb { background:var(--border-light); border-radius:2px; }
.rpg-entry.dm { background:rgba(180,142,255,.05); border-left:3px solid var(--purple); border-radius:0 var(--radius) var(--radius) 0; padding:12px 14px; }
.rpg-entry.player { align-self:flex-end; background:rgba(106,173,204,.08); border-right:3px solid var(--sky); border-radius:var(--radius) 0 0 var(--radius); padding:10px 14px; max-width:85%; }
.rpg-entry.system { text-align:center; font-size:12px; color:var(--text-3); font-style:italic; border-top:1px dashed var(--border); border-bottom:1px dashed var(--border); padding:8px 0; }
.rpg-dm-label { font-size:11px; font-weight:700; text-transform:uppercase; letter-spacing:.8px; color:var(--purple); margin-bottom:6px; }
.rpg-dm-text { font-size:14px; line-height:1.7; color:var(--text-0); }
.rpg-dm-text strong { color:var(--gold); }
.rpg-dm-text em { color:var(--text-1); font-style:italic; }
.rpg-player-label { font-size:11px; font-weight:700; text-transform:uppercase; letter-spacing:.8px; color:var(--sky); margin-bottom:4px; }
.rpg-player-text { font-size:13px; color:var(--text-1); }
.rpg-loc-tag { display:inline-block; padding:2px 8px; border-radius:10px; background:rgba(122,191,158,.12); color:var(--mint); font-size:11px; font-weight:700; margin-right:8px; }
.rpg-typing { display:flex; align-items:center; gap:6px; padding:8px 16px; font-size:12px; color:var(--text-3); font-style:italic; background:#0d0f0a; border-top:1px solid var(--border); }
.rpg-typing span { width:5px; height:5px; border-radius:50%; background:var(--purple); animation:rpg-dot 1.2s infinite; }
.rpg-typing span:nth-child(2){animation-delay:.2s} .rpg-typing span:nth-child(3){animation-delay:.4s}
@keyframes rpg-dot { 0%,80%,100%{transform:scale(.6);opacity:.4} 40%{transform:scale(1);opacity:1} }
.rpg-input-area { border-top:1px solid var(--border); background:var(--bg-2); padding:10px; }
.rpg-quick-btns { display:flex; flex-wrap:wrap; gap:5px; margin-bottom:8px; }
.rpg-quick { padding:5px 10px; border-radius:var(--radius); border:1px solid var(--border-light); background:var(--bg-3); color:var(--text-2); font-size:12px; cursor:pointer; font-family:'Inter',sans-serif; transition:all .12s; }
.rpg-quick:hover:not(:disabled) { border-color:var(--purple); color:var(--purple); }
.rpg-quick:disabled { opacity:.4; }
.rpg-input-row { display:flex; gap:8px; align-items:flex-end; }
.rpg-action-input { flex:1; padding:10px 12px; resize:none; background:var(--bg-0); border:1px solid var(--border-light); border-radius:var(--radius); color:var(--text-0); font-size:14px; font-family:'Inter',sans-serif; transition:border-color .15s; line-height:1.5; }
.rpg-action-input:focus { outline:none; border-color:var(--purple); }
.rpg-action-input:disabled { opacity:.5; }
.rpg-send-btn { width:40px; height:40px; border-radius:var(--radius); border:none; background:linear-gradient(135deg,#7b42cc,#b07ad4); color:#fff; cursor:pointer; display:flex; align-items:center; justify-content:center; flex-shrink:0; transition:transform .12s; }
.rpg-send-btn:hover:not(:disabled) { transform:translateY(-2px); }
.rpg-send-btn:disabled { opacity:.5; cursor:not-allowed; }
.rpg-stats-col { background:var(--bg-2); border:1px solid var(--border); border-radius:var(--radius-lg); padding:16px; display:flex; flex-direction:column; gap:14px; overflow-y:auto; }
.rpg-char-header { display:flex; align-items:center; gap:12px; padding-bottom:14px; border-bottom:1px solid var(--border); }
.rpg-char-icon { font-size:32px; }
.rpg-char-name { font-family:'Rajdhani',sans-serif; font-size:17px; font-weight:700; color:var(--text-0); }
.rpg-char-faction { font-size:12px; color:var(--text-3); }
.rpg-stat-block { display:flex; flex-direction:column; gap:10px; }
.rpg-stat-row { display:flex; flex-direction:column; gap:4px; }
.rpg-stat-label { display:flex; justify-content:space-between; align-items:center; font-size:12px; color:var(--text-2); }
.rpg-stat-label span:last-child { font-family:'Rajdhani',sans-serif; font-size:13px; font-weight:700; color:var(--text-0); }
.rpg-bar-track { height:6px; background:var(--bg-0); border-radius:3px; overflow:hidden; }
.rpg-bar { height:100%; border-radius:3px; transition:width .5s ease; }
.hp-bar  { background:linear-gradient(90deg,var(--rose) 0%,var(--mint) 60%); }
.rad-bar { background:linear-gradient(90deg,#56b84e 0%,#d4a843 50%,#d46a6a 100%); }
.hun-bar { background:linear-gradient(90deg,#d4a843 0%,var(--rose) 100%); }
.fat-bar { background:linear-gradient(90deg,var(--sky) 0%,var(--purple) 100%); }
.rpg-info-row { display:grid; grid-template-columns:1fr 1fr; gap:8px; }
.rpg-info-item { background:var(--bg-3); border-radius:var(--radius); padding:8px 10px; }
.rpg-info-item:first-child { grid-column:1/-1; }
.rpg-info-label { font-size:10px; color:var(--text-3); text-transform:uppercase; letter-spacing:.5px; margin-bottom:2px; }
.rpg-info-val { font-family:'Rajdhani',sans-serif; font-size:14px; font-weight:700; color:var(--text-0); }
.rpg-inv-block { background:var(--bg-3); border:1px solid var(--border); border-radius:var(--radius); padding:10px 12px; flex:1; }
.rpg-inv-title { font-size:11px; font-weight:700; text-transform:uppercase; letter-spacing:.6px; color:var(--text-3); margin-bottom:8px; }
.rpg-inv-list { display:flex; flex-wrap:wrap; gap:5px; }
.rpg-inv-item { display:inline-block; padding:3px 8px; background:var(--bg-4); border:1px solid var(--border-light); border-radius:10px; font-size:11px; color:var(--text-1); }
.rpg-inv-empty { font-size:12px; color:var(--text-3); font-style:italic; }
.rpg-game-over-overlay { position:fixed; inset:0; background:rgba(0,0,0,.85); display:flex; align-items:center; justify-content:center; z-index:500; animation:cas-fadein .3s ease; }
.rpg-game-over-box { background:var(--bg-2); border:2px solid var(--rose); border-radius:var(--radius-xl); padding:48px 40px; text-align:center; max-width:380px; box-shadow:0 0 60px rgba(212,106,106,.3); }
.rpg-go-icon  { font-size:64px; margin-bottom:16px; }
.rpg-go-title { font-family:'Rajdhani',sans-serif; font-size:32px; font-weight:800; color:var(--rose); margin-bottom:8px; }
.rpg-go-sub   { font-size:14px; color:var(--text-3); }
@media (max-width:860px) {
  .rpg-layout { grid-template-columns:1fr; height:auto; }
  .rpg-log-col { min-height:400px; }
  .rpg-stats-col { order:-1; }
}

/* ═══════════════════════════════════════════════════════════════
   DOWNLOADS ADMIN PANEL
   ═══════════════════════════════════════════════════════════════ */

.dm-admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
  gap: 20px;
}

.dm-admin-card {
  background: var(--bg-2);
  border: 1px solid var(--border-l);
  border-radius: 20px;
  overflow: hidden;
}
.dm-pc     { border-top: 3px solid var(--sky); }
.dm-android { border-top: 3px solid var(--mint); }

/* Card header */
.dm-card-header {
  display: flex; align-items: center; gap: 14px;
  padding: 20px 24px;
  background: var(--bg-3);
  border-bottom: 1px solid var(--border);
}
.dm-card-icon {
  font-size: 32px; flex-shrink: 0;
}
.dm-card-platform {
  font-family: 'Rajdhani', sans-serif; font-size: 16px; font-weight: 700;
  color: var(--text-0);
}
.dm-card-status-row {
  display: flex; align-items: center; gap: 10px; margin-top: 3px;
  flex-wrap: wrap;
}
.dm-status {
  font-size: 11px; font-weight: 700; padding: 2px 8px;
  border-radius: 10px; letter-spacing: .4px;
}
.dm-status.active   { color: var(--mint); background: rgba(122,191,158,.1); }
.dm-status.inactive { color: var(--text-3); background: rgba(255,255,255,.04); }
.dm-status.warning  { color: #e8a020; background: rgba(232,160,32,.1); }
.dm-updated { font-size: 11px; color: var(--text-3); }
.dm-dl-count {
  margin-left: auto; display: flex; align-items: center; gap: 5px;
  font-family: 'Rajdhani', sans-serif; font-size: 16px; font-weight: 700;
  color: var(--gold);
}

/* Form */
.dm-form {
  padding: 20px 24px;
  display: flex; flex-direction: column; gap: 14px;
}

.dm-row-3 {
  display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px;
}
@media (max-width: 700px) {
  .dm-row-3 { grid-template-columns: 1fr 1fr; }
}

.dm-field { display: flex; flex-direction: column; gap: 6px; }

.dm-label {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .8px; color: var(--text-3);
  display: flex; align-items: center; gap: 6px;
}
.dm-label-hint { font-size: 11px; color: var(--text-3); text-transform: none; font-weight: 400; letter-spacing: 0; }

.dm-input {
  padding: 9px 12px; border-radius: var(--radius);
  background: var(--bg-0); border: 1px solid var(--border-l);
  color: var(--text-0); font-size: 14px; font-family: 'Inter', sans-serif;
  transition: border-color .14s;
}
.dm-input:focus { outline: none; border-color: var(--accent); }

.dm-textarea {
  padding: 9px 12px; border-radius: var(--radius);
  background: var(--bg-0); border: 1px solid var(--border-l);
  color: var(--text-0); font-size: 13px; font-family: 'Inter', sans-serif;
  resize: vertical; line-height: 1.6; transition: border-color .14s;
}
.dm-textarea:focus { outline: none; border-color: var(--accent); }

/* Toggle */
.dm-toggle {
  display: flex; align-items: center; gap: 10px; cursor: pointer;
  user-select: none; margin-top: 4px;
}
.dm-toggle input { display: none; }
.dm-toggle-track {
  width: 40px; height: 22px; border-radius: 11px;
  background: var(--bg-4); border: 1px solid var(--border-l);
  position: relative; transition: background .2s, border-color .2s;
  flex-shrink: 0;
}
.dm-toggle input:checked ~ .dm-toggle-track { background: rgba(122,191,158,.3); border-color: var(--mint); }
.dm-toggle-thumb {
  position: absolute; top: 3px; left: 3px;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--text-3); transition: transform .2s, background .2s;
}
.dm-toggle input:checked ~ .dm-toggle-track .dm-toggle-thumb {
  transform: translateX(18px); background: var(--mint);
}
.dm-toggle-label { font-size: 13px; color: var(--text-2); }

/* Current file indicator */
.dm-current-file {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; border-radius: var(--radius);
  background: rgba(122,191,158,.06); border: 1px solid rgba(122,191,158,.2);
  font-size: 13px; color: var(--text-1); margin-bottom: 8px; flex-wrap: wrap;
}
.dm-filesize {
  font-family: 'JetBrains Mono', monospace; font-size: 11px;
  color: var(--text-3); margin-left: auto;
}
.dm-del-file-btn {
  margin-left: auto; padding: 3px 8px; border-radius: 6px;
  border: 1px solid rgba(212,106,106,.25); background: rgba(212,106,106,.07);
  color: var(--rose); font-size: 11px; font-weight: 600;
  cursor: pointer; transition: all .13s;
}
.dm-del-file-btn:hover { background: rgba(212,106,106,.16); border-color: var(--rose); }

/* Upload zone */
.dm-upload-zone {
  border: 2px dashed var(--border-l); border-radius: 12px;
  padding: 20px; text-align: center;
  background: var(--bg-3); cursor: pointer;
  transition: border-color .15s, background .15s;
}
.dm-upload-zone:hover, .dm-upload-zone.drag {
  border-color: var(--accent); background: rgba(212,168,67,.04);
}
.dm-upload-zone.has-file { border-color: var(--mint); background: rgba(122,191,158,.04); }
.dm-upload-icon { font-size: 28px; margin-bottom: 6px; }
.dm-upload-text {
  font-size: 13px; color: var(--text-2); margin-bottom: 4px;
}
.dm-upload-browse {
  background: none; border: none; color: var(--accent);
  font-size: 13px; cursor: pointer; font-family: 'Inter', sans-serif;
  font-weight: 600; text-decoration: underline; padding: 0;
}
.dm-upload-hint { font-size: 11px; color: var(--text-3); }
.dm-upload-chosen {
  margin-top: 8px; font-size: 12px; color: var(--mint); font-weight: 600;
}

/* Save button */
.dm-save-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 20px; border-radius: 12px; border: none;
  font-family: 'Rajdhani', sans-serif; font-size: 15px; font-weight: 800;
  letter-spacing: .5px; cursor: pointer;
  transition: transform .13s, box-shadow .13s;
  margin-top: 4px;
}
.dm-save-pc {
  background: linear-gradient(135deg, #3a7acc, #6aadcc);
  color: #fff; box-shadow: 0 4px 18px rgba(106,173,204,.3);
}
.dm-save-android {
  background: linear-gradient(135deg, #3a8a55, #7abf9e);
  color: #fff; box-shadow: 0 4px 18px rgba(122,191,158,.3);
}
.dm-save-btn:hover { transform: translateY(-2px); }

/* Flash messages */
.flash-msg {
  padding: 11px 16px; border-radius: var(--radius);
  font-size: 13px; font-weight: 500;
}
.flash-msg.success {
  background: rgba(122,191,158,.1); border: 1px solid rgba(122,191,158,.25); color: var(--mint);
}
.flash-msg.error {
  background: rgba(212,106,106,.1); border: 1px solid rgba(212,106,106,.25); color: var(--rose);
}

@media (max-width: 760px) {
  .dm-admin-grid { grid-template-columns: 1fr; }
  .dm-admin-card { border-radius: 14px; }
}

/* ═══════════════════════════════════════════════════════════════
   DOWNLOADS ADMIN v2
   ═══════════════════════════════════════════════════════════════ */

/* Tabs */
.dm-tabs {
  display: flex; gap: 4px;
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: 14px; padding: 4px; width: fit-content;
  margin-bottom: 20px;
}
.dm-tab {
  padding: 8px 20px; border-radius: 10px; border: none;
  background: transparent; color: var(--text-2);
  font-size: 13px; font-weight: 600; cursor: pointer;
  font-family: 'Inter', sans-serif; transition: all .15s;
}
.dm-tab:hover  { color: var(--text-0); background: var(--bg-3); }
.dm-tab.active { color: var(--text-0); background: var(--bg-4); box-shadow: 0 1px 8px rgba(0,0,0,.35); }

.dm-tab-panel { animation: dm-fadein .18s ease; }
@keyframes dm-fadein { from{opacity:0;transform:translateY(4px)} to{opacity:1;transform:none} }

/* Flash */
.dm-flash {
  padding: 11px 16px; border-radius: var(--radius);
  font-size: 13px; font-weight: 500; margin-bottom: 16px;
}
.dm-flash.success { background:rgba(122,191,158,.1); border:1px solid rgba(122,191,158,.25); color:var(--mint); }
.dm-flash.error   { background:rgba(212,106,106,.1); border:1px solid rgba(212,106,106,.25); color:var(--rose); }

/* Section form */
.dm-section-form { display: flex; flex-direction: column; gap: 16px; width: 100%; }
.dm-section-title {
  font-size: 11px; font-weight: 800; text-transform: uppercase;
  letter-spacing: 1.2px; color: var(--text-3);
  padding-bottom: 10px; border-bottom: 1px solid var(--border);
}

.dm-2col {
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px; width: 100%;
}
.dm-row3 {
  display: grid; grid-template-columns: 180px 1fr 1fr; gap: 12px; align-items: end; width: 100%;
}
@media (max-width: 700px) {
  .dm-2col  { grid-template-columns: 1fr; }
  .dm-row3  { grid-template-columns: 1fr 1fr; }
}

/* Fields */
.dm-field { display: flex; flex-direction: column; gap: 6px; }
.dm-label {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .8px; color: var(--text-3); display: flex; align-items: center; gap: 6px;
}
.dm-hint { text-transform: none; font-weight: 400; letter-spacing: 0; font-size: 11px; color: var(--text-3); }
.dm-input {
  padding: 9px 12px; border-radius: var(--radius);
  background: var(--bg-0); border: 1px solid var(--border-light);
  color: var(--text-0); font-size: 14px; font-family: 'Inter', sans-serif;
  transition: border-color .14s;
}
.dm-input:focus { outline: none; border-color: var(--accent); }
.dm-textarea {
  padding: 9px 12px; border-radius: var(--radius);
  background: var(--bg-0); border: 1px solid var(--border-light);
  color: var(--text-0); font-size: 13px; font-family: 'Inter', sans-serif;
  resize: vertical; line-height: 1.6; transition: border-color .14s;
}
.dm-textarea:focus { outline: none; border-color: var(--accent); }

/* Toggle */
.dm-toggle-wrap {
  display: flex; align-items: center; gap: 10px;
  cursor: pointer; user-select: none;
}
.dm-toggle-wrap input { display: none; }
.dm-tog-track {
  width: 40px; height: 22px; border-radius: 11px;
  background: var(--bg-4); border: 1px solid var(--border-light);
  position: relative; transition: background .2s, border-color .2s; flex-shrink: 0;
}
.dm-toggle-wrap input:checked ~ .dm-tog-track { background: rgba(122,191,158,.3); border-color: var(--mint); }
.dm-tog-thumb {
  position: absolute; top: 3px; left: 3px;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--text-3); transition: transform .2s, background .2s;
}
.dm-toggle-wrap input:checked ~ .dm-tog-track .dm-tog-thumb {
  transform: translateX(18px); background: var(--mint);
}
.dm-tog-label { font-size: 13px; color: var(--text-2); }

/* Release header */
.dm-release-header {
  display: flex; align-items: center; gap: 14px;
  padding: 18px 20px; background: var(--bg-3); border: 1px solid var(--border);
  border-radius: var(--radius-lg); margin-bottom: 20px;
}
.dm-rel-icon { font-size: 30px; }
.dm-rel-label { font-family: 'Rajdhani',sans-serif; font-size:16px; font-weight:700; color:var(--text-0); }
.dm-rel-count { margin-left:auto; font-family:'Rajdhani',sans-serif; font-size:15px; font-weight:700; color:var(--gold); }
.dm-status { font-size:11px; font-weight:700; padding:2px 8px; border-radius:10px; }
.dm-status.active  { color:var(--mint); background:rgba(122,191,158,.1); }
.dm-status.inactive{ color:var(--text-3); background:rgba(255,255,255,.04); }

/* Current file */
.dm-cur-file {
  display:flex; align-items:center; gap:8px;
  padding:8px 12px; border-radius:var(--radius);
  background:rgba(122,191,158,.05); border:1px solid rgba(122,191,158,.18);
  font-size:13px; color:var(--text-1); margin-bottom:8px; flex-wrap:wrap;
}
.dm-fsz { font-family:'JetBrains Mono',monospace; font-size:11px; color:var(--text-3); margin-left:auto; }
.dm-url-txt { font-family:'JetBrains Mono',monospace; font-size:11px; }
.dm-del-btn {
  padding:3px 8px; border-radius:6px;
  border:1px solid rgba(212,106,106,.2); background:rgba(212,106,106,.07);
  color:var(--rose); font-size:11px; font-weight:600; cursor:pointer;
  transition:all .13s;
}
.dm-del-btn:hover { background:rgba(212,106,106,.16); }

/* Drop zone */
.dm-drop-zone {
  border:2px dashed var(--border-light); border-radius:12px;
  padding:20px; text-align:center; background:var(--bg-3);
  transition:border-color .15s, background .15s; cursor:default;
}
.dm-drop-zone.drag,.dm-drop-zone:hover { border-color:var(--accent); background:rgba(212,168,67,.04); }
.dm-drop-zone.has-file { border-color:var(--mint); background:rgba(122,191,158,.04); }
.dm-dz-icon { font-size:26px; margin-bottom:6px; }
.dm-dz-text { font-size:13px; color:var(--text-2); margin-bottom:4px; }
.dm-dz-browse {
  background:none; border:none; color:var(--accent); font-size:13px;
  cursor:pointer; font-family:'Inter',sans-serif; font-weight:600;
  text-decoration:underline; padding:0;
}
.dm-dz-hint   { font-size:11px; color:var(--text-3); }
.dm-dz-chosen { margin-top:8px; font-size:12px; color:var(--mint); font-weight:600; }

/* Save button */
.dm-save-btn {
  display:flex; align-items:center; justify-content:center; gap:8px;
  padding:12px 28px; border-radius:12px; border:none; align-self:flex-start;
  font-family:'Rajdhani',sans-serif; font-size:15px; font-weight:800;
  letter-spacing:.5px; cursor:pointer; transition:transform .13s, box-shadow .13s;
  background:var(--grad-accent); color:#0a0b0e;
  box-shadow:0 4px 18px rgba(212,168,67,.3);
}
.dm-save-pc      { background:linear-gradient(135deg,#2a5acc,#6aadcc); color:#fff; box-shadow:0 4px 18px rgba(106,173,204,.3); }
.dm-save-android { background:linear-gradient(135deg,#2a7a55,#7abf9e); color:#fff; box-shadow:0 4px 18px rgba(122,191,158,.3); }
.dm-save-btn:hover { transform:translateY(-2px); }

/* Gallery admin */
.dm-gallery-admin {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
  padding: 4px 0;
}
.dm-shot-item {
  position: relative; border-radius: 10px; overflow: hidden;
  aspect-ratio: 16/9; border: 1px solid var(--border-light);
  cursor: default;
}
.dm-shot-item img { width:100%; height:100%; object-fit:cover; display:block; }
.dm-shot-overlay {
  position:absolute; inset:0; background:rgba(0,0,0,.55);
  opacity:0; display:flex; align-items:center; justify-content:center; gap:8px;
  transition:opacity .15s;
}
.dm-shot-item:hover .dm-shot-overlay { opacity:1; }
.dm-shot-del {
  width:32px; height:32px; border-radius:8px;
  background:rgba(212,106,106,.2); border:1px solid rgba(212,106,106,.4);
  color:var(--rose); font-size:14px; cursor:pointer; transition:all .13s;
}
.dm-shot-del:hover { background:rgba(212,106,106,.4); }
.dm-shot-drag { color:var(--text-2); font-size:18px; cursor:grab; }
.dm-shot-num {
  position:absolute; top:5px; left:7px;
  font-size:10px; font-weight:700; color:rgba(255,255,255,.5);
  font-family:'JetBrains Mono',monospace;
}

.dm-shot-upload {
  border:2px dashed var(--border-light); border-radius:10px;
  aspect-ratio:16/9; display:flex; flex-direction:column;
  align-items:center; justify-content:center; gap:4px;
  background:var(--bg-3); transition:all .15s; cursor:pointer;
}
.dm-shot-upload:hover,.dm-shot-upload.drag {
  border-color:var(--accent); background:rgba(212,168,67,.04);
}
.dm-shot-upload-icon { font-size:22px; color:var(--text-3); }
.dm-shot-upload-text {
  font-size:12px; font-weight:600; color:var(--text-2); cursor:pointer;
}
.dm-shot-upload-hint { font-size:10px; color:var(--text-3); text-align:center; }


/* ====================================================================
   REFACTOR ENHANCEMENTS v2
   ==================================================================== */

.main-content { animation: page-in 0.25s ease both; }
@keyframes page-in { from { opacity:0; transform:translateY(6px); } to { opacity:1; transform:translateY(0); } }

@keyframes notif-ring {
  0%{transform:rotate(0)} 15%{transform:rotate(18deg)} 30%{transform:rotate(-16deg)}
  45%{transform:rotate(12deg)} 60%{transform:rotate(-9deg)} 100%{transform:rotate(0)}
}
.notif-pulse svg { animation: notif-ring 0.6s ease; }

@keyframes shimmer { 0%{background-position:-600px 0} 100%{background-position:600px 0} }
.skeleton { background: linear-gradient(90deg, var(--bg-2) 25%, var(--bg-3) 50%, var(--bg-2) 75%); background-size: 1200px 100%; animation: shimmer 1.6s infinite linear; border-radius: var(--radius); }

.flash { display:flex; align-items:center; gap:10px; transition:opacity .35s ease,transform .35s ease; }

.btn:active:not(:disabled) { transform:translateY(1px) !important; }
.btn-icon:active { transform:scale(0.88); }

@keyframes card-in { from{opacity:0;transform:translateY(12px)} to{opacity:1;transform:translateY(0)} }

.db-stat-card { animation:card-in 0.3s ease both; }
.db-stat-card:nth-child(1){animation-delay:.03s} .db-stat-card:nth-child(2){animation-delay:.07s}
.db-stat-card:nth-child(3){animation-delay:.11s} .db-stat-card:nth-child(4){animation-delay:.15s}

.db-grid > * { animation:card-in 0.35s ease both; }
.db-grid > *:nth-child(1){animation-delay:.08s} .db-grid > *:nth-child(2){animation-delay:.14s}
.db-grid > *:nth-child(3){animation-delay:.20s} .db-grid > *:nth-child(4){animation-delay:.26s}

.db-card { transition:box-shadow .18s ease,border-color .18s ease; }
.db-card:hover { box-shadow:0 6px 28px rgba(0,0,0,.25); }

.log-row { animation:card-in 0.2s ease both; position:relative; }
.log-row::before { content:''; position:absolute; left:0; top:0; bottom:0; width:2px; background:transparent; transition:background .15s; }
.log-row:hover::before { background:var(--accent); }

.notif-item { transition:background .12s ease,transform .12s ease; position:relative; }
.notif-item:hover { transform:translateX(2px); }
.notif-item.unread { background:linear-gradient(135deg, var(--accent-dim) 0%, transparent 80%); }

.wiki-cat-card { animation:card-in 0.25s ease both; }
.wiki-cat-card:nth-child(1){animation-delay:.04s} .wiki-cat-card:nth-child(2){animation-delay:.08s}
.wiki-cat-card:nth-child(3){animation-delay:.12s} .wiki-cat-card:nth-child(4){animation-delay:.16s}
.wiki-cat-card:nth-child(5){animation-delay:.20s}

.fr-card { transition:transform .22s cubic-bezier(.34,1.56,.64,1),border-color .2s,box-shadow .2s; }
.fr-card:hover { transform:translateY(-6px) scale(1.01); }

.task-card { animation:card-in 0.22s ease both; }
.kanban-cards .task-card:nth-child(1){animation-delay:.03s} .kanban-cards .task-card:nth-child(2){animation-delay:.06s}
.kanban-cards .task-card:nth-child(3){animation-delay:.09s} .kanban-cards .task-card:nth-child(4){animation-delay:.12s}
.kanban-cards .task-card:nth-child(5){animation-delay:.15s}

.input:focus { box-shadow:0 0 0 3px var(--accent-dim), 0 0 12px rgba(212,168,67,.1); }

@keyframes spin { to{transform:rotate(360deg)} }
.spinner { width:20px;height:20px;border:2px solid var(--border-light);border-top-color:var(--accent);border-radius:50%;animation:spin .7s linear infinite;flex-shrink:0; }

.chip { display:inline-flex;align-items:center;gap:4px;padding:2px 9px;border-radius:20px;font-size:11px;font-weight:600;background:var(--bg-3);border:1px solid var(--border-light);color:var(--text-2);white-space:nowrap; }

:focus-visible { outline:2px solid var(--accent); outline-offset:2px; }

#search-overlay > div { animation:search-drop .22s cubic-bezier(.34,1.4,.64,1) both; }
@keyframes search-drop { from{transform:translateY(-20px) scale(.97);opacity:0} to{transform:translateY(0) scale(1);opacity:1} }
#search-results a:hover { background:var(--bg-hover) !important; }

.notif-dropdown.open { animation:dd-drop .18s cubic-bezier(.34,1.3,.64,1) both; }
@keyframes dd-drop { from{transform:translateY(-8px) scale(.97);opacity:0} to{transform:translateY(0) scale(1);opacity:1} }

#team-presence a { transition:transform .15s ease; }
#team-presence a:hover { transform:translateY(-2px) scale(1.1); z-index:1; }

.sidebar-user { transition:background .15s ease; }
.sidebar-user:hover { background:var(--bg-hover); }

.main-content,.kanban-cards,.chat-messages,.db-presence-list { -webkit-overflow-scrolling:touch; }

.db-empty svg { opacity:.2; transition:opacity .2s ease; }
.db-empty:hover svg { opacity:.35; }

.log-live-dot { display:inline-block;width:6px;height:6px;border-radius:50%;background:var(--mint);animation:pulse-dot 2s infinite;margin-right:4px;vertical-align:middle; }

.fr-page { padding:24px 28px; max-width:1200px; }

@media(max-width:1200px) { .db-grid { grid-template-columns:1fr 1fr 260px !important; } .db-presence-card { grid-column:1 / -1; } }
@media(max-width:860px)  { .db-grid { grid-template-columns:1fr 1fr !important; } .db-presence-card { grid-column:1 / -1; } }
@media(max-width:580px)  { .db-grid { grid-template-columns:1fr !important; } }
@media(max-width:900px)  { .fr-page { padding:12px; } #sfx-toggle { display:none; } }
@media(max-width:640px)  { #browser-notif-btn { display:none; } }

.status-badge { transition:box-shadow .15s ease; }

.sidebar-badge { animation:badge-pop .3s cubic-bezier(.34,1.56,.64,1) both; }
@keyframes badge-pop { from{transform:scale(0)} to{transform:scale(1)} }

.notif-type-icon { width:36px;height:36px;border-radius:10px;display:flex;align-items:center;justify-content:center;flex-shrink:0; }

.toolbar-bar select:focus,.toolbar-bar input:focus { border-color:var(--accent) !important; box-shadow:0 0 0 2px var(--accent-dim); }
