@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  --bg: #0f172a;
  --surface: #1e293b;
  --surface-2: #263348;
  --border: #334155;
  --accent: #38bdf8;
  --accent-dim: rgba(56, 189, 248, 0.12);
  --accent-hover: #0ea5e9;
  --text: #f1f5f9;
  --text-2: #94a3b8;
  --text-3: #64748b;
  --success: #22c55e;
  --danger: #ef4444;
  --warning: #f59e0b;
  --sidebar-w: 240px;
  --radius: 12px;
  --radius-sm: 8px;
}

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

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.5;
}

::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ── Layout ── */
.app-layout { display: flex; min-height: 100vh; }

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 100;
  overflow-y: auto;
}

.sidebar-brand {
  padding: 20px 16px 16px;
  border-bottom: 1px solid var(--border);
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.brand-badge {
  width: 38px;
  height: 38px;
  background: var(--accent);
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.5px;
  flex-shrink: 0;
}

.sidebar-logo {
  height: 42px;
  width: auto;
  object-fit: contain;
  flex-shrink: 0;
  mix-blend-mode: screen;
}

.brand-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}

.brand-sub {
  font-size: 10px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
}

.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent-dim);
  border: 1.5px solid rgba(56,189,248,0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  flex-shrink: 0;
}

.user-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  font-size: 10px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

/* ── Nav ── */
.sidebar-nav { flex: 1; padding: 10px 8px; }

.nav-section { margin-bottom: 20px; }

.nav-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 0 8px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.12s;
  position: relative;
  margin-bottom: 1px;
}

.nav-item:hover { background: rgba(255,255,255,0.05); color: var(--text); }

.nav-item.active {
  background: var(--accent-dim);
  color: var(--accent);
  font-weight: 600;
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 20px;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
}

.nav-icon {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-badge {
  margin-left: auto;
  background: var(--danger);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
  min-width: 18px;
  text-align: center;
  line-height: 1.6;
}

.sidebar-footer {
  padding: 10px 8px 16px;
  border-top: 1px solid var(--border);
}

/* ── Main ── */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0; z-index: 50;
  background: rgba(15, 23, 42, 0.80);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  padding: 0 28px;
  height: 58px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.page-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  flex: 1;
}

.topbar-actions { display: flex; align-items: center; gap: 8px; }

.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-2);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.12s;
  position: relative;
}

.icon-btn:hover { background: var(--surface); color: var(--text); }
.icon-btn svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.notif-dot {
  position: absolute;
  top: 6px; right: 6px;
  width: 7px; height: 7px;
  background: var(--danger);
  border-radius: 50%;
  border: 1.5px solid var(--bg);
}

.content { padding: 28px; flex: 1; }

