:root {
  color-scheme: dark;
  font: 100%/1.45 "Segoe UI", system-ui, sans-serif;
  color: #f7f3f5;
  background: #070608;
  --line: #ffffff13;
  --muted: #aaa3a9;
  --side: clamp(14.5rem, 22vw, 18.5rem);
  --column: 67rem;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  height: 100vh;
  height: 100dvh;
  display: grid;
  grid-template-columns: var(--side) minmax(0, 1fr);
  overflow: hidden;
}
button, textarea, input { font: inherit; }
button { cursor: pointer; color: inherit; background: none; border: 0; }
button:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 2px solid #ef849f;
  outline-offset: 3px;
}
[hidden], .symbols { display: none !important; }
.icon {
  width: 1.16rem;
  height: 1.16rem;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.65;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon-button, .model-badge, .send {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  border-radius: .78rem;
}
.icon-button, .model-badge { border: 1px solid #ffffff25; min-height: 2.65rem; }
.icon-button { width: 2.8rem; }
button:hover { background-color: #ffffff0c; }
#sidebar {
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: linear-gradient(160deg,#09080a,#080709 65%,#0b090c);
  border-right: 1px solid var(--line);
  padding: 1rem clamp(.8rem,1.25vw,1.15rem) .8rem;
}
.side-head { display: flex; align-items: center; justify-content: space-between; gap: .6rem; margin-bottom: 1.75rem; }
.wordmark { width: clamp(7.5rem,11.25vw,9.5rem); height: auto; margin-left: .25rem; }
.side-head .icon-button { border-color: var(--line); }
.nav-item {
  display: flex;
  gap: .82rem;
  align-items: center;
  text-align: left;
  width: 100%;
  border-radius: .7rem;
  padding: .68rem 1rem;
  font-size: .96rem;
  min-height: 2.75rem;
}
.nav-item + .nav-item { margin-top: .13rem; }
.nav-item .icon { width: 1.22rem; height: 1.22rem; }
.new-chat {
  background: linear-gradient(105deg,#690224,#54031e);
  box-shadow: inset 0 0 0 1px #a312392b;
  margin-bottom: 1.18rem;
}
.new-chat:hover { background: #78072d; }
.selected { background: #ffffff0f; }
.history { flex: 1; min-height: 0; overflow: auto; margin-top: 1.2rem; border-top: 1px solid var(--line); padding-top: 1.05rem; }
.history h2, #emptyHistory { font-size: .82rem; font-weight: 400; color: var(--muted); margin: 0 .72rem .8rem; }
#emptyHistory { color: #91888e; margin-top: .4rem; }
.history-item {
  display: flex;
  gap: .65rem;
  align-items: center;
  text-align: left;
  padding: .65rem .75rem;
  width: 100%;
  border-radius: .6rem;
  font-size: .91rem;
}
.history-item[aria-current=true] { background: #ffffff0a; }
.history-icon { position: relative; flex: none; width: .9rem; height: .76rem; border: 1.25px solid currentColor; border-radius: .23rem .23rem .23rem 0; }
.history-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile { display: flex; align-items: center; gap: .7rem; padding: .65rem; margin: .75rem -.25rem 0; border: 1px solid var(--line); border-radius: .85rem; background: #ffffff02; }
.avatar { display: grid; place-items: center; width: 2.48rem; height: 2.48rem; border-radius: .58rem; font-size: 1.05rem; font-weight: 650; background: linear-gradient(140deg,#322d33,#201d21); }
.profile-copy { flex: 1; min-width: 0; }
.profile-copy strong { display: block; font-size: .91rem; font-weight: 500; }
.profile .icon-button { border: 0; width: 1.8rem; }
.connection { display: flex; align-items: center; gap: .37rem; color: var(--muted); font-size: .75rem; }
.connection::before { content: ""; flex: none; width: .46rem; height: .46rem; border-radius: 50%; background: #aa8062; }
.connection.ready::before { background: #44cf83; box-shadow: 0 0 .4rem #2ab87450; }
.workspace {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0,1fr) auto;
  padding-bottom: clamp(1.2rem,13.6vh,8rem);
  background: radial-gradient(ellipse 44% 57% at 0% -8%,#3c001bbd,transparent 75%),
              radial-gradient(ellipse 55% 85% at 101% 107%,#400620b8,transparent 76%), #060507;
}
.toolbar { display: flex; align-items: center; justify-content: flex-end; gap: .95rem; padding: 1rem 1.4rem .55rem; }
.toolbar .icon-button, .model-badge { background-color: #0a090be0; }
.toolbar button:hover { background-color: #19141a; }
.model-badge { gap: .72rem; border-radius: .9rem; padding: 0 .9rem; font-size: .94rem; }
.model-badge .icon:last-child { width: .92rem; }
.reopen, .scrim { display: none; }
body.sidebar-collapsed { grid-template-columns: minmax(0,1fr); }
.sidebar-collapsed #sidebar { display: none; }
.sidebar-collapsed .reopen { display: inline-flex; margin-right: auto; }
#conversation { min-height: 0; overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; }
#conversation:has(.is-streaming) { overflow-anchor: none; }
.welcome { margin: auto; display: flex; flex-direction: column; align-items: center; padding: 1rem; text-align: center; }
.hero-logo { width: clamp(9rem,14.4vw,13.4rem); height: auto; }
.welcome h1 { margin: clamp(1.45rem,4.8vh,2.5rem) 0 0; font-size: clamp(1.18rem,1.85vw,1.7rem); font-weight: 410; letter-spacing: -.025em; color: #b0a9ae; }
.messages, .dock { width: min(calc(100% - clamp(2.5rem,7vw,7.5rem)),var(--column)); margin-inline: auto; }
.messages:empty { display: none; }
.messages { display: grid; gap: 1.45rem; padding: 1.5rem 0 2rem; }
.message { min-width: 0; max-width: 90%; }
.message small { display: block; color: #b2a7b0; font-size: .79rem; margin-bottom: .35rem; }
.message p { white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; line-height: 1.62; }
.message.user { justify-self: end; background: #231019; border: 1px solid #63263c80; border-radius: 1.1rem 1.1rem .3rem 1.1rem; padding: .75rem 1.05rem; }
.message.assistant { justify-self: start; padding-left: .8rem; border-left: 2px solid #850b38; }
.message.assistant small:first-child { color: #df97b1; font-weight: 650; }
.dock { align-self: end; }
#feedback { font-size: .87rem; color: #f1bacb; margin: 0 .4rem .5rem; }
#feedback:empty { display: none; }
#modelQuota {
  position: relative; flex: none; align-self: flex-start; margin-top: .65rem; z-index: 2;
}
.quota-ring {
  display: grid; place-items: center; position: relative; width: 2.625rem; height: 2.625rem;
}
.quota-ring::after {
  content: ""; position: absolute; pointer-events: none; width: .46rem; height: .46rem;
  border-radius: .07rem; background: #fff; transform: rotate(45deg);
}
.quota-arc {
  position: absolute; inset: .42rem; border-radius: 50%; pointer-events: none;
  background: conic-gradient(from 270deg, transparent 0 8deg, #faedf2 8deg var(--quota-sweep, 8deg),
    #94556f var(--quota-sweep, 8deg) 172deg, transparent 172deg);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 1.5px), #000 calc(100% - 1px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 1.5px), #000 calc(100% - 1px));
}
.quota-arc-bottom { transform: rotate(180deg); }
.quota-ring.is-single .quota-arc:not(.quota-arc-bottom) {
  background: conic-gradient(from 270deg, #faedf2 var(--quota-sweep, 0deg), #94556f 0);
}
.quota-ring button {
  position: absolute; inset: 0 0 50%; z-index: 1; padding: 0;
  border-radius: 99px 99px 0 0; background: transparent;
}
.quota-ring #quotaTriggerWeekly { inset: 50% 0 0; border-radius: 0 0 99px 99px; }
.quota-ring.is-single #quotaTrigger { inset: 0; border-radius: 50%; }
.quota-ring button:focus-visible { outline-offset: 1px; }
#quotaPanel, #quotaHint, #quotaHintWeekly {
  position: absolute; inset: auto auto calc(100% + .5rem) 0;
  width: min(15rem, calc(88vw - 2rem)); border: 1px solid var(--border);
  border-radius: .8rem; background: var(--surface); color: var(--secondary);
  box-shadow: 0 .55rem 1.5rem #0004; font-size: .8rem; line-height: 1.4;
}
#quotaPanel { display: grid; gap: .65rem; padding: .8rem; max-height: 55vh; overflow: auto; }
#quotaHint, #quotaHintWeekly { padding: .5rem .65rem; width: max-content; max-width: calc(100vw - 2rem); pointer-events: none; }
.quota-period { display: grid; min-width: 0; }
.quota-weekly { gap: .3rem; padding-top: .55rem; border-top: 1px solid var(--border); }
.quota-details { display: grid; min-width: 0; overflow-wrap: anywhere; }
.quota-heading { display: flex; justify-content: space-between; gap: .35rem; align-items: baseline; color: var(--text); font-weight: 650; }
.quota-heading strong { flex: none; font-variant-numeric: tabular-nums; }
.quota-usage { text-align: start; padding: .55rem .2rem .1rem; border-top: 1px solid var(--border); color: var(--text-link); }
.quota-switch {
  justify-self: start; min-height: 2rem; max-width: 100%; padding: .25rem .55rem;
  border: 1px solid var(--look-accent); border-radius: .5rem; color: var(--text-link); font-weight: 600;
}
.quota-switch:hover { background: var(--surface-hover); }
#quotaSwitchCompact { display: none; margin: .4rem 0 0 auto; font-size: .76rem; }
body.sidebar-collapsed #quotaSwitchCompact { display: block; }
@media (max-width: 760px) {
  body:not(.sidebar-open) #quotaSwitchCompact { display: block; }
  body.sidebar-open #quotaSwitchCompact { display: none; }
}
#send:disabled { background: var(--surface-active); color: var(--secondary); box-shadow: none; filter: none; cursor: default; }
#composer { display: flex; align-items: center; gap: .55rem; padding: .56rem .7rem; background: linear-gradient(100deg,#141315ed,#1a1419ec); border: 1px solid #ffffff3c; border-radius: 1.1rem; box-shadow: 0 5px 24px #0003; }
#composer:focus-within { border-color: #ae5a78; }
#attachFile { border: 0; min-height: 2.5rem; width: 2.25rem; }
#attachFile .icon { width: 1.32rem; height: 1.32rem; }
textarea {
  display: block;
  flex: 1;
  min-width: 0;
  min-height: 1.7rem;
  max-height: 25dvh;
  field-sizing: content;
  resize: none;
  color: inherit;
  background: transparent;
  border: 0;
  line-height: 1.65;
  padding: .08rem .15rem;
}
textarea:focus-visible { outline: none; }
textarea::placeholder { color: #b2aaaf; }
.send { width: 2.72rem; height: 2.6rem; background: linear-gradient(140deg,#8c0836,#57031e); border: 1px solid #8b0b3359; box-shadow: 0 0 1.15rem #84042d29; }
.send:hover { background: #970638; }
#dictate[aria-pressed="false"] .mic-active,
#dictate[aria-pressed="true"] .mic-idle { display: none; }
#dictate[aria-pressed="true"] { outline: 2px solid var(--text-link); outline-offset: 2px; }
.suggestions { display: flex; justify-content: center; flex-wrap: wrap; gap: clamp(.4rem,1.5vw,1.1rem); margin-top: 1.32rem; }
.suggestions button { display: inline-flex; align-items: center; justify-content: center; gap: .62rem; font-size: .875rem; padding: .65rem 1.2rem; border-radius: 99rem; border: 1px solid var(--line); background: #ffffff09; }
.suggestions button:hover { background: #351321; border-color: #71304b; }
.suggestions .icon { width: 1.05rem; height: 1.05rem; }
.has-messages .suggestions { display: none; }
.has-messages .workspace { padding-bottom: max(1.25rem,env(safe-area-inset-bottom)); }
dialog { width: min(25rem,calc(100vw - 2rem)); color: inherit; background: #151015; border: 1px solid #4d3440; border-radius: 1.1rem; padding: 1.35rem; box-shadow: 0 1.5rem 5rem #000a; }
dialog::backdrop { background: #030204ba; }
.dialog-head, dl div, .setting { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.dialog-head h2 { margin: 0; font-size: 1.35rem; font-weight: 600; }
.dialog-head .icon-button { min-height: 2rem; width: 2rem; border: 0; }
dl { margin: 1rem 0 0; }
dl div, .setting { padding: .75rem 0; border-top: 1px solid var(--line); }
dt, .setting small { color: var(--muted); }
dd { margin: 0; text-align: right; }
.setting { margin-top: .85rem; }
.setting small { display: block; }
.setting input { width: 1.2rem; height: 1.2rem; accent-color: #a2184a; }
@media (max-width: 760px) {
  body { grid-template-columns: minmax(0,1fr); }
  #sidebar, .sidebar-collapsed #sidebar { display: none; position: fixed; inset: 0 auto 0 0; width: min(18rem,88vw); z-index: 5; }
  .sidebar-open #sidebar { display: flex; }
  .sidebar-open .scrim { display: block; position: fixed; inset: 0; z-index: 4; background: #0009; }
  .reopen { display: inline-flex; margin-right: auto; }
  .toolbar { gap: .5rem; padding: .75rem .85rem; }
  .workspace { padding-bottom: max(1.1rem,env(safe-area-inset-bottom)); }
  .hero-logo { width: clamp(8rem,30vw,10rem); }
  .dock, .messages { width: calc(100% - 1.5rem); }
  .suggestions { gap: .4rem; margin-top: .8rem; }
  .suggestions button { padding: .45rem .65rem; font-size: .81rem; gap: .34rem; }
  .wordmark { width: 9rem; }
}
@media (max-height: 490px) {
  .workspace { padding-bottom: .6rem; }
  .welcome { padding: .3rem; }
  .hero-logo { width: 5rem; }
  .welcome h1 { margin-top: .45rem; }
  .suggestions { margin-top: .45rem; }
}

/* Reply formatting and tools */
.messages { grid-template-columns: minmax(0, 1fr); }
.message-body { min-width: 0; line-height: 1.62; }
.user .message-body { white-space: pre-wrap; overflow-wrap: anywhere; }
.message.assistant { width: 100%; max-width: 100%; }
.message-body :is(h3, blockquote, ul, ol) { margin: .7rem 0; overflow-wrap: anywhere; }
.message-body :is(ul, ol) { padding-inline-start: 1.55rem; }
.message-body blockquote { padding-inline-start: .75rem; border-inline-start: 2px solid #85435e; color: var(--muted); }
.message-body p + p { margin-top: .7rem; }
.message-body a { color: #f49fba; }
.message-body :not(pre) > code { background: #32212c; color: #f8c0d2; border-radius: .3rem; padding: .1em .3em; }
.code-block { border: 1px solid #44313a; background: #0c0a0e; border-radius: .85rem; overflow: hidden; margin: .85rem 0; }
.code-header { display: flex; align-items: center; gap: .15rem; flex-wrap: wrap; padding: .27rem .55rem; background: #21161d; border-bottom: 1px solid #ffffff14; }
.code-header > span { margin-right: auto; color: #f5bbcf; font: 600 .82rem/1.4 "Cascadia Mono", monospace; }
.code-header button { padding: .34rem .44rem; border-radius: .4rem; font-size: .8rem; color: #eadce4; min-height: 2rem; }
.code-body { display: flex; overflow-x: auto; }
.code-body pre { margin: 0; padding: .65rem .8rem; font: .9rem/1.55 "Cascadia Mono", Consolas, monospace; tab-size: 4; flex: none; }
.code-body code { font: inherit; }
.code-body .line-numbers { position: sticky; left: 0; text-align: right; user-select: none; background: #171219; color: #a195a0; padding-inline: .6rem; }
.syntax-keyword { color: #e7a6f0; }
.syntax-string { color: #b6d58e; }
.syntax-number { color: #f1c77e; }
.syntax-comment { color: #a397a0; }
.syntax-directive { color: #9bd8a1; }
.syntax-operator { color: #85d0df; }
.syntax-call { color: #9ebfff; }

/* Composer menu and profile */
#composer { display: grid; gap: .3rem; align-items: stretch; }
#prompt { width: 100%; padding: .35rem .5rem .2rem; }
.composer-controls { display: flex; align-items: center; gap: .45rem; min-width: 0; }
#modelBadge { margin-left: auto; min-width: 0; max-width: 75%; min-height: 2.45rem; border-color: transparent; color: #e1ccd6; padding-inline: .55rem; }
#modelName { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#localInfo { margin-left: auto; }
.panel-popover { color: inherit; background: #21171e; border: 1px solid #503747; border-radius: .85rem; padding: .45rem; box-shadow: 0 1rem 2.4rem #0009; }
.panel-popover[data-fallback-popover] { display: block; z-index: 6; }
#modelBadge { anchor-name: --model-anchor; }
#modelPicker {
  position: fixed; margin: 0; inset: auto 1rem 8rem auto;
  width: min(25rem,calc(100vw - 1.5rem)); max-height: min(20rem,55vh); max-height: min(20rem,55dvh); overflow: auto;
}
#profileSettings { anchor-name: --profile-anchor; }
#profileMenu { position: fixed; margin: 0; inset: auto auto 4.8rem .65rem; width: min(16rem,calc(100vw - 1.3rem)); }
@supports (bottom: anchor(top)) {
  #modelPicker { position-anchor: --model-anchor; bottom: calc(anchor(top) + .35rem); right: max(.65rem,anchor(right)); }
  #profileMenu { position-anchor: --profile-anchor; bottom: calc(anchor(top) + .65rem); }
}
.model-search { display: flex; gap: .4rem; }
.model-search input, .account-form input, .analytics-range select {
  color: inherit; background: #130e14; border: 1px solid #624254; border-radius: .5rem; padding: .45rem .6rem; min-width: 0;
}
.model-search input { flex: 1; }
.model-search button, .accent-button { background: #63122e; border-radius: .5rem; padding: .45rem .65rem; }
#modelList { display: grid; gap: .2rem; margin-top: .4rem; }
#modelList button, #profileMenu > button { width: 100%; text-align: left; padding: .52rem .6rem; border-radius: .48rem; }
#modelList button { display: flex; align-items: center; gap: .6rem; }
#modelList button[aria-pressed=true] { background: #62213b; }
#modelList button[aria-pressed=true]::after { content: "✓"; margin-left: auto; color: #ffd0e0; }
#modelList button span { overflow-wrap: anywhere; min-width: 0; }
#modelList small, #modelNotice, .menu-identity small { color: #c3aab8; }
#modelList small:empty, #modelNotice:empty, #accountNotice:empty { display: none; }
#modelNotice { margin: .5rem; font-size: .875rem; }
.menu-identity { display: grid; gap: .16rem; border-bottom: 1px solid var(--line); padding: .5rem .6rem .7rem; margin-bottom: .3rem; overflow-wrap: anywhere; }
#profileName { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-form { display: grid; gap: .75rem; margin-top: .85rem; }
.account-form label { display: grid; gap: .35rem; }
.account-form button { justify-self: start; }
#analyticsDialog { width: min(55rem,calc(100vw - 1.5rem)); max-height: calc(100dvh - 2rem); }
.analytics-range { display: flex; align-items: center; gap: .7rem; margin: 1rem 0; }
.analytics-summary { display: grid; grid-template-columns: repeat(auto-fit,minmax(6rem,1fr)); gap: .55rem; }
.analytics-summary > div { display: grid; gap: .18rem; background: #251821; border: 1px solid #3f2b3b; border-radius: .6rem; padding: .55rem .68rem; }
.analytics-summary span, #analyticsNotice, .chart-dates { color: var(--muted); font-size: .84rem; }
.analytics-summary strong { color: #ffb6ce; font-size: 1.17rem; }
#analyticsDialog h3 { font-size: .98rem; font-weight: 550; margin: 1.2rem 0 .55rem; }
.analytics-chart { min-height: 5.6rem; background: #110d13; border-radius: .55rem; padding: .7rem; display: flex; align-items: end; flex-wrap: wrap; gap: .28rem; }
.analytics-chart meter { writing-mode: vertical-lr; direction: rtl; flex: 1 1 2px; min-width: 2px; max-width: 2rem; height: 5.5rem; min-height: 5.5rem; }
.analytics-chart meter::-webkit-meter-optimum-value { background: #e5739b; }
.analytics-chart meter::-moz-meter-bar { background: #e5739b; }
.chart-dates { display: flex; justify-content: space-between; flex: 1 0 100%; }
.table-scroll { overflow: auto; }
#analyticsDialog table { width: 100%; border-collapse: collapse; font-size: .88rem; text-align: right; }
#analyticsDialog :is(th,td) { padding: .5rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
#analyticsDialog :is(th,td):first-child { text-align: left; }
@media (max-width: 760px) {
  #modelPicker { right: .75rem; }
  .message.assistant { padding-left: .35rem; }
  .code-header { gap: 0; padding-inline: .3rem; }
  .code-header button { padding-inline: .34rem; }
  .code-body pre { font-size: .84rem; }
  #modelBadge { font-size: .84rem; gap: .4rem; }
}


/* Neutral surfaces and readable chat text */
:root {
  --page: #171719;
  --side-bg: #121214;
  --surface: #202022;
  --surface-hover: #2b2b2e;
  --surface-active: #303034;
  --secondary: #a6a5aa;
  --text: #e7e7e8;
  --border: #353538;
  --look-accent: #842440;
  --on-accent: #fff;
  --message-bg: #262628;
  --text-link: #ed9eb7;
  --chat-size: 1rem;
  --code-size: .88rem;
  color: var(--text);
  background: var(--page);
  font-family: system-ui, "Segoe UI", sans-serif;
}
:root[data-chat-size="small"] { --chat-size: .9rem; --code-size: .8rem; }
:root[data-chat-size="large"] { --chat-size: 1.125rem; --code-size: 1rem; }
:root[data-accent="neutral"] { --look-accent: #505055; }
:root[data-theme="light"] {
  color-scheme: light;
  --page: #f6f5f6;
  --side-bg: #ecebed;
  --surface: #ffffff;
  --surface-hover: #eae8eb;
  --surface-active: #e4e2e5;
  --secondary: #57555b;
  --muted: #5f5d63;
  --text: #242327;
  --border: #d8d5d9;
  --line: #d8d5d9;
  --message-bg: #eae7ea;
  --text-link: #8a2046;
}
@media (prefers-color-scheme: light) {
:root[data-theme="system"] {
  color-scheme: light;
  --page: #f6f5f6;
  --side-bg: #ecebed;
  --surface: #ffffff;
  --surface-hover: #eae8eb;
  --surface-active: #e4e2e5;
  --secondary: #57555b;
  --muted: #5f5d63;
  --text: #242327;
  --border: #d8d5d9;
  --line: #d8d5d9;
  --message-bg: #eae7ea;
  --text-link: #8a2046;
}
}
#sidebar, .workspace, .toolbar .icon-button, #composer, .panel-popover,
dialog:not(#settingsDialog), .message.user { box-shadow: none; }
#sidebar { background: var(--side-bg); border-color: var(--border); }
.workspace { background: var(--page); }
.toolbar .icon-button, #composer, .panel-popover, dialog:not(#settingsDialog) {
  background: var(--surface); border-color: var(--border);
}
.toolbar button:hover, #modelBadge:hover, #attachFile:hover, .nav-item:not(.new-chat):hover,
#profileMenu button:hover, #modelList button:hover { background: var(--surface-hover); }
.selected, .history-item[aria-current=true], #modelList button[aria-pressed=true] { background: var(--surface-active); }
.new-chat, .send, .accent-button, .model-search button {
  color: var(--on-accent); background: var(--look-accent); border-color: transparent; box-shadow: none;
}
.new-chat:hover, .send:hover, .accent-button:hover, .model-search button:hover {
  background: var(--look-accent); filter: brightness(1.15);
}
#modelBadge, #modelList button[aria-pressed=true]::after { color: var(--text); }
.model-search input, .account-form input, .analytics-range select { background: var(--page); border-color: var(--border); }
#modelList small, #modelNotice, .menu-identity small, .connection, .message small,
.message.assistant small:first-child, #emptyHistory, #feedback, textarea::placeholder { color: var(--secondary); }
.messages, .dock { --column: 49rem; }
.workspace { padding-bottom: clamp(1rem, 15vh, 8rem); }
.welcome { margin: auto auto 0; padding: 0 1rem 1.5rem; }
.welcome h1 { margin: 0; font-size: clamp(1.33rem,2.3vw,1.65rem); letter-spacing: -.015em; font-weight: 450; color: var(--text); }
.message.user { background: var(--message-bg); border-color: var(--border); }
.message.assistant { padding-inline-start: 0; border: 0; }
.message-body, .message-body p, #prompt { font-size: var(--chat-size); line-height: 1.55; }
.message-body h3 { font-weight: 600; }
.message-body a { color: var(--text-link); }
.analytics-summary > div, .analytics-chart { background: var(--surface); border-color: var(--border); }
.analytics-summary strong { color: var(--text-link); }
.code-body pre { font-size: var(--code-size); }
.hide-line-numbers .line-numbers, .suggestions, .has-messages .recent-chats { display: none; }
.show-suggestions:not(.has-messages) .suggestions { display: flex; }
.suggestions button { background: var(--surface); border-color: var(--border); }
.suggestions button:hover { background: var(--surface-hover); border-color: var(--border); }
.recent-chats { margin: 1.4rem clamp(.1rem,5vw,3rem) 0; }
.recent-chats h2 { color: var(--secondary); font-size: .83rem; font-weight: 500; margin: 0 0 .35rem; }
#recentList button {
  display: flex; justify-content: space-between; align-items: center; gap: .65rem;
  width: 100%; padding: .38rem .45rem; text-align: left; border-radius: .4rem; font-size: .91rem;
}
#recentList button:hover { background: var(--surface-hover); }
#recentList time { white-space: nowrap; color: var(--secondary); font-size: .78rem; }

/* Full settings panel */
#settingsDialog {
  width: min(80rem,calc(100vw - 2.5rem)); height: min(53rem,calc(100dvh - 2.5rem));
  max-width: none; max-height: none; padding: 0; overflow: hidden;
  background: var(--page); color: var(--text); border: 1px solid var(--border); border-radius: 1.25rem;
}
#preferences { display: grid; grid-template-rows: auto minmax(0,1fr) auto; height: 100%; }
.pref-header, .pref-footer { display: flex; align-items: center; gap: .8rem; padding: .65rem 1rem; }
.pref-header { border-bottom: 1px solid var(--border); }
.pref-header span { color: var(--secondary); font-size: .82rem; margin-left: auto; }
.pref-header strong { color: var(--text); font-weight: 600; }
.pref-back { padding: .38rem .6rem; border-radius: .45rem; font-size: .9rem; }
.pref-layout { display: grid; grid-template-columns: 14rem minmax(0,1fr); min-height: 0; }
.pref-nav { overflow: auto; background: var(--side-bg); border-right: 1px solid var(--border); padding: .95rem .7rem; }
.pref-nav p { font-size: .76rem; color: var(--secondary); margin: .95rem .45rem .3rem; }
.pref-nav button { display: flex; align-items: center; gap: .55rem; padding: .48rem .55rem; width: 100%; text-align: left; border-radius: .48rem; font-size: .89rem; }
.pref-nav .icon { width: .92rem; height: .92rem; }
.pref-nav button[aria-current="page"] { background: var(--surface-active); font-weight: 600; }
.pref-nav button:hover, .pref-content button:hover, .pref-back:hover { background: var(--surface-hover); }
#prefNoResults { display: block; margin: .6rem .45rem; color: var(--secondary); font-size: .84rem; }
.pref-content { overflow: auto; padding: clamp(1rem,3vw,2rem); }
.pref-page { max-width: 53rem; }
.pref-page h2 { font-size: 1.1rem; font-weight: 620; margin: 0 0 .85rem; }
.pref-row, .pref-field { border-bottom: 1px solid var(--border); padding: .8rem 0; }
.pref-row { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.pref-row p, .pref-field p, #prefModelList { margin: .25rem 0 0; color: var(--secondary); font-size: .83rem; }
.pref-row label, .pref-field label { font-size: .93rem; color: var(--text); }
.pref-nav input, .pref-content :is(select,input:not([type="checkbox"]),textarea,button) {
  background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: .55rem;
  padding: .42rem .6rem; font-size: .87rem;
}
.pref-nav input { width: 100%; }
.pref-content :is(select,input[type="number"]) { width: min(9.5rem,40%); flex: none; }
.pref-field textarea { width: 100%; display: block; margin-top: .55rem; min-height: 5rem; max-height: 18rem; resize: vertical; }
.pref-switch { width: 1.15rem; height: 1.15rem; accent-color: var(--look-accent); flex: none; }
.pref-advanced { margin-top: 1rem; }
.pref-advanced summary { cursor: pointer; width: fit-content; padding: .2rem 0; font-size: .89rem; }
.pref-footer { justify-content: flex-end; border-top: 1px solid var(--border); }
.pref-footer output { color: var(--secondary); font-size: .85rem; }
.pref-footer button { background: var(--text); color: var(--page); padding: .48rem .8rem; border-radius: .52rem; font-size: .87rem; font-weight: 600; }
.pref-footer button:hover { filter: contrast(.82); }
@media (max-width: 640px) {
  #settingsDialog { width: calc(100vw - .8rem); height: calc(100dvh - .8rem); border-radius: .85rem; }
  .pref-layout { display: flex; flex-direction: column; }
  .pref-nav { display: flex; flex: none; flex-wrap: wrap; gap: .25rem; border-right: 0; border-bottom: 1px solid var(--border); padding: .6rem .65rem; }
  .pref-nav p { display: none; }
  .pref-nav button { width: auto; padding: .33rem .45rem; font-size: .82rem; }
  .pref-nav button .icon { display: none; }
  .pref-nav input { margin-bottom: .3rem; }
  .pref-content { min-height: 0; }
  .pref-row button { max-width: 48%; }
  .workspace { padding-bottom: max(1rem,env(safe-area-inset-bottom)); }
  .recent-chats { max-height: 7rem; overflow: auto; }
  .welcome { padding-bottom: .8rem; }
}


.hero-logo { width: clamp(5.5rem,11vw,8.25rem); max-height: 23dvh; object-fit: contain; }
.welcome { gap: .65rem; }
:root[data-scale="90"] { font-size: 90%; }
:root[data-scale="110"] { font-size: 110%; }
:root[data-scale="125"] { font-size: 125%; }
:root[data-font-face="sans"] { font-family: Arial, sans-serif; }
:root[data-font-face="serif"] { font-family: Georgia, serif; }
:root[data-font-face="mono"] { font-family: Consolas, monospace; }
.wide-chat :is(.messages,.dock) { --column: 75rem; }
.high-contrast { --secondary: var(--text); --muted: var(--text); --border: var(--text); }
.high-contrast :focus-visible { outline: 3px solid var(--text); outline-offset: 3px; }
.high-contrast #composer:focus-within { outline: 2px solid var(--text); }
.bubble-chat .message.assistant { padding: .85rem 1rem; border: 1px solid var(--border); border-radius: 1rem 1rem 1rem .3rem; background: var(--surface); }
.message .plain-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.stream-fade .is-streaming { animation: reveal-reply .25s ease-out; }
.stream-fade .is-streaming > :last-child { animation: reveal-reply .18s ease-out; }
@keyframes reveal-reply { from { opacity: .52; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .stream-fade .is-streaming, .stream-fade .is-streaming > :last-child { animation: none; } }
.quiet-button, .reply-actions button, #cancelQueue {
  border-radius: .5rem; padding: .4rem .55rem; color: var(--secondary); font-size: .82rem;
}
.quiet-button[aria-pressed="true"] { color: var(--on-accent); background: var(--look-accent); }
.toolbar { justify-content: flex-start; gap: .45rem; }
.toolbar .reopen { margin-right: 0; }
.reply-actions { display: flex; flex-wrap: wrap; gap: .2rem; margin-top: .4rem; }
.reply-actions button:hover, .quiet-button:hover, #cancelQueue:hover { background: var(--surface-hover); }
#queuedMessage { display: flex; align-items: center; gap: .5rem; justify-content: space-between; padding: .35rem .5rem; margin-bottom: .5rem; border: 1px solid var(--border); border-radius: .55rem; background: var(--surface); font-size: .85rem; }
#queuedMessage span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
#settingsDialog { width: calc(100vw - 2rem); height: calc(100dvh - 2rem); }
.pref-page { max-width: none; }
.pref-inline { display: flex; flex-wrap: wrap; gap: .45rem; margin-top: .7rem; }
.pref-list { margin: .65rem 0; color: var(--secondary); font-size: .87rem; }
.pref-list > div { display: flex; align-items: center; justify-content: space-between; gap: .65rem; padding: .46rem 0; border-bottom: 1px solid var(--border); }
.pref-list span { overflow-wrap: anywhere; }
.pref-content > section > button { margin-top: .7rem; }
#settingsDialog :is(a,output) { color: var(--text-link); }
.pref-nav button:not(:has(.icon)) { padding-inline-start: 2rem; }
.pref-switch {
  appearance: none; position: relative; cursor: pointer; width: 2.15rem; height: 1.18rem;
  border: 1px solid var(--border); border-radius: 1rem; background: var(--surface-active);
}
.pref-switch::before {
  content: ""; width: .78rem; height: .78rem; border-radius: 50%; background: var(--secondary);
  position: absolute; top: 50%; left: .15rem; transform: translateY(-50%);
}
.pref-switch:checked { background: var(--look-accent); }
.pref-switch:checked::before { left: auto; right: .15rem; background: var(--on-accent); }
@media (max-width: 640px) {
  .pref-nav button:not(:has(.icon)) { padding-inline-start: .45rem; }
  .pref-nav { max-height: min(11.5rem, 32dvh); flex-shrink: 0; }
  #settingsDialog { width: calc(100vw - .8rem); height: calc(100dvh - .8rem); }
  .hero-logo { width: clamp(5rem,23vw,7.5rem); }
}


.workspace { position: relative; isolation: isolate; }
#chatBackground { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .2; pointer-events: none; z-index: -1; }
.custom-colors :is(#composer,.message.user) { color: var(--text); background: color-mix(in srgb,var(--page) 83%,var(--text)); }
.pref-row input[type="color"] { width: 3rem; height: 2rem; padding: .2rem; }
.usage-grid { display: grid; grid-template-columns: repeat(14,minmax(0,1fr)); max-width: 42rem; gap: .25rem; margin: .9rem 0; }
.usage-grid.weekly { grid-template-columns: repeat(12,minmax(0,1fr)); }
.usage-grid span { height: .75rem; border-radius: .2rem; background: var(--surface-active); }
.usage-grid [data-level="1"] { background: color-mix(in srgb,var(--look-accent) 35%,var(--surface-active)); }
.usage-grid [data-level="2"] { background: color-mix(in srgb,var(--look-accent) 62%,var(--surface-active)); }
.usage-grid [data-level="3"] { background: color-mix(in srgb,var(--look-accent) 80%,var(--surface-active)); }
.usage-grid [data-level="4"] { background: var(--look-accent); }


#chatTags { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--secondary); font-size: .8rem; }
#followUps { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .55rem; }
#followUps button { max-width: 100%; padding: .35rem .55rem; border-radius: .5rem; background: var(--surface); border: 1px solid var(--border); font-size: .82rem; text-align: left; }
#followUps button:hover { background: var(--surface-hover); }


.auth-body { display: grid; grid-template-columns: minmax(0,1fr); place-items: center; min-height: 100dvh; height: auto; overflow: auto; padding: 1.5rem; }
.auth-card { width: min(100%, 25rem); background: var(--side-bg); border: 1px solid var(--border); border-radius: 1rem; padding: 1.65rem; }
.auth-card img { width: 8.5rem; height: auto; }
.auth-card h1 { font-size: 1.5rem; font-weight: 550; margin: 1rem 0; }
.auth-card a, #profileMenu a { color: var(--text-link); }
.auth-card a { display: inline-block; margin-top: .85rem; }
.auth-fields, .auth-fields label { display: grid; gap: .45rem; }
.auth-fields { gap: .75rem; }
.auth-fields :is(input,select) { min-width: 0; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: .5rem; padding: .65rem .7rem; }
.auth-primary { color: var(--on-accent); background: var(--look-accent); border-radius: .55rem; padding: .65rem; }
.auth-primary:hover { background: var(--look-accent); filter: brightness(1.12); }
.auth-error { color: #ffb1c3; background: #3c1421; border-radius: .55rem; padding: .6rem; font-size: .9rem; }
.auth-providers { display: grid; gap: .35rem; border-top: 1px solid var(--border); padding-top: .8rem; margin-top: .9rem; }
.auth-providers button { width: 100%; text-align: left; border-radius: .5rem; padding: .58rem .65rem; background: var(--surface); }
.auth-providers button:hover { background: var(--surface-hover); }
.auth-choices { border-top: 0; padding-top: 0; margin-bottom: 1.15rem; gap: .6rem; }
.auth-card .auth-choice { display: block; margin-top: 0; border: 1px solid var(--border); border-radius: .5rem; background: var(--surface); padding: .58rem .65rem; }
.auth-choices small { color: var(--muted); }
.auth-method { font-size: .95rem; font-weight: 550; margin: 0 0 .75rem; }
#profileMenu :is(a,form button) { display: block; padding: .52rem .6rem; width: 100%; text-align: left; border-radius: .48rem; }
#profileMenu a:hover { background: var(--surface-hover); }

.usage-legend { display: flex; gap: .75rem; font-size: .78rem; color: var(--secondary); margin-bottom: .45rem; }
.usage-legend span { display: inline-flex; align-items: center; gap: .3rem; }
.usage-legend span::before { content: ""; width: .55rem; height: .55rem; border-radius: .13rem; }
.usage-input-key::before, .usage-input { background: var(--look-accent); }
.usage-output-key::before, .usage-output { background: var(--text-link); }
#analyticsChart { display: block; overflow: auto; padding: .65rem; border: 1px solid var(--border); }
.usage-series { display: flex; gap: .2rem; }
.usage-day {
  display: grid; grid-template-rows: minmax(0,1fr) auto; justify-items: center; align-items: stretch;
  gap: .3rem; flex: 1 0 2.15rem; min-width: 0; height: 8rem; padding: .2rem;
  border-radius: .35rem; border: 1px solid transparent; font-size: .72rem;
}
.usage-day[aria-pressed=true] { border-color: var(--look-accent); background: var(--surface-hover); }
.usage-day:focus-visible { outline-offset: -2px; }
.usage-track {
  display: flex; flex-direction: column-reverse; justify-content: flex-start;
  width: min(90%,1.8rem); border-radius: .15rem; overflow: hidden; border-bottom: 1px solid var(--border);
}
.usage-track span { display: block; flex: none; }
.usage-day-label { white-space: nowrap; color: var(--secondary); }
.usage-day-detail { margin: .4rem 0 0; color: var(--secondary); font-size: .8rem; }
