:root {
  color-scheme: light;
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: #202a2a;
  background: #f5f6f2;
  font-synthesis: none;
  --surface: #fff;
  --rail: #f5f6f2;
  --ink: #202a2a;
  --muted: #596663;
  --soft: #74807c;
  --border: #e5eae5;
  --accent: #075d55;
  --accent-dark: #044b45;
  --highlight: #e9f3ed;
}
* { box-sizing: border-box; }
body { margin: 0; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid #207e72; outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.workspace { display: grid; grid-template-columns: 214px minmax(280px, 345px) minmax(330px, 1fr); min-height: 100vh; height: 100dvh; }
.rail, .conversation-pane, .chat-pane, .chat { min-height: 0; min-width: 0; }
.rail { background: var(--rail); border-right: 1px solid var(--border); padding: 32px 16px 19px; display: flex; flex-direction: column; }
.brand { display: flex; gap: 12px; align-items: center; padding: 0 8px; white-space: nowrap; }
.brand strong { display: block; font-size: 17px; font-weight: 750; letter-spacing: -.025em; }
.brand div > span { display: block; color: var(--muted); font-size: 11px; margin-top: 3px; }
.brand-mark { width: 41px; height: 41px; border-radius: 13px; background: var(--accent-dark); display: flex; align-items: center; justify-content: center; gap: 3px; flex: none; position: relative; }
.brand-mark::before { content: ""; width: 23px; height: 17px; border: 1.5px solid #d1eadb; border-radius: 6px; position: absolute; }
.brand-mark::after { content: ""; width: 4px; height: 4px; border-left: 1.5px solid #d1eadb; border-bottom: 1.5px solid #d1eadb; transform: skewY(-35deg); position: absolute; left: 13px; top: 28px; background: var(--accent-dark); }
.brand-mark i { display: block; width: 2px; height: 2px; border-radius: 50%; background: #d1eadb; }
.nav { margin-top: 42px; }
.nav-heading { margin: 31px 0 8px 12px; color: var(--soft); font-size: 11px; font-weight: 650; letter-spacing: .06em; }
.nav-button { width: 100%; border: 0; display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; align-items: center; gap: 10px; text-align: left; border-radius: 9px; padding: 8px 11px; min-height: 46px; background: transparent; color: var(--ink); font-size: 13px; font-weight: 600; white-space: nowrap; }
.nav-button:hover { background: #edf0ea; }
.nav-button.active { background: #e2eee5; color: var(--accent-dark); }
.nav-button + .nav-button { margin-top: 4px; }
.inbox-icon { display: block; width: 17px; height: 13px; justify-self: center; border: 1.5px solid currentColor; border-radius: 3px; position: relative; }
.inbox-icon::after { position: absolute; content: ""; width: 6px; height: 4px; left: 4px; top: -1px; border: 1.5px solid currentColor; border-top: 0; border-radius: 0 0 3px 3px; }
.pill { min-width: 20px; border-radius: 12px; padding: 2px 5px; color: var(--surface); background: var(--accent); text-align: center; font-size: 10px; font-weight: 700; }
.status-dot { display: inline-block; vertical-align: middle; flex: none; width: 7px; height: 7px; border-radius: 50%; background: #949e96; }
.status-dot.online { background: #238260; }
.status-dot.connecting { background: #a16b13; }
.status-dot.error { background: #b34538; }
.rail-footer { margin-top: auto; padding: 12px 10px 0; border-top: 1px solid var(--border); display: flex; gap: 8px; align-items: center; font-size: 11px; color: var(--muted); }
.conversation-pane { border-right: 1px solid var(--border); display: flex; flex-direction: column; background: var(--surface); }
.list-header { padding: 34px 20px 0; border-bottom: 1px solid var(--border); }
.list-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.list-heading h1 { font-size: 24px; letter-spacing: -.04em; margin: 0; font-weight: 750; }
.list-heading > span { color: var(--soft); font-size: 11px; }
.search-box { position: relative; margin-top: 20px; }
.search-box input { width: 100%; height: 38px; border: 1px solid #e8ece7; border-radius: 7px; background: #f6f8f5; padding: 0 10px 0 34px; font-size: 12px; color: var(--ink); }
.search-box input::placeholder { color: var(--muted); }
.search-icon { display: block; position: absolute; pointer-events: none; left: 12px; top: 12px; width: 11px; height: 11px; border-radius: 50%; border: 1.5px solid var(--soft); }
.search-icon::after { content: ""; position: absolute; right: -4px; bottom: -2px; width: 5px; height: 1.5px; background: var(--soft); transform: rotate(45deg); }
.filter-tabs { display: flex; gap: 20px; margin-top: 13px; }
.filter-tabs button { border: 0; border-bottom: 2px solid transparent; color: var(--muted); padding: 8px 0 10px; background: transparent; min-width: 32px; font-size: 12px; }
.filter-tabs button[aria-pressed="true"] { border-color: var(--accent); color: var(--accent-dark); font-weight: 750; }
.channel-panel { display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; align-items: center; padding: 11px 20px; border-bottom: 1px solid var(--border); background: #f9faf7; }
.channel-message { width: 100%; margin: 1px 0 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.channel-panel > div { display: flex; gap: 7px; align-items: center; color: var(--muted); font-size: 12px; }
.channel-panel > .channel-actions { gap: 12px; }
.text-button { color: var(--accent-dark); border: 0; background: transparent; border-radius: 4px; padding: 5px 0 5px 5px; font-size: 12px; font-weight: 700; }
.text-button:disabled { color: var(--soft); }
.text-button:hover:not(:disabled) { text-decoration: underline; }
.conversation-list { flex: 1; overflow: auto; padding: 9px 10px; }
.list-empty { color: var(--soft); font-size: 12px; text-align: center; padding: 35px 8px; }
.conversation { width: 100%; display: grid; grid-template-columns: 37px minmax(0, 1fr) auto; gap: 10px; border-radius: 9px; border: 1px solid transparent; background: transparent; color: var(--ink); align-items: center; text-align: left; padding: 10px 9px; }
.conversation:hover { background: #f5f7f3; }
.conversation[aria-current="true"] { background: #edf5ef; border-color: #e2ece3; }
.conversation strong, .conversation small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conversation strong { font-size: 13px; font-weight: 690; }
.conversation small { font-size: 11px; margin-top: 4px; color: var(--muted); }
.conversation-meta { align-self: stretch; text-align: right; display: flex; flex-direction: column; justify-content: space-between; align-items: end; gap: 4px; }
.conversation time { color: var(--soft); font-size: 10px; white-space: nowrap; }
.channel-avatar { --channel-bg: #e8eeea; --channel-fg: #385746; display: inline-grid; flex: none; place-items: center; width: 37px; height: 37px; border-radius: 11px; background: var(--channel-bg); color: var(--channel-fg); font-size: 15px; font-weight: 750; }
.channel-avatar.wechat { --channel-bg: #d9f0df; --channel-fg: #16633a; }
.channel-avatar.dingtalk { --channel-bg: #e2edfc; --channel-fg: #205ca6; }
.channel-avatar.feishu { --channel-bg: #e9e9f9; --channel-fg: #514ba4; }
.nav-button .channel-avatar { width: 28px; height: 28px; border-radius: 8px; font-size: 12px; }
.chat-pane { background: #f9faf7; }
.chat-empty { height: 100%; display: grid; place-items: center; text-align: center; padding: 28px; }
.chat-empty-content { transform: translateY(-16px); }
.chat-empty h2 { margin: 21px 0 7px; font-size: 21px; letter-spacing: -.03em; }
.chat-empty p { margin: 0; font-size: 13px; color: var(--muted); line-height: 1.7; }
.chat-empty button { margin-top: 19px; }
.empty-illustration { width: 131px; height: 123px; margin: auto; background: #edf2e9; border-radius: 50%; position: relative; }
.empty-illustration span { display: flex; align-items: center; justify-content: center; position: absolute; width: 63px; height: 45px; border: 1.4px solid #526d60; border-radius: 14px; gap: 5px; transform: rotate(8deg); }
.empty-illustration span::after { content: ""; width: 10px; height: 10px; border: inherit; border-top: 0; border-right: 0; transform: skewY(-31deg); position: absolute; bottom: -6px; left: 14px; background: inherit; }
.empty-illustration span i { width: 4px; height: 4px; background: #526d60; border-radius: 50%; }
.empty-illustration .bubble-back { top: 30px; left: 54px; background: #cddfd1; }
.empty-illustration .bubble-front { top: 52px; left: 24px; background: #f9fcf6; transform: rotate(-9deg); }
.chat { height: 100%; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; }
.chat-header { min-height: 80px; background: var(--surface); border-bottom: 1px solid var(--border); padding: 15px 24px; display: flex; gap: 11px; align-items: center; }
.chat-heading { min-width: 0; flex: 1; }
.chat-heading h2 { margin: 0; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-heading p { color: var(--muted); margin: 3px 0 0; font-size: 11px; line-height: 1.5; }
.manual-label { flex: none; display: flex; align-items: center; gap: 7px; color: var(--accent-dark); background: var(--highlight); padding: 5px 9px; border-radius: 6px; font-size: 11px; }
.manual-label .status-dot { background: #238260; width: 5px; height: 5px; }
.back-button { display: none !important; }
.message-list { min-height: 0; overflow-y: auto; padding: 20px clamp(14px, 4vw, 43px); }
.message { display: grid; gap: 5px; justify-items: start; margin: 0 0 16px; }
.message.outbound { justify-items: end; }
.message-body { max-width: min(75%, 52rem); white-space: pre-wrap; overflow-wrap: anywhere; color: var(--ink); background: var(--surface); border: 1px solid var(--border); border-radius: 4px 12px 12px 12px; font-size: 13px; line-height: 1.65; margin: 0; padding: 8px 11px; }
.message.outbound .message-body { background: #e1efe4; border-color: #d8e9dc; border-radius: 12px 4px 12px 12px; }
.message-meta { display: flex; gap: 6px; color: var(--soft); font-size: 10px; }
.composer { margin: 0 clamp(14px, 4vw, 43px) 24px; background: var(--surface); border: 1px solid #dce5db; border-radius: 12px; box-shadow: 0 3px 6px #193a3610; overflow: hidden; }
.composer:focus-within { border-color: #609e84; }
.composer textarea { display: block; width: 100%; min-height: 76px; resize: vertical; max-height: 30vh; border: 0; outline: 0; padding: 13px 14px 4px; background: transparent; color: var(--ink); font-size: 13px; line-height: 1.5; }
.composer-toolbar { display: flex; justify-content: space-between; gap: 10px; align-items: center; padding: 8px 10px 10px 14px; }
.composer-hint { color: var(--muted); font-size: 11px; }
.composer-hint.error { color: #95372d; }
.button { border: 1px solid transparent; border-radius: 7px; min-height: 34px; padding: 7px 12px; font-weight: 650; font-size: 12px; white-space: nowrap; }
.button.primary { background: var(--accent); color: #fff; }
.button.primary:hover:not(:disabled) { background: var(--accent-dark); }
.button.primary:disabled { background: #e7ede7; color: #617069; }
.button.primary span { margin-left: 4px; }
.button.secondary { background: var(--surface); color: var(--accent-dark); border-color: #dce5dc; }
.button.secondary:hover { background: var(--highlight); }
.button.danger { background: #a73a30; color: #fff; }
.button.danger:disabled { background: #e8c6c3; }
.icon-button { border: 0; width: 32px; height: 32px; display: grid; place-items: center; flex: none; border-radius: 7px; padding: 0; background: transparent; font-size: 24px; line-height: 1; color: var(--muted); }
.icon-button:hover { background: #edf1ec; color: var(--ink); }
.modal { border: 1px solid var(--border); border-radius: 14px; max-width: calc(100vw - 24px); width: 420px; padding: 0; color: var(--ink); background: var(--surface); box-shadow: 0 20px 70px #172d2a38; }
.modal::backdrop { background: #13272360; }
.modal-content { padding: 21px; }
.modal-header { display: flex; gap: 10px; justify-content: space-between; align-items: start; }
.modal-header h2 { font-size: 18px; margin: 0; }
.modal-header p { color: var(--muted); font-size: 12px; line-height: 1.6; margin: 6px 0 0; }
.dialog-options { margin-top: 18px; display: grid; gap: 8px; }
.dialog-option { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; border-radius: 9px; padding: 9px; background: var(--surface); border: 1px solid var(--border); color: var(--ink); }
.dialog-option:hover { background: #f4f8f3; }
.dialog-option strong { flex: 1; font-size: 13px; }
.dialog-option small { color: var(--muted); }
.qr-stage { width: max-content; margin: 18px auto 0; border: 1px solid var(--border); border-radius: 10px; background: #fff; padding: 4px; max-width: 100%; line-height: 0; }
.qr-stage img { display: block; max-width: 100%; height: auto; }
.pair-status { color: var(--muted); line-height: 1.6; font-size: 13px; margin: 16px 0; overflow-wrap: anywhere; white-space: pre-line; }
.pair-authorization { display: inline-flex; min-height: 32px; align-items: center; color: var(--accent-dark); font-size: 13px; font-weight: 650; text-underline-offset: 3px; }
.entry-code-label { display: block; color: var(--muted); font-size: 12px; margin: 16px 0 6px; }
.entry-code-copy { display: flex; gap: 8px; }
.entry-code-copy input { flex: 1; min-width: 0; padding: 6px 8px; border: 1px solid var(--border); border-radius: 7px; color: var(--ink); font-size: 12px; }
.entry-code-status:empty { margin: 0; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 17px; }
.pin-form { margin: 9px 0; display: grid; gap: 7px; font-size: 12px; color: var(--muted); }
.pin-form > div { display: flex; gap: 8px; }
.pin-form input { width: 100%; border: 1px solid var(--border); border-radius: 7px; padding: 5px 8px; }
@media (max-width: 980px) {
  .workspace { grid-template-columns: 166px minmax(246px, 31vw) minmax(315px, 1fr); }
  .rail { padding-right: 11px; padding-left: 11px; }
}
@media (max-width: 740px) {
  .workspace { grid-template-columns: 64px minmax(0, 1fr); }
  .rail { padding: 17px 7px; }
  .brand { padding: 0; justify-content: center; }
  .brand div, .nav-button > span:nth-child(2), .nav-heading, .rail-footer > span:last-child { display: none; }
  .nav { margin-top: 24px; }
  .nav-button { display: flex; position: relative; justify-content: center; margin-bottom: 5px; padding: 6px; }
  .nav-button > .status-dot, .nav-button > .pill { position: absolute; right: 4px; top: 4px; }
  .rail-footer { justify-content: center; padding: 11px 0 0; }
  .conversation-pane { border-right: 0; }
  .chat-pane { display: none; }
  .workspace.show-chat { display: block; }
  .workspace.show-chat > .rail, .workspace.show-chat > .conversation-pane { display: none; }
  .workspace.show-chat > .chat-pane { display: block; height: 100%; }
  .back-button { display: grid !important; }
  .chat-header { min-height: 66px; padding: 11px 13px 11px 7px; }
  .list-header { padding-top: 22px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; }
}
.list-empty-actions { margin-top: 14px; }

.account-screen {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 25px;
  background: var(--rail);
}
.account-card {
  width: min(100%, 400px);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: clamp(22px, 6vw, 32px);
  background: var(--surface);
  box-shadow: 0 12px 35px #1735300d;
}
.account-brand { padding: 0; margin-bottom: 26px; }
.account-card h1 { margin: 0; font-size: 23px; letter-spacing: -.025em; }
.account-copy { color: var(--muted); margin: 8px 0 18px; font-size: 13px; line-height: 1.65; }
.account-form { display: grid; gap: 8px; }
.account-form label { font-size: 13px; font-weight: 650; }
.account-form input {
  width: 100%;
  min-height: 41px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  background: #f8faf7;
  color: var(--ink);
  font-size: 16px;
  margin-bottom: 5px;
}
.account-form .button { min-height: 41px; margin-top: 3px; }
.account-form .text-button { justify-self: center; padding: 6px 3px; }
.account-error { color: #95372d; line-height: 1.55; font-size: 12px; margin: 0; }
.account-error:empty, .invite-status:empty { display: none; }
.rail-bottom { margin-top: auto; }
.workspace-account { display: flex; align-items: center; gap: 5px; padding: 7px 8px; }
.workspace-account > strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; font-weight: 650; }
.workspace-account-actions { display: flex; gap: 8px; margin-left: auto; }
.workspace-account .text-button { padding: 5px 0; white-space: nowrap; }
.team-modal { width: 470px; }
.team-actions { display: flex; align-items: center; gap: 12px; margin-top: 16px; }
.team-actions > .text-button { padding: 5px 3px; }
.issued-invite {
  margin-top: 14px;
  padding: 12px;
  border: 1px solid #dce9de;
  border-radius: 8px;
  color: var(--accent-dark);
  background: var(--highlight);
}
.issued-invite label { display: block; font-size: 12px; margin-bottom: 6px; font-weight: 650; }
.issued-invite input { background: var(--surface); font-size: 18px; letter-spacing: .13em; font-variant-numeric: tabular-nums; }
.issued-invite p { margin: 7px 0 0; color: var(--muted); font-size: 11px; }
.invite-status { color: var(--muted); font-size: 12px; line-height: 1.6; overflow-wrap: anywhere; margin: 10px 0; }
.invite-status.error { color: #95372d; }
.invite-list { list-style: none; margin: 16px 0 0; padding: 0; max-height: 37dvh; overflow: auto; }
.invite-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; border-top: 1px solid var(--border); padding: 10px 2px; font-size: 12px; }
.invite-row small { display: block; color: var(--muted); margin-top: 3px; font-size: 11px; line-height: 1.6; }
.invite-row .text-button { color: #95372d; }
.invite-empty { color: var(--muted); font-size: 12px; padding: 10px 0; }
@media (max-width: 740px) {
  .workspace-account { flex-direction: column; padding: 6px 0; }
  .workspace-account > strong { max-width: 100%; font-size: 10px; }
  .workspace-account-actions { flex-direction: column; gap: 0; margin: 0; }
  .workspace-account .text-button { min-height: 30px; }
}

.workspace-picker {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  margin-top: 13px;
  color: var(--muted);
  font-size: 12px;
}
.workspace-picker select {
  min-width: 0;
  width: 100%;
  min-height: 34px;
  padding: 4px 8px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 7px;
}
.workspace-picker:not([hidden]) + .search-box { margin-top: 11px; }
.workspace-context {
  margin: 0;
  padding: 8px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--highlight);
  color: var(--accent-dark);
  font-size: 11px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}
.chat.is-read-only { grid-template-rows: auto minmax(0, 1fr); }
.chat.is-read-only .manual-label { background: #eff1ee; color: var(--muted); }
.chat.is-read-only .manual-label .status-dot { background: var(--soft); }

:root[data-channel] {
  --brand-light: #fff;
  background: var(--rail);
}
:root[data-channel="wechat"] {
  --rail: #eef4ef;
  --canvas: #f5f8f5;
  --accent: #146946;
  --accent-dark: #0f5137;
  --accent-bright: #287b58;
  --highlight: #e5f1e8;
  --border: #dce9e1;
  --glow: #cee7d5;
  --channel-shadow: #174a3520;
}
:root[data-channel="dingtalk"] {
  --rail: #eff4fb;
  --canvas: #f6f8fd;
  --accent: #255bb4;
  --accent-dark: #1b478e;
  --accent-bright: #3d6ac0;
  --highlight: #e8f0fc;
  --border: #dce6f6;
  --glow: #cdddf7;
  --channel-shadow: #194a8e20;
}
:root[data-channel="feishu"] {
  --rail: #f3f0f9;
  --canvas: #f8f7fc;
  --accent: #6151aa;
  --accent-dark: #4a3b8d;
  --accent-bright: #7767bd;
  --highlight: #efecfb;
  --border: #e5def3;
  --glow: #e0d8f8;
  --channel-shadow: #4d3a8820;
}
[data-channel] :focus-visible { outline-color: var(--accent-bright); }
[data-channel] .brand-mark {
  background: linear-gradient(145deg, var(--accent-bright), var(--accent-dark));
  box-shadow: 0 5px 12px var(--channel-shadow);
}
[data-channel] .brand-mark::before,
[data-channel] .brand-mark::after { border-color: var(--brand-light); }
[data-channel] .brand-mark::after { background: var(--accent-dark); }
[data-channel] .brand-mark i { background: var(--brand-light); }
[data-channel] .nav { margin-top: 34px; }
[data-channel] .nav-button.active,
[data-channel] .nav-button:hover,
[data-channel] .button.secondary:hover { background: var(--highlight); }
[data-channel] .conversation[aria-current="true"],
[data-channel] .message.outbound .message-body { background: var(--highlight); border-color: var(--border); }
[data-channel] .channel-avatar { background: var(--highlight); color: var(--accent-dark); }
[data-channel] .chat-pane,
[data-channel] .channel-panel,
[data-channel] .search-box input { background: var(--canvas); }
[data-channel] .composer { border-color: var(--border); box-shadow: 0 4px 12px var(--channel-shadow); }
[data-channel] .composer:focus-within { border-color: var(--accent-bright); }
[data-channel] .empty-illustration { background: var(--highlight); }
[data-channel] .empty-illustration span { border-color: var(--accent); }
[data-channel] .empty-illustration span i { background: var(--accent); }
[data-channel] .empty-illustration .bubble-back { background: var(--glow); }
[data-channel] .empty-illustration .bubble-front { background: var(--surface); }
[data-channel] .account-screen {
  background: radial-gradient(ellipse at 24% 20%, var(--glow), transparent 52%),
              linear-gradient(132deg, var(--rail), var(--canvas));
}
[data-channel] .account-card {
  width: min(100%, 420px);
  padding: clamp(24px, 6vw, 36px);
  border-radius: 22px;
  box-shadow: 0 18px 55px var(--channel-shadow);
}
[data-channel] .account-brand { justify-content: flex-start; margin-bottom: 27px; }
[data-channel] .account-brand .brand-mark { width: 45px; height: 45px; }
[data-channel] .account-brand .brand-mark::after { top: 30px; left: 15px; }
[data-channel] .account-brand strong { color: var(--accent-dark); }
[data-channel] .account-card h1 { font-size: 27px; }
[data-channel] .account-form input { background: var(--canvas); }
[data-channel] .account-form .button { min-height: 44px; margin-top: 5px; }
[data-channel] .issued-invite { border-color: var(--border); }
@media (max-width: 740px) {
  [data-channel] .nav { margin-top: 23px; }
}
