/* eslaque — tema CoreaLux OS (tokens de os.corealux.com/web/src/index.css). */

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url("/fonts/inter-v20-latin-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url("/fonts/inter-v20-latin-ext-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7,
    U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF,
    U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  /* CoreaLux OS — tokens de web/src/index.css do projeto os.corealux.com. */
  --os-primary: #6e56cf;
  --os-primary-dark: #5b44b8;
  --os-accent: #e8963f;
  --rail-bg: #111318;
  --topbar-bg: #111318;
  --sidebar-bg: #111318;
  --sidebar-hover: #1e212a;
  --sidebar-text: #8b8fa8;
  --sidebar-muted: #8b8fa8;
  --sidebar-field: #1e212a;
  --sidebar-border: #1f2230;
  --selected-bg: #282b37;
  --selected-text: #ffffff;
  --accent: var(--os-primary);
  --accent-strong: var(--os-primary-dark);
  --blue: var(--os-primary-dark);
  --ink: #0d0f12;
  --ink-soft: #3d4551;
  --muted: #525966;
  --border: #e4e7ec;
  --border-strong: #cdd2db;
  --hover: #f3f4f8;
  --bg: #f7f8fa;
  --surface: #ffffff;
  --surface-2: #f3f4f8;
  --chip: #f3f4f8;
  --chip-active: #eee9ff;
  --code-bg: #f3f4f8;
  --danger: #ad5858;
  --star: var(--os-accent);
  --shadow: 0 6px 24px rgba(13, 15, 18, .16);
  --rail-w: 70px;
  --sidebar-w: 366px;
  --topbar-h: 40px;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --rail-bg: #0b0d11;
  --topbar-bg: #0b0d11;
  --sidebar-bg: #0b0d11;
  --sidebar-hover: #191c24;
  --sidebar-text: #8b8fa8;
  --sidebar-muted: #8b8fa8;
  --sidebar-field: #191c24;
  --sidebar-border: #1a1d26;
  --selected-bg: #242833;
  --selected-text: #ffffff;
  --ink: #f3f4f7;
  --ink-soft: #c7cbd6;
  --muted: #9aa0af;
  --border: #2b2f3a;
  --border-strong: #3c4150;
  --hover: #1f222b;
  --bg: #0f1116;
  --surface: #171a21;
  --surface-2: #1f222b;
  --chip: #1f222b;
  --chip-active: #2a2245;
  --code-bg: #1f222b;
  --blue: #a698e2;
  --accent: #6e56cf;
  --accent-strong: #5b44b8;
  --danger: #d49393;
}

* { box-sizing: border-box; }

html, body { height: 100%; overflow: clip; overscroll-behavior: none; }

body {
  height: 100dvh;
  margin: 0;
  font-family: "Inter", "Inter Fallback", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.46;
  color: var(--ink);
  background: var(--bg);
}

button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }

svg { width: 20px; height: 20px; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 4px;
  color: var(--muted);
}
.icon-btn:hover { background: var(--hover); color: var(--ink); }

/* ---------- top bar ---------- */

.topbar {
  flex: none;
  height: var(--topbar-h);
  display: grid;
  grid-template-columns: 300px minmax(280px, 760px) 1fr;
  align-items: center;
  gap: 8px;
  background: var(--topbar-bg);
  color: #8b8fa8;
  padding-right: 12px;
}

.topbar-left {
  display: flex;
  justify-content: flex-end;
  gap: 2px;
}

