:root {
  color-scheme: light;
  --base: #e7efed;
  --surface: #f8fcfa;
  --panel: #eef5f2;
  --ink: #182f2b;
  --muted: #4d6961;
  --line: #ccdcd5;
  --accent: #006753;
  --accent-hover: #005241;
  --focus: #007c66;
  --out: #d8eae0;
  --error: #943f34;
  --gold: #695723;
  font-family: "Noto Sans CJK SC","Microsoft YaHei UI","PingFang SC","Hiragino Sans GB",sans-serif;
  color: var(--ink);
  background: var(--base);
  font-size: 14px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
}

[hidden] {
  display: none!important;
}

button,input,textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--surface);
  padding: .65rem .9rem;
  border-radius: .55rem;
  line-height: 1.2;
  font-weight: 600;
  white-space: nowrap;
}

button:hover {
  background: var(--panel);
  border-color: #9bbdb0;
}

button:disabled {
  cursor: wait;
  opacity: .65;
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}

.primary {
  background: var(--accent);
  color: #f1faf6;
  border-color: var(--accent);
}

.primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.quiet {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
}

input,textarea {
  width: 100%;
  padding: .72rem .78rem;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: .5rem;
  min-width: 0;
}

input::placeholder {
  color: #587268;
}

textarea {
  resize: vertical;
  min-height: 85px;
  max-height: 45vh;
}

h1,h2,p {
  margin: 0;
}

.masthead {
  height: 64px;
  background: #18352e;
  color: #eaf4ee;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 clamp(1rem,4vw,3.4rem);
}

.identity,.header-tools {
  display: flex;
  gap: .8rem;
  align-items: center;
}

.identity h1 {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: .04em;
}

.mark {
  width: 30px;
  height: 30px;
  border: 1px solid #689786;
  border-radius: 7px;
  display: grid;
  align-content: center;
  justify-items: start;
  padding: 5px;
  gap: 3px;
  background: #25483e;
}

.mark i {
  height: 2px;
  width: 100%;
  background: #b7dfca;
  border-radius: 3px;
}

.mark i:nth-child(2) {
  width: 67%;
}

.mark i:nth-child(3) {
  width: 85%;
}

.environment {
  font-size: .84rem;
  color: #dbece2;
  display: inline-flex;
  align-items: center;
  gap: .45rem;
}

.environment i,.sync-dot {
  height: .5rem;
  width: .5rem;
  border-radius: 50%;
  background: #9bc9ab;
  display: inline-block;
  flex: none;
}

.masthead .quiet {
  color: #ebf5ef;
}

.masthead .quiet:hover {
  background: #34574c;
  border-color: #507568;
}

.login {
  min-height: calc(100dvh - 64px);
  display: grid;
  place-items: center;
  padding: 1.25rem;
  background: radial-gradient(ellipse at 70% 18%,#f0f7f1 0,transparent 64%),var(--base);
}

.login-panel {
  width: min(100%,410px);
  padding: 2.35rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 16px 50px #1c453317;
  display: grid;
  gap: .85rem;
}

.login-panel h2 {
  font-size: 1.7rem;
  letter-spacing: .035em;
}

.login-panel p {
  color: var(--muted);
  margin-bottom: .55rem;
}

.login-panel label,.search label,.dialog-form label {
  font-weight: 650;
  font-size: .86rem;
}

.login-panel .primary {
  margin-top: .2rem;
  min-height: 42px;
}

.workspace {
  height: calc(100dvh - 64px);
  display: grid;
  grid-template-columns: minmax(275px,320px) minmax(0,1fr);
  max-width: 1500px;
  margin: auto;
  padding: 1.2rem clamp(.9rem,3.2vw,3rem);
  gap: 1rem;
}

.side,.conversation {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}

.side {
  background: var(--panel);
}

.search {
  padding: 1.16rem;
  display: grid;
  gap: .65rem;
  border-bottom: 1px solid var(--line);
}

.search-row {
  display: grid;
  grid-template-columns: minmax(0,1fr) auto;
  gap: .45rem;
}

.sessions {
  padding: 1rem .65rem;
  flex: 1;
  overflow: auto;
}

.sessions h2 {
  font-size: .93rem;
  margin: 0 .5rem .55rem;
  display: flex;
  gap: .6rem;
  align-items: baseline;
}

.sessions h2 span {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-size: .85rem;
  font-weight: 500;
}

.session {
  width: 100%;
  display: grid;
  grid-template-columns: 37px minmax(0,1fr);
  gap: .73rem;
  align-items: center;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  padding: .67rem .5rem;
  margin-bottom: .25rem;
}

.session:hover,.session[aria-current="true"] {
  background: #dfece4;
  border-color: #bed4c7;
}

.session small,.session .preview-line {
  color: var(--muted);
  font-weight: 400;
  font-size: .78rem;
}

.session .preview-line {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
  margin-top: .35rem;
  line-height: 1.3;
}

.session-line {
  display: flex;
  justify-content: space-between;
  gap: .3rem;
  align-items: baseline;
}

.session-line strong {
  overflow: hidden;
  text-overflow: ellipsis;
}

.avatar {
  display: grid;
  place-items: center;
  width: 37px;
  height: 37px;
  border-radius: 9px;
  background: #cadfd2;
  color: #254c3d;
  font-size: 1rem;
}

.avatar.group {
  background: #dce7df;
  border: 1px solid #bacfc2;
}

.sync {
  display: flex;
  align-items: center;
  gap: .59rem;
  border-top: 1px solid var(--line);
  padding: .8rem .85rem;
  font-size: .84rem;
}

.sync small {
  display: block;
  margin-top: .2rem;
  color: var(--muted);
  font-size: .73rem;
}

.sync button {
  margin-left: auto;
}

.sync-dot {
  background: var(--accent);
}

.sync-dot.alert {
  background: var(--error);
}

.conversation {
  background: var(--surface);
}

.conversation-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  min-height: 71px;
  padding: .9rem 1.25rem;
  border-bottom: 1px solid var(--line);
}

