:root {
  color-scheme: light;
  --paper: #faf9f6;
  --sidebar: #f5f4f1;
  --surface: #fffefa;
  --surface-soft: #f1efe9;
  --ink: #292823;
  --muted: #77746c;
  --line: #e2dfd7;
  --accent: #d97757;
  --accent-dark: #bd6346;
  --shadow: 0 12px 34px rgba(51, 47, 39, .08);
}
* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif; font-size: 14px; }
button, input, textarea, select { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 3px solid rgba(217, 119, 87, .28); outline-offset: 2px; }
.hidden { display: none !important; }
.brand { display: inline-flex; align-items: center; gap: 9px; color: var(--ink); text-decoration: none; min-width: 0; }
.brand-mark { display: block; width: 27px; height: 27px; flex: 0 0 27px; }
.brand-word { font-family: Georgia, "Times New Roman", serif; font-size: 20px; letter-spacing: -.04em; }
.brand:not(.auth-brand) .brand-word { display: none; }
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 28px; background: radial-gradient(circle at 50% 10%, #fffefa, var(--paper) 62%); }
.auth-card { width: min(100%, 410px); background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 35px 38px 30px; box-shadow: var(--shadow); }
.auth-brand { margin-bottom: 38px; }
.auth-brand .brand-word { display: inline; font-size: 23px; }
.eyebrow { margin: 0 0 9px; color: var(--muted); text-transform: uppercase; letter-spacing: .11em; font-size: 11px; font-weight: 700; }
.auth-card h1, .account-header h1 { margin: 0 0 8px; font-size: 28px; letter-spacing: -.035em; }
.muted { color: var(--muted); line-height: 1.55; }
.auth-card > .muted { margin: 0 0 27px; }
.auth-form, .stack-form { display: flex; flex-direction: column; gap: 10px; }
.auth-form label, .stack-form label, .recharge-form label, .redeem-block label { margin-top: 5px; font-size: 12px; color: #56534c; font-weight: 600; }
input, select, textarea { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 12px 13px; color: var(--ink); transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { border-color: #c8a395; box-shadow: 0 0 0 3px rgba(217, 119, 87, .1); outline: none; }
input[readonly] { background: #f5f4f1; color: var(--muted); }
.button { border: 1px solid transparent; border-radius: 10px; padding: 11px 16px; font-weight: 650; cursor: pointer; transition: transform .12s, background .12s, border-color .12s; }
.button:hover { transform: translateY(-1px); }
.button:disabled { opacity: .55; cursor: wait; transform: none; }
.button.primary { background: var(--accent); color: white; margin-top: 12px; }
.button.primary:hover { background: var(--accent-dark); }
.button.dark { background: #302f2b; color: #fff; }
.button.dark:hover { background: #1f1e1b; }
.button.outline { background: transparent; color: #514e47; border-color: var(--line); font-size: 12px; padding: 8px 12px; }
.button.outline:hover { background: var(--surface-soft); }
.full { width: 100%; }
.auth-switch { margin: 19px 0 0; text-align: center; color: var(--muted); font-size: 13px; }
.text-button { border: 0; background: transparent; padding: 3px; color: #a85b42; font-weight: 650; cursor: pointer; }
.auth-note { border-top: 1px solid var(--line); margin: 25px 0 0; padding-top: 15px; color: #8a867d; font-size: 11px; line-height: 1.5; text-align: center; }
.app-shell { min-height: 100vh; display: flex; }
.sidebar { position: fixed; z-index: 4; inset: 0 auto 0 0; width: 274px; display: flex; flex-direction: column; padding: 17px 12px 10px; background: var(--sidebar); border-right: 1px solid var(--line); transition: transform .2s, width .2s; }
.sidebar-topline { height: 42px; display: flex; align-items: center; justify-content: space-between; padding: 0 8px 0 10px; }
.sidebar-collapse, .icon-button { border: 0; background: transparent; color: #6f6c65; cursor: pointer; border-radius: 8px; width: 34px; height: 34px; display: inline-grid; place-items: center; font-size: 22px; line-height: 1; }
.sidebar-collapse:hover, .icon-button:hover { background: #e9e7e1; }
.sidebar-collapse { font-size: 29px; font-family: Georgia, serif; }
.main-nav { display: grid; gap: 3px; margin: 20px 0 26px; }
.nav-item { position: relative; display: flex; align-items: center; gap: 11px; height: 38px; padding: 0 10px; border: 0; border-radius: 9px; background: transparent; text-align: left; cursor: pointer; color: #3e3c36; }
.nav-item:hover { background: #eceae5; }
.nav-item.active { background: #e9e7e1; color: #25241f; font-weight: 650; }
.nav-icon { width: 18px; display: inline-grid; place-items: center; font-size: 20px; line-height: 1; color: #5d5a53; }
.search-icon { font-size: 25px; transform: rotate(-20deg); }
.nav-item small { margin-left: auto; color: #98948a; font-size: 10px; }
.sidebar-projects { flex: 0 1 auto; min-height: 0; max-height: min(40vh, 330px); display: flex; flex-direction: column; margin: -12px -3px 13px; padding: 10px 3px 8px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.sidebar-section-heading { display: flex; align-items: center; justify-content: space-between; padding: 0 8px 5px; color: #79766e; font-size: 11px; }
.sidebar-section-heading .tiny-icon { width: 24px; height: 22px; border-radius: 5px; color: #817d74; font-size: 13px; }
.sidebar-section-heading .tiny-icon:hover { background: #e9e7e1; }
.sidebar-project-list { min-height: 0; overflow-y: auto; }
.sidebar-project-group { min-width: 0; }
.sidebar-project-header { display: flex; align-items: center; min-width: 0; min-height: 31px; border-radius: 7px; }
.sidebar-project-header:hover, .sidebar-project-group:focus-within .sidebar-project-header { background: #eceae5; }
.sidebar-project-expand, .sidebar-project-create { display: inline-grid; place-items: center; flex: 0 0 25px; width: 25px; height: 27px; padding: 0; border: 0; border-radius: 5px; background: transparent; color: #77736b; cursor: pointer; }
.sidebar-project-create { opacity: 0; font-size: 17px; }
.sidebar-project-header:hover .sidebar-project-create, .sidebar-project-create:focus-visible { opacity: 1; }
.sidebar-project-title { flex: 1; min-width: 0; padding: 6px 3px; overflow: hidden; border: 0; background: transparent; color: #36342e; text-align: left; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; font-weight: 570; cursor: pointer; }
.sidebar-project-title:hover { color: #a85b42; }
.sidebar-project-chats { padding: 1px 0 4px 21px; }
.sidebar-project-chats[hidden] { display: none; }
.sidebar-project-chat { display: flex; min-width: 0; align-items: center; border-radius: 7px; }
.sidebar-project-chat:hover, .sidebar-project-chat.current { background: #e9e7e1; }
.sidebar-project-chat .chat-row-button { padding-top: 6px; padding-bottom: 6px; font-size: 11px; }
.sidebar-project-chat.current .chat-row-button { font-weight: 650; }
.sidebar-project-draft .chat-row-button { color: #a85b42; font-style: italic; cursor: default; }
.sidebar-project-empty { margin: 3px 0; padding: 5px 7px; color: #99948a; font-size: 10px; }
.sidebar-project-more { border: 0; background: transparent; padding: 5px 7px; color: #a85b42; font-size: 10px; cursor: pointer; }
.sidebar-projects-empty { margin: 2px 0 0; padding: 0 8px; color: #99948a; font-size: 10px; }
.recents-head { display: flex; align-items: center; gap: 4px; padding: 0 8px; color: #79766e; font-size: 11px; margin-bottom: 7px; }
.tiny-icon { border: 0; background: transparent; color: inherit; padding: 0 3px; cursor: pointer; }
.chat-search { height: 34px; display: flex; align-items: center; gap: 7px; margin: 0 4px 8px; padding: 0 9px; border: 1px solid var(--line); border-radius: 8px; background: white; color: #817d74; }
.chat-search input { min-width: 0; width: 100%; border: 0; outline: 0; box-shadow: none; padding: 0; font-size: 12px; }
.chat-list { display: flex; flex-direction: column; gap: 3px; overflow-y: auto; flex: 1; padding: 0 0 10px; }
.chat-row { display: flex; min-width: 0; align-items: center; border-radius: 8px; padding: 1px 3px; }
.chat-row.current, .chat-row:hover { background: #e9e7e1; }
.chat-row-button { flex: 1; min-width: 0; padding: 8px 7px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; border: 0; background: transparent; text-align: left; cursor: pointer; color: #36342e; font-size: 13px; }
.chat-delete { opacity: 0; flex: 0 0 28px; height: 28px; border: 0; border-radius: 6px; background: transparent; color: #817d74; cursor: pointer; }
.chat-row:hover .chat-delete { opacity: 1; }
.sidebar-footer { border-top: 1px solid var(--line); margin: 0 -12px; padding: 11px 12px 0; }
.wallet-mini { display: flex; align-items: center; gap: 7px; padding: 2px 9px 10px; color: #4d4a43; font-size: 12px; font-variant-numeric: tabular-nums; }
.wallet-dot { width: 8px; height: 8px; background: #6e986f; border-radius: 99px; }
.wallet-caption { margin-left: auto; color: #969187; font-size: 10px; }
.wallet-recharge { border: 0; border-radius: 6px; background: #eee8db; padding: 4px 8px; color: #765a41; font-size: 10px; font-weight: 650; cursor: pointer; }
.wallet-recharge:hover { background: #e5dccb; color: #5d432f; }
.wallet-recharge:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.account-link { display: flex; align-items: center; width: 100%; gap: 9px; min-height: 44px; padding: 5px 8px; border: 0; border-radius: 9px; background: transparent; cursor: pointer; text-align: left; }
.account-link:hover { background: #e9e7e1; }
.avatar-mini { display: inline-grid; place-items: center; flex: 0 0 27px; width: 27px; height: 27px; border: 0; border-radius: 50%; background: #eee8db; color: #645f53; font-weight: 700; font-size: 11px; }
.account-link-label { flex: 1; font-size: 12px; color: #403e37; }
.account-chevron { color: #8b877d; }
.main-area { position: relative; margin-left: 274px; width: calc(100% - 274px); min-height: 100vh; }
.mobile-header { display: none; }
.chat-page { position: relative; min-height: 100vh; display: flex; flex-direction: column; }
.empty-state { width: min(100% - 42px, 740px); margin: auto; padding: 56px 0 120px; text-align: center; }
.welcome-mark { color: var(--accent); font-size: 34px; line-height: 1; }
.empty-state h1 { margin: 9px 0 36px; font-family: Georgia, "Times New Roman", serif; font-size: clamp(32px, 4vw, 45px); font-weight: 400; letter-spacing: -.04em; }
.mode-banner { display: inline-block; margin: -21px 0 18px; border: 1px solid #e6d5c9; border-radius: 999px; background: #fff8f1; color: #8b5b43; padding: 7px 12px; font-size: 11px; }
.composer-wrap { width: min(100%, 720px); margin: 0 auto; text-align: left; }
.composer-box { position: relative; border: 1px solid #ddd9d1; border-radius: 21px; background: var(--surface); box-shadow: 0 4px 18px rgba(41, 38, 32, .04); padding: 14px 14px 10px 20px; transition: border-color .15s, box-shadow .15s; }
.composer-box:focus-within { border-color: #cbbfb1; box-shadow: 0 5px 22px rgba(41, 38, 32, .08); }
.composer-box textarea { display: block; width: 100%; min-height: 56px; max-height: 200px; resize: none; overflow-y: hidden; border: 0; outline: 0; box-shadow: none; padding: 2px 2px 8px; background: transparent; font-size: 15px; line-height: 1.55; }
.composer-box textarea::placeholder { color: #858078; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.selected-files { display: flex; flex-wrap: wrap; gap: 7px; padding: 0 0 9px; }
.attachment-chip, .message-attachment-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; border: 1px solid var(--line); border-radius: 9px; background: #f7f5f0; padding: 6px 8px; color: #5d594f; font-size: 11px; }
.attachment-file-icon { flex: 0 0 auto; display: inline-grid; place-items: center; min-width: 28px; height: 22px; border-radius: 5px; background: #eee8db; color: #76634e; font-size: 8px; font-weight: 700; }
.attachment-file-name { min-width: 0; max-width: 210px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.attachment-chip small { flex: 0 0 auto; color: #8f8a80; font-size: 9px; }
.attachment-remove { flex: 0 0 20px; width: 20px; height: 20px; border: 0; border-radius: 50%; background: transparent; color: #77736a; cursor: pointer; font-size: 16px; line-height: 1; }
.attachment-remove:hover { background: #e9e5db; color: #8d3e30; }
.message-attachments { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.message-attachment-chip { max-width: min(100%, 320px); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; background: #faf9f6; }
.composer-toolbar { display: flex; justify-content: space-between; align-items: center; min-height: 33px; }
.plus-button { font-size: 23px; color: #4e4b44; }
.composer-actions { display: flex; align-items: center; gap: 8px; }
.model-picker-wrap { position: relative; }
.model-picker { display: flex; align-items: center; gap: 7px; border: 0; border-radius: 9px; background: #f2f0eb; padding: 7px 10px; cursor: pointer; color: #37352f; font-size: 12px; }
.model-picker:hover { background: #eae7df; }
.model-mode { color: #817c72; }
.chevron { color: #77736a; }
.model-menu { position: absolute; z-index: 8; bottom: calc(100% + 8px); right: 0; min-width: 240px; max-height: 310px; overflow: auto; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); padding: 7px; box-shadow: var(--shadow); }
.model-choice { display: block; width: 100%; border: 0; border-radius: 8px; padding: 10px; background: transparent; text-align: left; cursor: pointer; }
.model-choice:hover, .model-choice.selected { background: #efede7; }
.model-choice strong { display: block; font-size: 13px; font-weight: 600; }
.model-choice small { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }
.send-button { width: 33px; height: 33px; display: grid; place-items: center; border: 0; border-radius: 9px; background: #f0eee8; color: #8c877c; font-size: 21px; cursor: pointer; }
.send-button.ready { background: var(--accent); color: white; }
.send-button:hover { filter: brightness(.97); }
.composer-footnote { margin: 10px 8px 0; color: #99948a; font-size: 10px; text-align: center; line-height: 1.5; }
.followup-footnote { width: min(100%, 720px); margin: 7px auto 0; text-align: center; }
.chat-topbar { position: absolute; top: 15px; left: 0; right: 0; z-index: 1; display: flex; align-items: center; justify-content: center; min-height: 34px; color: #55524b; font-size: 13px; }
.chat-topbar .icon-button { position: absolute; right: 18px; }
.conversation-view { display: flex; flex: 1; flex-direction: column; min-height: 100vh; padding: 70px 24px 26px; }
.messages { width: min(100%, 760px); margin: 0 auto; flex: 1; display: flex; flex-direction: column; gap: 25px; padding: 12px 0 30px; }
.message { display: flex; gap: 13px; align-items: flex-start; animation: appear .16s ease-out; }
.message.user { justify-content: flex-end; }
.message-avatar { flex: 0 0 30px; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; background: #f1eee7; color: var(--accent-dark); font-size: 14px; }
.message-body { max-width: min(92%, 650px); line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere; }
.message.user .message-body { display: flex; flex-direction: column; align-items: flex-end; padding: 0; border-radius: 0; background: transparent; }
.message-content { white-space: pre-wrap; overflow-wrap: anywhere; }
.message.user .message-content { padding: 11px 16px; border-radius: 17px 17px 4px 17px; background: #f0eee9; }
.message.assistant .message-body { padding: 3px 0; }
.message-meta { display: flex; gap: 9px; color: #9a968d; font-size: 10px; margin-top: 5px; }
.message-actions { display: flex; align-items: center; gap: 3px; min-height: 27px; margin-top: 3px; opacity: 0; transition: opacity .12s ease; }
.message:hover .message-actions, .message:focus-within .message-actions { opacity: 1; }
.message.user .message-actions { justify-content: flex-end; }
.message.assistant .message-actions { justify-content: flex-start; }
.message-time { margin-right: 3px; color: #9a968d; font-size: 10px; white-space: nowrap; }
.message-action { display: inline-grid; place-items: center; width: 27px; height: 27px; padding: 0; border: 0; border-radius: 7px; background: transparent; color: #77736b; font-size: 15px; cursor: pointer; }
.message-action:hover, .message-action:focus-visible { background: #efede7; color: #37352f; outline: none; }
.message.assistant .message-action { width: 28px; }
.followup-composer { position: sticky; bottom: 14px; }
.account-page { width: min(100%, 1200px); margin: 0 auto; padding: 30px clamp(18px, 3vw, 38px) 52px; }
.account-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin: 2px 0 25px; }
.account-brand { display: inline-flex; align-items: center; gap: 7px; color: var(--ink); text-decoration: none; margin-bottom: 28px; }
.account-brand .brand-word { display: inline; font-size: 22px; }
.account-header h1 { margin: 0 0 4px; font-size: 30px; }
.account-header .muted { margin: 0; }
.status-pill, .demo-chip { display: inline-flex; align-items: center; border-radius: 999px; background: #f1efe8; padding: 5px 10px; color: #615e55; font-size: 11px; }
.balance-card, .panel { border: 1px solid var(--line); border-radius: 18px; background: var(--surface); }
.balance-card { padding: 21px 24px 23px; margin-bottom: 19px; }
.balance-card-heading { display: flex; align-items: center; justify-content: space-between; }
.balance-card h2, .panel h2 { margin: 0; font-size: 17px; letter-spacing: -.02em; }
.balance-layout { display: flex; align-items: center; justify-content: space-between; gap: 28px; padding-top: 18px; }
.field-caption { margin: 0 0 5px; color: var(--muted); font-size: 12px; }
.balance-amount { margin: 0 0 18px; font-size: clamp(27px, 4vw, 39px); line-height: 1.05; letter-spacing: -.05em; font-variant-numeric: tabular-nums; }
.balance-stats { display: flex; gap: clamp(24px, 5vw, 62px); padding: 0 5px; }
.balance-stats div { display: flex; flex-direction: column; gap: 7px; }
.balance-stats span { color: var(--muted); font-size: 12px; }
.balance-stats strong { font-size: 17px; font-weight: 500; font-variant-numeric: tabular-nums; }
.account-grid { display: grid; grid-template-columns: minmax(280px, .82fr) minmax(360px, 1.18fr); gap: 19px; align-items: start; }
.panel { padding: 22px 24px; }
.profile-panel { min-height: 320px; }
.stack-form { margin-top: 20px; }
.stack-form input { margin-top: -4px; }
.stack-form .button { margin-top: 17px; }
.text-danger { border: 0; background: transparent; padding: 0; margin-top: 24px; color: #ad5444; cursor: pointer; font-size: 12px; }
.billing-panel { min-height: 320px; }
.subsection-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 22px; }
.subsection-heading h3 { margin: 0; font-size: 13px; }
.demo-chip { background: #fbf0e8; color: #a75f42; font-size: 10px; }
.small-copy { margin: 7px 0 13px; font-size: 11px; }
.amount-presets { display: flex; gap: 7px; margin: 0 0 14px; }
.amount-preset { min-width: 47px; border: 0; border-radius: 9px; padding: 9px 12px; background: #f1efe9; cursor: pointer; }
.amount-preset.selected, .amount-preset:hover { background: #302f2b; color: white; }
.recharge-form { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; }
.recharge-form > div { display: flex; flex-direction: column; gap: 7px; }
.recharge-form label { margin: 0; }
.recharge-form input, .recharge-form select { min-width: 0; height: 43px; padding: 9px 11px; }
.recharge-form .button { grid-column: 1 / -1; margin-top: 3px; }
.redeem-block { border-top: 1px solid var(--line); padding-top: 16px; margin-top: 17px; }
.redeem-row { display: flex; gap: 9px; margin-top: 8px; }
.redeem-row input { flex: 1; min-width: 0; }
.tiny-copy { margin: 8px 0 0; font-size: 10px; }
.tiny-copy code { color: #6b5b4c; }
.ledger-panel { margin-top: 19px; padding-bottom: 10px; }
.ledger-heading { display: flex; flex-direction: column; gap: 18px; }
.ledger-tabs { display: flex; gap: 22px; border-bottom: 1px solid var(--line); }
.ledger-tab { position: relative; border: 0; background: transparent; padding: 0 0 11px; color: #77736b; cursor: pointer; }
.ledger-tab.selected { color: #37342e; }
.ledger-tab.selected::after { position: absolute; content: ""; height: 2px; border-radius: 4px; background: var(--accent); left: 0; right: 0; bottom: -1px; }
.table-scroll { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 11px; white-space: nowrap; }
thead { background: #f1efe9; color: #6b675e; }
th { padding: 12px 10px; font-weight: 500; text-align: left; }
td { padding: 12px 10px; border-bottom: 1px solid var(--line); color: #4f4b43; font-variant-numeric: tabular-nums; }
.positive { color: #447a56; }
.negative { color: #a85a48; }
.empty-ledger { padding: 25px 0; color: var(--muted); text-align: center; font-size: 12px; }
.toast { position: fixed; z-index: 30; left: 50%; bottom: 24px; transform: translate(-50%, 20px); max-width: calc(100vw - 30px); padding: 11px 16px; border: 1px solid rgba(255,255,255,.16); border-radius: 10px; background: #302f2b; color: white; box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: opacity .18s, transform .18s; font-size: 12px; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.dialog-backdrop { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 18px; background: rgba(34, 32, 27, .32); }
.order-dialog { position: relative; width: min(100%, 400px); border: 1px solid var(--line); border-radius: 18px; background: var(--surface); padding: 28px; box-shadow: var(--shadow); }
.order-dialog h2 { margin: 0 0 10px; font-size: 21px; }
.order-dialog .muted { margin: 0 0 12px; font-size: 13px; }
.dialog-close { position: absolute; top: 10px; right: 10px; font-size: 23px; }
.test-payment-note { margin: 0 0 18px; padding: 10px 12px; border-radius: 9px; background: #fff4e8; color: #795a41; font-size: 11px; line-height: 1.5; }
.loading { opacity: .7; }
@keyframes appear { from { opacity: .3; transform: translateY(3px); } to { opacity: 1; transform: translateY(0); } }
@media (max-width: 980px) {
  .account-grid { grid-template-columns: minmax(250px, .8fr) minmax(320px, 1.2fr); gap: 12px; }
  .panel { padding: 20px 17px; }
  .balance-card { padding: 19px; }
}
@media (max-width: 740px) {
  .sidebar { width: min(82vw, 290px); transform: translateX(-101%); box-shadow: none; }
  .sidebar.open { transform: translateX(0); box-shadow: 12px 0 30px rgba(0,0,0,.1); }
  .main-area { width: 100%; margin-left: 0; }
  .mobile-header { position: fixed; z-index: 3; inset: 0 0 auto 0; height: 52px; display: flex; align-items: center; justify-content: space-between; padding: 0 13px; background: rgba(250,249,246,.95); border-bottom: 1px solid rgba(226,223,215,.7); backdrop-filter: blur(8px); }
  .mobile-header .brand:not(.auth-brand) .brand-word { display: inline; font-size: 18px; }
  .empty-state { width: min(100% - 28px, 620px); padding: 58px 0 80px; }
  .empty-state h1 { margin-bottom: 27px; }
  .composer-wrap { width: 100%; }
  .conversation-view { padding: 64px 14px 18px; }
  .account-page { padding: 67px 14px 30px; }
  .account-header { align-items: flex-start; }
  .account-header .button { margin-top: 35px; white-space: nowrap; }
  .account-grid { grid-template-columns: 1fr; }
  .balance-layout { align-items: flex-start; flex-direction: column; gap: 20px; }
  .balance-stats { width: 100%; justify-content: space-between; }
  .balance-stats strong { font-size: 15px; }
  .profile-panel, .billing-panel { min-height: auto; }
}
@media (max-width: 430px) {
  .auth-card { padding: 28px 22px; }
  .account-header h1 { font-size: 26px; }
  .account-header { gap: 10px; }
  .account-header .button { padding: 9px 11px; font-size: 12px; }
  .recharge-form { grid-template-columns: 1fr; }
  .recharge-form .button { grid-column: auto; }
  .amount-presets { gap: 5px; }
  .amount-preset { min-width: 0; flex: 1; padding: 9px 5px; }
  .model-picker { gap: 5px; padding: 7px; }
  .model-picker .model-mode { display: none; }
  .composer-box { padding-left: 14px; padding-right: 11px; }
}
.hidden { display: none !important; }
.sidebar.collapsed { width: 76px; }
.sidebar.collapsed .brand-word,
.sidebar.collapsed .sidebar-collapse,
.sidebar.collapsed .nav-item > span:not(.nav-icon),
.sidebar.collapsed .nav-item small,
.sidebar.collapsed .recents-head,
.sidebar.collapsed .sidebar-projects,
.sidebar.collapsed .chat-list,
.sidebar.collapsed .wallet-mini,
.sidebar.collapsed .account-link-label,
.sidebar.collapsed .account-chevron { display: none; }
.sidebar.collapsed .main-nav { margin-top: 20px; }
.sidebar.collapsed .nav-item { justify-content: center; padding: 0; }
.sidebar.collapsed .sidebar-footer { display: flex; justify-content: center; }
.sidebar.collapsed .account-link { justify-content: center; }
.sidebar.collapsed + .main-area { margin-left: 76px; width: calc(100% - 76px); }
@media (pointer: coarse) { .sidebar-project-create { opacity: 1; } }
@media (max-width: 740px) { .sidebar.collapsed { width: min(82vw, 290px); } .sidebar.collapsed + .main-area { margin-left: 0; width: 100%; } }

.active-skills-note { width: min(100%, 720px); margin: 0 auto 9px; color: #8b684f; font-size: 11px; text-align: left; }
.skills-page { min-height: 100vh; }
.skill-safety-note { margin: -5px 0 18px; border: 1px solid #e6d5c9; border-radius: 12px; background: #fff8f1; padding: 12px 15px; color: #795b48; font-size: 12px; line-height: 1.6; }
.skills-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.skill-card { min-height: 155px; display: flex; flex-direction: column; gap: 14px; }
.skill-card-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.skill-card-heading h2 { margin: 0; font-size: 16px; }
.skill-card > p { flex: 1; margin: 0; font-size: 12px; }
.skill-enabled { background: #eaf2e8; color: #4d704e; }
.skill-actions { display: flex; align-items: center; gap: 8px; }
.skill-actions .button { padding: 8px 12px; font-size: 12px; }
.skill-actions .button:disabled { cursor: not-allowed; }
@media (max-width: 740px) { .skills-grid { grid-template-columns: 1fr; } .active-skills-note { width: 100%; } .account-page .account-brand { display: none; } }

.attachment-menu-wrap { position: relative; display: inline-flex; align-items: center; }
.plus-button[aria-expanded="true"] { background: #e8e5de; color: #282722; }
.attachment-menu { position: absolute; z-index: 15; top: calc(100% + 8px); left: 0; width: 254px; border: 1px solid #dedbd4; border-radius: 15px; background: #fffefa; padding: 6px; box-shadow: 0 10px 28px rgba(37, 34, 28, .16); color: #302e29; }
.attachment-menu-item { display: flex; align-items: center; width: 100%; min-height: 35px; gap: 10px; padding: 0 9px; border: 0; border-radius: 8px; background: transparent; text-align: left; cursor: pointer; font-size: 13px; white-space: nowrap; }
.attachment-menu-item:hover, .attachment-menu-item:focus-visible { background: #f2f0eb; outline: none; }
.attachment-menu-icon { flex: 0 0 18px; width: 18px; color: #55524b; text-align: center; font-size: 17px; line-height: 1; }
.attachment-menu-item kbd { margin-left: auto; color: #858178; font-family: inherit; font-size: 10px; }
.attachment-menu-divider { height: 1px; margin: 3px 7px; background: #e8e5de; }
.connector-menu-wrap { position: relative; }
.attachment-menu-chevron { margin-left: auto; color: #817d74; font-size: 20px; line-height: 1; }
.connector-submenu { position: absolute; z-index: 16; top: -6px; left: calc(100% + 8px); width: 220px; border: 1px solid #dedbd4; border-radius: 13px; background: #fffefa; padding: 8px; box-shadow: 0 10px 28px rgba(37, 34, 28, .16); }
.connector-empty { margin: 3px 6px 8px; color: #77736a; font-size: 11px; }
.connector-manage-button { width: 100%; border: 0; border-radius: 7px; background: transparent; padding: 8px 6px; text-align: left; cursor: pointer; color: #3d3a34; font: inherit; font-size: 12px; }
.connector-manage-button:hover { background: #f2f0eb; }
.followup-composer .attachment-menu { top: auto; bottom: calc(100% + 8px); }
.followup-composer .connector-submenu { top: auto; bottom: -6px; }
@media (max-width: 560px) { .connector-submenu { top: calc(100% + 4px); left: 0; width: 100%; } .followup-composer .connector-submenu { bottom: auto; } }
.plugin-dialog { position: fixed; inset: 0; width: min(720px, calc(100vw - 28px)); max-width: 720px; max-height: min(84vh, 760px); margin: auto; padding: 0; overflow-y: auto; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); color: var(--ink); box-shadow: 0 22px 60px rgba(37, 34, 28, .24); }
.plugin-dialog::backdrop { background: rgba(35, 32, 25, .38); backdrop-filter: blur(2px); }
.plugin-dialog-content { padding: 25px; }
.plugin-dialog-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; padding-right: 38px; }
.plugin-dialog-header h2 { margin: 3px 0 7px; font-size: 22px; }
.plugin-dialog-header .eyebrow { margin: 0; }
.plugin-dialog-header .muted { margin: 0; font-size: 12px; }
.plugin-safety-note { margin: 18px 0 0; border: 1px solid #e6d5c9; border-radius: 11px; background: #fff8f1; padding: 11px 13px; color: #795b48; font-size: 11px; line-height: 1.55; }
.plugin-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 14px; }
.plugin-card { min-width: 0; min-height: 0; display: flex; flex-direction: column; gap: 11px; padding: 15px; }
.plugin-card .skill-card-heading { align-items: flex-start; }
.plugin-card .skill-card-heading h2 { font-size: 15px; }
.plugin-description { flex: 1; margin: 0; font-size: 12px; line-height: 1.5; }
.plugin-usage, .plugin-example { display: flex; align-items: flex-start; gap: 7px; margin: 0; font-size: 11px; line-height: 1.5; }
.plugin-usage > span, .plugin-example > span { flex: 0 0 32px; color: var(--muted); }
.plugin-usage code, .plugin-example code { min-width: 0; overflow-wrap: anywhere; border-radius: 5px; background: #f4f1eb; padding: 2px 5px; color: #51483e; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 10px; }
.plugin-card .skill-actions { margin-top: 2px; flex-wrap: wrap; }
.plugin-empty { grid-column: 1 / -1; margin: 0; padding: 24px 8px; text-align: center; }
.active-plugins-note { width: min(100%, 720px); margin: 0 auto 8px; color: #76604e; font-size: 11px; text-align: left; line-height: 1.45; }
@media (max-width: 740px) { .plugin-dialog-content { padding: 20px 17px; } .plugin-grid { grid-template-columns: 1fr; } .plugin-dialog { max-height: 90vh; } }

.customize-page { min-height: 100vh; }
.customize-safety-note { margin: -5px 0 18px; border: 1px solid #e6d5c9; border-radius: 12px; background: #fff8f1; padding: 12px 15px; color: #795b48; font-size: 12px; line-height: 1.6; }
.customize-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.customize-upload-card { display: flex; flex-direction: column; gap: 15px; min-width: 0; }
.customize-upload-card h2 { margin: 2px 0 7px; font-size: 18px; }
.customize-upload-card .eyebrow { margin: 0; }
.customize-upload-card .muted { margin: 0; font-size: 12px; line-height: 1.55; }
.customize-upload-form { display: grid; gap: 9px; }
.customize-upload-form label { font-size: 12px; font-weight: 600; }
.customize-upload-form input[type="file"] { width: 100%; border: 1px solid var(--line); border-radius: 9px; background: #fffefa; padding: 9px; color: var(--ink); font: inherit; font-size: 11px; }
.customize-upload-form .button { justify-self: start; }
.customize-upload-form button:disabled { opacity: .55; cursor: wait; }
.customize-format-hint { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.55; }
.customize-manifest summary { color: #4f4b43; cursor: pointer; font-size: 12px; font-weight: 600; }
.customize-manifest pre { overflow-x: auto; margin: 10px 0; border-radius: 9px; background: #f4f1eb; padding: 12px; color: #51483e; font-size: 10px; line-height: 1.55; }
.customize-manifest p { margin: 0; }
.customize-import-list { display: grid; gap: 7px; border-top: 1px solid var(--line); padding-top: 10px; }
.customize-import-row { display: flex; justify-content: space-between; gap: 10px; color: #4f4b43; font-size: 11px; }
.customize-import-row span { color: var(--muted); white-space: nowrap; }
.customize-import-empty { margin: 0; font-size: 11px !important; }
@media (max-width: 740px) { .customize-grid { grid-template-columns: 1fr; } .customize-page .account-brand { display: none; } }

/* Conversation details stay beside the chat without changing its reading width. */
.chat-topbar { position: fixed; top: 0; left: 274px; right: 0; z-index: 2; min-height: 58px; padding: 10px 64px 10px 24px; gap: 10px; background: rgba(250, 249, 246, .96); backdrop-filter: blur(8px); }
#chatTitle { min-width: 0; max-width: min(42vw, 420px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-model-wrap { flex: 0 0 auto; }
.topbar-model-wrap .model-menu { top: calc(100% + 8px); bottom: auto; }
.sidebar.collapsed + .main-area .chat-topbar { left: 76px; }
.workspace-toggle[aria-expanded="true"] { background: #e9e6de; color: #3d3931; }
.conversation-workspace { position: fixed; z-index: 18; top: 62px; right: 18px; width: 314px; max-width: calc(100vw - 24px); max-height: calc(100vh - 80px); max-height: calc(100dvh - 80px); overflow-y: auto; overscroll-behavior: contain; border: 1px solid #dedad0; border-radius: 13px; background: var(--surface); box-shadow: 0 12px 36px rgba(48, 43, 34, .13); color: #433f36; animation: appear .14s ease-out; }
.workspace-panel-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 14px 5px 17px; color: #8a8478; font-size: 11px; }
.workspace-panel-header .icon-button { width: 25px; height: 25px; font-size: 20px; }
.workspace-loading { margin: 0; padding: 9px 17px; color: #8a8478; font-size: 11px; }
.workspace-error { margin: 8px 12px; padding: 10px 12px; border: 1px solid #e7cfc2; border-radius: 9px; background: #fff6ef; color: #93583e; font-size: 11px; line-height: 1.55; }
.workspace-error p { margin: 0; overflow-wrap: anywhere; }
.workspace-error .text-button { margin-top: 5px; padding: 0; font-size: 11px; }
.workspace-section + .workspace-section { border-top: 1px solid #e9e6de; }
.workspace-section > summary { display: flex; align-items: center; gap: 9px; min-height: 48px; padding: 10px 16px; cursor: pointer; list-style: none; user-select: none; font-size: 13px; font-weight: 550; }
.workspace-section > summary::-webkit-details-marker { display: none; }
.workspace-section > summary:hover { background: #f8f6f0; }
.workspace-section > summary:focus-visible { outline: 2px solid rgba(217,119,87,.5); outline-offset: -3px; border-radius: 7px; }
.workspace-section > summary > svg { flex: 0 0 18px; width: 18px; height: 18px; color: #6d685c; }
.workspace-section-meta { margin-left: auto; color: #9c9588; font-size: 10px; font-weight: 400; }
.workspace-section-meta[data-status="running"] { color: #a06b43; }
.workspace-section-meta[data-status="completed"] { color: #658064; }
.workspace-section-meta[data-status="failed"] { color: #a65c43; }
.workspace-chevron { margin-left: auto; color: #827b6d; font-size: 16px; line-height: 1; transform: rotate(-90deg); }
.workspace-section-meta + .workspace-chevron { margin-left: 1px; }
.workspace-section[open] > summary .workspace-chevron { transform: rotate(0deg); }
.workspace-section-content { padding: 0 17px 16px; }
.workspace-progress-title { margin: 1px 0 12px; color: #797265; font-size: 11px; line-height: 1.55; }
.workspace-progress-steps { display: grid; gap: 12px; padding: 0; margin: 0; list-style: none; }
.workspace-progress-step { position: relative; display: flex; align-items: flex-start; gap: 9px; font-size: 11px; line-height: 1.5; }
.workspace-progress-step:not(:last-child)::before { position: absolute; content: ""; top: 16px; bottom: -11px; left: 6px; width: 1px; background: #e1ddd2; }
.workspace-step-symbol { position: relative; z-index: 1; flex: 0 0 14px; display: inline-grid; place-items: center; width: 14px; height: 14px; margin-top: 2px; border: 1px solid #d8d3c7; border-radius: 50%; background: var(--surface); color: #819077; font-size: 10px; line-height: 1; }
.workspace-progress-step[data-status="completed"] .workspace-step-symbol { border-color: #d1dacb; background: #eef2e9; }
.workspace-progress-step[data-status="running"] .workspace-step-symbol { border: 3px solid #dab798; box-shadow: 0 0 0 3px #f7efe5; }
.workspace-progress-step[data-status="failed"] .workspace-step-symbol { color: #aa654b; border-color: #e4c8b8; background: #fff1e7; }
.workspace-step-label { color: #575044; }
.workspace-step-detail { margin: 3px 0 0; color: #948b7c; font-size: 10px; line-height: 1.55; overflow-wrap: anywhere; }
.workspace-folder-note, .workspace-empty-copy { margin: 0; color: #948b7c; font-size: 10px; line-height: 1.6; }
.workspace-folder-note { margin-bottom: 10px; }
.workspace-files { display: grid; gap: 6px; }
.workspace-file-button { display: flex; width: 100%; min-width: 0; align-items: center; gap: 9px; border: 1px solid #e8e3d8; border-radius: 9px; padding: 9px; background: #fcfaf5; color: #514b40; text-align: left; cursor: pointer; }
.workspace-file-button:hover { background: #f3efe5; border-color: #d7cdbb; }
.workspace-document-icon { flex: 0 0 29px; display: inline-grid; place-items: center; width: 29px; height: 34px; border: 1px solid #d7cdb9; border-radius: 4px 7px 4px 4px; background: #f4ecdc; color: #9a835d; font-size: 8px; font-weight: 700; }
.workspace-file-label { flex: 1; min-width: 0; }
.workspace-file-label strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; font-weight: 500; }
.workspace-file-label small { display: block; margin-top: 3px; color: #a09684; font-size: 9px; }
.workspace-file-arrow { color: #9c927f; font-size: 19px; }
.workspace-context-empty { display: flex; flex-direction: column; align-items: center; padding: 13px 8px 9px; text-align: center; }
.workspace-context-illustration { width: 105px; height: 79px; margin: 1px 0 9px; }
.workspace-context-empty p { max-width: 225px; margin: 0; color: #a1998a; font-size: 11px; line-height: 1.65; }
.workspace-context-meta { display: grid; gap: 8px; padding: 12px 0 2px; color: #8e8576; font-size: 10px; }
.workspace-context-meta > div { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.workspace-context-meta strong { min-width: 0; max-width: 190px; overflow-wrap: anywhere; color: #6b6254; font-size: 10px; font-weight: 500; text-align: right; }
.workspace-context-meta .workspace-token-row { justify-content: flex-start; gap: 13px; padding-top: 2px; }
.workspace-token-row strong { margin-left: 4px; font-variant-numeric: tabular-nums; }
.workspace-token-row small { color: #aaa18f; font-size: 9px; }
.workspace-resources { display: grid; gap: 11px; padding: 0; margin: 14px 0 0; list-style: none; }
.workspace-resources:empty { display: none; }
.workspace-resource { display: flex; align-items: flex-start; gap: 8px; min-width: 0; }
.workspace-resource-kind { flex: 0 0 auto; margin-top: 1px; border-radius: 4px; background: #f0ece2; padding: 2px 5px; color: #9b876b; font-size: 9px; line-height: 1.45; }
.workspace-resource > div { flex: 1; min-width: 0; }
.workspace-resource strong { display: block; color: #655c4d; font-size: 11px; line-height: 1.5; font-weight: 500; overflow-wrap: anywhere; }
.workspace-resource p { margin: 3px 0 0; color: #9d9280; font-size: 10px; line-height: 1.55; overflow-wrap: anywhere; }
.workspace-context-note { margin: 12px 0 0; border-top: 1px solid #ece7db; padding-top: 10px; color: #9c907c; font-size: 10px; line-height: 1.6; }
.workspace-file-dialog { position: fixed; inset: 0; width: min(760px, calc(100vw - 28px)); max-width: 760px; max-height: calc(100vh - 48px); max-height: calc(100dvh - 48px); margin: auto; padding: 0; overflow: auto; border: 1px solid #ded6c8; border-radius: 15px; background: var(--surface); color: var(--ink); box-shadow: 0 24px 70px rgba(40,35,27,.24); }
.workspace-file-dialog::backdrop { background: rgba(39,35,28,.32); backdrop-filter: blur(2px); }
.workspace-file-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding: 21px 22px 10px; }
.workspace-file-header .eyebrow { margin: 0 0 6px; font-size: 9px; }
.workspace-file-header h2 { margin: 0; color: #4d4538; font-size: 17px; font-weight: 600; overflow-wrap: anywhere; }
.workspace-file-header .icon-button { flex: 0 0 30px; width: 30px; height: 30px; }
.workspace-file-description { margin: 0; padding: 0 22px 12px; color: #9a8f7d; font-size: 10px; line-height: 1.5; }
.workspace-file-text { min-height: 190px; max-height: 55vh; max-height: 55dvh; margin: 0 14px; overflow: auto; border: 1px solid #ebe5da; border-radius: 9px; background: #f8f5ee; padding: 16px; color: #605748; font: 12px/1.8 ui-monospace, SFMono-Regular, Consolas, "Microsoft YaHei", monospace; white-space: pre-wrap; overflow-wrap: anywhere; tab-size: 4; }
.workspace-file-footer { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; padding: 14px 22px 19px; color: #a19784; font-size: 10px; }
.workspace-file-footer a { text-decoration: none; font-size: 11px !important; }
@media (max-width: 740px) {
  .chat-topbar, .sidebar.collapsed + .main-area .chat-topbar { top: 52px; left: 0; min-height: 48px; padding: 7px 53px 7px 13px; }
  .chat-topbar .icon-button { right: 10px; }
  #chatTitle { max-width: 34vw; font-size: 11px; }
  .topbar-model-wrap .model-picker { max-width: 40vw; font-size: 10px; }
  #chatTopbarModelName { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .conversation-view { padding-top: 111px; }
  .conversation-workspace { top: 104px; right: 12px; max-height: calc(100vh - 118px); max-height: calc(100dvh - 118px); }
  .workspace-file-header { padding: 17px 16px 9px; }
  .workspace-file-description { padding-right: 16px; padding-left: 16px; }
  .workspace-file-text { margin: 0 10px; padding: 12px; font-size: 11px; }
  .workspace-file-footer { padding: 13px 16px 16px; }
}
@media (prefers-reduced-motion: reduce) { .conversation-workspace { animation: none; } }

/* The Directory is also installed by JS when Flask is serving a cached template. */
.plugin-dialog.plugin-directory { width: min(1024px, calc(100vw - 36px)); max-width: 1024px; height: min(780px, calc(100vh - 64px)); height: min(780px, calc(100dvh - 64px)); max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); overflow: hidden; border-radius: 16px; background: #fcfbf7; }
.plugin-directory-layout { display: grid; grid-template-columns: 200px minmax(0, 1fr); height: 100%; min-height: 0; }
.plugin-directory-sidebar { display: flex; flex-direction: column; border-right: 1px solid #e4e0d6; background: #f4f2eb; padding: 29px 15px 20px; }
.plugin-directory-sidebar h2 { margin: 0 12px 30px; color: #3b3830; font-size: 21px; font-weight: 550; letter-spacing: -.045em; }
.directory-nav-item { display: flex; align-items: center; gap: 9px; width: 100%; min-height: 40px; border: 0; border-radius: 8px; background: #e8e4da; padding: 9px 12px; color: #4c463b; text-align: left; cursor: pointer; font-size: 13px; font-weight: 550; }
.directory-nav-item svg { width: 18px; height: 18px; flex: 0 0 18px; color: #7e705d; }
.directory-nav-item small { margin-left: auto; color: #8e826f; font-size: 10px; font-weight: 400; }
.directory-sidebar-note { margin: auto 12px 0; padding-top: 25px; color: #8d806c; font-size: 10px; line-height: 1.5; }
.directory-sidebar-note span { color: #736957; font-size: 11px; }
.directory-sidebar-note p { margin: 4px 0 0; color: #a29682; }
.plugin-directory-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; padding: 28px 30px 0; background: #fffefa; }
.directory-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; }
.directory-header h3 { margin: 0; color: #35332e; font-size: 25px; font-weight: 550; letter-spacing: -.035em; }
.directory-header p { margin: 6px 0 0; color: #9c9383; font-size: 11px; line-height: 1.6; }
.directory-header-actions { display: flex; align-items: center; gap: 8px; padding-top: 0; }
.directory-add-button { display: inline-grid; place-items: center; width: 34px; height: 34px; padding: 0; border: 1px solid #dcd5c8; border-radius: 8px; background: #fffefa; color: #6b604d; cursor: pointer; font-size: 24px; line-height: 1; }
.directory-add-button:hover { background: #f0eadf; }
.directory-add-button:disabled { opacity: .5; cursor: wait; }
.directory-close-button { width: 31px; height: 34px; font-size: 23px; color: #8d8372; }
.directory-search-wrap { position: relative; display: flex; align-items: center; gap: 9px; min-width: 0; margin-top: 24px; border: 1px solid #ddd7cb; border-radius: 9px; padding: 0 12px; background: #fffefa; }
.directory-search-wrap:focus-within { border-color: #bfa17e; box-shadow: 0 0 0 2px rgba(191,161,126,.1); }
.directory-search-wrap > svg { flex: 0 0 17px; width: 17px; height: 17px; color: #9e9482; }
.directory-search-wrap input { min-width: 0; width: 100%; height: 40px; border: 0; border-radius: 0; padding: 8px 0; background: transparent; color: #625949; box-shadow: none; font-size: 12px; }
.directory-search-wrap input::placeholder { color: #a49a89; }
.directory-search-wrap input:focus { border: 0; box-shadow: none; }
.directory-search-wrap input::-webkit-search-cancel-button { display: none; }
.directory-search-wrap .icon-button { width: 23px; height: 25px; flex: 0 0 23px; font-size: 18px; }
.directory-toolbar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; margin: 17px 0 13px; }
.directory-categories { display: flex; align-items: center; gap: 4px; }
.directory-categories button { display: flex; align-items: center; gap: 5px; min-height: 30px; border: 0; border-radius: 7px; padding: 6px 9px; background: transparent; color: #9a8f7b; cursor: pointer; font-size: 11px; }
.directory-categories button:hover { background: #f5f0e6; }
.directory-categories button[aria-pressed="true"] { background: #ece6d9; color: #746043; }
.directory-categories button span { font-size: 9px; color: #ab9c84; }
.directory-sort-label select { max-width: 150px; height: 29px; border: 0; border-radius: 6px; background: #f5f2ea; padding: 5px 24px 5px 8px; color: #9b8b72; font-size: 10px; }
.directory-results { position: relative; flex: 1; min-height: 150px; overflow-y: auto; overscroll-behavior: contain; margin: 0 -7px; padding: 0 7px 20px; }
.directory-results-heading { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; color: #a89b84; font-size: 10px; line-height: 1.6; }
#directoryEnabledCount { margin-left: auto; color: #b5a78f; font-size: 9px; }
#directoryLoading { color: #a78151; }
.directory-drop-hint { position: absolute; z-index: 3; inset: 0 7px 12px; display: none; flex-direction: column; align-items: center; justify-content: center; gap: 7px; border: 2px dashed #b9a078; border-radius: 12px; background: rgba(249,245,235,.96); color: #8e7550; pointer-events: none; }
.directory-results.dragging .directory-drop-hint { display: flex; }
.directory-drop-hint > span { margin-bottom: 6px; font-size: 39px; line-height: 1; }
.directory-drop-hint strong { font-size: 14px; font-weight: 500; }
.directory-drop-hint small { color: #b09b77; font-size: 11px; }
.plugin-grid.directory-plugin-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; margin: 0; }
.directory-plugin-card { display: flex; flex-direction: column; gap: 12px; min-width: 0; border: 1px solid #e5dfd2; border-radius: 11px; padding: 17px 16px 13px; background: #fffefa; scroll-margin: 8px; transition: border-color .15s, box-shadow .15s; }
.directory-plugin-card:hover { border-color: #d1c6b0; box-shadow: 0 3px 11px rgba(93,75,44,.04); }
.directory-plugin-card.directory-plugin-new { border-color: #b99b68; box-shadow: 0 0 0 2px #eee3cd; }
.directory-plugin-card:focus-visible { outline: 2px solid #c7ab7f; outline-offset: 2px; }
.directory-card-header { display: flex; align-items: flex-start; gap: 10px; min-width: 0; }
.directory-card-icon { display: inline-grid; place-items: center; flex: 0 0 35px; width: 35px; height: 35px; border: 1px solid #e4dccb; border-radius: 9px; background: #f3eddf; color: #9b8055; font: 17px/1 ui-monospace, SFMono-Regular, Consolas, monospace; }
.directory-card-icon.uploaded { background: #f2eadf; color: #a78358; font-size: 23px; }
.directory-card-header > div { min-width: 0; flex: 1; }
.directory-card-header h4 { margin: 0; color: #5b503f; font-size: 13px; line-height: 1.45; font-weight: 600; overflow-wrap: anywhere; }
.directory-card-header p { margin: 4px 0 0; color: #b2a186; font-size: 9px; }
.directory-card-badge { flex: 0 0 auto; margin-top: 2px; border-radius: 4px; padding: 3px 5px; background: #f3efe6; color: #b1a183; font-size: 8px; white-space: nowrap; }
.directory-card-badge.enabled { background: #edf0e4; color: #85916b; }
.directory-card-description { flex: 1; margin: 0; color: #9b8d76; font-size: 11px; line-height: 1.7; overflow-wrap: anywhere; }
.directory-card-command { display: flex; flex-direction: column; gap: 5px; min-width: 0; margin: 0; color: #b2a084; font-size: 9px; }
.directory-card-command code { display: block; padding: 6px 8px; border-radius: 5px; background: #f7f3ea; color: #9c8665; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 10px; line-height: 1.6; overflow-wrap: anywhere; }
.directory-card-footer { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 7px; border-top: 1px solid #f0eadf; margin-top: 1px; padding-top: 11px; }
.directory-card-footer > small { color: #b4a58b; font-size: 9px; }
.directory-card-actions { display: flex; align-items: center; gap: 9px; margin-left: auto; }
.directory-card-actions .button { min-width: 49px; border-radius: 6px; padding: 6px 9px; font-size: 10px; font-weight: 500; }
.directory-card-actions .button.dark { background: #7f6b4a; color: #fffdf7; }
.directory-card-actions .button.dark:hover { background: #6f5b3b; }
.directory-card-actions .button.outline { border-color: #ded3bf; color: #9a845f; }
.directory-uninstall { border: 0; background: transparent; padding: 4px 0; color: #b0a087; cursor: pointer; font-size: 9px; }
.directory-uninstall:hover { color: #9b6246; }
.directory-uninstall:disabled { opacity: .5; cursor: wait; }
.directory-empty { display: flex; grid-column: 1 / -1; flex-direction: column; align-items: center; justify-content: center; min-height: 300px; padding: 30px 16px; text-align: center; }
.directory-empty-icon { display: grid; place-items: center; width: 74px; height: 74px; margin-bottom: 17px; border: 1px solid #e5ddcd; border-radius: 18px; background: #f8f3e7; color: #c2ae88; }
.directory-empty-icon svg { width: 41px; height: 41px; }
.directory-empty h4 { margin: 0; color: #7d6c51; font-size: 17px; font-weight: 550; }
.directory-empty p { max-width: 300px; margin: 9px 0 19px; color: #ac9a7c; font-size: 11px; line-height: 1.65; }
.directory-empty .button.dark { border-radius: 7px; padding: 10px 16px; background: #8b7550; font-size: 11px; }
.directory-empty > small { margin-top: 13px; color: #c0ae8d; font-size: 9px; }
.directory-footer { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 8px 18px; border-top: 1px solid #ece6d9; margin-top: auto; padding: 12px 0 14px; color: #bcaa8b; font-size: 9px; }
.directory-footer details { flex: 1; }
.directory-footer summary { width: max-content; color: #a58d67; cursor: pointer; font-size: 10px; }
.directory-footer #pluginSafetyNote { max-width: 580px; margin: 8px 0 1px; color: #ad9979; font-size: 10px; line-height: 1.7; }
.directory-footer > span { white-space: nowrap; }
.directory-upload-status, .directory-load-error { display: flex; align-items: flex-start; gap: 9px; margin: 0 0 12px; border: 1px solid #e1d3b9; border-radius: 8px; padding: 10px 12px; background: #fbf6e9; color: #9f8152; font-size: 10px; line-height: 1.6; }
.directory-upload-status > span { display: inline-grid; place-items: center; width: 18px; height: 18px; flex: 0 0 18px; border-radius: 50%; background: #efe2c7; color: #aa8853; font-size: 13px; }
.directory-upload-status p, .directory-load-error p { margin: 0; overflow-wrap: anywhere; }
.directory-upload-status-actions { display: flex; gap: 13px; margin-top: 3px; }
.directory-upload-status .text-button, .directory-load-error .text-button { padding: 0; color: #9f7542; font-size: 10px; font-weight: 500; }
.directory-upload-status[data-status="error"], .directory-load-error { border-color: #e6cbb7; background: #fdf3e9; color: #ad7753; }
.directory-upload-status[data-status="success"] { border-color: #d4dbc1; background: #f6f8ee; color: #8b946b; }
.directory-upload-status[data-status="success"] > span { background: #e5ead7; color: #8b946b; }
.directory-load-error { justify-content: space-between; }
.directory-load-error .text-button { flex: 0 0 auto; }
.plugin-directory-initial { margin: 45px; color: #9c8e75; text-align: center; }
@media (max-width: 900px) {
  .plugin-directory-layout { grid-template-columns: 170px minmax(0, 1fr); }
  .plugin-directory-main { padding-right: 22px; padding-left: 22px; }
  .directory-plugin-card { padding: 14px 12px 12px; }
  .directory-card-header { gap: 8px; flex-wrap: wrap; }
  .directory-card-badge { margin-left: 43px; margin-top: -4px; }
}
@media (max-width: 740px) {
  .plugin-dialog.plugin-directory { width: calc(100vw - 20px); height: calc(100vh - 30px); height: calc(100dvh - 30px); max-height: calc(100vh - 20px); max-height: calc(100dvh - 20px); border-radius: 13px; }
  .plugin-directory-layout { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .plugin-directory-sidebar { flex-direction: row; align-items: center; gap: 17px; border-right: 0; border-bottom: 1px solid #e4e0d6; padding: 12px 17px; }
  .plugin-directory-sidebar h2 { margin: 0; font-size: 16px; }
  .plugin-directory-sidebar nav { min-width: 125px; }
  .directory-nav-item { min-height: 30px; padding: 6px 9px; font-size: 11px; }
  .directory-nav-item svg { width: 15px; height: 15px; flex-basis: 15px; }
  .directory-sidebar-note { display: none; }
  .plugin-directory-main { padding: 19px 17px 0; min-height: 0; }
  .directory-header h3 { font-size: 23px; }
  .directory-header p { max-width: 215px; font-size: 10px; }
  .directory-search-wrap { margin-top: 18px; }
  .directory-toolbar { gap: 10px; margin-top: 13px; }
  .directory-categories { gap: 2px; }
  .directory-categories button { padding: 6px 7px; font-size: 10px; }
  .plugin-grid.directory-plugin-grid { grid-template-columns: minmax(0, 1fr); }
  .directory-card-header { flex-wrap: nowrap; }
  .directory-card-badge { margin: 2px 0 0; }
  .directory-results { min-height: 100px; }
  .directory-empty { min-height: 260px; }
  .directory-footer > span { display: none; }
  .directory-load-error { flex-wrap: wrap; }
}
@media (max-width: 390px) {
  .plugin-directory-main { padding-right: 13px; padding-left: 13px; }
  .directory-toolbar { align-items: flex-start; gap: 8px; }
  .directory-sort-label { width: 100%; }
  .directory-sort-label select { width: 100%; max-width: none; }
  .directory-header-actions { gap: 4px; }
  .directory-header { gap: 9px; }
}

.skills-page-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.skills-page-actions .button { white-space: nowrap; }
.skills-upload-feedback { margin: -10px 0 18px; color: var(--muted); font-size: 12px; line-height: 1.6; overflow-wrap: anywhere; }
.skills-upload-feedback[data-status="error"] { color: #ad4d37; }
.skills-upload-feedback[data-status="success"] { color: #4d704e; }
.skill-card.skill-upload-highlight { border-color: #b6a482; box-shadow: 0 0 0 2px #e9e2d4; }
.skill-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
@media (max-width: 600px) { .skills-page .account-header { flex-wrap: wrap; align-items: flex-start; gap: 16px; } .skills-page-actions { flex-wrap: wrap; } .skills-upload-feedback { margin-top: 0; } }

.site-announcement-dialog { width: min(100% - 28px, 480px); max-height: min(82vh, 620px); overflow: auto; padding: 22px 24px 18px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); color: var(--ink); box-shadow: 0 18px 60px rgba(40,36,28,.2); }
.site-announcement-dialog::backdrop { background: rgba(34,32,27,.38); backdrop-filter: blur(2px); }
.site-announcement-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.site-announcement-header .eyebrow { margin: 0 0 5px; color: var(--accent-dark); }
.site-announcement-header h2 { margin: 0; font-size: 19px; }
.site-announcement-text { margin: 17px 0 20px; color: #615d54; font-size: 13px; line-height: 1.75; white-space: pre-wrap; overflow-wrap: anywhere; }
.site-announcement-footer { display: flex; justify-content: flex-end; }
.site-announcement-footer .button { min-width: 90px; margin: 0; }
@media (pointer: coarse) { .message-actions { opacity: 1; } }
@media (max-width: 500px) { .site-announcement-dialog { padding: 19px 17px 16px; } .message-actions { opacity: 1; } .message-action { width: 30px; height: 30px; } }

.preferences-panel { margin-top: 17px; }
.preferences-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.preferences-heading h2 { margin: 0 0 5px; font-size: 15px; }
.preferences-heading .small-copy { margin: 0; font-size: 11px; }
.preference-badge { flex: 0 0 auto; border: 1px solid #e6d5c9; border-radius: 999px; background: #fff8f1; padding: 6px 9px; color: #795b48; font-size: 10px; }
.preferences-form { display: grid; gap: 9px; margin-top: 17px; }
.preferences-form > label { color: #56534c; font-size: 12px; font-weight: 600; }
#customInstructions { width: 100%; min-height: 126px; resize: vertical; line-height: 1.6; }
.preferences-meta { display: flex; justify-content: space-between; gap: 16px; color: #8a867d; font-size: 10px; line-height: 1.5; }
#customInstructionsCount { flex: 0 0 auto; font-variant-numeric: tabular-nums; }
.preferences-actions { display: flex; align-items: center; gap: 9px; }
.preferences-actions .button { margin-top: 3px; }
@media (max-width: 430px) { .preferences-meta { flex-direction: column; gap: 3px; } }

/* Projects MVP */
.chat-project-select { position: absolute; left: 18px; top: 2px; max-width: min(28vw, 210px); height: 31px; padding: 5px 28px 5px 9px; border-color: transparent; background: #f2f0eb; color: #57534b; font-size: 11px; }
.chat-project-select:hover { border-color: var(--line); }
.projects-header { align-items: flex-end; }
.projects-header-actions, .project-detail-actions { display: flex; align-items: center; gap: 8px; }
.projects-header-actions .button { margin-top: 0; white-space: nowrap; }
.projects-header-actions .button.primary { margin-top: 0; }
.projects-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: 14px; }
.project-card { min-width: 0; padding: 19px 20px; border: 1px solid var(--line); border-radius: 15px; background: var(--surface); transition: border-color .15s, transform .15s, box-shadow .15s; }
.project-card:hover { transform: translateY(-1px); border-color: #d3c9b9; box-shadow: 0 7px 20px rgba(51,47,39,.06); }
.project-card-main { display: flex; align-items: flex-start; gap: 11px; min-width: 0; }
.project-card-icon { flex: 0 0 38px; width: 38px; height: 38px; display: grid; place-items: center; border-radius: 11px; background: #f1efe9; color: #6d665b; font-size: 19px; }
.project-card-copy { min-width: 0; flex: 1; }
.project-card h2 { margin: 1px 0 5px; overflow: hidden; color: var(--ink); font-size: 15px; text-overflow: ellipsis; white-space: nowrap; }
.project-card-meta { color: var(--muted); font-size: 11px; }
.project-card-description { display: -webkit-box; min-height: 36px; margin: 14px 0 15px; overflow: hidden; color: #767168; font-size: 11px; line-height: 1.55; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.project-card-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; border-top: 1px solid #eeeae2; padding-top: 12px; }
.project-card-actions .text-button { font-size: 11px; }
.project-card-open { border: 0; background: transparent; padding: 2px 0; color: #a85b42; font-size: 12px; font-weight: 650; cursor: pointer; }
.project-card-open:hover, .project-card-actions .text-button:hover { text-decoration: underline; }
.projects-empty { margin: 20px 0 0; padding: 36px 18px; border: 1px dashed #d9d4c9; border-radius: 14px; color: var(--muted); text-align: center; font-size: 12px; line-height: 1.6; }
.project-detail { margin-top: 18px; padding: 22px 24px; }
.project-detail-header { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.project-detail-header h2 { overflow-wrap: anywhere; }
.project-detail-actions .button { padding: 8px 11px; font-size: 11px; white-space: nowrap; }
.project-delete-button { color: #a85a48 !important; }
.project-instructions-card { margin-top: 16px; padding: 13px 15px; border-radius: 11px; background: #f7f5ef; }
.project-instructions-card .field-caption { font-weight: 650; }
.project-detail-instructions { margin: 6px 0 0; color: #615d54; font-size: 12px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
.project-context-note { margin: 9px 0 0; border-left: 2px solid #d8c5b3; padding: 7px 10px; color: #777168; font-size: 10px; line-height: 1.55; }
.project-chats-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 20px 0 10px; }
.project-chats-heading h3 { margin: 0; font-size: 13px; }
.project-chats-heading span { color: var(--muted); font-size: 10px; }
.project-chat-list { display: grid; gap: 7px; }
.project-chat-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-width: 0; padding: 10px 12px; border: 1px solid #eeeae2; border-radius: 9px; background: #fffefa; }
.project-chat-title { min-width: 0; overflow: hidden; color: #47443d; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.project-chat-actions { display: flex; flex: 0 0 auto; align-items: center; gap: 8px; }
.project-chat-row .text-button { flex: 0 0 auto; font-size: 11px; }
.project-chat-continue { white-space: nowrap; }
.project-chat-empty { padding: 21px 10px; color: #817d74; text-align: center; font-size: 11px; }
.task-handoff-dialog { width: min(100% - 28px, 680px); }
.handoff-source-label { margin: 0; color: #716c62; font-size: 11px; line-height: 1.6; overflow-wrap: anywhere; }
#taskHandoffCheckpoint { width: 100%; min-height: 250px; resize: vertical; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 11px; line-height: 1.6; }
#taskHandoffCount { float: right; font-weight: 400; }
.handoff-usage-note { border-left: 2px solid #d9c8b7; padding-left: 9px; }
.task-handoff-card { width: min(100%, 760px); margin: 2px auto 3px; padding: 13px 15px; border: 1px solid #e7dfd3; border-radius: 12px; background: #f7f5ef; color: #625d54; }
.task-handoff-card-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.task-handoff-card-header strong { min-width: 0; overflow: hidden; color: #514c43; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.task-handoff-card-header span { flex: 0 0 auto; color: #9a8068; font-size: 10px; }
.task-handoff-card details { margin-top: 7px; }
.task-handoff-card summary { color: #8d6148; font-size: 10px; cursor: pointer; }
.task-handoff-card pre { max-height: 230px; margin: 9px 0 0; overflow: auto; color: #625d54; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 10px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
.task-handoff-card > p { margin: 7px 0 0; color: #999184; font-size: 9px; line-height: 1.5; }
.project-editor { width: min(100% - 28px, 560px); max-width: 560px; max-height: min(88vh, 760px); overflow: auto; padding: 0; border: 1px solid var(--line); border-radius: 17px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.project-editor::backdrop { background: rgba(34,32,27,.38); backdrop-filter: blur(2px); }
.project-editor-form { display: grid; gap: 9px; padding: 23px 25px 20px; }
.project-editor-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; margin-bottom: 5px; }
.project-editor-header .eyebrow { margin-bottom: 5px; color: var(--accent-dark); }
.project-editor-header h2 { margin: 0; font-size: 19px; }
.project-editor-form > label { margin-top: 4px; color: #56534c; font-size: 12px; font-weight: 650; }
.project-label-note { color: #969187; font-weight: 400; }
.project-editor-form > input { min-width: 0; }
.project-editor-form textarea { width: 100%; min-height: 130px; resize: vertical; line-height: 1.6; }
.project-editor-help { margin: 0; color: #8a867d; font-size: 10px; line-height: 1.5; }
.project-editor-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 10px; }
.project-editor-actions .button { min-width: 80px; }
@media (max-width: 740px) {
  .projects-header { align-items: flex-start; flex-wrap: wrap; gap: 12px; }
  .projects-header .account-brand { display: none; }
  .projects-header-actions { width: 100%; }
  .projects-header-actions .button { flex: 1; }
  .project-detail { padding: 17px 15px; }
  .project-detail-header { align-items: flex-start; flex-direction: column; }
  .project-detail-actions { width: 100%; flex-wrap: wrap; }
  .project-detail-actions .button { flex: 1; }
  .chat-project-select { left: 12px; top: 37px; max-width: calc(42vw - 16px); height: 28px; padding: 3px 22px 3px 7px; font-size: 10px; }
}
@media (max-width: 430px) {
  .project-editor-form { padding: 20px 17px 17px; }
  .project-chat-row { align-items: flex-start; flex-direction: column; }
  .project-chat-actions { width: 100%; justify-content: flex-end; flex-wrap: wrap; }
  .project-chats-heading { align-items: flex-start; flex-direction: column; gap: 4px; }
  .chat-project-select { max-width: 42vw; }
}
