:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #f5f7fb;
  color: #172b4d;
  font-synthesis: none;
  --accent: #2563eb;
  --border: #e2e8f0;
  --muted: #66758c;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; }
button, input, select { font: inherit; }
/* iOS 聚焦小于 16px 的表单控件会放大视口；覆盖页面局部的 font 继承。 */
@media (any-pointer: coarse), (max-width: 767px) {
  input, select, textarea { font-size: 16px !important; }
}
button, summary { cursor: pointer; }
a { color: var(--accent); }
button, a, input, select { -webkit-tap-highlight-color: transparent; }
select {
  appearance: none;
  padding-right: 40px !important;
  background-color: #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath d='m4 6 4 4 4-4' fill='none' stroke='%2352647d' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  cursor: pointer;
  transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}
select:hover:not(:disabled) { border-color: #aebbd0; background-color: #fafdff; }
select:focus { outline: 2px solid #bfdbfe; border-color: #2563eb; box-shadow: 0 0 0 1px #2563eb12; }
select:disabled { background-color: #f1f5f9; color: #8290a5; cursor: not-allowed; }
select option { background: #fff; color: #172b4d; }
.select-control { position: relative; min-width: 0; color: #172b4d; font-size: 13px; }
.select-control-native { position: absolute !important; width: 1px !important; height: 1px !important; margin: 0 !important; padding: 0 !important; opacity: 0; pointer-events: none; }
.select-control-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 42px;
  padding: 9px 12px;
  border: 1px solid #d8e0ec;
  border-radius: 8px;
  background: #fff;
  color: #172b4d;
  text-align: left;
  font: inherit;
  cursor: pointer;
  transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}
.select-control-trigger::after { content: ''; width: 7px; height: 7px; flex: 0 0 auto; border-right: 1.5px solid #52647d; border-bottom: 1.5px solid #52647d; transform: rotate(45deg) translateY(-2px); transition: transform .15s ease; }
.select-control-value { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.select-control-trigger:hover:not(:disabled) { border-color: #aebbd0; background: #fafdff; }
.select-control-trigger:focus-visible, .select-control.is-open .select-control-trigger { outline: 2px solid #bfdbfe; outline-offset: 0; border-color: #2563eb; box-shadow: 0 0 0 1px #2563eb12; }
.select-control.is-open .select-control-trigger::after { transform: rotate(225deg) translate(-2px, -2px); }
.select-control.is-disabled .select-control-trigger { background: #f1f5f9; color: #8290a5; cursor: not-allowed; }
.select-control.is-invalid .select-control-trigger { border-color: #bc3535; box-shadow: 0 0 0 2px #fee2e2; }
.select-control-menu { position: absolute; z-index: 100; top: calc(100% + 6px); left: 0; right: 0; max-height: 240px; overflow-y: auto; padding: 6px; border: 1px solid #d8e0ec; border-radius: 10px; background: #fff; box-shadow: 0 16px 36px #172b4d20; }
.select-control-menu[hidden] { display: none; }
.select-control-option { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; min-height: 38px; padding: 8px 10px; border: 0; border-radius: 7px; background: transparent; color: #40536f; text-align: left; font: inherit; cursor: pointer; }
.select-control-option:hover, .select-control-option:focus-visible { outline: 0; background: #f1f5f9; color: #1d4ed8; }
.select-control-option.is-selected { background: #eaf0ff; color: #1d4ed8; font-weight: 650; }
.select-control-option.is-selected::after { content: '✓'; flex: 0 0 auto; color: #2563eb; font-weight: 700; }
.select-control-option:disabled { color: #a0aec0; cursor: not-allowed; }
:focus-visible { outline: 3px solid #93b4fc; outline-offset: 3px; }
.hidden { display: none !important; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: 30px; letter-spacing: -.035em; line-height: 1.3; }
h2 { margin-bottom: 0; font-size: 18px; line-height: 1.5; letter-spacing: -.02em; }
.shell { width: min(100%, 1320px); min-height: calc(100vh - 72px); margin: 0 auto; padding: max(0px, env(safe-area-inset-top)) 36px max(32px, env(safe-area-inset-bottom)); }
.site-footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 20px; min-height: 72px; padding: 20px 16px max(20px, env(safe-area-inset-bottom)); border-top: 1px solid var(--border); text-align: center; font-size: 13px; line-height: 24px; }
.site-footer a { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; color: #52647d; text-decoration: none; }
.site-footer img { width: 20px; height: 20px; object-fit: contain; flex-shrink: 0; }
.site-footer a:hover { color: var(--accent); text-decoration: underline; }
.site-footer a:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.workspace-nav { display: flex; align-items: center; justify-content: space-between; gap: 24px; min-height: 84px; border-bottom: 1px solid var(--border); margin-bottom: 32px; }
.brand-group { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: #172b4d; text-decoration: none; font-size: 17px; font-weight: 750; white-space: nowrap; }
.brand small { padding-left: 10px; border-left: 1px solid #cbd5e1; color: var(--muted); font-size: 13px; font-weight: 400; }
.brand-mark { display: block; width: 34px; height: 34px; border-radius: 9px; object-fit: cover; }
.nav-links { display: flex; gap: 8px; flex-shrink: 0; }
.nav-links a { display: flex; align-items: center; min-height: 42px; padding: 0 16px; border-radius: 8px; color: var(--muted); font-size: 14px; text-decoration: none; font-weight: 600; }
.nav-links a[aria-current="page"] { color: #1d4ed8; background: #eaf0ff; }
.nav-links a:hover { background: #eaf0ff; color: #1d4ed8; }
.nav-links a { white-space: nowrap; }
.feature-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.feature-card { display: flex; align-items: center; gap: 12px; min-width: 0; min-height: 76px; padding: 14px 16px; border: 1px solid var(--border); border-radius: 12px; background: #fff; color: inherit; text-decoration: none; transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease; }
.feature-card:hover { border-color: #93b4fc; box-shadow: 0 10px 28px #172b4d0d; transform: translateY(-1px); }
.feature-card-icon { display: grid; place-items: center; width: 38px; height: 38px; flex: 0 0 38px; border-radius: 10px; background: #eaf0ff; color: #1d4ed8; font-size: 15px; font-weight: 700; }
.feature-card strong { min-width: 0; color: #243650; font-size: 15px; line-height: 1.4; overflow-wrap: anywhere; }
.assets-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.asset-account { min-width: 0; padding: 18px; border: 1px solid var(--border); border-radius: 10px; background: #fff; }
.asset-account h3 { margin: 0 0 14px; font-size: 16px; overflow-wrap: anywhere; }
.asset-metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 18px; margin: 0; }
.asset-metrics div { min-width: 0; }
.asset-metrics dt { color: var(--muted); font-size: 12px; }
.asset-metrics dd { margin: 4px 0 0; font-size: 17px; font-weight: 650; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.asset-account .button { margin-top: 16px; }
.asset-empty { color: var(--muted); font-size: 13px; }
.eyebrow { display: block; margin-bottom: 8px; color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: .06em; }
.title-line { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.title-line h1 { margin-bottom: 8px; }
.admin-badge, .readonly-badge { display: inline-block; padding: 4px 9px; border: 1px solid var(--border); border-radius: 6px; background: #f8fafc; color: #52647d; font-size: 11px; line-height: 1.5; font-weight: 600; white-space: nowrap; }
.admin-badge { flex: 0 0 auto; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 24px; }
.topbar p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.top-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.button, .back-link { display: inline-flex; align-items: center; justify-content: center; min-height: 42px; padding: 10px 16px; border: 1px solid transparent; border-radius: 8px; font-size: 13px; line-height: 1.5; font-weight: 600; text-decoration: none; }
.button.primary { background: #2563eb; color: #fff; }
.button.primary:hover { background: #1d4ed8; }
.button.ghost, .back-link { border-color: #d8e0ec; background: #fff; color: #40536f; }
.button.ghost:hover, .back-link:hover { background: #f1f5f9; }
.button.danger { background: #bc3535; color: #fff; }
button:disabled { opacity: .55; cursor: not-allowed; }
.is-loading::before { content: ''; display: inline-block; width: 1em; height: 1em; margin-right: 8px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; vertical-align: -.12em; flex-shrink: 0; animation: workbench-spin .8s linear infinite; }
button.is-loading:disabled { opacity: .85; cursor: progress; }
@keyframes workbench-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .is-loading::before { animation: none; } }
.panel { margin-top: 20px; padding: 24px; border: 1px solid var(--border); border-radius: 12px; background: #fff; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.section-description { margin: 5px 0 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.daily-stats-panel { background: transparent; border: 0; padding: 0; }
.daily-stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.metric-card { display: flex; flex-direction: column; min-width: 0; min-height: 108px; padding: 20px 22px; border: 1px solid var(--border); border-radius: 10px; background: #fff; }
.metric-card-link { color: inherit; text-decoration: none; transition: border-color .15s; }
.metric-card-link:hover { border-color: #93b4fc; }
.metric-card span { color: var(--muted); font-size: 13px; }
.metric-card strong { margin-top: 12px; color: #172b4d; font-size: clamp(22px, 2.5vw, 32px); letter-spacing: -.035em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.watch-group + .watch-group,
#booking-groups:not(.empty):not(:empty) ~ #watch-groups:not(.empty):not(:empty) > .watch-group:first-child {
  border-top: 1px solid var(--border);
}
.watch-heading { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 64px; padding: 14px 4px; border: 0; background: transparent; color: #243650; text-align: left; font-size: 14px; font-weight: 650; }
.watch-heading:hover { color: var(--accent); }
.watch-heading strong { min-width: 27px; padding: 3px 8px; border-radius: 6px; background: #eef2f7; color: #52647d; text-align: center; font-size: 12px; font-variant-numeric: tabular-nums; }
.watch-heading::after { content: ''; width: 7px; height: 7px; margin-left: auto; margin-right: 8px; border-right: 1.5px solid #66758c; border-bottom: 1.5px solid #66758c; transform: rotate(45deg); }
.watch-heading[aria-expanded="true"]::after { transform: rotate(225deg); }
.order-list, .daily-order-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.order-list { padding-bottom: 20px; }
.order-list.collapsed { display: none; }
.balance-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.balance-item { min-width: 0; padding: 18px 20px; border: 1px solid var(--border); border-radius: 10px; background: #f8fafc; }
.balance-item > strong { font-size: 14px; }
.balance-metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 18px; }
.balance-metrics span { font-size: 24px; font-weight: 650; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.balance-metrics small { display: block; margin-bottom: 6px; color: var(--muted); font-size: 12px; font-weight: 400; }
.balance-item.failed { background: #fff8f8; border-color: #f0caca; }
.balance-item p { margin: 12px 0 0; color: #b13737; font-size: 12px; }
.balance-list.empty, .watch-groups.empty { display: block; padding: 32px 16px; color: var(--muted); text-align: center; font-size: 14px; }
.workspace-footer { display: flex; justify-content: space-between; padding: 24px 2px 0; color: var(--muted); font-size: 11px; }
.order-filter { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); align-items: end; gap: 16px; padding: 24px; border: 1px solid var(--border); border-radius: 12px; background: #fff; }
.filter-heading { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 2px; }
.filter-heading > span, .summary-note { color: var(--muted); font-size: 12px; }
.order-filter label { display: grid; min-width: 0; gap: 7px; color: #52647d; font-size: 12px; font-weight: 600; }
.order-filter input, .order-filter select { width: 100%; min-width: 0; height: 42px; padding: 0 12px; border: 1px solid #d8e0ec; border-radius: 8px; background-color: #fff; color: #172b4d; font-size: 13px; }
.order-filter input { font-weight: 400; }
input::placeholder { color: #8290a5; }
.order-filter input:focus, .order-filter select:focus { outline: 2px solid #bfdbfe; border-color: #2563eb; }
.advanced-filters { grid-column: 1 / -1; border-top: 1px solid var(--border); }
.advanced-filters summary { padding: 15px 0; color: #40536f; font-size: 13px; font-weight: 600; }
.advanced-filters summary span { color: var(--muted); font-weight: 600; }
.advanced-filter-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; padding: 0 0 8px; }
.filter-actions { grid-column: 1 / -1; display: flex; gap: 10px; }
.detail-summary { margin-bottom: 18px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.detail-loading { grid-column: 1 / -1; margin: 0; padding: 48px 16px; color: var(--muted); font-size: 14px; text-align: center; }
#order-load-more { display: flex; margin: 24px auto 0; min-width: 180px; }
.login-view { min-height: calc(100vh - 112px); display: grid; place-items: center; }
.login-card { width: min(100%, 420px); padding: 36px; border: 1px solid var(--border); border-radius: 16px; background: #fff; box-shadow: 0 12px 40px #172b4d08; }
.login-card .brand-mark { margin-bottom: 24px; width: 42px; height: 42px; }
.login-card .eyebrow { font-size: 11px; letter-spacing: .15em; }
.login-card h1 { margin: 12px 0; font-size: 27px; }
.login-card > p { color: var(--muted); font-size: 14px; line-height: 1.7; }
.login-card form { display: grid; gap: 10px; margin-top: 28px; }
.login-card label { color: #40536f; font-size: 13px; font-weight: 600; }
.login-card input { width: 100%; height: 48px; padding: 0 14px; border: 1px solid #d8e0ec; border-radius: 8px; background: #fff; }
.login-card button { min-height: 48px; margin-top: 6px; border: 0; border-radius: 8px; background: #2563eb; color: #fff; font-weight: 600; }
.dialog-backdrop { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 20px; background: #101d35a6; }
.action-dialog { width: min(100%, 480px); max-height: calc(100dvh - 40px); overflow-y: auto; padding: 24px; border-radius: 14px; background: #fff; box-shadow: 0 20px 60px #0f172a30; }
.action-dialog h2 { margin-bottom: 12px; }
.dialog-message { margin-bottom: 18px; color: var(--muted); font-size: 14px; line-height: 1.7; }
.dialog-details { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 12px 16px; margin: 0 0 18px; padding: 16px; border: 1px solid var(--border); border-radius: 8px; background: #f8fafc; font-size: 13px; }
.dialog-details dt { color: var(--muted); }
.dialog-details dd { margin: 0; overflow-wrap: anywhere; white-space: pre-wrap; }
.dialog-input { display: grid; gap: 8px; margin-bottom: 16px; color: #40536f; font-size: 13px; }
.dialog-input input { width: 100%; height: 46px; padding: 0 12px; border: 1px solid #d8e0ec; border-radius: 8px; }
#assets-withdraw-send-code { margin-bottom: 12px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.ticket-list { display: grid; gap: 10px; }
.ticket-item { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px 12px; padding: 14px; border-radius: 8px; background: #f1f5f9; }
.ticket-item code { font-size: 13px; overflow-wrap: anywhere; }
.ticket-item span:last-child { flex-basis: 100%; color: var(--muted); font-size: 12px; }
.detail-shell #order-detail-content > .panel, .detail-shell .detail-info-grid > .panel { padding: 18px 20px; }
.detail-shell #order-detail-content > .panel { margin-top: 12px; }
.detail-shell .order-detail-card { margin-top: 10px; }
.detail-shell .detail-info-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; margin-top: 12px; }
.detail-shell .detail-info-grid > .panel { margin-top: 0; }
.detail-shell .detail-info-panel h2 { margin: 0 0 10px; }
.detail-shell .detail-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 24px; margin: 0; }
.detail-shell .detail-fact { display: flex; align-items: baseline; gap: 8px; min-width: 0; padding: 4px 0; }
.detail-shell .detail-fact.wide { grid-column: 1 / -1; }
.detail-shell .detail-remarks dd { white-space: pre-wrap; }
.detail-shell .detail-fact dt { flex: 0 0 112px; color: var(--muted); font-size: 12px; }
.detail-shell .detail-fact dd { min-width: 0; margin: 0; color: #172b4d; font-size: 13px; font-weight: 650; line-height: 1.5; overflow-wrap: anywhere; }
.detail-shell .detail-fact.emphasis dd { color: #1d4ed8; font-size: 15px; font-variant-numeric: tabular-nums; }
.detail-shell .detail-fact-copy { margin-left: 8px; padding: 2px 5px; border: 0; border-radius: 4px; background: transparent; color: #315f7c; font-size: 11px; cursor: pointer; }
.detail-shell .detail-fact-copy:hover, .detail-shell .detail-fact-copy:focus-visible { background: #e4eef5; }
.order-log-list { margin-top: 10px; color: var(--muted); font-size: 13px; }
.order-log-item { padding: 7px 0; color: #172b4d; overflow-wrap: anywhere; line-height: 1.5; }
.order-log-item + .order-log-item { border-top: 1px solid #edf0f4; }
.order-log-item time, .order-log-item small { color: var(--muted); font-size: 12px; }
.order-log-item time { margin-right: 12px; white-space: nowrap; }
.order-log-item small { margin-left: 12px; }
.order-log-item p { display: inline; margin: 0 12px 0 0; white-space: pre-wrap; }
.empty-state { margin: 0; padding: 16px 4px; color: var(--muted); font-size: 13px; }
.error-text, .panel-error, .global-error { color: #b13737; font-size: 13px; line-height: 1.6; overflow-wrap: anywhere; }
.panel-error { margin: 14px 0 0; white-space: pre-wrap; }
.error-text:empty, .panel-error:empty, .global-error:empty { display: none; }
.global-error { margin: 18px 0; }
@media (max-width: 900px) {
  .workspace-nav { flex-wrap: wrap; }
  .shell { padding-left: 22px; padding-right: 22px; }
  .order-filter, .advanced-filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .order-list, .daily-order-list { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .detail-shell #order-detail-content > .panel, .detail-shell .detail-info-grid > .panel { padding: 16px; }
  .detail-shell .detail-facts { column-gap: 12px; }
  .detail-shell .detail-fact { display: block; padding: 5px 0; }
  .detail-shell .detail-fact dt { margin-bottom: 2px; }
  .shell { padding-left: 16px; padding-right: 16px; }
  .workspace-nav { align-items: flex-start; flex-direction: column; gap: 14px; padding: 20px 0 12px; margin-bottom: 24px; }
  .nav-links { width: 100%; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; }
  .nav-links a { min-width: 0; padding: 0 9px; font-size: 12px; justify-content: center; }
  .feature-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .feature-card { min-height: 70px; padding: 12px; gap: 9px; }
  .feature-card-icon { width: 34px; height: 34px; flex-basis: 34px; font-size: 14px; }
  .feature-card strong { font-size: 14px; }
  .assets-grid { grid-template-columns: 1fr; }
  .asset-account { padding: 14px; }
  h1 { font-size: 25px; }
  .topbar { align-items: flex-start; flex-wrap: wrap; gap: 14px; }
  .top-actions { gap: 6px; }
  .button, .back-link { padding: 10px 13px; }
  .panel, .order-filter { padding: 18px 16px; }
  .daily-stats-panel { padding: 0; }
  .daily-stats-grid { gap: 8px; }
  .metric-card { min-height: 124px; padding: 14px 10px; }
  .metric-card span { font-size: 11px; }
  .metric-card strong { font-size: 20px; }
  .metric-card small { font-size: 10px; }
  .panel-heading { gap: 8px; }
  .balance-list { grid-template-columns: 1fr; }
  .filter-heading { align-items: flex-start; flex-direction: column; gap: 4px; }
  .summary-note { font-size: 10px; }
  .login-card { padding: 28px; }
  .action-dialog { padding: 20px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
@media (max-width: 600px) {
  .daily-stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric-card { min-height: 110px; padding: 16px; }
  .metric-card strong { font-size: 24px; }
}
