:root {
  --bg: #0d0e11;
  --bg-elev: #13151a;
  --bg-card: #181b22;
  --bg-hover: #1f232d;
  --bg-active: #252a36;
  --border: #262a35;
  --border-strong: #353b4a;
  --text: #eceef2;
  --text-dim: #9aa3b2;
  --text-muted: #6e7787;
  --accent: #5b9cf6;
  --accent-bg: rgba(91, 156, 246, 0.14);
  --green: #34d399;
  --green-bg: rgba(52, 211, 153, 0.12);
  --red: #f87171;
  --red-bg: rgba(248, 113, 113, 0.14);
  --amber: #fbbf24;
  --amber-bg: rgba(251, 191, 36, 0.14);
  --radius: 12px;
  --radius-sm: 8px;
  --font-sans: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "JetBrains Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }
.muted { color: var(--text-dim); }
.small { font-size: 12px; }

/* BUTTONS & INPUTS */
button {
  font-family: inherit;
  cursor: pointer;
  color: inherit;
  border: none;
  background: transparent;
}
input, select, textarea {
  font-family: inherit;
  color: var(--text);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 13px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  transition: background 0.15s, border-color 0.15s;
}
.btn:hover { background: var(--bg-hover); border-color: var(--border-strong); }
.btn-primary {
  background: #f3f4f6;
  color: #0d0e11;
  border-color: #f3f4f6;
}
.btn-primary:hover { background: #ffffff; border-color: #ffffff; }
.btn-danger {
  background: var(--red-bg);
  color: var(--red);
  border-color: rgba(248, 113, 113, 0.35);
}
.btn-danger:hover { background: rgba(248, 113, 113, 0.22); }
.btn-full { width: 100%; padding: 10px 16px; }
.icon-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
}
.icon-btn:hover { background: var(--bg-hover); color: var(--text); }

/* LOGIN SCREEN */
.login-screen {
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(circle at top, #171b26 0%, var(--bg) 55%);
}
.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}
.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
}
.brand-logo { width: 42px; height: 42px; }
.brand-logo-sm { width: 24px; height: 24px; }
.login-brand h1 { margin: 0; font-size: 18px; font-weight: 600; }
.login-brand p { margin: 2px 0 0; font-size: 12px; }
.login-form, .stack-form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--text-dim); }
.field input, .field select { padding: 10px 12px; font-size: 14px; }
.login-foot { margin-top: 18px; font-size: 11px; text-align: center; }
.otp-meta {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
}
.otp-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.otp-phone-display {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.02em;
}
.otp-channel-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  background: var(--green-bg);
  color: var(--green);
}
.otp-code-input {
  text-align: center;
  font-size: 22px !important;
  font-weight: 600;
  letter-spacing: 0.35em;
  font-variant-numeric: tabular-nums;
}
.otp-actions-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 2px;
}
.link-btn {
  background: none;
  border: none;
  padding: 0;
  font-size: 12px;
  color: var(--accent);
  cursor: pointer;
}
.link-btn:hover:not(:disabled) { text-decoration: underline; }
.link-btn:disabled { color: var(--text-dim); opacity: 0.6; cursor: not-allowed; }
.form-error {
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  background: var(--red-bg);
  color: var(--red);
  font-size: 13px;
}
.form-msg {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  background: var(--green-bg);
  color: var(--green);
}
.form-msg.err { background: var(--red-bg); color: var(--red); }

/* STUDIO 3-PANE SHELL */
.studio-shell {
  display: flex;
  height: 100dvh;
  width: 100%;
  overflow: hidden;
  position: relative;
}

/* SIDEBAR */
.sidebar {
  width: 276px;
  min-width: 276px;
  background: var(--bg-elev);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100%;
  z-index: 30;
  transition: transform 0.2s ease, margin-left 0.2s ease;
}
.sidebar.collapsed { margin-left: -276px; }
.sidebar-top {
  height: 52px;
  padding: 0 12px 0 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
}
.sidebar-brand { display: flex; align-items: center; gap: 9px; font-weight: 600; font-size: 14px; }
.cli-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
}
.cli-dot.ok { background: var(--green); box-shadow: 0 0 8px rgba(52, 211, 153, 0.5); }
.cli-dot.err { background: var(--red); }

