/* BetterSlacker — design tokens, layout and components. No build step, no dependencies. */

:root {
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --r-sm: 6px;
  --r: 10px;
  --r-lg: 16px;
  --ease: cubic-bezier(.2, .8, .2, 1);
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d0e12;
  --rail: #08090c;
  --side: #111318;
  --surface: #171a21;
  --raised: #1e222b;
  --hover: rgba(255, 255, 255, .055);
  --active: rgba(139, 123, 255, .17);
  --border: rgba(255, 255, 255, .08);
  --border-strong: rgba(255, 255, 255, .15);
  --text: #e9ebf1;
  --text-2: #a7acbb;
  --text-3: #6d7384;
  --accent: #8b7bff;
  --accent-2: #5cc8ff;
  --accent-text: #b5abff;
  --green: #3ddc97;
  --amber: #ffb454;
  --red: #ff6b6b;
  --blue: #5cc8ff;
  --shadow: 0 18px 50px rgba(0, 0, 0, .55), 0 2px 8px rgba(0, 0, 0, .3);
  --glow: radial-gradient(1200px 500px at 85% -10%, rgba(139, 123, 255, .13), transparent 60%);
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #ffffff;
  --rail: #17162b;
  --side: #f4f4f9;
  --surface: #ffffff;
  --raised: #f5f5fa;
  --hover: rgba(22, 20, 50, .055);
  --active: rgba(108, 92, 231, .13);
  --border: rgba(22, 20, 50, .1);
  --border-strong: rgba(22, 20, 50, .2);
  --text: #191a22;
  --text-2: #535869;
  --text-3: #8b90a1;
  --accent: #6c5ce7;
  --accent-2: #0a9fd0;
  --accent-text: #5847d8;
  --green: #0f9d67;
  --amber: #c27308;
  --red: #d63f4b;
  --blue: #0a7fc4;
  --shadow: 0 18px 50px rgba(30, 25, 80, .16), 0 2px 8px rgba(30, 25, 80, .08);
  --glow: radial-gradient(1200px 500px at 85% -10%, rgba(108, 92, 231, .09), transparent 60%);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font: 14px/1.5 var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
}
h1, h2, h3, h4, p { margin: 0; }
h1 { font-size: 26px; line-height: 1.2; letter-spacing: -.02em; font-weight: 700; }
h2 { font-size: 18px; letter-spacing: -.01em; font-weight: 650; }
h3 { font-size: 14px; font-weight: 650; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { flex: none; }
::selection { background: color-mix(in srgb, var(--accent) 40%, transparent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
[hidden] { display: none !important; }

.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.small { font-size: 12px; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.spacer { flex: 1; }
.hstack { display: flex; align-items: center; gap: 8px; min-width: 0; }
.vstack { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.wrap { flex-wrap: wrap; }
.gap-lg { gap: 16px; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.kbd { font: 11px var(--mono); padding: 1px 5px; border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 4px; color: var(--text-2); }

/* ---------- Boot ---------- */
.boot { height: 100vh; display: grid; place-items: center; }
.boot-mark { width: 44px; height: 44px; border-radius: 13px; background: linear-gradient(135deg, var(--accent), var(--accent-2)); animation: pulse 1.2s var(--ease) infinite alternate; }
@keyframes pulse { from { transform: scale(.86); opacity: .55; } to { transform: scale(1); opacity: 1; } }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 34px; padding: 0 13px; border-radius: var(--r-sm);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font-weight: 550; white-space: nowrap; user-select: none;
  transition: background .12s, border-color .12s, transform .06s, opacity .12s;
}
.btn:hover { background: var(--raised); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: transparent; color: #fff; box-shadow: 0 1px 0 rgba(255, 255, 255, .18) inset, 0 4px 14px color-mix(in srgb, var(--accent) 35%, transparent); }
.btn.primary:hover { background: color-mix(in srgb, var(--accent) 88%, #fff); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--hover); color: var(--text); }
.btn.danger { color: var(--red); border-color: color-mix(in srgb, var(--red) 45%, transparent); background: transparent; }
.btn.danger:hover { background: color-mix(in srgb, var(--red) 12%, transparent); }
.btn.sm { height: 28px; padding: 0 9px; font-size: 12.5px; }
.btn.icon { width: 34px; padding: 0; }
.btn.icon.sm { width: 28px; }
.btn.block { width: 100%; height: 40px; }
.btn.on { background: var(--active); color: var(--accent-text); border-color: transparent; }

.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--raised); border: 1px solid var(--border); border-radius: 8px; }
.seg button { border: 0; background: transparent; height: 26px; padding: 0 10px; border-radius: 6px; color: var(--text-2); font-weight: 550; font-size: 12.5px; display: inline-flex; align-items: center; gap: 6px; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .18); }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.field > label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.field .hint { font-size: 12px; color: var(--text-3); }
.field .err, .form-err { font-size: 12.5px; color: var(--red); }
.form-err { padding: 9px 11px; margin-bottom: 12px; border-radius: var(--r-sm); background: color-mix(in srgb, var(--red) 11%, transparent); border: 1px solid color-mix(in srgb, var(--red) 30%, transparent); }
.inp {
  width: 100%; min-height: 36px; padding: 7px 10px; border-radius: var(--r-sm);
  border: 1px solid var(--border-strong); background: var(--bg); color: var(--text);
  transition: border-color .12s, box-shadow .12s;
}
.inp::placeholder { color: var(--text-3); }
.inp:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
textarea.inp { resize: vertical; line-height: 1.5; }
select.inp { appearance: none; padding-right: 28px; background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%), linear-gradient(135deg, var(--text-3) 50%, transparent 50%); background-position: calc(100% - 15px) 55%, calc(100% - 10px) 55%; background-size: 5px 5px; background-repeat: no-repeat; }
.inp.bare { border-color: transparent; background: transparent; padding-left: 6px; margin-left: -6px; }
.inp.bare:hover { background: var(--hover); }
.inp.bare:focus { background: var(--bg); border-color: var(--accent); }
.inp.title { font-size: 20px; font-weight: 650; letter-spacing: -.01em; }
.inp.sm { min-height: 28px; padding: 3px 8px; font-size: 12.5px; }
select.inp.sm { padding-right: 24px; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.checks { display: flex; flex-direction: column; gap: 2px; max-height: 190px; overflow: auto; padding: 4px; border: 1px solid var(--border-strong); border-radius: var(--r-sm); }
.checks label { display: flex; align-items: center; gap: 8px; padding: 5px 7px; border-radius: 5px; cursor: pointer; font-weight: 500; color: var(--text); }
.checks label:hover { background: var(--hover); }
input[type="checkbox"] { accent-color: var(--accent); width: 15px; height: 15px; margin: 0; }
input[type="color"].inp { padding: 3px; height: 36px; }

/* ---------- App frame ---------- */
.app { display: grid; grid-template-columns: 60px 268px minmax(0, 1fr); height: 100vh; background: var(--bg); }
.app.has-thread { grid-template-columns: 60px 268px minmax(0, 1fr) minmax(320px, 400px); }

.rail { background: var(--rail); display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 12px 0; border-right: 1px solid var(--border); }
.rail-ws { width: 38px; height: 38px; border-radius: 11px; border: 0; background: rgba(255, 255, 255, .09); color: #fff; font-weight: 700; font-size: 14px; position: relative; transition: border-radius .18s var(--ease), background .15s; }
.rail-ws:hover { border-radius: 14px; background: rgba(255, 255, 255, .16); }
.rail-ws.on { background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 45%, transparent); }
.rail-ws.on::before { content: ""; position: absolute; left: -11px; top: 9px; bottom: 9px; width: 4px; border-radius: 0 4px 4px 0; background: #fff; }
.rail-btn { width: 38px; height: 38px; border-radius: 11px; border: 0; background: transparent; color: rgba(255, 255, 255, .6); display: grid; place-items: center; }
.rail-btn:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.rail-btn.dashed { border: 1px dashed rgba(255, 255, 255, .25); }

.side { background: var(--side); border-right: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; }
.side-head { height: 56px; padding: 0 10px 0 16px; display: flex; align-items: center; gap: 6px; border-bottom: 1px solid var(--border); }
.side-title { font-weight: 700; font-size: 15.5px; letter-spacing: -.01em; }
.side-search { margin: 10px 10px 4px; position: relative; }
.side-search svg { position: absolute; left: 9px; top: 9px; color: var(--text-3); pointer-events: none; }
.side-search .inp { padding-left: 30px; min-height: 32px; background: var(--hover); border-color: transparent; }
.side-scroll { flex: 1; overflow-y: auto; padding: 6px 8px 16px; }
.side-group { display: flex; align-items: center; padding: 14px 8px 4px; font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--text-3); }
.side-group button { margin-left: auto; width: 22px; height: 22px; border: 0; border-radius: 5px; background: transparent; color: var(--text-3); display: grid; place-items: center; }
.side-group button:hover { background: var(--hover); color: var(--text); }
.nav-item { display: flex; align-items: center; gap: 9px; height: 31px; padding: 0 8px; border-radius: 7px; color: var(--text-2); font-weight: 500; cursor: pointer; position: relative; }
.nav-item:hover { background: var(--hover); color: var(--text); text-decoration: none; }
.nav-item.on { background: var(--active); color: var(--text); }
.nav-item.on .nav-icon { color: var(--accent-text); }
.nav-item.unread { color: var(--text); font-weight: 700; }
.nav-icon { width: 18px; display: grid; place-items: center; color: var(--text-3); }
.nav-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--border-strong); color: var(--text); font-size: 11px; font-weight: 700; display: inline-grid; place-items: center; }
.badge.red { background: var(--red); color: #fff; }
.badge.accent { background: var(--accent); color: #fff; }
.side-foot { border-top: 1px solid var(--border); padding: 9px 10px; display: flex; align-items: center; gap: 9px; }
.side-foot .who { flex: 1; min-width: 0; line-height: 1.25; cursor: pointer; }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg); background-image: var(--glow); position: relative; }
.main-head { height: 56px; flex: none; padding: 0 18px; display: flex; align-items: center; gap: 12px; border-bottom: 1px solid var(--border); background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(10px); }
.head-title { font-weight: 700; font-size: 16px; letter-spacing: -.01em; display: flex; align-items: center; gap: 7px; min-width: 0; }
.head-sub { color: var(--text-3); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 0 1 auto; }
.head-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; flex: none; }
.main-body { flex: 1; overflow-y: auto; min-height: 0; }
.pad { padding: 24px 28px 48px; max-width: 1240px; width: 100%; margin: 0 auto; }
.menu-btn { display: none; }

/* ---------- Generic components ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 16px; }
.card.hover { transition: border-color .12s, transform .12s var(--ease), box-shadow .12s; cursor: pointer; }
.card.hover:hover { border-color: var(--border-strong); transform: translateY(-1px); box-shadow: 0 8px 24px rgba(0, 0, 0, .14); }
.card-title { display: flex; align-items: center; gap: 8px; font-weight: 650; margin-bottom: 12px; }
.card-title .muted { font-weight: 500; }
.grid { display: grid; gap: 14px; }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.section-head { display: flex; align-items: center; gap: 10px; margin: 26px 0 12px; }
.section-head:first-child { margin-top: 0; }

.stat { padding: 16px 18px; position: relative; overflow: hidden; }
.stat-num { font-size: 30px; font-weight: 700; letter-spacing: -.03em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-label { color: var(--text-2); font-size: 12.5px; font-weight: 550; margin-top: 3px; }
.stat::after { content: ""; position: absolute; right: -24px; top: -24px; width: 84px; height: 84px; border-radius: 50%; background: var(--tone, var(--accent)); opacity: .13; }
.stat[data-tone="red"] { --tone: var(--red); } .stat[data-tone="amber"] { --tone: var(--amber); } .stat[data-tone="green"] { --tone: var(--green); } .stat[data-tone="blue"] { --tone: var(--blue); }

.pill { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px; border-radius: 11px; font-size: 11.5px; font-weight: 650; white-space: nowrap; color: var(--tone, var(--text-2)); background: color-mix(in srgb, var(--tone, var(--text-3)) 15%, transparent); }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.plain::before { display: none; }
[data-tone="green"] { --tone: var(--green); } [data-tone="amber"] { --tone: var(--amber); } [data-tone="red"] { --tone: var(--red); }
[data-tone="blue"] { --tone: var(--blue); } [data-tone="violet"] { --tone: var(--accent-text); } [data-tone="gray"] { --tone: var(--text-3); }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-2); font-weight: 550; max-width: 100%; }
.chip i { width: 8px; height: 8px; border-radius: 3px; background: var(--c, var(--accent)); flex: none; }

.progress { height: 7px; border-radius: 4px; background: var(--hover); overflow: hidden; flex: 1; min-width: 40px; }
.progress > i { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, var(--tone, var(--accent)), color-mix(in srgb, var(--tone, var(--accent-2)) 70%, var(--accent-2))); transition: width .5s var(--ease); }
.progress.lg { height: 10px; border-radius: 5px; }
.stack-bar { display: flex; height: 8px; border-radius: 4px; overflow: hidden; background: var(--hover); gap: 2px; }
.stack-bar i { display: block; height: 100%; }

.avatar { --size: 32px; width: var(--size); height: var(--size); border-radius: 30%; display: inline-grid; place-items: center; font-weight: 700; font-size: calc(var(--size) * .39); color: #fff; flex: none; position: relative; user-select: none; background: hsl(var(--hue, 250) 55% 52%); letter-spacing: 0; }
.avatar.xs { --size: 20px; } .avatar.s { --size: 24px; } .avatar.l { --size: 40px; } .avatar.xl { --size: 64px; }
.avatar.bot { background: linear-gradient(135deg, #2b3040, #454c63); border-radius: 26%; }
.avatar .dot { position: absolute; right: -2px; bottom: -2px; width: 31%; height: 31%; min-width: 8px; min-height: 8px; border-radius: 50%; background: var(--text-3); border: 2px solid var(--side); }
.avatar .dot.on { background: var(--green); }
.avatars { display: inline-flex; }
.avatars .avatar { margin-left: -4px; box-shadow: 0 0 0 2px var(--surface); }
.avatars .avatar:first-child { margin-left: 0; }

.empty { text-align: center; padding: 44px 20px; color: var(--text-2); }
.empty .empty-icon { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; margin: 0 auto 12px; background: var(--active); color: var(--accent-text); }
.empty h3 { color: var(--text); font-size: 15px; margin-bottom: 4px; }

.list { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; gap: 10px; padding: 9px 8px; border-radius: 8px; min-width: 0; }
.row + .row { border-top: 1px solid var(--border); border-radius: 0; }
.row.click { cursor: pointer; }
.row.click:hover { background: var(--hover); }
.row .grow { flex: 1; min-width: 0; }
.done-text { text-decoration: line-through; color: var(--text-3); }
.check { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--border-strong); background: transparent; display: grid; place-items: center; flex: none; padding: 0; color: transparent; }
.check:hover { border-color: var(--green); color: var(--green); }
.check.on { background: var(--green); border-color: var(--green); color: #fff; }
.check.sq { border-radius: 5px; }

table.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); font-weight: 700; padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.tbl td { padding: 9px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tr.click { cursor: pointer; }
.tbl tr.click:hover td { background: var(--hover); }
.tbl tr:last-child td { border-bottom: 0; }

.prio { width: 8px; height: 8px; border-radius: 2px; transform: rotate(45deg); background: var(--text-3); flex: none; }
.prio[data-p="urgent"] { background: var(--red); box-shadow: 0 0 0 3px color-mix(in srgb, var(--red) 22%, transparent); } .prio[data-p="high"] { background: var(--amber); } .prio[data-p="medium"] { background: var(--blue); }
.due { font-size: 12px; color: var(--text-2); display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.due.late { color: var(--red); font-weight: 650; }
.due.soon { color: var(--amber); font-weight: 600; }

/* ---------- Chat ---------- */
.chat { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.msgs { flex: 1; overflow-y: auto; padding: 12px 0 6px; min-height: 0; display: flex; flex-direction: column; }
.msgs-start { margin-top: auto; padding: 28px 22px 14px; }
.msgs-start h2 { font-size: 22px; margin-bottom: 4px; }
.msg { display: flex; gap: 11px; padding: 6px 22px; position: relative; }
.msg:hover, .msg.menu-open { background: var(--hover); }
.msg.compact { padding-top: 1px; padding-bottom: 1px; }
.msg.compact .msg-gutter { width: 36px; text-align: right; font-size: 10.5px; color: transparent; line-height: 22px; flex: none; }
.msg.compact:hover .msg-gutter { color: var(--text-3); }
.msg.flash { animation: flash 1.6s ease-out; }
@keyframes flash { from { background: color-mix(in srgb, var(--amber) 28%, transparent); } to { background: transparent; } }
.msg.system { padding: 3px 22px 3px 69px; color: var(--text-3); font-size: 12.5px; gap: 6px; align-items: baseline; }
.msg.system:hover { background: transparent; }
.msg .avatar { --size: 36px; margin-top: 2px; cursor: pointer; }
.msg-body { flex: 1; min-width: 0; }
.msg-meta { display: flex; align-items: baseline; gap: 8px; }
.msg-author { font-weight: 700; cursor: pointer; }
.msg-author:hover { text-decoration: underline; }
.msg-time { font-size: 11.5px; color: var(--text-3); }
.tag { font-size: 9.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; padding: 1px 5px; border-radius: 4px; background: var(--active); color: var(--accent-text); }
.msg-text { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.5; font-size: 14.5px; }
.msg-text.deleted { color: var(--text-3); font-style: italic; }
.msg-text code { font: 12.5px var(--mono); padding: 1.5px 5px; border-radius: 4px; background: var(--raised); border: 1px solid var(--border); color: var(--accent-text); }
.msg-text pre { font: 12.5px/1.55 var(--mono); padding: 10px 12px; margin: 5px 0; border-radius: 8px; background: var(--raised); border: 1px solid var(--border); overflow-x: auto; white-space: pre; }
.msg-text blockquote { margin: 3px 0; padding: 1px 0 1px 11px; border-left: 3px solid var(--border-strong); color: var(--text-2); }
.edited { font-size: 11px; color: var(--text-3); margin-left: 5px; }
.mention { padding: 0 3px; border-radius: 4px; background: var(--active); color: var(--accent-text); font-weight: 600; cursor: pointer; }
.mention.me { background: color-mix(in srgb, var(--amber) 24%, transparent); color: var(--amber); }
.pinned-note { font-size: 11.5px; color: var(--amber); display: flex; align-items: center; gap: 4px; margin-bottom: 1px; }
.msg-actions { position: absolute; right: 18px; top: -15px; display: none; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 8px; padding: 2px; box-shadow: 0 6px 18px rgba(0, 0, 0, .22); z-index: 2; }
.msg:hover .msg-actions, .msg.menu-open .msg-actions { display: flex; }
.msg-actions button { width: 29px; height: 27px; border: 0; background: transparent; border-radius: 6px; color: var(--text-2); display: grid; place-items: center; font-size: 15px; }
.msg-actions button:hover { background: var(--hover); color: var(--text); }
.reactions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
.reaction { display: inline-flex; align-items: center; gap: 5px; height: 25px; padding: 0 8px; border-radius: 13px; border: 1px solid var(--border); background: var(--raised); font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.reaction:hover { border-color: var(--border-strong); }
.reaction.on { background: var(--active); border-color: color-mix(in srgb, var(--accent) 55%, transparent); color: var(--accent-text); }
.reaction .e { font-size: 14px; }
.replies-link { display: inline-flex; align-items: center; gap: 7px; margin-top: 5px; padding: 3px 9px 3px 4px; border-radius: 7px; border: 1px solid transparent; background: transparent; color: var(--accent-text); font-weight: 650; font-size: 12.5px; }
.replies-link:hover { background: var(--surface); border-color: var(--border); }
.replies-link .faint { font-weight: 500; }
.attachments { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.att { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); color: var(--text); max-width: 320px; }
.att:hover { border-color: var(--border-strong); text-decoration: none; }
.att-icon { width: 34px; height: 34px; border-radius: 8px; background: var(--active); color: var(--accent-text); display: grid; place-items: center; flex: none; }
.att-img { display: block; max-width: 360px; max-height: 280px; border-radius: 9px; border: 1px solid var(--border); object-fit: cover; }
.day-divider, .new-divider { display: flex; align-items: center; gap: 12px; padding: 10px 22px 4px; font-size: 11.5px; font-weight: 700; color: var(--text-3); }
.day-divider::before, .day-divider::after, .new-divider::before { content: ""; flex: 1; height: 1px; background: var(--border); }
.day-divider span { padding: 2px 10px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg); }
.new-divider { color: var(--red); }
.new-divider::before { background: color-mix(in srgb, var(--red) 55%, transparent); }
.load-older { align-self: center; margin: 8px 0; }

.composer { padding: 0 18px 16px; flex: none; position: relative; }
.typing { height: 18px; padding: 0 6px; font-size: 11.5px; color: var(--text-3); }
.composer-box { border: 1px solid var(--border-strong); border-radius: 12px; background: var(--surface); transition: border-color .12s, box-shadow .12s; }
.composer-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.composer-box.dragover { border-style: dashed; border-color: var(--accent); background: var(--active); }
.composer textarea { display: block; width: 100%; border: 0; outline: 0; background: transparent; resize: none; padding: 12px 14px 4px; min-height: 44px; max-height: 240px; line-height: 1.5; font-size: 14.5px; }
.composer-tools { display: flex; align-items: center; gap: 2px; padding: 4px 6px 6px; }
.composer-tools .hint { margin-left: auto; margin-right: 8px; font-size: 11px; color: var(--text-3); }
.composer-files { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 10px 0; }
.file-chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 4px 3px 9px; border-radius: 7px; background: var(--raised); border: 1px solid var(--border); font-size: 12px; max-width: 220px; }
.file-chip button { border: 0; background: transparent; color: var(--text-3); width: 18px; height: 18px; border-radius: 4px; display: grid; place-items: center; padding: 0; }
.file-chip button:hover { background: var(--hover); color: var(--text); }
.suggest { position: absolute; left: 18px; bottom: calc(100% - 14px); width: min(340px, calc(100% - 36px)); background: var(--surface); border: 1px solid var(--border-strong); border-radius: 10px; box-shadow: var(--shadow); padding: 5px; z-index: 5; max-height: 260px; overflow: auto; }
.suggest-item { display: flex; align-items: center; gap: 9px; padding: 6px 8px; border-radius: 6px; cursor: pointer; }
.suggest-item.on { background: var(--active); }
.join-bar { margin: 0 18px 18px; padding: 16px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); text-align: center; }

.thread { border-left: 1px solid var(--border); background: var(--bg); display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.thread .msg { padding-left: 16px; padding-right: 16px; }
.thread .composer { padding: 0 12px 14px; }
.thread .composer-tools .hint { display: none; }
.thread .composer-tools .btn.primary { margin-left: auto; }
.thread-sep { padding: 6px 16px; font-size: 11.5px; color: var(--text-3); font-weight: 650; display: flex; align-items: center; gap: 10px; }
.thread-sep::after { content: ""; flex: 1; height: 1px; background: var(--border); }

/* ---------- Board ---------- */
.board { display: grid; grid-template-columns: repeat(5, minmax(196px, 1fr)); gap: 12px; padding: 18px 22px 24px; height: 100%; overflow-x: auto; align-items: start; }
.col { background: var(--side); border: 1px solid var(--border); border-radius: 12px; display: flex; flex-direction: column; max-height: 100%; min-height: 120px; }
.col-head { display: flex; align-items: center; gap: 8px; padding: 11px 12px 8px; font-weight: 700; font-size: 12.5px; }
.col-head i { width: 9px; height: 9px; border-radius: 50%; background: var(--tone, var(--text-3)); }
.col-head button { margin-left: auto; }
.col-body { padding: 4px 8px 10px; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; min-height: 60px; flex: 1; border-radius: 0 0 12px 12px; transition: background .12s; }
.col-body.drop { background: var(--active); }
.task-card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 11px 12px; cursor: grab; transition: border-color .12s, box-shadow .12s, transform .12s var(--ease); display: flex; flex-direction: column; gap: 8px; }
.task-card:hover { border-color: var(--border-strong); box-shadow: 0 6px 18px rgba(0, 0, 0, .16); transform: translateY(-1px); }
.task-card.dragging { opacity: .35; }
.task-card .t { font-weight: 600; line-height: 1.35; overflow-wrap: anywhere; }
.task-card .foot { display: flex; align-items: center; gap: 9px; min-height: 22px; }
.drop-line { height: 3px; border-radius: 2px; background: var(--accent); margin: -3px 0; }
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.toolbar .inp { width: auto; min-width: 140px; }

/* ---------- Goals ---------- */
.goal { padding: 18px; }
.goal-head { display: flex; align-items: flex-start; gap: 12px; }
.goal-pct { font-size: 24px; font-weight: 700; letter-spacing: -.03em; font-variant-numeric: tabular-nums; min-width: 62px; text-align: right; }
.objective { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(90px, 1fr) 150px 118px; align-items: center; gap: 12px; padding: 8px 0; border-top: 1px solid var(--border); }
.objective .val { font-variant-numeric: tabular-nums; font-size: 12.5px; color: var(--text-2); white-space: nowrap; text-align: right; overflow: hidden; text-overflow: ellipsis; }
.objective > .hstack { justify-content: flex-end; }

/* ---------- Calendar ---------- */
.cal { display: flex; flex-direction: column; height: 100%; padding: 16px 22px 22px; gap: 12px; }
.cal-grid { flex: 1; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); grid-auto-rows: minmax(104px, 1fr); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--border); gap: 1px; min-height: 0; }
.cal-dows { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--text-3); padding: 0 4px; }
.cal-dows div { padding: 0 6px; }
.cal-day { background: var(--bg); padding: 6px; display: flex; flex-direction: column; gap: 3px; min-width: 0; overflow: hidden; }
.cal-day.out { background: var(--side); }
.cal-day.out .cal-num { color: var(--text-3); }
.cal-num { font-size: 12px; font-weight: 650; width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; color: var(--text-2); }
.cal-day.today .cal-num { background: var(--accent); color: #fff; }
.cal-item { display: flex; align-items: center; gap: 5px; padding: 2px 6px; border-radius: 5px; font-size: 11.5px; font-weight: 550; line-height: 1.5; cursor: pointer; border: 0; text-align: left; width: 100%; color: var(--text); background: color-mix(in srgb, var(--tone, var(--accent)) 16%, transparent); border-left: 3px solid var(--tone, var(--accent)); }
.cal-item:hover { background: color-mix(in srgb, var(--tone, var(--accent)) 28%, transparent); }
.cal-item.done { opacity: .5; text-decoration: line-through; }
.cal-item[data-type="meeting"] { --tone: var(--accent); } .cal-item[data-type="task"] { --tone: var(--blue); }
.cal-item[data-type="milestone"] { --tone: var(--amber); } .cal-item[data-type="goal"] { --tone: var(--green); } .cal-item[data-type="project"] { --tone: var(--red); }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 9px; height: 9px; border-radius: 3px; background: var(--tone); }

