:root {
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: #202824;
  background: #f5f7f6;
  --ink: #202824;
  --muted: #596961;
  --line: #dfe6e1;
  --wash: #f5f7f6;
  --green: #19614d;
  --green-bg: #e6f2ec;
  --danger: #a13132;
  font-size: 14px;
}
* { box-sizing: border-box; }
body { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .55; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid #26856b; outline-offset: 2px;
}
a { color: var(--green); text-decoration: none; }
button, input, select, textarea { border-radius: 6px; }
input:not([type=checkbox], [type=radio], [type=file]), select, textarea {
  min-width: 0; border: 1px solid var(--line); background: white; padding: 9px 11px;
}
input::placeholder, textarea::placeholder { color: #66766d; }
h1, h2, p { margin: 0; }
h1 { font-size: 25px; font-weight: 650; }
h2 { font-size: 17px; font-weight: 650; }
code, .mono { font-family: "IBM Plex Mono", ui-monospace, monospace; font-size: .9em; overflow-wrap: anywhere; }
.icon { width: 17px; height: 17px; flex: 0 0 auto; vertical-align: middle; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-size: 17px; font-weight: 600; white-space: nowrap; color: var(--ink); }
.brand strong { color: var(--green); }
.brand-mark, .login-symbol { display: grid; width: 34px; height: 34px; place-items: center; background: var(--green); border-radius: 7px; }
.brand-mark .icon, .login-symbol .icon, .primary .icon { filter: invert(1); }
.button, .icon-button {
  display: inline-flex; min-height: 36px; justify-content: center; align-items: center; gap: 7px;
  border: 1px solid var(--line); background: white; padding: 7px 12px; font-weight: 580; white-space: nowrap;
}
.icon-button { width: 36px; padding: 0; flex-shrink: 0; }
.button:hover:not(:disabled), .icon-button:hover:not(:disabled) { background: var(--wash); }
.button.primary { background: var(--green); color: white; border-color: var(--green); }
.button.primary:hover:not(:disabled) { background: #124d3d; }
.link-button { border: 0; background: none; color: var(--green); padding: 5px 8px; font-weight: 560; }
.link-button:hover { text-decoration: underline; }
.danger { color: var(--danger); }
.subtle-link { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); white-space: nowrap; }
.subtle-link .icon { width: 14px; height: 14px; }
.muted { color: var(--muted); }
.login { min-height: 100dvh; display: flex; flex-direction: column; }
.login-bar, .topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: white; border-bottom: 1px solid var(--line); padding: 12px 26px; min-height: 63px;
}
.login-main { flex: 1; display: grid; place-items: center; padding: 36px 20px; }
.login-form { width: min(100%, 340px); display: grid; gap: 16px; }
.login-symbol { width: 45px; height: 45px; margin-bottom: 3px; }
.login-symbol .icon { width: 24px; height: 24px; }
.login-form h1 { margin-bottom: 7px; }
.login-form .button { margin-top: 5px; min-height: 44px; justify-content: space-between; }
.field { display: grid; gap: 6px; font-size: 13px; font-weight: 550; min-width: 0; }
.form-error { color: var(--danger); font-size: 13px; line-height: 1.5; }
.form-error:empty { display: none; }
.top-actions, .heading-actions, .table-actions, .filter, .tabbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.profile { display: flex; align-items: center; gap: 8px; min-width: 0; }
.profile span:last-child { max-width: 155px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar { width: 38px; height: 38px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 7px; background: #e8f0eb; color: #254e3e; font-weight: 650; }
.profile .avatar { width: 30px; height: 30px; }
.avatar.group { background: #e8edf4; color: #34516d; }
.admin-shell { display: grid; grid-template-columns: 218px minmax(0, 1fr); min-height: calc(100dvh - 63px); }
.admin-nav { border-right: 1px solid var(--line); background: #fcfdfc; padding: 23px 14px; }
.admin-nav > span { display: block; font-size: 12px; color: var(--muted); padding: 0 9px 12px; }
.nav-item { width: 100%; display: flex; align-items: center; gap: 9px; border: 0; border-radius: 6px; padding: 11px 10px; background: transparent; color: inherit; margin-bottom: 3px; text-align: left; white-space: nowrap; }
.nav-item:hover { background: var(--wash); }
.nav-item.active { background: var(--green-bg); color: var(--green); font-weight: 650; }
.workspace { padding: 27px 30px 40px; min-width: 0; }
.workspace-inner { max-width: 1360px; margin: 0 auto; }
.page-head, .section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.page-head { padding-bottom: 22px; }
.heading-actions { min-width: 0; }
.heading-actions > label { display: flex; align-items: center; gap: 6px; min-width: 0; white-space: nowrap; }
#app-select { max-width: min(320px, 100%); text-overflow: ellipsis; }
.section-head { margin-bottom: 12px; }
.section { margin-bottom: 25px; }
.table-wrap { overflow: auto; background: white; border: 1px solid var(--line); border-radius: 7px; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th { background: #f8faf8; color: var(--muted); font-size: 12px; font-weight: 650; white-space: nowrap; }
th, td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fafcfb; }
.table-actions { gap: 0; min-width: max-content; }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; white-space: nowrap; color: var(--muted); }
.status::before, .live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #8a9891; }
.status.active, .live.active { color: var(--green); }
.status.active::before, .live.active::before { background: #2b896a; }
.live { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); }
.record-text { max-width: 420px; white-space: pre-wrap; overflow-wrap: anywhere; }
.filter { margin-bottom: 14px; }
.filter label { display: flex; align-items: center; gap: 5px; }
.filter select { max-width: 220px; }
.filter input[name=q] { flex: 1; min-width: 140px; }
.paging { display: flex; justify-content: flex-end; align-items: center; gap: 10px; margin-top: 14px; }
.empty { display: grid; align-content: center; justify-items: center; gap: 12px; text-align: center; color: var(--muted); min-height: 187px; padding: 26px 16px; }
.empty > span { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 7px; background: #e9efeb; }
.empty > span .icon { width: 21px; height: 21px; }
.chat-shell { display: grid; grid-template-columns: 298px minmax(0, 1fr); height: calc(100dvh - 63px); }
.chat-list { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--line); background: white; }
.list-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 16px 14px; }
.list-heading h1 { font-size: 18px; }
.list-scroll { overflow: auto; padding: 1px 8px 12px; }
.conversation-row { display: grid; width: 100%; grid-template-columns: auto minmax(0, 1fr) auto; gap: 9px; text-align: left; align-items: center; padding: 10px 8px; background: none; border: 0; }
.conversation-row:hover { background: var(--wash); }
.conversation-row.selected { background: var(--green-bg); }
.conversation-row .row-name, .conversation-row .preview { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-name { font-weight: 640; margin-bottom: 3px; }
.preview, .row-time { color: var(--muted); font-size: 12px; }
.row-meta { display: grid; justify-items: end; gap: 4px; }
.unread { padding: 1px 5px; background: #286f58; color: white; border-radius: 9px; font-size: 11px; }
.chat-pane { min-width: 0; min-height: 0; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; }
.chat-pane > .empty { grid-row: 2; }
.chat-head { display: flex; align-items: center; gap: 10px; padding: 10px 17px; border-bottom: 1px solid var(--line); background: white; min-height: 59px; }
.chat-head .chat-title { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.chat-title .muted { font-size: 12px; }
.chat-head [data-back] { display: none; }
.chat-history { overflow: auto; padding: 18px clamp(12px, 3%, 38px); }
.timeline { max-width: 880px; margin: auto; }
.older { display: flex; justify-content: center; margin-bottom: 14px; }
.message-row { display: flex; gap: 9px; margin: 0 0 15px; align-items: flex-end; }
.message-row.self { flex-direction: row-reverse; }
.message-body { min-width: 0; max-width: min(78%, 565px); }
.message-row.self .message-meta { text-align: right; }
.message-meta { margin-bottom: 5px; color: var(--muted); font-size: 12px; }
.bubble { display: grid; gap: 8px; padding: 10px 12px; border-radius: 7px; background: white; border: 1px solid var(--line); overflow-wrap: anywhere; }
.bubble > p { white-space: pre-wrap; line-height: 1.55; }
.self .bubble { background: var(--green-bg); border-color: #d4e8df; }
.message-row.highlight .bubble { outline: 2px solid #27805f; }
.attachments { display: flex; gap: 6px; align-items: start; flex-wrap: wrap; }
.message-image { display: block; max-width: min(193px, 100%); max-height: 165px; object-fit: contain; border-radius: 5px; }
.message-video { display: block; width: min(320px, 100%); aspect-ratio: 16 / 9; max-height: 220px; object-fit: contain; background: #14251d; border-radius: 5px; }
audio { width: min(255px, 100%); min-width: 130px; height: 38px; }
.composer { background: white; border-top: 1px solid var(--line); padding: 11px 17px 13px; }
.compose-inner { max-width: 920px; margin: auto; }
.composer textarea { width: 100%; display: block; min-height: 65px; resize: vertical; line-height: 1.5; }
.compose-tools, .queued-files { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; margin-top: 7px; }
.compose-tools > [type=submit] { margin-left: auto; }
.file-label { display: flex; align-items: center; gap: 5px; max-width: 215px; padding: 3px 5px 3px 8px; background: var(--wash); border: 1px solid var(--line); border-radius: 5px; }
.file-label > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-label .icon-button { min-height: 23px; width: 24px; background: transparent; border: 0; }
.file-label .icon { width: 14px; height: 14px; }
.file-link { display: inline-flex; align-items: center; gap: 7px; max-width: 100%; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; }
.file-link span { overflow-wrap: anywhere; min-width: 0; }
.file-link:hover { background: var(--wash); }
.composer-banner { color: var(--muted); text-align: center; padding: 9px; }
dialog { width: min(540px, calc(100% - 24px)); max-height: min(90dvh, 760px); border: 1px solid var(--line); border-radius: 8px; padding: 0; box-shadow: 0 18px 54px #1b302326; background: white; color: var(--ink); }
dialog::backdrop { background: #16281f66; }
dialog header, dialog footer { display: flex; justify-content: space-between; align-items: center; gap: 9px; padding: 13px 17px; }
dialog header { border-bottom: 1px solid var(--line); }
dialog footer { border-top: 1px solid var(--line); justify-content: flex-end; }
.modal-body { padding: 16px 17px; display: grid; gap: 12px; }
.modal-body > .filter { margin-bottom: 0; }
.dialog-copy { line-height: 1.6; }
.member-picker { max-height: 230px; overflow: auto; border: 1px solid var(--line); border-radius: 6px; }
.member-option, .member-line { display: flex; align-items: center; gap: 8px; padding: 8px; border-bottom: 1px solid var(--line); }
.member-option:last-child, .member-line:last-child { border-bottom: 0; }
.member-line > strong { flex: 1; overflow-wrap: anywhere; }
.member-line .avatar, .member-option .avatar { width: 28px; height: 28px; }
.search-result { display: block; width: 100%; text-align: left; padding: 9px 8px; background: white; border: 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.search-result:hover { background: var(--wash); }
.search-result p { margin-top: 5px; }
mark { background: #ffebad; color: inherit; }
.secret { display: block; padding: 10px; background: var(--wash); }
#toasts { position: fixed; z-index: 3; right: 16px; bottom: 16px; display: grid; gap: 6px; pointer-events: none; }
.toast { background: #193f32; color: white; padding: 10px 14px; border-radius: 6px; max-width: 320px; }
.toast.error { background: #872c2d; }
[hidden] { display: none !important; }
@media (max-width: 820px) {
  .admin-shell { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .admin-nav { display: flex; overflow: auto; padding: 7px 12px; border: 0; border-bottom: 1px solid var(--line); gap: 3px; }
  .admin-nav > span { display: none; }
  .nav-item { width: auto; margin: 0; }
  .workspace { padding: 18px 13px 25px; }
}
@media (max-width: 650px) {
  .login-bar, .topbar { padding: 11px 12px; }
  .topbar .top-actions > .profile span:last-child, .topbar .top-actions > .subtle-link { display: none; }
  .chat-shell { display: block; }
  .chat-list, .chat-pane { height: 100%; }
  .chat-shell:not(.opened) .chat-pane, .chat-shell.opened .chat-list { display: none; }
  .chat-head [data-back] { display: inline-flex; }
  .chat-head { padding-inline: 8px; gap: 7px; }
  .chat-head .avatar { display: none; }
  .composer { padding-inline: 10px; }
  .message-body { max-width: 83%; }
  .admin-nav { display: grid; grid-template-columns: repeat(4, minmax(max-content, 1fr)) minmax(max-content, .75fr); padding: 7px 8px; }
  .nav-item { justify-content: center; font-size: 12px; gap: 4px; padding: 8px 4px; }
  .nav-item .icon { width: 14px; height: 14px; }
  .workspace .table-wrap:not(.message-table) table { min-width: 545px; }
  .message-table thead { position: absolute; width: 1px; height: 1px; clip-path: inset(50%); overflow: hidden; }
  .message-table tbody, .message-table table { display: block; }
  .message-table tr {
    display: grid; grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center; gap: 5px 8px; border-bottom: 1px solid var(--line); padding: 10px 12px;
  }
  .message-table tr:last-child { border-bottom: 0; }
  .message-table td { border: 0; padding: 0; overflow-wrap: anywhere; }
  .message-table td:nth-child(1) { font-weight: 640; }
  .message-table td:nth-child(2), .message-table td:nth-child(3), .message-table td:nth-child(5) { font-size: 12px; color: var(--muted); }
  .message-table td:nth-child(4) { grid-column: 1 / -1; padding: 5px 0; }
  .message-table td:nth-child(7) .table-actions { justify-content: flex-end; }
}
@media (max-width: 400px) {
  .admin-nav .nav-item .icon { display: none; }
}
