/* Supplier Portal v9.4 - WordPress Admin Style (20% larger) */
:root {
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f1f5f9;
    --sidebar-bg: #0f172a;
    --sidebar-hover: #1e293b;
    --sidebar-active: #3b82f6;
    --accent: #1d4ed8;
    --accent-hover: #1e40af;
    --accent-light: #dbeafe;
    --success: #047857;
    --success-light: #d1fae5;
    --danger: #b91c1c;
    --danger-light: #fee2e2;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #59687d;
    --border: #e2e8f0;
    --border-light: #f1f5f9;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --radius: 5px;
    --radius-lg: 7px;
    --sidebar-width: 190px;
    --topbar-height: 38px;
    --transition: all 0.15s ease;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    font-size: 14px;
    line-height: 1.4;
    background: var(--bg-primary);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
}

/* Top Bar */
.wp-admin-bar {
    background: var(--bg-secondary);
    height: var(--topbar-height);
    position: fixed;
    top: 0; left: var(--sidebar-width); right: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    padding: 0 14px;
    border-bottom: 1px solid var(--border);
}
.wp-admin-bar .logo {
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 7px;
}
.wp-admin-bar .logo:hover { color: var(--accent); }
.wp-admin-bar-right { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.wp-admin-bar-right span {
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 5px;
}
.wp-admin-bar-right a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 13px;
    padding: 5px 10px;
    border-radius: var(--radius);
    transition: var(--transition);
}
.wp-admin-bar-right a:hover {
    background: var(--danger-light);
    color: var(--danger);
}

/* Sidebar */
.wp-sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: var(--sidebar-width);
    background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 999;
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 8px rgba(0,0,0,0.15);
}
.wp-sidebar-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 18px;
    color: #fff;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    min-height: 56px;
    background: rgba(0,0,0,0.1);
}
.sidebar-logo {
    font-size: 24px;
    flex-shrink: 0;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}
.sidebar-title {
    font-size: 15px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    letter-spacing: -0.3px;
    background: linear-gradient(135deg, #fff 0%, #94a3b8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.sidebar-toggle { display: none; }
.wp-sidebar-menu { list-style: none; padding: 16px 12px; flex: 1; }
.wp-sidebar-menu li { margin-bottom: 4px; }
.wp-sidebar-menu li a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    color: #94a3b8;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    border-radius: 8px;
    transition: all 0.2s ease;
    white-space: nowrap;
    overflow: hidden;
    position: relative;
}
.wp-sidebar-menu li a:hover {
    background: rgba(255,255,255,0.08);
    color: #fff;
    transform: translateX(2px);
}
.wp-sidebar-menu li a.active {
    background: linear-gradient(135deg, var(--accent) 0%, #1e40af 100%);
    color: #fff;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}
.wp-sidebar-menu li a.active .menu-icon {
    opacity: 1;
}
.wp-sidebar-menu .menu-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    opacity: 0.7;
    flex-shrink: 0;
    transition: all 0.2s ease;
}
.wp-sidebar-menu li a:hover .menu-icon {
    opacity: 1;
    transform: scale(1.1);
}
.wp-sidebar-menu .menu-text {
    font-size: 14px;
}
.wp-sidebar-menu .menu-separator {
    height: 1px;
    background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.1) 50%, transparent 100%);
    margin: 16px 10px;
}

/* Main Content */
.wp-content {
    margin-left: var(--sidebar-width);
    margin-top: var(--topbar-height);
    padding: 14px;
    min-height: calc(100vh - var(--topbar-height));
}

.wp-page-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}
.wp-page-title {
    font-size: 22px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Boxes */
.wp-box {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 12px;
    box-shadow: var(--shadow-sm);
}
.wp-box-header {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.wp-box-title { font-size: 14px; font-weight: 600; }
.wp-box-content { padding: 14px; }

/* Buttons */
.wp-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 0 12px;
    height: 34px;
    font-size: 13px;
    font-weight: 500;
    border-radius: var(--radius);
    cursor: pointer;
    text-decoration: none;
    border: none;
    white-space: nowrap;
    transition: var(--transition);
}
.wp-button-primary {
    background: var(--accent);
    color: #fff;
}
.wp-button-primary:hover {
    background: var(--accent-hover);
}
.wp-button-secondary {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    color: var(--text-secondary);
}
.wp-button-secondary:hover {
    background: var(--bg-tertiary);
    border-color: var(--text-muted);
    color: var(--text-primary);
}
.wp-button-success {
    background: var(--success);
    color: #fff;
}
.wp-button-success:hover {
    background: #065f46;
}
.wp-button-danger {
    background: var(--danger);
    color: #fff;
}
.wp-button-danger:hover {
    background: #991b1b;
}
.wp-button-small { height: 29px; padding: 0 10px; font-size: 12px; }

/* Forms */
.wp-form-row { display: flex; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; align-items: flex-end; }
.wp-form-group { display: flex; flex-direction: column; gap: 5px; }
.wp-label { font-size: 12px; font-weight: 600; color: var(--text-secondary); }

.wp-input, .wp-select {
    height: 34px;
    padding: 0 10px;
    font-size: 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-secondary);
    color: var(--text-primary);
    width: 100%;
    transition: var(--transition);
}
.wp-input:focus, .wp-select:focus {
    border-color: var(--accent);
    outline: none;
    box-shadow: 0 0 0 1px var(--accent-light);
}