/* ── Cards ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.card-title { font-size: 13px; font-weight: 700; color: var(--text); }
.card-action { font-size: 12px; color: var(--accent); text-decoration: none; font-weight: 500; }
.card-action:hover { text-decoration: underline; }

/* ── Stat Cards ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  position: relative;
  overflow: hidden;
}

.stat-card::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 2px;
}

.stat-card.blue::after { background: var(--accent); }
.stat-card.green::after { background: var(--success); }
.stat-card.yellow::after { background: var(--warning); }
.stat-card.red::after { background: var(--danger); }

.stat-icon {
  width: 32px; height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
  font-size: 16px;
}

.stat-icon.blue { background: var(--accent-dim); color: var(--accent); }
.stat-icon.green { background: rgba(34,197,94,0.12); color: var(--success); }
.stat-icon.yellow { background: rgba(245,158,11,0.12); color: var(--warning); }
.stat-icon.red { background: rgba(239,68,68,0.12); color: var(--danger); }

.stat-icon svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.stat-label { font-size: 11px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.4px; margin-bottom: 6px; }
.stat-value { font-size: 26px; font-weight: 800; color: var(--text); line-height: 1; }
.stat-sub { font-size: 11px; color: var(--text-2); margin-top: 4px; }

/* ── Grid ── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid-cols { display: grid; grid-template-columns: 1.5fr 1fr; gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.12s;
  border: none;
  text-decoration: none;
  white-space: nowrap;
  line-height: 1;
}

.btn svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.btn-primary { background: var(--accent); color: #0f172a; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost { background: transparent; color: var(--text-2); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--surface); color: var(--text); }
.btn-danger { background: rgba(239,68,68,0.12); color: var(--danger); border: 1px solid rgba(239,68,68,0.25); }
.btn-danger:hover { background: rgba(239,68,68,0.22); }
.btn-success { background: rgba(34,197,94,0.12); color: var(--success); border: 1px solid rgba(34,197,94,0.25); }
.btn-success:hover { background: rgba(34,197,94,0.22); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 14px; }

/* ── Badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.6;
}

.badge-blue { background: var(--accent-dim); color: var(--accent); }
.badge-green { background: rgba(34,197,94,0.13); color: var(--success); }
.badge-red { background: rgba(239,68,68,0.13); color: var(--danger); }
.badge-yellow { background: rgba(245,158,11,0.13); color: var(--warning); }
.badge-gray { background: rgba(148,163,184,0.10); color: var(--text-2); }

/* ── Lists ── */
.item-list { display: flex; flex-direction: column; }

.list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 4px;
  border-radius: var(--radius-sm);
  transition: background 0.1s;
  cursor: pointer;
}

.list-item:not(:last-child) { border-bottom: 1px solid rgba(51,65,85,0.5); }
.list-item:hover { background: rgba(255,255,255,0.03); }

.list-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--accent-dim);
  border: 1px solid rgba(56,189,248,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  flex-shrink: 0;
}

.list-info { flex: 1; min-width: 0; }
.list-title { font-size: 13px; font-weight: 600; color: var(--text); }
.list-sub { font-size: 11px; color: var(--text-2); margin-top: 1px; }
.list-meta { font-size: 11px; color: var(--text-3); flex-shrink: 0; text-align: right; }

/* ── Event cards ── */
.event-list { display: flex; flex-direction: column; gap: 10px; }

.event-card {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  transition: border-color 0.15s, background 0.15s;
  cursor: pointer;
}

.event-card:hover {
  border-color: var(--text-3);
  background: var(--surface-2);
}

.event-date-block {
  width: 46px;
  text-align: center;
  flex-shrink: 0;
  padding-top: 2px;
}

.event-month { font-size: 10px; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: 0.5px; }
.event-day { font-size: 24px; font-weight: 800; color: var(--text); line-height: 1.1; }

.event-divider { width: 1px; background: var(--border); align-self: stretch; flex-shrink: 0; }

.event-info { flex: 1; min-width: 0; }
.event-title { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 4px; }

.event-meta {
  display: flex;
  gap: 14px;
  font-size: 12px;
  color: var(--text-2);
  margin-bottom: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.event-meta-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.event-meta-item svg { width: 12px; height: 12px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }

.rsvp-row { display: flex; gap: 6px; align-items: center; }

.rsvp-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 11px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.12s;
}

.rsvp-yes { background: rgba(34,197,94,0.12); color: var(--success); border-color: rgba(34,197,94,0.2); }
.rsvp-yes:hover, .rsvp-yes.active { background: rgba(34,197,94,0.25); border-color: var(--success); }
.rsvp-no { background: rgba(239,68,68,0.12); color: var(--danger); border-color: rgba(239,68,68,0.2); }
.rsvp-no:hover, .rsvp-no.active { background: rgba(239,68,68,0.25); border-color: var(--danger); }
.rsvp-maybe { background: rgba(245,158,11,0.10); color: var(--warning); border-color: rgba(245,158,11,0.2); }
.rsvp-maybe:hover, .rsvp-maybe.active { background: rgba(245,158,11,0.22); border-color: var(--warning); }

