/* Claus — Claude.ai visual replica
   Pixel-clone for Accord Partners internal demo.
   Palette swap to Accord brand: change --bg-app, --bg-sidebar, --accent. */

:root {
  /* Claude.ai dark palette */
  --bg-app: #262624;
  --bg-sidebar: #1F1E1D;
  --bg-elevated: #2F2E2C;
  --bg-elevated-hover: #3A3936;
  --bg-input: #2F2E2C;
  --bg-input-focus: #353330;

  --border-subtle: rgba(255, 255, 255, 0.06);
  --border-medium: rgba(255, 255, 255, 0.10);
  --border-strong: rgba(255, 255, 255, 0.18);

  --text-primary: #FAF9F5;
  --text-secondary: #C9C5BC;
  --text-tertiary: #8E8B83;
  --text-muted: #6E6B65;

  --accent: #C15F3C;
  --accent-hover: #D87149;
  --accent-bg: rgba(193, 95, 60, 0.12);
  --accent-bg-strong: rgba(193, 95, 60, 0.22);

  --shadow-popover: 0 12px 32px rgba(0, 0, 0, 0.40), 0 4px 12px rgba(0, 0, 0, 0.20);
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.06);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-pill: 999px;

  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --sidebar-width: 260px;
  --artifacts-width: 520px;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: var(--font-sans);
  background: var(--bg-app);
  color: var(--text-primary);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
}

body {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  transition: grid-template-columns 0.2s ease;
}

body.artifacts-open {
  grid-template-columns: var(--sidebar-width) 1fr var(--artifacts-width);
}

body.sidebar-collapsed {
  grid-template-columns: 0 1fr;
}

body.sidebar-collapsed.artifacts-open {
  grid-template-columns: 0 1fr var(--artifacts-width);
}

button {
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

textarea {
  font-family: inherit;
  font-size: inherit;
  background: none;
  border: none;
  outline: none;
  color: inherit;
  resize: none;
}

/* ─── Sidebar ─────────────────────────────────────────────── */

.sidebar {
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  transition: opacity 0.2s ease;
}

body.sidebar-collapsed .sidebar {
  opacity: 0;
  pointer-events: none;
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 14px 8px 14px;
}

.sidebar-toggle,
.sidebar-search {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  transition: background 0.15s, color 0.15s;
}

.sidebar-toggle:hover,
.sidebar-search:hover {
  background: var(--bg-elevated-hover);
  color: var(--text-primary);
}

.sidebar-brand {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-mark {
  display: flex;
  align-items: center;
}

.sidebar-new-chat {
  margin: 4px 12px 14px 12px;
  padding: 9px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: transparent;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 500;
  transition: background 0.15s, border-color 0.15s;
}

.sidebar-new-chat:hover {
  background: var(--bg-elevated-hover);
  border-color: var(--border-strong);
}

.sidebar-nav {
  padding: 0 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 14px;
  transition: background 0.15s, color 0.15s;
}

.sidebar-nav-item:hover {
  background: var(--bg-elevated-hover);
  color: var(--text-primary);
}

.sidebar-section {
  margin-top: 22px;
  padding: 0 8px;
}

.sidebar-section-header {
  padding: 4px 12px 8px 12px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-tertiary);
  letter-spacing: 0.02em;
}

.sidebar-section-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 50vh;
  overflow-y: auto;
}

.sidebar-pin {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text-secondary);
  transition: background 0.15s, color 0.15s;
}

.sidebar-pin:hover {
  background: var(--bg-elevated-hover);
  color: var(--text-primary);
}

.pin-emoji {
  font-size: 16px;
  flex-shrink: 0;
}

.sidebar-recent {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background 0.15s, color 0.15s;
  cursor: pointer;
}

.sidebar-recent.active {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.sidebar-recent:hover {
  background: var(--bg-elevated-hover);
  color: var(--text-primary);
}

.sidebar-footer {
  margin-top: auto;
  padding: 12px 14px;
  border-top: 1px solid var(--border-subtle);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s;
}

.user-chip:hover {
  background: var(--bg-elevated-hover);
}

.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 13px;
}

