:root {
    color-scheme: light;
    --bg: #eef2f6;
    --panel: #ffffff;
    --panel-soft: #f8fafc;
    --ink: #0f172a;
    --muted: #64748b;
    --line: #d8e0ea;
    --primary: #12805c;
    --primary-strong: #0f6b4d;
    --accent: #2563eb;
    --danger: #dc2626;
    --shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
}

body[data-theme="dark"] {
    color-scheme: dark;
    --bg: #0f172a;
    --panel: #172033;
    --panel-soft: #111827;
    --ink: #e5e7eb;
    --muted: #a7b0c0;
    --line: #334155;
    --primary: #34d399;
    --primary-strong: #86efac;
    --accent: #93c5fd;
    --danger: #f87171;
    --shadow: 0 18px 45px rgba(0, 0, 0, 0.28);
}

* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
}

body {
    margin: 0;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    background: var(--bg);
    color: var(--ink);
}

body[data-theme="dark"] input,
body[data-theme="dark"] select,
body[data-theme="dark"] textarea {
    background: #0f172a;
    color: var(--ink);
    border-color: var(--line);
}

a {
    color: inherit;
    text-decoration: none;
}

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    transition: grid-template-columns 180ms ease;
}

body.sidebar-collapsed .app-shell {
    grid-template-columns: 76px minmax(0, 1fr);
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 24px 18px;
    background: #0b1220;
    color: #e2e8f0;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-toggle {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    margin: 0 0 12px auto;
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
    color: #e2e8f0;
    cursor: pointer;
    font-size: 22px;
    line-height: 1;
}

.sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
}

body.sidebar-collapsed .sidebar-toggle {
    margin-right: auto;
}

body.sidebar-collapsed .sidebar-toggle span {
    transform: rotate(180deg);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 8px 22px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 8px;
    background: var(--primary);
    color: #fff;
    font-weight: 800;
}

.brand strong,
.brand small {
    display: block;
}

.brand strong {
    max-width: 190px;
    overflow-wrap: anywhere;
    font-size: 14px;
    text-transform: uppercase;
}

.brand small {
    margin-top: 2px;
    color: #94a3b8;
    font-size: 12px;
}

body.sidebar-collapsed .sidebar {
    padding-inline: 12px;
}

body.sidebar-collapsed .brand {
    justify-content: center;
    gap: 0;
    padding-inline: 0;
}

body.sidebar-collapsed .brand-copy,
body.sidebar-collapsed .submenu {
    display: none;
}

.side-nav {
    display: grid;
    gap: 6px;
    padding-top: 18px;
}

.nav-item {
    border-radius: 8px;
}

.nav-item > a,
.submenu a {
    display: flex;
    align-items: center;
    min-height: 38px;
    padding: 9px 12px;
    border-radius: 8px;
    color: #cbd5e1;
    font-size: 13px;
    font-weight: 650;
}

.nav-item:hover > a,
.nav-item.is-active > a {
    background: var(--primary);
    color: #fff;
}

.submenu {
    display: grid;
    gap: 2px;
    margin: 4px 0 8px 10px;
    padding-left: 10px;
    border-left: 1px solid rgba(148, 163, 184, 0.28);
}

.submenu a {
    min-height: 32px;
    color: #94a3b8;
    font-weight: 550;
}

.submenu a:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

body.sidebar-collapsed .nav-item > a {
    justify-content: center;
    width: 52px;
    min-height: 42px;
    padding: 9px 6px;
    overflow: hidden;
    white-space: nowrap;
    font-size: 0;
}

body.sidebar-collapsed .nav-item > a::before {
    content: attr(data-initial);
    font-size: 14px;
    font-weight: 850;
}

.main-panel {
    min-width: 0;
    padding: 28px;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    margin-bottom: 22px;
}

.topbar-actions {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.topbar h1,
.page-heading h2,
.panel-heading h2 {
    margin: 0;
    line-height: 1.1;
    letter-spacing: 0;
}

.topbar h1 {
    font-size: 30px;
}

.eyebrow {
    margin: 0 0 6px;
    color: var(--primary);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.user-pill,
.count-pill {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--panel);
    color: var(--muted);
    font-size: 13px;
    box-shadow: var(--shadow);
}

.user-pill a {
    padding: 6px 10px;
    border-radius: 999px;
    background: #e7f7ef;
    color: var(--primary-strong);
    font-weight: 750;
}

.theme-toggle {
    display: inline-grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--panel);
    color: var(--muted);
    cursor: pointer;
    box-shadow: var(--shadow);
}

.theme-toggle .dark-icon {
    display: none;
}

body[data-theme="dark"] .theme-toggle .light-icon {
    display: none;
}

body[data-theme="dark"] .theme-toggle .dark-icon {
    display: inline;
}

body[data-theme="dark"] .user-pill a {
    background: rgba(52, 211, 153, 0.14);
    color: var(--primary-strong);
}

.message-stack {
    display: grid;
    gap: 10px;
    margin-bottom: 18px;
}

.message {
    padding: 12px 14px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: var(--panel);
}

.message-success {
    color: #166534;
    background: #dcfce7;
    border-color: #bbf7d0;
}

.message-error {
    color: #991b1b;
    background: #fee2e2;
    border-color: #fecaca;
}

.auth-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(320px, 0.75fr);
    gap: 18px;
    align-items: stretch;
}

.panel,
.metric-card,
.service-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.panel {
    padding: 22px;
}

.panel-heading {
    margin-bottom: 18px;
}

.panel-heading h2,
.page-heading h2 {
    font-size: 24px;
}

