:root {
  color-scheme: light;
  --ink: #202c26;
  --muted: #53635b;
  --paper: #f5f5ef;
  --surface: #fffefa;
  --line: #dce1d7;
  --pine: #244b39;
  --pine-dark: #1b3027;
  --soft: #ecf3ec;
  --olive: #c6d3a5;
  --amber: #7c4b16;
  --clay: #9a392e;
  --font: "Microsoft YaHei UI", "PingFang SC", "Noto Sans CJK SC", system-ui, sans-serif;
  --number: "Bahnschrift", "Segoe UI", var(--font);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; color: var(--ink); background: var(--paper); font: 14px/1.6 var(--font); }
a { color: var(--pine); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .60; }
:focus-visible { outline: 2px solid #a25c24; outline-offset: 3px; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(26px, 3vw, 39px); line-height: 1.22; font-weight: 760; letter-spacing: -.035em; overflow-wrap: anywhere; }
h2 { font-size: 17px; letter-spacing: -.01em; line-height: 1.4; }
small { font-size: 12px; }
.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.desk { display: grid; grid-template-columns: 212px minmax(0, 1fr); min-height: 100vh; }
.sidebar { background: var(--pine-dark); color: #f2f5e9; display: flex; flex-direction: column; height: 100vh; position: sticky; top: 0; padding: 26px 14px 16px; }
.brand { display: flex; align-items: center; gap: 11px; color: inherit; font-size: 16px; white-space: nowrap; text-decoration: none !important; }
.sidebar .brand { margin: 0 7px 38px; }
.brand-mark { width: 27px; height: 27px; border-radius: 5px; background: var(--olive); position: relative; display: inline-block; flex: none; }
.brand-mark::after { content: ""; position: absolute; inset: 6px; border: 1.5px solid #2b4531; border-radius: 1px; background: linear-gradient(transparent 45%, #2b4531 45%, #2b4531 55%, transparent 55%); }
.main-nav { display: grid; gap: 5px; }
.main-nav a { display: flex; gap: 12px; align-items: center; color: #d8e0d3; padding: 10px 12px; border-radius: 7px; line-height: 1.5; }
.main-nav a:hover, .main-nav a[aria-current] { background: #31463c; color: #fff; text-decoration: none; }
.main-nav a[aria-current] { box-shadow: inset 3px 0 var(--olive); font-weight: 680; }
.nav-icon { display: inline-block; width: 14px; height: 14px; position: relative; border: 1.5px solid currentColor; border-radius: 3px; flex: none; }
.nav-icon.home { background: linear-gradient(to bottom, transparent 43%, currentColor 44%, currentColor 54%, transparent 55%); }
.nav-icon.customers { width: 13px; height: 10px; border-radius: 6px 6px 3px 3px; margin-top: 5px; }
.nav-icon.customers::after { content: ""; position: absolute; left: 2.5px; top: -7px; width: 5px; height: 5px; border: 1px solid currentColor; border-radius: 50%; background: var(--pine-dark); }
.nav-icon.orders { border-radius: 2px; }
.nav-icon.orders::after { content: ""; position: absolute; inset: 3px 2px; border-block: 1px solid currentColor; }
.nav-icon.after_sales::after { content: ""; position: absolute; inset: 3px; border: 1px solid currentColor; border-radius: 50%; }
.nav-icon.admin { border-radius: 50%; }
.nav-icon.admin::after { content: ""; position: absolute; inset: 4px; background: currentColor; border-radius: 50%; }
.profile { display: flex; align-items: center; gap: 9px; margin-top: auto; border-top: 1px solid #465950; padding: 15px 2px 0; }
.profile div { min-width: 0; overflow-wrap: anywhere; }
.profile small { display: block; color: #bac8ba; }
.avatar { width: 33px; height: 33px; border-radius: 50%; display: grid; place-items: center; background: #c6d3a5; color: var(--pine-dark); font-weight: 720; flex: none; }
.sign-out { border: 0; background: none; color: #d6e0d3; margin-left: auto; white-space: nowrap; }
.sign-out:hover { text-decoration: underline; }

.utility { display: flex; justify-content: space-between; gap: 8px; align-items: center; min-height: 60px; padding: 10px clamp(19px, 4vw, 54px); border-bottom: 1px solid var(--line); background: var(--surface); color: var(--muted); font-size: 13px; }
.timezone { display: flex; align-items: center; gap: 12px; }
.mode { border: 1px solid #d0dccb; padding: 2px 8px; border-radius: 4px; font-size: 12px; color: var(--pine); background: var(--soft); }
.page { padding: 32px clamp(19px, 4vw, 54px) 60px; max-width: 1540px; margin: 0 auto; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 26px; }
.page-heading > div:first-child { min-width: 0; }
.page-heading p { margin-top: 7px; }
.actions { display: flex; justify-content: end; align-items: center; flex-wrap: wrap; gap: 8px; flex: none; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-height: 38px; padding: 7px 13px; border: 1px solid #d0d8cc; border-radius: 6px; background: var(--surface); color: var(--ink); text-decoration: none !important; font-weight: 620; white-space: nowrap; }
.button:hover { border-color: #93a393; background: var(--soft); }
.button.primary { background: var(--pine); color: white; border-color: var(--pine); }
.button.primary:hover { background: #34634a; }
.button.small { font-size: 12px; min-height: 30px; padding: 4px 8px; }
.text-button { color: var(--pine); border: 0; background: none; padding: 2px 3px; font-weight: 650; font-size: 13px; }
.text-button:hover { text-decoration: underline; text-underline-offset: 3px; }

.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(147px, 1fr)); gap: 12px; margin-bottom: 25px; }
.metric { min-height: 129px; display: flex; flex-direction: column; justify-content: space-between; gap: 4px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; color: var(--ink); text-decoration: none !important; }
.metric:hover { border-color: #93a393; }
.metric[aria-current] { border-color: #658473; box-shadow: inset 0 3px var(--pine); background: #f6faf2; }
.metric-label { display: flex; align-items: center; gap: 8px; font-weight: 680; }
.metric i { width: 8px; height: 8px; border-radius: 50%; background: #547562; }
.metric-today i { background: #95642c; }
.metric-overdue i { background: #a74536; }
.metric-unassigned i { background: #687476; }
.metric strong { font: 690 36px/1.15 var(--number); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.metric-overdue strong { color: var(--clay); }
.metric small { color: var(--muted); }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 9px; min-width: 0; }
.panel-heading { display: flex; justify-content: space-between; align-items: center; padding: 15px 18px; gap: 10px; border-bottom: 1px solid var(--line); }
.filters { display: grid; grid-template-columns: minmax(170px, 1.5fr) .75fr 1.12fr .82fr 1fr auto; align-items: end; gap: 10px; padding: 13px 18px 15px; }
.filters label, .field, .login-form label { display: flex; flex-direction: column; gap: 5px; min-width: 0; color: var(--ink); font-weight: 630; }
.filters label span { font-size: 12px; color: var(--muted); }
input:not([type=checkbox]), select, textarea { width: 100%; padding: 8px 10px; min-height: 38px; color: var(--ink); background: #fff; border: 1px solid #d1d9cf; border-radius: 5px; font-weight: 400; min-width: 0; }
input::placeholder { color: #64726a; }
textarea { resize: vertical; min-height: 60px; }
.table-wrap { position: relative; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th { font-weight: 620; color: #47584d; background: #eef0e9; font-size: 12px; white-space: nowrap; }
td, th { padding: 11px 13px; vertical-align: middle; }
td:first-child, th:first-child { padding-left: 18px; }
td:last-child, th:last-child { padding-right: 18px; }
td { border-top: 1px solid #e8eae3; }
tbody tr:hover td { background: #f7faf4; }
.item-cell { min-width: 175px; max-width: 320px; }
.type-label, .item-subtitle, .shop-label { display: block; color: var(--muted); font-size: 12px; }
.type-label { margin-bottom: 2px; font-size: 11px; }
.item-link { font-weight: 700; color: var(--ink); overflow-wrap: anywhere; }
.item-subtitle { margin-top: 2px; overflow-wrap: anywhere; }
.platform-label { display: inline-block; border-radius: 4px; background: #eceeea; color: #394742; padding: 1px 6px; font-size: 12px; font-weight: 680; white-space: nowrap; }
.platform-taobao { background: #f9ecdf; color: #824715; }
.platform-douyin { background: #e9edef; color: #354b52; }
.shop-label { margin-top: 4px; min-width: 82px; }
.chip { display: inline-block; white-space: nowrap; border-radius: 4px; padding: 2px 7px; background: #edf0eb; color: #46534b; font-weight: 640; font-size: 12px; }
.status-following, .status-processing, .status-preparing, .status-ordered, .status-shipped { background: #e5efe6; color: #264d38; }
.status-waiting_customer, .status-waiting_factory, .status-confirming { background: #f7efd9; color: #6d501b; }
.status-closed, .status-cancelled, .status-completed { background: #e8eae7; color: #515c54; }
.due-overdue { background: #fae7e1; color: var(--clay); }
.due-today { background: #f8edd8; color: var(--amber); }
.due-soon { background: #ecf0df; color: #4a592d; }
.date-value, time { font-family: var(--number); font-variant-numeric: tabular-nums; white-space: nowrap; }
.deadline .date-value { display: block; }
.deadline .chip { margin-top: 3px; }
.row-end { white-space: nowrap; text-align: right; font-size: 13px; }
.empty { padding: 45px 18px; text-align: center; background: #f9faf5; color: var(--muted); }
.empty strong { color: var(--ink); }
.pager { display: flex; justify-content: end; align-items: center; gap: 9px; padding: 10px 18px; border-top: 1px solid var(--line); }

.back-link { display: inline-block; margin-bottom: 16px; font-size: 13px; }
.record-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, .84fr); gap: 16px; align-items: start; }
.detail-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin: 0; padding: 17px 18px 21px; }
.detail-fields .wide { grid-column: 1 / -1; }
.detail-fields dt { color: var(--muted); font-size: 12px; margin-bottom: 4px; font-weight: 650; }
.detail-fields dd { margin: 0; overflow-wrap: anywhere; }
.multiline { white-space: pre-wrap; }
.related, .admin-panel + .admin-panel { margin-top: 15px; }
.relation { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 11px 18px; overflow-wrap: anywhere; }
.relation + .relation { border-top: 1px solid var(--line); }
.timeline { list-style: none; padding: 16px 16px 16px 34px; margin: 0; }
.timeline > li { border-left: 2px solid #dbe2d5; padding: 1px 0 16px 15px; position: relative; overflow-wrap: anywhere; }
.timeline > li:last-child { padding-bottom: 4px; }
.timeline > li::before { content: ""; position: absolute; left: -5px; top: 7px; width: 8px; height: 8px; border-radius: 50%; background: #71927b; }
.timeline header { display: flex; gap: 8px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.timeline time, .timeline-actor { color: var(--muted); font-size: 12px; }
.timeline p { margin-top: 4px; white-space: pre-wrap; }
.timeline ul { padding: 3px 0 0; margin: 0; list-style: none; color: #425349; font-size: 13px; }

dialog { border: 1px solid #c6d1c1; padding: 0; border-radius: 10px; background: var(--surface); color: var(--ink); width: min(690px, calc(100% - 24px)); max-height: 92vh; box-shadow: 0 12px 55px #20332640; }
dialog::backdrop { background: #172b23a0; }
.dialog-head, .dialog-footer { display: flex; align-items: center; gap: 8px; justify-content: space-between; padding: 12px 17px; }
.dialog-head { border-bottom: 1px solid var(--line); }
.dialog-head h2 { font-size: 20px; }
.dialog-footer { border-top: 1px solid var(--line); justify-content: end; }
.dialog-body { max-height: 68vh; overflow-y: auto; padding: 16px 17px 20px; }
.icon-button { border: 0; background: transparent; font-size: 24px; line-height: 1; color: var(--muted); min-width: 32px; min-height: 32px; border-radius: 5px; }
.icon-button:hover { background: var(--soft); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px 14px; }
.wide { grid-column: 1 / -1; }
.field .required { color: var(--clay); }
.field-help, .form-note { color: var(--muted); font-size: 12px; font-weight: 400; }
.form-note { margin-right: auto; }
.readonly-value { line-height: 38px; font-weight: 500; }
.association-controls { display: flex; gap: 8px; }
.matches:empty, .inline-match:empty { display: none; }
.match { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-weight: 450; background: var(--soft); padding: 6px 8px; border-radius: 5px; margin-top: 4px; }
.inline-match { color: var(--amber); background: #f8f0df; padding: 6px 8px; border-radius: 5px; font-size: 12px; }
.notice { border: 1px solid #d9d8c9; border-radius: 6px; padding: 9px 10px; margin-bottom: 13px; overflow-wrap: anywhere; }
.notice a, .notice button, .inline-match a, .inline-match button { margin: 6px 8px 0 0; }
.notice.error { background: #fff0ea; border-color: #eec8bc; color: #842e24; }
.notice.conflict { color: #664515; background: #faf1db; border-color: #ead5a7; }
.notice.info { background: var(--soft); border-color: #d3dfd1; color: var(--pine); }
.notice ul { padding-left: 19px; }
.grants { border: 1px solid var(--line); border-radius: 5px; padding: 6px 10px 10px; margin: 0; }
.grants label { display: flex; align-items: center; gap: 7px; padding: 3px 0; }
input[type=checkbox] { accent-color: var(--pine); width: 16px; height: 16px; }
.toast { position: fixed; right: 18px; bottom: 19px; background: var(--pine-dark); color: #fff; padding: 10px 15px; border-radius: 7px; box-shadow: 0 3px 18px #182b3840; max-width: calc(100% - 36px); }

.login-layout { display: grid; grid-template-columns: minmax(330px, .88fr) 1.12fr; min-height: 100vh; }
.login-intro { color: #f2f5e9; background: var(--pine-dark); display: flex; flex-direction: column; align-items: start; justify-content: center; padding: clamp(25px, 6vw, 90px); position: relative; }
.login-intro .brand { position: absolute; top: 35px; left: clamp(25px, 6vw, 90px); }
.intro-text { color: #f6f7ed; font-size: clamp(31px, 4vw, 56px); line-height: 1.27; font-weight: 740; letter-spacing: -.05em; }
.login-intro p { margin-top: 16px; color: #c4d0c0; }
.cabinet { display: grid; gap: 3px; width: 62px; border: 1px solid var(--olive); border-radius: 3px; padding: 4px; margin-bottom: 19px; }
.cabinet span { border: 1px solid var(--olive); display: block; height: 10px; position: relative; }
.cabinet span::after { content: ""; position: absolute; left: 42%; top: 42%; width: 16%; border-top: 1px solid var(--olive); }
.login-panel { display: grid; place-items: center; padding: 28px; }
.login-form { display: grid; gap: 15px; width: min(100%, 390px); }
.login-form .muted { margin: -6px 0 6px; }
.demo-note { background: #e9eee4; border-left: 3px solid #8da081; border-radius: 4px; padding: 10px 12px; color: var(--muted); font-size: 12px; }
.demo-note strong { color: var(--pine); }
.demo-note code { color: var(--ink); }
.error-page { display: grid; justify-items: start; gap: 12px; padding: 10vh 12vw; }

@media (max-width: 1050px) {
  .desk { grid-template-columns: 180px minmax(0, 1fr); }
  .sidebar .brand { margin-inline: 2px; font-size: 14px; }
  .filters { grid-template-columns: 1.4fr 1fr 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
}

@media (max-width: 690px) {
  .desk { display: block; }
  .sidebar { position: static; height: auto; padding: 11px 13px; display: grid; grid-template-columns: 1fr auto; gap: 8px; }
  .sidebar .brand { margin: 0; }
  .main-nav { display: flex; flex-wrap: wrap; gap: 3px; grid-column: 1 / -1; grid-row: 2; }
  .main-nav a { gap: 5px; padding: 5px 7px; font-size: 12px; }
  .main-nav a[aria-current] { box-shadow: inset 0 -2px var(--olive); }
  .profile { margin: 0; padding: 0; border: 0; }
  .profile small, .avatar { display: none; }
  .profile strong { font-size: 12px; }
  .utility { min-height: 42px; padding-inline: 13px; }
  .page { padding: 20px 13px 36px; }
  .page-heading { align-items: start; flex-direction: column; }
  .actions { justify-content: start; flex: auto; }
  .metrics { grid-template-columns: 1fr 1fr; gap: 8px; }
  .metric { min-height: 96px; padding: 9px 10px; }
  .metric strong { font-size: 29px; }
  .filters { grid-template-columns: 1fr 1fr; padding: 10px; }
  .filters .search-field { grid-column: 1 / -1; }
  .filters button { grid-column: 1 / -1; justify-self: start; }
  .login-layout { display: block; }
  .login-intro { padding: 72px 22px 21px; }
  .login-intro .brand { left: 22px; top: 20px; }
  .intro-text { font-size: 28px; }
  .cabinet { display: none; }
  .login-panel { padding: 23px 17px; }
}

@media (max-width: 420px) {
  .form-grid { grid-template-columns: 1fr; }
  .dialog-body { max-height: 65vh; }
  .dialog-footer { flex-wrap: wrap; }
}
