:root {
  --bg: #0b0d10;
  --surface: #16191e;
  --surface-2: #1e232a;
  --border: #262b33;
  --text: #e7ecf3;
  --text-dim: #98a2b3;
  --accent: #3b82f6;
  --accent-text: #ffffff;
  --tool: #2a2f38;
  --tool-text: #b6c1d1;
  --error: #ef4444;
  --ok: #22c55e;
  --header-h: 52px;
  --composer-min-h: 56px;
  --radius: 18px;
  --radius-sm: 12px;
  --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);
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f6f7f9;
    --surface: #ffffff;
    --surface-2: #eef0f3;
    --border: #e2e5ea;
    --text: #0b0d10;
    --text-dim: #5b6473;
    --tool: #eef0f3;
    --tool-text: #4b5563;
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}

body {
  /* iOS soft keyboard - layout viewport */
  min-height: 100vh;
  min-height: 100dvh;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  padding-left: var(--safe-left);
  padding-right: var(--safe-right);
}

/* Header */
.header {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  padding-top: var(--safe-top);
  height: calc(var(--header-h) + var(--safe-top));
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 5;
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
}

.header-title {
  font-weight: 600;
  letter-spacing: 0.2px;
  font-size: 17px;
}

.header-actions {
  display: flex;
  gap: 4px;
}

.icon-btn {
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 0;
  color: var(--text);
  font-size: 20px;
  cursor: pointer;
  border-radius: 999px;
  padding: 0 10px;
}
.icon-btn:active { background: var(--surface-2); }

/* Push banner */
.banner {
  flex: none;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 13px;
  padding: 8px 14px;
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}
.banner a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}
.banner.hidden { display: none; }

/* Todos main view (the home screen) */
.todos-main {
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}
.todos-main-header {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 6px;
}
.todos-main-title { font-size: 22px; font-weight: 700; letter-spacing: -0.2px; }

/* Chat panel — collapsed to just composer; expands upward on focus or new message */
.chat-panel {
  flex: none;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-top: 1px solid var(--border);
  transition: height 220ms cubic-bezier(.2,.7,.2,1);
  height: calc(var(--composer-min-h) + 22px + var(--safe-bottom));
  max-height: calc(100dvh - var(--header-h) - var(--safe-top) - 80px);
  overflow: hidden;
}
.chat-panel.open {
  height: 62dvh;
}
.chat-handle {
  flex: none;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--surface);
  border: 0;
  border-bottom: 1px solid var(--border);
  color: var(--text-dim);
  cursor: pointer;
  font-size: 11px;
  padding: 0;
}
.chat-handle-grip {
  width: 36px; height: 4px;
  background: var(--text-dim);
  border-radius: 2px;
  opacity: 0.4;
  display: inline-block;
}
.chat-handle-hint { font-size: 11px; opacity: 0.65; }
.chat-panel.open .chat-handle-hint { opacity: 0; }

/* Messages list (inside chat panel) */
.messages {
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 14px 14px 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  scroll-behavior: smooth;
  opacity: 0;
  transition: opacity 200ms ease 60ms;
  pointer-events: none;
}
.chat-panel.open .messages { opacity: 1; pointer-events: auto; }

.msg {
  max-width: 82%;
  padding: 9px 13px;
  border-radius: var(--radius);
  font-size: 16px;
  line-height: 1.4;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  animation: pop 120ms ease-out;
}

@keyframes pop {
  from { transform: translateY(2px); opacity: 0; }
  to   { transform: none; opacity: 1; }
}

.msg.user {
  align-self: flex-end;
  background: var(--accent);
  color: var(--accent-text);
  border-bottom-right-radius: 6px;
}

.msg.assistant {
  align-self: flex-start;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-bottom-left-radius: 6px;
}

.msg.error {
  align-self: flex-start;
  background: rgba(239, 68, 68, 0.12);
  color: var(--error);
  border: 1px solid rgba(239, 68, 68, 0.3);
  font-size: 14px;
}

/* Tool pill */
.tool {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--tool);
  color: var(--tool-text);
  font-size: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  padding: 4px 10px;
  border-radius: 999px;
  max-width: 92%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tool .tool-icon { font-size: 12px; }