.sidebar-actions {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-bottom: 1px solid var(--border);
}
.btn-new-agent {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--border);
  font-weight: 500;
  font-size: 13px;
}
.btn-new-agent:hover { background: var(--bg-hover); border-color: var(--border-strong); }
.btn-new-agent kbd {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  background: var(--bg);
  padding: 2px 5px;
  border-radius: 4px;
  border: 1px solid var(--border);
}
.search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.search-wrap svg {
  position: absolute;
  left: 10px;
  color: var(--text-muted);
  pointer-events: none;
}
.search-wrap input {
  width: 100%;
  padding: 7px 10px 7px 30px;
  font-size: 12.5px;
  background: var(--bg);
}
.sidebar-filters {
  display: flex;
  gap: 6px;
}
.sidebar-filters select {
  flex: 1;
  min-width: 0;
  padding: 5px 8px;
  font-size: 12px;
  background: var(--bg);
}
.chip-btn {
  padding: 5px 9px;
  font-size: 11.5px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  color: var(--text-dim);
  background: var(--bg);
}
.chip-btn.active { background: var(--accent-bg); color: var(--accent); border-color: rgba(91,156,246,0.4); }

.thread-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.thread-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 1px solid transparent;
  position: relative;
}
.thread-item:hover { background: var(--bg-hover); }
.thread-item.active {
  background: var(--bg-active);
  border-color: var(--border-strong);
}
.thread-item-top {
  display: flex;
  align-items: center;
  gap: 7px;
}
.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--text-muted);
}
.status-dot.running, .status-dot.queued {
  background: var(--accent);
  animation: pulse 1.2s infinite;
}
.status-dot.completed { background: var(--green); }
.status-dot.error { background: var(--red); }

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.8); }
}

.thread-title {
  flex: 1;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.thread-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-muted);
  padding-left: 14px;
}
.thread-ws-tag {
  background: rgba(255,255,255,0.05);
  padding: 1px 6px;
  border-radius: 4px;
  color: var(--text-dim);
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.thread-actions {
  display: none;
  position: absolute;
  right: 6px;
  top: 6px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1px;
}
.thread-item:hover .thread-actions { display: flex; gap: 2px; }
.thread-act-btn {
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  color: var(--text-dim);
  font-size: 12px;
}
.thread-act-btn:hover { background: var(--bg-hover); color: var(--text); }
.thread-act-btn.del:hover { color: var(--red); }

.sidebar-footer {
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.founder-pill { display: flex; align-items: center; gap: 8px; min-width: 0; }
.avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent-bg);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 12px;
  flex-shrink: 0;
}
.founder-meta { min-width: 0; }
.founder-name { font-size: 12.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.founder-email { font-size: 11px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-footer-btns { display: flex; gap: 2px; flex-shrink: 0; }

/* MAIN PANE */
.main-pane {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--bg);
}

.topbar {
  height: 52px;
  padding: 0 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--bg);
  flex-shrink: 0;
}
.topbar-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.topbar-title-wrap { display: flex; align-items: center; gap: 8px; min-width: 0; }
.chat-title {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ws-badge {
  font-size: 11.5px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-dim);
  white-space: nowrap;
}
.topbar-right { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.topbar-btn, .health-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-card);
  font-size: 12px;
  color: var(--text-dim);
}
.topbar-btn:hover, .health-pill:hover { background: var(--bg-hover); color: var(--text); }
.health-pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-muted); }
.health-pill.ok { border-color: rgba(52, 211, 153, 0.35); color: var(--green); background: var(--green-bg); }
.health-pill.ok .dot { background: var(--green); }
.health-pill.err { border-color: rgba(248, 113, 113, 0.4); color: var(--red); background: var(--red-bg); }
.health-pill.err .dot { background: var(--red); }

