/* ============================================================
   Clank — app.css
   Base tokens, layout frame, top bar, sidebar, channel header
   ============================================================ */

@font-face {
  font-family: 'Slack-Lato';
  src: url('../assets/fonts/lato-400.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Slack-Lato';
  src: url('../assets/fonts/lato-700.woff2') format('woff2');
  font-weight: 700; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Slack-Lato';
  src: url('../assets/fonts/lato-900.woff2') format('woff2');
  font-weight: 900; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Slack-Lato';
  src: url('../assets/fonts/lato-400i.woff2') format('woff2');
  font-weight: 400; font-style: italic; font-display: swap;
}

:root {
  /* palette */
  --aubergine: #3F0E40;
  --aubergine-deep: #350D36;
  --aubergine-hover: rgba(255,255,255,.08);
  --aubergine-active: #1164A3;
  --sidebar-text: rgba(255,255,255,.72);
  --sidebar-text-dim: rgba(255,255,255,.5);
  --red: #E01E5A;
  --blue: #1264A3;
  --link: #1264A3;
  --green: #007A5A;
  --presence-green: #2BAC76;
  --yellow: #ECB22E;
  --sky: #36C5F0;
  --ink: #1D1C1D;
  --ink-60: #616061;
  --ink-40: #868686;
  --hairline: rgba(29,28,29,.13);
  --hairline-strong: rgba(29,28,29,.3);
  --hover-bg: #F8F8F8;
  --active-blue-bg: #E8F5FA;
  --mention-bg: rgba(242,199,68,.22);
  --select: rgba(29,155,209,.3);
  --code-red: #E01E5A;
  --mono: 'Monaco','Menlo','Consolas','Courier New',monospace;
  --font: 'Slack-Lato','Lato',-apple-system,BlinkMacSystemFont,'Segoe UI','Helvetica Neue',sans-serif;
  --shadow-1: 0 0 0 1px rgba(29,28,29,.13), 0 4px 12px 0 rgba(0,0,0,.08);
  --shadow-2: 0 0 0 1px rgba(29,28,29,.13), 0 4px 12px 0 rgba(0,0,0,.12);
  --shadow-menu: 0 0 0 1px rgba(29,28,29,.1), 0 4px 16px 0 rgba(0,0,0,.16);
  --radius: 8px;
  --topbar-h: 44px;
  --sidebar-w: 260px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  font-size: 15px;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  background: #fff;
}
button { font-family: inherit; font-size: inherit; color: inherit; background: none; border: none; cursor: pointer; }
input, textarea, select { font-family: inherit; font-size: inherit; color: inherit; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
::selection { background: var(--select); }
[hidden] { display: none !important; }

/* scrollbars */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(29,28,29,.25); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(29,28,29,.4); }
.sidebar ::-webkit-scrollbar-thumb { background: rgba(255,255,255,.22); }
.sidebar ::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.35); }

/* ============ Splash ============ */
#splash {
  position: fixed; inset: 0; z-index: 1000;
  background: var(--aubergine);
  display: flex; align-items: center; justify-content: center;
  transition: opacity .45s ease;
}
#splash.gone { opacity: 0; pointer-events: none; }
.splash-inner { display: flex; flex-direction: column; align-items: center; gap: 18px; }
.splash-logo { width: 84px; height: 84px; animation: splashbob 1.6s ease-in-out infinite; }
.splash-logo svg { width: 100%; height: 100%; }
@keyframes splashbob { 0%,100% { transform: translateY(0) rotate(0deg);} 50% { transform: translateY(-8px) rotate(4deg);} }
.splash-word {
  font-weight: 900; font-size: 42px; letter-spacing: -1.5px; color: #fff; line-height: 1;
}
.splash-quip { color: rgba(255,255,255,.6); font-size: 14px; min-height: 20px; font-style: italic; }

/* ============ App frame ============ */
.app { display: flex; flex-direction: column; height: 100vh; min-width: 900px; }
.body { display: flex; flex: 1; min-height: 0; }

