/* Coachinside AI Hub — Claude Desktop-inspired dark UX */
:root {
  --bg: #1a1a17;
  --bg-panel: #201f1b;
  --bg-panel-hover: #262521;
  --bg-active: #2f2d28;
  --bg-input: #16150f;
  --bg-msg-user: #262521;
  --bg-msg-assistant: transparent;
  --bg-composer: #16150f;
  --ink: #ebe9dc;
  --ink-mute: #b0aea0;
  --ink-dim: #78766c;
  --line: #302e28;
  --line-soft: #26251f;
  --accent: #d97757;
  --accent-hover: #e58862;
  --accent-soft: rgba(217, 119, 87, 0.12);
  --ok: #6fbf73;
  --warn: #f0c052;
  --err: #e57373;
  --f-body: "Inter", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  height: 100%; min-height: 100%;
  background: var(--bg);          /* paint the full canvas, not just <body> */
}
body {
  color: var(--ink);
  font-family: var(--f-body);
  font-size: 14px;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
#root { height: 100dvh; min-height: 100%; background: var(--bg); }

button { font-family: inherit; }

/* ============ AUTH ============ */
.auth-screen {
  height: 100dvh; min-height: 100%;
  display: grid; place-items: center;
  background: radial-gradient(ellipse at top, rgba(217,119,87,0.06), transparent 60%), var(--bg);
}
.auth-card {
  width: 400px;
  padding: 36px 32px 32px;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}
.auth-logo {
  width: 44px; height: 44px; border-radius: 11px;
  background: var(--accent); color: #fff;
  display: grid; place-items: center;
  font-weight: 700; font-size: 20px;
  margin-bottom: 18px;
}
.auth-card h1 { margin: 0 0 4px; font-size: 20px; font-weight: 600; }
.auth-sub { color: var(--ink-mute); font-size: 13px; margin: 0 0 22px; }
.auth-form { display: flex; flex-direction: column; gap: 12px; }
.auth-form label { display: flex; flex-direction: column; gap: 5px; }
.auth-form span { font-size: 11px; color: var(--ink-mute); letter-spacing: 0.04em; text-transform: uppercase; }
.auth-form input {
  padding: 10px 12px;
  border-radius: 7px;
  background: var(--bg-input);
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 14px;
  outline: none;
  transition: border-color 120ms;
}
.auth-form input:focus { border-color: var(--accent); }
.auth-hint { font-size: 11px; color: var(--ink-dim); }
.auth-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; gap: 12px; }
.auth-toggle {
  appearance: none; background: transparent; border: 0;
  color: var(--ink-mute); font-size: 12px; cursor: pointer; padding: 4px 0;
}
.auth-toggle:hover { color: var(--accent); }
.auth-error { color: var(--err); font-size: 12px; margin-top: 4px; font-family: var(--f-mono); }

/* ============ APP LAYOUT ============ */
.app { display: grid; grid-template-columns: 268px 1fr; height: 100dvh; min-height: 100%; background: var(--bg); }

