/* ============================================================
   Albert — modern dark UI, mobile-first responsive
   ============================================================ */

:root {
  /* Surfaces (deep, layered) */
  --bg-0: #08080b;
  --bg-1: #0d0d12;
  --bg-2: #15151c;
  --bg-3: #1d1d26;
  --bg-4: #262631;
  --bg-hover: rgba(255, 255, 255, 0.04);

  /* Borders */
  --border-subtle: rgba(255, 255, 255, 0.06);
  --border: rgba(255, 255, 255, 0.10);
  --border-strong: rgba(255, 255, 255, 0.18);

  /* Text */
  --text: #f1f1f5;
  --text-soft: #c8c8d2;
  --text-muted: #8a8a96;
  --text-dim: #5a5a64;

  /* Amber accent — Albert's signature */
  --accent: #f4b740;
  --accent-hover: #f6c25c;
  --accent-active: #d9a02f;
  --accent-soft: rgba(244, 183, 64, 0.13);
  --accent-glow: rgba(244, 183, 64, 0.32);
  --accent-text: #1a1300;
  --accent-gradient: linear-gradient(135deg, #f4b740 0%, #e89c2a 100%);

  /* States */
  --danger: #ef4444;
  --danger-soft: rgba(239, 68, 68, 0.12);
  --success: #10b981;
  --success-soft: rgba(16, 185, 129, 0.12);
  --info: #60a5fa;

  /* Glass */
  --glass-bg: rgba(20, 20, 28, 0.72);
  --glass-blur: blur(20px) saturate(140%);

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 6px 20px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 24px 64px rgba(0, 0, 0, 0.5);
  --shadow-drawer: 8px 0 32px rgba(0, 0, 0, 0.45);
  --shadow-glow: 0 0 28px var(--accent-glow);

  /* Radii */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;
  --r-xl: 22px;
  --r-2xl: 28px;
  --r-pill: 999px;

  /* Spacing scale */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 20px;
  --s-6: 24px;
  --s-7: 32px;
  --s-8: 40px;
  --s-9: 56px;
  --s-10: 72px;

  /* Transitions */
  --t-fast: 120ms cubic-bezier(0.4, 0, 0.2, 1);
  --t: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  --t-slow: 360ms cubic-bezier(0.2, 0.7, 0.2, 1);
  --t-spring: 420ms cubic-bezier(0.34, 1.18, 0.56, 1);

  /* Layout */
  --sidebar-w: 280px;
  --topbar-h: 56px;
  --compose-h: 64px;

  /* Fonts */
  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Consolas, monospace;

  /* Safe-area insets (iOS notch / home indicator) */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

/* ============================================================
   Reset + base
   ============================================================ */

*,
*::before,
*::after { box-sizing: border-box; }

/* Always respect the [hidden] HTML attribute, even on elements we
   otherwise style with display: flex / grid. Without this, rules like
   `.thread-header { display: flex }` clobber the user-agent's
   `[hidden] { display: none }`, so toggling the attribute from JS
   silently does nothing. */
[hidden] { display: none !important; }

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  overscroll-behavior-y: none;
}

body {
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg-0);
  background-image:
    radial-gradient(ellipse 70% 50% at 10% -10%, rgba(244, 183, 64, 0.10), transparent 55%),
    radial-gradient(ellipse 60% 50% at 100% 110%, rgba(244, 183, 64, 0.05), transparent 55%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
  text-rendering: optimizeLegibility;
}

@media (min-width: 760px) {
  body { font-size: 15.5px; }
}

button, input, textarea, select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: 0;
  background: transparent;
  padding: 0;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--t-fast);
}
a:hover { color: var(--accent-hover); }

::selection {
  background: var(--accent-glow);
  color: var(--text);
}

/* Scrollbar — slim, modern, only on hover-capable pointers */
@media (hover: hover) {
  ::-webkit-scrollbar { width: 10px; height: 10px; }
  ::-webkit-scrollbar-track { background: transparent; }
  ::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: var(--r-pill);
    border: 2px solid transparent;
    background-clip: content-box;
  }
  ::-webkit-scrollbar-thumb:hover {
    background: var(--border-strong);
    background-clip: content-box;
  }
}

/* ============================================================
   Auth pages — login, change-password
   ============================================================ */

.centered {
  display: grid;
  place-items: center;
  min-height: 100dvh;
  padding: var(--s-6);
  padding-top: calc(var(--s-6) + var(--safe-top));
  padding-bottom: calc(var(--s-6) + var(--safe-bottom));
}

.card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--r-2xl);
  padding: var(--s-8);
  width: min(420px, 100%);
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
}
.card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--r-2xl);
  padding: 1px;
  background: linear-gradient(135deg, var(--accent-glow), transparent 45%, transparent 55%, rgba(255,255,255,0.04));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

