:root {
  color-scheme: dark;
  --bg-primary: #020814;
  --bg-secondary: #06111f;
  --panel: rgba(12, 23, 38, .72);
  --panel-strong: rgba(15, 28, 45, .88);
  --card: rgba(17, 31, 50, .72);
  --card-hover: rgba(24, 45, 72, .84);
  --border: rgba(118, 151, 192, .18);
  --border-strong: rgba(120, 160, 220, .30);
  --divider: rgba(148, 163, 184, .13);
  --primary: #2f7dff;
  --primary-hover: #3b86ff;
  --electric: #60a5fa;
  --soft-blue: #93c5fd;
  --success: #3ee083;
  --warning: #fb923c;
  --danger: #f87171;
  --yellow: #facc15;
  --cyan: #22d3ee;
  --violet: #8b5cf6;
  --text: #f8fafc;
  --text-secondary: #b7c4d8;
  --text-muted: #75839a;
  --text-faint: #59677d;
  --shadow: 0 20px 70px rgba(0, 0, 0, .34);
  --blue-glow: 0 0 24px rgba(47, 125, 255, .20);
  --left-width: 280px;
  --right-width: 330px;
  --font: Inter, "SF Pro Display", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  min-height: 100%;
}

body {
  min-width: 320px;
  margin: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 0%, rgba(37, 99, 235, .18), transparent 34%),
    radial-gradient(circle at 48% 44%, rgba(47, 125, 255, .12), transparent 34%),
    linear-gradient(180deg, var(--bg-primary) 0%, #050b16 100%);
  color: var(--text);
  font: 14px/1.45 var(--font);
}

body::before {
  position: fixed;
  inset: 0;
  pointer-events: none;
  content: "";
  background:
    radial-gradient(circle at 0% 20%, rgba(96, 165, 250, .08), transparent 34%),
    radial-gradient(circle at 100% 70%, rgba(34, 211, 238, .06), transparent 28%),
    linear-gradient(90deg, rgba(0, 0, 0, .30), transparent 18%, transparent 82%, rgba(0, 0, 0, .32));
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
summary,
select,
input[type="file"],
input[type="checkbox"],
input[type="radio"],
input[type="range"] {
  cursor: pointer;
}

button:focus-visible,
summary:focus-visible,
select:focus-visible,
textarea:focus-visible,
input:focus-visible,
a:focus-visible {
  outline: 2px solid rgba(96, 165, 250, .95);
  outline-offset: 3px;
}

button {
  border: 1px solid transparent;
  color: var(--text);
  background: none;
}

button:disabled {
  cursor: not-allowed;
  opacity: .48;
}

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

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3 {
  letter-spacing: 0;
}

svg {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.85;
}

.icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

[hidden] {
  display: none !important;
}

.app-shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: var(--left-width) minmax(0, 1fr) var(--right-width);
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
}

.left-sidebar,
.advanced-options-panel {
  background: linear-gradient(180deg, rgba(8, 18, 32, .90), rgba(5, 13, 24, .82));
  border-color: var(--divider);
  backdrop-filter: blur(22px);
}

.left-sidebar {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto auto;
  gap: 18px;
  min-width: 0;
  min-height: 0;
  padding: 18px 16px 16px;
  overflow-y: auto;
  overflow-x: hidden;
  border-right: 1px solid var(--divider);
  scrollbar-width: thin;
}

.brand-header {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) 32px;
  gap: 8px;
  align-items: center;
}

.brand-mark,
.model-icon,
.hero-icon,
.message-avatar,
.assistant-avatar {
  display: grid;
  place-items: center;
  color: var(--electric);
  background:
    linear-gradient(145deg, rgba(47, 125, 255, .28), rgba(6, 17, 31, .72)),
    rgba(14, 30, 54, .88);
  border: 1px solid rgba(96, 165, 250, .35);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08), var(--blue-glow);
}

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 14px;
}

.brand-copy {
  min-width: 0;
}

