.doc-hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.9rem;
    border-radius: 999px;
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.22);
    color: #818cf8;
    font-size: 0.75rem;
    font-weight: 500;
}

.doc-type {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
    width: 100%;
    height: 100%;
    padding: 1.25rem 1.3rem 1.2rem;
    border-radius: 1.15rem;
    border: 1px solid var(--border-color);
    background: color-mix(in srgb, var(--bg-card) 88%, transparent);
    transition: border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}
.doc-type:hover {
    border-color: rgba(99, 102, 241, 0.55);
    transform: translateY(-2px);
    box-shadow: 0 12px 40px rgba(99, 102, 241, 0.12);
}
.doc-type-icon {
    width: 2.6rem;
    height: 2.6rem;
    border-radius: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.9rem;
    background: rgba(99, 102, 241, 0.12);
    color: #818cf8;
}
.doc-type.is-violet .doc-type-icon { background: rgba(139, 92, 246, 0.14); color: #a78bfa; }
.doc-type.is-blue .doc-type-icon { background: rgba(59, 130, 246, 0.14); color: #60a5fa; }
.doc-type.is-emerald .doc-type-icon { background: rgba(16, 185, 129, 0.14); color: #34d399; }
.doc-type.is-amber .doc-type-icon { background: rgba(245, 158, 11, 0.14); color: #fbbf24; }

.doc-workspace {
    display: grid;
    grid-template-columns: minmax(320px, 400px) minmax(0, 1fr);
    gap: 1.25rem;
    align-items: start;
}
@media (max-width: 1023px) {
    .doc-workspace { grid-template-columns: 1fr; }
}

.doc-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 1.15rem;
    overflow: hidden;
}

.doc-form-scroll {
    max-height: calc(100vh - 13.5rem);
    overflow-y: auto;
}
@media (max-width: 1023px) {
    .doc-form-scroll { max-height: none; }
}

.doc-section + .doc-section {
    border-top: 1px solid var(--border-color);
}
.doc-section-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.95rem 1.15rem;
    text-align: left;
    font-weight: 600;
}
.doc-section-btn i {
    color: #818cf8;
    transition: transform 0.2s ease;
}
.doc-section.is-open .doc-section-btn i { transform: rotate(180deg); }
.doc-section-body {
    display: none;
    padding: 0 1.15rem 1.15rem;
}
.doc-section.is-open .doc-section-body { display: block; }

.doc-field { display: flex; flex-direction: column; gap: 0.4rem; margin-bottom: 0.85rem; }
.doc-field label { font-size: 0.8rem; font-weight: 600; color: var(--text-secondary); }
.doc-field .req { color: #f87171; margin-left: 0.15rem; }
.doc-field input,
.doc-field select,
.doc-field textarea {
    width: 100%;
    border-radius: 0.75rem;
    border: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.04);
    padding: 0.7rem 0.9rem;
    outline: none;
    color: inherit;
}
.doc-field textarea { min-height: 6.5rem; resize: vertical; line-height: 1.5; }
.doc-field input:focus,
.doc-field select:focus,
.doc-field textarea:focus {
    border-color: rgba(99, 102, 241, 0.65);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}
.doc-field.is-error input,
.doc-field.is-error select,
.doc-field.is-error textarea {
    border-color: rgba(239, 68, 68, 0.55);
}
.doc-hint { font-size: 0.72rem; color: var(--text-muted); line-height: 1.4; }
.doc-err { display: none; font-size: 0.72rem; color: #f87171; }
.doc-field.is-error .doc-err { display: block; }

.doc-clause {
    display: flex;
    align-items: flex-start;
    gap: 0.7rem;
    width: 100%;
    padding: 0.75rem 0.85rem;
    margin-bottom: 0.5rem;
    border-radius: 0.8rem;
    border: 1px solid var(--border-color);
    text-align: left;
    background: transparent;
}
.doc-clause.is-on {
    border-color: rgba(99, 102, 241, 0.55);
    background: rgba(99, 102, 241, 0.1);
}
.doc-clause input { margin-top: 0.2rem; accent-color: #6366f1; }

.doc-preview-wrap {
    position: sticky;
    top: 7.5rem;
}
.doc-paper-frame {
    background: #1a1a1f;
    border-radius: 1.15rem;
    padding: 1rem 1rem 1.25rem;
    border: 1px solid var(--border-color);
}
body:not(.dark) .doc-paper-frame {
    background: #e8e4dc;
}
.doc-paper {
    background: #fbf8f1;
    color: #1c1917;
    min-height: 720px;
    padding: 2.4rem 2.6rem 2.8rem;
    border-radius: 2px;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
    font-family: "Times New Roman", Georgia, "Noto Serif", serif;
    font-size: 15.5px;
    line-height: 1.65;
    word-break: break-word;
}
.doc-block {
    white-space: pre-wrap;
    margin: 0 0 1rem;
}
.doc-right { text-align: right; max-width: 58%; margin-left: auto; }
.doc-center { text-align: center; font-weight: 700; letter-spacing: 0.03em; }
.doc-center .doc-paper-title,
.doc-center { font-size: 1.05rem; }
.doc-left { text-align: justify; }
.doc-sign {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-top: 1.75rem;
    white-space: pre-wrap;
}
.doc-sign > div:last-child { text-align: right; }

.doc-slot,
.doc-value {
    border-radius: 2px;
    cursor: pointer;
    transition: background 0.15s ease, box-shadow 0.15s ease;
}
.doc-slot {
    color: #a8a29e;
    border-bottom: 1px dashed #a8a29e;
    padding: 0 0.1rem;
}
.doc-value {
    color: inherit;
    background: transparent;
    padding: 0;
}
.doc-slot.is-focus,
.doc-value.is-focus {
    background: #fde68a;
    box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.35);
    color: #1c1917;
}

.doc-tabs {
    display: none;
    grid-template-columns: 1fr 1fr;
    gap: 0.4rem;
    padding: 0.4rem;
    border-radius: 0.9rem;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    margin-bottom: 0.85rem;
}
.doc-tabs button {
    border-radius: 0.7rem;
    padding: 0.55rem 0.75rem;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-secondary);
}
.doc-tabs button.is-on {
    background: linear-gradient(90deg, #6366f1, #a855f7);
    color: #fff;
}
@media (max-width: 1023px) {
    .doc-tabs { display: grid; }
    .doc-col-form.is-hidden-mobile,
    .doc-col-preview.is-hidden-mobile { display: none; }
    .doc-preview-wrap { position: static; }
}

.doc-progress {
    height: 0.4rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    overflow: hidden;
}
body:not(.dark) .doc-progress { background: #e5e7eb; }
.doc-progress > span {
    display: block;
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, #6366f1, #a855f7);
    transition: width 0.25s ease;
}

.doc-toast {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    z-index: 80;
    max-width: min(26rem, calc(100vw - 2rem));
    padding: 0.8rem 1rem;
    border-radius: 0.85rem;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
    display: none;
}
.doc-toast.is-on { display: block; }
.doc-toast.is-bad { border-color: rgba(239, 68, 68, 0.45); }

.doc-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    border-radius: 0.8rem;
    padding: 0.55rem 0.9rem;
    font-weight: 600;
    font-size: 0.85rem;
    border: 1px solid var(--border-color);
    background: transparent;
    color: inherit;
}
.doc-action:disabled { opacity: 0.45; cursor: not-allowed; }
.doc-action.is-primary {
    border: 0;
    background: linear-gradient(90deg, #6366f1, #a855f7);
    color: #fff;
}
.doc-action.is-ghost:hover { border-color: rgba(99, 102, 241, 0.45); }

.doc-sticky-bar {
    display: none;
    position: sticky;
    bottom: 0;
    z-index: 20;
    gap: 0.5rem;
    padding: 0.75rem 0 0.25rem;
    background: linear-gradient(180deg, transparent, var(--bg-primary) 30%);
}
@media (max-width: 1023px) {
    .doc-sticky-bar { display: flex; }
}
