/* TeamPulse — one stylesheet for web, desktop (installed PWA) and mobile. */

:root {
  --bg: #ffffff;
  --bg-soft: #f8fafc;
  --bg-hover: #f1f5f9;
  --bg-active: #e9edf5;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --text: #0f172a;
  --text-2: #334155;
  --text-3: #64748b;
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-soft: #eef2ff;
  --accent-text: #3730a3;
  --on-accent: #ffffff;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --success: #16a34a;
  --warning: #b45309;
  --mention-bg: #fef3c7;
  --mention-text: #92400e;
  --mention-me-bg: #fde68a;
  --highlight: #fffbeb;
  --side-bg: #1e1b4b;
  --side-text: #c7d2fe;
  --side-strong: #ffffff;
  --side-muted: #a5b4fc;
  --side-hover: rgba(255, 255, 255, 0.08);
  --side-active: #4f46e5;
  --side-border: rgba(255, 255, 255, 0.1);
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow: 0 4px 16px rgba(15, 23, 42, 0.1), 0 1px 3px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 20px 50px rgba(15, 23, 42, 0.2);
  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 12px;
  --font: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', 'Noto Sans Malayalam', 'Nirmala UI', 'Kartika', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji';
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace;
  --side-w: 268px;
  --panel-w: 400px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #12141c;
    --bg-soft: #171a24;
    --bg-hover: #1d2130;
    --bg-active: #242a3c;
    --border: #262b3a;
    --border-strong: #353c50;
    --text: #e6e8ef;
    --text-2: #c3c8d6;
    --text-3: #959cb0;
    --accent: #6366f1;
    --accent-hover: #818cf8;
    --accent-soft: rgba(99, 102, 241, 0.16);
    --accent-text: #a5b4fc;
    --danger: #f87171;
    --danger-soft: rgba(248, 113, 113, 0.12);
    --success: #4ade80;
    --warning: #fbbf24;
    --mention-bg: rgba(251, 191, 36, 0.16);
    --mention-text: #fcd34d;
    --mention-me-bg: rgba(251, 191, 36, 0.3);
    --highlight: rgba(251, 191, 36, 0.08);
    --side-bg: #0b0d14;
    --side-text: #b4bbd0;
    --side-muted: #8a93ad;
    --side-active: #4f46e5;
    --side-border: rgba(255, 255, 255, 0.07);
    --shadow: 0 4px 16px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.6);
    color-scheme: dark;
  }
}
:root[data-theme='dark'] {
  --bg: #12141c;
  --bg-soft: #171a24;
  --bg-hover: #1d2130;
  --bg-active: #242a3c;
  --border: #262b3a;
  --border-strong: #353c50;
  --text: #e6e8ef;
  --text-2: #c3c8d6;
  --text-3: #959cb0;
  --accent: #6366f1;
  --accent-hover: #818cf8;
  --accent-soft: rgba(99, 102, 241, 0.16);
  --accent-text: #a5b4fc;
  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, 0.12);
  --success: #4ade80;
  --warning: #fbbf24;
  --mention-bg: rgba(251, 191, 36, 0.16);
  --mention-text: #fcd34d;
  --mention-me-bg: rgba(251, 191, 36, 0.3);
  --highlight: rgba(251, 191, 36, 0.08);
  --side-bg: #0b0d14;
  --side-text: #b4bbd0;
  --side-muted: #8a93ad;
  --side-active: #4f46e5;
  --side-border: rgba(255, 255, 255, 0.07);
  --shadow: 0 4px 16px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.6);
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font: 15px/1.47 var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
button:disabled { cursor: not-allowed; }
a { color: var(--accent); }
img, video { max-width: 100%; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.i { flex: none; display: block; }
.muted { color: var(--text-3); }
.xs { font-size: 12px; }
.pad { padding: 16px; }
.dim { opacity: 0.6; }
kbd {
  font: 11px var(--mono);
  padding: 1px 5px;
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: var(--bg-soft);
  color: var(--text-2);
}
code { font-family: var(--mono); }

.splash { position: fixed; inset: 0; display: grid; place-items: center; background: var(--side-bg); z-index: 100; }
.splash img { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(0.92); opacity: 0.7; } }