.rsvp-counts { font-size: 11px; color: var(--text-3); margin-left: 4px; }

.event-type-pill {
  margin-left: auto;
  flex-shrink: 0;
}

/* ── Table ── */
.table-wrap { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; }

th {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

td {
  padding: 11px 12px;
  font-size: 13px;
  color: var(--text-2);
  border-bottom: 1px solid rgba(51,65,85,0.4);
}

tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: rgba(255,255,255,0.025); color: var(--text); }

/* ── Tab bar ── */
.tab-bar {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.tab-bar::-webkit-scrollbar { display: none; }

.tab {
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-3);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.12s;
  white-space: nowrap;
}

.tab:hover { color: var(--text-2); }

.tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 600;
}

/* ── Forms ── */
.form-group { margin-bottom: 16px; }

.form-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 6px;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: 16px; /* 16px minimum prevents iOS Safari auto-zoom on focus */
  transition: border-color 0.12s, box-shadow 0.12s;
  outline: none;
}
@media (min-width: 768px) {
  .form-input, .form-select, .form-textarea { font-size: 13px; }
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.form-input::placeholder, .form-textarea::placeholder { color: var(--text-3); }

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  cursor: pointer;
}

.form-select option { background: var(--surface); color: var(--text); }
.form-textarea { resize: vertical; min-height: 88px; }

/* ── Empty state ── */
.empty {
  text-align: center;
  padding: 56px 24px;
  color: var(--text-3);
}

.empty-icon { font-size: 36px; margin-bottom: 12px; opacity: 0.4; }
.empty-title { font-size: 14px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.empty-sub { font-size: 13px; }

/* ── Divider ── */
.divider { height: 1px; background: var(--border); margin: 14px 0; }

/* ── Announcement ── */
.announcement {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--accent);
  background: var(--accent-dim);
  margin-bottom: 10px;
}

.announcement.warning { border-color: var(--warning); background: rgba(245,158,11,0.08); }
.announcement.danger { border-color: var(--danger); background: rgba(239,68,68,0.08); }

.ann-title { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 3px; }
.ann-body { font-size: 12px; color: var(--text-2); }
.ann-meta { font-size: 11px; color: var(--text-3); margin-top: 5px; }

/* ── Progress bar ── */
.progress-bar {
  height: 6px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
  transition: width 0.4s;
}

.progress-fill.green { background: var(--success); }
.progress-fill.yellow { background: var(--warning); }
.progress-fill.red { background: var(--danger); }

/* ── Login page ── */
.login-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 24px 80px;
  position: relative;
  background: var(--bg) url('../assets/login-bg.jpg') center center / cover no-repeat;
}
.login-page::before {
  content: '';
  position: fixed;
  inset: 0;
  background: rgba(10, 15, 26, 0.72);
  backdrop-filter: blur(1px);
  -webkit-backdrop-filter: blur(1px);
  pointer-events: none;
  z-index: 0;
}
.login-page > * { position: relative; z-index: 1; }

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 36px;
}

.login-brand {
  text-align: center;
  margin-bottom: 28px;
}

.login-badge {
  width: 54px;
  height: 54px;
  background: var(--accent);
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 14px;
  letter-spacing: -0.5px;
}

.login-logo {
  height: 110px;
  width: auto;
  object-fit: contain;
  margin-bottom: 10px;
  display: block;
  margin-left: auto;
  margin-right: auto;
  mix-blend-mode: screen;
}

.login-title { font-size: 20px; font-weight: 800; color: var(--text); }
.login-sub { font-size: 13px; color: var(--text-2); margin-top: 5px; }

.login-tabs {
  display: flex;
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 3px;
  margin-bottom: 24px;
  gap: 2px;
}

.login-tab {
  flex: 1;
  padding: 7px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  color: var(--text-3);
  transition: all 0.12s;
  user-select: none;
}

