:root {
  color-scheme: light;
  --green: #16a34a;
  --green-dark: #15803d;
  --red: #eb5757;
  --orange: #f2994a;
  --bg: #f7f7f5;
  --bg-side: #fbfbfa;
  --card: #ffffff;
  --text: #37352f;
  --muted: #787774;
  --faint: #9b9a97;
  --line: #e9e9e7;
  --hover: #f1f1ef;
  --active: #e8e8e6;
  --input: #ffffff;
  --link: #2383e2;
  --shadow: rgba(15, 15, 15, 0.12);
  --scrim: rgba(0, 0, 0, 0.35);
  --msg-hover: #f1f1ef;
  --msg-bot: #ecfdf5;
  --msg-bot-hover: #e3f9ef;
  --msg-mention: #fff9db;
  --msg-mention-hover: #fff5c4;
  --mention-bg: rgba(35, 131, 226, 0.12);
  --mention: #1b6ec2;
  --mention-me-bg: #fde68a;
  --mention-me: #7a4b00;
  --tag-bg: #bbf7d0;
  --tag: #166534;
  --pill-on-bg: #dcfce7;
  --pill-on-line: #86efac;
  --danger-line: #f3c6c6;
  --danger-bg: #fdf0f0;
  --high-bg: #fdeaea;
  --toast: #2f2e2b;
  --toast-err: #b3261e;
  --err: #b3261e;
  --cell: #ebedf0;
  --cell1: #9be9a8;
  --cell2: #40c463;
  --cell3: #30a14e;
  --cell4: #216e39;
  --skel: #ececea;
  --skel-hi: #f6f6f4;
}
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #191919;
  --bg-side: #202020;
  --card: #252525;
  --text: #e6e6e3;
  --muted: #9b9a97;
  --faint: #7d7c78;
  --line: #2f2f2f;
  --hover: #2c2c2c;
  --active: #333333;
  --input: #1f1f1f;
  --link: #5aa9f0;
  --shadow: rgba(0, 0, 0, 0.5);
  --scrim: rgba(0, 0, 0, 0.6);
  --msg-hover: #2a2a2a;
  --msg-bot: #1b2e25;
  --msg-bot-hover: #20382d;
  --msg-mention: #3a3418;
  --msg-mention-hover: #453e1c;
  --mention-bg: rgba(90, 169, 240, 0.18);
  --mention: #7ab8f3;
  --mention-me-bg: #5c4a12;
  --mention-me: #fde68a;
  --tag-bg: #1f4d32;
  --tag: #86efac;
  --pill-on-bg: #1d3a29;
  --pill-on-line: #2f6b47;
  --danger-line: #5a2f2f;
  --danger-bg: #3a2424;
  --high-bg: #3d2626;
  --toast: #3a3a38;
  --toast-err: #b3261e;
  --err: #f28b82;
  --cell: #2c2c2c;
  --cell1: #0e4429;
  --cell2: #006d32;
  --cell3: #26a641;
  --cell4: #39d353;
  --skel: #2b2b2b;
  --skel-hi: #373737;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body { font-family: 'Inter', system-ui, sans-serif; background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5; overflow: hidden; -webkit-text-size-adjust: 100%; }
a { color: var(--link); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }

/* ---------- Layout ---------- */
.app { display: flex; height: 100vh; height: 100dvh; }
.sidebar { width: 264px; flex: none; background: var(--bg-side); border-right: 1px solid var(--line); padding: 14px 10px; overflow-y: auto; display: flex; flex-direction: column; }
.side-nav { flex: 1; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--bg); }
.topbar { height: 52px; flex: none; border-bottom: 1px solid var(--line); display: flex; align-items: center; padding: 0 18px; gap: 10px; font-weight: 600; background: var(--bg); }
.topbar-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; }
.theme-btn { background: none; border: 1px solid var(--line); border-radius: 8px; padding: 4px 10px; font-size: 15px; line-height: 1.4; flex: none; }
.theme-btn:hover { background: var(--hover); }
.menu-btn { display: none; background: none; border: none; font-size: 20px; line-height: 1; padding: 6px 8px; border-radius: 6px; }
.menu-btn:hover { background: var(--hover); }
.content { flex: 1; min-height: 0; padding: 32px 44px 56px; overflow-y: auto; }
.content.chat { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.scrim { display: none; }

.logo { display: flex; align-items: center; gap: 8px; padding: 6px 12px 18px; font-weight: 700; font-size: 16px; }
.logo-icon { width: 28px; height: 28px; background: linear-gradient(135deg, #16a34a, #15803d); border-radius: 7px; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: 13px; }
.nav-section { margin: 16px 0 6px; }
.nav-sub { margin: 2px 0 2px 10px; }
.nav-label { display: flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 600; color: var(--faint); text-transform: uppercase; padding: 5px 12px; letter-spacing: 0.5px; }
.nav-item { display: flex; align-items: center; gap: 9px; padding: 7px 12px; border-radius: 8px; font-size: 14px; color: var(--text); text-decoration: none; }
.nav-item:hover { background: var(--hover); }
.nav-item.active { background: var(--active); }
.nav-item.unread { font-weight: 700; }
.nav-item .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badges { display: flex; gap: 4px; margin-left: auto; }
button.nav-label { width: 100%; background: none; border: 0; text-align: left; border-radius: 8px; }
button.nav-label:hover { color: var(--text); background: var(--hover); }
button.nav-label.sub { text-transform: none; letter-spacing: 0; font-size: 13px; font-weight: 500; }
.nav-label .caret { display: inline-block; width: 10px; font-size: 9px; transition: transform 0.15s; }
.nav-section.shut > .nav-label .caret, .nav-sub.shut > .nav-label .caret { transform: rotate(-90deg); }
.badge { font-size: 10px; font-weight: 600; padding: 2px 6px; border-radius: 10px; min-width: 18px; text-align: center; color: #fff; line-height: 1.3; text-transform: none; letter-spacing: 0; }
.badge.red { background: var(--red); }
.badge.orange { background: var(--orange); }
.me-box { border-top: 1px solid var(--line); margin-top: 10px; padding: 12px 12px 4px; font-size: 13px; display: flex; align-items: center; gap: 8px; }
.me-box small { color: var(--faint); text-transform: capitalize; }

/* ---------- Common ---------- */
.page-title { font-size: 30px; font-weight: 700; margin-bottom: 18px; letter-spacing: -0.3px; }
.page-sub { color: var(--muted); margin-bottom: 14px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 18px 20px; margin: 14px 0; }
.card h3 { font-size: 14px; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.empty { color: var(--faint); padding: 10px 0; }
.btn { padding: 8px 14px; background: var(--green); color: #fff; border: none; border-radius: 8px; font-weight: 500; text-decoration: none; display: inline-block; transition: background 0.12s; }
.btn:hover { background: var(--green-dark); }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn.ghost { background: var(--card); color: var(--text); border: 1px solid var(--line); }
.btn.ghost:hover { background: var(--hover); }
.btn.danger { background: var(--card); color: var(--red); border: 1px solid var(--danger-line); }
.btn.danger:hover { background: var(--danger-bg); }
.btn.small { padding: 4px 10px; font-size: 12px; }
input[type=text], input:not([type]), select, textarea { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--input); min-width: 0; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.2); }
::placeholder { color: var(--faint); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.nowrap { flex-wrap: nowrap; }
.grow { flex: 1; min-width: 0; }
.hint { color: var(--muted); font-size: 12px; margin-top: 6px; }
.tabs { display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
.tab { padding: 5px 12px; border-radius: 8px; font-size: 13px; background: var(--hover); color: var(--text); text-decoration: none; border: none; display: inline-flex; align-items: center; gap: 6px; }
.tab:hover { background: var(--active); }
.tab.active { background: var(--green); color: #fff; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--toast); color: #fff; padding: 9px 16px; border-radius: 8px; font-size: 13px; z-index: 50; max-width: calc(100vw - 32px); box-shadow: 0 6px 20px var(--shadow); }
.toast.err { background: var(--toast-err); }

.avatar { width: 32px; height: 32px; border-radius: 50%; color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 14px; flex: none; }
.avatar.sm { width: 22px; height: 22px; font-size: 11px; }
.tag { font-size: 9px; font-weight: 700; letter-spacing: 0.5px; background: var(--tag-bg); color: var(--tag); padding: 1px 5px; border-radius: 4px; }

/* ---------- Gate ---------- */
.gate { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 24px; gap: 12px; background: var(--bg); color: var(--text); }
.gate .logo-icon { width: 56px; height: 56px; font-size: 22px; border-radius: 12px; }
.gate h1 { font-size: 26px; }
.gate p { color: var(--muted); max-width: 340px; }
.gate .err { color: var(--err); font-weight: 500; }

/* ---------- Space page ---------- */
.space-top { flex: none; padding: 20px 28px 0; border-bottom: 1px solid var(--line); background: var(--bg); }
.space-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.space-name { font-size: 24px; font-weight: 700; letter-spacing: -0.2px; margin-right: auto; display: flex; align-items: center; gap: 10px; min-width: 0; }
.space-name .paused { font-size: 11px; font-weight: 600; color: var(--muted); border: 1px solid var(--line); padding: 1px 8px; border-radius: 10px; }
.tabs-row { display: flex; gap: 2px; overflow-x: auto; white-space: nowrap; scrollbar-width: none; margin-bottom: -1px; }
.tabs-row::-webkit-scrollbar { display: none; }
.tabs-row .tab { background: none; border-radius: 0; padding: 8px 14px; border-bottom: 2px solid transparent; color: var(--muted); flex: none; font-size: 14px; }
.tabs-row .tab:hover { background: var(--hover); color: var(--text); }
.tabs-row .tab.active { background: none; color: var(--text); border-bottom-color: var(--green); font-weight: 600; }
.space-body { flex: 1; min-height: 0; overflow-y: auto; padding: 24px 28px 48px; }
.space-body.chat { padding: 0; overflow: hidden; display: flex; flex-direction: column; }

.tiles { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 12px 18px; min-width: 110px; }
.tile b { display: block; font-size: 24px; font-weight: 700; line-height: 1.2; }
.tile span { font-size: 12px; color: var(--muted); }
.ov-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; margin-top: 16px; }
.ov-card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 20px 22px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.ov-card.wide { grid-column: 1 / -1; border-color: var(--green); }
.ov-card h3 { font-size: 15px; display: flex; align-items: center; gap: 8px; }
.ov-meta { font-size: 12px; color: var(--muted); display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.ov-meta b { color: var(--text); }
.ov-open { margin-top: auto; font-size: 13px; font-weight: 500; text-decoration: none; }
.ov-open:hover { text-decoration: underline; }
.clamp { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- Chat ---------- */
.msgs { flex: 1; min-height: 0; overflow-y: auto; padding: 12px 24px 8px; display: flex; flex-direction: column; }
.msgs > * { flex: none; }
.msgs > :first-child, .msgs > .msg:first-child:not(.grouped) { margin-top: auto; }
.msg { position: relative; display: flex; gap: 10px; padding: 3px 8px; margin: 0 -8px; border-radius: 8px; }
.msg:not(.grouped) { margin-top: 10px; }
.msg:hover { background: var(--msg-hover); }
.msg.bot { background: var(--msg-bot); }
.msg.bot:hover { background: var(--msg-bot-hover); }
.msg.mentioned { background: var(--msg-mention); }
.msg.mentioned:hover { background: var(--msg-mention-hover); }
.msg .avatar-col { width: 32px; flex: none; }
.mbody { min-width: 0; flex: 1; }
.mhead { display: flex; align-items: center; gap: 8px; }
.mhead b { font-weight: 600; }
.time { color: var(--faint); font-size: 11px; }
.text { word-break: break-word; overflow-wrap: anywhere; }
.text a { overflow-wrap: anywhere; }
.mention { background: var(--mention-bg); color: var(--mention); border-radius: 4px; padding: 0 3px; font-weight: 500; }
.mention.me { background: var(--mention-me-bg); color: var(--mention-me); }
.chan-link { font-weight: 500; text-decoration: none; }
.chan-link:hover { text-decoration: underline; }
.reacts { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 3px; position: relative; align-items: center; }
.pill { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 1px 8px; font-size: 12px; line-height: 1.6; }
.pill:hover { background: var(--hover); }
.pill.on { background: var(--pill-on-bg); border-color: var(--pill-on-line); }
.pill.add { opacity: 0; padding: 1px 8px; color: var(--muted); }
.msg:hover .pill.add, .pill.add:focus-visible, .pill.add.open { opacity: 1; }
.picker { position: absolute; left: 0; bottom: 100%; z-index: 5; display: flex; gap: 2px; background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 4px; box-shadow: 0 6px 20px var(--shadow); }
.picker button { background: none; border: none; font-size: 18px; padding: 4px 6px; border-radius: 6px; }
.picker button:hover { background: var(--hover); }
.del { position: absolute; right: 8px; top: 2px; background: var(--card); border: 1px solid var(--line); border-radius: 6px; width: 24px; height: 24px; line-height: 1; font-size: 16px; color: var(--muted); opacity: 0; }
.msg:hover .del, .del:focus-visible { opacity: 1; }
.del:hover { color: var(--red); border-color: var(--danger-line); }
.composer { flex: none; border-top: 1px solid var(--line); padding: 12px 24px 14px; background: var(--bg); }
.composer form { display: flex; gap: 8px; align-items: flex-end; }
.composer textarea, .quick textarea { flex: 1; resize: none; max-height: 180px; line-height: 1.4; }
.note { flex: none; border-top: 1px solid var(--line); padding: 14px 16px; color: var(--muted); text-align: center; background: var(--card); }
.hint-msg { color: var(--faint); text-align: center; padding: 30px 0; }

/* Day and New dividers */
.day-div, .new-div { display: flex; align-items: center; gap: 12px; font-size: 12px; font-weight: 600; margin: 14px 0 4px; color: var(--faint); }
.day-div::before, .day-div::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.new-div { color: var(--red); }
.new-div::before { content: ''; flex: 1; height: 1px; background: var(--red); opacity: 0.6; }
.new-div span { background: var(--red); color: #fff; border-radius: 10px; padding: 0 8px; }

/* ---------- Tasks ---------- */
.task-wrap { padding: 24px 28px 48px; overflow-y: auto; flex: 1; min-height: 0; }
.task-form { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.task-form input[name=title] { flex: 1 1 220px; }
.task { display: flex; align-items: center; gap: 10px; padding: 10px 4px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.task input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--green); flex: none; }
.task .title { flex: 1 1 200px; min-width: 0; word-break: break-word; }
.task.done { opacity: 0.55; }
.task.done .title { text-decoration: line-through; }
.task select { padding: 4px 6px; font-size: 13px; }
.pill-high { background: var(--high-bg); color: var(--red); font-size: 11px; font-weight: 600; padding: 1px 8px; border-radius: 10px; }
.x-btn { background: none; border: none; font-size: 18px; line-height: 1; color: var(--faint); padding: 2px 8px; border-radius: 6px; }
.x-btn:hover { color: var(--red); background: var(--danger-bg); }

/* ---------- Home ---------- */
.home-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; align-items: start; }
.home-grid .card { margin: 0; min-width: 0; }
.home-grid .card.full { grid-column: 1 / -1; }
.quick form { display: flex; gap: 8px; align-items: flex-end; }
.feed-item { display: flex; gap: 10px; padding: 8px 6px; border-radius: 8px; cursor: pointer; }
.feed-item:hover { background: var(--hover); }
.feed-meta { font-size: 12px; color: var(--muted); display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.feed-meta b { color: var(--text); }
.feed-icon { font-size: 18px; width: 26px; text-align: center; flex: none; }
.home-task { display: flex; align-items: center; gap: 10px; padding: 6px 4px; }
.home-task input { width: 17px; height: 17px; accent-color: var(--green); }
.chan-chip { font-size: 12px; color: var(--muted); text-decoration: none; margin-left: auto; white-space: nowrap; }
.chan-chip:hover { text-decoration: underline; }
.more-link { display: inline-block; margin-top: 8px; font-size: 13px; font-weight: 500; text-decoration: none; }
.more-link:hover { text-decoration: underline; }

/* ---------- Contributions ---------- */
.grid-scroll { overflow-x: auto; padding: 4px 0 8px; max-width: 100%; }
.contribution-grid { display: grid; grid-template-rows: repeat(7, 11px); grid-auto-flow: column; grid-auto-columns: 11px; gap: 3px; width: max-content; }
.cell { width: 11px; height: 11px; border-radius: 2px; background: var(--cell); }
.cell.l1 { background: var(--cell1); }
.cell.l2 { background: var(--cell2); }
.cell.l3 { background: var(--cell3); }
.cell.l4 { background: var(--cell4); }
.legend { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); margin-top: 6px; }
.legend .cell { display: inline-block; }
.week-line { padding: 6px 0; border-bottom: 1px solid var(--line); display: flex; gap: 8px; }
.week-line:last-child { border: none; }

/* ---------- Calls & People ---------- */
.linkbox { margin-top: 8px; }
.linkbox input { flex: 1; font-size: 13px; }
.person { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.person:last-child { border: none; }
.person .info { flex: 1 1 140px; min-width: 0; }
.person small { color: var(--muted); display: block; }
.person .linkbox { flex-basis: 100%; }

/* ---------- Skeletons ---------- */
.sk { display: block; border-radius: 6px; background: linear-gradient(90deg, var(--skel) 25%, var(--skel-hi) 50%, var(--skel) 75%); background-size: 200% 100%; animation: sk-shimmer 1.4s ease-in-out infinite; }
@keyframes sk-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .sk { animation: none; } }
.sk-line { height: 12px; margin: 7px 0; }
.sk-line.w30 { width: 30%; } .sk-line.w40 { width: 40%; } .sk-line.w50 { width: 50%; } .sk-line.w70 { width: 70%; } .sk-line.w90 { width: 90%; }
.sk-msg, .sk-row { display: flex; gap: 10px; align-items: flex-start; padding: 6px 0; }
.sk-msg .sk-circle { width: 32px; height: 32px; border-radius: 50%; flex: none; }
.sk-icon { width: 26px; height: 26px; border-radius: 8px; flex: none; }
.sk-box { width: 17px; height: 17px; border-radius: 4px; flex: none; margin-top: 4px; }
.sk-tile { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 12px 18px; min-width: 110px; }
.sk-block { height: 95px; border-radius: 8px; margin: 4px 0 14px; }
.msgs > .sk-msg { margin: 0 -8px; padding: 6px 8px; }

/* ---------- Projects ---------- */
.sub-title { font-size: 13px; font-weight: 600; color: var(--faint); text-transform: uppercase; letter-spacing: 0.5px; margin: 26px 0 10px; }
.proj-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.proj-card { display: flex; align-items: center; gap: 12px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; color: var(--text); text-decoration: none; min-width: 0; }
.proj-card:hover { background: var(--hover); }
.proj-icon { font-size: 24px; width: 32px; text-align: center; flex: none; }
.proj-name { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.proj-latest { display: block; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- @ and # suggestions ---------- */
.sug { position: fixed; z-index: 40; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 4px; box-shadow: 0 6px 20px var(--shadow); overflow-y: auto; }
.sug[hidden] { display: none; }
.sug-item { display: flex; align-items: center; gap: 8px; padding: 0 10px; height: 40px; border-radius: 6px; cursor: pointer; font-size: 14px; }
.sug-item.on, .sug-item:hover { background: var(--hover); }
.sug-ico { width: 22px; text-align: center; flex: none; }
.sug-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sug-item small { color: var(--faint); }

/* ---------- Phone bottom bar ---------- */
.tabbar { display: none; }

/* ---------- Mobile ---------- */
@media (max-width: 760px) {
  :root { --bar-h: 56px; }
  .app { height: calc(100vh - var(--bar-h) - env(safe-area-inset-bottom, 0px)); height: calc(100dvh - var(--bar-h) - env(safe-area-inset-bottom, 0px)); }
  .tabbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 15; height: calc(var(--bar-h) + env(safe-area-inset-bottom, 0px)); padding-bottom: env(safe-area-inset-bottom, 0px); background: var(--bg-side); border-top: 1px solid var(--line); }
  .tab-item { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; background: none; border: 0; border-radius: 0; color: var(--muted); text-decoration: none; font-size: 11px; font-weight: 500; -webkit-tap-highlight-color: transparent; }
  .tab-item.active, .drawer-open .tab-item.more { color: var(--green); }
  .tab-item .ti { position: relative; display: block; line-height: 0; }
  .tab-item .badges { position: absolute; top: -5px; left: 100%; margin: 0 0 0 -8px; gap: 2px; }
  .tab-item .badge { font-size: 9px; padding: 1px 4px; min-width: 15px; }
  .tab-item .tl { line-height: 1.1; }
  .toast { bottom: calc(var(--bar-h) + env(safe-area-inset-bottom, 0px) + 16px); }
  .proj-grid { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; top: 0; bottom: 0; left: 0; z-index: 30; width: 280px; max-width: 86vw; transform: translateX(-100%); transition: transform 0.2s ease; box-shadow: none; }
  .drawer-open .sidebar { transform: none; box-shadow: 4px 0 24px var(--shadow); }
  .drawer-open .scrim { display: block; position: fixed; inset: 0; background: var(--scrim); z-index: 20; }
  .topbar { padding: 0 10px; }
  .content { padding: 20px 16px 32px; }
  .page-title { font-size: 24px; }
  input, select, textarea { font-size: 16px; }
  .space-top { padding: 14px 14px 0; }
  .space-name { font-size: 20px; }
  .space-body { padding: 16px 14px 32px; }
  .task-wrap { padding: 14px 14px 32px; }
  .msgs { padding: 12px 14px 8px; }
  .composer { padding: 10px 14px 12px; }
  .ov-grid, .home-grid { grid-template-columns: minmax(0, 1fr); }
  .del { opacity: 0.6; }
  .pill.add { opacity: 0.7; }
}
/* Touch screens have no hover: react/delete appear on the message you tap. */
@media (hover: none) {
  .msg .del, .msg .pill.add { display: none; }
  .msg.tapped .del, .msg.tapped .pill.add, .msg .pill.add.open { display: inline-block; opacity: 1; }
  .msg.tapped { background: var(--msg-hover); }
}