.brand-copy h1 {
  margin: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 20px;
  font-weight: 750;
  line-height: 1.05;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.eyebrow {
  margin: 0 0 3px;
  overflow: hidden;
  color: var(--soft-blue);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  min-width: 36px;
  padding: 0;
  color: var(--text-secondary);
  background: rgba(12, 23, 38, .55);
  border: 1px solid var(--border);
  border-radius: 12px;
  transition: border-color .18s ease, color .18s ease, background .18s ease, transform .18s ease;
}

.icon-button:hover {
  color: var(--text);
  background: rgba(24, 45, 72, .78);
  border-color: rgba(96, 165, 250, .45);
  transform: translateY(-1px);
}

.sidebar-collapse svg,
.advanced-header > .icon-button svg {
  width: 18px;
  height: 18px;
  transition: transform .18s ease;
}

.sidebar-collapse svg {
  transform: rotate(180deg);
}

.new-chat-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 56px;
  padding: 0 18px;
  color: white;
  font-size: 15px;
  font-weight: 700;
  background: linear-gradient(135deg, #2f7dff, #60a5fa);
  border: 1px solid rgba(147, 197, 253, .58);
  border-radius: 14px;
  box-shadow: 0 16px 36px rgba(47, 125, 255, .24), inset 0 1px 0 rgba(255, 255, 255, .20);
  transition: filter .18s ease, transform .18s ease, box-shadow .18s ease;
}

.new-chat-button:hover {
  filter: brightness(1.07);
  transform: translateY(-1px);
  box-shadow: 0 20px 42px rgba(47, 125, 255, .30);
}

.recent-section {
  min-height: 0;
  overflow: hidden;
  border-bottom: 1px solid var(--divider);
  padding-bottom: 16px;
}

.sidebar-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 9px;
}

.sidebar-section-header h2 {
  margin: 0;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 700;
}

.sidebar-section-header .icon-button {
  width: 30px;
  height: 30px;
  min-width: 30px;
  border-color: transparent;
  background: transparent;
}

.recent-list,
.run-history-list,
.model-results,
.messages {
  margin: 0;
  padding: 0;
  list-style: none;
}

.recent-list {
  display: grid;
  gap: 4px;
}

.recent-list button,
.primary-nav a {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  align-items: center;
  width: 100%;
  min-height: 38px;
  gap: 8px;
  padding: 0 9px;
  color: var(--text-secondary);
  border: 1px solid transparent;
  border-radius: 11px;
  transition: color .18s ease, border-color .18s ease, background .18s ease;
}

.recent-list button:hover,
.primary-nav a:hover {
  color: var(--text);
  background: rgba(24, 45, 72, .64);
  border-color: rgba(120, 160, 220, .16);
}

.recent-list svg,
.primary-nav svg {
  width: 18px;
  height: 18px;
  color: var(--text-muted);
}

.recent-list span {
  min-width: 0;
  overflow: hidden;
  font-size: 13px;
  font-weight: 550;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recent-list time {
  color: var(--text-faint);
  font-size: 11px;
}

.primary-nav {
  display: grid;
  align-self: start;
  gap: 6px;
  padding-top: 2px;
}

.primary-nav a {
  grid-template-columns: 24px minmax(0, 1fr);
  min-height: 44px;
  font-size: 15px;
  font-weight: 600;
}

.local-status-card {
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr) 18px;
  gap: 10px;
  align-items: center;
  padding: 13px;
  background: rgba(15, 28, 45, .82);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .04);
}

.status-dot,
.mini-dot,
.accordion-icon {
  display: inline-block;
  border-radius: 999px;
}

.status-dot {
  width: 10px;
  height: 10px;
  background: var(--success);
  box-shadow: 0 0 0 4px rgba(62, 224, 131, .14), 0 0 18px rgba(62, 224, 131, .28);
}

.app-shell[data-system-state="error"] .status-dot {
  background: var(--danger);
  box-shadow: 0 0 0 4px rgba(248, 113, 113, .14);
}

.app-shell[data-system-state="loading"] .status-dot,
.app-shell[data-system-state="generating"] .status-dot,
.app-shell[data-system-state="fetching"] .status-dot,
.app-shell[data-system-state="importing"] .status-dot {
  background: var(--electric);
  box-shadow: 0 0 0 4px rgba(96, 165, 250, .14);
}