/* ============ SIDEBAR ============ */
.sb {
  background: var(--bg-panel);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.sb-head {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 10px;
}
.sb-logo {
  width: 28px; height: 28px; border-radius: 8px;
  background: var(--accent); color: #fff;
  display: grid; place-items: center;
  font-weight: 700; font-size: 13px;
}
.sb-brand { display: flex; flex-direction: column; gap: 1px; }
.sb-title { font-weight: 600; font-size: 13px; letter-spacing: -0.005em; }
.sb-sub { font-size: 10px; color: var(--ink-dim); letter-spacing: 0.06em; text-transform: uppercase; }

.sb-toolbar {
  padding: 10px 12px 8px;
  display: flex; gap: 6px;
}
.new-chat-btn {
  flex: 1;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: flex; align-items: center; gap: 6px;
  justify-content: center;
  transition: filter 120ms;
}
.new-chat-btn:hover { filter: brightness(1.08); }

.icon-btn {
  appearance: none;
  width: 34px; height: 34px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: var(--bg-input);
  color: var(--ink);
  font-size: 16px;
  cursor: pointer;
  display: grid; place-items: center;
  transition: all 120ms;
}
.icon-btn:hover { border-color: var(--accent); color: var(--accent); }

.sb-search-wrap { padding: 4px 12px 8px; }
.sb-search {
  width: 100%;
  padding: 7px 10px;
  border-radius: 7px;
  background: var(--bg-input);
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 12px;
  outline: none;
}
.sb-search:focus { border-color: var(--accent); }

.sb-section {
  padding: 12px 16px 6px;
  font-size: 10px;
  color: var(--ink-dim);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.sb-list { flex: 1; overflow-y: auto; padding: 0 8px 12px; }
.sb-empty { padding: 12px 16px; color: var(--ink-mute); font-size: 12px; line-height: 1.5; }
.sb-item {
  display: flex; flex-direction: column; gap: 2px;
  padding: 9px 12px;
  border-radius: 8px;
  cursor: pointer;
  margin-bottom: 2px;
  transition: background 120ms;
}
.sb-item:hover { background: var(--bg-panel-hover); }
.sb-item.active { background: var(--bg-active); }
.sb-item-name {
  font-size: 13px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sb-item-meta { font-size: 10px; color: var(--ink-dim); font-family: var(--f-mono); }

/* Sidebar section row (label + inline mini-btn) */
.sb-section-row { display: flex; align-items: center; justify-content: space-between; }
.sb-mini-btn {
  appearance: none;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink-mute);
  font-size: 12px;
  width: 22px; height: 22px; padding: 0;
  border-radius: 5px;
  cursor: pointer;
  display: inline-grid; place-items: center;
  transition: all 120ms;
}
.sb-mini-btn:hover { border-color: var(--accent); color: var(--accent); }

/* Sidebar project row */
.sb-item-name-input {
  flex: 1;
  padding: 3px 6px;
  background: var(--bg-input);
  border: 1px solid var(--accent);
  border-radius: 4px;
  color: var(--ink);
  font-family: inherit;
  font-size: 13px;
  outline: none;
  min-width: 0;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 16px;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  font-size: 13px;
  z-index: 100;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  cursor: pointer;
  animation: toastIn 200ms cubic-bezier(0.2, 0.7, 0.2, 1);
}
.toast.err { border-color: var(--err); color: var(--err); }
.toast.ok { border-color: var(--ok); color: var(--ok); }
@keyframes toastIn { from { transform: translate(-50%, 8px); opacity: 0 } to { transform: translate(-50%, 0); opacity: 1 } }

/* Kebab / row actions */
.sb-item .sb-row-actions { position: relative; margin-left: auto; }
.sb-item .sb-row-kebab {
  appearance: none; background: transparent; border: 0;
  color: var(--ink-dim); font-size: 16px; padding: 0 4px;
  border-radius: 4px; cursor: pointer;
  opacity: 0; transition: all 120ms;
}
.sb-item:hover .sb-row-kebab, .sb-item.active .sb-row-kebab { opacity: 1; }
.sb-row-kebab:hover { color: var(--accent); background: var(--bg-panel-hover); }
.sb-menu {
  position: absolute;
  right: 0; top: calc(100% + 4px);
  min-width: 200px;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.4);
  z-index: 30;
  display: flex; flex-direction: column;
  padding: 4px;
}
.sb-menu button {
  appearance: none; background: transparent; border: 0;
  padding: 8px 10px; text-align: left;
  color: var(--ink); font-size: 12.5px;
  border-radius: 5px; cursor: pointer;
  display: flex; align-items: center; gap: 8px;
  white-space: nowrap;
}
.sb-menu button:hover { background: var(--bg-panel-hover); }
.sb-menu button.danger { color: var(--err); }
.sb-menu button.danger:hover { background: rgba(229, 115, 115, 0.1); }
.sb-menu-sub {
  border-top: 1px solid var(--line-soft);
  margin-top: 4px; padding-top: 4px;
  display: flex; flex-direction: column;
}
.sb-menu-sub-label {
  padding: 6px 10px 4px;
  font-size: 10px; color: var(--ink-dim);
  letter-spacing: 0.06em; text-transform: uppercase;
}

.sb-item-project { padding: 10px 12px; }
.sb-item-row { display: flex; align-items: center; gap: 8px; }
.sb-item-icon {
  width: 22px; height: 22px; border-radius: 6px;
  background: var(--bg-input); color: var(--ink);
  display: grid; place-items: center;
  font-size: 12px; font-weight: 600;
  flex-shrink: 0;
}
.sb-badge {
  font-size: 9px;
  padding: 1px 6px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent);
  letter-spacing: 0.06em; text-transform: uppercase;
}