.form-stack {
    display: grid;
    gap: 14px;
}

.migration-password-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(220px, 1fr));
    gap: 14px;
    margin-top: 18px;
}

.migration-password-form label {
    display: grid;
    gap: 7px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.migration-password-form .wide-xl {
    grid-column: 1 / -1;
}

.form-stack label {
    display: grid;
    gap: 7px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

input,
button {
    font: inherit;
}

input,
select {
    width: 100%;
    min-height: 42px;
    padding: 9px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    color: var(--ink);
}

input[type="checkbox"],
input[type="radio"] {
    width: 16px;
    height: 16px;
    min-width: 16px;
    min-height: 16px;
    padding: 0;
    border-radius: 4px;
    accent-color: var(--primary);
}

input[type="radio"] {
    border-radius: 50%;
}

input:focus,
select:focus {
    outline: 3px solid rgba(18, 128, 92, 0.16);
    border-color: var(--primary);
}

.button {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    min-height: 40px;
    padding: 9px 14px;
    border: 1px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 800;
}

.button.primary {
    background: var(--primary);
    color: #fff;
}

.button.primary:hover {
    background: var(--primary-strong);
}

.button.secondary {
    background: var(--panel);
    color: var(--muted);
    border-color: var(--line);
}

.button.muted {
    background: var(--panel-soft);
    color: var(--muted);
}

.button.disabled {
    cursor: default;
    opacity: 0.7;
}

.welcome-panel {
    background: linear-gradient(180deg, var(--panel), var(--panel-soft));
}

.pastel-welcome-panel {
    position: relative;
    overflow: hidden;
    display: grid;
    align-content: start;
    gap: 16px;
    background:
        radial-gradient(circle at 18% 14%, rgba(255, 231, 184, 0.72), transparent 30%),
        radial-gradient(circle at 88% 10%, rgba(223, 247, 255, 0.86), transparent 32%),
        linear-gradient(145deg, #fff7e6 0%, #eefcff 44%, #f7ecff 100%);
    border-color: #d8efe9;
}

.pastel-welcome-panel::after {
    content: "";
    position: absolute;
    right: -60px;
    bottom: -70px;
    width: 190px;
    height: 190px;
    border-radius: 50%;
    background: rgba(255, 210, 228, 0.46);
}

.pastel-welcome-panel .panel-heading {
    position: relative;
    z-index: 1;
    margin-bottom: 0;
    text-align: center;
}

.pastel-welcome-panel h2 {
    max-width: 520px;
    margin: 0 auto;
    color: #164e63;
    font-size: 28px;
    line-height: 1.35;
}

.welcome-art-wrap {
    position: relative;
    z-index: 1;
    padding: 8px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.54);
    box-shadow: 0 18px 44px rgba(88, 139, 153, 0.18);
}

.welcome-art {
    display: block;
    width: 100%;
    max-height: 340px;
    object-fit: contain;
    border-radius: 14px;
}

.soft-list {
    display: grid;
    gap: 7px;
    padding-left: 22px;
    color: var(--muted);
}

.page-heading {
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 16px;
    margin-bottom: 18px;
}

.page-heading.with-count {
    padding-bottom: 16px;
    border-bottom: 1px solid var(--line);
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(180px, 1fr)) repeat(3, minmax(160px, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.metric-card {
    padding: 18px;
}

.metric-card span {
    display: block;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.metric-card strong {
    display: block;
    margin-top: 8px;
    font-size: 26px;
    letter-spacing: 0;
}

.metric-card.compact strong {
    font-size: 15px;
}

.positive {
    color: #16a34a;
}

.negative {
    color: var(--danger);
}

.service-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.service-card {
    padding: 16px;
    background: var(--panel-soft);
    box-shadow: none;
}

.service-card h3 {
    margin: 0 0 10px;
    font-size: 16px;
}

.service-card ul {
    display: grid;
    gap: 6px;
    margin: 0;
    padding-left: 18px;
    color: var(--muted);
}

.filter-bar {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) auto auto;
    gap: 10px;
    margin-bottom: 18px;
}

.table-wrap {
    width: 100%;
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--panel);
    font-size: 13px;
}

.data-table th,
.data-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

.data-table th {
    position: sticky;
    top: 0;
    background: var(--panel-soft);
    color: var(--muted);
    font-size: 12px;
    font-weight: 850;
    white-space: nowrap;
}

.data-table th.sortable-header {
    cursor: pointer;
    user-select: none;
}

.data-table th.sortable-header::after {
    content: "  \2195";
    color: var(--muted);
    font-size: 11px;
    opacity: 0.5;
}

.data-table th.sortable-header.sort-asc::after {
    content: "  \2191";
    color: var(--primary);
    opacity: 1;
}

.data-table th.sortable-header.sort-desc::after {
    content: "  \2193";
    color: var(--primary);
    opacity: 1;
}

.data-table td {
    max-width: 360px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--ink);
}

.data-table tr:hover td {
    background: var(--panel-soft);
}

.empty-state {
    padding: 18px;
    border: 1px dashed var(--line);
    border-radius: 8px;
    background: var(--panel-soft);
    color: var(--muted);
}

.pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 16px;
}

.pagination a,
.pagination span {
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    color: var(--muted);
    font-weight: 750;
}

.modern-pagination {
    justify-content: flex-end;
    padding: 12px;
    border: 1px solid #dbeafe;
    border-radius: 8px;
    background:
        linear-gradient(180deg, rgba(240, 249, 255, 0.88), rgba(255, 255, 255, 0.62)),
        var(--panel);
}

.modern-pagination a,
.modern-pagination span {
    min-height: 36px;
    border-color: #bfdbfe;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

.modern-pagination a {
    color: #0369a1;
    text-decoration: none;
    transition: transform 0.14s ease, box-shadow 0.14s ease, background 0.14s ease;
}

.modern-pagination a:hover {
    transform: translateY(-1px);
    background: #e0f2fe;
    box-shadow: 0 8px 18px rgba(2, 132, 199, 0.12);
}

.modern-pagination .page-summary {
    margin-right: auto;
    border-color: transparent;
    background: transparent;
    box-shadow: none;
    color: #64748b;
}

.modern-pagination .page-current {
    border-color: #7dd3fc;
    background: #e0f2fe;
    color: #075985;
}

.modern-pagination .page-disabled {
    color: #94a3b8;
    opacity: 0.72;
}

.page-jump-form {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin-left: 4px;
    padding: 4px;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.72);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

.page-jump-form label {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: #64748b;
    font-size: 13px;
    font-weight: 800;
}

.page-jump-form input {
    width: 74px;
    min-height: 32px;
    padding: 6px 8px;
    border: 1px solid #cbd5e1;
    border-radius: 7px;
    background: #fff;
    color: var(--ink);
    text-align: right;
}

.page-jump-form button {
    min-height: 32px;
    padding: 6px 12px;
    border: 1px solid #7dd3fc;
    border-radius: 7px;
    background: linear-gradient(180deg, #f0f9ff, #e0f2fe);
    color: #075985;
    cursor: pointer;
    font-weight: 850;
}

.page-jump-form button:hover {
    background: linear-gradient(180deg, #e0f2fe, #bae6fd);
}

body[data-theme="dark"] .modern-pagination {
    border-color: rgba(125, 211, 252, 0.22);
    background:
        linear-gradient(180deg, rgba(14, 116, 144, 0.18), rgba(15, 23, 42, 0.04)),
        var(--panel);
}

body[data-theme="dark"] .modern-pagination a,
body[data-theme="dark"] .modern-pagination span {
    border-color: rgba(125, 211, 252, 0.24);
}

body[data-theme="dark"] .modern-pagination .page-current {
    border-color: rgba(125, 211, 252, 0.45);
    background: rgba(14, 165, 233, 0.22);
    color: #bae6fd;
}

body[data-theme="dark"] .page-jump-form {
    border-color: rgba(125, 211, 252, 0.24);
    background: rgba(15, 23, 42, 0.42);
}

body[data-theme="dark"] .page-jump-form label {
    color: #cbd5e1;
}

body[data-theme="dark"] .page-jump-form button {
    border-color: rgba(125, 211, 252, 0.36);
    background: linear-gradient(180deg, rgba(14, 165, 233, 0.28), rgba(3, 105, 161, 0.34));
    color: #e0f2fe;
}

.table-pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin: 10px 0 18px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 750;
}

.table-pagination label {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.table-pagination select,
.table-pagination input {
    width: auto;
    min-height: 34px;
    padding: 6px 9px;
}

.table-page-custom {
    width: 86px !important;
}

.table-pagination button,
.table-pagination-info,
.table-page-count {
    min-height: 34px;
    padding: 7px 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    color: var(--muted);
    font: inherit;
}

.table-pagination button {
    cursor: pointer;
}

.table-pagination button:disabled {
    cursor: not-allowed;
    opacity: 0.45;
}

.footer {
    margin-top: 28px;
    color: var(--muted);
    font-size: 12px;
}

.muted-note {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 13px;
    font-weight: 650;
}

.popup-shell {
    display: block;
    min-height: 100vh;
}

.popup-shell .main-panel {
    padding: 18px;
}

body.modal-open {
    overflow: hidden;
}

.legacy-popup-page {
    max-width: 1120px;
    margin: 0 auto;
}

.title-bg {
    margin: 0 0 16px;
    padding: 10px 12px;
    border-radius: 4px;
    background: var(--panel-soft);
    border: 1px solid var(--line);
    color: var(--ink);
    font-size: 22px;
    font-weight: 800;
}

.php-style-table th,
.php-style-table td {
    vertical-align: middle;
}

.site-locations-popup .data-table {
    min-width: 720px;
}

.site-location-controls {
    display: grid;
    grid-template-columns: minmax(320px, 8fr) minmax(180px, 3fr) auto;
    gap: 12px;
    align-items: center;
    margin-top: 14px;
}

.legacy-workspace {
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr);
    gap: 18px;
}

.inventory-popup-grid {
    display: grid;
    grid-template-columns: minmax(140px, 180px) minmax(0, 1fr);
    gap: 18px;
    align-items: start;
}

.inventory-history-page {
    max-width: none;
}

.inventory-periods {
    position: sticky;
    top: 18px;
    align-self: start;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
}

.inventory-periods h4 {
    margin: 0 0 10px;
    color: var(--muted);
    font-size: 13px;
    text-transform: uppercase;
}

.inventory-periods nav {
    display: grid;
    gap: 6px;
}

.inventory-periods a,
.inventory-periods span {
    padding: 6px 8px;
    border-radius: 6px;
    color: var(--accent);
    font-size: 13px;
    font-weight: 750;
}

.inventory-periods a.is-active {
    background: rgba(18, 128, 92, 0.12);
    color: var(--primary);
}

.inventory-summary-wrap {
    margin-bottom: 16px;
}

.inventory-history-table {
    min-width: 980px;
}

.inventory-history-table td {
    white-space: normal;
}

.inventory-add-form {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.module-panel {
    align-self: start;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: var(--shadow);
}

.module-panel h2,
.module-search h3 {
    margin: 0 0 14px;
    font-size: 18px;
}

.module-panel nav {
    display: grid;
    gap: 6px;
    margin-bottom: 20px;
}

.module-panel nav a {
    padding: 9px 10px;
    border-radius: 8px;
    color: var(--muted);
    font-weight: 750;
}

.module-panel nav a:hover,
.module-panel nav a.is-active {
    background: rgba(52, 211, 153, 0.14);
    color: var(--primary-strong);
}

.module-panel nav.prefix-filter-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(34px, 1fr));
    gap: 4px;
    margin: 0 0 20px;
}

.module-panel nav.prefix-filter-list a {
    padding: 6px 8px;
    text-align: center;
    text-transform: lowercase;
}

.module-search {
    display: grid;
    gap: 12px;
}

.module-search label,
.product-form label {
    display: grid;
    gap: 7px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 750;
}

.module-export {
    display: grid;
    gap: 10px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
}

.module-export h3 {
    margin: 0;
    font-size: 16px;
}

.muted-line {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.fetch-result {
    min-height: 180px;
    padding: 14px;
    border-radius: 8px;
    background: var(--panel-soft);
    color: var(--ink);
    font-family: Consolas, "Liberation Mono", monospace;
    font-size: 13px;
    line-height: 1.7;
}

.check-row {
    grid-template-columns: 18px 1fr;
    align-items: center;
}

.check-row input {
    width: 16px;
    min-height: 16px;
}

.button-row,
.toolbar-actions,
.source-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.toolbar-actions {
    margin-top: 14px;
}

.button.warning {
    background: #f59e0b;
    color: #fff;
}

.action-table .number,
.number {
    text-align: right;
}

.text-action {
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--accent);
    cursor: pointer;
    font-weight: 800;
}

.site-count {
    color: var(--accent);
    white-space: nowrap;
}

.site-count.has-inactive {
    color: #f97316;
}

.title-label-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px 22px;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
    font-size: 14px;
}

.inline-value {
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--accent);
    cursor: pointer;
    font: inherit;
    font-weight: 800;
}

