:root {
    --bg: #f4efe7;
    --surface: rgba(255, 252, 247, 0.84);
    --surface-strong: #fffaf2;
    --line: rgba(67, 61, 47, 0.12);
    --text: #231f18;
    --muted: #6b6256;
    --accent: #0f766e;
    --accent-soft: #d7f3ee;
    --gold: #c68429;
    --warning: #d97706;
    --danger: #b45309;
    --shadow: 0 18px 45px rgba(74, 56, 24, 0.12);
    --radius-xl: 28px;
    --radius-lg: 22px;
    --radius-md: 16px;
    --font-ui: "Aptos", "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    --sidebar-width: 204px;
    --sidebar-width-collapsed: 64px;
}

* {
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    overflow-x: hidden;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--font-ui);
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(15, 118, 110, 0.15), transparent 28%),
        radial-gradient(circle at bottom right, rgba(198, 132, 41, 0.16), transparent 32%),
        linear-gradient(145deg, #f6f1e8 0%, #efe7da 48%, #f9f5ee 100%);
}

body.is-sidebar-open {
    overflow: hidden;
}

a {
    color: inherit;
    text-decoration: none;
}

.erp-shell {
    position: relative;
    display: block;
    width: 100%;
    max-width: 100vw;
    min-height: 100vh;
    overflow-x: clip;
    padding-left: var(--sidebar-width);
    transition: padding-left 0.25s ease;
}

.erp-shell.is-sidebar-collapsed {
    padding-left: var(--sidebar-width-collapsed);
}

.erp-sidebar {
    position: fixed;
    display: flex;
    flex-direction: column;
    left: 0;
    top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    padding: 16px 14px 18px;
    border-right: 1px solid var(--line);
    background: rgba(35, 31, 24, 0.94);
    color: #f7f2e9;
    backdrop-filter: blur(18px);
    overflow: hidden;
    transition: width 0.25s ease, padding 0.25s ease, transform 0.25s ease;
    z-index: 20;
}

.sidebar-toggle-row {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 10px;
}

.sidebar-toggle-icon {
    width: 30px;
    height: 30px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 9px;
    background: rgba(255, 255, 255, 0.06);
    color: #fff7ec;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    transition: all 0.2s ease;
}

.sidebar-toggle-icon:hover {
    background: rgba(143, 229, 215, 0.2);
    border-color: rgba(143, 229, 215, 0.32);
}

.sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 15;
    background: rgba(35, 31, 24, 0.34);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.sidebar-backdrop.is-visible {
    opacity: 1;
    pointer-events: auto;
}

.brand-block {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
    min-width: 0;
}

.brand-badge {
    display: grid;
    place-items: center;
    width: 50px;
    height: 50px;
    border-radius: 16px;
    font-weight: 700;
    color: #12332f;
    background: linear-gradient(135deg, #f3d18d, #8fe5d7);
}

.brand-title {
    margin: 0;
    font-size: 0.98rem;
    font-weight: 700;
    line-height: 1.2;
}

.brand-subtitle {
    margin: 3px 0 0;
    color: rgba(247, 242, 233, 0.68);
    font-size: 0.72rem;
    line-height: 1.35;
}

.brand-copy,
.nav-text,
.sidebar-card {
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.brand-copy {
    min-width: 0;
}

.brand-copy .ghost-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto;
    min-width: 120px;
    max-width: 150px;
    margin-top: 8px;
    min-height: 38px;
    border-radius: 999px;
    padding: 0 18px;
    font-size: 0.95rem;
    text-align: center;
}

.nav-list {
    display: grid;
    gap: 8px;
    margin-top: 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0;
    padding: 11px 14px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    color: rgba(247, 242, 233, 0.88);
    background: rgba(255, 255, 255, 0.02);
    transition: all 0.25s ease;
}

.topbar-user {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    min-width: 140px;
    padding: 10px 14px;
    border-radius: 18px;
    border: 1px solid var(--line);
    background: rgba(255, 250, 242, 0.72);
}

.topbar-user strong {
    font-size: 0.95rem;
}

.topbar-user span {
    color: var(--muted);
    font-size: 0.82rem;
}

.checkbox-inline {
    display: flex;
    align-items: center;
    gap: 10px;
}

.account-list {
    display: grid;
    gap: 16px;
}

.account-card {
    display: grid;
    gap: 18px;
    padding: 22px;
    border: 1px solid rgba(67, 61, 47, 0.1);
    border-radius: 24px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(255, 250, 242, 0.9));
    box-shadow: 0 12px 28px rgba(74, 56, 24, 0.06);
}

.account-card-head {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
}

.account-card-identity {
    display: grid;
    gap: 8px;
}

.account-card-identity strong {
    font-size: 1.15rem;
}

.account-card-role {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(15, 118, 110, 0.1);
    color: var(--accent);
    font-size: 0.82rem;
    font-weight: 700;
}