/* ============ PROJECT DETAIL VIEW ============ */
.project-view {
  flex: 1;
  overflow-y: auto;
  padding: 32px 40px 40px;
  max-width: 900px;
  width: 100%;
  align-self: center;
}
.project-hero {
  display: flex; align-items: center; gap: 18px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 24px;
}
.project-hero-icon {
  width: 56px; height: 56px; border-radius: 14px;
  background: var(--accent); color: #fff;
  display: grid; place-items: center;
  font-weight: 700; font-size: 24px;
  flex-shrink: 0;
}
.project-name { margin: 0; font-size: 22px; font-weight: 600; letter-spacing: -0.01em; }
.project-desc { color: var(--ink-mute); font-size: 14px; margin-top: 4px; }
.project-meta { font-size: 11px; color: var(--ink-dim); margin-top: 6px; font-family: var(--f-mono); }

.project-section { margin-bottom: 28px; }
.project-section-h {
  font-size: 11px; color: var(--ink-mute);
  letter-spacing: 0.06em; text-transform: uppercase;
  margin-bottom: 10px;
}
.project-sysprompt {
  padding: 14px 16px;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  font-family: var(--f-mono);
  font-size: 12.5px;
  color: var(--ink-mute);
  white-space: pre-wrap;
  line-height: 1.55;
}
.project-file-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.project-file-chip {
  padding: 8px 12px;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 12.5px;
  color: var(--ink-mute);
  font-family: var(--f-mono);
}
.project-thread-list { display: flex; flex-direction: column; gap: 6px; }
.project-thread-item {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-panel);
  cursor: pointer;
  transition: all 120ms;
}
.project-thread-item:hover { border-color: var(--accent); background: var(--bg-panel-hover); }
.project-thread-title { font-size: 13.5px; font-weight: 500; }
.project-thread-meta { font-size: 11px; color: var(--ink-dim); margin-top: 2px; font-family: var(--f-mono); }

