:root {
  color-scheme: light;
  font-family: "Microsoft YaHei UI", "PingFang SC", "Segoe UI", system-ui, sans-serif;
  color: #182b28;
  background: #f5f8f7;
  font-size: 16px;
  --ink: #182b28;
  --muted: #526963;
  --line: #dce7e2;
  --primary: #106c55;
  --primary-dark: #0a5644;
  --green-light: #e5f4ed;
  --white: #fff;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
button, textarea, select, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled, input:disabled, textarea:disabled { cursor: not-allowed; opacity: .62; }
a { color: var(--primary); }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid #45a98d;
  outline-offset: 3px;
}
h1, h2, h3, p { margin: 0; }
.muted { color: var(--muted); }
.kicker, .visual-label { color: var(--primary); font-size: .76rem; font-weight: 750; letter-spacing: .13em; }
.field-error { color: #a52536; font-size: .92rem; line-height: 1.5; }

.button, .square, .close {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  min-height: 40px; padding: .55rem .82rem; border: 1px solid transparent; border-radius: 8px;
  background: transparent; color: var(--ink); font-size: .88rem; font-weight: 650; text-decoration: none;
  white-space: nowrap;
}
.button.primary, .square { color: white; background: var(--primary); }
.button.primary:hover:not(:disabled), .square:hover:not(:disabled) { background: var(--primary-dark); }
.button.secondary { background: white; border-color: var(--line); }
.button.secondary:hover, .button.text:hover, .close:hover { background: #edf5f1; }
.button.text { color: var(--primary); }
.square { width: 41px; padding: 0; font-size: 1.4rem; }
.close { width: 38px; padding: 0; font-size: 1.35rem; color: var(--muted); }

label:not(.search):not(.upload-button) { display: grid; gap: .45rem; font-size: .9rem; font-weight: 650; }
input:not([type="checkbox"]):not([type="file"]), select, textarea {
  display: block; width: 100%; min-width: 0; min-height: 43px; padding: .65rem .75rem;
  border: 1px solid var(--line); border-radius: 8px; background: white; color: var(--ink);
}
input::placeholder, textarea::placeholder { color: #657a74; }
select {
  appearance: none; padding-right: 2.05rem;
  background: linear-gradient(45deg, transparent 50%, #526963 50%) calc(100% - 17px) 53% / 5px 5px no-repeat,
    linear-gradient(135deg, #526963 50%, transparent 50%) calc(100% - 12px) 53% / 5px 5px no-repeat, white;
}
textarea { resize: vertical; line-height: 1.5; }
.brand-mark {
  position: relative; display: inline-grid; place-items: center; flex: 0 0 auto; width: 42px; height: 42px;
  border-radius: 13px; background: #b9ecd7; color: #115b48;
}
.brand-mark::before, .chat-icon::before {
  content: ""; display: block; width: 21px; height: 17px; border: 2px solid currentColor; border-radius: 7px;
}
.brand-mark::after, .chat-icon::after {
  content: ""; position: absolute; width: 8px; height: 2px; border-radius: 3px; background: currentColor;
  box-shadow: 0 4px 0 currentColor; top: calc(50% - 3px); left: calc(50% - 4px);
}
.chat-icon { position: relative; display: inline-grid; place-items: center; }

.login-shell { display: grid; min-height: 100dvh; grid-template-columns: minmax(350px, 1fr) minmax(370px, .88fr); }
.login-visual {
  position: relative; display: flex; flex-direction: column; padding: clamp(28px, 5vw, 75px);
  overflow: hidden; background: radial-gradient(ellipse at 88% 82%, #146950, transparent 55%), #0b3d34; color: #fff;
}
.login-visual::before, .login-visual::after {
  content: ""; position: absolute; border: 1px solid #88e2c42e; border-radius: 50%; pointer-events: none;
}
.login-visual::before { width: 790px; height: 790px; bottom: -450px; right: -360px; }
.login-visual::after { width: 665px; height: 665px; bottom: -395px; right: -310px; }
.signature { display: flex; align-items: center; gap: .75rem; color: #d6f5e6; font-size: .86rem; letter-spacing: .14em; font-weight: 750; }
.visual-content { position: relative; margin: auto 0; padding-block: 4rem 2rem; }
.visual-label { color: #a0e4c9; margin-bottom: 1.1rem; }
.visual-content h1 { font-size: clamp(2.85rem, 6vw, 6rem); line-height: 1.04; letter-spacing: -.07em; }
.visual-thread { display: grid; gap: .7rem; width: min(420px, 85%); margin-top: clamp(2.5rem, 7vh, 5.5rem); }
.visual-bubble { display: grid; gap: 9px; width: 62%; padding: 17px; border: 1px solid #a5e5cd5c; border-radius: 15px 15px 15px 3px; background: #b1e7d016; }
.visual-bubble.outgoing { margin-left: auto; background: #a4efd059; border-radius: 15px 15px 3px 15px; }
.visual-bubble.compact { width: 43%; }
.visual-bubble i { display: block; width: 80%; height: 5px; border-radius: 10px; background: #c9f4e58a; }
.visual-bubble i + i { width: 44%; }
.login-panel { display: grid; align-items: center; justify-items: center; padding: clamp(1.5rem, 6vw, 5rem); background: #fff; }
.login-form { display: grid; gap: 1.1rem; width: min(100%, 370px); }
.login-form h2 { font-size: clamp(1.7rem, 3vw, 2.35rem); letter-spacing: -.05em; }
.login-form > .muted { margin: -.55rem 0 .5rem; }
.login-form input { min-height: 48px !important; }
.captcha-row { display: grid; grid-template-columns: 1fr minmax(94px, 36%); gap: .55rem; }
.captcha { display: grid; place-items: center; min-width: 0; min-height: 48px; padding: 2px; border: 1px solid var(--line); border-radius: 8px; background: #f5faf7; color: var(--primary); }
.captcha img { max-width: 100%; max-height: 48px; }
.login-submit { min-height: 48px; margin-top: .3rem; }
.login-mode { justify-self: center; }

.workspace { display: grid; grid-template-columns: 74px minmax(0, 1fr); height: 100dvh; overflow: hidden; }
.rail { display: flex; align-items: center; flex-direction: column; min-height: 0; gap: .65rem; padding: 18px 7px 15px; background: #0b3d34; }
.rail .brand-mark { margin-bottom: 1rem; }
.rail-item { display: grid; place-items: center; gap: 4px; width: 100%; min-height: 62px; padding: 8px 2px; border: 0; border-radius: 9px; color: #c9e3dc; text-decoration: none; background: transparent; font-size: .8rem; font-weight: 650; }
.rail-item .icon { width: 25px; height: 24px; font-size: 1.3rem; line-height: 1; }
.overview-icon { display: grid; place-items: center; }
.overview-icon::before {
  content: ""; width: 19px; height: 17px; border: 2px solid currentColor; border-radius: 4px;
  background: linear-gradient(currentColor, currentColor) center / 2px 100% no-repeat,
    linear-gradient(currentColor, currentColor) center / 100% 2px no-repeat;
}
.rail-item:hover, .rail-item.selected { color: #f0fff9; background: #1a5749; }
.rail-bottom { margin-top: auto; }
.profile-button { display: grid; place-items: center; width: 43px; height: 43px; overflow: hidden; border: 1px solid #8ac5b1; border-radius: 50%; color: #12493c; background: #c1eadb; font-weight: 750; }
.profile-button img, .avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.inbox-view { display: grid; grid-template-columns: clamp(255px, 28vw, 352px) minmax(0, 1fr); min-width: 0; min-height: 0; }
.inbox-list { display: flex; flex-direction: column; min-width: 0; min-height: 0; border-right: 1px solid var(--line); background: #fff; }
.inbox-header { display: grid; gap: .85rem; padding: 22px 19px 14px; border-bottom: 1px solid var(--line); }
.title-row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.title-row h1, .settings-header h1 { margin-top: .2rem; font-size: 1.75rem; letter-spacing: -.045em; }
.search { display: flex; align-items: center; gap: .5rem; padding-left: .7rem; border: 1px solid var(--line); border-radius: 8px; background: #f6f9f7; color: var(--muted); }
.search span { font-size: 1.25rem; }
.search input:not([type="file"]) { padding-left: 0; border: 0; background: transparent; font-size: .875rem; }
.filter-label { color: var(--muted); }
.filter-label select { font-size: .88rem; }
.chat-list { flex: 1; overflow: auto; }
.chat-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: .65rem; width: 100%; min-height: 74px; padding: 11px 14px; border: 0; border-bottom: 1px solid #eef3f0; border-left: 3px solid transparent; text-align: left; background: white; color: var(--ink); }
.chat-row:hover { background: #f4f8f6; }
.chat-row.active { background: #e8f4ee; border-left-color: var(--primary); }
.chat-row .title, .chat-row .excerpt { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-row .title { font-size: .95rem; font-weight: 740; }
.chat-row .excerpt { margin-top: .22rem; color: var(--muted); font-size: .85rem; }
.chat-meta { display: grid; justify-items: end; gap: .25rem; color: var(--muted); font-size: .75rem; }
.unread { min-width: 21px; padding: 2px 5px; border-radius: 20px; background: var(--primary); color: #fff; text-align: center; font-size: .75rem; }
.list-empty { padding: 24px 17px; color: var(--muted); font-size: .9rem; line-height: 1.55; }
.inbox-footer { display: flex; align-items: center; gap: .48rem; min-height: 42px; padding: .45rem .9rem; border-top: 1px solid var(--line); color: var(--muted); font-size: .8rem; }
.connection-dot { width: 8px; height: 8px; border-radius: 50%; background: #43a27c; flex: 0 0 auto; }
.inbox-footer[data-error] .connection-dot { background: #be7625; }
.load-more { margin: 5px auto; min-height: 36px; }
.avatar { display: inline-grid; place-items: center; flex: 0 0 auto; width: 42px; height: 42px; overflow: hidden; border-radius: 50%; font-size: .96rem; font-weight: 750; background: #d9eee4; color: #145d49; }
.avatar[data-tone="1"] { background: #e6e9f8; color: #465383; }
.avatar[data-tone="2"] { background: #f4e7d7; color: #845121; }
.avatar[data-tone="3"] { background: #eee2f2; color: #784980; }

.conversation { position: relative; min-width: 0; min-height: 0; background: #f4f8f6; }
.empty-conversation { display: grid; place-content: center; justify-items: center; height: 100%; padding: 20px; text-align: center; }
.empty-conversation h2 { margin-top: 1.15rem; font-size: 1.5rem; }
.empty-conversation p { margin: .55rem 0 1rem; color: var(--muted); }
.empty-icon { display: grid; place-items: center; width: 74px; height: 74px; border: 1px solid #d1e9df; border-radius: 22px; color: var(--primary); background: var(--green-light); }
.empty-icon .chat-icon { transform: scale(1.55); }
.active-conversation { display: grid; grid-template-rows: auto minmax(0, 1fr); height: 100%; min-height: 0; }
.conversation-header { display: flex; align-items: center; min-width: 0; min-height: 70px; gap: .75rem; padding: 11px 18px; border-bottom: 1px solid var(--line); background: #fff; }
.conversation-name { flex: 1 1 auto; min-width: 0; }
.conversation-name h2, .conversation-name p { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conversation-name h2 { font-size: 1.05rem; }
.conversation-name p { margin-top: .2rem; color: var(--muted); font-size: .82rem; }
.mobile-back { display: none; }
.chat-main { display: flex; min-width: 0; min-height: 0; }
.thread { display: flex; flex: 1; flex-direction: column; min-width: 0; min-height: 0; }
.messages { overflow: auto; flex: 1; padding: 10px clamp(12px, 3vw, 33px) 24px; }
#message-items { display: grid; gap: 12px; }
.day-divider { justify-self: center; padding: 4px 10px; border-radius: 7px; background: #e7eeeb; color: var(--muted); font-size: .8rem; margin-top: .35rem; }
.message { display: grid; gap: .38rem; justify-self: start; width: fit-content; max-width: min(81%, 690px); padding: .6rem .75rem .48rem; border: 1px solid #dbe7e0; border-radius: 3px 12px 12px 12px; background: #fff; }
.message.out { justify-self: end; background: #dff1e7; border-color: #cce6d7; border-radius: 12px 3px 12px 12px; }
.message-body { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.55; }
.message-note { padding: .35rem .55rem; border-left: 2px solid #69a891; border-radius: 2px; background: #174f4310; overflow-wrap: anywhere; font-size: .85rem; white-space: pre-wrap; }
.message-meta { justify-self: end; color: var(--muted); font-size: .77rem; }
.message-meta.failed { color: #9b2634; }
.message-actions { display: flex; flex-wrap: wrap; gap: .45rem; }
.message-actions .button { padding: 0 .3rem; min-height: 27px; font-size: .8rem; }
.window-status { padding: 8px 16px; border-top: 1px solid var(--line); background: #eef6f1; color: #325c4e; font-size: .83rem; }
.window-status.closed { background: #fbf2df; color: #795822; }
.composer { display: grid; gap: .55rem; padding: .7rem 1rem .85rem; background: #fff; }
.composer textarea { min-height: 62px; max-height: 180px; }
.composer-actions, .actions { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem; }
.composer-actions { justify-content: space-between; }
.composer-note { display: flex; align-items: center; justify-content: space-between; gap: .5rem; min-height: 30px; padding: .15rem .5rem; border-left: 2px solid #69a891; background: #f1f7f3; color: var(--muted); font-size: .85rem; }
.composer-note span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.composer-note button { border: 0; color: var(--muted); background: transparent; font-size: 1.15rem; }
.upload-button { position: relative; cursor: pointer; }
.upload-button input { position: absolute; inset: 0; width: 100%; opacity: 0; cursor: pointer; }
.upload-button:focus-within { outline: 3px solid #45a98d; outline-offset: 3px; }
.chat-details { flex: 0 0 clamp(195px, 22vw, 275px); overflow: auto; padding: 17px 15px; border-left: 1px solid var(--line); background: #fff; }
.chat-details label + label { margin-top: .75rem; }
.chat-details dt { color: var(--muted); font-size: .8rem; }
.chat-details dd { margin: .22rem 0 .75rem; padding-bottom: .65rem; border-bottom: 1px solid var(--line); font-size: .88rem; overflow-wrap: anywhere; }

.settings-view { overflow: auto; padding: clamp(1rem, 4vw, 3rem); background: #f4f8f6; }
.settings-header { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 1rem; max-width: 1100px; margin: 0 auto 1.45rem; }
.settings-header .muted { margin-top: .55rem; }
.account-list { display: grid; gap: .8rem; max-width: 1100px; margin: auto; }
.account-card { display: grid; grid-template-columns: auto minmax(130px, 1fr) auto; align-items: center; gap: .85rem; padding: 1rem; border: 1px solid var(--line); border-radius: 12px; background: white; }
.account-card .account-info { display: grid; gap: .24rem; align-items: start; }
.account-info h2 { font-size: 1rem; overflow-wrap: anywhere; }
.account-info p { color: var(--muted); font-size: .86rem; overflow-wrap: anywhere; }
.account-status { justify-self: start; padding: 3px 7px; border-radius: 5px; color: #145f4a; background: #e7f4ed; font-size: .78rem; }
.account-status.offline { color: #775320; background: #f8efdc; }
.account-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .35rem; }
.settings-empty { min-height: 170px; border: 1px dashed #b9cec4; border-radius: 12px; padding: 1.3rem; color: var(--muted); background: #fbfdfc; }

.overview-view { min-width: 0; overflow: auto; padding: clamp(1.1rem, 4vw, 3rem); background: #f4f8f6; }
.overview-content { display: grid; gap: 1.25rem; max-width: 1210px; margin: 0 auto; }
.overview-header, .overview-actions, .overview-panel-header {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .55rem;
}
.overview-header h1 { font-size: clamp(1.55rem, 3.6vw, 2.35rem); letter-spacing: -.05em; }
.overview-header p { margin-top: .4rem; font-size: .9rem; }
.overview-header p[data-error] { color: #a52536; }
.overview-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .8rem; }
.overview-metric {
  display: grid; justify-items: start; align-content: start; gap: .42rem; min-height: 116px;
  padding: .95rem 1rem; border: 1px solid var(--line); border-radius: 12px; background: white;
}
.overview-metric h2 { font-size: .91rem; font-weight: 650; color: var(--muted); }
.overview-metric strong { font-size: clamp(1.48rem, 3.25vw, 2.3rem); line-height: 1.16; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.overview-metric p { font-size: .85rem; }
.overview-metric .button { min-height: 24px; padding: 0; }
.overview-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(260px, 1fr); align-items: start; gap: .8rem; }
.overview-side { display: grid; gap: .8rem; min-width: 0; }
.overview-panel { min-width: 0; border: 1px solid var(--line); border-radius: 12px; background: white; }
.overview-panel-header { min-height: 54px; padding: .4rem .7rem .4rem 1rem; border-bottom: 1px solid var(--line); }
.overview-panel-header h2 { font-size: 1rem; }
.overview-empty { padding: .95rem 1rem 1.1rem; color: var(--muted); font-size: .89rem; line-height: 1.55; }
.overview-number, .overview-order {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .55rem; padding: .65rem .9rem;
}
.overview-number + .overview-number, .overview-order + .overview-order { border-top: 1px solid #eef3f0; }
.overview-number-info { display: flex; align-items: center; gap: .65rem; flex: 1 1 160px; min-width: 0; }
.overview-number-info > div, .overview-order > div { min-width: 0; }
.overview-number-info strong, .overview-order strong { display: block; font-size: .95rem; overflow-wrap: anywhere; }
.overview-number-info p, .overview-order p { color: var(--muted); margin-top: .2rem; font-size: .84rem; overflow-wrap: anywhere; }
.overview-number .overview-actions { justify-content: flex-start; }
.overview-number .button { min-height: 34px; padding: .35rem .5rem; }
.overview-number .account-status, .overview-order .account-status { flex: 0 0 auto; }

.modal { width: min(490px, calc(100vw - 28px)); max-height: min(90dvh, 720px); border: 1px solid var(--line); border-radius: 15px; padding: 1rem 1.15rem; background: #fff; color: var(--ink); box-shadow: 0 12px 65px #132a2740; }
.modal::backdrop { background: #143a3373; }
.modal header, .modal footer { display: flex; align-items: center; justify-content: space-between; gap: .6rem; }
.modal header { margin-bottom: .75rem; }
.modal header h2 { font-size: 1.22rem; }
.modal footer { justify-content: flex-end; margin-top: 1rem; }
.modal-fields { display: grid; gap: .85rem; }
.modal-fields p { color: var(--muted); font-size: .9rem; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.modal-fields input[type="file"] { max-width: 100%; }
.modal-fields .check-label { grid-template-columns: auto 1fr; align-items: start; }
.modal-fields .field-error, .modal .field-error { margin-top: .55rem; }
.agent-row { display: flex; justify-content: space-between; align-items: center; padding: .25rem .55rem; border: 1px solid var(--line); border-radius: 7px; }
.notification { position: fixed; z-index: 2; bottom: 18px; right: 18px; max-width: min(420px, calc(100vw - 36px)); padding: .72rem 1rem; border: 1px solid #3e7b68; border-radius: 8px; background: #124e40; color: #fff; font-size: .9rem; overflow-wrap: anywhere; }
.notification.error { background: #882d39; border-color: #ac4b59; }

@media (max-width: 860px) {
  .overview-grid { grid-template-columns: minmax(0, 1fr); }
  .inbox-view { grid-template-columns: 244px minmax(0, 1fr); }
  .chat-main { position: relative; }
  .chat-details { position: absolute; z-index: 1; right: 0; inset-block: 0; width: min(270px, 93%); box-shadow: -8px 0 22px #143a331a; }
  .account-card { grid-template-columns: auto minmax(0, 1fr); }
  .account-actions { grid-column: 1 / -1; justify-content: flex-start; }
}
@media (max-width: 680px) {
  .overview-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .55rem; }
  .overview-metric { min-height: 101px; padding: .7rem; }
  .overview-content { gap: .85rem; }
  .login-shell { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .login-visual { padding: 18px 22px; }
  .login-visual .brand-mark { width: 33px; height: 33px; }
  .visual-content { padding-block: 16px 10px; }
  .visual-label, .visual-thread, .visual-content h1 br { display: none; }
  .visual-content h1 { font-size: 2rem; }
  .login-panel { align-items: start; padding: 2rem 1.5rem; }
  .workspace { grid-template-columns: 55px minmax(0, 1fr); }
  .rail { padding-inline: 4px; }
  .rail .brand-mark { width: 35px; height: 35px; }
  .rail-item { font-size: .75rem; min-height: 54px; }
  .profile-button { width: 34px; height: 34px; }
  .inbox-view { grid-template-columns: minmax(0, 1fr); }
  .inbox-view:not(.mobile-conversation) .conversation { display: none; }
  .inbox-view.mobile-conversation .inbox-list { display: none; }
  .mobile-back { display: inline-flex; font-size: 1.4rem; padding: .3rem; }
  .conversation-header { gap: .32rem; padding: 8px 6px; flex-wrap: wrap; }
  .conversation-header .button { padding-inline: .42rem; font-size: .78rem; }
  .conversation-header .avatar { width: 34px; height: 34px; }
  .composer { padding: .5rem; }
  .actions .button { padding-inline: .35rem; }
  .composer-actions .primary { min-height: 36px; }
}