.account-card-body {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px 18px;
}

.account-card-body label {
    display: grid;
    gap: 8px;
}

.account-card-body span {
    font-weight: 600;
}

.account-card-body input {
    width: 100%;
    min-height: 48px;
    border: 1px solid rgba(67, 61, 47, 0.12);
    border-radius: 14px;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.82);
    font: inherit;
    color: var(--text);
}

.account-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding-top: 2px;
    border-top: 1px dashed rgba(67, 61, 47, 0.12);
}

.account-card-head span,
.account-card-meta {
    color: var(--muted);
}

.account-card-flags {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.account-card-submit {
    justify-content: center;
    min-height: 50px;
    font-weight: 700;
}

.auth-body {
    position: relative;
    display: grid;
    place-items: center;
    padding: 32px 24px;
    overflow: hidden;
}

.auth-body::before,
.auth-body::after {
    content: "";
    position: fixed;
    inset: auto;
    border-radius: 999px;
    pointer-events: none;
    filter: blur(10px);
}

.auth-body::before {
    top: 8%;
    left: -120px;
    width: 320px;
    height: 320px;
    background: radial-gradient(circle, rgba(15, 118, 110, 0.18) 0%, rgba(15, 118, 110, 0) 72%);
}

.auth-body::after {
    right: -90px;
    bottom: 6%;
    width: 280px;
    height: 280px;
    background: radial-gradient(circle, rgba(198, 132, 41, 0.18) 0%, rgba(198, 132, 41, 0) 72%);
}

.auth-shell {
    position: relative;
    z-index: 1;
    width: min(100%, 560px);
}

.auth-card {
    display: grid;
    gap: 22px;
    padding: 34px;
    border: 1px solid rgba(255, 255, 255, 0.68);
    border-radius: 32px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(255, 250, 242, 0.95)),
        rgba(255, 250, 242, 0.92);
    box-shadow:
        0 28px 60px rgba(74, 56, 24, 0.14),
        inset 0 1px 0 rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(18px);
}

.auth-card::before {
    content: "";
    display: block;
    width: 72px;
    height: 5px;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--gold), rgba(15, 118, 110, 0.72));
}

.auth-card-copy {
    display: grid;
    gap: 10px;
}

.auth-card-copy h1,
.auth-card-copy p {
    margin: 0;
}

.auth-card-copy h1 {
    font-size: clamp(1.9rem, 4vw, 2.4rem);
    line-height: 1.15;
    letter-spacing: -0.03em;
}

.auth-card-copy p {
    max-width: 28rem;
    color: var(--muted);
    line-height: 1.8;
}

.auth-form {
    display: grid;
    gap: 16px;
}

.auth-form label {
    display: grid;
    gap: 8px;
}

.auth-form label span {
    font-size: 0.95rem;
    font-weight: 700;
    color: #2f2a21;
}

.auth-form input {
    width: 100%;
    height: 52px;
    padding: 0 16px;
    border: 1px solid rgba(67, 61, 47, 0.12);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.84);
    box-shadow: inset 0 1px 2px rgba(35, 31, 24, 0.04);
    font: inherit;
    color: var(--text);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease, background 0.2s ease;
}

.auth-form input::placeholder {
    color: #9a907f;
}

.auth-form input:hover {
    background: rgba(255, 255, 255, 0.96);
}

.auth-form input:focus {
    outline: none;
    border-color: rgba(15, 118, 110, 0.45);
    background: #fff;
    box-shadow:
        0 0 0 4px rgba(15, 118, 110, 0.12),
        0 10px 24px rgba(15, 118, 110, 0.08);
    transform: translateY(-1px);
}

.auth-submit {
    width: 100%;
    min-height: 56px;
    margin-top: 4px;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    box-shadow: 0 18px 30px rgba(15, 118, 110, 0.22);
    transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.auth-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 22px 34px rgba(15, 118, 110, 0.26);
    filter: saturate(1.05);
}

.auth-submit:active {
    transform: translateY(0);
}

.auth-hint {
    padding: 18px 20px;
    border: 1px solid rgba(15, 118, 110, 0.1);
    border-radius: 22px;
    background:
        linear-gradient(135deg, rgba(215, 243, 238, 0.92), rgba(239, 250, 247, 0.88));
}

.auth-hint strong,
.auth-hint p {
    margin: 0;
}

.auth-hint strong {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 1rem;
}

.auth-hint strong::before {
    content: "";
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--gold), var(--accent));
    box-shadow: 0 0 0 6px rgba(15, 118, 110, 0.08);
}

.auth-hint p {
    color: #26433f;
    line-height: 1.7;
}

.auth-hint p + p {
    margin-top: 6px;
}

