* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    color: #1f2937;
    background: #eef2f7;
    font-family: Arial, "Microsoft YaHei", sans-serif;
}

a {
    color: #1d4ed8;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.admin-login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.login-panel {
    width: 100%;
    max-width: 420px;
    padding: 28px;
    background: #ffffff;
    border: 1px solid #d8dee8;
    border-radius: 8px;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
}

.login-panel h1 {
    margin: 0 0 8px;
    font-size: 24px;
}

.muted {
    margin: 0 0 24px;
    color: #64748b;
}

.alert {
    margin-bottom: 16px;
    padding: 10px 12px;
    color: #991b1b;
    background: #fee2e2;
    border: 1px solid #fecaca;
    border-radius: 6px;
}

.notice {
    margin-bottom: 16px;
    padding: 10px 12px;
    color: #155e75;
    background: #cffafe;
    border: 1px solid #67e8f9;
    border-radius: 6px;
}

.login-form {
    display: grid;
    gap: 10px;
}

.login-form label {
    font-weight: 700;
}

.login-form input {
    width: 100%;
    height: 40px;
    padding: 8px 10px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 15px;
}

.login-form button {
    height: 42px;
    margin-top: 10px;
    color: #ffffff;
    background: #1d4ed8;
    border: 0;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
}

.login-form button:hover {
    background: #1e40af;
}

.admin-shell {
    background: #eef2f7;
}

.admin-topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 58px;
    padding: 0 24px;
    background: #ffffff;
    border-bottom: 1px solid #d8dee8;
}

.topbar-brand,
.topbar-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.topbar-brand strong {
    font-size: 18px;
}

.topbar-brand span {
    color: #64748b;
}

.role-badge {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 2px 8px;
    color: #155e75;
    background: #cffafe;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}

.admin-layout {
    display: grid;
    grid-template-columns: 220px 1fr;
    min-height: calc(100vh - 58px);
}

.admin-sidebar {
    padding: 18px;
    background: #ffffff;
    border-right: 1px solid #d8dee8;
}

.admin-sidebar a {
    display: block;
    padding: 10px 12px;
    margin-bottom: 6px;
    color: #334155;
    border-radius: 6px;
}

.admin-sidebar a:hover,
.admin-sidebar a.active {
    color: #1d4ed8;
    background: #eff6ff;
    text-decoration: none;
}

.admin-content {
    padding: 24px;
}

.page-heading {
    margin-bottom: 20px;
}

.page-heading.with-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.page-heading h1 {
    margin: 0 0 6px;
    font-size: 26px;
}

.page-heading p {
    margin: 0;
    color: #64748b;
}

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

.dashboard-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-bottom: 16px;
}

.dashboard-card {
    min-height: 150px;
    padding: 20px;
    background: #ffffff;
    border: 1px solid #d8dee8;
    border-radius: 8px;
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.05);
}

.dashboard-card h2 {
    margin: 0 0 16px;
    font-size: 18px;
}

.metric-card {
    min-height: 132px;
}

.metric-card span {
    display: block;
    margin-top: 8px;
    color: #64748b;
    line-height: 1.5;
}

.info-list {
    display: grid;
    grid-template-columns: 110px 1fr;
    gap: 10px;
    margin: 0;
}

.info-list dt {
    color: #64748b;
}

.info-list dd {
    margin: 0;
    font-weight: 700;
}

.compact-info {
    grid-template-columns: 80px 1fr;
}

.card-note {
    margin: 0;
    color: #475569;
    line-height: 1.7;
}

.section-title {
    margin: 0 0 14px;
    font-size: 18px;
}

.subsection-title {
    margin: 18px 0 10px;
    font-size: 15px;
}

.code-sample {
    overflow-x: auto;
    margin: 0;
    padding: 14px;
    color: #0f172a;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    line-height: 1.6;
}

.import-summary {
    margin-bottom: 16px;
}

.metric {
    margin: 0;
    font-size: 30px;
    font-weight: 700;
}

.metric.success {
    color: #15803d;
}

.metric.skipped {
    color: #a16207;
}

.metric.error {
    color: #b91c1c;
}

.panel {
    margin-bottom: 16px;
    padding: 20px;
    background: #ffffff;
    border: 1px solid #d8dee8;
    border-radius: 8px;
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.05);
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 8px 14px;
    color: #1f2937;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
}

.button:hover {
    text-decoration: none;
    background: #f8fafc;
}

.button.primary {
    color: #ffffff;
    background: #1d4ed8;
    border-color: #1d4ed8;
}

.button.primary:hover {
    background: #1e40af;
}

.button.secondary {
    color: #334155;
    background: #f8fafc;
}

.detail-list {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 10px 14px;
    margin: 0;
}

.detail-list dt {
    color: #64748b;
    font-weight: 700;
}

.detail-list dd {
    margin: 0;
    word-break: break-all;
}

.toolbar-form {
    display: flex;
    align-items: end;
    gap: 10px;
}

.bulk-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

.checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #334155;
    font-weight: 700;
}

.muted-inline {
    color: #64748b;
    font-size: 13px;
}

.toolbar-form label,
.admin-form label {
    display: grid;
    gap: 6px;
    color: #334155;
    font-weight: 700;
}