.card-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: var(--r-xl);
  margin: 0 0 var(--s-5);
  background: var(--accent-gradient);
  color: var(--accent-text);
  font-weight: 800;
  font-size: 1.6rem;
  letter-spacing: -0.02em;
  box-shadow: var(--shadow-glow);
}

.card h1 {
  margin: 0 0 var(--s-2);
  font-size: 1.9rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--text);
}

.card-subtitle {
  margin: 0 0 var(--s-6);
  color: var(--text-muted);
  font-size: 0.95rem;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
}

.stack label {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--text-soft);
  letter-spacing: 0.01em;
}

/* Form controls */
input[type="text"],
input[type="password"],
input[type="email"],
input:not([type]),
textarea {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--text);
  transition: border-color var(--t-fast), background var(--t-fast), box-shadow var(--t-fast);
  font-size: 16px; /* prevents iOS zoom-on-focus */
}
@media (min-width: 760px) {
  input[type="text"], input[type="password"], input[type="email"],
  input:not([type]), textarea { font-size: 0.95rem; }
}

input:hover, textarea:hover {
  border-color: var(--border-strong);
}
input:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--bg-1);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
input::placeholder, textarea::placeholder {
  color: var(--text-dim);
}

/* Primary button */
button[type="submit"],
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  padding: 12px 18px;
  min-height: 44px;
  background: var(--accent-gradient);
  color: var(--accent-text);
  border-radius: var(--r-md);
  font-weight: 600;
  letter-spacing: 0.01em;
  transition: transform var(--t-fast), box-shadow var(--t), filter var(--t-fast);
  box-shadow: var(--shadow-sm);
}
button[type="submit"]:hover,
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md), var(--shadow-glow);
  filter: brightness(1.05);
}
button[type="submit"]:active,
.btn-primary:active { transform: translateY(0); }
button[type="submit"]:disabled,
.btn-primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
  filter: none;
}

.error {
  margin: 0;
  font-size: 0.9rem;
  color: var(--danger);
  background: var(--danger-soft);
  padding: 10px 14px;
  border-radius: var(--r-md);
  border-left: 3px solid var(--danger);
}
.success {
  margin: 0;
  font-size: 0.9rem;
  color: var(--success);
  background: var(--success-soft);
  padding: 10px 14px;
  border-radius: var(--r-md);
  border-left: 3px solid var(--success);
}

/* ============================================================
   App layout
   Desktop: sidebar | main (CSS grid)
   Mobile: sidebar is a fixed drawer slid off-screen by default
   ============================================================ */

.app-layout {
  display: grid;
  grid-template-rows: auto 1fr;
  grid-template-columns: 1fr;
  height: 100dvh;
  overflow: hidden;
}

@media (min-width: 760px) {
  .app-layout {
    grid-template-columns: var(--sidebar-w) 1fr;
    grid-template-rows: 1fr;
  }
}

/* ---------- Topbar (mobile only) ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  height: calc(var(--topbar-h) + var(--safe-top));
  padding: var(--safe-top) var(--s-4) 0;
  background: var(--glass-bg);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--border-subtle);
  z-index: 30;
}
@media (min-width: 760px) {
  .topbar { display: none; }
}

.menu-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  background: transparent;
  color: var(--text);
  border-radius: var(--r-md);
  transition: background var(--t-fast);
}
.menu-btn:hover { background: var(--bg-hover); }
.menu-btn:active { background: var(--bg-3); }
.menu-btn svg { width: 22px; height: 22px; }

.topbar-brand {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
}
.topbar-brand .brand-mark {
  width: 26px; height: 26px;
  border-radius: 8px;
  background: var(--accent-gradient);
  color: var(--accent-text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.9rem;
}
.topbar-brand .brand-text { font-size: 1.02rem; }

/* ---------- Backdrop (mobile drawer overlay) ---------- */
.backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--t);
  z-index: 40;
}
.backdrop.open {
  opacity: 1;
  pointer-events: auto;
}
@media (min-width: 760px) {
  .backdrop { display: none; }
}

/* ---------- Sidebar ---------- */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: min(86vw, 320px);
  background: var(--bg-1);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  padding: calc(var(--s-5) + var(--safe-top)) var(--s-4) calc(var(--s-4) + var(--safe-bottom));
  gap: var(--s-5);
  overflow: hidden;
  z-index: 50;
  box-shadow: var(--shadow-drawer);
  transform: translateX(-100%);
  transition: transform var(--t-spring);
}
.sidebar.open {
  transform: translateX(0);
}