.label-gallery {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 12px 0 20px;
    border-bottom: 1px solid var(--line);
}

.label-gallery img {
    width: 128px;
    height: 128px;
    object-fit: contain;
}

.title-product-note {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
    gap: 24px;
    align-items: start;
    margin: 18px 0;
}

.label-note {
    min-height: 120px;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--text);
    font-size: 14px;
    text-align: left;
    line-height: 1.45;
    cursor: pointer;
}

.table-section-row td {
    background: var(--panel-soft);
    color: var(--primary-strong);
    font-size: 18px;
    font-weight: 800;
    text-transform: uppercase;
}

.sku-generate-input {
    width: 120px;
    min-height: 36px;
    text-align: center;
}

.inline-input-action {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
}

.inline-input-action .button {
    min-height: 38px;
    white-space: nowrap;
}

.ebay-api-modal {
    position: fixed;
    inset: 50% auto auto 50%;
    z-index: 45;
    width: min(960px, calc(100vw - 32px));
    max-height: calc(100vh - 64px);
    padding: 18px;
    border-radius: 8px;
    background: var(--panel);
    box-shadow: 0 30px 80px rgba(15, 23, 42, 0.32);
    transform: translate(-50%, -50%);
    overflow: auto;
}

.ebay-api-modal select {
    width: 100%;
}