.tool .tool-status { margin-left: 4px; }
.tool.ok .tool-status { color: var(--ok); }
.tool.err .tool-status { color: var(--error); }

/* Typing dots */
.typing {
  display: inline-flex;
  gap: 3px;
  align-items: center;
}
.typing span {
  width: 6px;
  height: 6px;
  background: var(--text-dim);
  border-radius: 50%;
  animation: blink 1.2s infinite ease-in-out both;
}
.typing span:nth-child(2) { animation-delay: 0.15s; }
.typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes blink {
  0%, 80%, 100% { opacity: 0.2; }
  40% { opacity: 1; }
}

/* Composer */
.composer {
  flex: none;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 8px 10px;
  padding-bottom: calc(8px + var(--safe-bottom));
  background: var(--surface);
  border-top: 1px solid var(--border);
}

.composer-input {
  flex: 1;
  resize: none;
  min-height: 40px;
  max-height: calc(1.4em * 6 + 18px);
  padding: 10px 14px;
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  outline: none;
  line-height: 1.4;
  overflow-y: auto;
}
.composer-input:focus {
  border-color: var(--accent);
}

.composer-send {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-text);
  border: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: opacity 120ms ease;
}
.composer-send:disabled {
  opacity: 0.4;
  cursor: default;
}
.composer-send:active:not(:disabled) {
  transform: scale(0.96);
}

