/* AutoSite AI Manager — dashboard styles. Dark/light via [data-theme]. */
:root, [data-theme="dark"] {
  --bg: #0f1420;
  --bg-soft: #161d2e;
  --card: #1a2338;
  --border: #2a3550;
  --text: #e8edf7;
  --muted: #93a0b8;
  --primary: #4f7cff;
  --primary-hover: #3d68e0;
  --danger: #e5484d;
  --ok: #30a46c;
  --warn: #f5a524;
  --input-bg: #10182a;
}
[data-theme="light"] {
  --bg: #f4f6fb;
  --bg-soft: #ffffff;
  --card: #ffffff;
  --border: #dfe5f0;
  --text: #1b2436;
  --muted: #5d6b85;
  --primary: #2f5fe0;
  --primary-hover: #244ec4;
  --danger: #d13438;
  --ok: #1f8a56;
  --warn: #b7791f;
  --input-bg: #f0f3f9;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px; line-height: 1.5;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
code { background: var(--bg-soft); padding: 0.1em 0.4em; border-radius: 4px; font-size: 0.9em; }

/* Auth pages */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.auth-card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 2rem; width: 100%; max-width: 440px; }
.brand { font-weight: 700; font-size: 1.15rem; margin-bottom: 1.25rem; display: flex; align-items: center; gap: 0.5rem; }
.brand-mark { display: inline-flex; align-items: center; justify-content: center; width: 2rem; height: 2rem; border-radius: 8px; background: var(--primary); color: #fff; font-weight: 800; }
.auth-links { margin-top: 1rem; font-size: 0.9rem; }
h1 { font-size: 1.5rem; margin: 0 0 0.5rem; }
h2 { font-size: 1.15rem; margin: 1.25rem 0 0.5rem; }
h3 { font-size: 1rem; margin: 1rem 0 0.5rem; }

/* App shell */
.app { display: flex; min-height: 100vh; }
.sidebar { width: 230px; flex-shrink: 0; background: var(--bg-soft); border-right: 1px solid var(--border); padding: 1rem; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.nav { display: flex; flex-direction: column; gap: 0.25rem; flex: 1; }
.nav-link { padding: 0.55rem 0.75rem; border-radius: 8px; color: var(--text); }
.nav-link:hover { background: var(--card); text-decoration: none; }
.nav-link.active { background: var(--primary); color: #fff; }
.nav-section { margin: 1rem 0 0.25rem; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.sidebar-foot { display: flex; gap: 0.5rem; margin-top: 1rem; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem 1.25rem; border-bottom: 1px solid var(--border); background: var(--bg-soft); position: sticky; top: 0; z-index: 5; }
.topbar-title { font-weight: 600; flex: 1; }
.topbar-user { color: var(--muted); font-size: 0.9rem; }
.content { padding: 1.25rem; max-width: 1200px; width: 100%; margin: 0 auto; }
.sidebar-toggle { display: none; }

/* Cards, grids, stats */
.grid { display: grid; gap: 1rem; }
.grid.cards { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); margin-bottom: 1rem; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); margin-bottom: 1rem; }
.grid.three { grid-template-columns: repeat(3, 1fr); }
.card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 1.25rem; margin-bottom: 1rem; }
.card.narrow { max-width: 640px; }
.stat { font-size: 1.9rem; font-weight: 700; }
.stat-label { color: var(--muted); font-size: 0.9rem; }
.stat-sub { color: var(--muted); font-size: 0.8rem; margin-top: 0.25rem; }

/* Tables */
.table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.table th, .table td { text-align: left; padding: 0.55rem 0.5rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.table th { color: var(--muted); font-weight: 600; font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.04em; }

/* Forms */
.form label { display: block; margin-bottom: 0.9rem; font-weight: 500; }
.form input[type="text"], .form input[type="email"], .form input[type="password"],
.form input[type="url"], .form input[type="number"], .form select, .form textarea,
.filter-row input, .filter-row select {
  display: block; width: 100%; margin-top: 0.3rem; padding: 0.55rem 0.7rem;
  background: var(--input-bg); border: 1px solid var(--border); border-radius: 8px; color: var(--text);
}
.form input:disabled { opacity: 0.6; }
.check { display: flex !important; align-items: center; gap: 0.5rem; font-weight: 400 !important; }
.check input { width: auto !important; margin: 0 !important; }
.muted { color: var(--muted); }
.small { font-size: 0.82rem; }

/* Buttons */
.btn { display: inline-block; padding: 0.55rem 1rem; border-radius: 8px; border: 1px solid transparent; cursor: pointer; font-size: 0.92rem; background: var(--bg-soft); color: var(--text); }
.btn:hover { text-decoration: none; filter: brightness(1.08); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-ghost { background: transparent; border-color: var(--border); }
.btn-sm { padding: 0.35rem 0.65rem; font-size: 0.85rem; }
.inline-form { display: inline; }
.page-actions { margin-bottom: 1rem; }

/* Alerts, badges */
.alert { padding: 0.75rem 1rem; border-radius: 8px; margin-bottom: 1rem; border: 1px solid var(--border); }
.alert-success { background: rgba(48,164,108,0.12); border-color: var(--ok); }
.alert-error { background: rgba(229,72,77,0.12); border-color: var(--danger); }
.alert-warning { background: rgba(245,165,36,0.12); border-color: var(--warn); }
.alert ul { margin: 0.25rem 0 0 1rem; padding: 0; }
.badge { display: inline-block; padding: 0.15rem 0.55rem; border-radius: 999px; font-size: 0.78rem; background: var(--bg-soft); border: 1px solid var(--border); }
.badge-active, .badge-ok, .badge-completed { color: var(--ok); border-color: var(--ok); }
.badge-suspended, .badge-bad, .badge-failed, .badge-dead { color: var(--danger); border-color: var(--danger); }
.badge-pending, .badge-queued, .badge-running, .badge-warn { color: var(--warn); border-color: var(--warn); }

/* Misc */
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 0.3rem 0.75rem; margin: 0 0 1rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.activity { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.4rem; font-size: 0.92rem; }
.empty { text-align: center; padding: 2.5rem 1rem; }
.empty h2 { margin-bottom: 0.25rem; }
.error-page { text-align: center; padding: 2.5rem 1.5rem; }
.row-actions { white-space: nowrap; }
.pagination { display: flex; gap: 0.35rem; margin-top: 1rem; }
.pagination a { padding: 0.35rem 0.7rem; border: 1px solid var(--border); border-radius: 6px; }
.pagination a.current { background: var(--primary); color: #fff; border-color: var(--primary); }
.filter-row { display: flex; gap: 0.5rem; margin-bottom: 1rem; flex-wrap: wrap; }
.filter-row input, .filter-row select { width: auto; margin-top: 0; }

@media (max-width: 820px) {
  .sidebar { position: fixed; left: 0; top: 0; z-index: 20; transform: translateX(-100%); transition: transform 0.2s ease; }
  .sidebar.open { transform: none; }
  .sidebar-toggle { display: inline-block; }
  .grid.three { grid-template-columns: 1fr; }
  .content { padding: 1rem; }
  .table { display: block; overflow-x: auto; }
}

/* ---- Phase 2: agent workspace ---- */
.agent-head { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.agent-head h2 { margin: 0; }
.agent-icon { font-size: 1.4rem; }
.agent-icon.big { font-size: 2.2rem; }
.workspace-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 1rem; margin-top: 1rem; align-items: start; }
@media (max-width: 1000px) { .workspace-grid { grid-template-columns: 1fr; } }
.chat { display: flex; flex-direction: column; gap: 0.6rem; max-height: 480px; overflow-y: auto; margin: 0.75rem 0; }
.msg { border: 1px solid var(--border); border-radius: 8px; padding: 0.6rem 0.8rem; }
.msg-user { background: rgba(120, 140, 255, 0.07); }
.msg-assistant { background: rgba(120, 255, 170, 0.05); }
.msg-role { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin-bottom: 0.25rem; }
.msg-body { white-space: pre-wrap; word-break: break-word; }
.prompt-form { margin-top: 0.5rem; }
.attach-note { display: block; margin-top: 0.75rem; }
.attach-note input[disabled] { opacity: 0.5; }
.event-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.4rem; }
.output summary { cursor: pointer; padding: 0.4rem 0; }
.output pre { max-height: 300px; overflow-y: auto; }
.approval-row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 0.6rem 0; border-top: 1px solid var(--border); }
.preview-panel { border: 1px dashed var(--border); border-radius: 8px; padding: 1rem; margin-top: 1rem; }
.preview-instr { white-space: pre-wrap; max-height: 200px; overflow-y: auto; background: rgba(127,127,127,0.08); padding: 0.6rem; border-radius: 6px; }
.template-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0.75rem; margin: 0.5rem 0 1rem; }
.template-card { border: 1px solid var(--border); border-radius: 8px; padding: 0.75rem; cursor: pointer; display: flex; flex-direction: column; gap: 0.25rem; }
.template-card input { position: absolute; opacity: 0; }
.template-card.selected { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.template-icon { font-size: 1.5rem; }
.template-name { font-weight: 600; }
.template-specialty { font-size: 0.85rem; color: var(--muted); }
.template-desc { font-size: 0.85rem; }
.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 0.5rem; margin: 0.5rem 0 1rem; }
.tool-check { display: flex; gap: 0.5rem; border: 1px solid var(--border); border-radius: 8px; padding: 0.6rem; cursor: pointer; align-items: flex-start; }
.tool-check input { margin-top: 0.2rem; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
@media (max-width: 700px) { .form-grid { grid-template-columns: 1fr; } }
.radio { display: inline-flex; align-items: center; gap: 0.4rem; margin-right: 1rem; }
/* Phase 4 additions */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1rem; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 0.75rem; }
.stage-timeline { list-style: none; display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 1rem 0; padding: 0; }
.stage-timeline li { padding: 0.3rem 0.7rem; border: 1px solid var(--border); border-radius: 999px; font-size: 0.85rem; color: var(--muted); }
.stage-timeline li.done { border-color: var(--ok, #2da44e); color: var(--ok, #2da44e); }
.stage-timeline li.current { border-color: var(--primary); color: var(--primary); font-weight: 600; }
.article-body { border: 1px solid var(--border); border-radius: 8px; padding: 1rem; max-height: 480px; overflow-y: auto; }
.article-body h1, .article-body h2, .article-body h3 { margin-top: 1em; }
textarea.code { font-family: ui-monospace, monospace; font-size: 0.85rem; }
.input-sm { padding: 0.3rem 0.5rem; font-size: 0.85rem; }
.check { display: flex; align-items: center; gap: 0.5rem; }

/* Video Studio */
.timeline { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 12px 0; }
.timeline li { padding: 6px 12px; border: 1px solid var(--border); border-radius: 20px; font-size: 0.85rem; }
.timeline-done { color: var(--success); border-color: var(--success); }
.timeline-active { color: var(--accent); border-color: var(--accent); font-weight: 600; }
.timeline-attention { color: var(--danger); border-color: var(--danger); font-weight: 600; }
.timeline-todo { color: var(--muted); }
.prose { line-height: 1.7; white-space: pre-wrap; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; margin: 12px 0; }
.stat { border: 1px solid var(--border); border-radius: 8px; padding: 10px; text-align: center; }
.stat-num { font-size: 1.5rem; font-weight: 700; }
.stat-label { font-size: 0.8rem; color: var(--muted); }
.mono { font-family: ui-monospace, monospace; }
.input-sm { padding: 4px 8px; font-size: 0.85rem; }
textarea.mono { font-family: ui-monospace, monospace; font-size: 0.9rem; }

/* ================= P1.4: chat-first dark UI =================
 * Scoped under .chat-shell: an original dark design for the chat
 * experience. Always dark (data-theme="dark" is forced by the chat
 * layout), independent of the app's theme toggle.
 */
.chat-shell { --cbg: #0b0f1a; --cbg2: #101728; --ccard: #151d31; --cborder: #26314b; --ctext: #e9eef9; --cmuted: #8f9bb5; --cprimary: #5b86ff; --cprimary-h: #4772ec; --cdanger: #e5484d; --cok: #3fb97f; --cwarn: #f0a53a; background: var(--cbg); color: var(--ctext); }
.chat-shell a { color: var(--cprimary); }
.chat-app { display: flex; min-height: 100vh; }

/* Narrow icon rail */
.chat-rail { width: 72px; flex-shrink: 0; background: var(--cbg2); border-right: 1px solid var(--cborder); display: flex; flex-direction: column; align-items: center; padding: 0.75rem 0; gap: 0.15rem; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.rail-brand { display: inline-flex; align-items: center; justify-content: center; width: 2.4rem; height: 2.4rem; border-radius: 10px; background: var(--cprimary); color: #fff; font-weight: 800; font-size: 1.2rem; margin-bottom: 0.6rem; }
.rail-brand:hover { text-decoration: none; }
.rail-link { display: flex; flex-direction: column; align-items: center; gap: 0.15rem; width: 60px; padding: 0.5rem 0; border-radius: 10px; color: var(--cmuted); font-size: 0.62rem; line-height: 1; }
.rail-link:hover { color: var(--ctext); background: var(--ccard); text-decoration: none; }
.rail-link.active { color: #fff; background: var(--ccard); box-shadow: inset 0 0 0 1px var(--cborder); }
.rail-label { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail-foot { margin-top: auto; }
.rail-btn { background: none; border: 0; cursor: pointer; font: inherit; }
.rail-foot form { margin: 0; }

/* Conversation list panel */
.chat-convs { width: 280px; flex-shrink: 0; background: var(--cbg2); border-right: 1px solid var(--cborder); display: flex; flex-direction: column; height: 100vh; position: sticky; top: 0; }
.chat-convs-head { display: flex; align-items: center; justify-content: space-between; padding: 0.9rem 1rem; border-bottom: 1px solid var(--cborder); }
.chat-convs-title { font-weight: 700; }
.conv-list { flex: 1; overflow-y: auto; padding: 0.6rem; display: flex; flex-direction: column; gap: 0.25rem; }
.conv-item { display: block; padding: 0.6rem 0.7rem; border-radius: 8px; color: var(--ctext); }
.conv-item:hover { background: var(--ccard); text-decoration: none; }
.conv-item.active { background: var(--ccard); box-shadow: inset 0 0 0 1px var(--cprimary); }
.conv-item-title { display: block; font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-item-time { display: block; font-size: 0.72rem; color: var(--cmuted); margin-top: 0.15rem; }
.conv-empty { padding: 0.75rem; font-size: 0.85rem; }
/* P3: sidebar chat search */
.chat-search { padding: 0.6rem 0.6rem 0; }
.chat-search input[type="search"] { width: 100%; padding: 0.5rem 0.7rem; border-radius: 8px; border: 1px solid var(--cborder); background: var(--cbg); color: var(--ctext); font-size: 0.85rem; }
.chat-search input[type="search"]:focus { outline: none; border-color: var(--cprimary); }
.chat-search-status { padding: 0.4rem 0.2rem 0; font-size: 0.78rem; }

/* Main chat column */
.chat-main { flex: 1; min-width: 0; display: flex; flex-direction: column; height: 100vh; }
.chat-topbar { display: flex; align-items: center; gap: 0.75rem; padding: 0.7rem 1.25rem; border-bottom: 1px solid var(--cborder); background: var(--cbg2); }
.chat-topbar-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-topbar-user { margin-left: auto; color: var(--cmuted); font-size: 0.85rem; }
.convs-toggle { display: none; }
.chat-content { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 1.25rem; max-width: 960px; width: 100%; margin: 0 auto; }
.chat-shell .alert { border: 1px solid var(--cborder); border-radius: 8px; padding: 0.6rem 0.9rem; margin-bottom: 0.75rem; background: var(--ccard); }
.chat-shell .alert-success { border-color: var(--cok); }
.chat-shell .alert-error { border-color: var(--cdanger); }

/* Welcome hero (index) */
.chat-welcome { flex: 1; display: flex; align-items: center; justify-content: center; text-align: center; }
.chat-welcome-inner { max-width: 560px; }
.chat-welcome h1 { font-size: 1.8rem; margin-bottom: 0.5rem; }
.chat-welcome .muted { color: var(--cmuted); }
.chat-hints { list-style: none; padding: 0; margin: 1.5rem 0 0; display: flex; flex-direction: column; gap: 0.4rem; color: var(--cmuted); font-size: 0.9rem; }

/* Thread */
.chat-thread { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.chat-messages { flex: 1; min-height: 120px; overflow-y: auto; display: flex; flex-direction: column; gap: 0.8rem; padding: 0.25rem 0.25rem 1rem; }
.chat-msg { max-width: 78%; border: 1px solid var(--cborder); border-radius: 12px; padding: 0.65rem 0.9rem; background: var(--ccard); }
.chat-msg-user { align-self: flex-end; background: #1d2c52; border-color: #2f4480; }
.chat-msg-assistant { align-self: flex-start; }
.chat-msg-tool { align-self: flex-start; max-width: 90%; }
.chat-msg-role { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--cmuted); margin-bottom: 0.3rem; }
.chat-msg-body { white-space: pre-wrap; word-break: break-word; }
.chat-msg-time { font-size: 0.7rem; margin-top: 0.35rem; }
.chat-empty { text-align: center; margin-top: 2rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Status line: honest in-flight indicator only — no fake typing. */
.chat-status { min-height: 1.4em; color: var(--cmuted); font-size: 0.85rem; margin: 0.25rem 0; }

/* Notices (unavailable / error) — visually distinct from assistant bubbles. */
.chat-notice { align-self: center; max-width: 90%; border: 1px dashed var(--cborder); border-radius: 10px; padding: 0.6rem 0.9rem; font-size: 0.9rem; background: var(--cbg2); }
.chat-notice-label { font-weight: 700; margin-right: 0.5rem; text-transform: uppercase; font-size: 0.72rem; letter-spacing: 0.05em; }
.chat-notice-error .chat-notice-label { color: var(--cdanger); }
.chat-notice-warn .chat-notice-label { color: var(--cwarn); }

/* Composer */
.chat-composer { display: flex; gap: 0.6rem; align-items: flex-end; border: 1px solid var(--cborder); border-radius: 14px; background: var(--cbg2); padding: 0.6rem; }
.chat-composer textarea { flex: 1; background: transparent; border: 0; color: var(--ctext); resize: none; font: inherit; min-height: 2.6em; max-height: 12em; outline: none; }
.chat-composer textarea:disabled { opacity: 0.55; }
.chat-composer button:disabled { opacity: 0.55; cursor: wait; }

/* Approval cards */
.approval-card { border: 1px solid var(--cwarn); border-radius: 12px; padding: 0.8rem 1rem; background: rgba(240,165,58,0.06); }
.approval-card-head { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.4rem; }
.approval-badge { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--cwarn); border: 1px solid var(--cwarn); border-radius: 999px; padding: 0.15rem 0.6rem; }
.approval-tool { font-family: ui-monospace, monospace; font-size: 0.82rem; color: var(--ctext); }
.approval-summary { margin: 0.3rem 0 0.7rem; font-size: 0.92rem; }
.approval-actions { display: flex; gap: 0.5rem; }
.approval-note { font-size: 0.78rem; margin: 0.6rem 0 0; color: var(--cmuted); }
.approval-decided { border-radius: 8px; padding: 0.6rem 0.8rem; border: 1px solid var(--cborder); background: var(--cbg2); }
.approval-decided-label { font-weight: 700; margin-right: 0.5rem; }
.approval-decided-approved .approval-decided-label { color: var(--cok); }
.approval-decided-rejected .approval-decided-label { color: var(--cdanger); }
.approval-decided-text { color: var(--cmuted); font-size: 0.88rem; }

/* Generic artifact preview cards */
.artifact-card { border: 1px solid var(--cborder); border-radius: 12px; padding: 0.8rem 1rem; background: var(--ccard); align-self: flex-start; max-width: 90%; }
.artifact-type { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--cmuted); }
.artifact-title { font-weight: 600; margin: 0.25rem 0 0.5rem; }
.artifact-link { display: inline-block; }

/* Buttons inside the chat shell (scoped so the rest of the app is untouched). */
.chat-shell .btn { display: inline-block; border: 1px solid var(--cborder); background: var(--ccard); color: var(--ctext); border-radius: 8px; padding: 0.55rem 1rem; font: inherit; cursor: pointer; }
.chat-shell .btn:hover { text-decoration: none; border-color: var(--cprimary); }
.chat-shell .btn-primary { background: var(--cprimary); border-color: var(--cprimary); color: #fff; }
.chat-shell .btn-primary:hover { background: var(--cprimary-h); }
.chat-shell .btn-sm { padding: 0.35rem 0.7rem; font-size: 0.85rem; }
.chat-shell .btn-lg { padding: 0.7rem 1.4rem; font-size: 1.05rem; }
.chat-shell .btn-ghost { background: transparent; }
.chat-shell .inline-form { display: inline; margin: 0; }

/* Mobile: conversation panel becomes an overlay drawer. */
@media (max-width: 900px) {
  .chat-convs { position: fixed; z-index: 30; left: 72px; top: 0; bottom: 0; height: 100dvh; transform: translateX(-115%); transition: transform 0.2s ease; box-shadow: 8px 0 24px rgba(0,0,0,0.45); }
  .chat-convs.open { transform: none; }
  .convs-toggle { display: inline-block; }
  .chat-content { padding: 0.9rem; }
  .chat-msg { max-width: 92%; }
}
@media (max-width: 560px) {
  .chat-rail { width: 56px; }
  .rail-link { width: 48px; font-size: 0; }
  .rail-link .rail-label { display: none; }
  .chat-convs { left: 56px; width: 260px; }
  .chat-topbar-user { display: none; }
}
.chat-hint { font-size: 0.82rem; color: var(--cmuted, #8f9bb5); margin: 0.5rem 0 0; }

/* Chat delete button */
.conv-item-wrap { position: relative; display: flex; align-items: stretch; border-radius: 8px; }
.conv-item-wrap.active { background: var(--ccard); box-shadow: inset 0 0 0 1px var(--cprimary); }
.conv-item-wrap .conv-item { flex: 1; min-width: 0; }
.conv-item-wrap .conv-item.active { background: none; box-shadow: none; }
.conv-delete-form { display: flex; align-items: center; padding-right: 0.3rem; }
.conv-delete-btn {
  display: none; background: none; border: none; color: var(--cmuted);
  font-size: 1.2rem; line-height: 1; cursor: pointer; padding: 0.2rem 0.4rem;
  border-radius: 6px;
}
.conv-item-wrap:hover .conv-delete-btn { display: block; }
.conv-delete-btn:hover { color: #ff6b6b; background: rgba(255,107,107,0.1); }

/* Phase 2: Browser activity card */
.browser-card {
  background: var(--ccard);
  border: 1px solid var(--cborder);
  border-radius: 12px;
  padding: 1rem;
  margin: 0.75rem 0;
  max-width: 480px;
}
.browser-card-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.browser-badge {
  background: #4c6ef5;
  color: white;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
}
.browser-status {
  font-size: 0.8rem;
  color: var(--cmuted);
  text-transform: capitalize;
}
.browser-url {
  font-size: 0.85rem;
  word-break: break-all;
  margin: 0.25rem 0;
}
.browser-action {
  font-size: 0.85rem;
  margin: 0.25rem 0;
}
.browser-progress {
  height: 6px;
  background: var(--cborder);
  border-radius: 3px;
  overflow: hidden;
  margin: 0.5rem 0;
}
.browser-progress-bar {
  height: 100%;
  width: 10%;
  background: #4c6ef5;
  border-radius: 3px;
  transition: width 0.5s ease;
}
.browser-message {
  font-size: 0.85rem;
  margin: 0.5rem 0 0 0;
}
.browser-screenshot {
  max-width: 100%;
  border-radius: 8px;
  margin-top: 0.75rem;
  border: 1px solid var(--cborder);
}

/* Method A: WordPress browser login card */
.wp-login-card {
  background: var(--ccard);
  border: 1px solid var(--cborder);
  border-radius: 12px;
  padding: 1rem;
  margin: 0.75rem 0;
  max-width: 480px;
}
.wp-login-card-head { margin-bottom: 0.5rem; }
.wp-login-badge {
  background: #21759b;
  color: white;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
}
.wp-login-site { font-size: 0.95rem; margin: 0.5rem 0; }
.wp-login-note { font-size: 0.85rem; margin: 0.5rem 0; }
.wp-login-form label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin: 0.75rem 0;
}
.wp-login-input {
  display: block;
  width: 100%;
  margin-top: 0.25rem;
  padding: 0.6rem;
  border: 1px solid var(--cborder);
  border-radius: 8px;
  background: var(--cbg);
  color: var(--ctext);
  font-size: 0.95rem;
}
.wp-login-status { margin-top: 0.75rem; font-size: 0.85rem; }
.wp-login-captcha-note { font-size: 0.8rem; margin-top: 0.75rem; }
