:root {
  color-scheme: light;
  --page: #f4f6f3;
  --ink: #182820;
  --muted: #4e6257;
  --line: #d8e1da;
  --green: #225542;
  --radius: 14px;
  font: 16px/1.5 system-ui, "Microsoft YaHei", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--page); color: var(--ink); }
button, input, select, textarea { font: inherit; }
button, input, select, textarea, a { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid #3c825f; outline-offset: 3px; }
button:disabled { cursor: not-allowed; opacity: .62; }
a { color: var(--green); text-underline-offset: 3px; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(1.65rem, 4vw, 2.2rem); line-height: 1.25; }
h2 { font-size: 1.16rem; line-height: 1.4; }
h3 { font-size: 1rem; }

.site-bar { background: #fff; border-bottom: 1px solid var(--line); }
.bar-inner { display: flex; min-height: 66px; align-items: center; justify-content: space-between; gap: 8px 16px; flex-wrap: wrap; max-width: 1440px; margin: auto; padding: 9px clamp(14px, 3vw, 40px); }
.brand, .bar-actions { display: flex; align-items: center; gap: 10px; }
.brand { font-weight: 750; text-decoration: none; color: var(--ink); }
.brand-mark { display: grid; place-items: center; width: 30px; height: 30px; color: #d6efaf; background: #234d3d; border-radius: 9px; font-size: 1rem; }
.brand-divider { height: 18px; width: 1px; background: var(--line); margin-inline: 2px; }
.brand-section, .bar-actions { font-size: .875rem; }
.bar-actions { flex-wrap: wrap; }
.layout { max-width: 1440px; margin: auto; padding: clamp(18px, 3vw, 40px) clamp(14px, 3vw, 40px) 54px; }
.page-intro { display: flex; align-items: end; justify-content: space-between; gap: 12px 18px; flex-wrap: wrap; margin-bottom: 18px; }
.page-intro p { margin-top: 6px; }
.muted { color: var(--muted); }
.feedback { min-width: 0; overflow-wrap: anywhere; color: var(--muted); }
.feedback:not([hidden]) { margin-block: 6px; }
.feedback[data-tone="error"] { color: #962b25; }
.feedback[data-tone="success"] { color: #225542; }
.card { min-width: 0; padding: clamp(12px, 2vw, 22px); border-radius: var(--radius); border: 1px solid var(--line); background: #fff; }
.login-card { max-width: 446px; margin: clamp(16px, 7vh, 82px) auto 0; padding: clamp(20px, 4vw, 34px); }
.login-card > p { margin: 8px 0 18px; }
.login-card form { display: grid; gap: 12px; }
.login-card .button { justify-self: start; }
.native-login { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; min-height: 42px; margin-bottom: 16px; }
.direct-login > summary { color: var(--muted); font-size: .875rem; }
.direct-login form { margin-top: 14px; }
.login-captcha { display: grid; gap: 8px; }
.captcha-image-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.captcha-image-row img { max-width: 100%; height: 42px; border: 1px solid var(--line); border-radius: 6px; }

.desk { display: grid; grid-template-columns: minmax(350px, .9fr) minmax(0, 1.25fr); gap: 16px; align-items: start; }
.section-head { display: flex; justify-content: space-between; gap: 8px; align-items: start; flex-wrap: wrap; margin-bottom: 15px; }
.section-head > div { min-width: 0; }
.section-head p { font-size: .875rem; }
.ticket-meta { margin-top: 4px; overflow-wrap: anywhere; }
.filters { display: grid; grid-template-columns: minmax(0, 1fr) minmax(112px, .65fr); gap: 8px 10px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
label { display: grid; gap: 5px; font-size: .875rem; font-weight: 620; min-width: 0; }
input:not([type="checkbox"]), select, textarea { min-width: 0; width: 100%; min-height: 42px; border: 1px solid #afbeb2; border-radius: 8px; padding: 8px 10px; background: #fff; color: var(--ink); font-size: 1rem; }
textarea { resize: vertical; }
input[type="checkbox"] { width: 18px; height: 18px; flex: none; accent-color: var(--green); }
.check { display: flex; align-items: center; gap: 6px; min-height: 42px; }
.flag-filters { display: flex; flex-wrap: wrap; gap: 0 9px; }
.button { border: 1px solid transparent; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; min-height: 42px; padding: 5px 12px; font-size: .875rem; font-weight: 700; text-decoration: none; cursor: pointer; }
.button.primary { background: var(--green); color: white; }
.button.primary:hover:not(:disabled) { background: #174532; }
.button.secondary { background: #fff; border-color: #bdcbc0; color: var(--green); }
.button.secondary:hover:not(:disabled) { background: #edf4ed; }
.filter-actions, .update-actions { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.filter-actions { justify-content: end; }
.ticket-list { display: grid; gap: 8px; padding-top: 12px; }
.ticket-list .empty { padding: 9px 0; }
.ticket-row { display: flex; justify-content: space-between; align-items: start; gap: 8px; min-width: 0; padding: 10px; min-height: 48px; background: #f9fbf9; border: 1px solid #e0e8e1; border-radius: 9px; color: var(--ink); text-decoration: none; }
.ticket-row:hover, .ticket-row[aria-current="true"] { background: #edf5ed; border-color: #8db296; }
.ticket-row .chip-list { justify-content: end; }
.ticket-row-text { min-width: 0; overflow-wrap: anywhere; }
.ticket-row-text strong { display: block; }
.ticket-row-text p { margin-top: 2px; font-size: .875rem; color: var(--muted); }
.chip-list { display: flex; flex-wrap: wrap; gap: 5px; flex: 0 1 auto; align-items: start; }
.badge { display: inline-block; border-radius: 20px; padding: 3px 8px; font-size: .8125rem; font-weight: 650; color: #314c3e; background: #eaf0eb; white-space: nowrap; }
.badge[data-state="pending"], .badge[data-state="overdue"] { color: #794221; background: #fbecdd; }
.badge[data-state="overdue"] { color: #892d20; background: #f8e3dc; }
.badge[data-state="processing"] { color: #225184; background: #eaf1fb; }
.badge[data-state="resolved"] { color: #1e5b3e; background: #e3f2e8; }
.detail-card .mobile-back { display: none; margin-bottom: 10px; }
.order-panel, .audit-panel { background: #f7faf7; border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px; }
details summary { cursor: pointer; font-weight: 700; }
.order-panel > div, .audit-panel > ol { margin-top: 8px; }
.order-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 12px; margin: 0; }
.order-grid div { min-width: 0; }
.order-grid dt { font-size: .8125rem; color: var(--muted); }
.order-grid dd { margin: 0; font-size: .9rem; overflow-wrap: anywhere; }
.order-products { padding-inline-start: 20px; margin-block: 8px 0; overflow-wrap: anywhere; }
.refund-note { margin-top: 8px; font-size: .875rem; }
.purchase-cost-summary { margin-top: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 9px; background: #fff; }
.purchase-cost-summary h3 { margin-bottom: 8px; }
.purchase-cost-summary > p { margin-top: 8px; font-size: .8125rem; }
.purchase-cost-summary[data-tone="warning"] { border-color: #dfbd79; background: #fffaf0; }
.cost-warnings { padding-inline-start: 20px; margin-block: 8px 0; color: #794221; font-size: .8125rem; overflow-wrap: anywhere; }
.conversation { margin: 14px 0; }
.messages, .audit { list-style: none; padding: 0; margin: 6px 0 0; display: grid; gap: 8px; }
.message { border: 1px solid #dce6df; border-radius: 9px; padding: 10px 12px; min-width: 0; }
.message[data-actor="staff"] { background: #edf5ee; }
.message header { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 2px 10px; color: var(--muted); font-size: .8125rem; }
.message p { white-space: pre-wrap; overflow-wrap: anywhere; margin-top: 4px; }
#update-form { display: grid; gap: 8px; margin-bottom: 14px; }
#update-form select { width: min(100%, 210px); }
.form-note, .audit li { font-size: .875rem; overflow-wrap: anywhere; }
.audit li { border-top: 1px solid var(--line); padding-top: 7px; }
.audit li p { margin-top: 2px; }

@media (max-width: 970px) {
  .desk { grid-template-columns: minmax(290px, .9fr) minmax(0, 1.25fr); }
}
@media (max-width: 720px) {
  .desk { grid-template-columns: minmax(0, 1fr); }
  .desk:not([data-detail="true"]) .detail-card, .desk[data-detail="true"] .ticket-inbox { display: none; }
  .desk[data-detail="true"] .mobile-back { display: inline-flex; }
}
@media (max-width: 375px) {
  .filters { grid-template-columns: minmax(0, 1fr); }
  .filter-actions { justify-content: start; }
  .bar-actions { gap: 7px; }
  .bar-inner { padding-block: 7px; }
  .ticket-row { flex-wrap: wrap; }
  .ticket-row .chip-list { justify-content: start; }
}
