:root {
  color-scheme: light;
  --ink: #272b29;
  --muted: #858b87;
  --line: #e9e9e5;
  --side: #f7f7f4;
  --accent: #397f67;
  --left-width: 252px;
  --right-width: 286px;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { color: var(--ink); background: #fff; font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; font-size: 14px; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, textarea:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
[hidden] { display: none !important; }
.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; }
.skip-link { position: absolute; left: 16px; top: -60px; z-index: 100; padding: 10px 14px; background: #fff; color: var(--ink); border-radius: 8px; }
.skip-link:focus { top: 12px; }
.app-shell { display: grid; grid-template-columns: var(--left-width) minmax(0, 1fr) var(--right-width); width: 100%; height: 100vh; height: 100dvh; min-height: 420px; overflow: hidden; }
.app-shell.left-collapsed { --left-width: 48px; }
.app-shell.right-collapsed { --right-width: 48px; }
.sidebar { min-width: 0; min-height: 0; background: var(--side); position: relative; }
.sidebar-left { border-right: 1px solid var(--line); }
.sidebar-right { border-left: 1px solid var(--line); }
.sidebar-panel { display: flex; flex-direction: column; height: 100%; min-width: 0; padding: 24px 16px 16px; }
.left-panel { padding-left: 16px; padding-right: 16px; }
.right-panel { padding-left: 18px; padding-right: 18px; }
.rail-toggle { display: none; width: 100%; height: 100%; border: 0; background: transparent; color: #616d65; align-items: flex-start; justify-content: center; padding: 23px 0 0; writing-mode: vertical-rl; letter-spacing: .18em; font-size: 12px; font-weight: 650; }
.rail-toggle:hover { background: #eeeeea; color: #2c6753; }
.left-collapsed .left-rail, .right-collapsed .right-rail { display: flex; }
.left-collapsed .left-panel, .right-collapsed .right-panel { display: none; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; min-height: 28px; gap: 8px; margin-bottom: 28px; }
.brand { font-size: 18px; font-weight: 750; letter-spacing: -.035em; white-space: nowrap; text-decoration: none; color: #28382f; }
.panel-heading h2 { margin: 0; font-size: 15px; font-weight: 700; }
.panel-close { border: 0; background: transparent; color: #7b847e; font-size: 12px; padding: 7px 3px; white-space: nowrap; }
.panel-close:hover { color: var(--ink); }
.new-chat-button { width: 100%; padding: 11px 13px; text-align: left; border: 1px solid #dce3db; border-radius: 10px; background: #edf3ec; color: #2f604e; font-weight: 650; }
.new-chat-button:hover { background: #e4eee3; }
.search-label { display: none; }
.conversation-search { display: block; width: 100%; margin: 15px 0 27px; padding: 10px 12px; border: 1px solid #e5e6e2; border-radius: 9px; background: #fff; color: var(--ink); outline: none; }
.conversation-search::placeholder { color: #a0a59f; }
.conversation-search:focus { border-color: #8eae9b; }
.section-label { margin: 0 2px 10px; color: #8d938e; font-size: 11px; font-weight: 700; letter-spacing: .08em; }
.conversation-nav { flex: 1; min-height: 0; overflow-y: auto; }
.sidebar-empty { margin: 8px 2px; color: #9b9f9a; font-size: 12px; line-height: 1.5; }
.conversation-item { display: block; width: 100%; padding: 11px 12px; border: 0; border-radius: 8px; background: transparent; color: #58615a; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.conversation-item:hover { background: #edeeea; }
.conversation-item.is-active { background: #e9eee8; color: #315c48; font-weight: 650; }
.left-footer { border-top: 1px solid var(--line); padding: 17px 4px 0; color: #929892; font-size: 12px; }
.center-column { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: #fff; }
.chat-scroll { flex: 1; min-height: 0; overflow-y: auto; }
.message-list { width: min(100% - 48px, 760px); margin: 0 auto; padding: 46px 0 28px; }
.message-row { display: flex; justify-content: flex-end; margin-top: 20px; }
.message-bubble { max-width: min(80%, 620px); padding: 13px 16px; border-radius: 17px 17px 5px 17px; background: #eef2ed; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.6; }
.message-meta { margin: 6px 3px 0; color: #a1a7a0; text-align: right; font-size: 11px; }
.service-status { margin: 28px 0 0; color: #858d86; font-size: 12px; line-height: 1.6; }
.composer-area { flex: none; width: min(100% - 48px, 760px); margin: 0 auto; padding: 0 0 max(26px, env(safe-area-inset-bottom)); }
.composer { display: flex; align-items: flex-end; gap: 12px; width: 100%; padding: 10px 10px 10px 17px; border: 1px solid #dedfdb; border-radius: 17px; background: #fff; box-shadow: 0 5px 24px rgba(27, 43, 32, .055); }
.composer:focus-within { border-color: #a0b7a5; box-shadow: 0 5px 26px rgba(27, 43, 32, .085); }
.composer textarea { display: block; flex: 1; min-width: 0; min-height: 27px; max-height: 190px; resize: none; border: 0; outline: 0; background: transparent; color: var(--ink); padding: 4px 0 3px; line-height: 1.45; }
.composer textarea::placeholder { color: #a0a69f; }
.send-button { flex: none; border: 0; border-radius: 10px; background: var(--accent); color: #fff; min-height: 34px; padding: 0 15px; font-size: 12px; font-weight: 650; }
.send-button:hover:not(:disabled) { background: #2c6d56; }
.send-button:disabled { cursor: default; background: #e8ebe7; color: #a4aba4; }
.file-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 16px; border-bottom: 1px solid var(--line); color: #9aa19a; font-size: 12px; }
.file-toolbar button { border: 1px solid #dce5db; border-radius: 8px; padding: 8px 10px; background: #edf3ec; color: #36624e; font-size: 12px; font-weight: 650; white-space: nowrap; }
.file-toolbar button:hover { background: #e3eee2; }
.file-list { flex: 1; min-height: 0; overflow-y: auto; padding-top: 14px; }
.file-empty { margin: 14px 0; text-align: center; color: #a1a7a1; font-size: 12px; }
.file-item { display: flex; align-items: center; gap: 9px; border-bottom: 1px solid var(--line); padding: 11px 0; }
.file-name { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.file-size { color: #a2a8a2; font-size: 11px; white-space: nowrap; }
.file-remove { border: 0; padding: 4px; background: transparent; color: #8f9990; font-size: 12px; }
.file-remove:hover { color: #bd5747; }
.file-note { margin: 12px 0 20px; color: #969e96; font-size: 11px; line-height: 1.5; }
.right-footer { display: flex; flex-direction: column; gap: 6px; padding-top: 14px; border-top: 1px solid var(--line); color: #a1a7a0; font-size: 11px; }
.right-footer a { color: #8d988e; text-decoration: none; }
.right-footer a:hover { text-decoration: underline; }
.panel-scrim { display: none; }
@media (max-width: 760px) {
  .app-shell, .app-shell.left-collapsed, .app-shell.right-collapsed { grid-template-columns: 44px minmax(0, 1fr) 44px; min-height: 0; }
  .sidebar { z-index: 30; }
  .rail-toggle, .left-collapsed .left-rail, .right-collapsed .right-rail { display: flex; }
  .rail-toggle { padding-top: 18px; }
  .sidebar-panel { position: fixed; z-index: 35; top: 0; bottom: 0; width: min(288px, calc(100vw - 64px)); height: 100dvh; visibility: hidden; pointer-events: none; background: var(--side); box-shadow: 0 10px 30px rgba(22, 36, 27, .16); transition: transform .22s ease, visibility .22s ease; }
  .left-panel { left: 0; transform: translateX(-105%); }
  .right-panel { right: 0; transform: translateX(105%); }
  .app-shell:not(.left-collapsed) .left-panel { display: flex; visibility: visible; pointer-events: auto; transform: translateX(0); }
  .app-shell:not(.right-collapsed) .right-panel { display: flex; visibility: visible; pointer-events: auto; transform: translateX(0); }
  .app-shell.left-collapsed .left-panel, .app-shell.right-collapsed .right-panel { display: flex; }
  .panel-scrim:not([hidden]) { display: block; position: fixed; inset: 0; z-index: 20; border: 0; background: rgba(24, 35, 27, .26); }
  .message-list { width: min(100% - 30px, 760px); padding-top: 30px; }
  .composer-area { width: min(100% - 20px, 760px); padding-bottom: max(14px, env(safe-area-inset-bottom)); }
  .composer { padding-left: 12px; gap: 6px; border-radius: 14px; }
  .send-button { padding: 0 10px; }
}
@media (prefers-reduced-motion: reduce) { .sidebar-panel { transition: none; } }