.local-status-card strong,
.status-text,
.status-detail {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.local-status-card strong {
  color: var(--text);
  font-size: 13px;
  font-weight: 750;
}

.status-text {
  color: var(--success);
  font-size: 12px;
  font-weight: 700;
}

.status-detail {
  color: var(--text-muted);
  font-size: 11px;
}

.local-status-card > svg {
  width: 16px;
  height: 16px;
  color: var(--text-faint);
  transform: rotate(90deg);
}

.sidebar-utilities {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
}

.sidebar-utilities .icon-button {
  width: 100%;
}

.main-workspace {
  position: relative;
  display: grid;
  grid-auto-rows: max-content;
  align-content: start;
  row-gap: 0;
  min-width: 0;
  min-height: 0;
  height: auto;
  max-height: 100vh;
  max-height: 100dvh;
  padding: 22px clamp(18px, 3vw, 34px) 20px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

.privacy-badge {
  justify-self: center;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  min-height: 34px;
  padding: 6px 13px;
  color: var(--text-secondary);
  font-size: 13px;
  background: rgba(8, 19, 34, .76);
  border: 1px solid rgba(96, 165, 250, .28);
  border-radius: 999px;
  box-shadow: 0 0 30px rgba(47, 125, 255, .10);
}

.privacy-badge svg,
.privacy-badge span::first-letter {
  color: var(--electric);
}

.privacy-badge span {
  min-width: 0;
}

.model-toolbar {
  position: relative;
  justify-self: center;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  align-content: center;
  gap: 8px;
  width: min(780px, 100%);
  min-height: 62px;
  margin-top: 16px;
  padding: 8px;
  background: rgba(8, 19, 34, .74);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, .04);
  backdrop-filter: blur(20px);
}

.mode-toggle {
  display: none;
}

.mode-button {
  min-height: 30px;
  padding: 0 12px;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 750;
}

.mode-button[aria-pressed="true"] {
  color: white;
  background: rgba(47, 125, 255, .18);
  border-color: rgba(96, 165, 250, .58);
  box-shadow: var(--blue-glow);
}

.mobile-advanced-button {
  display: none;
  justify-self: center;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  margin-top: 12px;
  padding: 0 13px;
  color: var(--text);
  font-size: 13px;
  font-weight: 750;
  background: rgba(15, 28, 45, .82);
  border: 1px solid rgba(96, 165, 250, .32);
  border-radius: 999px;
  box-shadow: 0 0 24px rgba(47, 125, 255, .12);
}

.mobile-advanced-button:hover {
  border-color: rgba(96, 165, 250, .58);
  background: rgba(24, 45, 72, .78);
}

.mobile-advanced-button svg {
  width: 16px;
  height: 16px;
  color: var(--electric);
}

.model-icon {
  width: 38px;
  height: 38px;
  border-radius: 12px;
}

.model-name-button {
  flex: 1 1 232px;
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  min-height: 38px;
  padding: 0 8px;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  border-radius: 10px;
}

.model-name-button span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.model-name-button svg {
  width: 15px;
  height: 15px;
  transform: rotate(90deg);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 0 8px;
  color: var(--text-secondary);
  font-size: 11.5px;
  font-weight: 700;
  white-space: nowrap;
  background: rgba(15, 28, 45, .82);
  border: 1px solid var(--border);
  border-radius: 999px;
}

.mini-dot {
  width: 7px;
  height: 7px;
}

.status-pill.success .mini-dot {
  background: var(--success);
  box-shadow: 0 0 12px rgba(62, 224, 131, .46);
}

.status-pill.info .mini-dot {
  background: var(--electric);
  box-shadow: 0 0 12px rgba(96, 165, 250, .40);
}

.status-pill.neutral .mini-dot {
  background: var(--text-muted);
  box-shadow: 0 0 10px rgba(117, 131, 154, .28);
}

.status-pill.error .mini-dot {
  background: var(--danger);
  box-shadow: 0 0 12px rgba(248, 113, 113, .38);
}

.edit-model-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  margin-left: auto;
  padding: 0 9px;
  color: var(--text-secondary);
  font-weight: 700;
  background: rgba(15, 28, 45, .82);
  border: 1px solid var(--border);
  border-radius: 11px;
}

.edit-model-button:hover {
  color: var(--text);
  border-color: rgba(96, 165, 250, .42);
  background: rgba(24, 45, 72, .72);
}

.model-popover {
  position: absolute;
  top: 126px;
  left: 50%;
  z-index: 40;
  width: min(780px, calc(100% - 48px));
  padding: 14px;
  transform: translateX(-50%);
  background: rgba(7, 17, 31, .95);
  border: 1px solid rgba(96, 165, 250, .32);
  border-radius: 18px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .48), var(--blue-glow);
  backdrop-filter: blur(24px);
}

