* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
    background: #f5f7fb;
    color: #333;
}

.admin-cert-list.is-loading {
    opacity: 0.55;
    pointer-events: none;
    transition: opacity 160ms ease;
}

.frontend-results.is-loading {
    opacity: 0.55;
    pointer-events: none;
    transition: opacity 160ms ease;
}

/* 页面最大宽度，logo 与内容统一 */
:root {
    --page-max-width: 1300px;
    --page-gutter: 0px;
}

.banner-full {
    width: 100%;
    overflow: hidden;
    position: relative;
    margin-top: 26px;
    right: 3px;
}

.banner-bg {
    width: 100%;
    height: 260px;
    display: block;
    object-fit: cover;
    object-position: center center;
}

.banner-inner {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    width: 100%;
    max-width: var(--page-max-width);
    height: 260px;
    margin: 0 auto;
    box-sizing: border-box;
}

/* 响应式 logo：随视口在 60px～150px 之间平滑缩放 */
.banner-logo {
    position: absolute;
    left: 0;
    top: 52%;
    transform: translateY(-50%);
    max-height: clamp(60px, 12vw, 150px);
    width: auto;
    height: auto;
    object-fit: contain;
}

.page-grid {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 1rem;
    align-items: start;
}

.panel {
    background: #ffffff;
    border-radius: 0.75rem;
    box-shadow: 0 10px 25px rgba(15, 23, 42, 0.08);
    overflow: hidden;
}

.panel-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #eef2f7;
    background: #fbfdff;
}

.panel-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: #111827;
}

.breadcrumb {
    margin-top: 0.35rem;
    font-size: 0.85rem;
    color: #6b7280;
}

.breadcrumb-item {
    color: #374151;
}

.list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.list-item {
    padding: 0.9rem 1.25rem;
    border-bottom: 1px dashed #e5e7eb;
}

.list-item:last-child {
    border-bottom: none;
}

.list-row {
    display: flex;
    gap: 0.75rem;
    align-items: baseline;
    justify-content: space-between;
}

.list-title {
    font-weight: 600;
    color: #111827;
    text-decoration: none;
    line-height: 1.35;
    flex: 1;
    min-width: 0;
}

.list-title:hover {
    color: #2563eb;
    text-decoration: underline;
}

.list-date {
    white-space: nowrap;
    font-size: 0.85rem;
    color: #6b7280;
    margin-left: 0.75rem;
}

.list-summary {
    margin-top: 0.35rem;
    font-size: 0.9rem;
    color: #4b5563;
    line-height: 1.55;
}

.sidebar .panel-header {
    background: #ffffff;
}

.side-list {
    list-style: none;
    padding: 0.75rem 1rem 1rem;
    margin: 0;
}

.side-item {
    display: flex;
    gap: 0.5rem;
    align-items: flex-start;
    padding: 0.45rem 0;
    border-bottom: 1px solid #f3f4f6;
}

.side-item:last-child {
    border-bottom: none;
}

.side-dot {
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background: #2563eb;
    margin-top: 0.5rem;
    flex: 0 0 auto;
}

.side-text {
    font-size: 0.92rem;
    color: #374151;
    line-height: 1.35;
}

.side-text:hover {
    color: #2563eb;
}