.sb-user {
  padding: 10px 14px;
  border-top: 1px solid var(--line);
  display: flex; align-items: center; gap: 10px;
  cursor: pointer;
  transition: background 120ms;
  background: var(--bg-panel);
}
.sb-user:hover { background: var(--bg-panel-hover); }
.sb-user-avatar {
  width: 30px; height: 30px; border-radius: 999px;
  background: var(--bg-input); color: var(--ink);
  display: grid; place-items: center;
  font-size: 12px; font-weight: 600;
}
.sb-user-info { flex: 1; min-width: 0; }
.sb-user-email { font-size: 12px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-user-role { font-size: 10px; color: var(--ink-dim); letter-spacing: 0.06em; text-transform: uppercase; }

/* ============ MAIN ============ */
.main {
  display: flex; flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}
.mainbar {
  height: 52px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  display: flex; align-items: center; padding: 0 20px; gap: 14px;
  flex-shrink: 0;
}
.mb-title {
  flex: 1; min-width: 0;
  font-weight: 500; font-size: 14px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  display: flex; align-items: center; gap: 8px;
}
.rename-btn {
  appearance: none; background: transparent; border: 0;
  color: var(--ink-dim); font-size: 12px; padding: 2px 6px;
  border-radius: 5px; cursor: pointer;
  opacity: 0; transition: opacity 120ms;
}
.mb-title:hover .rename-btn { opacity: 1; }
.rename-btn:hover { background: var(--bg-panel-hover); color: var(--accent); }
.mb-controls { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.mb-select {
  appearance: none;
  padding: 7px 26px 7px 10px;
  border-radius: 7px;
  background: var(--bg-input);
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 12px;
  outline: none;
  cursor: pointer;
  min-width: 150px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path fill='%23b0aea0' d='M0 0h10L5 6z'/></svg>");
  background-repeat: no-repeat;
  background-position: right 8px center;
}
.mb-select:hover { border-color: var(--ink-dim); }
.mb-btn {
  appearance: none;
  padding: 7px 12px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: var(--bg-input);
  color: var(--ink);
  font-size: 12px;
  cursor: pointer;
  transition: all 120ms;
  white-space: nowrap;
}
.mb-btn:hover { border-color: var(--ink-dim); background: var(--bg-panel-hover); }
.mb-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.mb-btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.mb-btn.primary:hover { filter: brightness(1.08); }
.mb-btn.danger:hover:not(:disabled) { border-color: var(--err); color: var(--err); }

/* ============ CHAT PANE ============ */
.chat-pane {
  flex: 1;
  display: flex; flex-direction: column;
  overflow: hidden;
  position: relative;
}
.chat-empty {
  flex: 1;
  display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 14px;
  color: var(--ink-mute);
  padding: 40px 20px;
}
.chat-empty-logo {
  width: 56px; height: 56px; border-radius: 14px;
  background: var(--accent-soft);
  color: var(--accent);
  display: grid; place-items: center;
  font-weight: 700; font-size: 24px;
}
.chat-empty h2 { margin: 0; font-size: 20px; font-weight: 500; color: var(--ink); }
.chat-empty p { margin: 0; font-size: 14px; max-width: 46ch; text-align: center; }

.msg-list {
  flex: 1;
  overflow-y: auto;
  padding: 24px 0;
  display: flex; flex-direction: column;
  gap: 24px;
}
.msg-row { padding: 0 24px; display: flex; }
.msg-row.user { justify-content: flex-end; }
.msg-inner {
  max-width: 780px;
  width: 100%;
}
.msg-row.user .msg-inner { max-width: 620px; }
.msg-bubble {
  padding: 12px 16px;
  border-radius: 12px;
  line-height: 1.6;
  font-size: 14.5px;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.msg-row.user .msg-bubble {
  background: var(--bg-msg-user);
  border: 1px solid var(--line);
}
.msg-row.assistant .msg-bubble {
  padding: 0;
}
.msg-role {
  font-size: 10px;
  color: var(--ink-dim);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 6px;
  font-family: var(--f-mono);
}
.msg-md p { margin: 0 0 12px; }
.msg-md p:last-child { margin-bottom: 0; }
.msg-md ul, .msg-md ol { padding-left: 22px; margin: 0 0 12px; }
.msg-md li { margin-bottom: 4px; }
.msg-md h1, .msg-md h2, .msg-md h3 { font-weight: 600; margin: 18px 0 8px; }
.msg-md h1 { font-size: 20px; }
.msg-md h2 { font-size: 17px; }
.msg-md h3 { font-size: 15px; }
.msg-md code {
  font-family: var(--f-mono);
  background: var(--bg-input);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 12.5px;
}
.msg-md pre {
  background: var(--bg-input);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  overflow-x: auto;
  margin: 8px 0 14px;
}
.msg-md pre code { background: transparent; padding: 0; font-size: 12.5px; line-height: 1.55; }
.msg-md blockquote { border-left: 3px solid var(--line); padding: 2px 12px; color: var(--ink-mute); margin: 0 0 12px; }
.msg-md a { color: var(--accent); text-decoration: none; }
.msg-md a:hover { text-decoration: underline; }
.msg-caret {
  display: inline-block;
  width: 6px; height: 15px;
  background: var(--accent);
  vertical-align: text-bottom;
  animation: caret-blink 0.8s infinite;
  border-radius: 1px;
}
@keyframes caret-blink { 0%, 49% { opacity: 1 } 50%, 100% { opacity: 0 } }

/* ============ ATTACHMENT CHIPS ============ */
.attach-chips {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 8px 24px 0;
}
.attach-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px 5px 8px;
  background: var(--bg-input);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 11px;
  color: var(--ink-mute);
  font-family: var(--f-mono);
}
.attach-chip .rm {
  appearance: none; background: transparent; border: 0;
  color: var(--ink-dim); font-size: 14px; cursor: pointer; padding: 0 2px;
}
.attach-chip .rm:hover { color: var(--err); }

/* ============ TOOL ACTIVITY ============ */
.tool-activity {
  display: flex; flex-direction: column; gap: 4px;
  padding: 0 24px 8px;
}
.tool-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 10px;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 11.5px;
  font-family: var(--f-mono);
  color: var(--ink-mute);
  align-self: flex-start;
  max-width: 100%;
}
.tool-chip .tool-dot { width: 6px; height: 6px; border-radius: 999px; background: var(--ink-dim); flex-shrink: 0; }
.tool-chip.running .tool-dot { background: var(--warn); animation: toolPulse 1s infinite; }
.tool-chip.done .tool-dot { background: var(--ok); }
.tool-chip.failed .tool-dot { background: var(--err); }
.tool-chip.failed { border-color: rgba(229,115,115,0.4); }
@keyframes toolPulse { 0%,100%{opacity:1} 50%{opacity:.35} }
.tool-chip .tool-name { color: var(--ink); }
.tool-chip .tool-label { color: var(--ink-mute); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tool-chip .tool-ms { color: var(--ink-dim); font-size: 10px; }

/* ============ PROPOSALS (human-in-the-loop) ============ */
.proposals { padding: 0 24px 10px; display: flex; flex-direction: column; gap: 10px; }
.proposal {
  border: 1px solid var(--accent);
  background: var(--accent-soft);
  border-radius: 12px;
  overflow: hidden;
}
.proposal-head {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(217,119,87,0.25);
}
.proposal-badge {
  font-size: 9.5px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--accent); border: 1px solid var(--accent);
  padding: 2px 8px; border-radius: 999px;
}
.proposal-action { font-size: 13px; font-weight: 600; }
.proposal-body { padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.proposal-k {
  display: inline-block; min-width: 62px;
  font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-mute);
}
.proposal-text {
  margin: 6px 0 0; padding: 10px 12px;
  background: var(--bg-input); border: 1px solid var(--line); border-radius: 8px;
  font-family: var(--f-mono); font-size: 12px; line-height: 1.55;
  white-space: pre-wrap; word-break: break-word; max-height: 260px; overflow-y: auto;
}
.proposal-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 10px 14px; border-top: 1px solid rgba(217,119,87,0.2); }

