:root {
  color-scheme: dark;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #e0e0e0;
  background: #111111;
  --orange: #ff5722;
  --red: #d32f2f;
  --dock-height: 170px;
  --sidebar-offset: 0px;
  --chat-max-width: 900px;
  --chat-gutter: 24px;
}

* { box-sizing: border-box; }
body { margin: 0; overflow: hidden; }
button, textarea { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
.app { height: 100vh; height: 100dvh; min-height: 0; padding-top: env(safe-area-inset-top, 0px); margin-left: var(--sidebar-offset); display: flex; flex-direction: column; overflow: hidden; transition: margin-left .3s ease-in-out; }
[hidden] { display: none !important; }
body.sidebar-open { --sidebar-offset: 260px; }
.sidebar-toggle, .sidebar-close, .new-chat, .session-open, .session-delete {
  border-radius: 0; color: #e0e0e0; background: transparent; cursor: pointer;
}
.sidebar-toggle { position: fixed; left: max(16px, env(safe-area-inset-left, 0px)); top: calc(12px + env(safe-area-inset-top, 0px)); z-index: 6; width: 44px; height: 44px; display: grid; place-items: center; border: 0; color: #858585; transition: color .15s ease-out; }
.sidebar-toggle:hover, .session-delete:hover { color: var(--orange); border-color: var(--orange); }
.sidebar-open .sidebar-toggle { display: none; }
.history-sidebar { position: fixed; inset: 0 auto 0 0; z-index: 5; width: 260px; padding: calc(24px + env(safe-area-inset-top, 0px)) 16px max(20px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); background: #111111; border-right: 1px solid #39302c; display: flex; flex-direction: column; gap: 24px; transform: translateX(0); visibility: visible; transition: transform .3s ease-in-out, visibility 0s; }
.history-sidebar.sidebar-closed { transform: translateX(-100%); visibility: hidden; pointer-events: none; transition: transform .3s ease-in-out, visibility 0s linear .3s; }
.sidebar-heading { display: flex; justify-content: space-between; align-items: center; }
.sidebar-close { display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; color: #858585; font-size: 18px; line-height: 1; transition: color .15s ease-out; }
.sidebar-close:hover { color: var(--orange); }
.sidebar-close:focus-visible { outline: none; color: var(--orange); text-decoration: underline; text-underline-offset: 4px; }
.new-chat { align-self: flex-start; border: 0; color: #e67b59; padding: 10px 0; text-align: left; font-size: 13px; transition: color .15s ease-out, background-color .15s ease-out; }
.new-chat:hover { color: var(--orange); background: #ffffff06; }
.session-list { flex: 1; min-height: 0; overflow-y: auto; scrollbar-width: thin; scrollbar-color: #39302c transparent; }
.sidebar-actions { display: flex; flex-direction: column; flex-shrink: 0; gap: 2px; }
.sidebar-action { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 10px 0; border: 0; border-radius: 0; background: transparent; color: #858585; text-align: left; font-size: 13px; cursor: pointer; transition: color .15s ease-out, background-color .15s ease-out; }
.sidebar-action span { width: 14px; text-align: center; font-size: 16px; line-height: 1; }
.sidebar-action:hover:enabled { color: var(--orange); background: #ffffff06; }
.sidebar-action:focus-visible { color: var(--orange); outline: 1px solid var(--orange); outline-offset: 3px; }
.sidebar-action:disabled { opacity: .45; cursor: default; }
.sidebar-footer { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; flex-shrink: 0; }
.settings-toggle { display: grid; place-items: center; width: 44px; height: 44px; margin-left: -10px; padding: 0; border: 0; border-radius: 0; background: transparent; color: var(--orange); font-size: 22px; cursor: pointer; }
.settings-toggle:hover { background: #ffffff06; }
.settings-toggle:focus-visible, .settings-close:focus-visible { outline: 1px solid var(--orange); outline-offset: 3px; }
.settings-dialog { width: min(360px, calc(100% - 32px)); max-height: calc(100dvh - 32px); padding: 20px; border: 1px solid #49403b; border-radius: 0; background: #111111; color: #e0e0e0; }
.settings-dialog::backdrop { background: #0009; }
.settings-heading { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.settings-heading h2 { margin: 0; }
.settings-close { display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 0; background: transparent; color: #858585; font-size: 18px; cursor: pointer; }
.settings-close:hover { color: var(--orange); }
.settings-note { margin: 16px 0; color: #929292; font-size: 12px; line-height: 1.6; }
.session-row { display: flex; align-items: stretch; margin-bottom: 8px; border-left: 2px solid transparent; }
.session-row.is-active { border-color: var(--orange); background: #ff57220a; }
.session-open { flex: 1; min-width: 0; padding: 12px 10px; border: 0; text-align: left; }
.session-row.is-active .session-title { color: var(--orange); }
.session-title { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.session-date { display: block; margin-top: 6px; color: #858585; font-size: 10px; }
.session-delete { flex: 0 0 32px; border: 0; color: #858585; font-size: 15px; }
.session-open:hover { background: #ffffff06; }
.vault-caption, .history-empty { margin: 0; color: #858585; font-size: 10px; letter-spacing: .08em; line-height: 1.6; }
.history-empty { padding: 8px 10px; letter-spacing: 0; font-size: 12px; }
.storage-status { margin: 8px 0 0; color: #efb0a7; font-size: 11px; }
.sidebar-backdrop { position: fixed; inset: 0; z-index: 4; border: 0; border-radius: 0; background: #0009; }
.sidebar-toggle:focus-visible, .new-chat:focus-visible, .session-open:focus-visible, .session-delete:focus-visible { outline: 1px solid var(--orange); outline-offset: 3px; }
.header { flex: 0 0 64px; min-width: 0; display: flex; align-items: center; gap: 12px; padding: 8px var(--chat-gutter) 8px 64px; }
.sidebar-open .header { padding-left: var(--chat-gutter); }
.sidebar-brand, .header-brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.sidebar-brand { position: relative; width: 164px; height: 44px; flex-shrink: 0; overflow: hidden; }
/* Account for the supplied image's outer padding, aligning its visible lettering. */
.sidebar-wordmark, .header-wordmark { position: absolute; display: block; width: 200px; height: auto; max-width: none; left: -15px; top: 50%; transform: translateY(-47%); }
.sidebar-close { flex-shrink: 0; }
.header-brand { position: relative; width: 164px; height: 44px; flex: 0 0 164px; overflow: hidden; }
.sidebar-open .header-brand { display: none; }
.brand-copy { min-width: 0; }
.brand-name { display: block; color: var(--orange); font-size: 13px; font-weight: 650; letter-spacing: .14em; }
.install-app { display: none; border: 0; border-radius: 0; min-height: 44px; padding: 8px 0; background: #111111; color: var(--orange); font-size: 11px; line-height: 16px; cursor: pointer; }
.install-app.is-available { display: inline-block; }
.install-app:hover { background: #1a1a1a; }
.install-app:focus-visible { outline: 1px solid var(--orange); outline-offset: 3px; }
.install-app:disabled { opacity: .5; cursor: default; }
.logo {
  display: block;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border-radius: 0;
  object-fit: contain;
  filter: drop-shadow(0 0 12px #ff57222b);
}
.sidebar-brand .logo { width: 36px; height: 36px; }
.tagline { display: block; margin: 5px 0 0; color: #929292; font-size: 9px; line-height: 1.4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-panel { flex: 1; min-height: 0; width: 100%; max-width: var(--chat-max-width); margin: 0 auto; display: flex; flex-direction: column; }
.conversation {
  flex: 1;
  min-height: 0;
  width: 100%;
  margin: 0;
  padding: 0 var(--chat-gutter);
  display: flex;
  flex-direction: column;
}
.messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #39302c transparent;
  padding: 12px 0 24px;
  scroll-padding-bottom: 24px;
  scroll-behavior: auto;
  overflow-anchor: none;
}
.messages:has(> .empty-state) { display: grid; place-items: center; padding: 0; }
.empty-state { padding: 24px 0; text-align: center; }
.eyebrow { color: var(--orange); font-size: 10px; font-weight: 650; letter-spacing: .2em; }
.empty-state h1 { margin: 0; font-size: clamp(30px, 5vw, 46px); font-weight: 550; line-height: 1.15; letter-spacing: -.045em; }
.message { margin: 0 0 24px; }
.message-actions { display: flex; gap: 12px; min-height: 32px; opacity: 0; pointer-events: none; }
.message:hover .message-actions, .message:focus-within .message-actions { opacity: 1; pointer-events: auto; }
.message-action, .message-edit button, .message-menu button { min-height: 44px; padding: 4px 0; border: 0; border-radius: 0; background: transparent; color: #858585; font: inherit; font-size: 12px; cursor: pointer; }
.message-action:hover, .message-edit button:hover, .message-menu button:hover { color: var(--orange); }
.message-action:focus-visible, .message-edit button:focus-visible, .message-menu button:focus-visible { outline: 1px solid var(--orange); outline-offset: 3px; }
.message-action:disabled, .message-edit button:disabled { opacity: .4; cursor: default; }
.message-edit { display: flex; flex-wrap: wrap; gap: 12px; }
.message-edit textarea { flex: 1 0 100%; min-height: 100px; max-height: 320px; border-bottom: 1px solid var(--orange); }
.message-edit-error { flex-basis: 100%; margin: 0; color: #efb0a7; font-size: 12px; }
.message-menu { width: min(280px, calc(100% - 32px)); padding: 16px 24px; border: 1px solid #49403b; border-radius: 0; color: #e0e0e0; background: #111111; }
.message-menu::backdrop { background: #0009; }
.message-menu button { display: block; width: 100%; text-align: left; }
.message-toast { position: fixed; z-index: 10; left: 50%; bottom: 180px; transform: translateX(-50%); margin: 0; padding: 10px 16px; border: 1px solid #49403b; background: #181818; color: #e0e0e0; font-size: 12px; }
@media (hover: none) { .message-actions { display: none; } .message-body { -webkit-touch-callout: none; } }
.message-meta { display: flex; align-items: center; justify-content: space-between; padding: 0 2px; margin-bottom: 9px; }
.message-author { font-size: 12px; font-weight: 600; }
.message--assistant .message-author { color: var(--orange); letter-spacing: .06em; }
.message-time { color: #7d7d7d; font-size: 11px; }
.message-body { margin: 0; padding: 18px 20px; border-radius: 8px; background: #242424; line-height: 1.65; font-size: 15px; white-space: pre-wrap; overflow-wrap: anywhere; }
.message--assistant .message-body { background: #090909; border-left: 2px solid var(--orange); }
.message--assistant .message-body--error { border-left-color: var(--red); color: #efb0a7; }
.fade-in-word { position: relative; animation: fade-in-word .2s ease-out both; }
@keyframes fade-in-word {
  from { opacity: 0; top: 3px; }
  to { opacity: 1; top: 0; }
}
.stream-error { color: #efb0a7; }
.composer-dock {
  flex: 0 0 auto;
  width: 100%;
  z-index: 2;
  padding: 12px var(--chat-gutter) max(14px, env(safe-area-inset-bottom, 0px));
  background: #111111;
}
.composer { display: flex; align-items: flex-end; gap: 12px; padding: 10px 10px 10px 18px; border: 1px solid #49403b; border-radius: 12px; background: #181818; transition: border-color .18s, box-shadow .18s; }
.composer:focus-within { border-color: var(--orange); box-shadow: 0 0 0 1px #ff57221a, 0 0 24px #ff57221c; }
textarea { display: block; flex: 1; min-width: 0; width: 100%; min-height: 44px; max-height: 160px; resize: none; border: 0; outline: none; padding: 11px 0; background: transparent; color: #e0e0e0; font-size: 15px; line-height: 22px; }
textarea::placeholder { color: #858585; }
.attach-image { display: grid; place-items: center; flex: 0 0 44px; height: 44px; padding: 0; border: 0; background: transparent; color: #858585; cursor: pointer; }
.attach-image:hover:enabled, #remove-image:hover { color: var(--orange); }
.attach-image:disabled { opacity: .4; cursor: default; }
.attach-image:focus-visible, #remove-image:focus-visible { outline: 1px solid var(--orange); outline-offset: 2px; }
.image-attachment { display: flex; align-items: center; gap: 10px; margin-top: 8px; color: #929292; font-size: 12px; }
.image-attachment img { width: 48px; height: 48px; object-fit: contain; }
.image-attachment span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
#remove-image { width: 44px; height: 44px; border: 0; background: transparent; color: #858585; cursor: pointer; }
.image-status { margin: 8px 0 0; font-size: 12px; color: #efb0a7; }
.message-image { display: block; max-width: 100%; max-height: 320px; object-fit: contain; margin-top: 12px; }
.send-button { display: grid; place-items: center; flex: 0 0 44px; height: 44px; border: 0; border-radius: 4px; color: #fff; background: var(--orange); cursor: pointer; transition: background .18s, box-shadow .18s; }
.send-button:hover:enabled { background: #ee4817; box-shadow: 0 0 18px #ff572233; }
.send-button:active:enabled { background: var(--red); }
.send-button:disabled { opacity: .4; cursor: default; }
.send-button:focus-visible { outline: 2px solid #e0e0e0; outline-offset: 4px; }
.composer-footer { width: 100%; max-width: var(--chat-max-width); margin: 0 auto; text-align: center; }
.keyboard-hint { margin: 9px 0 0; text-align: center; color: #777; font-size: 10px; }
.keyboard-hint span { margin: 0 5px; }
footer { display: flex; justify-content: center; align-items: center; gap: 8px; margin-top: 12px; }
footer p { margin: 0; color: #858585; font-size: 11px; line-height: 1.5; }
.status-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--orange); opacity: .7; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
@media (max-width: 520px) {
  .message-body { padding: 15px 16px; }
  footer p { font-size: 10px; }
}
@media (max-width: 760px) {
  :root { --chat-gutter: 14px; }
  textarea { font-size: 16px; }
  .app { height: var(--mobile-viewport-height, 100dvh); position: relative; top: var(--mobile-viewport-offset, 0px); }
  .header { flex-basis: 56px; padding-left: 56px; }
  .header-brand { gap: 8px; }
  .header-brand .logo { width: 28px; height: 28px; }
  .header-brand .brand-name { font-size: 11px; }
  .header-brand .tagline { font-size: 8px; }
  .install-app { font-size: 10px; }
  .keyboard-hint { display: none; }
  body.sidebar-open { --sidebar-offset: 0px; }
  .history-sidebar { width: min(280px, calc(100vw - 48px)); }
  .sidebar-toggle { top: calc(8px + env(safe-area-inset-top, 0px)); left: max(10px, env(safe-area-inset-left, 0px)); }
  .composer-dock { padding-bottom: max(8px, calc(env(safe-area-inset-bottom, 0px) - var(--keyboard-inset, 0px))); }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }
