* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    background: #f6f8fb;
    font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
    color: #1b1b1f;
}
a { color: #2361cc; text-decoration: none; }
.page { max-width: 860px; margin: 0 auto; padding: 18px; }
.page.wide { max-width: 1120px; }
.card {
    background: #fff;
    border-radius: 18px;
    padding: 18px;
    margin-bottom: 16px;
    border: 1px solid #e4e8ef;
    box-shadow: 0 1px 2px rgba(20, 30, 55, 0.04);
}
.login-card { margin-top: 60px; }
h1 { font-size: 26px; margin: 0 0 8px; }
h2 { font-size: 20px; margin: 0 0 12px; }
.muted { color: #777; margin-top: 0; }
.small { font-size: 13px; }
label { display: block; margin: 16px 0 6px; font-weight: 600; }
input, select {
    width: 100%; height: 44px; border: 1px solid #ddd; border-radius: 12px;
    padding: 0 12px; font-size: 16px; background: #fff;
}
button {
    min-height: 46px; border: 0; border-radius: 999px; margin-top: 12px;
    font-size: 16px; font-weight: 700; background: #0b57d0; color: white; cursor: pointer;
    padding: 0 18px;
}
button.issue { background: #c23b3b; }
.error { background: #ffecec; color: #b00020; padding: 12px; border-radius: 12px; margin: 14px 0; }
.demo { background: #f2f2f2; border-radius: 12px; padding: 12px; margin-top: 18px; color: #555; }
.demo p { margin: 4px 0; }
.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.logout { color: #555; text-decoration: none; white-space: nowrap; }
.notice {
    background: #e8f1ff;
    color: #174b86;
    padding: 12px 14px;
    border-radius: 12px;
    margin-bottom: 14px;
    font-weight: 600;
}
.snackbar {
    border-radius: 16px;
    background: #1f2937;
    color: #fff;
}
.simple-rule {
    line-height: 1.6;
    color: #333;
}
.eyebrow {
    color: #5f6f89;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .02em;
}
.text-danger { color: #ba1a1a; }
.page-loading {
    position: fixed;
    left: 50%;
    top: 12px;
    z-index: 10000;
    transform: translateX(-50%);
    background: #1f2937;
    color: #fff;
    border-radius: 999px;
    padding: 9px 14px;
    font-size: 13px;
    box-shadow: 0 6px 18px rgba(20, 30, 55, 0.16);
}
.page-loading.loaded { display: none; }
.customer-summary {
    padding: 16px;
}
.customer-main {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
    margin-bottom: 14px;
}
.customer-main h2 {
    margin: 4px 0 2px;
    font-size: 24px;
}
.customer-main p { margin-bottom: 0; }
.summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}
.summary-cell {
    border-radius: 14px;
    background: #f6f8fb;
    padding: 10px;
    min-height: 68px;
}
.summary-cell span {
    display: block;
    color: #65748b;
    font-size: 12px;
    font-weight: 700;
}
.summary-cell b {
    display: block;
    margin-top: 6px;
    color: #1b1b1f;
    font-size: 16px;
    word-break: break-all;
}
.md-tabs {
    position: sticky;
    top: 0;
    z-index: 20;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    padding: 8px 0 10px;
    background: rgba(246,248,251,.96);
    backdrop-filter: blur(12px);
}
.md-tabs a {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 54px;
    border-radius: 16px;
    background: #fff;
    border: 1px solid #dbe3f0;
    color: #334155;
    font-size: 13px;
    font-weight: 800;
}
.md-tabs a b {
    margin-top: 3px;
    font-size: 12px;
    color: #64748b;
}
.md-tabs a.active {
    background: #d7e3ff;
    border-color: #abc7ff;
    color: #0b57d0;
}
.md-tabs a.active b { color: #0b57d0; }
.sort-bar {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin: 4px 0 12px;
}
.sort-bar a {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 0 12px;
    border-radius: 999px;
    background: #eef2f7;
    color: #475569;
    font-size: 13px;
    font-weight: 800;
}
.sort-bar a.active {
    background: #0b57d0;
    color: #fff;
}
.order-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
}
.order-card {
    display: grid;
    grid-template-columns: 150px minmax(0, 1fr);
    gap: 14px;
    background: #fff;
    border: 1px solid #e4e8ef;
    border-radius: 18px;
    padding: 12px;
    box-shadow: 0 1px 2px rgba(20, 30, 55, 0.04);
    scroll-margin-top: 96px;
}
.order-card.has-issue {
    border-color: #ffb4ab;
    background: #fffafa;
}
.order-img {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 150px;
    min-height: 150px;
    margin: 0;
    padding: 0;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid #e4e8ef;
    background: #f1f5f9;
    cursor: zoom-in;
}
.order-img img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}
.order-img.image-error::after {
    content: "图片加载失败";
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f1f5f9;
    color: #64748b;
    font-size: 13px;
    font-weight: 800;
}
.order-content {
    min-width: 0;
}
.order-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
}
.order-head h2 {
    margin: 0;
    font-size: 17px;
    line-height: 1.35;
    word-break: break-all;
}
.order-head p {
    margin: 5px 0 0;
    color: #64748b;
    font-size: 13px;
    word-break: break-all;
}
.progress-line {
    margin-top: 10px;
    border-radius: 12px;
    background: #eef6ff;
    color: #174b86;
    padding: 10px 12px;
    font-size: 13px;
    font-weight: 700;
}
.info-grid,
.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 12px;
}
.info-grid div,
.detail-grid div {
    min-width: 0;
}
.info-grid span,
.detail-grid span {
    display: block;
    color: #65748b;
    font-size: 12px;
    font-weight: 700;
}
.info-grid b,
.detail-grid b,
.detail-grid a {
    display: block;
    margin-top: 4px;
    color: #1b1b1f;
    font-size: 14px;
    word-break: break-all;
}
.detail-grid a { color: #0b57d0; font-weight: 800; }
.order-details {
    margin-top: 12px;
    border-top: 1px solid #edf1f7;
    padding-top: 10px;
}
.order-details summary {
    color: #0b57d0;
    cursor: pointer;
    font-weight: 800;
    min-height: 32px;
    line-height: 32px;
}
.order-actions {
    grid-template-columns: minmax(150px, .5fr) minmax(0, 1fr);
    align-items: end;
}
.order-actions .outlined-btn[disabled] {
    color: #94a3b8;
    border-color: #e2e8f0;
    cursor: not-allowed;
}
.order-actions .issue-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
}
.order-actions .danger-btn,
.order-actions .outlined-btn {
    width: 100%;
    margin: 0;
    min-height: 42px;
}
.copy-toast {
    position: fixed;
    left: 50%;
    bottom: max(18px, env(safe-area-inset-bottom));
    z-index: 10000;
    transform: translate(-50%, 18px);
    opacity: 0;
    pointer-events: none;
    background: #1f2937;
    color: #fff;
    border-radius: 999px;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 800;
    transition: opacity .18s ease, transform .18s ease;
}
.copy-toast.show {
    opacity: 1;
    transform: translate(-50%, 0);
}

/* 客户商品页：顶部工具栏 */
.shop-page { padding-top: 14px; }
.shop-topbar h1 { font-size: 24px; }
.sticky-tools {
    position: sticky;
    top: 0;
    z-index: 10;
    background: rgba(245,245,247,0.96);
    backdrop-filter: blur(12px);
    padding: 8px 0 12px;
    margin-bottom: 12px;
}
.toolbar-row {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-bottom: 10px;
}
.tool-btn {
    width: auto;
    min-height: 38px;
    margin-top: 0;
    padding: 0 14px;
    border-radius: 999px;
    background: #fff;
    color: #333;
    border: 1px solid #e1e1e1;
    box-shadow: 0 4px 12px rgba(0,0,0,0.04);
    font-size: 14px;
}
.filter-panel {
    display: none;
    background: #fff;
    border-radius: 16px;
    margin-top: 10px;
    padding: 14px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.06);
}
.filter-panel.open { display: block; }
.filter-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.filter-grid label { margin: 0; color: #555; font-size: 13px; }
.filter-grid select { margin-top: 6px; }
.apply-filter { width: 100%; background: #222; }
.empty-card { text-align: center; color: #666; }

/* 商品列表：默认双列小图模式 */
.products.grid-view {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}
.products.list-view {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}
.product-card {
    background: #fff;
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 6px 20px rgba(0,0,0,0.06);
    scroll-margin-top: 96px;
}
.product-card.has-issue {
    outline: 2px solid #ffd0d0;
}
.product-img {
    width: 100%;
    height: 210px;
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: zoom-in;
    outline: none;
}
.product-img:focus-visible {
    box-shadow: 0 0 0 3px rgba(35, 97, 204, 0.28) inset;
}
.product-img img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}
.zoom-hint {
    position: absolute;
    right: 8px;
    bottom: 8px;
    background: rgba(0,0,0,0.58);
    color: #fff;
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 999px;
    pointer-events: none;
}
body.modal-open {
    overflow: hidden;
}
.image-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
}
.image-modal.open {
    display: block;
}
.image-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.78);
}
.image-modal-body {
    position: absolute;
    inset: max(12px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom));
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.image-modal-title {
    max-width: calc(100vw - 84px);
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 10px;
    text-align: center;
    word-break: break-all;
}
.image-modal-body img {
    max-width: 100%;
    max-height: calc(100vh - 92px);
    object-fit: contain;
    border-radius: 14px;
    background: #fff;
}
.image-modal-close {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 42px;
    height: 42px;
    min-height: 42px;
    margin: 0;
    border-radius: 999px;
    background: rgba(255,255,255,0.92);
    color: #111;
    font-size: 28px;
    line-height: 1;
    padding: 0;
}

.issue-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background: #c23b3b;
    color: #fff;
    border-radius: 999px;
    padding: 5px 10px;
    font-size: 12px;
    font-weight: 800;
}
.product-main { padding: 12px; }
.product-title {
    font-size: 16px;
    font-weight: 800;
    line-height: 1.35;
    word-break: break-all;
    min-height: 42px;
}
.product-meta {
    margin-top: 6px;
    color: #777;
    font-size: 13px;
    word-break: break-all;
}
.product-link { margin-top: 8px; font-size: 14px; }
.actions {
    margin-top: 10px;
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}
.actions form { margin: 0; }
.actions button { width: 100%; margin-top: 0; min-height: 42px; font-size: 14px; }
.issue-form { display: grid; grid-template-columns: 1fr; gap: 8px; }
.issue-input {
    height: 40px;
    font-size: 14px;
    width: 100%;
}
.issue-note { background: #fff1f1; color: #9e2424; padding: 9px; border-radius: 10px; margin-top: 8px; font-size: 13px; }
.issue-note b,
.issue-note span,
.issue-note p {
    display: block;
}
.issue-note span {
    margin-top: 3px;
    color: #b94a48;
    font-size: 12px;
}
.issue-note p {
    margin: 6px 0 0;
    color: #7f1d1d;
    line-height: 1.55;
}

/* 宽版一行一个：接近淘宝列表样式 */
.products.list-view .product-card {
    display: grid;
    grid-template-columns: 150px 1fr;
    gap: 12px;
    padding: 12px;
    align-items: start;
}
.products.list-view .product-img {
    height: 150px;
    border-radius: 14px;
    overflow: hidden;
}
.products.list-view .product-main { padding: 0; }
.products.list-view .product-title {
    font-size: 18px;
    min-height: unset;
}
.products.list-view .actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}
.products.list-view .issue-form {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 8px;
    align-items: center;
}
.products.list-view .issue-input {
    height: 42px;
}