/* MESSAGES AREA */
.messages-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 20px 18px 28px;
  scroll-behavior: smooth;
}
.welcome-view {
  max-width: 780px;
  margin: 26px auto 0;
  text-align: center;
}
.welcome-logo { width: 48px; height: 48px; margin-bottom: 12px; }
.welcome-view h1 { margin: 0 0 8px; font-size: 24px; font-weight: 600; letter-spacing: -0.02em; }
.welcome-view p { margin: 0 auto 24px; max-width: 560px; font-size: 13.5px; }
.welcome-view code {
  font-family: var(--font-mono);
  background: var(--bg-card);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--border);
  font-size: 12px;
}
.welcome-section-label {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin: 18px 0 8px;
}
.ws-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px;
  text-align: left;
}
.ws-card {
  padding: 11px 12px;
  border-radius: var(--radius);
  background: var(--bg-elev);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.ws-card:hover { background: var(--bg-card); border-color: var(--border-strong); }
.ws-card.selected { border-color: var(--accent); background: var(--accent-bg); }
.ws-card-name { font-weight: 600; font-size: 13px; display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.ws-card-branch { font-family: var(--font-mono); font-size: 10.5px; color: var(--text-muted); }
.ws-card-desc { font-size: 11.5px; color: var(--text-dim); margin-top: 3px; }

.quick-prompts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.quick-chip {
  padding: 7px 12px;
  border-radius: 999px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  font-size: 12.5px;
  color: var(--text-dim);
}
.quick-chip:hover { background: var(--bg-hover); color: var(--text); border-color: var(--border-strong); }

/* CONVERSATION TURNS */
.messages-list {
  max-width: 840px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.turn-block {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.user-bubble {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 15px;
}
.user-bubble-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.user-bubble-head strong { color: var(--text-dim); font-weight: 600; }
.mode-pill {
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 10.5px;
  text-transform: uppercase;
  font-weight: 600;
  background: var(--accent-bg);
  color: var(--accent);
}
.mode-pill.plan { background: var(--amber-bg); color: var(--amber); }
.mode-pill.ask { background: rgba(167, 139, 250, 0.16); color: #c4b5fd; }
.user-prompt-text {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 14px;
}
.att-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.att-thumb {
  width: 78px;
  height: 78px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
  cursor: zoom-in;
}
.att-pdf {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  font-size: 12px;
  color: var(--text);
  text-decoration: none;
}

/* THINKING & TOOL CALLS (EXACT CURSOR STYLE) */
.agent-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-left: 4px;
}
.thinking-box, .tools-box {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-elev);
  overflow: hidden;
}
.accordion-head {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  font-size: 12.5px;
  color: var(--text-dim);
  text-align: left;
}
.accordion-head:hover { background: var(--bg-hover); color: var(--text); }
.accordion-caret {
  margin-left: auto;
  transition: transform 0.15s;
  color: var(--text-muted);
}
.open > .accordion-head .accordion-caret { transform: rotate(90deg); }
.thinking-content {
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  font-size: 12.5px;
  color: var(--text-dim);
  white-space: pre-wrap;
  max-height: 280px;
  overflow-y: auto;
  background: #0f1116;
}

.tool-list {
  display: flex;
  flex-direction: column;
}
.tool-row {
  border-top: 1px solid var(--border);
}
.tool-row:first-child { border-top: none; }
.tool-row-head {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  font-size: 12.5px;
  text-align: left;
}
.tool-row-head:hover { background: var(--bg-hover); }
.tool-badge {
  font-family: var(--font-mono);
  font-size: 10.5px;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(255,255,255,0.06);
  color: var(--text-dim);
  flex-shrink: 0;
}
.tool-title-text {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tool-dur { font-size: 11px; color: var(--text-muted); flex-shrink: 0; }
.tool-detail {
  padding: 8px 12px;
  border-top: 1px solid var(--border);
  background: #0b0d11;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-dim);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 240px;
  overflow-y: auto;
}

/* MARKDOWN RESPONSE */
.assistant-md {
  font-size: 14px;
  line-height: 1.65;
  color: var(--text);
  word-break: break-word;
}
.assistant-md h1, .assistant-md h2, .assistant-md h3 {
  margin: 16px 0 8px;
  font-weight: 600;
  line-height: 1.35;
}
.assistant-md h1 { font-size: 19px; }
.assistant-md h2 { font-size: 16.5px; }
.assistant-md h3 { font-size: 14.5px; }
.assistant-md p { margin: 8px 0; }
.assistant-md ul, .assistant-md ol { margin: 8px 0; padding-left: 22px; }
.assistant-md li { margin: 4px 0; }
.assistant-md a { color: var(--accent); text-decoration: none; }
.assistant-md a:hover { text-decoration: underline; }
.assistant-md code {
  font-family: var(--font-mono);
  font-size: 12.5px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 1px 5px;
  border-radius: 5px;
}
.code-block {
  margin: 10px 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: #0b0d11;
}
.code-block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  background: var(--bg-elev);
  border-bottom: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}
.code-copy-btn {
  font-size: 11px;
  color: var(--text-dim);
  padding: 2px 7px;
  border-radius: 4px;
}
.code-copy-btn:hover { background: var(--bg-hover); color: var(--text); }
.code-block pre {
  margin: 0;
  padding: 12px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.5;
}
.code-block pre code {
  background: none;
  border: none;
  padding: 0;
}

/* RUNNING INDICATOR */
.running-banner {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--accent);
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--accent-bg);
  width: fit-content;
}
.spinner {
  width: 13px;
  height: 13px;
  border: 2px solid rgba(91, 156, 246, 0.25);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* POST-RUN GUARDRAIL FOOTER CARD */
.run-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-radius: 10px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  font-size: 12px;
}
.guard-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-dim);
}
.guard-pill.ok { background: var(--green-bg); border-color: rgba(52,211,153,0.3); color: var(--green); }
.guard-pill.err { background: var(--red-bg); border-color: rgba(248,113,113,0.35); color: var(--red); }
.run-footer-actions {
  margin-left: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.mini-btn {
  padding: 4px 9px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  font-size: 11.5px;
  color: var(--text);
}
.mini-btn:hover { background: var(--bg-hover); border-color: var(--border-strong); }
.mini-btn.danger { color: var(--red); border-color: rgba(248,113,113,0.35); background: var(--red-bg); }
.mini-btn.primary { color: #0d0e11; background: #f3f4f6; border-color: #f3f4f6; font-weight: 500; }
.error-card {
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--red-bg);
  border: 1px solid rgba(248, 113, 113, 0.35);
  color: #fecaca;
  font-family: var(--font-mono);
  font-size: 12px;
  white-space: pre-wrap;
  max-height: 220px;
  overflow-y: auto;
}

/* BOTTOM COMPOSER */
.composer-wrap {
  padding: 8px 18px calc(12px + env(safe-area-inset-bottom));
  background: var(--bg);
  flex-shrink: 0;
}
.composer-box {
  max-width: 840px;
  margin: 0 auto;
  background: var(--bg-elev);
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  padding: 10px 12px 8px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.composer-box:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(91, 156, 246, 0.12);
}
.composer-box.drag-over {
  border-color: var(--accent);
  background: #171d29;
}
.pending-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}
.pending-att-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  font-size: 12px;
}
.pending-att-chip img {
  width: 24px;
  height: 24px;
  object-fit: cover;
  border-radius: 4px;
}
.pending-att-remove { color: var(--text-muted); font-size: 14px; padding: 0 2px; }
.pending-att-remove:hover { color: var(--red); }

