:root {
  color-scheme: light;
  --ink: #22392f;
  --sub: #51675b;
  --muted: #64736a;
  --border: #d9dfd6;
  --paper: #fff;
  --accent: #275d47;
  --tint: #edf4ed;
  font-family: "DM Sans", -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: #f5f6f1;
}
* { box-sizing: border-box; }
body { margin: 0; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .6; }
button:focus-visible, input:focus-visible, textarea:focus-visible, [tabindex]:focus-visible { outline: 3px solid #377e76; outline-offset: 2px; }
[hidden] { display: none !important; }
h1, h2, p { margin: 0; }
.masthead { height: 62px; display: flex; align-items: center; justify-content: space-between; padding-inline: clamp(20px,4vw,68px); border-bottom: 1px solid var(--border); background: #fff; }
.identity { display: flex; gap: 12px; align-items: center; font-weight: 720; font-size: 16px; letter-spacing: .06em; }
.brand-icon, .empty-icon { display: grid; align-content: center; justify-items: start; gap: 3px; position: relative; }
.brand-icon { width: 30px; height: 30px; background: var(--ink); border-radius: 10px 10px 10px 3px; padding: 8px; }
.brand-icon i, .empty-icon i { display: block; height: 2px; width: 100%; border-radius: 3px; background: #f3f4d9; }
.brand-icon i:nth-child(2), .empty-icon i:nth-child(2) { width: 66%; }
.top-button, #back, #refresh { color: var(--sub); background: transparent; border: 1px solid var(--border); border-radius: 9px; }
.top-button { padding: 7px 12px; font-size: 13px; }
.top-button:hover, #refresh:hover, #back:hover { background: var(--tint); }
#boot { width: fit-content; margin: 18vh auto; color: var(--sub); }
main { padding: clamp(12px,2.4vw,34px) clamp(14px,4vw,68px) 10px; }
#workspace { max-width: 1480px; margin: 0 auto; }
.desk { display: grid; grid-template-columns: minmax(263px, 31%) minmax(0,1fr); overflow: hidden; height: calc(100vh - 132px); height: calc(100dvh - 132px); min-height: 320px; border: 1px solid var(--border); border-radius: 19px; background: var(--paper); box-shadow: 0 9px 32px rgba(28,50,35,.035); }
.sidebar, .reader, #thread { min-width: 0; min-height: 0; }
.sidebar { display: flex; flex-direction: column; border-right: 1px solid var(--border); }
.list-controls { padding: clamp(18px,2vw,30px) clamp(14px,1.8vw,27px) 16px; border-bottom: 1px solid var(--border); }
.section-mark { width: 33px; height: 4px; border-radius: 6px; background: #b0c17b; }
.list-title { display: flex; align-items: center; justify-content: space-between; margin: 11px 0 16px; gap: 10px; }
h1 { font-weight: 700; font-size: clamp(23px,2vw,31px); letter-spacing: -.04em; }
#refresh, #back { width: 32px; height: 32px; display: grid; place-content: center; font-size: 20px; line-height: 1; }
.filters { display: flex; align-items: center; gap: 2px; padding: 3px; background: #f2f4ee; border-radius: 10px; }
.filter { flex: 1; border: 0; border-radius: 8px; background: transparent; color: var(--sub); white-space: nowrap; padding: 7px 2px; font-size: 12px; }
.filter[aria-pressed="true"] { background: #fff; box-shadow: 0 1px 4px #20302722; font-weight: 700; color: var(--ink); }
#conversations { overflow: auto; flex: 1; padding: 6px; }
.speed-panel { flex: none; border-bottom: 1px solid var(--border); }
.speed-panel summary { padding: 10px clamp(14px,1.8vw,27px); color: var(--sub); cursor: pointer; font-size: 13px; font-weight: 650; }
.speed-panel summary:focus-visible { outline: 2px solid var(--accent); outline-offset: -3px; }
.speed-records { max-height: min(37dvh, 360px); overflow: auto; padding: 0 clamp(12px,1.5vw,20px) 12px; }
.speed-records p, .speed-group small { color: var(--sub); font-size: 12px; }
.speed-group + .speed-group { margin-top: 16px; }
.speed-group h3 { margin: 3px 0 6px; font-size: 13px; }
.speed-group table { border-collapse: collapse; width: 100%; table-layout: fixed; font-size: 12px; }
.speed-group th, .speed-group td { border-bottom: 1px solid var(--border); padding: 5px 2px; vertical-align: top; text-align: right; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.speed-group th { color: var(--sub); font-size: 11px; }
.speed-group th:first-child, .speed-group td:first-child { width: 40%; text-align: left; }
.speed-group small { display: block; margin-top: 2px; }
.conversation { display: block; color: var(--ink); text-align: left; background: transparent; border: 1px solid transparent; width: 100%; padding: 14px 12px; border-radius: 10px; }
.conversation:hover { background: #f4f6f1; }
.conversation[aria-current="true"] { background: #eef4ee; border-color: #d7e4d8; }
.row-head, .row-foot { display: flex; gap: 9px; align-items: center; justify-content: space-between; }
.row-name { font-weight: 650; font-size: 14px; }
.row-time { flex: none; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.row-preview { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--sub); font-size: 13px; }
.row-foot { margin-top: 8px; }
.status { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 600; color: #536559; white-space: nowrap; }
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #829482; flex: none; }
.status[data-status="waiting"] { color: #815321; }
.status[data-status="waiting"]::before { background: #be8130; }
.status[data-status="human"] { color: #2a6663; }
.status[data-status="human"]::before { background: #368480; }
.list-empty { color: var(--muted); font-size: 14px; text-align: center; padding: 28px 12px; }
.reader { background: #fafbf7; }
.empty-reader { height: 100%; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; padding: 24px; gap: 8px; }
.empty-icon { width: 70px; height: 61px; padding: 20px; gap: 5px; background: #e3ecdf; border: 1px solid #d3dfcf; border-radius: 22px 22px 22px 6px; margin-bottom: 12px; transform: rotate(-4deg); }
.empty-icon i { background: #829b7d; height: 3px; }
.empty-reader h2 { font-size: 21px; }
.empty-reader p, .login-card p { font-size: 14px; color: var(--sub); line-height: 1.65; }
#thread { display: grid; grid-template-rows: auto minmax(0,1fr) auto; height: 100%; }
.thread-heading { display: flex; gap: 12px; align-items: center; padding: 16px clamp(16px,2.4vw,38px); background: var(--paper); border-bottom: 1px solid var(--border); }
.thread-identity { flex: 1; }
#case-summary { color: var(--sub); background: var(--paper); border-bottom: 1px solid var(--border); padding: 8px clamp(12px,2.4vw,38px); font-size: 13px; }
#case-summary summary { cursor: pointer; font-weight: 650; }
#case-fields { margin: 6px 0 0; max-height: 24vh; overflow-y: auto; overflow-wrap: anywhere; }
#case-fields dt { color: var(--ink); font-weight: 600; margin-top: 6px; }
#case-fields dd { margin: 2px 0; white-space: pre-wrap; }
.thread-identity h2 { font-size: 19px; line-height: 1.4; }
#back { display: none; }
.primary { background: var(--accent); color: white; border: 0; border-radius: 9px; font-weight: 650; font-size: 13px; padding: 10px 17px; }
.primary:not(:disabled):hover { background: #174532; }
#messages { overflow: auto; padding: 18px clamp(12px,2.4vw,40px) 24px; display: flex; flex-direction: column; gap: 16px; }
.message { max-width: min(79%,690px); width: fit-content; align-self: flex-start; }
.message-meta { display: flex; gap: 9px; align-items: center; color: var(--muted); font-size: 11px; margin: 0 3px 4px; }
.message-body { color: var(--ink); background: var(--paper); border: 1px solid var(--border); border-radius: 13px 13px 13px 3px; padding: 9px 13px; font-size: 15px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
.response-timing { margin: 5px 3px 0; color: var(--sub); font-size: 12px; }
.response-timing summary { cursor: pointer; width: fit-content; padding: 3px 0; }
.response-timing summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.response-timing dl { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 5px 12px; width: min(29em,100%); margin: 4px 0 0; padding: 8px 0; border-top: 1px solid var(--border); line-height: 1.45; }
.response-timing dd { margin: 0; color: var(--ink); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.message:has(.response-timing[open]) { width: min(100%, 28em); }
.message[data-role="staff"], .message[data-role="ai"] { align-self: flex-end; }
.message[data-role="staff"] .message-meta, .message[data-role="ai"] .message-meta { justify-content: flex-end; }
.message[data-role="staff"] .message-body { background: #dcecdf; border-color: #cbdece; border-radius: 13px 13px 3px 13px; }
.message[data-role="ai"] .message-body { background: #eaf1e9; border-color: #dfe8dd; border-radius: 13px 13px 3px 13px; }
.message[data-role="system"] { max-width: 90%; align-self: center; }
.message[data-role="system"] .message-meta { justify-content: center; }
.message[data-role="system"] .message-body { border: 0; color: var(--sub); padding: 2px 8px; background: transparent; font-size: 12px; text-align: center; }
.reply-area { padding: 14px clamp(12px,2.4vw,38px); background: #fff; border-top: 1px solid var(--border); }
#reply-note { color: var(--sub); font-size: 13px; padding: 3px 0; }
#reply-form { border: 1px solid #c7d2c7; border-radius: 12px; padding: 8px; }
#reply { display: block; padding: 4px 5px; margin-bottom: 7px; width: 100%; resize: vertical; max-height: 160px; min-height: 40px; border: none; background: #fff; color: var(--ink); font-size: 15px; }
.composer-actions { display: flex; justify-content: space-between; align-items: center; }
.keyboard-hint { margin-left: 5px; font-size: 11px; color: var(--muted); }
.sync-error, .error-text { color: #903a2c; font-size: 13px; line-height: 1.5; margin-top: 7px; }
.sync-error { text-align: center; }
.login-card { background: #fff; border: 1px solid var(--border); border-radius: 19px; width: min(100%,420px); margin: clamp(24px,10vh,105px) auto; padding: clamp(24px,4vw,41px); }
.login-card h1 { margin: 16px 0 6px; }
.login-card label { display: block; margin: 26px 0 6px; font-weight: 650; font-size: 14px; }
.login-card input { width: 100%; background: #fafbf7; padding: 10px; border: 1px solid #c5d1c4; border-radius: 8px; color: var(--ink); }
.login-card .primary { width: 100%; margin-top: 18px; }
.login-card .error-text { color: #903a2c; }
.sr-only { position: absolute; width: 1px; height: 1px; clip-path: inset(50%); overflow: hidden; white-space: nowrap; }
@media(max-width: 700px) {
  .masthead { height: 50px; padding-inline: 16px; }
  main { padding: 0; }
  .desk { height: calc(100vh - 50px); height: calc(100dvh - 50px); min-height: 240px; display: block; border: 0; border-radius: 0; }
  .sidebar { height: 100%; border: 0; }
  .reader { height: 100%; display: none; }
  .show-thread .sidebar { display: none; }
  .show-thread .reader { display: block; }
  #back { display: grid; }
  .list-controls { padding: 22px 16px 12px; }
  .thread-heading { padding: 12px; }
  .login-card { width: calc(100% - 32px); }
  .reply-area { padding-bottom: max(12px, env(safe-area-inset-bottom)); }
  .sync-error { background: #fff2e9; margin: 0; position: fixed; top: 0; inset-inline: 0; padding: 4px; }
  .keyboard-hint { visibility: hidden; }
}