.chip {
    min-height: 28px;
    padding: 5px 8px;
    border: 0;
    border-radius: 6px;
    background: var(--panel-soft);
    color: var(--ink);
    cursor: pointer;
    font-size: 12px;
    font-weight: 800;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 40;
    display: grid;
    place-items: center;
    padding: 18px;
    background: rgba(15, 23, 42, 0.48);
    overflow: auto;
}

.modal-backdrop[hidden] {
    display: none;
}

.legacy-modal {
    width: min(460px, 100%);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: 0 30px 80px rgba(15, 23, 42, 0.28);
    overflow: hidden;
}

.legacy-modal.small {
    width: min(320px, 100%);
}

.legacy-modal.title-action-modal {
    width: min(420px, calc(100vw - 32px));
    max-height: calc(100vh - 36px);
    overflow: auto;
}

.legacy-modal.wide {
    width: min(900px, 100%);
}

.legacy-modal.site-location-modal {
    width: min(1120px, 98vw);
    max-height: 94vh;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
}

.legacy-modal.site-location-modal iframe {
    display: block;
    width: 100%;
    height: min(720px, calc(94vh - 58px));
    min-height: 560px;
    border: 0;
    background: var(--panel);
}

.legacy-modal.tall {
    max-height: 92vh;
    overflow: auto;
}

.legacy-modal header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
}

.legacy-modal h3 {
    margin: 0;
}

.legacy-modal header button {
    border: 0;
    background: transparent;
    cursor: pointer;
    font-weight: 900;
}

#legacyModalBody,
.legacy-modal .form-stack {
    padding: 16px;
}

.modal-form {
    display: grid;
    gap: 14px;
    padding: 16px;
}

.modal-form.two-col {
    grid-template-columns: 1fr 1fr;
}

.modal-form .wide-xl,
.modal-form.two-col .wide-xl {
    grid-column: 1 / -1;
}

.modal-form label {
    display: grid;
    gap: 7px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 750;
}

.modal-form label input,
.modal-form label textarea,
.modal-form label select {
    width: 100%;
}

.modal-form button {
    justify-self: start;
}

.modal-table {
    width: 100%;
    border-collapse: collapse;
}