/* ============ COMPOSER ============ */
.composer-wrap { padding: 12px 24px 20px; }
.composer {
  background: var(--bg-composer);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px 10px;
  display: flex; flex-direction: column; gap: 8px;
  transition: border-color 120ms;
}
.composer:focus-within { border-color: var(--accent); }
.composer textarea {
  width: 100%;
  min-height: 48px;
  max-height: 260px;
  background: transparent;
  border: 0;
  outline: none;
  resize: none;
  color: var(--ink);
  font-family: inherit;
  font-size: 14.5px;
  line-height: 1.55;
}
.composer textarea::placeholder { color: var(--ink-dim); }
.composer-bar {
  display: flex; align-items: center; gap: 8px;
}
.composer-bar .spacer { flex: 1; }
.composer-attach {
  appearance: none; background: transparent; border: 0;
  color: var(--ink-mute); font-size: 18px; cursor: pointer;
  padding: 4px 6px; border-radius: 6px;
  transition: color 120ms, background 120ms;
}
.composer-attach:hover { color: var(--accent); background: var(--accent-soft); }
.composer-send {
  appearance: none;
  padding: 7px 14px;
  border-radius: 8px;
  border: 0;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: filter 120ms;
}
.composer-send:hover:not(:disabled) { filter: brightness(1.08); }
.composer-send:disabled { opacity: 0.4; cursor: not-allowed; }
.composer-send.stop { background: var(--err); }

