/**
 * 后台样式：侧栏、表格、表单，与前台统一色系
 */
:root {
    --aside-w: 220px;
    --aside-collapsed: 72px;
}

.admin-membership-table input[type="text"],
.admin-membership-table input[type="number"],
.admin-membership-table select {
    max-width: 100%;
    box-sizing: border-box;
}

.admin-membership-table__new td {
    background: rgba(7, 193, 96, 0.04);
}

.login-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(160deg, #e8f8ef 0%, #f6f8f7 45%, #eef0ee 100%);
}

.login-wrap {
    width: 100%;
    max-width: 400px;
    padding: 24px;
}

.login-card {
    background: #fff;
    border-radius: 16px;
    padding: 32px 28px 28px;
    box-shadow: 0 16px 50px rgba(7, 193, 96, 0.12);
    border: 1px solid rgba(7, 193, 96, 0.12);
}

.login-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 1.2rem;
    margin-bottom: 8px;
}

.login-tip {
    font-size: 0.85rem;
    color: #6b7280;
    margin: 0 0 20px;
    line-height: 1.5;
}

.login-error {
    background: #fef2f2;
    color: #b91c1c;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 0.88rem;
    margin-bottom: 14px;
}

.login-form .field {
    display: block;
    margin-bottom: 16px;
}

.login-form .field span {
    display: block;
    font-size: 0.85rem;
    color: #4b5563;
    margin-bottom: 6px;
}

.btn-block {
    width: 100%;
    margin-top: 8px;
    padding: 12px;
}

.back-home {
    display: block;
    text-align: center;
    margin-top: 18px;
    font-size: 0.88rem;
    color: #9ca3af;
}

.back-home:hover {
    color: var(--wx);
}

/* 布局 */
.admin-root {
    display: flex;
    min-height: 100vh;
    background: #f0f3f1;
}

.admin-aside {
    width: var(--aside-w);
    background: #fff;
    border-right: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    transition: width 0.3s ease;
    position: sticky;
    top: 0;
    height: 100vh;
    flex-shrink: 0;
}

.admin-aside.collapsed {
    width: var(--aside-collapsed);
}

.admin-aside.collapsed .aside-text {
    display: none;
}

.admin-aside.collapsed .aside-brand span:last-child {
    display: none;
}

.aside-brand {
    padding: 20px 18px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid #eef2f0;
}

.aside-toggle {
    margin: 12px 14px;
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    background: #fafafa;
    cursor: pointer;
    font-size: 0.85rem;
    color: #4b5563;
    transition: background 0.2s, border-color 0.2s;
}

.aside-toggle:hover {
    border-color: var(--wx);
    color: var(--wx);
    background: var(--wx-light);
}

.aside-nav {
    flex: 1;
    padding: 8px 10px;
    overflow-y: auto;
}

.aside-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 14px;
    border-radius: 10px;
    color: #4b5563;
    font-size: 0.92rem;
    margin-bottom: 4px;
    transition: background 0.2s, color 0.2s, transform 0.15s;
}

.aside-nav a:hover {
    background: var(--wx-light);
    color: var(--wx);
}

.aside-nav a.active {
    background: linear-gradient(90deg, var(--wx-light), #fff);
    color: var(--wx-dark);
    font-weight: 600;
    border: 1px solid rgba(7, 193, 96, 0.15);
}

.aside-foot {
    padding: 14px;
    border-top: 1px solid #eef2f0;
    font-size: 0.8rem;
    color: #9ca3af;
}

.admin-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.admin-topbar {
    height: 56px;
    background: rgba(255, 255, 255, 0.95);
    border-bottom: 1px solid #e8ece9;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 22px;
    position: sticky;
    top: 0;
    z-index: 20;
    backdrop-filter: blur(8px);
}

.admin-topbar h1 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 600;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.88rem;
    color: #6b7280;
}

.topbar-actions a {
    color: var(--wx);
    font-weight: 600;
}

.admin-content {
    padding: 22px;
    flex: 1;
}

.panel {
    background: #fff;
    border-radius: 14px;
    border: 1px solid #e8ece9;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.04);
    padding: 22px;
    margin-bottom: 20px;
}

.panel h2 {
    margin: 0 0 16px;
    font-size: 1.05rem;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
}

.form-grid .full {
    grid-column: 1 / -1;
}

.field-block label {
    display: block;
    font-size: 0.82rem;
    color: #4b5563;
    margin-bottom: 6px;
}

.field-block input,
.field-block textarea,
.field-block select {
    width: 100%;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    font-family: inherit;
    font-size: 0.92rem;
}

.field-block textarea {
    min-height: 88px;
    resize: vertical;
}

.field-block input:focus,
.field-block textarea:focus,
.field-block select:focus {
    outline: none;
    border-color: var(--wx);
    box-shadow: 0 0 0 3px var(--wx-light);
}

/* 资料上架 / 编辑：分步表单 */
.product-form {
    max-width: 760px;
}

.product-form-head {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid #eef2f0;
}

.product-form-head h2 {
    margin: 0 0 8px;
}