.source-option-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.source-option,
.starter-action {
  display: grid;
  min-width: 0;
  text-align: left;
  background: var(--card);
  border: 1px solid var(--border);
  transition: transform .18s ease, background .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.source-option {
  gap: 5px;
  min-height: 76px;
  padding: 12px;
  border-radius: 14px;
}

.source-option span,
.starter-action span {
  color: var(--text);
  font-weight: 750;
}

.source-option small,
.starter-action small,
.helper-text,
.helper-status,
.inline-status {
  color: var(--text-muted);
}

.source-option:hover,
.source-option[aria-pressed="true"],
.starter-action:hover,
.starter-action.is-selected {
  background: var(--card-hover);
  border-color: rgba(96, 165, 250, .52);
  box-shadow: var(--blue-glow);
  transform: translateY(-2px);
}

.source-panel {
  display: grid;
  gap: 10px;
  margin-top: 10px;
  padding: 12px;
  background: rgba(8, 19, 34, .78);
  border: 1px solid var(--border);
  border-radius: 14px;
}

.source-panel p,
.helper-status,
.inline-status,
.helper-text {
  margin: 0;
  font-size: 12px;
}

.search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

label {
  display: block;
  margin: 10px 0 6px;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 700;
}

textarea,
select,
input[type="number"],
input[type="file"],
input[type="search"],
input[type="url"] {
  width: 100%;
  min-height: 38px;
  color: var(--text);
  background: rgba(5, 13, 24, .74);
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 0 11px;
}

input[type="file"] {
  padding: 8px 10px;
}

.secondary-action,
.search-row button,
.text-link-button {
  min-height: 36px;
  padding: 0 11px;
  color: var(--text-secondary);
  font-weight: 700;
  background: rgba(15, 28, 45, .86);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.secondary-action:hover,
.search-row button:hover {
  color: var(--text);
  border-color: rgba(96, 165, 250, .46);
  background: rgba(24, 45, 72, .76);
}

.text-link-button {
  width: fit-content;
  min-height: 0;
  padding: 0;
  color: var(--electric);
  background: transparent;
  border: 0;
}

.simple-error {
  justify-self: center;
  width: min(780px, 100%);
  margin-top: 12px;
  padding: 12px 14px;
  color: var(--text);
  background: rgba(47, 14, 20, .82);
  border: 1px solid rgba(248, 113, 113, .45);
  border-radius: 14px;
}

.simple-error strong {
  color: var(--danger);
}

.simple-error p {
  margin-bottom: 0;
  color: var(--text-secondary);
}

.chat-stage {
  align-self: start;
  justify-self: center;
  display: grid;
  justify-items: center;
  width: min(760px, 100%);
  margin-top: clamp(18px, 3vh, 34px);
  text-align: center;
}

.hero-icon {
  width: 72px;
  height: 72px;
  margin-bottom: 20px;
  border-radius: 24px;
}

.hero-icon svg {
  width: 34px;
  height: 34px;
}

.chat-stage h2 {
  width: min(680px, 100%);
  margin: 0;
  color: var(--text);
  font-size: clamp(30px, 4vw, 34px);
  font-weight: 780;
  line-height: 1.12;
  text-wrap: balance;
}

.chat-stage > p {
  width: min(560px, 100%);
  max-width: 560px;
  margin: 11px 0 0;
  color: var(--text-secondary);
  font-size: 16px;
  text-wrap: balance;
}

.starter-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  width: 100%;
  margin-top: 30px;
}

.starter-action {
  align-content: start;
  gap: 10px;
  min-height: 198px;
  padding: 18px 15px;
  border-radius: 18px;
}

.starter-action svg {
  width: 25px;
  height: 25px;
  color: var(--electric);
}

.starter-action span {
  font-size: 15px;
  line-height: 1.22;
  overflow-wrap: anywhere;
}

.starter-action small {
  font-size: 13px;
  line-height: 1.4;
}

.conversation-panel {
  align-self: start;
  justify-self: center;
  width: min(740px, 100%);
  min-height: 138px;
  max-height: 210px;
  margin-top: 22px;
  overflow: auto;
  scrollbar-width: thin;
}

.messages {
  display: grid;
  gap: 11px;
}

.message,
.preview-message {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 11px;
  align-items: start;
  padding: 13px;
  color: var(--text-secondary);
  background: rgba(12, 23, 38, .70);
  border: 1px solid var(--border);
  border-radius: 17px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .20);
}

.message-assistant,
.preview-message.assistant {
  background: rgba(15, 28, 45, .78);
}

.message-avatar,
.assistant-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 800;
}

.message-role {
  margin-bottom: 3px;
  color: var(--soft-blue);
  font-size: 12px;
  font-weight: 800;
}

