/* Admin and seller/customer workspace only; loaded after the legacy page styles. */
@media screen {
    :root { --md-sys-color-surface-container-low:var(--tcgc-panel); }
    html body :is(.main,.shell,.wrap,.manager-grid,.seller-home,.home-grid,.card,.panel,.section-card,.portal-table-card,.allocation-card,.stack,.grid,.form-grid) { min-width:0; }
    html body :is(.card,.notice,.account-head,.management-modal-head) { overflow-wrap:break-word; }
    /* Table intrinsic widths must be based on whole words, never individual letters. */
    html body table { overflow-wrap:normal; word-break:normal; }
    html body :is(.status,.status-pill,.badge,.allocation-state,.order-type-pill,.brand-profile,.order-flag) {
        white-space:nowrap; overflow-wrap:normal; word-break:normal; flex-shrink:0;
    }
    html body .sheet-financial-status { min-width:96px; }
    html body .sheet-table td:has(.sheet-financial-status) { min-width:118px; }
    html body :is(.table-wrap,.spreadsheet-wrap,.sheet-wrap,.portal-table-wrap,.table-scroll,.allocation-table-wrap,.alibaba-doc-table-wrap,.tcgc-table-scroll) {
        min-width:0; max-width:100%; overflow:auto; overscroll-behavior-inline:contain;
        -webkit-overflow-scrolling:touch; scrollbar-color:#586577 var(--tcgc-panel); scrollbar-width:thin;
    }
    .tcgc-table-hint { margin:0; padding:8px 12px; color:var(--tcgc-muted); background:var(--tcgc-raised); font-size:12px; line-height:1.5; }
    html body .tcgc-table-scroll:focus-visible { outline:2px solid #e0bc74; outline-offset:-2px; }
    html body :is(.modal-overlay,.drawer-overlay,.product-modal-overlay,.client-modal-overlay,.adjust-modal-overlay,.label-modal-overlay,.management-modal-overlay,.cart-modal-overlay,.account-modal) {
        box-sizing:border-box; padding:16px; max-width:100%; overflow:auto; overscroll-behavior:contain;
    }
    html body :is(.drawer,.modal-content,.product-modal,.client-modal,.adjust-modal,.label-modal,.import-modal,.editor-modal,.management-modal,.cart-modal-content,.account-panel,dialog) {
        box-sizing:border-box; min-width:0; min-height:0; max-width:100%;
        max-height:calc(100vh - 32px); max-height:calc(100dvh - 32px); overflow:auto;
        overscroll-behavior:contain; overflow-wrap:break-word;
    }
    html body :is(dialog) { max-width:calc(100% - 32px); }
    /* Flex bodies use the actual remaining height, including wrapped headers. */
    html body :is(.order-detail-modal,.seller-order-detail-modal,.cart-modal-content) { display:flex; flex-direction:column; overflow:hidden!important; }
    html body :is(.order-detail-header,.seller-order-detail-header,.cart-modal-header) { flex:none; min-width:0; }
    html body :is(.order-detail-body,.seller-order-detail-body,.cart-modal-body) { flex:1 1 auto; min-height:0; max-height:none!important; overflow:auto; }
    html body .compact-order-body> * { flex-shrink:0; }
    html body :is(.modal-head,.drawer-head,.management-modal-head,.account-head,.share-card-head,.product-image-dialog-head,.order-share-head) { min-width:0; }
    html body :is(.modal-head,.drawer-head,.management-modal-head,.account-head,.share-card-head,.product-image-dialog-head,.order-share-head)>:first-child { min-width:0; }
    html body .account-head>:first-child { flex:1; }
    html body :is(.modal-close,.drawer-close,.product-modal-close,.product-image-dialog-close,.order-share-close,.share-card-close,.modal-x,.close-btn,.account-close) { flex-shrink:0; min-width:44px; min-height:44px; display:inline-grid; place-items:center; }
    html body :is(.modal-head,.drawer-head)>.modal-close { position:static; }
    html body :is(.form-grid,.grid,.manager-form,.order-line)> * { min-width:0; }
    html body :is(input:not([type=checkbox]):not([type=radio]),select,textarea) { max-width:100%; }
    html body.tcgc-dialog-open { overflow:hidden; }
    html body :is(.seller-home,.cart-modal-body) { background:var(--tcgc-bg)!important; }
    html body :is(.editor-modal,.account-panel,.cs-option,.voucher-history,.detail-item,.invoice-preview-summary,.invoice-preview-items,.login input) { background:var(--tcgc-panel)!important; color:var(--tcgc-ink)!important; border-color:var(--tcgc-line)!important; }
    html body :is(.cs-title,.home-order-customer,.invoice-preview-title,.invoice-preview-line strong) { color:var(--tcgc-ink)!important; }
    html body :is(.cs-meta,.cart-item-meta,.home-intro p,.home-kpi-label,.home-order-meta,.brand-subtitle,.detail-label,.voucher-history-head span,.invoice-preview-line span) { color:var(--tcgc-muted)!important; }
    html body :is(.cs-option.out-of-stock,.stock-warning) { background:#42262b!important; color:#ffbcc4!important; }
    html body .cs-option:hover { background:var(--tcgc-raised)!important; }
    html body :is(.brand-profile,.order-type-pill,.order-type-field) { background:var(--tcgc-raised)!important; color:var(--tcgc-ink)!important; border-color:var(--tcgc-line)!important; }
    html body .order-type-pill.preorder { background:#332c1c!important; color:#efce7e!important; border-color:#615133!important; }
    html body .seller-order-detail-title>span { color:#ddbc62!important; }
    html body :is(.portal-btn,.head-btn,.home-action):hover { background:#303a49!important; color:#fff!important; }
    html body :is(.portal-btn.primary,.head-btn.primary):hover { background:#b42d44!important; }
    html body :is(.price-card,.chip,.status-pill,.badge) { border-color:var(--tcgc-line); }
    html body :is(.main,.management-modal,.account-panel) table th { background:var(--tcgc-raised); color:var(--tcgc-muted); border-color:var(--tcgc-line); }
    html body :is(.main,.management-modal,.account-panel) table td { border-color:var(--tcgc-line); }
    html body .main table tfoot tr td { background:var(--tcgc-raised)!important; color:var(--tcgc-ink)!important; border-color:var(--tcgc-line)!important; }
    html body :is(.import-modal,.management-modal,.account-panel) table tbody tr:nth-child(n) td { background:var(--tcgc-panel)!important; color:var(--tcgc-ink)!important; border-color:var(--tcgc-line)!important; }
    html body :is(.import-modal,.management-modal,.account-panel) table tbody tr:hover td { background:var(--tcgc-raised)!important; }
    html body .alibaba-flow-step strong { background:#332c1c!important; color:#efce7e!important; border-color:#615133!important; }
    html body .alibaba-fixed-cell span { background:var(--tcgc-raised)!important; color:var(--tcgc-ink)!important; border-color:var(--tcgc-line)!important; }
    html body :is(.portal-input,.portal-select,.portal-textarea,.search-input,.qty-input,.login input):not([type=checkbox]):not([type=radio]) { color:var(--tcgc-ink)!important; background:#12161d!important; border-color:#414b5c!important; }
    @media(max-width:1080px) {
        /* Frozen columns used 526px in Orders: scroll every column on narrow screens. */
        html body :is(.sheet-table,.spreadsheet-table,.product-sheet,.portal-table) :is(th,td):nth-child(n) { position:static!important; left:auto!important; right:auto!important; box-shadow:none!important; }
    }
    @media(max-width:760px) {
        html body :is(.topbar,.result-head,.section-head,.pagination,.simple-toolbar,.sheet-toolbar,.filter-actions,.order-detail-header,.seller-order-detail-header,.seller-order-detail-section-head) { flex-wrap:wrap; }
        html body :is(.topbar,.section-head,.pagination)> * { min-width:0; }
        html body :is(.modal-overlay,.drawer-overlay,.product-modal-overlay,.client-modal-overlay,.adjust-modal-overlay,.label-modal-overlay,.management-modal-overlay,.cart-modal-overlay,.account-modal) { padding:8px; }
        html body :is(.drawer,.modal-content,.product-modal,.client-modal,.adjust-modal,.label-modal,.import-modal,.editor-modal,.management-modal,.cart-modal-content,.account-panel,dialog) { max-height:calc(100vh - 16px); max-height:calc(100dvh - 16px); min-height:0; border-radius:12px!important; }
        html body dialog { max-width:calc(100% - 16px); }
        html body :is(.form-grid,.manager-grid,.seller-order-detail-overview,.order-detail-overview,.compact-order-body>.order-detail-overview) { grid-template-columns:minmax(0,1fr)!important; }
        html body :is(.form-grid,.manager-grid)>[class*="span-"] { grid-column:1/-1; }
        html body :is(.order-detail-title,.seller-order-detail-title) { min-width:0; }
        html body :is(.order-detail-statuses,.seller-order-detail-statuses) { justify-content:flex-start; }
        html body :is(.order-detail-meta,.compact-order-body .order-detail-meta,.seller-order-detail-meta) { grid-template-columns:repeat(2,minmax(0,1fr)); }
        html body :is(.seller-order-financial-grid,.compact-order-body .order-financial-grid) { grid-template-columns:repeat(2,minmax(0,1fr)); }
        html body :is(.order-detail-meta,.seller-order-detail-meta,.seller-order-financial-grid) strong { overflow-wrap:anywhere; }
        html body :is(.management-modal,.editor-modal) { padding:16px; }
        html body :is(.cart-modal-header,.cart-modal-body,.account-head,.account-body) { padding:16px; }
        html body :is(.order-detail-header,.seller-order-detail-header) { padding-right:72px!important; }
        html body :is(input:not([type=checkbox]):not([type=radio]),select,textarea) { font-size:16px!important; }
        html body :is(.actions,.portal-actions,.pagination-links,.tabs,.status-tabs,.head-actions) { flex-wrap:wrap; }
        html body :is(.btn,.portal-btn,.head-btn,.page-link,.table-icon-btn,.qty-btn) { min-height:44px; }
        html body :is(.qty-btn,.table-icon-btn) { min-width:36px; }
        html body .cart-item { flex-wrap:wrap; }
        html body .cart-item-info { flex-basis:100%; }
        html body .cart-item-title { white-space:normal; }
        html body .statement-order-head { grid-template-columns:minmax(0,1fr) minmax(0,1fr); }
        html body .statement-order-head .mobile-hide { display:block; text-align:left!important; }
        html body .share-card-actions { grid-template-columns:1fr; }
        html body .account-panel { width:100%; }
    }
    @media(max-width:400px) {
        html body :is(.order-detail-meta,.compact-order-body .order-detail-meta,.seller-order-detail-meta) { grid-template-columns:1fr; }
        html body .order-line { grid-template-columns:minmax(0,1fr); }
    }
}
@media print { .tcgc-table-hint { display:none!important; } }
