:root {
  color-scheme: dark;
  --black: #000;
  --panel: #070707;
  --panel-raised: #0c0c0c;
  --panel-hover: #121212;
  --white: #fff;
  --soft-white: #e9e9e9;
  --muted: #8f8f8f;
  --muted-2: #626262;
  --line: #242424;
  --line-strong: #3a3a3a;
  --danger: #fff;
  --premium-accent: #c084fc;
  --premium-surface: rgba(192, 132, 252, .11);
  --paygo-accent: #fbbf24;
  --paygo-surface: rgba(251, 191, 36, .10);
  --premium-text: #e9d5ff;
  --paygo-text: #fde68a;
  --scrim: rgba(0,0,0,.72);
  --sidebar-width: 280px;
  --header-height: 72px;
  --composer-width: 900px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --app-height: var(--luna-vh, 100dvh);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

html[data-theme="light"] {
  color-scheme: light;
  --black: #fff;
  --panel: #f4f4f4;
  --panel-raised: #f8f8f8;
  --panel-hover: #eaeaea;
  --white: #080808;
  --soft-white: #181818;
  --muted: #626262;
  --muted-2: #858585;
  --line: #dadada;
  --line-strong: #b9b9b9;
  --premium-accent: #7e22ce;
  --premium-surface: rgba(126, 34, 206, .08);
  --premium-text: #6815a8;
  --paygo-accent: #9a6700;
  --paygo-surface: rgba(154, 103, 0, .09);
  --paygo-text: #775000;
  --scrim: rgba(0,0,0,.38);
}

* { box-sizing: border-box; }
html, body { width: 100%; min-width: 0; height: 100%; margin: 0; background: var(--black); color: var(--white); }
body { min-height: var(--app-height); overflow: hidden; }
button, input, textarea, select { font: inherit; color: inherit; }
button { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-underline-offset: 3px; }
::selection { background: var(--white); color: var(--black); }

.hidden { display: none !important; }
.mobile-only { display: none !important; }
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.app-shell {
  width: 100%;
  min-width: 0;
  height: var(--app-height);
  min-height: 600px;
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  overflow: hidden;
  background: var(--black);
}

.sidebar {
  min-width: 0;
  height: 100%;
  padding: calc(18px + var(--safe-top)) 16px calc(16px + var(--safe-bottom)) calc(16px + var(--safe-left));
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow: hidden;
  background: var(--panel);
  border-right: 1px solid var(--line);
  z-index: 20;
}

.sidebar-header,
.brand-block,
.section-label-row,
.selector-button,
.footer-button,
.workspace-header,
.workspace-actions,
.workspace-title-group,
.header-model-button,
.sheet-header,
.setting-row,
.card-heading,
.button-row,
.legal-tabs,
.composer-meta,
.message-heading,
.message-actions,
.code-header,
.model-row,
.model-row-main,
.instruction-item,
.attachment-preview,
.message-asset {
  display: flex;
  align-items: center;
}

.sidebar-header,
.section-label-row,
.selector-button,
.footer-button,
.workspace-header,
.sheet-header,
.setting-row,
.card-heading,
.composer-meta,
.message-heading,
.code-header,
.model-row,
.instruction-item,
.attachment-preview,
.message-asset { justify-content: space-between; }

.brand-block { gap: 11px; min-width: 0; }
.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid var(--white);
  background: var(--white);
  color: var(--black);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-weight: 900;
  font-size: 16px;
}
.brand-block strong,
.workspace-kicker,
.section-label,
.section-count,
.composer-meta,
.message-role,
.code-language,
.model-meta,
.settings-link-button small {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: .09em;
  text-transform: uppercase;
}
.brand-block strong { display: block; font-size: 13px; letter-spacing: .13em; }
.brand-block small { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; letter-spacing: .08em; }

.icon-button {
  width: 38px;
  height: 38px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--white);
  cursor: pointer;
  font-size: 20px;
  line-height: 0;
}
.icon-button:hover,
.icon-button:focus-visible { background: var(--white); color: var(--black); border-color: var(--white); outline: none; }

.primary-button,
.secondary-button,
.settings-link-button,
.selector-button,
.footer-button,
.header-model-button,
.composer-button,
.send-button,
.tab-button,
.message-action,
.code-copy-button,
.model-action,
.pager button,
.conversation-item,
.delete-conversation,
.remove-attachment,
.asset-download-button {
  border-radius: 0;
  cursor: pointer;
  transition: background-color 120ms ease, color 120ms ease, border-color 120ms ease, opacity 120ms ease;
}

.primary-button,
.secondary-button {
  min-height: 42px;
  padding: 10px 13px;
  border: 1px solid var(--white);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: .035em;
}
.primary-button { background: var(--white); color: var(--black); }
.secondary-button { background: transparent; color: var(--white); border-color: var(--line-strong); }
.primary-button:hover,
.primary-button:focus-visible { background: var(--soft-white); outline: none; }
.secondary-button:hover,
.secondary-button:focus-visible { background: var(--white); color: var(--black); border-color: var(--white); outline: none; }
.full-width { width: 100%; }