/* Sheet (menu) */
.sheet {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 20;
  animation: fade 150ms ease;
}
.sheet.hidden { display: none; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.sheet-card {
  width: 100%;
  max-width: 480px;
  background: var(--surface);
  border-top-left-radius: 18px;
  border-top-right-radius: 18px;
  padding: 14px 14px calc(14px + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  gap: 8px;
  animation: slide 200ms cubic-bezier(.2,.7,.2,1);
}
@keyframes slide {
  from { transform: translateY(100%); }
  to   { transform: none; }
}

.sheet-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 6px;
  font-size: 14px;
  color: var(--text-dim);
}
.sheet-value {
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  max-width: 60%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sheet-btn {
  min-height: 48px;
  border: 0;
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
}
.sheet-btn:active { opacity: 0.8; }
.sheet-btn.destructive { color: var(--error); }
.sheet-btn.ghost { background: transparent; color: var(--text-dim); }

/* Accent dot indicator on notify button */
.icon-btn.has-dot::after {
  content: "";
  position: absolute;
  transform: translate(12px, -12px);
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
  border: 2px solid var(--bg);
}
.icon-btn { position: relative; }

/* Tall sheets (live view, subagents) — near-fullscreen */
.sheet-tall .sheet-card.tall {
  width: 100%;
  max-width: 720px;
  height: 92vh;
  height: 92dvh;
  max-height: 92dvh;
  padding: 0;
  border-radius: 18px 18px 0 0;
  overflow: hidden;
}
.sheet-header {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  gap: 8px;
}
.sheet-header-actions { display: flex; gap: 8px; align-items: center; }
.sheet-title { font-weight: 600; font-size: 15px; color: var(--text); }
.sheet-link {
  color: var(--accent);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  padding: 6px 10px;
}
.sheet-btn.compact { min-height: 36px; padding: 0 12px; font-size: 14px; }

/* Todos panel */
.todos-toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-dim); cursor: pointer; }
.todos-toggle input { margin: 0; }
.todos-list { flex: 1; padding: 4px 0 8px; }
.todo-row {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 14px; border-bottom: 1px solid var(--border);
  transition: opacity 280ms ease, background-color 220ms ease;
}
.todo-row:last-child { border-bottom: 0; }
.todo-check {
  flex: none; width: 22px; height: 22px; margin-top: 2px;
  border: 2px solid var(--text-dim); border-radius: 6px;
  background: transparent; cursor: pointer; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--accent-text); font-size: 14px; font-weight: 600;
  transition: background-color 200ms ease, border-color 200ms ease, transform 180ms cubic-bezier(.2,.9,.3,1.4);
}
.todo-check:active { transform: scale(0.88); }
.todo-row.done .todo-check { background: var(--ok); border-color: var(--ok); }
.todo-row.done .todo-check::after {
  content: "✓"; display: inline-block;
  animation: todo-check-pop 320ms cubic-bezier(.2,.9,.3,1.4);
}
@keyframes todo-check-pop {
  0%   { transform: scale(0); opacity: 0; }
  60%  { transform: scale(1.35); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}
/* Linger phase: row is freshly checked off but still visible — flash a soft green
   bg + lift to celebrate, then fade to the muted "done" steady state. */
.todo-row.completing {
  animation: todo-row-celebrate 1100ms ease forwards;
}
@keyframes todo-row-celebrate {
  0%   { background-color: transparent; }
  18%  { background-color: rgba(34, 197, 94, 0.18); }
  70%  { background-color: rgba(34, 197, 94, 0.08); }
  100% { background-color: transparent; opacity: 0.6; }
}
.todo-body { flex: 1; min-width: 0; transition: opacity 220ms ease; }
.todo-title { font-size: 15px; line-height: 1.3; word-wrap: break-word; transition: color 220ms ease; }
.todo-row.done .todo-title { color: var(--text-dim); text-decoration: line-through; }
.todo-meta { font-size: 11px; color: var(--text-dim); margin-top: 3px; display: flex; gap: 8px; flex-wrap: wrap; }
.todo-prio { font-weight: 600; color: var(--accent); }
.todo-tag { background: var(--surface-2); padding: 1px 6px; border-radius: 6px; }
.todo-del {
  flex: none; background: transparent; border: 0; color: var(--text-dim); cursor: pointer;
  font-size: 16px; padding: 4px 6px; border-radius: 6px; margin-top: -2px;
}
.todo-del:active { background: var(--surface-2); color: var(--error); }
.todos-empty { padding: 30px 14px; text-align: center; color: var(--text-dim); font-size: 14px; }

/* Memory panel */
.memory-add {
  flex: none; display: flex; gap: 8px; padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}
.memory-add input[type="text"] {
  flex: 1; min-width: 0;
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 12px; font: inherit; outline: none;
}
.memory-add input[type="text"]:focus { border-color: var(--accent); }
.memory-add select {
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 10px;
  padding: 0 8px; font: inherit; font-size: 12px; cursor: pointer;
}
.memory-add-btn {
  background: var(--accent); color: var(--accent-text);
  border: 0; border-radius: 10px; padding: 0 16px;
  font: inherit; font-weight: 600; cursor: pointer;
}
.memory-list { flex: 1; overflow-y: auto; padding: 4px 0; }
.memory-row {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 14px; border-bottom: 1px solid var(--border);
}
.memory-row:last-child { border-bottom: 0; }
.memory-imp {
  flex: none; font-size: 11px; padding: 2px 8px; border-radius: 999px;
  background: var(--surface-2); color: var(--text-dim);
  font-family: ui-monospace, monospace; font-weight: 600;
  align-self: flex-start; margin-top: 2px;
}
.memory-imp.high { background: rgba(59,130,246,0.18); color: var(--accent); }
.memory-text { flex: 1; min-width: 0; font-size: 15px; line-height: 1.35; word-wrap: break-word; }
.memory-del {
  flex: none; background: transparent; border: 0; color: var(--text-dim); cursor: pointer;
  font-size: 16px; padding: 4px 6px; border-radius: 6px; margin-top: -2px;
}
.memory-del:active { background: var(--surface-2); color: var(--error); }
.memory-empty { padding: 30px 14px; text-align: center; color: var(--text-dim); font-size: 14px; }
.memory-hint { padding: 8px 14px; font-size: 12px; color: var(--text-dim); border-bottom: 1px solid var(--border); }

/* Credentials sheet */
.vault-form { display: flex; flex-direction: column; gap: 8px; padding: 0 4px; }
.vault-form input {
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 10px;
  padding: 12px 14px; font: inherit; outline: none;
}
.vault-form input:focus { border-color: var(--accent); }
.vault-error { padding: 4px 6px; color: var(--error); font-size: 13px; }
.vault-error.hidden { display: none; }

.secrets-list { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; }
.secrets-empty { padding: 30px 14px; text-align: center; color: var(--text-dim); font-size: 14px; }
.secret-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-bottom: 1px solid var(--border);
}
.secret-main { flex: 1; min-width: 0; }
.secret-label { font-weight: 600; font-size: 14px; line-height: 1.3; }
.secret-meta { font-size: 12px; line-height: 1.3; margin-top: 2px; word-break: break-all; }
.secret-actions { flex: none; display: flex; gap: 4px; }