.modal-table td {
    padding: 14px;
    border: 1px solid var(--line);
    text-align: center;
}

.modal-table-wrap {
    margin: 16px;
}

.permission-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 10px 16px;
    padding: 4px 0;
}

.permission-grid label {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text);
}

.inline-form {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) minmax(160px, 240px) auto;
    gap: 12px;
    align-items: center;
    margin-top: 16px;
}

.inline-form.site-switcher {
    grid-template-columns: minmax(260px, 420px) auto;
    margin: 0 0 18px;
}

.tool-form {
    display: grid;
    grid-template-columns: repeat(6, minmax(120px, 1fr));
    gap: 14px;
    align-items: end;
}

.tool-form label,
.sticker-form label {
    display: grid;
    gap: 7px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 750;
}

.tool-form .wide-xl {
    grid-column: 1 / -1;
}

.parcel-tool-form {
    grid-template-columns: repeat(6, minmax(110px, 1fr));
    gap: 12px 14px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.58), rgba(255, 255, 255, 0)),
        var(--panel);
}

body[data-theme="dark"] .parcel-tool-form {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0)),
        var(--panel);
}

.parcel-section-heading {
    margin: 6px 0 0;
    padding: 9px 12px;
    border: 1px solid #bfdbfe;
    border-left: 5px solid #38bdf8;
    border-radius: 8px;
    background: #e0f2fe;
    color: #075985;
    font-size: 15px;
    font-weight: 850;
    line-height: 1.2;
}

body[data-theme="dark"] .parcel-section-heading {
    border-color: rgba(125, 211, 252, 0.32);
    border-left-color: #38bdf8;
    background: rgba(14, 116, 144, 0.26);
    color: #bae6fd;
}

.parcel-warehouse-field select {
    min-height: 44px;
    white-space: normal;
}

.parcel-actions {
    padding-top: 2px;
}

.parcel-result-table {
    margin-top: 18px;
}

.track-search-form {
    grid-template-columns: minmax(170px, 240px) minmax(260px, 1fr) auto;
}

.track-search-value {
    min-width: 0;
}

.track-search-actions {
    align-self: end;
}

.tool-split .parcel-section-heading {
    margin-bottom: 10px;
}

.compact-tool-form {
    grid-template-columns: repeat(5, minmax(100px, 1fr));
}

.input-with-button {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px;
}

.result-panel {
    margin-top: 16px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel-soft);
}

.tool-split {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 18px;
    margin-top: 20px;
}

.data-table.compact th,
.data-table.compact td {
    padding: 8px 9px;
}

.sticker-form {
    display: grid;
    grid-template-columns: repeat(4, minmax(160px, 1fr));
    gap: 14px;
}

.radio-row {
    display: flex !important;
    grid-template-columns: none !important;
    align-items: center;
    gap: 7px;
}

@media (max-width: 760px) {
    .modal-backdrop {
        padding: 10px;
    }

    .legacy-modal.site-location-modal {
        width: min(1120px, calc(100vw - 20px));
        max-height: calc(100vh - 20px);
        align-self: start;
    }

    .legacy-modal.site-location-modal iframe {
        height: calc(100vh - 78px);
        min-height: 560px;
    }

    .popup-shell .main-panel {
        padding: 10px;
    }

    .title-bg {
        margin-bottom: 10px;
        padding: 9px 10px;
        font-size: 18px;
    }

    .site-locations-popup .table-wrap {
        max-height: 52vh;
        overflow: auto;
    }

    .modal-form.two-col,
    .inline-form {
        grid-template-columns: 1fr;
    }

    .site-location-controls {
        grid-template-columns: minmax(260px, 8fr) minmax(150px, 3fr) auto;
        gap: 10px;
        margin-top: 10px;
    }
}

@media (max-width: 520px) {
    .site-location-controls {
        grid-template-columns: 1fr;
    }

    .site-location-controls .button {
        width: 100%;
    }
}

.modal-loading {
    margin: 0;
    padding: 16px;
    color: var(--muted);
}

.warehouse-products td {
    white-space: normal;
}

.warehouse-products .number {
    white-space: normal;
}

.product-thumb {
    display: block;
    width: 64px;
    height: 64px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid var(--line);
}

.sku-cell {
    display: inline-block;
    min-width: 80px;
    font-weight: 800;
}

.status-badge {
    display: inline-grid;
    place-items: center;
    min-width: max-content;
    min-height: 20px;
    padding: 2px 8px;
    border-radius: 4px;
    color: #fff;
    font-size: 12px;
    font-weight: 900;
    line-height: 1.2;
    white-space: nowrap;
}

.status-badge.success {
    background: #16a34a;
}

.status-badge.danger {
    background: var(--danger);
}

.status-badge.warning,
.status-badge.status-0 {
    background: #f59e0b;
}

.status-badge.info,
.status-badge.status-1 {
    background: #0ea5e9;
}

.status-badge.status-2 {
    background: #2563eb;
}

.status-badge.status-3 {
    background: #16a34a;
}

.legacy-label-default {
    display: inline-block;
    padding: 2px 6px 3px;
    border-radius: 4px;
    background: #777;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
}

button.legacy-label-default {
    border: 0;
    cursor: pointer;
}

.legacy-label-default.service-suggestion {
    background: #777;
}

.legacy-click-badge {
    display: inline-block;
    padding: 2px 6px 3px;
    border: 0;
    border-radius: 4px;
    background: #777;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
}

.text-button {
    border: 0;
    background: transparent;
    color: var(--link);
    font: inherit;
    padding: 0;
    cursor: pointer;
}

