:root {
  color-scheme: light;
  --page: #eef2f7;
  --panel: #f9fafc;
  --inset: #edf1f6;
  --ink: #172438;
  --muted: #52637b;
  --border: #dce3ee;
  --field-border: #aab8cc;
  --blue: #075ce5;
  --blue-wash: #dceaff;
  --red: #ab2836;
  font: 16px/1.55 Inter, "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--page); color: var(--ink); }
a { color: #064ec7; text-underline-offset: .18em; }
button, input, select, textarea { font: inherit; color: inherit; }
button, select { cursor: pointer; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible,
textarea:focus-visible, summary:focus-visible { outline: 3px solid #4081e8; outline-offset: 3px; }
[hidden] { display: none !important; }
.shell { width: min(100% - 36px, 860px); margin-inline: auto; }
.shell.admin-wide { width: min(100% - 36px, 1080px); }
.site-header { background: var(--panel); border-bottom: 1px solid var(--border); }
.bar { min-height: 72px; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.brand { display: inline-flex; align-items: center; gap: 9px; color: var(--ink); font-size: 1.22rem; font-weight: 750; text-decoration: none; white-space: nowrap; }
.brand img { display: block; }
.bar-actions { display: flex; align-items: center; gap: 18px; font-size: .89rem; }
.bar-actions a, .plain { color: var(--muted); text-decoration: none; }
.bar-actions a:hover, .plain:hover { text-decoration: underline; }
.plain { background: transparent; border: 0; padding: 8px 0; }
.main { padding-block: clamp(26px, 5vw, 48px) 48px; }
h1 { font-size: clamp(1.72rem, 4vw, 2.36rem); line-height: 1.25; margin: 0 0 22px; letter-spacing: -.025em; }
h2 { margin: 0 0 10px; font-size: 1.34rem; }
h3 { margin: 0 0 7px; font-size: 1rem; }
p { margin: 0 0 12px; }

.card { background: var(--panel); border: 1px solid var(--border); border-radius: 20px; padding: clamp(18px, 4vw, 28px); overflow-wrap: anywhere; }
.login-card { max-width: 470px; padding-block: 30px; }
.login-card p { color: var(--muted); margin-bottom: 20px; }
.login-card button { min-width: 132px; }
.wechat-mark { display: block; width: 48px; height: 43px; position: relative; margin-bottom: 12px; }
.wechat-mark i { position: absolute; display: block; background: #079649; border-radius: 50%; width: 35px; height: 29px; }
.wechat-mark i::before { position: absolute; top: 10px; left: 10px; width: 4px; height: 4px; border-radius: 50%; background: #fff; box-shadow: 10px 0 #fff; content: ""; }
.wechat-mark i::after { position: absolute; left: 6px; bottom: -3px; border: 4px solid transparent; border-left-color: #079649; transform: rotate(13deg); content: ""; }
.wechat-mark i + i { top: 13px; right: 0; width: 29px; height: 25px; border: 2px solid var(--panel); }
.wechat-mark i + i::before { top: 7px; left: 7px; box-shadow: 8px 0 #fff; }
.wechat-mark i + i::after { right: 3px; left: auto; bottom: -4px; border-left-color: transparent; border-right-color: #079649; transform: rotate(-13deg); }
.tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.tabs a { display: inline-flex; align-items: center; justify-content: center; min-height: 42px; padding: 7px 19px; border: 1px solid var(--border); border-radius: 11px; color: var(--ink); text-decoration: none; background: var(--panel); font-weight: 600; font-size: .93rem; }
.tabs a[aria-current] { background: var(--blue-wash); border-color: #c4d9f8; color: #074fc4; }
.tabs a:hover { border-color: #9bb4d9; }
.form, .field-pair { display: grid; gap: 15px; }
.field-pair { grid-template-columns: repeat(2, minmax(0, 1fr)); }
label { display: block; font-weight: 650; font-size: .94rem; }
label small { color: var(--muted); font-weight: 400; }
input:not([type=file]), select, textarea { width: 100%; margin-top: 6px; padding: 9px 11px; min-height: 42px; border: 1px solid var(--field-border); border-radius: 10px; background: #fff; font-weight: 400; }
textarea { display: block; resize: vertical; }
::placeholder { color: #62728a; opacity: 1; }
.required { color: var(--red); }
.upload { display: grid; gap: 7px; background: var(--inset); padding: 13px 14px; border-radius: 12px; min-width: 0; }
.upload p { margin: 0; font-size: .84rem; }
.upload input { width: 100%; font-size: .88rem; }
.upload input::file-selector-button { border: 1px solid var(--border); border-radius: 8px; background: #fff; color: var(--ink); padding: 6px 11px; margin-inline-end: 8px; cursor: pointer; }
.upload #file-help { color: var(--muted); }
.file-error { color: var(--red); }
.attachment-previews { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; margin: 0; padding: 0; list-style: none; }
.attachment-previews:empty { display: none; }
.attachment-previews li { display: grid; grid-template-columns: minmax(0, 1fr); justify-items: start; gap: 4px; }
.attachment-previews span { overflow-wrap: anywhere; font-size: .82rem; }
.attachment-previews img { display: block; max-width: 100%; height: auto; border: 1px solid var(--border); border-radius: 6px; background: #fff; }
.attachment-previews button { padding: 3px 8px; border: 1px solid var(--border); border-radius: 6px; background: #fff; font-size: .82rem; }
.actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 9px; }
button.primary, button.secondary, .button, button.danger { display: inline-flex; align-items: center; justify-content: center; min-height: 42px; border: 1px solid transparent; border-radius: 11px; padding: 8px 18px; text-decoration: none; font-weight: 650; }
button.primary { color: #fff; background: var(--blue); }
button.primary:hover { background: #064ebf; }
button.secondary, .button.secondary { color: #064ec7; border-color: #a9c2ef; background: #fff; }
button.danger, .button.danger { color: var(--red); border-color: #ecb3bb; background: #fff5f6; }
.notice { margin-top: 18px; padding: 15px 17px; background: #e7edf5; border-radius: 13px; font-size: .85rem; color: #344459; overflow-wrap: anywhere; }
.notice h2 { font-size: .96rem; margin-bottom: 5px; color: var(--ink); }
.notice p { margin-bottom: 7px; }
.notice summary { width: fit-content; cursor: pointer; color: #184e9e; }
.notice details p:first-of-type { margin-top: 8px; }
.flash { display: flex; align-items: baseline; gap: 9px; margin-bottom: 12px; border-radius: 10px; padding: 9px 13px; font-size: .9rem; }
.flash span { border-radius: 50%; width: 8px; height: 8px; flex: 0 0 8px; background: currentColor; }
.flash.success { background: #dff3e9; color: #166044; }
.flash.error { background: #fbe8eb; color: var(--red); }
.ticket-list { border-radius: 15px; border: 1px solid var(--border); overflow: hidden; background: var(--panel); }
.ticket-list ul, .files { padding: 0; margin: 0; list-style: none; }
.ticket-list li + li { border-top: 1px solid var(--border); }
.list-head, .ticket-list a { display: grid; grid-template-columns: minmax(0, 1fr) minmax(106px, 25%); align-items: center; gap: 12px; padding: 10px 15px; }
.list-head { background: var(--inset); font-weight: 700; font-size: .87rem; }
.ticket-list a { text-decoration: none; color: var(--ink); }
.ticket-list a:hover, .ticket-list a[aria-current] { background: var(--blue-wash); }
.ticket-list a:focus-visible { outline-offset: -3px; }
.admin-ticket-list .list-head, .ticket-row {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(88px, 13%) 155px 76px 76px 72px;
  align-items: center; gap: 10px; padding: 10px 15px;
}
.ticket-row {
  width: 100%; border: 0; background: transparent; text-align: left; color: var(--ink);
}
.ticket-row:hover { background: var(--blue-wash); }
.ticket-row:focus-visible { outline-offset: -3px; }
.ticket-row:has(.unread) .ticket-title { font-weight: 700; }
.reply-dot { display: inline-block; width: 8px; height: 8px; margin-inline-start: 6px; vertical-align: middle; border-radius: 50%; background: #c52738; }
.ticket-date { color: var(--muted); font-size: .85rem; font-variant-numeric: tabular-nums; }
.ticket-open { color: #064ec7; font-size: .85rem; font-weight: 650; justify-self: start; }
.ticket-row:hover .ticket-open { text-decoration: underline; }
.status-tabs { margin-top: -4px; }
.status-tabs a { min-height: 36px; padding-block: 5px; font-size: .85rem; }
.feedback-search { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-block: 12px; }
.feedback-search input[type="search"] { flex: 0 1 360px; min-width: 0; }
.status-pill { display: inline-block; padding: 2px 8px; border-radius: 7px; font-size: .77rem; font-weight: 650; white-space: nowrap; }
.status-pill.unread { color: #1350a3; background: #dfebff; }
.status-pill.seen { color: #465b75; background: #e7edf5; }
.status-pill.open { color: #795313; background: #f8eed6; }
.status-pill.solved { color: #166044; background: #dff3e9; }
.status-pill.rejected { color: var(--red); background: #f9e5e8; }
.status-pill.follow-up { color: #4e3984; background: #eee7fc; }
.ticket-heading { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: start; gap: 12px; margin-bottom: 14px; }
.ticket-info { flex: 1 1 24rem; min-width: 0; }
.ticket-heading h1 { margin-bottom: 8px; font-size: clamp(1.3rem, 3vw, 1.65rem); }
.ticket-states { display: flex; flex-wrap: wrap; gap: 6px; }
.ticket-tools { display: grid; grid-template-columns: max-content max-content; gap: 8px; }
.ticket-follow-up { grid-column: 2; justify-self: end; }
#reply-text { scroll-margin-top: 48px; }
.back-link { display: inline-block; margin-bottom: 14px; font-size: .9rem; }
.ticket-title, .files span { overflow-wrap: anywhere; }
.ticket-meta, .meta, .hint, small { color: var(--muted); font-size: .85rem; }
.badge { display: inline-block; margin: 2px 0 2px 6px; border-radius: 6px; background: #e5f4ec; color: #1b6749; padding: 2px 6px; font-size: .72rem; }
.empty { padding: 18px; border-radius: 13px; background: var(--panel); }
.detail { margin-top: 16px; }
.description, .reply p { white-space: pre-wrap; overflow-wrap: anywhere; }
.metadata { display: grid; grid-template-columns: max-content 1fr; gap: 3px 12px; margin: 0 0 14px; color: var(--muted); font-size: .88rem; }
.metadata dd { margin: 0; }
.reply { padding: 14px 16px; background: var(--blue-wash); border-radius: 12px; }
.reply p { margin-bottom: 6px; }
.reply-thread { display: grid; gap: 10px; }
.customer-reply { background: #e8edf4; }
.files { display: grid; gap: 5px; }
.files li { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; border-radius: 9px; padding: 8px 11px; background: var(--inset); }
.file-details { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.file-details a { flex: none; }
.file-image { display: block; max-width: 100%; height: auto; border-radius: 5px; }
.admin-form, .reply-form { display: grid; gap: 8px; margin-block: 16px; }
.admin-form p { margin: 0; }
.pager { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; align-items: center; margin: 13px 0; color: var(--muted); font-size: .88rem; }
.identifier { overflow-wrap: anywhere; }
.sr-only, .skip:not(:focus) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.skip:focus { display: block; padding: 8px; }

@media (max-width: 680px) {
  .admin-ticket-list .list-head { display: none; }
  .ticket-row { grid-template-columns: max-content max-content minmax(0, 1fr); gap: 5px 8px; padding: 10px 12px; }
  .ticket-row .ticket-title, .ticket-row .ticket-meta, .ticket-row .ticket-date { grid-column: 1 / -1; }
  .ticket-row .ticket-open { justify-self: end; }
}
@media (max-width: 540px) {
  .shell, .shell.admin-wide { width: calc(100% - 24px); }
  .field-pair { grid-template-columns: 1fr; }
  .bar { min-height: 58px; }
  .bar-actions { gap: 10px; font-size: .82rem; }
  .brand { font-size: 1.06rem; gap: 5px; }
  .brand img { width: 37px; height: 37px; }
  .tabs a { padding-inline: 12px; }
}