.secrets-add-wrap { padding: 4px; border-top: 1px solid var(--border); }
.secrets-add-summary {
  cursor: pointer; padding: 8px 10px;
  color: var(--accent); font-size: 13px; font-weight: 600;
  list-style: none;
}
.secrets-add-summary::-webkit-details-marker { display: none; }
.secrets-add-wrap[open] .secrets-add-summary { color: var(--text-dim); }
.secrets-add-wrap form { padding: 4px 6px 8px; }

/* Notifications sheet */
.push-status {
  flex: none;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-dim);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.push-status-btn {
  background: var(--accent); color: var(--accent-text);
  border: 0; border-radius: 8px; padding: 6px 12px;
  font: inherit; font-size: 12px; font-weight: 600; cursor: pointer;
}
.push-status-btn.subscribed { background: var(--surface-2); color: var(--text-dim); cursor: default; }
.notif-list { flex: 1; overflow-y: auto; }
.notif-row {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 14px; border-bottom: 1px solid var(--border);
  cursor: default;
}
.notif-row.actionable { cursor: pointer; }
.notif-row.actionable:active { background: var(--surface-2); }
.notif-icon { flex: none; font-size: 18px; line-height: 1.3; }
.notif-body { flex: 1; min-width: 0; }
.notif-title { font-weight: 600; font-size: 14px; line-height: 1.3; }
.notif-sub { color: var(--text-dim); font-size: 12px; line-height: 1.3; margin-top: 2px; word-break: break-word; }
.notif-time { color: var(--text-dim); font-size: 11px; flex: none; }
.notif-empty { padding: 30px 14px; text-align: center; color: var(--text-dim); font-size: 14px; }