@media (min-width: 760px) {
  .sidebar {
    position: relative;
    width: var(--sidebar-w);
    transform: none;
    box-shadow: none;
    padding: var(--s-5) var(--s-4);
    transition: none;
  }
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: 0 var(--s-2);
}
.sidebar-brand .brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--accent-gradient);
  color: var(--accent-text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.1rem;
  box-shadow: var(--shadow-glow);
  flex-shrink: 0;
}
.sidebar-brand h1 {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

/* Primary nav: vertical stack of page links */
.primary-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.primary-nav a {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: 10px 12px;
  border-radius: var(--r-md);
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0.005em;
  transition: color var(--t-fast), background var(--t-fast);
  position: relative;
  min-height: 40px;
}
.primary-nav a svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.85;
}
.primary-nav a:hover {
  color: var(--text);
  background: var(--bg-2);
}
.primary-nav a:hover svg { opacity: 1; }
.primary-nav a.active {
  color: var(--text);
  background: var(--accent-soft);
}
.primary-nav a.active svg {
  color: var(--accent);
  opacity: 1;
}
.primary-nav a.active::before {
  content: "";
  position: absolute;
  left: -4px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  background: var(--accent);
  border-radius: var(--r-pill);
}

/* Generic linkish button (used by logout) */
.linkish {
  background: transparent;
  border: 0;
  color: var(--text-muted);
  font-size: 0.9rem;
  padding: 10px 12px;
  border-radius: var(--r-md);
  text-align: left;
  transition: color var(--t-fast), background var(--t-fast);
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  gap: var(--s-3);
}
.linkish:hover {
  color: var(--text);
  background: var(--bg-2);
}
.linkish svg { width: 18px; height: 18px; opacity: 0.85; }

/* Conversation section — only on chat page */
.sidebar-conv-section {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  flex: 1;
  min-height: 0;
  border-top: 1px solid var(--border-subtle);
  padding-top: var(--s-4);
}

/* Spacer pushes the footer to the bottom on pages without a conv section */
.sidebar-spacer { flex: 1; }

.sidebar-footer {
  border-top: 1px solid var(--border-subtle);
  padding-top: var(--s-3);
}

#new-conv-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  padding: 11px 14px;
  background: var(--bg-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-weight: 500;
  transition: background var(--t-fast), border-color var(--t-fast), transform var(--t-fast);
  min-height: 42px;
}
#new-conv-btn::before {
  content: "+";
  font-size: 1.25rem;
  line-height: 1;
  color: var(--accent);
  font-weight: 600;
}
#new-conv-btn:hover {
  background: var(--bg-3);
  border-color: var(--border-strong);
  transform: translateY(-1px);
}
#new-conv-btn:active { transform: translateY(0); }

.conv-list {
  list-style: none;
  padding: 0;
  margin: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-height: 0;
}

.conv-list li {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: 2px;
  border-radius: var(--r-md);
  transition: background var(--t-fast);
  position: relative;
}
.conv-list li:hover { background: var(--bg-2); }
.conv-list li.active { background: var(--accent-soft); }
.conv-list li.active::before {
  content: "";
  position: absolute;
  left: -8px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  background: var(--accent);
  border-radius: var(--r-pill);
}

.conv-list button.title {
  flex: 1;
  text-align: left;
  padding: 10px 12px;
  color: var(--text-soft);
  border-radius: var(--r-md);
  font-size: 0.92rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color var(--t-fast);
}
.conv-list li.active button.title {
  color: var(--text);
  font-weight: 500;
}

.conv-list button.delete {
  opacity: 0;
  padding: 6px 8px;
  color: var(--text-dim);
  border-radius: var(--r-sm);
  font-size: 1rem;
  line-height: 1;
  transition: opacity var(--t-fast), background var(--t-fast), color var(--t-fast);
}
/* on coarse pointers (mobile) the delete X is always visible */
@media (hover: none) {
  .conv-list button.delete { opacity: 0.7; }
}
@media (hover: hover) {
  .conv-list li:hover button.delete { opacity: 1; }
}
.conv-list button.delete:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

/* ============================================================
   Thread (chat page)
   ============================================================ */

.thread {
  /* Flex column so optional children (thread-header, pending-attachments,
     error) can appear/disappear without stealing the messages-area space.
     Only .messages flex-grows; everything else is auto-sized. The previous
     grid-template-rows: 1fr auto auto only worked when there were exactly
     three children -- it broke the moment we added the thread-header. */
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: transparent;
  position: relative;
  overflow: hidden;
}
.thread > * { flex: 0 0 auto; }

.messages {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: var(--s-6) var(--s-4) var(--s-3);
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
  max-width: 900px;
  width: 100%;
  margin: 0 auto;
}
@media (min-width: 760px) {
  .messages {
    padding: var(--s-8) var(--s-6) var(--s-3);
    gap: var(--s-5);
  }
}

