:root {
  color-scheme: light;
  font: 14px/1.6 'Segoe UI', 'Microsoft YaHei', system-ui, sans-serif;
  --page:#f7f8fa; --surface:#fff; --raised:#f3f5f8; --border:#e4e7ec;
  --text:#18253b; --muted:#647084; --accent:#c44d08; --accent-soft:#fff2e8;
  --good:#087f5b; --warn:#945500; --danger:#bd3038; --radius:12px;
  --chart-orange:#df6507; --chart-teal:#15a693; --chart-blue:#2b91d0;
  --shadow:0 2px 3px #18253b06,0 0 0 1px #18253b02;
}
* { box-sizing:border-box }
[hidden] { display:none !important }
body { margin:0; background:var(--page); color:var(--text) }
p,h1,h2,h3,h4,dl,dd,ul { margin:0 }
h1 { font-size:24px; line-height:1.4; letter-spacing:-.025em; font-weight:700 }
h2 { font-size:17px; font-weight:650 }
h3 { font-size:15px; font-weight:650 }
h4 { font-size:14px }
p,small,label { color:var(--muted) }
a { color:var(--accent); text-underline-offset:3px }
button,input,select { font:inherit }
button,input,select { min-height:44px; border:1px solid var(--border); border-radius:8px; color:var(--text); background:var(--surface); padding:9px 13px }
button { cursor:pointer; font-weight:600; transition:background 160ms,border-color 160ms,box-shadow 160ms; display:inline-flex; align-items:center; justify-content:center; gap:8px }
button svg,a svg { width:19px; height:19px; flex-shrink:0 }
button:hover:not(:disabled) { background:var(--raised); border-color:#adb5c2 }
button:active:not(:disabled) { box-shadow:inset 0 1px 3px #18253b14 }
button:disabled { cursor:default; opacity:.5 }
button.primary,.primary { background:var(--accent); color:white; border-color:var(--accent); box-shadow:0 3px 8px #c44d081c }
button.primary:hover:not(:disabled) { background:#a33e04; border-color:#a33e04 }
input:focus,select:focus { border-color:var(--accent) }
:focus-visible { outline:3px solid var(--accent); outline-offset:3px }
input { min-width:0 }
input::placeholder { color:#647084 }
input:not([type=checkbox]):not([readonly]),select { border-color:#8b95a5 }
input:not([type=checkbox]):focus,select:focus { border-color:var(--accent) }
input[type=checkbox] { accent-color:var(--accent) }
.skip-link { position:fixed; top:-100px; left:16px; z-index:100; background:var(--surface); padding:12px }
.skip-link:focus { top:12px }
.sidebar { width:224px; position:fixed; inset:0 auto 0 0; display:flex; flex-direction:column; background:var(--surface); border-right:1px solid var(--border); z-index:40 }
.brand { display:flex; align-items:center; gap:10px; color:var(--text); text-decoration:none; font-size:18px; font-weight:750; min-height:68px; padding:0 24px; border-bottom:1px solid var(--border) }
.brand-mark { width:33px; height:33px; display:grid; place-items:center; border-radius:10px; background:var(--accent); color:white }
.brand-mark svg { width:21px; height:21px }
.brand small { display:block; font-size:10px; letter-spacing:.14em; font-weight:600; line-height:1.1 }
.sidebar-label { font-size:11px; color:var(--muted); letter-spacing:.14em; padding:25px 24px 9px }
.side-nav { display:grid; gap:6px; padding:0 12px }
.side-nav a,.side-nav button { border:0; background:transparent; box-shadow:none; width:100%; text-decoration:none; display:flex; align-items:center; justify-content:flex-start; gap:12px; min-height:46px; padding:12px; border-radius:8px; font-size:14px; font-weight:500; color:#536074; text-align:left }
.side-nav :is(a,button):hover { background:var(--raised) }
.side-nav [aria-current=page] { background:var(--accent); color:#fff; box-shadow:0 4px 10px #c44d0820 }
.side-nav [aria-current=page]:hover { background:#a33e04 }
.sidebar-foot { margin-top:auto; padding:20px 24px 24px; font-size:12px; color:var(--muted); border-top:1px solid var(--border) }
.sidebar-foot p { margin-top:8px; font-size:11px }
.sidebar-foot a { display:flex; gap:8px; align-items:center; color:var(--muted); text-decoration:none }
.sidebar-foot svg { width:16px }
.topbar { height:68px; margin-left:224px; padding:0 32px; display:flex; align-items:center; justify-content:space-between; background:var(--surface); border-bottom:1px solid var(--border); gap:16px }
.breadcrumbs { display:flex; align-items:center; gap:12px; color:var(--muted); font-size:13px }
.breadcrumbs svg { width:16px; height:16px }
.breadcrumbs span:last-child { color:var(--text) }
.header-account { display:flex; align-items:center; gap:12px }
.avatar { width:35px; height:35px; border-radius:50%; display:grid; place-items:center; background:var(--accent-soft); color:var(--accent); font-size:12px; font-weight:700; flex-shrink:0 }
.account-copy { font-size:12px; line-height:1.45 }
.account-copy strong { display:block; font-weight:650 }
.account-copy small { font-size:11px }
.header-account button { border:0; margin-left:8px; font-size:12px; color:var(--muted); min-width:44px }
#menu-toggle { display:none }
#nav-scrim { display:none }
.main { margin-left:224px; padding:28px 32px 40px; min-height:calc(100dvh - 68px) }
.content { max-width:1440px; margin-inline:auto }
.panel { border:1px solid var(--border); border-radius:var(--radius); background:var(--surface); box-shadow:var(--shadow); min-width:0 }
.section-title,.project-header,.rules-footer,.rules-heading,.channel-title,.actions { display:flex; align-items:center; justify-content:space-between; gap:12px }
.section-title { margin-bottom:24px; align-items:flex-start }
.section-title p { margin-top:5px; font-size:13px }
.eyebrow { font-size:11px; letter-spacing:.13em; font-weight:650; color:var(--accent); margin-bottom:6px }
.actions { justify-content:flex-end; flex-wrap:wrap }
.actions button { font-size:13px }
.metrics { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:16px; margin-bottom:24px }
.metrics>div { padding:19px 22px; border:1px solid var(--border); border-radius:var(--radius); background:var(--surface); box-shadow:var(--shadow) }
.metrics dt { color:var(--muted); font-size:12px }
.metrics dd { font-size:26px; line-height:1.5; font-weight:700; font-variant-numeric:tabular-nums; letter-spacing:-.025em; overflow-wrap:anywhere }
.workspace { display:grid; grid-template-columns:190px minmax(0,1fr); align-items:start; gap:20px }
.selector { padding:16px 10px }
.selector h2 { margin:0 10px 14px; font-size:13px; color:var(--muted) }
#project-list { display:grid; gap:6px }
.project-button { display:flex; flex-direction:column; align-items:flex-start; gap:2px; text-align:left; width:100%; white-space:normal; overflow-wrap:anywhere; border:1px solid transparent; background:transparent; font-weight:600 }
.project-button small { font-size:11px; font-weight:400 }
.project-button[aria-current=true] { background:var(--accent-soft); border-color:#f4d9c5; color:var(--accent) }
.detail { min-width:0; display:grid; gap:20px }
.project-header,.rules { padding:22px }
.project-header h2 { overflow-wrap:anywhere }
.readiness { padding:0; margin-top:9px; list-style:none; display:flex; flex-wrap:wrap; gap:6px 16px; font-size:12px }
.readiness li::before { content:' '; display:inline-block; width:6px; height:6px; background:currentColor; border-radius:50%; margin-right:6px; vertical-align:middle }
[data-tone=good] { color:var(--good) }
[data-tone=warn] { color:var(--warn) }
.key-settings { display:flex; align-items:center; gap:9px; color:var(--muted); flex-wrap:wrap; font-size:12px }
.key-settings button { font-size:12px }
.provider { margin-top:18px; padding:18px; border:1px solid var(--border); border-radius:10px; background:#fcfcfd }
.provider h3 { margin-bottom:10px }
.provider>p { margin-bottom:10px; color:var(--warn); font-size:12px }
.channel { border-top:1px solid var(--border); padding:16px 0 0 }
.channel+.channel { margin-top:18px }
.channel-title label { display:inline-flex; align-items:center; gap:9px; color:var(--text); cursor:pointer; font-weight:600; min-height:32px }
.channel-title input { width:17px; height:17px; min-height:0; padding:0; margin:0 }
.channel-title p { font-size:12px; text-align:right }
.fields { display:grid; grid-template-columns:repeat(auto-fit,minmax(130px,1fr)); gap:12px; margin-top:14px }
.fields label { min-width:0; display:grid; gap:6px; align-content:start; font-size:12px }
.fields :is(select,input) { width:100%; min-width:0; font-size:14px }
.fields :disabled { opacity:.55 }
.rules-heading p { font-size:12px; margin-top:4px }
.rules-footer { margin-top:20px; padding-top:18px; border-top:1px solid var(--border); justify-content:flex-end; flex-wrap:wrap }
#save-status { margin-right:auto; color:var(--good) }
.notice { border:1px solid #efd4b8; border-radius:8px; padding:12px 16px; margin-bottom:20px; color:var(--warn); background:#fff9f1; overflow-wrap:anywhere }
.login { width:min(100%,420px); margin:8vh auto; padding:32px }
.login-icon { width:48px; height:48px; border-radius:14px; background:var(--accent-soft); color:var(--accent); display:grid; place-items:center; margin-bottom:20px }
.login-icon svg { width:26px; height:26px }
.login h1 { font-size:23px }
.login>p { margin-top:6px; font-size:13px }
.login form { display:grid; gap:9px; margin-top:26px }
.login form>label { margin-top:7px; font-size:13px; font-weight:500; color:var(--text) }
.login input { width:100% }
.login button { width:100%; margin-top:14px }
.login small { font-size:12px }
.login-foot { border-top:1px solid var(--border); margin-top:24px; padding-top:18px; text-align:center; font-size:12px }
.login-foot a { font-weight:600 }
body.signed-out .sidebar { display:none }
body.signed-out .main,body.signed-out .topbar { margin-left:0 }
body.signed-out .topbar { justify-content:space-between }
.login-brand { font-weight:700; font-size:16px; color:var(--text); display:flex; align-items:center; gap:9px }
body:not(.signed-out) .login-brand { display:none }
body.signed-out .breadcrumbs { display:none }
body.signed-out #menu-toggle { display:none }
dialog { width:min(480px,calc(100% - 32px)); padding:26px; color:var(--text); max-height:calc(100dvh - 40px); overflow:auto }
dialog::backdrop { background:#18253b66 }
dialog p { margin-top:10px; font-size:13px }
dialog input { width:100%; margin-top:10px }
dialog .actions { margin-top:22px }
#otp-field,.dialog-form { display:grid; gap:8px }
.dialog-form { margin-top:18px }
.dialog-form label { display:block; font-size:13px }
#otp-field input,.dialog-form :is(input,select) { width:100%; margin-top:6px }
.routing-fields { border-top:1px solid var(--border); margin-top:18px; padding-top:18px }
.routing-fields>label { margin-right:12px; font-size:13px }
#finance { display:grid; gap:16px; margin-top:18px }
.finance-metrics { margin:0; grid-template-columns:repeat(auto-fit,minmax(160px,1fr)) }
.finance-metrics>div { padding:16px }
.finance-metrics dd { font-size:21px }
.money-list { display:grid; gap:0 }
.money-list>div { display:flex; justify-content:space-between; gap:12px; flex-wrap:wrap; border-bottom:1px solid var(--border); padding:12px 0 }
.money-list dt { color:var(--muted); font-size:13px }
.money-list dd { font-variant-numeric:tabular-nums; font-weight:600; overflow-wrap:anywhere }
#finance details { border-block:1px solid var(--border); padding-block:16px }
#finance summary { cursor:pointer; font-weight:600; min-height:28px }
#finance details>dl { margin-top:10px }
#settlement-form { align-items:end }
.orders-scroll { overflow:auto; border-block:1px solid var(--border); max-height:600px }
.orders-scroll:focus-visible { outline-offset:-3px }
.orders-table { width:100%; border-collapse:collapse; white-space:nowrap; font-variant-numeric:tabular-nums; font-size:13px }
.orders-table :is(th,td) { padding:16px 20px; border-bottom:1px solid var(--border); text-align:left }
.orders-table th { color:var(--muted); background:#fafbfc; position:sticky; top:0; font-size:12px; font-weight:500; z-index:1 }
.orders-table tbody tr:last-child td { border-bottom:0 }
.orders-table tbody tr:hover { background:#fffaf6 }
.orders-table .numeric { text-align:right }
.table-card { overflow:hidden }
.table-heading { padding:20px 24px; display:flex; align-items:center; justify-content:space-between; gap:16px }
.table-heading p { font-size:12px; margin-top:3px }
.table-footer { padding:16px 24px; display:flex; justify-content:space-between; align-items:center; gap:16px; font-size:12px; color:var(--muted) }
.table-footer button { font-size:12px }
.empty-state { min-height:190px; display:flex; align-items:center; justify-content:center; flex-direction:column; gap:14px; color:var(--muted); text-align:center; white-space:normal }
.empty-state svg { width:44px; height:44px; color:#a0a7b2; stroke-width:1 }
.banner { display:flex; align-items:center; gap:12px; padding:12px 16px; border-left:3px solid var(--accent); margin-bottom:24px; font-size:12px }
.banner svg { width:18px; height:18px; color:var(--accent); flex-shrink:0 }
.banner p { color:#586376 }
.banner strong { color:var(--accent); margin-right:10px; font-weight:600 }
.hero-grid { display:grid; grid-template-columns:minmax(220px,.8fr) minmax(0,1.8fr); gap:20px; margin-bottom:24px }
.profile-card { padding:24px }
.profile-heading { display:flex; align-items:center; gap:12px; padding:18px 0; border-bottom:1px solid var(--border) }
.profile-heading .avatar { width:42px; height:42px }
.profile-heading strong { overflow-wrap:anywhere }
.profile-heading small { display:block; font-size:11px; letter-spacing:.04em }
.profile-card dl { margin-top:8px }
.profile-card .money-list>div { border:0; padding:7px 0; font-size:12px }
.profile-card .money-list dt { font-size:12px }
.wallet-card { background:linear-gradient(115deg,#ff8a28,#ffb36d); border:1px solid #f69142; border-radius:var(--radius); padding:25px 30px; color:#43230f; position:relative; overflow:hidden; box-shadow:0 8px 20px #d47b2514; min-height:245px }
.wallet-card::before,.wallet-card::after { content:''; width:230px; height:230px; border-radius:50%; background:#ffffff17; position:absolute; right:-60px; top:-80px; pointer-events:none }
.wallet-card::after { width:170px; height:170px; top:auto; bottom:-100px; right:25% }
.wallet-heading { display:flex; align-items:center; justify-content:space-between; gap:12px; position:relative; z-index:1 }
.wallet-heading h2 { display:flex; align-items:center; gap:10px }
.wallet-heading svg { width:21px; height:21px }
.wallet-chip { border:1px solid #43230f35; padding:3px 9px; border-radius:20px; font-size:11px; font-weight:600; background:#ffffff25 }
.wallet-label { margin-top:20px; font-size:12px; color:inherit; position:relative }
.wallet-total { font-size:42px; line-height:1.3; font-weight:700; font-variant-numeric:tabular-nums; letter-spacing:-.025em; position:relative; overflow-wrap:anywhere }
.wallet-bottom { display:flex; gap:38px; margin-top:18px; position:relative }
.wallet-bottom dt { font-size:11px; opacity:.85 }
.wallet-bottom dd { font-size:17px; font-weight:650; font-variant-numeric:tabular-nums }
.wallet-note { font-size:11px; color:inherit; margin-top:12px }
.chart-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:20px; margin-bottom:24px }
.chart-card { padding:20px 24px }
.chart-caption { font-size:11px; margin-top:5px }
.ring-wrap { width:172px; height:172px; position:relative; margin:20px auto 0 }
.ring-wrap svg { width:100%; height:100%; transform:rotate(-90deg) }
.ring-track,.ring-value { fill:none; stroke-width:12 }
.ring-track { stroke:#f0f2f5 }
.ring-value { stroke:var(--chart-orange) }
.chart-card:nth-child(2) .ring-value { stroke:var(--chart-teal) }
.chart-card:nth-child(3) .ring-value { stroke:var(--chart-blue) }
.ring-center { position:absolute; inset:0; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:2px }
.ring-center strong { font-size:clamp(14px,1.55vw,21px); font-weight:700; font-variant-numeric:tabular-nums; max-width:80%; overflow-wrap:anywhere; text-align:center; line-height:1.3 }
.ring-center span { font-size:11px; color:var(--muted); max-width:80%; text-align:center }
.tag { display:inline-flex; align-items:center; gap:4px; padding:3px 8px; border-radius:5px; background:var(--raised); color:#566277; font-size:11px; font-weight:500 }
.tag.success { background:#e8f7f0; color:var(--good) }
.tag.warning { background:#fff5df; color:var(--warn) }
.tag.test { background:#eef3ff; color:#435e9c }
.access-form { margin-top:14px; display:grid; gap:12px }
.access-form label { font-size:12px; display:grid; gap:6px }
.access-form .actions { justify-content:flex-start }
.access-form input { max-width:420px; width:100% }
.muted { color:var(--muted); font-size:12px }
.page-foot { margin-top:32px; font-size:11px; color:var(--muted); text-align:center }
body[data-admin-view=overview] #admin-workspace { display:none }
body[data-admin-view=finance] :is(#rules-form,#access-panel,.key-settings) { display:none }
body:not([data-admin-view=finance]) #admin-finance { display:none }
@media(min-width:1600px) { .main { padding-inline:48px } }
@media(max-width:1100px) {
  .sidebar { width:204px }
  .main,.topbar { margin-left:204px; padding-inline:24px }
  .workspace { grid-template-columns:160px minmax(0,1fr); gap:16px }
  .project-header { align-items:flex-start; flex-wrap:wrap }
  .hero-grid { grid-template-columns:minmax(210px,.9fr) minmax(0,1.5fr); gap:16px }
  .wallet-card { padding:24px }
  .wallet-total { font-size:36px }
  .chart-card { padding:18px }
  .chart-grid { gap:16px }
  .ring-wrap { width:150px; height:150px }
}
@media(max-width:900px) {
  .sidebar { transform:translateX(-100%); width:240px; transition:transform 180ms }
  .main,.topbar { margin-left:0 }
  #menu-toggle { display:inline-flex; padding:10px; background:transparent; border:0 }
  .topbar { padding-inline:16px }
  .menu-open .sidebar { transform:translateX(0) }
  .menu-open #nav-scrim { display:block; position:fixed; inset:0; background:#18253b60; border:0; border-radius:0; z-index:30 }
  .menu-open { overflow:hidden }
  .main { padding:24px }
}
@media(max-width:640px) {
  :root { font-size:16px }
  .main { padding:20px 16px 32px }
  .topbar { gap:8px; height:64px }
  .breadcrumbs { gap:6px; font-size:12px }
  .breadcrumbs>.crumb-root,.breadcrumbs>svg { display:none }
  .account-copy { display:none }
  .header-account { gap:6px }
  .header-account button { margin-left:0; padding:10px; font-size:12px }
  h1 { font-size:22px }
  .section-title { gap:16px; flex-wrap:wrap; margin-bottom:20px }
  .section-title>.actions { width:100%; justify-content:flex-start }
  .metrics { grid-template-columns:minmax(0,1fr); gap:12px; margin-bottom:20px }
  .metrics>div { display:flex; align-items:center; justify-content:space-between; padding:16px 20px; gap:12px }
  .metrics dd { font-size:24px }
  .workspace { grid-template-columns:minmax(0,1fr); gap:16px }
  .selector { padding:14px }
  .selector h2 { margin:0 0 10px }
  #project-list { grid-template-columns:repeat(auto-fit,minmax(125px,1fr)); gap:8px }
  .project-header,.rules { padding:18px }
  .provider { padding:14px }
  .fields { grid-template-columns:repeat(2,minmax(0,1fr)) }
  .fields :is(select,input),.access-form input { font-size:16px }
  .channel-title { align-items:flex-start; gap:12px }
  .channel-title label { font-size:14px }
  .rules-heading { align-items:flex-start }
  .rules-heading p { line-height:1.7 }
  .hero-grid { grid-template-columns:minmax(0,1fr); gap:16px; margin-bottom:20px }
  .hero-grid .wallet-card { grid-row:1 }
  .wallet-card { padding:22px; min-height:260px }
  .wallet-total { font-size:38px }
  .wallet-bottom { gap:32px }
  .profile-card { padding:20px }
  .chart-grid { grid-template-columns:minmax(0,1fr); gap:16px; margin-bottom:20px }
  .chart-card { padding:20px }
  .ring-wrap { width:180px; height:180px; margin-top:14px }
  .ring-center strong { font-size:21px }
  .table-heading { padding:18px }
  .table-footer { padding:16px; align-items:flex-start; flex-wrap:wrap }
  .orders-table :is(th,td) { padding:14px 16px }
  .banner { align-items:flex-start; margin-bottom:20px }
  .banner p { font-size:12px }
  .banner strong { display:block }
  .login { padding:24px; margin:6vh auto }
  .login input { font-size:16px }
  .login-brand { font-size:14px }
  .wallet-chip { max-width:45%; overflow-wrap:anywhere }
  .finance-metrics { grid-template-columns:minmax(0,1fr) }
  .login-foot { font-size:12px }
}
@media(prefers-reduced-motion:reduce) { *,*::before,*::after { transition:none !important; animation:none !important; scroll-behavior:auto !important } }