.text-button:hover,
.legacy-click-badge:hover,
button.legacy-label-default:hover {
    filter: brightness(0.95);
    text-decoration: underline;
}

.location-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--link);
    font-size: 12px;
    line-height: 1.4;
    text-decoration: none;
    white-space: nowrap;
}

.location-link:hover {
    text-decoration: underline;
}

.location-link.muted {
    color: var(--muted);
}

.location-flag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 4px;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
}

.location-flag.ok {
    background: #16a34a;
}

.location-flag.missing {
    background: #dc2626;
}

.multiline-action {
    text-align: left;
    line-height: 1.5;
}

.notice-box,
.upload-form,
.return-item-block {
    margin-bottom: 16px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel-soft);
}

.upload-form {
    display: grid;
    gap: 12px;
}

.upload-form label,
.claim-row {
    display: grid;
    gap: 7px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 750;
}

.date-list {
    display: grid;
    gap: 6px;
}

.filter-inline {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: end;
}

.field-label,
.form-section-title {
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.choice-list {
    max-height: 260px;
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.compact-table td {
    padding: 7px 9px;
}

.qty-input {
    width: 64px;
    min-height: 30px;
    padding: 4px 6px;
    text-align: right;
}

.return-label-table td {
    white-space: normal;
}

.return-form .form-section-title {
    grid-column: 1 / -1;
    margin: 6px 0 0;
    padding-top: 12px;
    border-top: 1px solid var(--line);
    font-size: 16px;
}

.return-images {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 12px;
}

.return-images img {
    width: 256px;
    height: 256px;
    object-fit: cover;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.return-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 10px;
}

.orders-table-wrap {
    -webkit-overflow-scrolling: touch;
}

.orders-track-table {
    min-width: 1180px;
    table-layout: fixed;
}

.orders-track-table th {
    background: #ffe8c2;
    color: #4a2f0a;
    font-weight: 900;
}

.orders-track-table th:nth-child(1),
.orders-track-table td:nth-child(1) {
    width: 82px;
}

.orders-track-table th:nth-child(2),
.orders-track-table td:nth-child(2) {
    width: 140px;
}

.orders-track-table th:nth-child(3),
.orders-track-table td:nth-child(3),
.orders-track-table th:nth-child(4),
.orders-track-table td:nth-child(4) {
    width: 150px;
}

.orders-track-table th:nth-child(5),
.orders-track-table td:nth-child(5) {
    width: 150px;
}

.orders-track-table th:nth-child(6),
.orders-track-table td:nth-child(6) {
    width: 260px;
}

.orders-track-table th:nth-child(7),
.orders-track-table td:nth-child(7) {
    width: 180px;
}

.orders-track-table th:nth-child(8),
.orders-track-table td:nth-child(8) {
    width: 92px;
}

.orders-track-table th:nth-child(9),
.orders-track-table td:nth-child(9) {
    width: 96px;
}

.orders-track-table td {
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: normal;
}

.orders-track-table .track-number,
.orders-track-table td:nth-child(2),
.orders-track-table td:nth-child(3),
.orders-track-table td:nth-child(4) {
    font-weight: 800;
    overflow-wrap: anywhere;
}

.orders-track-table .order-title-cell {
    max-width: none;
    line-height: 1.45;
}

.orders-track-table .order-actions {
    white-space: normal;
}

.orders-track-table .order-actions .text-action {
    display: inline-block;
    margin: 0 8px 6px 0;
}

.orders-track-table select {
    max-width: 100%;
}

.orders-track-table .status-cell {
    text-align: center;
}

.orders-track-table tr.order-row-sky td {
    background: #e6f7ff;
}

.orders-track-table tr.order-row-white td {
    background: #fff;
}

.orders-track-table tr.order-row-sky:hover td {
    background: #d8f1fb;
}

.orders-track-table tr.order-row-white:hover td {
    background: #f8fbfd;
}

body[data-theme="dark"] .orders-track-table tr.order-row-sky td {
    background: rgba(14, 165, 233, 0.14);
}

body[data-theme="dark"] .orders-track-table tr.order-row-white td {
    background: var(--panel);
}

body[data-theme="dark"] .orders-track-table tr.order-row-sky:hover td {
    background: rgba(14, 165, 233, 0.22);
}

body[data-theme="dark"] .orders-track-table tr.order-row-white:hover td {
    background: var(--panel-soft);
}

.product-form {
    display: grid;
    grid-template-columns: minmax(160px, 1fr) minmax(220px, 2fr) minmax(160px, 1fr);
    gap: 14px;
}

.product-form .wide {
    grid-column: span 1;
}

.product-form .wide-xl {
    grid-column: 1 / -1;
}

.product-form select {
    min-height: 120px;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--ink);
}

.label-edit-panel {
    max-width: 1180px;
    margin: 0 auto;
}

.label-edit-heading {
    align-items: center;
}

.soft-pill {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 6px 12px;
    border: 1px solid #bae6fd;
    border-radius: 999px;
    background: #ecfeff;
    color: #0369a1;
    font-size: 12px;
    font-weight: 850;
}

.label-edit-form {
    grid-template-columns: repeat(6, minmax(110px, 1fr));
    gap: 14px;
}

.label-edit-section {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 12px 14px;
    padding: 14px;
    border: 1px solid #dbeafe;
    border-radius: 8px;
    background:
        linear-gradient(180deg, rgba(240, 249, 255, 0.9), rgba(255, 255, 255, 0.56)),
        var(--panel);
}

.label-edit-section .parcel-section-heading {
    grid-column: 1 / -1;
    margin: 0;
}

.label-edit-section label,
.label-edit-section .multi-action-field {
    grid-column: span 2;
}

.label-edit-section label.wide,
.label-edit-section .multi-action-field.wide {
    grid-column: span 3;
}

.label-edit-section label.wide-xl,
.label-edit-section .wide-xl {
    grid-column: 1 / -1;
}

.label-edit-form input,
.label-edit-form textarea,
.label-edit-form select {
    width: 100%;
}

.label-edit-form select:not([multiple]) {
    min-height: 42px;
    height: 42px;
    padding: 8px 34px 8px 10px;
}

.label-edit-form select[multiple] {
    min-height: 136px;
    font-size: 13px;
}

.checkbox-card {
    grid-template-columns: 18px 1fr !important;
    align-items: center;
    align-self: end;
    min-height: 42px;
    padding: 8px 10px;
    border: 1px solid #dbeafe;
    border-radius: 8px;
    background: #f8fafc;
}

.checkbox-card input {
    width: 16px;
    min-height: 16px;
}

.option-button-row {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    align-items: center;
    margin-bottom: 7px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 850;
}

.option-button-row span {
    margin-right: auto;
}

.label-edit-form .button,
.pastel-dialog .button {
    position: relative;
    min-height: 34px;
    padding: 7px 12px;
    border-radius: 7px;
    border-color: transparent;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
    font-size: 12px;
    font-weight: 850;
    line-height: 1;
    transition: transform 0.14s ease, box-shadow 0.14s ease, background 0.14s ease, border-color 0.14s ease;
}

.label-edit-form .button:hover,
.pastel-dialog .button:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.12);
}

