:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  --bg: #f4f6f8;
  --bg-strong: #eef1f4;
  --panel: rgba(255,255,255,.96);
  --panel-solid: #fff;
  --panel-soft: #f7f8fa;
  --text: #11151b;
  --muted: #69717b;
  --muted-2: #9198a1;
  --line: #e1e5e9;
  --line-strong: #d1d7dd;
  --accent: #19b779;
  --accent-soft: #e7f8f1;
  --dark: #0e1116;
  --dark-2: #151922;
  --sidebar-text: #f6f8fa;
  --sidebar-muted: #919aa6;
  --shadow: 0 24px 70px rgba(16, 25, 35, .08);
  --shadow-soft: 0 10px 30px rgba(16, 25, 35, .05);
  --radius-xl: 26px;
  --radius-lg: 18px;
  --radius-md: 14px;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0c1015;
  --bg-strong: #11161d;
  --panel: rgba(18,23,30,.97);
  --panel-solid: #12171e;
  --panel-soft: #171d25;
  --text: #f3f6f8;
  --muted: #a2abb5;
  --muted-2: #7f8892;
  --line: #27303a;
  --line-strong: #36414d;
  --accent: #2fd28d;
  --accent-soft: rgba(47,210,141,.12);
  --shadow: 0 30px 90px rgba(0,0,0,.32);
  --shadow-soft: 0 15px 40px rgba(0,0,0,.2);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background:
    radial-gradient(circle at 72% 4%, rgba(28, 195, 133, .07), transparent 22%),
    linear-gradient(180deg, var(--bg-strong), var(--bg));
  color: var(--text);
}
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button, input, textarea, select { -webkit-tap-highlight-color: transparent; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 292px minmax(0, 1fr); }