.user-meta {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.user-name {
  font-size: 13px;
  font-weight: 500;
}

.user-plan {
  font-size: 11px;
  color: var(--text-tertiary);
}

/* ─── Main panel ──────────────────────────────────────────── */

.main {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  background: var(--bg-app);
}

.main-header {
  height: 56px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 4px;
}

.topbar-tab {
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-tertiary);
  transition: background 0.15s, color 0.15s;
}

.topbar-tab:hover {
  background: var(--bg-elevated-hover);
  color: var(--text-secondary);
}

.topbar-tab.active {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.topbar-center {
  display: flex;
  align-items: center;
}

.model-switcher {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: background 0.15s, color 0.15s;
}

.model-switcher:hover {
  background: var(--bg-elevated-hover);
  color: var(--text-primary);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar-iconbtn {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  transition: background 0.15s, color 0.15s;
}

.topbar-iconbtn:hover {
  background: var(--bg-elevated-hover);
  color: var(--text-primary);
}

.topbar-btn {
  padding: 7px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  transition: background 0.15s;
}

.topbar-btn.primary {
  background: var(--text-primary);
  color: var(--bg-app);
}

.topbar-btn.primary:hover {
  background: var(--text-secondary);
}

/* ─── Conversation area ───────────────────────────────────── */

.conversation {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.welcome {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  max-width: 760px;
  width: 100%;
  margin: 0 auto;
}

.welcome-greeting {
  font-size: 32px;
  font-weight: 400;
  margin: 0 0 36px 0;
  text-align: center;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.brand-star {
  color: var(--accent);
  margin-right: 6px;
}

.welcome-disclaimer {
  margin-top: 18px;
  font-size: 12px;
  color: var(--text-tertiary);
  text-align: center;
  max-width: 540px;
}

.messages {
  max-width: 760px;
  width: 100%;
  margin: 0 auto;
  padding: 24px 24px 120px 24px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.msg {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.msg.user {
  align-items: flex-end;
}

.msg.user .msg-bubble {
  background: var(--bg-elevated);
  padding: 12px 16px;
  border-radius: var(--radius-lg);
  max-width: 80%;
  font-size: 15px;
}

.msg.assistant .msg-bubble {
  max-width: 100%;
  font-size: 15px;
  line-height: 1.65;
}

.msg-bubble p {
  margin: 0 0 12px 0;
}

.msg-bubble p:last-child {
  margin-bottom: 0;
}

.msg-bubble pre {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 13px;
  margin: 12px 0;
}

.msg-bubble code {
  background: var(--bg-elevated);
  border-radius: 4px;
  padding: 2px 6px;
  font-family: var(--font-mono);
  font-size: 13px;
}

.msg-bubble pre code {
  background: none;
  padding: 0;
}

.msg-bubble h1, .msg-bubble h2, .msg-bubble h3 {
  margin: 18px 0 8px 0;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.msg-bubble h1 { font-size: 22px; }
.msg-bubble h2 { font-size: 18px; }
.msg-bubble h3 { font-size: 16px; }

.msg-bubble ul, .msg-bubble ol {
  margin: 8px 0 12px 0;
  padding-left: 22px;
}

.msg-bubble li {
  margin: 4px 0;
}

.msg-bubble blockquote {
  border-left: 3px solid var(--border-strong);
  padding-left: 14px;
  color: var(--text-secondary);
  margin: 12px 0;
}

.msg-bubble table {
  border-collapse: collapse;
  margin: 12px 0;
  width: 100%;
}

.msg-bubble th, .msg-bubble td {
  border: 1px solid var(--border-medium);
  padding: 8px 12px;
  text-align: left;
}

.msg-bubble th {
  background: var(--bg-elevated);
  font-weight: 600;
}

.msg-bubble a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.msg-actions {
  display: flex;
  gap: 4px;
  margin-top: 4px;
  opacity: 0;
  transition: opacity 0.15s;
}

.msg:hover .msg-actions {
  opacity: 1;
}

.msg-action-btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-tertiary);
  transition: background 0.15s, color 0.15s;
}

.msg-action-btn:hover {
  background: var(--bg-elevated-hover);
  color: var(--text-primary);
}

.thinking-cursor {
  display: inline-block;
  width: 8px;
  height: 16px;
  background: var(--text-primary);
  vertical-align: middle;
  animation: blink 1s infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

.artifact-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  margin: 12px 0;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.artifact-card:hover {
  background: var(--bg-elevated-hover);
  border-color: var(--border-strong);
}

.artifact-card-icon {
  width: 36px;
  height: 36px;
  background: var(--accent-bg);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  flex-shrink: 0;
}

.artifact-card-meta {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.artifact-card-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}

.artifact-card-sub {
  font-size: 12px;
  color: var(--text-tertiary);
}

/* ─── Composer ────────────────────────────────────────────── */

.composer-wrapper {
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 0 24px;
}

.composer-wrapper.welcome-composer {
  max-width: 720px;
  padding: 0;
}

.composer-wrapper.docked {
  position: sticky;
  bottom: 0;
  background: linear-gradient(to bottom, transparent, var(--bg-app) 40%);
  padding-top: 32px;
  padding-bottom: 18px;
  pointer-events: none;
}

.composer-wrapper.docked .composer {
  pointer-events: auto;
}

.composer {
  background: var(--bg-input);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  padding: 14px 14px 8px 14px;
  transition: border-color 0.15s, background 0.15s;
}

.composer:focus-within {
  background: var(--bg-input-focus);
  border-color: var(--border-strong);
}

.composer-input {
  width: 100%;
  min-height: 24px;
  max-height: 220px;
  font-size: 15px;
  line-height: 1.5;
  color: var(--text-primary);
  padding: 0;
}

.composer-input::placeholder {
  color: var(--text-tertiary);
}

.composer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
}

.composer-left,
.composer-right {
  display: flex;
  align-items: center;
  gap: 4px;
}

.composer-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: var(--radius-pill);
  color: var(--text-tertiary);
  font-size: 13px;
  transition: background 0.15s, color 0.15s;
}

.composer-btn:hover {
  background: var(--bg-elevated-hover);
  color: var(--text-primary);
}

.model-pill {
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  color: var(--text-tertiary);
}

.composer-send {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--text-primary);
  color: var(--bg-app);
  transition: background 0.15s, opacity 0.15s;
}

.composer-send:disabled {
  background: var(--bg-elevated);
  color: var(--text-muted);
  cursor: not-allowed;
}

.composer-send:not(:disabled):hover {
  background: var(--text-secondary);
}

/* ─── Artifacts panel ─────────────────────────────────────── */

.artifacts-panel {
  background: var(--bg-sidebar);
  border-left: 1px solid var(--border-subtle);
  height: 100vh;
  display: none;
  flex-direction: column;
  overflow: hidden;
}

body.artifacts-open .artifacts-panel {
  display: flex;
}

.artifacts-header {
  height: 56px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
}

.artifacts-title {
  font-size: 14px;
  font-weight: 600;
}

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

.artifacts-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.artifacts-body pre {
  margin: 0;
  background: none;
  border: none;
  font-family: var(--font-mono);
  font-size: 13px;
  white-space: pre-wrap;
  word-break: break-word;
}

.artifacts-body iframe {
  width: 100%;
  height: 100%;
  border: none;
  border-radius: var(--radius-md);
  background: white;
}

.artifact-render {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 12px;
  background: #ffffff;
  border-radius: var(--radius-md);
  color: #111827;
  min-height: 100%;
}

.mermaid-render {
  background: #1F1E1D;
  color: var(--text-primary);
  width: 100%;
  overflow: auto;
  padding: 24px;
  align-items: flex-start;
  justify-content: center;
}

.mermaid-render svg {
  max-width: none;
  height: auto;
  min-width: 100%;
}

.markdown-render {
  display: block;
  background: var(--bg-sidebar);
  color: var(--text-primary);
  padding: 36px 40px;
  line-height: 1.7;
  font-size: 15.5px;
  max-width: 100%;
  letter-spacing: -0.005em;
}

.markdown-render h1,
.markdown-render h2,
.markdown-render h3 {
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.markdown-render h1 {
  font-size: 26px;
  margin: 0 0 18px 0;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.markdown-render h2 {
  font-size: 19px;
  margin: 32px 0 12px 0;
}

.markdown-render h3 {
  font-size: 16px;
  margin: 22px 0 8px 0;
  color: var(--text-secondary);
}

.markdown-render p {
  margin: 0 0 14px 0;
  color: var(--text-primary);
}

.markdown-render strong {
  color: var(--text-primary);
  font-weight: 600;
}

.markdown-render em {
  color: var(--text-secondary);
}

.markdown-render ul,
.markdown-render ol {
  margin: 10px 0 16px 0;
  padding-left: 24px;
}

.markdown-render li {
  margin: 6px 0;
  color: var(--text-primary);
}

.markdown-render li::marker {
  color: var(--text-tertiary);
}

.markdown-render blockquote {
  border-left: 3px solid var(--accent);
  padding: 4px 16px;
  margin: 16px 0;
  color: var(--text-secondary);
  background: rgba(193, 95, 60, 0.04);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.markdown-render code {
  background: var(--bg-app);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  padding: 1px 6px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--accent);
}

.markdown-render pre {
  background: var(--bg-app);
  border: 1px solid var(--border-subtle);
  padding: 14px 16px;
  border-radius: var(--radius-md);
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.55;
  margin: 16px 0;
}

.markdown-render pre code {
  background: none;
  border: none;
  padding: 0;
  color: var(--text-primary);
  font-size: inherit;
}

.markdown-render table {
  border-collapse: collapse;
  margin: 16px 0;
  width: 100%;
  font-size: 14px;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.markdown-render th,
.markdown-render td {
  border-bottom: 1px solid var(--border-subtle);
  padding: 10px 14px;
  text-align: left;
  vertical-align: top;
}

.markdown-render tr:last-child th,
.markdown-render tr:last-child td {
  border-bottom: none;
}

.markdown-render th {
  background: var(--bg-app);
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 12.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.markdown-render td:not(:last-child),
.markdown-render th:not(:last-child) {
  border-right: 1px solid var(--border-subtle);
}

.markdown-render a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-thickness: 1px;
}

.markdown-render hr {
  border: none;
  border-top: 1px solid var(--border-subtle);
  margin: 28px 0;
}

.artifact-error {
  color: #FCA5A5;
  background: rgba(239, 68, 68, 0.10);
  border: 1px solid rgba(239, 68, 68, 0.30);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  margin-bottom: 12px;
}

/* ─── Model menu ──────────────────────────────────────────── */

.model-menu {
  position: fixed;
  display: none;
  background: var(--bg-elevated);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-popover);
  padding: 6px;
  min-width: 280px;
  z-index: 100;
}

.model-menu.open {
  display: block;
}

.model-menu-item {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s;
}

.model-menu-item:hover {
  background: var(--bg-elevated-hover);
}

.model-menu-name {
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 2px;
}

.model-menu-desc {
  font-size: 12px;
  color: var(--text-tertiary);
}

/* ─── Scrollbars ──────────────────────────────────────────── */

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-medium);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--border-strong);
}

/* ─── Responsive ──────────────────────────────────────────── */

@media (max-width: 880px) {
  body {
    grid-template-columns: 1fr;
  }
  .sidebar {
    display: none;
  }
  body.artifacts-open {
    grid-template-columns: 1fr;
  }
  .artifacts-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 100%;
    z-index: 200;
  }
}