/* Beautiful empty state for the messages list */
.messages:empty::before {
  content: "";
  display: block;
  flex: 1;
  min-height: 30vh;
  background:
    radial-gradient(circle at center, var(--accent-glow), transparent 70%) center top / 240px 240px no-repeat;
}
.messages:empty::after {
  content: "Good day. How may I help?";
  display: block;
  text-align: center;
  color: var(--text-soft);
  font-size: 1.25rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  padding: var(--s-2) var(--s-4) var(--s-9);
  background:
    radial-gradient(circle at center, var(--accent) 0%, var(--accent) 22%, transparent 25%) center -120px / 56px 56px no-repeat;
}

.msg {
  max-width: 88%;
  padding: 12px 16px;
  border-radius: var(--r-xl);
  word-wrap: break-word;
  overflow-wrap: anywhere;
  line-height: 1.6;
  font-size: 0.97rem;
  animation: msg-in 280ms cubic-bezier(0.2, 0.8, 0.2, 1);
  position: relative;
}
@media (min-width: 760px) {
  .msg { max-width: 78%; padding: 14px 18px; }
}

.msg.user { white-space: pre-wrap; }
/* Assistant uses rendered markdown, browser handles whitespace */

@keyframes msg-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.msg.user {
  align-self: flex-end;
  background: var(--accent-gradient);
  color: var(--accent-text);
  font-weight: 500;
  box-shadow: var(--shadow-sm);
  border-bottom-right-radius: var(--r-sm);
}

.msg.assistant {
  align-self: flex-start;
  background: var(--bg-2);
  border: 1px solid var(--border-subtle);
  color: var(--text);
  border-bottom-left-radius: var(--r-sm);
  box-shadow: var(--shadow-sm);
}

/* Markdown rendering inside assistant bubbles */
.msg.assistant > *:first-child { margin-top: 0; }
.msg.assistant > *:last-child { margin-bottom: 0; }
.msg.assistant p,
.msg.assistant ul,
.msg.assistant ol,
.msg.assistant pre,
.msg.assistant blockquote,
.msg.assistant table {
  margin: 0 0 var(--s-3);
}
.msg.assistant p:last-child,
.msg.assistant ul:last-child,
.msg.assistant ol:last-child,
.msg.assistant pre:last-child,
.msg.assistant blockquote:last-child,
.msg.assistant table:last-child { margin-bottom: 0; }
.msg.assistant h1,
.msg.assistant h2,
.msg.assistant h3,
.msg.assistant h4 {
  margin: var(--s-4) 0 var(--s-2);
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.35;
}
.msg.assistant h1 { font-size: 1.2rem; }
.msg.assistant h2 { font-size: 1.1rem; }
.msg.assistant h3 { font-size: 1.02rem; }
.msg.assistant h4 { font-size: 0.96rem; color: var(--text-soft); }
.msg.assistant ul,
.msg.assistant ol { padding-left: 1.4em; }
.msg.assistant li + li { margin-top: 3px; }
.msg.assistant li > p { margin: 0; }
.msg.assistant code {
  font-family: var(--font-mono);
  font-size: 0.86em;
  background: var(--bg-3);
  border: 1px solid var(--border-subtle);
  padding: 1px 6px;
  border-radius: var(--r-sm);
}
.msg.assistant pre {
  padding: 12px 14px;
  background: var(--bg-0);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-md);
  overflow-x: auto;
  font-size: 0.85rem;
  line-height: 1.5;
}
.msg.assistant pre code {
  background: transparent;
  border: 0;
  padding: 0;
  border-radius: 0;
  font-size: inherit;
}
.msg.assistant blockquote {
  border-left: 3px solid var(--accent);
  padding: 2px 12px;
  color: var(--text-soft);
}
.msg.assistant table {
  border-collapse: collapse;
  font-size: 0.9rem;
  display: block;
  overflow-x: auto;
  max-width: 100%;
}
.msg.assistant th,
.msg.assistant td {
  border: 1px solid var(--border);
  padding: 6px 10px;
  text-align: left;
}
.msg.assistant th {
  background: var(--bg-3);
  font-weight: 600;
}
.msg.assistant a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: var(--accent-glow);
  text-underline-offset: 2px;
}
.msg.assistant a:hover { text-decoration-color: var(--accent); }
.msg.assistant hr {
  border: 0;
  border-top: 1px solid var(--border-subtle);
  margin: var(--s-3) 0;
}
.msg.assistant strong { color: var(--text); font-weight: 600; }
.msg.assistant em { color: var(--text); font-style: italic; }

/* ============================================================
   Thread header: title + optional job tag + mode pill
   Shown above messages once a conversation is selected.
   ============================================================ */

