/* cursorWeb — ChatGPT-style interface.
   Light is the base palette; dark overrides only the tokens. */
:root {
  --page: #ffffff;
  --sidebar: #f9f9f9;
  --bubble: #f4f4f4;
  --text: #0d0d0d;
  --muted: #5d5d5d;
  --border: #e5e5e5;
  --hover: rgba(0, 0, 0, .05);
  --active: rgba(0, 0, 0, .08);
  --accent: #10a37f;
  --danger: #e02e2a;
  --code-bg: #f6f6f6;
  --code-head: #ececec;
  --composer: #ffffff;
  --composer-border: rgba(0, 0, 0, .12);
  --shadow: 0 2px 12px rgba(0, 0, 0, .08);
  --radius-bubble: 1.5rem;
  --radius-composer: 1.75rem;
  --column: 48rem;
  --sidebar-w: 260px;
  --font: ui-sans-serif, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --page: #212121;
    --sidebar: #171717;
    --bubble: #303030;
    --text: #ececec;
    --muted: #b4b4b4;
    --border: #2f2f2f;
    --hover: rgba(255, 255, 255, .06);
    --active: rgba(255, 255, 255, .1);
    --code-bg: #1a1a1a;
    --code-head: #2a2a2a;
    --composer: #303030;
    --composer-border: rgba(255, 255, 255, .1);
    --shadow: 0 2px 12px rgba(0, 0, 0, .4);
  }
}

:root[data-theme="dark"] {
  --page: #212121;
  --sidebar: #171717;
  --bubble: #303030;
  --text: #ececec;
  --muted: #b4b4b4;
  --border: #2f2f2f;
  --hover: rgba(255, 255, 255, .06);
  --active: rgba(255, 255, 255, .1);
  --code-bg: #1a1a1a;
  --code-head: #2a2a2a;
  --composer: #303030;
  --composer-border: rgba(255, 255, 255, .1);
  --shadow: 0 2px 12px rgba(0, 0, 0, .4);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--page);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- login ---------- */
#login-view {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}
.login-card { width: 100%; max-width: 22rem; text-align: center; }
.login-card h1 { font-size: 1.75rem; font-weight: 600; margin: 0 0 .5rem; letter-spacing: -.02em; }
.login-card p.sub { color: var(--muted); font-size: .9375rem; margin: 0 0 2rem; }
.login-card form { display: flex; flex-direction: column; gap: .75rem; text-align: left; }
.field label { display: block; font-size: .8125rem; color: var(--muted); margin-bottom: .375rem; }
input[type="text"], input[type="password"], select.control {
  width: 100%;
  padding: .75rem 1rem;
  font: inherit;
  color: var(--text);
  background: var(--page);
  border: 1px solid var(--border);
  border-radius: .75rem;
}
input:focus { border-color: var(--accent); outline: none; }
.btn-primary {
  width: 100%;
  padding: .75rem 1rem;
  background: var(--text);
  color: var(--page);
  border-radius: 999px;
  font-weight: 500;
  transition: opacity .15s;
}
.btn-primary:hover { opacity: .85; }
.btn-primary:disabled { opacity: .4; cursor: default; }
.form-error { color: var(--danger); font-size: .875rem; min-height: 1.25rem; margin: .25rem 0 0; }

/* ---------- shell ---------- */
#app-view { display: flex; height: 100vh; overflow: hidden; }

#sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--sidebar);
  display: flex;
  flex-direction: column;
  border-right: 1px solid transparent;
}
.sidebar-top { padding: .5rem; display: flex; align-items: center; gap: .25rem; }
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: .5rem;
  color: var(--text);
  flex: 0 0 auto;
  transition: background .12s;
}
.icon-btn:hover { background: var(--hover); }
.new-chat {
  flex: 1;
  display: flex;
  align-items: center;
  gap: .625rem;
  padding: .625rem .75rem;
  border-radius: .625rem;
  font-size: .875rem;
  font-weight: 500;
  transition: background .12s;
}
.new-chat:hover { background: var(--hover); }