/* 后台表格 */
.table-wrap { width: 100%; overflow-x: auto; }
table { border-collapse: collapse; width: 100%; min-width: 760px; }
th, td { border-bottom: 1px solid #eee; padding: 10px; text-align: left; font-size: 14px; }
th { background: #f8fafc; color: #4b5563; font-weight: 700; }
.admin-upload label { margin-top: 12px; }
.header-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}
.admin-header,
.section-title-row {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
    margin-bottom: 16px;
}
.admin-header h1,
.section-title-row h2 { margin-bottom: 4px; }
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 16px;
}
.metric-card {
    min-height: 92px;
    border-radius: 18px;
    background: #fff;
    border: 1px solid #e4e8ef;
    padding: 14px;
    box-shadow: 0 1px 2px rgba(20, 30, 55, 0.04);
}
.metric-card span {
    display: block;
    color: #65748b;
    font-size: 12px;
    font-weight: 800;
}
.metric-card b {
    display: block;
    margin-top: 10px;
    font-size: 22px;
    color: #1b1b1f;
    word-break: break-all;
}
.metric-card.danger b { color: #ba1a1a; }
.admin-upload-card summary {
    cursor: pointer;
    color: #0b57d0;
    font-weight: 800;
}
.admin-filter {
    display: grid;
    grid-template-columns: 1.2fr 1fr 1fr .8fr .8fr auto;
    gap: 10px;
    align-items: end;
    margin-bottom: 14px;
}
.admin-filter.card {
    grid-template-columns: 1.4fr 1fr auto;
}
.admin-filter label {
    margin: 0;
    color: #65748b;
    font-size: 12px;
    font-weight: 800;
}
.admin-filter input,
.admin-filter select {
    margin-top: 6px;
    height: 40px;
    font-size: 14px;
}
.filter-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}
.filter-actions .filled-btn,
.filter-actions .outlined-link {
    min-height: 40px;
    margin: 0;
}
.admin-empty {
    margin-top: 14px;
    padding: 18px;
}
.filled-btn { background: #0b57d0; }
.outlined-btn,
.danger-btn,
.text-btn,
.outlined-link {
    min-height: 38px;
    border-radius: 999px;
    padding: 0 14px;
    margin-top: 0;
    font-size: 14px;
    font-weight: 700;
}
.outlined-btn {
    background: #fff;
    color: #0b57d0;
    border: 1px solid #9bb7e8;
}
.danger-btn {
    background: #ba1a1a;
    color: #fff;
}
.text-btn,
.outlined-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #0b57d0;
    background: transparent;
    border: 1px solid #c6d6f3;
    white-space: nowrap;
}
.small-btn {
    min-height: 32px;
    font-size: 12px;
    padding: 0 10px;
}
.row-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}
.row-actions form { margin: 0; }
.chip {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 0 10px;
    border-radius: 8px;
    background: #eef2f7;
    color: #334155;
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}
.chip-info {
    background: #e8f1ff;
    color: #174b86;
}
.chip-success {
    background: #e7f6ed;
    color: #146c3c;
}
.chip-error {
    background: #ffe8e8;
    color: #ba1a1a;
}
.admin-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.admin-tabs a {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 0 12px;
    border-radius: 999px;
    color: #334155;
    background: #eef2f7;
    font-size: 13px;
    font-weight: 700;
}
.admin-tabs a.active {
    background: #d7e3ff;
    color: #0b57d0;
}
.issue-admin-list {
    display: grid;
    gap: 14px;
}
.issue-admin-card {
    display: grid;
    grid-template-columns: 180px minmax(0, 1fr);
    gap: 16px;
    margin-bottom: 0;
}
.issue-thumb {
    display: block;
    width: 100%;
    height: 180px;
    border-radius: 14px;
    overflow: hidden;
    background: #f1f5f9;
    border: 1px solid #e4e8ef;
}
.issue-thumb img,
.item-photo-card img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}
.issue-admin-main {
    min-width: 0;
}
.admin-issue-note {
    margin: 10px 0 0;
}
.issue-row-actions {
    margin-top: 14px;
}
.item-detail-layout {
    display: grid;
    grid-template-columns: 380px minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}