/* Tables */
.wp-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.wp-table th {
    text-align: left;
    padding: 10px 12px;
    font-weight: 600;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.wp-table td { padding: 10px 12px; border-bottom: 1px solid var(--border-light); vertical-align: middle; }
.wp-table tbody tr:hover td { background: var(--bg-tertiary); }

/* Notices */
.wp-notice {
    padding: 10px 14px;
    margin-bottom: 12px;
    border-radius: var(--radius);
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 7px;
}
.wp-notice-success { background: var(--success-light); color: #065f46; }
.wp-notice-warning { background: var(--warning-light); color: #92400e; }
.wp-notice-error { background: var(--danger-light); color: #991b1b; }

/* ORDER CARDS */
.wp-orders-list { display: flex; flex-direction: column; gap: 12px; }
.wp-order-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: var(--transition);
}
.wp-order-card:hover {
    box-shadow: var(--shadow);
    border-color: var(--accent);
}
.wp-order-header {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border);
    gap: 12px;
    flex-wrap: wrap;
}
.wp-order-checkbox {
    width: 19px;
    height: 19px;
    cursor: pointer;
    accent-color: var(--accent);
}
.wp-checkbox-hit { display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.wp-order-id {
    font-size: 14px;
    font-weight: 600;
    color: var(--accent);
    text-decoration: none;
    transition: var(--transition);
}
.wp-order-id:hover { color: var(--accent-hover); }
.wp-order-meta { display: flex; align-items: center; gap: 10px; margin-left: auto; flex-wrap: wrap; }
.wp-order-date {
    font-size: 12px;
    color: var(--text-muted);
    background: var(--bg-secondary);
    padding: 2px 10px;
    border-radius: 100px;
    border: 1px solid var(--border);
}
.wp-site-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 100px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* Order Body */
.wp-order-body {
    display: grid;
    grid-template-columns: 240px 1fr 310px;
    gap: 14px;
    padding: 14px;
}
@media (max-width: 1200px) {
    .wp-order-body { grid-template-columns: 1fr 1fr; }
    .wp-order-section:last-child { grid-column: 1 / -1; }
}
@media (max-width: 800px) {
    .wp-order-body { grid-template-columns: 1fr; }
    .wp-order-section:last-child { grid-column: auto; }
}

.wp-order-section {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px;
}
.wp-section-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
    padding-bottom: 7px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 5px;
}
.wp-customer-info { font-size: 13px; line-height: 1.5; }
.wp-customer-info p { margin-bottom: 2px; }
.wp-customer-info strong { color: var(--text-muted); font-weight: 500; font-size: 12px; }

/* Product Items */
.wp-product-item {
    display: flex;
    gap: 10px;
    padding: 10px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    margin-bottom: 7px;
    align-items: center;
    border-radius: var(--radius);
    transition: var(--transition);
}
.wp-product-item:hover {
    border-color: var(--accent);
}
.wp-product-image {
    width: 48px;
    height: 48px;
    object-fit: cover;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    flex-shrink: 0;
    border-radius: var(--radius);
}
.wp-product-details { flex: 1; min-width: 0; overflow: hidden; }
.wp-product-name {
    font-weight: 600;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-primary);
}
.wp-product-meta { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.wp-product-variant { font-size: 11px; color: var(--accent); margin-top: 2px; font-weight: 500; }
.wp-product-supplier-price { font-size: 11px; color: var(--danger); margin-top: 2px; font-weight: 500; }
.wp-product-admin-tools {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
}
.wp-product-assignment-inline { display: flex; align-items: center; gap: 6px; flex: 1 1 260px; }
.wp-product-assignment-inline .wp-select { width: min(100%, 180px); min-width: 130px; }
.wp-product-qty {
    background: var(--accent);
    color: #fff;
    padding: 5px 10px;
    font-size: 12px;
    font-weight: 600;
    border-radius: var(--radius);
}

/* Tracking Form */
.wp-tracking-form { display: flex; flex-direction: column; gap: 7px; }
.wp-tracking-row { display: flex; align-items: center; gap: 10px; }
.wp-tracking-row label {
    width: 84px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    flex-shrink: 0;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.wp-tracking-row select, .wp-tracking-row input[type="text"], .wp-tracking-row input[type="date"] {
    height: 31px;
    padding: 0 10px;
    font-size: 13px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    flex: 1;
    background: var(--bg-secondary);
    transition: var(--transition);
}
.wp-tracking-row select:focus, .wp-tracking-row input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent-light);
    outline: none;
}
.wp-tracking-row .track-provider { width: 100%; max-width: 180px; }
.wp-tracking-row .track-number { min-width: 120px; }
.wp-tracking-row .track-date { max-width: 144px; }
.wp-carrier-status {
    margin: -2px 0 2px 94px;
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.35;
}
.wp-carrier-status.is-detected { color: var(--success); font-weight: 600; }
.wp-carrier-status.is-manual { color: var(--text-secondary); }
.wp-carrier-status.is-unrecognized { color: var(--text-secondary); }
.wp-tracking-actions {
    display: flex;
    gap: 7px;
    margin-top: 5px;
}
.wp-tracking-actions-main {
    display: flex;
    flex-direction: column;
    gap: 7px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}
.wp-button-wide {
    width: 100%;
    height: 36px;
    font-size: 13px;
}
.wp-button-danger-outline {
    background: transparent;
    border: 1px solid var(--danger);
    color: var(--danger);
    width: 100%;
}
.wp-button-danger-outline:hover {
    background: var(--danger-light);
}

/* Filter Bar */
.wp-filter-bar {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 14px;
    margin-bottom: 14px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

/* Badges */
.wp-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 100px;
}
.wp-badge-admin { background: var(--danger-light); color: var(--danger); }
.wp-badge-user { background: var(--accent-light); color: var(--accent-hover); }

/* Pagination */
.wp-pagination {
    display: flex;
    justify-content: center;
    gap: 5px;
    margin-top: 14px;
    flex-wrap: wrap;
}
.wp-page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    padding: 0 10px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: var(--transition);
}
.wp-page-link:hover {
    background: var(--bg-tertiary);
    border-color: var(--accent);
    color: var(--accent);
}
.wp-page-link.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}
.wp-page-link.disabled { opacity: 0.4; pointer-events: none; }