#chat-list { flex: 1; overflow-y: auto; padding: .5rem .5rem 1rem; }
.group-label {
  font-size: .75rem;
  font-weight: 600;
  color: var(--muted);
  padding: 1rem .75rem .375rem;
  letter-spacing: .01em;
}
.chat-row {
  display: flex;
  align-items: center;
  border-radius: .625rem;
  transition: background .12s;
  position: relative;
}
.chat-row:hover { background: var(--hover); }
.chat-row.active { background: var(--active); }
.chat-row button.open {
  flex: 1;
  min-width: 0;
  text-align: left;
  padding: .5rem .75rem;
  font-size: .875rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-row .chat-dot { margin: 0 .125rem 0 0; }
.chat-row .row-menu {
  opacity: 0;
  width: 1.75rem;
  height: 1.75rem;
  margin-right: .25rem;
  border-radius: .375rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}
.chat-row:hover .row-menu, .chat-row .row-menu:focus-visible, .chat-row.menu-open .row-menu { opacity: 1; }
.chat-row .row-menu:hover { background: var(--active); }
.chat-dot {
  display: inline-block;
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
  flex: 0 0 auto;
}
.chat-dot.waking { background: #d9822b; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .3; } }

.sidebar-bottom { padding: .5rem; border-top: 1px solid var(--border); position: relative; }
.user-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: .625rem;
  padding: .5rem;
  border-radius: .625rem;
  font-size: .875rem;
  transition: background .12s;
}
.user-btn:hover { background: var(--hover); }
.avatar {
  width: 1.75rem; height: 1.75rem;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .8125rem;
  font-weight: 600;
  flex: 0 0 auto;
  text-transform: uppercase;
}
.menu {
  position: absolute;
  background: var(--page);
  border: 1px solid var(--border);
  border-radius: .75rem;
  box-shadow: var(--shadow);
  padding: .375rem;
  min-width: 11rem;
  z-index: 60;
}
.menu.up { bottom: 3.25rem; left: .5rem; right: .5rem; }
.menu button {
  display: flex;
  align-items: center;
  gap: .625rem;
  width: 100%;
  text-align: left;
  padding: .5rem .625rem;
  border-radius: .5rem;
  font-size: .875rem;
}
.menu button:hover { background: var(--hover); }
.menu button.danger { color: var(--danger); }

#scrim { display: none; }

/* ---------- main ---------- */
main { flex: 1; display: flex; flex-direction: column; min-width: 0; position: relative; }
.topbar {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .5rem .75rem;
  min-height: 3.25rem;
  flex: 0 0 auto;
}
.topbar .title { font-size: .9375rem; font-weight: 500; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#menu-btn { display: none; }

#center { flex: 1; display: flex; flex-direction: column; min-height: 0; }
#thread-scroll { flex: 1; overflow-y: auto; scroll-behavior: smooth; }
#center.is-empty { justify-content: center; flex: 1 1 auto; }
#center.is-empty #thread-scroll { flex: 0 0 auto; overflow: visible; }
#center.is-empty #thread { padding: 0; }
#thread { max-width: var(--column); margin: 0 auto; padding: 1rem 1.25rem 2.5rem; }

#empty-state { text-align: center; padding: 0 1.25rem 1.5rem; }
#empty-state h2 { font-size: 1.75rem; font-weight: 600; letter-spacing: -.02em; margin: 0; }

.turn { margin-bottom: 1.75rem; }
.msg-user {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 1.75rem;
}
.msg-user .bubble {
  background: var(--bubble);
  border-radius: var(--radius-bubble);
  padding: .625rem 1.125rem;
  max-width: 70%;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.msg-assistant {
  margin-bottom: 1.75rem;
  line-height: 1.75;
  overflow-wrap: anywhere;
}
.msg-assistant > *:first-child { margin-top: 0; }
.msg-assistant > *:last-child { margin-bottom: 0; }
.msg-assistant p { margin: 0 0 1rem; }
.msg-assistant h1, .msg-assistant h2, .msg-assistant h3,
.msg-assistant h4, .msg-assistant h5, .msg-assistant h6 {
  margin: 1.75rem 0 .75rem;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -.01em;
}
.msg-assistant h1 { font-size: 1.5rem; }
.msg-assistant h2 { font-size: 1.3rem; }
.msg-assistant h3 { font-size: 1.125rem; }
.msg-assistant h4, .msg-assistant h5, .msg-assistant h6 { font-size: 1rem; }
.msg-assistant ul, .msg-assistant ol { margin: 0 0 1rem; padding-left: 1.5rem; }
.msg-assistant li { margin: .375rem 0; }
.msg-assistant li > ul, .msg-assistant li > ol { margin: .375rem 0; }
.msg-assistant blockquote {
  margin: 0 0 1rem;
  padding: .125rem 0 .125rem 1rem;
  border-left: 3px solid var(--border);
  color: var(--muted);
}
.msg-assistant hr { border: 0; border-top: 1px solid var(--border); margin: 1.5rem 0; }
.msg-assistant a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.inline-code {
  font-family: var(--mono);
  font-size: .875em;
  background: var(--hover);
  border-radius: .3rem;
  padding: .12em .32em;
}
.streaming::after {
  content: "";
  display: inline-block;
  width: .5rem;
  height: 1.05rem;
  background: var(--text);
  vertical-align: text-bottom;
  margin-left: .15rem;
  animation: blink 1.05s steps(2, start) infinite;
}
@keyframes blink { to { visibility: hidden; } }

.code-block {
  margin: 0 0 1rem;
  border-radius: .75rem;
  overflow: hidden;
  border: 1px solid var(--border);
}
.code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .375rem .75rem;
  background: var(--code-head);
  font-size: .75rem;
  color: var(--muted);
}
.code-lang { font-family: var(--mono); }
.code-copy { font-size: .75rem; color: var(--muted); padding: .125rem .375rem; border-radius: .25rem; }
.code-copy:hover { background: var(--hover); color: var(--text); }
.code-block pre { margin: 0; padding: .875rem 1rem; background: var(--code-bg); overflow-x: auto; }
.code-block code { font-family: var(--mono); font-size: .8125rem; line-height: 1.6; }

.table-scroll { overflow-x: auto; margin: 0 0 1rem; }
.msg-assistant table { border-collapse: collapse; width: 100%; font-size: .9375rem; }
.msg-assistant th, .msg-assistant td { border: 1px solid var(--border); padding: .5rem .75rem; text-align: left; }
.msg-assistant th { background: var(--code-head); font-weight: 600; }

/* tool + reasoning disclosures */
.disclosure {
  border: 1px solid var(--border);
  border-radius: .75rem;
  margin: 0 0 1rem;
  overflow: hidden;
  background: var(--sidebar);
}
.disclosure > summary {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .5rem .75rem;
  cursor: pointer;
  font-size: .8125rem;
  color: var(--muted);
  list-style: none;
  user-select: none;
}
.disclosure > summary::-webkit-details-marker { display: none; }
.disclosure > summary:hover { color: var(--text); }
.disclosure > summary .chev { margin-left: auto; transition: transform .15s; }
.disclosure[open] > summary .chev { transform: rotate(90deg); }
.disclosure .body { padding: .25rem .75rem .75rem; }
.disclosure .body pre {
  margin: 0;
  padding: .625rem .75rem;
  background: var(--code-bg);
  border-radius: .5rem;
  font-family: var(--mono);
  font-size: .78125rem;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 22rem;
  overflow-y: auto;
}
.disclosure .body .label {
  font-size: .6875rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
  margin: .5rem 0 .25rem;
}
.disclosure .body .label:first-child { margin-top: 0; }

.chat-image {
  display: block;
  max-width: min(28rem, 100%);
  border-radius: .75rem;
  border: 1px solid var(--border);
  margin: 0 0 1rem;
  cursor: zoom-in;
}
.file-note { font-size: .8125rem; color: var(--muted); margin: 0 0 1rem; }
.file-note a { color: var(--accent); text-decoration: none; }
.file-note a:hover { text-decoration: underline; }
.notice {
  border: 1px solid var(--danger);
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 8%, transparent);
  border-radius: .75rem;
  padding: .625rem .875rem;
  margin: 0 0 1rem;
  font-size: .875rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* typing indicator */
.thinking { display: flex; gap: .3rem; padding: .35rem 0 1.75rem; }
.thinking span {
  width: .45rem; height: .45rem; border-radius: 50%;
  background: var(--muted);
  animation: bounce 1.3s ease-in-out infinite;
}
.thinking span:nth-child(2) { animation-delay: .18s; }
.thinking span:nth-child(3) { animation-delay: .36s; }
@keyframes bounce { 0%, 60%, 100% { opacity: .25; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-.25rem); } }

/* ---------- composer ---------- */
#composer-wrap {
  flex: 0 0 auto;
  padding: 0 1.25rem .75rem;
  background: linear-gradient(to bottom, transparent, var(--page) 28%);
}
.composer-inner { max-width: var(--column); margin: 0 auto; }
#status {
  font-size: .8125rem;
  color: var(--muted);
  min-height: 1.25rem;
  padding: 0 .5rem .25rem;
  display: flex;
  align-items: center;
  gap: .4rem;
}
#status:empty { display: none; }
.composer-box {
  border: 1px solid var(--composer-border);
  background: var(--composer);
  border-radius: var(--radius-composer);
  padding: .625rem .625rem .5rem .875rem;
  box-shadow: var(--shadow);
}
.composer-box:focus-within { border-color: color-mix(in srgb, var(--text) 25%, transparent); }
#prompt {
  width: 100%;
  border: 0;
  resize: none;
  background: none;
  color: var(--text);
  font: inherit;
  line-height: 1.5;
  max-height: 200px;
  overflow-y: auto;
  padding: .25rem 0;
}
#prompt:focus { outline: none; }
#prompt::placeholder { color: var(--muted); }
.composer-row { display: flex; align-items: center; gap: .5rem; padding-top: .375rem; }
.model-pill {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  font-size: .8125rem;
  color: var(--muted);
  padding: .3rem .6rem;
  border-radius: 999px;
  border: 1px solid transparent;
}
.model-pill:hover { background: var(--hover); color: var(--text); }
.model-pill { position: relative; }
.model-pill input {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  outline: none;
  width: 8.5rem;
  cursor: text;
}
.model-pill input::placeholder { color: inherit; opacity: .8; }

