:root {
  color-scheme: dark;
  --bg: #030303;
  --sidebar: #1b1b1b;
  --panel: #080808;
  --surface: #0d0d0d;
  --surface-2: #131313;
  --surface-3: #191919;
  --line: #202020;
  --line-soft: #171717;
  --text: #f3f3f3;
  --muted: #9a9a9a;
  --muted-2: #666;
  --accent: #fff;
  --success: #8be3b4;
  font-family: "Inter", "Noto Sans Thai", system-ui, sans-serif;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f7f7f5;
  --sidebar: #f1f1ee;
  --panel: #fbfbfa;
  --surface: #fff;
  --surface-2: #f0f0ed;
  --surface-3: #e8e8e5;
  --line: #deded9;
  --line-soft: #e9e9e5;
  --text: #171717;
  --muted: #696969;
  --muted-2: #8a8a8a;
  --accent: #171717;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; overflow: hidden; background: var(--bg); color: var(--text); }
button, textarea, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
[hidden] { 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; }

.shell { display: grid; grid-template-columns: 282px minmax(0, 1fr); height: 100dvh; transition: grid-template-columns .3s cubic-bezier(.22,1,.36,1); }
.sidebar { min-width: 0; display: flex; flex-direction: column; padding: 16px 14px 12px; background: var(--sidebar); border-right: 1px solid rgba(255,255,255,.045); box-shadow: inset -1px 0 rgba(0,0,0,.18); transition: width .22s ease, padding .22s ease, transform .22s ease; z-index: 40; }
.sidebar-head { position: relative; min-height: 68px; padding: 0 4px; transition: min-height .3s cubic-bezier(.22,1,.36,1); }
.brand-lockup { position: absolute; top: 0; left: 4px; display: flex; align-items: center; width: 170px; height: 38px; color: var(--text); text-decoration: none; transform: translateX(0); transition: left .3s cubic-bezier(.22,1,.36,1), width .3s cubic-bezier(.22,1,.36,1), height .3s cubic-bezier(.22,1,.36,1), transform .3s cubic-bezier(.22,1,.36,1); }
.brand-animated-logo { display: flex; align-items: center; gap: 10px; width: auto; transform: scale(.92); transform-origin: center left; transition: gap .3s cubic-bezier(.22,1,.36,1), transform .3s cubic-bezier(.22,1,.36,1); }
.brand-thinking-face { flex: 0 0 64px; }
.brand-thinking-face, .brand-thinking-face .thinking-eye, .brand-thinking-face .thinking-mouth { animation-duration: 4.2s; animation-delay: -.8s; }
.brand-thinking-face .thinking-eye-left { animation-name: brand-left-eye; }
.brand-thinking-face .thinking-eye-right { animation-name: brand-right-eye; }
.brand-thinking-face .thinking-mouth { animation-name: brand-mouth; }
.brand-copy { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-width: 0; }
.brand-wordmark { max-width: 92px; overflow: hidden; color: #f5f5f3; font-size: 13px; font-weight: 600; line-height: 1; letter-spacing: .28em; white-space: nowrap; opacity: 1; transform: translateX(0); transition: max-width .3s cubic-bezier(.22,1,.36,1), font-size .3s cubic-bezier(.22,1,.36,1), letter-spacing .3s cubic-bezier(.22,1,.36,1), opacity .2s ease, transform .3s cubic-bezier(.22,1,.36,1); }
.brand-plan { max-width: 92px; overflow: hidden; color: #a3a3a3; font-size: 13px; font-weight: 600; line-height: 1; letter-spacing: .2em; white-space: nowrap; opacity: 1; transform: translateX(0); transition: max-width .3s cubic-bezier(.22,1,.36,1), opacity .2s ease, transform .3s cubic-bezier(.22,1,.36,1); }
.icon-button { display: inline-grid; place-items: center; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 9px; background: transparent; cursor: pointer; color: #bdbdbd; font-size: 20px; }
.icon-button:hover { background: rgba(255,255,255,.07); color: var(--text); }
.collapse-button { position: absolute; top: 1px; right: 0; display: inline-flex; align-items: center; justify-content: center; gap: 5px; width: 66px; height: 30px; padding: 0 7px; overflow: hidden; border: 1px solid rgba(255,255,255,.04); border-radius: 999px; background: rgba(0,0,0,.22); color: #bdbdbd; font-size: 14px; transform: translateX(0); transition: top .3s cubic-bezier(.22,1,.36,1), right .3s cubic-bezier(.22,1,.36,1), width .3s cubic-bezier(.22,1,.36,1), transform .3s cubic-bezier(.22,1,.36,1), border-color .18s ease, background-color .18s ease, color .18s ease; }
.collapse-button::after { content: "ย่อ"; order: 2; font-size: 11.5px; font-weight: 500; line-height: 1; white-space: nowrap; animation: collapse-copy-in-right .32s cubic-bezier(.22,1,.36,1) both; }
.collapse-button i { order: 1; width: 13px; line-height: 1; transition: transform .22s cubic-bezier(.22,1,.36,1); }
.collapse-button i::before { content: "\ea64"; }
.collapse-button:hover { border-color: rgba(255,255,255,.075); background: rgba(0,0,0,.34); color: #f1f1f1; }
.collapse-button:hover i { transform: translateX(-1px); }
.new-chat { display: flex; align-items: center; gap: 11px; min-height: 40px; padding: 0 12px; margin: 0 0 8px; border-radius: 999px; background: rgba(0,0,0,.28); border: 1px solid transparent; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; cursor: pointer; color: #f0f0f0; font-size: 12.5px; font-weight: 500; text-align: left; transition: border-color .18s ease, background-color .18s ease, color .18s ease; }
.new-chat:hover { background: rgba(0,0,0,.42); border-color: rgba(255,255,255,.055); box-shadow: none; transform: none; }
.new-chat i { font-size: 18px; }
.primary-nav { display: flex; flex-direction: column; gap: 2px; padding: 0; }
.nav-item { display: flex; align-items: center; gap: 11px; min-height: 38px; width: 100%; padding: 0 11px; border: 1px solid transparent; border-radius: 12px; background: transparent; cursor: pointer; text-align: left; color: #d0d0d0; font-size: 12.5px; transition: border-color .18s ease, background-color .18s ease, color .18s ease; }
.nav-item i { width: 18px; text-align: center; font-size: 17px; }
.nav-item:hover { border-color: transparent; background: rgba(255,255,255,.055); box-shadow: none; color: var(--text); transform: none; }
.nav-item.active { border-color: transparent; background: rgba(255,255,255,.075); box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; color: #fff; }
.new-chat:focus-visible, .nav-item:focus-visible, .session:focus-visible, .account-card:focus-visible, .collapse-button:focus-visible { outline: 2px solid rgba(255,255,255,.72); outline-offset: 2px; }
.sidebar-divider { height: 0; background: transparent; margin: 14px 8px 8px; }
.section-label { padding: 0 10px 6px; color: #858585; font-size: 10.5px; font-weight: 500; }
.sessions { display: flex; flex: 1 1 auto; flex-direction: column; gap: 2px; min-height: 0; overflow-y: auto; padding-right: 2px; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.12) transparent; }
.sessions::-webkit-scrollbar { width: 4px; }
.sessions::-webkit-scrollbar-thumb { border-radius: 999px; background: rgba(255,255,255,.12); }
.session { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 8px; width: 100%; min-height: 36px; padding: 8px 10px; border: 0; border-radius: 12px; background: transparent; color: #bdbdbd; cursor: pointer; text-align: left; font-size: 11.5px; }
.session:hover, .session.active { color: var(--text); background: rgba(255,255,255,.065); }
.session strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 400; }
.session time { color: var(--muted-2); font-size: 10px; }
.session-skeleton { height: 36px; margin: 1px 6px; border-radius: 12px; background: rgba(255,255,255,.045); opacity: .72; }
.session-skeleton.short { width: 72%; }
.account-card { display: grid; grid-template-columns: 36px minmax(0,1fr) auto; align-items: center; gap: 10px; width: 100%; min-height: 58px; margin-top: 10px; padding: 9px 10px; border: 1px solid rgba(255,255,255,.045); border-radius: 16px; background: rgba(255,255,255,.035); cursor: pointer; color: #efefef; text-align: left; transition: background-color .18s ease, border-color .18s ease; }
.account-card:hover { background: rgba(255,255,255,.065); border-color: rgba(255,255,255,.075); }
.avatar { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: rgba(255,255,255,.075); border: 1px solid rgba(255,255,255,.055); overflow: hidden; }
.avatar img { width: 24px; height: 24px; object-fit: contain; }
.account-copy { min-width: 0; }
.account-copy strong, .account-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-copy strong { font-size: 11.5px; font-weight: 500; }
.account-copy small { margin-top: 3px; color: #858585; font-size: 9.5px; }
.account-card > i { color: #aaa; font-size: 16px; }

.app-main { position: relative; min-width: 0; display: grid; grid-template-rows: minmax(0,1fr); height: 100dvh; }
.mobile-menu { display: none; }

.content-grid { min-height: 0; display: grid; grid-template-columns: minmax(0,1fr); }
.chat-pane { min-width: 0; min-height: 0; display: grid; grid-template-rows: minmax(0,1fr) auto auto; background: var(--bg); }
.pricing-view { min-width: 0; min-height: 0; height: 100dvh; overflow-y: auto; background: var(--bg); }
.new-chat-welcome { display: none; }
.chat-pane.new-chat-state { grid-template-rows: minmax(0,1fr) auto auto minmax(0,1fr); }
.chat-pane.new-chat-state .new-chat-welcome { display: block; grid-row: 2; width: min(870px, calc(100% - 60px)); margin: 0 auto 22px; text-align: center; animation: new-chat-welcome-in .42s cubic-bezier(.22,1,.36,1) both; }
.chat-pane.new-chat-state .new-chat-welcome h1 { margin: 0; color: #f2f2f0; font-size: clamp(24px, 2.2vw, 32px); font-weight: 600; line-height: 1.35; letter-spacing: -.025em; text-wrap: balance; }
.chat-pane.new-chat-state .composer-wrap { grid-row: 3; align-self: start; padding-bottom: 0; animation: new-chat-composer-in .34s cubic-bezier(.22,1,.36,1) both; }
.chat-scroll { min-height: 0; overflow-y: auto; scroll-behavior: smooth; }
.thread { width: min(844px, calc(100% - 70px)); margin: 0 auto; padding: 75px 0 30px; }
.message { display: grid; grid-template-columns: 50px minmax(0,1fr); gap: 12px; margin: 0 0 28px; }
.message-avatar { display: grid; place-items: center; width: 46px; height: 46px; border: 1px solid #292929; border-radius: 50%; background: #050505; overflow: hidden; }
.message-avatar img { width: 29px; height: 29px; object-fit: contain; }
.message-main { min-width: 0; }
.message-meta { display: flex; align-items: baseline; gap: 13px; min-height: 27px; font-size: 12px; }
.message-meta strong { font-weight: 500; }
.message-meta time { color: var(--muted-2); font-size: 10px; }
.bubble { display: inline-block; max-width: 610px; padding: 13px 16px; border-radius: 8px; background: var(--surface-3); color: #ddd; font-size: 13px; line-height: 1.62; }
.bubble p { margin: 0; }
.bubble p + p { margin-top: 8px; }
.assistant-text-blur-root { min-width: 0; }
.message.assistant .bubble { padding: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
.message.user { display: flex; flex-direction: column; align-items: flex-end; margin: 8px 0 34px; }
.message.user .message-main { display: flex; flex-direction: column; align-items: flex-end; width: min(610px, 82%); }
.message.user .message-meta { padding-right: 8px; }
.message.user .bubble { width: 100%; text-align: left; background: var(--surface-2); border: 1px solid var(--line); }
.message.user .message-avatar { display: none; }
.message.thinking .bubble { min-width: 0; padding: 4px 0; border: 0; background: transparent; color: var(--muted); box-shadow: none; }
.thinking-status { display: grid; place-items: center; width: 72px; min-height: 34px; }
.thinking-face { position: relative; display: block; width: 64px; height: 32px; animation: thinking-face-drift 3.2s ease-in-out infinite; }
.thinking-eye, .thinking-mouth { position: absolute; display: block; background: #f5f5f3; transform-origin: center; will-change: transform, border-radius; }
.thinking-eye { top: 4px; width: 11px; height: 20px; border-radius: 6px; }
.thinking-eye-left { left: 8px; animation: thinking-left-eye 3.2s ease-in-out infinite; }
.thinking-eye-right { right: 8px; animation: thinking-right-eye 3.2s ease-in-out infinite; }
.thinking-mouth { top: 19px; left: 26px; width: 12px; height: 7px; border-radius: 2px 2px 7px 7px; animation: thinking-mouth 3.2s ease-in-out infinite; }
.quick-actions { display: flex; justify-content: center; gap: 12px; width: min(820px, calc(100% - 70px)); margin: 0 auto 27px; }
.quick-actions { scrollbar-width: none; }
.quick-actions::-webkit-scrollbar { display: none; }
.quick-actions button { display: inline-flex; align-items: center; justify-content: center; gap: 9px; min-height: 46px; padding: 0 17px; border: 1px solid var(--line); border-radius: 8px; background: #090909; color: #cfcfcf; cursor: pointer; white-space: nowrap; font-size: 12px; }
.quick-actions button:hover { background: var(--surface-2); color: var(--text); border-color: #343434; }
.quick-actions i { font-size: 17px; }
.composer-wrap { position: relative; z-index: 20; width: min(870px, calc(100% - 60px)); margin: 0 auto; padding: 0 0 30px; }
.composer-wrap > p { margin: 10px 0 0; color: var(--muted-2); text-align: center; font-size: 10px; }

.utility-view { min-height: 0; overflow-y: auto; padding: 52px max(36px, 8vw); }
.utility-shell { max-width: 780px; margin: 0 auto; }
.utility-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; padding-bottom: 24px; border-bottom: 1px solid var(--line); }
.utility-head h1 { margin: 0 0 8px; font-size: 28px; }
.utility-head p { margin: 0; color: var(--muted); font-size: 13px; }
.back-to-chat { min-height: 38px; padding: 0 13px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); cursor: pointer; }
.utility-list { display: grid; gap: 10px; margin-top: 25px; }
.utility-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 16px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); }
.utility-row > div { display: flex; align-items: center; gap: 13px; }
.utility-row i { font-size: 20px; }
.utility-row strong { display: block; font-size: 13px; }
.utility-row small { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; }
.toggle { width: 34px; height: 19px; padding: 2px; border: 0; border-radius: 99px; background: #333; cursor: pointer; }
.toggle::after { content: ""; display: block; width: 15px; height: 15px; border-radius: 50%; background: #ddd; transform: translateX(0); transition: .2s; }
.toggle.on { background: #d7d7d7; }
.toggle.on::after { background: #171717; transform: translateX(15px); }

.popover { position: fixed; z-index: 80; top: 66px; right: 54px; width: 260px; padding: 16px; border: 1px solid var(--line); border-radius: 9px; background: #111; box-shadow: 0 20px 60px rgba(0,0,0,.45); }
.popover strong { font-size: 12px; }
.popover p { margin: 8px 0 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.account-popover { top: auto; right: auto; bottom: 74px; left: 26px; width: 225px; }
.account-popover button, .account-popover a { display: flex; align-items: center; gap: 9px; width: 100%; padding: 9px 7px; border: 0; border-radius: 6px; background: transparent; color: #ddd; text-decoration: none; cursor: pointer; font-size: 11px; }
.account-popover button:hover, .account-popover a:hover { background: #1a1a1a; }
.account-popover-profile { margin: -2px 0 8px; padding: 2px 7px 12px; border-bottom: 1px solid var(--line); }
.account-popover-profile strong, .account-popover-profile small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-popover-profile strong { font-size: 12px; font-weight: 600; }
.account-popover-profile small { margin-top: 4px; color: var(--muted); font-size: 10px; }

.auth-modal { position: fixed; inset: 0; z-index: 120; display: grid; place-items: center; overflow-y: auto; padding: 24px; }
.auth-modal[hidden] { display: none; }
.auth-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.78); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
.auth-dialog { position: relative; z-index: 1; width: min(440px, 100%); padding: 34px; border: 1px solid rgba(255,255,255,.14); border-radius: 24px; background: radial-gradient(100% 70% at 50% 0, rgba(255,255,255,.07), transparent 60%), #0b0b0b; box-shadow: 0 42px 130px rgba(0,0,0,.72); }
.auth-close { position: absolute; top: 16px; right: 16px; display: grid; place-items: center; width: 34px; height: 34px; padding: 0; border: 1px solid transparent; border-radius: 50%; background: transparent; color: #aaa; cursor: pointer; font-size: 20px; }
.auth-close:hover { border-color: var(--line); background: rgba(255,255,255,.04); color: #fff; }
.auth-brand { display: grid; place-items: center; width: 48px; height: 48px; margin-bottom: 20px; border: 1px solid rgba(255,255,255,.12); border-radius: 50%; background: rgba(255,255,255,.04); }
.auth-brand img { width: 32px; height: 32px; object-fit: contain; }
.auth-eyebrow { margin: 0 0 9px; color: #777; font-size: 9px; font-weight: 700; letter-spacing: .2em; }
.auth-dialog h2 { margin: 0; font-size: 27px; font-weight: 600; letter-spacing: -.035em; }
.auth-subtitle { margin: 10px 0 24px; color: #888; font-size: 12px; line-height: 1.6; }
.auth-providers { display: grid; gap: 10px; }
.auth-provider { display: grid; grid-template-columns: 24px 1fr 24px; align-items: center; min-height: 48px; width: 100%; padding: 0 14px; border: 1px solid #2b2b2b; border-radius: 10px; background: #111; color: #eee; cursor: pointer; font-family: inherit; font-size: 12px; font-weight: 500; }
.auth-provider::after { content: ""; }
.auth-provider:hover:not(:disabled) { border-color: #444; background: #171717; }
.auth-provider:disabled { color: #666; cursor: not-allowed; }
.auth-provider i { font-size: 21px; }
.google-mark { display: grid; place-items: center; width: 21px; height: 21px; border-radius: 50%; background: #fff; color: #181818; font: 700 13px/1 Inter, sans-serif; }
.auth-divider { display: flex; align-items: center; gap: 12px; margin: 22px 0 17px; color: #656565; font-size: 10px; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: #222; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; margin-bottom: 17px; padding: 3px; border: 1px solid #222; border-radius: 9px; background: #070707; }
.auth-tabs button { min-height: 34px; border: 0; border-radius: 6px; background: transparent; color: #777; cursor: pointer; font-family: inherit; font-size: 11px; }
.auth-tabs button[aria-selected="true"] { background: #1a1a1a; color: #fff; box-shadow: inset 0 0 0 1px rgba(255,255,255,.05); }
.auth-form { display: grid; gap: 13px; }
.auth-form label > span { display: block; margin: 0 0 7px 2px; color: #aaa; font-size: 10px; }
.auth-form input { width: 100%; height: 45px; box-sizing: border-box; padding: 0 13px; border: 1px solid #292929; border-radius: 9px; outline: none; background: #0e0e0e; color: #fff; font: 400 12px/1.2 Inter, "Noto Sans Thai", sans-serif; }
.auth-form input::placeholder { color: #555; }
.auth-form input:focus { border-color: #666; box-shadow: 0 0 0 3px rgba(255,255,255,.055); }
.auth-status { min-height: 0; margin: -1px 2px 0; color: #ff9c9c; font-size: 10px; line-height: 1.5; }
.auth-status:empty { display: none; }
.auth-status.success { color: #86e7b1; }
.auth-submit { min-height: 46px; border: 0; border-radius: 9px; background: #f0f0ee; color: #050505; cursor: pointer; font-family: inherit; font-size: 12px; font-weight: 700; }
.auth-submit:hover:not(:disabled) { background: #fff; }
.auth-submit:disabled { opacity: .55; cursor: wait; }
.auth-terms { margin: 0; color: #5f5f5f; text-align: center; font-size: 9px; line-height: 1.6; }
.auth-modal.is-login .auth-name-field { display: none; }
body.auth-open { overflow: hidden; }
.auth-dialog button:focus-visible, .auth-dialog input:focus-visible { outline: 2px solid #ddd; outline-offset: 2px; }
.mobile-scrim { display: none; position: fixed; inset: 0; z-index: 30; background: rgba(0,0,0,.62); }

.shell.sidebar-collapsed { grid-template-columns: 86px minmax(0,1fr); }
.shell.sidebar-collapsed .sidebar { padding: 12px 10px; }
.shell.sidebar-collapsed .sidebar-divider,
.shell.sidebar-collapsed .section-label,
.shell.sidebar-collapsed .sessions,
.shell.sidebar-collapsed .account-card > i { display: none; }
.shell.sidebar-collapsed .new-chat span,
.shell.sidebar-collapsed .nav-item span,
.shell.sidebar-collapsed .account-copy { 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; }
.shell.sidebar-collapsed .sidebar-head { min-height: 82px; }
.shell.sidebar-collapsed .brand-lockup { left: 50%; width: 58px; height: 40px; transform: translateX(-50%); }
.shell.sidebar-collapsed .brand-animated-logo { gap: 0; transform: scale(.62); transform-origin: center; }
.shell.sidebar-collapsed .brand-wordmark { max-width: 0; font-size: 11px; letter-spacing: .24em; opacity: 0; transform: translateX(-6px); }
.shell.sidebar-collapsed .brand-plan { max-width: 0; opacity: 0; transform: translateX(-6px); }
.shell.sidebar-collapsed .collapse-button { top: 46px; right: 50%; width: 70px; transform: translateX(50%); }
.shell.sidebar-collapsed .collapse-button::after { content: "ขยาย"; order: 1; animation-name: collapse-copy-in-left; }
.shell.sidebar-collapsed .collapse-button i { order: 2; }
.shell.sidebar-collapsed .collapse-button i::before { content: "\ea6e"; }
.shell.sidebar-collapsed .collapse-button:hover i { transform: translateX(1px); }
.shell.sidebar-collapsed .new-chat, .shell.sidebar-collapsed .nav-item { justify-content: center; min-height: 40px; padding: 0; }
.shell.sidebar-collapsed .account-card { grid-template-columns: 1fr; justify-items: center; min-height: 52px; padding: 8px; }

@keyframes thinking-face-drift {
  0%, 100% { transform: translateY(0) rotate(0); }
  25% { transform: translateY(-1px) rotate(-1deg); }
  50% { transform: translateY(1px) rotate(0); }
  75% { transform: translateY(-1px) rotate(1deg); }
}

@keyframes collapse-copy-in-right {
  from { opacity: 0; filter: blur(4px); transform: translateX(5px); }
  to { opacity: 1; filter: blur(0); transform: translateX(0); }
}

@keyframes collapse-copy-in-left {
  from { opacity: 0; filter: blur(4px); transform: translateX(-5px); }
  to { opacity: 1; filter: blur(0); transform: translateX(0); }
}

@keyframes new-chat-composer-in {
  from { opacity: 0; transform: translateY(10px) scale(.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes new-chat-welcome-in {
  from { opacity: 0; filter: blur(6px); transform: translateY(7px); }
  to { opacity: 1; filter: blur(0); transform: translateY(0); }
}

@keyframes brand-left-eye {
  0%, 8%, 14%, 100% { transform: translate(0,0) scale(1); }
  10%, 12% { transform: translate(0,7px) scale(1.06,.1); }
  28%, 42% { transform: translate(2px,0) scale(.94,1); }
  62%, 78% { transform: translate(-2px,0) scale(.94,1); }
  88%, 94% { transform: translate(0,1px) scale(1,.9); }
}

@keyframes brand-right-eye {
  0%, 8%, 14%, 100% { transform: translate(0,0) scale(1); }
  10%, 12% { transform: translate(0,7px) scale(1.06,.1); }
  28%, 42% { transform: translate(2px,0) scale(.94,1); }
  62%, 78% { transform: translate(-2px,0) scale(.94,1); }
  88%, 94% { transform: translate(0,1px) scale(1,.9); }
}

@keyframes brand-mouth {
  0%, 18%, 100% { width: 12px; height: 7px; border-radius: 2px 2px 7px 7px; transform: translate(0,0); }
  28%, 42% { width: 11px; height: 6px; transform: translate(3px,0) scale(.9); }
  62%, 78% { width: 11px; height: 6px; transform: translate(-2px,0) scale(.9); }
  88%, 94% { width: 16px; height: 7px; border-radius: 2px 2px 10px 10px; transform: translate(-2px,-1px); }
}

@keyframes thinking-left-eye {
  0%, 7%, 16%, 100% { border-radius: 6px; transform: translate(0,0) scale(1); }
  10%, 13% { border-radius: 8px; transform: translate(0,7px) scale(1.08,.08); }
  23%, 32% { transform: translate(3px,0) scale(.9,1); }
  42%, 49% { border-radius: 7px; transform: translate(0,5px) rotate(-9deg) scale(1.12,.25); }
  59%, 68% { border-radius: 50%; transform: translate(1px,3px) scale(.72); }
  77%, 85% { transform: translate(-3px,0) scale(.9,1); }
  91%, 95% { border-radius: 8px; transform: translate(0,6px) rotate(8deg) scale(1.12,.18); }
}

@keyframes thinking-right-eye {
  0%, 7%, 16%, 100% { border-radius: 6px; transform: translate(0,0) scale(1); }
  10%, 13% { border-radius: 8px; transform: translate(0,7px) scale(1.08,.08); }
  23%, 32% { transform: translate(3px,0) scale(.9,1); }
  42%, 49% { border-radius: 7px; transform: translate(0,4px) rotate(7deg) scale(1.06,.34); }
  59%, 68% { border-radius: 50%; transform: translate(-1px,3px) scale(.72); }
  77%, 85% { transform: translate(-3px,0) scale(.9,1); }
  91%, 95% { border-radius: 8px; transform: translate(0,6px) rotate(-8deg) scale(1.12,.18); }
}

@keyframes thinking-mouth {
  0%, 16%, 100% { width: 12px; height: 7px; border-radius: 2px 2px 7px 7px; transform: translate(0,0) scale(1); }
  23%, 32% { width: 10px; height: 6px; border-radius: 3px 3px 7px 7px; transform: translate(5px,0) scale(.85); }
  42%, 49% { width: 14px; height: 3px; border-radius: 4px; transform: translate(-1px,2px) rotate(-5deg); }
  59%, 68% { width: 9px; height: 9px; border-radius: 50%; transform: translate(2px,-1px) scale(.88,1.12); }
  77%, 85% { width: 10px; height: 6px; border-radius: 3px 3px 7px 7px; transform: translate(-3px,0) scale(.85); }
  91%, 95% { width: 16px; height: 7px; border-radius: 2px 2px 10px 10px; transform: translate(-2px,-1px); }
}

@media (max-width: 760px) {
  .shell, .shell.sidebar-collapsed { grid-template-columns: 1fr; }
  .sidebar, .shell.sidebar-collapsed .sidebar { position: fixed; inset: 0 auto 0 0; width: 280px; padding: 16px 14px 12px; transform: translateX(-100%); box-shadow: 30px 0 80px rgba(0,0,0,.55); }
  .sidebar.open { transform: translateX(0); }
  .mobile-scrim.visible { display: block; }
  .mobile-menu { position: fixed; top: 14px; left: 14px; z-index: 35; display: inline-grid; background: var(--surface-2); border: 1px solid var(--line); box-shadow: 0 8px 24px rgba(0,0,0,.28); }
  .collapse-button { display: none; }
  .new-chat, .nav-item { min-height: 44px; }
  .shell.sidebar-collapsed .sidebar-head { min-height: 68px; }
  .shell.sidebar-collapsed .brand-lockup { top: 0; left: 4px; width: 170px; height: 38px; transform: none; }
  .shell.sidebar-collapsed .brand-animated-logo { gap: 10px; transform: scale(.92); transform-origin: center left; }
  .shell.sidebar-collapsed .brand-wordmark { max-width: 92px; font-size: 13px; letter-spacing: .28em; opacity: 1; transform: none; }
  .shell.sidebar-collapsed .brand-plan { max-width: 92px; opacity: 1; transform: none; }
  .thread { width: calc(100% - 30px); padding-top: 70px; }
  .message { grid-template-columns: 38px minmax(0,1fr); gap: 9px; }
  .message-avatar { width: 36px; height: 36px; }
  .message-avatar img { width: 23px; height: 23px; }
  .bubble { font-size: 12px; }
  .quick-actions { width: calc(100% - 24px); justify-content: flex-start; overflow-x: auto; padding-bottom: 4px; margin-bottom: 14px; }
  .quick-actions button { min-height: 40px; padding: 0 13px; }
  .auth-modal { align-items: end; padding: 0; }
  .auth-dialog { width: 100%; max-height: 92dvh; overflow-y: auto; box-sizing: border-box; padding: 28px 22px max(24px, env(safe-area-inset-bottom)); border-right: 0; border-bottom: 0; border-left: 0; border-radius: 24px 24px 0 0; }
  .composer-wrap { width: calc(100% - 22px); padding-bottom: 12px; }
  .composer-wrap > p { font-size: 8px; }
  .chat-pane.new-chat-state .new-chat-welcome { width: calc(100% - 34px); margin-bottom: 18px; }
  .chat-pane.new-chat-state .new-chat-welcome h1 { font-size: 22px; line-height: 1.42; }
  .utility-view { padding: 28px 18px; }
  .utility-head { flex-direction: column; }
}

/*
 * Desktop density: the original dashboard was composed at a presentation-like
 * scale. Keep the mobile touch layout unchanged, while making 100% browser zoom
 * feel like a normal productivity app on laptop and desktop displays.
 */
@media (min-width: 761px) {
  body {
    zoom: .86;
  }

  .shell,
  .app-main {
    height: 116.28dvh;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
  .thinking-face, .thinking-eye, .thinking-mouth { animation: none !important; }
}

@media (prefers-reduced-transparency: reduce) {
  .new-chat, .nav-item.active { -webkit-backdrop-filter: none; backdrop-filter: none; background: var(--surface-3); }
}
