@import url("/assets/admin-base.css");

[hidden] { display:none !important; }
html, body { min-width:0; overflow-x:hidden; }
#portal-app :is(button,select,input) { min-height:44px; }
.portal-shell { min-width:0; min-height:100dvh; color:var(--ink); background:var(--canvas); }
#portal-app button:where(:not(.admin-account-entry button)) { border:1px solid var(--line); border-radius:9px; color:var(--ink); background:var(--paper); cursor:pointer; font-weight:600; }
#portal-app button:not(:disabled):hover { border-color:var(--control-focus); }

#portal-status { position:fixed; z-index:80; right:22px; bottom:20px; max-width:min(520px,calc(100vw - 44px)); margin:0; padding:10px 14px; border:1px solid var(--line); border-radius:10px; color:var(--muted); background:rgba(255,255,255,.96); box-shadow:0 8px 24px rgba(23,33,43,.08); }
#portal-status:empty { display:none; }
#portal-status[role="alert"] { color:#b42318; border-color:#fecaca; background:#fff7f7; }

.admin-brand img { display:block; width:142px; height:auto; }
.admin-navigation a[aria-current="page"] { color:#252b37; background:#eceef7; }
.admin-nav-icon { color:#111; }
.admin-nav-icon svg { width:24px; height:24px; }
.admin-nav-icon [data-nav-weight="fill"] { display:none; }
.admin-navigation a:is(:hover,[aria-current="page"]) [data-nav-weight="regular"] { display:none; }
.admin-navigation a:is(:hover,[aria-current="page"]) [data-nav-weight="fill"] { display:block; }
.partner-profile-dialog { width:min(760px,calc(100vw - 32px)); max-height:calc(100dvh - 32px); overflow:auto; padding:0; border:1px solid #dfe3eb; border-radius:16px; color:#4e5261; background:#fff; box-shadow:0 28px 80px rgba(20,28,45,.26); }
.partner-profile-dialog::backdrop { background:rgba(24,30,42,.42); }
.partner-profile-dialog > header { display:flex; justify-content:space-between; align-items:center; padding:18px 20px; border-bottom:1px solid #edf0f4; }
.partner-profile-dialog h2 { margin:0; color:#1b2436; font-size:16px; }
.partner-profile-dialog > header button { width:30px; height:30px; padding:0; border:0; border-radius:8px; color:#697386; background:transparent; font-size:22px; cursor:pointer; }

.portal-area .admin-subhead h2 { margin:0; color:#151d2d; font-size:28px; line-height:1.2; letter-spacing:-.04em; }
.portal-area .admin-subhead > div > span { display:block; max-width:800px; margin-top:9px; color:#768094; font-size:12px; line-height:1.65; }
.data-panel { min-width:0; margin-top:20px; }
.data-panel > h3 { margin:0; padding:18px 20px; border-bottom:1px solid #edf0f4; color:#1b2436; font-size:16px; }
.panel-heading { display:flex; flex-wrap:wrap; justify-content:space-between; gap:18px; align-items:center; }
.panel-heading h3 { margin:0; color:#1b2436; font-size:16px; }
.panel-heading > div:first-child p { margin:5px 0 0; color:var(--muted); }
.data-panel > .hint { margin:0; padding:13px 20px; border-top:1px solid #edf0f4; color:var(--muted); background:#fafbfc; font-size:12px; }
.data-panel > button:not([hidden]) { display:block; min-width:168px; min-height:40px; margin:0 auto 20px; color:#4d50b8; border-color:#d9d5ff; border-radius:999px; }
.portal-filters { display:grid; grid-template-columns:auto minmax(140px,190px); gap:9px; align-items:center; }
.portal-filters label { color:var(--muted); font-size:13px; font-weight:600; }
.portal-filters select,#withdrawal-form :is(input,select) { width:100%; min-width:0; padding:0 12px; border:1px solid var(--line); border-radius:9px; color:var(--ink); background:var(--paper); }
.table-scroll { min-width:0; max-width:100%; overflow:auto; }
.table-scroll table { width:100%; min-width:720px; }
#orders-region table,#withdrawals-region table { min-width:1040px; }
.table-scroll td { vertical-align:top; overflow-wrap:anywhere; }
.metric-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); margin:0; padding:6px 20px 20px; }
.metric-grid > div { min-width:0; padding:20px 18px; border-right:1px solid #edf0f4; border-bottom:1px solid #edf0f4; }
.metric-grid > div:nth-child(3n) { border-right:0; }
.metric-grid dt { color:var(--muted); font-size:12px; }
.metric-grid dd { margin:8px 0 0; color:#20263a; font-size:22px; font-weight:750; letter-spacing:-.025em; }
#open-withdrawal { padding:0 16px; color:#fff; border-color:#1d1f23; background:#1d1f23; }

#withdrawal-dialog { width:min(620px,calc(100vw - 32px)); max-height:calc(100dvh - 32px); padding:0; border:1px solid var(--line); border-radius:18px; color:var(--ink); background:var(--paper); box-shadow:0 28px 80px rgba(15,23,42,.24); }
#withdrawal-dialog::backdrop { background:rgba(28,34,46,.46); backdrop-filter:blur(3px); }
#withdrawal-form { display:grid; max-height:calc(100dvh - 34px); gap:8px; overflow:auto; padding:22px; }
#withdrawal-form > header,#withdrawal-form > footer { display:flex; justify-content:space-between; gap:12px; align-items:center; }
#withdrawal-form label { color:var(--muted); font-size:13px; font-weight:600; }
#withdrawal-form h2 { margin:0; font-size:21px; }
#close-withdrawal { width:44px; padding:0; border:0; border-radius:50%; font-size:24px; }
#withdrawal-message { margin:8px 0; color:var(--muted); font-size:12px; }
#withdrawal-form > footer { position:sticky; bottom:-22px; justify-content:flex-end; margin:8px -22px -22px; padding:15px 22px; border-top:1px solid var(--line); background:var(--paper); }
#withdrawal-form > footer button { padding:0 16px; }
#withdrawal-form > footer button:last-child { color:#fff; border-color:#1d1f23; background:#1d1f23; }

@media (max-width:1199px) {
  .metric-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .metric-grid > div:nth-child(3n) { border-right:1px solid #edf0f4; }
  .metric-grid > div:nth-child(2n) { border-right:0; }
}

@media (max-width:820px) {
  .partner-sidebar-foot { display:flex; margin-top:0; padding:4px 8px 0; }
  .partner-sidebar-foot .admin-account-card { top:calc(100% + 8px); right:0; bottom:auto; left:0; width:min(280px,calc(100vw - 44px)); max-height:calc(100dvh - 220px); }
  .portal-area.admin-subpage { min-height:0; padding-top:28px; }
}

@media (max-width:720px) {
  .admin-navigation { width:100%; }
  .admin-navigation a { min-width:max-content; padding:0 14px; }
  .admin-nav-icon { margin-right:8px; }
  .portal-area .admin-subhead { align-items:flex-start; padding-right:0; padding-left:0; }
  .portal-area .admin-subhead h2 { font-size:25px; }
  .portal-filters { width:100%; grid-template-columns:1fr; }
  .panel-heading { align-items:flex-start; }
  .panel-heading > :is(div,button) { width:100%; }
  .metric-grid { grid-template-columns:1fr; padding:4px 16px 16px; }
  .metric-grid > div,.metric-grid > div:nth-child(2n),.metric-grid > div:nth-child(3n) { border-right:0; }
  .table-scroll { overflow:visible; padding:12px; }
  .table-scroll table,.table-scroll tbody { display:block; width:100%; min-width:0 !important; }
  .table-scroll thead { position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; }
  .table-scroll tbody { display:grid; gap:12px; }
  .table-scroll tr { display:grid; overflow:hidden; border:1px solid var(--line); border-radius:11px; background:var(--paper); }
  .table-scroll td { display:grid; min-width:0; grid-template-columns:minmax(94px,36%) minmax(0,1fr); gap:10px; padding:11px 12px; white-space:normal; }
  .table-scroll td::before { color:var(--muted); font-weight:700; }
  .table-scroll td[colspan] { grid-template-columns:1fr; text-align:center; }
  .table-scroll td[colspan]::before { display:none; }
  #customers-body td:nth-child(1)::before { content:"客户编号"; } #customers-body td:nth-child(2)::before { content:"绑定时间"; }
  #orders-body td:nth-child(1)::before { content:"订单编号"; } #orders-body td:nth-child(2)::before { content:"客户编号"; } #orders-body td:nth-child(3)::before { content:"商品"; } #orders-body td:nth-child(4)::before { content:"状态"; } #orders-body td:nth-child(5)::before { content:"实付"; } #orders-body td:nth-child(6)::before { content:"佣金 / 比例"; } #orders-body td:nth-child(7)::before { content:"创建 / 支付时间"; }
  #withdrawals-body td:nth-child(1)::before { content:"申请编号"; } #withdrawals-body td:nth-child(2)::before { content:"金额"; } #withdrawals-body td:nth-child(3)::before { content:"状态 / 原因"; } #withdrawals-body td:nth-child(4)::before { content:"收款资料"; } #withdrawals-body td:nth-child(5)::before { content:"计划付款日"; } #withdrawals-body td:nth-child(6)::before { content:"付款凭证"; } #withdrawals-body td:nth-child(7)::before { content:"申请 / 处理时间"; }
  #withdrawal-dialog { width:calc(100vw - 20px); max-height:calc(100dvh - 20px); }
  #withdrawal-form { max-height:calc(100dvh - 22px); padding:18px; }
  #withdrawal-form > footer { margin:8px -18px -18px; padding:13px 18px max(13px,env(safe-area-inset-bottom)); }
  #withdrawal-form > footer button { flex:1; }
  #portal-status { right:12px; bottom:12px; max-width:calc(100vw - 24px); }
}
