:root {
  color-scheme: light dark;
  --bg: #f6f5f2;
  --surface: #ffffff;
  --surface-2: #efede8;
  --text: #1d1f23;
  --muted: #646872;
  --border: #e0ddd5;
  --accent: #2f6f5e;
  --accent-hover: #285f50;
  --accent-text: #ffffff;
  --user-bubble: #2f6f5e;
  --user-text: #ffffff;
  --danger: #b3261e;
  --radius: 18px;
  --topbar-height: 56px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16181d;
    --surface: #1f2229;
    --surface-2: #282c34;
    --text: #e8e9ec;
    --muted: #a1a6b0;
    --border: #30343c;
    --accent: #7cc4ad;
    --accent-hover: #93d2bd;
    --accent-text: #0f1a16;
    --user-bubble: #2c5c4f;
    --user-text: #eef7f3;
    --danger: #f2a7a1;
  }
}

* { box-sizing: border-box; }

html, body { margin: 0; height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
}

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Buttons */
button, .button-primary, .button-quiet { font: inherit; cursor: pointer; }

.button-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 18px;
  border: 0;
  border-radius: 12px;
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 600;
  text-decoration: none;
}
.button-primary:hover { background: var(--accent-hover); }
.button-primary:disabled { opacity: 0.6; cursor: default; }
.button-block { width: 100%; }

.button-quiet {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  text-decoration: none;
}
.button-quiet:hover { background: var(--surface-2); }

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 40px; height: 40px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
}
.icon-button:hover { background: var(--surface-2); }

/* App shell */
.app {
  display: grid;
  grid-template-rows: var(--topbar-height) 1fr;
  /* --app-height is the area the on-screen keyboard leaves (set in app.js); dvh ignores the keyboard. */
  height: var(--app-height, 100dvh);
}

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  padding-top: env(safe-area-inset-top);
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.brand { margin: 0; font-size: 18px; font-weight: 700; letter-spacing: -0.01em; }
.topbar-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.topbar-actions form { margin: 0; }
.me { color: var(--muted); font-size: 14px; }
.nav-toggle { display: none; margin-left: -8px; }

.layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 0;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 12px;
  border-right: 1px solid var(--border);
  background: var(--bg);
  overflow-y: auto;
}
.nav-item {
  padding: 8px 12px;
  border-radius: 10px;
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
}
.nav-item[aria-current="page"] { background: var(--surface-2); }
.nav-heading {
  margin: 16px 12px 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.topic-list { margin: 0; padding: 0; list-style: none; }
.topic { padding: 8px 12px; border-radius: 10px; }
.nav-empty { margin: 0 12px; color: var(--muted); font-size: 14px; }
.status {
  margin-top: auto;
  padding: 12px;
  color: var(--muted);
  font-size: 13px;
}
.status p { margin: 2px 0; }

/* Chat */
.chat {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
}

.messages {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: 0;
  padding: 20px 16px;
  list-style: none;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.message {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  max-width: min(44rem, 86%);
}
.message.user { align-self: flex-end; align-items: flex-end; }

.bubble {
  padding: 10px 14px;
  border-radius: var(--radius);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.message.user .bubble {
  background: var(--user-bubble);
  color: var(--user-text);
  border-bottom-right-radius: 6px;
}
.message.assistant .bubble {
  background: var(--surface);
  border: 1px solid var(--border);
  border-bottom-left-radius: 6px;
}
.message.error .bubble { border-color: var(--danger); color: var(--danger); }

.meta { margin: 4px 8px 0; color: var(--muted); font-size: 12px; }

.empty-chat {
  margin: auto;
  max-width: 26rem;
  padding: 0 16px;
  color: var(--muted);
  text-align: center;
}

.typing { display: inline-flex; gap: 4px; padding: 6px 2px; }
.typing span {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--muted);
  animation: typing 1.2s infinite ease-in-out;
}
.typing span:nth-child(2) { animation-delay: 0.15s; }
.typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes typing {
  0%, 80%, 100% { opacity: 0.3; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-3px); }
}

.composer {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 16px;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  background: var(--bg);
}
.keyboard-open .composer { padding-bottom: 12px; }  /* the home-bar inset is under the keyboard */
.composer textarea {
  flex: 1;
  min-height: 44px;
  max-height: 200px;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  resize: none;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(84px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  max-width: min(32rem, calc(100vw - 32px));
  padding: 10px 16px;
  border-radius: 12px;
  background: var(--text);
  color: var(--bg);
  font-size: 14px;
  box-shadow: 0 4px 16px rgb(0 0 0 / 20%);
}

/* Login and error pages */
.center-page {
  display: grid;
  place-items: center;
  min-height: 100dvh;
  padding: 16px;
}
.card {
  width: 100%;
  max-width: 24rem;
  padding: 28px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
}
.card h1 { margin: 12px 0 8px; font-size: 24px; }
.card p { margin: 0 0 20px; color: var(--muted); }
.card .button-link { color: var(--accent); }
.card-icon { display: block; border-radius: 14px; }

/* Phones */
@media (max-width: 760px) {
  .layout { grid-template-columns: 1fr; }
  .nav-toggle { display: inline-grid; }
  .me { display: none; }
  .sidebar {
    position: fixed;
    top: calc(var(--topbar-height) + env(safe-area-inset-top));
    bottom: 0;
    left: 0;
    z-index: 10;
    width: min(300px, 82vw);
    transform: translateX(-100%);
    visibility: hidden;
    transition: transform 0.2s ease, visibility 0s linear 0.2s;
  }
  .nav-open .sidebar {
    transform: none;
    visibility: visible;
    transition: transform 0.2s ease;
    box-shadow: 4px 0 24px rgb(0 0 0 / 15%);
  }
  .message { max-width: 92%; }
}

@media (prefers-reduced-motion: reduce) {
  .typing span { animation: none; opacity: 0.6; }
  .sidebar { transition: none; }
}

/* Task cards */
:root {
  --warn: #8a5a00;
  --warn-bg: #fdf3dc;
  --ok: #2f6f5e;
}
@media (prefers-color-scheme: dark) {
  :root {
    --warn: #e8b85a;
    --warn-bg: #2d2615;
    --ok: #7cc4ad;
  }
}

.message.has-task { max-width: min(38rem, 100%); width: 100%; }

.task-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.task-card.status-waiting_approval,
.task-card.status-waiting_human { border-color: var(--warn); }

.task-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.task-employee { color: var(--muted); font-size: 13px; font-weight: 600; }
.task-status {
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.status-running .task-status,
.status-queued .task-status { color: var(--accent); }
.status-waiting_approval .task-status,
.status-waiting_human .task-status { background: var(--warn-bg); color: var(--warn); }
.status-done .task-status { color: var(--ok); }
.status-failed .task-status { color: var(--danger); }

.task-title { margin: 0; font-size: 16px; font-weight: 600; overflow-wrap: anywhere; }
.task-activity { margin: 0; color: var(--muted); font-size: 14px; overflow-wrap: anywhere; }
.task-result { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.status-failed .task-result { color: var(--danger); }

.task-approval,
.task-question {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border-radius: 12px;
  background: var(--warn-bg);
}
.task-approval p { margin: 0; overflow-wrap: anywhere; }
.task-approval-label,
.task-question-label { font-weight: 600; color: var(--warn); }
.task-question textarea {
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  resize: vertical;
}
.task-question .button-primary { align-self: flex-start; }
.task-buttons { display: flex; gap: 8px; flex-wrap: wrap; }

.task-footer { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.task-meta { margin-right: auto; color: var(--muted); font-size: 12px; }

.task-log { font-size: 13px; color: var(--muted); }
.task-log summary { cursor: pointer; width: max-content; }
.task-log ol { margin: 6px 0 0; padding-left: 0; list-style: none; display: grid; gap: 4px; }
.task-log li { display: grid; grid-template-columns: 4.5rem 1fr; gap: 8px; overflow-wrap: anywhere; }

/* Notifications panel */
.notify { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.nav-note { margin: 0 12px; color: var(--muted); font-size: 14px; }
.notify-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 12px; }
.notify-actions [hidden] { display: none; }
.check { display: flex; align-items: center; gap: 8px; margin: 0 12px; font-size: 14px; }
.check[hidden] { display: none; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }

.task-card.highlight { outline: 3px solid var(--accent); outline-offset: 2px; }

/* Attachments */
.composer-row { display: flex; align-items: flex-end; gap: 8px; }
.attach { flex: none; width: 44px; height: 44px; cursor: pointer; color: var(--muted); }
.attach:hover { color: var(--text); }
.composer:has(#file-input:focus-visible) .attach { outline: 2px solid var(--accent); outline-offset: 2px; }

.pending-files { display: flex; gap: 8px; margin: 0; padding: 0; list-style: none; overflow-x: auto; }
.pending-files[hidden] { display: none; }
.pending-file {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 220px;
  padding: 6px 30px 6px 6px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  font-size: 13px;
}
.pending-file img { width: 40px; height: 40px; object-fit: cover; border-radius: 8px; }
.pending-file.uploading { opacity: 0.6; }
.pending-file.error { border-color: var(--danger); color: var(--danger); }
.pending-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pending-remove {
  position: absolute;
  top: 4px; right: 4px;
  width: 22px; height: 22px;
  border: 0; border-radius: 50%;
  background: var(--surface-2);
  color: var(--text);
  line-height: 1;
}

.attachments { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 0; padding: 0; list-style: none; }
.message.user .attachments { justify-content: flex-end; }
.attachment-image img {
  display: block;
  width: auto; height: auto;
  max-width: min(240px, 60vw); max-height: 240px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface-2);
}
.file-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 260px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
}
.file-kind {
  flex: none;
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--danger);
  color: var(--bg);
  font-size: 11px;
  font-weight: 700;
}
.file-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Scrolling: the topic panel and the thread scroll together */
.scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
/* "Summary" and "Latest" buttons that float over the thread: zero-height sticky rows */
.jump-row { position: sticky; z-index: 3; height: 0; display: flex; justify-content: center; pointer-events: none; }
.jump-row.top { top: 0; align-items: flex-start; }
.jump-row.bottom { bottom: 0; align-items: flex-end; }
.jump {
  pointer-events: auto;
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 2px 8px rgb(0 0 0 / 0.12);
  cursor: pointer;
}
.jump-row.top .jump { transform: translateY(10px); }
.jump-row.bottom .jump { transform: translateY(-12px); }
.jump[hidden] { display: none; }
.scroll .messages { flex: none; overflow: visible; }

/* Sidebar topics */
.nav-heading-row { display: flex; align-items: center; justify-content: space-between; margin: 16px 4px 4px 0; }
.nav-heading-row .nav-heading { margin: 0 12px; }
.icon-button.small { width: 30px; height: 30px; font-size: 20px; line-height: 1; }
.topic-list li { margin: 0; }
.topic-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 10px;
  color: var(--text);
  text-decoration: none;
}
.topic-link:hover { background: var(--surface-2); }
.topic-link[aria-current="page"] { background: var(--surface-2); font-weight: 600; }
.topic-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topic-shared { color: var(--muted); font-size: 11px; }
.topic-count {
  min-width: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--warn-bg);
  color: var(--warn);
  font-size: 12px;
  font-weight: 600;
  text-align: center;
}

/* Small buttons */
.button-quiet.small, .button-primary.small { min-height: 30px; padding: 0 10px; font-size: 13px; }

/* Topic chips under a message */
.chips { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 6px; margin: 6px 4px 0; }
.chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  text-decoration: none;
}
a.chip:hover { background: var(--surface-2); }
.chip.uncertain { border-style: dashed; color: var(--muted); }
.chip.proposal { border-color: var(--warn); background: var(--warn-bg); color: var(--warn); }
.chip.muted { border-color: transparent; background: transparent; color: var(--muted); }
.chip-action {
  padding: 3px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
}
.chip-action.primary { border-color: var(--accent); background: var(--accent); color: var(--accent-text); }
.chip-move {
  max-width: 9rem;
  padding: 3px 6px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
}
.chip-move:hover, .chip-move:focus-visible { border-color: var(--border); background: var(--surface); }

