/* Scoped to the private workspace; public tool layouts keep their existing styles. */
body.admin-redesign-active{--ad-bg:#f5f6f8;--ad-surface:#fff;--ad-ink:#242733;--ad-muted:#747c8b;--ad-line:#e5e8ef;--ad-accent:#775ca2;--ad-accent-bg:#f2edf9;--ad-hover:#f8f9fb;--ad-green:#2d8267;--ad-green-bg:#eaf6f0;--ad-amber:#a97524;--ad-amber-bg:#fff5e3;--ad-red:#b45363;--ad-red-bg:#fceef0;background:var(--ad-bg);color:var(--ad-ink);}
html[data-theme=dark] body.admin-redesign-active{--ad-bg:#171a21;--ad-surface:#20242d;--ad-ink:#e9edf5;--ad-muted:#a2abba;--ad-line:#323743;--ad-accent:#c2a6ef;--ad-accent-bg:#342d46;--ad-hover:#272c36;--ad-green:#7dcbac;--ad-green-bg:#263b34;--ad-amber:#e3ba7c;--ad-amber-bg:#3b3428;--ad-red:#efa2ae;--ad-red-bg:#3c2932;}
body.admin-redesign-active>.promo-banner,body.admin-redesign-active .app>.topbar,body.admin-redesign-active .site-header,body.admin-redesign-active .app>header,body.admin-redesign-active .site-footer{display:none!important}
body.admin-redesign-active .app,body.admin-redesign-active .app>main,body.admin-redesign-active .main,body.admin-redesign-active #adminView{width:100%;max-width:none;margin:0;padding:0;min-height:100vh;overflow:visible;display:block;}
body.admin-redesign-active #adminView>.admin-panel{display:none!important}
#adminWorkspace{font:14px/1.6 -apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC",sans-serif;color:var(--ad-ink);text-align:left;letter-spacing:normal;}
#adminWorkspace *{box-sizing:border-box;}
#adminWorkspace [hidden]{display:none!important;}
#adminWorkspace button,#adminWorkspace input,#adminWorkspace select{font:inherit;color:inherit;letter-spacing:normal;}
#adminWorkspace button{cursor:pointer;box-shadow:none;transition:none;}
#adminWorkspace button:disabled{opacity:.45;cursor:default;}
#adminWorkspace a{color:inherit;text-decoration:none;}
#adminWorkspace :is(a,button,input,select):focus-visible{outline:3px solid #ac93d080;outline-offset:3px;}
#adminWorkspace .ad-skip{position:fixed;top:-100px;left:20px;background:var(--ad-surface);padding:12px;z-index:110;}
#adminWorkspace .ad-skip:focus{top:10px;}
#adminWorkspace .ad-sidebar{position:fixed;inset:0 auto 0 0;width:216px;border-right:1px solid var(--ad-line);background:var(--ad-surface);padding:28px 18px 18px;display:flex;flex-direction:column;z-index:10;overflow:auto;}
#adminWorkspace .ad-brand{display:flex;gap:11px;align-items:center;font-size:18px;font-weight:750;padding:0 12px 30px;}
#adminWorkspace .ad-mark{display:grid;place-items:center;width:35px;height:35px;border-radius:11px;background:#9e324d;color:white;font-size:23px;font-weight:800;}
#adminWorkspace .ad-brand small{display:block;color:var(--ad-muted);font-size:11px;font-weight:450;letter-spacing:2px;}
#adminWorkspace .ad-nav-label{font-size:11px;color:var(--ad-muted);padding:0 14px;margin:8px 0;letter-spacing:1px;}
#adminWorkspace #adminNavigation{display:grid;gap:4px;}
#adminWorkspace .ad-nav-item{display:flex;align-items:center;gap:12px;padding:10px 14px;border-radius:8px;color:var(--ad-muted);font-weight:550;white-space:nowrap;}
#adminWorkspace .ad-nav-item svg{height:18px;width:18px;flex-shrink:0;}
#adminWorkspace .ad-nav-item:hover{color:var(--ad-ink);background:var(--ad-hover);}
#adminWorkspace .ad-nav-item.active{color:var(--ad-accent);background:var(--ad-accent-bg);}
#adminWorkspace .ad-nav-count{margin-left:auto;background:var(--ad-amber-bg);color:var(--ad-amber);font-size:11px;padding:0 6px;border-radius:4px;}
#adminWorkspace .ad-secondary{border-top:1px solid var(--ad-line);padding-top:14px;margin-top:18px;}
#adminWorkspace .ad-sidebar-bottom{margin-top:auto;padding-top:20px;display:grid;gap:8px;}
#adminWorkspace .ad-workspace{margin-left:216px;min-height:100vh;}
#adminWorkspace .ad-topbar{height:70px;display:flex;align-items:center;justify-content:space-between;padding:0 36px;border-bottom:1px solid var(--ad-line);background:var(--ad-surface);}
#adminWorkspace .ad-muted{color:var(--ad-muted);}
#adminWorkspace #adminContent,#adminWorkspace #adminEmbedded,#adminWorkspace #adminLegacySlot{max-width:1460px;margin:auto;padding:30px 36px 18px;}
#adminWorkspace #adminEmbedded,#adminWorkspace #adminLegacySlot{padding-top:0;}
#adminWorkspace .ad-heading{display:flex;gap:20px;align-items:center;justify-content:space-between;margin-bottom:24px;}
#adminWorkspace h1{font-size:25px;font-weight:680;margin:0 0 5px;line-height:1.4;}
#adminWorkspace .ad-heading p{font-size:13px;color:var(--ad-muted);margin:0;}
#adminWorkspace .ad-updated{font-size:11px;color:var(--ad-muted);white-space:nowrap;}
#adminWorkspace .ad-stats{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:16px;margin-bottom:24px;}
#adminWorkspace .ad-stat{border:1px solid var(--ad-line);border-radius:11px;background:var(--ad-surface);padding:20px;text-align:left;}
#adminWorkspace .ad-stat>span{display:flex;align-items:center;justify-content:space-between;font-size:12px;color:var(--ad-muted);}
#adminWorkspace .ad-stat svg{width:17px;height:17px;}
#adminWorkspace .ad-stat strong{display:block;font-size:31px;font-weight:650;margin:8px 0 4px;}
#adminWorkspace .ad-stat small{font-size:11px;color:var(--ad-muted);}
#adminWorkspace .ad-card{border:1px solid var(--ad-line);border-radius:11px;background:var(--ad-surface);overflow:hidden;}
#adminWorkspace .ad-card-head{display:flex;justify-content:space-between;align-items:center;gap:12px;padding:19px 22px;}
#adminWorkspace h2{font-size:14px;font-weight:650;margin:0;}
#adminWorkspace .ad-overview-grid{display:grid;grid-template-columns:1fr 1fr;gap:20px;margin-top:20px;}
#adminWorkspace .ad-table-scroll{overflow:auto;}
#adminWorkspace table{border-collapse:collapse;width:100%;min-width:820px;text-align:left;font-size:12px;}
#adminWorkspace th{font-size:11px;font-weight:550;color:var(--ad-muted);background:var(--ad-hover);padding:12px 20px;white-space:nowrap;border-block:1px solid var(--ad-line);}
#adminWorkspace td{padding:15px 20px;border-bottom:1px solid var(--ad-line);vertical-align:middle;}
#adminWorkspace tbody tr:last-child td{border-bottom:0;}
#adminWorkspace tbody tr:hover{background:var(--ad-hover);}
#adminWorkspace td strong{font-weight:550;display:block;max-width:280px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
#adminWorkspace td small{font-size:10px;color:var(--ad-muted);display:block;margin-top:3px;}
#adminWorkspace .ad-button{background:var(--ad-surface);border:1px solid var(--ad-line);border-radius:7px;padding:8px 13px;white-space:nowrap;font-size:12px;font-weight:550;}
#adminWorkspace .ad-button:hover{background:var(--ad-hover);}
#adminWorkspace .ad-link{border:0;background:none;color:var(--ad-accent);padding:4px 0;font-size:12px;white-space:nowrap;}
#adminWorkspace .ad-mini-row{padding:15px 22px;border-top:1px solid var(--ad-line);display:flex;align-items:center;justify-content:space-between;gap:12px;}
#adminWorkspace .ad-mini-row strong{display:block;font-size:12px;font-weight:550;overflow-wrap:anywhere;}
#adminWorkspace .ad-mini-row small{font-size:11px;color:var(--ad-muted);display:block;}
#adminWorkspace .ad-status{display:inline-flex;align-items:center;padding:3px 9px;border-radius:5px;font-size:11px;white-space:nowrap;color:var(--ad-muted);background:var(--ad-hover);}
#adminWorkspace .ad-status.paid,#adminWorkspace .ad-status.succeeded,#adminWorkspace .ad-status.refunded,#adminWorkspace .ad-status.sent{color:var(--ad-green);background:var(--ad-green-bg);}
#adminWorkspace .ad-status.pending,#adminWorkspace .ad-status.queued,#adminWorkspace .ad-status.reviewing,#adminWorkspace .ad-status.needs_info{color:var(--ad-amber);background:var(--ad-amber-bg);}
#adminWorkspace .ad-status.failed,#adminWorkspace .ad-status.declined{color:var(--ad-red);background:var(--ad-red-bg);}
#adminWorkspace .ad-status.running,#adminWorkspace .ad-status.approved{color:var(--ad-accent);background:var(--ad-accent-bg);}
#adminWorkspace .ad-list-top{display:flex;align-items:center;justify-content:space-between;padding:0 22px;border-bottom:1px solid var(--ad-line);gap:12px;font-size:11px;color:var(--ad-muted);}
#adminWorkspace .ad-segments{display:flex;gap:22px;overflow-x:auto;}
#adminWorkspace .ad-segment{background:none;border:0;border-bottom:2px solid transparent;padding:15px 0 12px;white-space:nowrap;font-size:12px;color:var(--ad-muted);}
#adminWorkspace .ad-segment.active{color:var(--ad-accent);border-bottom-color:var(--ad-accent);}
#adminWorkspace .ad-filters{display:flex;align-items:center;flex-wrap:wrap;gap:10px;padding:17px 22px;}
#adminWorkspace .ad-filters input{flex:1 1 240px;min-width:180px;}
#adminWorkspace .ad-filters select{min-width:105px;}
#adminWorkspace :is(.ad-filters,.ad-table-footer) :is(input,select){border:1px solid var(--ad-line);border-radius:7px;background:var(--ad-surface);padding:8px 11px;font-size:12px;min-height:38px;width:auto;}
#adminWorkspace .ad-table-footer{display:flex;justify-content:space-between;align-items:center;gap:12px;flex-wrap:wrap;padding:15px 22px;border-top:1px solid var(--ad-line);font-size:11px;color:var(--ad-muted);}
#adminWorkspace .ad-pagination{display:flex;align-items:center;gap:9px;}
#adminWorkspace [data-page-jump]{display:flex;gap:6px;}
#adminWorkspace [data-page-jump] input{width:64px;}
#adminWorkspace .ad-empty{padding:30px 22px;text-align:center;color:var(--ad-muted);font-size:13px;}
#adminWorkspace .ad-retry{display:block;margin:0 auto 25px;}
#adminWorkspace .ad-notice{padding:12px 16px;border:1px solid var(--ad-line);background:var(--ad-amber-bg);color:var(--ad-amber);border-radius:8px;font-size:12px;margin:0 0 20px;}
#adminWorkspace .ad-caption,#adminWorkspace .ad-filter-note{color:var(--ad-muted);font-size:11px;margin:14px 0;}
#adminWorkspace .ad-filter-note{padding:0 22px;}
#adminWorkspace .ad-note-card{margin-top:20px;padding:16px 22px;font-size:12px;color:var(--ad-muted);}
#adminWorkspace .ad-note-card summary{cursor:pointer;color:var(--ad-ink);font-weight:550;}
#adminWorkspace .ad-note-card p{margin:12px 0 0;}
#adminWorkspace .ad-footer{font-size:11px;color:var(--ad-muted);padding:18px 36px 24px;border:0;}
#adminWorkspace #adminPageMessage{margin:20px 36px 0;padding:12px 16px;border:1px solid var(--ad-line);border-radius:8px;background:var(--ad-red-bg);color:var(--ad-red);font-size:12px;}
#adminWorkspace .ad-backdrop{position:fixed;inset:0;background:#10162250;z-index:90;}
#adminWorkspace .ad-drawer{position:fixed;inset:0 0 0 auto;width:min(480px,100%);z-index:91;background:var(--ad-surface);overflow:auto;display:flex;flex-direction:column;box-shadow:-15px 0 60px #11182712;}
#adminWorkspace .ad-drawer-head{padding:25px 26px 20px;border-bottom:1px solid var(--ad-line);display:flex;justify-content:space-between;align-items:start;gap:16px;position:sticky;top:0;background:var(--ad-surface);z-index:1;}
#adminWorkspace .ad-drawer h2{font-size:19px;font-weight:650;}
#adminWorkspace .ad-drawer small{display:block;font-size:11px;color:var(--ad-muted);overflow-wrap:anywhere;}
#adminWorkspace .ad-icon-button{display:grid;place-items:center;border:1px solid var(--ad-line);background:var(--ad-surface);border-radius:7px;width:32px;height:32px;font-size:20px;}
#adminWorkspace .ad-drawer-body{padding:24px 26px;flex:1;}
#adminWorkspace .ad-detail-group{margin-bottom:24px;}
#adminWorkspace .ad-detail-group h3{font-size:11px;color:var(--ad-muted);border-bottom:1px solid var(--ad-line);padding-bottom:9px;margin:0 0 9px;}
#adminWorkspace .ad-detail-group dl{margin:0;}
#adminWorkspace .ad-detail-row{display:grid;grid-template-columns:110px minmax(0,1fr);gap:14px;padding:7px 0;font-size:12px;}
#adminWorkspace .ad-detail-row dt{color:var(--ad-muted);}
#adminWorkspace .ad-detail-row dd{margin:0;overflow-wrap:anywhere;}
#adminWorkspace .ad-reason{font-size:12px;line-height:1.8;white-space:pre-wrap;overflow-wrap:anywhere;background:var(--ad-hover);border-radius:7px;padding:13px 14px;}
#adminWorkspace .ad-drawer-footer{padding:18px 26px;border-top:1px solid var(--ad-line);background:var(--ad-surface);position:sticky;bottom:0;display:flex;gap:10px;flex-wrap:wrap;}
body.ad-drawer-open{overflow:hidden;}
/* Existing traffic/system/promotion widgets reuse their handlers and theme tokens. */
#adminWorkspace #adminEmbedded .admin-section{margin:0;padding:22px;border:1px solid var(--ad-line);border-radius:11px;background:var(--ad-surface);color:var(--ad-ink);}
#adminWorkspace #adminLegacySlot .admin-panel{display:block;max-height:none;height:auto;overflow:visible;width:auto;margin:0;padding:24px;background:var(--ad-surface);border:1px solid var(--ad-line);}
#adminWorkspace #adminLegacySlot .admin-tabs{position:static;flex-wrap:wrap;}
@media(max-width:1150px){#adminWorkspace .ad-sidebar{width:190px;}#adminWorkspace .ad-workspace{margin-left:190px;}#adminWorkspace #adminContent,#adminWorkspace #adminEmbedded,#adminWorkspace #adminLegacySlot{padding-left:26px;padding-right:26px;}#adminWorkspace .ad-topbar{padding:0 26px;}#adminWorkspace .ad-stats{gap:10px;}#adminWorkspace .ad-stat{padding:16px;}#adminWorkspace .ad-overview-grid{grid-template-columns:1fr;}#adminWorkspace .ad-updated{display:none;}}
@media(max-width:760px){#adminWorkspace .ad-sidebar{position:sticky;top:0;inset:auto;width:100%;padding:10px 14px;border:0;border-bottom:1px solid var(--ad-line);max-height:220px;}#adminWorkspace .ad-brand,#adminWorkspace .ad-nav-label{display:none;}#adminWorkspace #adminNavigation{display:flex;overflow-x:auto;gap:4px;}#adminWorkspace .ad-nav-item{padding:9px;font-size:12px;}#adminWorkspace .ad-sidebar-bottom{display:flex;justify-content:space-between;padding-top:8px;}#adminWorkspace .ad-workspace{margin-left:0;}#adminWorkspace .ad-topbar{height:54px;padding:0 18px;}#adminWorkspace #adminContent,#adminWorkspace #adminEmbedded,#adminWorkspace #adminLegacySlot{padding-left:16px;padding-right:16px;}#adminWorkspace .ad-stats{grid-template-columns:repeat(2,minmax(0,1fr));}#adminWorkspace .ad-filters{padding:14px;}#adminWorkspace .ad-filters input{flex-basis:100%;}#adminWorkspace .ad-segments{gap:16px;}#adminWorkspace .ad-list-top{padding:0 14px;}#adminWorkspace .ad-list-top>span{display:none;}#adminWorkspace .ad-pagination{flex-wrap:wrap;}#adminWorkspace .ad-footer{padding-left:16px;padding-right:16px;}}

body.admin-redesign-active .shell>.topbar{display:none!important;}
body.admin-redesign-active main.shell{margin:0;padding:0;max-width:none;display:block;width:100%;}

#adminWorkspace .ad-table-footer>label{display:flex;align-items:center;gap:7px;}


/* Lists keep their controls outside the scrolling data area. */
#adminWorkspace #adminContent.ad-list-layout{height:var(--ad-list-height);display:flex;flex-direction:column;}
#adminWorkspace .ad-list-layout>.ad-heading,#adminWorkspace .ad-list-layout>.ad-caption,#adminWorkspace .ad-list-layout>.ad-notice{flex-shrink:0;}
#adminWorkspace .ad-list-card{flex:1;min-height:0;display:flex;flex-direction:column;}
#adminWorkspace .ad-list-card>.ad-list-top,#adminWorkspace .ad-list-card>.ad-filters,#adminWorkspace .ad-list-card>.ad-filter-note,#adminWorkspace .ad-list-card>.ad-table-footer{flex-shrink:0;}
#adminWorkspace .ad-list-card>.ad-table-scroll{flex:1;min-height:0;overflow:auto;overscroll-behavior:contain;scrollbar-gutter:stable;}
#adminWorkspace .ad-list-card>.ad-empty{flex:1;min-height:0;}
#adminWorkspace .ad-list-card th{position:sticky;top:0;z-index:1;}
#adminWorkspace .ad-list-card>.ad-table-footer{background:var(--ad-surface);}

/* The redesigned workspace scrolls at document level, unlike the old panel. */
html:has(body.admin-entry.admin-redesign-active){height:auto;min-height:100%;overflow-y:auto;}
body.admin-entry.admin-redesign-active{height:auto;min-height:100vh;display:block;overflow:visible;}
body.admin-entry.admin-redesign-active main.shell{height:auto;overflow:visible;flex:none;}
#adminWorkspace .ad-workspace,#adminWorkspace #adminContent,#adminWorkspace .ad-card{min-width:0;}
#adminWorkspace .ad-sidebar{max-height:100dvh;}
#adminWorkspace .ad-section-heading{display:flex;justify-content:space-between;align-items:center;gap:16px;flex-wrap:wrap;margin-bottom:16px;}
#adminWorkspace .ad-section-heading h2,#adminWorkspace .ad-section-title{font-size:17px;margin:0 0 8px;}
#adminWorkspace .ad-section-heading p,#adminWorkspace .ad-today-payments p{font-size:12px;color:var(--ad-muted);margin:6px 0 0;}
#adminWorkspace .ad-today{margin-bottom:30px;}
#adminWorkspace .ad-today-stats{grid-template-columns:repeat(3,minmax(0,1fr));margin-bottom:16px;}
#adminWorkspace .ad-stat{min-width:0;overflow-wrap:anywhere;}
#adminWorkspace .ad-stat>span{gap:8px;align-items:flex-start;}
#adminWorkspace .ad-stat svg{flex:none;}
#adminWorkspace .ad-today-payments{padding:18px 22px;display:flex;align-items:center;justify-content:space-between;gap:16px;flex-wrap:wrap;overflow-wrap:anywhere;}
#adminWorkspace .ad-today-payments h3{font-size:12px;color:var(--ad-muted);margin:0 0 8px;font-weight:550;}
#adminWorkspace .ad-today-payments strong{font-size:20px;}
#adminWorkspace .ad-section-title{margin-bottom:16px;}
#adminWorkspace .ad-mini-row>div{min-width:0;}
#adminWorkspace .ad-mini-row>button{flex:none;}
#adminWorkspace .ad-filters input{min-width:0;max-width:100%;}
#adminWorkspace .ad-filters select{max-width:100%;}
#adminWorkspace .ad-list-top>span{flex:none;}
#adminWorkspace .ad-segments{min-width:0;}
#adminWorkspace .ad-pagination{flex-wrap:wrap;min-width:0;}
/* Keep close/actions visible and let long details scroll independently. */
#adminWorkspace .ad-drawer{height:100dvh;max-width:100vw;overflow:hidden;}
#adminWorkspace .ad-drawer-head{position:static;flex:none;max-height:33dvh;overflow:auto;}
#adminWorkspace .ad-drawer-head>div{min-width:0;}
#adminWorkspace .ad-drawer-head .ad-icon-button{flex:none;}
#adminWorkspace .ad-drawer-body{flex:1 1 auto;min-height:0;overflow:auto;overscroll-behavior:contain;}
#adminWorkspace .ad-drawer-footer{position:static;flex:none;max-height:30dvh;overflow:auto;}
body.admin-entry.admin-redesign-active.ad-drawer-open,html:has(body.admin-entry.admin-redesign-active.ad-drawer-open),body.admin-entry.admin-redesign-active.modal-open,html:has(body.admin-entry.admin-redesign-active.modal-open){overflow:hidden;}
@media(max-width:760px){
 #adminWorkspace .ad-sidebar{max-height:min(220px,40dvh);}
 #adminWorkspace .ad-today-stats{grid-template-columns:repeat(2,minmax(0,1fr));}
 #adminWorkspace .ad-today-payments{padding:16px;}
 #adminWorkspace .ad-drawer-head,#adminWorkspace .ad-drawer-body,#adminWorkspace .ad-drawer-footer{padding:16px;}
 #adminWorkspace .admin-owner-device-card{grid-template-columns:minmax(0,1fr);}
 #adminWorkspace .admin-owner-device-card>*{min-width:0;max-width:100%;}
 #adminWorkspace .admin-owner-device-card button{justify-self:start;white-space:normal;}
}