.message-text {
  color: var(--text-secondary);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.message-time {
  color: var(--text-faint);
  font-size: 11px;
  white-space: nowrap;
}

.message.error .message-text,
.message.error .message-role,
.error {
  color: var(--danger);
}

.latest-response {
  margin-top: 8px;
  color: var(--text-secondary);
  white-space: pre-wrap;
}

.latest-response:empty {
  display: none;
}

.response-code-block {
  position: relative;
  margin: 12px 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(2, 8, 20, .86);
}

.response-code-block pre {
  margin: 0;
  padding: 12px;
  overflow: auto;
}

.copy-code-button,
.copy-field-button {
  min-width: 30px;
  min-height: 30px;
  padding: 0 8px;
  color: var(--text-secondary);
  background: rgba(15, 28, 45, .86);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.copy-code-button {
  position: absolute;
  top: 7px;
  right: 7px;
}

.copy-code-button::before,
.copy-field-button::before {
  content: "Copy";
  font-size: 11px;
  font-weight: 700;
}

.composer-panel {
  align-self: start;
  justify-self: center;
  display: grid;
  width: min(790px, 100%);
  min-height: 142px;
  margin-top: 18px;
  margin-bottom: 18px;
  padding: 16px;
  background: rgba(8, 19, 34, .88);
  border: 1px solid rgba(120, 160, 220, .34);
  border-radius: 20px;
  box-shadow: 0 18px 60px rgba(0, 0, 0, .34), inset 0 1px 0 rgba(255, 255, 255, .05);
  backdrop-filter: blur(20px);
}

.composer-panel textarea {
  min-height: 68px;
  max-height: 150px;
  resize: none;
  padding: 0;
  color: var(--text);
  background: transparent;
  border: 0;
  border-radius: 0;
  line-height: 1.55;
  cursor: text;
}

.composer-panel textarea::placeholder {
  color: var(--text-faint);
}

.composer-footer {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 48px;
  gap: 12px;
  align-items: center;
  margin-top: 10px;
}

.attachment-button,
.send-button {
  display: grid;
  place-items: center;
  padding: 0;
  border-radius: 13px;
}

.attachment-button {
  width: 42px;
  height: 42px;
  color: var(--text-secondary);
  background: rgba(15, 28, 45, .86);
  border: 1px solid var(--border);
}

.composer-footer > span {
  min-width: 0;
  overflow: hidden;
  color: var(--text-muted);
  font-size: 12px;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.send-button {
  width: 48px;
  height: 48px;
  color: white;
  background: linear-gradient(135deg, var(--primary), var(--electric));
  border: 1px solid rgba(147, 197, 253, .58);
  box-shadow: 0 0 26px rgba(47, 125, 255, .30);
  transition: transform .18s ease, filter .18s ease, box-shadow .18s ease;
}

.send-button:hover:not(:disabled) {
  filter: brightness(1.08);
  transform: scale(1.03);
  box-shadow: 0 0 32px rgba(47, 125, 255, .40);
}

.advanced-options-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
  border-left: 1px solid var(--divider);
}

.advanced-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 62px;
  padding: 15px 16px 11px;
  border-bottom: 1px solid var(--divider);
}

.advanced-header > div {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.advanced-header svg {
  color: var(--electric);
}

.advanced-header h2 {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 16px;
  font-weight: 760;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.advanced-header > .icon-button svg {
  transform: none;
}

.advanced-scroll {
  display: grid;
  align-content: start;
  gap: 12px;
  min-height: 0;
  padding: 16px;
  overflow: auto;
  scrollbar-width: thin;
}

.generation-card,
.status-accordion,
.drawer-section,
.run-history {
  background: rgba(13, 25, 42, .76);
  border: 1px solid var(--border);
  border-radius: 15px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .035);
}

.generation-card {
  padding: 14px;
}

.generation-card h3 {
  margin: 0 0 12px;
  color: var(--text);
  font-size: 14px;
  font-weight: 760;
}

.preset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(52px, 1fr));
  gap: 7px;
}

