:root {
  color-scheme: light;
  font-family: Inter, "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  color: #202d26;
  background: #f4f6f3;
  font-synthesis: none;
  --ink: #202d26;
  --muted: #626f65;
  --line: #e2e8e0;
  --surface: #fff;
  --page: #f4f6f3;
  --green: #1f6347;
  --green-hover: #174d37;
  --tint: #eaf4eb;
  --focus: #3c8b67;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; font-size: 14px; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
a { color: var(--green); }
h1, h2, p, dl, dd { margin: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.boot { padding: 48px 24px; text-align: center; color: var(--muted); }
.muted { color: var(--muted); line-height: 1.7; }

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  width: fit-content;
  font-size: 17px;
  font-weight: 730;
  color: inherit;
  text-decoration: none;
  white-space: nowrap;
}
.brand-mark {
  width: 35px;
  height: 35px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: #cde8ce;
  color: #204e38;
  flex: none;
}
.brand-mark i, .empty-icon::before {
  position: relative;
  width: 18px;
  height: 14px;
  border: 2px solid currentColor;
  border-radius: 5px;
}
.brand-mark i::after, .empty-icon::after {
  content: "";
  position: absolute;
  width: 5px;
  height: 5px;
  border-bottom: 2px solid currentColor;
  border-left: 2px solid currentColor;
  background: inherit;
  transform: skewY(-32deg);
}
.brand-mark i::after { left: 2px; bottom: -4px; background: #cde8ce; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 37px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 7px 13px;
  font-weight: 650;
  white-space: nowrap;
}
.button.primary { color: white; background: var(--green); border-color: var(--green); }
.button.primary:hover:not(:disabled) { background: var(--green-hover); }
.button.primary:disabled { background: #e6ede6; color: #6b7d6d; border-color: #e6ede6; }
.button.secondary { color: var(--green); background: #f4f8f3; border-color: #dbe6da; }
.button.secondary:hover:not(:disabled) { background: #e8f2e6; }
.button.secondary:disabled { opacity: .58; }

input:not([type=checkbox]), select, textarea {
  color: var(--ink);
  background: #fff;
  border: 1px solid #dce4da;
  border-radius: 8px;
  padding: 9px 11px;
  min-width: 0;
  width: 100%;
}
input::placeholder, textarea::placeholder { color: #758076; }
input:focus, select:focus, textarea:focus { outline: 2px solid #b7d9c1; outline-offset: 0; border-color: #6ba882; }
textarea { resize: vertical; line-height: 1.65; }
label { display: grid; gap: 7px; font-weight: 600; }
label :is(input, select, textarea) { font-weight: 400; }

.auth-page {
  min-height: 100dvh;
  display: grid;
  align-items: center;
  justify-items: center;
  padding: 32px 18px;
  background: radial-gradient(ellipse at 50% 6%, #e2efe2, transparent 64%), var(--page);
}
.auth-card {
  width: min(100%, 436px);
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: white;
  box-shadow: 0 18px 65px #203b2710;
}
.auth-card h1 { margin: 27px 0 8px; font-size: 26px; letter-spacing: -.04em; line-height: 1.25; }
.stack-form { margin-top: 24px; display: grid; gap: 17px; }
.auth-card > .button { margin-top: 22px; }
.feedback { color: #a02c24; font-size: 13px; line-height: 1.55; overflow-wrap: anywhere; }
.feedback[data-type=success] { color: #1b5c3f; }

.desk-app { display: grid; grid-template-columns: 208px minmax(0, 1fr); min-height: 100dvh; }
.sidebar {
  position: sticky;
  top: 0;
  height: 100dvh;
  background: #193025;
  color: #f3f8f0;
  padding: 23px 14px 14px;
  display: flex;
  flex-direction: column;
}
.sidebar .brand { margin: 0 10px 34px; }
.sidebar nav { display: grid; gap: 5px; }
.sidebar nav button {
  display: flex;
  align-items: center;
  gap: 11px;
  border: 1px solid transparent;
  background: none;
  color: #ccdad0;
  padding: 11px 12px;
  text-align: left;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}
.sidebar nav button:hover { background: #253e30; }
.sidebar nav button[aria-current=page] { color: #edf7e9; background: #30503d; border-color: #41604d; }
.nav-icon { position: relative; width: 16px; height: 15px; display: inline-block; flex: none; }
.nav-icon.inbox { border: 1.5px solid currentColor; border-radius: 4px; height: 13px; }
.nav-icon.inbox::after { content: ""; position: absolute; left: 3px; right: 3px; top: 4px; border-top: 1.5px solid currentColor; }
.nav-icon.channels::before, .nav-icon.channels::after {
  content: ""; position: absolute; width: 10px; height: 6px; border: 1.5px solid currentColor; border-radius: 4px; transform: rotate(-38deg);
}
.nav-icon.channels::before { top: 2px; left: 5px; }
.nav-icon.channels::after { bottom: 2px; left: 0; }
.nav-icon.seats::before {
  content: ""; position: absolute; top: 0; left: 5px; width: 7px; height: 7px; border: 1.5px solid currentColor; border-radius: 50%;
}
.nav-icon.seats::after {
  content: ""; position: absolute; bottom: 0; left: 1px; width: 15px; height: 7px; border: 1.5px solid currentColor; border-radius: 6px 6px 2px 2px;
}
.sidebar-profile {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: auto;
  padding: 14px 3px 2px;
  border-top: 1px solid #3a5042;
}
.avatar {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: 11px;
  background: #e6f1e7;
  color: #23583b;
  font-weight: 700;
  font-size: 15px;
}
.sidebar-profile .avatar { width: 34px; height: 34px; border-radius: 10px; background: #cde8ce; }
.profile-name { flex: 1; min-width: 0; display: grid; gap: 4px; }
.profile-name strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-name small { color: #bbcdc1; white-space: nowrap; }
.logout { color: #c1d1c6; background: none; border: 0; padding: 6px 3px; white-space: nowrap; }
.logout:hover { color: white; }

.desk-main { min-width: 0; padding: 25px 27px 27px; }
.desk-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 21px; }
.desk-header h1 { font-size: 25px; letter-spacing: -.035em; line-height: 1.25; }
.connection {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}
.connection::before, .status-pill i { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.connection.connected { color: var(--green); }

.workspace {
  display: grid;
  grid-template-columns: minmax(252px, 295px) minmax(0, 1fr);
  min-height: 510px;
  height: calc(100dvh - 105px);
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
  overflow: hidden;
}
.inbox-pane { min-width: 0; min-height: 0; display: flex; flex-direction: column; border-right: 1px solid var(--line); }
.inbox-header { padding: 18px 14px 0; border-bottom: 1px solid var(--line); }
.inbox-header h2 { font-size: 15px; margin: 0 1px 12px; }
.search { position: relative; display: block; }
.search span {
  position: absolute;
  top: 12px;
  left: 11px;
  width: 11px;
  height: 11px;
  border: 1.5px solid #6c7d70;
  border-radius: 50%;
}
.search span::after {
  content: ""; position: absolute; left: 7px; top: 7px; width: 5px; border-top: 1.5px solid #6c7d70; transform: rotate(45deg);
}
.search input { padding-left: 31px; font-size: 13px; background: #f8faf7; }
.filters { display: flex; gap: 3px; margin-top: 9px; overflow-x: auto; }
.filters button {
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  padding: 8px 4px 9px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}
.filters button span { font-variant-numeric: tabular-nums; }
.filters button[aria-pressed=true] { color: var(--green); border-bottom-color: var(--green); font-weight: 750; }
.filters button:focus-visible { outline-offset: -2px; }
.conversation-list { min-height: 0; overflow-y: auto; }
.list-empty { padding: 18px 15px; color: var(--muted); font-size: 13px; line-height: 1.65; }
.conversation-row {
  width: 100%;
  display: grid;
  gap: 7px;
  padding: 14px;
  text-align: left;
  background: #fff;
  border: 0;
  border-bottom: 1px solid #edf0eb;
  border-left: 3px solid transparent;
}
.conversation-row:hover { background: #f6faf5; }
.conversation-row[aria-pressed=true] { background: #edf6ed; border-left-color: var(--green); }
.conversation-row:focus-visible { outline-offset: -3px; }
.row-line { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-width: 0; }
.row-line strong { color: var(--ink); }
.row-line time { font-size: 11px; color: var(--muted); white-space: nowrap; }
.row-channel, .last-message { color: var(--muted); font-size: 12px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.last-message { font-size: 13px; }
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 7px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 650;
  white-space: nowrap;
  line-height: 1.5;
}
.status-pill.waiting { background: #fbefd9; color: #805018; }
.status-pill.active { background: #e8f3e9; color: #245e3d; }
.status-pill.closed { background: #eef1ee; color: #626e65; }
.status-pill.suspended { background: #f8eae6; color: #903d30; }

.active-conversation { min-width: 0; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 218px; }
.empty-panel { display: grid; grid-template-columns: 1fr; place-items: center; background: #fafbf9; }
.empty-state { text-align: center; padding: 26px 18px; }
.empty-state h2 { font-size: 16px; font-weight: 700; margin: 0 0 7px; }
.empty-state p { color: var(--muted); font-size: 13px; line-height: 1.65; }
.empty-icon {
  position: relative;
  display: grid;
  place-items: center;
  width: 51px;
  height: 51px;
  margin: 0 auto 15px;
  color: #397153;
  background: #e6f1e7;
  border-radius: 15px;
}
.empty-icon::before { content: ""; }
.empty-icon::after { left: 22px; bottom: 16px; background: #e6f1e7; }
.message-pane { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: #fbfcfa; }
.thread-header, .visitor-header {
  display: flex;
  align-items: center;
  gap: 11px;
  background: white;
  padding: 13px 17px;
  border-bottom: 1px solid var(--line);
}
.thread-heading, .visitor-heading { flex: 1; min-width: 0; }
.thread-heading h2 { font-size: 16px; }
.thread-heading p, .visitor-heading p { color: var(--muted); font-size: 12px; margin-top: 3px; overflow-wrap: anywhere; }
.back-button { display: none; }
.messages { min-height: 0; flex: 1; overflow-y: auto; padding: 17px 18px 19px; }
.day-divider, .conversation-event { text-align: center; color: var(--muted); font-size: 12px; line-height: 1.55; padding: 6px 3px; overflow-wrap: anywhere; }
.day-divider { margin-bottom: 10px; }
.conversation-event { margin: 9px 0; }
.message-row { display: flex; flex-direction: column; align-items: flex-start; margin: 0 0 15px; }
.message-row.mine { align-items: flex-end; }
.message-row:last-child { margin-bottom: 0; }
.message-meta { display: flex; align-items: baseline; gap: 7px; color: var(--muted); font-size: 11px; margin: 0 1px 5px; overflow-wrap: anywhere; }
.message-bubble {
  max-width: min(87%, 540px);
  border: 1px solid var(--line);
  border-radius: 4px 12px 12px 12px;
  background: #fff;
  color: var(--ink);
  padding: 8px 11px;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.message-row.mine .message-bubble { background: #e5f1e5; border-color: #d8e9d7; border-radius: 12px 4px 12px 12px; }
.inline-emoji { display: inline-block; width: 1.25em; height: 1.25em; vertical-align: -.2em; }
.message-media { display: grid; gap: 7px; white-space: normal; min-width: 0; }
.message-text + .message-media { margin-top: 8px; }
.message-media img, .message-media video {
  display: block;
  max-width: min(100%, 360px);
  max-height: 42dvh;
  object-fit: contain;
  border-radius: 7px;
}
.message-media audio { display: block; width: 300px; max-width: 100%; }
.message-media a { font-size: 12px; overflow-wrap: anywhere; }
.composer { display: grid; gap: 8px; background: #fff; }
.desk-composer { padding: 12px 15px; border-top: 1px solid var(--line); }
.composer textarea { min-height: 58px; max-height: 150px; }
.compose-tools { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.compose-tools .button { min-width: 75px; }
.compose-actions { display: flex; gap: 6px; align-items: center; }
.emoji-picker { position: relative; }
.emoji-picker summary { list-style: none; min-width: 52px; cursor: pointer; }
.emoji-picker summary::-webkit-details-marker { display: none; }
.emoji-panel {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  z-index: 3;
  width: min(276px, calc(100vw - 54px));
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  box-shadow: 0 4px 18px #203b2722;
}
.emoji-grid { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 2px; }
.emoji-option {
  display: grid;
  place-items: center;
  min-height: 29px;
  padding: 3px;
  border: 0;
  border-radius: 5px;
  background: transparent;
}
.emoji-option:hover { background: var(--tint); }
.emoji-option img { width: 22px; height: 22px; max-width: 100%; object-fit: contain; }
.emoji-panel > a { display: inline-block; margin: 6px 0 0 3px; font-size: 11px; color: var(--muted); }
.media-picker:focus-within { outline: 2px solid var(--focus); outline-offset: 3px; }
.media-picker:has(input:disabled) { opacity: .58; cursor: default; }
.media-picker { cursor: pointer; }
.pending-media {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 12px;
  background: #f8faf7;
}
.pending-media span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pending-media img { width: 48px; height: 40px; object-fit: contain; border-radius: 4px; }
.pending-media .button { min-height: 26px; padding: 3px 7px; }
.keyboard-hint { color: var(--muted); font-size: 11px; }
.closed-panel { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 15px; color: var(--muted); background: #fff; }
.message-pane .closed-panel { border-top: 1px solid var(--line); }

.context-pane { border-left: 1px solid var(--line); padding: 17px 14px; overflow: auto; }
.context-pane h2 { font-size: 14px; margin-bottom: 17px; }
.details-list { display: grid; gap: 13px; font-size: 13px; }
.details-list div { display: grid; gap: 4px; }
.details-list dt { color: var(--muted); font-size: 12px; }
.details-list dd { overflow-wrap: anywhere; }
.assign-form { display: grid; gap: 9px; margin-top: 19px; padding-top: 15px; border-top: 1px solid var(--line); }
.assign-form label { font-size: 12px; }
.assign-form select { font-size: 12px; }
.no-seats { margin-top: 16px; font-size: 12px; }
.close-button { margin-top: 15px; width: 100%; color: #8f342a; border-color: #f0ded8; background: #fffafa; }
.close-button:hover { background: #fdf0ec; }
.toast {
  position: fixed;
  z-index: 2;
  right: 18px;
  bottom: 18px;
  max-width: calc(100% - 36px);
  padding: 10px 15px;
  border: 1px solid #eddad3;
  background: #fff7f5;
  border-radius: 9px;
  box-shadow: 0 4px 15px #182e2714;
}
.toast[data-type=success] { border-color: #d1e5d2; background: #f1f9f0; }

.directory { max-width: 1040px; }
.view-help { color: var(--muted); margin-bottom: 18px; line-height: 1.7; }
.create-panel { margin-bottom: 15px; }
.create-panel summary {
  width: fit-content;
  color: #fff;
  background: var(--green);
  border-radius: 8px;
  padding: 9px 13px;
  font-weight: 650;
  cursor: pointer;
}
.create-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(155px, 1fr));
  align-items: end;
  gap: 12px;
  margin-top: 12px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
}
.create-form .button { justify-self: start; }
.directory-list { display: grid; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.directory-row {
  padding: 15px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--line);
}
.directory-row:last-child { border: 0; }
.channel-actions { display: flex; gap: 7px; align-items: center; justify-content: flex-end; flex-wrap: wrap; }
.button.channel-disable { color: #8f342a; border-color: #f0ded8; background: #fffafa; }
.button.channel-disable:hover { background: #fdf0ec; }
.directory-name { min-width: 0; flex: 1; }
.directory-name h2 { font-size: 15px; margin-bottom: 5px; overflow-wrap: anywhere; }
.directory-name :is(a, p) { font-size: 13px; overflow-wrap: anywhere; }
.directory-name p, .workload { color: var(--muted); }
.workload { white-space: nowrap; font-size: 12px; }

.visitor-page {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 25px 15px;
  background: radial-gradient(ellipse at 50% 8%, #e6f1e6, transparent 68%), var(--page);
}
.visitor-wrap { width: min(100%, 610px); }
.visitor-brand { margin: 0 0 13px 1px; }
.visitor-card {
  display: flex;
  flex-direction: column;
  height: min(700px, calc(100dvh - 108px));
  min-height: 395px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: white;
  box-shadow: 0 12px 50px #21422812;
}
.visitor-header { padding: 13px 17px; }
.visitor-header h1 { font-size: 17px; }
.visitor-log { min-height: 0; flex: 1; display: flex; flex-direction: column; background: #fafcf9; }
.visitor-log .empty-state { margin: auto; }
.visitor-bottom { padding: 12px 15px; border-top: 1px solid var(--line); }
.visitor-bottom .closed-panel { padding: 0; }
.visitor-bottom .feedback { margin-bottom: 8px; }

@media (max-width: 1180px) {
  .desk-app { grid-template-columns: 175px minmax(0, 1fr); }
  .desk-main { padding-left: 19px; padding-right: 19px; }
  .workspace { grid-template-columns: 245px minmax(0, 1fr); }
  .active-conversation { grid-template-columns: minmax(0, 1fr) 170px; }
  .context-pane { padding-left: 11px; padding-right: 11px; }
  .filters button { padding-left: 3px; padding-right: 3px; }
}

@media (max-width: 980px) {
  .workspace { min-height: 555px; height: auto; }
  .conversation-list { max-height: 625px; }
  .active-conversation { grid-template-columns: 1fr; }
  .message-pane { min-height: 425px; height: 57dvh; }
  .context-pane { border-left: 0; border-top: 1px solid var(--line); padding: 16px; }
  .details-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .assign-form { grid-template-columns: 1fr auto; align-items: end; }
  .close-button { width: auto; }
}

@media (max-width: 760px) {
  .desk-app { display: block; }
  .sidebar {
    z-index: 1;
    height: auto;
    padding: 10px 12px 8px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
  }
  .sidebar .brand { margin: 0; font-size: 15px; }
  .sidebar .brand-mark { width: 29px; height: 29px; }
  .sidebar nav { grid-column: 1 / -1; grid-row: 2; display: flex; flex-wrap: wrap; gap: 4px; }
  .sidebar nav button { gap: 6px; padding: 6px 8px; font-size: 12px; }
  .sidebar-profile { margin: 0; padding: 0; border: 0; max-width: 155px; }
  .sidebar-profile .avatar { width: 28px; height: 28px; font-size: 13px; }
  .profile-name { gap: 2px; font-size: 12px; }
  .logout { font-size: 12px; }
  .desk-main { padding: 16px 12px; }
  .desk-header { margin-bottom: 12px; }
  .desk-header h1 { font-size: 21px; }
}

@media (max-width: 590px) {
  .workspace { display: block; min-height: 0; }
  .workspace .active-conversation { display: none; }
  .workspace.show-conversation .active-conversation { display: grid; }
  .workspace.show-conversation .inbox-pane { display: none; }
  .inbox-pane { border-right: 0; }
  .conversation-list { min-height: 125px; max-height: 65dvh; }
  .message-pane { min-height: 380px; }
  .back-button { display: inline-flex; min-height: 32px; padding: 5px 8px; font-size: 12px; }
  .thread-header { padding: 10px; gap: 8px; }
  .thread-header .avatar { display: none; }
  .keyboard-hint { display: none; }
  .visitor-page { align-items: stretch; padding: 10px; }
  .visitor-brand { margin-bottom: 7px; font-size: 14px; }
  .visitor-brand .brand-mark { width: 29px; height: 29px; }
  .visitor-card { height: calc(100dvh - 56px); min-height: 300px; border-radius: 12px; }
  .visitor-header, .visitor-bottom { padding: 10px 12px; }
  .composer textarea, .stack-form input, .create-form input { font-size: 16px; }
  .directory-row { padding: 12px 9px; gap: 8px; }
  .directory-row .button { font-size: 12px; padding-inline: 8px; }
  .directory-row .avatar { width: 29px; height: 29px; }
  .channel-row { flex-wrap: wrap; }
  .channel-actions { flex-basis: 100%; }
  .auth-card { padding: 24px; }
}
