.id-photo-layout {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

/* Chrome 需用户直接点到 file input；全局 .upload-dropzone input 为 0×0 + pointer-events:none，仅靠 JS .click() 在 Chrome 下易出现选文件对话框无法点选 */
#dropzone {
    position: relative;
    overflow: hidden;
}

#dropzone .dropzone-content,
#dropzone .id-photo-upload-busy {
    position: relative;
    z-index: 1;
    pointer-events: none;
}

#dropzone input[type="file"] {
    position: absolute;
    inset: 0;
    z-index: 2;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    opacity: 0;
    cursor: pointer;
    pointer-events: auto;
    font-size: 0;
}

#dropzone.is-uploading input[type="file"] {
    pointer-events: none;
    cursor: default;
}

.id-photo-upload-busy {
    margin: 1rem;
    text-align: center;
    color: #64748b;
}

.upload-dropzone.is-uploading {
    pointer-events: none;
    opacity: 0.85;
}

.id-photo-presets {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0.75rem;
    max-height: 280px;
    overflow-y: auto;
    padding: 0.25rem;
}

.id-photo-preset {
    text-align: left;
    padding: 0.65rem 0.75rem;
    border: 2px solid var(--border-color, #e2e8f0);
    border-radius: 8px;
    background: var(--card-bg, #fff);
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.id-photo-preset:hover {
    border-color: var(--primary, #2563eb);
}

.id-photo-preset.active {
    border-color: var(--primary, #2563eb);
    box-shadow: 0 0 0 1px var(--primary, #2563eb);
}

.id-photo-preset .preset-name {
    font-weight: 600;
    font-size: 0.95rem;
}

.id-photo-preset .preset-meta {
    font-size: 0.8rem;
    color: #64748b;
    margin-top: 0.2rem;
}

.id-photo-preset .preset-uses {
    font-size: 0.75rem;
    color: #94a3b8;
    margin-top: 0.35rem;
    line-height: 1.35;
}

.id-photo-bg-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
}

.id-photo-bg-swatch {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    border: 3px solid transparent;
    cursor: pointer;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
}

.id-photo-bg-swatch.active {
    border-color: var(--primary, #2563eb);
    outline: 2px solid rgba(37, 99, 235, 0.35);
}

.id-photo-bg-label {
    font-size: 0.85rem;
    color: #64748b;
}

.id-photo-bg-recommend {
    font-size: 0.85rem;
    color: #0f766e;
    margin: 0.35rem 0 0;
    line-height: 1.45;
}

.id-photo-bg-guide th,
.id-photo-bg-guide td {
    padding: 0.5rem 0.65rem;
    border-bottom: 1px solid #e2e8f0;
    vertical-align: top;
}

.id-photo-bg-guide th {
    background: #f8fafc;
}

.id-photo-options-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
}

.id-photo-editor .cropper-main {
    align-items: flex-start;
}

.id-photo-editor .cropper-sidebar {
    width: 220px;
}

.id-photo-editor .preview-section {
    text-align: center;
    background: none !important;
    background-image: none !important;
}

/* 构图预览：中性底，不展示证件照底色 */
.id-photo-preview-stage {
    position: relative;
    margin: 0 auto;
    box-sizing: border-box;
    border: 2px solid var(--color-border, #e2e8f0);
    border-radius: var(--radius-md, 8px);
    overflow: hidden;
    line-height: 0;
    box-shadow: var(--shadow-sm, 0 1px 3px rgba(0, 0, 0, 0.08));
    background-image: none !important;
}

.id-photo-preview-stage--compose {
    background-color: #e2e8f0;
    background-image:
        linear-gradient(45deg, #cbd5e1 25%, transparent 25%),
        linear-gradient(-45deg, #cbd5e1 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #cbd5e1 75%),
        linear-gradient(-45deg, transparent 75%, #cbd5e1 75%) !important;
    background-size: 12px 12px !important;
    background-position: 0 0, 0 6px, 6px -6px, -6px 0 !important;
}

.id-photo-preview-layer {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: fill;
}

.id-photo-preview-canvas {
    display: block;
}

.id-photo-preview-img {
    display: block;
}

/* hidden 必须压过 .id-photo-preview-canvas { display:block }，否则透明 canvas 会盖住 img */
.id-photo-preview-stage .id-photo-preview-canvas[hidden],
.id-photo-preview-stage .id-photo-preview-img[hidden] {
    display: none !important;
}

.id-photo-preview-status {
    font-size: 0.75rem;
    color: #64748b;
    margin: 0.45rem 0 0;
    min-height: 1.2em;
}

.id-photo-size-hint {
    font-size: 0.8rem;
    color: #64748b;
    text-align: center;
    margin-top: 0.5rem;
}

.id-photo-result-preview {
    max-width: 200px;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    margin-top: 0.75rem;
}

.id-photo-refine-hint {
    font-size: 0.85rem;
    color: #64748b;
    margin: 0.35rem 0 0.65rem;
    line-height: 1.45;
}

.id-photo-refine-viewport {
    max-width: min(100%, 520px);
    max-height: min(72vh, 640px);
    overflow: auto;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    background: #f8fafc;
    padding: 0.5rem;
}

.id-photo-refine-stage {
    position: relative;
    display: inline-block;
    line-height: 0;
    overflow: visible;
    touch-action: none;
}

.id-photo-refine-canvas {
    display: block;
    width: 360px;
    max-width: none;
    height: auto;
    cursor: none;
    user-select: none;
}

.id-photo-refine-cursor {
    position: absolute;
    box-sizing: border-box;
    border: 2px solid #ff2d55;
    box-shadow: 0 0 0 1px #fff, inset 0 0 0 1px #fff;
    border-radius: 50%;
    pointer-events: none;
    transform: translate(-50%, -50%);
    z-index: 2;
    background: rgba(255, 45, 85, 0.12);
}

.id-photo-refine-tools {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.65rem;
    margin-top: 0.65rem;
}

.id-photo-refine-brush {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    color: #475569;
}

.id-photo-layout .data-table th,
.id-photo-layout .data-table td {
    padding: 0.5rem 0.65rem;
    border-bottom: 1px solid #e2e8f0;
    text-align: left;
    vertical-align: top;
}

.id-photo-layout .data-table th {
    background: #f8fafc;
    font-weight: 600;
}

@media (max-width: 768px) {
    .id-photo-presets {
        max-height: 200px;
    }
}
