:root {
  font-family: "Microsoft YaHei UI", "PingFang SC", "Segoe UI", system-ui, sans-serif;
  color: #18233b;
  background: #f1f4fa;
  font-size: 14px;
  line-height: 1.55;
  --ink: #172846;
  --muted: #516581;
  --line: #d9e2ef;
  --outline: #a7b7cf;
  --paper: #fff;
  --surface-alt: #f4f7fc;
  --brand: #294f9b;
  --brand-hover: #1b3978;
  --brand-tint: #e7eefc;
  --focus: #3469c6;
  --radius: 12px;
  --topbar-height: 62px;
  --rail-width: 220px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button, a.button, summary { cursor: pointer; }
button, .button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 7px;
  min-height: 44px;
  padding: 8px 15px;
  border: 1px solid var(--outline);
  border-radius: 8px;
  color: var(--ink);
  background: var(--paper);
  font-weight: 650;
  line-height: 1.35;
  text-align: center;
}
button:hover, .button:hover { border-color: var(--brand); background: #f1f3ff; }
.primary { color: var(--paper); border-color: var(--brand); background: var(--brand); }
.primary:hover { color: var(--paper); border-color: var(--brand-hover); background: var(--brand-hover); }
.danger { color: #8c2637; border-color: #cf8994; background: #fff4f5; }
.danger:hover { border-color: #a93246; background: #ffe9ec; }
button:disabled { opacity: .55; cursor: default; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.skip { position: fixed; top: -80px; left: 16px; z-index: 20; padding: 10px; background: var(--paper); }
.skip:focus { top: 10px; }
.topbar {
  position: sticky;
  z-index: 5;
  top: 0;
  display: flex;
  min-height: var(--topbar-height);
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 11px 25px;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}
.brand { display: inline-flex; align-items: center; gap: 11px; font-size: 17px; font-weight: 750; }
.brand small { display: block; font-weight: 500; font-size: 12px; }
.brand-mark {
  display: inline-grid;
  flex: 0 0 36px;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: #4165db;
  color: #fff;
  font-size: 21px;
}
.topbar-tools { display: flex; align-items: center; gap: 13px; }
.topbar-tools .button { min-height: 38px; font-size: 12px; }
.preview-bar { z-index: 3; }
.shell { display: grid; min-height: 100vh; grid-template-columns: var(--rail-width) minmax(0, 1fr); }
.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
  height: 100vh;
  overflow: auto;
  scrollbar-width: thin;
  padding: 17px 12px 16px;
  background: #111e3b;
  color: #edf3ff;
  scrollbar-color: #4a638d #111e3b;
}
.sidebar .brand { padding: 7px 9px 19px; border-bottom: 1px solid #324365; color: #fff; }
.sidebar .brand small, .sidebar .nav-title { color: #baccec; }
.sidebar .nav-section + .nav-section, .sidebar .sidebar-bottom { border-color: #324365; }
.sidebar :is(.nav-link,.child-link,.nav-branch summary,.preview-link) { color: #edf3ff; }
.sidebar :is(.nav-link,.child-link,.nav-branch summary,.preview-link):hover { background: #20365c; border-color: #415982; }
.sidebar :is(.nav-link,.child-link)[aria-current] { background: #28498a; border-color: #4668aa; color: #fff; }
.sidebar .nav-glyph { color: #baccec; }
.sidebar .nav-link[aria-current] .nav-glyph { color: #fff; }
.sidebar :is(.nav-children,.nav-branches) { border-color: #4a638d; }
.sidebar :is(.nav-branch summary,.preview-link) { border-color: #324b71; background: #17294b; }
.sidebar .nav-branch:has(.child-link[aria-current]) summary { color: #d2e2ff; }
.sidebar :focus-visible { outline-color: #a9c6ff; }
.nav-section + .nav-section { margin-top: 16px; padding-top: 13px; border-top: 1px solid #e5e9f1; }
.nav-title { display: block; margin: 0 9px 6px; color: var(--muted); font-size: 12px; font-weight: 650; }
.nav-link, .child-link, .nav-branch summary, .preview-link {
  display: flex;
  align-items: center;
  min-height: 40px;
  gap: 9px;
  padding: 7px 9px;
  border: 1px solid transparent;
  border-radius: 7px;
}
.nav-link { font-weight: 650; }
.nav-link:hover, .child-link:hover, .nav-branch summary:hover, .preview-link:hover { background: #eff2fa; border-color: #d7deed; }
.nav-link[aria-current] { border-color: #d8cef3; background: var(--brand-tint); color: var(--brand-hover); }
.nav-glyph {
  width: 20px;
  color: #536387;
  font-size: 16px;
}
.nav-children, .nav-branches { margin: 5px 0 3px 20px; padding-left: 8px; border-left: 1px solid #cdd5e5; }
.nav-branches .nav-children { margin-left: 10px; }
.child-link, .nav-branch summary { min-height: 37px; color: #4a5a73; font-size: 13px; }
.child-link[aria-current] { border-color: #d8cef3; background: var(--brand-tint); color: var(--brand-hover); font-weight: 750; }
.nav-branch summary { justify-content: space-between; list-style: none; font-weight: 650; border-color: #dbe1ed; background: var(--paper); }
.nav-branch summary::-webkit-details-marker { display: none; }
.branch-arrow { font-size: 11px; transform: rotate(-90deg); }
.nav-branch[open] .branch-arrow { transform: none; }
.nav-branch:has(.child-link[aria-current]) summary { color: var(--brand-hover); }
.nav-branch + .nav-branch { margin-top: 6px; }
.sidebar-bottom { display: grid; gap: 7px; margin-top: auto; padding-top: 13px; border-top: 1px solid #e5e9f1; }
.sidebar-bottom .nav-title { margin-bottom: 0; }
.preview-link { min-height: 37px; border-color: #c7d0e1; background: #fff; font-size: 12px; font-weight: 650; }
.mobile-nav, .mobile-brand { display: none; }
.workspace { min-width: 0; }
.crumb {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}
.crumb strong { color: var(--ink); }
.crumb { align-items: center; }
.crumb-separator { color: #687b9b; font-size: 10px; }
.crumb a:hover { color: var(--brand); text-decoration: underline; }
.main { width: min(100%, 1700px); margin: 0 auto; padding: 24px clamp(18px, 3vw, 42px) 40px; }
.main:focus { outline: 0; }
.page-head, .panel-head, .board-head, .section-heading, .actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}
.page-head, .panel-head, .board-head, .section-heading { justify-content: space-between; }
.page-head { align-items: center; gap: 16px; margin-bottom: 20px; }
.page-title { flex: 1 1 260px; min-width: 0; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(27px, 3.3vw, 35px); line-height: 1.25; letter-spacing: -.024em; }
h2 { font-size: 17px; line-height: 1.35; }
h3 { font-size: 14px; }
.sub { color: var(--muted); margin-top: 7px; }
.muted, .note { color: var(--muted); }
.note { font-size: 12px; }
.grid { display: grid; gap: 16px; margin-top: 16px; }
.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.overview-layout { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); align-items: start; gap: 15px; }
.overview-products { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.overview-links { grid-column: 1 / -1; }
.overview-layout > .panel.panel { margin: 0; }
.panel, .product-board {
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: 0 1px 3px #17284608;
}
.panel-head { margin-bottom: 16px; }
.panel-head h2 { flex: 1 0 auto; max-width: 100%; }
.panel > .actions, .section-actions { margin-top: 15px; }
.panel + .panel, .panel + .callout { margin-top: 16px; }
.grid > .panel { margin: 0; }
.product-board { display: grid; gap: 13px; }
.board-head { margin-bottom: 1px; }
.board-head .button { min-height: 38px; font-size: 12px; }
.robot { --product-accent: #3157b1; --product-bg: #e8effe; --product-border: #c5d4f3; }
.finance { --product-accent: #6044a2; --product-bg: #eee8fa; --product-border: #d8ccee; }
.authorization-card { border-top: 3px solid var(--product-accent); }
.authorization-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px;
  margin-top: 14px;
  padding-top: 13px;
  border-top: 1px solid var(--line);
}
.product-card {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--product-border);
  border-radius: 8px;
  background: var(--product-bg);
}
.product-icon {
  display: inline-grid;
  width: 52px;
  height: 52px;
  flex: 0 0 52px;
  place-items: center;
  border-radius: 13px;
  color: var(--product-accent, var(--brand));
  background: var(--product-bg, var(--brand-tint));
  font-size: 23px;
  line-height: 1;
}
.product-copy { flex: 1 1 130px; min-width: 0; }
.product-copy h2 { font-size: 16px; }
.product-copy .sub { margin-top: 4px; }
.product-card .product-progress { margin: 7px 0 0; }
.product-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; }
.product-head h3 { font-size: 16px; }
.ledger-tag {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 5px;
  border: 1px solid var(--product-border);
  background: var(--paper);
  color: var(--product-accent);
  font-family: "Bahnschrift", "Segoe UI", sans-serif;
  font-weight: 700;
  font-size: 13px;
  white-space: nowrap;
}
.product-progress { display: flex; align-items: center; flex-wrap: wrap; gap: 7px 9px; margin: 10px 0 12px; color: var(--muted); font-size: 12px; }
.product-button, .product-outline { border-color: var(--product-accent); color: var(--product-accent); background: #fff; }
.product-button:hover, .product-outline:hover { border-color: var(--product-accent); background: var(--product-bg); }
.brand-pill { color: var(--product-accent); background: var(--product-bg); border-color: var(--product-border); }
.region-list { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 9px; }
.account-strip { display: flex; align-items: center; flex-wrap: wrap; gap: 16px; min-height: 100px; }
.account-id { flex: 1 0 165px; min-width: 0; overflow-wrap: anywhere; }
.account-strip > div:not(.account-id) { border-left: 1px solid var(--line); padding-left: 14px; }
.account-strip > div p { margin-top: 4px; }
.authorization-expiry { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 18px; }
.authorization-expiry strong { flex: 1; font-size: 16px; }
.page-controls { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 13px; color: var(--muted); font-size: 12px; }
.inline-context { font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.result-line { color: #294c4a; font-weight: 650; }
.live-record { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.live-original-image { display: block; max-width: 100%; max-height: 48vh; margin: 0 auto 12px; object-fit: contain; }
.quota-stats { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 10px; }
.quota-stats > div { display: grid; gap: 3px; padding: 10px 13px; border-radius: 8px; background: #e8effc; color: #264b91; }
.quota-stats > div:nth-child(2) { background: #eee8fa; color: #5d4292; }
.quota-stats > div:nth-child(3) { background: #fff0db; color: #775114; }
.quota-stats strong { font-size: 23px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.ocr-quota .note { margin-top: 5px; }
.recognition-hint { margin: 0 0 12px; }
.draw-overview { grid-column: 1 / -1; }
.draw-overview .grid { margin-top: 11px; }
.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  border: 1px solid #d6ddf4;
  border-radius: 6px;
  background: #eef1fb;
  color: #34467c;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.ok { background: #e8f5ed; color: #205b40; border-color: #bedfca; }
.warn { background: #fff4dd; color: #79521b; border-color: #eddbb6; }
.bad { background: #fcecef; color: #87263b; border-color: #ebcbd2; }
.callout {
  margin: 15px 0;
  padding: 12px 14px;
  border: 1px solid #e8c98b;
  border-left: 4px solid #a97325;
  border-radius: 7px;
  background: #fff8e9;
  color: #684718;
  overflow-wrap: anywhere;
}
.scope {
  display: grid;
  grid-template-columns: auto auto;
  align-items: baseline;
  gap: 1px 9px;
  padding: 7px 13px 8px;
  border: 1px solid var(--product-border);
  border-radius: 8px;
  background: var(--product-bg);
  color: var(--muted);
  font-size: 12px;
}
.scope strong { color: var(--product-accent); font-family: "Bahnschrift", "Segoe UI", sans-serif; font-size: 19px; font-variant-numeric: tabular-nums; }
.scope-product { grid-column: 1 / -1; font-weight: 650; color: var(--product-accent); }
.main > .scope { width: max-content; max-width: 100%; margin-bottom: 14px; }
.section-nav { margin-bottom: 16px; padding: 11px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); }
.tabbar { display: flex; gap: 9px; flex-wrap: wrap; }
.tab-button[aria-current] { border-color: var(--brand); color: var(--brand-hover); background: var(--brand-tint); }
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 8px; }
table { border-collapse: collapse; width: 100%; text-align: left; font-size: 13px; }
th, td { padding: 12px 13px; border-bottom: 1px solid #e3e8f0; vertical-align: middle; }
th { color: #435270; font-weight: 700; background: #eef2f9; white-space: nowrap; }
td { min-width: 82px; overflow-wrap: anywhere; }
.lead-cell { font-weight: 700; }
.amount { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr:nth-child(even) { background: #fafbfe; }
tbody tr:hover { background: #f2f5ff; }
tbody tr:last-child td { border-bottom: 0; }
.row-actions { text-align: right; }
td .actions { justify-content: flex-end; gap: 9px; }
td button, td .button { min-height: 38px; white-space: nowrap; font-size: 12px; padding: 6px 10px; }
.fields {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 12px;
  margin: 0 0 15px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-alt);
}
.filter-buttons { display: flex; flex-wrap: wrap; gap: 9px; }
label { display: grid; gap: 5px; color: #435270; font-size: 13px; font-weight: 600; }
input, select, textarea {
  min-height: 44px;
  min-width: 0;
  max-width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--outline);
  border-radius: 7px;
  color: var(--ink);
  background: var(--paper);
  font-weight: 400;
}
input[type="checkbox"] { min-height: auto; }
.filter-input { flex: 1 1 165px; }
.form-stack { display: grid; gap: 13px; margin-top: 16px; }
.form-stack .actions { margin-top: 4px; }
.restricted-actions { margin-top: 17px; border-top: 1px solid var(--line); padding-top: 14px; }
dl { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 9px 15px; margin: 12px 0 0; font-size: 13px; }
dt { color: var(--muted); }
dd { margin: 0; overflow-wrap: anywhere; }
code { color: #354b80; font-size: .93em; overflow-wrap: anywhere; }
.queue-list { display: grid; }
.queue-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 0;
  border-top: 1px solid var(--line);
}
.queue-row:first-child { border: 0; padding-top: 0; }
.queue-row:last-child { padding-bottom: 0; }
.queue-row .note { margin-top: 4px; }
.queue-controls { display: flex; flex-direction: column; align-items: end; flex-shrink: 0; gap: 7px; }
.queue-controls .button { min-height: 35px; padding: 5px 10px; font-size: 12px; }
.numbers { display: flex; flex-wrap: wrap; gap: 5px; margin: 10px 0; }
.number {
  display: inline-grid;
  place-items: center;
  min-width: 24px;
  height: 26px;
  border: 1px solid #dbe1f4;
  border-radius: 5px;
  background: #eef1fb;
  color: #364979;
  font-family: "Bahnschrift", "Segoe UI", sans-serif;
  font-size: 13px;
  font-weight: 650;
}
.special { color: #83283b; background: #fcecf0; border-color: #f0ccd4; }
.preview-shell { max-width: 990px; margin: 0 auto; }
.login { max-width: 460px; margin: 30px auto; }
.empty { padding: 17px; text-align: center; color: var(--muted); background: var(--surface-alt); border-radius: 8px; }
dialog { width: min(550px, calc(100% - 26px)); max-height: 85vh; border: 1px solid #ece9f2; border-radius: 17px; padding: 23px; color: var(--ink); box-shadow: 0 18px 60px #24213d38; }
dialog::backdrop { background: #14254a39; backdrop-filter: blur(2px); }
.dialog-description { color: var(--muted); }
.dialog-description .table-wrap { margin-top: 12px; }
.dialog-description p + p, .dialog-scope + p { margin-top: 7px; }
.dialog-scope { display: inline-block; padding: 4px 9px; border-radius: 7px; background: var(--brand-tint); color: var(--brand-hover); font-weight: 650; }
.dialog-close { min-height: 36px; min-width: 36px; padding: 0 8px; font-size: 14px; }
.dialog-footer { border-top: 1px solid var(--line); padding-top: 13px; margin-top: 12px; display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.check-field { display: flex; align-items: center; gap: 8px; }
.backup-scopes { display: grid; gap: 8px; min-width: 0; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.backup-scopes legend { color: var(--ink); font-size: 13px; font-weight: 600; padding: 0 4px; }
.form-error { color: #8c2637; }
.toast { position: fixed; z-index: 8; bottom: 22px; left: 50%; transform: translateX(-50%); width: max-content; max-width: calc(100% - 28px); padding: 10px 14px; background: #29345d; color: white; border-radius: 8px; box-shadow: 0 4px 18px #202b4e45; }
@media (max-width: 970px) {
  .overview-layout { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .shell { display: block; }
  .sidebar { display: none; }
  .topbar { position: relative; top: 0; padding: 10px 13px; }
  .mobile-brand { display: block; }
  .admin-topbar .crumb { order: 1; flex-basis: 100%; }
  .mobile-nav { display: block; flex: 0 0 100%; }
  .mobile-nav > summary {
    display: flex;
    align-items: center;
    gap: 7px;
    width: max-content;
    min-height: 44px;
    padding: 9px 12px;
    border: 1px solid var(--outline);
    border-radius: 7px;
    font-weight: 700;
  }
  .mobile-menu { max-height: 55dvh; overflow-y: auto; padding: 12px 4px 0; }
  .mobile-menu .sidebar-bottom { margin-top: 14px; }
  .mobile-menu .nav-link, .mobile-menu .child-link, .mobile-menu .nav-branch summary, .mobile-menu .preview-link { min-height: 44px; }
  .three { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 540px) {
  .two, .three, .overview-aside { grid-template-columns: minmax(0, 1fr); }
  .overview-products { grid-template-columns: minmax(0, 1fr); }
  .main { padding: 15px 14px 30px; }
  .page-head { gap: 12px; }
  .page-title { flex-basis: 100%; }
  .panel, .product-board { padding: 13px; }
  .fields { padding: 10px; }
  .panel-head { margin-bottom: 12px; }
  td button, td .button, .queue-controls .button { min-height: 44px; }
  .topbar-tools .button { min-height: 44px; }
  .quota-stats > div { padding: 8px; font-size: 12px; }
  .quota-stats strong { font-size: 18px; }
}
