/* One accent: green identifies actions and the current place. Neutral surfaces
   separate navigation from conversation; type and spacing carry hierarchy. */
:root { --accent: #557b2e; --accent-hover: #446426; --accent-soft: #edf4e3; --ink: #2c3028; --muted: #73786b; --line: #e7e9e3; --paper: #fff; --canvas: #fff; --sidebar: #fff; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif; color: var(--ink); font-synthesis: none; }
* { box-sizing: border-box; scrollbar-color: #cdd1c8 transparent; }
/* Safari ignores scrollbar-color; only the thumb is drawn, the track stays transparent. */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cdd1c8; border-radius: 10px; border: 3px solid transparent; background-clip: content-box; }
body { margin: 0; background: var(--canvas); font-size: 14px; line-height: 1.6; }
button, input, textarea, select { font: inherit; color: inherit; }
button, a, input, textarea, select { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { opacity: .55; cursor: wait; }
a { color: var(--accent); text-underline-offset: 3px; }
button, a { touch-action: manipulation; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 24px; font-weight: 650; line-height: 1.35; letter-spacing: -.5px; }
h2 { font-size: 18px; font-weight: 650; }
h3 { font-size: 15px; font-weight: 650; }
input:not([type=checkbox]):not([type=file]), textarea, select { width: 100%; border: 1px solid #dce0d7; border-radius: 7px; background: #fff; padding: 11px 13px; outline-offset: 2px; min-height: 43px; }
input:not([type=checkbox]):not([type=file]):focus-visible, textarea:focus-visible { outline: none; }
input::placeholder, textarea::placeholder { color: #949a91; }
textarea { resize: vertical; }
input[readonly] { background: var(--canvas); color: var(--muted); }
input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--accent); flex-shrink: 0; }
small { font-size: 12px; }
[hidden] { display: none !important; }
.muted { color: var(--muted); font-weight: 400; }
.eyebrow { font-size: 11px; font-weight: 600; letter-spacing: 1.5px; color: var(--muted); }
.button { border: 0; border-radius: 7px; padding: 9px 15px; min-height: 40px; font-weight: 550; background: transparent; display: inline-flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap; }
.button.primary { background: var(--accent); color: white; }
.button.primary:hover { background: var(--accent-hover); }
.button.secondary { border: 1px solid #dce0d7; background: white; }
.button.quiet { color: var(--muted); }
.button.quiet:hover { background: #e7eae2; color: var(--ink); }
.icon-button { display: inline-flex; align-items: center; justify-content: center; min-width: 32px; min-height: 32px; border: 0; border-radius: 5px; background: transparent; font-size: 21px; color: var(--muted); }
.icon-button:hover { background: #e3e8df; color: var(--ink); }
.text-button { border: 0; background: none; color: var(--accent); padding: 6px; font-weight: 600; }
.field { display: flex; flex-direction: column; gap: 7px; margin: 0 0 18px; font-weight: 500; }
.field > span { font-size: 13px; }
.field small { font-weight: 400; }
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.notice, .form-error { font-size: 13px; min-height: 0; color: var(--ink); overflow-wrap: anywhere; }
.notice:empty, .form-error:empty { display: none; }
.form-error:not(:empty) { border-left: 2px solid var(--ink); padding-left: 10px; margin: 12px 0; }
.brand { display: flex; align-items: center; gap: 10px; font-size: 21px; letter-spacing: -.7px; font-weight: 700; min-width: 0; }
.brand > span:nth-child(2) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand-mark { font-family: Georgia, serif; background: var(--accent); color: white; width: 31px; height: 31px; display: inline-flex; justify-content: center; align-items: center; font-size: 28px; line-height: 1; border-radius: 9px; padding-bottom: 4px; flex-shrink: 0; }
.auth-layout { min-height: 100dvh; display: grid; place-items: center; padding: 40px 24px; }
.auth-form { width: 100%; max-width: 340px; }
.auth-form .brand { margin-bottom: 36px; justify-content: center; }
.auth-form h1 { font-size: 23px; margin-bottom: 28px; text-align: center; }
.auth-form > .primary { width: 100%; margin-top: 6px; }
.auth-form .notice { margin-bottom: 16px; }
.auth-switch { text-align: center; color: var(--muted); font-size: 12px; margin-top: 20px; }
.auth-form > .text-button { display: block; margin: 4px auto 0; font-weight: 400; font-size: 12px; }
.shell { height: 100dvh; display: grid; grid-template-columns: 68px 248px minmax(0, 1fr); }
.sidebar { background: var(--sidebar); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 27px 14px 16px; min-height: 0; }
.sidebar-brand { padding: 0 8px; margin-bottom: 20px; display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 17px; }
.sidebar-brand > strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 650; }
.rail-top { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.connection { font-size: 10px; line-height: 1; color: var(--muted); display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.connection::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: #9da599; }
.connection[data-state=connected]::before { background: var(--accent); }
.connection[data-state=reconnecting]::before, .connection[data-state=disconnected]::before { background: #c0503c; }
input.nav-search { font-size: 12px; min-height: 36px !important; padding: 8px 11px !important; border-color: transparent !important; background: #f0f3e8 !important; margin-bottom: 24px; }
.sidebar nav { min-height: 0; overflow-y: auto; flex: 1; }
.nav-heading { display: flex; align-items: center; justify-content: space-between; padding: 0 8px; margin-bottom: 6px; }
.nav-heading h2 { font-size: 11px; font-weight: 600; color: var(--muted); letter-spacing: 1px; }
.direct-heading { margin-top: 27px; }
.nav-item { display: flex; width: 100%; align-items: center; gap: 10px; min-height: 43px; padding: 12px 10px; border: none; border-radius: 6px; background: none; text-align: left; color: #596153; font-size: 13px; margin: 2px 0; }
.nav-item:hover { background: #f0f3e8; }
.nav-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; font-weight: 550; }
.nav-copy { min-width: 0; }
.nav-preview { display: block; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 150px; font-size: 11px; font-weight: 400; margin-top: 3px; }
.channel-symbol { font-size: 20px; width: 20px; text-align: center; color: #89917f; font-weight: 400; }
.nav-item.active .channel-symbol { color: var(--accent); }
.nav-empty { font-size: 11px; padding: 9px 11px; color: var(--muted); }
.unread { margin-left: auto; background: var(--accent); border-radius: 10px; color: white; font-size: 10px; min-width: 18px; padding: 1px 5px; text-align: center; }
.sidebar-footer { padding-top: 16px; margin-top: 14px; border-top: 1px solid #dde2d6; display: flex; align-items: center; justify-content: space-between; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: #e9eddc; font-size: 13px; color: #67715f; font-weight: 600; flex-shrink: 0; }
.avatar.small { width: 23px; height: 23px; font-size: 10px; border-radius: 7px; background: #e0e6d9; }
.account-button { padding: 0; display: flex; gap: 10px; align-items: center; min-width: 0; border: none; background: transparent; text-align: left; }
.account-copy { display: flex; flex-direction: column; overflow: hidden; }
.account-copy strong { font-size: 12px; text-overflow: ellipsis; overflow: hidden; max-width: 120px; white-space: nowrap; }
.account-copy small { color: var(--muted); font-size: 10px; }
.logout { font-size: 11px; padding: 8px; }
.workspace { min-width: 0; min-height: 0; display: flex; flex-direction: column; background: white; }
.workspace-header { min-height: 88px; padding: 20px 38px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-shrink: 0; }
.conversation-heading { min-width: 0; }
.conversation-heading h1 { font-size: 18px; display: flex; align-items: center; gap: 9px; letter-spacing: -.3px; overflow-wrap: anywhere; }
.conversation-heading h1 .avatar { width: 27px; height: 27px; font-size: 11px; }
.heading-symbol { color: #909687; font-size: 24px; font-weight: 400; }
.conversation-heading p { font-size: 11px; margin-top: 3px; }
.channel-info { font-size: 11px; padding-right: 0; }
.message-scroll { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 18px clamp(20px, 3.5vw, 50px) 20px; scrollbar-width: thin; }
.messages { max-width: 1080px; margin: 0 auto; }
.history-button { display: block; margin: 0 auto; font-size: 11px; }
.date-divider { display: flex; align-items: center; gap: 16px; color: #93988d; font-size: 10px; margin: 17px 0 28px; }
.date-divider::before, .date-divider::after { content: ''; height: 1px; flex: 1; background: #edf0e8; }
.message { display: flex; gap: 13px; padding: 0 0 26px; }
.message.own > .avatar { background: var(--accent-soft); color: var(--accent); }
.message-main { min-width: 0; max-width: 100%; }
.message-meta { display: flex; align-items: baseline; gap: 9px; margin-bottom: 5px; flex-wrap: wrap; }
.message-meta strong { font-size: 12px; font-weight: 600; }
.message-meta time, .message-meta span { font-size: 10px; color: #959b90; }
.message-text { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.85; font-size: 14px; color: #3a4236; }
.message-body { max-width: 750px; }
.reply-reference { padding: 5px 10px; margin-bottom: 7px; border-left: 2px solid #cbd7c8; background: var(--canvas); color: var(--muted); font-size: 11px; }
.message-image { display: block; max-width: min(400px, 100%); max-height: 290px; object-fit: contain; border-radius: 8px; border: 1px solid var(--line); margin: 5px 0 8px; background: var(--canvas); }
.image-link { display: block; cursor: zoom-in; }
.image-viewer { border: 0; padding: 0; margin: 0; inset: 0; width: 100vw; height: 100dvh; max-width: none; max-height: none; background: transparent; }
.image-viewer[open] { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; }
.image-viewer::backdrop { background: #111410; }
.image-viewer img { max-width: calc(100vw - 48px); max-height: calc(100dvh - 110px); object-fit: contain; border-radius: 6px; }
/* Esc or a click outside the image closes; the only control is download. */
.image-viewer-download { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 50%; background: #ffffff1a; color: #fff; }
.image-viewer-download:hover { background: #ffffff33; }
.file-card { display: flex; gap: 13px; align-items: center; border: 1px solid var(--line); border-radius: 8px; padding: 12px 16px; color: var(--ink); text-decoration: none; min-width: min(280px, 100%); max-width: 420px; }
.file-card strong { display: block; font-size: 12px; font-weight: 500; overflow-wrap: anywhere; }
.file-card small { font-size: 10px; display: block; }
.file-card > .muted { margin-left: auto; font-size: 11px; }
.file-icon { font-size: 24px; font-weight: 400; color: var(--accent); }
.composer-wrap { padding: 0 38px 24px; flex-shrink: 0; }
.composer { border: 1px solid #dee3d7; border-radius: 10px; background: #fff; overflow: hidden; }
.composer-input { padding: 13px 16px 0; }
.composer textarea { border: none; background: transparent; border-radius: 0; min-height: 49px; max-height: 170px; resize: none; overflow-y: auto; padding: 0; font-size: 13px; line-height: 1.8; }
.composer-tools { padding: 5px 12px 10px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.send-button { margin-left: auto; padding: 0 12px; height: 28px; min-height: 0; font-size: 12px; border-radius: 6px; }
.send-arrow { font-size: 17px; font-weight: 400; }
.attach-button { width: 28px; height: 28px; min-width: 0; min-height: 0; border: 1px solid #dfe4d8; border-radius: 6px; }
.empty-messages { padding: 90px 20px; text-align: center; }
.empty-symbol { display: block; color: #abb3a2; font-size: 38px; font-weight: 300; margin-bottom: 15px; }
.empty-messages h2 { font-size: 20px; font-weight: 500; margin-bottom: 8px; }
.empty-messages p { font-size: 12px; }
.welcome { margin: auto; max-width: 570px; padding: 50px; text-align: center; display: flex; align-items: center; flex-direction: column; gap: 23px; }
.welcome h1 { font-size: 36px; margin: 17px 0; }
.welcome .row { margin-top: 28px; }
.settings-container { min-height: 0; overflow-y: auto; padding: 32px 38px 60px; }
.settings-page { max-width: 840px; margin: 0 auto; }
.settings-page > .row { justify-content: space-between; }
.page-title { font-size: 24px; font-weight: 600; margin-bottom: 4px; }
.settings-page > h2.page-title { margin-top: 40px; }
.settings-section { margin-top: 30px; border-top: 1px solid var(--line); padding-top: 25px; }
.section-title { font-size: 16px; margin-bottom: 6px; }
.settings-section > .muted { font-size: 12px; margin-bottom: 17px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 20px; margin-top: 19px; }
.form-grid > .row { align-self: start; margin: 5px 0 22px; }
.settings-section > div > .row { padding: 16px 0; border-bottom: 1px solid var(--line); align-items: center; }
.settings-section > div > .row > div:first-child { flex: 1; min-width: 140px; }
.settings-section > div > .row .field { margin: 0; width: 140px; }
.settings-section > div > .row > span:first-child { flex: 1; overflow-wrap: anywhere; }
.settings-section > div > .row .muted { font-size: 11px; }
.compact-select { width: auto !important; min-height: 0 !important; height: 32px; padding: 0 28px 0 10px !important; font-size: 13px; font-weight: 400; border-radius: 6px; }
.member-notice { font-size: 11px; color: var(--muted); min-width: 3em; text-align: right; }
.settings-section .notice { font-size: 11px; }
.dialog { border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 20px 70px #24312824; width: min(490px, calc(100% - 32px)); padding: 26px; max-height: 85dvh; overflow-y: auto; }
.dialog::backdrop { background: #29312650; }
.dialog-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.dialog > .muted { font-size: 12px; margin-bottom: 23px; }
.people-list { margin-top: 12px; }
.person-item { display: flex; gap: 12px; align-items: center; text-align: left; padding: 13px 6px; width: 100%; border: 0; background: none; border-bottom: 1px solid var(--line); }
.person-item:hover { background: var(--canvas); }
.person-item > span:nth-child(2) { display: flex; flex: 1; flex-direction: column; }
.person-item strong { font-weight: 550; }
.person-item small { font-size: 11px; }
.check-field { display: flex; gap: 10px; align-items: center; margin: 16px 0; flex-wrap: wrap; }
.member-picker { border: 1px solid var(--line); border-radius: 8px; margin-bottom: 20px; max-height: 170px; overflow-y: auto; }
.member-picker legend { color: var(--muted); font-size: 12px; }
#toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(10px); padding: 11px 18px; max-width: calc(100vw - 32px); background: var(--ink); color: white; border-radius: 8px; font-size: 12px; opacity: 0; pointer-events: none; transition: opacity .18s, transform .18s; z-index: 10; overflow-wrap: anywhere; }
#toast.visible { opacity: 1; transform: translateX(-50%) translateY(0); }
.boot { max-width: 650px; margin: 15vh auto; padding: 30px; text-align: center; }
.boot p { margin: 18px 0; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; top: -70px; left: 20px; z-index: 20; padding: 10px; background: white; }
.skip-link:focus { top: 10px; }
.mobile-menu, .mobile-close { display: none; }
.collapse-button { color: #9aa093; }
@media (min-width: 601px) { .sidebar-collapsed .shell { grid-template-columns: 68px minmax(0, 1fr); } .sidebar-collapsed .sidebar { display: none; } }
@media (max-width: 600px) { .collapse-button { display: none; } }
@media (min-width: 1450px) { .shell { grid-template-columns: 72px 264px minmax(0, 1fr); } .sidebar { padding: 28px 20px 20px; } .message-scroll { padding-inline: 60px; } .composer-wrap { padding-inline: 60px; } }
@media (max-width: 800px) { .shell { grid-template-columns: 60px 220px minmax(0, 1fr); } .sidebar { padding-inline: 12px; } .workspace-header { padding: 17px 22px; } .composer-wrap { padding: 0 20px 18px; } .settings-container { padding: 24px; } .form-grid { grid-template-columns: 1fr; } .auth-story { padding: 32px; }  }
@media (max-width: 600px) { .shell { display: flex; } .sidebar { display: none; position: fixed; inset: 0 auto 0 56px; width: min(280px, calc(100vw - 56px)); z-index: 5; box-shadow: 10px 0 50px #24312830; } .nav-open .sidebar { display: flex; } .mobile-menu, .mobile-close { display: inline-flex; } .mobile-close { font-size: 11px; } .workspace { width: calc(100% - 56px); height: 100dvh; } .rail { width: 56px; flex-shrink: 0; } .workspace-header { min-height: 76px; padding: 13px 16px; gap: 12px; } .conversation-heading { flex: 1; } .conversation-heading h1 { font-size: 16px; } .conversation-heading p { font-size: 10px; } .channel-info { display: none; } .message-scroll { padding: 12px 17px; } .message { gap: 10px; padding-bottom: 23px; } .message > .avatar { width: 28px; height: 28px; border-radius: 8px; font-size: 11px; } .message-text { font-size: 13px; } .composer-wrap { padding: 0 12px max(12px, env(safe-area-inset-bottom)); } .settings-container { padding: 24px 18px; } .settings-section > div > .row .field { width: 120px; } .welcome { padding: 30px; } .welcome h1 { font-size: 29px; } .auth-layout { padding: 32px 24px; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
.avatar { position: relative; overflow: hidden; }
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

/* The kiwi Emoji is the identity; green only highlights actions and selection. */
.kiwi-mark { width: 38px; height: 38px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; font-size: 31px; line-height: 1; }
.welcome .kiwi-mark { width: 58px; height: 58px; font-size: 46px; }
.rail { display: flex; flex-direction: column; align-items: center; gap: 26px; background: #fff; border-right: 1px solid var(--line); padding: 26px 9px 17px; min-height: 0; }
.rail-account { border: none; background: transparent; padding: 0; }
.rail-account .avatar { width: 38px; height: 38px; background: var(--accent); color: white; font-size: 15px; }
.rail-links, .rail-bottom { display: flex; flex-direction: column; align-items: center; gap: 11px; width: 100%; }
.rail-bottom { margin-top: auto; }
.rail-button { border: none; display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 13px; background: transparent; color: #7b816f; }
.rail-button:hover { background: #e5ecd7; color: var(--accent); }
.rail-button.selected { background: var(--accent); color: white; }
.group-nav { margin-top: 30px; border-top: 1px solid var(--line); padding-top: 18px; }
.group-nav summary { font-size: 11px; color: var(--muted); padding: 4px 9px; cursor: pointer; }
.group-actions { padding: 5px 0; }
.group-actions .button { font-size: 11px; padding-block: 5px; min-height: 28px; }
.message-save { opacity: 0; margin-left: auto; flex-shrink: 0; width: 28px; min-height: 28px; }
.message-save svg { width: 16px; height: 16px; }
.message:hover .message-save, .message-save:focus-visible { opacity: 1; }
@media (hover: none) { .message-save { opacity: .5; } }
@media (max-width: 600px) { .rail { padding-inline: 5px; padding-top: 20px; } .rail-button { width: 40px; height: 40px; border-radius: 11px; } .rail-account .avatar { width: 32px; height: 32px; } .sidebar { padding-top: 20px; } .workspace-header .button.quiet { font-size: 11px; padding-inline: 6px; } }

.sidebar-title { display: flex; align-items: center; gap: 8px; min-width: 0; }
.sidebar-title .kiwi-mark { width: 28px; height: 28px; font-size: 23px; }
.file-card > span:nth-child(2) { min-width: 0; flex: 1; }
.file-card > .muted, .file-icon { flex-shrink: 0; white-space: nowrap; }

/* Phones. iOS Safari zooms into any focused field under 16px, so fields are
   16px here; touch targets grow to ~40px. */
@media (max-width: 600px) {
  input:not([type=checkbox]):not([type=file]), textarea, select { font-size: 16px; }
  .composer textarea { font-size: 16px; line-height: 1.6; min-height: 44px; }
  input.nav-search { font-size: 16px; }
  .attach-button { width: 38px; height: 38px; font-size: 22px; }
  .send-button { height: 38px; padding: 0 16px; font-size: 14px; }
  .message-save { width: 40px; min-height: 40px; margin-right: -10px; }
  .message-save svg { width: 18px; height: 18px; }
}

/* Phones: the rail becomes a bottom tab bar (chat, favorites, files,
   settings). The avatar duplicates settings and logout is easy to hit by
   accident there, so both leave the bar; logout sits in the settings header.
   Connection status only shows, as a top pill, when it is not connected. */
.mobile-only { display: none; }
@media (max-width: 600px) {
  :root { --tabbar: calc(58px + env(safe-area-inset-bottom)); }
  .shell { display: block; }
  .workspace { width: 100%; height: calc(100dvh - var(--tabbar)); }
  .workspace-header { padding-top: max(13px, env(safe-area-inset-top)); }
  .rail { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; width: auto; height: var(--tabbar); flex-direction: row; justify-content: space-around; align-items: flex-start; gap: 0; padding: 7px 12px env(safe-area-inset-bottom); border-right: 0; border-top: 1px solid var(--line); }
  .rail-links, .rail-bottom { display: contents; }
  .rail-button { width: 52px; height: 42px; border-radius: 12px; }
  .rail-button[aria-label="退出登录"], .rail-account { display: none; }
  .rail-top { position: fixed; top: calc(86px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); z-index: 7; pointer-events: none; }
  .rail-top .connection { font-size: 12px; background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 7px 12px; box-shadow: 0 6px 20px #2431281f; }
  .rail-top .connection[data-state=connected] { display: none; }
  .sidebar { inset: 0 auto var(--tabbar) 0; width: min(320px, 86vw); padding-top: max(27px, env(safe-area-inset-top)); }
  .composer-wrap { padding: 0 12px 12px; }
  .mobile-only { display: inline-flex; }
}
@media (max-width: 600px) { .compact-select { font-size: 16px; height: 36px; } }