.wp-customer-note {
    background: var(--warning-light);
    border: 1px solid var(--warning);
    padding: 7px 10px;
    margin-top: 10px;
    font-size: 12px;
    border-radius: var(--radius);
    color: #92400e;
}

code {
    font-family: 'SF Mono', Consolas, monospace;
    font-size: 11px;
    background: var(--bg-tertiary);
    padding: 1px 5px;
    border-radius: 4px;
    color: var(--accent);
    border: 1px solid var(--border);
}

.wp-admin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 1100px) { .wp-admin-grid { grid-template-columns: 1fr; } }

.wp-changelog-item {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-light);
    transition: var(--transition);
}
.wp-changelog-item:hover { background: var(--bg-tertiary); }
.wp-changelog-action { font-weight: 600; color: var(--accent); }
.wp-changelog-time { font-size: 11px; color: var(--text-muted); }

.wp-empty-state { text-align: center; padding: 48px 29px; color: var(--text-muted); }
.wp-empty-icon { font-size: 48px; margin-bottom: 12px; opacity: 0.5; }

.wp-login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--sidebar-bg) 0%, #1e293b 100%);
}
.wp-login-box {
    width: 100%;
    max-width: 384px;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: 29px;
    box-shadow: var(--shadow-lg);
}
.wp-login-logo { text-align: center; margin-bottom: 24px; font-size: 24px; }

.wp-export-bar {
    background: var(--accent);
    color: white;
    padding: 10px 14px;
    margin-bottom: 12px;
    display: none;
    align-items: center;
    gap: 12px;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 500;
}
.wp-export-bar.show { display: flex; }

.loading-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(2px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}
.loading-overlay.show { display: flex; }
.loading-spinner {
    background: var(--bg-secondary);
    padding: 19px 29px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 10px;
}

@media (max-width: 782px) {
    .wp-sidebar { width: 60px; }
    .wp-sidebar-header { justify-content: center; padding: 10px; }
    .sidebar-title { display: none; }
    .wp-sidebar-menu li a .menu-text { display: none; }
    .wp-sidebar-menu li a { justify-content: center; padding: 10px; }
    .wp-content { margin-left: 60px; }
    .wp-admin-bar { left: 60px; }
}

