:root {
  --bg: #f3f6fb;
  --panel: #ffffff;
  --text: #182032;
  --muted: #6f7a8d;
  --border: #dce3ee;
  --primary: #146ef5;
  --primary-dark: #0e56c6;
  --danger: #d9363e;
  --success: #15855b;
  --warning: #b56b00;
  --shadow: 0 10px 30px rgba(32, 52, 84, .08);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, textarea, select { font: inherit; }
code { font-family: "Cascadia Mono", "SFMono-Regular", Consolas, monospace; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 250px minmax(0, 1fr); }
.sidebar { background: #101a2d; color: white; padding: 24px 18px; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; gap: 12px; align-items: center; padding: 0 8px 24px; border-bottom: 1px solid rgba(255,255,255,.1); }
.brand-mark, .login-logo { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; font-weight: 900; color: white; background: linear-gradient(135deg, #1476ff 0 48%, #ed1212 50%); box-shadow: inset 0 0 0 2px rgba(255,255,255,.25); }
.brand strong { display: block; font-size: 18px; }
.brand span { display: block; font-size: 12px; opacity: .65; margin-top: 4px; }
.nav { display: grid; gap: 7px; margin-top: 24px; }
.nav a { color: rgba(255,255,255,.78); padding: 11px 13px; border-radius: 10px; font-weight: 650; }
.nav a:hover, .nav a.active { color: #fff; background: rgba(49, 126, 255, .2); text-decoration: none; }
.sidebar-foot { margin-top: auto; font-size: 12px; color: rgba(255,255,255,.58); display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 16px 8px 0; border-top: 1px solid rgba(255,255,255,.1); }
.link-button { border: 0; background: transparent; color: #8bb8ff; cursor: pointer; padding: 0; }

.main { min-width: 0; padding: 28px 34px 50px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.topbar h1 { margin: 0; font-size: 27px; }
.topbar p { margin: 7px 0 0; color: var(--muted); }
.panel { background: var(--panel); border: 1px solid var(--border); border-radius: 15px; box-shadow: var(--shadow); padding: 20px; margin-bottom: 20px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 16px; }
.panel-head h2, .panel h2 { margin: 0; font-size: 18px; }
.notice-panel { color: #43506a; line-height: 1.75; }
.notice-panel p { margin: 0; }

.stats-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 16px; margin-bottom: 20px; }
.stat-card { background: var(--panel); border: 1px solid var(--border); border-radius: 15px; padding: 19px; box-shadow: var(--shadow); border-left: 4px solid #8ba2c6; }
.stat-card span, .stat-card small { display: block; color: var(--muted); }
.stat-card strong { display: block; font-size: 25px; margin: 9px 0 6px; }
.stat-card.attention { border-left-color: #e39716; }
.stat-card.danger { border-left-color: var(--danger); }
.stat-card.ok { border-left-color: var(--success); }
.two-column { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 20px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 12px; color: var(--muted); letter-spacing: .03em; background: #f7f9fc; }
th, td { padding: 12px 11px; border-bottom: 1px solid #edf1f6; vertical-align: top; }
tbody tr:hover { background: #fafcff; }
.empty { text-align: center; color: var(--muted); padding: 36px; }
.address-code { display: inline-block; max-width: 330px; overflow-wrap: anywhere; }
.small-note { margin-top: 7px; color: var(--muted); font-size: 12px; max-width: 300px; overflow-wrap: anywhere; }

.status { display: inline-flex; align-items: center; border-radius: 999px; padding: 4px 8px; font-size: 12px; font-weight: 700; background: #eef2f8; color: #516075; }
.status.pending { background: #fff4d8; color: #956100; }
.status.paid, .status.approved, .status.exhausted { background: #e1f7ee; color: #08724b; }
.status.rejected, .status.expired { background: #ffe5e7; color: #aa2630; }
.status.active { background: #e6f0ff; color: #145dc2; }
.status.none { background: #eef2f8; color: #657188; }

.button { border: 1px solid transparent; border-radius: 9px; padding: 10px 15px; display: inline-flex; justify-content: center; align-items: center; font-weight: 720; cursor: pointer; text-decoration: none; transition: .15s ease; }
.button:hover { text-decoration: none; transform: translateY(-1px); }
.button.primary { background: var(--primary); color: white; }
.button.primary:hover { background: var(--primary-dark); }
.button.secondary { background: white; color: #3d4b63; border-color: var(--border); }
.button.danger { background: var(--danger); color: white; }
.button.compact { padding: 7px 10px; font-size: 12px; }
.button.full { width: 100%; }

.flash { padding: 13px 15px; border-radius: 10px; margin-bottom: 18px; border: 1px solid; }
.flash.success { background: #e9f8f1; color: #0b6d49; border-color: #bfe8d5; }
.flash.error { background: #fff0f1; color: #a32630; border-color: #f3c6ca; }

.settings-form { padding-bottom: 70px; }
.form-section { padding: 24px; }
.form-grid { display: grid; gap: 16px; }
.form-grid.two { grid-template-columns: repeat(2, minmax(0,1fr)); }
.form-grid.three { grid-template-columns: repeat(3, minmax(0,1fr)); }
.span-2 { grid-column: 1 / -1; }
.stack-form { display: grid; gap: 16px; }
label { display: grid; gap: 7px; font-size: 14px; font-weight: 680; color: #344158; }
input, textarea, select { width: 100%; border: 1px solid #cfd8e6; background: white; color: var(--text); border-radius: 9px; padding: 10px 11px; outline: none; }
input:focus, textarea:focus, select:focus { border-color: #6ba3f8; box-shadow: 0 0 0 3px rgba(20,110,245,.11); }
textarea { resize: vertical; }
label small, .field-help { color: var(--muted); font-size: 12px; font-weight: 400; line-height: 1.55; }
.check-row { display: flex; flex-direction: row; align-items: center; gap: 9px; font-weight: 550; }
.check-row input { width: auto; }
.sticky-actions { position: sticky; bottom: 18px; display: flex; justify-content: flex-end; pointer-events: none; }
.sticky-actions .button { pointer-events: auto; box-shadow: 0 8px 25px rgba(20,110,245,.27); }

.menu-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 16px; }
.menu-card { display: grid; gap: 13px; margin: 0; }
.reply-button-card { display: grid; gap: 14px; min-width: 0; margin: 0; padding: 16px; border: 1px solid var(--border); border-radius: 10px; }
.reply-button-card legend { padding: 0 6px; font-size: 14px; font-weight: 700; }
.menu-position, .menu-action { font-size: 12px; color: var(--muted); }
.search-row { display: grid; grid-template-columns: minmax(220px, 1fr) auto auto; gap: 10px; margin-bottom: 20px; }
.pagination { display: flex; justify-content: center; gap: 20px; align-items: center; padding-top: 18px; color: var(--muted); }
.detail-list { margin: 0; display: grid; gap: 0; }
.detail-list div { display: grid; grid-template-columns: 120px 1fr; gap: 14px; padding: 11px 0; border-bottom: 1px solid #edf1f6; }
.detail-list dt { color: var(--muted); }
.detail-list dd { margin: 0; overflow-wrap: anywhere; }
.positive { color: var(--success); font-weight: 700; }
.negative { color: var(--danger); font-weight: 700; }
.filter-tabs { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.filter-tabs a { background: white; border: 1px solid var(--border); border-radius: 999px; padding: 8px 14px; color: #4d5a70; }
.filter-tabs a.active { background: var(--primary); color: white; border-color: var(--primary); text-decoration: none; }
.action-details { margin-top: 8px; }
.action-details summary { color: var(--primary); cursor: pointer; font-weight: 700; }
.mini-form { display: grid; gap: 7px; margin-top: 10px; min-width: 230px; }
.reject-form { padding-top: 10px; border-top: 1px solid var(--border); }

.login-body { min-height: 100vh; display: grid; place-items: center; padding: 22px; background: radial-gradient(circle at top, #dceaff, var(--bg) 50%); }
.login-card { width: min(410px, 100%); background: white; border: 1px solid var(--border); border-radius: 20px; box-shadow: 0 24px 70px rgba(24, 48, 83, .15); padding: 34px; text-align: center; }
.login-logo { margin: 0 auto 16px; width: 58px; height: 58px; font-size: 22px; }
.login-card h1 { margin: 0; font-size: 26px; }
.login-card > p { margin: 8px 0 25px; color: var(--muted); }
.login-card form { text-align: left; }

@media (max-width: 1050px) {
  .stats-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .form-grid.three { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 820px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  .nav { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .sidebar-foot { margin-top: 20px; }
  .main { padding: 22px 16px 40px; }
  .two-column, .menu-grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .stats-grid, .form-grid.two, .form-grid.three { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .nav { grid-template-columns: 1fr; }
  .topbar { align-items: flex-start; }
  .topbar .button { display: none; }
  .search-row { grid-template-columns: 1fr; }
  .panel { padding: 15px; }
}
/* Group trade animation preview. */
.trade-animation-preview { display: block; width: min(100%, 640px); height: auto; margin: 16px 0; border-radius: 10px; }