.nav-text {
    white-space: nowrap;
    font-size: 1.02rem;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.nav-item:hover,
.nav-item.is-active {
    color: #fffaf2;
    border-color: rgba(143, 229, 215, 0.24);
    background: linear-gradient(135deg, rgba(15, 118, 110, 0.36), rgba(198, 132, 41, 0.22));
    box-shadow: 0 10px 22px rgba(15, 118, 110, 0.14);
}

.nav-icon {
    display: none;
}

.sidebar-card {
    margin-top: 18px;
    padding: 14px;
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02));
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.erp-shell.is-sidebar-collapsed .erp-sidebar {
    width: var(--sidebar-width-collapsed);
    padding: 18px 8px;
}

.erp-shell.is-sidebar-collapsed .sidebar-toggle-row {
    justify-content: center;
}

.topbar-menu-toggle {
    display: none;
}

.erp-shell.is-sidebar-collapsed .brand-block {
    justify-content: center;
}

.erp-shell.is-sidebar-collapsed .brand-copy,
.erp-shell.is-sidebar-collapsed .nav-text,
.erp-shell.is-sidebar-collapsed .sidebar-card {
    opacity: 0;
    transform: translateX(-8px);
    pointer-events: none;
}

.erp-shell.is-sidebar-collapsed .nav-item {
    justify-content: center;
    padding-left: 10px;
    padding-right: 10px;
}

.erp-shell.is-sidebar-collapsed .nav-icon {
    width: 34px;
    height: 34px;
}

.sidebar-card-label,
.eyebrow {
    margin: 0 0 8px;
    color: var(--gold);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.sidebar-card h3,
.panel h3,
.feature-card h3,
.topbar h1,
.hero-panel h2,
.module-hero h2 {
    margin: 0;
}

.sidebar-card p,
.page-subtitle,
.hero-summary,
.feature-card p,
.panel-head span,
.stack-item p,
.timeline-item p,
.todo-item p,
.mini-stat span,
.kpi-card p {
    margin: 0;
    color: var(--muted);
}

.erp-main {
    min-width: 0;
    width: 100%;
    min-height: 100vh;
    padding: 18px 16px;
    overflow-x: hidden;
}

.topbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 18px;
}

.topbar-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 12px;
}

.primary-btn,
.ghost-btn {
    border: 0;
    cursor: pointer;
    border-radius: 999px;
    padding: 12px 18px;
    font: inherit;
}

.primary-btn {
    color: #fff;
    background: linear-gradient(135deg, #0f766e, #14532d);
    box-shadow: 0 12px 24px rgba(15, 118, 110, 0.18);
}

.ghost-btn {
    color: var(--text);
    background: rgba(255, 255, 255, 0.56);
    border: 1px solid var(--line);
}

.page-content {
    display: grid;
    gap: 16px;
    min-width: 0;
}

.hero-panel,
.module-hero,
.panel,
.kpi-card {
    border: 1px solid var(--line);
    border-radius: 20px;
    background: var(--surface);
    box-shadow: var(--shadow);
    backdrop-filter: blur(16px);
    min-width: 0;
}

.hero-panel,
.module-hero {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 16px;
    padding: 20px;
}

.chip-row,
.feature-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 20px;
}

.chip,
.pill {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 8px 12px;
    background: var(--accent-soft);
    color: #0f5f57;
    font-size: 0.86rem;
}

.hero-metrics {
    display: grid;
    gap: 14px;
}

.mini-stat,
.feature-card,
.todo-item {
    padding: 14px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.62);
    border: 1px solid rgba(255, 255, 255, 0.6);
}

.mini-stat strong,
.kpi-card strong,
.todo-item strong {
    display: block;
    margin: 8px 0 6px;
    font-size: 1.65rem;
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.kpi-card {
    padding: 18px;
}

.trend {
    display: inline-flex;
    margin-top: 12px;
    font-size: 0.88rem;
    font-weight: 600;
}

.trend-positive {
    color: var(--accent);
}

.trend-warning {
    color: var(--warning);
}

.trend-neutral {
    color: #4b5563;
}

.content-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.85fr);
    gap: 14px;
}

.content-grid-wide {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.panel {
    padding: 18px;
}

.panel-collapsible {
    padding: 0;
    overflow: hidden;
}

.panel-collapsible-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px;
    cursor: pointer;
    list-style: none;
}

.panel-collapsible-summary::-webkit-details-marker {
    display: none;
}

.panel-collapsible-summary h3 {
    margin: 0 0 4px;
}

.panel-collapsible-indicator {
    color: var(--accent);
    font-weight: 700;
    white-space: nowrap;
}

.panel-collapsible[open] .panel-collapsible-indicator::after {
    content: "收起";
}

.panel-collapsible:not([open]) .panel-collapsible-indicator::after {
    content: "";
}

.panel-collapsible[open] > .panel-collapsible-summary .panel-collapsible-indicator {
    color: var(--muted);
}

.panel-collapsible-body {
    padding: 0 18px 18px;
}