.wp-toast {
    position: fixed;
    bottom: 19px;
    right: 19px;
    background: var(--success);
    color: white;
    padding: 12px 19px;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 600;
    z-index: 10000;
    animation: slideIn 0.3s ease;
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    gap: 7px;
}
.wp-toast.error { background: var(--danger); }
@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Scrollbar */
::-webkit-scrollbar { width: 7px; height: 7px; }
::-webkit-scrollbar-track { background: var(--bg-tertiary); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* Completed order tracking display */
.wp-tracking-info {
    padding: 7px 10px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    margin-bottom: 7px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    font-size: 13px;
}
.wp-tracking-info strong {
    color: var(--text-primary);
    font-weight: 600;
}
.wp-tracking-info a {
    color: var(--accent);
    font-weight: 500;
    text-decoration: none;
}
.wp-tracking-info a:hover {
    text-decoration: underline;
}

/* Security, staging status, supplier assignment, and accessibility refinements */
[hidden] { display: none !important; }

.screen-reader-text {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.wp-filter-label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible {
    outline: 3px solid rgba(59, 130, 246, 0.35);
    outline-offset: 2px;
}

.wp-button:disabled,
.wp-select:disabled,
.wp-input:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.wp-inline-form,
.wp-logout-form { display: inline-flex; }

.wp-password-reset-input { width: 150px; min-width: 120px; }

.wp-logout-button {
    appearance: none;
    border: 0;
    background: transparent;
    color: var(--text-secondary);
    font: inherit;
    font-size: 13px;
    padding: 5px 10px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
}

.wp-logout-button:hover {
    background: var(--danger-light);
    color: var(--danger);
}

.wp-environment-banner {
    min-height: 42px;
    padding: 9px 14px;
    margin-bottom: 14px;
    border: 1px solid;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    font-size: 13px;
    box-shadow: var(--shadow-sm);
}

.wp-environment-banner.writes-disabled {
    color: #065f46;
    background: #ecfdf5;
    border-color: #6ee7b7;
}

.wp-environment-banner.writes-enabled {
    color: #991b1b;
    background: #fff1f2;
    border-color: #fda4af;
}

.wp-environment-name {
    color: #fff;
    background: #7c3aed;
    border-radius: 999px;
    padding: 3px 10px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.wp-environment-detail {
    margin-left: auto;
    opacity: 0.85;
}

.wp-page-description,
.wp-box-description {
    color: var(--text-secondary);
    font-size: 13px;
    margin-top: 4px;
}

.wp-box-header-stacked { align-items: flex-start; }
.wp-box-header-stacked .wp-box-description { max-width: 760px; }
.wp-box-title { margin: 0; }

.wp-button-full { width: 100%; }
.wp-button-push-right { margin-left: auto; }
.wp-form-stack { display: flex; flex-direction: column; gap: 12px; }
.wp-form-stack .wp-form-row { margin-bottom: 0; }
.wp-field-grow { flex: 1 1 180px; }
.wp-field-small { flex: 0 1 150px; }
.wp-field-medium { flex: 1 1 220px; }
.wp-field-cost { flex: 1 1 82px; }
.wp-field-color { flex: 0 0 64px; }

.wp-color-input {
    width: 54px;
    height: 34px;
    padding: 2px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-secondary);
}

.wp-filter-search { width: min(100%, 270px); }
.wp-filter-site { width: 155px; }
.wp-filter-count { width: 90px; }
.wp-filter-days { width: 115px; }
.wp-select-all-label { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; }
.wp-select-all-label input { width: 19px; height: 19px; accent-color: #fff; }

.wp-site-badge {
    color: #1e40af;
    background: var(--accent-light);
    border: 1px solid #bfdbfe;
}

.wp-supplier-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    color: #065f46;
    background: var(--success-light);
    border: 1px solid #a7f3d0;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
}

.wp-supplier-badge.is-unassigned {
    color: #991b1b;
    background: var(--danger-light);
    border-color: #fecaca;
}

.wp-order-card.is-unassigned { border-left: 4px solid var(--danger); }
.wp-order-card.is-removing {
    opacity: 0;
    transform: translateX(80px);
    pointer-events: none;
}

.wp-action-explanation {
    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1.45;
}

.wp-assignment-blocked {
    padding: 12px;
    color: #991b1b;
    background: #fff7ed;
    border: 1px solid #fed7aa;
    border-radius: var(--radius);
}

.wp-assignment-blocked p { margin: 5px 0 12px; color: #7c2d12; font-size: 12px; }
.wp-muted { color: var(--text-muted); }
.wp-completed-by { margin-top: 10px; color: var(--text-muted); font-size: 12px; }
.wp-actions-cell { white-space: nowrap; }

.wp-toast-region {
    position: fixed;
    right: 19px;
    bottom: 19px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
    pointer-events: none;
}

.wp-toast-region .wp-toast { position: static; }

.wp-badge-neutral {
    color: var(--text-secondary);
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
}

.wp-assignment-panel { border-top: 4px solid var(--accent); }
.wp-settings-disclosure > summary { cursor: pointer; list-style: none; user-select: none; }
.wp-settings-disclosure > summary::-webkit-details-marker { display: none; }
.wp-settings-disclosure > summary::after {
    content: "Open";
    margin-left: 8px;
    color: var(--accent);
    font-size: 12px;
    font-weight: 700;
}
.wp-settings-disclosure[open] > summary::after { content: "Close"; }
.wp-settings-disclosure[open] > summary { border-bottom: 1px solid var(--border); }
.wp-assignment-group + .wp-assignment-group { margin-top: 24px; padding-top: 24px; border-top: 1px solid var(--border); }
.wp-assignment-group-header { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 12px; }
.wp-assignment-group-header h3 { font-size: 15px; margin-bottom: 2px; }
.wp-assignment-group-header p { color: var(--text-secondary); font-size: 12px; }
.wp-assignment-search { width: min(100%, 280px); margin-left: auto; }

.wp-assignment-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding: 10px;
    margin-bottom: 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.wp-assignment-actions > label { font-size: 12px; font-weight: 700; color: var(--text-secondary); }
.wp-assignment-supplier { width: 210px; }
.wp-assignment-status { min-width: 120px; color: var(--text-muted); font-size: 11px; }
.wp-assignment-pager {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
    margin: 10px 0;
}
.wp-assignment-pager label { display: inline-flex; align-items: center; gap: 6px; color: var(--text-secondary); font-size: 12px; font-weight: 600; }
.wp-assignment-pager .wp-select { width: 74px; }
.wp-assignment-page-status { min-width: 160px; color: var(--text-secondary); text-align: center; font-size: 12px; }
.wp-assignment-pager-bottom { margin-top: 12px; }
.wp-assignment-table th:first-child,
.wp-assignment-table td:first-child { width: 48px; text-align: center; }
.wp-assignment-table input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); }
.wp-assignment-no-results { padding: 24px; }
.wp-assignment-empty { padding: 30px 20px; }

.wp-manual-assignment-form {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    flex-wrap: wrap;
    max-width: 980px;
    margin: 0 auto 14px;
    padding: 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.wp-table-scroll { max-width: 100%; overflow-x: auto; }
.wp-table-medium { max-height: 250px; overflow-y: auto; }
.wp-table-subtext { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 3px; color: var(--text-muted); font-size: 11px; }
.wp-empty-compact { padding: 18px; text-align: center; color: var(--text-muted); background: var(--bg-tertiary); border-radius: var(--radius); }
.wp-account-form { align-items: flex-end; margin-top: 12px; }

.wp-list-scroll { max-height: 240px; overflow-y: auto; }
.wp-list-short { max-height: 170px; }
.wp-settings-list-item { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border-light); }
.wp-list-item-content { flex: 1; min-width: 0; }
.wp-list-item-title { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.wp-list-note { margin-top: 3px; color: var(--text-muted); font-size: 11px; font-style: italic; }
.wp-backup-create { margin-bottom: 10px; }
.wp-backup-item { font-size: 12px; }
.wp-activity-scroll { max-height: 280px; overflow-y: auto; }
.wp-changelog-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

.wp-modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(15, 23, 42, 0.68);
}

.has-modal { overflow: hidden; }
.wp-modal-panel { width: min(100%, 460px); padding: 20px; background: var(--bg-secondary); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); }
.wp-modal-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 16px; }
.wp-modal-header h2 { font-size: 18px; }
.wp-modal-close { width: 34px; height: 34px; border: 0; border-radius: var(--radius); background: transparent; color: var(--text-secondary); font-size: 24px; cursor: pointer; }
.wp-modal-close:hover { color: var(--danger); background: var(--danger-light); }
.wp-cost-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.wp-modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 4px; }
.wp-order-status-notice { grid-column: 1 / -1; margin-bottom: 0; }
.wp-settings-jump { display: none; }

