/* Minimal styling for lik-ui. Kept intentionally small — server-rendered pages. */
:root { --fg: #1a1a1a; --muted: #666; --accent: #2b6cb0; --bg: #fafafa; --line: #e2e2e2; }
* { box-sizing: border-box; }
body { font-family: system-ui, -apple-system, sans-serif; color: var(--fg); background: var(--bg);
  margin: 0; line-height: 1.5; display: flex; flex-direction: column; min-height: 100vh; }
main { flex: 1; min-width: 0; width: 100%; max-width: 820px; margin: 0 auto; padding: 2rem 1.25rem; }
/* The chat page uses the full browser width. */
body.chat-page main { max-width: none; }
a { color: var(--accent); }

/* Top bar: navigation on the left, account (email + sign out) on the right. */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  background: #fff; border-bottom: 1px solid var(--line); padding: .6rem 1.25rem; }
.topbar-nav { display: flex; gap: .35rem; }
.topbar-nav a { text-decoration: none; color: var(--fg); padding: .4rem .6rem; border-radius: 6px; }
.topbar-nav a:hover { background: var(--bg); }
.topbar-account { display: flex; align-items: center; gap: .75rem; }
.topbar-email { font-size: .85rem; color: var(--muted); }
.btn { display: inline-block; padding: .5rem .9rem; border: 1px solid var(--accent);
  border-radius: 6px; background: var(--accent); color: #fff; text-decoration: none; cursor: pointer; }
.btn.secondary { background: #fff; color: var(--accent); }
.btn.danger { background: #c05621; border-color: #c05621; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.start-chat { display: flex; gap: .5rem; align-items: center; max-width: 640px; }
.start-chat input { flex: 1; padding: .5rem .6rem; border: 1px solid var(--line); border-radius: 6px; }
.cred-list { list-style: none; padding: 0; margin: .5rem 0; }
.cred-list li { display: flex; align-items: center; justify-content: space-between; gap: .7rem; padding: .5rem .7rem; border: 1px solid var(--line); border-radius: 6px; margin: .35rem 0; background: var(--bg); }
.cred-list .btn { flex: none; padding: .3rem .7rem; font-size: .85rem; }
.cred-url { color: var(--muted); font-size: .85rem; word-break: break-all; }
.status-connected { color: #2f855a; }
.status-missing { color: #c05621; }
.card { border: 1px solid var(--line); border-radius: 8px; padding: 1rem; margin: .75rem 0; background: #fff; }
/* Collapsible per-agent details on the agent-selection page. */
.card > details { margin-top: .6rem; }
.card > details > summary { cursor: pointer; color: var(--accent); }
.card > details dl { display: grid; grid-template-columns: auto 1fr; gap: .15rem .75rem;
  margin: .5rem 0 0; font-size: .85rem; }
.card > details dt { color: var(--muted); }
.card > details dd { margin: 0; word-break: break-all; }
.card > details .prompt-label { margin-top: .6rem; font-size: .85rem; color: var(--muted); }
.card > details pre { margin: .3rem 0 0; padding: .6rem .8rem; background: var(--bg);
  border: 1px solid var(--line); border-radius: 6px; white-space: pre-wrap; overflow-wrap: anywhere;
  font-size: .82rem; max-height: 20rem; overflow-y: auto; }

/* Agent system prompt on the connections page: collapsed by default, scrollable when long. */
details.system-prompt { margin: .75rem 0; }
details.system-prompt > summary { cursor: pointer; color: var(--accent); }
details.system-prompt pre { margin: .5rem 0 0; padding: .6rem .8rem; background: #fff;
  border: 1px solid var(--line); border-radius: 6px; white-space: pre-wrap; overflow-wrap: anywhere;
  font-size: .85rem; max-height: 24rem; overflow-y: auto; }

details.skills { margin: .75rem 0; }
details.skills > summary { cursor: pointer; color: var(--accent); }
details.skills li { margin: .35rem 0; }
details.skills .skill-details-btn { padding: .1rem .5rem; font-size: .8rem; margin-left: .35rem; }
details.skills .skill-details { margin: .35rem 0 .5rem; padding: .5rem .7rem; background: #fff;
  border: 1px solid var(--line); border-radius: 6px; font-size: .85rem; }
details.skills .skill-details p { margin: .3rem 0 0; }

/* Chat transcript bubbles: shared .card base with a per-role tint. */
.card.user { background: #f0f6ff; border-color: #cfe0f5; }
.card.assistant { background: #fff; }
.card.tool { background: #f7f7f5; border-color: #e6e6e0; color: var(--muted);
  font-size: .9rem; padding: .6rem .8rem; }
/* MCP (external-server) tools get a distinct tint to set them apart from built-in tools. */
.card.tool.mcp { background: #f3f0fb; border-color: #ddd3f0; }
.card.error { background: #fff5ef; border-color: #f0c9ad; color: #c05621; }
/* Collapsible tool arguments / results. */
.card.tool details { margin-top: .4rem; }
.card.tool summary { cursor: pointer; color: var(--accent); }
.card.tool pre { margin: .4rem 0 0; padding: .5rem; background: #fff; border: 1px solid var(--line);
  border-radius: 6px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: .82rem;
  max-height: 24rem; overflow-y: auto; }

/* Tool-visibility toggles: hide tool bubbles by kind based on the container's class. */
#chat-controls { display: flex; gap: 1rem; margin: .5rem 0; color: var(--muted); font-size: .9rem; }
#chat-controls label { display: inline-flex; align-items: center; gap: .3rem; cursor: pointer; }
#transcript.hide-builtin-tools .card.tool.builtin { display: none; }
#transcript.hide-mcp-tools .card.tool.mcp { display: none; }
/* A gated (permission-checked) call stays visible even when its kind is toggled off — you
   can't approve what you can't see, and the approved/denied outcome stays on the record. */
#transcript.hide-builtin-tools .card.tool.builtin.gated,
#transcript.hide-mcp-tools .card.tool.mcp.gated { display: block; }
/* Approve/Deny prompt on a paused tool call. */
.card.tool.awaiting { color: var(--fg); border-color: var(--accent); }
.card.tool .tool-actions { display: flex; gap: .5rem; margin-top: .5rem; }
.card.tool .tool-actions .btn { padding: .3rem .8rem; font-size: .85rem; }
/* Outcome tag left on a gated call after it's approved / auto-approved / denied. */
.card.tool .tool-decision { margin-top: .5rem; font-size: .85rem; font-weight: 600; }
.card.tool .tool-decision.ok { color: #2f855a; }
.card.tool .tool-decision.no { color: #c05621; }

/* Per-server auto-approve checklist. */
#auto-approve { display: flex; flex-wrap: wrap; gap: .3rem 1rem; align-items: center;
  margin: .25rem 0 .5rem; color: var(--muted); font-size: .9rem; }
#auto-approve label { display: inline-flex; align-items: center; gap: .3rem; cursor: pointer; }
#auto-approve .auto-approve-label { cursor: default; }

/* Queued/waiting indicator shown between submit and the turn's first event. */
.card.pending { background: none; border: none; color: var(--muted); font-size: .9rem;
  padding: .25rem; font-style: italic; }

/* Context-compaction divider: a quiet centered marker, not a card. */
.card.compacted { border: none; background: none; text-align: center; color: var(--muted);
  font-size: .85rem; padding: .25rem; margin: .5rem 0; }

/* Running token total, shown once below the transcript. */
.usage { color: var(--muted); font-size: .8rem; margin: .5rem 0 0; text-align: right; }

/* Descriptive 500 page: readable summary plus, in local/test, the full traceback. */
.error-page { max-width: 60rem; }
.error-summary { color: #c05621; font-weight: 600; }
.error-hint { color: var(--muted); font-size: .9rem; }
.error-traceback { padding: .75rem; background: #fff5ef; border: 1px solid #f0c9ad;
  border-radius: 6px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: .82rem;
  max-height: 32rem; overflow-y: auto; }
