/* ── FM Plan Viewer ─────────────────────────────────────────────────────── */
body.fm-pv-open { overflow: hidden; }

.fm-pv-overlay {
    position: fixed;
    inset: 0;
    z-index: 100050;
    background: rgba(15, 23, 42, .72);
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.fm-pv-overlay *,
.fm-pv-overlay *::before,
.fm-pv-overlay *::after { box-sizing: border-box; }

.fm-pv-dialog {
    background: #fff;
    border-radius: 14px;
    width: min(1200px, 100%);
    height: min(860px, 100%);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 24px 60px rgba(0, 0, 0, .3);
}

.fm-pv-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px 12px 18px;
    border-bottom: 1px solid #e2e8f0;
}

.fm-pv-titles { min-width: 0; }
.fm-pv-title { font-size: 16px; font-weight: 700; color: #1b3a5c; line-height: 1.3; }
.fm-pv-sub { font-size: 13px; color: #64748b; margin-top: 2px; }
.fm-pv-sub:empty { display: none; }

.fm-pv-tools { display: flex; gap: 6px; flex-shrink: 0; }

.fm-pv-overlay .fm-pv-btn {
    width: 36px;
    height: 36px;
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 1px solid #dbe2ea;
    border-radius: 8px;
    background: #fff;
    color: #334155;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: none;
}
.fm-pv-overlay .fm-pv-btn:hover { background: #f1f5f9; }
.fm-pv-overlay .fm-pv-close { font-size: 24px; }

.fm-pv-stage {
    position: relative;
    flex: 1;
    min-height: 0;
    background: #eef1f5;
    overflow: hidden;
    touch-action: none;
}
.fm-pv-stage .canvas-container { position: absolute !important; inset: 0; }

.fm-pv-status {
    display: none;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 10px 16px;
    font-size: 14px;
    color: #475569;
    box-shadow: 0 6px 20px rgba(15, 23, 42, .12);
    z-index: 5;
    max-width: 90%;
    text-align: center;
}

.fm-pv-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    padding: 10px 18px;
    border-top: 1px solid #e2e8f0;
    font-size: 12.5px;
    color: #64748b;
}
.fm-pv-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.fm-pv-pick-info { font-weight: 600; color: #334155; }

.fm-pv-overlay .fm-pv-use {
    margin: 0;
    padding: 8px 16px;
    border-radius: 8px;
    border: 1px solid #4f46e5;
    background: #4f46e5;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    width: auto;
}
.fm-pv-overlay .fm-pv-use:disabled { opacity: .45; cursor: default; }

@media (max-width: 600px) {
    .fm-pv-overlay { padding: 0; }
    .fm-pv-dialog { border-radius: 0; height: 100%; }
    .fm-pv-title { font-size: 14px; }
    .fm-pv-overlay .fm-pv-btn { width: 34px; height: 34px; }
}