.label-edit-form .button:active,
.pastel-dialog .button:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.12);
}

.label-edit-form .button.soft,
.pastel-dialog .button.soft {
    border-color: #bae6fd;
    background: linear-gradient(180deg, #f0f9ff, #e0f2fe);
    color: #075985;
}

.label-edit-form .button.soft:hover,
.pastel-dialog .button.soft:hover {
    border-color: #7dd3fc;
    background: linear-gradient(180deg, #e0f2fe, #bae6fd);
}

.label-edit-form .button.subtle,
.pastel-dialog .button.subtle {
    border-color: #e2e8f0;
    background: linear-gradient(180deg, #ffffff, #f8fafc);
    color: #475569;
}

.label-edit-form .button.subtle:hover,
.pastel-dialog .button.subtle:hover {
    border-color: #cbd5e1;
    background: linear-gradient(180deg, #f8fafc, #eef2f7);
    color: #334155;
}

.label-edit-form .form-actions,
.pastel-dialog .form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
    align-items: center;
}

.label-edit-form > .form-actions {
    position: sticky;
    bottom: 0;
    z-index: 3;
    margin-top: 2px;
    padding: 12px 0 0;
    border-top: 1px solid rgba(186, 230, 253, 0.72);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0), var(--panel) 42%);
}

.label-edit-form > .form-actions .button.primary {
    min-width: 150px;
    min-height: 42px;
    padding: 11px 22px;
    border-color: #0369a1;
    background: linear-gradient(135deg, #0ea5e9, #0284c7);
    color: #fff;
    box-shadow: 0 10px 24px rgba(2, 132, 199, 0.24);
    font-size: 14px;
}

.label-edit-form > .form-actions .button.primary:hover {
    background: linear-gradient(135deg, #0284c7, #0369a1);
    box-shadow: 0 14px 30px rgba(2, 132, 199, 0.3);
}

.option-button-row .button {
    min-width: 62px;
}

.template-row {
    display: grid !important;
    grid-template-columns: 1fr auto auto;
    align-items: end;
}

.template-row > span {
    grid-column: 1 / -1;
}

.pastel-dialog {
    width: min(92vw, 520px);
    border: 1px solid #bae6fd;
    border-radius: 10px;
    background: var(--panel);
    color: var(--ink);
    box-shadow: 0 24px 70px rgba(15, 23, 42, 0.22);
}

.pastel-dialog::backdrop {
    background: rgba(15, 23, 42, 0.36);
}

.pastel-dialog h3 {
    margin: 0 0 14px;
    color: #075985;
}

.dialog-form {
    display: grid;
    gap: 12px;
}

.image-dialog {
    width: min(94vw, 660px);
}

.image-dialog img {
    display: block;
    width: 100%;
    max-height: 64vh;
    object-fit: contain;
    border-radius: 8px;
    background: #f8fafc;
}

.product-dialog {
    width: min(94vw, 760px);
}

.product-dialog-grid {
    display: grid;
    grid-template-columns: minmax(240px, 1fr) minmax(90px, 130px);
    gap: 12px;
    align-items: end;
}

.product-dialog select {
    width: 100%;
    min-height: 260px;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--ink);
}

body[data-theme="dark"] .label-edit-section,
body[data-theme="dark"] .checkbox-card {
    border-color: rgba(125, 211, 252, 0.24);
    background:
        linear-gradient(180deg, rgba(14, 116, 144, 0.16), rgba(15, 23, 42, 0.04)),
        var(--panel);
}

body[data-theme="dark"] .soft-pill {
    border-color: rgba(125, 211, 252, 0.32);
    background: rgba(14, 116, 144, 0.2);
    color: #bae6fd;
}

body[data-theme="dark"] .label-edit-form .button.soft,
body[data-theme="dark"] .pastel-dialog .button.soft {
    border-color: rgba(125, 211, 252, 0.38);
    background: linear-gradient(180deg, rgba(14, 165, 233, 0.28), rgba(3, 105, 161, 0.34));
    color: #e0f2fe;
}

body[data-theme="dark"] .label-edit-form .button.subtle,
body[data-theme="dark"] .pastel-dialog .button.subtle {
    border-color: rgba(148, 163, 184, 0.34);
    background: linear-gradient(180deg, rgba(30, 41, 59, 0.96), rgba(15, 23, 42, 0.96));
    color: #cbd5e1;
}

body[data-theme="dark"] .label-edit-form > .form-actions {
    border-top-color: rgba(125, 211, 252, 0.22);
    background: linear-gradient(180deg, rgba(15, 23, 42, 0), var(--panel) 42%);
}

body[data-theme="dark"] .pastel-dialog h3 {
    color: #bae6fd;
}

.return-label-edit-panel {
    max-width: 1040px;
    margin: 0 auto;
}

.return-form .return-destination-field {
    grid-column: span 2;
    width: min(100%, 320px);
}

.return-form .return-warehouse-select,
.return-form select:not([multiple]) {
    width: 320px;
    min-height: 42px;
    height: 42px;
    max-width: 100%;
    padding: 9px 38px 9px 12px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 1180px) {
    .metric-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 860px) {
    .app-shell,
    body.sidebar-collapsed .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar,
    body.sidebar-collapsed .sidebar {
        position: relative;
        height: auto;
        padding: 18px;
    }

    body.sidebar-collapsed .brand {
        justify-content: flex-start;
        gap: 12px;
        padding: 8px 8px 22px;
    }

    body.sidebar-collapsed .brand-copy,
    body.sidebar-collapsed .submenu {
        display: block;
    }

    body.sidebar-collapsed .nav-item > a {
        justify-content: flex-start;
        width: auto;
        min-height: 38px;
        padding: 9px 12px;
        font-size: 13px;
    }

    body.sidebar-collapsed .nav-item > a::before {
        content: none;
    }

    .side-nav,
    .service-grid,
    .auth-grid,
    .metric-grid {
        grid-template-columns: 1fr;
    }

    .main-panel {
        padding: 18px;
    }

    .topbar,
    .page-heading {
        align-items: stretch;
        flex-direction: column;
    }

    .filter-bar {
        grid-template-columns: 1fr;
    }

    .legacy-workspace,
    .product-form,
    .tool-split {
        grid-template-columns: 1fr;
    }

    .inventory-add-form {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .return-form .return-destination-field {
        grid-column: 1 / -1;
        width: 100%;
    }

    .return-form .return-warehouse-select,
    .return-form select:not([multiple]) {
        width: 100%;
    }

    .module-panel {
        position: static;
    }

    .module-panel nav.date-list {
        max-height: 220px;
        overflow: auto;
    }

    .title-product-note {
        grid-template-columns: 1fr;
    }

    .orders-track-table {
        min-width: 960px;
        font-size: 12px;
    }

    .orders-track-table th,
    .orders-track-table td {
        padding: 8px 9px;
    }

    .tool-form,
    .track-search-form,
    .compact-tool-form,
    .sticker-form,
    .label-edit-form,
    .label-edit-section {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .label-edit-section label,
    .label-edit-section .multi-action-field,
    .label-edit-section label.wide,
    .label-edit-section .multi-action-field.wide {
        grid-column: span 1;
    }
}

@media (max-width: 640px) {
    .inventory-popup-grid {
        grid-template-columns: 1fr;
    }

    .inventory-periods {
        position: static;
    }

    .inventory-periods nav {
        display: flex;
        flex-wrap: wrap;
    }
}

@media (max-width: 560px) {
    .main-panel {
        padding: 12px;
    }

    .module-panel {
        padding: 14px;
    }

    .button-row,
    .toolbar-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .button-row .button,
    .toolbar-actions .button {
        width: 100%;
        text-align: center;
    }

    .orders-table-wrap {
        border-radius: 6px;
    }

    .orders-track-table {
        min-width: 860px;
    }

    .orders-track-table th,
    .orders-track-table td {
        padding: 7px 8px;
    }

    .orders-track-table th:nth-child(6),
    .orders-track-table td:nth-child(6) {
        width: 210px;
    }

    .orders-track-table th:nth-child(7),
    .orders-track-table td:nth-child(7) {
        width: 150px;
    }

    .modern-pagination {
        justify-content: stretch;
    }

    .modern-pagination .page-summary,
    .page-jump-form {
        width: 100%;
    }

    .page-jump-form {
        justify-content: space-between;
        margin-left: 0;
    }

    .tool-form,
    .track-search-form,
    .compact-tool-form,
    .sticker-form,
    .label-edit-form,
    .label-edit-section,
    .inventory-add-form,
    .migration-password-form {
        grid-template-columns: 1fr;
    }

    .label-edit-section label,
    .label-edit-section .multi-action-field,
    .label-edit-section label.wide,
    .label-edit-section .multi-action-field.wide,
    .template-row {
        grid-column: 1 / -1;
    }

    .template-row,
    .product-dialog-grid {
        grid-template-columns: 1fr;
    }

    .label-edit-form > .form-actions {
        position: static;
    }

    .label-edit-form .form-actions .button,
    .pastel-dialog .form-actions .button,
    .option-button-row .button {
        width: 100%;
    }

    .option-button-row span {
        flex-basis: 100%;
    }

    .return-label-edit-panel {
        padding: 14px;
    }

    .return-form .return-warehouse-select,
    .return-form select:not([multiple]) {
        height: auto;
        min-height: 42px;
        white-space: normal;
    }
}