.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 14px;
}

.todo-grid,
.stack-list,
.timeline {
    display: grid;
    gap: 12px;
}

.stack-item,
.timeline-item {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    padding: 14px 0;
    border-bottom: 1px solid var(--line);
}

.stack-item:last-child,
.timeline-item:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.timeline-item span {
    min-width: 52px;
    font-weight: 700;
    color: var(--accent);
}

.table-wrap {
    width: 100%;
    min-width: 0;
    overflow-x: auto;
    overflow-y: hidden;
    max-width: 100%;
}

.resale-log-wrap {
    max-height: 520px;
    overflow-y: auto;
    overflow-x: auto;
}

.table-load-more[hidden] {
    display: none;
}

.table-load-more {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 16px;
    padding: 14px 16px;
    border: 1px dashed rgba(15, 118, 110, 0.24);
    border-radius: 16px;
    background: rgba(15, 118, 110, 0.05);
}

.table-load-more-copy {
    color: var(--muted);
    font-size: 0.92rem;
}

.table-actions {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    margin-bottom: 12px;
}

.table-check-all {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: var(--muted);
}

.checkbox-col {
    width: 52px;
    min-width: 52px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.data-table th,
.data-table td {
    padding: 12px 8px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: top;
}

.data-table th {
    position: relative;
    color: var(--muted);
    font-size: 0.86rem;
    font-weight: 700;
}

.data-table th:first-child,
.data-table td:first-child {
    width: 56px;
    min-width: 56px;
    max-width: 56px;
}

.product-row-focus td {
    background: rgba(215, 243, 238, 0.88);
    transition: background 0.25s ease;
}

.module-inventory {
    background: linear-gradient(135deg, rgba(15, 118, 110, 0.12), rgba(255, 255, 255, 0.6));
}

.module-orders {
    background: linear-gradient(135deg, rgba(14, 116, 144, 0.12), rgba(255, 255, 255, 0.6));
}

.module-purchase {
    background: linear-gradient(135deg, rgba(198, 132, 41, 0.14), rgba(255, 255, 255, 0.6));
}

.module-finance {
    background: linear-gradient(135deg, rgba(22, 101, 52, 0.12), rgba(255, 255, 255, 0.6));
}

.module-customers {
    background: linear-gradient(135deg, rgba(190, 24, 93, 0.1), rgba(255, 255, 255, 0.6));
}

.module-emag {
    background: linear-gradient(135deg, rgba(29, 78, 216, 0.13), rgba(255, 255, 255, 0.64));
}

.notice {
    padding: 16px 18px;
    border-radius: 18px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.72);
}

.notice strong {
    display: block;
    margin-bottom: 6px;
}

.notice-success {
    border-color: rgba(15, 118, 110, 0.22);
    background: rgba(215, 243, 238, 0.8);
}

.notice-error {
    border-color: rgba(217, 119, 6, 0.22);
    background: rgba(255, 244, 229, 0.88);
}

.sync-form {
    display: grid;
    gap: 14px;
}

.sync-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 16px;
}

.sync-grid-span-2 {
    grid-column: 1 / -1;
}

.sync-form label {
    display: grid;
    gap: 8px;
}

.sync-form span {
    font-weight: 600;
}

.sync-form input {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.78);
    font: inherit;
}

.sync-form select {
    width: 100%;
    min-height: 48px;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 0 42px 0 14px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(250, 247, 240, 0.92));
    font: inherit;
    color: var(--text);
    appearance: none;
    -webkit-appearance: none;
    background-image:
        linear-gradient(45deg, transparent 50%, rgba(67, 61, 47, 0.8) 50%),
        linear-gradient(135deg, rgba(67, 61, 47, 0.8) 50%, transparent 50%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(250, 247, 240, 0.92));
    background-position:
        calc(100% - 20px) calc(50% - 3px),
        calc(100% - 14px) calc(50% - 3px),
        0 0;
    background-size:
        6px 6px,
        6px 6px,
        100% 100%;
    background-repeat: no-repeat;
    box-shadow: inset 0 1px 2px rgba(35, 31, 24, 0.04);
}

.sync-form input:focus,
.sync-form textarea:focus,
.sync-form select:focus {
    outline: none;
    border-color: rgba(15, 118, 110, 0.45);
    box-shadow:
        0 0 0 4px rgba(15, 118, 110, 0.10),
        0 10px 24px rgba(15, 118, 110, 0.08);
    background-color: #fff;
}

.sync-form textarea {
    width: 100%;
    min-height: 110px;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.78);
    font: inherit;
    line-height: 1.6;
    resize: vertical;
}

.sync-form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-start;
}

.api-debug-meta p {
    margin: 0 0 10px;
    color: var(--muted);
    word-break: break-all;
}

.api-debug-block {
    display: grid;
    gap: 8px;
    margin-top: 10px;
}

