:root {
  color-scheme: light;
  --ink: #192633;
  --muted: #596574;
  --sidebar: #192632;
  --side-text: #e2e8eb;
  --side-muted: #acbac5;
  --paper: #f6f4ef;
  --surface: #fff;
  --line: #e4dfd5;
  --gold: #855929;
  --gold-dark: #6e471e;
  --gold-pale: #f2e8d9;
  --error: #9c2b23;
  --positive: #216349;
  --radius: 14px;
  --font: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
  font: 15px/1.55 var(--font);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 300px; color: var(--ink); background: var(--paper); }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .65; }
a { color: inherit; }
:focus-visible { outline: 3px solid #b77c3a; outline-offset: 3px; }
h1, h2, h3, p, dl, dd { margin: 0; }
h1 { font-size: clamp(25px, 3vw, 36px); line-height: 1.25; letter-spacing: -.035em; }
h2 { font-size: 16px; line-height: 1.4; }
h3 { font-size: 14px; }
.subtle { color: var(--muted); }
.skip-link { position: fixed; left: 12px; top: 12px; translate: 0 -200%; padding: 8px 14px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); z-index: 10; }
.skip-link:focus { translate: 0; }

.entry { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(ellipse at 55% 5%, #fff, transparent 75%), var(--paper); }
.login-card { width: min(100%, 440px); padding: clamp(24px, 5vw, 39px); border: 1px solid var(--line); border-radius: 22px; background: var(--surface); box-shadow: 0 15px 65px #26313a14; }
.login-brand { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 36px; }
.login-card .flow { margin-top: 24px; }
.login-card .subtle { margin-top: 10px; }
.login-card .notice:not(:empty) { margin-top: 15px; }
#retry-session { margin-top: 12px; }
.brand { display: flex; align-items: center; gap: 11px; line-height: 1.25; white-space: nowrap; }
.brand strong { display: block; font-size: 18px; font-weight: 700; letter-spacing: .06em; }
.brand small { display: block; margin-top: 4px; font-size: 12px; font-weight: 500; color: var(--muted); }
.brand-symbol { display: grid; place-items: center; width: 40px; height: 40px; background: var(--gold); color: #fff; border-radius: 11px; font: 700 25px/1 Georgia, serif; }
.environment { display: inline-flex; align-items: center; gap: 7px; width: fit-content; padding: 4px 8px; border: 1px solid #ead8bc; border-radius: 7px; color: #704115; background: #fcf2e0; font-size: 12px; white-space: nowrap; }
.environment[data-mode="production"] { border-color: #cfddd7; background: #e5eee9; color: #234d3d; }
.environment::before { content: ""; width: 6px; height: 6px; background: currentColor; border-radius: 50%; }

.shell { display: grid; grid-template-columns: 216px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; display: flex; flex-direction: column; height: 100dvh; padding: 26px 15px 17px; background: var(--sidebar); color: var(--side-text); }
.sidebar-brand { padding-inline: 10px; }
.sidebar .brand strong { color: #fff; }
.sidebar .brand small { color: var(--side-muted); }
.sidebar nav { display: grid; gap: 4px; margin-top: 37px; }
.sidebar nav a { display: block; padding: 10px 14px; color: var(--side-muted); text-decoration: none; border-radius: 7px; white-space: nowrap; }
.sidebar nav a:hover { background: #ffffff12; color: #fff; }
.sidebar nav a[aria-current="page"] { color: #fff; background: #ffffff19; box-shadow: inset 3px 0 #c79961; font-weight: 650; }
.sidebar-account { margin-top: auto; padding: 16px 9px 0; border-top: 1px solid #ffffff23; }
.sidebar-account p { margin-top: 9px; overflow-wrap: anywhere; font-size: 12px; color: var(--side-muted); }
.sidebar-account .notice[data-error="true"] { color: #ffd7d3; }
.quiet { padding: 6px 0; border: 0; background: transparent; color: inherit; text-underline-offset: 4px; }
.quiet:hover { text-decoration: underline; }

.content { width: 100%; max-width: 1490px; margin-inline: auto; padding: 40px clamp(22px, 4vw, 60px) 70px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-bottom: 24px; }
.section-heading p { margin-top: 9px; color: var(--muted); }
.section-heading button { flex: 0 0 auto; }
.report-filter { display: flex; align-items: end; justify-content: space-between; gap: 15px; padding: 13px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: #faf8f4; }
.date-controls { display: flex; align-items: end; gap: 12px; }
.report-filter abbr { flex: 0 0 auto; padding-bottom: 8px; color: var(--muted); font-size: 12px; text-decoration: none; }
.notice { color: var(--muted); font-size: 13px; }
.notice:not(:empty) { margin: 10px 0; }
.notice[data-error="true"] { color: var(--error); }
.notice[data-success="true"] { color: var(--positive); }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 16px 0 18px; }
.stat { min-width: 0; padding: 18px 17px 17px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.stat:first-child { background: #fcf7ee; border-color: #e7dbca; }
.stat h2 { font-size: 13px; color: var(--muted); font-weight: 600; }
.stat strong { display: block; margin-top: 6px; max-width: 100%; overflow-wrap: anywhere; color: var(--ink); font-size: clamp(19px, 2.15vw, 33px); letter-spacing: -.06em; font-variant-numeric: tabular-nums; }
.stat p { margin-top: 5px; color: var(--muted); font-size: 12px; }
.stat strong, .summary-list dd, table { font-variant-numeric: tabular-nums; }
.panel { min-width: 0; margin-block: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.panel-heading { display: flex; align-items: start; justify-content: space-between; gap: 16px; padding: 17px 18px 13px; }
.panel-heading p, .table-note { color: var(--muted); font-size: 13px; }
.panel-heading p { margin-top: 3px; }
.table-note { padding: 11px 18px 15px; }
.table-note:empty { display: none; }
.panel-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.panel-grid > .panel { margin-block: 0; }
.account-grid { margin: 14px 0; }
.table-wrap { overflow-x: auto; }
.table-wrap:focus-visible { outline-offset: -4px; }
table { width: 100%; border-collapse: collapse; color: var(--ink); text-align: left; }
th, td { padding: 10px 16px; border-bottom: 1px solid var(--line); font-size: 13px; }
th { color: var(--muted); font-weight: 600; background: #faf8f4; white-space: nowrap; }
td { vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fcfbf8; }
.reference { font: 12px/1.55 var(--mono); word-break: break-word; }
#overview th:not(:first-child), #overview td:not(:first-child) { text-align: right; white-space: nowrap; }
.empty { padding-block: 18px; color: var(--muted); text-align: center; }
.connector-source { display: block; color: var(--muted); font: 11px/1.5 var(--mono); }
td progress { display: block; width: 72px; height: 5px; margin-top: 5px; margin-left: auto; border: 0; border-radius: 3px; background: #efe7da; accent-color: var(--gold); }
td progress::-webkit-progress-bar { background: #efe7da; border-radius: 3px; }
td progress::-webkit-progress-value { background: var(--gold); border-radius: 3px; }
.summary-list { padding-inline: 18px; }
.summary-list > div { display: grid; grid-template-columns: minmax(90px, 40%) minmax(0, 1fr); gap: 12px; padding-block: 10px; border-bottom: 1px solid var(--line); }
.summary-list > div:last-child { border-bottom: 0; }
.summary-list dt { color: var(--muted); font-size: 13px; }
.summary-list dd { font-weight: 600; overflow-wrap: anywhere; }
.search-form { display: flex; align-items: end; gap: 12px; padding: 16px 18px; }
.search-form label { flex: 0 1 330px; }
#lookup-form label:first-child { flex: 0 1 145px; }
.search-form button { flex: 0 0 auto; }
.pending-credit { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; background: #fcf7ee; padding: 13px 16px; }
.pending-credit p { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.account-overview { display: grid; grid-template-columns: 1fr 1.6fr; align-items: center; gap: 20px; padding: 18px; }
.account-overview h2 { overflow-wrap: anywhere; }
.account-overview p { font-size: 13px; margin-top: 4px; }
.account-overview dl { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.account-overview dl > div { padding-left: 12px; border-left: 1px solid var(--line); }
.account-overview dt { color: var(--muted); font-size: 12px; }
.account-overview dd { margin-top: 3px; overflow-wrap: anywhere; font-size: 20px; font-weight: 650; font-variant-numeric: tabular-nums; letter-spacing: -.04em; }
.panel-form { padding: 0 18px 18px; }
.panel-form button { justify-self: start; }
.settings-panel { max-width: 660px; }
.settings-panel form { padding-top: 15px; }
.state-tag { padding: 4px 9px; border-radius: 7px; background: var(--gold-pale); color: var(--gold-dark); font-size: 13px; font-weight: 650; white-space: nowrap; }
.state-tag[data-active="true"] { background: #e3f0e8; color: var(--positive); }

label { display: grid; gap: 5px; font-size: 13px; font-weight: 600; min-width: 0; }
input, textarea, select { min-width: 0; width: 100%; min-height: 40px; padding: 8px 10px; border: 1px solid #cfc9be; border-radius: 7px; background: #fff; }
textarea { resize: vertical; }
input::placeholder { color: #6d7680; }
.flow { display: grid; gap: 13px; }
.primary, .secondary { min-height: 40px; padding: 8px 13px; border: 1px solid transparent; border-radius: 7px; font-size: 13px; font-weight: 650; }
.primary { color: #fff; background: var(--gold); }
.primary:hover:not(:disabled) { background: var(--gold-dark); }
.secondary { color: var(--ink); border-color: #d8ccbc; background: #fff; }
.secondary:hover:not(:disabled) { background: var(--gold-pale); }
.full { width: 100%; }
dialog { width: min(calc(100% - 32px), 460px); padding: 0; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 16px 55px #09101833; }
dialog::backdrop { background: #13202cb3; }
.dialog-inner { padding: 22px; }
.dialog-inner h2 { margin-bottom: 10px; }
.dialog-inner dl { padding: 0; }
.dialog-actions { display: flex; justify-content: end; flex-wrap: wrap; gap: 8px; margin-top: 18px; }

@media (max-width: 1040px) {
  .shell { grid-template-columns: 177px minmax(0, 1fr); }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .panel-grid { grid-template-columns: 1fr; }
}
@media (max-width: 650px) {
  .shell { display: block; }
  .sidebar { position: static; display: grid; grid-template-columns: minmax(90px, 1fr) auto; gap: 10px; height: auto; padding: 11px 12px; }
  .sidebar-brand { align-self: center; padding: 0; }
  .sidebar-account { grid-column: 2; grid-row: 1; display: flex; align-items: center; gap: 8px; padding: 0; border: 0; }
  .sidebar-account #operator-email { display: none; }
  .sidebar-account button { font-size: 12px; white-space: nowrap; }
  .sidebar-account .notice { max-width: 115px; }
  .sidebar nav { grid-column: 1 / -1; display: flex; flex-wrap: wrap; margin: 0; }
  .sidebar nav a { padding: 7px 9px; font-size: 12px; }
  .sidebar nav a[aria-current="page"] { box-shadow: inset 0 -2px #c79961; }
  .brand-symbol { width: 34px; height: 34px; font-size: 21px; }
  .sidebar .brand small { display: none; }
  .content { padding: 23px 12px 45px; }
  .section-heading { flex-wrap: wrap; margin-bottom: 15px; }
  .section-heading p { margin-top: 5px; font-size: 13px; }
  .report-filter { display: block; padding: 11px; }
  .date-controls { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .date-controls button { width: fit-content; }
  .report-filter abbr { display: block; margin-top: 4px; padding: 0; }
  .stats { gap: 8px; }
  .stat { padding: 13px 11px; }
  .stat p { font-size: 11px; }
  .search-form { flex-wrap: wrap; padding: 12px; }
  .search-form label, #lookup-form label:first-child { flex: 1 1 160px; }
  .panel-heading { padding-inline: 12px; }
  .table-note { padding-inline: 12px; }
  th, td { padding-inline: 11px; }
  .account-overview { grid-template-columns: 1fr; gap: 12px; padding: 13px; }
  .account-overview dl { gap: 8px; }
  .account-overview dd { font-size: 17px; }
  .summary-list, .panel-form { padding-inline: 12px; }
}

.quick-dates, .toolbar-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.quick-dates button { min-height: 36px; padding-inline: 7px; border-radius: 6px; font-size: 12px; color: var(--gold-dark); }
.quick-dates button:hover:not(:disabled) { background: var(--gold-pale); text-decoration: none; }
.quick-dates abbr { padding: 0; margin-left: 6px; }
.text-action { color: var(--gold-dark); font-size: 13px; white-space: nowrap; text-underline-offset: 4px; }
.status-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; padding: 1px 18px 15px; }
.status-grid > div { padding: 9px 12px; background: #faf8f4; border: 1px solid var(--line); border-radius: 7px; }
.status-grid dt { color: var(--muted); font-size: 12px; }
.status-grid dd { font-size: 15px; font-weight: 650; color: var(--ink); overflow-wrap: anywhere; }
.plot { padding: 4px 18px 0; }
.plot-key { display: flex; flex-wrap: wrap; gap: 14px; margin: 0 0 8px; padding: 0; list-style: none; color: var(--muted); font-size: 12px; }
.plot-key li { display: flex; align-items: center; gap: 6px; }
.plot-key li::before { content: ""; width: 15px; border-top: 3px solid #91602e; border-radius: 2px; }
.plot-key .key-workbench::before { border-color: #516886; border-top-style: dashed; }
#activity-chart { display: block; width: 100%; height: 205px; }
.daily-detail { margin: 0 18px 14px; color: var(--muted); }
.daily-detail summary { width: fit-content; padding-block: 6px; color: var(--gold-dark); cursor: pointer; font-weight: 600; font-size: 13px; }
.daily-detail .table-wrap { max-height: 245px; overflow: auto; }
.daily-detail thead th { position: sticky; top: 0; }
.funnel { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 0 18px; padding: 0; list-style: none; }
.funnel li { min-width: 0; display: grid; gap: 3px; padding: 13px; border: 1px solid #e8ded0; border-radius: 9px; background: #fbf8f3; }
.funnel li:nth-child(2) { background: #fcfaf7; }
.funnel li:nth-child(3) { background: #fbfaf8; }
.funnel h3 { color: var(--ink); }
.funnel strong { font-size: clamp(18px, 2.2vw, 29px); letter-spacing: -.04em; overflow-wrap: anywhere; }
.funnel span { color: var(--muted); font-size: 12px; }
.section-switch { display: flex; width: fit-content; max-width: calc(100% - 24px); flex-wrap: wrap; gap: 3px; margin: 3px 18px 5px; padding: 4px; border: 1px solid var(--line); border-radius: 9px; background: #f5f2ec; }
.section-switch button { padding: 6px 10px; border: 1px solid transparent; border-radius: 6px; background: transparent; color: var(--muted); font-size: 13px; font-weight: 600; }
.section-switch button:hover { color: var(--gold-dark); }
.section-switch button[aria-pressed="true"] { border-color: #e2d8ca; background: #fff; color: var(--gold-dark); }
.product-switch { margin: 11px 0 12px; }
.directory-panel > .search-form, .list-filter { margin-block: 0; padding-block: 4px 12px; }
.directory-notice:not(:empty) { margin: 0; padding: 6px 18px 12px; }
.directory-stats { margin-top: 0; }
.pagination { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.pagination > div { display: flex; flex-wrap: wrap; gap: 6px; }
.table-action { padding: 0; border: 0; background: transparent; color: var(--gold-dark); text-decoration: underline; text-underline-offset: 3px; font-size: inherit; white-space: nowrap; }
.table-action:hover { color: var(--ink); }
.credit-jump { margin-top: 9px; }
#account-title:focus, #credit-title:focus { outline: 0; }
@media (max-width: 650px) {
  .quick-dates { margin-top: 4px; gap: 4px; }
  .quick-dates abbr { margin: 0 0 0 auto; }
  .funnel { margin-inline: 12px; gap: 4px; }
  .funnel li { padding: 9px 7px; }
  .funnel h3 { font-size: 12px; }
  .status-grid { padding-inline: 12px; gap: 6px; }
  .status-grid > div { padding-inline: 8px; }
  .section-switch { margin-inline: 12px; }
  .product-switch { margin-inline: 0; }
  .plot { padding-inline: 12px; }
  .daily-detail { margin-inline: 12px; }
  .toolbar-actions { gap: 4px; }
  .toolbar-actions button { padding-inline: 8px; }
}