.thread-header {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  border-bottom: 1px solid var(--border-subtle);
  background: var(--glass-bg);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  flex-wrap: wrap;
  z-index: 5;
}
.thread-title {
  font-weight: 600;
  font-size: 0.98rem;
  color: var(--text);
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.thread-job {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--r-pill);
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid rgba(244, 183, 64, 0.3);
}
.thread-mode {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--r-pill);
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: 1px solid var(--border);
  color: var(--text-muted);
  background: var(--bg-2);
}
.thread-mode.mode-brainstorm { color: #c4b5fd; border-color: rgba(196,181,253,0.3); background: rgba(139,92,246,0.12); }
.thread-mode.mode-analyze    { color: #67e8f9; border-color: rgba(103,232,249,0.3); background: rgba(34,211,238,0.10); }
.thread-mode.mode-job        { color: var(--accent); border-color: rgba(244,183,64,0.3); background: var(--accent-soft); }
.thread-mode.mode-chat       { color: var(--text-muted); }

/* Job tag inside the conversation list */
.conv-list .conv-title-text {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.conv-list button.title {
  display: flex;
  align-items: center;
  gap: var(--s-2);
}
.conv-job-tag {
  flex-shrink: 0;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 2px 6px;
  border-radius: var(--r-sm);
  background: var(--accent-soft);
  color: var(--accent);
  text-transform: uppercase;
  max-width: 90px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Stable conversation id, shown at the start of every sidebar row so
   the user can correlate with Telegram-side /resume <id>. */
.conv-id-tag {
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--text-dim);
  letter-spacing: 0.02em;
  min-width: 28px;
  text-align: right;
}
.conv-list li.active .conv-id-tag {
  color: var(--accent);
}

/* ============================================================
   Attachments — pending chips above compose form, message-level
   thumbnails / pills below each message
   ============================================================ */

.pending-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
  max-width: 900px;
  width: 100%;
  margin: 0 auto;
  padding: 0 var(--s-4);
}
@media (min-width: 760px) {
  .pending-attachments { padding: 0 var(--s-6); }
}
.pending-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 4px 6px 4px 8px;
  font-size: 0.82rem;
  color: var(--text-soft);
  max-width: 240px;
}
.pending-chip.kind-image { padding: 4px; }
.pending-chip img {
  width: 32px;
  height: 32px;
  object-fit: cover;
  border-radius: 6px;
  display: block;
}
.pending-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pending-remove {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: transparent;
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background var(--t-fast), color var(--t-fast);
}
.pending-remove:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

/* Attach (paperclip) button shares the .mic visual weight */
#attach-btn svg { width: 20px; height: 20px; }

/* Message-level attachments */
.msg-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
  margin-top: var(--s-3);
}
.att-thumb {
  max-width: 240px;
  max-height: 240px;
  border-radius: var(--r-md);
  object-fit: cover;
  display: block;
  background: var(--bg-0);
  border: 1px solid var(--border-subtle);
}
.att-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  font-size: 0.82rem;
  color: var(--text-soft);
  text-decoration: none;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.att-pill:hover {
  color: var(--text);
  border-color: var(--border-strong);
}
.att-pill svg { flex-shrink: 0; }
.msg.user .att-pill {
  background: rgba(0,0,0,0.18);
  border-color: rgba(0,0,0,0.22);
  color: rgba(26,19,0,0.85);
}

/* Generated media: /image renders ![alt](url) -> <img>; /video drops in
   a raw <video controls> tag. Both should fill the bubble width on
   mobile, cap at a sensible size on desktop, and pick up the same
   rounded corners as the surrounding chrome. */
.msg.assistant img,
.msg.assistant video {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: var(--r-md);
  margin: var(--s-2) 0;
  background: var(--bg-0);
  box-shadow: var(--shadow-sm);
}
.msg.assistant video {
  width: 100%;
  max-width: 520px;
}

/* Typing indicator */
.typing {
  align-self: flex-start;
  padding: 14px 18px;
  background: var(--bg-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-xl);
  border-bottom-left-radius: var(--r-sm);
  display: flex;
  gap: 4px;
  animation: msg-in 240ms cubic-bezier(0.2, 0.8, 0.2, 1);
  box-shadow: var(--shadow-sm);
}
.typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: typing-bounce 1.2s ease-in-out infinite;
}
.typing span:nth-child(2) { animation-delay: 0.15s; }
.typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.45; }
  30% { transform: translateY(-6px); opacity: 1; }
}