#model-list {
  position: absolute;
  bottom: calc(100% + .45rem);
  left: 0;
  width: max(18rem, 100%);
  max-width: 80vw;
  max-height: 15rem;
  overflow-y: auto;
  background: var(--page);
  border: 1px solid var(--border);
  border-radius: .75rem;
  box-shadow: var(--shadow);
  padding: .25rem;
  z-index: 70;
}
#model-list .opt {
  padding: .4rem .6rem;
  border-radius: .5rem;
  font-size: .8125rem;
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#model-list .opt:hover, #model-list .opt.active { background: var(--hover); }
#model-list .opt mark { background: none; color: var(--accent); font-weight: 600; }
#model-list .hint { padding: .4rem .6rem; font-size: .75rem; color: var(--muted); }
#model-list .hint.bad { color: var(--danger); }
.spacer { flex: 1; }
#send {
  width: 2.25rem; height: 2.25rem;
  border-radius: 50%;
  background: var(--text);
  color: var(--page);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: opacity .15s;
}
#send:disabled { opacity: .25; cursor: default; }
.disclaimer { text-align: center; font-size: .75rem; color: var(--muted); margin: .5rem 0 0; }

/* ---------- files drawer ---------- */
#files-drawer {
  width: 320px;
  flex: 0 0 320px;
  background: var(--sidebar);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}
