:root {
  --ink: #17372f;
  --muted: #536b63;
  --line: #d7e1d9;
  --green: #166348;
  --tint: #ecf5ef;
  --paper: #f7f9f6;
  font: 15px/1.5 "Inter", "Microsoft YaHei UI", "PingFang SC", sans-serif;
  color: var(--ink);
  background: var(--paper);
}
* { box-sizing: border-box; }
[hidden], .notice:empty { display: none !important; }
body { margin: 0; height: 100vh; height: 100dvh; display: flex; flex-direction: column; }
h1, h2, p, ul, ol { margin: 0; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.2rem; }
button, select, textarea { font: inherit; color: inherit; }
button, select { background: white; border: 1px solid var(--line); border-radius: 6px; }
button { cursor: pointer; font-size: .88rem; padding: .42rem .8rem; }
button:hover:enabled { background: var(--tint); }
button:disabled, select:disabled { opacity: .55; cursor: default; }
:focus-visible { outline: 3px solid #20a882; outline-offset: 2px; }
.primary { padding: .6rem 1.5rem; background: var(--green); color: white; border-color: var(--green); font-weight: 600; }
.primary:hover:enabled { background: #104f39; }
.topbar { display: flex; justify-content: space-between; align-items: center; flex: 0 0 auto; min-height: 62px; gap: 1rem; padding: .6rem clamp(1rem, 3vw, 3rem); color: white; background: #123e32; }
.brand, .account, .row, .composer-actions, .thread-head { display: flex; align-items: center; gap: .8rem; }
.brand { font-weight: 750; font-size: 1.15rem; white-space: nowrap; }
.brand-symbol, .inbox-symbol { position: relative; border: 2px solid currentColor; border-radius: 4px; }
.brand-symbol { width: 24px; height: 18px; color: #b0dab9; }
.brand-symbol::after, .inbox-symbol::after { content: ""; position: absolute; inset: 25% 15% auto; height: 32%; border: solid currentColor; border-width: 0 0 2px; border-radius: 0 0 45% 45%; }
.account { min-width: 0; }
#language { margin-left: auto; width: auto; flex-shrink: 0; color: var(--ink); font-size: .88rem; }
.account span, .person, .preview, .meta, .thread-identity p { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plain { background: transparent; color: white; border-color: #648278; white-space: nowrap; }
.plain:hover:enabled { background: #285443; }
.entry, .placeholder { display: grid; align-content: center; justify-items: center; }
.entry { flex: 1; padding: 1rem; }
.login-card { width: min(100%, 24rem); display: grid; justify-items: start; gap: 1rem; padding: clamp(1.5rem, 6vw, 3rem); border: 1px solid var(--line); border-radius: 12px; background: white; }
.inbox-symbol { width: 40px; height: 30px; color: var(--green); }
.login-card h1 { margin-top: .45rem; }
.login-card p, .placeholder p, .thread-identity p, .notice, .meta, .preview, .workspace-label, #send-note { color: var(--muted); }
.login-card button { margin-top: .4rem; width: 100%; }
.inbox { display: grid; grid-template-columns: clamp(17rem, 29vw, 25rem) minmax(0, 1fr); flex: 1; min-height: 0; }
.sidebar, .thread { min-height: 0; height: 100%; display: flex; flex-direction: column; }
.sidebar { border-right: 1px solid var(--line); background: white; }
.sidebar-head { padding: 1.35rem 1.35rem 1rem; border-bottom: 1px solid var(--line); }
.row, .composer-actions { justify-content: space-between; }
.workspace-label { display: block; font-weight: 600; font-size: .85rem; }
.sidebar-head label { margin: .95rem 0 .22rem; }
select { padding: .45rem; width: 100%; }
.list-scroll, .transcript { overflow-y: auto; overscroll-behavior: contain; }
.list-scroll { flex: 1; }
ul, ol { list-style: none; padding: 0; }
.conversation { width: 100%; text-align: left; border: none; border-bottom: 1px solid var(--line); border-radius: 0; padding: .85rem 1.35rem; display: grid; gap: .2rem; }
.conversation[aria-current="true"] { background: var(--tint); box-shadow: inset 3px 0 var(--green); }
.person { font-size: .99rem; }
.preview { width: 100%; }
.meta, .conversation time { font-size: .78rem; color: var(--muted); }
.conversation time { flex-shrink: 0; }
.notice { margin: .75rem 1.3rem; font-size: .9rem; }
.more { display: block; margin: .7rem auto 1rem; }
.detail { min-height: 0; }
.placeholder { height: 100%; gap: .8rem; }
.thread-head { padding: 1rem clamp(1rem, 3vw, 3rem); border-bottom: 1px solid var(--line); background: white; }
.thread-identity { flex: 1; min-width: 0; }
.thread-identity h2 { overflow-wrap: anywhere; }
.thread-identity p { font-size: .82rem; }
#back { display: none; }
.transcript { flex: 1; padding: 1rem clamp(1rem, 3vw, 3rem); }
#messages { display: grid; gap: .9rem; }
.message { display: grid; gap: .2rem; justify-items: start; }
.message.outbound { justify-items: end; }
.bubble { max-width: min(85%, 48rem); padding: .65rem .9rem; border: 1px solid var(--line); border-radius: 2px 12px 12px; background: white; white-space: pre-wrap; overflow-wrap: anywhere; }
.outbound .bubble { background: #dbede0; border-color: #cadfce; border-radius: 12px 2px 12px 12px; }
.message .meta { max-width: 100%; white-space: normal; }
.composer { padding: .8rem clamp(1rem, 3vw, 3rem) max(.8rem, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: white; }
textarea { width: 100%; padding: .65rem .8rem; margin: .4rem 0; resize: vertical; border: 1px solid #b6c6bc; border-radius: 6px; min-height: 3rem; max-height: 20vh; }
.composer-actions { align-items: center; }
#send { margin-left: auto; flex-shrink: 0; }
#send-note { font-size: .86rem; }
@media (max-width: 670px) {
  .topbar { min-height: 52px; }
  .inbox { grid-template-columns: minmax(0, 1fr); }
  .sidebar { border-right: none; }
  .detail, .inbox.thread-open .sidebar { display: none; }
  .inbox.thread-open .detail, #back { display: block; }
  .sidebar-head, .thread-head { padding: .8rem 1rem; }
  .thread-head { gap: .55rem; }
  .composer textarea { font-size: 16px; }
}
@media (max-width: 440px) {
  .topbar { flex-wrap: wrap; gap: .45rem .75rem; }
  .account { flex: 1 0 100%; justify-content: space-between; }
  .thread-head button { max-width: 6.5rem; }
}