.api-debug-block textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(23, 19, 14, 0.92);
    color: #f7f2e9;
    padding: 10px 12px;
    font: 13px/1.5 "Consolas", "Courier New", monospace;
    resize: vertical;
}

.api-debug-hint {
    margin: 6px 0;
    color: var(--muted);
    font-size: 0.92rem;
}

.api-char-group-list {
    display: grid;
    gap: 14px;
    margin-top: 10px;
}

.api-char-group {
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.62);
    padding: 12px 14px;
}

.api-char-group h4 {
    margin: 0 0 6px;
    font-size: 1rem;
}

.api-char-group-subtitle {
    margin-bottom: 10px;
    color: var(--muted);
    font-size: 0.9rem;
}

.api-char-items {
    display: grid;
    gap: 8px;
}

.api-char-item {
    border: 1px solid rgba(67, 61, 47, 0.18);
    border-radius: 10px;
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.8);
}

.api-char-value {
    font-weight: 600;
    margin-bottom: 4px;
}

.api-char-value-muted {
    color: var(--muted);
    font-weight: 500;
}

.api-char-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 6px 0;
}

.api-char-pill {
    display: inline-flex;
    align-items: center;
    border: 1px solid rgba(67, 61, 47, 0.16);
    border-radius: 999px;
    padding: 2px 8px;
    font-size: 0.8rem;
    color: #3e372d;
    background: rgba(255, 255, 255, 0.9);
}

.api-char-values {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 6px 0 2px;
}

.api-char-value-chip {
    display: inline-flex;
    align-items: center;
    border: 1px solid rgba(15, 118, 110, 0.24);
    border-radius: 999px;
    padding: 2px 8px;
    font-size: 0.8rem;
    color: #0d5f58;
    background: rgba(215, 243, 238, 0.64);
}

.api-char-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    color: var(--muted);
    font-size: 0.84rem;
    word-break: break-all;
}

.product-search-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

.product-search-form {
    gap: 16px;
}

.product-search-form > label:first-of-type {
    grid-column: 1 / -1;
}

.product-search-form > label:not(:first-of-type) {
    max-width: 340px;
}

.sync-form button[disabled] {
    opacity: 0.6;
    cursor: not-allowed;
}

.secondary-action-form {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed var(--line);
}

.form-tip {
    margin: 0;
    color: var(--muted);
    line-height: 1.6;
}

.product-cell {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    min-width: 260px;
}

.product-cell img {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid var(--line);
}

.product-cell strong {
    display: block;
}

.product-cell p {
    margin: 4px 0 0;
}

.product-image-cell {
    display: grid;
    place-items: center;
    width: 52px;
    min-width: 52px;
}

.product-image-trigger {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: zoom-in;
}

.product-image-cell img {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid var(--line);
}

.product-image-placeholder {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    padding: 4px;
    border-radius: 12px;
    border: 1px dashed var(--line);
    color: var(--muted);
    font-size: 0.68rem;
    text-align: center;
    line-height: 1.2;
    background: rgba(255, 255, 255, 0.45);
}

.product-name-column {
    width: 200px;
    min-width: 200px;
    max-width: 200px;
    white-space: normal;
}

.short-name-column {
    width: 240px;
    min-width: 240px;
    max-width: 240px;
    white-space: normal;
}

.column-resize-handle {
    position: absolute;
    top: 0;
    right: -5px;
    width: 10px;
    height: 100%;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: col-resize;
    z-index: 2;
}

.column-resize-handle::before {
    content: '';
    position: absolute;
    top: 10px;
    bottom: 10px;
    left: 4px;
    width: 2px;
    border-radius: 999px;
    background: transparent;
    transition: background 0.2s ease;
}

.data-table th:hover .column-resize-handle::before,
.column-resize-handle:hover::before,
.is-resizing-columns .column-resize-handle::before {
    background: rgba(15, 118, 110, 0.28);
}

body.is-resizing-columns {
    cursor: col-resize;
    user-select: none;
}

.short-name-details .product-name-summary {
    line-height: 1.5;
}

.product-link-column {
    width: 160px;
    min-width: 160px;
    max-width: 160px;
    white-space: normal;
}

.hs-code-column {
    width: 110px;
    min-width: 110px;
    max-width: 110px;
}

.hs-code-column a {
    color: var(--accent);
    font-weight: 600;
}

.product-link-column a {
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--accent);
}

.product-link-empty {
    color: var(--muted);
}

.table-action-column {
    width: 198px;
    min-width: 198px;
}

.print-qty-column {
    width: 92px;
    min-width: 92px;
}

.print-qty-input {
    width: 76px;
    height: 32px;
    padding: 0 8px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--ink);
}

