@import url('https://fonts.googleapis.com/css2?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); }

.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 */
}
