:root {
  --green: #1E8E3E;
  --green-dark: #188038;
  --green-tint: #E6F4EA;
  --blue: #1A73E8;
  --ink: #202124;
  --text: #202124;
  --text-soft: #5F6368;
  --text-soft-2: #3C4043;
  --surface: #FFFFFF;
  --bg: #F8F9FA;
  --bg-2: #F1F3F4;
  --line: #DADCE0;
  --line-soft: #E8EAED;
  --danger: #D93025;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --shadow-1: 0 1px 2px rgba(60,64,67,.15), 0 1px 3px rgba(60,64,67,.1);
  --shadow-2: 0 4px 8px rgba(60,64,67,.2), 0 1px 24px rgba(60,64,67,.1);
  --topbar-h: 64px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body {
  height: 100%;
  margin: 0;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
body {
  font-family: 'Roboto', 'Google Sans', Arial, -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: 'Roboto', 'Google Sans', Arial, sans-serif; margin: 0; }
button, input, textarea, select { font-family: inherit; }
.hidden { display: none !important; }
.material-symbols-outlined {
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 20;
  font-size: 20px; line-height: 1; vertical-align: middle; user-select: none;
}

/* ===================== AUTH ===================== */
.auth-screen {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 24px;
}
.auth-card {
  width: 100%;
  max-width: 380px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 40px 32px 32px;
  box-shadow: var(--shadow-1);
}
.auth-brand { display: flex; align-items: center; gap: 10px; }
.auth-brand-mark { font-size: 28px; width: 32px; height: 32px; display: inline-flex; }
.auth-brand-mark img { width: 100%; height: 100%; object-fit: contain; }
.auth-brand-name { font-family: 'Roboto', sans-serif; font-size: 24px; font-weight: 500; color: var(--text-soft-2); letter-spacing: -.2px; }
.auth-tagline { color: var(--text-soft); margin: 6px 0 24px; font-size: 14.5px; }
.auth-tabs { display: flex; gap: 4px; background: var(--bg-2); padding: 4px; border-radius: 24px; margin-bottom: 24px; }
.auth-tab {
  flex: 1; border: none; background: transparent; padding: 8px 0;
  border-radius: 20px; font-weight: 500; font-size: 13.5px; color: var(--text-soft); cursor: pointer;
}
.auth-tab.active { background: #fff; color: var(--green); box-shadow: var(--shadow-1); }
.auth-form { display: flex; flex-direction: column; gap: 16px; }
.auth-form label { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; font-weight: 500; color: var(--text-soft); }
.auth-form input {
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 11px 12px;
  font-size: 15px; color: var(--text); background: #fff;
}
.auth-form input:focus { outline: 2px solid var(--blue); outline-offset: -1px; border-color: var(--blue); }
.auth-error { color: var(--danger); font-size: 13px; margin: -6px 0 0; min-height: 1em; }

/* ===================== BUTTONS ===================== */
.btn {
  border: none; border-radius: 4px; padding: 9px 20px;
  font-weight: 500; font-size: 14px; cursor: pointer; letter-spacing: .15px;
  transition: background .12s ease, box-shadow .12s ease;
}
.btn:active { opacity: .9; }
.btn-primary { background: var(--green); color: #fff; }
.btn-primary:hover { background: var(--green-dark); box-shadow: var(--shadow-1); }
.btn-ghost { background: transparent; color: var(--green-dark); border: 1px solid var(--line); }
.btn-ghost:hover { background: var(--green-tint); border-color: var(--green); }
.btn-block { width: 100%; padding: 11px 0; margin-top: 6px; border-radius: 20px; }
.btn-small { padding: 6px 14px; font-size: 12.5px; border-radius: 16px; display: inline-flex; align-items: center; gap: 4px; }
.btn-small .material-symbols-outlined { font-size: 16px; }
.icon-btn { background: none; border: none; cursor: pointer; color: var(--text-soft); border-radius: 50%; width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center; }
.icon-btn:hover { background: var(--bg-2); }

/* ===================== TOP APP BAR ===================== */
.topbar {
  height: var(--topbar-h); flex-shrink: 0; display: flex; align-items: center; gap: 6px;
  padding: 0 8px 0 4px; background: #fff; border-bottom: 1px solid var(--line);
}
.topbar-icon-btn {
  width: 44px; height: 44px; border-radius: 50%; border: none; background: none; cursor: pointer;
  color: var(--text-soft-2); display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.topbar-icon-btn:hover { background: var(--bg-2); }
.topbar-brand { display: flex; align-items: center; gap: 10px; padding: 0 4px 0 8px; }
.topbar-brand img { width: 32px; height: 32px; border-radius: 6px; }
.topbar-brand span { font-size: 22px; color: var(--text-soft-2); font-weight: 400; letter-spacing: -.2px; display: none; }
@media (min-width: 520px) { .topbar-brand span { display: inline; } }
.topbar-spacer { flex: 1; }
.topbar-avatar {
  width: 32px; height: 32px; border-radius: 50%; margin-left: 6px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; color: #fff; font-size: 13px; font-weight: 600;
  background: var(--blue);
}

/* ===================== APP SHELL ===================== */
.app { display: flex; flex-direction: column; height: 100dvh; overflow: hidden; }
.app-body { flex: 1; display: flex; overflow: hidden; min-height: 0; }

/* --- drawer / rail --- */
.rail {
  width: 280px; flex-shrink: 0; background: #fff; border-right: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 2px;
  padding: 10px 8px; overflow-y: auto; transition: width .15s ease, padding .15s ease;
}
.rail.collapsed { width: 0; padding: 10px 0; border-right: none; overflow: hidden; }
.rail-item {
  width: 100%; min-height: 44px; border-radius: 0 24px 24px 0; border: none;
  background: transparent; color: var(--text-soft-2); font-size: 14.5px; font-weight: 500;
  display: flex; align-items: center; gap: 20px; padding: 0 20px; cursor: pointer; text-align: left;
  white-space: nowrap;
}
.rail-item .material-symbols-outlined { color: var(--text-soft); flex-shrink: 0; }
.rail-item:hover { background: var(--bg-2); }
.rail-item.active { background: var(--green-tint); color: var(--green-dark); font-weight: 700; }
.rail-item.active .material-symbols-outlined { color: var(--green-dark); }
.rail-item-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail-divider { height: 1px; background: var(--line-soft); margin: 10px 12px; }
.rail-section-label { padding: 6px 20px; font-size: 11px; font-weight: 700; letter-spacing: .06em; color: var(--text-soft); text-transform: uppercase; }
.rail-classes { display: flex; flex-direction: column; gap: 2px; }
.rail-class-item .class-avatar {
  width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 12.5px; font-weight: 700; color: #fff; flex-shrink: 0; overflow: hidden;
}
.class-avatar-img { width: 100%; height: 100%; object-fit: cover; }

/* --- home view --- */
.home-view { flex: 1; background: var(--bg); overflow-y: auto; padding: 32px 40px; }
.home-header { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 16px; margin-bottom: 28px; }
.home-header h1 { font-size: 24px; font-weight: 400; color: var(--text-soft-2); }
.home-actions { display: flex; gap: 10px; }
.class-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 24px; }
.class-card {
  background: #fff; border-radius: var(--radius-md); overflow: visible; cursor: pointer;
  box-shadow: var(--shadow-1); border: 1px solid var(--line-soft); transition: box-shadow .15s ease;
  display: flex; flex-direction: column;
}
.class-card:hover { box-shadow: var(--shadow-2); }
.class-card-banner {
  height: 100px; padding: 14px 16px; border-radius: var(--radius-md) var(--radius-md) 0 0;
  display: flex; flex-direction: column; justify-content: flex-end; color: #fff; position: relative;
  background-image: radial-gradient(circle at 100% 0%, rgba(255,255,255,.14), transparent 55%);
  overflow: hidden;
}
.class-card-banner h3 { font-family: 'Google Sans', 'Roboto', sans-serif; font-size: 20px; font-weight: 500; line-height: 1.25; padding-right: 52px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.class-card-role { font-size: 13.5px; opacity: .92; margin: 2px 0 0; padding-right: 52px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.class-card-menu {
  position: absolute; top: 6px; right: 6px; width: 36px; height: 36px; border-radius: 50%;
  background: transparent; border: none; color: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.class-card-menu:hover { background: rgba(255,255,255,.18); }
.class-card-avatar {
  position: absolute; right: 14px; bottom: -28px; width: 64px; height: 64px; border-radius: 50%;
  background: #fff; color: var(--text); display: flex; align-items: center; justify-content: center;
  font-family: 'Google Sans', sans-serif; font-weight: 600; font-size: 22px; border: 1px solid var(--line-soft); overflow: hidden;
}
.class-card-avatar img { width: 100%; height: 100%; object-fit: cover; }
.class-card-body { padding: 38px 16px 14px; flex: 1; }
.class-card-desc { color: var(--text-soft); font-size: 13.5px; margin: 0; min-height: 1.3em; }
.class-card-footer { display: flex; justify-content: flex-end; gap: 2px; padding: 4px 6px 8px; border-top: 1px solid var(--line-soft); }
.class-card-icon-btn { width: 36px; height: 36px; border-radius: 50%; border: none; background: none; color: var(--text-soft); display: flex; align-items: center; justify-content: center; cursor: pointer; }
.class-card-icon-btn:hover { background: var(--bg-2); color: var(--text-soft-2); }
.empty-state { text-align: center; margin-top: 80px; color: var(--text-soft); }
.empty-state p:first-child { font-size: 17px; color: var(--text); font-weight: 500; }
.empty-sub { font-size: 14px; }

/* --- class view layout --- */
.class-view { flex: 1; display: flex; overflow: hidden; }
.channel-sidebar { width: 260px; flex-shrink: 0; background: #fff; border-right: 1px solid var(--line); display: flex; flex-direction: column; }
.class-banner {
  padding: 20px 18px 40px; position: relative; color: #fff;
  background-image: radial-gradient(circle at 100% 0%, rgba(255,255,255,.14), transparent 55%);
}
.class-banner-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.class-banner h2 { color: #fff; font-family: 'Google Sans', sans-serif; font-size: 19px; font-weight: 500; line-height: 1.3; }
.class-banner p { color: rgba(255,255,255,.88); font-size: 12.5px; margin: 4px 0 0; padding-right: 8px; }
.class-settings-btn { color: rgba(255,255,255,.85); flex-shrink: 0; }
.class-settings-btn:hover { color: #fff; background: rgba(255,255,255,.16); }
.class-banner-avatar {
  position: absolute; left: 18px; bottom: -20px; width: 44px; height: 44px; border-radius: 50%;
  background: #fff; color: var(--text); display: flex; align-items: center; justify-content: center;
  font-family: 'Google Sans', sans-serif; font-weight: 600; font-size: 17px; border: 1px solid var(--line-soft); overflow: hidden;
}
.class-banner-avatar img { width: 100%; height: 100%; object-fit: cover; }
.channel-list { flex: 1; overflow-y: auto; padding: 30px 8px 10px; }
.channel-item {
  display: flex; align-items: center; gap: 12px; padding: 9px 14px; border-radius: 0 24px 24px 0;
  color: var(--text-soft-2); font-size: 14px; font-weight: 500; cursor: pointer; margin-bottom: 2px;
}
.channel-item .hash { opacity: .65; font-weight: 700; width: 20px; text-align: center; flex-shrink: 0; }
.channel-item-icon { color: var(--text-soft); flex-shrink: 0; }
.channel-item:hover { background: var(--bg-2); }
.channel-item.active { background: var(--green-tint); color: var(--green-dark); font-weight: 700; }
.channel-item.active .channel-item-icon { color: var(--green-dark); }
.add-channel-btn {
  margin: 0 6px 10px; padding: 9px 14px; border-radius: 0 24px 24px 0; text-align: left;
  background: none; border: none; color: var(--text-soft); font-size: 13.5px; cursor: pointer;
  display: flex; align-items: center; gap: 12px;
}
.add-channel-btn:hover { color: var(--text-soft-2); background: var(--bg-2); }
.sidebar-footer { padding: 10px; display: flex; gap: 6px; border-top: 1px solid var(--line-soft); }
.sidebar-footer .btn { flex: 1; }

.chat-main { flex: 1; display: flex; flex-direction: column; background: var(--bg); min-width: 0; }
.chat-header {
  height: 56px; flex-shrink: 0; display: flex; align-items: center; gap: 8px;
  padding: 0 20px; border-bottom: 1px solid var(--line); font-weight: 500; font-size: 15px; background: #fff;
}
.chat-header-hash { color: var(--green-dark); font-weight: 700; }
.pinned-btn { margin-left: auto; background: none; border: none; font-size: 13px; color: var(--text-soft); cursor: pointer; padding: 6px 12px; border-radius: 16px; display: flex; align-items: center; gap: 4px; }
.pinned-btn .material-symbols-outlined { font-size: 16px; }
.pinned-btn:hover { background: var(--bg-2); }

.message-list { flex: 1; overflow-y: auto; padding: 18px 20px 4px; display: flex; flex-direction: column; gap: 10px; }
.msg-group {
  display: flex; gap: 12px; padding: 12px 14px; border-radius: var(--radius-md);
  background: #fff; border: 1px solid var(--line-soft); box-shadow: var(--shadow-1);
}
.msg-avatar {
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0; margin-top: 1px;
  display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: 13.5px;
}
.msg-body { flex: 1; min-width: 0; }
.msg-meta { display: flex; align-items: baseline; gap: 8px; margin-bottom: 3px; }
.msg-author { font-weight: 500; font-size: 14px; color: var(--text-soft-2); }
.msg-time { font-size: 11.5px; color: var(--text-soft); }
.msg-text { font-size: 14.5px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; color: var(--text); }
.edited-tag { font-size: 11.5px; color: var(--text-soft); font-style: italic; font-weight: 400; }
.msg-pin-flag { font-size: 11px; color: var(--green-dark); font-weight: 700; margin-bottom: 4px; display: flex; align-items: center; gap: 4px; }
.msg-pin-flag .material-symbols-outlined { font-size: 14px; }

.msg-embed { margin-top: 8px; max-width: 400px; }
.msg-embed iframe { width: 100%; aspect-ratio: 16/9; border-radius: 8px; border: 1px solid var(--line); }

.msg-attachments { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.attachment-img { max-width: 260px; max-height: 200px; border-radius: 8px; border: 1px solid var(--line); display: block; }
.attachment-video { max-width: 320px; max-height: 220px; border-radius: 8px; border: 1px solid var(--line); display: block; background: #000; }
.attachment-audio { display: block; max-width: 300px; }
.attachment-file {
  display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: var(--bg-2);
  border: 1px solid var(--line); border-radius: var(--radius-sm); font-size: 13px; text-decoration: none; color: var(--text);
}

.msg-reactions { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.reaction-pill { display: flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 12px; background: var(--bg-2); border: 1px solid var(--line); font-size: 12.5px; cursor: pointer; }
.reaction-pill.mine { background: var(--green-tint); border-color: var(--green); }
.reaction-pill:hover { border-color: var(--green); }

.msg-actions {
  display: none; gap: 2px; position: relative; top: -22px; float: right; margin-left: 8px;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius-sm); box-shadow: var(--shadow-1); padding: 2px;
}
.msg-group:hover .msg-actions { display: flex; }
.msg-actions button { background: none; border: none; padding: 6px; cursor: pointer; border-radius: 6px; color: var(--text-soft); display: flex; }
.msg-actions button .material-symbols-outlined { font-size: 17px; }
.msg-actions button:hover { background: var(--bg-2); }
.msg-thread-link { margin-top: 6px; font-size: 12.5px; color: var(--blue); font-weight: 500; cursor: pointer; }

.edit-box { display: flex; flex-direction: column; gap: 6px; margin-top: 2px; }
.edit-textarea { width: 100%; resize: vertical; min-height: 44px; border: 1.5px solid var(--blue); border-radius: var(--radius-sm); padding: 8px 10px; font-size: 14.5px; font-family: inherit; }
.edit-actions { display: flex; gap: 6px; justify-content: flex-end; }

.thread-reply-actions { display: flex; gap: 4px; margin-top: 4px; }
.thread-reply-actions button { background: none; border: none; cursor: pointer; padding: 4px 6px; border-radius: 6px; color: var(--text-soft); display: inline-flex; }
.thread-reply-actions button .material-symbols-outlined { font-size: 16px; }
.thread-reply-actions button:hover { background: var(--bg-2); }
.thread-reply { padding: 6px; border-radius: var(--radius-sm); }
.thread-reply:hover { background: var(--bg-2); }

.typing-indicator { padding: 0 22px; font-size: 12.5px; color: var(--text-soft); font-style: italic; min-height: 18px; }

.composer { display: flex; align-items: flex-end; gap: 6px; padding: 10px 16px; position: relative; }
.composer-attach { background: none; border: none; cursor: pointer; padding: 8px; flex-shrink: 0; color: var(--text-soft); border-radius: 50%; display: flex; }
.composer-attach:hover { background: var(--bg-2); }
.gif-text-btn { font-size: 11px; font-weight: 800; letter-spacing: .02em; border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; }
.composer textarea {
  flex: 1; resize: none; border: 1px solid var(--line); border-radius: 20px; padding: 10px 16px;
  font-size: 14.5px; max-height: 140px; background: #fff;
}
.composer textarea:focus { outline: 2px solid var(--blue); outline-offset: -1px; border-color: var(--blue); }
.composer-send { flex-shrink: 0; border-radius: 50%; width: 40px; height: 40px; padding: 0; display: flex; align-items: center; justify-content: center; }
.attach-preview { display: flex; gap: 8px; padding: 0 16px 10px; flex-wrap: wrap; }
.attach-chip { display: flex; align-items: center; gap: 6px; background: var(--bg-2); border-radius: 8px; padding: 5px 8px; font-size: 12.5px; }
.attach-chip button { background: none; border: none; cursor: pointer; color: var(--danger); font-weight: 700; }
.attach-chip-gif img { height: 32px; border-radius: 4px; display: block; }

/* --- gif picker --- */
.gif-wrap { position: relative; flex-shrink: 0; }
.gif-panel {
  position: absolute; bottom: 46px; left: 0; width: 300px; max-height: 340px; background: #fff;
  border: 1px solid var(--line); border-radius: var(--radius-md); box-shadow: var(--shadow-2); padding: 10px;
  display: flex; flex-direction: column; gap: 8px; z-index: 40;
}
.gif-panel input { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 7px 10px; font-size: 13.5px; }
.gif-panel input:focus { outline: 2px solid var(--blue); outline-offset: -1px; }
.gif-results { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; overflow-y: auto; max-height: 260px; }
.gif-thumb { border: none; background: var(--bg-2); border-radius: var(--radius-sm); padding: 0; overflow: hidden; cursor: pointer; }
.gif-thumb img { width: 100%; height: 84px; object-fit: cover; display: block; }
.gif-loading { grid-column: 1/-1; text-align: center; font-size: 12.5px; color: var(--text-soft); padding: 12px 0; }

/* --- member sidebar --- */
.member-sidebar { width: 240px; flex-shrink: 0; background: #fff; border-left: 1px solid var(--line); padding: 18px 14px; overflow-y: auto; }
.member-sidebar h3 { color: var(--text-soft-2); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 12px; font-weight: 700; }
.member-row { display: flex; align-items: center; gap: 10px; padding: 6px 6px; border-radius: var(--radius-sm); }
.member-row:hover { background: var(--bg-2); }
.member-avatar { width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 11.5px; font-weight: 700; flex-shrink: 0; }
.member-name { font-size: 13.5px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member-role { font-size: 10px; color: var(--text-soft); text-transform: uppercase; margin-left: auto; flex-shrink: 0; font-weight: 600; }
.member-manage-btn { background: none; border: none; color: var(--text-soft); cursor: pointer; padding: 4px; border-radius: 50%; flex-shrink: 0; display: flex; }
.member-manage-btn .material-symbols-outlined { font-size: 16px; }
.member-manage-btn:hover { color: var(--text-soft-2); background: var(--bg-2); }

/* --- thread panel --- */
.thread-panel {
  position: fixed; right: 0; top: 0; bottom: 0; width: 340px; background: #fff;
  border-left: 1px solid var(--line); display: flex; flex-direction: column; z-index: 30; box-shadow: var(--shadow-2);
}
.thread-header { height: 56px; display: flex; align-items: center; justify-content: space-between; padding: 0 16px; border-bottom: 1px solid var(--line); font-weight: 500; background: #fff; }
.thread-parent { padding: 14px 16px; border-bottom: 1px solid var(--line); background: var(--bg); }
.thread-replies { flex: 1; overflow-y: auto; padding: 10px 16px; display: flex; flex-direction: column; gap: 10px; }

/* --- modals --- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(32,33,36,.5); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 20px; }
.modal { background: #fff; border-radius: var(--radius-lg); padding: 24px; width: 100%; max-width: 400px; max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-2); display: flex; flex-direction: column; gap: 16px; }
.modal h3 { font-size: 18px; font-weight: 500; color: var(--text-soft-2); }
.modal label { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; font-weight: 500; color: var(--text-soft); }
.modal input, .modal select { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; font-size: 14.5px; }
.modal input:focus, .modal select:focus { outline: 2px solid var(--blue); outline-offset: -1px; border-color: var(--blue); }
.optional { font-weight: 400; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.invite-code-display { font-family: 'Google Sans', 'Roboto', sans-serif; font-size: 26px; font-weight: 600; letter-spacing: .06em; text-align: center; padding: 14px; background: var(--green-tint); color: var(--green-dark); border-radius: var(--radius-sm); }
.pinned-list { display: flex; flex-direction: column; gap: 10px; max-height: 320px; overflow-y: auto; }
.pinned-item { padding: 8px 10px; background: var(--bg); border: 1px solid var(--line-soft); border-radius: var(--radius-sm); font-size: 13px; }
.pinned-item b { display: block; font-size: 12.5px; margin-bottom: 2px; }

.settings-icon-row { display: flex; align-items: center; gap: 14px; }
.settings-icon-preview {
  width: 56px; height: 56px; border-radius: 50%; overflow: hidden; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; background: var(--bg-2);
  font-family: 'Google Sans', sans-serif; font-weight: 700; font-size: 20px; color: var(--text-soft-2);
}
.settings-icon-preview img { width: 100%; height: 100%; object-fit: cover; }
.settings-icon-preview span { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; color: #fff; }
.settings-icon-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.color-swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.color-swatch { width: 28px; height: 28px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; padding: 0; }
.color-swatch.selected { border-color: var(--text-soft-2); box-shadow: 0 0 0 2px #fff inset; }
.perm-check-list { display: flex; flex-direction: column; gap: 8px; margin-top: -6px; }
.perm-check { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 500; color: var(--text); flex-direction: row !important; }
.perm-check input { width: auto; }

.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: #323232; color: #fff; padding: 12px 20px; border-radius: var(--radius-sm); font-size: 13.5px; z-index: 100; box-shadow: var(--shadow-2);
}

/* ===================== RESPONSIVE ===================== */
@media (max-width: 860px) {
  .member-sidebar { position: fixed; right: 0; top: var(--topbar-h); bottom: 0; z-index: 20; }
  .thread-panel { width: 100%; }
}
@media (max-width: 640px) {
  .rail { position: fixed; left: 0; top: var(--topbar-h); bottom: 0; z-index: 25; box-shadow: var(--shadow-2); }
  .rail:not(.collapsed) { width: 280px; }
  .rail.collapsed { width: 0; }
  .home-view { padding: 20px 16px; }
  .channel-sidebar { position: fixed; left: 0; top: var(--topbar-h); bottom: 0; z-index: 15; transform: translateX(-110%); transition: transform .2s ease; }
  .channel-sidebar.open { transform: translateX(0); box-shadow: var(--shadow-2); }
  .gif-panel { width: 240px; }
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(60,64,67,.25); border-radius: 5px; border: 2px solid transparent; background-clip: content-box; }