.sidebar {
  min-height: 100vh;
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 28px 22px 22px;
  color: var(--sidebar-text);
  background:
    radial-gradient(circle at 20% 0%, rgba(37, 210, 145, .10), transparent 20%),
    linear-gradient(180deg, #0d1116, #0a0d12);
  border-right: 1px solid rgba(255,255,255,.05);
  overflow: hidden;
}
.sidebar::after {
  content: "";
  position: absolute;
  inset: auto -20% 7% auto;
  width: 190px;
  height: 190px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,.035);
  box-shadow: 0 0 0 34px rgba(255,255,255,.018), 0 0 0 68px rgba(255,255,255,.01);
  pointer-events: none;
}
.sidebar-top { position: relative; z-index: 1; }
.brand-row { display: flex; gap: 12px; align-items: center; }
.brand-mark {
  width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center;
  background: linear-gradient(145deg, #18211f, #0d1413); border: 1px solid rgba(255,255,255,.11);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.06), 0 8px 28px rgba(0,0,0,.22);
}
.brand-mark-core { width: 24px; height: 24px; border-radius: 8px; display: grid; place-items: center; color: #dff9ed; border: 1px solid rgba(47,210,141,.5); font-weight: 900; font-size: 12px; }
.brand-name { font-weight: 850; letter-spacing: -.01em; font-size: 16px; }
.brand-sub { color: #7e8995; font-size: 8px; font-weight: 800; letter-spacing: .16em; margin-top: 2px; }
.side-hero { padding: 72px 8px 30px; }
.side-kicker { color: #62d8a9; font-size: 10px; font-weight: 850; text-transform: uppercase; letter-spacing: .15em; }
.side-hero h2 { margin: 10px 0 12px; font-size: 33px; line-height: 1.01; letter-spacing: -.045em; }
.side-hero h2 span { color: #8a96a2; }
.side-hero p { margin: 0; color: #89939e; font-size: 12px; line-height: 1.7; max-width: 240px; }
.privacy-card { display: flex; gap: 10px; padding: 14px; border: 1px solid rgba(255,255,255,.08); background: rgba(255,255,255,.03); border-radius: 15px; }
.privacy-shield { width: 24px; height: 24px; flex: 0 0 auto; border-radius: 8px; display: grid; place-items: center; background: rgba(47,210,141,.12); color: #58e2ad; font-size: 12px; font-weight: 900; }
.privacy-card strong { font-size: 11px; }
.privacy-card p { margin: 4px 0 0; color: #7f8995; font-size: 9px; line-height: 1.5; }
.side-metrics { margin-top: 18px; border-top: 1px solid rgba(255,255,255,.07); }
.metric-row { padding: 13px 0; display: flex; align-items: center; justify-content: space-between; gap: 8px; border-bottom: 1px solid rgba(255,255,255,.07); }
.metric-row span { color: #697581; text-transform: uppercase; letter-spacing: .1em; font-size: 8px; font-weight: 800; }
.metric-row strong { color: #dbe1e5; font-size: 10px; font-weight: 750; }
.sidebar-bottom { position: relative; z-index: 1; padding-top: 18px; }
.status-line { display: flex; align-items: center; gap: 8px; color: #d7dfe4; font-size: 10px; font-weight: 700; }
.status-dot, .connection-dot span, .live-badge span, .secure-dot { width: 7px; height: 7px; display: inline-block; border-radius: 50%; background: #38d28e; box-shadow: 0 0 0 4px rgba(56,210,142,.10); }
.status-pill { margin-left: auto; color: #67ddac; border: 1px solid rgba(56,210,142,.2); background: rgba(56,210,142,.08); padding: 3px 6px; border-radius: 999px; font-size: 7px; letter-spacing: .08em; }
.side-caption { margin-top: 8px; color: #616c77; font-size: 8px; }

.main { min-width: 0; max-width: 1640px; width: 100%; margin: 0 auto; padding: 34px clamp(18px, 3vw, 52px) 36px; }
.topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 30px; margin-bottom: 28px; }
.topbar-copy { min-width: 0; }
.eyebrow { color: var(--muted-2); font-size: 9px; font-weight: 850; letter-spacing: .17em; text-transform: uppercase; }
.topbar h1 { margin: 7px 0 12px; font-size: clamp(38px, 4vw, 62px); line-height: .98; letter-spacing: -.055em; }
.topbar h1 span { color: var(--muted); }
.intro { max-width: 760px; margin: 0; color: var(--muted); font-size: 13px; line-height: 1.7; }
.topbar-actions { display: flex; align-items: center; gap: 9px; padding-top: 2px; flex-wrap: wrap; justify-content: flex-end; }
.ghost-button, .theme-button { border: 1px solid var(--line); background: var(--panel); color: var(--text); border-radius: 11px; min-height: 39px; padding: 0 12px; font-size: 11px; font-weight: 750; box-shadow: var(--shadow-soft); }
.ghost-button:hover, .theme-button:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.theme-button { display: inline-flex; gap: 7px; align-items: center; }
.secure-pill { display: flex; align-items: center; gap: 8px; min-height: 39px; padding: 0 12px; border: 1px solid var(--line); border-radius: 11px; background: var(--panel); color: var(--muted); font-size: 10px; font-weight: 750; box-shadow: var(--shadow-soft); }
.secure-dot { width: 6px; height: 6px; }

.workspace { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: stretch; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-xl); box-shadow: var(--shadow); backdrop-filter: blur(10px); }
.chat-panel { min-height: 720px; display: flex; flex-direction: column; overflow: hidden; }
.panel-head { padding: 18px 19px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.panel-head-left { min-width: 0; }
.panel-title-row { display: flex; align-items: center; gap: 10px; }
.live-badge { display: inline-flex; align-items: center; gap: 7px; padding: 5px 8px; border-radius: 999px; background: var(--accent-soft); color: #239b6e; font-size: 9px; font-weight: 800; }
.live-badge span { width: 5px; height: 5px; box-shadow: none; }
.turn-counter { color: var(--muted-2); font-size: 9px; }
.panel-muted { color: var(--muted); font-size: 10px; line-height: 1.45; margin-top: 8px; max-width: 600px; }
.select-shell { position: relative; display: grid; gap: 1px; }
.provider-shell { min-width: 170px; }
.select-label { color: var(--muted-2); font-size: 7px; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.select-shell select { appearance: none; width: 100%; border: 0; outline: 0; background: transparent; color: var(--text); padding: 2px 20px 1px 0; font-size: 11px; font-weight: 750; }
.provider-shell::after, .compact-shell::after { content: "⌄"; position: absolute; right: 0; bottom: 2px; color: var(--muted-2); font-size: 12px; pointer-events: none; }

.chat { flex: 1; min-height: 450px; padding: 26px 25px 20px; overflow-y: auto; overflow-x: hidden; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
.chat::-webkit-scrollbar, pre::-webkit-scrollbar { width: 8px; height: 8px; }
.chat::-webkit-scrollbar-thumb, pre::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 999px; }
.chat::-webkit-scrollbar-track, pre::-webkit-scrollbar-track { background: transparent; }
.chat.empty { display: grid; place-items: center; }
.empty-state { max-width: 650px; text-align: center; padding: 16px 10px 28px; }
.empty-mark { width: 66px; height: 66px; margin: 0 auto 17px; border-radius: 20px; display: grid; place-items: center; background: linear-gradient(145deg, var(--panel-soft), var(--bg)); border: 1px solid var(--line); box-shadow: inset 0 1px 0 rgba(255,255,255,.45); }
.empty-mark-inner { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 11px; border: 1px solid rgba(32,180,123,.35); color: #27a874; font-weight: 900; font-size: 14px; }
.empty-state h2 { margin: 7px 0 9px; font-size: 24px; letter-spacing: -.035em; }
.empty-state p { margin: 0 auto; max-width: 560px; color: var(--muted); font-size: 11px; line-height: 1.6; }
.suggestions { margin: 21px auto 0; display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; }
.suggestion { border: 1px solid var(--line); background: var(--panel); color: var(--muted); border-radius: 999px; padding: 8px 11px; font-size: 9px; font-weight: 750; }
.suggestion:hover { color: var(--text); border-color: var(--line-strong); background: var(--panel-soft); }
.empty-foot { margin-top: 17px; color: var(--muted-2); font-size: 9px; }
.empty-foot span { border: 1px solid var(--line); border-bottom-width: 2px; padding: 4px 6px; border-radius: 6px; color: var(--muted); }

.message-row { display: flex; margin: 0 0 16px; animation: message-in .18s ease-out; }
.message-row.user { justify-content: flex-end; }
.message-wrap { max-width: min(76%, 760px); }
.message-bubble { padding: 13px 15px; border-radius: 17px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 12px; line-height: 1.65; border: 1px solid var(--line); box-shadow: var(--shadow-soft); }
.message-row.user .message-bubble { background: #10141a; color: #fff; border-color: #10141a; border-bottom-right-radius: 6px; }
html[data-theme="dark"] .message-row.user .message-bubble { background: #e9eef2; color: #11151b; border-color: #e9eef2; }
.message-row.assistant .message-bubble { background: var(--panel-soft); color: var(--text); border-bottom-left-radius: 6px; }
.message-meta { margin: 5px 4px 0; color: var(--muted-2); font-size: 8px; }
.message-row.user .message-meta { text-align: right; }
.typing-bubble { display: flex; align-items: center; gap: 4px; min-height: 44px; }
.typing-bubble i { width: 5px; height: 5px; border-radius: 50%; background: var(--muted-2); animation: bounce 1.2s infinite ease-in-out; }
.typing-bubble i:nth-child(2){ animation-delay: .14s; }
.typing-bubble i:nth-child(3){ animation-delay: .28s; }

.attachment { margin: 0 18px 10px; padding: 10px 12px; display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); background: var(--panel-soft); border-radius: 14px; }
.attachment-icon { width: 34px; height: 34px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 10px; background: var(--panel-solid); border: 1px solid var(--line); color: #3ba97d; font-size: 8px; font-weight: 900; }
.attachment-info { display: grid; min-width: 0; flex: 1; }
.attachment-info strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10px; }
.attachment-info span { color: var(--muted-2); font-size: 8px; margin-top: 2px; }
.attachment-safe { color: #239b6e; font-size: 8px; font-weight: 800; }
.icon-button { border: 0; background: transparent; color: var(--muted-2); font-size: 20px; padding: 2px 6px; }
.icon-button:hover { color: var(--text); }

.composer-wrap { padding: 0 16px 16px; }
.composer { border: 1px solid var(--line-strong); background: var(--panel-solid); border-radius: 18px; padding: 12px; box-shadow: var(--shadow-soft); }
textarea { resize: none; width: 100%; min-height: 94px; max-height: 220px; padding: 8px 7px 3px; border: 0; outline: none; background: transparent; color: var(--text); font-size: 12px; line-height: 1.55; }
textarea::placeholder { color: var(--muted-2); }
.composer-tools { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.left-tools { min-width: 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.attach-button { border: 1px solid var(--line); background: var(--panel-soft); color: var(--text); border-radius: 10px; padding: 8px 10px; font-size: 9px; font-weight: 800; }
.attach-button:hover { border-color: var(--line-strong); }
.attach-glyph { color: #3caa7d; font-size: 14px; margin-right: 3px; }
.compact-shell { min-width: 116px; padding: 1px 0; }
.send-button { min-width: 142px; min-height: 38px; border: 0; border-radius: 11px; background: linear-gradient(180deg, #14191f, #0d1116); color: #fff; display: inline-flex; align-items: center; justify-content: center; gap: 16px; padding: 0 14px; font-size: 10px; font-weight: 850; box-shadow: 0 9px 20px rgba(14,17,22,.16); }
html[data-theme="dark"] .send-button { background: #f0f4f7; color: #0f1419; }
.send-button:hover { transform: translateY(-1px); }
.send-button:disabled { opacity: .55; cursor: wait; transform: none; }
.send-icon { font-size: 14px; }
.composer-footer { min-height: 20px; margin-top: 7px; display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--muted-2); font-size: 8px; }
.composer-footer strong { color: var(--muted); }
.status { min-width: 0; text-align: right; }

.settings { align-self: stretch; padding: 18px; display: flex; flex-direction: column; gap: 16px; }
.settings-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.settings-title { margin-top: 4px; font-size: 14px; font-weight: 850; letter-spacing: -.02em; }
.connection-dot { width: 24px; height: 24px; border-radius: 8px; display: grid; place-items: center; background: var(--accent-soft); }
.connection-dot span { width: 5px; height: 5px; box-shadow: none; }
.field-group { display: grid; gap: 12px; }
.field { display: grid; gap: 6px; }
.field > span { font-size: 9px; color: var(--muted); font-weight: 850; }
.field > span em { color: var(--muted-2); font-style: normal; font-weight: 600; }
.field input { width: 100%; min-height: 39px; padding: 0 10px; border: 1px solid var(--line); border-radius: 11px; background: var(--panel-soft); color: var(--text); outline: none; font-size: 10px; }
.field input:focus, textarea:focus { border-color: #83cdb0; box-shadow: 0 0 0 3px rgba(47,210,141,.08); }
.input-wrap { position: relative; }
.input-wrap input { padding-right: 52px; }
.reveal-button { position: absolute; right: 4px; top: 4px; min-height: 31px; border: 0; background: transparent; color: var(--muted-2); font-size: 8px; font-weight: 800; }
.field small { color: var(--muted-2); font-size: 8px; line-height: 1.4; }
.connection-note { display: flex; gap: 9px; padding: 11px; border: 1px solid #cfe9dc; background: var(--accent-soft); border-radius: 13px; }
html[data-theme="dark"] .connection-note { border-color: rgba(47,210,141,.18); }
.note-icon { width: 20px; height: 20px; flex: 0 0 auto; border-radius: 7px; display: grid; place-items: center; color: #1f996c; background: rgba(255,255,255,.55); font-size: 9px; font-weight: 900; }
.connection-note strong { font-size: 9px; }
.connection-note p { margin: 3px 0 0; color: var(--muted); font-size: 8px; line-height: 1.5; }
code { font: 8px/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; color: var(--text); }
.capability-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 7px; }
.capability { padding: 10px; border: 1px solid var(--line); background: var(--panel-soft); border-radius: 12px; }
.capability span { display: block; color: var(--muted-2); font-size: 7px; text-transform: uppercase; letter-spacing: .09em; font-weight: 850; }
.capability strong { display: block; margin-top: 4px; color: var(--text); font-size: 10px; }
.settings-footer { margin-top: auto; padding-top: 13px; border-top: 1px solid var(--line); }
.footer-title { font-size: 9px; font-weight: 850; }
.settings-footer p { margin: 4px 0 0; color: var(--muted); font-size: 8px; line-height: 1.55; }

.trace-section { margin-top: 26px; }
.trace-head { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin-bottom: 12px; }
.trace-head h2 { margin: 4px 0 5px; font-size: 25px; letter-spacing: -.035em; }
.trace-head p { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.55; max-width: 660px; }
.trace-stat { min-width: 120px; padding: 11px 13px; border: 1px solid var(--line); background: var(--panel); border-radius: 13px; text-align: right; box-shadow: var(--shadow-soft); }
.trace-stat strong { display: block; font-size: 16px; letter-spacing: -.02em; }
.trace-stat span { color: var(--muted-2); font-size: 7px; text-transform: uppercase; letter-spacing: .09em; font-weight: 850; }
.trace-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.trace-card { min-height: 176px; padding: 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-soft); }
.trace-card.protected-card { background: linear-gradient(180deg, var(--accent-soft), var(--panel)); border-color: rgba(47,210,141,.18); }
.trace-card.restored-card { background: var(--panel-soft); }
.trace-label { margin-bottom: 10px; color: var(--muted-2); font-size: 8px; font-weight: 850; text-transform: uppercase; letter-spacing: .09em; }
pre { margin: 0; max-height: 260px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text); font: 10px/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { padding: 6px 8px; border-radius: 999px; background: var(--panel-soft); border: 1px solid var(--line); color: var(--text); font: 700 8px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.empty-tag { color: var(--muted-2); font-size: 9px; }
.trace-card-foot { margin-top: 22px; color: var(--muted-2); font-size: 8px; }
.privacy-proof { margin-top: 10px; display: flex; gap: 11px; padding: 14px 15px; border-radius: 16px; border: 1px solid #cfe9dc; background: var(--accent-soft); }
html[data-theme="dark"] .privacy-proof { border-color: rgba(47,210,141,.18); }
.proof-icon { width: 28px; height: 28px; flex: 0 0 auto; border-radius: 10px; display: grid; place-items: center; background: rgba(255,255,255,.58); color: #1f996c; font-size: 12px; font-weight: 900; }
.privacy-proof strong { font-size: 9px; }
.privacy-proof p { margin: 3px 0 0; color: var(--muted); font-size: 8px; line-height: 1.55; }
.main-footer { display: flex; justify-content: space-between; gap: 16px; padding: 18px 2px 0; color: var(--muted-2); font-size: 8px; }
.hidden { display: none !important; }

@keyframes message-in { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
@keyframes bounce { 0%, 80%, 100% { transform: scale(.7); opacity: .45; } 40% { transform: scale(1); opacity: 1; } }

@media (max-width: 1180px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .settings { order: -1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
  .settings-head, .field-group, .connection-note, .settings-footer { grid-column: 1 / -1; }
  .capability-grid { grid-column: auto; }
  .settings-footer { margin-top: 0; }
}

@media (max-width: 760px) {
  .main { padding: 22px 12px 28px; }
  .topbar { flex-direction: column; }
  .topbar-actions { justify-content: flex-start; }
  .topbar h1 { font-size: clamp(36px, 10vw, 52px); }
  .panel-head { flex-direction: column; }
  .provider-shell { width: 100%; }
  .chat-panel { min-height: 680px; }
  .chat { min-height: 420px; padding: 19px 14px 16px; }
  .message-wrap { max-width: 90%; }
  .composer-wrap { padding: 0 10px 10px; }
  .composer-tools { align-items: stretch; flex-direction: column; }
  .left-tools { width: 100%; }
  .send-button { width: 100%; }
  .composer-footer { align-items: flex-start; flex-direction: column; }
  .status { text-align: left; }
  .settings { grid-template-columns: 1fr; }
  .settings-head, .field-group, .connection-note, .settings-footer { grid-column: auto; }
  .trace-grid { grid-template-columns: 1fr; }
  .trace-head { align-items: flex-start; flex-direction: column; }
  .trace-stat { align-self: stretch; text-align: left; }
  .main-footer { flex-direction: column; }
}


/* v1.3.1 premium workspace layout */
body { overflow-x: hidden; }
.workspace {
  display: grid;
  grid-template-columns: minmax(290px, 330px) minmax(500px, 1fr) minmax(300px, 360px);
  gap: 16px;
  align-items: stretch;
  height: clamp(650px, calc(100vh - 245px), 900px);
  min-height: 650px;
}
.control-rail { min-width: 0; display: flex; flex-direction: column; gap: 12px; min-height: 0; overflow-y: auto; padding-right: 3px; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
.control-rail::-webkit-scrollbar, .trace-scroll::-webkit-scrollbar { width: 7px; }
.control-rail::-webkit-scrollbar-thumb, .trace-scroll::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 999px; }
.control-rail::-webkit-scrollbar-track, .trace-scroll::-webkit-scrollbar-track { background: transparent; }
.settings { align-self: auto; padding: 18px; display: flex; flex-direction: column; gap: 16px; }
.rail-card { padding: 17px; }
.rail-label { color: var(--muted-2); font-size: 8px; font-weight: 900; letter-spacing: .14em; text-transform: uppercase; }
.rail-card h3 { margin: 8px 0 9px; font-size: 20px; line-height: 1.05; letter-spacing: -.04em; }
.rail-card h3 span { color: var(--muted); }
.rail-card p { margin: 0; color: var(--muted); font-size: 9px; line-height: 1.6; }
.rail-proof { margin-top: 14px; display: flex; gap: 9px; padding: 10px; border: 1px solid rgba(47,210,141,.18); background: var(--accent-soft); border-radius: 12px; }
.rail-proof > span { width: 22px; height: 22px; flex: 0 0 auto; border-radius: 7px; display: grid; place-items: center; background: rgba(255,255,255,.55); color: #1f996c; font-weight: 900; font-size: 9px; }
.rail-proof strong { display:block; font-size: 9px; }
.rail-proof small { display:block; margin-top: 2px; color: var(--muted); font-size: 8px; }
.capability-rail { padding-bottom: 14px; }
.integration-rail { margin-top: auto; }
.chat-panel { min-height: 0; height: 100%; }
.chat { min-height: 0; height: auto; overscroll-behavior: contain; }
.chat-panel .composer-wrap { flex: 0 0 auto; }
textarea { min-height: 100px; max-height: 200px; overflow-y: auto; }
.message-bubble { font-size: 12px; }
.trace-section {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  padding: 18px;
  margin-top: 0;
  overflow: hidden;
}
.trace-section.hidden { display: none !important; }
.trace-head { flex: 0 0 auto; display: block; margin-bottom: 13px; }
.trace-head h2 { margin: 5px 0 6px; font-size: 22px; letter-spacing: -.04em; }
.trace-head p { max-width: none; font-size: 9px; line-height: 1.55; }
.trace-scroll { flex: 1; min-height: 0; overflow-y: auto; padding-right: 3px; display: flex; flex-direction: column; gap: 10px; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
.trace-card { min-height: 0; padding: 13px; border-radius: 14px; display: flex; flex-direction: column; }
.trace-card pre { min-height: 90px; max-height: 180px; overflow: auto; padding-right: 4px; }
.trace-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 9px; }
.trace-label { margin: 0; }
.trace-status { font-size: 7px; font-weight: 850; padding: 4px 6px; border-radius: 999px; background: var(--accent-soft); color: #239b6e; }
.copy-button { border: 1px solid var(--line); background: var(--panel-soft); color: var(--muted); border-radius: 8px; min-height: 25px; padding: 0 8px; font-size: 8px; font-weight: 800; }
.copy-button:hover { color: var(--text); border-color: var(--line-strong); }
.copy-button.copied { color: #239b6e; border-color: rgba(47,210,141,.3); }
.copy-primary { background: #12171d; color: #fff; border-color: #12171d; }
html[data-theme="dark"] .copy-primary { background: #f2f6f8; color: #0f1419; border-color: #f2f6f8; }
.privacy-proof { margin-top: 0; padding: 12px; border-radius: 14px; flex: 0 0 auto; }
.privacy-proof strong { font-size: 8px; }
.privacy-proof p { font-size: 7px; line-height: 1.5; }
.main-footer { display:none; }

@media (max-width: 1380px) {
  .workspace { grid-template-columns: 285px minmax(460px, 1fr) 310px; }
  .main { padding-left: 24px; padding-right: 24px; }
}

@media (max-width: 1180px) {
  .workspace { height: auto; min-height: 0; grid-template-columns: 1fr; }
  .control-rail { order: 1; display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); overflow: visible; }
  .chat-panel { order: 2; height: 720px; min-height: 720px; }
  .trace-section { order: 3; height: 720px; min-height: 720px; }
  .integration-rail { margin-top: 0; }
}

@media (max-width: 760px) {
  .control-rail { grid-template-columns: 1fr; }
  .chat-panel, .trace-section { height: 680px; min-height: 680px; }
}