.header {
    background: #1f2937;
    color: #fff;
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header h1 {
    font-size: 1.25rem;
}

.header nav a {
    color: #e5e7eb;
    margin-left: 1rem;
    text-decoration: none;
    font-size: 0.95rem;
}

.header nav a:hover {
    color: #ffffff;
    text-decoration: underline;
}

.container {
    max-width: var(--page-max-width);
    margin: 2rem auto;
    padding: 0 var(--page-gutter);
}

/* 内容区域：横幅下面整块 */
.content-region {
    background-image: url("/static/img/bg.png");
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    min-height: 50vh;
    padding: 2rem 0 2rem 0;
}

.content-region-title {
    text-align: center;
    font-size: 2.5rem;
    font-weight: 700;
    color: #525252;
    margin: 0 0 1.5rem 0;
}

/* 证书查询卡片（参考：gspchina 证书查询页） */
.cert-card {
    max-width: var(--page-max-width);
    margin: 0 auto 1.5rem auto;
    padding: 0 var(--page-gutter);
    background: #ffffff;
    border-radius: 0.75rem;
    box-shadow: 0 10px 25px rgba(15, 23, 42, 0.08);
    overflow: hidden;
    padding-bottom: 1rem;
}

.cert-form {
    padding: 1.25rem 1.25rem 1rem 1.25rem;
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1rem;
}

.cert-form-row {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.cert-label {
    font-weight: 600;
    color: #374151;
    font-size: 0.95rem;
}

.cert-input,
.cert-select {
    height: 44px;
    padding: 0 0.75rem;
    border-radius: 0.5rem;
    border: 1px solid #d1d5db;
    font-size: 0.95rem;
    background: #ffffff;
}

.cert-actions {
    display: flex;
    grid-column: 1 / -1;
    align-items: center;
    justify-content: center;
}

.cert-btn {
    height: 44px;
    border-radius: 0;
    padding: 0 2.25rem;
    min-width: 220px;
}

/* 覆盖全局 .btn 的圆角，确保查询按钮为直角 */
.btn.cert-btn {
    border-radius: 6px;
}

.cert-result-hint {
    margin: 0;
    padding: 0.75rem 1.25rem;
    color: #374151;
    font-weight: 600;
    border-top: 1px solid #eef2f7;
}

.cert-count {
    color: #2563eb;
}

.cert-query-error {
    margin: 0.75rem 1.25rem 0 1.25rem;
    padding: 0.75rem 1rem;
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
    border-radius: 0.75rem;
    font-size: 0.95rem;
}

.cert-table-wrap {
    margin: 0;
}

/* 前台证书查询卡片：表格与表单保持一致的左右内边距 */
.cert-card .cert-table-wrap {
    padding: 0 1.25rem 1.25rem 1.25rem;
}

/* 后台列表卡片：不额外增加左右内边距（由 .card 的 padding 负责） */
.card .cert-table-wrap {
    padding: 0 0 1.25rem 0;
}

.cert-table {
    width: 100%;
    border-collapse: collapse;
    background: #ffffff;
    border-radius: 0.5rem;
    overflow: hidden;
}

.cert-table th,
.cert-table td {
    border: 1px solid #e5e7eb;
    padding: 0.75rem 0.75rem;
    font-size: 0.95rem;
    color: #374151;
    text-align: left;
}

.cert-table th {
    background: #f8fafc;
    font-weight: 700;
    color: #111827;
}

.cert-empty {
    text-align: center !important;
    color: #6b7280;
    padding: 1.25rem 0.75rem !important;
}

.cert-pager {
    margin: 0.75rem 0 0 0;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.9rem;
    color: #4b5563;
}

.cert-pager-bottom {
    margin-top: 0.75rem;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 1rem;
}

.cert-pager-compact {
    margin: 0;
    font-size: 0.9rem;
}

.cert-pager-compact .cert-page {
    min-width: 32px;
    height: 32px;
    border-radius: 8px;
}

.cert-page-size {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: #6b7280;
    font-size: 0.9rem;
}

.cert-page-size-select {
    height: 34px;
    padding: 0 0.6rem;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    background: #ffffff;
    color: #374151;
    outline: none;
}

.cert-page-size-select:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.cert-pager a {
    color: #2563eb;
    text-decoration: none;
}

.cert-pager a:hover {
    text-decoration: underline;
}

.cert-pager-pages {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.cert-page {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    padding: 0 0.4rem;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    background: #ffffff;
    color: #374151;
    text-decoration: none;
    font-size: 0.9rem;
}

.cert-page:hover {
    border-color: #cbd5e1;
    background: #f8fafc;
    text-decoration: none;
}

.cert-page.is-active {
    border-color: #2563eb;
    background: #2563eb;
    color: #ffffff;
}

.cert-page-ellipsis {
    color: #9ca3af;
    padding: 0 0.25rem;
}

.cert-pager-info {
    color: #6b7280;
}

.cert-link {
    color: #2563eb;
    text-decoration: none;
    font-weight: 600;
}

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

.cert-image-card {
    max-width: var(--page-max-width);
    margin: 0 auto 2rem auto;
    padding: 0 var(--page-gutter);
    background: #ffffff;
    border-radius: 0.75rem;
    box-shadow: 0 10px 25px rgba(15, 23, 42, 0.08);
    overflow: hidden;
}

.cert-image-header {
    padding: 0.9rem 1.25rem;
    font-weight: 700;
    color: #111827;
    border-bottom: 1px solid #eef2f7;
    background: #fbfdff;
}

.cert-image-body {
    padding: 1.25rem;
}

.cert-image {
    width: 100%;
    display: block;
    border-radius: 0.5rem;
    border: 1px solid #e5e7eb;
}

@media (max-width: 900px) {
    .cert-form {
        grid-template-columns: 1fr;
    }
    .cert-actions {
        justify-content: stretch;
    }
    .cert-btn {
        width: 100%;
    }
}

.card {
    background: #ffffff;
    border-radius: 0.75rem;
    padding: 1.5rem;
    box-shadow: 0 10px 25px rgba(15, 23, 42, 0.08);
}

.card h2 {
    margin-bottom: 1rem;
}

.card ul {
    padding-left: 1.25rem;
}

.card li {
    margin-bottom: 0.5rem;
}

@media (max-width: 900px) {
    .page-grid {
        grid-template-columns: 1fr;
    }
    :root {
        --page-gutter: 16px;
    }
}

/* 横幅与 logo 小屏响应式 */
@media (max-width: 768px) {
    .banner-bg {
        height: 180px;
    }
    .banner-inner {
        height: 180px;
    }
    .banner-logo {
        max-height: clamp(50px, 14vw, 100px);
    }
}

@media (max-width: 480px) {
    .banner-bg {
        height: 140px;
    }
    .banner-inner {
        height: 140px;
    }
    .banner-logo {
        max-height: 48px;
    }
}

.form-group {
    margin-bottom: 1rem;
    display: flex;
    flex-direction: column;
}

label {
    margin-bottom: 0.25rem;
    font-weight: 500;
}

input[type="text"],
input[type="file"] {
    padding: 0.5rem;
    border-radius: 0.5rem;
    border: 1px solid #d1d5db;
    font-size: 0.95rem;
}

/* 后台管理员表单（登录 + 上传）统一样式 */
.admin-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 1.5rem;
    row-gap: 1rem;
}

.admin-form input[type="text"],
.admin-form input[type="password"],
.admin-form input[type="file"],
.admin-form input[type="date"],
.admin-edit-form input[type="text"],
.admin-edit-form input[type="date"],
.admin-edit-form select {
    height: 44px;
    padding: 0 0.75rem;
    border-radius: 0.5rem;
    border: 1px solid #d1d5db;
    font-size: 0.95rem;
}

/* 让“选择文件”文字在输入框内上下居中（部分浏览器生效） */
.admin-form input[type="file"] {
    line-height: 44px;
}

/* 图片预览 + 右侧操作区域 同一行 */
.admin-preview-row {
    grid-column: 1 / -1;
    display: flex;
    align-items: stretch;
    gap: 1.5rem;
    margin-top: 1rem;
}

.admin-preview-wrap {
    flex: 1 1 50%;
    min-width: 280px;
}

/* 操作区域框：与图片区各占一侧，样式与预览框一致 */
.admin-actions-box {
    flex: 1 1 50%;
    min-width: 280px;
    border: 1px dashed #d1d5db;
    border-radius: 0.5rem;
    padding: 1rem;
    min-height: 220px;
    background: #f9fafb;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 操作区域：上传、清空按钮（在框内，并排） */
.admin-form-actions {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 2rem;
}

.admin-form .btn {
    height: 44px;
    padding: 0 2.5rem;
    min-width: 160px;
    border-radius: 4px;
    font-size: 0.95rem;
}

.admin-form .btn-primary {
    background: #2563eb;
    color: #fff;
}

.admin-form .btn-primary:hover {
    background: #1d4ed8;
}

.admin-form .btn-secondary {
    background: #6b7280;
    color: #fff;
}

.admin-form .btn-secondary:hover {
    background: #4b5563;
}

/* 登录页按钮：在整个表单宽度居中 */
.admin-login-form .btn {
    grid-column: 1 / -1;
    margin: 0 auto;
}


.admin-preview-title {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #374151;
}

.admin-preview-box {
    border: 1px dashed #d1d5db;
    border-radius: 0.5rem;
    padding: 1rem;
    min-height: 220px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f9fafb;
}

.admin-preview-img {
    max-width: 100%;
    max-height: 320px;
    display: none;
    border-radius: 0.5rem;
}

.admin-preview-placeholder {
    font-size: 0.9rem;
    color: #9ca3af;
}

@media (max-width: 768px) {
    .admin-form {
        grid-template-columns: 1fr;
    }
    .admin-form .btn {
        grid-column: 1 / -1;
        margin: 0 auto;
    }
    .admin-preview-row {
        flex-direction: column;
    }
    .admin-form-actions {
        align-items: stretch;
    }
    .admin-form-actions .btn {
        width: 100%;
    }
}

/* 通用弹窗样式（编辑证书） */
.modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal.is-open {
    display: flex;
}

.modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
}

.modal-dialog {
    position: relative;
    z-index: 1;
    background: #ffffff;
    border-radius: 0.75rem;
    padding: 1.5rem 1.75rem 1.25rem 1.75rem;
    width: 760px;
    max-width: 95%;
    box-shadow: 0 20px 45px rgba(15, 23, 42, 0.25);
}

.modal-dialog-sm {
    width: 520px;
}

.modal-text {
    color: #374151;
    font-size: 0.95rem;
    line-height: 1.6;
    margin: 0.25rem 0 1rem 0;
}

.modal-strong {
    font-weight: 700;
    color: #111827;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.modal-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: #111827;
}

.modal-close {
    border: none;
    background: transparent;
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
    color: #6b7280;
}

.modal-close:hover {
    color: #111827;
}

.admin-edit-form .form-group {
    margin-bottom: 0.85rem;
}

.modal-actions {
    margin-top: 1.25rem;
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

/* 编辑弹窗内 左右布局：左表单，右图片 */
.modal-edit-body {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    column-gap: 1.5rem;
    align-items: stretch;
}

.modal-edit-image {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
}

.modal-image-box {
    border: 1px dashed #d1d5db;
    border-radius: 0.5rem;
    padding: 0.75rem;
    min-height: 160px;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f9fafb;
}

.modal-image {
    max-width: 100%;
    max-height: 220px;
    display: none;
    border-radius: 0.5rem;
}

.modal-image-placeholder {
    font-size: 0.9rem;
    color: #9ca3af;
}

@media (max-width: 640px) {
    .modal-dialog {
        padding: 1.25rem 1.25rem 1rem 1.25rem;
    }
    .modal-edit-body {
        grid-template-columns: 1fr;
        row-gap: 1rem;
    }
    .modal-edit-image {
        gap: 0.5rem;
    }
}

.btn {
    display: inline-block;
    padding: 0.6rem 1.4rem;
    background: #2563eb;
    color: #ffffff;
    border: none;
    border-radius: 999px;
    cursor: pointer;
    font-size: 0.95rem;
}

.btn:hover {
    background: #1d4ed8;
}

.message {
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    background: #ecfdf3;
    color: #166534;
    border-radius: 0.75rem;
    border: 1px solid #bbf7d0;
}

.footer {
    text-align: center;
    padding: 1.8rem 0 0.8rem 0;
    font-size: 0.95rem;
    color: #6b7280;
    background: #ffffff;
    line-height: 1.8;
}

.footer div + div {
    margin-top: 0.4rem;
}