.sidebar-section { min-width: 0; display: grid; gap: 9px; }
.conversation-section { min-height: 0; flex: 1 1 auto; display: flex; flex-direction: column; }
.section-label-row { min-height: 16px; padding: 0 2px; }
.section-label,
.section-count { color: var(--muted); font-size: 9px; line-height: 1; }

.selector-button,
.footer-button,
.footer-status,
.header-model-button {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--white);
}
.selector-button { min-height: 58px; padding: 10px 12px; text-align: left; gap: 12px; }
.selector-button:hover,
.selector-button:focus-visible,
.footer-button:hover,
.footer-button:focus-visible,
.footer-energy-button:hover,
.footer-energy-button:focus-visible,
.header-model-button:hover,
.header-model-button:focus-visible { border-color: var(--white); outline: none; }
.selector-copy,
.footer-button-copy { min-width: 0; display: block; text-align: left; }
.selector-copy small,
.footer-button-copy small { display: block; color: var(--muted); font-size: 10px; margin-bottom: 4px; }
.selector-copy strong,
.footer-button-copy strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }

.collapsible-panel { min-height: 0; display: flex; flex-direction: column; gap: 8px; overflow: hidden; }
.collapsible-panel.collapsed { display: none; }
.search-field { display: block; width: 100%; }
.search-field input,
.settings-card textarea,
.settings-card select,
.settings-card input,
#messageInput {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--black);
  color: var(--white);
  outline: none;
}
.search-field input { min-height: 44px; padding: 10px 12px; font-size: 13px; }
.compact-search input { min-height: 38px; padding: 8px 10px; font-size: 12px; }
.search-field input:focus,
.settings-card textarea:focus,
.settings-card select:focus,
.settings-card input:focus,
#messageInput:focus { border-color: var(--white); }
input::placeholder,
textarea::placeholder { color: var(--muted-2); }

.conversation-list {
  min-height: 72px;
  flex: 1 1 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  border-top: 1px solid var(--line);
}
.conversation-item-wrap {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 32px;
  border-bottom: 1px solid var(--line);
}
.conversation-item {
  min-width: 0;
  min-height: 52px;
  padding: 10px 8px;
  border: 0;
  background: transparent;
  color: var(--muted);
  text-align: left;
}
.conversation-item:hover,
.conversation-item:focus-visible { background: var(--panel-hover); color: var(--white); outline: none; }
.conversation-item.active { background: var(--white); color: var(--black); }
.conversation-item strong,
.conversation-item small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conversation-item strong { font-size: 12px; font-weight: 700; }
.conversation-item small { margin-top: 4px; font-size: 10px; opacity: .66; }
.delete-conversation {
  width: 32px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  line-height: 0;
  border: 0;
  border-left: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 16px;
}
.delete-conversation:hover,
.delete-conversation:focus-visible { background: var(--white); color: var(--black); outline: none; }
.empty-list { padding: 18px 8px; color: var(--muted); font-size: 12px; line-height: 1.5; }

.sidebar-footer { display: grid; gap: 8px; margin-top: auto; }
.footer-button,
.footer-status { min-height: 54px; padding: 9px 11px; gap: 10px; font-size: 10px; text-transform: uppercase; letter-spacing: .075em; }
.footer-status {
  width: 100%;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-align: left;
  font: inherit;
  cursor: pointer;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--white);
}
.footer-energy-button:hover,
.footer-energy-button:focus-visible { background: var(--panel-hover); }

.sidebar-scrim { display: none; }