.item-photo-card {
    height: 420px;
    padding: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8fafc;
}
.detail-grid-wide {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}
.detail-link {
    margin: 12px 0 0;
}
.detail-link a {
    font-weight: 800;
}
.detail-actions {
    margin-top: 16px;
}

@media (min-width: 900px) {
    .products.grid-view { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .product-img { height: 230px; }
    .order-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .order-card { grid-template-columns: 1fr; }
    .order-img { height: 230px; }
    .order-actions { grid-template-columns: 1fr; }
    .order-actions .issue-form { grid-template-columns: 1fr; }
}

@media (max-width: 700px) {
    .page { padding: 12px; }
    .login-card { margin-top: 24px; }
    .shop-topbar h1 { font-size: 22px; }
    .sticky-tools { padding-top: 6px; }
    .toolbar-row { justify-content: space-between; }
    .tool-btn { flex: 1; }
    .filter-grid { grid-template-columns: 1fr; }
    .admin-header,
    .section-title-row { display: block; }
    .header-actions { justify-content: flex-start; margin-top: 10px; }
    .admin-tabs { margin-top: 10px; }
    .dashboard-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .admin-filter,
    .admin-filter.card { grid-template-columns: 1fr; }
    .filter-actions { align-items: stretch; }
    .filter-actions .filled-btn,
    .filter-actions .outlined-link { flex: 1; }
    .issue-admin-card { grid-template-columns: 1fr; }
    .issue-thumb { height: 240px; }
    .item-detail-layout { grid-template-columns: 1fr; }
    .item-photo-card { height: 320px; }
    .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .customer-main h2 { font-size: 22px; }
    .md-tabs {
        gap: 6px;
        overflow-x: auto;
        grid-template-columns: repeat(4, minmax(92px, 1fr));
        padding-bottom: 8px;
    }
    .md-tabs a {
        min-height: 50px;
        border-radius: 14px;
        font-size: 12px;
    }
    .sort-bar { justify-content: stretch; }
    .sort-bar a {
        flex: 1;
        justify-content: center;
    }
    .order-card {
        grid-template-columns: 118px minmax(0, 1fr);
        gap: 10px;
        border-radius: 16px;
        padding: 10px;
    }
    .order-img {
        height: 118px;
        min-height: 118px;
        border-radius: 12px;
    }
    .order-head {
        display: block;
    }
    .order-head .chip {
        margin-top: 8px;
    }
    .order-head h2 { font-size: 16px; }
    .info-grid,
    .detail-grid,
    .order-actions,
    .order-actions .issue-form {
        grid-template-columns: 1fr;
    }
    .products.grid-view { gap: 10px; }
    .product-card { border-radius: 16px; }
    .product-img { height: 178px; }
    .product-main { padding: 10px; }
    .product-title { font-size: 15px; min-height: 40px; }
    .actions button { min-height: 40px; font-size: 13px; }

    .products.list-view .product-card {
        grid-template-columns: 130px 1fr;
        gap: 10px;
        padding: 10px;
    }
    .products.list-view .product-img { height: 130px; }
    .products.list-view .product-title { font-size: 16px; }
    .products.list-view .issue-form { grid-template-columns: 1fr; }
}

@media (max-width: 390px) {
    .page { padding: 10px; }
    .order-card { grid-template-columns: 1fr; }
    .order-img { height: 210px; }
    .product-img { height: 160px; }
    .products.list-view .product-card { grid-template-columns: 112px 1fr; }
    .products.list-view .product-img { height: 112px; }
}
