/* Sauron · memoria de trabajo — tema oscuro navy/cyan con acentos cálidos. Sin dependencias externas. */

:root {
  --bg: #090f1d;
  --bg-2: #0e1628;
  --surface: #131d33;
  --surface-2: #1a2640;
  --surface-3: #22304f;
  --border: #263455;
  --border-strong: #35476e;
  --text: #ece6da;
  --text-2: #c3bfb4;
  --muted: #8d97ad;
  --cyan: #34d6e8;
  --cyan-2: #8ceaf4;
  --cyan-dim: rgba(52, 214, 232, 0.14);
  --amber: #f2b263;
  --amber-dim: rgba(242, 178, 99, 0.16);
  --rose: #f47b7b;
  --rose-dim: rgba(244, 123, 123, 0.16);
  --green: #62d69c;
  --green-dim: rgba(98, 214, 156, 0.16);
  --violet: #b59cf5;
  --violet-dim: rgba(181, 156, 245, 0.16);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --radius: 12px;
  --radius-sm: 8px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --topbar-h: 56px;
}

* { box-sizing: border-box; }
html { height: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(52, 214, 232, 0.10), transparent 60%),
    radial-gradient(900px 500px at 110% 10%, rgba(242, 178, 99, 0.08), transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--cyan-2); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