.product-form-head .edit-product-title {
    margin: 0 0 10px;
    font-size: 1rem;
    font-weight: 700;
    color: #111827;
    line-height: 1.35;
}

.product-form-head .muted {
    margin: 0;
    line-height: 1.55;
    font-size: 0.9rem;
}

.form-section {
    margin-bottom: 22px;
    padding: 18px 18px 4px;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    background: #fafdfb;
}

.form-section:last-of-type {
    margin-bottom: 8px;
}

.form-section--optional {
    background: #fafafa;
    border-style: dashed;
    border-color: #d1d5db;
}

.form-section--delivery {
    border-left: 4px solid var(--wx);
    background: #fff;
}

.form-section-header {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    margin-bottom: 14px;
}

.form-step {
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.88rem;
    color: #fff;
    background: linear-gradient(135deg, var(--wx), #2dd279);
    box-shadow: 0 4px 12px rgba(7, 193, 96, 0.25);
}

.form-section-header h3 {
    margin: 0 0 4px;
    font-size: 0.98rem;
    font-weight: 700;
    color: #111827;
}

.form-section-header .form-section-lead {
    margin: 0;
    font-size: 0.82rem;
    color: #6b7280;
    line-height: 1.45;
}

.form-section .form-grid {
    margin-bottom: 14px;
}

.form-section .field-block label .label-hint {
    font-weight: 400;
    color: #9ca3af;
    font-size: 0.78rem;
}

.field-tag {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 7px;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 700;
    vertical-align: middle;
}

.field-tag--req {
    background: #fef2f2;
    color: #b91c1c;
}

.field-tag--opt {
    background: #f3f4f6;
    color: #6b7280;
}

.field-block--upload {
    padding: 14px;
    border-radius: 10px;
    border: 1px dashed #d1d5db;
    background: #fff;
}

.field-block--upload label {
    margin-bottom: 8px;
}

.form-section .btn-row {
    margin-top: 0;
}

.product-form > .btn-row {
    margin-top: 12px;
    padding-top: 4px;
}

.btn-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 16px;
}

.btn-admin {
    padding: 10px 18px;
    border-radius: 999px;
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-weight: 600;
    font-size: 0.88rem;
    transition: transform 0.12s, box-shadow 0.2s, opacity 0.2s;
}

.btn-admin:active {
    transform: scale(0.96);
}

.btn-save {
    background: linear-gradient(135deg, var(--wx), #2dd279);
    color: #fff;
    box-shadow: 0 4px 16px rgba(7, 193, 96, 0.3);
}

.btn-save:hover {
    opacity: 0.95;
}

.btn-muted {
    background: #f3f4f6;
    color: #374151;
}

.btn-danger {
    background: #fee2e2;
    color: #b91c1c;
}

.btn-warn {
    background: #fef3c7;
    color: #92400e;
}

/* 表格 */
.data-table-wrap {
    overflow-x: auto;
    border-radius: 10px;
    border: 1px solid #e8ece9;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

.data-table th,
.data-table td {
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid #eef2f0;
}

.data-table th {
    background: #f9fafb;
    font-weight: 600;
    color: #374151;
}

.data-table tbody tr:nth-child(even) {
    background: #fafdfb;
}

.data-table tbody tr:hover {
    background: var(--wx-light);
}

.badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
}

.badge-ok {
    background: var(--wx-light);
    color: var(--wx-dark);
}

.badge-wait {
    background: #fef3c7;
    color: #92400e;
}

.stat-row {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

.stat-card {
    background: #fff;
    border-radius: 12px;
    padding: 18px;
    border: 1px solid #e8ece9;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
}

.stat-card .num {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--wx-dark);
}

.stat-card .lab {
    font-size: 0.82rem;
    color: #6b7280;
    margin-top: 4px;
}

.flash {
    padding: 12px 14px;
    border-radius: 10px;
    margin-bottom: 16px;
    font-size: 0.9rem;
}

.flash-ok {
    background: var(--wx-light);
    color: #065f46;
}

.flash-err {
    background: #fef2f2;
    color: #991b1b;
}

.thumb {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 8px;
    background: #f3f4f6;
}

.admin-file-list {
    list-style: none;
    margin: 0;
    padding: 0;
    border: 1px solid var(--line, #e5e7eb);
    border-radius: 10px;
    overflow: hidden;
}

.admin-file-list li {
    border-bottom: 1px solid var(--line, #e5e7eb);
}

.admin-file-list li:last-child {
    border-bottom: none;
}

.admin-file-check {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    padding: 10px 12px;
    cursor: pointer;
    font-size: 0.9rem;
}

.admin-file-check code {
    font-size: 0.75rem;
    color: var(--muted, #6b7280);
    word-break: break-all;
}

@media (max-width: 860px) {
    .admin-root {
        flex-direction: column;
    }

    .admin-aside {
        width: 100%;
        height: auto;
        position: relative;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
    }

    .aside-nav {
        display: flex;
        flex-wrap: wrap;
        width: 100%;
        padding: 8px;
    }

    .aside-nav a {
        flex: 1 1 auto;
        justify-content: center;
    }

    .aside-foot {
        width: 100%;
    }
}
