:root {
    --erp-green: #1ab394;
    --erp-dark: #2f4050;
    --erp-active: #293846;
    --erp-border: #e7eaec;
    --erp-muted: #8795a3;
    --bs-success: #1ab394;
}
.portal-shell {
    margin: 0;
    background: #f3f3f4;
    color: #676a6c;
    font:
        13px/1.5 -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        "Microsoft YaHei",
        sans-serif;
    overflow: hidden;
}
.portal-shell .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 220px;
    background: var(--erp-dark);
    overflow-y: auto;
    color: #a7b1c2;
    z-index: 30;
    padding: 0 0 45px;
}
.portal-shell .brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 32px 22px 12px;
    color: #fff;
    text-decoration: none;
    font-size: 19px;
    font-weight: 600;
}
.portal-shell .brand-mark {
    display: grid;
    place-items: center;
    background: var(--erp-green);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 22px;
}
.portal-shell .nav-label {
    padding: 0 22px 25px;
    color: #a7b1c2;
    font-size: 12px;
}
.portal-shell .sidebar-foot {
    padding: 24px 22px;
    font-size: 11px;
    color: #7d8e9f;
}
.portal-shell .nav-link {
    display: block;
    color: #a7b1c2;
    padding: 10px 20px 10px 36px;
    text-decoration: none;
    border-left: 4px solid transparent;
    font-weight: 500;
}
.portal-shell .nav-link:hover {
    color: white;
    background: #293846;
}
.portal-shell .nav-link.active {
    color: #fff;
    border-left-color: var(--erp-green);
    background: var(--erp-active);
}
.portal-shell .nav-group summary {
    padding: 14px 18px;
    cursor: pointer;
    font-weight: 600;
    list-style: none;
}
.portal-shell .nav-group summary::after {
    content: "‹";
    float: right;
}
.portal-shell .nav-group[open] summary::after {
    content: "⌄";
}
.portal-shell .nav-group[open] {
    background: #293846;
}
.portal-shell .nav-group summary:hover {
    color: #fff;
}
.portal-shell .nav-link[data-presentation="standalone"]::after,
.portal-shell .nav-link[data-presentation="auth"]::after {
    content: " ↗";
    font-size: 10px;
}
.shell-workspace {
    margin-left: 220px;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.shell-header {
    height: 61px;
    flex-shrink: 0;
    background: #fff;
    border-bottom: 1px solid var(--erp-border);
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 0 24px;
}
.shell-user {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 18px;
}
.shell-user a {
    color: #676a6c;
    text-decoration: none;
}
.shell-tabbar {
    display: flex;
    background: #fafafa;
    border-bottom: 2px solid var(--erp-dark);
    height: 42px;
    flex-shrink: 0;
}
#tabs {
    display: flex;
    flex: 1;
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: thin;
}
.work-tab {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    border-right: 1px solid var(--erp-border);
    gap: 4px;
    max-width: 240px;
    padding-right: 8px;
}
.work-tab button {
    border: 0;
    background: transparent;
    color: #777;
    padding: 11px 12px;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
    font-size: 12px;
}
.work-tab .tab-close {
    padding: 3px 6px;
}
.work-tab.active {
    background: var(--erp-dark);
}
.work-tab.active button {
    color: #fff;
}
.work-tab.dirty .tab-label::before {
    content: "● ";
    color: #f5b94e;
}
.work-tab.pending .tab-label::after {
    content: " …";
}
.tab-menu {
    position: relative;
    width: 88px;
    border-left: 1px solid #ddd;
    background: #fff;
}
.tab-menu summary {
    cursor: pointer;
    padding: 10px;
    list-style: none;
    text-align: center;
}
.tab-menu > div {
    position: absolute;
    right: 0;
    top: 40px;
    width: 150px;
    z-index: 50;
    background: #fff;
    border: 1px solid #ddd;
    box-shadow: 0 4px 12px #0002;
    padding: 5px;
}
.tab-menu button {
    display: block;
    border: 0;
    background: white;
    width: 100%;
    text-align: left;
    padding: 10px;
    font-size: 13px;
}
.tab-menu button:hover {
    background: #f3f3f4;
}
#frames {
    flex: 1;
    min-height: 0;
    position: relative;
}
.work-frame {
    width: 100%;
    height: 100%;
    border: 0;
    background: #f3f3f4;
    display: block;
}
.work-frame[hidden] {
    display: none;
}
.frame-warning {
    position: absolute;
    top: 15px;
    left: 20px;
    right: 20px;
    padding: 20px;
    background: #fff8df;
    border: 1px solid #ebd697;
    z-index: 10;
}
.shell-footer {
    height: 30px;
    flex-shrink: 0;
    display: flex;
    justify-content: space-between;
    padding: 5px 20px;
    background: #fff;
    border-top: 1px solid #e7eaec;
    font-size: 11px;
}
.shell-notice:empty {
    display: none;
}
.shell-notice {
    padding: 10px 20px;
    background: #e8f6f0;
    color: #16755e;
}
.shell-notice.error {
    background: #fff0ee;
    color: #a3382c;
}
.portal-shell.menu-collapsed .sidebar {
    display: none;
}
.portal-shell.menu-collapsed .shell-workspace {
    margin-left: 0;
}
.btn-success {
    --bs-btn-bg: #1ab394;
    --bs-btn-border-color: #1ab394;
    --bs-btn-hover-bg: #18a689;
    --bs-btn-hover-border-color: #18a689;
    --bs-btn-active-bg: #148b72;
}
.btn {
    border-radius: 3px;
    font-size: 13px;
}
.portal-dialog {
    padding: 24px;
    max-width: min(540px, calc(100vw - 32px));
    border: 0;
    border-top: 4px solid var(--erp-green);
    border-radius: 3px;
    box-shadow: 0 10px 55px #0004;
    color: #676a6c;
    font: 14px/1.6 sans-serif;
}
.portal-dialog::backdrop {
    background: #14202f66;
}
.portal-dialog h2 {
    font-size: 19px;
    margin: 0 0 15px;
}
.dialog-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 22px;
}
.dialog-actions button {
    padding: 7px 15px;
    border: 1px solid #ddd;
    border-radius: 3px;
    cursor: pointer;
}
.dialog-actions .confirm-primary {
    background: var(--erp-green);
    color: white;
    border-color: var(--erp-green);
}
.portal-dialog p {
    white-space: pre-line;
}
.portal-error main {
    max-width: 650px;
    margin: 8vh auto;
    padding: 32px;
    background: white;
    border-top: 4px solid var(--erp-green);
}
.portal-error {
    background: #f3f3f4;
}
.portal-content {
    background: #f3f3f4;
    color: #676a6c;
    font-size: 13px;
}
.portal-content .workspace {
    margin: 0;
    min-height: 0;
}
.portal-content .main {
    padding: 20px;
    max-width: none;
    margin: 0;
}
.portal-content .page-title {
    margin: 0 0 18px;
    align-items: center;
}
.portal-content h1 {
    font-size: 20px;
    color: #676a6c;
    font-weight: 500;
}
.portal-content h2 {
    font-size: 15px;
    font-weight: 600;
    color: #676a6c;
}
.portal-content h3 {
    font-size: 14px;
}
.portal-content .card {
    border: 1px solid var(--erp-border);
    border-top: 3px solid var(--erp-border);
    border-radius: 0;
    box-shadow: none;
    padding: 20px;
    margin-bottom: 20px;
}
.portal-content .card h2 {
    padding-bottom: 12px;
    border-bottom: 1px solid #f0f0f0;
    margin-bottom: 16px;
}
.portal-content table {
    font-size: 13px;
    border: 1px solid var(--erp-border);
    width: 100%;
}
.portal-content th,
.portal-content td {
    padding: 9px 10px;
    border: 1px solid var(--erp-border);
    vertical-align: middle;
}
.portal-content th {
    background: #f7f7f7;
    color: #676a6c;
    font-weight: 600;
}
.portal-content tbody tr:hover {
    background: #f9fafb;
}
.portal-content button,
.portal-content .button {
    padding: 6px 12px;
    min-height: 32px;
    border-radius: 3px;
    font-size: 12px;
    background: #1ab394;
    border: 1px solid #1ab394;
    color: white;
    box-shadow: none;
}
.portal-content button.secondary,
.portal-content .button.secondary {
    background: white;
    color: #676a6c;
    border: 1px solid #d2d2d2;
}
.portal-content button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}
.portal-content input:not([type="checkbox"]):not([type="radio"]),
.portal-content select,
.portal-content textarea {
    font-size: 13px;
    border: 1px solid #e5e6e7;
    border-radius: 1px;
    min-height: 34px;
    padding: 6px 10px;
    background: white;
    color: #676a6c;
}
.portal-content input:focus,
.portal-content select:focus,
.portal-content textarea:focus {
    border-color: #1ab394;
    box-shadow: 0 0 0 2px #1ab39415;
    outline: none;
}
.portal-content .field label {
    font-weight: 600;
    font-size: 12px;
}
.portal-content .filter-bar {
    align-items: end;
    gap: 12px;
}
.portal-content .filter-bar .field {
    flex: 1;
    min-width: 130px;
}
.portal-content .pagination {
    justify-content: flex-end;
    border-top: 1px solid #eee;
    padding-top: 14px;
    margin-top: 12px;
}
.portal-content .muted,
.portal-content .hint {
    color: #8b9198;
    font-size: 12px;
}
.portal-content .notice {
    border-radius: 2px;
}
.portal-content .notice:empty {
    display: none;
}
.portal-content .rich-editor {
    min-height: 230px;
    border-radius: 0;
}
.portal-content .media-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
}
.portal-content .media-tile {
    border-radius: 2px;
    box-shadow: none;
}
.portal-content .media-tile img {
    height: 150px;
    object-fit: contain;
    background: #fafafa;
}
.portal-content .sku-table {
    max-width: 100%;
    overflow: auto;
}
.portal-content .sku-table table {
    min-width: 1100px;
}
.portal-content .sku-table input {
    min-width: 90px;
}
.portal-content .sku-table select {
    min-width: 130px;
}
.portal-content .spec-group {
    border-radius: 0;
    background: #f8f9fa;
}
.portal-content .form-row {
    gap: 20px;
}
.portal-content .form-row .field {
    flex: 1;
    min-width: 200px;
}
.editor-nav {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
    background: #fff;
    padding: 10px;
    margin-bottom: 18px;
    border-bottom: 2px solid #1ab394;
}
.editor-nav a {
    color: #676a6c;
    text-decoration: none;
    padding: 6px 12px;
    font-size: 13px;
}
.editor-nav a:hover {
    background: #f3f3f4;
}
.save-badge {
    color: #b06c18;
    font-size: 12px;
    margin-left: 12px;
}
.save-badge:empty {
    display: none;
}
.product-status-tag {
    display: inline-block;
    background: #e6f4ee;
    color: #148266;
    padding: 3px 8px;
    border-radius: 2px;
}
.product-status-tag.off {
    background: #f0f1f3;
    color: #777;
}
.dispatch-guide {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 16px;
    background: #fff;
    border-left: 3px solid #1ab394;
    padding: 14px 18px;
}
.dispatch-guide span {
    color: #92989d;
}
.portal-content .table-wrap {
    border-radius: 0;
}
.portal-content .list-loading {
    opacity: 0.6;
    pointer-events: none;
}
.portal-content fieldset:disabled {
    opacity: 0.75;
}
@media (max-width: 767px) {
    .portal-shell .sidebar {
        width: 200px;
        box-shadow: 3px 0 12px #0002;
    }
    .portal-shell .shell-workspace {
        margin-left: 0;
    }
    .portal-shell:not(.menu-open) .sidebar {
        display: none;
    }
    .shell-header {
        padding: 0 12px;
        gap: 10px;
        height: 54px;
    }
    .shell-entry {
        font-size: 12px;
    }
    .shell-user {
        gap: 8px;
    }
    .shell-user > span,
    .shell-user > a {
        display: none;
    }
    .shell-footer span:last-child {
        display: none;
    }
    .portal-content .main {
        padding: 12px;
    }
    .portal-content .card {
        padding: 14px;
    }
    .portal-content .filter-bar {
        display: flex;
        flex-wrap: wrap;
    }
    .portal-content .filter-bar .field {
        min-width: 135px;
    }
    .portal-content .form-row {
        gap: 12px;
    }
    .portal-content .form-row .field {
        min-width: 100%;
    }
    .portal-content .page-title {
        align-items: flex-start;
        gap: 10px;
    }
    .portal-content h1 {
        font-size: 18px;
    }
    .portal-content .table-wrap {
        overflow: auto;
    }
    .editor-nav {
        gap: 0;
    }
    .editor-nav a {
        padding: 5px 8px;
    }
    .shell-tabbar {
        height: 41px;
    }
}
@media print {
    body.portal-content {
        background: white;
    }
    .portal-content .packing-order {
        break-inside: avoid;
        margin-top: 16px;
    }

    .portal-content #detail-body {
        overflow: visible;
        max-height: none;
    }
    .portal-content .editor-nav,
    .portal-content .dispatch-guide {
        display: none !important;
    }
    .portal-content .main {
        padding: 0;
    }
    .portal-content .card {
        padding: 0;
        border: 0;
        break-inside: auto;
    }
    .portal-content table {
        break-inside: auto;
    }
    .portal-content tr {
        break-inside: avoid;
    }
    .portal-content thead {
        display: table-header-group;
    }
    .portal-content .table-wrap {
        overflow: visible;
    }
    .portal-content #print-area h2 {
        break-after: avoid;
    }
    .portal-content #print-area table {
        min-width: 0;
    }
}