.table-action-group {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.table-action-form {
    margin: 0;
}

.table-action-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 68px;
    height: 32px;
    padding: 0 12px;
    border-radius: 999px;
    border: 0;
    background: rgba(15, 118, 110, 0.1);
    color: var(--accent);
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    margin: 0;
    white-space: nowrap;
}

.table-action-link-secondary {
    background: rgba(29, 78, 216, 0.08);
    color: #1d4ed8;
}

.table-action-link-monitor {
    background: rgba(180, 83, 9, 0.10);
    color: #b45309;
}

.table-action-link-muted {
    background: rgba(100, 116, 139, 0.12);
    color: #64748b;
    cursor: not-allowed;
}

.table-action-link-danger {
    background: rgba(185, 28, 28, 0.10);
    color: #b91c1c;
}

.monitor-self-tag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 48px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}

.monitor-self-tag.is-self {
    background: rgba(15, 118, 110, 0.12);
    color: #0f766e;
}

.monitor-self-tag.is-other {
    background: rgba(217, 119, 6, 0.12);
    color: #d97706;
}

.monitor-warning-tag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 88px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    background: rgba(185, 28, 28, 0.10);
    color: #b91c1c;
}

.monitor-warning-tag.is-clear {
    background: rgba(15, 118, 110, 0.10);
    color: #0f766e;
}

.monitor-table {
    table-layout: auto;
}

.monitor-table th,
.monitor-table td {
    white-space: nowrap;
}

.monitor-table thead th {
    position: sticky;
    top: 0;
    z-index: 6;
    background: rgba(255, 250, 242, 0.96);
    box-shadow: inset 0 -1px 0 rgba(67, 61, 47, 0.12);
}

.monitor-self-column {
    min-width: 110px;
}

.monitor-action-sticky {
    position: sticky;
    right: 0;
    z-index: 7;
    background: rgba(255, 250, 242, 0.98);
    box-shadow: -10px 0 18px rgba(74, 56, 24, 0.08);
}

.monitor-table tbody .monitor-action-sticky {
    z-index: 5;
}

.monitor-table thead .monitor-action-sticky {
    z-index: 8;
}

.monitor-expand-cell {
    max-width: 180px;
    white-space: normal;
}

.monitor-inline-text {
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: top;
}

.monitor-expand-text {
    min-width: 0;
}

.monitor-expand-text summary {
    display: block;
    cursor: pointer;
    list-style: none;
}

.monitor-expand-text summary::-webkit-details-marker {
    display: none;
}

.monitor-expand-text:not([open]) .monitor-inline-text::after {
    content: " 点击展开";
    color: var(--accent);
    font-weight: 600;
}

.monitor-expand-panel {
    margin-top: 6px;
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.88);
    border: 1px solid rgba(67, 61, 47, 0.12);
    white-space: normal;
    line-height: 1.6;
    word-break: break-word;
}

.monitor-row-warning td {
    background: rgba(254, 242, 242, 0.9);
}

.monitor-row-other-store td {
    background: rgba(255, 247, 237, 0.9);
}

.monitor-row-warning.monitor-row-other-store td {
    background: linear-gradient(90deg, rgba(254, 242, 242, 0.96), rgba(255, 247, 237, 0.96));
}

.monitor-row-protected td {
    background: rgba(254, 226, 226, 0.94);
}

.monitor-price-protect-flag {
    display: inline-block;
    margin-left: 6px;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    color: #b91c1c;
    background: rgba(254, 202, 202, 0.9);
}

.image-preview-modal[hidden] {
    display: none;
}

.loading-progress-modal[hidden] {
    display: none;
}

.action-dialog-modal[hidden] {
    display: none;
}

.action-dialog-modal {
    position: fixed;
    inset: 0;
    z-index: 95;
}

.action-dialog-backdrop {
    position: absolute;
    inset: 0;
    border: 0;
    background:
        radial-gradient(circle at top, rgba(15, 118, 110, 0.14), transparent 48%),
        rgba(17, 24, 39, 0.46);
    backdrop-filter: blur(8px);
}

.action-dialog-panel {
    position: relative;
    z-index: 1;
    width: min(92vw, 460px);
    margin: 18vh auto 0;
    border-radius: 24px;
    background: rgba(255, 252, 247, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.72);
    box-shadow: 0 24px 80px rgba(17, 24, 39, 0.24);
    overflow: hidden;
}

.action-dialog-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 20px 14px;
    border-bottom: 1px solid var(--line);
}

.action-dialog-close {
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 999px;
    background: rgba(15, 118, 110, 0.08);
    color: var(--text);
    font-size: 1.3rem;
    line-height: 1;
    cursor: pointer;
}

.action-dialog-body {
    padding: 18px 20px 10px;
}

.action-dialog-body p {
    margin: 0;
    color: var(--muted);
    line-height: 1.8;
}

.action-dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 14px 20px 20px;
}

body.is-dialog-open {
    overflow: hidden;
}

.loading-progress-modal {
    position: fixed;
    inset: 0;
    z-index: 90;
}