.preset-button {
  display: grid;
  justify-items: center;
  gap: 6px;
  min-width: 0;
  min-height: 62px;
  padding: 8px 4px 7px;
  color: var(--text-muted);
  background: rgba(8, 19, 34, .72);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 11px;
  font-weight: 750;
  transition: color .18s ease, background .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.preset-button span {
  max-width: 100%;
  overflow: hidden;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preset-button svg {
  width: 18px;
  height: 18px;
}

.preset-button:hover,
.preset-button.is-active {
  color: var(--text);
  background: rgba(47, 125, 255, .15);
  border-color: rgba(96, 165, 250, .72);
  box-shadow: var(--blue-glow);
}

.slider-stack {
  display: grid;
  gap: 13px;
  margin-top: 16px;
}

.slider-control {
  display: grid;
  grid-template-columns: minmax(70px, .85fr) minmax(70px, 1fr) minmax(54px, 66px);
  gap: 10px;
  align-items: center;
  margin: 0;
  min-width: 0;
}

.slider-control span,
.seed-control span {
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 700;
}

.slider-control output {
  display: grid;
  place-items: center;
  min-height: 30px;
  color: var(--text);
  font-size: 12px;
  font-weight: 750;
  background: rgba(5, 13, 24, .74);
  border: 1px solid var(--border);
  border-radius: 8px;
}

input[type="range"] {
  width: 100%;
  height: 8px;
  appearance: none;
  background: linear-gradient(to right, var(--primary) var(--fill, 50%), rgba(71, 85, 105, .45) var(--fill, 50%));
  border-radius: 999px;
}

input[type="range"]::-webkit-slider-thumb {
  width: 17px;
  height: 17px;
  appearance: none;
  background: #eaf3ff;
  border: 3px solid var(--electric);
  border-radius: 50%;
  box-shadow: 0 0 18px rgba(96, 165, 250, .48);
}

input[type="range"]::-moz-range-thumb {
  width: 17px;
  height: 17px;
  background: #eaf3ff;
  border: 3px solid var(--electric);
  border-radius: 50%;
  box-shadow: 0 0 18px rgba(96, 165, 250, .48);
}

.seed-control {
  display: grid;
  grid-template-columns: minmax(70px, .85fr) minmax(0, 1fr) 36px;
  gap: 10px;
  align-items: center;
  margin: 16px 0 0;
  min-width: 0;
}

.seed-control input {
  min-height: 34px;
}

.accordion-stack {
  display: grid;
  gap: 10px;
}

.status-accordion,
.drawer-section,
.run-history {
  overflow: hidden;
}

.status-accordion summary,
.drawer-section summary,
.run-history summary {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) 18px;
  gap: 10px;
  align-items: center;
  min-height: 62px;
  padding: 0 12px;
  list-style: none;
  color: var(--text);
  font-weight: 750;
}

.drawer-section summary,
.run-history summary {
  grid-template-columns: minmax(0, 1fr) 18px;
}

.status-accordion summary::-webkit-details-marker,
.drawer-section summary::-webkit-details-marker,
.run-history summary::-webkit-details-marker {
  display: none;
}

.status-accordion summary:hover,
.drawer-section summary:hover,
.run-history summary:hover {
  background: rgba(24, 45, 72, .44);
}

.status-accordion summary > span:not(.accordion-icon) {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.status-accordion summary strong,
.status-accordion summary small,
.drawer-section summary,
.run-history summary,
.run-history-item,
.model-result {
  min-width: 0;
  overflow-wrap: anywhere;
}

.status-accordion summary small {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 650;
}

.status-accordion summary > svg:last-child,
.drawer-section summary::after,
.run-history summary::after {
  color: var(--text-faint);
  transition: transform .18s ease;
}

.status-accordion[open] summary > svg:last-child {
  transform: rotate(90deg);
}

.drawer-section summary::after,
.run-history summary::after {
  content: "›";
  font-size: 22px;
}

.drawer-section[open] summary::after,
.run-history[open] summary::after {
  transform: rotate(90deg);
}

.accordion-icon {
  width: 10px;
  height: 10px;
}

.accordion-icon.success {
  background: var(--success);
  box-shadow: 0 0 16px rgba(62, 224, 131, .38);
}

.accordion-svg {
  width: 20px;
  height: 20px;
}

.accordion-svg.warn {
  color: var(--warning);
}

.accordion-svg.info {
  color: var(--violet);
}

.accordion-svg.yellow {
  color: var(--yellow);
}

.accordion-svg.cyan {
  color: var(--cyan);
}

.status-accordion > :not(summary),
.drawer-section > :not(summary),
.run-history > :not(summary) {
  margin: 0 12px 12px;
}

.kv-list {
  display: grid;
  grid-template-columns: minmax(92px, 118px) minmax(0, 1fr);
  gap: 8px 9px;
  margin-top: 0;
  color: var(--text-secondary);
  font-size: 12px;
}

.kv-list dt {
  color: var(--text-muted);
}

.kv-list dd {
  display: flex;
  gap: 6px;
  align-items: center;
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
}

.kv-list dd.copyable {
  justify-content: space-between;
}

pre {
  max-height: 250px;
  margin: 10px 0 0;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: var(--text-muted);
  background: rgba(2, 8, 20, .72);
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 10px;
  font-size: 12px;
}

.tabs {
  display: flex;
  gap: 6px;
  max-width: 100%;
  overflow-x: auto;
  padding-bottom: 6px;
}

.tab-button {
  flex: 0 0 auto;
  min-height: 30px;
  padding: 0 9px;
  color: var(--text-secondary);
  background: rgba(8, 19, 34, .72);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 750;
}

.tab-button[aria-selected="true"] {
  color: white;
  background: rgba(47, 125, 255, .18);
  border-color: rgba(96, 165, 250, .62);
}

.tab-panel:empty {
  display: none;
}

.console-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
}

.console-actions button {
  min-height: 30px;
  padding: 0 9px;
  color: var(--text-secondary);
  background: rgba(8, 19, 34, .72);
  border: 1px solid var(--border);
  border-radius: 9px;
  font-size: 12px;
  font-weight: 700;
}

.toggle-row {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  margin: 0;
  color: var(--text-secondary);
}

.benchmark-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.metric-card {
  display: grid;
  gap: 4px;
  padding: 10px;
  background: rgba(8, 19, 34, .68);
  border: 1px solid var(--border);
  border-radius: 11px;
}

.metric-card span {
  color: var(--text-muted);
  font-size: 11px;
}

.metric-card strong {
  overflow-wrap: anywhere;
  color: var(--text);
  font-size: 12px;
}

.run-history {
  padding-bottom: 10px;
}

.run-history-list {
  display: grid;
  gap: 8px;
}

.run-history-item {
  display: grid;
  gap: 7px;
  padding: 10px;
  background: rgba(8, 19, 34, .68);
  border: 1px solid var(--border);
  border-radius: 11px;
}

.run-history-item p {
  margin-bottom: 0;
  color: var(--text-muted);
}

.run-history-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.run-history-actions button {
  min-height: 30px;
  padding: 0 9px;
  color: var(--text-secondary);
  background: rgba(15, 28, 45, .86);
  border: 1px solid var(--border);
  border-radius: 9px;
  font-size: 12px;
  font-weight: 700;
}

.model-results {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.model-result {
  display: grid;
  gap: 6px;
  padding: 10px;
  background: rgba(8, 19, 34, .68);
  border: 1px solid var(--border);
  border-radius: 11px;
}

.model-result strong,
.model-result a {
  color: var(--soft-blue);
}

.model-result-meta {
  color: var(--text-muted);
  font-size: 12px;
}

.model-result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.model-result-actions a,
.model-result-actions button {
  min-height: 30px;
  padding: 5px 8px;
  color: var(--text-secondary);
  background: rgba(15, 28, 45, .86);
  border: 1px solid var(--border);
  border-radius: 9px;
  font-weight: 700;
}

.bottom-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 36px 36px 36px;
  gap: 8px;
  align-items: center;
  padding-top: 2px;
}

.reset-defaults-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  min-width: 0;
  padding: 0 12px;
  color: var(--text-secondary);
  background: rgba(8, 19, 34, .82);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-weight: 750;
}

