:root{
  --bg:#f4f7fb;
  --panel:#fff;
  --text:#172033;
  --muted:#6b7280;
  --line:#e5e7eb;
  --line-soft:#eef2f7;
  --top:#111827;
  --sidebar:#ffffff;
  --primary:#2563eb;
  --primary-soft:#eef4ff;
  --danger:#dc2626;
  --success:#047857;
  --radius:14px;
  --shadow:0 2px 12px rgba(15,23,42,.05);
  --sidebar-width:232px;
}
*{box-sizing:border-box}
html{min-height:100%;background:var(--bg)}
body{margin:0;font-family:Arial,"Microsoft YaHei",sans-serif;background:var(--bg);color:var(--text);min-height:100vh;-webkit-font-smoothing:antialiased}
button,input,select,textarea{font:inherit}
button{touch-action:manipulation}
.topbar{height:68px;background:var(--top);color:#fff;display:flex;align-items:center;justify-content:space-between;padding:0 22px;position:sticky;top:0;z-index:40;box-shadow:0 1px 0 rgba(255,255,255,.05)}
.topbar-left,.topbar-right{display:flex;align-items:center;gap:14px;min-width:0}
.brand{font-size:18px;font-weight:800;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.sub{font-size:12px;color:#9ca3af;margin-top:3px}
.domain-badge{font-size:12px;color:#cbd5e1;border:1px solid #374151;border-radius:999px;padding:6px 10px;white-space:nowrap}
.menu-toggle{display:none;width:42px;height:42px;border:0;border-radius:10px;background:#1f2937;align-items:center;justify-content:center;flex-direction:column;gap:4px;padding:0;cursor:pointer}
.menu-toggle span{width:18px;height:2px;border-radius:2px;background:#fff;display:block}
.layout{display:grid;grid-template-columns:var(--sidebar-width) minmax(0,1fr);min-height:calc(100vh - 68px)}
.sidebar{background:var(--sidebar);border-right:1px solid var(--line);padding:18px 12px 16px;position:sticky;top:68px;height:calc(100vh - 68px);overflow-y:auto;z-index:35}
.sidebar-mobile-head{display:none}
.nav-section-label{padding:10px 12px 7px;color:#94a3b8;font-size:11px;font-weight:800;letter-spacing:.08em;text-transform:uppercase}
.nav{display:flex;align-items:center;gap:11px;color:#374151;text-decoration:none;padding:11px 12px;border-radius:10px;margin-bottom:5px;font-weight:700;transition:.16s ease}
.nav:hover{background:#f1f5f9;color:#111827}
.nav.active{background:var(--primary-soft);color:#1d4ed8;box-shadow:inset 3px 0 0 #2563eb}
.nav-icon{width:22px;text-align:center;font-size:17px;line-height:1}
.sidebar-foot{margin-top:22px;padding:13px 12px;border-top:1px solid var(--line-soft);color:#64748b}
.sidebar-foot-title{font-size:12px;font-weight:800;margin-bottom:6px;color:#475569}
.sidebar-foot-value{font-size:12px;word-break:break-all;line-height:1.6}
.sidebar-backdrop{display:none}
.content{padding:24px 26px 34px;max-width:1600px;width:100%;min-width:0}
h1{margin:0 0 18px;font-size:25px;line-height:1.25}
h2{margin:0 0 14px;font-size:18px;line-height:1.35}
p{line-height:1.65}
.page-title-row{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;margin-bottom:18px}
.page-title-row h1{margin-bottom:4px}
.page-subtitle{color:var(--muted);font-size:13px;line-height:1.6}
.cards{display:grid;grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:14px;margin-bottom:18px}
.card,.panel{background:var(--panel);border:1px solid var(--line);border-radius:var(--radius);padding:18px;box-shadow:var(--shadow)}
.card span{display:block;color:var(--muted);font-size:13px;margin-bottom:10px}
.card strong{font-size:28px;line-height:1.1}
.stat-card{min-height:108px;display:flex;flex-direction:column;justify-content:center}
.grid2{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px}
.grid3{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:16px}
.dashboard-grid{display:grid;grid-template-columns:minmax(0,1.1fr) minmax(0,.9fr);gap:16px}
.status-row,.kv,.panel-head{display:flex;align-items:center;justify-content:space-between;gap:14px;padding:11px 0;border-bottom:1px solid var(--line-soft)}
.status-row:last-child,.kv:last-child{border-bottom:0}
.status-row small{display:block;color:var(--muted);margin-top:5px}
.status-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
.status-tile{border:1px solid var(--line-soft);border-radius:11px;padding:12px;background:#fafcff}
.status-tile span{display:block;color:var(--muted);font-size:12px;margin-bottom:5px}
.status-tile strong{font-size:14px;word-break:break-word}
.pill{display:inline-flex;align-items:center;padding:6px 10px;border-radius:999px;font-size:12px;font-weight:800;white-space:nowrap}
.pill.open{background:#dcfce7;color:#166534}.pill.closed{background:#fee2e2;color:#991b1b}
.btn{border:1px solid #d1d5db;background:#fff;color:#111827;border-radius:9px;padding:9px 14px;min-height:40px;cursor:pointer;font-weight:700;transition:.15s ease}
.btn:hover{filter:brightness(.985)}
.btn.primary{background:var(--primary);border-color:var(--primary);color:#fff}
.btn.danger{background:var(--danger);border-color:var(--danger);color:#fff}
.btn.ghost{background:transparent;color:#fff;border-color:#4b5563}.btn.compact{min-height:36px;padding:7px 12px}
.wide{width:100%}.stack{display:grid;gap:10px;margin-top:10px}
label{color:#4b5563;font-size:13px;font-weight:600}
input,textarea,select{width:100%;border:1px solid #d1d5db;border-radius:9px;padding:10px 12px;background:#fff;color:#111827;min-height:42px}
input:focus,textarea:focus,select:focus{outline:2px solid rgba(37,99,235,.12);border-color:#60a5fa}
textarea{resize:vertical;min-height:auto}
.two-inputs{display:grid;grid-template-columns:1fr 1fr;gap:12px}.two-inputs label{display:grid;gap:7px}
.manual-buttons{display:flex;gap:10px;margin-top:14px}.manual-buttons form{flex:1}.manual-buttons .btn{width:100%}
.notice,.error{padding:12px 14px;border-radius:10px;margin-bottom:16px;line-height:1.6;word-break:break-word}
.notice{background:#eff6ff;color:#1d4ed8;border:1px solid #dbeafe}.error{background:#fef2f2;color:#b91c1c;border:1px solid #fee2e2}
.muted{color:var(--muted);font-size:13px}.page-head{display:flex;align-items:flex-start;justify-content:space-between;gap:18px;margin-bottom:14px}.page-head h1,.page-head h2{margin-bottom:0}
.search{display:flex;gap:8px;max-width:720px;width:100%;align-items:center}.search input{min-width:180px}.search select{max-width:170px}
.table-wrap{overflow:auto;background:#fff;border:1px solid var(--line);border-radius:var(--radius);box-shadow:var(--shadow);-webkit-overflow-scrolling:touch}
table{width:100%;border-collapse:collapse;min-width:980px}th,td{padding:12px 13px;border-bottom:1px solid var(--line-soft);text-align:left;vertical-align:top}th{background:#f8fafc;font-size:12px;color:#475569;position:sticky;top:0;z-index:1}td{font-size:14px}tr:last-child td{border-bottom:0}
.security-code{font-family:Consolas,monospace;font-weight:800}.empty{text-align:center;color:#94a3b8;padding:30px}.section-title{margin-top:22px}
.login-body{min-height:100vh;display:grid;place-items:center;background:#eef2f7}.login-card{width:min(420px,calc(100% - 30px));background:#fff;border-radius:16px;padding:30px;box-shadow:0 18px 45px rgba(15,23,42,.12)}.login-card h1{margin-bottom:8px}.login-card p{color:var(--muted);margin-top:0;margin-bottom:20px}.login-card input{margin-bottom:12px}
details summary{cursor:pointer;font-weight:800;margin-bottom:8px}
.compact-form{padding-top:10px;margin-top:10px;border-top:1px solid var(--line-soft)}.checkline{display:flex;align-items:center;gap:8px;font-size:14px}.checkline input{width:auto;min-height:0}
.copy-row{display:flex;gap:8px;align-items:center;margin-top:8px}.copy-row code{flex:1;display:block;overflow:auto;padding:11px 12px;border-radius:9px;background:#f3f4f6;font-family:Consolas,monospace}
.qr-wrap{display:flex;justify-content:center;margin:12px 0 18px}.qr-wrap img{max-width:240px;max-height:240px;border:1px solid var(--line);border-radius:12px;background:#fff;padding:8px}
.mini-cards{grid-template-columns:repeat(3,minmax(0,1fr))}.mono{font-family:Consolas,monospace;word-break:break-all}.plus{color:var(--success);font-weight:800}.minus{color:#b91c1c;font-weight:800}.small-error{font-size:12px;margin-top:10px}
.order-cards{margin-top:-2px}.order-search{max-width:800px}.orders-table{min-width:1380px}.order-text{white-space:pre-wrap;word-break:break-word;background:#f8fafc;border:1px solid var(--line-soft);border-radius:8px;padding:9px;margin:0 0 8px;max-width:320px}.original-text{background:#fff7ed;border-color:#fed7aa}.group-box{padding:8px 9px;border-radius:8px;margin-bottom:7px;min-width:240px}.group-ok{background:#f0fdf4}.group-failed{background:#fef2f2}.bet-line{white-space:normal;word-break:break-word;margin-top:5px}.order-actions{min-width:240px}.order-actions details{border-bottom:1px solid var(--line-soft);padding:8px 0}.danger-text{color:#b91c1c}
.desktop-only{display:block}.mobile-only{display:none!important}
.mobile-card-list{display:grid;gap:12px}.mobile-card{background:#fff;border:1px solid var(--line);border-radius:14px;padding:14px;box-shadow:var(--shadow)}.mobile-card-head{display:flex;align-items:flex-start;justify-content:space-between;gap:10px;padding-bottom:10px;border-bottom:1px solid var(--line-soft)}.mobile-card-title{font-weight:800;word-break:break-all}.mobile-card-sub{font-size:12px;color:var(--muted);margin-top:4px}.mobile-kv{display:grid;grid-template-columns:92px 1fr;gap:8px;padding:8px 0;border-bottom:1px solid #f1f5f9;font-size:13px}.mobile-kv:last-child{border-bottom:0}.mobile-kv>span:first-child{color:var(--muted)}.mobile-actions{margin-top:10px}.mobile-actions details{padding:8px 0;border-top:1px solid var(--line-soft)}
.section-tabs{display:flex;gap:8px;overflow:auto;margin:-4px 0 16px;padding-bottom:2px}.section-tab{white-space:nowrap;text-decoration:none;color:#475569;background:#fff;border:1px solid var(--line);padding:8px 12px;border-radius:999px;font-size:13px;font-weight:700}.section-tab:hover{background:#f8fafc}

@media(max-width:1100px){
  :root{--sidebar-width:210px}
  .content{padding:22px 20px}
  .dashboard-grid{grid-template-columns:1fr}
  .status-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
}

@media(max-width:900px){
  body.sidebar-open{overflow:hidden}
  .topbar{height:62px;padding:0 12px}
  .topbar-left{gap:10px}.brand{font-size:16px}.sub{display:none}.domain-badge{display:none}
  .menu-toggle{display:flex}.layout{display:block;min-height:calc(100vh - 62px)}
  .sidebar{position:fixed;left:0;top:0;height:100vh;width:min(82vw,290px);padding:12px 12px 18px;transform:translateX(-105%);transition:transform .2s ease;box-shadow:16px 0 35px rgba(15,23,42,.18);z-index:70;border-right:1px solid var(--line)}
  .sidebar-open .sidebar{transform:translateX(0)}
  .sidebar-backdrop{display:block;position:fixed;inset:0;background:rgba(15,23,42,.46);opacity:0;visibility:hidden;transition:.2s ease;z-index:60}
  .sidebar-open .sidebar-backdrop{opacity:1;visibility:visible}
  .sidebar-mobile-head{display:flex;align-items:center;justify-content:space-between;padding:7px 8px 13px;border-bottom:1px solid var(--line);margin-bottom:8px}.sidebar-close{border:0;background:#f1f5f9;width:38px;height:38px;border-radius:10px;font-size:25px;line-height:1;cursor:pointer;color:#334155}
  .nav{padding:12px;min-height:45px}.sidebar-foot{margin-top:16px}
  .content{padding:16px 13px 28px;max-width:none}
  h1{font-size:22px;margin-bottom:14px}h2{font-size:17px}
  .cards{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}.card,.panel{padding:14px;border-radius:12px}.card strong{font-size:24px}
  .grid2,.grid3{grid-template-columns:1fr}.page-head,.page-title-row{align-items:stretch;flex-direction:column;gap:10px}.search{display:grid;grid-template-columns:1fr;max-width:none}.search select{max-width:none}.search input{min-width:0}
  .two-inputs{grid-template-columns:1fr}.manual-buttons{flex-direction:column}.copy-row{align-items:stretch;flex-direction:column}
  .desktop-only{display:none!important}.mobile-only{display:block!important}
  .table-wrap{border-radius:12px}.mini-cards{grid-template-columns:repeat(3,minmax(0,1fr))}
  .section-title{margin-top:18px}.status-grid{grid-template-columns:1fr 1fr}
}

@media(max-width:560px){
  .topbar-right .btn{padding:7px 10px}.content{padding:13px 10px 24px}.cards{grid-template-columns:1fr 1fr}.card{min-height:92px}.card span{font-size:12px;margin-bottom:7px}.card strong{font-size:21px}.mini-cards{grid-template-columns:repeat(3,minmax(0,1fr));gap:7px}.mini-cards .card{padding:11px;min-height:auto}.mini-cards .card strong{font-size:18px}.status-grid{grid-template-columns:1fr}.mobile-kv{grid-template-columns:82px 1fr}.btn{min-height:43px}.panel-head{align-items:flex-start}.qr-wrap img{max-width:210px;max-height:210px}
}

/* Funds page: keep desktop content compact and readable instead of stretching edge-to-edge. */
.funds-shell{width:100%;max-width:1180px;margin:0 auto}
.funds-orders-table{min-width:1040px}
.funds-orders-wrap th,.funds-orders-wrap td{padding:11px 10px}
.funds-orders-wrap th:nth-child(1){width:235px}
.funds-orders-wrap th:nth-child(2){width:135px}
.funds-orders-wrap th:nth-child(3){width:82px}
.funds-orders-wrap th:nth-child(4){width:175px}
.funds-orders-wrap th:nth-child(5){width:170px}
.funds-orders-wrap th:nth-child(6){width:100px}
.funds-orders-wrap th:nth-child(7){width:118px}
.txid-cell{max-width:170px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;word-break:normal}
.txid-mobile{word-break:break-all}
.funds-action-cell{min-width:118px}
.topup-details{min-width:100px}
.topup-details>summary{list-style:none;display:inline-flex;align-items:center;justify-content:center;margin:0}
.topup-details>summary::-webkit-details-marker{display:none}
.topup-details[open]{min-width:300px}
.topup-form{min-width:280px;max-width:360px;margin-top:8px}
@media(max-width:900px){
  .funds-shell{max-width:none}
  .topup-details[open],.topup-form{min-width:0;max-width:none;width:100%}
}

/* Post-STEP10 order management: one compact record per order, no duplicate desktop/mobile blocks. */
.order-compact-list{display:grid;gap:8px}
.order-compact-row{display:grid;grid-template-columns:minmax(180px,1.05fr) minmax(120px,.7fr) minmax(260px,2.3fr) minmax(78px,.55fr) minmax(250px,1.45fr);gap:10px;align-items:start;background:#fff;border:1px solid var(--line);border-radius:12px;padding:11px 12px;box-shadow:var(--shadow);min-width:0}
.order-compact-row.is-cancelled{background:#fffafa}
.order-compact-row>div{min-width:0}
.order-no{font-size:13px;margin-bottom:4px}.order-lottery-col{display:grid;gap:7px}.order-term-mini{font-size:11px;white-space:pre-line;color:#64748b;line-height:1.45}
.order-content-label{font-size:11px;color:#64748b;font-weight:700;margin-bottom:4px}.order-content-text{margin:0;white-space:pre-wrap;word-break:break-word;font:inherit;line-height:1.45;max-height:92px;overflow:auto;background:#f8fafc;border:1px solid #eef2f7;border-radius:7px;padding:7px 8px}.original-mini{margin-top:6px;background:#fff7ed}.order-mini-detail{margin-top:5px}.order-mini-detail>summary{font-size:12px;color:#2563eb;margin:0;font-weight:700}
.order-parse-compact{display:grid;gap:5px;margin-top:6px}.parse-line{display:grid;gap:2px;background:#f0fdf4;border-radius:7px;padding:6px 7px;font-size:12px}.parse-line.failed{background:#fef2f2}.parse-line small{color:#64748b}
.order-amount-col{display:grid;gap:4px;text-align:right}.order-amount-col span{font-size:11px;color:#64748b}.order-amount-col strong{font-size:17px;font-variant-numeric:tabular-nums}
.order-side-col{display:grid;gap:7px}.order-current-state{display:flex;gap:6px;align-items:center;flex-wrap:wrap;justify-content:flex-end}.order-count-badge{font-size:11px;background:#f1f5f9;border-radius:999px;padding:4px 7px;color:#475569}
.order-history{display:grid;gap:3px}.order-history-line{display:grid;grid-template-columns:auto auto 1fr;gap:5px;align-items:center;font-size:11px;border-left:3px solid #cbd5e1;padding:3px 5px;background:#f8fafc;border-radius:4px}.order-history-line strong{white-space:nowrap}.order-history-line span{color:#64748b}.order-history-line time{text-align:right;color:#94a3b8;white-space:nowrap}.order-history-line.action-cancel{border-left-color:#ef4444}.order-history-line.action-edit{border-left-color:#3b82f6}.order-history-line.action-correct{border-left-color:#f59e0b}
.order-action-tools{display:flex;gap:6px;justify-content:flex-end;flex-wrap:wrap}.order-action-tools>details{position:relative}.order-action-tools>details>summary{list-style:none;margin:0;border:1px solid #d7dee8;border-radius:7px;padding:5px 8px;font-size:12px;background:#fff;white-space:nowrap}.order-action-tools>details>summary::-webkit-details-marker{display:none}.order-action-tools>details[open]{flex-basis:100%}.order-action-tools .compact-form{margin-top:5px;padding:8px;background:#f8fafc;border:1px solid #e2e8f0;border-radius:8px}.order-action-tools textarea,.order-action-tools input{font-size:12px;padding:7px 8px;min-height:34px}
@media(max-width:1180px){.order-compact-row{grid-template-columns:minmax(170px,1fr) minmax(110px,.7fr) minmax(230px,1.8fr) minmax(70px,.5fr) minmax(230px,1.3fr)}}
@media(max-width:900px){.order-compact-row{grid-template-columns:1fr 1fr}.order-content-col,.order-side-col{grid-column:1/-1}.order-amount-col{text-align:left}.order-current-state,.order-action-tools{justify-content:flex-start}.order-history-line time{text-align:left}.order-history-line{grid-template-columns:auto auto 1fr}}
@media(max-width:560px){.order-compact-row{grid-template-columns:1fr}.order-content-col,.order-side-col{grid-column:auto}.order-history-line{grid-template-columns:auto 1fr}.order-history-line time{grid-column:1/-1}.order-action-tools>details{width:100%}.order-action-tools>details>summary{width:100%}}