/* Memory proposal cards */
.propose-card {
  align-self: flex-start;
  max-width: 88%;
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  border-radius: var(--r-xl);
  padding: var(--s-4) var(--s-5);
  position: relative;
  animation: msg-in 320ms cubic-bezier(0.2, 0.8, 0.2, 1);
  box-shadow: var(--shadow-sm);
}
@media (min-width: 760px) {
  .propose-card { max-width: 78%; }
}
.propose-card::before {
  content: "Memory proposed";
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: var(--s-2);
}
.propose-card p {
  margin: 0 0 var(--s-3);
  color: var(--text);
}
.propose-card p:nth-child(2) {
  font-size: 1.02rem;
  font-weight: 500;
}
.propose-card .actions {
  display: flex;
  gap: var(--s-2);
  flex-wrap: wrap;
}
.propose-card .actions button {
  padding: 9px 16px;
  border-radius: var(--r-sm);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all var(--t-fast);
  min-height: 38px;
}
.propose-card .actions button:first-child {
  background: var(--accent);
  color: var(--accent-text);
}
.propose-card .actions button:first-child:hover {
  background: var(--accent-hover);
}
.propose-card .actions button:last-child {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.propose-card .actions button:last-child:hover {
  color: var(--text);
  border-color: var(--border-strong);
}

/* ============================================================
   Compose form
   ============================================================ */

.send-form {
  display: grid;
  /* attach | textarea | mic | send */
  grid-template-columns: auto 1fr auto auto;
  gap: var(--s-2);
  padding: var(--s-3) var(--s-3) calc(var(--s-3) + var(--safe-bottom));
  max-width: 900px;
  width: 100%;
  margin: 0 auto;
  align-items: end;
}
@media (min-width: 760px) {
  .send-form {
    gap: var(--s-3);
    padding: var(--s-4) var(--s-6) var(--s-6);
  }
}

.send-form textarea {
  resize: none;
  min-height: 48px;
  max-height: 240px;
  padding: 13px 16px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  line-height: 1.5;
  transition: border-color var(--t-fast), background var(--t-fast), box-shadow var(--t-fast);
}
@media (min-width: 760px) {
  .send-form textarea {
    min-height: 52px;
    padding: 14px 18px;
  }
}
.send-form textarea:focus {
  border-color: var(--border-strong);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.send-form button[type="submit"] {
  height: 48px;
  width: 48px;
  padding: 0;
  border-radius: var(--r-xl);
}
.send-form button[type="submit"] .send-label { display: none; }
.send-form button[type="submit"] svg { width: 20px; height: 20px; }

@media (min-width: 760px) {
  .send-form button[type="submit"] {
    height: 52px;
    width: auto;
    padding: 0 22px;
  }
  .send-form button[type="submit"] .send-label { display: inline; }
  .send-form button[type="submit"] svg { display: none; }
}

.send-form button.mic {
  width: 48px;
  height: 48px;
  background: var(--bg-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast);
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}
.send-form button.mic svg { width: 20px; height: 20px; }
@media (min-width: 760px) {
  .send-form button.mic { width: 52px; height: 52px; }
}
.send-form button.mic:hover {
  background: var(--bg-3);
  border-color: var(--border-strong);
}
.send-form button.mic.recording {
  background: var(--danger);
  color: white;
  border-color: var(--danger);
  animation: mic-pulse 1.4s ease-in-out infinite;
}

@keyframes mic-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.45); }
  50%      { box-shadow: 0 0 0 12px rgba(239, 68, 68, 0); }
}

.thread .error {
  margin: 0 var(--s-4) var(--s-3);
  max-width: 900px;
  width: calc(100% - var(--s-4) * 2);
  align-self: center;
}
@media (min-width: 760px) {
  .thread .error {
    margin: 0 var(--s-6) var(--s-4);
    width: calc(100% - var(--s-6) * 2);
  }
}

/* ============================================================
   Generic page (main pane) — used by memories + settings + tasks
   ============================================================ */

.page {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: var(--s-5) var(--s-4);
}
@media (min-width: 760px) {
  .page { padding: var(--s-8) var(--s-7); }
}

.page-inner {
  max-width: 920px;
  margin: 0 auto;
  width: 100%;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
  padding-bottom: var(--s-4);
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: var(--s-5);
  flex-wrap: wrap;
}
@media (min-width: 760px) {
  .page-header {
    padding-bottom: var(--s-5);
    margin-bottom: var(--s-6);
  }
}

.page-header h1 {
  margin: 0;
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--text);
}
@media (min-width: 760px) {
  .page-header h1 { font-size: 2rem; font-weight: 800; }
}

.page-action {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  padding: 8px 14px;
  min-height: 38px;
  background: var(--bg-2);
  color: var(--text-soft);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-size: 0.88rem;
  transition: all var(--t-fast);
}
.page-action:hover {
  color: var(--text);
  border-color: var(--border-strong);
  background: var(--bg-3);
}
.page-action:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.stack-horizontal {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--s-2);
  margin-bottom: var(--s-5);
  padding: var(--s-3);
  background: var(--bg-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-lg);
}
@media (min-width: 760px) {
  .stack-horizontal {
    grid-template-columns: 1fr 220px auto;
    gap: var(--s-3);
    padding: var(--s-4);
    margin-bottom: var(--s-6);
  }
}