.loading-progress-backdrop {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at top, rgba(15, 118, 110, 0.16), transparent 48%),
        rgba(17, 24, 39, 0.46);
    backdrop-filter: blur(8px);
}

.loading-progress-panel {
    position: relative;
    z-index: 1;
    width: min(92vw, 420px);
    margin: 18vh auto 0;
    padding: 28px 24px 24px;
    border-radius: 24px;
    background: rgba(255, 252, 247, 0.96);
    box-shadow: 0 28px 80px rgba(17, 24, 39, 0.25);
    border: 1px solid rgba(15, 118, 110, 0.14);
    text-align: center;
}

.loading-progress-orb {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    border-radius: 999px;
    background:
        radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.1) 34%),
        linear-gradient(135deg, rgba(15, 118, 110, 0.92), rgba(29, 78, 216, 0.7));
    box-shadow:
        inset 0 4px 18px rgba(255, 255, 255, 0.45),
        0 10px 24px rgba(15, 118, 110, 0.28);
    animation: loading-orb-float 1.5s ease-in-out infinite;
}

.loading-progress-panel strong {
    display: block;
    font-size: 1.08rem;
}

.loading-progress-panel p {
    margin: 10px 0 0;
    color: var(--muted);
    line-height: 1.7;
}

.loading-progress-bar {
    height: 10px;
    margin-top: 18px;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(15, 118, 110, 0.1);
}

.loading-progress-bar span {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #0f766e, #14b8a6 48%, #38bdf8);
    box-shadow: 0 0 18px rgba(20, 184, 166, 0.35);
    transition: width 0.22s ease;
    animation: loading-progress-sweep 1.6s ease-in-out infinite;
}

.loading-progress-bar span.is-complete {
    animation: none;
}

@keyframes loading-orb-float {
    0%, 100% {
        transform: translateY(0) scale(1);
    }

    50% {
        transform: translateY(-6px) scale(1.04);
    }
}

@keyframes loading-progress-sweep {
    0% {
        width: 12%;
    }

    50% {
        width: 78%;
    }

    100% {
        width: 24%;
    }
}

.image-preview-modal {
    position: fixed;
    inset: 0;
    z-index: 60;
}

.image-preview-backdrop {
    position: absolute;
    inset: 0;
    border: 0;
    background: rgba(17, 24, 39, 0.7);
    cursor: zoom-out;
}

.image-preview-dialog {
    position: relative;
    z-index: 1;
    width: min(92vw, 920px);
    margin: 4vh auto;
    border-radius: 20px;
    background: rgba(255, 252, 247, 0.98);
    box-shadow: 0 24px 80px rgba(17, 24, 39, 0.28);
    overflow: hidden;
}

.image-preview-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--line);
}

.image-preview-close {
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 999px;
    background: rgba(15, 118, 110, 0.08);
    color: var(--text);
    font-size: 1.3rem;
    line-height: 1;
    cursor: pointer;
}

.image-preview-body {
    display: grid;
    place-items: center;
    padding: 18px;
    max-height: 82vh;
    overflow: auto;
    background:
        linear-gradient(135deg, rgba(15, 118, 110, 0.05), rgba(255, 255, 255, 0.9)),
        repeating-linear-gradient(
            45deg,
            rgba(107, 98, 86, 0.04) 0,
            rgba(107, 98, 86, 0.04) 12px,
            rgba(255, 255, 255, 0.16) 12px,
            rgba(255, 255, 255, 0.16) 24px
        );
}

.image-preview-body img {
    display: block;
    max-width: 100%;
    max-height: 72vh;
    border-radius: 16px;
    background: #fff;
    object-fit: contain;
}

.product-name-details {
    min-width: 0;
}

.product-name-details summary {
    display: block;
    cursor: pointer;
    list-style: none;
}

.product-name-details summary::-webkit-details-marker {
    display: none;
}

.product-name-summary {
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 700;
    color: var(--text);
    vertical-align: top;
}

.product-name-details:not([open]) .product-name-summary::after {
    content: " 点击展开";
    color: var(--accent);
    font-weight: 600;
}

.product-name-expanded {
    margin-top: 8px;
    white-space: normal;
    line-height: 1.6;
}

.product-name-expanded strong {
    display: block;
    margin-bottom: 4px;
}

.product-name-expanded p {
    margin: 0;
}

.product-edit-form {
    display: grid;
    gap: 18px;
}

.product-edit-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px 18px;
}

.product-edit-grid label {
    display: grid;
    gap: 8px;
}

.product-edit-grid span {
    font-weight: 600;
}

.column-picker-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px 18px;
}

.column-picker-grid label,
.upload-field {
    display: grid;
    gap: 8px;
}

.column-picker-grid label {
    grid-template-columns: 18px 1fr;
    align-items: center;
    font-weight: 600;
}