/* ============ ARTIFACTS ============ */
.artifact-preview {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg-panel);
}
.artifact-head {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-input);
}
.artifact-lang {
  font-size: 10px; color: var(--accent);
  letter-spacing: 0.08em; text-transform: uppercase;
}
.artifact-iframe {
  width: 100%; height: 260px;
  border: 0; background: #fff;
  display: block;
  resize: vertical;
}

/* message attachments (images inline) */
.msg-attachments { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.msg-image {
  max-width: 320px; max-height: 320px;
  border-radius: 10px; border: 1px solid var(--line);
  display: block;
}

/* composer attachment strip */
.composer-attachments { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 2px 8px; }

/* skills sidebar row */
.sb-item-skill { padding: 8px 12px; }

/* analytics bar chart */
.chart-bars {
  display: flex; align-items: flex-end; gap: 3px;
  height: 130px; padding: 8px 4px 0;
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--bg-input);
  overflow-x: auto;
}
.chart-bar {
  flex: 1; min-width: 14px;
  height: 100%;
  display: flex; flex-direction: column; justify-content: flex-end; align-items: center;
  gap: 4px;
}
.chart-bar-fill {
  width: 100%;
  background: linear-gradient(180deg, var(--accent), rgba(217,119,87,0.35));
  border-radius: 3px 3px 0 0;
  min-height: 2px;
}
.chart-bar-label { font-size: 8px; color: var(--ink-dim); white-space: nowrap; }

/* ============ MODAL ============ */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 50;
  display: grid; place-items: center;
  animation: fade 150ms;
}
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }
.modal {
  width: 580px; max-width: calc(100vw - 32px); max-height: calc(100vh - 64px);
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  display: flex; flex-direction: column;
  overflow: hidden;
}
.modal-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-head h3 { margin: 0; font-size: 15px; font-weight: 600; }
.modal-body { padding: 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 18px; }
.modal-actions { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; }

.field { display: flex; flex-direction: column; gap: 5px; }
.field-label { font-size: 11px; color: var(--ink-mute); letter-spacing: 0.04em; text-transform: uppercase; }
.field-input, .field-textarea {
  padding: 9px 12px;
  border-radius: 7px;
  background: var(--bg-input);
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 13px;
  outline: none;
}
.field-textarea { min-height: 90px; resize: vertical; font-family: var(--f-mono); font-size: 12px; }
.field-input:focus, .field-textarea:focus { border-color: var(--accent); }
.field-hint { font-size: 11px; color: var(--ink-dim); }
.field-error { font-size: 11px; color: var(--err); font-family: var(--f-mono); }

/* keys list */
.keys-list { display: flex; flex-direction: column; gap: 8px; }
.key-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-input);
}
.key-row-info { flex: 1; min-width: 0; }
.key-row-title { font-size: 13px; font-weight: 500; }
.key-row-meta { font-size: 11px; color: var(--ink-dim); font-family: var(--f-mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ============ SCROLLBAR ============ */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 5px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.16); border: 2px solid transparent; background-clip: content-box; }
