@import url("https://fonts.googleapis.com/css2?family=Lexend:wght@600;700;800&family=Noto+Sans+SC:wght@400;500;700;800&display=swap");

:root {
    --ux-font-heading: "Lexend", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
    --ux-font-body: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
    --ux-bg-start: #f2f6fb;
    --ux-bg-end: #eef4ff;
    --ux-surface: rgba(255, 255, 255, 0.94);
    --ux-border: #d7e3f2;
    --ux-text: #0f172a;
    --ux-muted: #4b5563;
    --ux-primary: #0f766e;
    --ux-primary-strong: #0b5f5a;
    --ux-focus: #1d4ed8;
    --ux-shadow: 0 14px 36px rgba(15, 23, 42, 0.08);
    --ux-shadow-soft: 0 8px 22px rgba(15, 23, 42, 0.06);
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--ux-font-body);
    color: var(--ux-text);
    line-height: 1.62;
    background:
        radial-gradient(circle at 15% -10%, #dbeafe 0%, transparent 44%),
        radial-gradient(circle at 90% 0%, #dcfce7 0%, transparent 40%),
        linear-gradient(180deg, var(--ux-bg-start) 0%, var(--ux-bg-end) 100%);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    overscroll-behavior: contain;
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type="number"] {
    -moz-appearance: textfield;
    appearance: textfield;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--ux-font-heading);
    letter-spacing: 0.01em;
    color: #0b1220;
}

.container {
    width: min(1320px, calc(100% - 28px));
}

.topbar,
.header {
    background: rgba(255, 255, 255, 0.78);
    border: 1px solid rgba(214, 226, 242, 0.9);
    box-shadow: var(--ux-shadow-soft);
    backdrop-filter: blur(10px);
    border-radius: 14px;
}

.form-section,
.list-section,
.card,
.panel,
.table-wrap,
.detail-card,
.modal-content,
.modal-card,
.edit-modal-card {
    background: var(--ux-surface);
    border: 1px solid var(--ux-border);
    box-shadow: var(--ux-shadow);
}

.modal.show,
.edit-modal.show {
    backdrop-filter: blur(2px);
}

.modal-content,
.modal-card,
.edit-modal-card {
    border-radius: 16px;
    max-height: min(92vh, 980px);
    overflow: auto;
}

button,
.btn,
.btn-export,
.btn-filter,
.btn-page,
.btn-small,
.btn-action,
.btn-back,
.btn-edit,
.btn-submit,
.btn-detail,
.btn-delete,
.btn-cancel,
.btn-save,
.edit-btn,
.edit-upload-btn,
.edit-upload-remove,
.btn-add-order-item,
.btn-remove-order-item,
.btn-add-product {
    min-height: 44px;
    min-width: 44px;
    border-radius: 12px;
    font-family: var(--ux-font-body);
    font-weight: 700;
    letter-spacing: 0.01em;
    transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
    cursor: pointer;
}

button:hover,
.btn:hover,
.btn-export:hover,
.btn-filter:hover,
.btn-page:hover,
.btn-small:hover,
.btn-action:hover,
.btn-back:hover,
.btn-edit:hover,
.btn-submit:hover,
.btn-detail:hover,
.btn-delete:hover,
.btn-cancel:hover,
.btn-save:hover,
.edit-btn:hover,
.edit-upload-btn:hover,
.edit-upload-remove:hover,
.btn-add-order-item:hover,
.btn-remove-order-item:hover,
.btn-add-product:hover {
    transform: translateY(-1px);
    filter: saturate(1.03);
}

button:active,
.btn:active,
.btn-export:active,
.btn-filter:active,
.btn-page:active,
.btn-small:active,
.btn-action:active,
.btn-submit:active,
.edit-btn:active {
    transform: translateY(0);
}

button:disabled,
.btn:disabled,
.btn-export:disabled,
.btn-filter:disabled,
.btn-page:disabled,
.btn-small:disabled,
.btn-action:disabled,
.btn-submit:disabled,
.edit-btn:disabled {
    transform: none;
    filter: grayscale(0.08);
}

