/* Shared brand colors; status and draw-result colors retain their meaning. */
:root{--primary:#a61b29;--primary-hover:#861622;--primary-soft:#fbefed;--primary-border:#e5b7ae;--focus-ring:#c9695b;--surface-warm:#f8f5f0;--gold:#94703b}
:root{font-family:"PingFang SC","Microsoft YaHei",sans-serif;color:#26323a;background:var(--surface-warm);font-synthesis:none;--blue:var(--primary);--line:#e8ddd5;--muted:#80746c}*{box-sizing:border-box}body{margin:0}button,input,select,textarea{font:inherit}button{cursor:pointer}button:disabled{cursor:not-allowed;opacity:.48}button{border:1px solid var(--line);border-radius:6px;padding:9px 15px;background:#fff;color:inherit}button:hover:not(:disabled){filter:brightness(.97)}button:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible{outline:3px solid var(--focus-ring);outline-offset:2px}input,select,textarea{width:100%;min-height:42px;border:1px solid #d9cdc6;border-radius:6px;background:#fff;color:#26323a;padding:10px 12px}input::placeholder,textarea::placeholder{color:#959ca3}textarea{resize:vertical}input[type=checkbox]{width:17px;min-height:17px;height:17px;accent-color:var(--primary);vertical-align:middle;margin:0 6px 0 0}.app-header{height:88px;background:#a61b29;color:#fff7ed;padding:0 22px;display:flex;align-items:center;justify-content:space-between;border-bottom:4px solid #fff}.brand{font-size:29px;letter-spacing:2px}.icon{border:0;background:transparent;color:white;font-size:35px;padding:4px 12px;line-height:1.2}.dark{color:#75818b}.workspace{max-width:1120px;margin:auto}.main-tabs{display:flex;padding:10px 6px 8px;border-top:4px solid var(--primary);border-bottom:1px solid var(--line);gap:4px}.main-tabs button{flex:1;border:0;background:transparent;color:#8b969e;font-size:19px;padding:14px 3px;position:relative;white-space:nowrap}.main-tabs .active{background:var(--primary-soft);color:var(--primary);font-weight:700}.main-tabs .active:after{content:"";height:3px;background:var(--primary);border-radius:4px;position:absolute;bottom:0;left:20%;right:20%}.markets{display:flex;gap:7px;padding:12px 6px 0}.markets button{flex:1;padding:13px 0;font-size:18px;color:#89949b;border-radius:8px 8px 0 0;border-bottom:0}.markets .active{background:var(--primary-soft);color:var(--primary);border:1px solid var(--primary);border-bottom:0;font-weight:700}.period{margin:11px 6px 0;padding:11px 4px;border:1px solid var(--line);border-radius:8px;background:var(--surface-warm);display:flex;justify-content:center;gap:8px;color:#89939c;font-size:15px;align-items:center}.period strong{color:var(--primary);letter-spacing:1px}.period span{height:22px;border-left:1px solid var(--line);margin:0 3px}.preview-notice{margin:0;padding:9px 15px;color:#7e8995;font-size:12px;border-bottom:1px solid var(--line)}main{padding:12px 8px 100px}.panel{background:white;border:1px solid var(--line);border-radius:12px;padding:18px;margin-bottom:14px;box-shadow:0 2px 3px #28385505}h1,h2,h3,p{margin-top:0}h1{font-size:21px;margin-bottom:18px}h2{font-size:18px;margin-bottom:16px}h3{font-size:15px}p{line-height:1.65}.muted,.hint{color:var(--muted);font-size:13px}.hint{margin:7px 0 0;line-height:1.7}.row{display:flex;align-items:center;gap:10px;flex-wrap:wrap}.between{justify-content:space-between}.primary{background:var(--primary);border-color:var(--primary);color:white}.success{background:#05996d;border-color:#05996d;color:white}.text-button{color:var(--primary);border:0;background:transparent;padding:5px}.danger{color:#ca5a5a;border-color:#efbdbd;background:#fff5f5}.segmented{display:flex;margin-top:18px}.segmented button{border-radius:0;min-width:86px}.segmented button:first-child{border-radius:6px 0 0 6px}.segmented button:last-child{border-radius:0 6px 6px 0}.segmented .active{background:var(--primary);color:white;border-color:var(--primary)}.tools{display:flex;flex-wrap:wrap;gap:7px}.tools input{width:115px}.tools button{padding:8px 10px}.table-wrap{overflow-x:auto;margin-top:18px}table{border-collapse:collapse;width:100%;font-size:15px}th,td{padding:10px 8px;border:1px solid var(--line);text-align:center;white-space:nowrap}th{font-weight:500;background:var(--surface-warm);color:#76828d}.empty{padding:40px 14px;text-align:center;color:#909ba5;font-size:14px;line-height:1.9}.empty-symbol{font-size:28px;color:#c5aa93;margin-bottom:8px}.badges{display:flex;gap:9px;align-items:center;flex-wrap:wrap}.badge{border:1px solid var(--primary-border);border-radius:7px;background:var(--primary-soft);color:var(--primary);padding:8px 12px;font-size:15px}.badge.purple{background:#f7f2ff;color:#a08ad7;border-color:#d7cbee}.badge.green{background:#eefbf4;color:#30965a;border-color:#75bf95}.section-heading{display:flex;justify-content:space-between;align-items:center;gap:8px;margin-bottom:12px}.section-heading h2{margin:0}.quick-input{height:135px;margin-bottom:12px}.floating{position:fixed;width:59px;height:59px;border:0;border-radius:50%;background:var(--primary);color:white;box-shadow:0 8px 20px #a61b2930;font-size:25px;z-index:12}.agents-toggle{left:18px;bottom:24px}.help-toggle{right:18px;bottom:24px;font-size:32px}.settings-menu{position:absolute;right:max(8px,calc((100vw - 1120px)/2));top:157px;width:185px;background:white;padding:8px 0;border-radius:6px;box-shadow:0 7px 25px #192b4526;z-index:20}.settings-menu button{display:block;width:100%;text-align:left;border:0;border-radius:0;padding:12px 18px;background:white}.settings-menu button:last-child{border-top:1px solid var(--line);color:#c8554b}.drawer{margin:0;padding:0;border:0;position:fixed;top:88px;left:0;height:calc(100dvh - 88px);max-height:none;width:min(72vw,380px);max-width:none;background:#fff;box-shadow:4px 0 20px #0001}.drawer::backdrop{background:#18202b66}.drawer-head{padding:20px 12px 8px;display:flex;align-items:center;justify-content:space-between;background:var(--surface-warm)}.drawer-head>.text-button{font-size:20px;font-weight:700}.count{border-radius:20px;background:var(--surface-warm);padding:3px 9px;color:#7e8c97}.drawer-search{padding:10px 18px 20px;background:var(--surface-warm);border-bottom:1px solid var(--line)}#agent-list{padding:18px}.agent-card{display:flex;align-items:center;padding:14px 10px;border:1px solid var(--line);border-radius:10px;margin-bottom:13px;gap:10px}.agent-card.selected{background:var(--primary-soft);border-color:var(--primary-border)}.agent-card .select-agent{border:0;background:transparent;flex:1;text-align:left;padding:3px;overflow-wrap:anywhere;min-width:0}.avatar{width:40px;height:40px;flex-shrink:0;display:grid;place-items:center;border-radius:50%;background:var(--primary-soft);color:var(--primary);font-weight:700}.edit-agent{padding:8px;color:#768592;border:0;background:transparent}.drawer-note{color:#8d98a2;font-size:12px;padding:0 20px}.form-panel{max-width:780px;margin:auto;background:#fff;padding:22px 20px;border-radius:10px}.field{display:block;margin:20px 0}.field>span{display:block;font-size:14px;margin-bottom:9px;font-weight:500}.input-row{display:flex;align-items:center;gap:6px}.input-row input{min-width:0}.input-row button{flex-shrink:0;font-size:13px}.form-section{padding:20px 0 5px;border-top:1px solid var(--line);margin-top:22px}.form-section h2{font-size:16px}.permission-toolbar{display:flex;align-items:center;gap:7px;flex-wrap:wrap}.permission-toolbar button{font-size:12px;padding:5px}.rate-group{margin:22px 0}.rate-group h3{background:var(--surface-warm);padding:10px;font-size:14px;color:#6e7c87;font-weight:500;margin:0}.rate-table{table-layout:fixed;font-size:12px}.rate-table th,.rate-table td{border:0;border-bottom:1px solid var(--line);padding:8px 3px;white-space:normal}.rate-table th{font-size:11px;background:white;color:#8d969d}.rate-table th:first-child{width:28%}.rate-table input[type=number]{min-height:32px;padding:5px 4px;font-size:12px;width:100%;text-align:center}.rate-pair{display:flex;gap:3px;align-items:center;margin-bottom:4px}.rate-pair:last-child{margin-bottom:0}.rate-pair span{font-size:10px;color:#939aa3}.rate-table label{display:flex;align-items:center;gap:2px;text-align:left}.rate-table input[type=checkbox]{flex-shrink:0;width:15px;height:15px;margin:0 4px}.save-bar{padding:14px 0}.save-bar button{width:100%;padding:12px}.permissions-note{background:var(--surface-warm);padding:16px;font-size:12px;color:#7b858f}.permissions-note ul{padding-left:18px;line-height:1.9}.rules-row{display:grid;grid-template-columns:1fr 1fr auto;gap:6px;padding:10px 0}.rules-row input{min-width:0;font-size:12px}.rules-row button{padding:6px}.form-error{border:1px solid #efb1b1;background:#fff0f0;color:#b34444;padding:12px;line-height:1.7;font-size:13px}.info-dialog{border:0;border-radius:12px;padding:25px;max-width:calc(100vw - 40px);width:390px;color:#344252}.info-dialog::backdrop{background:#18202b66}.info-dialog p{color:#73808e;font-size:14px}.info-dialog button{width:100%}#toast{position:fixed;left:50%;top:24px;transform:translateX(-50%);padding:12px 20px;background:#effbea;border:1px solid #d6ebca;color:#548844;z-index:100;border-radius:7px;max-width:90vw;font-size:14px;width:max-content}.selection-note{font-size:12px;margin:0 0 12px;color:#6d819a}.search-row{display:flex;gap:7px}.search-row input{min-width:0}.search-row button{white-space:nowrap}.login-panel{max-width:420px;margin:80px auto;padding:40px 25px;background:var(--primary-soft);border:1px solid white;box-shadow:0 15px 60px #a61b291a;border-radius:25px}.login-logo{display:grid;place-items:center;background:var(--primary);color:white;font-size:52px;border:12px solid white;border-radius:27px;width:88px;height:88px;margin:0 auto 30px;font-weight:bold}.login-panel button{width:100%;padding:15px;margin-top:15px;background:linear-gradient(110deg,var(--primary-hover),var(--primary));color:white;border:0;border-radius:18px}.login-panel input{padding:16px;border-radius:16px}.login-panel .hint{text-align:center}.summary{display:grid;grid-template-columns:1fr 1fr;gap:12px;background:var(--surface-warm);padding:15px;color:#737f8b}@media(min-width:760px){.app-header{padding-left:max(25px,calc((100vw - 1080px)/2));padding-right:max(25px,calc((100vw - 1080px)/2))}main{padding:22px 18px 100px}.dashboard-grid{display:grid;grid-template-columns:300px 1fr;gap:18px;align-items:start}.main-tabs button{padding:17px}.settings-menu{top:164px}.form-panel{padding:30px 35px}.rate-table{font-size:14px}.rate-table input[type=number]{font-size:14px}.floating.agents-toggle{left:max(18px,calc((100vw - 1230px)/2))}}@media(max-width:370px){.main-tabs button{font-size:16px}.panel{padding:12px}.period{font-size:12px}.form-panel{padding:18px 10px}.badge{padding:7px}.drawer{width:85vw}}@media(prefers-reduced-motion:no-preference){.panel,.form-panel{animation:appear .18s ease-out}@keyframes appear{from{opacity:.5;transform:translateY(4px)}to{opacity:1;transform:translateY(0)}}}

/* Compact editor on mobile; a workspace and permanent navigation on desktop. */
.editor-heading{display:flex;justify-content:space-between;align-items:center;gap:16px;margin-bottom:22px}.editor-heading h1{margin:5px 0 8px;font-size:25px}.editor-heading p{margin-bottom:0}.eyebrow{font-size:12px;color:#8590a1}.editor-heading>button{flex-shrink:0;font-size:13px}.profile-fields,.rates-editor{min-width:0}.profile-fields h2{font-size:16px}.advanced-fields{border-top:1px solid var(--line);margin-top:22px;padding-top:16px}.advanced-fields summary{cursor:pointer;font-size:14px;font-weight:500}.advanced-fields summary span{float:right;font-size:12px;color:#98a1ae}.advanced-fields .field{margin:17px 0}.rates-editor{margin-top:25px}.rates-editor>.section-heading{align-items:flex-start}.rates-editor h2{font-size:18px}.batch-panel{padding:16px;background:var(--primary-soft);border:1px solid var(--primary-border);border-radius:8px;margin-bottom:18px}.batch-heading{display:flex;align-items:center;gap:12px;flex-wrap:wrap;margin-bottom:12px;font-size:13px}.batch-heading span{color:#8590a1;font-size:12px}.batch-controls{display:grid;grid-template-columns:1fr 1fr;gap:10px;align-items:end}.batch-controls label{font-size:12px;color:#68768a;min-width:0}.batch-controls input,.batch-controls select{display:block;margin-top:6px;min-height:36px;font-size:13px;padding:8px;min-width:0}.batch-controls>label:first-child{grid-column:1/-1}.batch-controls>button{grid-column:1/-1}.rate-tabs{display:flex;border-bottom:1px solid var(--line);overflow-x:auto;gap:4px}.rate-tabs button{flex-shrink:0;background:none;border:0;border-radius:0;padding:12px 11px;font-size:13px;color:#788599;border-bottom:2px solid transparent}.rate-tabs button[aria-selected=true]{color:var(--primary);border-bottom-color:var(--primary);font-weight:600}.permission-toolbar{padding:12px 0;border-bottom:1px solid var(--line);gap:10px}.permission-toolbar>span{font-size:12px;color:#8c98a8;margin-right:auto}.rate-group{margin:0}.rate-group[hidden]{display:none}.rate-table th{padding-top:14px;padding-bottom:14px}.rate-table td{padding:8px 4px}.rate-table input[type=number]{min-height:34px;color:#374860}.rate-table input:disabled{background:#f3f5f8;color:#9ca6b2}.rate-pair{min-width:0;flex:1;margin:0}.rate-pair span{min-width:10px}.rate-values{display:flex;flex-direction:column;gap:6px}.save-bar{position:sticky;bottom:0;z-index:10;background:#fff;border-top:1px solid var(--line);margin-top:24px;padding:16px 0;display:flex;align-items:center;justify-content:space-between;gap:12px}.save-bar>span{font-size:12px;color:#8793a3}.save-bar button{width:auto;min-width:140px;font-size:14px;flex-shrink:0}.form-error{margin-bottom:20px}.error-text{color:#c23e3e!important}.profile-fields .input-row input{font-size:13px}.profile-fields .input-row button{padding:5px}.form-panel{max-width:none}.rates-editor .rate-table th:first-child{width:30%}
@media(min-width:1000px){
 body{background:var(--surface-warm);font-size:14px}.app-header{height:64px;position:fixed;inset:0 0 auto;z-index:30;padding:0 28px;border:0;background:#a61b29}.brand{font-size:23px;letter-spacing:3px}.brand:after{content:"业务管理工作台";font-size:12px;color:#f4d6c9;border-left:1px solid #ffffff45;margin-left:24px;padding-left:24px;letter-spacing:1px}.app-header .icon{font-size:27px}.workspace{max-width:none;margin:64px 0 0 200px;padding:24px 32px 0;display:grid;grid-template-columns:minmax(310px,1fr) auto;align-items:start;column-gap:20px}.main-tabs{position:fixed;left:0;top:64px;bottom:0;width:200px;background:#fff;border:0;border-right:1px solid var(--line);display:flex;flex-direction:column;padding:28px 15px;gap:8px;z-index:15}.main-tabs:before{content:"工作空间";padding:0 17px 15px;font-size:11px;letter-spacing:2px;color:#a0a8b7}.main-tabs button{flex:none;display:flex;align-items:center;gap:15px;text-align:left;font-size:14px;padding:14px 16px;color:#6f7c90;border-radius:7px}.main-tabs button:before{font-size:18px;font-weight:400;color:#97a5bb;content:"▦"}.main-tabs button:nth-child(2):before{content:"♙"}.main-tabs button:nth-child(3):before{content:"☷"}.main-tabs button:nth-child(4):before{content:"◉"}.main-tabs #settings:before{content:"⚙"}.main-tabs button[data-tab="wechat"]:before{content:"☏"}.main-tabs .active{background:var(--primary-soft);color:var(--primary)}.main-tabs .active:before{color:var(--primary)}.main-tabs .active:after{display:none}.markets{padding:0;gap:5px;justify-self:start;background:var(--surface-warm);border-radius:7px;padding:4px;min-width:310px}.markets button{border:0;border-radius:5px;font-size:13px;min-width:96px;padding:9px 16px;background:transparent;color:#79879c}.markets .active{border:0;background:white;color:var(--primary);box-shadow:0 1px 5px #384d7110}.period{margin:0;padding:10px 14px;border:0;background:var(--surface-warm);font-size:12px;white-space:nowrap}.period span{height:18px}.preview-notice{grid-column:1/-1;border:0;padding:11px 0;color:#94a0b0}main{grid-column:1/-1;padding:10px 0 35px;min-width:0}.panel{border:1px solid var(--line);border-radius:9px;box-shadow:none;padding:24px}.dashboard-grid{grid-template-columns:240px minmax(0,1fr);gap:20px}.dashboard-grid>.panel:last-child{min-height:480px}.dashboard-grid .empty{padding:100px 14px}.tools{gap:8px}.tools input{width:130px}.empty{font-size:14px}.form-panel{padding:0;border-radius:0;background:transparent}.editor-heading{margin-bottom:24px}.editor-heading h1{font-size:26px}.editor-heading .muted{font-size:13px}#agent-form{min-width:0}.editor-columns{display:grid;grid-template-columns:280px minmax(0,1fr);gap:22px;align-items:start}.profile-fields{padding:22px;background:white;border:1px solid var(--line);border-radius:9px}.profile-fields>.field{margin:18px 0}.profile-fields>.field:last-child{margin-bottom:0}.profile-fields input{min-height:38px;font-size:13px}.profile-fields .hint{font-size:11px;line-height:1.8}.rates-editor{margin:0;padding:22px;background:white;border:1px solid var(--line);border-radius:9px}.batch-panel{padding:13px}.batch-controls{grid-template-columns:repeat(4,minmax(0,1fr)) auto;gap:8px}.batch-controls>label:first-child{grid-column:1/-1;display:flex;gap:14px;align-items:center}.batch-controls select{width:180px;margin:0}.batch-controls>button{grid-column:auto;padding:8px 15px;min-height:36px}.rate-table{font-size:13px}.rate-table input[type=number]{font-size:13px;max-width:140px}.rate-table td{padding:7px 8px}.rate-table th:first-child{width:28%}.rate-table th{font-size:12px;text-align:left;padding-left:8px;background:var(--surface-warm)}.rate-values{flex-direction:row;gap:10px}.rate-pair{max-width:155px}.rate-pair span{font-size:11px}.rate-table label{white-space:nowrap}.rate-table input[type=checkbox]{margin-right:9px}.rate-tabs button{font-size:13px;padding:12px 14px}.save-bar{border:1px solid var(--line);border-radius:8px;padding:14px 22px;bottom:12px;box-shadow:0 4px 16px #2739560a}.save-bar button{min-width:160px;padding:10px 22px}.settings-menu{position:fixed;left:200px;right:auto;top:310px;width:190px;z-index:35}.floating.agents-toggle{left:15px;bottom:22px;width:170px;height:42px;border-radius:7px;box-shadow:none;font-size:14px;z-index:20}.agents-toggle:before{content:"业务员列表 · ";font-size:13px}.help-toggle{height:43px;width:43px;right:13px;bottom:18px;box-shadow:0 4px 14px #a61b291a}.help-toggle svg{width:23px;height:23px}.drawer{top:64px;height:calc(100dvh - 64px);width:380px}.drawer-head>.text-button{font-size:18px}.drawer-search input{font-size:14px}.summary{grid-template-columns:repeat(4,1fr);margin-top:18px}.search-row input{max-width:500px}main[data-page=details]>.panel:first-child .row select{width:200px}main[data-page=agents]{display:grid;grid-template-columns:minmax(0,1fr) 330px;gap:20px}main[data-page=agents]>.panel:first-child{grid-column:1/-1;margin:0}main[data-page=agents]>.panel:nth-child(2){min-height:330px}main[data-page=agents]>.panel:nth-child(3) .section-heading{flex-wrap:wrap;gap:16px}main[data-page=agents] .quick-input{height:170px}
}
@media(min-width:1500px){.workspace{padding-left:40px;padding-right:40px}.editor-columns{grid-template-columns:320px minmax(0,1fr)}.batch-controls{grid-template-columns:180px repeat(4,minmax(80px,1fr)) auto}.batch-controls>label:first-child{display:block;grid-column:auto}.batch-controls select{width:100%;margin-top:6px}.rates-editor{padding:26px}.rate-table td{padding:9px 12px}.rate-table th{padding-left:12px}.rate-table input[type=number]{max-width:180px}.rate-pair{max-width:195px}}
@media(max-width:999px){.editor-heading h1{font-size:22px}.save-bar{bottom:0;padding-bottom:75px}.editor-columns{display:block}.rate-table th:first-child{width:30%}.batch-panel{padding:12px}.profile-fields>h2{margin-top:24px}.rates-editor{border-top:1px solid var(--line);padding-top:24px}}

@media(max-width:999px){.save-bar{position:static;padding:16px 0;flex-wrap:wrap}.save-bar>span{flex:1;min-width:120px}}

.auth-view .main-tabs,.auth-view .markets,.auth-view .period,.auth-view .preview-notice,.auth-view .floating,.auth-view #more,.auth-view #settings-menu{display:none!important}.auth-view .workspace{display:block;margin:90px auto 0;padding:20px;max-width:520px}.auth-view #content{padding:0}.auth-view .login-panel{margin:0 auto;background:#fff;border:1px solid var(--line);padding:30px;box-shadow:0 12px 45px #324c7410}.auth-view .login-panel h1{text-align:center}.auth-view .login-panel>.muted{text-align:center}.auth-view .login-panel .field{margin:16px 0}.auth-view .login-panel input{border-radius:7px;padding:10px}.auth-view .login-panel button{border-radius:7px}.auth-view .login-panel #retry-connect{background:none;color:var(--primary);padding:6px}.account-status{display:flex;align-items:center;justify-content:space-between;gap:8px;font-size:12px;padding:12px 0}.account-status button{font-size:12px;padding:6px 9px}.session-item{border-bottom:1px solid var(--line);padding:12px 0;font-size:12px;overflow-wrap:anywhere}.session-item p{font-size:12px;margin:6px 0}.info-dialog{max-height:85dvh;overflow:auto}.profile-fields input[type=password]{min-width:0}.main-tabs [hidden]{display:none!important}

.agent-rate-summary{display:flex;align-items:center;gap:16px;flex-wrap:wrap;min-width:0}.agent-play-label{display:flex;align-items:center;gap:8px;font-size:12px;color:#738196;white-space:nowrap}.agent-play-label select{width:130px;min-height:38px;font-size:13px;padding:8px}.agent-rate-summary .badges{flex-wrap:wrap}.agent-rate-summary .badge{overflow-wrap:anywhere}

/* The source renders numeric glyphs as 14×28 image slices at 252×420 CSS size. */
.source-ball{border-radius:50%;width:28px;height:28px;line-height:0;font-size:0;display:inline-flex;align-items:center;justify-content:center;vertical-align:middle;margin:2px 1px;background:radial-gradient(circle at 35% 30%,#68c3ff 0%,#35aaf7 20%,#0092ff 50%,#6bb9f1 80%,#085599 100%);overflow:hidden;padding:0;flex-shrink:0}.source-ball>i{display:block;width:14px;height:28px;overflow:hidden;background-repeat:no-repeat;background-size:252px 420px;transform-origin:center center;margin:0;padding:0;flex:0 0 14px}.source-ball>i+i{margin-left:-6px}.source-ball.special-ball{outline:2px solid #e9b355;outline-offset:1px}.source-balls{display:flex;gap:3px;align-items:center;flex-wrap:wrap}.period .period-label{border:0;height:auto;margin:0}.period{flex-wrap:wrap;white-space:normal}.period small{font-size:11px}.draw-pagination{margin-top:16px}@media(min-width:1000px){.period{max-width:600px}}@media(max-width:600px){.period{gap:8px;padding:12px}.source-balls{gap:1px}.period small{width:100%;text-align:center}}
.period .source-ball{border:0;width:28px;height:28px;margin:2px 1px}.period .source-ball.special-ball{outline:2px solid #e9b355}

/* Both menu triggers position this popup from their actual viewport bounds. */
.settings-menu{position:fixed;right:auto;max-width:calc(100vw - 16px);overflow-y:auto;overscroll-behavior:contain;z-index:35}

/* Text and precise order-entry modes share the selected agent and market. */
.entry-fields{border:0;padding:0;margin:18px 0 0;min-width:0}.entry-fields legend{padding:0}.entry-fields .field{margin:16px 0}.entry-fields input,.entry-fields select,.entry-fields textarea{width:100%;box-sizing:border-box}.entry-fields:disabled{opacity:.65}.order-entry [role=tabpanel][hidden]{display:none}.precise-entry-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:0 16px}.precise-entry-grid .field{min-width:0}.entry-selection{grid-column:1/-1}.entry-help{margin:0 0 20px}.entry-help summary{cursor:pointer;color:var(--primary);font-size:13px}.entry-notice{padding:12px;background:var(--primary-soft);border-radius:6px;margin-top:20px;line-height:1.8}.order-entry .row{flex-wrap:wrap}.order-entry button:disabled{cursor:not-allowed;opacity:.55}.order-entry-tabs button:focus-visible{outline:2px solid var(--primary);outline-offset:-3px}@media(max-width:600px){.precise-entry-grid{grid-template-columns:1fr}.entry-selection{grid-column:auto}}

#order-preview{border-top:1px solid var(--line);margin-top:20px;padding-top:16px}#entry-feedback:empty{display:none}.entry-success{padding:14px;background:#effbea;color:#32642e;overflow-wrap:anywhere}.saved-order{padding:20px 0;border-bottom:1px solid var(--line)}.saved-order .hint{overflow-wrap:anywhere}.order-original{white-space:pre-wrap;overflow-wrap:anywhere;background:var(--surface-warm);padding:12px;font:inherit}#order-search{align-items:end;flex-wrap:wrap}#order-search label{font-size:13px}#order-search input{display:block;margin-top:6px}#order-results .table-wrap td,#order-preview .table-wrap td{white-space:normal;overflow-wrap:anywhere}#order-results .table-wrap td:nth-child(2),#order-preview .table-wrap td:nth-child(2){max-width:320px}

#wechat-refresh{flex-shrink:0;white-space:nowrap}#wechat-bindings{margin-top:18px}[data-page="wechat"] .saved-order{overflow-wrap:anywhere}

.source-ball.number-ball{font-size:14px;line-height:1;font-weight:700;color:#102d47;background:radial-gradient(circle at 35% 30%,#fff,#c7e7ff);border:1px solid #8dc6ee}

@media(max-width:999px){.main-tabs{max-width:100%;overflow-x:auto}.main-tabs button{flex:1 0 auto}}

/* Keep account management focused on accounts. */
.platform-view .markets,.platform-view .period,.platform-view #open-agents{display:none!important}
#content[data-page=tenants] .section-heading{margin-bottom:0}
#content[data-page=tenants] .section-heading h1{margin:0}
#tenant-error:empty,#tenant-notice:empty{display:none}
#tenant-notice{margin:12px 0 0}
#tenant-create .entry-fields{margin-top:0}
#content[data-page=tenants] details.hint{margin-top:16px}
#content[data-page=tenants] details summary{cursor:pointer}

.app-header .brand{color:#ffe2a6}.app-header .icon{color:#fff7ed}

#order-results .orders-compact{table-layout:fixed;width:100%;margin-top:16px}#order-results .orders-compact>thead>tr>th:first-child,#order-results .orders-compact>tbody>.order-summary-row>td:first-child{text-align:left}#order-results .orders-compact>thead>tr>th:nth-child(2){width:130px}#order-results .orders-compact>thead>tr>th:nth-child(3){width:140px}#order-results .orders-compact>thead>tr>th:nth-child(6){width:76px}#order-results .orders-compact>thead>tr>th:nth-child(4),#order-results .orders-compact>thead>tr>th:nth-child(5){width:140px}#order-results .orders-compact>tbody>.order-summary-row>td{padding:12px 14px;vertical-align:middle}.order-summary-text{white-space:normal;overflow-wrap:anywhere;line-height:1.6}.order-summary-text .bet-amount{white-space:nowrap}.order-total{white-space:nowrap;font-weight:600;font-variant-numeric:tabular-nums;text-align:right}.order-detail-content{text-align:left;padding:12px;min-width:0;background:var(--surface-warm)}.order-detail-content>.table-wrap{background:white}.order-detail-content details{margin-top:12px}.order-detail-row[hidden]{display:none}#order-results .orders-compact>tbody>.order-detail-row>td{padding:0;max-width:none}@media(max-width:600px){#order-results .orders-compact>thead>tr>th:nth-child(2){width:95px}#order-results .orders-compact>thead>tr>th:nth-child(3){width:110px}#order-results .orders-compact>thead>tr>th:nth-child(6){width:60px}#order-results .orders-compact>thead>tr>th:nth-child(4),#order-results .orders-compact>thead>tr>th:nth-child(5){width:110px}#order-results .orders-compact>tbody>.order-summary-row>td{padding:10px 6px}.order-detail-content{padding:8px}}

/* Warm content surfaces and gold secondary accents. */
.badge.purple{background:#faf3e4;color:#805d28;border-color:#dcc79c}
.period strong,.order-total{color:var(--primary)}
a{color:var(--primary)}
@media(hover:hover){.primary:hover:not(:disabled),.floating:hover:not(:disabled){background:var(--primary-hover)}.main-tabs button:hover:not(.active),.settings-menu button:hover{background:var(--primary-soft)}}

.bet-play{color:#713da6;font-weight:600}.bet-selection{color:#175caf;font-weight:500}.bet-amount{color:#a34416;font-weight:600;font-variant-numeric:tabular-nums}.bet-mode{color:#657080}.bet-separator{color:#89929e;padding:0 6px}.bet-legend{display:inline-block;margin-left:12px;font-size:12px;font-weight:400;white-space:nowrap}.bet-legend span{font-weight:400}@media(max-width:600px){.bet-legend{display:block;margin-left:0;margin-top:4px;font-size:10px}}

#settlement-section>summary{cursor:pointer;font-weight:600}#settlement-issue{max-width:420px}.settlement-table{font-variant-numeric:tabular-nums}.settlement-table th:nth-child(2),.settlement-table td:nth-child(2){text-align:left}.settlement-table tfoot{background:#e7edf8;font-weight:600}.settlement-table tfoot tr:last-child{background:#304f91;color:white}.settlement-table tfoot tr:last-child th{background:transparent;color:inherit}

.wave-red{color:#b42318;font-weight:600}.wave-blue{color:#175cd3;font-weight:600}.wave-green{color:#067647;font-weight:600}

.reference-card-table{min-width:0;width:100%;table-layout:fixed}.reference-card-table th:first-child{width:5.5em}.reference-card-table td{white-space:normal;overflow-wrap:anywhere;text-align:left}.card-number{display:inline-block;min-width:2em;padding:3px 2px;text-align:center;font-weight:700}

/* WeChat: compact controls, searchable contacts and a separate message scroller. */
#content[data-page=wechat]{display:grid;grid-template-columns:minmax(250px,1fr) minmax(0,2fr);grid-template-rows:auto minmax(0,1fr);gap:14px;height:calc(100dvh - 190px);min-height:520px;padding-bottom:16px}
#content[data-page=wechat]>.panel{margin:0;min-width:0;padding:20px}
.wechat-connection .section-heading{align-items:flex-start;flex-wrap:wrap}
.wechat-connection .section-heading>.row{gap:6px}
.wechat-connection button{padding:8px 10px;font-size:13px}
.wechat-connection p{margin-bottom:8px;font-size:13px;overflow-wrap:anywhere}
#wechat-error:empty{display:none}
#wechat-fields{display:grid;grid-template-columns:minmax(130px,1fr) minmax(0,2fr) auto;gap:12px;align-items:end;margin:0}
#wechat-fields .field{margin:0;min-width:0}
#wechat-fields>button{white-space:nowrap;min-height:42px}
#wechat-bindings{margin-top:12px;max-height:130px;overflow:auto;overscroll-behavior:contain}
#wechat-bindings>.muted{margin-bottom:0}
.wechat-contact-picker{position:relative;display:grid;gap:8px}
#wechat-contact-popup{position:absolute;z-index:20;top:100%;left:0;right:0;margin-top:4px;background:white;border:1px solid var(--line);border-radius:8px;box-shadow:0 8px 24px #26323a20;overflow:hidden}
#wechat-contact-count{padding:8px 12px;margin:0;border-bottom:1px solid var(--line);font-size:12px}
#wechat-contact-options{max-height:240px;overflow:auto;overscroll-behavior:contain}
#wechat-contact-options [role=option]{padding:9px 12px;cursor:pointer;overflow-wrap:anywhere}
#wechat-contact-options [role=option]:hover,#wechat-contact-options [role=option].active,#wechat-contact-options [aria-selected=true]{background:var(--primary-soft)}
#wechat-contact-options strong,#wechat-contact-options span{display:block;font-size:13px}
#wechat-contact-options span{color:var(--muted);font-size:12px;margin-top:3px}
#wechat-contact-options>.muted{padding:12px;margin:0}
.wechat-messages{grid-column:1/-1;display:flex;flex-direction:column;min-height:0}
.wechat-messages>.section-heading{flex:none}
.wechat-messages>.section-heading>label{display:flex;gap:8px;align-items:center;font-size:13px}
.wechat-messages h2 small{margin-left:8px;font-weight:400}
#wechat-events{flex:1;min-height:0;overflow:auto;overscroll-behavior:contain;scrollbar-gutter:stable;padding-right:8px;overflow-wrap:anywhere}
#wechat-events .saved-order:first-child{margin-top:0}
#wechat-events pre{white-space:pre-wrap;overflow-wrap:anywhere}
@media(max-width:1000px){#wechat-fields{grid-template-columns:1fr 2fr}#wechat-fields>button{justify-self:start;grid-column:1/-1}}
@media(max-width:700px){#content[data-page=wechat]{display:flex;flex-direction:column;height:auto;min-height:0}#content[data-page=wechat]>.panel{padding:16px}.wechat-connection .section-heading{align-items:center}#wechat-fields{grid-template-columns:1fr}.wechat-messages{height:55dvh;min-height:280px}#wechat-contact-options{max-height:180px}}
.wechat-connection{align-self:start}
#wechat-bindings h3{margin:0 0 8px}
#wechat-bindings .saved-order{padding:8px 0;margin:0}
.wechat-messages>.section-heading>label{white-space:nowrap}
.wechat-messages>.section-heading>label select{width:auto;min-width:92px}

/* Keep the agent picker next to the button that opened it. */
#drawer.drawer{inset:auto;margin:0;height:auto;max-height:520px;border:1px solid var(--line);border-radius:12px;box-shadow:0 12px 40px #18202b26;overflow:hidden}
#drawer[open]{display:flex;flex-direction:column}
#drawer::backdrop{background:#18202b20}
#drawer .drawer-head{padding:12px 16px 8px;flex-shrink:0}
#drawer .drawer-search{padding:8px 16px 12px;flex-shrink:0}
#drawer #agent-list{overflow-y:auto;min-height:0;padding:12px 16px;overscroll-behavior:contain}
#drawer .agent-card{padding:10px;margin-bottom:8px}
#drawer .agent-card:last-child{margin-bottom:0}
/* Expand selection to the full card while keeping Edit independently clickable. */
#drawer .agent-card{position:relative;cursor:pointer}
#drawer .edit-agent{position:relative;z-index:1}
#drawer .agent-card:hover{border-color:var(--primary-border)}

#order-results .orders-compact [data-order-detail]{padding:5px 8px;font-size:13px;white-space:nowrap}

#order-results .orders-compact{min-width:940px}#order-results .order-money{white-space:nowrap;text-align:right;font-variant-numeric:tabular-nums}

#order-results .order-totals{background:var(--surface-warm);font-weight:600;font-variant-numeric:tabular-nums}#order-results .order-totals th{text-align:left;font-weight:600;white-space:normal}#order-results .order-totals td{padding:14px}#order-results .order-totals .order-profit th,#order-results .order-totals .order-profit td{background:var(--primary-soft);color:var(--primary)}#order-results .order-totals .order-profit td{text-align:left;white-space:normal}

/* Everyday workflows: clear entry points, readable controls, and compact mobile navigation. */
.skip-link{position:fixed;left:16px;top:-80px;z-index:110;background:white;color:var(--primary);padding:12px 18px;border:2px solid var(--primary);border-radius:8px}.skip-link:focus-visible{top:12px}
.workspace-welcome{display:flex;justify-content:space-between;align-items:center;gap:24px;padding:28px}.workspace-welcome h1{font-size:26px;margin-bottom:10px}.workspace-welcome p:last-child{margin-bottom:0}.workspace-welcome .eyebrow{color:var(--primary);font-weight:600}.workspace-context{display:flex;flex-direction:column;gap:8px;flex-shrink:0;padding-left:28px;border-left:1px solid var(--line);color:var(--muted);font-size:13px}.workspace-context strong{font-size:32px;color:var(--primary);font-variant-numeric:tabular-nums}
.quick-actions{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:16px;margin-bottom:20px}.quick-action{text-align:left;padding:22px;display:flex;flex-direction:column;gap:14px;border-radius:10px;min-width:0}.quick-action strong{font-size:17px;display:flex;justify-content:space-between;gap:8px}.quick-action>span:last-child{font-size:13px;color:#655d57;line-height:1.7}.action-number{font-size:12px;color:var(--primary);font-weight:700;letter-spacing:2px}.quick-action:hover{border-color:var(--primary);background:var(--primary-soft)}.status-pending{font-size:12px;padding:5px 10px;border-radius:20px;background:#f3eee8;color:#746353}.unavailable-stats p{margin-bottom:12px}.unavailable-stats .section-heading h2{font-size:16px}
.main-tabs button[data-tab="tenants"]:before{content:"▦"}.main-tabs button[data-tab="dashboard"]:before{content:"▦"}.main-tabs button[data-tab="agents"]:before{content:"♙"}.main-tabs button[data-tab="details"]:before{content:"☷"}.main-tabs button[data-tab="draws"]:before{content:"◉"}
.muted,.hint{color:#71665e}.preview-notice{color:#71665e}.table-wrap{overscroll-behavior-x:contain}th{color:#59636d}.table-wrap tbody tr:hover{background:#fcf8f4}summary{min-height:36px;align-content:center}#agent-list .empty{padding:24px 8px}.login-panel form[aria-busy=true] button{cursor:wait}
@media(max-width:999px){.main-tabs{position:sticky;top:0;z-index:14;background:var(--surface-warm);padding:6px;scroll-padding-inline:8px;gap:4px;border-top:0;box-shadow:0 2px 8px #33221108}.main-tabs button{font-size:15px;min-height:44px;padding:10px 15px}.main-tabs button:before{display:none}.app-header{height:68px}.brand{font-size:24px}.workspace-welcome{padding:22px}.quick-actions{gap:10px}.quick-action{padding:16px}.quick-action strong{font-size:15px}.floating{width:48px;height:48px;bottom:calc(16px + env(safe-area-inset-bottom))}.agents-toggle{left:12px}.help-toggle{right:12px}main{padding-bottom:90px}.auth-view .workspace{margin:24px auto 0}}
@media(max-width:600px){.workspace-welcome{align-items:flex-start;gap:14px}.workspace-welcome h1{font-size:21px;line-height:1.5}.workspace-context{padding-left:14px;font-size:11px;max-width:80px}.workspace-context strong{font-size:26px}.quick-actions{grid-template-columns:1fr}.quick-action{display:grid;grid-template-columns:28px 1fr;gap:6px 12px;padding:18px}.quick-action .action-number{grid-row:1/3;align-self:center}.quick-action strong{font-size:16px}.quick-action>span:last-child{grid-column:2}.markets button{font-size:15px;min-height:44px}.row>button,.section-heading>button,.edit-agent{min-height:44px}.table-wrap{max-width:100%}.login-panel input,.field input,.field select,.field textarea,.drawer-search input{font-size:16px}.panel{padding:16px}.section-heading{flex-wrap:wrap}.auth-view .login-panel{padding:24px}.onboarding .primary{width:100%}}

.manual-draw-numbers{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:8px}.manual-draw-numbers input{min-width:0;width:100%}.manual-draw-numbers .field{margin:8px 0}

/* Compact working views: page long data sets, give the active table full width. */
[hidden]{display:none!important}
.table-pagination{justify-content:flex-end;margin:12px 0 0;gap:12px;font-size:13px}
.table-pagination span{color:var(--muted);font-variant-numeric:tabular-nums}
.secondary-details{margin:8px 0;font-size:12px;color:var(--muted)}
.secondary-details>summary{min-height:30px;cursor:pointer}
.report-choice{margin:14px 0}.report-choice:empty{display:none}.report-choice label{display:flex;align-items:center;gap:10px;font-size:13px}.report-choice select{width:auto;min-width:200px}
.win-label{display:inline-block;margin-left:8px;color:var(--primary);font-size:12px;font-weight:600}
#settlement-report>.summary{margin:14px 0 18px}
.settlement-table th:first-child{width:56px}.settlement-table th:nth-child(n+3){width:120px}
.settlement-table td:nth-child(2){white-space:normal;overflow-wrap:anywhere;line-height:1.6}
.settlement-table td:nth-child(n+3){text-align:right;white-space:nowrap}
.table-wrap{margin-top:12px;max-width:100%}
.table-wrap>table>thead>tr>th{position:sticky;top:0;z-index:1}
.table-wrap>table>tbody>tr>td{padding-top:11px;padding-bottom:11px}
#order-results .orders-compact{min-width:760px;margin-top:0}
#order-results .orders-compact>thead>tr>th:nth-child(2){width:125px}
#order-results .orders-compact>thead>tr>th:nth-child(3),#order-results .orders-compact>thead>tr>th:nth-child(4),#order-results .orders-compact>thead>tr>th:nth-child(5){width:100px}
#order-results .orders-compact>thead>tr>th:nth-child(6){width:64px}
#order-search{gap:10px}#order-search label{flex:1;min-width:140px}#order-search input,#order-search select{width:100%;min-height:40px;margin-top:5px}#order-search button{min-height:40px}
#order-filter-note{margin:12px 0 0}#order-filter-note:empty,#entry-issue-hint:empty{display:none}
#order-preview>button{margin-top:12px}.order-entry>.entry-fields>.field:first-child{max-width:340px;margin:12px 0 0}.order-entry .quick-input{min-height:180px}
#order-preview table{min-width:640px}#order-preview td{white-space:normal;overflow-wrap:anywhere}
#order-preview .secondary-details table{min-width:720px}
#content[data-page=wechat]{height:auto;min-height:0;grid-template-rows:auto auto}
#content[data-page=wechat]>.panel{padding:18px}
.wechat-messages{height:auto;min-height:0}
#wechat-events{overflow:visible;padding:0;scroll-margin-top:80px}
#wechat-events .saved-order{padding:14px 0}
#wechat-events .saved-order p{margin:6px 0}
#wechat-events .message-preview{color:#26323a;background:var(--surface-warm);padding:9px 12px;white-space:pre-wrap;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;line-height:1.6}
#wechat-events .saved-order>button{padding:7px 12px;margin:6px 8px 0 0}
#wechat-events summary{font-size:12px;color:var(--muted);min-height:28px}
#wechat-bindings{max-height:220px}
#content[data-page=draws]>.panel:first-child>.table-wrap{max-height:65dvh;min-height:280px;overflow:auto}
#content[data-page=draws]>.panel:first-child table{min-width:660px}
#content[data-page=draws]>.panel:first-child td{padding:9px 8px}
#content[data-page=draws] .section-heading{margin-bottom:8px}
@media(min-width:1000px){
 .workspace{padding:16px 24px 0}.preview-notice{padding:7px 0}main{padding-top:6px}.panel{padding:18px;margin-bottom:12px}
 main[data-page=agents]{grid-template-columns:minmax(0,1fr);gap:12px}main[data-page=agents]>.panel:nth-child(3){grid-row:2;padding:12px 18px;display:flex;align-items:center;gap:16px;flex-wrap:wrap}main[data-page=agents]>.panel:nth-child(3) p{margin:0}main[data-page=agents]>.panel:nth-child(3) .section-heading{margin:0 auto 0 0;gap:12px}main[data-page=agents]>.panel:nth-child(3) h2{font-size:14px}
 #content[data-page=tenants]{display:grid;grid-template-columns:300px minmax(0,1fr);gap:14px;align-items:start}#content[data-page=tenants]>.panel:first-child{grid-column:1/-1}#content[data-page=tenants]>.panel{margin:0}#tenant-list .saved-order{padding:12px 0}
 .workspace-welcome{padding:20px}.workspace-welcome h1{margin:0;font-size:23px}.quick-action{padding:20px}.empty{padding:28px 12px}
}
@media(max-width:700px){
 #order-search label{min-width:120px}.settlement-table{min-width:540px}.settlement-table th:nth-child(n+3){width:90px}
 .summary{gap:10px;padding:14px}.table-pagination{justify-content:center}.table-pagination button{min-height:42px}
 #content[data-page=wechat]{height:auto}.wechat-messages{height:auto;min-height:0}#wechat-events{overflow:visible}
 .report-choice select{min-width:0;flex:1}.workspace-welcome{padding:16px}
}
.result-summary{display:flex;flex-wrap:wrap;gap:12px 24px;align-items:center;padding:14px;background:var(--surface-warm)}
.result-summary>span{white-space:nowrap;font-size:13px}.result-summary strong{color:#26323a;font-variant-numeric:tabular-nums}.result-summary>span:last-child strong{color:var(--primary)}
#order-results>.table-wrap{max-height:68dvh;overflow:auto}
#tenant-list:empty:before{content:"没有匹配的管理员";display:block;padding:24px 0;color:var(--muted)}
/* Original-message list and per-bet detail dialog. */
#order-results .message-orders{min-width:560px;table-layout:fixed}
#order-results .message-orders>thead>tr>th:nth-child(1){width:60px}
#order-results .message-orders>thead>tr>th:nth-child(2){width:auto;text-align:left}
#order-results .message-orders>thead>tr>th:nth-child(3),#order-results .message-orders>thead>tr>th:nth-child(4),#order-results .message-orders>thead>tr>th:nth-child(5){width:120px}
#order-results .message-orders .order-message{text-align:left;max-width:none}
#order-results .orders-compact .order-original-link{display:block;width:100%;border:0;padding:0;background:none;color:#175caf;text-decoration:underline;text-underline-offset:3px;text-align:left;white-space:pre-wrap;overflow-wrap:anywhere;line-height:1.6}
.order-message>.hint{display:block;margin-top:5px;font-size:11px}
.winning-amount{color:#098354;font-weight:700}
.order-dialog{width:min(760px,calc(100vw - 24px));max-width:none;max-height:88dvh;border:1px solid var(--line);border-radius:12px;padding:20px;color:#26323a;overflow:auto}
.order-dialog::backdrop{background:#18202b66}.order-dialog>.section-heading{position:sticky;top:-20px;background:white;padding:8px 0;z-index:2}
.order-dialog .section-heading button{border:0;color:var(--muted);padding:8px 12px}
.detail-original{background:var(--surface-warm);border:1px solid var(--line);border-radius:8px;padding:14px}
.detail-original pre{margin:8px 0 0;white-space:pre-wrap;overflow-wrap:anywhere;font:inherit;line-height:1.6;max-height:22dvh;overflow:auto}
.detail-context{display:flex;justify-content:space-between;gap:8px;flex-wrap:wrap;margin:14px 0;color:var(--muted);font-size:12px}
.bet-detail-table{table-layout:fixed;font-variant-numeric:tabular-nums}.bet-detail-table th:nth-child(2){width:35%}.bet-detail-table td{white-space:normal;overflow-wrap:anywhere}.bet-detail-table tbody tr:nth-child(even){background:#faf8f5}
@media(max-width:600px){.order-dialog{padding:14px}.order-dialog>.section-heading{top:-14px}.bet-detail-table{font-size:12px}.bet-detail-table th,.bet-detail-table td{padding:9px 4px}.bet-detail-table th:nth-child(2){width:30%}#order-results .message-orders>thead>tr>th:nth-child(1){width:44px}#order-results .message-orders>thead>tr>th:nth-child(n+3){width:80px}#order-results .message-orders{min-width:480px}}
.detail-ball{display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;border-radius:50%;color:white;font-weight:600;vertical-align:middle;font-variant-numeric:tabular-nums}.detail-ball.red{background:#c93e42}.detail-ball.blue{background:#276bcd}.detail-ball.green{background:#13896a}

#order-results .message-orders .order-totals>tr:first-child>th{text-align:center}#order-results .message-orders .order-profit th,#order-results .message-orders .order-profit td{background:#304f91;color:white}#order-results .message-orders .order-profit th{text-align:center}

.main-tabs button[data-tab="help"]:before{content:"?"}.help-filters label{display:flex;align-items:center;gap:10px;font-size:13px}.help-filters select{width:180px}.help-filters input{width:240px}.help-table th,.help-table td{text-align:left;white-space:normal;overflow-wrap:anywhere;line-height:1.7;vertical-align:top}.help-table th:first-child{width:110px}.help-table th:nth-child(2){min-width:140px}.help-table{min-width:640px}#help-results .section-heading{margin-bottom:12px}#help-results .table-wrap{margin-top:0}@media(max-width:600px){.help-filters{display:grid;grid-template-columns:1fr}.help-filters label{min-width:0}.help-filters select,.help-filters input{flex:1;width:0}.help-table{font-size:13px}}

/* Bill previews use the same narrow layout as the downloaded phone image. */
.order-dialog.bill-image-dialog{width:min(430px,calc(100vw - 16px));padding:12px;background:#f4f2ef}
.bill-image-toolbar{position:sticky;top:-12px;z-index:2;background:#f4f2ef;padding:4px 0 12px}
.bill-image-toolbar h2{font-size:17px;margin:6px 0}
.bill-image-actions{display:grid;grid-template-columns:40px 48px 40px 1fr;align-items:center;gap:6px}
.bill-image-actions button{min-height:40px;padding:8px 4px;white-space:nowrap}
.bill-image-actions [data-page]{text-align:center;font-size:13px}
.bill-image-dialog>img{display:block;width:100%;height:auto;border-radius:8px}
/* Keep data in the workspace; connection and setup live in focused dialogs. */
.app-header>div{display:flex;align-items:center;gap:10px}
.app-header .global-wechat-status{display:inline-flex;align-items:center;gap:7px;border:1px solid #ffffff55;border-radius:20px;background:#ffffff14;color:#fff;font-size:13px;padding:7px 12px;min-height:34px}
.app-header .global-wechat-status[hidden]{display:none}
.global-wechat-status:before{content:'';width:7px;height:7px;border-radius:50%;background:#ffd2a5}
.global-wechat-status[data-state=connected]:before{background:#8aefbd}
.global-wechat-status[data-state=offline]:before{background:#ffd2a5}
#content[data-page=wechat]{display:block;height:auto}
.wechat-overlay-host>.wechat-messages{display:none}
.wechat-login-dialog{width:min(470px,calc(100vw - 24px))}
.wechat-login-dialog .section-heading{flex-wrap:wrap}
#wechat-qr{text-align:center;padding:18px 0}
#wechat-binding-dialog #wechat-fields{display:grid;grid-template-columns:1fr;gap:16px}
#wechat-binding-dialog #wechat-bindings{max-height:none;overflow:visible}
#wechat-events .wechat-message-table{table-layout:fixed;width:100%;text-align:left}
.wechat-message-table th:first-child{width:175px}.wechat-message-table th:last-child{width:190px}
.wechat-message-table td{vertical-align:top;text-align:left;padding:14px}
.wechat-message-meta{font-size:12px;line-height:1.8;color:var(--muted)}
.wechat-message-state{font-size:13px}.wechat-message-state p{font-size:12px}
#wechat-events .saved-order{border:0;margin:0;padding:0}
#wechat-events .message-preview{background:transparent;padding:0;margin:0 0 6px}
.wechat-messages .section-heading label{display:flex;align-items:center;gap:6px;font-size:13px}
.wechat-messages .section-heading select{min-width:90px;width:auto}
.action-menu{position:relative;flex:none;font-size:14px}
.action-menu>summary{list-style:none;cursor:pointer;border:1px solid var(--line);border-radius:7px;padding:12px 15px;background:white;white-space:nowrap}
.action-menu>summary:after{content:' ▾'}.action-menu>summary::-webkit-details-marker{display:none}
.action-menu-items{position:absolute;right:0;top:calc(100% + 6px);min-width:160px;z-index:15;background:white;border:1px solid var(--line);border-radius:8px;padding:6px;box-shadow:0 8px 25px #30201618;display:grid;gap:4px}
.action-menu-items button{width:100%;text-align:left;border:0;white-space:nowrap}
.secondary-details>.row{margin-top:14px}
@media(max-width:700px){
 .app-header>div{gap:3px}.app-header .global-wechat-status{font-size:11px;padding:6px 8px;gap:5px}
 .wechat-messages .section-heading{align-items:flex-start;flex-wrap:wrap;gap:12px}
 .wechat-message-table thead{display:none}.wechat-message-table tbody,.wechat-message-table tr,.wechat-message-table td{display:block;width:100%}
 .wechat-message-table tr{border-bottom:1px solid var(--line);padding:12px 0}
 .wechat-message-table td{border:0;padding:5px 0}.wechat-message-meta br{display:none}.wechat-message-meta{word-spacing:4px}
 .wechat-message-table{min-width:0}.wechat-messages>.section-heading>.row{width:100%;gap:7px}.wechat-messages button{padding:8px 10px}
}
main[data-page=agents]{grid-template-columns:minmax(0,1fr)}
main[data-page=agents]>.secondary-details{align-self:start}
@media(max-width:999px){.app-header{position:sticky;top:0;z-index:30}.main-tabs{top:68px}}
@media(max-width:700px){.wechat-message-table td{height:auto;min-height:0}.wechat-message-meta br{display:block}}

/* Phone workspace: consistent gutters and deliberate control rows. */
@media(max-width:999px){
 .app-header{height:60px;padding:0 16px;border-bottom:0}
 .brand{font-size:23px;letter-spacing:1px;font-weight:600}
 .app-header .icon{width:40px;height:44px;padding:0;font-size:29px}
 .app-header>div{gap:2px}
 .main-tabs{top:60px;padding:0 12px;gap:4px;background:#fff;box-shadow:none;scrollbar-width:none}
 .main-tabs::-webkit-scrollbar{display:none}
 .main-tabs button{min-height:48px;padding:12px 13px;font-size:15px;border-radius:0;color:#687078}
 .main-tabs .active{background:transparent}
 .main-tabs .active:after{left:13px;right:13px;height:3px}
 .markets{margin:16px 16px 0;padding:4px;gap:4px;background:#eee9e4;border-radius:10px}
 .markets button,.markets .active{min-height:40px;padding:8px 0;border:0;border-radius:7px;font-size:14px;background:transparent;color:#716b66}
 .markets .active{background:#fff;color:var(--primary);box-shadow:0 1px 4px #3322110c}
 .period{margin:12px 16px 0;padding:14px 16px;gap:10px;background:#fff;border-radius:12px;font-size:13px}
 .period .period-label{width:100%;text-align:center}
 .period strong{font-variant-numeric:tabular-nums}
 .period .source-balls{justify-content:center;gap:5px;flex-wrap:nowrap}
 .period small{width:100%;text-align:center;color:#8a8e93;font-size:11px}
 .preview-notice{padding:10px 18px 2px;border:0;font-size:11px;color:#85807b;overflow-wrap:anywhere}
 main{padding:12px 16px calc(88px + env(safe-area-inset-bottom))}
 .panel{padding:16px;border-radius:12px;margin-bottom:12px;box-shadow:none;min-width:0}
 main[data-page=agents]>.panel:first-child>.row{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:12px}
 .agent-rate-summary{display:contents}
 .agent-play-label{grid-column:1;grid-row:1;display:grid;gap:6px;font-size:11px;color:var(--muted);min-width:0}
 .agent-play-label select{width:100%;min-width:0;min-height:44px;height:44px;font-size:16px;padding:9px 10px;border-radius:8px}
 main[data-page=agents]>.panel:first-child [data-drawer]{grid-column:2;grid-row:1;align-self:end;min-width:0;min-height:44px;height:44px;padding:9px 10px;border-radius:8px;overflow-wrap:anywhere;text-align:left;font-size:15px}
 .agent-rate-summary .badges{grid-column:1/-1;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;border-top:1px solid var(--line);padding-top:12px}
 .agent-rate-summary .badge{padding:7px 8px;text-align:center;border:0;border-radius:6px;font-size:14px;line-height:1.5;font-variant-numeric:tabular-nums}
 .order-entry .section-heading{margin-bottom:14px;align-items:center}
 .order-entry .section-heading h2{font-size:18px}
 .order-entry .section-heading>.hint{margin:0;font-size:12px;overflow-wrap:anywhere}
 .order-entry-tabs{display:grid;grid-template-columns:1fr 1fr;margin:0;padding:3px;background:#f4f1ee;border:0;border-radius:8px}
 .order-entry-tabs button{min-height:42px;padding:9px 8px;border:0;border-radius:6px;font-size:14px}
 .order-entry-tabs button[aria-selected=true]{background:#fff;color:var(--primary);box-shadow:0 1px 4px #3322110c;border:0}
 .order-entry>.entry-fields{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:0 10px;margin-top:16px}
 .order-entry>.entry-fields>.field:first-child{min-width:0;max-width:none;margin:0}
 .order-entry>.entry-fields>#use-current-issue{align-self:start;min-height:44px;margin-top:27px;padding:10px 0 10px 4px;font-size:13px;white-space:nowrap}
 .order-entry>.entry-fields>section{grid-column:1/-1;min-width:0}
 .order-entry .field>span{font-size:13px;margin-bottom:8px;line-height:19px}
 .order-entry input,.order-entry select,.order-entry textarea{border-radius:8px;min-height:44px;font-size:16px}
 .order-entry .quick-input{min-height:144px;height:144px;margin-bottom:0;line-height:1.7}
 .order-entry .entry-help{margin-bottom:16px}
 .order-entry [role=tabpanel]>.row{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:10px}
 .order-entry [role=tabpanel]>.row>button{min-height:44px;font-size:14px}
 .floating{width:42px;height:42px;bottom:calc(14px + env(safe-area-inset-bottom));box-shadow:0 3px 12px #a61b2920;font-size:20px}
 .agents-toggle{left:16px}.help-toggle{right:16px}
 .help-toggle svg{width:24px;height:24px}
}
@media(max-width:359px){
 .app-header{padding:0 12px}.brand{font-size:21px}
 .app-header .global-wechat-status{padding:6px;font-size:10px}
 .app-header .icon{width:34px}
 main{padding-left:12px;padding-right:12px}
 .markets{margin-left:12px;margin-right:12px}.period{margin-left:12px;margin-right:12px}
 .period .source-balls{gap:3px}
}

/* Center authentication and modal surfaces, with room to scroll on short screens. */
.auth-view .app-header{position:relative;inset:auto}
.auth-view .workspace{display:flex;align-items:center;justify-content:center;width:100%;max-width:none;min-height:calc(100dvh - 64px);margin:0;padding:24px 16px calc(24px + env(safe-area-inset-bottom))}
.auth-view #content{display:block;width:100%;max-width:420px;min-width:0;padding:0;margin:0}
.auth-view .login-panel{width:100%;max-width:none;margin:0;border-radius:16px}
:is(dialog.info-dialog,dialog.order-dialog){position:fixed;inset:0;margin:auto;max-width:calc(100vw - 32px);max-height:calc(100dvh - 32px);overflow:auto;overscroll-behavior:contain}
#drawer.drawer{inset:0;margin:auto;width:min(380px,calc(100vw - 32px));height:fit-content;max-height:min(520px,calc(100dvh - 32px))}
#info-dialog h2,#info-dialog #info-body{text-align:center}
@media(max-width:999px){
 .auth-view .workspace{min-height:calc(100dvh - 60px)}
}

/* Daily orders first; historical filters are available on demand. */
.order-filters .section-heading{margin-bottom:12px}
.details-toolbar{gap:8px}
.details-toolbar>button,.details-toolbar>.action-menu>summary{min-height:40px;padding:9px 12px;font-size:13px}
.details-toolbar>.action-menu{margin-left:auto}
.details-toolbar .action-menu-items{right:0;left:auto;min-width:150px;max-width:calc(100vw - 64px)}
#toggle-order-filters[aria-expanded=true]{background:var(--primary-soft);color:var(--primary);border-color:var(--primary-border)}
.order-filters #order-search{margin-top:16px;padding-top:16px;border-top:1px solid var(--line)}
.order-filters #order-filter-note{font-size:12px;margin-top:10px}
@media(max-width:600px){
 .order-filters #order-search{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
 .order-filters #order-search label{min-width:0;font-size:13px}
 .order-filters #order-search label:nth-child(3){grid-column:1/-1}
 .order-filters #order-search button{min-height:44px;font-size:14px}
}

/* Dashboard shortcuts stay visible above daily agent statistics. */
.dashboard-shortcuts .section-heading>.hint{margin:0;font-size:12px}
.dashboard-actions{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:10px}
.dashboard-actions button{min-height:48px;padding:12px 8px;font-size:14px;border-radius:8px}
.dashboard-actions button:first-child{color:var(--primary);background:var(--primary-soft);border-color:var(--primary-border)}
.statistics-panel .section-heading h2{font-size:18px}
.statistics-panel .section-heading .row{gap:8px}
.statistics-panel .section-heading button{padding:8px 12px;min-height:40px;font-size:13px}
#statistics-filter{padding:14px 0;margin-bottom:10px;border-top:1px solid var(--line);gap:12px;align-items:end}
#statistics-filter label{flex:1;min-width:120px;font-size:13px}
#statistics-filter input{margin-top:6px;min-width:0}
#statistics-period{margin:0 0 12px;font-size:12px}
#statistics-history[aria-expanded=true]{color:var(--primary);background:var(--primary-soft)}
@media(max-width:600px){
 .dashboard-actions{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
 #statistics-filter{display:grid;grid-template-columns:repeat(2,minmax(0,1fr))}
 #statistics-filter label{min-width:0}
 #statistics-filter input{font-size:16px}
 #statistics-filter button{min-height:44px}
 .statistics-panel .section-heading{gap:8px}
}

/* Platform administration is a focused account list. */
#content[data-page=tenants]{display:block;max-width:960px;margin:0 auto}
.tenant-management h1{font-size:21px;margin:0 0 4px}
.tenant-management>.section-heading{margin-bottom:20px}
.tenant-search-row{display:flex;gap:10px}.tenant-search-row input{min-width:0}.tenant-search-row button{flex-shrink:0}
#tenant-error:empty,#tenant-notice:empty{display:none}
#tenant-notice{font-size:13px;color:#35704d;margin:12px 0}
.tenant-card{border:1px solid var(--line);border-radius:10px;padding:16px;margin-top:12px;min-width:0}
.tenant-card .section-heading{margin-bottom:6px}.tenant-card strong{overflow-wrap:anywhere;min-width:0}
.tenant-email{font-size:14px;overflow-wrap:anywhere;margin:0 0 8px}
.tenant-expiry{font-size:13px;color:var(--muted);margin:0 0 14px}
.tenant-state{font-size:12px;padding:4px 8px;border-radius:5px;background:#edf5ef;color:#3c7150;white-space:nowrap}
.tenant-state[data-state=expired],.tenant-state[data-state=disabled]{background:#fbefed;color:var(--primary)}
.tenant-state[data-state=legacy]{background:#faf3e4;color:#94703b}
.tenant-actions{display:flex;flex-wrap:wrap;gap:8px}.tenant-actions button{font-size:13px;min-height:40px}
.tenant-actions [data-renew]{background:var(--primary-soft);color:var(--primary);border-color:var(--primary-border)}
.tenant-dialog .section-heading{flex-wrap:nowrap}.tenant-dialog .section-heading h2{margin:0;font-size:18px}
.tenant-dialog .section-heading button{width:auto;padding:8px;font-size:13px;min-height:40px}
.tenant-dialog .entry-fields{margin:0}.tenant-dialog .field{margin:16px 0}
.tenant-dialog input,.tenant-dialog select{font-size:16px;min-width:0;max-width:100%}
.tenant-dialog #tenant-edit-account{overflow-wrap:anywhere;font-size:13px}
.platform-view .help-toggle{display:none}
@media(max-width:600px){.tenant-actions{display:grid;grid-template-columns:repeat(3,minmax(0,1fr))}.tenant-actions button{padding:9px 5px;min-height:44px}.tenant-card{padding:14px}}