.product-edit-grid input,
.product-edit-grid textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.82);
    font: inherit;
    color: var(--text);
}

.product-edit-grid textarea {
    min-height: 140px;
    resize: vertical;
}

.upload-field input[type="file"] {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.82);
    font: inherit;
    color: var(--text);
}

.product-edit-grid input[readonly] {
    background: rgba(148, 163, 184, 0.12);
    color: var(--muted);
}

.product-edit-span-2 {
    grid-column: span 2;
}

.product-edit-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.edit-product-modal[hidden] {
    display: none;
}

.edit-product-modal {
    position: fixed;
    inset: 0;
    z-index: 70;
}

.edit-product-dialog {
    position: relative;
    z-index: 1;
    width: min(92vw, 760px);
    margin: 7vh auto;
    max-height: 86vh;
    border-radius: 20px;
    background: rgba(255, 252, 247, 0.98);
    box-shadow: 0 24px 80px rgba(17, 24, 39, 0.28);
    overflow: auto;
    padding: 0 18px 18px;
}

.product-detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 18px;
    padding-top: 12px;
}

.product-detail-grid div {
    display: grid;
    gap: 8px;
}

.product-detail-grid span {
    font-weight: 600;
    color: var(--muted);
}

.product-detail-grid strong {
    font-weight: 700;
    color: var(--text);
    white-space: normal;
    line-height: 1.6;
    word-break: break-word;
}

.product-detail-grid a {
    color: var(--accent);
}

.back-to-top-btn {
    position: fixed;
    right: 26px;
    bottom: 28px;
    z-index: 45;
    width: 48px;
    height: 48px;
    border: 0;
    border-radius: 999px;
    background: linear-gradient(135deg, #1f8a70, #17594c);
    color: #fff;
    font-size: 24px;
    line-height: 1;
    box-shadow: 0 18px 32px rgba(23, 89, 76, 0.28);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.back-to-top-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 22px 38px rgba(23, 89, 76, 0.34);
}

.back-to-top-btn:active {
    transform: translateY(0);
}

.back-to-top-btn[hidden] {
    display: none;
}

@media (max-width: 1180px) {
    .kpi-grid,
    .content-grid,
    .content-grid-wide,
    .hero-panel,
    .module-hero {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 920px) {
    .erp-shell {
        padding-left: 0;
    }

    .edit-product-dialog {
        max-height: 90vh;
        margin: 4vh auto;
    }

    .product-edit-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .column-picker-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .product-detail-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .product-edit-span-2 {
        grid-column: auto;
    }

    .erp-sidebar {
        position: fixed;
        left: 0;
        top: 0;
        z-index: 20;
        width: 220px;
        transform: translateX(-100%);
        transition: transform 0.25s ease;
    }

    .topbar-menu-toggle {
        display: inline-flex;
    }

    .erp-shell.is-sidebar-collapsed {
        padding-left: 0;
    }

    .erp-shell.is-sidebar-collapsed .erp-sidebar {
        padding: 28px 22px;
    }

    .erp-shell.is-sidebar-collapsed .brand-block {
        justify-content: flex-start;
    }

    .erp-shell.is-sidebar-collapsed .brand-copy,
    .erp-shell.is-sidebar-collapsed .nav-text,
    .erp-shell.is-sidebar-collapsed .sidebar-card {
        opacity: 1;
        transform: none;
        pointer-events: auto;
    }

    .erp-shell.is-sidebar-collapsed .nav-item {
        justify-content: flex-start;
        padding-left: 14px;
        padding-right: 14px;
    }

    .erp-sidebar.is-open {
        transform: translateX(0);
    }

    .erp-main {
        padding: 20px;
    }

    .topbar {
        flex-direction: column;
    }

    .account-card-body {
        grid-template-columns: minmax(0, 1fr);
    }

    .account-card-footer {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 640px) {
    .auth-body {
        padding: 18px;
    }

    .auth-card {
        gap: 18px;
        padding: 24px 18px;
        border-radius: 24px;
    }

    .auth-form input,
    .auth-submit {
        min-height: 50px;
        height: 50px;
    }

    .auth-hint {
        padding: 16px;
        border-radius: 18px;
    }

    .account-card {
        padding: 18px;
        border-radius: 20px;
    }

    .account-card-head {
        flex-direction: column;
    }

    .back-to-top-btn {
        right: 18px;
        bottom: 18px;
        width: 44px;
        height: 44px;
        font-size: 22px;
    }

    .erp-main {
        padding: 16px;
    }

    .hero-panel,
    .module-hero,
    .panel,
    .kpi-card {
        padding: 18px;
        border-radius: 22px;
    }

    .topbar-actions {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }

    .topbar-user {
        min-width: 0;
    }

    .primary-btn,
    .ghost-btn {
        width: 100%;
        flex: none;
        text-align: center;
    }
}
