:root {
  color-scheme: light;
  font-family: Inter, "Noto Sans SC", "Microsoft YaHei", system-ui, -apple-system, "Segoe UI", sans-serif;
  color: #0f172a;
  background: #f8fafc;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --blue: #1e40af;
  --action-blue: #3b82f6;
  --mist: #f8fafc;
  --slate: #64748b;
  --border: #e5e7eb;
  --card-shadow: 0 1px 2px rgba(15, 23, 42, .06);
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; min-height: 100dvh; background: var(--mist); }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
:focus-visible { outline: 2px solid var(--action-blue); outline-offset: 2px; }

.workspace { height: 100dvh; max-width: 1120px; margin: 0 auto; display: grid; grid-template-columns: 72px 320px minmax(0, 1fr); background: var(--mist); }
.app-rail { min-height: 0; display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 16px 10px; background: #fff; border-right: 1px solid var(--border); z-index: 1; }
.brand-mark { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: #eef3ff; color: var(--blue); }
.archive-glyph { position: relative; width: 20px; height: 14px; border: 2px solid currentColor; border-top: 0; border-radius: 3px; }
.archive-glyph::before { content: ""; position: absolute; width: 20px; height: 5px; left: -2px; top: -5px; border-radius: 3px; background: currentColor; }
.rail-current { width: 52px; min-height: 64px; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 4px; margin-top: 8px; border-radius: 12px; color: var(--blue); background: #eef3ff; font-size: 12px; }
.chat-glyph { width: 17px; height: 13px; border: 1.5px solid currentColor; border-radius: 4px; position: relative; }
.chat-glyph::after { content: ""; position: absolute; bottom: -4px; left: 3px; width: 5px; height: 5px; border-left: 1.5px solid currentColor; transform: skewY(-35deg); background: #eef3ff; }
.rail-spacer { flex: 1; }
.rail-account { width: 52px; display: grid; justify-items: center; gap: 5px; padding: 7px 0; border-radius: 12px; color: var(--slate); background: #f8fafc; font-size: 12px; }
.account-avatar,.group-avatar,.message-avatar { display: grid; flex: 0 0 auto; place-items: center; border-radius: 10px; color: var(--blue); background: #eef3ff; font-weight: 600; }
.account-avatar { width: 28px; height: 28px; border-radius: 9px; }
.rail-link { border: 0; padding: 7px 10px; color: var(--slate); background: none; font-size: 12px; }
.rail-link:hover { color: var(--blue); }
.rail-current,.brand-mark,.rail-link,.group-row,.load-older,.mobile-back,.primary-button,.download-button { transition: color 150ms ease-out,background-color 150ms ease-out,box-shadow 150ms ease-out,transform 150ms ease-out; }

.group-pane { display: flex; min-width: 0; height: 100dvh; flex-direction: column; background: #fff; border-right: 1px solid var(--border); }
.group-list { flex: 1; overflow: auto; padding: 24px 8px 16px; }
.group-row { display: flex; position: relative; align-items: center; min-height: 84px; gap: 12px; margin-bottom: 8px; padding: 12px; border-radius: 10px; }
.group-row:hover { background: #f8fafc; }
.group-row.is-active { background: #eef3ff; color: var(--blue); }
.group-row.is-active::before { content: ""; position: absolute; left: 0; top: 12px; bottom: 12px; width: 3px; border-radius: 2px; background: var(--action-blue); }
.group-avatar { width: 40px; height: 40px; font-size: 14px; }
.group-copy { display: grid; min-width: 0; flex: 1; gap: 4px; }
.group-title { overflow: hidden; color: #0f172a; font-size: 14px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.group-preview { overflow: hidden; color: var(--slate); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.group-meta { flex: none; align-self: flex-start; padding-top: 3px; color: var(--slate); font-size: 11px; }
.list-empty { display: grid; justify-items: center; gap: 12px; margin: 64px 12px; color: var(--slate); font-size: 13px; }

.conversation-pane { position: relative; display: flex; min-width: 0; height: 100dvh; flex-direction: column; background: var(--mist); }
.conversation-head { display: flex; min-height: 72px; align-items: center; gap: 14px; padding: 12px 24px; border-bottom: 1px solid var(--border); background: #fff; }
.conversation-title { display: grid; gap: 3px; min-width: 0; }
.conversation-title h2 { margin: 0; overflow: hidden; font-size: 18px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.timeline { flex: 1; min-height: 0; overflow: auto; padding: 18px 24px 28px; }
.load-older { display: block; width: fit-content; margin: 0; padding: 10px 14px; border: 1px solid var(--border); border-radius: 8px; color: var(--blue); background: #fff; font-size: 12px; }
.load-older:hover { box-shadow: var(--card-shadow); transform: translateY(-1px); }
.date-divider { display: flex; align-items: center; gap: 14px; justify-content: center; margin: 4px 0 24px; color: var(--slate); font-size: 11px; }
.date-divider::before,.date-divider::after { content: ""; width: min(12%, 60px); height: 1px; background: var(--border); }
.message-row { display: flex; align-items: flex-end; gap: 10px; max-width: 760px; margin: 0 auto 18px; }
.message-avatar { width: 34px; height: 34px; font-size: 13px; }
.message-content { display: grid; min-width: 0; max-width: min(75%, 560px); gap: 6px; }
.message-meta { display: flex; align-items: center; gap: 10px; color: var(--slate); font-size: 11px; }
.message-meta span { min-width: 0; overflow-wrap: anywhere; }
.message-meta time { white-space: nowrap; }
.message-bubble { width: fit-content; max-width: 100%; padding: 11px 15px; border: 1px solid var(--border); border-radius: 4px 12px 12px; color: #0f172a; background: #fff; font-size: 15px; line-height: 1.65; overflow-wrap: anywhere; white-space: pre-wrap; }
.from-service { flex-direction: row-reverse; }
.from-service .message-content { justify-items: end; }
.from-service .message-meta { justify-content: flex-end; }
.from-service .message-bubble { border-color: #dbe7ff; border-radius: 12px 4px 12px 12px; background: #e8efff; }
.file-card { display: grid; grid-template-columns: 40px minmax(0,1fr); align-items: center; gap: 8px 12px; width: min(100%, 360px); padding: 12px; border: 1px solid var(--border); border-radius: 12px; background: #fff; box-shadow: var(--card-shadow); }
.file-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; color: var(--blue); background: #eef3ff; font-size: 13px; }
.file-info { display: grid; min-width: 0; gap: 4px; }
.file-info strong { overflow: hidden; font-size: 13px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.file-info small { color: var(--slate); font-size: 11px; }
.success-label { color: #047857; }
.download-form { grid-column: 2; justify-self: end; }
.download-button,.primary-button { display: inline-flex; min-height: 34px; align-items: center; justify-content: center; gap: 8px; padding: 7px 14px; border: 0; border-radius: 8px; color: #fff; background: var(--blue); font-size: 13px; font-weight: 500; }
.download-button:hover,.primary-button:hover { background: #1e3a8a; box-shadow: 0 4px 12px rgba(15,23,42,.08); transform: translateY(-2px); }
.download-button:active,.primary-button:active { transform: scale(.98); }
.spinner { display: none; width: 14px; height: 14px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; }
.download-button.is-loading .spinner { display: inline-block; animation: spin .8s linear infinite; }
.download-button { min-height: 40px; min-width: 112px; }
.download-button.is-error { background: #991b1b; }
.file-unavailable { grid-column: 2; justify-self: end; color: #991b1b; font-size: 12px; }
@keyframes spin { to { transform: rotate(360deg); } }
.conversation-foot { display: flex; justify-content: space-between; gap: 16px; padding: 14px 24px; border-top: 1px solid var(--border); color: var(--slate); background: #fff; font-size: 11px; }
.timeline-empty,.welcome-empty { display: grid; justify-items: center; align-content: center; gap: 14px; color: var(--slate); text-align: center; }
.timeline-empty { min-height: 100%; }
.welcome-empty { flex: 1; padding: 24px; }
.timeline-empty strong,.welcome-empty strong { color: #334155; font-size: 16px; font-weight: 600; }
.empty-chat-icon { display: grid; place-items: center; width: 58px; height: 50px; border: 1px solid #dbe7ff; border-radius: 16px; color: var(--blue); background: #eef3ff; font-size: 22px; letter-spacing: 3px; }
.mobile-heading { display: none; }
.mobile-back { display: none; flex: none; place-items: center; width: 44px; height: 44px; border-radius: 8px; color: var(--blue); }
.mobile-back span { width: 12px; height: 12px; border-left: 2px solid; border-bottom: 2px solid; transform: rotate(45deg); }
.mobile-back:hover, .rail-account:hover { background: #eef3ff; }
.timeline-pages { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.list-pages { display: flex; gap: 16px; padding: 12px 16px; border-top: 1px solid var(--border); font-size: 13px; color: var(--blue); }
.list-pages a:hover { text-decoration: underline; }

.auth-page { display: grid; min-height: 100vh; min-height: 100dvh; background: #f8fafc; }
.auth-layout { display: grid; min-height: 100vh; min-height: 100dvh; place-items: center; padding: 24px; }
.auth-card { width: min(100%, 504px); padding: 32px 48px; border: 1px solid var(--border); border-radius: 12px; background: #fff; box-shadow: var(--card-shadow); }
.auth-card h1 { margin: 0 0 28px; font-size: 28px; line-height: 1.25; font-weight: 600; }
.login-card { min-height: 420px; }
.login-card h1 { margin-bottom: 40px; font-size: 30px; }
.login-card .fields { gap: 24px; }
.login-card .fields input { min-height: 46px; }
.login-card .primary-button { min-height: 48px; margin-top: 0; }
.auth-subtitle { margin: -16px 0 24px; color: var(--slate); font-size: 14px; }
.fields,.fields label { display: grid; gap: 8px; }
.fields { gap: 18px; }
.fields label { color: #334155; font-size: 14px; font-weight: 500; }
.fields input { width: 100%; min-height: 44px; padding: 9px 12px; border: 1px solid #d1d5db; border-radius: 8px; background: #fff; color: #0f172a; font-size: 16px; font-weight: 400; }
.fields input::placeholder { color: #94a3b8; }
.fields input:focus-visible { outline: 2px solid var(--action-blue); outline-offset: 2px; border-color: var(--blue); }
.auth-card .primary-button { min-height: 44px; margin-top: 4px; }
.error { margin: -10px 0 18px; padding: 10px 12px; border: 1px solid #fecaca; border-radius: 8px; color: #991b1b; background: #fef2f2; font-size: 13px; }
.account-layout { max-width: 1120px; width: 100%; margin: 0 auto; display: grid; grid-template-rows: auto 1fr auto; min-height: 100dvh; }
.account-nav { display: flex; align-items: center; gap: 16px; min-height: 64px; padding: 8px 24px; border-bottom: 1px solid var(--border); background: #fff; }
.account-nav .brand-mark { flex: none; width: 36px; height: 36px; }
.account-nav > a:not(.brand-mark) { color: var(--blue); }
.account-nav .account-avatar { margin-left: auto; }
.account-nav .account-name { overflow-wrap: anywhere; }
.account-layout .auth-layout { min-height: 0; }
.account-foot { display: flex; justify-content: space-between; gap: 12px; padding: 16px 24px; color: var(--slate); font-size: 12px; }
.password-card { width: min(100%, 540px); padding-inline: 34px; }
.password-card .primary-button { justify-self: start; min-width: 132px; }
.password-card h1 { margin-bottom: 8px; }
.password-card .auth-subtitle { margin-top: 0; }

@media (max-width: 760px) {
  .workspace { display: flex; flex-direction: column; }
  .app-rail { flex: none; flex-direction: row; gap: 8px; height: 64px; padding: 8px 16px; border-right: 0; border-bottom: 1px solid var(--border); }
  .app-rail .brand-mark, .rail-current { display: none; }
  .rail-account { width: auto; grid-auto-flow: column; align-items: center; padding: 8px; }
  .rail-link { min-height: 44px; }
  .group-pane { height: auto; min-height: 0; flex: 1; overflow: auto; padding: 12px 16px 24px; border: 0; background: var(--mist); }
  .mobile-heading { display: block; margin: 0 0 12px; font-size: 28px; line-height: 44px; }
  .group-list { flex: none; overflow: visible; padding: 8px; border: 1px solid var(--border); border-radius: 12px; background: #fff; }
  .group-row { margin-bottom: 5px; }
  .group-row:last-child { margin-bottom: 0; }
  .group-row.is-active { background: transparent; color: inherit; }
  .group-row.is-active::before { display: none; }
  .group-row:hover { background: #eef3ff; }
  .conversation-pane { display: none; }
  .show-conversation .app-rail, .show-conversation .group-pane { display: none; }
  .show-conversation .conversation-pane { display: flex; }
  .conversation-head { gap: 12px; padding: 8px 16px; }
  .mobile-back { display: grid; }
  .conversation-title h2 { font-size: 18px; }
  .timeline { padding: 12px 16px 22px; }
  .message-row { gap: 8px; margin-bottom: 16px; }
  .message-avatar { width: 32px; height: 32px; }
  .message-content { max-width: min(calc(100% - 40px), 268px); }
  .message-bubble { padding: 8px 12px; font-size: 14px; }
  .file-card { grid-template-columns: 36px minmax(0, 1fr); }
  .file-icon { width: 36px; height: 36px; }
  .download-button { min-height: 44px; }
  .conversation-foot { padding: 12px 16px; }
  .auth-layout { padding: 16px; }
  .auth-card { padding: 28px 22px; }
  .account-nav { flex-wrap: wrap; gap: 8px; padding-inline: 16px; }
  .account-nav .account-name { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *,*::before,*::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
.conversation-tabs{display:flex;gap:.3rem;padding:.5rem}.conversation-tabs a{flex:1;text-align:center;padding:.45rem;border-radius:.4rem;color:inherit;text-decoration:none}.conversation-tabs a[aria-current=page]{background:#dcefe5;color:#126143;font-weight:600}