.import-card {
  background: var(--bg-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-lg);
  margin-bottom: var(--s-5);
  overflow: hidden;
  transition: border-color var(--t-fast);
}
.import-card[open] { border-color: var(--border); }
.import-card summary {
  padding: var(--s-4) var(--s-5);
  cursor: pointer;
  font-weight: 500;
  color: var(--text-soft);
  list-style: none;
  display: flex;
  align-items: center;
  gap: var(--s-2);
  user-select: none;
  transition: color var(--t-fast), background var(--t-fast);
}
.import-card summary::-webkit-details-marker { display: none; }
.import-card summary::before {
  content: "›";
  color: var(--accent);
  font-size: 1.1rem;
  transition: transform var(--t-fast);
  display: inline-block;
  width: 14px;
  text-align: center;
}
.import-card[open] summary::before { transform: rotate(90deg); }
.import-card summary:hover {
  color: var(--text);
  background: var(--bg-2);
}
.import-card form {
  padding: 0 var(--s-5) var(--s-5);
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}
.import-card .note {
  margin: 0 0 var(--s-2);
  color: var(--text-muted);
  font-size: 0.88rem;
  line-height: 1.55;
}
.import-card textarea {
  min-height: 180px;
  resize: vertical;
  font-family: var(--font-mono);
  font-size: 0.85rem;
}
.import-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  margin-top: var(--s-1);
}
.muted {
  color: var(--text-dim);
  font-size: 0.85rem;
}

.memory-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}

.memory-list li {
  background: var(--bg-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-lg);
  padding: var(--s-4) var(--s-5);
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--s-3);
  align-items: start;
  transition: border-color var(--t-fast), background var(--t-fast);
}
@media (min-width: 560px) {
  .memory-list li {
    grid-template-columns: 1fr auto;
    gap: var(--s-4);
  }
}
.memory-list li:hover {
  border-color: var(--border);
  background: var(--bg-2);
}
.memory-list .meta {
  font-size: 0.78rem;
  color: var(--text-dim);
  margin-top: var(--s-2);
  letter-spacing: 0.02em;
}
.memory-list .actions {
  display: flex;
  gap: var(--s-2);
}
.memory-list .actions button {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 7px 12px;
  font-size: 0.85rem;
  color: var(--text-muted);
  transition: all var(--t-fast);
  min-height: 34px;
}
.memory-list .actions button:hover {
  color: var(--text);
  border-color: var(--border-strong);
  background: var(--bg-3);
}

.memory-list:empty::before {
  content: "No memories yet — add one above, or talk to Albert and let him propose them.";
  display: block;
  text-align: center;
  color: var(--text-dim);
  padding: var(--s-9) var(--s-4);
  font-size: 0.96rem;
  border: 1px dashed var(--border);
  border-radius: var(--r-lg);
}

/* ============================================================
   Tasks page
   ============================================================ */

.task-add {
  grid-template-columns: 1fr !important;
  margin-bottom: var(--s-5);
}
@media (min-width: 560px) {
  .task-add { grid-template-columns: 1fr auto !important; }
}

.task-section { margin-top: var(--s-4); }

.task-section-title {
  margin: 0 0 var(--s-3);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.task-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}

.task-item {
  background: var(--bg-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-md);
  padding: var(--s-3) var(--s-4);
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: var(--s-3);
  align-items: center;
  transition: background var(--t-fast), border-color var(--t-fast);
}
.task-item:hover {
  background: var(--bg-2);
  border-color: var(--border);
}

.task-check {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  border: 2px solid var(--border-strong);
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all var(--t-fast);
  padding: 0;
}
.task-check:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.task-item.done .task-check {
  background: var(--accent);
  border-color: var(--accent);
}
.task-item.done .task-check::after {
  content: "✓";
  color: var(--accent-text);
  font-size: 0.85rem;
  font-weight: 700;
  line-height: 1;
}

.task-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.task-content {
  color: var(--text);
  font-size: 0.95rem;
  line-height: 1.4;
  word-wrap: break-word;
}
.task-item.done .task-content {
  color: var(--text-muted);
  text-decoration: line-through;
}
.task-meta {
  font-size: 0.75rem;
  color: var(--text-dim);
  letter-spacing: 0.01em;
}

.task-actions {
  display: flex;
  gap: var(--s-1);
  opacity: 0;
  transition: opacity var(--t-fast);
}
@media (hover: hover) {
  .task-item:hover .task-actions { opacity: 1; }
}
/* On coarse pointers (touch) actions are always visible */
@media (hover: none) {
  .task-actions { opacity: 0.85; }
}
.task-actions button {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 6px 10px;
  font-size: 0.8rem;
  color: var(--text-muted);
  transition: all var(--t-fast);
  min-height: 32px;
}
.task-actions button:hover {
  color: var(--text);
  border-color: var(--border-strong);
  background: var(--bg-3);
}