/* Topic page panel */
.topic-panel { display: flex; flex-direction: column; gap: 16px; padding: 20px 16px 4px; max-width: 48rem; }
.topic-panel[hidden] { display: none; }
.topic-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.topic-title-row { display: flex; align-items: center; gap: 10px; min-width: 0; }
.topic-title { margin: 0; font-size: 22px; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.topic-badge { padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); font-size: 12px; }
.topic-badge.shared { background: var(--warn-bg); color: var(--warn); }
.topic-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }

.topic-summary, .topic-todos {
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.section-head h3 { margin: 0; font-size: 14px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.summary-text { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.summary-edit {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  resize: vertical;
}
.section-meta { margin: 8px 0 0; color: var(--muted); font-size: 13px; }

.todo-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.todo { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; }
.todo label { display: flex; align-items: baseline; gap: 8px; cursor: pointer; }
.todo input { width: 18px; height: 18px; accent-color: var(--accent); transform: translateY(3px); }
.todo.done .todo-text { color: var(--muted); text-decoration: line-through; }
.todo-meta { color: var(--muted); font-size: 13px; }
.todo-add { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.todo-add input[type="text"] { flex: 1 1 12rem; }
.todo-add input {
  min-height: 34px;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 14px;
}

/* Model replies with light formatting */
.rich { white-space: normal; }
.rich p { margin: 0; }
.rich p + p, .rich p + ul, .rich p + ol, .rich ul + p, .rich ol + p { margin-top: 8px; }
.rich ul, .rich ol { margin: 4px 0 0; padding-left: 1.3em; }
.rich li + li { margin-top: 2px; }
.rich code { padding: 1px 4px; border-radius: 4px; background: var(--surface-2); font-size: 0.92em; }
.rich a { color: var(--accent); overflow-wrap: anywhere; }
.rich .rich-heading { font-weight: 600; }

/* Email notes from the inbox sorter */
.message.system { align-self: flex-start; max-width: min(38rem, 100%); }
.email-note { border: 1px solid var(--border); background: var(--surface); border-left: 4px solid var(--accent); }
.email-head { display: flex; align-items: baseline; gap: 8px; color: var(--muted); font-size: 13px; }
.email-label { font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: 0.05em; font-size: 11px; }
.email-from { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.email-subject { margin: 2px 0 6px; font-weight: 600; overflow-wrap: anywhere; }
.email-open { display: inline-block; margin-top: 8px; color: var(--accent); font-size: 14px; }
.email-note.skipped { border-left-color: var(--border); background: transparent; padding-block: 6px; }
.email-note.skipped .email-label { color: var(--muted); }
.email-skip-line { margin: 2px 0 0; color: var(--muted); font-size: 14px; }
.link-button { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; text-decoration: underline;
  cursor: pointer; min-height: 0; }
.email-skips { margin: 8px 12px 0; font-size: 14px; }
.email-skips .nav-note { margin: 4px 0 0; }
.email-skips summary { cursor: pointer; color: var(--muted); }
.email-skips ul { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 6px; }
.email-skip { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.email-skip-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.message.system .chips { justify-content: flex-start; }
.nav-note.problem { color: var(--danger); }

/* Earlier answers on a task's question */
.task-approval .check { margin: 0 0 8px; }
.answer-suggestions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.answer-choices { display: flex; flex-wrap: wrap; gap: 8px; }
.answer-choices .choice-button { min-height: 40px; }
.answer-choices.pictures { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); }
.choice-button.with-picture {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.choice-button.with-picture:hover { border-color: var(--accent); }
.choice-button.with-picture:disabled { opacity: 0.6; cursor: default; }
.choice-button.with-picture img {
  display: block;
  width: 100%;
  max-height: 220px;
  object-fit: contain;
  border-radius: 8px;
  background: var(--surface-2);
}
.answer-chip { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Sign-in card */
.sign-in input {
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}
.sign-in-url { margin: 0; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; overflow-wrap: anywhere; }
.sign-in-skip { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.sign-in-skip[hidden] { display: none; }
.sign-in-skip input { flex: 1 1 14rem; min-width: 0; font-size: 16px; }
.sign-in-warning { margin: 0; color: var(--danger); font-weight: 600; }

/* Browser preview on task cards */
.task-screen {
  position: relative;
  display: block;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
}
.task-screen img { display: block; width: 100%; height: auto; max-height: 220px; object-fit: cover; object-position: top; }
.task-screen-label {
  position: absolute;
  right: 8px;
  bottom: 8px;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgb(0 0 0 / 62%);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
}

/* Pages (Costs, …): no chat box */
.page-view .composer, .page-view .empty-chat { display: none; }
.page-card {
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.page-card-title { margin: 0 0 8px; font-size: 14px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.page-card p { margin: 4px 0 0; }
.hero-label { margin: 0; color: var(--muted); font-size: 14px; }
.hero .hero-number { margin: 2px 0 8px; font-size: 40px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.hero meter { width: 100%; height: 12px; }
.button-quiet.active { background: var(--surface-2); font-weight: 600; }

.data-table { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.data-table th { color: var(--muted); font-weight: 600; text-align: left; padding: 4px 8px 6px 0; border-bottom: 1px solid var(--border); }
.data-table td { padding: 6px 8px 6px 0; border-bottom: 1px solid var(--border); overflow-wrap: anywhere; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table .num { text-align: right; white-space: nowrap; }

/* Daily bar chart: thin bars, 2px gaps, rounded tops on a recessive baseline */
.chart { position: relative; margin: 0; }
.chart-max { color: var(--muted); font-size: 12px; }
.bars { display: flex; align-items: flex-end; gap: 2px; height: 140px; margin-top: 6px; border-bottom: 1px solid var(--border); }
.bar-slot { flex: 1; height: 100%; display: flex; align-items: flex-end; cursor: default; }
.bar-slot:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.bar { width: 100%; max-width: 14px; margin: 0 auto; background: var(--accent); border-radius: 4px 4px 0 0; }
.bar-slot:hover .bar, .bar-slot:focus .bar { opacity: 0.8; }
.bar-axis { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; margin-top: 4px; }
.chart-tip {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  padding: 4px 10px;
  border-radius: 8px;
  background: var(--text);
  color: var(--bg);
  font-size: 12px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 1;
}
.chart-table { margin-top: 10px; font-size: 14px; }
.chart-table summary { color: var(--muted); cursor: pointer; }

/* Memory page */
.memory-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 10px; }
.memory-item { padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.memory-item:last-child { padding-bottom: 0; border-bottom: 0; }
.memory-text { margin: 0; overflow-wrap: anywhere; }
.memory-add select {
  min-height: 34px;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 14px;
}
/* Scheduled page */
.schedule-kind { color: var(--muted); font-size: 13px; white-space: nowrap; }
.schedule-when { margin: 2px 0 4px; font-size: 14px; }
.schedule-instructions { color: var(--muted); font-size: 14px; }
.schedule-item.paused strong, .schedule-item.paused .schedule-when { color: var(--muted); }
.site-note + .site-note { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }

/* The live browser, full screen in the app */
body.sheet-open { overflow: hidden; }
.browser-sheet {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}
.browser-sheet-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: max(8px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 8px max(12px, env(safe-area-inset-left));
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.browser-sheet-mode { flex: 1; min-width: 0; overflow: hidden; color: var(--muted); font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.browser-sheet-hint { margin: 0; padding: 6px 12px; border-bottom: 1px solid var(--border); color: var(--muted); font-size: 13px; }
.browser-sheet-hint[hidden] { display: none; }
.browser-sheet-frame { flex: 1; width: 100%; min-height: 0; border: 0; background: #1e1e1e; }
