:root {
  --sidebar: #f3f4f6;
  --surface: #fff;
  --hover: #e3e5e8;
  --text: #0d0d0d;
  --muted: #525252;
  --border: #d1d5db;
  --brand-gold: #a97818;
  --sidebar-width: 260px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; color: var(--text); background: var(--surface); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; font-size: 14px; }
button, textarea { font: inherit; }
input { font: inherit; }
button { color: inherit; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.app-shell { display: flex; height: 100dvh; overflow: hidden; }
.app-shell[hidden] { display: none; }
.login-screen { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 24px; background: #f3f4f6; }
.login-screen[hidden] { display: none; }
.login-card { width: min(100%, 400px); padding: 34px; border: 1px solid var(--border); border-radius: 18px; background: #fff; box-shadow: 0 16px 45px rgba(0,0,0,.08); }
.login-card [hidden] { display: none; }
.login-logo { display: block; width: 148px; height: auto; margin: 0 auto 12px; }
.login-card .product-name { margin: 0 0 18px; color: var(--brand-gold); font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.login-card h1 { margin: 0; text-align: center; font-size: 25px; }
.login-card > p { margin: 9px 0 24px; color: var(--muted); text-align: center; }
.login-card label { display: block; margin: 14px 0; color: #444; font-size: 13px; font-weight: 500; }
.login-card input { width: 100%; height: 46px; margin-top: 7px; padding: 0 13px; border: 1px solid #cfcfcf; border-radius: 9px; outline: none; font-size: 15px; }
.login-card input:focus { border-color: #555; box-shadow: 0 0 0 2px rgba(0,0,0,.08); }
.login-submit { width: 100%; height: 46px; margin-top: 8px; border: 0; border-radius: 9px; background: #0d0d0d; color: #fff; cursor: pointer; font-weight: 600; }
.login-submit:disabled { opacity: .55; cursor: wait; }
.login-back { width: 100%; margin-top: 12px; border: 0; background: transparent; color: var(--muted); cursor: pointer; }
.login-card .login-error { min-height: 19px; margin: 15px 0 0; color: #b42318; font-size: 13px; }
.sidebar { width: var(--sidebar-width); flex: 0 0 var(--sidebar-width); background: var(--sidebar); border-right: 1px solid var(--border); padding: 10px 9px 9px; display: flex; flex-direction: column; overflow: hidden; transition: transform .25s ease; z-index: 30; }
.sidebar-top { display: flex; align-items: center; gap: 4px; min-height: 42px; }
.brand-button { display: flex; align-items: center; gap: 9px; flex: 1; min-width: 0; height: 40px; padding: 7px; border: 0; background: transparent; border-radius: 9px; font-weight: 600; cursor: pointer; }
.brand-button:hover, .sidebar-icon:hover, .nav-item:hover, .history-item:hover, .account-card:hover { background: var(--hover); }
.brand-mark { display: grid; place-items: center; width: 34px; height: 30px; overflow: hidden; background: #fff; border: 1px solid #d7d7d7; border-radius: 7px; box-shadow: 0 1px 2px rgba(0,0,0,.05); }
.brand-mark img { width: 48px; height: auto; transform: translateX(7px); }
.chevron { margin-left: auto; color: #888; font-size: 20px; font-weight: 400; }
.sidebar-icon, .mobile-menu, .round-button { display: grid; place-items: center; border: 0; background: transparent; cursor: pointer; border-radius: 8px; }
.sidebar-icon { width: 36px; height: 36px; }

.primary-nav { margin-top: 14px; }
.nav-item { width: 100%; display: flex; align-items: center; gap: 12px; height: 38px; padding: 0 10px; border: 0; border-radius: 8px; background: transparent; text-align: left; cursor: pointer; }
.nav-item svg { width: 19px; height: 19px; flex: 0 0 auto; }
.nav-item span:nth-child(2) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-item kbd { opacity: 0; margin-left: auto; color: #888; font-family: inherit; font-size: 11px; font-weight: 400; transition: opacity .15s; }
.nav-item:hover kbd { opacity: 1; }
.secondary-nav { margin-top: 13px; }
.mini-icon { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 5px; }
.mini-icon svg { width: 16px; height: 16px; }
.mini-icon.blue { color: #3083f3; background: #e9f3ff; }
.mini-icon.violet { color: #8554d8; background: #f1eaff; }
.history { min-height: 0; overflow-y: auto; margin-top: 17px; flex: 1; scrollbar-width: thin; }
.section-label { margin: 0; padding: 8px 10px 5px; color: var(--muted); font-size: 12px; font-weight: 600; }
.history-item { display: block; width: 100%; height: 36px; padding: 0 10px; overflow: hidden; border: 0; border-radius: 8px; background: transparent; text-align: left; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.history-item.active { background: #ececec; }
.account-card { display: flex; align-items: center; width: 100%; min-height: 52px; margin-top: 8px; padding: 6px 8px; border: 0; border-radius: 9px; background: transparent; cursor: pointer; text-align: left; }
.avatar { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: #6e56cf; color: #fff; font-size: 13px; font-weight: 600; }
.account-copy { display: flex; flex-direction: column; gap: 2px; margin-left: 10px; }
.account-copy strong { font-size: 13px; font-weight: 600; }
.account-copy small { color: var(--muted); font-size: 11px; }
.more { margin-left: auto; letter-spacing: 1px; }

.main-panel { position: relative; min-width: 0; flex: 1; display: flex; flex-direction: column; background: var(--surface); }
.topbar { height: 56px; flex: 0 0 56px; display: flex; align-items: center; padding: 0 16px; }
.mobile-menu { display: none; width: 38px; height: 38px; margin-right: 4px; }
.model-wrap { position: relative; }
.model-button { display: flex; align-items: center; gap: 6px; height: 38px; padding: 0 10px; border: 0; border-radius: 9px; background: transparent; font-size: 18px; font-weight: 600; cursor: pointer; }
.model-button:hover { background: #f4f4f4; }
.model-button span { color: #777; font-size: 16px; }
.model-menu { position: absolute; top: 43px; left: 0; z-index: 20; display: none; width: 285px; padding: 6px; border: 1px solid var(--border); border-radius: 13px; background: #fff; box-shadow: 0 12px 35px rgba(0,0,0,.14); }
.model-menu.open { display: block; animation: menuIn .16s ease; }
.model-menu button { display: flex; flex-direction: column; gap: 3px; width: 100%; padding: 11px; border: 0; border-radius: 9px; background: transparent; text-align: left; cursor: pointer; }
.model-menu button:hover { background: #f3f3f3; }
.model-menu strong { font-size: 14px; }
.model-menu small { color: var(--muted); }
.top-actions { display: flex; align-items: center; gap: 5px; margin-left: auto; }
.share-timer { padding: 7px 10px; border: 1px solid #e0c36d; border-radius: 9px; background: #fff8dd; color: #6d5100; font-size: 12px; font-weight: 700; white-space: nowrap; }
.share-button { display: flex; align-items: center; gap: 7px; height: 36px; padding: 0 12px; border: 1px solid #dedede; border-radius: 9px; background: #fff; cursor: pointer; }
.share-button:hover { background: #f6f6f6; }
.share-button svg { width: 17px; height: 17px; }
.round-button { width: 36px; height: 36px; font-weight: 600; letter-spacing: 1px; }
.round-button:hover, .mobile-menu:hover { background: #f2f2f2; }

.conversation { min-height: 0; flex: 1; overflow-y: auto; scroll-behavior: smooth; }
.welcome { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: calc(100% - 110px); padding: 52px 20px 20px; }
.welcome-logo { display: grid; width: 142px; height: 44px; margin-bottom: 14px; place-items: center; }
.welcome-logo img { width: 142px; height: auto; }
.welcome h1 { margin: 0 0 31px; font-size: 30px; line-height: 1.2; letter-spacing: -.7px; font-weight: 600; }
.suggestions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; width: min(100%, 660px); }
.suggestions button { display: flex; align-items: flex-start; gap: 11px; min-height: 78px; padding: 15px; border: 1px solid #d1d5db; border-radius: 14px; background: #fff; text-align: left; cursor: pointer; transition: background .15s, border-color .15s, box-shadow .15s; }
.suggestions button:hover { background: #f8f8f8; border-color: #d8d8d8; }
.suggestions button > span:last-child { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.suggestions strong { font-size: 13px; font-weight: 500; }
.suggestions small { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.suggest-icon { font-size: 19px; line-height: 20px; }
.suggest-icon.amber { color: #e49438; }.suggest-icon.green { color: #39a172; }.suggest-icon.blue { color: #4b83dd; }.suggest-icon.purple { color: #9e63d8; }

.messages { width: min(100% - 32px, 760px); margin: 28px auto 130px; }
.message { margin: 0 0 28px; line-height: 1.65; font-size: 15px; animation: messageIn .25s ease; }
.message.user { display: flex; justify-content: flex-end; }
.message.user .bubble { max-width: 78%; padding: 10px 16px; border-radius: 20px; background: #f2f2f2; white-space: pre-wrap; }
.message.assistant { display: grid; grid-template-columns: 28px 1fr; gap: 13px; }
.assistant-icon { display: grid; place-items: center; width: 28px; height: 28px; margin-top: 1px; border: 1px solid var(--border); border-radius: 50%; font-size: 13px; font-weight: 600; }
.assistant-copy p { margin: 1px 0 10px; }
.assistant-copy p { white-space: pre-wrap; }
.assistant-copy a { color: #1264a3; text-decoration: underline; text-underline-offset: 2px; }
.assistant-copy ul { padding-left: 21px; }
.typing::after { content: ""; display: inline-block; width: 7px; height: 15px; margin-left: 3px; vertical-align: -2px; background: #222; animation: blink .8s infinite; }

.composer-area { position: absolute; right: 0; bottom: 0; left: 0; z-index: 10; padding: 0 18px 9px; background: linear-gradient(to bottom, rgba(255,255,255,0), #fff 24px, #fff); }
.composer { width: min(100%, 768px); min-height: 102px; margin: 0 auto; padding: 13px 14px 10px; border: 1px solid #dedede; border-radius: 26px; background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.06); }
.composer:focus-within { border-color: #cecece; box-shadow: 0 3px 12px rgba(0,0,0,.08); }
.composer textarea { display: block; width: 100%; max-height: 150px; min-height: 30px; padding: 2px 3px; resize: none; border: 0; outline: 0; background: transparent; line-height: 24px; font-size: 16px; }
.composer textarea::placeholder { color: #777; }
.composer-actions { display: flex; align-items: center; justify-content: space-between; height: 38px; margin-top: 6px; }
.left-tools { display: flex; align-items: center; gap: 5px; }
.tool-button, .voice-button, .send-button, .tools-pill { border: 0; cursor: pointer; }
.tool-button { display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid #e3e3e3; border-radius: 50%; background: #fff; }
.tool-button:hover, .tools-pill:hover { background: #f2f2f2; }
.tool-button.uploading { animation: pulse 1s infinite; pointer-events: none; }
.tools-pill { display: flex; align-items: center; gap: 7px; height: 34px; padding: 0 10px; border-radius: 17px; background: transparent; }
.tools-pill svg { width: 18px; height: 18px; }
.tools-pill.active { background: #e7f2ff; color: #075da8; }
.voice-button, .send-button { display: grid; place-items: center; width: 36px; height: 36px; margin-left: auto; border-radius: 50%; background: #0d0d0d; color: #fff; }
.send-button { display: none; }
.send-button.visible { display: grid; }
.voice-button.hidden { display: none; }
.send-button svg { width: 19px; height: 19px; stroke-width: 2.4; }
.bars { height: 16px; display: flex; align-items: center; gap: 2px; }
.bars i { display: block; width: 2px; border-radius: 2px; background: currentColor; }
.bars i:nth-child(1) { height: 6px; }.bars i:nth-child(2) { height: 13px; }.bars i:nth-child(3) { height: 9px; }.bars i:nth-child(4) { height: 4px; }
.disclaimer { margin: 7px 0 0; color: #777; font-size: 11px; text-align: center; }
.scrim { display: none; }
.toast { position: fixed; bottom: 25px; left: 50%; z-index: 100; padding: 10px 16px; transform: translate(-50%, 30px); border-radius: 9px; background: #202020; color: #fff; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.dialog-backdrop { position: fixed; inset: 0; z-index: 150; display: grid; place-items: center; padding: 20px; background: rgba(0,0,0,.35); }
.dialog-backdrop[hidden] { display: none; }
.dialog { width: min(100%, 620px); max-height: min(82dvh, 760px); overflow: auto; border: 1px solid var(--border); border-radius: 16px; background: #fff; box-shadow: 0 22px 60px rgba(0,0,0,.22); }
.dialog > header { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; padding: 16px 18px; border-bottom: 1px solid var(--border); background: #fff; }
.dialog h2 { margin: 0; font-size: 18px; }
.dialog h3 { margin: 22px 0 9px; font-size: 13px; }
.dialog > header button { width: 34px; height: 34px; margin-left: auto; border: 0; border-radius: 8px; background: transparent; cursor: pointer; font-size: 25px; }
.dialog > header button:hover { background: var(--hover); }
#dialogBody { padding: 18px; }
.dialog-help, .empty-state { color: var(--muted); line-height: 1.5; }
.dialog-search { width: 100%; height: 44px; padding: 0 12px; border: 1px solid #ccc; border-radius: 9px; outline: none; }
.search-results { margin-top: 10px; }
.search-result { display: block; width: 100%; padding: 11px; border: 0; border-radius: 8px; background: transparent; text-align: left; cursor: pointer; }
.search-result:hover { background: var(--hover); }
.file-row { display: flex; align-items: center; gap: 10px; min-height: 54px; padding: 8px 0; border-bottom: 1px solid #eee; }
.file-copy { min-width: 0; display: flex; flex: 1; flex-direction: column; gap: 3px; }
.file-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-copy small { color: var(--muted); }
.file-download, .file-delete { flex: 0 0 auto; padding: 7px 9px; border: 0; border-radius: 7px; background: #f1f1f1; color: inherit; cursor: pointer; text-decoration: none; }
.file-delete { color: #b42318; }
.dialog-action { display: block; width: 100%; margin-top: 9px; padding: 11px 13px; border: 1px solid #ddd; border-radius: 9px; background: #fff; cursor: pointer; text-align: left; }
.dialog a.dialog-action { color: inherit; text-decoration: none; }
.dialog-action:hover { background: #f6f6f6; }
.dialog-action.danger { color: #b42318; }
.share-duration { display: grid; gap: 7px; margin: 14px 0; color: var(--muted); font-size: 13px; }
.share-duration input { width: 100%; height: 42px; padding: 0 11px; border: 1px solid var(--border); border-radius: 9px; }
.share-record { display: flex; flex-direction: column; gap: 5px; margin-top: 9px; padding: 11px; border: 1px solid var(--border); border-radius: 10px; }
.share-record small { color: var(--muted); line-height: 1.4; }
.share-record .file-delete { align-self: flex-start; margin-top: 5px; }
.guest-mode #newChat, .guest-mode #searchButton, .guest-mode #shareButton, .guest-mode #moreButton, .guest-mode #homeButton .chevron { display: none; }
.tool-options { display: grid; gap: 7px; }
.tool-options .dialog-help { margin: 0 0 8px; }
.tool-option { display: grid; grid-template-columns: 24px 1fr; gap: 2px 9px; width: 100%; padding: 12px; border: 1px solid #e2e2e2; border-radius: 11px; background: #fff; text-align: left; cursor: pointer; }
.tool-option:hover { background: #f7f7f7; }
.tool-option.selected { border-color: #9ac7ee; background: #f1f8ff; }
.tool-option .tool-check { grid-row: 1 / 3; color: #0874ce; font-weight: 700; }
.tool-option strong { font-size: 14px; }
.tool-option small { color: var(--muted); line-height: 1.4; }

@keyframes blink { 50% { opacity: 0; } }
@keyframes menuIn { from { opacity: 0; transform: translateY(-4px); } }
@keyframes messageIn { from { opacity: 0; transform: translateY(5px); } }
@keyframes pulse { 50% { opacity: .35; } }

@media (max-width: 760px) {
  .sidebar { position: fixed; inset: 0 auto 0 0; width: min(86vw, 320px); transform: translateX(-102%); box-shadow: 8px 0 30px rgba(0,0,0,.12); }
  .sidebar.open { transform: translateX(0); }
  .scrim { position: fixed; inset: 0; z-index: 25; background: rgba(0,0,0,.28); }
  .scrim.open { display: block; }
  .mobile-menu { display: grid; }
  .topbar { padding: 0 9px; }
  .model-button { font-size: 16px; }
  .share-button span { display: none; }
  .share-button { width: 36px; padding: 0; justify-content: center; border: 0; }
  .welcome { justify-content: flex-start; padding-top: 19vh; }
  .welcome-logo { display: grid; }
  .welcome h1 { margin-bottom: 24px; font-size: 25px; }
  .suggestions { display: flex; width: 100%; overflow-x: auto; padding: 0 2px 5px; scrollbar-width: none; }
  .suggestions::-webkit-scrollbar { display: none; }
  .suggestions button { min-width: 215px; }
  .composer-area { padding-inline: 10px; }
  .composer { min-height: 98px; border-radius: 24px; }
  .disclaimer { font-size: 10px; }
  .messages { width: calc(100% - 24px); margin-top: 20px; }
  .message.user .bubble { max-width: 88%; }
}

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