* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body.admin-app {
    font-family: -apple-system, BlinkMacSystemFont, "PingFang TC", "Microsoft JhengHei", sans-serif;
    background: #eef1f6;
    color: #1f2937;
    min-height: 100vh;
}

.admin-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 220px;
    background: #111827;
    color: #e5e7eb;
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
}

.admin-brand {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 8px;
    letter-spacing: 0.02em;
}

.admin-user-chip {
    font-size: 12px;
    color: #9ca3af;
    margin-bottom: 18px;
    padding: 0 12px;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.stat-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 14px;
}

.stat-card.stat-warn {
    border-color: #fdba74;
    background: #fff7ed;
}

.stat-label {
    font-size: 12px;
    color: #6b7280;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    margin: 6px 0;
}

.stat-value-sm {
    font-size: 16px;
    line-height: 1.4;
}

.stat-card a {
    font-size: 12px;
    color: #2563eb;
    text-decoration: none;
}

.admin-nav {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.admin-nav a {
    color: #d1d5db;
    text-decoration: none;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 14px;
}

.admin-nav a.is-active,
.admin-nav a:hover {
    background: #374151;
    color: #fff;
}

.admin-sidebar-logout {
    margin-top: auto;
    color: #9ca3af;
    text-decoration: none;
    font-size: 13px;
    padding: 8px 12px;
}

.admin-main {
    margin-left: 220px;
    padding: 24px 24px 48px;
    max-width: 1200px;
}

.admin-topbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.admin-topbar h1 {
    font-size: 24px;
    font-weight: 700;
}

.admin-topbar p {
    margin-top: 6px;
    font-size: 13px;
    color: #6b7280;
}

.admin-topbar-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 14px;
    text-decoration: none;
    border: none;
    cursor: pointer;
}

.btn-primary {
    background: #111827;
    color: #fff;
}

.btn-secondary {
    background: #fff;
    color: #111827;
    border: 1px solid #d1d5db;
}

.btn-orange {
    background: #f58220;
    color: #fff;
}

.flash {
    padding: 12px 14px;
    border-radius: 10px;
    margin-bottom: 14px;
    font-size: 14px;
}

.flash-success {
    background: #ecfdf5;
    color: #047857;
    border: 1px solid #a7f3d0;
}

.flash-error {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

.admin-link-bar {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: 16px;
    font-size: 14px;
}

.admin-link-bar code {
    background: #f3f4f6;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 13px;
}

.admin-form-grid {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 16px;
    align-items: start;
}

.admin-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 18px 16px;
    margin-bottom: 16px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.admin-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid #f3f4f6;
}

.admin-card-head h2 {
    font-size: 16px;
    font-weight: 700;
}

.admin-card-head span {
    font-size: 12px;
    color: #6b7280;
}

.admin-form label {
    display: block;
    font-size: 13px;
    color: #4b5563;
    margin: 12px 0 6px;
    font-weight: 600;
}

.admin-form label:first-child {
    margin-top: 0;
}

.admin-form input,
.admin-form textarea,
.admin-form select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    background: #fff;
}

.admin-form textarea {
    min-height: 88px;
    resize: vertical;
    line-height: 1.55;
}

.admin-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.admin-form input[type="file"] {
    border: 1px dashed #d1d5db;
    padding: 12px;
    background: #fafafa;
}

.switch-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    background: #fff7ed;
    border: 1px solid #fed7aa;
    border-radius: 10px;
    margin-bottom: 12px;
}

.switch-row strong {
    display: block;
    font-size: 14px;
    margin-bottom: 4px;
}

.switch-row small {
    font-size: 12px;
    color: #6b7280;
}

.switch-row input {
    width: 18px;
    height: 18px;
}

.hint {
    font-size: 12px;
    color: #6b7280;
    margin-top: 4px;
}

.image-preview-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.image-preview-list img {
    width: 72px;
    height: 72px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.admin-sticky {
    position: sticky;
    top: 20px;
}

.preview-card .sys-modal-panel {
    position: static;
    max-width: none;
    box-shadow: none;
}

.preview-label {
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 10px;
}

.admin-form-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.popup-template-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.popup-template-actions button {
    font-size: 12px;
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid #d1d5db;
    background: #fff;
    cursor: pointer;
}

/* 列表页 */
.product-table-wrap {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
}

.product-table {
    width: 100%;
    border-collapse: collapse;
}

.product-table th,
.product-table td {
    padding: 12px 14px;
    border-bottom: 1px solid #f3f4f6;
    text-align: left;
    vertical-align: middle;
    font-size: 14px;
}

.product-table th {
    background: #f9fafb;
    color: #6b7280;
    font-size: 12px;
    font-weight: 600;
}

.product-table tr:last-child td {
    border-bottom: none;
}

.product-thumb {
    width: 52px;
    height: 52px;
    border-radius: 8px;
    object-fit: cover;
    background: #f3f4f6;
}

.badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
}

.badge-on {
    background: #ffedd5;
    color: #c2410c;
}

.badge-off {
    background: #f3f4f6;
    color: #6b7280;
}

.table-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.table-actions a,
.table-actions button,
.table-actions form button {
    font-size: 12px;
    padding: 6px 8px;
    border-radius: 6px;
    border: 1px solid #d1d5db;
    background: #fff;
    color: #111827;
    text-decoration: none;
    cursor: pointer;
}

.table-actions .danger {
    color: #b91c1c;
    border-color: #fecaca;
}

.table-actions form {
    margin: 0;
}

/* 登录页 */
.admin-login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(145deg, #111827, #1f2937);
}

.admin-login-card {
    width: 100%;
    max-width: 420px;
    background: #fff;
    border-radius: 14px;
    padding: 24px 20px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
}

.admin-login-card h1 {
    font-size: 22px;
    margin-bottom: 6px;
}

.admin-login-card p {
    font-size: 13px;
    color: #6b7280;
    margin-bottom: 16px;
}

.preview-card .sys-modal-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.preview-card .sys-modal-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #f58220;
    color: #fff;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.preview-card .sys-modal-title {
    font-size: 18px;
    font-weight: 700;
    color: #f58220;
}

.preview-card .sys-modal-body {
    font-size: 14px;
    line-height: 1.65;
    color: #666;
    margin-bottom: 16px;
    white-space: pre-wrap;
}

.preview-card .sys-modal-btn {
    width: 100%;
    height: 46px;
    border: none;
    border-radius: 8px;
    background: #f58220;
    color: #fff;
    font-size: 16px;
    font-weight: 700;
}

.preview-card .sys-modal-panel {
    background: #fffaf5;
    border-radius: 14px;
    padding: 18px 16px 16px;
    border: 1px solid #ffe2cc;
}

@media (max-width: 960px) {
    .admin-sidebar {
        position: static;
        width: 100%;
        flex-direction: row;
        align-items: center;
        gap: 12px;
        padding: 12px 14px;
    }

    .admin-brand {
        margin: 0;
    }

    .admin-nav {
        flex-direction: row;
        flex: 1;
    }

    .admin-sidebar-logout {
        margin-top: 0;
    }

    .admin-main {
        margin-left: 0;
        padding: 16px;
    }

    .admin-form-grid {
        grid-template-columns: 1fr;
    }

    .admin-form-row {
        grid-template-columns: 1fr;
    }

    .stat-grid {
        grid-template-columns: 1fr 1fr;
    }

    .product-table-wrap {
        overflow-x: auto;
    }
}
