:root {
    --zc-primary: #2563eb;
    --zc-primary-dark: #1d4ed8;
    --zc-border: #d9e1ef;
    --zc-muted: #64748b;
    --zc-text: #172033;
    --zc-bg: #f5f7fb;
    --zc-sidebar: #101827;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    color: var(--zc-text);
    background: var(--zc-bg);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
    letter-spacing: 0;
}

.login-page {
    min-height: 100vh;
    background:
        linear-gradient(120deg, rgba(37, 99, 235, 0.14), rgba(20, 184, 166, 0.12)),
        #eef3fb;
}

.login-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.login-panel {
    width: min(430px, 100%);
    background: #fff;
    border: 1px solid var(--zc-border);
    border-radius: 8px;
    padding: 36px;
    box-shadow: 0 18px 50px rgba(15, 23, 42, 0.12);
}

.brand-mark {
    width: 54px;
    height: 54px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    color: #fff;
    background: var(--zc-primary);
    font-size: 26px;
    margin-bottom: 18px;
}

.login-panel h1 {
    font-size: 26px;
    margin: 0 0 6px;
    font-weight: 700;
}

.login-panel p {
    color: var(--zc-muted);
    margin-bottom: 28px;
}

.login-form .btn {
    height: 44px;
}

.login-error {
    min-height: 22px;
    margin-top: 14px;
    color: #dc2626;
    font-size: 14px;
}

.admin-layout {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 248px minmax(0, 1fr);
}

.sidebar {
    background: var(--zc-sidebar);
    color: #dbeafe;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}

.sidebar-brand {
    height: 66px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 20px;
    font-weight: 700;
    font-size: 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-icon {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    color: #fff;
    background: var(--zc-primary);
}

.side-nav {
    padding: 12px;
    overflow-y: auto;
}

.nav-item-btn {
    width: 100%;
    height: 42px;
    border: 0;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 12px;
    color: #cbd5e1;
    background: transparent;
    font-size: 14px;
    text-align: left;
    margin-bottom: 4px;
}

.nav-item-btn:hover,
.nav-item-btn.active {
    background: rgba(37, 99, 235, 0.18);
    color: #fff;
}

.nav-item-btn i {
    width: 20px;
    text-align: center;
}

.main {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.topbar {
    height: 66px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 0 24px;
    background: #fff;
    border-bottom: 1px solid var(--zc-border);
    position: sticky;
    top: 0;
    z-index: 10;
}

.topbar h1 {
    font-size: 20px;
    margin: 0;
    font-weight: 700;
}

.topbar p {
    margin: 3px 0 0;
    color: var(--zc-muted);
    font-size: 13px;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.admin-name {
    max-width: 180px;
    color: #334155;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.content {
    padding: 22px 24px 34px;
}

.toolbar {
    background: #fff;
    border: 1px solid var(--zc-border);
    border-radius: 8px;
    padding: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.toolbar .filters {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.table-panel,
.stat-card,
.form-section {
    background: #fff;
    border: 1px solid var(--zc-border);
    border-radius: 8px;
}

.table-panel {
    overflow: hidden;
}

.table {
    margin: 0;
}

.table thead th {
    background: #f8fafc;
    color: #475569;
    font-size: 13px;
    font-weight: 700;
    border-bottom-color: var(--zc-border);
    white-space: nowrap;
}

.table td {
    vertical-align: middle;
    font-size: 14px;
}

.table td .sub {
    display: block;
    color: var(--zc-muted);
    font-size: 12px;
    margin-top: 2px;
}

.cover-img,
.thumb-img {
    width: 64px;
    height: 44px;
    border-radius: 6px;
    object-fit: cover;
    background: #e2e8f0;
    border: 1px solid #e2e8f0;
}

.thumb-img {
    width: 54px;
    height: 54px;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 24px;
    padding: 0 8px;
    border-radius: 999px;
    font-size: 12px;
    background: #e0f2fe;
    color: #0369a1;
}

.status-badge.off {
    background: #f1f5f9;
    color: #64748b;
}

.status-badge.warn {
    background: #fef3c7;
    color: #92400e;
}

.status-badge.ok {
    background: #dcfce7;
    color: #166534;
}

.table-actions {
    display: inline-flex;
    gap: 6px;
    flex-wrap: wrap;
}

.pagination-bar {
    min-height: 58px;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-top: 1px solid var(--zc-border);
    color: var(--zc-muted);
    font-size: 13px;
}

.pager-buttons {
    display: flex;
    align-items: center;
    gap: 8px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 14px;
}

.stat-card {
    padding: 18px;
}

.stat-card .label {
    color: var(--zc-muted);
    font-size: 13px;
    margin-bottom: 8px;
}

.stat-card .value {
    font-size: 28px;
    font-weight: 750;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.form-grid .span-2 {
    grid-column: span 2;
}

.preview-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.upload-card {
    border: 1px dashed #b8c4d6;
    border-radius: 8px;
    background: #f8fafc;
    padding: 12px;
}

.upload-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}

.upload-card-title {
    font-size: 13px;
    color: #475569;
    font-weight: 700;
}

.media-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.media-item {
    width: 112px;
    border: 1px solid #dbe3ef;
    border-radius: 8px;
    background: #fff;
    padding: 6px;
    position: relative;
}

.media-item img {
    width: 100%;
    height: 82px;
    object-fit: cover;
    border-radius: 6px;
    background: #e2e8f0;
    display: block;
}

.media-file-link {
    min-height: 94px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: #64748b;
    font-size: 12px;
    text-decoration: none;
}

.media-file-link i {
    font-size: 26px;
    color: #2563eb;
}

.media-file-link span {
    max-width: 92px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.media-remove {
    position: absolute;
    right: 2px;
    top: 2px;
    width: 24px;
    height: 24px;
    border: 0;
    border-radius: 50%;
    background: rgba(15, 23, 42, 0.72);
    color: #fff;
    display: grid;
    place-items: center;
    line-height: 1;
}

.media-empty {
    color: #94a3b8;
    font-size: 13px;
    padding: 12px 0;
}

.gallery-editor {
    display: grid;
    gap: 12px;
}

.gallery-row {
    border: 1px solid #dbe3ef;
    border-radius: 8px;
    padding: 12px;
    background: #fff;
}

.gallery-row-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.empty-state {
    padding: 42px 18px;
    text-align: center;
    color: var(--zc-muted);
}

.detail-box {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px;
    white-space: pre-wrap;
    line-height: 1.7;
    color: #334155;
}

.section-title {
    font-size: 15px;
    font-weight: 700;
    margin: 18px 0 10px;
}

@media (max-width: 980px) {
    .admin-layout {
        grid-template-columns: 78px minmax(0, 1fr);
    }
    .sidebar-brand span:last-child,
    .nav-item-btn span {
        display: none;
    }
    .sidebar-brand {
        justify-content: center;
        padding: 0;
    }
    .nav-item-btn {
        justify-content: center;
        padding: 0;
    }
    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .form-grid {
        grid-template-columns: 1fr;
    }
    .form-grid .span-2 {
        grid-column: span 1;
    }
}
