:root {
  color-scheme: light;
  --paper: #f7f6f2;
  --white: #fff;
  --ink: #252a22;
  --muted: #596254;
  --line: #dedfd7;
  --accent: #35533e;
  --accent-deep: #274333;
  --accent-soft: #e7eee4;
  --warn: #774619;
  --warn-bg: #f9eddc;
  --negative: #a03937;
  --shadow: 0 10px 30px #343a2512;
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;
  font-size: 16px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--paper); color: var(--ink); line-height: 1.55; }
button, input, select, textarea { font: inherit; }
button, select { cursor: pointer; }
button:disabled { cursor: wait; opacity: .65; }
a { color: var(--accent-deep); }
:focus-visible { outline: 2px solid #50815c; outline-offset: 3px; }
.skip { position: fixed; top: 10px; left: 10px; z-index: 5; background: #fff; padding: 10px; transform: translateY(-150%); }
.skip:focus { transform: translateY(0); }
.sidebar {
  width: 214px; background: #edeee6; border-right: 1px solid var(--line);
  position: fixed; inset: 0 auto 0 0; padding: 30px 17px 20px;
  display: flex; flex-direction: column; gap: 32px;
}
.brand {
  display: flex; align-items: center; gap: 10px; padding: 0 6px; text-decoration: none;
  color: var(--accent-deep); font-size: 1.02rem; font-weight: 750; white-space: nowrap;
}
.brand svg { flex: none; }
nav { display: grid; gap: 5px; }
nav button {
  background: transparent; border: 1px solid transparent; color: var(--muted); border-radius: 9px;
  display: flex; align-items: center; gap: 10px; padding: 9px 11px; text-align: left;
  font-size: .91rem; font-weight: 650; white-space: nowrap;
}
nav button:hover { background: #e4e9df; }
nav button[aria-current="page"] { background: #dce7da; color: #284635; border-color: #d8e3d6; }
.nav-icon { font-size: 1.18rem; width: 19px; text-align: center; line-height: 1; }
.account { margin-top: auto; display: grid; gap: 6px; padding: 12px 6px 0; border-top: 1px solid #d7dbd1; }
.role { color: var(--accent-deep); font-weight: 700; font-size: .87rem; }
.email { color: var(--muted); font-size: .81rem; overflow-wrap: anywhere; }
.signout { font-size: .81rem; width: fit-content; }
.workspace { margin: 0 auto 0 214px; padding: 22px clamp(20px, 3.2vw, 55px) 50px; min-width: 0; }
.topbar { display: flex; justify-content: space-between; gap: 14px; align-items: center; min-height: 41px; margin-bottom: 24px; }
.breadcrumb { color: var(--muted); font-size: .875rem; }
.breadcrumb span { margin: 0 7px; opacity: .7; }
.breadcrumb strong { color: var(--ink); font-weight: 650; }
#page { max-width: 1530px; }
.page-heading { display: flex; justify-content: space-between; gap: 18px; align-items: end; margin-bottom: 24px; flex-wrap: wrap; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 7px; font-size: clamp(1.75rem, 3.1vw, 2.65rem); letter-spacing: -.045em; line-height: 1.15; }
h2 { font-size: 1.17rem; margin-bottom: 5px; }
h3 { font-size: 1rem; margin-bottom: 6px; }
.sub, .hint { margin: 0; color: var(--muted); }
.sub { font-size: .94rem; }
.hint { font-size: .85rem; }
.button {
  display: inline-flex; min-height: 39px; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--white); color: var(--ink);
  padding: 8px 13px; font-size: .88rem; font-weight: 680; text-decoration: none; white-space: nowrap;
}
.button:hover { background: #f0f1eb; }
.button.primary { color: #fff; border-color: var(--accent); background: var(--accent); }
.button.primary:hover { background: var(--accent-deep); }
.button.quiet { background: transparent; }
.button.quiet:hover { background: #eeefe8; }
.panel { border: 1px solid var(--line); border-radius: 13px; background: var(--white); min-width: 0; }
.filters { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; margin-bottom: 15px; }
.filters label { display: grid; gap: 4px; font-size: .86rem; color: var(--muted); }
.filters .grow { flex: 1 1 210px; max-width: 380px; }
.filters .button { margin-left: auto; }
.field { width: 100%; min-height: 40px; border: 1px solid #cfd3c9; border-radius: 8px; padding: 7px 10px; background: #fff; color: var(--ink); }
.field::placeholder { color: #646c5f; }
.metrics { display: grid; gap: 12px; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 14px; }
.metric { padding: 16px 17px 14px; min-width: 0; }
.metric.highlight { background: var(--accent-deep); border-color: var(--accent-deep); color: #fff; }
.metric-label { font-size: .88rem; font-weight: 650; color: var(--muted); }
.metric.highlight .metric-label, .metric.highlight .metric-detail { color: #e2ebe0; }
.money { font-variant-numeric: tabular-nums; white-space: nowrap; }
.metric-value { display: block; font-size: clamp(1.31rem, 2.45vw, 2.15rem); margin: 5px 0 2px; line-height: 1.3; letter-spacing: -.04em; white-space: normal; overflow-wrap: anywhere; }
.metric-detail { color: var(--muted); font-size: .82rem; }
.recap { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 19px; }
.recap-card { padding: 14px 17px; }
.recap-labels { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 8px; margin: 8px 0 0; }
.recap-labels dt { color: var(--muted); font-size: .83rem; }
.recap-labels dd { margin: 2px 0 0; font-size: 1rem; font-weight: 700; white-space: normal; overflow-wrap: anywhere; }
.table-head { display: flex; justify-content: space-between; align-items: start; flex-wrap: wrap; padding: 15px 17px 12px; gap: 10px; }
.table-head p { margin: 0; }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: .86rem; text-align: left; }
th, td { padding: 11px 12px; border-top: 1px solid #e8e9e2; vertical-align: middle; white-space: nowrap; }
th { background: #f5f6f1; color: var(--muted); font-size: .82rem; font-weight: 720; }
th:first-child, td:first-child { padding-left: 17px; }
th:last-child, td:last-child { padding-right: 17px; }
td strong { display: block; }
td small { color: var(--muted); display: block; font-size: .79rem; }
tr:hover td { background: #fafbf7; }
.pill { display: inline-block; border-radius: 999px; padding: 3px 8px; font-size: .78rem; font-weight: 650; background: #edf0e9; color: #485445; white-space: nowrap; }
.pill.good { background: var(--accent-soft); color: var(--accent-deep); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.negative { color: var(--negative); }
.metric.highlight .negative { color: #ffd7d1; }
.link-button { background: none; border: 0; padding: 4px 0; color: var(--accent-deep); text-decoration: underline; text-underline-offset: .17em; font-weight: 690; }
.empty { padding: 32px 18px; text-align: center; color: var(--muted); }
.empty h3, .empty h2 { color: var(--ink); }
.empty .button { margin-top: 9px; }
.notice { max-width: 1530px; margin: 0 0 14px; border: 1px solid #cfdccc; background: #edf2ea; padding: 9px 12px; border-radius: 8px; font-size: .9rem; color: var(--accent-deep); }
.notice.error, .form-error { background: var(--warn-bg); color: var(--warn); border-color: #e9cfab; }
.products { display: grid; grid-template-columns: repeat(auto-fit, minmax(218px, 1fr)); gap: 14px; }
.product { overflow: hidden; }
.product img, .no-image { display: block; width: 100%; height: 210px; object-fit: cover; background: var(--accent-soft); }
.no-image { display: grid; place-items: center; color: var(--muted); }
.product-body { padding: 14px 16px; }
.product-body p { margin-bottom: 8px; color: var(--muted); white-space: pre-wrap; overflow-wrap: anywhere; }
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.settings-grid .panel { padding: 17px; }
.settings-grid .button { margin: 10px 4px 0 0; }
dialog { border: 1px solid var(--line); border-radius: 15px; width: min(740px, calc(100% - 24px)); max-height: calc(100% - 32px); padding: 0; color: var(--ink); box-shadow: var(--shadow); }
dialog::backdrop { background: #20272070; }
.dialog-head { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 13px 18px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: #fff; z-index: 1; }
.dialog-head h2 { margin: 0; }
#dialog-body { padding: 17px 18px; }
.dialog-actions { display: flex; gap: 9px; margin-top: 16px; justify-content: flex-end; }
fieldset { border: 1px solid var(--line); border-radius: 9px; margin: 0 0 13px; padding: 9px 12px 13px; min-width: 0; }
legend { font-weight: 740; padding: 0 4px; font-size: .9rem; }
.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.form-grid label { display: grid; gap: 4px; align-content: start; font-size: .87rem; }
.form-grid .wide { grid-column: 1 / -1; }
.form-grid .wide textarea { min-height: 64px; }
.form-grid .check { display: flex; align-items: center; }
.form-grid .check input { width: 1rem; height: 1rem; }
.form-error { padding: 7px 10px; border-radius: 8px; margin: 0 0 10px; }
.detail-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 0; }
.detail-grid dt { font-size: .82rem; color: var(--muted); }
.detail-grid dd { margin: 2px 0 0; overflow-wrap: anywhere; }
.detail-note { white-space: pre-wrap; overflow-wrap: anywhere; margin: 8px 0 0; }
@media (max-width: 1020px) {
  .sidebar { width: 171px; padding-inline: 11px; }
  .workspace { margin-left: 171px; }
}
@media (max-width: 760px) {
  .sidebar { width: auto; position: static; padding: 12px 14px 8px; gap: 8px; border-right: 0; border-bottom: 1px solid var(--line); }
  .workspace { margin: 0; padding: 12px 14px 35px; }
  nav { display: flex; overflow-x: auto; gap: 2px; }
  nav button { padding: 6px 8px; font-size: .82rem; gap: 3px; }
  .nav-icon { display: none; }
  .account { grid-auto-flow: column; grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px; padding: 6px 6px 0; }
  .topbar { margin-bottom: 12px; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .metric { padding: 12px; }
  .recap { gap: 8px; }
  .recap-card { padding: 10px; }
  .recap-labels { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .settings-grid { grid-template-columns: 1fr; }
  .form-grid, .detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; } }

.login-card { width: min(100%, 445px); margin: clamp(22px, 8vh, 66px) 0; padding: clamp(21px, 4vw, 34px); }
.login-card h1 { font-size: clamp(1.55rem, 3.2vw, 2.1rem); }
.login-card form { display: grid; gap: 9px; margin-top: 21px; }
.login-card .form-error { margin: 0; }
.login-card button { justify-self: start; margin-top: 3px; }