code, pre, kbd { font-family: var(--mono); font-size: 0.92em; }
h1, h2, h3, h4 { margin: 0 0 0.5rem; line-height: 1.25; font-weight: 650; letter-spacing: -0.01em; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; color: var(--text-2); }
p { margin: 0 0 0.75rem; }
hr { border: 0; border-top: 1px solid var(--border); margin: 1rem 0; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Layout ---------- */
.app { min-height: 100dvh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 1rem;
  padding: 0 1rem;
  background: rgba(9, 15, 29, 0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 0.6rem; font-weight: 700; letter-spacing: 0.02em; white-space: nowrap; }
.brand a { color: var(--text); }
.eye {
  width: 26px; height: 26px; border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, var(--amber) 0 22%, var(--bg) 24% 34%, var(--cyan) 36% 60%, transparent 62%);
  box-shadow: 0 0 18px rgba(52, 214, 232, 0.45);
}
.nav { display: flex; gap: 0.25rem; overflow-x: auto; scrollbar-width: none; flex: 1; }
.nav::-webkit-scrollbar { display: none; }
.nav a {
  color: var(--text-2); padding: 0.35rem 0.7rem; border-radius: 999px; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 0.4rem;
}
.nav a:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.nav a.active { color: var(--cyan-2); background: var(--cyan-dim); }
.nav .pill { background: var(--amber); color: #1a1206; font-size: 0.72rem; padding: 0 0.4rem; border-radius: 999px; font-weight: 700; }
.userbox { display: flex; align-items: center; gap: 0.5rem; color: var(--muted); font-size: 0.85rem; white-space: nowrap; }
.userbox .email { max-width: 180px; overflow: hidden; text-overflow: ellipsis; }

main { flex: 1; width: 100%; max-width: 1320px; margin: 0 auto; padding: 1.25rem 1rem 3rem; }

.page-head { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; margin-bottom: 1rem; }
.page-head h1 { margin: 0; }
.page-head .grow { flex: 1; }
.subtle { color: var(--muted); font-size: 0.88rem; }
.stack { display: flex; flex-direction: column; gap: 0.75rem; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.right { margin-left: auto; }

/* ---------- Cards ---------- */
.card {
  background: linear-gradient(180deg, var(--surface), var(--bg-2));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
}
.card.tight { padding: 0.75rem; }
.card-title { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.6rem; }
.card-title h2 { margin: 0; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  padding: 0.45rem 0.85rem; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text);
  cursor: pointer; transition: background 0.15s, border-color 0.15s, transform 0.05s;
  white-space: nowrap; line-height: 1.2;
}
.btn:hover { background: var(--surface-3); border-color: var(--cyan); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn.primary { background: var(--cyan); border-color: var(--cyan); color: #04141a; font-weight: 650; }
.btn.primary:hover { background: var(--cyan-2); }
.btn.warm { background: var(--amber); border-color: var(--amber); color: #1a1206; font-weight: 650; }
.btn.danger { border-color: var(--rose); color: var(--rose); background: transparent; }
.btn.danger:hover { background: var(--rose-dim); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.sm { padding: 0.25rem 0.55rem; font-size: 0.85rem; }
.btn.icon { padding: 0.35rem; width: 32px; height: 32px; }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 0.3rem; min-width: 0; }
.page-head > select { width: auto; max-width: 100%; }
.field > label, .field > .label { font-size: 0.8rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.field .hint { font-size: 0.8rem; color: var(--muted); }
.input, input[type="text"], input[type="search"], input[type="date"], input[type="datetime-local"], input[type="url"], input[type="email"], select, textarea {
  width: 100%;
  min-width: 0;
  padding: 0.5rem 0.65rem;
  background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text); outline: none;
  min-height: 38px;
}
input:focus, select:focus, textarea:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px var(--cyan-dim); }
input::placeholder, textarea::placeholder { color: var(--muted); }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 16px) 16px, calc(100% - 11px) 16px; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 2rem; }
select[multiple] { background-image: none; min-height: 120px; }
textarea { resize: vertical; min-height: 120px; line-height: 1.5; }
textarea.md { min-height: 320px; font-family: var(--mono); font-size: 0.9rem; tab-size: 2; }
input[type="checkbox"] { accent-color: var(--cyan); width: 16px; height: 16px; }
.check { display: inline-flex; align-items: center; gap: 0.45rem; cursor: pointer; padding: 0.2rem 0; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0.85rem; }
.form-grid .span-2 { grid-column: 1 / -1; }
.form-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin-top: 0.75rem; }
.form-actions .status { color: var(--muted); font-size: 0.85rem; }
.dirty-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--amber); margin-right: 0.35rem; }
.chips { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.chip {
  display: inline-flex; align-items: center; gap: 0.3rem;
  padding: 0.15rem 0.55rem; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--border); font-size: 0.82rem; color: var(--text-2);
}
.chip.cyan { background: var(--cyan-dim); border-color: transparent; color: var(--cyan-2); }
.chip.amber { background: var(--amber-dim); border-color: transparent; color: var(--amber); }
.chip.rose { background: var(--rose-dim); border-color: transparent; color: var(--rose); }
.chip.green { background: var(--green-dim); border-color: transparent; color: var(--green); }
.chip.violet { background: var(--violet-dim); border-color: transparent; color: var(--violet); }
.chip.select { cursor: pointer; user-select: none; }
.chip.select:hover { border-color: var(--cyan); }
.chip.select.on { background: var(--cyan-dim); border-color: var(--cyan); color: var(--cyan-2); }
.chip button { all: unset; cursor: pointer; opacity: 0.7; padding: 0 0.1rem; }
.chip button:hover { opacity: 1; }
.avatar {
  width: 26px; height: 26px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.7rem; font-weight: 700; color: #0a1020; background: var(--cyan-2);
  border: 2px solid var(--bg-2); flex: none;
}
.avatar.warm { background: var(--amber); }
.avatar-stack { display: inline-flex; }
.avatar-stack .avatar + .avatar { margin-left: -8px; }