.reset-defaults-button:hover:not(:disabled) {
  color: var(--text);
  border-color: rgba(96, 165, 250, .46);
  background: rgba(24, 45, 72, .72);
}

.footnote {
  position: fixed;
  left: calc(var(--left-width) + 18px);
  bottom: 6px;
  z-index: 4;
  display: flex;
  gap: 10px;
  max-width: calc(100vw - var(--left-width) - var(--right-width) - 40px);
  overflow: hidden;
  color: rgba(183, 196, 216, .58);
  font-size: 11px;
  pointer-events: none;
}

.footnote span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.footnote .notice {
  color: rgba(147, 197, 253, .66);
}

.model-summary {
  display: none;
}

.app-shell[data-sidebar-collapsed="true"] {
  --left-width: 72px;
}

.app-shell[data-sidebar-collapsed="true"] .left-sidebar {
  padding-inline: 14px;
}

.app-shell[data-sidebar-collapsed="true"] .brand-header {
  grid-template-columns: 42px;
  justify-content: center;
  gap: 10px;
}

.app-shell[data-sidebar-collapsed="true"] .brand-copy,
.app-shell[data-sidebar-collapsed="true"] .new-chat-button span,
.app-shell[data-sidebar-collapsed="true"] .recent-section,
.app-shell[data-sidebar-collapsed="true"] .primary-nav span,
.app-shell[data-sidebar-collapsed="true"] .local-status-card div,
.app-shell[data-sidebar-collapsed="true"] .local-status-card > svg {
  display: none;
}

.app-shell[data-sidebar-collapsed="true"] .sidebar-collapse {
  display: inline-grid;
  grid-row: 2;
  justify-self: center;
}

.app-shell[data-sidebar-collapsed="true"] .sidebar-collapse svg {
  transform: none;
}

.app-shell[data-sidebar-collapsed="true"] .new-chat-button {
  min-width: 48px;
  padding: 0;
}

.app-shell[data-sidebar-collapsed="true"] .primary-nav a {
  grid-template-columns: 1fr;
  justify-items: center;
  padding-inline: 0;
}

.app-shell[data-sidebar-collapsed="true"] .local-status-card {
  grid-template-columns: 1fr;
  justify-items: center;
}

.app-shell[data-rail-collapsed="true"] {
  --right-width: 64px;
}

.app-shell[data-rail-collapsed="true"] .advanced-header {
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 10px;
  min-height: 100%;
  padding: 14px 10px;
  border-bottom: 0;
}

.app-shell[data-rail-collapsed="true"] .advanced-header h2,
.app-shell[data-rail-collapsed="true"] .advanced-header > div svg,
.app-shell[data-rail-collapsed="true"] .advanced-scroll {
  display: none;
}