.conversation-title {
  flex: 1;
  min-width: 0;
}

.conversation-title h2 {
  font-size: 1.26rem;
}

.conversation-title p {
  color: var(--muted);
  font-size: .8rem;
  margin-top: .33rem;
}

.timeline {
  overflow: auto;
  flex: 1;
  padding: 1.05rem clamp(1rem,4%,3rem) 1.65rem;
  background: #f4f9f6;
}

.older {
  display: block;
  margin: 0 auto .95rem;
  color: var(--accent);
  background: var(--surface);
}

.messages {
  display: grid;
  gap: .88rem;
}

.day {
  margin: .4rem 0 .1rem;
  display: flex;
  gap: .85rem;
  align-items: center;
  color: var(--muted);
  font-size: .78rem;
  font-variant-numeric: tabular-nums;
}

.day:before,.day:after {
  content: "";
  height: 1px;
  background: var(--line);
  flex: 1;
}

.message {
  max-width: min(85%,630px);
  justify-self: start;
  min-width: 0;
}

.message.out {
  justify-self: end;
}

.message.out .message-meta {
  justify-content: flex-end;
}

.message-meta {
  display: flex;
  align-items: center;
  gap: .46rem;
  font-size: .75rem;
  color: var(--muted);
  margin-bottom: .3rem;
  min-height: 19px;
}

.message-meta time {
  font-variant-numeric: tabular-nums;
}

.message-meta button {
  border: 0;
  background: transparent;
  padding: .1rem .2rem;
  font-size: .75rem;
  color: var(--accent);
}

.message-meta button:hover {
  text-decoration: underline;
}

.bubble {
  padding: .68rem .85rem;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 3px 11px 11px 11px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.64;
}

.out .bubble {
  background: var(--out);
  border-color: #c5dccc;
  border-radius: 11px 3px 11px 11px;
}

.attachment {
  display: block;
  margin: .2rem 0;
  font-weight: 650;
  color: var(--accent);
}

.tour-link {
  display: inline-block;
  font-size: .76rem;
  margin: .46rem .3rem 0 0;
  padding: .24rem .4rem;
  background: #f0f7f3;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  white-space: normal;
  text-align: left;
}

.empty {
  padding: 2.5rem 1rem;
  text-align: center;
  color: var(--muted);
}

.feedback {
  padding: .7rem 1rem;
  color: var(--muted);
  border-top: 1px solid var(--line);
  overflow-wrap: anywhere;
}

.error,.login-panel .error {
  color: var(--error);
}

dialog {
  max-width: min(540px,calc(100% - 2rem));
  width: 100%;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 18px 85px #19362d50;
}

dialog::backdrop {
  background: #13382c75;
}

.dialog-form {
  display: grid;
  gap: .8rem;
  padding: 1.35rem;
}

.dialog-form h2 {
  font-size: 1.28rem;
}

.dialog-form .feedback {
  padding: .5rem 0;
}

.recipient {
  padding: .66rem .75rem;
  background: var(--panel);
  border-radius: .45rem;
  color: var(--muted);
}

.recipient strong {
  color: var(--ink);
  margin-left: .4rem;
}

.preview {
  border: 1px solid var(--line);
  border-radius: .5rem;
  padding: .65rem .75rem;
  overflow-wrap: anywhere;
}

.preview p {
  font-size: .83rem;
  color: var(--muted);
  margin-bottom: .3rem;
}

.preview div {
  white-space: pre-wrap;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: .4rem;
  flex-wrap: wrap;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.back {
  display: none;
}

@media(max-width:720px) {
  .workspace {
    display: block;
    padding: .6rem;
    height: calc(100dvh - 64px);
  }
  .workspace .side,.workspace .conversation {
    height: 100%;
  }
  .workspace:not(.chat-open) .conversation,.workspace.chat-open .side {
    display: none;
  }
  .back {
    display: inline-block;
    padding: .55rem .35rem;
    font-size: .8rem;
  }
  .conversation-header {
    padding: .62rem .75rem;
    gap: .4rem;
  }
  .conversation-title h2 {
    font-size: 1.07rem;
  }
  .conversation-header .primary {
    padding: .58rem .61rem;
    font-size: .82rem;
  }
  .timeline {
    padding: .8rem .75rem 1.2rem;
  }
  .message {
    max-width: 94%;
  }
  .login-panel {
    padding: 1.5rem;
  }
  .identity h1 {
    font-size: 1rem;
  }
}
