.app-body {
  margin: 0;
  height: 100dvh;
  overflow: hidden;
  background: var(--bg-base);
  color: var(--ink);
  font-feature-settings: 'cv11', 'ss01';
}

.layout {
  display: flex;
  height: 100dvh;
}

.sidebar {
  width: var(--rail);
  flex: 0 0 var(--rail);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  z-index: 40;
}

.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  color: var(--ink);
}

.brand-name {
  font-size: 1.06rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.brand-tag {
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  padding: 2px 5px;
  color: var(--ink-dim);
  background: var(--bg-raised);
  border: 1px solid var(--line-strong);
}

.new-chat {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 12px 12px 6px;
  padding: 0 12px;
  height: var(--control);
  background: var(--bg-raised);
  border: 1px solid var(--line-strong);
  color: var(--ink);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
}

.new-chat:hover {
  background: var(--bg-hover);
  border-color: #3a3a44;
}

.new-chat .mark { transition: transform 0.2s ease; }
.new-chat:hover .mark { transform: rotate(90deg); }

.conversations {
  flex: 1;
  overflow-y: auto;
  padding: 6px 8px 12px;
}

.group-label {
  padding: 12px 8px 5px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.conversation {
  position: relative;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 6px 8px 11px;
  cursor: pointer;
  color: var(--ink-dim);
  font-size: 0.83rem;
  transition: background 0.1s ease, color 0.1s ease;
}

.conversation::before {
  content: '';
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: transparent;
  transition: background 0.12s ease;
}

.conversation:hover { background: var(--bg-hover); color: var(--ink); }

.conversation.active {
  background: var(--bg-raised);
  color: var(--ink);
}

.conversation.active::before { background: var(--brand-hot); }

.conversation-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conversation-delete {
  flex: none;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  opacity: 0;
  background: none;
  border: none;
  color: var(--ink-faint);
  cursor: pointer;
  transition: opacity 0.12s ease, color 0.12s ease, background 0.12s ease;
}

.conversation:hover .conversation-delete,
.conversation-delete:focus-visible { opacity: 1; }

.conversation-delete:hover {
  color: #e88a8a;
  background: rgba(194, 59, 59, 0.14);
}

.rail-empty {
  padding: 22px 12px;
  text-align: center;
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--ink-faint);
}

.sidebar-foot {
  border-top: 1px solid var(--line);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 9px;
}

.account-badge {
  flex: none;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  background: linear-gradient(150deg, var(--brand-hot), var(--brand));
  color: #fff;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.account { flex: 1; min-width: 0; }

.account-name {
  font-size: 0.8rem;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-meta {
  font-size: 10.5px;
  color: var(--ink-faint);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: none;
  background: none;
  border: 1px solid transparent;
  color: var(--ink-faint);
  cursor: pointer;
  transition: color 0.12s ease, background 0.12s ease, border-color 0.12s ease;
}

.icon-btn:hover {
  color: var(--ink);
  background: var(--bg-hover);
  border-color: var(--line-strong);
}

.rail-toggle { display: none; }

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background:
    radial-gradient(900px 420px at 50% -10%, rgba(156, 47, 47, 0.07), transparent 70%),
    var(--bg-base);
}

.topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 56px;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(9, 9, 11, 0.82);
  backdrop-filter: blur(10px);
}

.status {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

#chat-title {
  font-size: 0.87rem;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.spacer { flex: 1; }

.quota {
  font-size: 11px;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
  padding: 4px 9px;
  border: 1px solid var(--line);
  background: var(--bg-panel);
  white-space: nowrap;
}

.thread {
  flex: 1;
  overflow-y: auto;
  padding: 28px 20px 12px;
}

.thread.is-empty {
  display: grid;
  place-items: center;
  padding-bottom: 56px;
}

.turn {
  max-width: 760px;
  margin: 0 auto 26px;
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 14px;
  animation: rise 0.26s cubic-bezier(0.22, 0.9, 0.3, 1) both;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.avatar {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.03em;
  background: var(--bg-raised);
  border: 1px solid var(--line-strong);
  color: var(--ink-dim);
}

.turn.user .avatar {
  background: linear-gradient(150deg, var(--brand-hot), var(--brand));
  border-color: transparent;
  color: #fff;
}

.turn.assistant .avatar { color: var(--brand-hot); }

.byline {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 6px;
}

.bubble {
  min-width: 0;
  font-size: 0.94rem;
  line-height: 1.68;
  color: #d7d7dd;
  overflow-wrap: anywhere;
}

.turn.user .bubble {
  color: var(--ink);
  white-space: pre-wrap;
}

.bubble > :first-child { margin-top: 0; }
.bubble > :last-child { margin-bottom: 0; }
.bubble p { margin: 0 0 12px; }
.bubble ul, .bubble ol { margin: 0 0 12px; padding-left: 22px; }
.bubble li { margin-bottom: 5px; }
.bubble li::marker { color: var(--ink-faint); }

.bubble h2, .bubble h3, .bubble h4, .bubble h5, .bubble h6 {
  margin: 20px 0 9px;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.bubble a { color: #e08a8a; text-underline-offset: 2px; }
.bubble strong { color: var(--ink); font-weight: 600; }

.bubble code {
  background: var(--bg-raised);
  border: 1px solid var(--line);
  padding: 1.5px 5px;
  font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace;
  font-size: 0.845em;
  color: #e6b3b3;
}

.bubble pre {
  position: relative;
  background: #0d0d10;
  border: 1px solid var(--line-strong);
  padding: 34px 14px 14px;
  overflow-x: auto;
  margin: 0 0 12px;
}

.bubble pre::before {
  content: attr(data-lang);
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 26px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  background: #121216;
  border-bottom: 1px solid var(--line);
  font-family: ui-monospace, Consolas, monospace;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.bubble pre code {
  background: none;
  border: none;
  padding: 0;
  color: #cfd3d8;
  font-size: 0.83rem;
  line-height: 1.62;
}

.code-actions {
  position: absolute;
  top: 3px;
  right: 4px;
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.12s ease;
}

.bubble pre:hover .code-actions,
.code-actions:focus-within { opacity: 1; }

.code-action {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  background: var(--bg-raised);
  border: 1px solid var(--line-strong);
  color: var(--ink-dim);
  font-family: inherit;
  font-size: 10px;
  cursor: pointer;
  transition: color 0.12s ease, background 0.12s ease, border-color 0.12s ease;
}

.code-action:hover { color: var(--ink); background: var(--bg-hover); }

.code-action.run {
  color: #e8a0a0;
  border-color: #4a2626;
  background: rgba(194, 59, 59, 0.12);
}

.code-action.run:hover {
  color: #fff;
  background: var(--brand);
  border-color: var(--brand);
}

.code-action svg { display: block; }

.cursor::after {
  content: '';
  display: inline-block;
  width: 2px;
  height: 1em;
  background: var(--brand-hot);
  margin-left: 3px;
  vertical-align: -0.15em;
  animation: blink 1.05s steps(2, start) infinite;
}

@keyframes blink { to { visibility: hidden; } }

.turn-error .bubble {
  color: #eda5a5;
  border-left: 2px solid var(--brand);
  background: rgba(156, 47, 47, 0.07);
  padding: 10px 14px;
  font-size: 0.87rem;
}

.turn-error .avatar {
  color: #eda5a5;
  border-color: #4a2323;
  background: rgba(156, 47, 47, 0.12);
}

.empty {
  width: 100%;
  max-width: 660px;
  margin: 0 auto;
  text-align: center;
  animation: rise 0.4s cubic-bezier(0.22, 0.9, 0.3, 1) both;
}

.empty-mark {
  display: inline-grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin-bottom: 20px;
  color: var(--brand-hot);
  background: var(--bg-panel);
  border: 1px solid var(--line-strong);
  box-shadow: 0 0 60px rgba(194, 59, 59, 0.28);
}

.empty h1 {
  font-size: 2rem;
  font-weight: 600;
  letter-spacing: -0.035em;
  margin: 0 0 8px;
}

.empty h1 em {
  font-style: normal;
  color: var(--brand-hot);
}

.empty p {
  color: var(--ink-dim);
  font-size: 0.92rem;
  margin: 0 auto 30px;
  max-width: 420px;
  line-height: 1.6;
}

.starters {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-auto-rows: 1fr;
  gap: 9px;
  text-align: left;
}

.starter {
  position: relative;
  display: block;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  color: #b4b4be;
  padding: 14px 34px 14px 15px;
  font-family: inherit;
  font-size: 0.83rem;
  line-height: 1.45;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.14s ease, color 0.14s ease, background 0.14s ease;
}

.starter::after {
  content: '→';
  position: absolute;
  right: 13px;
  top: 50%;
  transform: translateY(-50%) translateX(-3px);
  color: var(--brand-hot);
  opacity: 0;
  transition: opacity 0.14s ease, transform 0.14s ease;
}

.starter:hover {
  border-color: #3a3a44;
  background: var(--bg-raised);
  color: var(--ink);
}

.starter:hover::after { opacity: 1; transform: translateY(-50%) translateX(0); }

.composer-wrap {
  padding: 4px 20px 12px;
  background: linear-gradient(to top, var(--bg-base) 62%, transparent);
}

.composer {
  position: relative;
  max-width: 760px;
  margin: 0 auto;
  display: flex;
  align-items: flex-end;
  gap: 6px;
  background: var(--bg-panel);
  border: 1px solid var(--line-strong);
  padding: 3px 3px 3px 11px;
  transition: border-color 0.14s ease, box-shadow 0.14s ease;
}

.composer:focus-within {
  border-color: #45454f;
  box-shadow: 0 0 0 3px rgba(194, 59, 59, 0.09);
}

.composer textarea {
  flex: 1;
  min-width: 0;
  min-height: 28px;
  max-height: 200px;
  background: none;
  border: none;
  outline: none;
  resize: none;
  color: var(--ink);
  font-family: inherit;
  font-size: 0.92rem;
  line-height: 20px;
  padding: 4px 0;
  display: block;
}

.composer textarea::placeholder { color: #4d4d57; }

.send {
  flex: none;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  background: var(--brand);
  color: #fff;
  border: none;
  cursor: pointer;
  transition: background 0.13s ease, opacity 0.13s ease;
}

.send:hover:not(:disabled) { background: var(--brand-hot); }
.send:disabled { opacity: 0.35; cursor: default; }
.send svg { display: block; }

.composer-note {
  max-width: 760px;
  margin: 9px auto 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-size: 10.5px;
  color: var(--ink-faint);
}

kbd {
  font-family: inherit;
  font-size: 9.5px;
  padding: 1.5px 5px;
  border: 1px solid var(--line-strong);
  background: var(--bg-raised);
  color: var(--ink-dim);
}

.scrim {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(2px);
  z-index: 35;
}

@media (max-width: 860px) {
  .rail-toggle { display: grid; }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    transform: translateX(-100%);
    transition: transform 0.2s cubic-bezier(0.22, 0.9, 0.3, 1);
  }

  .sidebar.open { transform: none; }
  .scrim.open { display: block; }
  .starters { grid-template-columns: 1fr; }
  .thread { padding: 20px 14px 8px; }
  .composer-wrap { padding: 10px 14px 12px; }
  .turn { grid-template-columns: 24px 1fr; gap: 11px; margin-bottom: 22px; }
  .avatar { width: 24px; height: 24px; }
  .empty h1 { font-size: 1.6rem; }
  .thread.is-empty { padding-bottom: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

.preview {
  width: 46%;
  min-width: 380px;
  max-width: 900px;
  flex: none;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--line);
  background: var(--bg-panel);
}

.preview.expanded {
  width: 74%;
  max-width: none;
}

.preview-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 56px;
  padding: 0 10px 0 12px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-sidebar);
}

.preview-tabs {
  display: flex;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.preview-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  background: none;
  border: 1px solid transparent;
  color: var(--ink-faint);
  font-family: inherit;
  font-size: 0.79rem;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.12s ease, background 0.12s ease, border-color 0.12s ease;
}

.preview-tab:hover { color: var(--ink-dim); }

.preview-tab[aria-selected="true"] {
  color: var(--ink);
  background: var(--bg-raised);
  border-color: var(--line-strong);
}

.badge {
  min-width: 16px;
  padding: 0 4px;
  background: var(--brand);
  color: #fff;
  font-size: 9.5px;
  font-weight: 600;
  line-height: 15px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.preview-actions {
  display: flex;
  gap: 2px;
  flex: none;
}

.preview-body {
  flex: 1;
  min-height: 0;
  position: relative;
  background: #fff;
}

#preview-frame {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
  background: #fff;
}

.preview-code {
  position: absolute;
  inset: 0;
  margin: 0;
  padding: 14px;
  overflow: auto;
  background: #0d0d10;
  color: #cfd3d8;
  font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace;
  font-size: 0.78rem;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.preview-console {
  position: absolute;
  inset: 0;
  overflow: auto;
  padding: 8px 0;
  background: #0d0d10;
  font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace;
  font-size: 0.76rem;
  line-height: 1.55;
}

.console-line {
  padding: 4px 14px;
  border-left: 2px solid transparent;
  color: #b9bdc4;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.console-line + .console-line { border-top: 1px solid #16161a; }
.console-error { color: #eda5a5; border-left-color: var(--brand); background: rgba(156, 47, 47, 0.08); }
.console-warn { color: #e5c07b; border-left-color: #6b5524; }

.console-empty {
  padding: 18px 14px;
  color: var(--ink-faint);
  font-family: inherit;
  font-size: 0.8rem;
}

.preview-errors {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-top: 1px solid #4a2222;
  background: rgba(156, 47, 47, 0.13);
}

.preview-errors-text {
  flex: 1;
  min-width: 0;
  font-size: 0.79rem;
  color: #eda5a5;
}

.fix-btn {
  flex: none;
  padding: 6px 12px;
  background: var(--brand);
  color: #fff;
  border: none;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s ease;
}

.fix-btn:hover { background: var(--brand-hot); }

.preview-errors .link-btn {
  flex: none;
  background: none;
  border: none;
  padding: 0;
  font-family: inherit;
  font-size: 0.76rem;
  color: #b98b8b;
  cursor: pointer;
}

.preview-errors .link-btn:hover { color: #eda5a5; }

@media (max-width: 1100px) {
  .layout.with-preview .sidebar:not(.open) {
    position: fixed;
    transform: translateX(-100%);
  }

  .layout.with-preview .rail-toggle { display: grid; }
  .preview { width: 50%; min-width: 320px; }
}

@media (max-width: 860px) {
  .preview {
    position: fixed;
    inset: 0;
    z-index: 50;
    width: 100%;
    max-width: none;
    min-width: 0;
  }
}

.send.stopping {
  background: var(--bg-raised);
  border: 1px solid var(--line-strong);
  color: var(--ink);
}

.send.stopping:hover {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.confirm {
  padding: 0;
  border: 1px solid var(--line-strong);
  background: var(--bg-panel);
  color: var(--ink);
  max-width: 380px;
  width: calc(100% - 40px);
}

.confirm::backdrop {
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(2px);
}

.confirm h2 {
  margin: 0;
  padding: 20px 22px 0;
  font-size: 1.02rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.confirm p {
  margin: 8px 0 0;
  padding: 0 22px;
  font-size: 0.86rem;
  line-height: 1.6;
  color: var(--ink-dim);
}

.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 20px 22px 20px;
}

.ghost-btn,
.solid-btn {
  height: 36px;
  padding: 0 16px;
  font-family: inherit;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.13s ease, border-color 0.13s ease, color 0.13s ease;
}

.ghost-btn {
  background: transparent;
  border: 1px solid var(--line-strong);
  color: var(--ink-dim);
}

.ghost-btn:hover {
  background: var(--bg-hover);
  color: var(--ink);
}

.solid-btn {
  background: var(--brand);
  border: 1px solid var(--brand);
  color: #fff;
}

.solid-btn:hover {
  background: var(--brand-hot);
  border-color: var(--brand-hot);
}

.thinking {
  display: inline-block;
  color: var(--ink-dim);
  font-size: 0.92rem;
  opacity: 0.45;
  animation: breathe 1.5s ease-in-out infinite;
}

.thinking::after {
  content: '…';
}

@keyframes breathe {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 0.7; }
}

.attach {
  flex: none;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  margin-left: -4px;
  background: none;
  border: none;
  color: var(--ink-faint);
  cursor: pointer;
  transition: color 0.12s ease, background 0.12s ease;
}

.attach:hover {
  color: var(--ink);
  background: var(--bg-hover);
}

.attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-width: 760px;
  margin: 0 auto 6px;
}

.chip {
  display: flex;
  align-items: center;
  gap: 7px;
  max-width: 240px;
  padding: 4px 4px 4px 8px;
  background: var(--bg-raised);
  border: 1px solid var(--line-strong);
  font-size: 0.76rem;
  color: var(--ink-dim);
}

.chip-thumb {
  width: 20px;
  height: 20px;
  object-fit: cover;
  flex: none;
  border: 1px solid var(--line);
}

.chip-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink);
}

.chip-size {
  flex: none;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
}

.chip-remove {
  flex: none;
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  background: none;
  border: none;
  color: var(--ink-faint);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
}

.chip-remove:hover {
  color: #e88a8a;
  background: rgba(194, 59, 59, 0.14);
}

.main { position: relative; }

.dropzone {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  background: rgba(9, 9, 11, 0.82);
  backdrop-filter: blur(2px);
}

.dropzone-inner {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 30px 42px;
  border: 1px dashed var(--brand-hot);
  background: var(--bg-panel);
  color: var(--ink);
  text-align: center;
  pointer-events: none;
}

.dropzone-inner svg { color: var(--brand-hot); }

.dropzone-inner strong {
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.dropzone-inner span {
  font-size: 0.8rem;
  color: var(--ink-faint);
}

.chart-mount {
  margin: 0 0 12px;
  padding: 10px 12px;
  background: #0d0d10;
  border: 1px solid var(--line-strong);
}

.chart-mount svg { display: block; }

.chart-pending,
.chart-failed {
  font-size: 0.82rem;
  color: var(--ink-faint);
}

.chart-failed { color: #eda5a5; }

.attached-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.attached {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 260px;
  padding: 7px 11px 7px 9px;
  background: var(--bg-panel);
  border: 1px solid var(--line-strong);
  color: var(--ink-dim);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.13s ease, background 0.13s ease, color 0.13s ease;
}

.attached:hover {
  border-color: #3d3d47;
  background: var(--bg-raised);
  color: var(--ink);
}

.attached-icon {
  flex: none;
  display: grid;
  place-items: center;
  color: var(--brand-hot);
}

.attached-icon svg { display: block; }

.attached-meta {
  display: grid;
  min-width: 0;
}

.attached-name {
  font-size: 0.8rem;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attached-size {
  font-size: 10.5px;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
}

.viewer {
  padding: 0;
  width: min(880px, calc(100vw - 48px));
  max-width: none;
  max-height: calc(100vh - 64px);
  background: var(--bg-panel);
  border: 1px solid var(--line-strong);
  color: var(--ink);
}

.viewer::backdrop {
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(3px);
}

.viewer-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 10px 10px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-sidebar);
}

.viewer-title {
  flex: 1;
  min-width: 0;
  font-size: 0.85rem;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.viewer-body {
  max-height: calc(100vh - 140px);
  overflow: auto;
  background: #0d0d10;
}

.viewer-image {
  display: block;
  max-width: 100%;
  margin: 0 auto;
}

.viewer-text {
  margin: 0;
  padding: 14px 16px;
  font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace;
  font-size: 0.8rem;
  line-height: 1.6;
  color: #cfd3d8;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.viewer-note {
  margin: 0;
  padding: 26px 16px;
  text-align: center;
  font-size: 0.85rem;
  color: var(--ink-faint);
}