.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .875rem 1rem;
  font-size: .875rem;
  font-weight: 600;
}
#files { flex: 1; overflow-y: auto; padding: 0 .75rem 1rem; }
.file-item { margin-bottom: .875rem; }
.file-item img {
  width: 100%;
  border-radius: .5rem;
  border: 1px solid var(--border);
  display: block;
  margin-bottom: .375rem;
  cursor: zoom-in;
  background: var(--page);
}
.file-item .row { display: flex; align-items: baseline; gap: .5rem; }
.file-item a { color: var(--text); font-size: .8125rem; text-decoration: none; overflow-wrap: anywhere; }
.file-item a:hover { color: var(--accent); text-decoration: underline; }
.file-item .size { color: var(--muted); font-size: .75rem; flex: 0 0 auto; margin-left: auto; }
.empty-hint { color: var(--muted); font-size: .8125rem; padding: .5rem .25rem; }

/* ---------- lightbox + modal ---------- */
#lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  cursor: zoom-out;
  padding: 2rem;
}
#lightbox img { max-width: 100%; max-height: 100%; border-radius: .5rem; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 110;
  padding: 1.5rem;
}
.modal {
  background: var(--page);
  border-radius: 1rem;
  box-shadow: var(--shadow);
  padding: 1.5rem;
  width: 100%;
  max-width: 24rem;
}
.modal h3 { margin: 0 0 .375rem; font-size: 1.0625rem; font-weight: 600; }
.modal p { margin: 0 0 1rem; color: var(--muted); font-size: .875rem; }
.modal-actions { display: flex; justify-content: flex-end; gap: .5rem; margin-top: 1.25rem; }
.btn-ghost { padding: .5rem 1rem; border-radius: 999px; font-size: .875rem; }
.btn-ghost:hover { background: var(--hover); }
.btn-solid { padding: .5rem 1rem; border-radius: 999px; font-size: .875rem; background: var(--text); color: var(--page); }
.btn-solid.danger { background: var(--danger); color: #fff; }

/* ---------- admin ---------- */
.admin-page { max-width: 60rem; margin: 0 auto; padding: 2rem 1.5rem 4rem; }
.admin-head { display: flex; align-items: center; gap: .75rem; margin-bottom: .25rem; }
.admin-head h1 { font-size: 1.5rem; font-weight: 600; margin: 0; letter-spacing: -.02em; }
.admin-sub { color: var(--muted); font-size: .9375rem; margin: 0 0 2rem; }
.card {
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}
.card h2 { font-size: 1rem; font-weight: 600; margin: 0 0 1rem; }
table.admin { width: 100%; border-collapse: collapse; font-size: .875rem; }
table.admin th {
  text-align: left;
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
  font-weight: 600;
  padding: 0 .75rem .5rem;
  border-bottom: 1px solid var(--border);
}
table.admin td { padding: .75rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.admin tr:last-child td { border-bottom: 0; }
.role-tag {
  display: inline-block;
  font-size: .6875rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: .15rem .45rem;
  border-radius: .3rem;
  border: 1px solid var(--border);
  color: var(--muted);
}
.role-tag.admin { color: var(--accent); border-color: var(--accent); }
.row-actions { display: flex; gap: .25rem; justify-content: flex-end; }
.mini-btn { font-size: .8125rem; padding: .3rem .6rem; border-radius: .5rem; color: var(--muted); }
.mini-btn:hover { background: var(--hover); color: var(--text); }
.mini-btn:disabled { opacity: .35; cursor: default; }
.mini-btn:disabled:hover { background: none; color: var(--muted); }
.mini-btn.danger:hover { color: var(--danger); }
.add-form { display: grid; grid-template-columns: 1fr 1fr auto auto; gap: .75rem; align-items: end; }
.add-form .field { min-width: 0; }
.add-form select.control, .add-form .btn-solid { height: 2.875rem; }
.add-form .btn-solid { white-space: nowrap; }
.status-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: 1rem; }
.stat .k { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.stat .v { font-size: 1.375rem; font-weight: 600; margin-top: .125rem; }
.banner {
  border: 1px solid var(--border);
  border-radius: .75rem;
  padding: 1rem 1.25rem;
  color: var(--muted);
  font-size: .9375rem;
}

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  #files-drawer { position: fixed; right: 0; top: 0; bottom: 0; z-index: 70; box-shadow: var(--shadow); }
}
@media (max-width: 768px) {
  #menu-btn { display: inline-flex; }
  #sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    z-index: 80;
    transform: translateX(-100%);
    transition: transform .2s ease;
    box-shadow: var(--shadow);
  }
  body.sidebar-open #sidebar { transform: translateX(0); }
  body.sidebar-open #scrim {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .4);
    z-index: 75;
  }
  #files-drawer { width: min(320px, 88vw); flex-basis: min(320px, 88vw); }
  #thread { padding: 1rem 1rem 2rem; }
  #composer-wrap { padding: 0 .75rem .5rem; }
  .msg-user .bubble { max-width: 85%; }
  .add-form { grid-template-columns: 1fr; }
}

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

/* the agent's live activity readout above the composer */
#status:not(:empty) {
  animation: status-pulse 1.8s ease-in-out infinite;
}
@keyframes status-pulse { 50% { opacity: .55; } }
@media (prefers-reduced-motion: reduce) {
  #status:not(:empty) { animation: none; }
}

/* download affordance on the image lightbox */
.lightbox-download {
  position: absolute;
  top: 1rem;
  right: 1rem;
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .5rem .85rem;
  border-radius: 999px;
  background: var(--page);
  color: var(--text);
  border: 1px solid var(--border);
  font-size: .8125rem;
  font-weight: 500;
  text-decoration: none;
  box-shadow: var(--shadow);
}
.lightbox-download:hover { background: var(--hover); }

/* stacked fields inside a dialog (change password) */
.form-stack { display: flex; flex-direction: column; gap: .75rem; }
.form-stack .field label { display: block; font-size: .8125rem; color: var(--muted); margin-bottom: .375rem; }
.form-stack input { width: 100%; padding: .6rem .75rem; font: inherit; color: var(--text);
  background: var(--page); border: 1px solid var(--border); border-radius: .625rem; }
.form-stack .form-error:empty { display: none; }
