:root {
  color-scheme: light;
  --paper: #fff;
  --background: #f5f7f2;
  --ink: #17342b;
  --muted: #586a61;
  --line: #dee7dc;
  --green: #165b49;
  --pale: #e8f1da;
  font: 15px/1.5 "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", "Noto Sans SC", system-ui, sans-serif;
  color: var(--ink);
  background: var(--background);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { min-width: 300px; margin: 0; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .55; }
:focus-visible { outline: 2px solid var(--green); outline-offset: 3px; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(26px, 3vw, 36px); line-height: 1.2; }
a { color: var(--green); }
.brand-mark { display: grid; width: 44px; height: 44px; place-items: center; border-radius: 15px; background: #d9edb3; color: var(--ink); font-size: 22px; font-weight: 800; }
.primary, .secondary { min-height: 42px; padding: 8px 16px; border: 1px solid transparent; border-radius: 999px; font-weight: 650; white-space: nowrap; }
.primary { background: var(--green); color: white; }
.secondary { background: var(--paper); border-color: var(--line); color: var(--green); }
.sign-in { display: grid; min-height: 100dvh; place-items: center; padding: 20px; }
.login-card { display: grid; gap: 16px; width: min(100%, 440px); padding: clamp(22px, 5vw, 38px); border: 1px solid var(--line); border-radius: 28px; background: var(--paper); }
.login-card p { color: var(--muted); }
.layout { display: grid; grid-template-columns: 210px minmax(0, 1fr); min-height: 100dvh; }
.sidebar { position: sticky; top: 0; display: flex; flex-direction: column; gap: 30px; height: 100dvh; padding: 26px 16px; border-right: 1px solid var(--line); background: #fbfcf8; }
.brand { display: flex; gap: 11px; align-items: center; padding-inline: 5px; }
.brand small { display: block; color: var(--muted); }
.sidebar nav { display: grid; gap: 6px; }
.sidebar nav a { padding: 10px 16px; border-radius: 14px; color: var(--ink); text-decoration: none; white-space: nowrap; }
.sidebar nav a[aria-current="page"] { background: var(--pale); color: var(--green); font-weight: 750; }
.sidebar nav a:hover { background: #edf3e8; }
.sidebar #logout { margin-top: auto; }
.workspace { width: 100%; max-width: 1550px; padding: clamp(20px, 4vw, 48px); }
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 23px; }
.page-header p { margin-top: 7px; color: var(--muted); }
.header-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.notice { margin-bottom: 14px; padding: 10px 14px; border-radius: 14px; background: var(--pale); }
.error, .notice[data-error] { color: #922e38; }
.notice[data-error] { background: #f9e9e7; }
.error:empty { display: none; }
.panel { overflow: hidden; border: 1px solid var(--line); border-radius: 23px; background: var(--paper); }
.toolbar { display: flex; flex-wrap: wrap; align-items: end; gap: 10px; padding: 15px; border-bottom: 1px solid var(--line); }
label { display: grid; gap: 4px; color: var(--ink); font-weight: 650; }
input, textarea, select { width: 100%; min-height: 42px; padding: 7px 11px; border: 1px solid #cbd8cb; border-radius: 12px; background: #fcfdfb; color: var(--ink); }
.search-label { flex: 1 1 230px; }
.toolbar select { min-width: 125px; max-width: 260px; }
.table-scroll { overflow: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; }
thead { background: #f2f6ed; color: var(--muted); font-size: 13px; }
th, td { padding: 13px 14px; border-bottom: 1px solid #edf0eb; white-space: nowrap; }
tbody tr:hover { background: #fafcf7; }
td:first-child { min-width: 185px; white-space: normal; }
td:nth-child(3) { max-width: 260px; white-space: normal; }
td small { display: block; margin-top: 3px; color: var(--muted); }
.actions { display: flex; align-items: center; gap: 10px; }
.link-button { min-height: 36px; padding: 0; border: 0; background: transparent; color: var(--green); font-weight: 650; }
.actions a { padding-block: 8px; font-weight: 650; }
.badge { display: inline-block; padding: 3px 9px; border-radius: 999px; background: #eef0ec; color: #46564c; font-size: 13px; }
.badge[data-state="PUBLISHED"], .badge[data-state="REGISTERED"], .badge[data-state="ACCEPTED"] { background: var(--pale); color: var(--green); }
.empty { padding: 34px 16px; text-align: center; color: var(--muted); }
.pager { display: flex; align-items: center; gap: 9px; padding: 13px 15px; }
.pager span { flex: 1; color: var(--muted); }
dialog { width: min(640px, calc(100vw - 28px)); max-height: calc(100dvh - 28px); padding: 0; border: 1px solid var(--line); border-radius: 23px; }
dialog::backdrop { background: #162c2480; }
#edit-form, #import-form { padding: 19px; }
.dialog-header, .dialog-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
#edit-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-block: 16px; }
#edit-fields label.wide { grid-column: 1 / -1; }
#edit-fields textarea { min-height: 86px; resize: vertical; }
.dialog-footer { margin-top: 14px; justify-content: flex-end; }
.import-fields { display: grid; gap: 12px; margin-top: 16px; }
.import-fields > button { justify-self: start; }
.import-fields > p:not(.error) { color: var(--muted); }
#import-error { white-space: pre-line; overflow-wrap: anywhere; }
.support-desk { display: grid; grid-template-columns: minmax(225px, 310px) minmax(0, 1fr); }
.support-inbox { display: flex; min-width: 0; flex-direction: column; border-right: 1px solid var(--line); }
.support-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 68px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.support-bar h2 { font-size: 18px; overflow-wrap: anywhere; }
.support-bar p { color: var(--muted); overflow-wrap: anywhere; }
.support-chats { max-height: 61vh; overflow-y: auto; }
.support-chat { display: grid; gap: 3px; width: 100%; min-height: 82px; padding: 11px 16px; border: 0; border-bottom: 1px solid var(--line); background: var(--paper); color: var(--ink); text-align: left; }
.support-chat:hover, .support-chat[aria-pressed="true"] { background: #f2f6ed; }
.support-chat:focus-visible { outline-offset: -2px; }
.support-chat-heading { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.support-chat-heading strong { flex: 1 1 80px; overflow-wrap: anywhere; }
.support-chat-heading time, .support-chat-context, .support-preview { color: var(--muted); font-size: 13px; }
.support-unread { background: var(--pale); color: var(--green); white-space: nowrap; }
.support-chat-context, .support-preview { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.support-pager { justify-content: space-between; margin-top: auto; }
.support-prompt { align-self: center; min-height: 260px; display: grid; place-items: center; }
.support-thread { display: flex; min-width: 0; flex-direction: column; background: #fafcf7; }
.support-thread .support-bar, .support-reply { background: var(--paper); }
.support-history { height: clamp(240px, 53vh, 680px); overflow: auto; padding: 14px 16px; }
.support-history:focus-visible { outline-offset: -2px; }
.support-history > button { display: block; margin: 0 auto 12px; }
.support-messages { display: grid; gap: 13px; }
.support-message { justify-self: start; max-width: min(85%, 600px); }
.support-message-own { justify-self: end; }
.support-message-meta { margin-bottom: 3px; color: var(--muted); font-size: 12px; }
.support-message-own .support-message-meta { text-align: right; }
.support-message-body { padding: 9px 13px; border: 1px solid var(--line); border-radius: 13px; background: var(--paper); overflow-wrap: anywhere; white-space: pre-wrap; }
.support-message-own .support-message-body { border-color: transparent; background: var(--pale); }
.support-reply { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 8px 12px; padding: 12px 16px; border-top: 1px solid var(--line); }
.support-reply label { grid-column: 1 / -1; }
.support-reply textarea { resize: vertical; }
.support-feedback:not(:empty) { padding: 8px 16px; }
.support-reply-status { color: var(--muted); overflow-wrap: anywhere; }
#support-list-empty:empty, #support-thread-empty:empty { display: none; }
@media (max-width: 850px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: relative; flex-flow: row wrap; height: auto; gap: 12px; align-items: center; padding: 13px 16px; border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebar nav { order: 3; display: flex; width: 100%; overflow-x: auto; }
  .sidebar #logout { margin: 0 0 0 auto; }
}
@media (max-width: 640px) {
  .support-desk { grid-template-columns: minmax(0, 1fr); }
  .support-inbox { border-right: 0; border-bottom: 1px solid var(--line); }
  .support-chats { max-height: 240px; }
  .support-prompt { min-height: 120px; }
}
@media (max-width: 450px) {
  #edit-fields { grid-template-columns: 1fr; }
  .page-header { align-items: flex-start; }
  .pager .secondary { padding-inline: 10px; }
}