/* ============ Top bar ============ */
.topbar {
  height: var(--topbar-h); flex: 0 0 var(--topbar-h);
  background: #fff;
  border-bottom: 1px solid var(--hairline);
  display: flex; align-items: center;
  padding: 0 12px 0 16px;
  gap: 8px;
  -webkit-app-region: drag;
}
.topbar-left { display: flex; gap: 2px; width: 220px; }
.topbar-center { flex: 1; display: flex; justify-content: center; }
.topbar-right { display: flex; gap: 6px; width: 220px; justify-content: flex-end; align-items: center; }
.tb-icon-btn {
  width: 28px; height: 28px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-60);
  transition: background .12s;
}
.tb-icon-btn:hover { background: var(--hover-bg); color: var(--ink); }
.tb-icon-btn:disabled { color: rgba(29,28,29,.3); cursor: default; background: none; }
.tb-icon-btn svg { width: 18px; height: 18px; }
.tb-search {
  display: flex; align-items: center; gap: 8px;
  width: min(640px, 60vw); height: 28px;
  background: #F8F8F8;
  border: 1px solid var(--hairline);
  border-radius: 6px; padding: 0 10px;
  color: var(--ink-60); font-size: 13px;
  transition: background .12s, border-color .12s;
}
.tb-search:hover { background: #fff; border-color: var(--hairline-strong); color: var(--ink); }
.tb-search-icon svg { width: 14px; height: 14px; display: block; }
.tb-search-label { flex: 1; text-align: left; }
.tb-search-kbd {
  font-size: 11px; color: var(--ink-40);
  border: 1px solid var(--hairline); border-radius: 4px; padding: 0 4px; background: #fff;
}
.tb-avatar { position: relative; width: 28px; height: 28px; border-radius: 6px; overflow: visible; }
.tb-avatar img { width: 28px; height: 28px; border-radius: 6px; display: block; }
.tb-avatar:hover { outline: 2px solid rgba(29,28,29,.25); }

/* presence dot (context-colored ring) */
.presence {
  position: absolute; right: -2px; bottom: -2px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--presence-green);
  border: 2px solid var(--aubergine);
}
.presence.away { background: transparent; border-width: 2px; border-color: rgba(255,255,255,.75); width: 8px; height: 8px; box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.75); }
.presence.dnd { background: var(--red); }
.presence.on-white { border-color: #fff; }
.presence.away.on-white { border-color: var(--ink-60); box-shadow: inset 0 0 0 1.5px var(--ink-60); }
.presence .dnd-z {
  position: absolute; font-size: 7px; font-weight: 900; color: #fff;
  left: 50%; top: 50%; transform: translate(-50%,-50%); line-height: 1;
}

/* ============ Sidebar ============ */
.sidebar {
  width: var(--sidebar-w); flex: 0 0 var(--sidebar-w);
  background: var(--aubergine);
  color: var(--sidebar-text);
  display: flex; flex-direction: column;
  font-size: 15px;
  user-select: none;
}
.ws-header {
  display: flex; align-items: center;
  height: 49px; padding: 0 16px 0 19px;
  border-bottom: 1px solid rgba(255,255,255,.13);
  flex: 0 0 auto;
}
.ws-name {
  display: flex; align-items: center; gap: 6px;
  color: #fff; font-weight: 900; font-size: 18px; letter-spacing: -.25px;
  padding: 4px 6px 4px 0; border-radius: 6px; flex: 1; min-width: 0;
}
.ws-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws-name svg { width: 12px; height: 12px; flex: 0 0 auto; opacity: .7; }
.ws-name:hover { background: var(--aubergine-hover); }
.ws-compose {
  width: 34px; height: 34px; border-radius: 50%;
  background: #fff; color: var(--aubergine);
  display: flex; align-items: center; justify-content: center;
  flex: 0 0 auto;
  box-shadow: 0 1px 3px rgba(0,0,0,.3);
  transition: transform .1s;
}
.ws-compose:hover { transform: scale(1.06); }
.ws-compose svg { width: 18px; height: 18px; }

.sidebar-scroll { flex: 1; overflow-y: auto; overflow-x: hidden; padding-bottom: 24px; }

/* top nav rows (Threads / Later / Activity) */
.sb-nav { padding: 8px 0 4px; }
.sb-row {
  display: flex; align-items: center; gap: 8px;
  height: 28px; padding: 0 16px 0 19px;
  color: var(--sidebar-text); cursor: pointer;
  position: relative;
}
.sb-row:hover { background: var(--aubergine-hover); }
.sb-row.active { background: var(--aubergine-active); color: #fff; }
.sb-row-icon { width: 20px; height: 20px; flex: 0 0 auto; display: flex; align-items: center; justify-content: center; opacity: .9; }
.sb-row-icon svg { width: 16px; height: 16px; }
.sb-row-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* badges */
.badge {
  min-width: 18px; height: 18px; padding: 0 5px;
  background: var(--red); color: #fff;
  font-size: 12px; font-weight: 700; line-height: 18px; text-align: center;
  border-radius: 9px; flex: 0 0 auto;
}
.badge.mention { background: var(--red); }
.badge.muted-badge { background: rgba(255,255,255,.25); color: #fff; }
.sb-row.unread .sb-row-label { color: #fff; font-weight: 700; }
.sb-row .draft-mark { color: var(--sidebar-text-dim); display: flex; }
.sb-row .draft-mark svg { width: 14px; height: 14px; }

/* section headers */
.sb-section { margin-top: 12px; }
.sb-section-head {
  display: flex; align-items: center;
  height: 26px; padding: 0 12px 0 19px;
  color: var(--sidebar-text); cursor: pointer;
}
.sb-section-head:hover { color: #fff; }
.sb-section-caret { width: 14px; height: 14px; margin-right: 2px; display: flex; align-items: center; transition: transform .15s; }
.sb-section-caret svg { width: 12px; height: 12px; }
.sb-section.closed .sb-section-caret { transform: rotate(-90deg); }
.sb-section-title { flex: 1; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-section-add {
  width: 22px; height: 22px; border-radius: 4px;
  display: none; align-items: center; justify-content: center; color: var(--sidebar-text);
}
.sb-section-add svg { width: 14px; height: 14px; }
.sb-section-add:hover { background: var(--aubergine-hover); color: #fff; }
.sb-section-head:hover .sb-section-add { display: flex; }
.sb-section.closed .sb-section-items { display: none; }

/* channel rows */
.sb-chan-icon { width: 20px; height: 20px; flex: 0 0 auto; display: flex; align-items: center; justify-content: center; opacity: .85; }
.sb-chan-icon svg { width: 15px; height: 15px; }
.sb-row .dm-avatar { position: relative; width: 20px; height: 20px; flex: 0 0 auto; }
.sb-row .dm-avatar img { width: 20px; height: 20px; border-radius: 4px; display: block; }
.sb-row .dm-presence {
  position: absolute; right: -3px; bottom: -3px; width: 9px; height: 9px;
  border-radius: 50%; background: var(--presence-green); border: 2px solid var(--aubergine);
}
.sb-row .dm-presence.away { background: transparent; box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.7); border-color: transparent; }
.sb-row .dm-presence.dnd { background: var(--red); }
.sb-row .dm-presence.dnd::after {
  content: 'z'; position: absolute; font-size: 6px; font-weight: 900; color: #fff;
  left: 50%; top: 50%; transform: translate(-50%,-52%);
}
.sb-you-suffix { color: var(--sidebar-text-dim); font-weight: 400; margin-left: 4px; }
.sb-row.active .sb-you-suffix { color: rgba(255,255,255,.75); }

/* ============ Main column ============ */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; background: #fff; }
.channel-view { display: flex; flex-direction: column; flex: 1; min-height: 0; }

/* ============ Channel header ============ */
.channel-header {
  flex: 0 0 auto;
  border-bottom: 1px solid var(--hairline);
  padding: 0 16px 0 20px;
  min-height: 49px;
  display: flex; align-items: center; gap: 4px;
  background: #fff; z-index: 5;
}
.ch-title {
  display: flex; align-items: center; gap: 6px;
  padding: 3px 7px; margin-left: -7px; border-radius: 6px;
  font-weight: 900; font-size: 18px; letter-spacing: -.25px;
  cursor: pointer; max-width: 46%;
}
.ch-title:hover { background: var(--hover-bg); }
.ch-title svg.ch-caret { width: 12px; height: 12px; color: var(--ink-60); flex: 0 0 auto; }
.ch-title .ch-title-icon { width: 18px; height: 18px; display: flex; align-items: center; color: var(--ink); }
.ch-title .ch-title-icon svg { width: 16px; height: 16px; }
.ch-title span.ch-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-title .dm-title-presence { position: relative; width: 9px; height: 9px; flex: 0 0 auto; border-radius: 50%; background: var(--presence-green); }
.ch-title .dm-title-presence.away { background: transparent; box-shadow: inset 0 0 0 1.5px var(--ink-60); }
.ch-title .dm-title-presence.dnd { background: var(--red); }

.ch-topic {
  color: var(--ink-60); font-size: 13px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  flex: 1; min-width: 0; cursor: text;
  padding: 4px 6px; border-radius: 4px;
}
.ch-topic:hover { background: var(--hover-bg); }
.ch-topic:empty { display: none; }
.ch-header-spacer { flex: 1; }
.ch-actions { display: flex; align-items: center; gap: 2px; margin-left: auto; }
.ch-action-btn {
  height: 32px; min-width: 32px; padding: 0 6px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  color: var(--ink-60); font-size: 13px;
  position: relative;
}
.ch-action-btn:hover { background: var(--hover-bg); color: var(--ink); }
.ch-action-btn svg { width: 18px; height: 18px; }
.ch-action-btn .count { font-size: 13px; }
.ch-members-facepile { display: flex; align-items: center; }
.ch-members-facepile img { width: 22px; height: 22px; border-radius: 4px; border: 2px solid #fff; margin-left: -6px; }
.ch-members-facepile img:first-child { margin-left: 0; }
.ch-pin-btn.has-pins { color: var(--ink); }
.ch-pin-btn .pin-count { font-size: 13px; }
.ch-action-btn.in-huddle { color: var(--green); background: rgba(0,122,90,.08); }