/* Agent-initiated notifications (in-PWA, non-blocking) */
.agent-notifs {
  flex: none;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.agent-notif {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: rgba(59, 130, 246, 0.14);
  color: var(--text);
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  cursor: pointer;
  transition: background-color 120ms ease;
}
.agent-notif:active { background: rgba(59, 130, 246, 0.22); }
.agent-notif-icon { flex: none; font-size: 18px; }
.agent-notif-body { flex: 1; min-width: 0; }
.agent-notif-title { font-weight: 600; line-height: 1.3; }
.agent-notif-sub { color: var(--text-dim); font-size: 12px; line-height: 1.3; margin-top: 1px; }
.agent-notif-dismiss {
  flex: none;
  background: transparent; border: 0; color: var(--text-dim);
  font-size: 16px; padding: 4px 8px; border-radius: 6px; cursor: pointer;
}
.agent-notif-dismiss:active { background: var(--surface-2); }

/* Iframe wrap for live view */
.iframe-wrap { position: relative; flex: 1; overflow: hidden; background: #000; }
.iframe-wrap iframe { width: 100%; height: 100%; border: 0; display: block; }
.iframe-empty {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: var(--surface); color: var(--text); padding: 20px; text-align: center;
}
.iframe-empty.hidden { display: none; }
.iframe-empty .muted { color: var(--text-dim); font-size: 14px; margin-top: 4px; }

/* Chip badge (running subagent count) */
.chip { position: relative; }
.chip-badge {
  position: absolute;
  top: 4px; right: 0;
  min-width: 18px; height: 18px;
  background: var(--accent);
  color: var(--accent-text);
  font-size: 11px;
  font-weight: 600;
  border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0 5px;
  border: 2px solid var(--bg);
}
.chip-badge.hidden { display: none; }

/* Subagent list + detail */
.agents-list { flex: 1; overflow-y: auto; padding: 8px 14px 14px; display: flex; flex-direction: column; gap: 8px; }
.agent-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; background: var(--surface-2); border-radius: 12px;
  border: 1px solid var(--border); cursor: pointer; gap: 10px;
}
.agent-row:active { opacity: 0.8; }
.agent-row .agent-row-main { flex: 1; min-width: 0; }
.agent-row .agent-row-name { font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agent-row .agent-row-task { font-size: 12px; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 2px; }
.agent-row .agent-status {
  font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 999px;
  background: var(--tool); color: var(--tool-text); text-transform: uppercase; letter-spacing: 0.3px;
}
.agent-status.running { background: rgba(59, 130, 246, 0.18); color: var(--accent); }
.agent-status.completed { background: rgba(34, 197, 94, 0.18); color: var(--ok); }
.agent-status.failed { background: rgba(239, 68, 68, 0.18); color: var(--error); }
.agent-status.cancelled, .agent-status.interrupted { background: var(--tool); color: var(--text-dim); }

.agent-detail { position: absolute; inset: 0; background: var(--surface); display: flex; flex-direction: column; }
.agent-detail.hidden { display: none; }
.agent-detail-header { flex: none; display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.agent-detail-header .sheet-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.agent-events { flex: 1; overflow-y: auto; padding: 10px 14px; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.agent-event { padding: 6px 10px; border-radius: 8px; background: var(--surface-2); }
.agent-event.assistant_delta { background: transparent; padding: 4px 0; white-space: pre-wrap; }
.agent-event.tool_call { font-family: ui-monospace, monospace; font-size: 11px; color: var(--tool-text); }
.agent-event.tool_result { font-family: ui-monospace, monospace; font-size: 11px; color: var(--text-dim); padding-left: 18px; }
.agent-event.finished { font-weight: 600; color: var(--ok); }
.agent-event.finished.failed { color: var(--error); }
.agent-event.finished.cancelled, .agent-event.finished.interrupted { color: var(--text-dim); }

/* Browser tool pills clickable */
.tool.tappable { cursor: pointer; }
.tool.tappable:active { opacity: 0.8; }

/* Toasts */
.toasts {
  position: fixed;
  top: calc(var(--header-h) + var(--safe-top) + 8px);
  left: 0;
  right: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  max-width: 480px;
  width: fit-content;
  min-width: 0;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-left-width: 3px;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 14px;
  line-height: 1.35;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
  overflow-wrap: anywhere;
  cursor: pointer;
  transform: translateY(-8px);
  opacity: 0;
  transition: transform 180ms cubic-bezier(.2,.7,.2,1), opacity 180ms ease;
}
.toast.show { transform: none; opacity: 1; }
.toast.leaving { transform: translateY(-8px); opacity: 0; }
.toast.info { border-left-color: var(--accent); }
.toast.ok { border-left-color: var(--ok); }
.toast.error { border-left-color: var(--error); }
.toast:active { opacity: 0.85; }

/* Usage badge in header */
.usage-badge {
  display: inline-flex;
  align-items: center;
  height: 26px;
  padding: 0 8px;
  margin-right: 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  color: var(--text-dim);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.usage-badge:active { opacity: 0.8; }
.usage-badge.hidden { display: none; }

/* Session list inside menu sheet */
.sessions-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 4px 0 6px;
}
.sessions-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 6px;
}
.sessions-list {
  max-height: 200px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 2px;
  background: var(--surface-2);
  border-radius: 12px;
  border: 1px solid var(--border);
}
.sessions-list:empty::before {
  content: "No saved sessions yet.";
  color: var(--text-dim);
  font-size: 13px;
  padding: 12px;
  text-align: center;
}
.session-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  min-width: 0;
}
.session-row:active { background: var(--tool); }
.session-row.current { background: var(--surface); }
.session-row.current .session-title { font-weight: 600; }
.session-row .session-title {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
}
.session-row .session-dot {
  flex: none;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  margin-right: 6px;
  opacity: 0;
}
.session-row.current .session-dot { opacity: 1; }
.session-row .session-time {
  flex: none;
  font-size: 11px;
  color: var(--text-dim);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
