*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f0f2f5;
    color: #1a1a2e;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
.header {
    background: #16213e;
    color: #fff;
    padding: 16px 24px;
    display: flex;
    align-items: center;
    gap: 12px;
}
.header h1 { font-size: 20px; font-weight: 600; }
.header .badge {
    background: #0f3460;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}
.container {
    max-width: 720px;
    margin: 24px auto;
    padding: 0 16px;
    width: 100%;
}
.card {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 1px 4px rgba(0,0,0,.08);
    padding: 24px;
    margin-bottom: 16px;
}
.card-header {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.step-num {
    background: #16213e;
    color: #fff;
    width: 26px; height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    flex-shrink: 0;
}
.plugin-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 14px;
}
.plugin-status.ok { background: #e8f5e9; color: #2e7d32; }
.plugin-status.err { background: #ffebee; color: #c62828; }
.plugin-status.warn { background: #fff3e0; color: #e65100; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.dot.green { background: #4caf50; }
.dot.red { background: #f44336; }
.dot.orange { background: #ff9800; }

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background .2s, opacity .2s;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: #16213e; color: #fff; }
.btn-primary:hover:not(:disabled) { background: #1a1a4e; }
.btn-outline { background: #fff; color: #16213e; border: 1.5px solid #16213e; }
.btn-outline:hover:not(:disabled) { background: #f0f2f5; }
.btn-danger { background: #c62828; color: #fff; }
.btn-danger:hover:not(:disabled) { background: #b71c1c; }
.btn-sm { padding: 6px 14px; font-size: 13px; }

select, input[type=file] { font-size: 14px; }
select {
    width: 100%;
    padding: 10px 12px;
    border: 1.5px solid #d0d5dd;
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
}
select:focus { outline: none; border-color: #16213e; }

.upload-zone {
    border: 2px dashed #c0c5ce;
    border-radius: 10px;
    padding: 32px;
    text-align: center;
    cursor: pointer;
    transition: border-color .2s, background .2s;
}
.upload-zone:hover, .upload-zone.dragover {
    border-color: #16213e;
    background: #f8f9fc;
}
.upload-zone.has-file { border-style: solid; border-color: #4caf50; background: #f1f8e9; }
.upload-icon { font-size: 40px; margin-bottom: 8px; }
.upload-text { font-size: 14px; color: #666; }
.upload-text strong { color: #16213e; }
.file-info {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
    padding: 10px 14px;
    background: #f0f2f5;
    border-radius: 6px;
    font-size: 13px;
}
.file-info .name { font-weight: 500; word-break: break-all; }
.file-info .size { color: #888; white-space: nowrap; }

.pdf-preview {
    margin-top: 16px;
    text-align: center;
    position: relative;
    display: inline-block;
}
.pdf-preview canvas {
    max-width: 100%;
    border: 1px solid #d0d5dd;
    border-radius: 4px;
    display: block;
}
.sig-overlay {
    position: absolute;
    background: rgba(255,255,255,0.55);
    border: 2px dashed #16213e;
    border-radius: 6px;
    cursor: move;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
    user-select: none;
    min-width: 80px;
    min-height: 36px;
}
.sig-overlay .sig-label {
    font-size: 10px;
    color: #16213e;
    font-weight: 600;
    text-align: center;
    line-height: 1.25;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
.sig-overlay .sig-coords {
    font-size: 9px;
    color: #555;
    margin-top: 2px;
}

.progress-bar {
    height: 6px;
    background: #e0e0e0;
    border-radius: 3px;
    overflow: hidden;
    margin-top: 12px;
}
.progress-fill {
    height: 100%;
    background: #16213e;
    border-radius: 3px;
    transition: width .3s;
    width: 0;
}

.result-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid #eee;
}
.result-item:last-child { border-bottom: none; }
.result-name { font-weight: 500; font-size: 14px; }
.result-desc { font-size: 12px; color: #888; }

.cert-details {
    font-size: 13px;
    color: #555;
    margin-top: 8px;
    line-height: 1.6;
}
.cert-details span { color: #1a1a2e; font-weight: 500; }

.logo-status {
    font-size: 13px;
    color: #555;
    display: flex;
    align-items: center;
    gap: 8px;
}
.logo-status .logo-name { font-weight: 500; color: #1a1a2e; }
.logo-status .logo-tag { font-size: 11px; padding: 1px 6px; border-radius: 3px; font-weight: 500; }
.logo-status .logo-tag.auto { background: #e3f2fd; color: #1565c0; }
.logo-status .logo-tag.manual { background: #fff3e0; color: #e65100; }

.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #16213e;
    color: #fff;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 13px;
    z-index: 1000;
    opacity: 0;
    transform: translateY(10px);
    transition: all .3s;
    pointer-events: none;
    max-width: 520px;
    white-space: pre-line;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.err { background: #c62828; }

.spinner {
    display: inline-block;
    width: 16px; height: 16px;
    border: 2px solid #ccc;
    border-top-color: #16213e;
    border-radius: 50%;
    animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }