/* MD Chatroom — Material Design 1 (2014) styling.
 * Faithful to the 2014 spec: Roboto, paper elevation via z-depth shadows,
 * 4px baseline grid, ripples, FABs, snackbars, tabs with ink bar slide,
 * cards, list avatars, sliders, checkboxes/radios rebuilt without native UI. */

:root {
  --indigo-500: #3F51B5;
  --indigo-700: #303F9F;
  --indigo-100: #C5CAE9;
  --pink-500: #E91E63;
  --pink-A200: #FF4081;
  --teal-500: #009688;
  --amber-500: #FFC107;
  --orange-700: #F57C00;
  --red-500: #F44336;
  --red-700: #D32F2F;
  --green-500: #4CAF50;
  --green-700: #388E3C;
  --blue-500: #2196F3;
  --blue-700: #1976D2;
  --purple-500: #9C27B0;
  --cyan-500: #00BCD4;
  --lime-500: #CDDC39;

  --text-primary: rgba(0,0,0,.87);
  --text-secondary: rgba(0,0,0,.54);
  --text-disabled: rgba(0,0,0,.38);
  --text-hint: rgba(0,0,0,.38);
  --divider: rgba(0,0,0,.12);

  --bg: #FAFAFA;
  --bg-card: #FFFFFF;
  --bg-elevated: #FFFFFF;
  --bg-hover: rgba(0,0,0,.04);
  --bg-selected: rgba(63,81,181,.12);
  --bg-pressed: rgba(0,0,0,.08);

  --z1: 0 1px 3px 0 rgba(0,0,0,.12), 0 1px 2px 0 rgba(0,0,0,.24);
  --z2: 0 3px 6px rgba(0,0,0,.16), 0 3px 6px rgba(0,0,0,.23);
  --z3: 0 10px 20px rgba(0,0,0,.15), 0 6px 6px rgba(0,0,0,.18);
  --z4: 0 14px 28px rgba(0,0,0,.22), 0 10px 10px rgba(0,0,0,.18);
  --z5: 0 19px 38px rgba(0,0,0,.24), 0 15px 12px rgba(0,0,0,.18);

  --radius: 4px;
  --radius-lg: 8px;
  --ease: cubic-bezier(.4,0,.2,1);
  --ease-accel: cubic-bezier(.55,.085,.68,.53);
  --ease-decel: cubic-bezier(.23,1,.32,1);
  --ease-sharp: cubic-bezier(.4,0,.6,1);
  --appbar-h: 56px;
  --sidebar-w: 280px;
  --tab-h: 48px;
  --font: 'Roboto', 'Helvetica Neue', 'PingFang SC', 'Microsoft YaHei', Arial, sans-serif;
  --mono: 'Roboto Mono', 'SF Mono', Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --text-primary: rgba(255,255,255,.92);
    --text-secondary: rgba(255,255,255,.60);
    --text-disabled: rgba(255,255,255,.40);
    --text-hint: rgba(255,255,255,.40);
    --divider: rgba(255,255,255,.12);
    --bg: #1A1A1A;
    --bg-card: #242424;
    --bg-elevated: #2E2E2E;
    --bg-hover: rgba(255,255,255,.06);
    --bg-selected: rgba(63,81,181,.30);
    --bg-pressed: rgba(255,255,255,.10);
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.4;
  color: var(--text-primary);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
  text-rendering: optimizeLegibility;
}
button { font-family: inherit; }
a { color: var(--blue-700); text-decoration: none; }
input, textarea, select { font-family: inherit; font-size: 14px; color: inherit; }
img { max-width: 100%; display: block; }

/* ===== Boot screen ===== */
.boot-screen {
  position: fixed; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: var(--indigo-500);
  z-index: 9999;
  transition: opacity .4s var(--ease);
}
.boot-screen.fade-out { opacity: 0; pointer-events: none; }
.boot-logo {
  position: relative; width: 96px; height: 96px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 24px;
}
.boot-logo-circle {
  width: 64px; height: 64px; border-radius: 50%;
  background: #fff;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--z3);
  animation: boot-pop .6s var(--ease-decel);
}
.boot-logo-inner {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--indigo-500);
  animation: boot-pulse 1.4s var(--ease) infinite;
}
.boot-ripple {
  position: absolute; inset: 0; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.5);
  animation: boot-ripple 2s var(--ease) infinite;
}
.boot-ripple-2 { animation-delay: 1s; }
.boot-title {
  color: #fff; font-size: 22px; font-weight: 500; letter-spacing: .5px;
  margin-bottom: 32px;
  animation: boot-fade-up .6s .2s var(--ease-decel) backwards;
}
.boot-progress {
  width: 180px; height: 3px; background: rgba(255,255,255,.25); border-radius: 2px; overflow: hidden;
}
.boot-progress-bar {
  height: 100%; width: 30%; background: #fff; border-radius: 2px;
  animation: boot-progress 1.4s var(--ease) infinite;
}
.boot-sub {
  color: rgba(255,255,255,.7); font-size: 12px; margin-top: 16px;
  animation: boot-fade-up .6s .4s var(--ease-decel) backwards;
}
@keyframes boot-pop { 0% { transform: scale(0); } 60% { transform: scale(1.1); } 100% { transform: scale(1); } }
@keyframes boot-pulse { 0%,100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.4); opacity: .6; } }
@keyframes boot-ripple { 0% { transform: scale(1); opacity: .6; } 100% { transform: scale(1.8); opacity: 0; } }
@keyframes boot-progress { 0% { transform: translateX(-100%); } 100% { transform: translateX(400%); } }
@keyframes boot-fade-up { 0% { opacity: 0; transform: translateY(8px); } 100% { opacity: 1; transform: translateY(0); } }

/* ===== App layout ===== */
.app-shell {
  display: flex; flex-direction: column; height: 100vh; height: 100dvh;
  background: var(--bg);
}
.app-bar {
  height: var(--appbar-h);
  background: var(--indigo-500);
  color: #fff;
  display: flex; align-items: center;
  padding: 0 4px 0 4px;
  box-shadow: var(--z1);
  position: relative; z-index: 30;
  transition: box-shadow .2s var(--ease);
}
.app-bar.scrolled { box-shadow: var(--z2); }
.app-bar-nav { width: 56px; height: 56px; display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.app-bar-title { font-size: 18px; font-weight: 500; flex: 1 1 auto; padding: 0 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-bar-actions { display: flex; align-items: center; gap: 0; flex: 0 0 auto; }

.icon-button {
  width: 40px; height: 40px; border: none; background: transparent; color: inherit;
  border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; position: relative; overflow: hidden;
  transition: background .2s var(--ease);
  padding: 0;
}
.icon-button:hover { background: rgba(255,255,255,.15); }
.app-bar .icon-button { color: #fff; }
.icon-button .material-icons { font-size: 24px; }
.icon-button.sm { width: 32px; height: 32px; }
.icon-button.sm .material-icons { font-size: 20px; }
.icon-button.lg { width: 48px; height: 48px; }

.body-area {
  flex: 1 1 auto; display: flex; min-height: 0; position: relative;
}

/* ===== Sidebar / Nav drawer ===== */
.nav-drawer {
  width: var(--sidebar-w);
  background: var(--bg-card);
  flex: 0 0 auto;
  display: flex; flex-direction: column;
  border-right: 1px solid var(--divider);
  overflow: hidden;
  transition: transform .3s var(--ease-decel), width .3s var(--ease);
  position: relative; z-index: 20;
}
.nav-drawer-header {
  height: 168px;
  background: linear-gradient(135deg, var(--indigo-500), var(--indigo-700));
  color: #fff;
  padding: 16px;
  display: flex; flex-direction: column; justify-content: flex-end;
  position: relative; overflow: hidden;
}
.nav-drawer-header::after {
  content: ''; position: absolute; right: -30px; top: -30px;
  width: 140px; height: 140px; border-radius: 50%;
  background: rgba(255,255,255,.08);
}
.nav-drawer-header .ndh-avatar {
  width: 56px; height: 56px; border-radius: 50%;
  background: rgba(255,255,255,.25);
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; font-weight: 500; color: #fff;
  margin-bottom: 12px; overflow: hidden;
  border: 2px solid rgba(255,255,255,.3);
  position: relative; z-index: 1;
}
.nav-drawer-header .ndh-avatar img { width: 100%; height: 100%; object-fit: cover; }
.nav-drawer-header .ndh-name { font-size: 15px; font-weight: 500; position: relative; z-index: 1; }
.nav-drawer-header .ndh-email { font-size: 12px; opacity: .8; margin-top: 2px; position: relative; z-index: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.nav-list { flex: 1 1 auto; overflow-y: auto; padding: 8px 0; }
.nav-section-label { font-size: 12px; font-weight: 500; color: var(--text-secondary); padding: 12px 16px 4px; text-transform: none; letter-spacing: .2px; }
.nav-item {
  display: flex; align-items: center; gap: 16px;
  padding: 0 16px; height: 48px;
  cursor: pointer; position: relative; overflow: hidden;
  color: var(--text-primary);
  transition: background .15s var(--ease);
  font-size: 14px; font-weight: 500;
  user-select: none;
}
.nav-item:hover { background: var(--bg-hover); }
.nav-item.active { background: var(--bg-selected); color: var(--indigo-500); }
.nav-item.active::before {
  content: ''; position: absolute; left: 0; top: 8px; bottom: 8px; width: 4px;
  background: var(--indigo-500); border-radius: 0 2px 2px 0;
}
.nav-item .material-icons { font-size: 22px; color: var(--text-secondary); flex: 0 0 auto; }
.nav-item.active .material-icons { color: var(--indigo-500); }
.nav-item .nav-label { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-item .nav-badge {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
  background: var(--pink-500); color: #fff; font-size: 11px; font-weight: 500;
  display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto;
}
.nav-item .nav-badge.zero { display: none; }

.nav-drawer-footer { padding: 8px; border-top: 1px solid var(--divider); }

/* Mobile drawer */
.scrim {
  position: fixed; inset: 0; background: rgba(0,0,0,.4);
  z-index: 25; opacity: 0; pointer-events: none;
  transition: opacity .3s var(--ease);
}
.scrim.visible { opacity: 1; pointer-events: auto; }
@media (max-width: 840px) {
  .nav-drawer {
    position: fixed; top: 0; bottom: 0; left: 0; z-index: 30;
    transform: translateX(-100%);
    box-shadow: var(--z3);
  }
  .nav-drawer.open { transform: translateX(0); }
}

/* ===== Main content ===== */
.content {
  flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column;
  position: relative; overflow: hidden;
}
.page {
  flex: 1 1 auto; overflow-y: auto; overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding: 16px;
  animation: page-enter .35s var(--ease-decel);
}
.page.narrow { max-width: 720px; margin: 0 auto; width: 100%; }
.page.wide { max-width: 1280px; margin: 0 auto; width: 100%; }
@keyframes page-enter {
  0% { opacity: 0; transform: translateY(12px); }
  100% { opacity: 1; transform: translateY(0); }
}
.page-exit { animation: page-exit .12s var(--ease-accel) forwards; }
@keyframes page-exit {
  0% { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(-4px); }
}

/* ===== Cards ===== */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--z1);
  overflow: hidden;
  transition: box-shadow .25s var(--ease), transform .25s var(--ease);
  position: relative;
}
.card.hoverable:hover { box-shadow: var(--z3); transform: translateY(-2px); }
.card.clickable { cursor: pointer; }
.card-header { padding: 16px; display: flex; align-items: center; gap: 12px; }
.card-title { font-size: 16px; font-weight: 500; flex: 1 1 auto; }
.card-subtitle { font-size: 13px; color: var(--text-secondary); }
.card-content { padding: 0 16px 16px; }
.card-actions { padding: 8px; display: flex; gap: 4px; justify-content: flex-end; border-top: 1px solid var(--divider); }

/* ===== Grid layouts ===== */
.grid { display: grid; gap: 16px; }
.grid.rooms { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.grid.users { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.grid.cards-2 { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.grid.stats { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }

/* ===== Room card ===== */
.room-card {
  display: flex; flex-direction: column;
  padding: 16px; cursor: pointer;
  position: relative; overflow: hidden;
  animation: card-in .4s var(--ease-decel) backwards;
}
@keyframes card-in { 0% { opacity: 0; transform: scale(.96) translateY(8px); } 100% { opacity: 1; transform: scale(1) translateY(0); } }
.room-card .room-icon {
  width: 56px; height: 56px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 24px; font-weight: 500; flex: 0 0 auto;
  margin-bottom: 12px;
  box-shadow: var(--z1);
  position: relative;
}
.room-card .room-icon .material-icons { font-size: 28px; }
.room-card .room-name { font-size: 16px; font-weight: 500; margin-bottom: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.room-card .room-desc { font-size: 13px; color: var(--text-secondary); line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 38px; }
.room-card .room-meta { display: flex; align-items: center; gap: 12px; margin-top: 12px; font-size: 12px; color: var(--text-secondary); }
.room-card .room-meta .chip { display: inline-flex; align-items: center; gap: 4px; }
.room-card .room-type-badge {
  position: absolute; top: 12px; right: 12px;
  padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 500;
}
.room-type-badge.public { background: rgba(76,175,80,.12); color: var(--green-700); }
.room-type-badge.private { background: rgba(255,152,0,.12); color: var(--orange-700); }
.room-type-badge.password { background: rgba(244,67,54,.12); color: var(--red-700); }

/* ===== Tabs ===== */
.tabs-bar {
  display: flex; background: var(--bg-card);
  border-bottom: 1px solid var(--divider);
  position: relative; overflow-x: auto; overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  flex: 0 0 auto;
}
.tabs-bar::-webkit-scrollbar { display: none; }
.tab {
  flex: 1 0 auto; min-width: 72px; max-width: 264px;
  height: var(--tab-h); padding: 0 12px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; position: relative; overflow: hidden;
  font-size: 14px; font-weight: 500; color: var(--text-secondary);
  text-transform: none; letter-spacing: .2px;
  transition: color .2s var(--ease);
  white-space: nowrap; gap: 8px;
  user-select: none;
}
.tab:hover { color: var(--text-primary); }
.tab.active { color: var(--indigo-500); }
.tab .material-icons { font-size: 20px; }
.tab .tab-count {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: rgba(0,0,0,.1); color: var(--text-secondary);
  font-size: 11px; font-weight: 500;
  display: inline-flex; align-items: center; justify-content: center;
}
.tab.active .tab-count { background: var(--indigo-100); color: var(--indigo-700); }
.tabs-ink {
  position: absolute; bottom: 0; height: 2px;
  background: var(--indigo-500);
  transition: left .3s var(--ease-decel), width .3s var(--ease-decel);
  border-radius: 1px;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 36px; padding: 0 16px;
  border: none; border-radius: var(--radius);
  background: transparent; color: var(--text-primary);
  font-size: 14px; font-weight: 500; letter-spacing: .3px;
  cursor: pointer; position: relative; overflow: hidden;
  text-transform: none;
  transition: background .2s var(--ease), box-shadow .2s var(--ease), transform .12s var(--ease);
  user-select: none;
}
.btn:hover { background: var(--bg-hover); }
.btn:active { background: var(--bg-pressed); }
.btn:disabled { color: var(--text-disabled); cursor: not-allowed; pointer-events: none; }
.btn-raised {
  background: var(--indigo-500); color: #fff;
  box-shadow: var(--z1);
}
.btn-raised:hover { background: var(--indigo-700); box-shadow: var(--z2); }
.btn-raised:active { box-shadow: var(--z1); transform: translateY(1px); }
.btn-accent { background: var(--pink-A200); color: #fff; box-shadow: var(--z1); }
.btn-accent:hover { background: var(--pink-500); box-shadow: var(--z2); }
.btn-flat { color: var(--indigo-500); }
.btn-flat:hover { background: rgba(63,81,181,.08); }
.btn-danger { background: var(--red-500); color: #fff; box-shadow: var(--z1); }
.btn-danger:hover { background: var(--red-700); }
.btn-outline { border: 1px solid var(--divider); background: transparent; }
.btn-block { display: flex; width: 100%; }
.btn .material-icons { font-size: 18px; }
.btn.loading { pointer-events: none; color: transparent !important; }
.btn.loading::after {
  content: ''; position: absolute; width: 18px; height: 18px;
  border: 2px solid currentColor; border-top-color: transparent;
  border-radius: 50%; color: #fff; opacity: .9;
  animation: spin .8s linear infinite;
}
.btn-raised.loading::after, .btn-accent.loading::after, .btn-danger.loading::after { color: #fff; }
.btn-flat.loading::after, .btn-outline.loading::after { color: var(--indigo-500); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== FAB ===== */
.fab {
  position: fixed; right: 24px; bottom: 24px;
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--pink-A200); color: #fff;
  border: none; cursor: pointer;
  box-shadow: var(--z2);
  display: inline-flex; align-items: center; justify-content: center;
  z-index: 15;
  transition: box-shadow .2s var(--ease), transform .2s var(--ease), background .2s var(--ease);
}
.fab:hover { background: var(--pink-500); box-shadow: var(--z3); transform: scale(1.05); }
.fab:active { box-shadow: var(--z1); transform: scale(.98); }
.fab .material-icons { font-size: 24px; }
.fab.extended { width: auto; padding: 0 20px; border-radius: 28px; gap: 8px; font-weight: 500; }
.fab.mini { width: 40px; height: 40px; }
.fab.mini .material-icons { font-size: 20px; }

/* ===== Inputs ===== */
.field { display: block; margin-bottom: 20px; position: relative; }
.field-label {
  display: block; font-size: 12px; color: var(--text-secondary);
  margin-bottom: 4px; padding-left: 4px;
}
.input, .textarea, .select {
  width: 100%; padding: 12px 14px;
  font-size: 15px; font-family: inherit;
  background: var(--bg-card);
  border: 1px solid var(--divider); border-radius: var(--radius);
  color: var(--text-primary);
  transition: border-color .25s var(--ease), box-shadow .25s var(--ease), background .25s var(--ease);
  outline: none;
  -webkit-appearance: none; appearance: none;
}
.input:hover, .textarea:hover, .select:hover {
  border-color: var(--text-secondary);
}
.input:focus, .textarea:focus, .select:focus {
  border-color: var(--indigo-500);
  box-shadow: 0 0 0 3px rgba(63,81,181,.14);
  background: #fff;
}
.textarea { resize: vertical; min-height: 80px; line-height: 1.5; }
.input.error, .textarea.error { border-color: var(--red-500); }
.field-error { font-size: 12px; color: var(--red-500); margin-top: 4px; padding-left: 4px; }
.field-hint { font-size: 12px; color: var(--text-hint); margin-top: 4px; padding-left: 4px; }

/* Floating label variant */
.field-floating { position: relative; }
.field-floating .input { padding-top: 18px; padding-bottom: 6px; }
.field-floating .float-label {
  position: absolute; left: 12px; top: 14px;
  color: var(--text-secondary); font-size: 14px;
  pointer-events: none; transition: all .2s var(--ease);
  background: transparent;
}
.field-floating .input:focus + .float-label,
.field-floating .input:not(:placeholder-shown) + .float-label {
  top: 4px; font-size: 11px; color: var(--indigo-500);
}

/* ===== Avatar ===== */
.avatar {
  border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 500; overflow: hidden; flex: 0 0 auto;
  position: relative; user-select: none;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.sm { width: 32px; height: 32px; font-size: 13px; }
.avatar.md { width: 40px; height: 40px; font-size: 16px; }
.avatar.lg { width: 56px; height: 56px; font-size: 22px; }
.avatar.xl { width: 96px; height: 96px; font-size: 36px; }
.avatar.presence::after {
  content: ''; position: absolute; right: 0; bottom: 0;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--text-disabled); border: 2px solid var(--bg-card);
}
.avatar.presence.online::after { background: var(--green-500); }
.avatar.presence.away::after { background: var(--amber-500); }

/* ===== List ===== */
.list { background: var(--bg-card); border-radius: var(--radius); overflow: hidden; box-shadow: var(--z1); }
.list-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; cursor: pointer; position: relative; overflow: hidden;
  transition: background .15s var(--ease);
  min-height: 56px;
}
.list-item:hover { background: var(--bg-hover); }
.list-item + .list-item { border-top: 1px solid var(--divider); }
.list-item .li-avatar { flex: 0 0 auto; }
.list-item .li-text { flex: 1 1 auto; min-width: 0; }
.list-item .li-primary { font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-item .li-secondary { font-size: 13px; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 2px; }
.list-item .li-meta { flex: 0 0 auto; font-size: 12px; color: var(--text-secondary); text-align: right; }
.list-item .li-action { flex: 0 0 auto; }

/* ===== Chat ===== */
.chat-shell { display: flex; flex-direction: column; height: 100%; background: var(--bg); }
.chat-header {
  height: 64px; background: var(--bg-card); border-bottom: 1px solid var(--divider);
  display: flex; align-items: center; gap: 12px; padding: 0 8px 0 16px;
  flex: 0 0 auto; box-shadow: var(--z1); z-index: 5;
}
.chat-header .ch-title { flex: 1 1 auto; min-width: 0; }
.chat-header .ch-name { font-size: 15px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-header .ch-sub { font-size: 12px; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.messages-area {
  flex: 1 1 auto; overflow-y: auto; padding: 16px;
  display: flex; flex-direction: column; gap: 4px;
  scroll-behavior: smooth;
  background:
    radial-gradient(circle at 20% 80%, rgba(63,81,181,.03), transparent 40%),
    radial-gradient(circle at 80% 20%, rgba(233,30,99,.02), transparent 40%),
    var(--bg);
}
.message {
  display: flex; gap: 8px; max-width: 80%;
  animation: msg-in .3s var(--ease-decel);
  align-items: flex-end;
}
@keyframes msg-in { 0% { opacity: 0; transform: translateY(8px); } 100% { opacity: 1; transform: translateY(0); } }
.message.mine { align-self: flex-end; flex-direction: row-reverse; }
.message .m-avatar { flex: 0 0 auto; align-self: flex-start; margin-top: 4px; }
.message.mine .m-avatar { display: none; }
.message .m-content { display: flex; flex-direction: column; min-width: 0; }
.message.mine .m-content { align-items: flex-end; }
.message .m-bubble {
  background: var(--bg-card); padding: 8px 12px; border-radius: 4px 12px 12px 12px;
  box-shadow: var(--z1); font-size: 14px; line-height: 1.5; word-wrap: break-word; word-break: break-word; position: relative;
  max-width: 100%;
}
.message.mine .m-bubble { background: var(--indigo-500); color: #fff; border-radius: 12px 4px 12px 12px; }
.message .m-bubble.continuation { border-radius: 4px 12px 12px 4px; margin-top: 2px; }
.message.mine .m-bubble.continuation { border-radius: 12px 4px 4px 12px; }
.message .m-meta { font-size: 11px; color: var(--text-secondary); margin-top: 4px; display: flex; gap: 8px; align-items: center; }
.message.mine .m-meta { color: var(--text-secondary); }
.message .m-meta .m-edited { font-style: italic; }
.message .m-sender { font-size: 12px; font-weight: 500; color: var(--indigo-500); margin-bottom: 2px; }
.message.system { align-self: center; max-width: 90%; }
.message.system .m-bubble { background: rgba(0,0,0,.06); color: var(--text-secondary); font-size: 12px; padding: 4px 12px; border-radius: 12px; box-shadow: none; }
.message .m-attachments { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 4px; }
.message .m-attachment-img { width: 220px; max-width: 100%; height: auto; border-radius: 4px; cursor: pointer; transition: transform .2s var(--ease); }
.message .m-attachment-img:hover { transform: scale(1.02); }
.message .m-attachment-file { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; background: rgba(0,0,0,.04); border-radius: 4px; font-size: 13px; }
.message.mine .m-attachment-file { background: rgba(255,255,255,.15); color: #fff; }
.message .m-attachment-file .material-icons { font-size: 20px; }
.message .m-reactions { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; }
.message .m-reaction {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 12px; font-size: 12px;
  background: rgba(0,0,0,.06); cursor: pointer;
  transition: background .15s var(--ease), transform .15s var(--ease);
}
.message .m-reaction:hover { background: rgba(0,0,0,.1); transform: scale(1.05); }
.message .m-reaction.mine { background: var(--indigo-100); color: var(--indigo-700); }
.message .m-reply-quote { border-left: 3px solid var(--indigo-500); padding-left: 8px; margin-bottom: 4px; font-size: 12px; opacity: .8; }
.message.mine .m-reply-quote { border-left-color: rgba(255,255,255,.5); }
.message .m-actions {
  position: absolute; top: -12px; right: -8px;
  display: flex; gap: 2px; opacity: 0; transition: opacity .2s var(--ease);
  background: var(--bg-card); border-radius: 16px; padding: 2px; box-shadow: var(--z1);
}
.message:hover .m-actions { opacity: 1; }
.message.mine .m-actions { right: auto; left: -8px; }
.message .m-actions .icon-button { width: 28px; height: 28px; }
.message .m-actions .icon-button .material-icons { font-size: 16px; color: var(--text-secondary); }

.typing-indicator {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 8px 12px; background: var(--bg-card); border-radius: 12px;
  box-shadow: var(--z1); font-size: 12px; color: var(--text-secondary);
  align-self: flex-start; margin-top: 4px;
}
.typing-indicator .dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--text-secondary);
  animation: typing-bounce 1.2s var(--ease) infinite;
}
.typing-indicator .dot:nth-child(2) { animation-delay: .15s; }
.typing-indicator .dot:nth-child(3) { animation-delay: .3s; }
@keyframes typing-bounce { 0%,60%,100% { transform: translateY(0); opacity: .4; } 30% { transform: translateY(-4px); opacity: 1; } }

.message-day-divider {
  align-self: center; font-size: 11px; color: var(--text-secondary);
  background: rgba(0,0,0,.06); padding: 2px 12px; border-radius: 12px; margin: 12px 0;
}

.composer {
  flex: 0 0 auto; background: var(--bg-card); border-top: 1px solid var(--divider);
  padding: 8px; display: flex; align-items: flex-end; gap: 4px;
  box-shadow: 0 -1px 4px rgba(0,0,0,.06); z-index: 5;
}
.composer .composer-input {
  flex: 1 1 auto; min-height: 40px; max-height: 160px;
  padding: 10px 12px; border: 1px solid var(--divider); border-radius: 20px;
  background: var(--bg); color: var(--text-primary);
  resize: none; outline: none; line-height: 1.4;
  transition: border-color .2s var(--ease);
  overflow-y: auto;
}
.composer .composer-input:focus { border-color: var(--indigo-500); }
.composer .composer-input[contenteditable] { white-space: pre-wrap; word-break: break-word; }
.composer .composer-send {
  width: 40px; height: 40px; border-radius: 50%; border: none;
  background: var(--indigo-500); color: #fff; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  flex: 0 0 auto; transition: background .2s var(--ease), transform .12s var(--ease);
}
.composer .composer-send:hover { background: var(--indigo-700); }
.composer .composer-send:active { transform: scale(.94); }
.composer .composer-send:disabled { background: var(--text-disabled); cursor: not-allowed; }
.composer .composer-send .material-icons { font-size: 20px; }
.composer .composer-reply {
  display: flex; align-items: center; gap: 8px; padding: 4px 12px;
  background: var(--bg-selected); border-radius: 4px; margin-bottom: 4px; font-size: 12px;
  width: 100%;
}
.composer .composer-reply .cr-close { margin-left: auto; }

.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 48px 24px; text-align: center; color: var(--text-secondary);
  animation: fade-in .4s var(--ease-decel);
}
.empty-state .material-icons { font-size: 64px; opacity: .3; margin-bottom: 16px; }
.empty-state .es-title { font-size: 16px; font-weight: 500; color: var(--text-primary); margin-bottom: 4px; }
.empty-state .es-sub { font-size: 13px; max-width: 360px; line-height: 1.5; }
@keyframes fade-in { 0% { opacity: 0; } 100% { opacity: 1; } }

/* ===== Chips ===== */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 16px;
  background: rgba(0,0,0,.06); color: var(--text-primary);
  font-size: 13px; cursor: pointer; user-select: none;
  transition: background .15s var(--ease);
}
.chip:hover { background: rgba(0,0,0,.1); }
.chip.active { background: var(--indigo-500); color: #fff; }
.chip .material-icons { font-size: 16px; }
.chip-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* ===== Switch ===== */
.switch {
  position: relative; display: inline-block; width: 36px; height: 24px;
  cursor: pointer; flex: 0 0 auto;
}
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch .track {
  position: absolute; inset: 0; border-radius: 12px;
  background: rgba(0,0,0,.26); transition: background .2s var(--ease);
}
.switch .thumb {
  position: absolute; top: 2px; left: 2px; width: 20px; height: 20px;
  border-radius: 50%; background: #fff; box-shadow: var(--z1);
  transition: transform .2s var(--ease);
}
.switch input:checked + .track { background: rgba(63,81,181,.5); }
.switch input:checked + .track .thumb { transform: translateX(12px); background: var(--indigo-500); }

/* ===== Checkbox ===== */
.checkbox {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none;
}
.checkbox input { display: none; }
.checkbox .cb-box {
  width: 18px; height: 18px; border: 2px solid var(--text-secondary);
  border-radius: 2px; display: inline-flex; align-items: center; justify-content: center;
  transition: all .15s var(--ease); flex: 0 0 auto;
}
.checkbox input:checked + .cb-box { background: var(--indigo-500); border-color: var(--indigo-500); }
.checkbox input:checked + .cb-box::after {
  content: ''; width: 5px; height: 9px; border: solid #fff; border-width: 0 2px 2px 0;
  transform: rotate(45deg) translate(-1px, -1px);
}

/* ===== Radio ===== */
.radio { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.radio input { display: none; }
.radio .r-box {
  width: 18px; height: 18px; border: 2px solid var(--text-secondary);
  border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  transition: border-color .15s var(--ease); flex: 0 0 auto;
}
.radio input:checked + .r-box { border-color: var(--indigo-500); }
.radio input:checked + .r-box::after {
  content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--indigo-500);
}

/* ===== Slider ===== */
.slider { position: relative; height: 36px; display: flex; align-items: center; }
.slider input[type=range] {
  -webkit-appearance: none; appearance: none; width: 100%; height: 4px;
  background: rgba(0,0,0,.26); border-radius: 2px; outline: none; margin: 0;
}
.slider input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 20px; height: 20px; border-radius: 50%;
  background: var(--indigo-500); cursor: pointer; border: none; box-shadow: var(--z1);
}
.slider input[type=range]::-moz-range-thumb {
  width: 20px; height: 20px; border-radius: 50%; background: var(--indigo-500);
  cursor: pointer; border: none;
}

/* ===== Ripple ===== */
.ripple-container { position: relative; overflow: hidden; }
.ripple {
  position: absolute; border-radius: 50%; transform: scale(0);
  background: rgba(255,255,255,.3); pointer-events: none;
  animation: ripple-anim .6s var(--ease);
}
.ripple.dark { background: rgba(0,0,0,.1); }
@keyframes ripple-anim { to { transform: scale(4); opacity: 0; } }

/* ===== Toast / Snackbar ===== */
.toast-root {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: center;
  pointer-events: none; width: 100%; max-width: 560px; padding: 0 16px;
}
.toast {
  background: #323232; color: #fff; padding: 14px 16px; border-radius: var(--radius);
  box-shadow: var(--z3); font-size: 14px; min-width: 280px; max-width: 100%;
  display: flex; align-items: center; gap: 12px; pointer-events: auto;
  animation: toast-in .3s var(--ease-decel);
}
.toast.exit { animation: toast-out .25s var(--ease-accel) forwards; }
.toast .t-action { color: var(--pink-A200); cursor: pointer; font-weight: 500; text-transform: none; flex: 0 0 auto; }
.toast .t-close { color: rgba(255,255,255,.6); cursor: pointer; flex: 0 0 auto; }
@keyframes toast-in { 0% { opacity: 0; transform: translateY(40px); } 100% { opacity: 1; transform: translateY(0); } }
@keyframes toast-out { 0% { opacity: 1; } 100% { opacity: 0; transform: translateY(20px); } }

/* ===== Modal / Dialog ===== */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.5);
  z-index: 80; display: flex; align-items: center; justify-content: center;
  padding: 16px; opacity: 0; transition: opacity .25s var(--ease);
  pointer-events: none;
}
.modal-backdrop.visible { opacity: 1; pointer-events: auto; }
.modal {
  background: var(--bg-card); border-radius: var(--radius-lg);
  box-shadow: var(--z4); width: 100%; max-width: 560px; max-height: 90vh;
  display: flex; flex-direction: column; overflow: hidden;
  transform: scale(.9); opacity: 0;
  transition: transform .25s var(--ease-decel), opacity .25s var(--ease);
}
.modal-backdrop.visible .modal { transform: scale(1); opacity: 1; }
.modal.lg { max-width: 800px; }
.modal.sm { max-width: 360px; }
.modal-header { padding: 20px 24px 8px; font-size: 18px; font-weight: 500; display: flex; align-items: center; gap: 12px; }
.modal-header .material-icons { color: var(--text-secondary); }
.modal-body { padding: 8px 24px 16px; overflow-y: auto; flex: 1 1 auto; }
.modal-footer { padding: 8px; display: flex; gap: 4px; justify-content: flex-end; border-top: 1px solid var(--divider); }

/* ===== Auth pages ===== */
.auth-wrap {
  min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 16px;
  background: linear-gradient(135deg, var(--indigo-500) 0%, var(--indigo-700) 100%);
  position: relative; overflow-y: auto;
}
.auth-wrap::before, .auth-wrap::after {
  content: ''; position: absolute; border-radius: 50%;
  background: rgba(255,255,255,.06);
}
.auth-wrap::before { width: 400px; height: 400px; top: -100px; right: -100px; }
.auth-wrap::after { width: 300px; height: 300px; bottom: -80px; left: -80px; }
.auth-card {
  background: var(--bg-card); border-radius: var(--radius-lg);
  box-shadow: var(--z4); width: 100%; max-width: 420px;
  padding: 32px 28px 24px; position: relative; z-index: 1;
  animation: auth-in .3s var(--ease-decel);
}
@keyframes auth-in { 0% { opacity: 0; transform: translateY(12px) scale(.98); } 100% { opacity: 1; transform: translateY(0) scale(1); } }
.auth-logo { display: flex; align-items: center; justify-content: center; margin-bottom: 8px; }
.auth-logo .logo-circle { width: 64px; height: 64px; border-radius: 50%; background: var(--indigo-500); color: #fff; display: flex; align-items: center; justify-content: center; box-shadow: var(--z2); }
.auth-logo .logo-circle .material-icons { font-size: 32px; }
.auth-title { text-align: center; font-size: 22px; font-weight: 500; margin-bottom: 4px; }
.auth-subtitle { text-align: center; font-size: 13px; color: var(--text-secondary); margin-bottom: 24px; }
.auth-tabs { display: flex; margin-bottom: 20px; border-bottom: 1px solid var(--divider); position: relative; }
.auth-tab { flex: 1; padding: 12px; text-align: center; cursor: pointer; font-weight: 500; color: var(--text-secondary); transition: color .2s var(--ease); position: relative; overflow: hidden; }
.auth-tab.active { color: var(--indigo-500); }
.auth-ink { position: absolute; bottom: 0; height: 2px; background: var(--indigo-500); transition: left .3s var(--ease-decel), width .3s var(--ease-decel); }
.auth-footer { text-align: center; margin-top: 16px; font-size: 12px; color: var(--text-secondary); }
.auth-links { display: flex; justify-content: space-between; margin-top: 12px; font-size: 13px; }
.auth-links a { color: var(--indigo-500); cursor: pointer; }
.pw-strength { display: flex; gap: 2px; height: 3px; margin-top: 6px; }
.pw-strength .seg { flex: 1; background: rgba(0,0,0,.1); border-radius: 1px; transition: background .2s var(--ease); }
.pw-strength .seg.s0 { background: var(--red-500); }
.pw-strength .seg.s1 { background: var(--orange-700); }
.pw-strength .seg.s2 { background: var(--amber-500); }
.pw-strength .seg.s3 { background: var(--green-500); }

/* ===== Profile page ===== */
.profile-header {
  background: var(--bg-card); border-radius: var(--radius); box-shadow: var(--z1);
  overflow: hidden; margin-bottom: 16px;
}
.profile-banner { height: 120px; background: linear-gradient(135deg, var(--indigo-500), var(--purple-500)); position: relative; }
.profile-banner .pb-edit { position: absolute; top: 12px; right: 12px; }
.profile-body { padding: 0 24px 24px; margin-top: -48px; position: relative; }
.profile-avatar-wrap { position: relative; display: inline-block; margin-bottom: 12px; }
.profile-avatar-wrap .avatar { border: 4px solid var(--bg-card); box-shadow: var(--z1); }
.profile-avatar-wrap .pa-edit { position: absolute; right: -4px; bottom: 4px; }
.profile-name { font-size: 22px; font-weight: 500; }
.profile-handle { font-size: 14px; color: var(--text-secondary); }
.profile-bio { margin-top: 12px; font-size: 14px; line-height: 1.6; color: var(--text-primary); }
.profile-stats { display: flex; gap: 24px; margin-top: 16px; }
.profile-stat .ps-num { font-size: 20px; font-weight: 500; }
.profile-stat .ps-label { font-size: 12px; color: var(--text-secondary); }

/* ===== Loading skeletons ===== */
.skeleton { background: rgba(0,0,0,.06); border-radius: var(--radius); position: relative; overflow: hidden; }
.skeleton::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(0,0,0,.04), transparent);
  animation: skeleton 1.4s var(--ease) infinite;
}
@keyframes skeleton { 0% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }
.skeleton-line { height: 14px; margin-bottom: 8px; border-radius: 2px; }
.skeleton-line.short { width: 60%; }
.skeleton-card { height: 180px; }

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,.2); border-radius: 5px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,.35); }

/* ===== Progress bar ===== */
.progress-linear {
  position: relative; height: 3px; background: rgba(63,81,181,.2); overflow: hidden; border-radius: 2px;
}
.progress-linear .pl-bar {
  position: absolute; top: 0; left: 0; height: 100%; background: var(--indigo-500);
  border-radius: 2px; transition: width .3s var(--ease);
}
.progress-linear.indeterminate .pl-bar {
  width: 30%; animation: indeterminate 1.6s var(--ease) infinite;
}
@keyframes indeterminate { 0% { left: -30%; } 100% { left: 100%; } }

/* ===== Banner / Announcement ===== */
.banner {
  background: var(--amber-500); color: #212121;
  padding: 12px 16px; display: flex; align-items: center; gap: 12px;
  font-size: 13px; box-shadow: var(--z1);
  animation: banner-slide .4s var(--ease-decel);
}
@keyframes banner-slide { 0% { transform: translateY(-100%); } 100% { transform: translateY(0); } }
.banner .b-close { margin-left: auto; cursor: pointer; }

/* ===== Search bar ===== */
.search-bar {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-card); border-radius: var(--radius); box-shadow: var(--z1);
  padding: 4px 8px 4px 12px; height: 44px; flex: 1 1 auto;
}
.search-bar .material-icons { color: var(--text-secondary); }
.search-bar input {
  border: none; outline: none; background: transparent; flex: 1 1 auto;
  font-size: 14px; color: var(--text-primary);
}
.search-bar .sb-clear { cursor: pointer; }

/* ===== Badge / Pill ===== */
.pill {
  display: inline-flex; align-items: center; padding: 2px 8px;
  border-radius: 10px; font-size: 11px; font-weight: 500;
}
.pill.green { background: rgba(76,175,80,.15); color: var(--green-700); }
.pill.red { background: rgba(244,67,54,.15); color: var(--red-700); }
.pill.amber { background: rgba(255,193,7,.18); color: var(--orange-700); }
.pill.blue { background: rgba(33,150,243,.15); color: var(--blue-700); }
.pill.grey { background: rgba(0,0,0,.08); color: var(--text-secondary); }

/* ===== Captcha widget ===== */
.captcha-wrap { margin: 12px 0; }
.captcha-builtin {
  display: flex; align-items: center; gap: 12px; padding: 12px;
  background: rgba(63,81,181,.05); border: 1px dashed var(--indigo-100); border-radius: var(--radius);
}
.captcha-builtin .cb-q { font-size: 18px; font-weight: 500; font-family: var(--mono); color: var(--indigo-700); }
.captcha-builtin .cb-input { width: 80px; text-align: center; font-size: 18px; }

/* ===== Responsive ===== */
.app-bar .menu-toggle { display: none; }
@media (max-width: 840px) {
  .app-bar .menu-toggle { display: inline-flex; }
  .page { padding: 12px; }
  .grid.rooms { grid-template-columns: 1fr; }
  .grid.users { grid-template-columns: 1fr; }
  .fab { right: 16px; bottom: 16px; }
  .message { max-width: 92%; }
  .modal { max-width: 100%; }
  .profile-stats { flex-wrap: wrap; gap: 16px; }
  .chat-header { height: 56px; }
}

@media (max-width: 480px) {
  .auth-card { padding: 24px 20px; }
  .grid { grid-template-columns: 1fr; }
  .modal-body { padding: 8px 16px; }
  .modal-header { padding: 16px 16px 8px; font-size: 16px; }
}

/* ===== Utility ===== */
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-secondary { color: var(--text-secondary); }
.text-sm { font-size: 12px; }
.text-lg { font-size: 18px; }
.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; } .mb-16 { margin-bottom: 16px; } .mb-24 { margin-bottom: 24px; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; }
.flex-1 { flex: 1 1 auto; }
.w-full { width: 100%; }
.relative { position: relative; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mono { font-family: var(--mono); }
.divider { height: 1px; background: var(--divider); margin: 16px 0; }
.row { display: flex; align-items: center; gap: 12px; }
.spacer { flex: 1 1 auto; }

/* ===== Image viewer ===== */
.image-viewer {
  position: fixed; inset: 0; background: rgba(0,0,0,.92); z-index: 200;
  display: flex; align-items: center; justify-content: center; padding: 24px;
  animation: fade-in .2s var(--ease);
}
.image-viewer img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: var(--radius); animation: img-zoom .3s var(--ease-decel); }
.image-viewer .iv-close { position: absolute; top: 16px; right: 16px; color: #fff; cursor: pointer; }
@keyframes img-zoom { 0% { transform: scale(.85); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }

/* ===== Tooltip ===== */
[data-tooltip] { position: relative; }
[data-tooltip]:hover::after {
  content: attr(data-tooltip); position: absolute; bottom: calc(100% + 6px); left: 50%;
  transform: translateX(-50%); background: #323232; color: #fff; padding: 4px 8px;
  border-radius: 2px; font-size: 11px; white-space: nowrap; z-index: 90;
  pointer-events: none; animation: fade-in .15s var(--ease);
}

/* ===== Online dot ===== */
.online-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--green-500); }
.offline-dot { background: var(--text-disabled); }

/* ===== Drawer sub-list ===== */
.sub-list { overflow: hidden; transition: max-height .3s var(--ease); }
.sub-list.collapsed { max-height: 0 !important; }

/* ===== Dropzone ===== */
.dropzone {
  border: 2px dashed var(--divider); border-radius: var(--radius); padding: 24px;
  text-align: center; color: var(--text-secondary); cursor: pointer;
  transition: border-color .2s var(--ease), background .2s var(--ease);
}
.dropzone:hover, .dropzone.dragover { border-color: var(--indigo-500); background: rgba(63,81,181,.04); }
.dropzone .material-icons { font-size: 36px; margin-bottom: 8px; opacity: .5; }

/* ===== Settings groups ===== */
.settings-group { background: var(--bg-card); border-radius: var(--radius); box-shadow: var(--z1); overflow: hidden; margin-bottom: 16px; }
.settings-group .sg-header { padding: 16px; font-size: 14px; font-weight: 500; background: rgba(0,0,0,.02); border-bottom: 1px solid var(--divider); display: flex; align-items: center; gap: 8px; }
.settings-group .sg-header .material-icons { color: var(--text-secondary); }
.settings-row { display: flex; align-items: center; gap: 16px; padding: 16px; }
.settings-row + .settings-row { border-top: 1px solid var(--divider); }
.settings-row .sr-text { flex: 1 1 auto; }
.settings-row .sr-title { font-size: 14px; font-weight: 500; }
.settings-row .sr-sub { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }

/* ===== Notification item ===== */
.notif-item { display: flex; gap: 12px; padding: 12px 16px; cursor: pointer; position: relative; overflow: hidden; }
.notif-item + .notif-item { border-top: 1px solid var(--divider); }
.notif-item.unread { background: rgba(63,81,181,.04); }
.notif-item.unread::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--indigo-500); }
.notif-item .ni-icon { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--indigo-100); color: var(--indigo-700); flex: 0 0 auto; }

/* ===== Misc animations ===== */
.shake { animation: shake .4s var(--ease); }
@keyframes shake { 0%,100% { transform: translateX(0); } 20%,60% { transform: translateX(-6px); } 40%,80% { transform: translateX(6px); } }
.pulse { animation: pulse 2s var(--ease) infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .5; } }
.slide-up { animation: slide-up .3s var(--ease-decel); }
@keyframes slide-up { 0% { opacity: 0; transform: translateY(20px); } 100% { opacity: 1; transform: translateY(0); } }
.scale-in { animation: scale-in .25s var(--ease-decel); }
@keyframes scale-in { 0% { opacity: 0; transform: scale(.9); } 100% { opacity: 1; transform: scale(1); } }