.login-tab.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.login-error {
  background: rgba(239,68,68,0.10);
  border: 1px solid rgba(239,68,68,0.25);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 12px;
  color: var(--danger);
  margin-bottom: 16px;
  display: none;
}

.login-footer {
  margin-top: 18px;
  text-align: center;
  font-size: 12px;
  color: var(--text-3);
}

/* ── Messages page ── */
.messages-layout {
  display: flex;
  gap: 0;
  height: calc(100vh - 58px);
  margin: -28px;
}

.channel-list {
  width: 260px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.channel-list-header {
  padding: 18px 16px 12px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.channel-items { overflow-y: auto; flex: 1; padding: 8px; }

.channel-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.1s;
}

.channel-item:hover { background: rgba(255,255,255,0.04); }
.channel-item.active { background: var(--accent-dim); }

.channel-icon {
  width: 34px; height: 34px;
  border-radius: 9px;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
}

.channel-name { font-size: 13px; font-weight: 600; color: var(--text); }
.channel-preview { font-size: 11px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.channel-unread {
  margin-left: auto;
  background: var(--accent);
  color: #0f172a;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
  flex-shrink: 0;
}

.chat-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.chat-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}

.chat-title { font-size: 14px; font-weight: 700; color: var(--text); }
.chat-sub { font-size: 12px; color: var(--text-3); }

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.message-group { margin-bottom: 14px; }

.msg-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 5px;
}

.msg-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--accent-dim);
  border: 1px solid rgba(56,189,248,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  flex-shrink: 0;
}

.msg-sender { font-size: 13px; font-weight: 600; color: var(--text); }
.msg-time { font-size: 11px; color: var(--text-3); }

.msg-bubble {
  font-size: 13px;
  color: var(--text-2);
  padding: 8px 12px;
  background: var(--surface-2);
  border-radius: 0 10px 10px 10px;
  display: inline-block;
  max-width: 70%;
  line-height: 1.5;
}

.msg-bubble.mine {
  background: var(--accent-dim);
  color: var(--text);
  border-radius: 10px 0 10px 10px;
  border: 1px solid rgba(56,189,248,0.2);
}

.message-mine {
  align-items: flex-end;
}

.message-mine .msg-header { flex-direction: row-reverse; }
.message-mine .msg-sender { display: none; }

.chat-input-area {
  padding: 12px 20px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.chat-input-area .form-input {
  flex: 1;
  resize: none;
  background: var(--surface-2);
}

/* ── Bottom Nav (mobile) ── */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: 60px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  z-index: 200;
  padding: 0 4px;
  safe-area-inset-bottom: env(safe-area-inset-bottom);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.bottom-nav-inner {
  display: flex;
  height: 60px;
  align-items: stretch;
}

.bnav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  text-decoration: none;
  color: var(--text-3);
  font-size: 10px;
  font-weight: 500;
  transition: color 0.12s;
  position: relative;
  cursor: pointer;
}

.bnav-item svg {
  width: 22px; height: 22px;
  stroke: currentColor; fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.bnav-item.active { color: var(--accent); }

.bnav-item.active::before {
  content: '';
  position: absolute;
  top: 0; left: 20%; right: 20%;
  height: 2px;
  background: var(--accent);
  border-radius: 0 0 4px 4px;
}

.bnav-badge {
  position: absolute;
  top: 6px; right: calc(50% - 18px);
  background: var(--danger);
  color: white;
  font-size: 9px;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 999px;
  min-width: 15px;
  text-align: center;
  line-height: 1.5;
}

/* ── Responsive ── */
@media (max-width: 900px) {
  .grid-cols { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .sidebar { display: none; }
  .main { margin-left: 0; padding-bottom: 60px; }
  .bottom-nav { display: block; }
  .content { padding: 16px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .messages-layout { margin: -16px; height: calc(100vh - 58px - 60px); }
  .channel-list { width: 220px; }
  .topbar { padding: 0 16px; }
}
