:root {
  color-scheme: dark;
  --bg: #0f1115;
  --panel: #171a21;
  --panel-2: #1d212a;
  --line: #2a303b;
  --text: #f1f3f5;
  --muted: #9da5b2;
  --accent: #10a37f;
  --accent-strong: #0d8f70;
  --danger: #e56b6f;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--text); }
button, input, textarea, select { font: inherit; }
button, a, select { min-height: 42px; }
a { color: inherit; text-decoration: none; }
.app-shell { display: grid; grid-template-columns: 264px minmax(0, 1fr); min-height: 100vh; }
.sidebar { display: flex; flex-direction: column; gap: 18px; border-right: 1px solid var(--line); padding: 18px 14px; background: #12151b; }
.brand-row { display: flex; align-items: center; gap: 10px; font-weight: 650; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; background: var(--accent); color: #071610; font-size: 12px; font-weight: 800; }
.conversation-list { display: flex; flex: 1; flex-direction: column; gap: 4px; overflow: auto; }
.conversation-row { display: flex; align-items: center; gap: 2px; min-width: 0; }
.conversation-item { display: flex; align-items: center; gap: 8px; width: 100%; border: 0; border-radius: 7px; padding: 10px; background: transparent; color: var(--muted); text-align: left; cursor: pointer; }
.conversation-item:hover, .conversation-item.active { background: var(--panel-2); color: var(--text); }
.conversation-item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conversation-actions { display: flex; opacity: 0; transition: opacity .15s ease; }
.conversation-row:hover .conversation-actions, .conversation-row:focus-within .conversation-actions { opacity: 1; }
.conversation-action { min-width: 34px; min-height: 34px; padding: 4px; }
.sidebar-bottom { display: flex; align-items: center; justify-content: space-between; border-top: 1px solid var(--line); padding-top: 12px; }
.workspace { display: flex; min-width: 0; flex-direction: column; min-height: 100vh; }
.topbar { display: flex; align-items: center; justify-content: space-between; min-height: 64px; border-bottom: 1px solid var(--line); padding: 10px 24px; }
.topbar-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 650; }
.intro-band { display: flex; justify-content: space-between; gap: 24px; border-bottom: 1px solid var(--line); padding: 28px clamp(18px, 5vw, 72px); background: #141820; }
.intro-band h1 { max-width: 680px; margin: 4px 0 8px; font-size: clamp(24px, 4vw, 42px); line-height: 1.12; }
.intro-copy { margin: 0; color: var(--muted); }
.eyebrow { margin: 0; color: var(--accent); font-size: 11px; font-weight: 750; }
.intro-sample { display: grid; flex: 0 0 160px; place-items: center; min-height: 110px; border: 1px solid #394351; border-radius: 8px; background: #24302f; color: #c2d7d0; font-size: 12px; }
.message-pane { flex: 1; width: min(920px, 100%); margin: 0 auto; padding: 32px 24px 180px; }
.empty-state { margin-top: 10vh; text-align: center; color: var(--muted); }
.empty-state h2 { color: var(--text); font-size: 22px; }
.message { display: flex; gap: 14px; padding: 18px 0; border-bottom: 1px solid rgba(42,48,59,.55); }
.message-role { flex: 0 0 72px; color: var(--muted); font-size: 12px; text-transform: uppercase; }
.message-body { min-width: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.message-image { display: block; max-width: min(100%, 640px); height: auto; margin-top: 8px; border-radius: 6px; }
.message-time { display: block; margin-top: 8px; color: var(--muted); font-size: 11px; }
.composer { position: fixed; right: 0; bottom: 0; left: 264px; border-top: 1px solid var(--line); padding: 12px max(18px, calc((100vw - 920px) / 2)); background: rgba(15,17,21,.96); }
.composer-tools, .composer-footer { display: flex; align-items: center; gap: 8px; }
.composer-tools { margin-bottom: 8px; }
.composer textarea { display: block; width: 100%; resize: vertical; border: 1px solid var(--line); border-radius: 8px; padding: 12px; background: var(--panel); color: var(--text); outline: none; }
.composer textarea:focus, select:focus, button:focus-visible, a:focus-visible { border-color: var(--accent); outline: 2px solid rgba(16,163,127,.35); outline-offset: 2px; }
.composer-footer { justify-content: flex-end; margin-top: 8px; }
.status-text, .file-label { flex: 1; min-width: 0; overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.button, .icon-button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid transparent; border-radius: 7px; padding: 8px 12px; cursor: pointer; }
.button-primary { background: var(--accent); color: #06150f; font-weight: 700; }
.button-primary:hover { background: var(--accent-strong); }
.button:disabled, .icon-button:disabled, select:disabled { cursor: not-allowed; opacity: .55; }
.button-quiet { border-color: var(--line); background: transparent; color: var(--muted); }
.button-quiet:hover { color: var(--text); background: var(--panel-2); }
.full { width: 100%; }
.select-wrap select, select { border: 1px solid var(--line); border-radius: 7px; background: var(--panel); color: var(--text); padding: 8px 10px; }
.toast { position: fixed; right: 18px; bottom: 18px; z-index: 5; max-width: 360px; border: 1px solid var(--line); border-radius: 7px; padding: 10px 12px; background: var(--panel-2); color: var(--text); opacity: 0; pointer-events: none; transition: opacity .18s ease; }
.toast.show { opacity: 1; }
.admin-shell { width: min(1200px, 100%); margin: 0 auto; padding: 0 20px 48px; }
.admin-topbar { margin: 0 -20px 24px; }
.metric-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.metric { border: 1px solid var(--line); border-radius: 8px; padding: 16px; background: var(--panel); }
.metric-label { color: var(--muted); font-size: 12px; }
.metric-value { margin-top: 8px; font-size: 24px; font-weight: 700; }
.admin-section { margin-top: 28px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.section-heading h2 { margin: 0; font-size: 18px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; }
table { width: 100%; border-collapse: collapse; min-width: 680px; }
th, td { border-bottom: 1px solid var(--line); padding: 11px 12px; color: var(--muted); font-size: 13px; text-align: left; white-space: nowrap; }
th { color: var(--text); font-weight: 650; background: var(--panel-2); }
tr:last-child td { border-bottom: 0; }
.mobile-only { display: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

@media (max-width: 760px) {
  .app-shell { display: block; }
  .sidebar { position: fixed; inset: 0 auto 0 0; z-index: 10; width: min(86vw, 300px); transform: translateX(-102%); transition: transform .18s ease; }
  .sidebar.open { transform: translateX(0); }
  .workspace { min-height: 100dvh; }
  .topbar { padding: 10px 14px; }
  .mobile-only { display: inline-flex; }
  .intro-band { padding: 22px 16px; }
  .intro-sample { display: none; }
  .message-pane { padding: 20px 16px 210px; }
  .message { gap: 8px; }
  .message-role { flex-basis: 54px; }
  .composer { left: 0; padding: 10px 12px 12px; }
  .composer-tools { overflow-x: auto; }
  .conversation-actions { opacity: 1; }
  .admin-shell { padding: 0 12px 32px; }
  .admin-topbar { margin: 0 -12px 18px; padding: 10px 12px; }
  .metric-grid { grid-template-columns: 1fr; }
}