.task-list:empty::before {
  content: "Nothing here — add a task above, or ask Albert to add one in chat.";
  display: block;
  text-align: center;
  color: var(--text-dim);
  padding: var(--s-7) var(--s-4);
  font-size: 0.92rem;
  border: 1px dashed var(--border);
  border-radius: var(--r-md);
}
.task-list-done:empty::before { content: "None done yet."; }

.task-done-section {
  margin-top: var(--s-6);
  border-top: 1px solid var(--border-subtle);
  padding-top: var(--s-4);
}
.task-done-section summary {
  cursor: pointer;
  list-style: none;
  padding: var(--s-2) 0;
  display: flex;
  align-items: center;
  gap: var(--s-2);
  color: var(--text-soft);
  font-weight: 500;
  user-select: none;
}
.task-done-section summary::-webkit-details-marker { display: none; }
.task-done-section summary::before {
  content: "›";
  color: var(--accent);
  font-size: 1.1rem;
  width: 14px;
  text-align: center;
  transition: transform var(--t-fast);
}
.task-done-section[open] summary::before { transform: rotate(90deg); }
.task-done-section summary .summary-label { font-weight: 500; }

/* "Clear completed" button sits inline in the summary, pushed right.
   Stop the click from also toggling the disclosure: handled in JS via
   stopPropagation. */
.task-done-section summary {
  flex-wrap: wrap;
}
.task-section-action {
  margin-left: auto;
  font-size: 0.78rem !important;
  padding: 5px 10px !important;
  min-height: 28px !important;
}

/* Archived rows: dimmer, italic content. */
.task-item.archived {
  opacity: 0.65;
}
.task-item.archived .task-content {
  font-style: italic;
}
.task-item.archived .task-check {
  border-style: dashed;
}

/* ============================================================
   Settings / status page
   ============================================================ */

.status-stack {
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
}

.status-card {
  background: var(--bg-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-lg);
  padding: var(--s-5);
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
  transition: border-color var(--t-fast);
}
@media (min-width: 760px) {
  .status-card { padding: var(--s-5) var(--s-6); }
}
.status-card:hover { border-color: var(--border); }

.status-card h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0.005em;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  flex-wrap: wrap;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 8px;
  border-radius: var(--r-pill);
  font-size: 0.76rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--text-muted);
  background: var(--bg-3);
  border: 1px solid var(--border-subtle);
}
.status-pill::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-dim);
}
.status-pill.ok {
  color: var(--success);
  background: rgba(16, 185, 129, 0.08);
  border-color: rgba(16, 185, 129, 0.24);
}
.status-pill.ok::before {
  background: var(--success);
  box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.18);
}
.status-pill.error {
  color: var(--danger);
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.24);
}
.status-pill.error::before {
  background: var(--danger);
  box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.18);
}
.status-pill.warn {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: rgba(244, 183, 64, 0.3);
}
.status-pill.warn::before {
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-glow);
}

.kv {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2px var(--s-3);
  margin: 0;
  font-size: 0.92rem;
}
@media (min-width: 560px) {
  .kv {
    grid-template-columns: 160px 1fr;
    gap: var(--s-2) var(--s-5);
  }
}
.kv dt {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.85rem;
  padding-top: 1px;
}
@media (max-width: 559px) {
  .kv dt { margin-top: var(--s-2); }
}
.kv dd {
  margin: 0;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.86rem;
  word-break: break-all;
}
.kv dd.err {
  color: var(--danger);
  font-family: var(--font-sans);
  font-size: 0.9rem;
}
.kv dd em {
  color: var(--text-dim);
  font-style: italic;
  font-family: var(--font-sans);
}

.status-card .note {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.55;
}
.status-card .note code {
  background: var(--bg-3);
  padding: 2px 6px;
  border-radius: var(--r-sm);
  font-family: var(--font-mono);
  font-size: 0.85em;
  color: var(--text);
}

.status-loading {
  text-align: center;
  padding: var(--s-9) var(--s-4);
  color: var(--text-dim);
}
.status-loading::after {
  content: "…";
  display: inline-block;
  animation: ellipsis 1.4s steps(4, end) infinite;
  width: 1.2em;
  text-align: left;
}
@keyframes ellipsis {
  0%, 25%   { content: "."; }
  50%       { content: ".."; }
  75%, 100% { content: "..."; }
}

/* Prevent body scroll when the drawer is open on mobile */
body.drawer-open { overflow: hidden; }
@media (min-width: 760px) {
  body.drawer-open { overflow: visible; }
}

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