#conn-banner {
  position: fixed; top: calc(8px + var(--safe-t)); left: 50%; transform: translateX(-50%); z-index: 90;
  background: #111827; color: #fff; padding: 6px 14px; border-radius: 999px; font-size: 13px; box-shadow: var(--shadow);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 14px; border-radius: var(--radius);
  font-weight: 600; font-size: 14px; white-space: nowrap; text-decoration: none;
  border: 1px solid transparent; transition: background 0.15s, border-color 0.15s, color 0.15s, opacity 0.15s;
}
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn.block { width: 100%; height: 42px; }
.btn.primary { background: var(--accent); color: var(--on-accent); }
.btn.primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn.ghost { background: var(--bg); border-color: var(--border-strong); color: var(--text); }
.btn.ghost:hover:not(:disabled) { background: var(--bg-hover); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.danger:hover:not(:disabled) { filter: brightness(0.92); }
.btn:disabled { opacity: 0.55; }
.btn.loading { position: relative; color: transparent !important; }
.btn.loading::after {
  content: ''; position: absolute; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid currentColor; border-color: var(--on-accent) transparent var(--on-accent) transparent; animation: spin 0.8s linear infinite;
}
.btn.ghost.loading::after { border-color: var(--text-3) transparent var(--text-3) transparent; }
@keyframes spin { to { transform: rotate(360deg); } }
.danger-text { color: var(--danger) !important; }
.link-btn { color: var(--accent); font-weight: 600; font-size: 13px; }
.link-btn:hover { text-decoration: underline; }

.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: var(--radius);
  color: var(--text-3); transition: background 0.15s, color 0.15s; flex: none;
}
.icon-btn:hover { background: var(--bg-hover); color: var(--text); }
.icon-btn.sm { width: 28px; height: 28px; border-radius: var(--radius-sm); }
.icon-btn.live { color: #fff; background: var(--success); }
.icon-btn.on-dark { color: #e5e7eb; }
.icon-btn.on-dark:hover { background: rgba(255, 255, 255, 0.12); color: #fff; }

.round-btn {
  width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(255, 255, 255, 0.16); color: #fff; transition: background 0.15s, transform 0.1s;
}
.round-btn:hover { background: rgba(255, 255, 255, 0.26); }
.round-btn:active { transform: scale(0.95); }
.round-btn.off { background: #dc2626; }
.round-btn.danger { background: #dc2626; }
.round-btn.ok { background: #16a34a; }

/* ---------- Forms ---------- */
.form { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.label { font-weight: 600; font-size: 14px; color: var(--text-2); }
.hint { color: var(--text-3); font-size: 12.5px; }
.input {
  width: 100%; height: 40px; padding: 0 12px; border-radius: var(--radius);
  border: 1px solid var(--border-strong); background: var(--bg); color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input.sm { height: 34px; }
textarea.input { height: auto; padding: 10px 12px; resize: vertical; line-height: 1.45; }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input::placeholder { color: var(--text-3); }
.input-prefix { display: flex; align-items: center; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--bg); }
.input-prefix:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input-prefix span { padding-left: 12px; color: var(--text-3); font-weight: 600; }
.input-prefix .input { border: 0; box-shadow: none; padding-left: 4px; }
.form-error { margin: 0; color: var(--danger); background: var(--danger-soft); padding: 8px 12px; border-radius: var(--radius); font-size: 14px; }

.switch-row { display: flex; align-items: flex-start; gap: 12px; cursor: pointer; }
.switch-row.disabled { opacity: 0.6; cursor: not-allowed; }
.switch-row input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-row > span:last-child { display: flex; flex-direction: column; }
.switch-row small { color: var(--text-3); font-size: 13px; }
.switch {
  flex: none; width: 38px; height: 22px; border-radius: 999px; background: var(--border-strong);
  position: relative; transition: background 0.15s; margin-top: 1px;
}
.switch::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%;
  background: #fff; transition: transform 0.15s; box-shadow: var(--shadow-sm);
}
.switch-row input:checked + .switch { background: var(--accent); }
.switch-row input:checked + .switch::after { transform: translateX(16px); }
.switch-row input:focus-visible + .switch { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Auth ---------- */
.auth {
  position: fixed; inset: 0; overflow: auto; display: grid; place-items: center; padding: 24px 16px;
  background: radial-gradient(1200px 600px at 20% 0%, #312e81 0%, transparent 60%), linear-gradient(160deg, #1e1b4b, #0f172a);
}
.auth-card {
  width: 100%; max-width: 420px; background: var(--bg); border-radius: 16px; padding: 32px;
  box-shadow: var(--shadow-lg);
}
.auth-card h1 { font-size: 24px; line-height: 1.2; margin: 18px 0 6px; }
.auth-card > .muted { margin: 0 0 22px; }
.auth-brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 18px; letter-spacing: -0.01em; }
.auth-switch { text-align: center; margin: 18px 0 0; color: var(--text-3); font-size: 14px; }

/* ---------- Avatars & badges ---------- */
.avatar {
  --size: 36px;
  position: relative; display: inline-grid; place-items: center; flex: none;
  width: var(--size); height: var(--size); border-radius: calc(var(--size) * 0.22);
  background: var(--c); color: #fff; font-weight: 700; font-size: calc(var(--size) * 0.4); line-height: 1;
  user-select: none;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.avatar .presence { position: absolute; right: -3px; bottom: -3px; }
.presence {
  display: inline-block; width: 10px; height: 10px; border-radius: 50%;
  background: transparent; border: 2px solid var(--text-3); box-shadow: 0 0 0 2px var(--bg);
}
.presence.on { background: #22c55e; border-color: #22c55e; }
.sidebar .presence { box-shadow: 0 0 0 2px var(--side-bg); border-color: var(--side-muted); }
.sidebar .presence.on { border-color: #22c55e; }
.avatar-stack { display: inline-flex; align-items: center; }
.avatar-stack .avatar { box-shadow: 0 0 0 2px var(--bg); }
.avatar-stack .avatar + .avatar { margin-left: -6px; }
.more-count { font-size: 12px; color: var(--text-3); margin-left: 6px; }
.badge {
  display: inline-flex; align-items: center; height: 18px; padding: 0 6px; border-radius: 4px;
  font-size: 11px; font-weight: 700; background: var(--bg-active); color: var(--text-2);
}
.badge.ai { background: linear-gradient(135deg, #6366f1, #8b5cf6); color: #fff; }
.badge.count { background: #e11d48; color: #fff; border-radius: 999px; min-width: 20px; justify-content: center; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: #22c55e; display: inline-block; flex: none; box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.6); animation: live 1.6s infinite; }
@keyframes live { 70% { box-shadow: 0 0 0 7px rgba(34, 197, 94, 0); } 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); } }

/* ---------- Shell ---------- */
.shell {
  height: 100dvh; display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr);
  padding-top: var(--safe-t);
}
.shell.has-panel { grid-template-columns: var(--side-w) minmax(0, 1fr) var(--panel-w); }
.main { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg); }
.panel { display: flex; flex-direction: column; min-height: 0; border-left: 1px solid var(--border); background: var(--bg); }

/* ---------- Sidebar ---------- */
.sidebar {
  display: flex; flex-direction: column; min-height: 0; background: var(--side-bg); color: var(--side-text);
}
.side-head { display: flex; align-items: center; gap: 4px; padding: 10px 10px 6px 12px; }
.ws-btn {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 6px; border-radius: var(--radius);
  color: var(--side-strong); font-weight: 800; font-size: 16px; text-align: left;
}
.ws-btn:hover { background: var(--side-hover); }
.ws-logo {
  width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; flex: none;
  background: linear-gradient(135deg, #6366f1, #8b5cf6); color: #fff; font-size: 15px;
}
.ws-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-icon { color: var(--side-text); }
.side-icon:hover { background: var(--side-hover); color: var(--side-strong); }
.side-search {
  display: flex; align-items: center; gap: 8px; margin: 4px 12px 8px; height: 34px; padding: 0 10px;
  border-radius: var(--radius); background: rgba(255, 255, 255, 0.08); color: var(--side-muted); font-size: 14px;
  border: 1px solid var(--side-border); transition: background 0.15s;
}
.side-search:hover { background: rgba(255, 255, 255, 0.13); }
.side-search span { flex: 1; text-align: left; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.side-search kbd { background: transparent; border-color: var(--side-border); color: var(--side-muted); }
.side-scroll { flex: 1; overflow-y: auto; padding: 4px 8px 12px; overscroll-behavior: contain; }
.side-scroll::-webkit-scrollbar { width: 8px; }
.side-scroll::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.14); border-radius: 8px; }
.side-nav { padding-bottom: 6px; margin-bottom: 4px; border-bottom: 1px solid var(--side-border); }
.side-item {
  display: flex; align-items: center; gap: 9px; width: 100%; min-height: 32px; padding: 4px 10px; border-radius: var(--radius-sm);
  color: var(--side-text); text-decoration: none; font-size: 15px; text-align: left; transition: background 0.12s, color 0.12s;
}
.side-item:hover { background: var(--side-hover); color: var(--side-strong); }
.side-item.active { background: var(--side-active); color: #fff; }
.side-item.unread { color: var(--side-strong); font-weight: 700; }
.side-item.muted { opacity: 0.6; }
.side-item.ghost { color: var(--side-muted); }
.side-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-status { font-size: 13px; }
.ch-icon { opacity: 0.85; }
.group-count {
  width: 20px; height: 20px; border-radius: 5px; display: grid; place-items: center; flex: none;
  background: rgba(255, 255, 255, 0.16); font-size: 11px; font-weight: 700;
}
.live-pill { display: grid; place-items: center; width: 22px; height: 18px; border-radius: 9px; background: #16a34a; color: #fff; }
.side-section { margin-top: 10px; }
.side-section-head { display: flex; align-items: center; justify-content: space-between; padding-right: 2px; }
.section-toggle {
  display: flex; align-items: center; gap: 6px; padding: 4px 6px; border-radius: var(--radius-sm);
  color: var(--side-muted); font-size: 13.5px; font-weight: 600;
}
.section-toggle:hover { color: var(--side-strong); background: var(--side-hover); }
.section-toggle .rot { transform: rotate(-90deg); }
.side-add { color: var(--side-muted); }
.side-add:hover { background: var(--side-hover); color: var(--side-strong); }
.side-banner {
  display: flex; align-items: flex-start; gap: 10px; width: 100%; margin: 10px 0 4px; padding: 10px 12px; border-radius: var(--radius);
  background: rgba(99, 102, 241, 0.22); color: var(--side-strong); text-align: left; border: 1px solid rgba(165, 180, 252, 0.25);
}
.side-banner span { display: flex; flex-direction: column; font-size: 13.5px; }
.side-banner small { color: var(--side-text); font-size: 12.5px; }
.side-banner:hover { background: rgba(99, 102, 241, 0.32); }
.side-foot { display: flex; align-items: center; gap: 4px; padding: 8px 10px calc(8px + var(--safe-b)); border-top: 1px solid var(--side-border); }
.me-btn { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 6px; border-radius: var(--radius); text-align: left; }
.me-btn:hover { background: var(--side-hover); }
.me-meta { display: flex; flex-direction: column; min-width: 0; }
.me-meta b { color: var(--side-strong); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-meta small { color: var(--side-muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Channel header ---------- */
.ch-head {
  display: flex; align-items: center; gap: 8px; min-height: 58px; padding: 8px 12px 8px 16px;
  border-bottom: 1px solid var(--border); background: var(--bg);
}
.back-btn { display: none; }
.ch-title { flex: 1; min-width: 0; }
.ch-name {
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 2px 6px; margin-left: -6px; border-radius: var(--radius-sm);
  font-weight: 800; font-size: 17px; color: var(--text);
}
.ch-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-name:hover { background: var(--bg-hover); }
.star-on { color: #f59e0b; fill: #f59e0b; }
.ch-topic { font-size: 13px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.ch-topic.add { display: block; text-align: left; }
.ch-topic.add:hover { color: var(--accent); }
.ch-tools { display: flex; align-items: center; gap: 4px; }
.members-btn {
  display: flex; align-items: center; gap: 6px; height: 32px; padding: 0 8px 0 6px; border-radius: var(--radius);
  border: 1px solid var(--border); font-size: 13px; font-weight: 600; color: var(--text-2);
}
.members-btn:hover { background: var(--bg-hover); }
.catchup { color: var(--accent-text); border-color: var(--border); }

.meeting-banner {
  display: flex; align-items: center; gap: 10px; padding: 8px 16px; font-size: 14px;
  background: linear-gradient(90deg, rgba(34, 197, 94, 0.12), rgba(34, 197, 94, 0.04)); border-bottom: 1px solid var(--border);
}
.meeting-banner > span:nth-child(2) { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Messages ---------- */
.ch-scroll { flex: 1; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; scroll-padding-bottom: 16px; }
.ch-messages { padding: 8px 0 12px; }
.intro { padding: 28px 20px 16px; }
.intro h2 { margin: 10px 0 4px; font-size: 24px; }
.intro p { margin: 0; max-width: 60ch; }
.intro-icon { width: 60px; height: 60px; border-radius: 14px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.intro-actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.load-older { height: 40px; display: grid; place-items: center; color: var(--text-3); font-size: 13px; }

.day-divider { position: relative; z-index: 1; display: flex; justify-content: center; margin: 12px 0 4px; pointer-events: none; }
.day-divider::before { content: ''; position: absolute; left: 0; right: 0; top: 50%; border-top: 1px solid var(--border); z-index: -1; }
.day-divider span {
  pointer-events: auto; font-size: 12.5px; font-weight: 700; padding: 3px 12px; border-radius: 999px;
  background: var(--bg); border: 1px solid var(--border); color: var(--text-2);
}
.unread-divider { display: flex; align-items: center; margin: 6px 16px; color: #e11d48; font-size: 12px; font-weight: 700; }
.unread-divider::before { content: ''; flex: 1; border-top: 1px solid #e11d48; }
.unread-divider span { padding-left: 8px; }

.msg { position: relative; display: flex; gap: 10px; padding: 6px 16px 6px 16px; transition: background 0.1s; }
.msg.compact { padding-top: 1px; padding-bottom: 1px; }
.msg:hover, .msg:focus-within { background: var(--bg-soft); }
.msg.pinned { background: var(--highlight); }
.msg.highlight { animation: flash 2.4s ease-out; }
@keyframes flash { 0%, 40% { background: var(--mention-me-bg); } 100% { background: transparent; } }
.msg-gutter { width: 38px; flex: none; display: flex; justify-content: center; }
.avatar-btn { border-radius: 9px; height: fit-content; }
.hover-time { visibility: hidden; font-size: 11px; color: var(--text-3); padding-top: 4px; white-space: nowrap; }
.msg:hover .hover-time { visibility: visible; }
.msg-body { flex: 1; min-width: 0; }
.msg-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; line-height: 1.3; margin-bottom: 1px; }
.msg-author { font-weight: 800; font-size: 15px; color: var(--text); }
.msg-author:hover { text-decoration: underline; }
.msg-head time { font-size: 12px; color: var(--text-3); }
.status-emoji { font-size: 13px; }
.pinned-tag { display: inline-flex; align-items: center; gap: 3px; font-size: 11.5px; color: var(--warning); font-weight: 600; }
.msg-text { color: var(--text); overflow-wrap: anywhere; }
.msg-text.deleted { color: var(--text-3); font-style: italic; }
.msg-text.jumbo { font-size: 34px; line-height: 1.25; }
.edited { color: var(--text-3); font-size: 12px; }
.from-bot .msg-text { color: var(--text); }
.result-context { position: absolute; top: 6px; left: 64px; right: 16px; display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--text-3); }

.md .md-p + .md-p, .md .md-p + ul, .md ul + .md-p, .md .md-p + ol, .md .md-h + .md-p { margin-top: 6px; }
.md ul, .md ol { margin: 4px 0; padding-left: 22px; }
.md li { margin: 2px 0; }
.md .md-h { font-weight: 800; margin: 12px 0 4px; line-height: 1.3; }
.md .md-h:first-child { margin-top: 2px; }
.md .md-h1 { font-size: 18px; }
.md .md-h2 { font-size: 16px; }
.md .md-h3 { font-size: 15px; }
.md blockquote { margin: 4px 0; padding: 2px 0 2px 12px; border-left: 3px solid var(--border-strong); color: var(--text-2); }
.md .md-code { font-size: 13px; padding: 1px 5px; border-radius: 4px; background: var(--bg-active); color: #e11d48; }
:root[data-theme='dark'] .md .md-code { color: #fda4af; }
.md .md-pre {
  margin: 6px 0; padding: 10px 12px; border-radius: var(--radius); background: var(--bg-soft); border: 1px solid var(--border);
  overflow-x: auto; font-size: 13px; line-height: 1.5;
}
.md a { overflow-wrap: anywhere; }
.md-tasks { list-style: none; padding-left: 2px !important; }
.md-tasks li { display: flex; gap: 8px; align-items: flex-start; }
.md-tasks .box {
  flex: none; width: 16px; height: 16px; margin-top: 3px; border-radius: 4px; border: 1.5px solid var(--border-strong);
  display: grid; place-items: center; font-size: 11px; color: #fff;
}
.md-tasks .done .box { background: var(--success); border-color: var(--success); }
.md-tasks .done > span:last-child { text-decoration: line-through; color: var(--text-3); }
.mention {
  display: inline; padding: 0 3px; border-radius: 4px; font-weight: 600;
  background: var(--accent-soft); color: var(--accent-text);
}
button.mention:hover { text-decoration: underline; }
.mention.me, .mention.all { background: var(--mention-bg); color: var(--mention-text); }

/* Hover action bar */
.msg-actions {
  position: absolute; top: -14px; right: 16px; z-index: 3; display: none; align-items: center; gap: 2px; padding: 2px;
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.msg:hover .msg-actions, .msg:focus-within .msg-actions { display: flex; }
.act { width: 32px; height: 32px; display: grid; place-items: center; border-radius: var(--radius-sm); color: var(--text-3); }
.act:hover { background: var(--bg-hover); color: var(--text); }
.act.emoji { font-size: 17px; }
.act.on { color: var(--accent); }
@media (hover: none) { .msg-actions { display: none !important; } }

/* Attachments */
.attachments { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.att-images { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 220px)); gap: 6px; }
.att-images.single { grid-template-columns: minmax(0, 360px); }
.att-img { border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); background: var(--bg-soft); max-height: 320px; }
.att-img img { display: block; width: 100%; height: 100%; max-height: 320px; object-fit: cover; }
.att-images.single .att-img img { object-fit: contain; }
.att-video video, .recording-card video { display: block; width: 100%; max-width: 560px; border-radius: var(--radius); background: #000; aspect-ratio: 16 / 9; }
.att-caption { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--text-3); text-decoration: none; margin-top: 4px; }
.att-audio audio { width: min(100%, 360px); }
.att-file {
  display: flex; align-items: center; gap: 10px; width: min(100%, 380px); padding: 8px 10px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--bg); color: var(--text); text-decoration: none; transition: background 0.15s;
}
.att-file:hover { background: var(--bg-hover); }
.att-file-icon { width: 38px; height: 38px; border-radius: 8px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex: none; }
.att-file-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.att-file-name { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-file-size { font-size: 12px; color: var(--text-3); }
.att-file-dl { color: var(--text-3); }

/* Reactions */
.reactions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.reaction {
  display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 8px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--bg-soft); font-size: 13px; transition: border-color 0.15s, background 0.15s;
}
.reaction b { font-weight: 600; font-size: 12px; color: var(--text-2); }
.reaction:hover { border-color: var(--border-strong); background: var(--bg-hover); }
.reaction.mine { border-color: var(--accent); background: var(--accent-soft); }
.reaction.mine b { color: var(--accent-text); }
.reaction.add { color: var(--text-3); opacity: 0; }
.msg:hover .reaction.add, .reaction.add:focus-visible { opacity: 1; }
@media (hover: none) { .reaction.add { opacity: 1; } }

.thread-summary {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 6px; padding: 4px 8px 4px 4px; border-radius: var(--radius);
  font-size: 13px; color: var(--accent); border: 1px solid transparent;
}
.thread-summary:hover { background: var(--bg); border-color: var(--border); }
.thread-summary .avatar-stack .avatar { box-shadow: 0 0 0 2px var(--bg-soft); }

/* Cards */
.card { margin-top: 4px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--bg); max-width: 640px; }
.meeting-card { display: flex; align-items: center; gap: 12px; padding: 12px 14px; flex-wrap: wrap; }
.meeting-card.live { border-color: rgba(34, 197, 94, 0.5); background: linear-gradient(135deg, rgba(34, 197, 94, 0.08), transparent); }
.card-icon { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex: none; }
.meeting-card.live .card-icon { background: #16a34a; color: #fff; }
.card-main { flex: 1; min-width: 160px; display: flex; flex-direction: column; gap: 4px; }
.card-title { font-weight: 700; }
.card-sub { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-3); }
.card-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.ai-card, .recording-card { padding: 12px 14px; }
.ai-card { border-color: rgba(99, 102, 241, 0.35); background: linear-gradient(180deg, var(--accent-soft), var(--bg) 120px); }
.ai-card-head { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; font-size: 14px; color: var(--accent-text); flex-wrap: wrap; }
.ai-card-head .muted { color: var(--text-3); }
.ai-card-foot { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.ai-card details summary { cursor: pointer; color: var(--accent); font-weight: 600; font-size: 14px; }
.ai-card details[open] summary { margin-bottom: 8px; }

/* System messages */
.msg.system { padding-top: 2px; padding-bottom: 2px; color: var(--text-3); font-size: 14px; }
.msg.system .msg-gutter { align-items: center; }
.sys-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--border-strong); }
.sys-text { color: var(--text-2); }
.sys-text b { color: var(--text); }
.sys-text .md-p { display: inline; }
.msg.system time { font-size: 12px; color: var(--text-3); }

/* Skeletons & empty states */
.skel { display: block; border-radius: 6px; background: linear-gradient(90deg, var(--bg-hover), var(--bg-active), var(--bg-hover)); background-size: 200% 100%; animation: shimmer 1.3s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.skel-msg { display: flex; gap: 10px; padding: 10px 16px; }
.skel.av { width: 36px; height: 36px; border-radius: 9px; flex: none; }
.skel-lines { flex: 1; display: flex; flex-direction: column; gap: 8px; padding-top: 4px; }
.skel.l1 { height: 12px; width: 40%; }
.skel.l2 { height: 12px; width: 75%; }
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 6px; padding: 40px 20px; color: var(--text-2); }
.empty-state p { margin: 0; max-width: 40ch; }
.empty-state.full { flex: 1; }
.empty-state .i { color: var(--text-3); }

.new-pill {
  position: absolute; left: 50%; bottom: 120px; transform: translateX(-50%); z-index: 4;
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 14px; border-radius: 999px;
  background: var(--accent); color: #fff; font-size: 13px; font-weight: 600; box-shadow: var(--shadow);
}
.typing-line { height: 20px; padding: 0 20px; font-size: 12.5px; color: var(--text-3); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

/* ---------- Composer ---------- */
.ch-composer, .panel-composer { padding: 0 16px calc(14px + var(--safe-b)); }
.panel-composer { padding-top: 8px; border-top: 1px solid var(--border); }
.composer { position: relative; }
.composer-box {
  border: 1px solid var(--border-strong); border-radius: var(--radius-lg); background: var(--bg);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.composer-box:focus-within { border-color: var(--text-3); box-shadow: var(--shadow-sm); }
.composer-input {
  display: block; width: 100%; min-height: 44px; max-height: 40vh; padding: 12px 14px 4px; border: 0; outline: 0; resize: none;
  background: transparent; line-height: 1.45; font-size: 15px;
}
.composer-bar { display: flex; align-items: center; gap: 2px; padding: 4px 6px 6px; }
.composer-bar .icon-btn { width: 32px; height: 32px; }
.composer-hint { flex: 1; font-size: 11.5px; color: var(--text-3); padding: 0 8px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.composer-hint kbd { font-size: 10px; padding: 0 4px; }
.send-btn {
  width: 36px; height: 32px; border-radius: var(--radius); display: grid; place-items: center;
  background: var(--accent); color: #fff; transition: background 0.15s, opacity 0.15s;
}
.send-btn:hover:not(:disabled) { background: var(--accent-hover); }
.send-btn:disabled { background: var(--bg-active); color: var(--text-3); }
.send-btn.busy { animation: pulse 1s infinite; }
.composer-files { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 10px 0; }
.file-chip {
  position: relative; display: flex; align-items: center; gap: 8px; max-width: 260px; padding: 6px 6px 6px 8px; overflow: hidden;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-soft);
}
.file-chip.error { border-color: var(--danger); }
.file-chip img { width: 36px; height: 36px; object-fit: cover; border-radius: 6px; }
.file-chip-icon { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 6px; background: var(--accent-soft); color: var(--accent); flex: none; }
.file-chip-meta { min-width: 0; display: flex; flex-direction: column; }
.file-chip-name { font-size: 13px; font-weight: 600; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.file-chip-sub { font-size: 11.5px; color: var(--text-3); }
.file-progress { position: absolute; left: 0; bottom: 0; height: 3px; width: calc(var(--p) * 100%); background: var(--accent); transition: width 0.2s; }
.ac-pop {
  position: absolute; left: 0; right: 0; bottom: calc(100% + 6px); z-index: 20; max-height: 280px; overflow-y: auto; padding: 6px;
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow);
}
.ac-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 10px; border-radius: var(--radius-sm); text-align: left; }
.ac-item.active, .ac-item:hover { background: var(--accent); color: #fff; }
.ac-item.active .muted, .ac-item.active .ac-desc { color: rgba(255, 255, 255, 0.8); }
.ac-desc { margin-left: auto; color: var(--text-3); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-left: 12px; }
.ac-at { width: 22px; text-align: center; font-weight: 800; }
.join-bar { display: flex; align-items: center; justify-content: center; gap: 14px; flex-wrap: wrap; padding: 16px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--bg-soft); }
.join-bar p { margin: 0; display: flex; align-items: center; gap: 6px; }
.drop-overlay {
  position: absolute; inset: 8px; z-index: 30; display: grid; place-items: center; text-align: center;
  border: 2px dashed var(--accent); border-radius: var(--radius-lg); background: color-mix(in srgb, var(--bg) 88%, transparent); color: var(--accent); pointer-events: none;
}
.msg-edit { display: flex; flex-direction: column; gap: 6px; margin-top: 2px; }
.msg-edit-bar { display: flex; align-items: center; gap: 6px; justify-content: flex-end; }
.msg-edit-bar .muted { margin-right: auto; }

/* ---------- Right panel ---------- */
.panel-head { display: flex; align-items: center; gap: 8px; min-height: 58px; padding: 8px 10px 8px 16px; border-bottom: 1px solid var(--border); }
.panel-title { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 8px; }
.panel-title h2 { margin: 0; font-size: 17px; }
.panel-sub { color: var(--text-3); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.panel-body { flex: 1; overflow-y: auto; overscroll-behavior: contain; }
.panel .back-btn { display: none; }
.thread-root .msg { padding-top: 14px; }
.thread-count { display: flex; align-items: center; gap: 10px; padding: 4px 16px; font-size: 13px; color: var(--text-3); }
.thread-count::after { content: ''; flex: 1; border-top: 1px solid var(--border); }
.results .msg { padding-top: 26px; border-bottom: 1px solid var(--border); cursor: pointer; }
.panel-loading { padding-top: 8px; }
.search-form { display: flex; align-items: center; gap: 8px; margin: 12px 16px; padding-left: 12px; border: 1px solid var(--border-strong); border-radius: var(--radius); color: var(--text-3); }
.search-form:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search-form .input { border: 0; box-shadow: none !important; padding-left: 0; }
.tabs { display: flex; gap: 4px; padding: 0 12px; border-bottom: 1px solid var(--border); overflow-x: auto; }
.tab { padding: 10px 8px; font-size: 14px; font-weight: 600; color: var(--text-3); border-bottom: 2px solid transparent; white-space: nowrap; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.rows { display: flex; flex-direction: column; padding: 4px 8px; }
.row { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 6px 8px; border-radius: var(--radius); text-align: left; color: var(--text); }
button.row:hover, .file-row:hover { background: var(--bg-hover); }
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.row-main b { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-main small { color: var(--text-3); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-thumb { width: 40px; height: 40px; border-radius: 8px; overflow: hidden; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex: none; }
.file-thumb img { width: 100%; height: 100%; object-fit: cover; }
.detail-block { margin: 12px 16px; padding: 4px 0; border: 1px solid var(--border); border-radius: var(--radius-lg); }
.detail-block.toggles, .detail-block.danger-zone { padding: 4px; }
.detail-block.danger-zone { display: flex; flex-direction: column; gap: 6px; padding: 10px; border: 0; }
.detail-row { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; padding: 10px 14px; border-bottom: 1px solid var(--border); font-size: 14px; }
.detail-row:last-child { border-bottom: 0; }
.detail-label { grid-column: 1 / -1; font-size: 12.5px; font-weight: 700; color: var(--text-3); }
.detail-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 14px 4px; }
.profile { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 24px 16px; gap: 4px; }
.profile h3 { margin: 12px 0 0; font-size: 20px; display: flex; align-items: center; gap: 8px; }
.profile p { margin: 0; }
.presence-line { display: flex; align-items: center; gap: 6px; color: var(--text-2); font-size: 14px; }
.status-line { color: var(--text-2); }
.profile-actions { display: flex; gap: 8px; margin: 14px 0 6px; }
.profile .detail-block { align-self: stretch; text-align: left; }
.ai-summary { padding: 16px; }
.ai-meta { display: flex; align-items: center; gap: 6px; color: var(--accent-text); font-size: 13px; font-weight: 600; margin-bottom: 10px; }
.ai-loading { padding: 32px 20px; display: flex; flex-direction: column; align-items: center; gap: 10px; color: var(--accent); }
.ai-loading .skel { width: 100%; }
.ai-loading .i { animation: pulse 1.2s infinite; }
.transcript { padding: 8px 16px; }
.tr-line { padding: 8px 0; border-bottom: 1px solid var(--border); }
.tr-who { font-weight: 700; font-size: 13.5px; }
.tr-time { color: var(--text-3); font-size: 12px; margin-left: 8px; }
.tr-line p { margin: 2px 0 0; }

/* ---------- Modals, popovers, sheets ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 16px;
  background: rgba(15, 23, 42, 0.55); animation: fade 0.15s ease-out;
}
@keyframes fade { from { opacity: 0; } }
.modal {
  width: 100%; max-width: 520px; max-height: calc(100dvh - 32px); display: flex; flex-direction: column;
  background: var(--bg); border-radius: 14px; box-shadow: var(--shadow-lg); animation: pop 0.18s ease-out;
}
.modal.wide { max-width: 720px; }
@keyframes pop { from { transform: translateY(8px) scale(0.98); opacity: 0; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 16px 8px 22px; }
.modal-head h2 { margin: 0; font-size: 19px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.modal-body { padding: 8px 22px 22px; overflow-y: auto; }
.modal-text { margin: 0 0 4px; color: var(--text-2); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.lightbox { display: grid; place-items: center; background: #000; border-radius: var(--radius); }
.lightbox img { max-height: 70dvh; object-fit: contain; }

.pop-layer { position: fixed; inset: 0; z-index: 70; pointer-events: none; }
.popover {
  position: fixed; pointer-events: auto; min-width: 220px; max-width: min(340px, calc(100vw - 16px)); padding: 6px;
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); animation: pop 0.12s ease-out;
}
.sheet-backdrop { position: fixed; inset: 0; z-index: 70; background: rgba(15, 23, 42, 0.45); display: flex; align-items: flex-end; animation: fade 0.15s; }
.sheet {
  width: 100%; max-height: 80dvh; overflow-y: auto; padding: 8px 8px calc(12px + var(--safe-b));
  background: var(--bg); border-radius: 16px 16px 0 0; box-shadow: var(--shadow-lg); animation: up 0.2s ease-out;
}
.sheet::before { content: ''; display: block; width: 40px; height: 4px; border-radius: 4px; margin: 2px auto 10px; background: var(--border-strong); }
@keyframes up { from { transform: translateY(100%); } }
.menu { display: flex; flex-direction: column; }
.menu-header { display: flex; flex-direction: column; padding: 8px 10px 10px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.menu-header small { color: var(--text-3); }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 36px; padding: 6px 10px; border-radius: var(--radius-sm); text-align: left; font-size: 14px; }
.sheet .menu-item { min-height: 46px; font-size: 15px; }
.menu-item:hover, .menu-item:focus-visible { background: var(--accent); color: #fff; outline: none; }
.menu-item.danger { color: var(--danger); }
.menu-item.danger:hover { background: var(--danger); color: #fff; }
.menu-item kbd { margin-left: auto; }
.menu-divider { height: 1px; margin: 4px 6px; background: var(--border); }
.sheet-reactions { display: flex; justify-content: space-around; padding: 4px 4px 10px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }

.emoji-pop { width: 340px; }
.emoji-picker { display: flex; flex-direction: column; gap: 8px; }
.emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; max-height: 260px; overflow-y: auto; }
.sheet .emoji-grid { max-height: 50dvh; }
.emoji-btn { height: 38px; border-radius: var(--radius-sm); font-size: 22px; line-height: 1; display: grid; place-items: center; }
.emoji-btn.lg { width: 46px; height: 46px; font-size: 26px; border-radius: 50%; background: var(--bg-soft); }
.emoji-btn:hover { background: var(--bg-hover); }
.react-row { display: flex; gap: 2px; }

.toasts { position: fixed; z-index: 80; top: calc(12px + var(--safe-t)); left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; width: min(440px, calc(100vw - 24px)); pointer-events: none; }
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 10px; padding: 10px 8px 10px 14px; border-radius: var(--radius-lg);
  background: #111827; color: #f9fafb; box-shadow: var(--shadow-lg); font-size: 14px; animation: pop 0.18s ease-out;
}
.toast.error { background: #7f1d1d; }
.toast.success { background: #14532d; }
.toast.out { opacity: 0; transform: translateY(6px); transition: 0.18s; }
.toast-msg { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.toast-action { color: #a5b4fc; font-weight: 700; padding: 4px 8px; border-radius: 6px; white-space: nowrap; }
.toast-action:hover { background: rgba(255, 255, 255, 0.1); }
.toast .icon-btn { color: #d1d5db; }
.toast .icon-btn:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }

/* People picker, chips, settings */
.picker { border: 1px solid var(--border-strong); border-radius: var(--radius); overflow: hidden; }
.picker-box { display: flex; flex-wrap: wrap; gap: 6px; padding: 6px; border-bottom: 1px solid var(--border); }
.picker-chips { display: contents; }
.picker-input { flex: 1; min-width: 140px; height: 30px; border: 0; outline: 0; background: transparent; padding: 0 6px; }
.picker-list { max-height: 240px; overflow-y: auto; padding: 4px; }
.picker-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 6px 8px; border-radius: var(--radius-sm); text-align: left; }
.picker-item:hover { background: var(--bg-hover); }
.picker-item.on { background: var(--accent-soft); }
.picker-item .check { color: var(--accent); width: 18px; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 4px 0 4px; border-radius: 6px; background: var(--accent-soft); color: var(--accent-text); font-size: 13px; font-weight: 600; }
.chip-x { width: 20px; height: 20px; display: grid; place-items: center; border-radius: 4px; }
.chip-x:hover { background: rgba(0, 0, 0, 0.08); }
.browse-bar { display: flex; gap: 8px; margin-bottom: 8px; }
.browse-row { border-bottom: 1px solid var(--border); border-radius: 0; }
.browse-list { padding: 0; max-height: 55dvh; overflow-y: auto; }
.ok { color: var(--success); font-weight: 600; }
.avatar-edit { display: flex; align-items: center; gap: 16px; }
.file-btn { cursor: pointer; }
.status-input { display: flex; gap: 8px; }
.emoji-pick { width: 40px; height: 40px; border: 1px solid var(--border-strong); border-radius: var(--radius); font-size: 20px; flex: none; }
.presets { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.preset { padding: 4px 10px; border-radius: 999px; border: 1px solid var(--border); font-size: 13px; }
.preset:hover { background: var(--bg-hover); }
.pw-details { margin-top: 18px; border-top: 1px solid var(--border); padding-top: 12px; }
.pw-details summary { cursor: pointer; font-weight: 600; color: var(--text-2); margin-bottom: 12px; }
.settings-block { padding: 14px 0; border-bottom: 1px solid var(--border); }
.settings-block:last-child { border-bottom: 0; }
.settings-block h3 { margin: 0 0 6px; font-size: 15px; }
.settings-block p { margin: 0 0 10px; }
.settings-block .rows { padding: 0; max-height: 300px; overflow-y: auto; }
.copy-row { display: flex; gap: 8px; }
.call-card { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 12px 0; }
.call-card h3 { margin: 14px 0 0; font-size: 20px; }
.call-actions { display: flex; gap: 36px; margin-top: 24px; }
.call-actions .round-btn { width: 60px; height: 60px; }

/* ---------- Meetings ---------- */
.meeting { position: fixed; inset: 0; z-index: 50; background: #0b0d14; color: #e5e7eb; }
.meeting .muted { color: #9ca3af; }
.pj {
  height: 100%; display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(300px, 1fr); gap: 32px; align-items: center;
  max-width: 1100px; margin: 0 auto; padding: calc(24px + var(--safe-t)) 24px calc(24px + var(--safe-b));
}
.pj-preview { position: relative; aspect-ratio: 16 / 10; border-radius: 16px; overflow: hidden; background: #1c2030; display: grid; place-items: center; }
.pj-preview video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); opacity: 0; }
.pj-preview.video-on video { opacity: 1; }
.pj-preview.video-on .pj-avatar { opacity: 0; }
.pj-toggles { position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%); display: flex; gap: 12px; }
.pj-status { position: absolute; top: 12px; left: 16px; margin: 0; font-size: 13px; }
.pj-side h2 { margin: 0 0 4px; font-size: 26px; color: #fff; }
.pj-side > .muted { margin: 0 0 16px; }
.pj-people { display: flex; align-items: center; gap: 10px; margin-bottom: 22px; font-size: 14px; }
.pj-people .avatar-stack .avatar { box-shadow: 0 0 0 2px #0b0d14; }
.meeting .switch-row small { color: #9ca3af; }
.pj-warn { margin: 16px 0 0; padding: 10px 12px; border-radius: var(--radius); background: rgba(245, 158, 11, 0.14); color: #fcd34d; font-size: 14px; }
.pj-actions { display: flex; gap: 10px; margin-top: 24px; }
.pj-actions .btn { height: 44px; padding: 0 22px; }
.meeting .btn.ghost { background: transparent; color: #e5e7eb; border-color: #374151; }
.meeting .btn.ghost:hover { background: #1f2937; }

.mt-shell { height: 100%; display: flex; flex-direction: column; padding-top: var(--safe-t); }
.mt-top { display: flex; align-items: center; gap: 10px; padding: 10px 14px; }
.mt-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.mt-info b { color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mt-sub { font-size: 12.5px; color: #9ca3af; }
.rec-badge { padding: 3px 10px; border-radius: 999px; background: #dc2626; color: #fff; font-size: 12px; font-weight: 700; animation: pulse 1.6s infinite; }
.cc-badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; background: rgba(99, 102, 241, 0.25); color: #c7d2fe; font-size: 12px; font-weight: 600; }
button.cc-badge:hover { background: rgba(99, 102, 241, 0.4); color: #fff; }
.pj-lang { margin-top: 14px; }
.meeting select.input { background: #1f2433; color: #e5e7eb; border-color: #374151; }
.meeting .label { color: #d1d5db; }
.lang-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; align-items: start; }
@media (max-width: 640px) { .lang-grid { grid-template-columns: 1fr; } }
.mt-body { flex: 1; min-height: 0; display: flex; position: relative; }
.mt-stage {
  flex: 1; min-width: 0; min-height: 0; display: grid; gap: 10px; padding: 4px 14px 10px;
  grid-template-columns: repeat(var(--cols, 1), minmax(0, 1fr)); grid-auto-rows: minmax(0, 1fr);
}
.mt-stage[data-count='2']:not(.spotlight) { align-content: center; grid-auto-rows: auto; }
.mt-stage[data-count='2']:not(.spotlight) .tile { aspect-ratio: 16 / 9; }
.mt-stage.spotlight { grid-template-columns: minmax(0, 1fr) 220px; grid-template-rows: none; grid-auto-rows: 124px; }
.mt-stage.spotlight .tile.featured { grid-column: 1; grid-row: 1 / span 20; }
.mt-stage.spotlight .tile:not(.featured) { grid-column: 2; }
.tile {
  position: relative; min-height: 0; border-radius: 14px; overflow: hidden; background: #1c2030; display: grid; place-items: center;
  outline: 3px solid transparent; outline-offset: -3px; transition: outline-color 0.15s; cursor: pointer;
}
.tile.speaking { outline-color: #22c55e; }
.tile video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; }
.tile.video-on video { opacity: 1; }
.tile.screen video { object-fit: contain; background: #000; }
.tile.mirror video { transform: scaleX(-1); }
.tile.video-on .tile-avatar { visibility: hidden; }
.tile-avatar .avatar { --size: clamp(48px, 18vmin, 96px) !important; }
.tile-label {
  position: absolute; left: 8px; bottom: 8px; display: flex; align-items: center; gap: 5px; max-width: calc(100% - 16px);
  padding: 3px 9px; border-radius: 6px; background: rgba(0, 0, 0, 0.6); color: #fff; font-size: 13px;
}
.tile-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile-mic { color: #f87171; display: flex; }
.tile-hand { position: absolute; top: 8px; left: 8px; font-size: 22px; display: none; background: rgba(0, 0, 0, 0.5); border-radius: 8px; padding: 2px 6px; }
.tile.hand .tile-hand { display: block; }
.tile-conn { position: absolute; top: 8px; right: 8px; font-size: 12px; color: #fcd34d; }
.tile-conn:not(:empty) { background: rgba(0, 0, 0, 0.6); padding: 2px 8px; border-radius: 6px; }
.tile.offstage { display: none; }
.more-tile { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; color: #e5e7eb; font-size: 15px; border: 1px dashed #374151; }
.more-tile:hover { background: #232838; }
.more-tile .avatar-stack .avatar { box-shadow: 0 0 0 2px #1c2030; }
.more-tile .muted { font-size: 12.5px; }
.mt-people { width: 300px; flex: none; margin: 4px 14px 10px 0; border-radius: 14px; background: #161a26; display: flex; flex-direction: column; min-height: 0; }
.mt-people-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 8px 6px 14px; color: #fff; }
.mt-people-list { overflow-y: auto; padding: 0 6px 8px; }
.mt-person { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 8px; font-size: 14px; }
.mt-person.speaking { background: rgba(34, 197, 94, 0.14); }
.mt-person-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #e5e7eb; }
.mt-person-name small { color: #9ca3af; }
.mt-person-name small.warn { color: #fcd34d; }
.mt-person-mic { color: #9ca3af; display: flex; }
.mt-person-mic.off { color: #f87171; }
.mt-net { padding: 3px 10px; border-radius: 999px; background: rgba(245, 158, 11, 0.2); color: #fcd34d; font-size: 12px; font-weight: 600; }
.mt-audio-btn { background: #f59e0b; color: #111827; }
.ctrl { position: relative; }
.ctrl-badge { position: absolute; top: 4px; right: 8px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: #374151; color: #fff; font-size: 11px; font-style: normal; line-height: 18px; }
.mt-captions { position: absolute; left: 50%; bottom: 96px; transform: translateX(-50%); width: min(820px, calc(100% - 32px)); display: flex; flex-direction: column; gap: 4px; pointer-events: none; z-index: 2; }
.cap { align-self: center; max-width: 100%; padding: 6px 12px; border-radius: 8px; background: rgba(0, 0, 0, 0.72); color: #fff; font-size: 16px; line-height: 1.35; }
.cap.interim { color: #d1d5db; }
.mt-float { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 3; }
.float-emoji { position: absolute; bottom: 90px; display: flex; flex-direction: column; align-items: center; animation: floatUp 3.2s ease-out forwards; }
.float-emoji span { font-size: 40px; }
.float-emoji small { font-size: 11px; background: rgba(0, 0, 0, 0.6); padding: 1px 6px; border-radius: 6px; }
@keyframes floatUp { to { transform: translateY(-55vh); opacity: 0; } }
.mt-controls { display: flex; justify-content: center; gap: 8px; padding: 10px 12px calc(14px + var(--safe-b)); flex-wrap: wrap; }
.ctrl {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-width: 64px; height: 58px; padding: 0 8px;
  border-radius: 12px; background: #1f2433; color: #e5e7eb; font-size: 11.5px; font-weight: 600; transition: background 0.15s;
}
.ctrl:hover:not(:disabled) { background: #2a3044; }
.ctrl.on { background: #4f46e5; color: #fff; }
.ctrl.off { background: #3b1d22; color: #fca5a5; }
.ctrl.danger { background: #dc2626; color: #fff; }
.ctrl.danger:hover { background: #b91c1c; }
.ctrl:disabled { opacity: 0.5; }
.react-pop { background: #1f2433; border-color: #2a3044; }
.react-pop .emoji-btn:hover { background: #2a3044; }

.mt-mini { display: none; }
.meeting.min { inset: 66px 16px auto auto; width: 300px; height: auto; border-radius: 14px; box-shadow: var(--shadow-lg); overflow: hidden; }
.meeting.min .mt-shell { display: block; height: 0; overflow: hidden; padding: 0; }
.meeting.min .mt-mini { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; }
.mt-mini-info { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.mt-mini-title { flex: 1; min-width: 0; font-weight: 700; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mt-mini-ctrls { display: flex; gap: 6px; }
.mt-mini-ctrls .ctrl { flex: 1; height: 40px; min-width: 0; }

/* ---------- Mobile tab bar ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; padding-bottom: var(--safe-b);
  background: var(--bg); border-top: 1px solid var(--border);
}
.tab-btn { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0 6px; font-size: 11px; font-weight: 600; color: var(--text-3); }
.tab-btn.active { color: var(--accent); }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  :root { --side-w: 240px; --panel-w: 360px; }
  .catchup span { display: none; }
}
@media (max-width: 960px) and (min-width: 769px) {
  .shell.has-panel { grid-template-columns: var(--side-w) minmax(0, 1fr); }
  .shell.has-panel .panel { position: fixed; top: 0; right: 0; bottom: 0; width: min(400px, 90vw); z-index: 15; box-shadow: var(--shadow-lg); }
  .members-btn { display: none; }
}
@media (max-width: 768px) {
  body { font-size: 16px; }
  .shell, .shell.has-panel { grid-template-columns: 1fr; }
  .shell[data-view='list'] .main, .shell[data-view='list'] .panel { display: none; }
  .shell[data-view='channel'] .sidebar, .shell[data-view='channel'] .panel { display: none; }
  .shell[data-view='panel'] .sidebar, .shell[data-view='panel'] .main { display: none; }
  .shell[data-view='list'] .sidebar { padding-bottom: calc(58px + var(--safe-b)); }
  .shell[data-view='panel'] .panel { border-left: 0; }
  .tabbar:not([hidden]) ~ * .panel-body { padding-bottom: 64px; }
  .side-foot { display: none; }
  .side-search kbd, .members-btn { display: none; }
  .back-btn, .panel .back-btn { display: inline-grid; margin-left: -8px; }
  .panel .close-btn { display: none; }
  .ch-head { padding-left: 8px; min-height: 54px; }
  .ch-name { font-size: 16px; }
  .msg { padding-left: 12px; padding-right: 12px; }
  .ch-composer, .panel-composer { padding-left: 10px; padding-right: 10px; }
  .composer-hint { visibility: hidden; display: block; }
  .side-item { min-height: 40px; font-size: 16px; }
  .icon-btn { width: 40px; height: 40px; }
  .modal-backdrop { align-items: end; padding: 0; }
  .modal { max-width: none !important; border-radius: 16px 16px 0 0; max-height: 92dvh; padding-bottom: var(--safe-b); animation: up 0.2s ease-out; }
  .pj { grid-template-columns: 1fr; gap: 18px; align-content: start; overflow-y: auto; }
  .pj-side h2 { font-size: 22px; }
  .mt-people { position: absolute; inset: 0 8px 8px; width: auto; margin: 0; z-index: 4; }
  .mt-stage.spotlight { grid-template-columns: 1fr; grid-auto-rows: 96px; grid-template-rows: minmax(0, 1fr); }
  .mt-stage.spotlight .tile.featured { grid-column: 1; grid-row: 1; }
  .mt-stage.spotlight .tile:not(.featured) { grid-column: auto; display: none; }
  .ctrl { min-width: 52px; height: 52px; font-size: 0; gap: 0; }
  .mt-captions { bottom: 150px; }
  .meeting.min { inset: calc(6px + var(--safe-t)) 8px auto 8px; width: auto; }
  .meeting.min .mt-mini { flex-direction: row; align-items: center; }
  .meeting.min .mt-mini-ctrls { flex: none; }
  .meeting.min .mt-mini-ctrls .ctrl { width: 44px; flex: none; }
  .att-images { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .att-images.single { grid-template-columns: minmax(0, 1fr); }
  .new-pill { bottom: 110px; }
  .result-context { left: 60px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* ---------- Guests ---------- */
.mt-invite { background: #1f2433; color: #e5e7eb; border-color: #374151; }
.mt-invite:hover { background: #2a3044; }
.mt-lobby { margin: 0 14px 6px; padding: 6px; border-radius: 12px; background: #1f2433; border: 1px solid #f59e0b55; display: flex; flex-direction: column; gap: 4px; }
.lobby-row { display: flex; align-items: center; gap: 10px; padding: 4px 6px; color: #e5e7eb; font-size: 14px; }
.lobby-row.all { justify-content: flex-end; }
.lobby-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.guest-card { text-align: left; }
.guest-kicker { margin: 18px 0 0; color: var(--text-3); font-size: 14px; }
.guest-card h1 { margin-top: 4px; }
.guest-card .muted { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.guest-fine { text-align: center; justify-content: center; }
.guest-actions { display: flex; gap: 8px; margin-top: 12px; }
.wait-spinner { width: 36px; height: 36px; margin: 18px 0 12px; border-radius: 50%; border: 3px solid var(--border); border-top-color: var(--accent); animation: spin 0.9s linear infinite; }
.guest-links-title { margin: 22px 0 6px; font-size: 15px; }
.guest-links { padding: 0; }
.guest-link { flex-wrap: wrap; border-bottom: 1px solid var(--border); border-radius: 0; }
.guest-link.fresh { background: var(--accent-soft); }
.guest-link .row-main small { white-space: normal; overflow-wrap: anywhere; }
.guest-link-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.guest-lobby-toggle { align-self: end; padding-bottom: 6px; }

/* ---------- Calendar ---------- */
.cal { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.cal-head {
  display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap; min-height: 58px; padding: 8px 12px 8px 16px;
  border-bottom: 1px solid var(--border);
}
.cal-h { display: flex; align-items: center; gap: 8px; margin: 0 6px 0 0; font-size: 17px; font-weight: 800; }
.cal-h .i { color: var(--accent); }
.cal-nav { display: flex; align-items: center; gap: 4px; flex: 1; min-width: 0; }
.cal-nav .icon-btn { color: var(--text-2); }
.cal-range { min-width: 0; margin-left: 6px; font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-tools { display: flex; align-items: center; gap: 6px; min-width: 0; }
.cal-who { width: auto; max-width: 190px; padding-right: 8px; }
.cal-new { height: 34px; }
.seg { display: inline-flex; padding: 2px; border-radius: var(--radius); background: var(--bg-hover); }
.seg-btn { height: 28px; padding: 0 10px; border-radius: 6px; font-size: 13px; font-weight: 600; color: var(--text-2); transition: background 0.15s, color 0.15s; }
.seg-btn:hover { color: var(--text); }
.seg-btn.on { background: var(--bg); color: var(--text); box-shadow: var(--shadow-sm); }
.cal-body { flex: 1; min-height: 0; display: flex; flex-direction: column; transition: opacity 0.15s; }
.cal-body.loading { opacity: 0.7; }

/* Week / day grid */
.cal-week { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.cal-week-head { display: grid; grid-template-columns: 56px repeat(var(--days), minmax(0, 1fr)); border-bottom: 1px solid var(--border); padding-right: 8px; }
.cal-dayhead { display: flex; flex-direction: column; align-items: center; padding: 6px 0 8px; color: var(--text-3); font-size: 12px; font-weight: 600; text-transform: uppercase; border-radius: var(--radius-sm); }
.cal-dayhead:hover { background: var(--bg-hover); }
.cal-dayhead b { font-size: 20px; line-height: 1.3; color: var(--text); font-weight: 700; text-transform: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; }
.cal-dayhead.today { color: var(--accent); }
.cal-dayhead.today b { background: var(--accent); color: var(--on-accent); }
.cal-scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; }
.cal-grid { position: relative; display: grid; grid-template-columns: 56px repeat(var(--days), minmax(0, 1fr)); }
.cal-hours { position: relative; }
.cal-hours span { position: absolute; right: 8px; transform: translateY(-50%); font-size: 11px; color: var(--text-3); white-space: nowrap; }
.cal-col {
  position: relative; border-left: 1px solid var(--border); cursor: cell;
  background-image: linear-gradient(to bottom, var(--border) 1px, transparent 1px);
  background-size: 100% 48px;
}
.cal-col.today { background-color: color-mix(in srgb, var(--accent) 4%, transparent); }
.cal-now { position: absolute; left: -1px; right: 0; height: 2px; background: #e11d48; z-index: 3; pointer-events: none; }
.cal-now::before { content: ''; position: absolute; left: -5px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: #e11d48; }
.cal-ev {
  position: absolute; z-index: 2; display: flex; flex-direction: column; gap: 1px; overflow: hidden; padding: 3px 6px; text-align: left;
  border-radius: 6px; border-left: 3px solid var(--ec); font-size: 12px; line-height: 1.3; color: var(--text); cursor: pointer;
  background: color-mix(in srgb, var(--ec) 16%, var(--bg)); box-shadow: 0 0 0 1px var(--bg);
  transition: filter 0.15s, box-shadow 0.15s;
}
.cal-ev:hover { filter: brightness(0.97); box-shadow: 0 0 0 1px var(--bg), var(--shadow); z-index: 4; }
.cal-ev b { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: center; gap: 4px; }
.cal-ev span { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; }
.cal-ev.short { flex-direction: row; align-items: center; gap: 6px; padding-top: 1px; padding-bottom: 1px; }
.cal-ev.short span { white-space: nowrap; }
.cal-ev.live { border-left-color: #16a34a; background: color-mix(in srgb, #16a34a 16%, var(--bg)); }
.cal-ev.past, .cal-pill.past, .cal-row.past { opacity: 0.6; }
.cal-ev.busy, .cal-pill.busy {
  background: repeating-linear-gradient(135deg, var(--bg-hover) 0 6px, var(--bg-soft) 6px 12px); border-left-color: var(--border-strong); color: var(--text-2);
}

/* Month grid */
.cal-month { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.cal-month-head { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-bottom: 1px solid var(--border); }
.cal-month-head span { padding: 6px 8px; font-size: 12px; font-weight: 600; color: var(--text-3); text-transform: uppercase; }
.cal-month-grid { flex: 1; min-height: 0; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); grid-template-rows: repeat(6, minmax(92px, 1fr)); overflow-y: auto; }
.cal-cell { display: flex; flex-direction: column; gap: 2px; min-width: 0; padding: 4px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.cal-cell:nth-child(7n) { border-right: 0; }
.cal-cell.other { background: var(--bg-soft); }
.cal-cell.other .cal-date { color: var(--text-3); }
.cal-date { align-self: flex-start; min-width: 26px; height: 26px; padding: 0 4px; border-radius: 13px; font-size: 13px; font-weight: 700; }
.cal-date:hover { background: var(--bg-hover); }
.cal-cell.today .cal-date { background: var(--accent); color: var(--on-accent); }
.cal-pill {
  display: flex; align-items: center; min-width: 0; height: 22px; padding: 0 6px; border-radius: 5px; font-size: 12px; text-align: left;
  border-left: 3px solid var(--ec); background: color-mix(in srgb, var(--ec) 14%, var(--bg)); color: var(--text);
}
.cal-pill span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-pill:hover { filter: brightness(0.96); }
.cal-more { align-self: flex-start; padding: 0 6px; font-size: 12px; font-weight: 600; color: var(--text-3); border-radius: 4px; }
.cal-more:hover { color: var(--accent); background: var(--bg-hover); }

/* List */
.cal-list { flex: 1; overflow-y: auto; padding: 4px 0 24px; overscroll-behavior: contain; }
.cal-group { padding: 0 16px; }
.cal-group-head { position: sticky; top: 0; z-index: 1; margin: 0; padding: 14px 0 6px; font-size: 13px; font-weight: 700; color: var(--text-2); background: var(--bg); }
.cal-group-head.today { color: var(--accent); }
.cal-row {
  display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: var(--radius); cursor: pointer;
  border: 1px solid var(--border); margin-bottom: 6px; background: var(--bg); transition: background 0.15s, border-color 0.15s;
}
.cal-row:hover { background: var(--bg-hover); }
.cal-row-time { display: flex; flex-direction: column; width: 72px; flex: none; }
.cal-row-time b { font-size: 14px; white-space: nowrap; }
.cal-row-time small { font-size: 12px; color: var(--text-3); }
.cal-row-bar { width: 4px; align-self: stretch; border-radius: 4px; background: var(--ec); flex: none; }
.cal-row.busy .cal-row-bar { background: repeating-linear-gradient(180deg, var(--border-strong) 0 4px, transparent 4px 8px); }
.cal-row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.cal-row-main b { display: flex; align-items: center; gap: 6px; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-row-main small { font-size: 13px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Invitation card in the conversation */
.event-card { display: flex; align-items: center; gap: 12px; padding: 12px 14px; flex-wrap: wrap; border-left: 4px solid var(--ec); }
.event-card.cancelled .card-title { text-decoration: line-through; color: var(--text-3); }
.event-card.cancelled .card-title .badge { text-decoration: none; }
.event-card.over { opacity: 0.75; }
.cal-badge {
  width: 46px; height: 50px; flex: none; display: flex; flex-direction: column; align-items: center; justify-content: center; border-radius: 10px;
  background: color-mix(in srgb, var(--ec) 14%, var(--bg)); color: var(--ec); line-height: 1.1;
}
.cal-badge small { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em; }
.cal-badge b { font-size: 20px; color: var(--text); }
.event-card .card-sub .avatar-stack .avatar { box-shadow: 0 0 0 2px var(--bg); }

/* Meeting details */
.ev-detail { display: flex; flex-direction: column; gap: 14px; }
.ev-line { display: flex; gap: 12px; align-items: flex-start; font-size: 15px; }
.ev-line > .i { color: var(--text-3); margin-top: 2px; }
.ev-line small { color: var(--text-3); font-size: 13px; display: inline-flex; align-items: center; gap: 4px; }
.ev-line a { font-weight: 600; }
.ev-people { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 6px; }
.ev-person { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; }
.ev-person small { color: var(--text-3); }
.ev-guests { list-style: none; margin: 6px 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.ev-guests li { display: flex; gap: 8px; flex-wrap: wrap; align-items: baseline; }
.ev-agenda { white-space: pre-wrap; font-size: 14px; color: var(--text-2); }
.ev-actions { display: flex; gap: 8px; flex-wrap: wrap; padding-top: 4px; }
.ev-cancelled { margin: 0; display: flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: var(--radius); background: var(--danger-soft); color: var(--danger); font-weight: 600; }
.ev-organizer { margin: -4px 0 0; }

/* Schedule dialog */
.sched { gap: 14px; }
.sched-when { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 10px; }
.sched-repeat { display: grid; grid-template-columns: 1.3fr 1fr; gap: 10px; }
.sched-end { margin: -6px 0 0; }
.sched-people-head { display: flex; align-items: center; justify-content: space-between; }
.sched-people { display: flex; flex-wrap: wrap; gap: 6px; max-height: 150px; overflow-y: auto; padding: 2px; }
.sched-person {
  position: relative; display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 10px 0 6px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--border-strong); font-size: 14px; transition: background 0.15s, border-color 0.15s;
}
.sched-person input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.sched-person.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-text); }
.sched-person:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.sched-person:has(input:disabled) { cursor: default; }
.sched-person small { color: var(--text-3); }
.sched-switches { display: flex; flex-direction: column; gap: 12px; }
.guest-emails .picker-box { border-bottom: 0; }
.guest-emails .chip { padding: 0 4px 0 8px; }
.sub-steps { margin: 14px 0; padding-left: 18px; display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.sub-warn { margin: 0 0 12px; padding: 10px 12px; border-radius: var(--radius); color: var(--warning); background: color-mix(in srgb, #f59e0b 14%, transparent); }
.guest-when { display: flex; align-items: center; gap: 8px; margin: 4px 0 8px; font-weight: 600; color: var(--text); }
.guest-when .i { color: var(--accent); }

@media (max-width: 768px) {
  .shell[data-view='calendar'] .sidebar, .shell[data-view='calendar'] .panel { display: none; }
  .shell[data-view='calendar'] .main { padding-bottom: calc(58px + var(--safe-b)); }
  .cal-head { padding: 8px 10px; gap: 8px; }
  .cal-h { flex: 1; }
  .cal-new { order: 2; width: 40px; padding: 0; }
  .cal-new span { display: none; }
  .cal-nav { order: 3; flex-basis: 100%; }
  .cal-tools { order: 4; flex-basis: 100%; }
  .cal-tools .seg { flex: none; }
  .cal-who { flex: 1; max-width: none; min-width: 0; }
  .cal-week-head, .cal-grid { grid-template-columns: 48px repeat(var(--days), minmax(0, 1fr)); }
  .cal-month-grid { grid-template-rows: repeat(6, minmax(64px, 1fr)); }
  .cal-cell { padding: 2px; cursor: pointer; }
  .cal-pill { height: 6px; padding: 0; border-left: 0; border-radius: 3px; background: var(--ec); }
  .cal-pill.busy { background: var(--border-strong); }
  .cal-pill span { display: none; }
  .cal-more { font-size: 11px; padding: 0 2px; }
  .cal-date { font-size: 12px; min-width: 24px; height: 24px; }
  .cal-group { padding: 0 10px; }
  .cal-row { gap: 10px; padding: 10px 8px; }
  .cal-row-time { width: 70px; }
  .cal-row-people { display: none; }
  .sched-when { grid-template-columns: 1fr 1fr; }
  .sched-when .field:first-child { grid-column: 1 / -1; }
  .sched-repeat { grid-template-columns: 1fr; }
  .ev-actions .btn { flex: 1 1 auto; }
}