.app-shell[data-rail-collapsed="true"] .advanced-header > div {
  display: none;
}

.app-shell[data-rail-collapsed="true"] .advanced-header::after {
  content: "Advanced";
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  line-height: 1;
  text-transform: uppercase;
  writing-mode: vertical-rl;
}

.app-shell[data-rail-collapsed="true"] .advanced-header > .icon-button svg {
  transform: rotate(180deg);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: .001ms !important;
    animation-duration: .001ms !important;
  }
}

@media (max-width: 1199px) {
  .app-shell {
    grid-template-columns: 236px minmax(0, 1fr);
  }

  .advanced-options-panel {
    position: fixed;
    top: 0;
    right: 0;
    z-index: 80;
    width: min(360px, 92vw);
    transform: translateX(0);
    box-shadow: -22px 0 70px rgba(0, 0, 0, .48);
  }

  .app-shell[data-rail-collapsed="true"] .advanced-options-panel {
    transform: translateX(100%);
    pointer-events: none;
  }

  .app-shell[data-rail-collapsed="false"] .advanced-options-panel {
    pointer-events: auto;
  }

  .main-workspace {
    padding-right: 24px;
  }

  .mobile-advanced-button {
    display: inline-flex;
  }

  .starter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .footnote {
    display: none;
  }
}

@media (max-width: 899px) {
  body {
    overflow: auto;
  }

  .app-shell {
    display: block;
    min-height: 100vh;
    overflow: visible;
  }

  .left-sidebar {
    position: sticky;
    top: 0;
    z-index: 70;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-rows: auto;
    gap: 10px;
    min-height: 72px;
    padding: 12px;
    border-right: 0;
    border-bottom: 1px solid var(--divider);
  }

  .brand-header {
    grid-template-columns: 40px minmax(0, 1fr);
  }

  .sidebar-collapse,
  .recent-section,
  .primary-nav,
  .local-status-card {
    display: none;
  }

  .app-shell[data-sidebar-collapsed="true"] .sidebar-collapse {
    display: none;
  }

  .new-chat-button {
    justify-self: end;
    width: auto;
    min-height: 46px;
    padding-inline: 14px;
  }

  .sidebar-utilities {
    grid-template-columns: repeat(3, 36px);
  }

  .main-workspace {
    height: auto;
    min-height: calc(100vh - 72px);
    overflow: visible;
    padding: 16px 14px 132px;
  }

  .model-toolbar {
    flex-wrap: wrap;
    overflow: visible;
    justify-content: flex-start;
  }

  .model-name-button {
    flex: 1 1 220px;
  }

  .model-popover {
    position: fixed;
    top: 82px;
    width: calc(100vw - 24px);
  }

  .source-option-grid,
  .starter-grid {
    grid-template-columns: 1fr;
  }

  .starter-action {
    min-height: 112px;
    padding: 15px;
  }

  .conversation-panel {
    max-height: none;
  }

  .composer-panel {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: 12px;
    z-index: 60;
    width: auto;
    min-height: 104px;
    padding: 14px;
  }

  .composer-panel textarea {
    height: 38px;
    min-height: 38px;
    max-height: 38px;
  }

  .advanced-options-panel {
    width: min(340px, 94vw);
  }
}

@media (max-width: 560px) {
  .brand-copy h1 {
    font-size: 18px;
  }

  .eyebrow {
    display: none;
  }

  .sidebar-utilities {
    display: none;
  }

  .left-sidebar {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .new-chat-button {
    width: 46px;
    min-width: 46px;
    padding: 0;
  }

  .new-chat-button span {
    display: none;
  }

  .privacy-badge,
  .status-pill {
    white-space: normal;
  }

  .privacy-badge {
    width: 100%;
    justify-content: center;
    text-align: center;
    line-height: 1.35;
  }

  .model-toolbar {
    gap: 8px;
  }

  .model-icon {
    width: 36px;
    height: 36px;
  }

  .model-name-button {
    flex: 1 1 calc(100% - 46px);
    font-size: 13px;
  }

  .edit-model-button {
    margin-left: 0;
  }

  .chat-stage h2 {
    font-size: 26px;
  }

  .chat-stage > p {
    font-size: 15px;
  }

  .hero-icon {
    width: 64px;
    height: 64px;
    margin-bottom: 16px;
    border-radius: 21px;
  }

  .message,
  .preview-message {
    grid-template-columns: 36px minmax(0, 1fr);
  }

  .message-time {
    grid-column: 2;
  }

  .composer-footer {
    grid-template-columns: 42px minmax(0, 1fr) 46px;
  }

  .composer-footer > span {
    font-size: 11px;
  }
}