#composer-input {
  width: 100%;
  border: none;
  background: transparent;
  resize: none;
  font-size: 14px;
  line-height: 1.5;
  max-height: 200px;
  padding: 2px 2px 8px;
}
.composer-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 6px;
  border-top: 1px solid rgba(255,255,255,0.05);
}
.composer-left-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.mode-segment {
  display: inline-flex;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 2px;
}
.mode-btn {
  padding: 3px 9px;
  font-size: 11.5px;
  font-weight: 500;
  border-radius: 5px;
  color: var(--text-dim);
}
.mode-btn.active { background: var(--bg-active); color: var(--text); }
.composer-select {
  padding: 4px 8px;
  font-size: 12px;
  background: var(--bg);
  max-width: 190px;
}
.pin-input {
  width: 78px;
  padding: 4px 8px;
  font-size: 12px;
  background: var(--bg);
}
.composer-right-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}
.btn-send {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: #f3f4f6;
  color: #0d0e11;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn-send:hover { background: #ffffff; }
.btn-send:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-stop {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  border-radius: 8px;
  background: var(--red-bg);
  border: 1px solid rgba(248, 113, 113, 0.4);
  color: var(--red);
  font-size: 12px;
  font-weight: 600;
}
.stop-square { width: 8px; height: 8px; background: var(--red); border-radius: 2px; }
.composer-hint {
  max-width: 840px;
  margin: 5px auto 0;
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
  padding: 0 4px;
}

/* DIFF DRAWER */
.diff-drawer {
  width: 460px;
  max-width: 92vw;
  background: var(--bg-elev);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100%;
  z-index: 25;
}
.drawer-header {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.drawer-header h3 { margin: 0; font-size: 14px; }
.diff-stat-box {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 11.5px;
  white-space: pre-wrap;
  background: #101217;
  max-height: 150px;
  overflow-y: auto;
  color: var(--text-dim);
}
.diff-code-box {
  flex: 1;
  overflow: auto;
  padding: 10px 0;
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 1.5;
  background: #0b0d11;
}
.diff-line { padding: 0 12px; white-space: pre; }
.diff-line.add { background: rgba(52, 211, 153, 0.14); color: #86efac; }
.diff-line.del { background: rgba(248, 113, 113, 0.14); color: #fca5a5; }
.diff-line.hunk { background: rgba(91, 156, 246, 0.12); color: #93c5fd; margin-top: 6px; }
.diff-line.file { font-weight: 700; color: #f3f4f6; margin-top: 10px; border-top: 1px solid var(--border); padding-top: 6px; }

/* MODALS */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 60;
}
.modal-card {
  width: 100%;
  max-width: 600px;
  max-height: 86dvh;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.modal-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-header h3 { margin: 0; font-size: 15px; }
.modal-tabs {
  display: flex;
  gap: 4px;
  padding: 8px 14px 0;
  border-bottom: 1px solid var(--border);
}
.tab-btn {
  padding: 8px 12px;
  font-size: 12.5px;
  color: var(--text-dim);
  border-bottom: 2px solid transparent;
}
.tab-btn.active { color: var(--text); border-bottom-color: var(--accent); font-weight: 500; }
.modal-body { padding: 16px; overflow-y: auto; }
.tab-panel { display: flex; flex-direction: column; gap: 12px; }
.info-banner {
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  font-size: 12.5px;
}
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  cursor: pointer;
}
.toggle-row input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); }
.field-inline { display: flex; gap: 8px; }
.field-inline input { flex: 1; padding: 8px 10px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.grid-2 input, .grid-2 select { padding: 8px 10px; }
.founders-list, .audit-list { display: flex; flex-direction: column; gap: 8px; }
.founder-row, .audit-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 11px;
  border-radius: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  font-size: 12.5px;
}
.add-founder-box {
  margin-top: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.add-founder-box h4 { margin: 0 0 4px; font-size: 13px; }
.lightbox-inner img {
  max-width: 92vw;
  max-height: 88dvh;
  border-radius: 10px;
  border: 1px solid var(--border);
}

/* TOAST */
.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  padding: 10px 14px;
  border-radius: 10px;
  background: #1f2430;
  border: 1px solid var(--border-strong);
  color: var(--text);
  font-size: 13px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  z-index: 90;
}

.mobile-only { display: none; }
.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 24;
}

@media (max-width: 860px) {
  .mobile-only { display: inline-flex; }
  .desktop-only { display: none; }
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    transform: translateX(-100%);
    margin-left: 0 !important;
  }
  .sidebar.mobile-open { transform: translateX(0); }
  .diff-drawer {
    position: fixed;
    right: 0;
    top: 0;
    bottom: 0;
    width: 100%;
    max-width: 100%;
  }
  .ws-badge { display: none; }
  .composer-select { max-width: 130px; }
  .composer-hint { display: none; }
  .grid-2 { grid-template-columns: 1fr; }
}