.topbar-btn {
  color: #8b8fa8;
  width: 26px;
  height: 26px;
}
.topbar-btn:hover { background: #1e212a; color: #ffffff; }
.topbar-btn svg { width: 18px; height: 18px; }

.topbar-search {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 26px;
  padding: 0 10px;
  border-radius: 6px;
  background: var(--sidebar-field);
  color: #8b8fa8;
  justify-self: center;
  width: 100%;
}
.topbar-search:focus-within { background: #282b37; color: #ffffff; }
.search-icon { width: 15px; height: 15px; flex: none; }
.topbar-search input {
  flex: 1;
  min-width: 0;
  background: none;
  border: 0;
  outline: 0;
  color: #ffffff;
  font-size: 13px;
}
.topbar-search input::placeholder { color: #8b8fa8; }
.topbar-search input::-webkit-search-cancel-button { filter: invert(1); opacity: .6; }

.topbar-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.topbar-avatar {
  width: 26px;
  height: 26px;
  border-radius: 4px;
  background: var(--accent);
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
  margin-left: 6px;
}

.search-results {
  position: absolute;
  top: 32px;
  left: 0;
  right: 0;
  max-height: 60vh;
  overflow-y: auto;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 6px;
  z-index: 60;
}
.search-results .sr-title {
  font-size: 12px;
  color: var(--muted);
  padding: 6px 10px;
  text-transform: none;
}
.search-results .sr-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 7px 10px;
  border-radius: 6px;
}
.search-results .sr-item:hover { background: var(--hover); }
.search-results .sr-conv { font-size: 12px; color: var(--muted); }
.search-results .sr-text { font-size: 14px; }
.search-results mark { background: #fff2a8; color: inherit; border-radius: 2px; }
.search-results .sr-empty { padding: 10px; color: var(--muted); font-size: 14px; }

/* ---------- layout ---------- */

.workspace {
  display: flex;
  flex: 1;
  min-width: 0;
  min-height: 0;
}

.rail {
  width: var(--rail-w);
  flex: none;
  background: var(--rail-bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 0 10px;
}

.rail-ws {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: #242833;
  color: #ffffff;
  border: 1px solid #1f2230;
  font-weight: 800;
  font-size: 17px;
  margin-bottom: 10px;
}

.rail-item {
  width: 54px;
  padding: 5px 0 4px;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  color: #8b8fa8;
}
.rail-item:hover { background: #1e212a; color: #ffffff; }
.rail-item.is-active { background: #242833; color: #ffffff; }
.rail-ico { display: flex; }
.rail-ico svg { width: 20px; height: 20px; }
.rail-label { font-size: 10px; line-height: 1.15; text-align: center; }
.rail-spacer { flex: 1; }
.rail-avatar {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  background: var(--accent);
  color: #ffffff;
  font-weight: 700;
  font-size: 13px;
}

/* ---------- sidebar ---------- */

.sidebar {
  width: var(--sidebar-w);
  flex: none;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding-top: 10px;
}

.ws-head {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px 8px 16px;
}
.ws-name {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 18px;
  font-weight: 900;
  color: #f5f5f7;
  padding: 2px 6px;
  border-radius: 6px;
}
.ws-name:hover { background: #1e212a; }
.ws-name svg { width: 12px; height: 12px; }
.ws-actions { margin-left: auto; display: flex; gap: 2px; }
.side-icon { color: var(--sidebar-muted); }
.side-icon:hover { background: #1e212a; color: #ffffff; }

.side-note {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 2px 12px 10px;
  padding: 7px 10px;
  border: 1px solid var(--sidebar-border);
  border-radius: 8px;
  font-size: 13px;
  color: #8b8fa8;
}
.side-note svg { width: 16px; height: 16px; flex: none; color: var(--accent); }

.side-search {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0 12px 8px;
  padding: 5px 9px;
  border-radius: 6px;
  background: var(--sidebar-field);
  color: var(--sidebar-muted);
}
.side-search svg { width: 14px; height: 14px; flex: none; }
.side-search input {
  flex: 1;
  min-width: 0;
  background: none;
  border: 0;
  outline: 0;
  font-size: 13px;
  color: #ffffff;
}
.side-search input::placeholder { color: #8b8fa8; }

.side-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 4px 0 12px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, .28) transparent;
}
.side-scroll::-webkit-scrollbar { width: 8px; }
.side-scroll::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .22); border-radius: 4px; }

.side-section { margin-bottom: 14px; }
.side-head {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 16px 2px;
  font-size: 15px;
  font-weight: 400;
  color: var(--sidebar-muted);
  width: 100%;
}
.side-head:hover { color: #ffffff; }
.side-head svg { width: 12px; height: 12px; }
.side-head .side-count { margin-left: auto; font-size: 12px; }
.side-add {
  margin-left: auto;
  width: 22px;
  height: 22px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--sidebar-muted);
}
.side-add:hover { background: #1e212a; color: #ffffff; }
.side-add svg { width: 14px; height: 14px; }

.side-row {
  display: flex;
  align-items: center;
  gap: 7px;
  width: calc(100% - 16px);
  margin: 1px 8px;
  padding: 4px 8px 4px 26px;
  border-radius: 6px;
  font-size: 15px;
  color: var(--sidebar-text);
  text-align: left;
  min-height: 28px;
}
.side-row:hover { background: #1e212a; }
.side-row .hash { color: var(--sidebar-muted); width: 13px; height: 13px; flex: none; }
.side-row .label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-row.is-unread { color: #ffffff; font-weight: 700; }
.side-row.is-active {
  background: var(--selected-bg);
  color: var(--selected-text);
  font-weight: 700;
}
.side-row.is-active:hover { background: var(--selected-bg); }
.side-row.is-active .hash { color: var(--selected-text); }
.side-row .badge {
  margin-left: auto;
  background: var(--danger);
  color: #fff;
  border-radius: 10px;
  min-width: 20px;
  height: 18px;
  padding: 0 6px;
  font-size: 12px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.side-row.is-active .badge { background: var(--danger); }
.side-row .star { color: var(--star); width: 14px; height: 14px; flex: none; }
.side-row .dm-avatar {
  width: 20px;
  height: 20px;
  border-radius: 5px;
  font-size: 10px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  background: var(--accent);
  color: #fff;
}
.side-empty { padding: 2px 16px 4px 26px; font-size: 13px; color: var(--sidebar-muted); }

.side-foot {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px 10px;
}

/* ---------- main ---------- */

.main {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.channel-head {
  height: 49px;
  flex: none;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
  border-bottom: 1px solid var(--border);
}
.channel-title {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 18px;
  font-weight: 900;
  padding: 3px 6px;
  border-radius: 6px;
  max-width: 60%;
}
.channel-title:hover { background: var(--hover); }
.channel-title .hash { width: 16px; height: 16px; color: var(--muted); }
.channel-title .label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.channel-title .dm-state { font-weight: 400; font-size: 13px; color: var(--muted); margin-left: 6px; }
.head-actions { margin-left: auto; display: flex; align-items: center; gap: 2px; }
.head-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 8px;
  border-radius: 4px;
  color: var(--muted);
  font-size: 13px;
}
.head-btn:hover { background: var(--hover); color: var(--ink); }
.head-btn svg { width: 16px; height: 16px; }

.channel-tabs {
  height: 44px;
  flex: none;
  display: flex;
  align-items: stretch;
  gap: 22px;
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
}
.tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 2px;
  font-size: 13px;
  color: var(--muted);
  border-bottom: 2px solid transparent;
}
.tab:hover { color: var(--ink); }
.tab.is-active { color: var(--ink); font-weight: 700; border-bottom-color: var(--ink); }

.scroll-area {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 12px 0 8px;
}
.messages::-webkit-scrollbar { width: 10px; }
.messages::-webkit-scrollbar-thumb { background: #c9c9c9; border-radius: 5px; }
html[data-theme="dark"] .messages::-webkit-scrollbar-thumb { background: #4a4a4a; }

.day-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 10px 20px 6px;
  color: var(--muted);
  font-size: 13px;
}
.day-divider::before, .day-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}
.day-divider .pill {
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 2px 12px;
  background: var(--surface);
  white-space: nowrap;
}

.msg {
  position: relative;
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 8px;
  padding: 5px 20px;
}
.msg:hover { background: var(--hover); }
.msg.grouped { margin-top: -1px; }
.msg.is-flash { animation: flash 1.6s ease-out; }
@keyframes flash {
  0%, 55% { background: #fff3c4; }
  100% { background: transparent; }
}

.msg-avatar {
  width: 36px;
  height: 36px;
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  user-select: none;
  margin-top: 2px;
}
.msg-avatar.ghost { background: none; }
.msg-time-rail {
  font-size: 11px;
  color: var(--muted);
  text-align: right;
  padding-top: 3px;
  opacity: 0;
}
.msg:hover .msg-time-rail { opacity: 1; }

.msg-body { min-width: 0; }
.msg-top { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.msg-author { font-weight: 900; color: var(--ink); }
.msg-badge {
  font-size: 10px;
  background: var(--chip);
  color: var(--muted);
  border-radius: 3px;
  padding: 0 4px;
  line-height: 15px;
}
.msg-time { font-size: 12px; color: var(--muted); }
.msg-edited { font-size: 12px; color: var(--muted); font-style: italic; }
.msg-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.msg-text code {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1px 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
}
.msg-text a { color: var(--blue); text-decoration: none; }
.msg-text a:hover { text-decoration: underline; }
.msg-text .mention {
  color: #5b44b8;
  background: #eee9ff;
  border-radius: 3px;
  padding: 0 2px;
  font-weight: 500;
}
html[data-theme="dark"] .msg-text .mention { background: #221d35; color: #a698e2; }
.msg-text .mention.is-me { background: #fff3e0; color: #b45309; font-weight: 700; }
html[data-theme="dark"] .msg-text .mention.is-me { background: #2b2717; color: #eeb68b; }

.msg-toolbar {
  position: absolute;
  top: -14px;
  right: 18px;
  display: none;
  align-items: center;
  gap: 1px;
  padding: 2px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 1px 6px rgba(0, 0, 0, .12);
  z-index: 5;
}
.msg:hover .msg-toolbar,
.msg:focus-within .msg-toolbar { display: flex; }
.msg:focus { outline: none; }
.msg:focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; border-radius: 4px; }
.msg-toolbar .icon-btn { width: 26px; height: 26px; }
.msg-toolbar .icon-btn svg { width: 15px; height: 15px; }

.reactions { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 5px; }
.reaction {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 24px;
  padding: 0 8px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--chip);
  font-size: 12px;
  color: var(--ink-soft);
}
.reaction:hover { border-color: var(--muted); }
.reaction.is-mine { background: var(--chip-active); border-color: var(--accent); color: var(--blue); font-weight: 700; }

.emoji-pop {
  position: absolute;
  right: 18px;
  top: 22px;
  z-index: 20;
  width: 300px;
  padding: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
}
.emoji-search {
  width: 100%;
  height: 30px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  padding: 0 8px;
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  outline: none;
}
.emoji-search:focus { border-color: var(--blue); box-shadow: 0 0 0 1px var(--blue); }
.emoji-body { max-height: 236px; overflow-y: auto; margin-top: 6px; }
.emoji-title { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin: 6px 2px 2px; }
.emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; }
.emoji-pop .emoji-btn {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  font-size: 18px;
  line-height: 1;
}
.emoji-pop .emoji-btn:hover { background: var(--hover); }
.emoji-empty { padding: 10px 4px; color: var(--muted); font-size: 13px; }

.thread-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  padding: 3px 8px 3px 4px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-size: 13px;
  color: var(--blue);
  font-weight: 700;
}
.thread-chip:hover { background: var(--surface-2); border-color: var(--border); }
.thread-chip .faces { display: inline-flex; }
.thread-chip .faces span {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  border: 2px solid var(--surface);
  margin-left: -6px;
  font-size: 9px;
  font-weight: 700;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.thread-chip .faces span:first-child { margin-left: 0; }
.thread-chip .count { color: var(--muted); font-weight: 400; }

.edit-box { margin-top: 4px; }
.edit-box textarea {
  width: 100%;
  min-height: 62px;
  resize: vertical;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 8px 10px;
  outline: none;
  background: var(--surface);
}
.edit-box textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 1px var(--blue); }
.edit-actions { display: flex; gap: 8px; margin-top: 6px; }
.btn {
  height: 30px;
  padding: 0 12px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 14px;
  font-weight: 700;
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #ffffff; }
.btn.primary:hover { background: var(--accent-strong); }
.btn.primary:disabled { opacity: .5; cursor: default; }
.btn.ghost { border-color: transparent; font-weight: 400; }

/* ---------- onboarding / empty ---------- */

.onboarding {
  padding: 40px 46px 20px;
  max-width: 1060px;
}
.onboarding h2 {
  margin: 0 0 10px;
  font-size: 28px;
  line-height: 1.3;
  font-weight: 900;
}
.onboarding > p {
  margin: 0 0 26px;
  font-size: 17px;
  color: var(--ink-soft);
  max-width: 900px;
}
.cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.card {
  text-align: left;
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface-2);
  display: flex;
  flex-direction: column;
  border: 1px solid transparent;
  padding: 0;
}
.card:hover { border-color: var(--border-strong); }
.card-head { padding: 14px 16px 12px; display: block; }
.card-title { display: block; font-size: 15px; font-weight: 900; }
.card-sub { display: block; font-size: 13px; color: var(--muted); margin-top: 2px; }
.card-art { height: 168px; flex: 1; display: block; width: 100%; }
.card.yellow { background: #eee9ff; }
.card.yellow .card-sub { color: #5b44b8; }
.card.blue { background: #fff3e0; }
.card.blue .card-head { background: #ffd9a8; }
.card.blue .card-sub { color: #b45309; }
.card.pink { background: #f3f4f8; }
.card.pink .card-sub { color: #525966; }

.empty-tail {
  padding: 26px 46px 30px;
  color: var(--muted);
  font-size: 14px;
  border-top: 1px solid var(--border);
  margin-top: 30px;
}

/* ---------- composer ---------- */

.composer-wrap { flex: none; padding: 0 20px 18px; }
.composer {
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--surface);
  overflow: hidden;
}
.composer:focus-within { border-color: var(--ink-soft); }
.composer-tools {
  display: flex;
  align-items: center;
  gap: 1px;
  padding: 4px 6px;
  border-bottom: 1px solid var(--border);
}
.composer-tools .icon-btn { width: 26px; height: 26px; color: var(--muted); }
.composer-tools .icon-btn svg { width: 15px; height: 15px; }
.composer-tools .fmt { font-size: 13px; font-weight: 700; }
.composer-tools .sep { width: 1px; height: 18px; background: var(--border); margin: 0 4px; }
.composer textarea {
  display: block;
  width: 100%;
  min-height: 24px;
  max-height: 220px;
  padding: 9px 12px;
  border: 0;
  outline: 0;
  resize: none;
  background: none;
  line-height: 1.4;
}
.composer-bottom {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 2px 6px 6px;
}
.composer-bottom .icon-btn { width: 28px; height: 28px; color: var(--muted); }
.composer-bottom .icon-btn svg { width: 17px; height: 17px; }
.send-group { margin-left: auto; display: flex; align-items: center; }
.send-btn {
  width: 30px;
  height: 28px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
}
.send-btn.enabled { color: var(--accent); }
.send-btn.enabled:hover { background: var(--hover); }
.send-btn svg { width: 18px; height: 18px; }
.send-caret { width: 18px; height: 28px; color: var(--muted); display: inline-flex; align-items: center; justify-content: center; }
.send-caret svg { width: 11px; height: 11px; }
.composer-hint { font-size: 12px; color: var(--muted); padding: 0 4px 0 2px; }

.typing-line {
  height: 16px;
  font-size: 12px;
  color: var(--muted);
  opacity: 0;
  transition: opacity .15s ease;
  padding: 0 2px 2px;
}
.typing-line.is-on { opacity: 1; }

.mention-pop {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0 0 6px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  max-width: 340px;
}
.mention-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 6px;
  border-radius: 6px;
  text-align: left;
  font-size: 13px;
}
.mention-item:hover, .mention-item.is-active { background: var(--surface-2); }
.mention-item .msg-avatar { width: 24px; height: 24px; font-size: 10px; margin: 0; flex: none; }
.mention-who { font-weight: 700; }
.mention-handle { color: var(--muted); }

.archived-chip {
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .03em;
}
.archived-note {
  padding: 12px 14px;
  border: 1px dashed var(--border-strong);
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
  background: var(--surface-2);
}

.muted-bell { display: inline-flex; width: 16px; height: 16px; color: var(--muted); flex: none; }
.muted-bell svg { width: 16px; height: 16px; }

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field-row .field { margin-bottom: 14px; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid transparent;
  box-shadow: 0 0 0 1px var(--border);
}
.swatch.is-active { border-color: var(--surface); box-shadow: 0 0 0 2px var(--ink); }
.channel-settings { grid-template-columns: 1fr 1.4fr auto auto; align-items: center; }
.channel-settings .check { white-space: nowrap; }

/* ---------- thread ---------- */

.thread {
  width: 420px;
  flex: none;
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--surface);
}
.thread-head {
  height: 49px;
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px 0 16px;
  border-bottom: 1px solid var(--border);
}
.thread-head h3 { margin: 0; font-size: 17px; font-weight: 900; }
.thread-head .thread-sub { color: var(--muted); font-size: 13px; }
.thread-head .icon-btn { margin-left: auto; }
.thread-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 10px 0; }
.thread-parent { padding-bottom: 8px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.thread-replies-label {
  padding: 8px 20px 2px;
  font-size: 13px;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  padding-bottom: 6px;
  margin-bottom: 4px;
}
.thread .composer-wrap { padding: 10px 12px 14px; }

/* ---------- about tab ---------- */

.about { padding: 24px 26px; max-width: 720px; }
.about h2 { margin: 0 0 4px; font-size: 20px; }
.about .about-sub { color: var(--muted); font-size: 14px; margin-bottom: 20px; }
.about-block { border-top: 1px solid var(--border); padding: 16px 0; }
.about-block h3 { margin: 0 0 8px; font-size: 14px; color: var(--muted); font-weight: 700; }
.about-block p { margin: 0; }
.member-row { display: flex; align-items: center; gap: 10px; padding: 5px 0; }
.member-row .msg-avatar { width: 30px; height: 30px; font-size: 12px; margin: 0; }
.member-row .who { font-weight: 700; }
.member-row .risk { color: var(--muted); font-size: 13px; }
.presence { width: 8px; height: 8px; border-radius: 50%; background: #22c55e; display: inline-block; }
.presence.away { background: #f59e0b; }
.presence.offline { background: #9aa0af; }

/* ---------- activity ---------- */

.activity { padding: 22px 26px; max-width: 820px; }
.activity h2 { margin: 0 0 4px; font-size: 22px; }
.activity .sub { color: var(--muted); font-size: 14px; margin-bottom: 18px; }
.activity-item {
  display: block;
  width: 100%;
  text-align: left;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 8px;
  background: var(--surface);
}
.activity-item:hover { background: var(--surface-2); }
.activity-meta { font-size: 12px; color: var(--muted); margin-bottom: 3px; }
.activity-text { font-size: 14px; }

/* ---------- modal / toast ---------- */

#overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow-y: auto;
  overscroll-behavior: contain;
  z-index: 90;
}
.modal {
  width: min(520px, 100%);
  min-width: 0;
  max-width: 100%;
  max-height: min(820px, calc(100dvh - 48px));
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  overflow-wrap: anywhere;
  background: var(--surface);
  color: var(--ink);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 24px 28px 22px;
  margin: auto;
}
.modal h2 { margin: 0 0 6px; font-size: 22px; }
.modal .modal-sub { color: var(--muted); font-size: 14px; margin: 0 0 18px; }
.modal input, .modal select, .modal textarea { max-width: 100%; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 700; margin-bottom: 5px; }
.field input[type="text"],
.field input[type="password"] {
  width: 100%;
  height: 38px;
  padding: 0 10px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  outline: none;
  background: var(--surface);
}
.field input[type="text"]:focus,
.field input[type="password"]:focus { border-color: var(--blue); box-shadow: 0 0 0 1px var(--blue); }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink-soft); }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }
.modal-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.dm-list { max-height: 42vh; overflow-y: auto; margin: 0 -8px; }
.dm-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 7px 8px;
  border-radius: 6px;
}
.dm-row:hover { background: var(--hover); }
.dm-row .msg-avatar { width: 32px; height: 32px; font-size: 12px; margin: 0; }
.dm-row .name { font-weight: 700; }
.dm-row .title { color: var(--muted); font-size: 13px; }

.toasts {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 120;
}
.toast {
  display: flex;
  align-items: center;
  gap: 14px;
  background: #111318;
  color: #fff;
  border-radius: 6px;
  padding: 9px 14px;
  font-size: 14px;
  box-shadow: var(--shadow);
}
.toast button { color: #7fd0ff; font-weight: 700; }

.help-panel { position: fixed; right: 16px; top: 46px; width: 300px; z-index: 70; }

/* ---------- aplicação com servidor ---------- */

.app { height: 100%; display: flex; flex-direction: column; min-height: 0; overflow: clip; }

.conn {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #e0a33a;
  box-shadow: 0 0 0 3px rgba(224, 163, 58, .2);
  margin-right: 4px;
}
.conn.is-on { background: #22c55e; box-shadow: 0 0 0 3px rgba(34, 197, 94, .2); }

.msg-avatar { position: relative; }
.presence-dot {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 2px solid var(--surface);
  background: #9c9c9c;
}
.presence-dot.on { background: #22c55e; }

/* ---------- entrada ---------- */

.auth {
  height: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  place-items: center;
  padding: 28px;
  overflow-y: auto;
  background:
    radial-gradient(900px 420px at 18% -10%, rgba(110, 86, 207, .30), transparent 70%),
    radial-gradient(700px 380px at 100% 110%, rgba(232, 150, 63, .18), transparent 65%),
    linear-gradient(135deg, #111318 0%, #151821 58%, #1f222b 100%);
}

.auth-card {
  width: 420px;
  max-width: 100%;
  background: var(--surface);
  color: var(--ink);
  border-radius: 14px;
  padding: 26px 28px 22px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .35);
}

.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.auth-brand h1 { margin: 0; font-size: 24px; font-weight: 900; letter-spacing: -.01em; }
.auth-brand p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.brand-mark { width: 40px; height: 40px; display: flex; flex: none; }
.brand-mark svg { width: 40px; height: 40px; }

.auth-tabs { display: flex; gap: 6px; margin-bottom: 16px; border-bottom: 1px solid var(--border); }
.auth-tab {
  padding: 8px 10px;
  font-size: 14px;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.auth-tab.is-active { color: var(--ink); font-weight: 700; border-bottom-color: var(--accent); }

.auth .field { margin-bottom: 12px; }
.auth .field input { height: 40px; }
.auth-submit { width: 100%; height: 38px; margin-top: 6px; }
.auth-error {
  margin: 0 0 10px;
  padding: 8px 10px;
  border-radius: 6px;
  background: #f3e3e3;
  color: #914747;
  font-size: 13px;
}
html[data-theme="dark"] .auth-error { background: #4a2028; color: #ffb3c1; }
.auth-hint { margin: 16px 0 0; font-size: 12px; color: var(--muted); line-height: 1.6; }
.auth-hint code {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0 3px;
  font-size: 11px;
}

@media (max-width: 900px) {
  :root { --sidebar-w: 290px; --rail-w: 60px; }
  .cards { grid-template-columns: 1fr; }
  .thread { display: none; }
}

/* ---------- histórico, menções, administração ---------- */

.load-older { text-align: center; padding: 6px 0 2px; }
.load-older .btn { font-size: 13px; height: 28px; }

.badge.mention {
  background: var(--danger);
  color: #fff;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
}

.admin-row { display: flex; align-items: center; gap: 10px; padding: 8px 6px; border-radius: 6px; }
.admin-row:hover { background: var(--hover); }
.admin-row .who { min-width: 0; flex: 1; }
.admin-row .who .name { font-weight: 700; display: block; }
.admin-row .who .title { color: var(--muted); font-size: 12px; }
.admin-actions { display: flex; gap: 6px; }
.admin-actions .btn { height: 26px; font-size: 12px; padding: 0 8px; }
.tag-admin {
  font-size: 10px;
  border-radius: 3px;
  padding: 0 4px;
  background: var(--accent);
  color: #ffffff;
  margin-left: 6px;
  vertical-align: 1px;
}

.explore-row { display: flex; align-items: center; gap: 10px; padding: 8px 6px; border-radius: 6px; }
.explore-row:hover { background: var(--hover); }
.explore-row .who { flex: 1; min-width: 0; }
.explore-row .name { font-weight: 700; }
.explore-row .title { color: var(--muted); font-size: 12px; display: block; }
.modal.wide { width: min(620px, 100%); }
.side-head .side-add + .side-add { margin-left: 0; }

/* ---------- anexos ---------- */

.pending-files { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 12px; }
.pending-files:not(:empty) { padding-top: 8px; }
.pending-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 320px;
  padding: 3px 6px 3px 10px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-2);
  font-size: 12px;
}
.pending-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pending-size { color: var(--muted); }
.pending-remove { width: 18px; height: 18px; border-radius: 50%; color: var(--muted); line-height: 1; }
.pending-remove:hover { background: var(--border); color: var(--ink); }

.attachments { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.attachments-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.attachment-image { display: block; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; max-width: 320px; }
.attachment-image img { display: block; max-width: 320px; max-height: 220px; object-fit: contain; background: var(--surface-2); }
.attachment-file {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 360px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--ink);
  text-decoration: none;
  font-size: 13px;
}
.attachment-file:hover { border-color: var(--muted); }
.attachment-file svg { width: 18px; height: 18px; color: var(--muted); flex: none; }
.attachment-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attachment-size { color: var(--muted); flex: none; }

/* ---------- abas de administração ---------- */

.admin-tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--border); margin: 4px 0 12px; }
.admin-tabs .tab { padding: 8px 10px; }
.audit-list { max-height: 46vh; overflow-y: auto; margin: 0 -6px; }
.audit-row { display: grid; grid-template-columns: 92px 1fr; gap: 10px; padding: 7px 6px; border-bottom: 1px solid var(--border); font-size: 13px; }
.audit-row:last-child { border-bottom: 0; }
.audit-when { color: var(--muted); font-size: 12px; }
.audit-action { font-weight: 700; }
.audit-meta { color: var(--muted); font-size: 12px; }
.audit-hash { font-family: ui-monospace, Menlo, monospace; font-size: 10px; color: var(--muted); }
.policy-grid { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; font-size: 13px; }
.policy-grid dt { color: var(--muted); }
.policy-grid dd { margin: 0; font-weight: 600; text-align: right; }
.hold-row { display: flex; align-items: center; gap: 8px; padding: 6px 4px; font-size: 13px; border-bottom: 1px solid var(--border); }
.hold-row:last-child { border-bottom: 0; }
.hold-row .reason { flex: 1; color: var(--muted); }
.admin-form { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 10px 0; }
.admin-form select, .admin-form input {
  height: 32px; border: 1px solid var(--border-strong); border-radius: 6px; padding: 0 8px; background: var(--surface); color: var(--ink);
  min-width: 0;
}
.admin-form input { flex: 1 1 160px; }
.admin-form select { flex: 0 1 auto; max-width: 100%; }
.admin-form .btn { flex: none; white-space: nowrap; }
.admin-actions-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }

/* ---------- mobile nav, arquivos, convites, notificações ---------- */

.mobile-only { display: none; }
.nav-backdrop { display: none; }
.field-inline { display: block; margin-bottom: 4px; font-size: 13px; color: var(--muted); }
#notification-level { height: 32px; border: 1px solid var(--border-strong); border-radius: 6px; background: var(--surface); color: var(--ink); padding: 0 8px; }

.files-view { max-width: 900px; }
.file-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin: 8px 0;
  color: inherit;
  text-decoration: none;
  background: var(--surface);
}
.file-row:hover { border-color: var(--border-strong); background: var(--hover); }
.file-preview {
  width: 54px;
  height: 54px;
  border-radius: 6px;
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  overflow: hidden;
  color: var(--muted);
}
.file-preview img { width: 100%; height: 100%; object-fit: cover; }
.file-body { display: flex; flex-direction: column; min-width: 0; }
.file-name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-meta { color: var(--muted); font-size: 12px; }
.file-context { color: var(--ink-soft); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.invite-list { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.invite-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; border-bottom: 1px solid var(--border); padding: 6px 0; }
.invite-link { font-family: ui-monospace, Menlo, monospace; font-size: 12px; }
.search-results .sr-more { display: block; width: 100%; margin: 6px 0; }

@media (max-width: 900px) {
  :root { --sidebar-w: 290px; --rail-w: 60px; }
  .mobile-only { display: inline-flex; }
  .rail { display: none; }
  .sidebar {
    position: fixed;
    top: var(--topbar-h);
    bottom: 0;
    left: 0;
    width: min(320px, 88vw);
    z-index: 50;
    transform: translateX(-105%);
    transition: transform .18s ease;
    box-shadow: var(--shadow);
  }
  .app.nav-open .sidebar { transform: none; }
  .nav-backdrop:not([hidden]) {
    display: block;
    position: fixed;
    inset: var(--topbar-h) 0 0 0;
    z-index: 40;
    background: rgba(0, 0, 0, .45);
  }
  .topbar { grid-template-columns: auto minmax(0, 1fr) auto; }
  .topbar-search { min-width: 0; }
  .topbar-left { justify-content: flex-start; }
  .topbar-right .conn { display: none; }
  .thread {
    display: flex;
    position: fixed;
    inset: var(--topbar-h) 0 0 0;
    width: 100%;
    max-width: none;
    z-index: 55;
    border-left: 0;
  }
  .channel-head { padding: 0 8px; gap: 4px; }
  .channel-title { min-width: 0; max-width: 40%; flex-shrink: 0; }
  .head-actions { min-width: 0; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: thin; }
  .head-actions > * { flex: none; white-space: nowrap; }
  .head-btn { padding: 0 6px; font-size: 12px; }
  .channel-tabs { gap: 16px; padding: 0 12px; overflow-x: auto; overscroll-behavior-x: contain; }
  .channel-tabs .tab { flex: none; white-space: nowrap; }
  .messages { padding-left: 2px; padding-right: 2px; }
  .composer-wrap { padding: 0 8px 10px; }
  .about { padding: 18px 16px; }
  .cards { grid-template-columns: 1fr; }
  .field-row { grid-template-columns: 1fr; }
  .modal .btn { max-width: 100%; height: auto; min-height: 30px; white-space: normal; }
  .admin-tabs { overflow-x: auto; overscroll-behavior-x: contain; }
  .admin-tabs .tab { flex: none; white-space: nowrap; }
  .admin-row { flex-wrap: wrap; }
  .admin-row .who { flex-basis: 120px; }
  .admin-actions { width: 100%; flex-wrap: wrap; }
}

@media (max-width: 900px) {
  .msg-toolbar {
    display: flex;
    opacity: 0;
    pointer-events: none;
    transition: opacity .12s ease;
  }
  .msg:focus-within .msg-toolbar,
  .msg:hover .msg-toolbar {
    opacity: 1;
    pointer-events: auto;
  }
}


/* ---------- paridade Slack: vistas, menus, formato e pins ---------- */
.view-row .view-ico { width: 18px; text-align: center; font-size: 14px; }
.link-btn { background: none; border: 0; color: var(--accent); cursor: pointer; padding: 0 4px; font: inherit; }
.link-btn:hover { text-decoration: underline; }
.msg-menu {
  position: absolute; right: 12px; top: 34px; z-index: 30; min-width: 210px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,.18); padding: 6px; display: flex; flex-direction: column;
}
.msg-menu button {
  text-align: left; border: 0; background: none; color: var(--text); padding: 7px 10px;
  border-radius: 6px; cursor: pointer; font: inherit;
}
.msg-menu button:hover, .msg-menu button:focus-visible { background: var(--hover); outline: none; }
.msg { position: relative; }
.forward-attribution {
  font-size: 12px; color: var(--muted); border-left: 2px solid var(--accent);
  padding-left: 8px; margin-bottom: 4px;
}
.pinned-chip, .saved-chip { font-size: 11px; color: var(--muted); margin-left: 6px; }
.unread-divider {
  display: flex; align-items: center; gap: 8px; color: var(--accent);
  font-size: 12px; font-weight: 600; margin: 10px 0;
}
.unread-divider::before, .unread-divider::after { content: ''; flex: 1; border-top: 1px solid var(--accent); opacity: .5; }
.pinned-item, .saved-item, .thread-item {
  border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; margin: 10px 0;
  background: var(--surface);
}
.pinned-meta, .thread-item .activity-meta { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.thread-actions { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.bookmark-row { display: flex; align-items: center; gap: 10px; padding: 4px 0; }
.bookmark-row a { flex: 1; color: var(--accent); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-scope { font-size: 12px; color: var(--muted); padding: 6px 10px; border-bottom: 1px solid var(--border); }
.chip { border: 1px solid var(--border); background: transparent; color: var(--text); border-radius: 999px; padding: 4px 10px; cursor: pointer; font: inherit; }
.chip.is-active { background: var(--accent); color: #ffffff; border-color: var(--accent); }
.head-select { background: var(--surface); color: var(--ink); border: 1px solid var(--border); border-radius: 6px; padding: 3px 6px; font: inherit; max-width: 110px; }
@supports (appearance: base-select) and selector(select::picker(select)) {
  .head-select, .head-select::picker(select) { appearance: base-select; }
  .head-select::picker(select) {
    background: var(--surface); color: var(--ink); border: 1px solid var(--border);
    border-radius: 6px; box-shadow: var(--shadow);
  }
  .head-select option { padding: 6px 10px; }
  .head-select option:checked { background: var(--chip-active); }
  .head-select option:hover, .head-select option:focus-visible { background: var(--hover); }
}
.group-avatar { width: 24px; height: 24px; border-radius: 6px; background: var(--accent); color: #ffffff; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; }
.emoji-custom { width: 1.4em; height: 1.4em; vertical-align: -0.25em; object-fit: contain; }
.emoji-shortcode { font-style: normal; }
.unread-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); display: inline-block; margin-left: 6px; }
.msg-text h1, .msg-text h2, .msg-text h3, .msg-text h4, .msg-text h5, .msg-text h6 { margin: 8px 0 4px; line-height: 1.25; }
.msg-text h1 { font-size: 1.5em; } .msg-text h2 { font-size: 1.3em; } .msg-text h3 { font-size: 1.15em; }
.msg-text ul, .msg-text ol { margin: 4px 0; padding-left: 22px; }
.msg-text blockquote { margin: 6px 0; padding-left: 10px; border-left: 3px solid var(--border); color: var(--muted); }
.msg-text pre { background: var(--code-bg); color: var(--ink); border: 1px solid var(--border); border-radius: 6px; padding: 8px 10px; overflow-x: auto; }
.msg-text pre code { background: none; padding: 0; }
.msg-text p { margin: 2px 0; }
.msg.is-flash { animation: eslaque-flash 1.6s ease; }
@keyframes eslaque-flash { 0% { background: rgba(242,199,68,.35); } 100% { background: transparent; } }


.previews { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.preview-card {
  display: flex; gap: 10px; max-width: 420px; border: 1px solid var(--border);
  border-radius: 8px; padding: 8px; text-decoration: none; color: var(--text); background: var(--surface);
}
.preview-image { width: 72px; height: 72px; object-fit: cover; border-radius: 6px; }
.preview-body { display: flex; flex-direction: column; min-width: 0; }
.preview-site { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .02em; }
.preview-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.preview-desc { font-size: 12px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.thread-quick { display: flex; gap: 8px; margin-top: 8px; }
.thread-quick input { flex: 1; border: 1px solid var(--border); border-radius: 6px; padding: 6px 8px; background: var(--surface); color: var(--text); }
.member-picker { max-height: 240px; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.reminder-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 3px 0; }
.automations-view { max-width: 920px; }
.automation-section { margin: 28px 0 12px; font-size: 16px; }
.automation-card { border: 1px solid var(--border); border-radius: 8px; padding: 16px; margin: 12px 0; background: var(--surface); }
.automation-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.automation-heading h3 { margin: 0; font-size: 15px; overflow-wrap: anywhere; }
.automation-status { font-size: 12px; color: var(--muted); }
.automation-text { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; margin: 8px 0; }
.automation-card .audit-meta { overflow-wrap: anywhere; margin: 6px 0; }
.automation-error { color: var(--ink); border-left: 3px solid var(--accent); padding: 8px 10px; font-size: 13px; }
.automation-note { margin-top: 24px; }
.automation-attribution { font-size: 11px; color: var(--muted); margin: 2px 0 4px; }
.modal .field select, .modal .field textarea, .modal .field input[type="datetime-local"] {
  width: 100%; max-width: 100%; border: 1px solid var(--border-strong); border-radius: 6px;
  padding: 8px 10px; background: var(--surface); color: var(--ink); font: inherit;
}
.modal .field textarea { resize: vertical; }
.file-row-wrap { display: flex; align-items: center; gap: 8px; }
.file-row-wrap .file-row { flex: 1; }
.file-versions { font-size: 12px; color: var(--muted); white-space: nowrap; }
.file-versions a { color: var(--accent); margin: 0 2px; }