.workspace { min-width: 0; height: 100%; display: grid; grid-template-rows: var(--header-height) minmax(0, 1fr) auto; overflow: hidden; }
.workspace-header {
  min-width: 0;
  height: var(--header-height);
  padding: calc(12px + var(--safe-top)) calc(18px + var(--safe-right)) 12px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--black);
  gap: 18px;
}
.workspace-title-group { min-width: 0; gap: 11px; }
.workspace-actions { min-width: 0; gap: 8px; margin-left: auto; }
.workspace-title-copy { min-width: 0; }
.workspace-kicker { display: block; color: var(--muted); font-size: 9px; line-height: 1; }
.workspace-title-copy h1,
.sheet-header h2 { margin: 6px 0 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 16px; line-height: 1.2; font-weight: 740; }
.header-model-button { width: auto; max-width: min(330px, 42vw); min-height: 40px; padding: 9px 11px; gap: 12px; font-size: 11px; letter-spacing: .02em; }
.header-model-button span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.messages {
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-behavior: smooth;
  padding: 34px max(24px, calc((100% - var(--composer-width)) / 2)) 56px;
}
.empty-state {
  max-width: 720px;
  min-height: 60%;
  margin: 0 auto;
  display: grid;
  align-content: center;
  gap: 18px;
}
.empty-state-label { color: var(--muted); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10px; letter-spacing: .14em; text-transform: uppercase; }
.empty-state h2 { max-width: 670px; margin: 0; font-size: clamp(30px, 5vw, 62px); line-height: .98; letter-spacing: -.055em; font-weight: 780; }
.empty-state p { max-width: 560px; margin: 0; color: var(--muted); font-size: 14px; line-height: 1.65; }
.empty-state-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); }
.empty-state-grid button {
  min-height: 96px;
  padding: 14px;
  border: 0;
  background: var(--black);
  color: var(--white);
  text-align: left;
  cursor: pointer;
}
.empty-state-grid button:hover,
.empty-state-grid button:focus-visible { background: var(--white); color: var(--black); outline: none; }
.empty-state-grid small { display: block; margin-bottom: 20px; color: inherit; opacity: .58; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.empty-state-grid strong { font-size: 12px; line-height: 1.4; }

.message {
  max-width: var(--composer-width);
  margin: 0 auto 34px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.message-heading { gap: 16px; margin-bottom: 12px; }
.message-role { color: var(--muted); font-size: 9px; }
.message-time { color: var(--muted-2); font-size: 10px; }
.message-body { min-width: 0; color: var(--soft-white); font-size: 15px; line-height: 1.7; overflow-wrap: anywhere; }
.message.user .message-body { color: var(--white); font-size: 16px; }
.message-body > :first-child { margin-top: 0; }
.message-body > :last-child { margin-bottom: 0; }
.message-body p { margin: 0 0 14px; }
.message-body h1,
.message-body h2,
.message-body h3,
.message-body h4 { margin: 26px 0 10px; line-height: 1.2; letter-spacing: -.025em; color: var(--white); }
.message-body h1 { font-size: 25px; }
.message-body h2 { font-size: 21px; }
.message-body h3 { font-size: 18px; }
.message-body h4 { font-size: 16px; }
.message-body ul,
.message-body ol { margin: 8px 0 16px; padding-left: 22px; }
.message-body li { margin: 5px 0; }
.message-body blockquote { margin: 15px 0; padding: 2px 0 2px 14px; border-left: 2px solid var(--white); color: var(--muted); }
.message-body hr { height: 1px; margin: 24px 0; border: 0; background: var(--line); }
.message-body a { text-decoration: underline; }
.message-body code:not(.code-content) { padding: 2px 5px; border: 1px solid var(--line-strong); background: var(--panel-raised); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .9em; }
.markdown-table-wrap {
  width: 100%;
  max-width: 100%;
  margin: 18px 0;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-inline: contain;
  -webkit-overflow-scrolling: touch;
  border-radius: 12px;
}
.markdown-table-wrap:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.message-body table { width: max-content; min-width: 100%; margin: 0; border-collapse: collapse; font-size: 13px; }
.message-body th,
.message-body td { padding: 8px 10px; border: 1px solid var(--line); text-align: left; vertical-align: top; }
.message-body th { background: var(--panel-raised); color: var(--white); }
.message-actions { justify-content: flex-start; gap: 7px; margin-top: 13px; }
.message-action {
  min-height: 30px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.message-action:hover,
.message-action:focus-visible { background: var(--white); color: var(--black); border-color: var(--white); outline: none; }
.message-attachment { margin: 10px 0; padding: 10px 12px; border: 1px solid var(--line); color: var(--muted); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; }
.message-delivery-notice { margin-top: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 0; font-size: 13px; color: var(--muted); background: var(--panel-soft); }
.message-assets { display: grid; gap: 8px; margin-top: 15px; }
.message-asset {
  min-width: 0;
  gap: 12px;
  padding: 11px;
  border: 1px solid var(--line-strong);
  background: var(--panel-raised);
}
.message-asset-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid var(--white);
  background: var(--white);
  color: var(--black);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 8px;
  font-weight: 900;
  letter-spacing: .08em;
}
.message-asset-copy { min-width: 0; flex: 1 1 auto; }
.message-asset-copy strong,
.message-asset-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.message-asset-copy strong { font-size: 12px; }
.message-asset-copy small { margin-top: 4px; color: var(--muted); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 9px; }
.asset-download-button {
  min-height: 34px;
  padding: 7px 10px;
  flex: 0 0 auto;
  border: 1px solid var(--white);
  background: var(--white);
  color: var(--black);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.asset-download-button:hover,
.asset-download-button:focus-visible { background: transparent; color: var(--white); outline: none; }
.asset-download-button:disabled { opacity: .55; cursor: wait; }
.typing-cursor { display: inline-block; width: 8px; height: 15px; margin-left: 3px; vertical-align: -2px; background: var(--white); animation: blink 900ms step-end infinite; }
@keyframes blink { 50% { opacity: 0; } }

.code-block { margin: 18px 0; border: 1px solid var(--line-strong); background: var(--panel-raised); overflow: hidden; }
.code-header { min-height: 36px; padding: 6px 7px 6px 11px; border-bottom: 1px solid var(--line); background: var(--black); }
.code-language { color: var(--muted); font-size: 9px; }
.code-copy-button {
  min-height: 24px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.code-copy-button:hover,
.code-copy-button:focus-visible { background: var(--white); color: var(--black); border-color: var(--white); outline: none; }
.code-block pre { max-width: 100%; margin: 0; padding: 15px; overflow: auto; tab-size: 2; }
.code-content { display: block; min-width: max-content; color: #e6edf3; background: transparent; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace; font-size: 12.5px; line-height: 1.65; white-space: pre; }
.tok-comment { color: #7f8c98; font-style: italic; }
.tok-string { color: #a6e3a1; }
.tok-number { color: #f9e2af; font-weight: 700; }
.tok-keyword { color: #cba6f7; font-weight: 800; }
.tok-built-in { color: #89b4fa; font-weight: 700; }
.tok-constant { color: #fab387; font-weight: 750; }
.tok-property { color: #94e2d5; }
.tok-operator { color: #f38ba8; }

.composer-dock {
  min-width: 0;
  padding: 10px max(24px, calc((100% - var(--composer-width)) / 2)) calc(12px + var(--safe-bottom));
  background: var(--black);
}
.attachment-preview {
  min-width: 0;
  min-height: 42px;
  margin-bottom: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line-strong);
  background: var(--panel-raised);
  gap: 12px;
}
.attachment-preview-copy { min-width: 0; }
.attachment-preview strong,
.attachment-preview small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attachment-preview strong { font-size: 11px; }
.attachment-preview small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.remove-attachment { width: 30px; height: 30px; flex: 0 0 auto; display: inline-grid; place-items: center; padding: 0; line-height: 0; border: 1px solid var(--line); background: transparent; color: var(--white); }
.remove-attachment:hover,
.remove-attachment:focus-visible { background: var(--white); color: var(--black); outline: none; }
.composer-frame {
  min-width: 0;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 52px;
  align-items: end;
  border: 1px solid var(--line-strong);
  background: var(--black);
}
.composer-button,
.send-button { border: 0; background: transparent; color: var(--white); }
.composer-button { width: 44px; min-height: 52px; align-self: stretch; border-right: 1px solid var(--line); font-size: 24px; }
.composer-button:hover,
.composer-button:focus-visible { background: var(--white); color: var(--black); outline: none; }
.file-picker-button {
  position: relative;
  overflow: hidden;
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  user-select: none;
}
.file-picker-button:focus-within { background: var(--white); color: var(--black); outline: none; }
.file-picker-button.is-disabled { opacity: .4; pointer-events: none; }
.file-input-native {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  opacity: 0;
  cursor: pointer;
  font-size: 100px;
}
#messageInput { min-height: 52px; max-height: min(220px, 30vh); padding: 14px 14px; resize: none; border: 0; background: transparent; font-size: 14px; line-height: 1.55; }
.send-button { width: 52px; min-width: 52px; min-height: 52px; align-self: stretch; padding: 0; display: inline-grid; place-items: center; border-left: 1px solid var(--line); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10px; letter-spacing: .1em; }
.send-button:hover,
.send-button:focus-visible { background: var(--white); color: var(--black); outline: none; }
.send-button:disabled { opacity: .4; cursor: not-allowed; }
.composer-meta { min-width: 0; gap: 16px; padding: 7px 2px 0; color: var(--muted-2); font-size: 8px; }

.sheet { position: fixed; inset: 0; z-index: 60; display: none; }
.sheet.open { display: block; }
.sheet-backdrop { position: absolute; inset: 0; width: 100%; height: 100%; padding: 0; border: 0; background: transparent; cursor: default; }
.sheet-panel {
  position: absolute;
  top: 0;
  right: 0;
  width: min(620px, 100%);
  height: 100%;
  padding: calc(20px + var(--safe-top)) calc(22px + var(--safe-right)) calc(22px + var(--safe-bottom)) 22px;
  overflow-y: auto;
  background: var(--panel);
  border-left: 1px solid var(--line-strong);
}
.sheet-header { gap: 20px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.sheet-header > div { min-width: 0; }
.sheet-header h2 { font-size: 22px; }
.sheet-header p { max-width: 460px; margin: 8px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.model-picker > .search-field { margin: 16px 0; }
.model-list { display: grid; border-top: 1px solid var(--line); }
.model-row { position: relative; min-width: 0; gap: 12px; padding: 13px 0 13px 12px; border-bottom: 1px solid var(--line); }
.model-row::before { content: ""; position: absolute; inset: 10px auto 10px 0; width: 3px; background: var(--line-strong); }
.model-row.access-premium { background: var(--premium-surface); }
.model-row.access-premium::before { background: var(--premium-accent); }
.model-row.access-paygo { background: var(--paygo-surface); }
.model-row.access-paygo::before { background: var(--paygo-accent); }
.model-row.access-free::before { background: var(--white); }
.model-row-main { min-width: 0; flex: 1 1 auto; gap: 12px; }
.model-index { width: 30px; flex: 0 0 auto; color: var(--muted-2); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 9px; }
.model-copy { min-width: 0; }
.model-copy strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.model-copy p { margin: 4px 0 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 10px; }
.model-meta { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; font-size: 8px; }
.model-meta span { padding: 3px 5px; border: 1px solid var(--line); color: var(--muted); }
.model-meta .access-badge { font-weight: 850; white-space: nowrap; }
.model-meta .access-badge.free { background: var(--white); color: var(--black); border-color: var(--white); }
.model-meta .access-badge.premium { background: var(--premium-surface); color: var(--premium-text); border-color: var(--premium-accent); }
.model-meta .access-badge.paygo { background: var(--paygo-surface); color: var(--paygo-text); border-color: var(--paygo-accent); }
.model-action { flex: 0 0 auto; min-width: 90px; min-height: 34px; padding: 7px 9px; border: 1px solid var(--line-strong); background: transparent; color: var(--white); font-size: 9px; text-transform: uppercase; letter-spacing: .06em; }
.model-action:hover,
.model-action:focus-visible { background: var(--white); color: var(--black); border-color: var(--white); outline: none; }
.model-action.selected { background: var(--white); color: var(--black); border-color: var(--white); cursor: default; }
.model-action:disabled { opacity: .42; cursor: not-allowed; }
.model-action.selected:disabled { opacity: 1; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-top: 15px; }
.pager button { min-height: 34px; padding: 7px 10px; border: 1px solid var(--line); background: transparent; color: var(--white); font-size: 10px; }
.pager button:hover:not(:disabled),
.pager button:focus-visible:not(:disabled) { background: var(--white); color: var(--black); outline: none; }
.pager button:disabled { opacity: .35; cursor: not-allowed; }
.pager span { color: var(--muted); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 9px; }

.settings-panel { width: min(570px, 100%); }
.settings-actions { display: grid; margin: 18px 0; border-top: 1px solid var(--line); }
.settings-link-button {
  min-height: 58px;
  padding: 10px 4px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--white);
  text-align: left;
}
.settings-link-button:hover,
.settings-link-button:focus-visible { padding-left: 10px; background: var(--white); color: var(--black); outline: none; }
.settings-link-button span:first-child { display: flex; align-items: center; gap: 14px; }
.settings-link-button small { color: inherit; opacity: .5; font-size: 8px; }
.settings-link-button strong { font-size: 13px; }
.settings-card { margin-top: 12px; padding: 15px; border: 1px solid var(--line); background: var(--black); }
.settings-card strong { font-size: 13px; }
.settings-card p { margin: 5px 0 0; color: var(--muted); font-size: 11px; line-height: 1.55; }
.setting-row { gap: 18px; }
.setting-row > div { min-width: 0; }
.field-label { display: block; margin-bottom: 8px; color: var(--muted); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 9px; letter-spacing: .08em; text-transform: uppercase; }
.settings-card textarea { min-height: 90px; margin-top: 12px; padding: 11px; resize: vertical; font-size: 12px; line-height: 1.5; }
.settings-card select { min-height: 44px; padding: 8px 10px; font-size: 12px; }
.button-row { justify-content: flex-start; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.button-row > button { flex: 1 1 140px; }
.compact-button { min-height: 34px; padding: 7px 10px; flex: 0 0 auto; }
.transaction-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.transaction-heading > div { min-width: 0; }
.text-button { min-height: 30px; padding: 5px 0; border: 0; background: transparent; color: var(--muted); font-size: 10px; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.text-button:hover,
.text-button:focus-visible { color: var(--white); outline: none; }
.transaction-list { display: grid; margin-top: 10px; border-top: 1px solid var(--line); }
.transaction-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.transaction-main { min-width: 0; }
.transaction-title-row { display: flex; align-items: baseline; flex-wrap: wrap; gap: 7px; }
.transaction-title-row strong { min-width: 0; overflow-wrap: anywhere; color: var(--soft-white); font-size: 12px; }
.transaction-title-row span { color: var(--muted-2); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 8px; letter-spacing: .06em; text-transform: uppercase; }
.transaction-main small { display: block; margin-top: 4px; color: var(--muted); font-size: 9px; line-height: 1.4; text-transform: capitalize; }
.transaction-values { display: grid; justify-items: end; align-content: start; gap: 3px; text-align: right; }
.transaction-values small { color: var(--muted); font-size: 9px; }
.transaction-amount { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; white-space: nowrap; }
.transaction-amount.positive { color: var(--soft-white); }
.transaction-amount.negative { color: var(--muted); }
.transaction-amount.neutral { color: var(--muted); }
.transaction-status { color: var(--muted-2); font-size: 8px; letter-spacing: .05em; text-transform: uppercase; }
.transaction-status.status-failed { color: var(--white); text-decoration: line-through; }
.transaction-status.status-pending,
.transaction-status.status-created { color: var(--paygo-text); }
.transaction-toggle { justify-self: start; margin-top: 10px; padding-bottom: 2px; }
.switch-control { position: relative; width: 46px; height: 24px; flex: 0 0 auto; }
.switch-control input { position: absolute; opacity: 0; pointer-events: none; }
.switch-control span { position: absolute; inset: 0; border: 1px solid var(--line-strong); background: transparent; cursor: pointer; }
.switch-control span::after { content: ""; position: absolute; top: 4px; left: 4px; width: 14px; height: 14px; background: var(--muted); transition: transform 120ms ease, background-color 120ms ease; }
.switch-control input:checked + span { border-color: var(--white); }
.switch-control input:checked + span::after { transform: translateX(22px); background: var(--white); }
.switch-control input:focus-visible + span { outline: 1px solid var(--white); outline-offset: 2px; }
.instruction-list { display: grid; margin-top: 11px; border-top: 1px solid var(--line); }
.instruction-item { min-width: 0; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.instruction-item span { min-width: 0; flex: 1 1 auto; overflow-wrap: anywhere; color: var(--soft-white); font-size: 11px; line-height: 1.45; }
.instruction-item button { width: 28px; height: 28px; flex: 0 0 auto; border: 1px solid var(--line); background: transparent; color: var(--muted); cursor: pointer; }
.instruction-item button:hover,
.instruction-item button:focus-visible { background: var(--white); color: var(--black); outline: none; }
.storage-card { border-style: dashed; }

.legal-panel { width: min(760px, 100%); }
.legal-tabs { gap: 8px; margin: 16px 0; }
.tab-button { min-height: 38px; padding: 8px 14px; border: 1px solid var(--line-strong); background: transparent; color: var(--white); font-size: 10px; text-transform: uppercase; letter-spacing: .06em; }
.tab-button.active,
.tab-button:hover,
.tab-button:focus-visible { background: var(--white); color: var(--black); border-color: var(--white); outline: none; }
.legal-content { padding: 8px 0 40px; color: var(--soft-white); font-size: 13px; line-height: 1.7; overflow-wrap: anywhere; }
.legal-content h1,
.legal-content h2,
.legal-content h3 { margin: 26px 0 10px; color: var(--white); }
.legal-content p { margin: 0 0 14px; }
.legal-section { margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--line); }
.legal-section h4 { margin: 0 0 10px; color: var(--white); font-size: 15px; line-height: 1.35; }
.legal-section h4 span { color: var(--muted); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; }
.legal-section ul,
.legal-section ol { margin: 8px 0 16px; padding-left: 22px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(22px + var(--safe-bottom));
  z-index: 100;
  max-width: min(520px, calc(100vw - 32px));
  padding: 11px 14px;
  transform: translate(-50%, 18px);
  border: 1px solid var(--white);
  background: var(--white);
  color: var(--black);
  opacity: 0;
  pointer-events: none;
  font-size: 11px;
  line-height: 1.45;
  transition: opacity 150ms ease, transform 150ms ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--black); color: var(--white); }

[dir="rtl"] .sidebar { border-right: 0; border-left: 1px solid var(--line); }
[dir="rtl"] .sheet-panel { right: auto; left: 0; border-left: 0; border-right: 1px solid var(--line-strong); }
[dir="rtl"] .selector-button,
[dir="rtl"] .footer-button,
[dir="rtl"] .settings-link-button,
[dir="rtl"] .conversation-item,
[dir="rtl"] .message-body,
[dir="rtl"] .model-copy { text-align: right; }
[dir="rtl"] .message-body ul,
[dir="rtl"] .message-body ol { padding-left: 0; padding-right: 22px; }
[dir="rtl"] .message-body blockquote { border-left: 0; border-right: 2px solid var(--white); padding-left: 0; padding-right: 14px; }

@media (max-width: 920px) {
  :root { --sidebar-width: 264px; }
  .messages,
  .composer-dock { padding-left: 20px; padding-right: 20px; }
  .empty-state-grid { grid-template-columns: 1fr; }
  .empty-state-grid button { min-height: 72px; }
  .empty-state-grid small { margin-bottom: 10px; }
}

@media (max-width: 760px) {
  .mobile-only { display: inline-grid !important; }
  .app-shell { display: block; min-height: 0; }
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(88vw, 340px);
    transform: translateX(-102%);
    transition: transform 180ms ease;
    box-shadow: none; border-right-color: var(--line-strong);
  }
  .app-shell.sidebar-open .sidebar { transform: translateX(0); }
  .sidebar-scrim {
    position: fixed;
    inset: 0;
    z-index: 15;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    background: transparent;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    display: block;
  }
  .app-shell.sidebar-open .sidebar-scrim { opacity: 1; visibility: visible; pointer-events: auto; }
  .workspace { height: var(--app-height); }
  .workspace-header { padding-left: 12px; padding-right: calc(12px + var(--safe-right)); }
  .workspace-title-copy h1 { max-width: 42vw; }
  .header-model-button { max-width: 42vw; }
  .messages { padding: 24px 15px 40px; }
  .composer-dock { padding: 8px 12px calc(10px + var(--safe-bottom)); }
  .composer-meta { font-size: 7px; }
  .message { margin-bottom: 28px; }
  .message-body { font-size: 14px; }
  .message.user .message-body { font-size: 15px; }
  .empty-state { min-height: 55%; }
  .empty-state h2 { font-size: clamp(32px, 11vw, 54px); }
  .sheet-panel { width: 100%; padding-left: 16px; padding-right: calc(16px + var(--safe-right)); border-left: 0; }
}

@media (max-width: 430px) {
  :root { --header-height: 66px; }
  .workspace-kicker { font-size: 8px; }
  .workspace-title-copy h1 { font-size: 14px; }
  .header-model-button { min-height: 36px; padding: 8px 9px; font-size: 10px; }
  .composer-frame { grid-template-columns: 42px minmax(0, 1fr) 42px; }
  .composer-button { width: 42px; }
  .send-button { width: 42px; min-width: 42px; padding: 0; }
  .composer-meta span:first-child { display: none; }
  .composer-meta { justify-content: flex-end; }
  .model-row { align-items: flex-start; }
  .model-action { min-width: 76px; }
  .message-asset { align-items: flex-start; flex-wrap: wrap; }
  .message-asset-copy { min-width: calc(100% - 52px); }
  .asset-download-button { width: 100%; }
}

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


/* v65: theme switcher, compact composer, model marks, and code folding. */
.icon-svg,
.send-icon,
.stop-icon {
  display: block;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}
.send-icon { width: 21px; height: 21px; stroke-width: 2; }
.stop-icon { width: 15px; height: 15px; fill: currentColor; stroke: none; }
.icon-button > .icon-svg { margin: 0; }
.theme-toggle-button { width: 40px; height: 40px; }
.theme-icon-moon { display: none; }
html[data-theme="light"] .theme-icon-sun { display: none; }
html[data-theme="light"] .theme-icon-moon { display: block; }
html[data-theme="light"] .code-content { color: #172033; }
html[data-theme="light"] .tok-comment { color: #56616f; }
html[data-theme="light"] .tok-string { color: #0b6b3a; }
html[data-theme="light"] .tok-number { color: #6f4500; }
html[data-theme="light"] .tok-keyword { color: #5321a8; }
html[data-theme="light"] .tok-built-in { color: #005a9c; }
html[data-theme="light"] .tok-constant { color: #8f3514; }
html[data-theme="light"] .tok-property { color: #005f59; }
html[data-theme="light"] .tok-operator { color: #971744; }

.support-contact {
  display: block;
  margin: -6px 0 18px;
  padding: 11px 4px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
  text-decoration: none;
}
.support-contact:hover,
.support-contact:focus-visible { color: var(--white); outline: none; }

.model-logo {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--panel-raised);
  color: var(--white);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: -.03em;
}
.model-logo img { width: 19px; height: 19px; display: block; object-fit: contain; }
.model-logo.provider-openai { background: #fff; color: #111; }
.model-logo.provider-anthropic { background: #d8c7b1; color: #17120f; }
.model-logo.provider-deepseek { background: #fff; color: #111; }
.model-logo.provider-google { background: #fff; color: #111; }
.model-logo.provider-kimi { background: #000; color: #fff; }
.model-logo.provider-kimi img { width: 30px; height: 30px; border-radius: 50%; object-fit: contain; }
.model-logo.provider-generic { background: var(--panel-raised); color: var(--white); }

.code-header { gap: 10px; }
.code-actions { display: inline-flex; align-items: center; gap: 6px; }
.code-collapse-button { min-width: 60px; }
.code-block.collapsible { position: relative; }
.code-block.collapsible::after {
  content: "";
  position: absolute;
  z-index: 2;
  right: 0;
  bottom: 0;
  left: 0;
  height: 112px;
  background: linear-gradient(to bottom, transparent 0%, var(--panel-raised) 82%, var(--panel-raised) 100%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms ease;
}
.code-block pre { transition: max-height 220ms ease; }
.code-block.collapsible.collapsed pre { max-height: 300px; overflow: hidden; }
.code-block.collapsible.collapsed::after { opacity: 1; }
.code-block.collapsible.collapsed { border-bottom-color: var(--white); }
.code-block.collapsible.collapsed .code-collapse-button { background: var(--white); color: var(--black); border-color: var(--white); }

@media (max-width: 760px) {
  .workspace-actions { gap: 6px; }
  .theme-toggle-button { width: 36px; height: 36px; }
  .header-model-button { max-width: min(42vw, 220px); }
}

@media (max-width: 430px) {
  .workspace-header { gap: 8px; }
  .workspace-title-group { gap: 7px; }
  .workspace-title-copy h1 { max-width: 30vw; }
  .workspace-actions { gap: 5px; }
  .header-model-button { max-width: 34vw; min-height: 36px; padding-left: 8px; padding-right: 8px; }
  .theme-toggle-button { width: 36px; height: 36px; }
  .composer-meta { justify-content: flex-start; }
}

@media (max-width: 360px) {
  .workspace-title-copy h1 { max-width: 22vw; font-size: 13px; }
  .header-model-button { max-width: 34vw; }
}

/* v67: normalize sidebar arrows and custom-instruction controls. */
.footer-arrow {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  display: grid;
  place-items: center;
  line-height: 0;
}
.footer-arrow svg { width: 18px; height: 18px; display: block; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: square; stroke-linejoin: miter; }
.instruction-item { display: grid; grid-template-columns: minmax(0, 1fr) 32px; align-items: center; gap: 10px; }
.instruction-item > span { min-width: 0; }
.instruction-item .instruction-delete {
  width: 32px;
  height: 32px;
  min-width: 32px;
  padding: 0;
  display: grid;
  place-items: center;
  line-height: 0;
}
.instruction-delete svg { width: 16px; height: 16px; display: block; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: square; }
.model-row.access-premium-paygo { background: var(--premium-surface); }
.model-row.access-premium-paygo::before { background: var(--premium-accent); }
.access-badge.premium-paygo { border-color: var(--premium-accent); color: var(--premium-accent); }

/* v73: transaction history is a standalone Settings card below Prices. */
.standalone-transaction-heading { margin-top: 0; padding-top: 0; border-top: 0; }

/* v74: resumable payments and referral program */
.continue-payment-link {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  margin-top: 8px;
  padding: 5px 9px;
  border: 1px solid var(--line-strong);
  color: var(--soft-white);
  font-size: 9px;
  line-height: 1.2;
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.continue-payment-link:hover,
.continue-payment-link:focus-visible {
  border-color: var(--white);
  background: var(--white);
  color: var(--black);
  outline: none;
}
.referral-card { overflow: hidden; }
.referral-heading { align-items: flex-start; }
.referral-link-label { margin-top: 14px; }
.referral-link-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}
.referral-link-row input {
  min-width: 0;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line);
  background: var(--black);
  color: var(--soft-white);
  font-size: 10px;
}
@media (max-width: 420px) {
  .referral-link-row { grid-template-columns: 1fr; }
  .referral-link-row button { width: 100%; }
}

/* v77: structured referral program and readable legal documents. */
.legal-document { display: grid; gap: 0; }
.legal-document > h1:first-child { margin-top: 4px; }
.legal-content .legal-document h1 {
  margin: 28px 0 8px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line-strong);
  font-size: clamp(22px, 5vw, 32px);
  line-height: 1.15;
  letter-spacing: -.025em;
}
.legal-content .legal-document h2 {
  margin: 30px 0 10px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  font-size: 17px;
  line-height: 1.35;
}
.legal-content .legal-document h3 {
  margin: 20px 0 8px;
  font-size: 14px;
  line-height: 1.4;
}
.legal-content .legal-document p { margin: 0 0 13px; color: var(--soft-white); }
.legal-content .legal-document blockquote {
  margin: 14px 0 18px;
  padding: 10px 13px;
  border-left: 2px solid var(--white);
  background: var(--panel);
  color: var(--soft-white);
}
.legal-content .legal-document ul,
.legal-content .legal-document ol { margin: 4px 0 16px; padding-left: 22px; }
.legal-content .legal-document li { margin: 6px 0; padding-left: 2px; }
.legal-content .legal-document hr { margin: 24px 0; border: 0; border-top: 1px solid var(--line); }
.legal-content .legal-document a { color: var(--white); text-decoration: underline; text-underline-offset: 3px; }
.legal-content .legal-document code {
  padding: 1px 4px;
  border: 1px solid var(--line);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .9em;
}
[dir="rtl"] .legal-content .legal-document blockquote { border-left: 0; border-right: 2px solid var(--white); }
[dir="rtl"] .legal-content .legal-document ul,
[dir="rtl"] .legal-content .legal-document ol { padding-left: 0; padding-right: 22px; }

