* { box-sizing: border-box; }
:root {
  --bg: #f7f6fa;
  --surface: #fff;
  --ink: #231c32;
  --muted: #61596f;
  --border: #e5e0ed;
  --accent: #5f4791;
  --pale: #f0eaf8;
  --error: #982e49;
  font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--bg);
  color-scheme: light;
}
body { margin: 0; font-size: .9rem; }
[hidden] { display: none !important; }
button, select, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .5; }
button:focus-visible, input:focus-visible, select:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid #8c72c0; outline-offset: 2px;
}
.wrap { width: min(100% - 72px, 1136px); margin-inline: auto; }
.top { background: var(--surface); border-bottom: 1px solid var(--border); }
.top-inner, .brand, .account, .intro, .ledger-head, .actions { display: flex; align-items: center; }
.top-inner { min-height: 65px; justify-content: space-between; gap: 18px; }
.brand { gap: 12px; white-space: nowrap; }
.brand strong { font-size: 1rem; }
.brand span:last-child, .account, .muted { color: var(--muted); }
.brand span:last-child { border-left: 1px solid var(--border); padding-left: 12px; }
.mark { color: var(--accent); font-size: 1.45rem; line-height: 1; }
.account { gap: 12px; justify-content: flex-end; min-width: 0; }
#account-name { overflow-wrap: anywhere; }
.dashboard { padding: 42px 0 52px; }
.intro { justify-content: space-between; gap: 18px; margin-bottom: 22px; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(1.6rem, 3vw, 2rem); line-height: 1.3; letter-spacing: -.02em; }
h2 { font-size: 1.15rem; }
.intro p { margin-top: 9px; color: var(--muted); }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; }
.primary, .quiet { padding: 10px 15px; border: 1px solid transparent; border-radius: 9px; white-space: nowrap; }
.primary { color: #fff; background: var(--accent); font-weight: 700; }
.primary:hover { background: #4c3676; }
.quiet { color: var(--accent); background: var(--pale); }
.quiet:hover { background: #e9e0f4; }
.capital-panel { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; padding: 14px 20px; }
.capital-details { display: flex; flex-wrap: wrap; align-items: end; gap: 8px 20px; min-width: 0; }
.capital-details h2 { font-size: .95rem; margin-bottom: 4px; }
.capital-details strong { font-size: clamp(1.3rem, 2.6vw, 1.75rem); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.capital-details p { font-size: .78rem; margin-bottom: 3px; overflow-wrap: anywhere; }
.filters { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: space-between; padding: 9px 10px; }
.presets, .filter-fields { display: flex; align-items: center; gap: 6px; }
.presets button {
  background: transparent; color: var(--muted); border: 0; border-radius: 8px;
  padding: 8px 10px; white-space: nowrap;
}
.presets button[aria-pressed="true"] { background: var(--pale); color: var(--accent); font-weight: 700; }
input, select {
  color: var(--ink); background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; min-height: 39px; padding: 8px 10px; min-width: 0;
}
.filter-fields select { max-width: 145px; }
.filter-fields input[type="search"] { width: 155px; }
.filter-button { padding: 8px 11px; }
.message { color: var(--error); font-size: .86rem; margin: 10px 0; }
.message.success { color: #226245; }
.message:empty { display: none; }
.metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin: 18px 0 10px; }
.metric { min-height: 110px; padding: 17px 20px; display: grid; align-content: center; gap: 7px; }
.metric span { color: var(--muted); }
.metric strong { font-size: clamp(1.25rem, 2.5vw, 1.95rem); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.cost-note { margin: 0 0 17px; }
.loss { color: var(--error); }
.cost-edit { padding: 0; color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.sale-edit { display: block; margin-top: 6px; }
.details { display: grid; grid-template-columns: minmax(235px, 1fr) minmax(0, 2.1fr); gap: 16px; align-items: start; }
.channels { padding: 19px 20px 23px; min-height: 220px; }
.channels .muted { margin-top: 6px; }
.chart { display: grid; gap: 18px; margin-top: 23px; }
.channel-label { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.channel-label strong { font-size: .9rem; }
.channel-label span { font-variant-numeric: tabular-nums; color: var(--muted); }
meter { width: 100%; height: 12px; margin-top: 6px; }
meter::-webkit-meter-bar { border: 0; background: var(--pale); }
meter::-webkit-meter-optimum-value { background: var(--accent); }
meter::-moz-meter-bar { background: var(--accent); }
.ledger { min-width: 0; overflow: hidden; }
.ledger-head { justify-content: space-between; gap: 12px; padding: 18px 19px; }
.ledger-head .muted { text-align: right; font-size: .76rem; }
.table-scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; text-align: left; white-space: nowrap; font-variant-numeric: tabular-nums; }
th, td { padding: 12px 10px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); background: var(--bg); font-weight: 600; font-size: .8rem; }
th:first-child, td:first-child { padding-left: 19px; }
th:last-child, td:last-child { padding-right: 19px; }
td { font-size: .83rem; }
td.product { white-space: normal; min-width: 115px; max-width: 200px; overflow-wrap: anywhere; font-weight: 700; }
td small { display: block; color: var(--muted); margin-top: 3px; white-space: normal; }
.empty { white-space: normal; text-align: center; padding: 28px 18px; color: var(--muted); }
.pagination { padding: 11px 16px; display: flex; align-items: center; justify-content: flex-end; gap: 12px; color: var(--muted); }
.pagination button { padding: 5px 10px; }
.login-view { padding: 64px 18px; }
.login-card { width: min(100%, 430px); margin-inline: auto; padding: clamp(22px, 5vw, 38px); }
.login-card h1 { margin-bottom: 24px; }
label { display: grid; gap: 7px; font-weight: 600; }
label input, label select { width: 100%; font-weight: 400; }
.login-card label { margin-bottom: 16px; }
.login-card .primary { margin-top: 8px; }
dialog { border: 1px solid var(--border); border-radius: 20px; padding: 24px; width: min(100% - 28px, 520px); max-height: calc(100% - 24px); overflow: auto; color: var(--ink); background: var(--surface); }
dialog::backdrop { background: rgb(28 20 46 / 48%); }
dialog h2 { font-size: 1.45rem; }
dialog h2 + p { margin-top: 7px; }
.sale-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px 15px; margin: 19px 0; }
.wide { grid-column: 1 / -1; }
.actions { justify-content: flex-end; gap: 8px; }
@media (max-width: 920px) {
  .wrap { width: calc(100% - 36px); }
  .details { grid-template-columns: minmax(0, 1fr); }
  .channels { min-height: 0; }
}
@media (max-width: 620px) {
  .wrap { width: calc(100% - 28px); }
  .dashboard { padding-top: 24px; }
  .filters { display: grid; }
  .filter-fields { flex-wrap: wrap; }
  .filter-fields input { flex: 1; min-width: 116px; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .metric { min-height: 86px; padding: 10px 13px; }
  .brand { gap: 7px; }
  .brand span:last-child { padding-left: 7px; }
  .account { gap: 5px; }
  .top-inner { gap: 8px; }
  .intro .primary, .account .quiet { padding-inline: 10px; }
  .capital-panel { padding-inline: 13px; }
  .capital-panel .primary { padding-inline: 10px; }
}
@media (max-width: 390px) {
  .sale-fields { grid-template-columns: minmax(0, 1fr); }
  dialog { padding: 17px; }
  .brand span:last-child { display: none; }
}