/* ---------- Topics list ---------- */
.topics-layout { display: grid; grid-template-columns: 290px 1fr; gap: 1rem; align-items: start; }
.filters { position: sticky; top: calc(var(--topbar-h) + 1rem); }
.filters summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 0.5rem; font-weight: 600; }
.filters summary::-webkit-details-marker { display: none; }
.filters .stack { margin-top: 0.75rem; }
.filters .field label { font-size: 0.75rem; }
.views-list { display: flex; flex-direction: column; gap: 0.25rem; }
.views-list a { padding: 0.3rem 0.5rem; border-radius: var(--radius-sm); color: var(--text-2); display: flex; align-items: center; gap: 0.4rem; }
.views-list a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.topic-list { display: flex; flex-direction: column; gap: 0.6rem; }
.topic-card {
  display: grid; grid-template-columns: 1fr auto; gap: 0.25rem 1rem;
  padding: 0.85rem 1rem; border: 1px solid var(--border); border-radius: var(--radius);
  background: linear-gradient(180deg, var(--surface), var(--bg-2));
  color: var(--text); transition: border-color 0.15s, transform 0.1s;
  position: relative;
}
.topic-card:hover { border-color: var(--cyan); text-decoration: none; transform: translateY(-1px); }
.topic-card.radar { border-left: 3px solid var(--amber); }
.topic-card .t-title { font-weight: 650; font-size: 1.02rem; display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.topic-card .t-meta { color: var(--muted); font-size: 0.83rem; display: flex; flex-wrap: wrap; gap: 0.35rem 0.8rem; align-items: center; }
.topic-card .t-side { display: flex; flex-direction: column; align-items: flex-end; gap: 0.35rem; font-size: 0.82rem; color: var(--muted); }
.topic-card .t-snippet { color: var(--text-2); font-size: 0.88rem; grid-column: 1 / -1; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.health-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; background: var(--muted); flex: none; }
.health-dot.ok { background: var(--green); box-shadow: 0 0 8px var(--green); }
.health-dot.warn { background: var(--amber); box-shadow: 0 0 8px var(--amber); }
.health-dot.bad { background: var(--rose); box-shadow: 0 0 8px var(--rose); }
.due.overdue { color: var(--rose); font-weight: 600; }
.due.soon { color: var(--amber); }

/* ---------- Topic detail ---------- */
.detail-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 1rem; align-items: start; }
.detail-main { display: flex; flex-direction: column; gap: 1rem; min-width: 0; }
.detail-aside { display: flex; flex-direction: column; gap: 1rem; position: sticky; top: calc(var(--topbar-h) + 1rem); }
.meta-list { display: grid; grid-template-columns: auto 1fr; gap: 0.4rem 0.75rem; font-size: 0.9rem; }
.meta-list dt { color: var(--muted); }
.meta-list dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.actions-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.4rem; }
.tabs { display: flex; gap: 0.25rem; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  background: none; border: 0; border-bottom: 2px solid transparent; padding: 0.5rem 0.75rem; color: var(--text-2); cursor: pointer; white-space: nowrap;
  display: inline-flex; gap: 0.4rem; align-items: center;
}
.tabs button.active { color: var(--cyan-2); border-bottom-color: var(--cyan); }
.tabs .count { font-size: 0.75rem; color: var(--muted); background: var(--surface-2); padding: 0 0.4rem; border-radius: 999px; }
.item-list { display: flex; flex-direction: column; gap: 0.5rem; }
.item {
  display: flex; flex-direction: column; gap: 0.2rem;
  padding: 0.65rem 0.8rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-2);
}
.item .i-title { font-weight: 600; display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.item .i-meta { color: var(--muted); font-size: 0.82rem; }
.item a.i-title { color: var(--text); }
.empty { color: var(--muted); padding: 1.25rem; text-align: center; border: 1px dashed var(--border); border-radius: var(--radius); }
details.kv { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0.4rem 0.7rem; background: var(--bg-2); }
details.kv summary { cursor: pointer; color: var(--text-2); }
.kv-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.kv-table td { padding: 0.3rem 0.4rem; vertical-align: top; border-top: 1px solid var(--border); }
.kv-table td:first-child { color: var(--muted); white-space: nowrap; width: 1%; }

/* ---------- Markdown ---------- */
.md { line-height: 1.6; overflow-wrap: anywhere; }
.md > :first-child { margin-top: 0; }
.md h1, .md h2, .md h3, .md h4 { margin-top: 1.2em; color: var(--text); }
.md h1 { font-size: 1.35rem; } .md h2 { font-size: 1.18rem; } .md h3 { font-size: 1.05rem; } .md h4 { font-size: 0.98rem; }
.md ul, .md ol { padding-left: 1.4rem; margin: 0 0 0.75rem; }
.md li { margin: 0.15rem 0; }
.md li.task { list-style: none; margin-left: -1.2rem; }
.md li.task input { margin-right: 0.4rem; vertical-align: -2px; }
.md blockquote { margin: 0 0 0.75rem; padding: 0.4rem 0.9rem; border-left: 3px solid var(--amber); background: var(--amber-dim); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; color: var(--text-2); }
.md blockquote > :last-child { margin-bottom: 0; }
.md pre { background: #070c17; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0.75rem; overflow-x: auto; margin: 0 0 0.75rem; }
.md code { background: rgba(255, 255, 255, 0.06); padding: 0.1em 0.35em; border-radius: 4px; }
.md pre code { background: none; padding: 0; }
.md table { border-collapse: collapse; margin: 0 0 0.75rem; width: 100%; font-size: 0.9rem; display: block; overflow-x: auto; }
.md th, .md td { border: 1px solid var(--border); padding: 0.3rem 0.55rem; text-align: left; }
.md th { background: var(--surface-2); }
.md a { text-decoration: underline; text-decoration-color: rgba(140, 234, 244, 0.4); }
.md hr { margin: 1rem 0; }
.md .img-ref { color: var(--muted); font-style: italic; }
.md-preview { border: 1px dashed var(--border); border-radius: var(--radius-sm); padding: 0.75rem 1rem; min-height: 120px; background: var(--bg-2); }
.editor-toolbar { display: flex; gap: 0.35rem; align-items: center; margin-bottom: 0.4rem; flex-wrap: wrap; }
.editor-toolbar .spacer { flex: 1; }

/* ---------- Conversation ---------- */
.conv { display: flex; flex-direction: column; gap: 0.75rem; }
.conv-list { display: flex; gap: 0.35rem; flex-wrap: wrap; align-items: center; }
.messages { display: flex; flex-direction: column; gap: 0.6rem; max-height: 60vh; overflow-y: auto; padding: 0.25rem; scroll-behavior: smooth; }
.msg { max-width: 92%; padding: 0.6rem 0.85rem; border-radius: 14px; border: 1px solid var(--border); background: var(--bg-2); }
.msg .who { font-size: 0.72rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 0.2rem; }
.msg.user { align-self: flex-end; background: var(--cyan-dim); border-color: rgba(52, 214, 232, 0.35); border-bottom-right-radius: 4px; }
.msg.assistant { align-self: flex-start; border-bottom-left-radius: 4px; background: var(--surface-2); }
.msg.system { align-self: center; font-size: 0.85rem; color: var(--muted); background: transparent; border-style: dashed; }
.msg .md > :last-child { margin-bottom: 0; }
.thinking { display: inline-flex; align-items: center; gap: 0.35rem; color: var(--muted); font-size: 0.85rem; }
.thinking i { width: 6px; height: 6px; border-radius: 50%; background: var(--cyan); animation: blink 1.2s infinite; }
.thinking i:nth-child(2) { animation-delay: 0.2s; }
.thinking i:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%, 80%, 100% { opacity: 0.2; } 40% { opacity: 1; } }
.composer { display: flex; gap: 0.5rem; align-items: flex-end; position: sticky; bottom: 0; background: var(--surface); padding-top: 0.5rem; padding-bottom: env(safe-area-inset-bottom); }
.composer textarea { min-height: 44px; max-height: 40vh; resize: none; }
.composer .btn { height: 44px; }
.conv-status { font-size: 0.82rem; color: var(--muted); display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.conv-status .err { color: var(--rose); }

/* ---------- Proposals ---------- */
.proposal { display: flex; flex-direction: column; gap: 0.5rem; }
.proposal .p-head { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.proposal .p-head .title { font-weight: 650; }
.changes { display: grid; grid-template-columns: auto 1fr; gap: 0.3rem 0.75rem; font-size: 0.9rem; }
.changes .k { color: var(--muted); white-space: nowrap; }
.changes .v { min-width: 0; }
.changes .old { color: var(--rose); text-decoration: line-through; opacity: 0.8; margin-right: 0.4rem; overflow-wrap: anywhere; }
.changes .new { color: var(--green); overflow-wrap: anywhere; }
.changes .md-diff { border-left: 2px solid var(--green); padding-left: 0.6rem; margin-top: 0.2rem; }

/* ---------- Tables (business) ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); }
table.data { border-collapse: collapse; width: 100%; font-size: 0.87rem; font-variant-numeric: tabular-nums; }
table.data th, table.data td { padding: 0.4rem 0.6rem; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap; }
table.data th { position: sticky; top: 0; background: var(--surface-2); cursor: pointer; user-select: none; }
table.data th.sorted::after { content: " ▾"; color: var(--cyan); }
table.data th.sorted.asc::after { content: " ▴"; }
table.data tr:hover td { background: rgba(255, 255, 255, 0.025); }
table.data td.num { text-align: right; }

/* ---------- Login ---------- */
.login { min-height: calc(100dvh - var(--topbar-h)); display: grid; place-items: center; padding: 2rem 1rem; }
.login .card { max-width: 420px; width: 100%; text-align: center; padding: 2rem; }
.login .eye { width: 64px; height: 64px; margin: 0 auto 1rem; }
.login p { color: var(--text-2); }

/* ---------- Feedback ---------- */
.toasts { position: fixed; right: 1rem; bottom: calc(1rem + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 0.5rem; z-index: 60; max-width: min(420px, calc(100vw - 2rem)); }
.toast { padding: 0.65rem 0.9rem; border-radius: var(--radius-sm); background: var(--surface-3); border: 1px solid var(--border-strong); box-shadow: var(--shadow); display: flex; gap: 0.6rem; align-items: flex-start; animation: rise 0.2s ease-out; }
.toast.error { border-color: var(--rose); }
.toast.ok { border-color: var(--green); }
.toast button { all: unset; cursor: pointer; color: var(--muted); margin-left: auto; }
@keyframes rise { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
.loading { color: var(--muted); display: flex; align-items: center; gap: 0.5rem; padding: 1rem 0; }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--border-strong); border-top-color: var(--cyan); animation: spin 0.8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { height: 64px; border-radius: var(--radius); background: linear-gradient(90deg, var(--surface) 25%, var(--surface-2) 50%, var(--surface) 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.error-box { border: 1px solid var(--rose); background: var(--rose-dim); border-radius: var(--radius); padding: 0.75rem 1rem; display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; }
.banner { border: 1px solid var(--amber); background: var(--amber-dim); border-radius: var(--radius-sm); padding: 0.5rem 0.8rem; display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; font-size: 0.9rem; }

/* ---------- Modal ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(3, 6, 14, 0.7); backdrop-filter: blur(3px); z-index: 50; display: grid; place-items: center; padding: 1rem; }
.modal { width: 100%; max-width: 560px; max-height: calc(100dvh - 2rem); overflow-y: auto; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.25rem; }
.modal h2 { margin-bottom: 0.75rem; }
.modal .form-actions { justify-content: flex-end; }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .topics-layout, .detail-layout { grid-template-columns: 1fr; }
  .filters, .detail-aside { position: static; }
  .detail-aside { order: -1; }
  .detail-aside .card { padding: 0.75rem; }
}
@media (max-width: 640px) {
  body { font-size: 14.5px; }
  main { padding: 0.85rem 0.75rem 4rem; }
  .topbar { gap: 0.5rem; padding: 0 0.6rem; }
  .brand span.text { display: none; }
  .userbox .email { display: none; }
  .topic-card { grid-template-columns: 1fr; }
  .topic-card .t-side { flex-direction: row; align-items: center; flex-wrap: wrap; }
  .messages { max-height: none; }
  .composer { position: sticky; bottom: 0; }
  .actions-grid { grid-template-columns: 1fr 1fr; }
  .modal { padding: 1rem; }
  .form-grid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