#frames.identity-check::after {
    content: "正在核验会话…";
    position: absolute;
    inset: 0;
    background: #f3f3f4;
    z-index: 20;
    display: grid;
    place-items: center;
}
.portal-content .card {
    display: block;
}

/* Shared business pages: compact ERP panels, readable long forms and local scrolling. */
.portal-content .subsection {
    background: #fff;
    border: 1px solid var(--erp-border);
    border-left: 3px solid #1ab394;
    border-radius: 0;
    padding: 16px;
    margin: 16px 0;
}
.portal-content .subsection > h3 {
    margin: 0 0 16px;
    font-weight: 600;
}
.portal-content .form-grid {
    gap: 16px;
    align-items: start;
}
.portal-content .form-grid > button {
    align-self: end;
    justify-self: start;
}
.portal-content .form-grid label {
    font-size: 12px;
    font-weight: 600;
}
.portal-content .form-grid textarea {
    min-height: 88px;
    resize: vertical;
}
.portal-content select[multiple] {
    min-height: 112px;
}
.portal-content #filter {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: end;
}
.portal-content #filter > input,
.portal-content #filter > select {
    width: auto;
    max-width: 100%;
}
.portal-content #tools {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.portal-content #detail-body {
    overflow-wrap: anywhere;
}
.portal-content #detail-body .table-wrap {
    max-width: 100%;
}
.portal-content #detail-body td {
    max-width: 420px;
    white-space: normal;
}
.portal-content form[inert],
.portal-content #detail-body[inert] {
    opacity: 0.72;
}
.portal-content input[type="file"] {
    max-width: 100%;
}
@media (max-width: 767px) {
    .portal-content .subsection {
        padding: 12px;
    }
    .portal-content .form-grid {
        grid-template-columns: minmax(0, 1fr);
    }
    .portal-content #filter > input,
    .portal-content #filter > select {
        width: 100%;
    }
}