/* Keep image-corner close/remove buttons at their original compact size. */
.single-photo-preview .single-photo-item .remove-btn,
.multi-photo-preview .photo-item .remove-btn,
.edit-photo-remove-x,
.photo-preview-close,
#photoPreviewModal .modal-content > button {
    min-width: 0;
    min-height: 0;
    padding: 0;
}

input,
select,
textarea {
    min-height: 44px;
    border-radius: 12px;
    border: 1.5px solid var(--ux-border);
    color: #0f172a;
    background: #fff;
    padding: 10px 12px;
    font-size: 0.97rem;
}

textarea {
    min-height: 96px;
}

input::placeholder,
textarea::placeholder {
    color: #64748b;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible {
    outline: 2px solid var(--ux-focus);
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(29, 78, 216, 0.18);
}

.list-header-actions,
.topbar-actions,
.header-actions,
.filter-actions,
.modal-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.sale-item,
.order-item,
.record-card,
.table-row {
    border-radius: 14px;
}

.sale-item {
    border: 1px solid #dce7f5;
    box-shadow: var(--ux-shadow-soft);
}

.sale-info-item {
    align-items: center;
    gap: 8px;
}

.empty-state {
    text-align: center;
    padding: 56px 18px;
}

.empty-state-icon {
    width: 78px;
    height: 78px;
    margin: 0 auto 14px;
    border-radius: 999px;
    border: 1px solid #c8d8fb;
    background: linear-gradient(150deg, #e0ebff 0%, #eff6ff 100%);
    color: #1d4ed8;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    opacity: 1;
}

.payment-stat-icon--text {
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.08em;
}

.sale-info-label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 48px;
    padding: 4px 8px;
    border-radius: 999px;
    background: #e6f0ff;
    color: #1e40af;
    font-size: 0.74rem;
    font-weight: 800;
}

.sale-info-item span,
.sale-info-item strong {
    color: #0f172a;
    font-weight: 700;
}

table th {
    background: #eef4ff;
    color: #0f172a;
    font-weight: 800;
}

table td {
    color: #111827;
    font-weight: 600;
}

/* 固定操作列 - 防止左右滑动时看不到操作按钮 */
table .sticky-action {
    position: sticky;
    right: 0;
    z-index: 10;
    background: #fff;
}
table th.sticky-action {
    z-index: 20;
    background: #eef4ff;
}
table .sticky-action::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 1px;
    background: #e2e8f0;
}

.sync-status #syncIcon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.08);
    color: #0f172a;
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.04em;
}

.user-action-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    gap: 10px;
    align-items: stretch;
}

.user-action-row-dual {
    display: contents;
}

.user-action-list .btn-logout {
    width: 100% !important;
    flex: none !important;
}

.toast {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    right: auto !important;
    bottom: auto !important;
    z-index: 60000 !important;
    width: min(92vw, 520px);
    max-width: 520px;
    transform: translate(-50%, -50%) scale(0.94) !important;
    transform-origin: center center;
    opacity: 0;
    pointer-events: none;
}

.toast.show {
    transform: translate(-50%, -50%) scale(1) !important;
    opacity: 1 !important;
}

@media (min-width: 1024px) {
    .topbar-actions,
    .header-actions {
        justify-content: flex-end;
    }
}

@media (max-width: 1024px) {
    .container {
        width: min(100%, calc(100% - 20px));
    }

    .list-header-actions,
    .topbar-actions,
    .header-actions,
    .filter-actions,
    .user-action-list {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        width: 100%;
    }

    .list-header-actions > *,
    .topbar-actions > *,
    .header-actions > *,
    .filter-actions > *,
    .user-action-list > * {
        width: 100%;
    }
}

@media (max-width: 640px) {
    .container {
        width: min(100%, calc(100% - 14px));
    }

    .list-header-actions,
    .topbar-actions,
    .header-actions,
    .filter-actions,
    .modal-actions,
    .user-action-list {
        grid-template-columns: 1fr;
    }

    .toast {
        width: min(94vw, 420px);
        max-width: 420px;
        padding: 12px 14px !important;
    }
}

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