:root {
    --primary: #4f46e5;
    --primary-600: #4338ca;
    --primary-dark: #4338ca;
    --primary-light: #eef2ff;
    --violet: #7c3aed;
    --gradient: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    --success: #16a34a;
    --danger: #dc2626;
    --warning: #f59e0b;
    --text: #0b1220;
    --text-secondary: #5b6577;
    --text-hint: #98a2b3;
    --border: #e8ecf2;
    --border-light: #f1f5f9;
    --bg: #fbfcfe;
    --card: #ffffff;
    --radius: 14px;
    --radius-lg: 22px;
    --shadow-sm: 0 1px 2px rgba(16,24,40,.05), 0 1px 3px rgba(16,24,40,.06);
    --shadow-md: 0 14px 38px rgba(16,24,40,.09);
    --shadow-lg: 0 30px 70px rgba(16,24,40,.12);
    --ease: cubic-bezier(.22,.61,.36,1);
}

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

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background:
        radial-gradient(620px 420px at 12% 8%, rgba(79,70,229,.10), transparent 60%),
        radial-gradient(560px 400px at 88% 18%, rgba(124,58,237,.10), transparent 60%),
        radial-gradient(720px 520px at 50% 108%, rgba(6,182,212,.06), transparent 62%);
}

.wrap {
    max-width: 1080px;
    margin: 0 auto;
    padding: 0 24px;
}

/* 顶部导航 */
.site-header {
    background: rgba(255,255,255,.72);
    backdrop-filter: saturate(180%) blur(14px);
    -webkit-backdrop-filter: saturate(180%) blur(14px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.site-header .wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text);
    font-weight: 700;
    font-size: 16px;
}

.brand-logo {
    width: 28px;
    height: 28px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-radius: 6px;
    position: relative;
}

.brand-logo::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 12px;
    height: 12px;
    border: 2px solid #fff;
    border-radius: 50%;
    border-top-color: transparent;
}

.brand-text {
    font-weight: 700;
    font-size: 16px;
    color: var(--text);
}

.site-nav { display: flex; gap: 12px; }

.nav-btn {
    padding: 7px 16px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.15s;
}

.nav-btn:hover {
    background: var(--border-light);
    color: var(--text);
}

/* 页面标题 */
.page-title {
    background: #fff;
    border-bottom: 1px solid var(--border);
    padding: 28px 0;
}

.page-title h1 {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 4px;
}

.page-title p {
    font-size: 13px;
    color: var(--text-secondary);
}

/* 主内容 */
.main {
    flex: 1;
    padding: 28px 0 48px;
}

.main .wrap {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 28px;
    align-items: flex-start;
}

/* 表单 */
.form-wrap {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px;
    box-shadow: var(--shadow-md);
}

.form-block {
    padding-bottom: 24px;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border-light);
}

.form-block:last-of-type {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.block-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.block-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0;
}

.cert-guide-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: var(--primary);
    text-decoration: none;
    padding: 6px 10px;
    border-radius: 6px;
    background: rgba(79, 70, 229, 0.08);
    transition: all 0.15s;
    white-space: nowrap;
}

.cert-guide-link:hover {
    background: rgba(79, 70, 229, 0.15);
}

.field { margin-bottom: 18px; }
.field:last-child { margin-bottom: 0; }

.field-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.req { color: var(--danger); margin-left: 2px; }
.optional-tag { color: var(--text-hint); font-size: 13px; font-weight: 400; margin-left: 4px; }

.field-control { position: relative; }

.field-input,
.field-textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    color: var(--text);
    background: #fff;
    transition: all 0.15s;
    font-family: inherit;
    line-height: 1.6;
}

.field-textarea { resize: vertical; min-height: 80px; }

.field-input:focus,
.field-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(79,70,229,.12);
}

.field-input::placeholder,
.field-textarea::placeholder {
    color: var(--text-hint);
}

.field-tip {
    font-size: 12px;
    color: var(--text-hint);
    margin-top: 6px;
}

/* 主体信息 */
.entity-box {
    margin-top: 12px;
    padding: 14px 16px;
    background: var(--border-light);
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.entity-row {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
}

.entity-label { color: var(--text-hint); }
.entity-val { color: var(--text); font-weight: 500; }

/* 上传 */
.upload-box { position: relative; }

.upload-input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.upload-placeholder {
    border: 1.5px dashed var(--border);
    border-radius: var(--radius);
    padding: 28px 20px;
    text-align: center;
    background: #fafbfc;
    transition: all 0.15s;
}

.upload-input:hover + .upload-placeholder,
.upload-box:hover .upload-placeholder {
    border-color: var(--primary);
    background: var(--primary-light);
}

.upload-icon {
    width: 40px;
    height: 40px;
    margin: 0 auto 10px;
    color: var(--text-hint);
}

.upload-icon svg { width: 100%; height: 100%; }

.upload-text {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.upload-sub {
    font-size: 12px;
    color: var(--text-hint);
}

.file-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    background: var(--primary-light);
    border-radius: var(--radius);
    border: 1px solid #c7d2fe;
}

.file-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--primary-dark);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    margin-right: 12px;
}

.file-remove {
    padding: 4px 12px;
    font-size: 12px;
    color: var(--danger);
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
    flex-shrink: 0;
}

.file-remove:hover {
    background: #fef2f2;
    border-color: #fecaca;
}

/* 提交按钮 */
.form-submit { padding-top: 8px; }

.submit-btn {
    width: 100%;
    padding: 14px 24px;
    background: var(--gradient);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all .2s var(--ease);
    font-family: inherit;
    box-shadow: 0 10px 24px rgba(79,70,229,.28);
}

.submit-btn:hover { transform: translateY(-1px); box-shadow: 0 14px 30px rgba(79,70,229,.36); }
.submit-btn:active { transform: translateY(0); }

/* 右侧边栏 */
.sidebar {
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: sticky;
    top: 84px;
}

.side-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
}

.side-card h3 {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 12px;
}

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

.notice-list li {
    font-size: 13px;
    color: var(--text-secondary);
    padding: 6px 0 6px 18px;
    position: relative;
    line-height: 1.6;
}

.notice-list li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 13px;
    width: 6px;
    height: 6px;
    background: var(--primary);
    border-radius: 50%;
}

.side-card-accent {
    background: var(--gradient);
    color: #fff;
    border: none;
}

.side-card-accent h3 { color: #fff; }

.side-text {
    font-size: 13px;
    opacity: 0.9;
    margin-bottom: 14px;
    line-height: 1.6;
}

.side-btn {
    display: inline-block;
    padding: 8px 16px;
    background: #fff;
    color: var(--primary);
    text-decoration: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.15s;
}

.side-btn:hover {
    transform: translateX(2px);
}

/* 底部 */
.site-footer {
    background: #fff;
    border-top: 1px solid var(--border);
    padding: 20px 0;
    margin-top: auto;
}

.site-footer .wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.site-footer p {
    font-size: 12px;
    color: var(--text-hint);
    text-align: center;
}

.site-footer a {
    color: var(--text-hint);
    text-decoration: none;
}

.site-footer a:hover {
    color: var(--primary);
}

/* 模态框 */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.active { display: flex; }

.modal-card {
    background: #fff;
    border-radius: var(--radius-lg);
    padding: 32px 28px 24px;
    max-width: 380px;
    width: 100%;
    text-align: center;
    animation: modalIn 0.2s ease;
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.96) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 16px;
    background: #dcfce7;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--success);
}

.modal-icon svg { width: 28px; height: 28px; }

.modal-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 6px;
}

.modal-text {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.modal-code {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    background: var(--border-light);
    border-radius: var(--radius);
    margin-bottom: 20px;
}

.modal-code span {
    font-family: "SF Mono", Monaco, monospace;
    font-size: 16px;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: 1px;
}

.copy-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.15s;
}

.copy-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.copy-btn svg { width: 14px; height: 14px; }

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

.btn {
    flex: 1;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 600;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
    text-align: center;
    font-family: inherit;
}

.btn-plain {
    background: #fff;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.btn-plain:hover {
    background: var(--border-light);
    color: var(--text);
}

.btn-primary {
    background: var(--primary);
    color: #fff;
    border: none;
}

.btn-primary:hover { background: var(--primary-dark); }

/* 加载 */
.loading {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(255,255,255,0.9);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.loading.active { display: flex; }

.loading-box { text-align: center; }

.loading-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--primary-light);
    border-top-color: var(--primary);
    border-radius: 50%;
    margin: 0 auto 12px;
    animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading p {
    font-size: 14px;
    color: var(--text-secondary);
}

/* 响应式 */
@media (max-width: 768px) {
    .wrap { padding: 0 16px; }

    .site-header .wrap { height: 52px; }
    .brand-text { font-size: 14px; }

    .page-title { padding: 20px 0; }
    .page-title h1 { font-size: 18px; }
    .page-title p { font-size: 12px; }

    .main { padding: 16px 0 32px; }

    .main .wrap {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .form-wrap {
        padding: 20px 16px;
        border-radius: var(--radius);
    }

    .block-title { font-size: 14px; }
    .form-block { padding-bottom: 18px; margin-bottom: 18px; }

    .sidebar {
        order: -1;
        position: static;
    }

    .side-card {
        padding: 16px;
        border-radius: var(--radius);
    }

    .side-card h3 { font-size: 14px; }

    .modal-card {
        padding: 28px 20px 20px;
        border-radius: var(--radius);
    }

    .modal-icon { width: 48px; height: 48px; }
    .modal-icon svg { width: 24px; height: 24px; }
    .modal-title { font-size: 16px; }
    .modal-code span { font-size: 14px; }
}

@media (max-width: 374px) {
    .form-wrap { padding: 16px 14px; }
    .block-title { font-size: 14px; }
    .field-input, .field-textarea { font-size: 16px; }
}