/* Admin financial analytics */
.wp-analytics-filter {
    align-items: flex-end;
}

.wp-analytics-filter .wp-form-group {
    min-width: 120px;
}

.wp-analytics-filter .wp-filter-label {
    position: static;
    width: auto;
    height: auto;
    padding: 0;
    margin: 0 0 5px;
    overflow: visible;
    clip: auto;
    white-space: normal;
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 700;
}

.wp-analytics-definition {
    align-items: flex-start;
    line-height: 1.45;
}

.wp-analytics-currency-list {
    display: grid;
    gap: 12px;
}

.wp-analytics-currency {
    border-top: 4px solid var(--accent);
}

.wp-analytics-currency-header {
    gap: 12px;
}

.wp-analytics-warning {
    color: #92400e;
    background: var(--warning-light);
    border: 1px solid #fcd34d;
}

.wp-analytics-summary-grid.wp-finance-equation {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 24px minmax(0, 1fr) 24px minmax(0, 1fr) 24px minmax(0, 1fr);
    align-items: stretch;
    gap: 8px;
}

.wp-order-finance {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 24px minmax(0, 1fr) 24px minmax(0, 1fr) 24px minmax(0, 1fr);
    align-items: stretch;
    gap: 8px;
    padding: 12px;
    background: #f8fafc;
    border-bottom: 1px solid var(--border);
}