.toolbar-form input,
.toolbar-form select,
.admin-form input,
.admin-form select,
.admin-form textarea {
    width: 100%;
    min-height: 38px;
    padding: 8px 10px;
    color: #1f2937;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font: inherit;
    font-weight: 400;
}

.toolbar-form input {
    min-width: 280px;
}

.admin-form {
    display: grid;
    gap: 18px;
}

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

.full-field {
    display: grid;
    gap: 6px;
}

.form-actions {
    display: flex;
    gap: 10px;
}

.table-wrap {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.data-table th,
.data-table td {
    padding: 12px 10px;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
    vertical-align: middle;
}

.data-table th {
    color: #475569;
    background: #f8fafc;
    font-weight: 700;
}

.row-warning td {
    background: #fff7ed;
}

.path-cell {
    max-width: 360px;
    word-break: break-all;
}

.message-cell {
    max-width: 360px;
    word-break: break-word;
}

.compact-table {
    font-size: 13px;
}

.json-block {
    max-height: 520px;
    overflow: auto;
    margin: 0;
    padding: 14px;
    color: #e5e7eb;
    background: #111827;
    border-radius: 6px;
    font-size: 13px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
}

.plain-list {
    margin: 0;
    padding-left: 20px;
}

.health-list {
    display: grid;
    gap: 12px;
}

.health-item {
    padding: 14px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-left-width: 4px;
    border-radius: 8px;
}

.health-item-main {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.health-item h3 {
    margin: 0 0 4px;
    font-size: 15px;
}

.health-item p {
    margin: 0;
    color: #475569;
    line-height: 1.6;
}

.health-pass {
    border-color: #86efac;
}

.health-warn {
    border-color: #fde68a;
}

.health-fail {
    border-color: #fecaca;
}

.health-status {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
}

.health-status.health-pass {
    color: #166534;
    background: #dcfce7;
}

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

.health-status.health-fail {
    color: #991b1b;
    background: #fee2e2;
}

.empty-cell {
    color: #64748b;
    text-align: center;
}

.empty-state {
    padding: 18px;
    color: #64748b;
    text-align: center;
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: 8px;
}

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

.actions-cell form {
    margin: 0;
}

.link-button {
    padding: 0;
    color: #b91c1c;
    background: transparent;
    border: 0;
    font: inherit;
    cursor: pointer;
}

.link-button:hover {
    text-decoration: underline;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 2px 8px;
    color: #334155;
    background: #e2e8f0;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}

.badge {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
}

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

.badge-danger {
    color: #991b1b;
    background: #fee2e2;
}

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

.badge-info {
    color: #075985;
    background: #e0f2fe;
}

.badge-muted {
    color: #475569;
    background: #e2e8f0;
}

.badge-default {
    color: #334155;
    background: #f1f5f9;
}

.flash-message {
    margin-bottom: 16px;
    padding: 12px 14px;
    border: 1px solid transparent;
    border-radius: 8px;
}

.flash-success {
    color: #166534;
    background: #dcfce7;
    border-color: #bbf7d0;
}

.flash-error {
    color: #991b1b;
    background: #fee2e2;
    border-color: #fecaca;
}

.flash-warning {
    color: #92400e;
    background: #fef3c7;
    border-color: #fde68a;
}

.flash-info {
    color: #075985;
    background: #e0f2fe;
    border-color: #bae6fd;
}

.compact-form {
    margin-top: 16px;
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 16px;
    color: #64748b;
}

.pagination-unified {
    flex-wrap: wrap;
}

.pagination-summary {
    margin-right: auto;
}

.page-item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    min-height: 32px;
    padding: 4px 10px;
    color: #334155;
    text-decoration: none;
    background: #fff;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
}

.page-item.active {
    color: #fff;
    background: #2563eb;
    border-color: #2563eb;
}

.page-item.disabled {
    color: #94a3b8;
    background: #f8fafc;
    cursor: not-allowed;
}

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

.health-details {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    margin-top: 10px;
    color: #64748b;
    font-size: 13px;
}

.health-details span {
    word-break: break-word;
}

.quick-links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.page-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
}

.log-preview {
    max-height: 620px;
    overflow: auto;
    padding: 16px;
    color: #dbeafe;
    background: #111827;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
}

@media (max-width: 760px) {
    .admin-topbar,
    .topbar-brand,
    .topbar-user {
        align-items: flex-start;
        flex-direction: column;
    }

    .admin-topbar {
        gap: 10px;
        padding: 14px 18px;
    }

    .admin-layout {
        grid-template-columns: 1fr;
    }

    .admin-sidebar {
        display: flex;
        gap: 8px;
        overflow-x: auto;
        border-right: 0;
        border-bottom: 1px solid #d8dee8;
    }

    .admin-sidebar a {
        flex: 0 0 auto;
        margin-bottom: 0;
    }

    .admin-content {
        padding: 18px;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-metrics {
        grid-template-columns: 1fr;
    }

    .page-heading.with-actions,
    .toolbar-form,
    .bulk-actions,
    .form-actions,
    .pagination {
        align-items: stretch;
        flex-direction: column;
    }

    .toolbar-form input {
        min-width: 0;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .detail-list {
        grid-template-columns: 1fr;
    }
}