/* ---------- Meetings ---------- */
.meeting { display: grid; grid-template-columns: 74px minmax(0, 1fr) auto; gap: 16px; align-items: center; padding: 14px 16px; }
.meeting.cancelled { opacity: .55; }
.meeting-date { text-align: center; padding: 7px 0; border-radius: 10px; background: var(--active); color: var(--accent-text); line-height: 1.15; }
.meeting-date b { display: block; font-size: 21px; letter-spacing: -.02em; }
.meeting-date span { font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.rsvp { display: inline-flex; gap: 4px; }

/* ---------- Overlays ---------- */
#overlays { position: relative; z-index: 50; }
.modal-back { position: fixed; inset: 0; background: rgba(4, 5, 10, .62); backdrop-filter: blur(3px); display: grid; place-items: start center; padding: 7vh 16px 16px; overflow-y: auto; animation: fade .14s ease-out; z-index: 50; }
.modal { width: min(500px, 100%); background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-lg); box-shadow: var(--shadow); animation: pop .18s var(--ease); }
.modal.wide { width: min(760px, 100%); }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 16px 18px 0; }
.modal-head h2 { flex: 1; min-width: 0; }
.modal-body { padding: 16px 18px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 0 18px 18px; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.98); } }
.menu { position: fixed; min-width: 190px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 10px; box-shadow: var(--shadow); padding: 5px; z-index: 70; animation: pop .12s var(--ease); }
.menu-item { display: flex; align-items: center; gap: 9px; width: 100%; padding: 7px 10px; border: 0; background: transparent; border-radius: 6px; text-align: left; color: var(--text); font-weight: 500; }
.menu-item:hover { background: var(--hover); }
.menu-item.danger { color: var(--red); }
.menu-sep { height: 1px; background: var(--border); margin: 5px 0; }
.emoji-grid { display: grid; grid-template-columns: repeat(8, 32px); gap: 2px; }
.emoji-grid button { width: 32px; height: 32px; border: 0; background: transparent; border-radius: 6px; font-size: 18px; }
.emoji-grid button:hover { background: var(--hover); }
.popover { position: fixed; width: min(400px, calc(100vw - 24px)); max-height: min(560px, calc(100vh - 80px)); display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 12px; box-shadow: var(--shadow); z-index: 60; animation: pop .14s var(--ease); }
.popover-head { display: flex; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--border); font-weight: 700; }
.popover-body { overflow-y: auto; padding: 5px; }
.notif { display: flex; gap: 10px; padding: 9px 10px; border-radius: 8px; cursor: pointer; }
.notif:hover { background: var(--hover); }
.notif.unread .notif-title { font-weight: 700; }
.notif.unread::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); margin-top: 7px; flex: none; }
.notif:not(.unread) { padding-left: 27px; }
.toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 90; pointer-events: none; }
.toast { pointer-events: auto; max-width: 360px; padding: 10px 14px; border-radius: 10px; background: var(--raised); border: 1px solid var(--border-strong); box-shadow: var(--shadow); font-weight: 550; animation: pop .18s var(--ease); display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.toast.err { border-color: color-mix(in srgb, var(--red) 55%, transparent); }
.toast.err svg { color: var(--red); }
.token-box { font: 12.5px var(--mono); padding: 10px 12px; border-radius: 8px; background: var(--bg); border: 1px dashed var(--border-strong); overflow-wrap: anywhere; user-select: all; }
pre.code { font: 12px/1.6 var(--mono); padding: 12px; border-radius: 8px; background: var(--bg); border: 1px solid var(--border); overflow-x: auto; margin: 0; white-space: pre; }

/* ---------- Auth & onboarding ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); overflow-y: auto; height: 100vh; }
.auth-form { display: grid; place-items: center; padding: 32px 24px; }
.auth-card { width: min(380px, 100%); }
.auth-card h1 { margin: 22px 0 6px; }
.auth-card .sub { color: var(--text-2); margin-bottom: 22px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-size: 17px; letter-spacing: -.02em; color: var(--text); }
.brand-mark { width: 32px; height: 32px; border-radius: 10px; background: linear-gradient(135deg, var(--accent), var(--accent-2)); display: grid; place-items: center; color: #fff; box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 45%, transparent); }
.auth-art { position: relative; overflow: hidden; border-left: 1px solid var(--border); background: radial-gradient(900px 600px at 20% 10%, color-mix(in srgb, var(--accent) 34%, transparent), transparent 60%), radial-gradient(700px 500px at 90% 90%, color-mix(in srgb, var(--accent-2) 26%, transparent), transparent 60%), var(--side); display: grid; place-items: center; padding: 40px; }
.auth-art .pitch { max-width: 440px; }
.auth-art h2 { font-size: 30px; line-height: 1.15; letter-spacing: -.03em; margin-bottom: 18px; }
.feature { display: flex; gap: 12px; padding: 11px 0; }
.feature-icon { width: 34px; height: 34px; border-radius: 10px; background: color-mix(in srgb, var(--surface) 70%, transparent); border: 1px solid var(--border); display: grid; place-items: center; color: var(--accent-text); flex: none; }
.center-page { min-height: 100vh; height: 100vh; overflow-y: auto; display: grid; place-items: center; padding: 24px; background-image: var(--glow); }
.center-card { width: min(440px, 100%); }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .app.has-thread { grid-template-columns: 60px 268px minmax(0, 1fr); }
  .app.has-thread .thread { position: fixed; inset: 0 0 0 auto; width: min(420px, 100vw); z-index: 30; box-shadow: var(--shadow); }
}
@media (max-width: 820px) {
  .app, .app.has-thread { grid-template-columns: minmax(0, 1fr); }
  .rail, .side { position: fixed; top: 0; bottom: 0; z-index: 40; transform: translateX(-340px); transition: transform .22s var(--ease); }
  .rail { left: 0; width: 60px; }
  .side { left: 60px; width: min(280px, calc(100vw - 60px)); box-shadow: var(--shadow); }
  .app.nav-open .rail, .app.nav-open .side { transform: none; }
  .app.nav-open::after { content: ""; position: fixed; inset: 0; background: rgba(0, 0, 0, .5); z-index: 35; }
  .menu-btn { display: inline-flex; }
  .pad { padding: 16px 14px 40px; }
  .cols-2, .cols-3 { grid-template-columns: minmax(0, 1fr); }
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth-art { display: none; }
  .head-sub { display: none; }
  .msg { padding-left: 14px; padding-right: 14px; }
  .composer { padding: 0 10px 10px; }
  .composer-tools .hint { display: none; }
  .meeting { grid-template-columns: 60px minmax(0, 1fr); }
  .meeting > :last-child { grid-column: 1 / -1; }
  .objective { grid-template-columns: minmax(0, 1fr) auto; }
  .objective .val { display: none; }
  .objective .progress { grid-column: 1 / -1; order: 3; }
  .cal { padding: 10px; }
  .cal-grid { grid-auto-rows: minmax(74px, 1fr); }
  .cal-item { font-size: 10px; padding: 1px 3px; }
  .row-2 { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