.wp-order-finance .wp-finance-term > span {
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.wp-order-finance .wp-finance-term > strong {
    color: var(--text-primary);
    font-size: clamp(16px, 2vw, 21px);
    line-height: 1.2;
    overflow-wrap: anywhere;
}

.wp-order-finance .wp-finance-profit.is-positive > strong { color: #047857; }
.wp-order-finance .wp-finance-profit.is-negative > strong { color: #b91c1c; }
.wp-finance-profit.is-incomplete { background: var(--warning-light); border-color: #fcd34d; }
.wp-order-finance .wp-finance-context {
    grid-column: 1 / -1;
    margin: 2px 2px 0;
    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1.45;
}

.wp-finance-term {
    min-width: 0;
    display: flex;
    justify-content: center;
    flex-direction: column;
    gap: 5px;
    min-height: 86px;
    padding: 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}

.wp-finance-label {
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.wp-finance-value {
    color: var(--text-primary);
    font-size: clamp(17px, 2vw, 23px);
    line-height: 1.2;
    overflow-wrap: anywhere;
}

.wp-finance-operator {
    align-self: center;
    color: var(--text-muted);
    text-align: center;
    font-size: 22px;
    font-weight: 800;
}

.wp-finance-profit {
    border-width: 2px;
}

.wp-finance-profit.is-positive {
    background: var(--success-light);
    border-color: #6ee7b7;
}

.wp-finance-profit.is-positive .wp-finance-value,
.wp-analytics-profit.is-positive strong {
    color: #047857;
}

.wp-finance-profit.is-negative {
    background: var(--danger-light);
    border-color: #fca5a5;
}

.wp-finance-profit.is-negative .wp-finance-value,
.wp-analytics-profit.is-negative strong {
    color: #b91c1c;
}

.wp-analytics-cost-warning {
    margin-top: 10px;
    color: #92400e;
    font-size: 12px;
    line-height: 1.45;
}

.wp-analytics-table th,
.wp-analytics-table td {
    white-space: nowrap;
}

.wp-analytics-table td:first-child,
.wp-analytics-table td:nth-child(3) {
    white-space: normal;
}

.wp-analytics-amount strong {
    color: #9a3412;
    font-size: 14px;
}

.wp-analytics-missing-cost {
    margin-top: 4px;
    color: #b45309;
    font-size: 11px;
    font-weight: 700;
}

.wp-analytics-profit.is-incomplete strong {
    color: var(--text-muted);
}

.wp-order-profit-table .wp-table-subtext {
    white-space: normal;
}

.wp-login-environment {
    position: fixed;
    top: 20px;
    left: 50%;
    z-index: 10;
    transform: translateX(-50%);
    width: min(calc(100% - 32px), 620px);
    justify-content: center;
}

.wp-login-title { margin-bottom: 5px; text-align: center; font-size: 24px; }
.wp-login-description { margin-bottom: 22px; color: var(--text-secondary); text-align: center; font-size: 13px; }
.wp-login-logo { margin-bottom: 4px; font-size: 44px; }
.wp-error-box { max-width: 520px; text-align: center; }
.wp-error-icon { margin-bottom: 10px; font-size: 48px; }
.wp-error-box h1 { margin-bottom: 8px; font-size: 23px; }
.wp-error-box > p { color: var(--text-secondary); }
.wp-error-actions { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; margin-top: 20px; }

@media (max-width: 800px) {
    .wp-environment-detail { width: 100%; margin-left: 0; }
    .wp-assignment-group-header { align-items: stretch; flex-direction: column; }
    .wp-assignment-search { width: 100%; margin-left: 0; }
    .wp-assignment-actions { align-items: stretch; flex-direction: column; }
    .wp-assignment-actions > label { margin-bottom: -3px; }
    .wp-assignment-supplier { width: 100%; }
    .wp-assignment-status { min-width: 0; }
    .wp-manual-assignment-form { align-items: stretch; flex-direction: column; }
    .wp-form-row > .wp-button { width: 100%; }
    .wp-analytics-summary-grid.wp-finance-equation {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .wp-order-finance { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .wp-finance-operator { display: none; }
}

@media (max-width: 560px) {
    :root { --topbar-height: 54px; }
    .wp-admin-bar { padding: 0 10px; }
    .wp-admin-bar .logo { font-size: 0; }
    .wp-admin-bar .logo::first-letter { font-size: 20px; }
    .wp-admin-bar-right { gap: 5px; }
    .wp-admin-bar-right span { max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .wp-content { padding: 10px; }
    .wp-order-body { padding: 10px; }
    .wp-order-meta { width: 100%; margin-left: 0; }
    .wp-filter-bar > * { width: 100%; }
    .wp-button-push-right { margin-left: 0; }
    .wp-tracking-row { align-items: stretch; flex-direction: column; gap: 4px; }
    .wp-tracking-row label { width: auto; }
    .wp-tracking-row .track-provider,
    .wp-tracking-row .track-number,
    .wp-tracking-row .track-date { width: 100%; max-width: none; }
    .wp-carrier-status { margin-left: 0; }
    .wp-cost-grid { grid-template-columns: 1fr; }
    .wp-environment-banner { align-items: flex-start; flex-direction: column; gap: 5px; }
    .wp-login-environment { align-items: center; }
}

/* Mobile-first authenticated layout and touch ergonomics */
@media (max-width: 900px) {
    :root { --topbar-height: calc(56px + env(safe-area-inset-top)); }

    html, body { max-width: 100%; }
    body { overflow-x: hidden; font-size: 15px; }

    .wp-admin-bar {
        left: 0;
        min-width: 0;
        padding-top: env(safe-area-inset-top);
        padding-left: max(12px, env(safe-area-inset-left));
        padding-right: max(12px, env(safe-area-inset-right));
    }

    .wp-admin-bar-right { min-width: 0; gap: 6px; }
    .wp-admin-bar-right span {
        min-width: 0;
        max-width: min(46vw, 230px);
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .wp-logout-button { min-height: 44px; padding: 8px 10px; }

    .wp-sidebar {
        top: auto;
        right: 0;
        bottom: 0;
        width: 100%;
        height: calc(68px + env(safe-area-inset-bottom));
        overflow: visible;
        background: #0f172a;
        border-top: 1px solid rgba(255,255,255,0.12);
        box-shadow: 0 -5px 18px rgba(15, 23, 42, 0.2);
    }

    .wp-sidebar-header { display: none; }
    .wp-sidebar-menu {
        width: 100%;
        display: flex;
        align-items: stretch;
        gap: 3px;
        padding: 4px max(6px, env(safe-area-inset-right)) env(safe-area-inset-bottom) max(6px, env(safe-area-inset-left));
    }
    .wp-sidebar-menu li { flex: 1 1 0; min-width: 0; margin: 0; }
    .wp-sidebar-menu .menu-separator { display: none; }
    .wp-sidebar-menu li a {
        width: 100%;
        min-height: 60px;
        justify-content: center;
        flex-direction: column;
        gap: 2px;
        padding: 5px 3px;
        border-radius: 10px;
        overflow: visible;
        transform: none;
    }
    .wp-sidebar-menu li a:hover { transform: none; }
    .wp-sidebar-menu .menu-icon { width: 24px; height: 26px; font-size: 19px; }
    .wp-sidebar-menu li a .menu-text {
        display: block;
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        color: inherit;
        font-size: 11px;
        line-height: 1.15;
    }

    .wp-content {
        min-width: 0;
        margin-left: 0;
        padding: 14px;
        padding-left: max(14px, env(safe-area-inset-left));
        padding-right: max(14px, env(safe-area-inset-right));
        padding-bottom: calc(88px + env(safe-area-inset-bottom));
    }

    .wp-page-title { font-size: 21px; line-height: 1.2; }
    .wp-box-header { padding: 12px; gap: 8px; }
    .wp-box-content { padding: 12px; }
    .wp-notice { align-items: flex-start; line-height: 1.45; }

    .wp-button {
        min-height: 44px;
        height: auto;
        padding: 9px 14px;
        line-height: 1.2;
        text-align: center;
        white-space: normal;
    }
    .wp-button-small { min-height: 44px; height: auto; padding: 8px 12px; }
    .wp-button:disabled { font-size: 13px; }
    .wp-input, .wp-select, .wp-color-input {
        min-height: 44px;
        height: 44px;
        font-size: 16px;
    }
    .wp-order-checkbox,
    .wp-select-all-label input,
    .wp-assignment-table input[type="checkbox"] { width: 24px; height: 24px; }
    .wp-checkbox-hit { min-width: 44px; min-height: 44px; margin: -8px; }
    .wp-page-link { min-width: 44px; height: 44px; }

    .wp-order-header { padding: 12px; gap: 9px; }
    .wp-order-body { gap: 10px; padding: 12px; }
    .wp-order-section { min-width: 0; padding: 12px; }
    .wp-customer-info,
    .wp-customer-note,
    .wp-product-details,
    .wp-tracking-info { overflow-wrap: anywhere; }
    .wp-product-name { white-space: normal; overflow: visible; text-overflow: clip; line-height: 1.35; }
    .wp-product-meta,
    .wp-product-variant { overflow-wrap: anywhere; }
    .wp-tracking-row select,
    .wp-tracking-row input[type="text"],
    .wp-tracking-row input[type="date"] { min-height: 44px; height: 44px; font-size: 16px; }
    .wp-tracking-actions { flex-wrap: wrap; }
    .wp-tracking-actions .wp-button { flex: 1 1 180px; }
    .wp-product-admin-tools { align-items: stretch; flex-direction: column; }
    .wp-product-assignment-inline { align-items: stretch; flex-direction: column; flex-basis: auto; }
    .wp-product-assignment-inline .wp-select,
    .wp-product-admin-tools .wp-button { width: 100%; max-width: none; }

    .wp-export-bar { flex-wrap: wrap; }
    .wp-export-bar .wp-select-all-label { flex: 1 1 100%; }

    .wp-table-scroll {
        overscroll-behavior-inline: contain;
        -webkit-overflow-scrolling: touch;
        scrollbar-gutter: stable;
    }
    .wp-table { min-width: 620px; }
    .wp-assignment-table { min-width: 760px; }
    .wp-actions-cell { white-space: normal; }

    .wp-settings-list-item { align-items: flex-start; }
    .wp-changelog-item { align-items: flex-start; }

    .wp-settings-jump {
        position: sticky;
        top: calc(var(--topbar-height) + 6px);
        z-index: 50;
        display: flex;
        gap: 6px;
        max-width: 100%;
        padding: 6px;
        margin: -2px 0 12px;
        overflow-x: auto;
        overscroll-behavior-inline: contain;
        background: rgba(248, 250, 252, 0.96);
        border: 1px solid var(--border);
        border-radius: 10px;
        box-shadow: var(--shadow-sm);
        backdrop-filter: blur(8px);
        scrollbar-width: none;
    }
    .wp-settings-jump::-webkit-scrollbar { display: none; }
    .wp-settings-jump a {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        flex: 0 0 auto;
        padding: 8px 12px;
        color: var(--text-secondary);
        background: var(--bg-secondary);
        border: 1px solid var(--border);
        border-radius: 999px;
        font-size: 12px;
        font-weight: 700;
        text-decoration: none;
    }
    .wp-settings-jump a:active { color: #fff; background: var(--accent); border-color: var(--accent); }
    #product-assignments,
    #supplier-accounts,
    #connected-stores,
    #product-costs,
    #system-settings { scroll-margin-top: calc(var(--topbar-height) + 64px); }

    .wp-modal {
        padding-top: max(12px, env(safe-area-inset-top));
        padding-right: max(12px, env(safe-area-inset-right));
        padding-bottom: max(12px, env(safe-area-inset-bottom));
        padding-left: max(12px, env(safe-area-inset-left));
    }
    .wp-modal-panel {
        max-height: calc(100dvh - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
        overflow-y: auto;
        overscroll-behavior: contain;
        padding: 18px;
    }
    .wp-modal-close { min-width: 44px; min-height: 44px; }

    .wp-toast-region {
        right: max(12px, env(safe-area-inset-right));
        bottom: calc(80px + env(safe-area-inset-bottom));
        left: max(12px, env(safe-area-inset-left));
        align-items: stretch;
    }
    .wp-toast-region .wp-toast { max-width: 100%; justify-content: center; overflow-wrap: anywhere; }
    .wp-analytics-filter .wp-form-group { flex: 1 1 180px; }
}

@media (max-width: 640px) {
    .wp-responsive-table,
    .wp-responsive-table tbody,
    .wp-responsive-table tr,
    .wp-responsive-table td,
    .wp-assignment-table,
    .wp-assignment-table tbody,
    .wp-assignment-table tr,
    .wp-assignment-table td {
        display: block;
        width: 100%;
        min-width: 0;
    }

    .wp-responsive-table thead,
    .wp-assignment-table thead {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
        border: 0;
    }

    .wp-responsive-table tr,
    .wp-assignment-table tr {
        margin-bottom: 12px;
        overflow: hidden;
        background: var(--bg-secondary);
        border: 1px solid var(--border);
        border-radius: var(--radius-lg);
        box-shadow: var(--shadow-sm);
    }

    .wp-responsive-table td,
    .wp-assignment-table td,
    .wp-assignment-table td:first-child {
        display: grid;
        grid-template-columns: minmax(86px, 32%) minmax(0, 1fr);
        align-items: center;
        gap: 10px;
        width: auto;
        padding: 10px 12px;
        text-align: left;
        border-bottom: 1px solid var(--border-light);
        overflow-wrap: anywhere;
    }

    .wp-responsive-table td:last-child,
    .wp-assignment-table td:last-child { border-bottom: 0; }
    .wp-responsive-table td::before,
    .wp-assignment-table td::before {
        content: attr(data-label);
        color: var(--text-secondary);
        font-size: 11px;
        font-weight: 700;
        letter-spacing: 0.04em;
        text-transform: uppercase;
    }
    .wp-responsive-table td > *,
    .wp-assignment-table td > * { min-width: 0; grid-column: 2; }
    .wp-responsive-table .wp-inline-form,
    .wp-assignment-table .wp-inline-form { width: 100%; }
    .wp-responsive-table .wp-button,
    .wp-assignment-table .wp-button { width: 100%; }
    .wp-table-medium { max-height: none; }
    .wp-responsive-table .wp-actions-cell { align-items: start; }
    .wp-responsive-table .wp-actions-cell .wp-inline-form {
        align-items: stretch;
        flex-direction: column;
        gap: 8px;
        margin-bottom: 8px;
    }
    .wp-responsive-table .wp-actions-cell > .wp-button { width: 100%; }
    .wp-responsive-table .wp-actions-cell > * { grid-column: 2; }
    .wp-assignment-pager { justify-content: center; }
    .wp-assignment-page-status { order: -1; width: 100%; }
    .wp-analytics-table th,
    .wp-analytics-table td { white-space: normal; }
    .wp-analytics-table tr { border-left: 4px solid var(--accent); }
    .wp-analytics-table td[data-label="Amount owed"] {
        background: #fff7ed;
    }
    .wp-analytics-table .wp-analytics-profit.is-positive { background: var(--success-light); }
    .wp-analytics-table .wp-analytics-profit.is-negative { background: var(--danger-light); }
}

@media (min-width: 641px) and (max-width: 900px) {
    .wp-order-body { grid-template-columns: minmax(0, 0.82fr) minmax(0, 1.18fr); }
    .wp-order-section:last-child { grid-column: 1 / -1; }
}

@media (max-width: 560px) {
    .wp-admin-bar .logo { flex: 0 0 34px; width: 34px; font-size: 0; }
    .wp-admin-bar .logo::before { content: "📦"; font-size: 22px; }
    .wp-admin-bar .logo::first-letter { font-size: 0; }
    .wp-admin-bar-right { flex: 1; justify-content: flex-end; }
    .wp-admin-bar-right span { max-width: 48vw; font-size: 12px; }

    .wp-content {
        padding: 12px;
        padding-right: max(12px, env(safe-area-inset-right));
        padding-bottom: calc(86px + env(safe-area-inset-bottom));
        padding-left: max(12px, env(safe-area-inset-left));
    }
    .wp-page-header { margin-bottom: 12px; }
    .wp-page-title { font-size: 20px; }
    .wp-page-description { font-size: 13px; line-height: 1.45; }
    .wp-environment-banner { padding: 10px 12px; }

    .wp-filter-bar { padding: 12px; gap: 8px; }
    .wp-filter-label {
        position: static;
        width: auto;
        height: auto;
        margin: 2px 0 -4px;
        overflow: visible;
        clip: auto;
        white-space: normal;
        color: var(--text-secondary);
        font-size: 12px;
        font-weight: 700;
    }
    .wp-filter-bar > *,
    .wp-filter-search,
    .wp-filter-site,
    .wp-filter-count,
    .wp-filter-days { width: 100%; }

    .wp-export-bar { align-items: stretch; flex-direction: column; }
    .wp-export-bar .wp-button { width: 100%; }

    .wp-order-meta { align-items: flex-start; gap: 6px; }
    .wp-supplier-badge,
    .wp-site-badge { max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
    .wp-order-date { color: var(--text-secondary); }
    .wp-product-item {
        display: grid;
        grid-template-columns: 52px minmax(0, 1fr) auto;
        align-items: start;
        gap: 9px;
        padding: 9px;
    }
    .wp-product-image { width: 52px; height: 52px; }
    .wp-product-qty { padding: 5px 8px; }
    .wp-product-item > .wp-inline-form { grid-column: 2 / 4; justify-self: end; }

    .wp-tracking-row { align-items: stretch; flex-direction: column; gap: 5px; }
    .wp-tracking-row label { width: auto; color: var(--text-secondary); }
    .wp-tracking-row .track-provider,
    .wp-tracking-row .track-number,
    .wp-tracking-row .track-date { width: 100%; max-width: none; }
    .wp-tracking-info { align-items: flex-start; flex-direction: column; gap: 4px; }
    .wp-tracking-info code { max-width: 100%; word-break: break-all; }

    .wp-form-row,
    .wp-account-form { align-items: stretch; flex-direction: column; }
    .wp-form-row > .wp-form-group,
    .wp-field-grow,
    .wp-field-small,
    .wp-field-medium,
    .wp-field-cost,
    .wp-field-color { width: 100%; flex: 1 1 auto; }
    .wp-color-input { width: 100%; }
    .wp-password-reset-input { width: 100%; min-width: 0; }

    .wp-settings-list-item { flex-wrap: wrap; }
    .wp-settings-list-item > .wp-inline-form { margin-left: auto; }
    .wp-changelog-item { flex-direction: column; gap: 4px; }
    .wp-empty-state { padding: 32px 16px; }

    .wp-modal-actions { align-items: stretch; flex-direction: column-reverse; }
    .wp-modal-actions .wp-button { width: 100%; }
    .wp-cost-grid { grid-template-columns: 1fr; }
    .wp-analytics-filter .wp-form-group,
    .wp-analytics-filter .wp-select,
    .wp-analytics-filter .wp-button { width: 100%; }
    .wp-analytics-currency-header { align-items: flex-start; flex-direction: column; }
    .wp-finance-term { min-height: 78px; padding: 12px; }
    .wp-finance-value { font-size: 18px; }

    .wp-login-page {
        min-height: 100dvh;
        align-items: center;
        padding-top: calc(92px + env(safe-area-inset-top));
        padding-right: max(16px, env(safe-area-inset-right));
        padding-bottom: max(28px, env(safe-area-inset-bottom));
        padding-left: max(16px, env(safe-area-inset-left));
    }
    .wp-login-box { max-width: 100%; padding: 24px 18px; }
    .wp-login-environment {
        top: max(12px, env(safe-area-inset-top));
        right: max(12px, env(safe-area-inset-right));
        left: max(12px, env(safe-area-inset-left));
        width: auto;
        transform: none;
    }
    .wp-login-title { font-size: 22px; }
}

@media (max-width: 420px) {
    .wp-analytics-summary-grid.wp-finance-equation,
    .wp-order-finance { grid-template-columns: 1fr; }
}

@media (max-height: 520px) and (orientation: landscape) {
    .wp-login-page { align-items: flex-start; padding-top: calc(82px + env(safe-area-inset-top)); }
    .wp-login-environment { position: absolute; }
    .wp-modal { align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}
