/* ═══════════════════════════════════════════════════════
   Fortimove Workbench — Dark Theme (Accordion Layout)
   ═══════════════════════════════════════════════════════ */

:root {
    --bg: #0d1117;
    --card: #161b22;
    --card-hover: #1c2128;
    --border: #30363d;
    --text: #c9d1d9;
    --text-muted: #8b949e;
    --brand: #e94560;
    --blue: #58a6ff;
    --green: #3fb950;
    --yellow: #d29922;
    --red: #da3633;
    --purple: #8957e5;
    --nav-bg: #1a1a2e;
    --sidebar-w: 220px;
    --cyan: #56d4e0;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { background: var(--bg); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; overflow: hidden; height: 100vh; }

/* ── Top Navigation ────────────────────────────────── */
.wb-nav {
    background: var(--nav-bg);
    height: 48px;
    display: flex;
    align-items: center;
    padding: 0 20px;
    gap: 8px;
    border-bottom: 1px solid var(--border);
    z-index: 100;
}
.wb-nav .brand { color: var(--brand); font-weight: 900; font-size: 1.1rem; text-decoration: none; margin-right: 16px; }
.wb-nav .nav-link { color: var(--text-muted); text-decoration: none; padding: 6px 12px; border-radius: 6px; font-size: 13px; }
.wb-nav .nav-link:hover { color: #fff; background: rgba(255,255,255,.08); }
.wb-nav .nav-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }

/* 최근 작업 드롭다운 */
.recent-dropdown { position: relative; }
.recent-btn { background: rgba(255,255,255,.06); border: 1px solid var(--border); color: var(--text); padding: 6px 14px; border-radius: 6px; cursor: pointer; font-size: 13px; }
.recent-btn:hover { background: rgba(255,255,255,.12); }
.recent-panel {
    display: none; position: absolute; top: 40px; right: 0;
    width: 400px; max-height: 480px; overflow-y: auto;
    background: var(--card); border: 1px solid var(--border); border-radius: 12px;
    box-shadow: 0 16px 48px rgba(0,0,0,.5); z-index: 200;
}
.recent-panel.open { display: block; }
.recent-panel .rp-title { padding: 14px 16px 8px; font-size: 12px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; }
.recent-item {
    display: flex; align-items: center; gap: 12px; padding: 10px 16px;
    cursor: pointer; border-bottom: 1px solid var(--border); transition: background .15s;
}
.recent-item:hover { background: var(--card-hover); }
.recent-item:last-child { border: none; }
.recent-item .ri-score { font-weight: 800; font-size: 1.1rem; min-width: 36px; text-align: center; }
.recent-item .ri-title { font-size: 13px; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px; }
.recent-item .ri-meta { font-size: 11px; color: var(--text-muted); }
.recent-item .ri-status { font-size: 11px; padding: 2px 8px; border-radius: 4px; font-weight: 600; }
.st-draft { background: rgba(139,148,158,.15); color: var(--text-muted); }
.st-under_review { background: rgba(88,166,255,.15); color: var(--blue); }
.st-approved_for_export { background: rgba(63,185,80,.15); color: var(--green); }
.st-hold { background: rgba(210,153,34,.15); color: var(--yellow); }
.st-rejected { background: rgba(218,54,51,.15); color: var(--red); }

/* ── Layout: Sidebar + Main scrolling area ───────── */
.wb-layout {
    display: flex;
    height: calc(100vh - 48px - 32px); /* nav + status bar */
}

/* ═══════════════════════════════════════════════════════
   PROGRESS SIDEBAR (fixed left timeline)
   ═══════════════════════════════════════════════════════ */
.progress-sidebar {
    width: var(--sidebar-w);
    background: var(--nav-bg);
    border-right: 1px solid var(--border);
    flex-shrink: 0;
    padding: 24px 16px;
    overflow-y: auto;
    position: sticky;
    top: 0;
}

.ps-title {
    font-size: 10px;
    font-weight: 800;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 24px;
    padding-left: 4px;
}

.ps-timeline {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.ps-step {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 8px;
    border-radius: 8px;
    cursor: pointer;
    transition: all .2s;
}
.ps-step:hover {
    background: rgba(255,255,255,.04);
}

.ps-dot {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 800;
    flex-shrink: 0;
    border: 2px solid var(--border);
    color: var(--text-muted);
    background: transparent;
    transition: all .25s;
}

.ps-info {
    flex: 1;
    min-width: 0;
}

.ps-step-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-muted);
    transition: color .2s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ps-step-status {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 2px;
    font-weight: 600;
}

.ps-connector {
    width: 2px;
    height: 20px;
    background: var(--border);
    margin-left: 23px; /* center under the dot */
    transition: background .25s;
}

/* Sidebar step states */
.ps-step.active .ps-dot {
    border-color: var(--brand);
    background: var(--brand);
    color: #fff;
    box-shadow: 0 0 12px rgba(233,69,96,.35);
}
.ps-step.active .ps-step-title { color: #fff; }
.ps-step.active .ps-step-status { color: var(--brand); }

.ps-step.completed .ps-dot {
    border-color: var(--green);
    background: var(--green);
    color: #fff;
}
.ps-step.completed .ps-step-title { color: var(--green); }
.ps-step.completed .ps-step-status { color: var(--green); }

.ps-step.pending {
    opacity: .45;
    cursor: default;
}

/* Connector between completed steps turns green */
.ps-step.completed + .ps-connector {
    background: var(--green);
}
.ps-step.active + .ps-connector {
    background: linear-gradient(to bottom, var(--brand), var(--border));
}

/* ═══════════════════════════════════════════════════════
   MAIN CONTENT — vertical accordion of step cards
   ═══════════════════════════════════════════════════════ */
.wb-main {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 24px 28px 80px;
    scroll-behavior: smooth;
}

/* ── Step Card (accordion item) ────────────────────── */
.step-card {
    border: 1px solid var(--border);
    border-radius: 14px;
    margin-bottom: 16px;
    background: var(--card);
    transition: all .3s ease;
    overflow: hidden;
}

/* Active: expanded, blue-left accent */
.step-card.active {
    border-left: 4px solid var(--brand);
    box-shadow: 0 4px 24px rgba(233,69,96,.08);
}
.step-card.active .step-content {
    display: block;
    animation: accordionOpen .3s ease-out;
}
.step-card.active .sh-chevron {
    transform: rotate(0deg);
}

/* Completed: collapsed, green-left accent */
.step-card.completed {
    border-left: 4px solid var(--green);
}
.step-card.completed .step-header {
    cursor: pointer;
}
.step-card.completed .sh-number {
    background: var(--green);
    border-color: var(--green);
    color: #fff;
}

/* Pending: collapsed, greyed out */
.step-card.pending {
    opacity: .45;
    border-left: 4px solid var(--border);
}
.step-card.pending .step-header {
    cursor: default;
}

/* Collapsed state (for completed + pending, or manual toggle) */
.step-card.collapsed .step-content {
    display: none;
}
.step-card.collapsed .sh-chevron {
    transform: rotate(-90deg);
}

@keyframes accordionOpen {
    from { opacity: 0; max-height: 0; }
    to   { opacity: 1; max-height: 5000px; }
}

/* ── Step Header (always visible) ──────────────────── */
.step-header {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    cursor: pointer;
    user-select: none;
    gap: 12px;
    transition: background .15s;
}
.step-header:hover {
    background: rgba(255,255,255,.02);
}

.sh-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.sh-number {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 800;
    border: 2px solid var(--border);
    color: var(--text-muted);
    background: transparent;
    flex-shrink: 0;
    transition: all .25s;
}

.step-card.active .sh-number {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
}

.sh-title {
    font-size: 15px;
    font-weight: 800;
    color: #fff;
    white-space: nowrap;
}

.sh-badge {
    font-size: 10px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 20px;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: .5px;
}
.badge-active {
    background: rgba(233,69,96,.15);
    color: var(--brand);
}
.badge-completed {
    background: rgba(63,185,80,.15);
    color: var(--green);
}
.badge-pending {
    background: rgba(139,148,158,.1);
    color: var(--text-muted);
}

.sh-summary {
    flex: 1;
    font-size: 13px;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.sh-chevron {
    font-size: 10px;
    color: var(--text-muted);
    transition: transform .25s;
    flex-shrink: 0;
}

/* ── Step Content (the actual content area) ────────── */
.step-content {
    display: none;
    padding: 0 24px 24px;
}

/* Override for editor panel — needs flex + no padding */
.step-content-editor {
    padding: 0 !important;
}
.step-card.active .step-content-editor {
    display: flex !important;
}

/* ── Status Bar ────────────────────────────────────── */
.wb-status {
    height: 32px;
    background: var(--nav-bg);
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 20px;
    font-size: 11px;
    color: var(--text-muted);
    gap: 16px;
}
.wb-status .status-dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; margin-right: 4px; }
.dot-ok { background: var(--green); } .dot-warn { background: var(--yellow); } .dot-err { background: var(--red); }

/* ═══════════════════════════════════════════════════════
   STEP 1: 소싱
   ═══════════════════════════════════════════════════════ */
.sourcing-hero {
    max-width: 680px;
    margin: 20px auto 0;
    text-align: center;
}
.sourcing-hero h2 { font-size: 1.6rem; font-weight: 900; color: #fff; margin-bottom: 8px; }
.sourcing-hero p { color: var(--text-muted); font-size: 14px; margin-bottom: 32px; }

.url-input-group {
    display: flex; gap: 8px; margin-bottom: 20px;
}
.url-input-group input {
    flex: 1; background: var(--bg); border: 2px solid var(--border);
    color: #fff; padding: 14px 18px; border-radius: 12px; font-size: 15px;
    transition: border-color .2s;
}
.url-input-group input:focus { outline: none; border-color: var(--brand); }
.url-input-group input::placeholder { color: var(--text-muted); }

.btn-analyze {
    background: var(--brand); border: none; color: #fff;
    padding: 14px 32px; border-radius: 12px; font-size: 15px;
    font-weight: 700; cursor: pointer; transition: all .2s; white-space: nowrap;
}
.btn-analyze:hover { background: #d63e57; transform: translateY(-1px); box-shadow: 0 4px 16px rgba(233,69,96,.3); }
.btn-analyze:disabled { opacity: .5; cursor: not-allowed; transform: none; }

.sourcing-fields {
    display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px;
    max-width: 680px; margin: 0 auto;
}
.sf-group label { font-size: 11px; color: var(--text-muted); font-weight: 600; display: block; margin-bottom: 4px; }
.sf-group select, .sf-group input {
    width: 100%; background: var(--bg); border: 1px solid var(--border);
    color: var(--text); padding: 8px 10px; border-radius: 8px; font-size: 13px;
}
.sf-group select:focus, .sf-group input:focus { outline: none; border-color: var(--blue); }

/* 프로그레스 */
.analysis-progress {
    display: none; max-width: 680px; margin: 40px auto 0; text-align: center;
}
.analysis-progress.active { display: block; }
.progress-bar-wrap {
    height: 4px; background: var(--border); border-radius: 2px; overflow: hidden; margin: 16px 0;
}
.progress-bar-fill {
    height: 100%; background: linear-gradient(90deg, var(--brand), var(--purple), var(--blue));
    border-radius: 2px; transition: width .5s; width: 0;
    background-size: 200% 100%; animation: shimmer 1.5s infinite;
}
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
.progress-step-text { font-size: 13px; color: var(--text-muted); }

/* ═══════════════════════════════════════════════════════
   STEP 2: 분석
   ═══════════════════════════════════════════════════════ */
.analysis-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    max-width: 960px;
    margin: 0 auto;
}
.analysis-grid .full-width { grid-column: 1 / -1; }

.a-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
}
.a-card-title {
    font-size: 11px; font-weight: 700; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 1px; margin-bottom: 12px;
}

/* 점수 카드 */
.score-display { display: flex; align-items: center; gap: 20px; }
.score-big { font-size: 3.5rem; font-weight: 900; line-height: 1; }
.score-bar { flex: 1; }
.score-bar-bg { height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; }
.score-bar-fill { height: 100%; border-radius: 4px; transition: width .5s; }
.score-label { font-size: 14px; font-weight: 700; margin-top: 6px; }

/* 마진 바 */
.margin-row { display: flex; align-items: center; gap: 12px; padding: 8px 0; }
.margin-row .m-label { font-size: 12px; color: var(--text-muted); min-width: 80px; }
.margin-row .m-value { font-size: 16px; font-weight: 800; color: #fff; }
.margin-row .m-arrow { color: var(--text-muted); }

/* 리스크 뱃지 */
.risk-badge {
    display: inline-block; padding: 4px 10px; border-radius: 6px;
    font-size: 12px; font-weight: 600; margin: 2px;
}
.risk-low { background: rgba(63,185,80,.15); color: var(--green); }
.risk-medium { background: rgba(210,153,34,.15); color: var(--yellow); }
.risk-high { background: rgba(218,54,51,.15); color: var(--red); }

/* 플랫폼 프리뷰 */
.platform-preview {
    background: var(--bg); border-radius: 8px; padding: 14px;
    border: 1px solid var(--border);
}
.platform-preview .pp-label { font-size: 11px; font-weight: 700; margin-bottom: 6px; }
.platform-preview .pp-title { font-size: 14px; color: #fff; font-weight: 600; }

/* 액션 바 */
.action-bar {
    display: flex; justify-content: center; gap: 12px;
    padding: 24px 0; max-width: 960px; margin: 0 auto;
}
.btn-action {
    padding: 12px 32px; border-radius: 10px; font-size: 14px;
    font-weight: 700; border: none; cursor: pointer; transition: all .2s;
}
.btn-action:hover { transform: translateY(-1px); }
.btn-approve { background: var(--green); color: #fff; }
.btn-approve:hover { box-shadow: 0 4px 16px rgba(63,185,80,.3); }
.btn-hold { background: var(--card); color: var(--yellow); border: 1px solid var(--yellow); }
.btn-reject { background: var(--card); color: var(--red); border: 1px solid var(--red); }

/* ═══════════════════════════════════════════════════════
   STEP 3: 편집
   ═══════════════════════════════════════════════════════ */
.edit-container { max-width: 960px; margin: 0 auto; }
.edit-tabs {
    display: flex; gap: 4px; border-bottom: 1px solid var(--border);
    margin-bottom: 20px; overflow-x: auto;
}
.edit-tab {
    padding: 10px 18px; font-size: 13px; font-weight: 600;
    color: var(--text-muted); cursor: pointer; border-bottom: 2px solid transparent;
    transition: all .2s; white-space: nowrap; background: none; border-top: none; border-left: none; border-right: none;
}
.edit-tab:hover { color: var(--text); }
.edit-tab.active { color: var(--brand); border-bottom-color: var(--brand); }

.tab-content { display: none; animation: fadeSlide .2s ease-out; }
.tab-content.active { display: block; }
@keyframes fadeSlide { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: translateX(0); } }

.field-group { margin-bottom: 16px; }
.field-group label {
    font-size: 12px; font-weight: 700; color: var(--text-muted);
    display: block; margin-bottom: 6px;
}
.field-group input, .field-group textarea, .field-group select {
    width: 100%; background: var(--bg); border: 1px solid var(--border);
    color: var(--text); padding: 10px 14px; border-radius: 8px; font-size: 13px;
    font-family: inherit; resize: vertical;
}
.field-group input:focus, .field-group textarea:focus { outline: none; border-color: var(--blue); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.edit-footer {
    display: flex; justify-content: space-between; align-items: center;
    padding: 20px 0; border-top: 1px solid var(--border); margin-top: 20px;
}
.autosave-indicator { font-size: 11px; color: var(--text-muted); }
.btn-next {
    background: var(--brand); color: #fff; border: none;
    padding: 12px 28px; border-radius: 10px; font-size: 14px;
    font-weight: 700; cursor: pointer; transition: all .2s;
}
.btn-next:hover { background: #d63e57; }
.btn-next:disabled { opacity: .5; cursor: not-allowed; }

.btn-secondary-wb {
    background: var(--card); color: var(--text); border: 1px solid var(--border);
    padding: 10px 20px; border-radius: 8px; font-size: 13px;
    cursor: pointer; transition: all .2s;
}
.btn-secondary-wb:hover { background: var(--card-hover); border-color: var(--text-muted); }

/* ═══════════════════════════════════════════════════════
   STEP 4: 에디터
   ═══════════════════════════════════════════════════════ */
.editor-wrap {
    display: flex;
    flex: 1;
    height: calc(100vh - 300px); /* fit within the card */
    min-height: 500px;
}

.editor-wrap .ed-sidebar-left {
    width: 90px; background: #222; border-right: 1px solid #333;
    overflow-y: auto; padding: 6px; flex-shrink: 0;
}
.editor-wrap .ed-main { flex: 1; display: flex; flex-direction: column; }
.editor-wrap .ed-toolbar {
    height: 44px; background: #2a2a2a; border-bottom: 1px solid #333;
    display: flex; align-items: center; padding: 0 12px; gap: 6px;
}
.editor-wrap .ed-canvas-wrap {
    flex: 1; overflow: auto; display: flex;
    align-items: center; justify-content: center; background: #111; position: relative;
}
.editor-wrap .ed-sidebar-right {
    width: 260px; background: #222; border-left: 1px solid #333;
    overflow-y: auto; padding: 10px; flex-shrink: 0;
}

/* 에디터 내부 컴포넌트 */
.ed-tb { background: #444; border: 1px solid #555; color: #ddd; padding: 4px 10px; border-radius: 4px; cursor: pointer; font-size: 11px; }
.ed-tb:hover { background: #555; }
.ed-tb.active { background: #4a90d9; border-color: #4a90d9; color: #fff; }
.ed-tb-sep { width: 1px; height: 20px; background: #444; margin: 0 2px; }

.ed-thumb { width: 76px; height: 56px; margin-bottom: 4px; cursor: pointer; border: 2px solid transparent; border-radius: 4px; overflow: hidden; position: relative; }
.ed-thumb img { width: 100%; height: 100%; object-fit: cover; }
.ed-thumb.active { border-color: #4a90d9; }
.ed-thumb span { position: absolute; bottom: 0; left: 0; right: 0; background: rgba(0,0,0,.7); font-size: 8px; text-align: center; color: #fff; }

.ed-container { position: relative; display: inline-block; }
.ed-container img { display: block; max-width: 90vw; max-height: calc(100vh - 350px); }

/* 텍스트 레이어 */
.ed-text-layer {
    position: absolute; cursor: move; padding: 6px 10px;
    border: 2px solid transparent; border-radius: 4px;
    user-select: none; min-width: 40px; min-height: 20px;
    transition: border-color .15s;
}
.ed-text-layer:hover { border-color: rgba(74,144,217,.6); }
.ed-text-layer.selected { border-color: #4a90d9; }
.ed-text-layer .resize-handle {
    position: absolute; bottom: -4px; right: -4px; width: 10px; height: 10px;
    background: #4a90d9; border-radius: 2px; cursor: nwse-resize; display: none;
}
.ed-text-layer.selected .resize-handle { display: block; }
.ed-text-layer .delete-btn {
    position: absolute; top: -10px; right: -10px; width: 20px; height: 20px;
    background: #d63031; color: #fff; border: none; border-radius: 50%;
    font-size: 12px; cursor: pointer; display: none; line-height: 20px; text-align: center;
}
.ed-text-layer.selected .delete-btn { display: block; }

/* 에디터 패널 */
.ed-panel { margin-bottom: 14px; }
.ed-panel-title { font-size: 10px; font-weight: 600; color: #888; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 6px; }
.ed-panel-btn { width: 100%; background: #333; border: 1px solid #444; color: #ddd; padding: 7px; border-radius: 4px; cursor: pointer; font-size: 11px; margin-bottom: 4px; text-align: left; }
.ed-panel-btn:hover { background: #444; }
.ed-panel-input { width: 100%; background: #333; border: 1px solid #444; color: #ddd; padding: 5px 7px; border-radius: 4px; font-size: 11px; margin-bottom: 4px; }
.ed-panel-row { display: flex; gap: 4px; margin-bottom: 4px; }
.ed-panel-row > * { flex: 1; }

/* ═══════════════════════════════════════════════════════
   STEP 5: 완료
   ═══════════════════════════════════════════════════════ */
.complete-hero {
    max-width: 560px; margin: 40px auto 0; text-align: center;
}
.complete-hero .check-icon {
    width: 80px; height: 80px; border-radius: 50%; background: rgba(63,185,80,.15);
    display: flex; align-items: center; justify-content: center;
    font-size: 2.5rem; margin: 0 auto 24px;
}
.complete-hero h2 { font-size: 1.5rem; font-weight: 900; color: #fff; margin-bottom: 8px; }
.complete-hero p { color: var(--text-muted); font-size: 14px; margin-bottom: 32px; }
.complete-summary {
    display: flex; justify-content: center; gap: 24px; margin-bottom: 32px;
}
.complete-summary .cs-item { text-align: center; }
.complete-summary .cs-value { font-size: 1.2rem; font-weight: 800; color: #fff; }
.complete-summary .cs-label { font-size: 11px; color: var(--text-muted); }

.download-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 24px;
}
.dl-card {
    background: var(--bg); border: 1px solid var(--border); border-radius: 12px;
    padding: 20px; text-align: center; cursor: pointer; transition: all .2s;
    text-decoration: none; color: var(--text);
}
.dl-card:hover { background: var(--card-hover); border-color: var(--text-muted); transform: translateY(-2px); }
.dl-card .dl-icon { font-size: 2rem; margin-bottom: 8px; }
.dl-card .dl-title { font-size: 14px; font-weight: 700; color: #fff; }
.dl-card .dl-desc { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

.btn-new-product {
    background: transparent; border: 2px solid var(--brand); color: var(--brand);
    padding: 12px 32px; border-radius: 10px; font-size: 14px;
    font-weight: 700; cursor: pointer; transition: all .2s;
}
.btn-new-product:hover { background: var(--brand); color: #fff; }

/* ═══════════════════════════════════════════════════════
   공통 유틸
   ═══════════════════════════════════════════════════════ */
.loading-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(13,17,23,.85); z-index: 500;
    display: none; align-items: center; justify-content: center; flex-direction: column;
}
.loading-overlay.show { display: flex; }
.wb-spinner { width: 36px; height: 36px; border: 3px solid var(--border); border-top: 3px solid var(--brand); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text { margin-top: 12px; color: var(--text-muted); font-size: 13px; }

.wb-toast {
    position: fixed; bottom: 20px; right: 20px;
    background: var(--card); border: 1px solid var(--border); color: var(--text);
    padding: 10px 20px; border-radius: 10px; z-index: 9999;
    display: none; font-size: 13px; box-shadow: 0 8px 32px rgba(0,0,0,.3);
}
.wb-toast.show { display: block; animation: toastIn .3s ease-out; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* ═══════════════════════════════════════════════════════
   A4/A1: 처리량 배너 — Step 1 상단 가로 전체
   ═══════════════════════════════════════════════════════ */
.throughput-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    background: linear-gradient(135deg, #161b22 0%, #1a1f2e 100%);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 18px 28px;
    margin-bottom: 20px;
    cursor: pointer;
    transition: border-color .2s;
    flex-wrap: wrap;
}
.throughput-banner:hover { border-color: var(--brand); }

.tb-stats {
    display: flex;
    align-items: center;
    gap: 24px;
}
.tb-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 70px;
}
.tb-num {
    font-size: 2.2rem;
    font-weight: 900;
    color: #fff;
    line-height: 1;
}
.tb-num.pending { color: #f39c12; }
.tb-label {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 700;
    margin-top: 4px;
}
.tb-delta {
    font-size: 11px;
    font-weight: 700;
    margin-top: 3px;
    min-height: 14px;
}
.tb-delta.up { color: #3fb950; }
.tb-delta.down { color: #ff6b6b; }
.tb-delta.flat { color: var(--text-muted); }
.tb-sep {
    width: 1px;
    height: 44px;
    background: var(--border);
}

.tb-right {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}
.tb-spark {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    height: 36px;
}
.tb-spark .bar {
    width: 8px;
    background: var(--brand);
    border-radius: 2px;
    min-height: 3px;
    opacity: .7;
}
.tb-spark .bar.today {
    opacity: 1;
    background: #3fb950;
}
.tb-stages {
    display: flex;
    flex-direction: column;
    gap: 3px;
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 600;
}
.tb-stages .stage { white-space: nowrap; }
.tb-stages .stage.bottleneck { color: #f39c12; font-weight: 800; }
.tb-stages .stage.bottleneck::before { content: "⚠ "; }

/* A2: 단일/벌크 모드 토글 + 벌크 입력 */
.src-mode-toggle {
    display: inline-flex;
    gap: 4px;
    margin-bottom: 14px;
    padding: 4px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 10px;
}
.src-mode-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 7px 16px;
    border-radius: 7px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 700;
    transition: all .2s;
}
.src-mode-btn.active {
    background: var(--brand);
    color: #fff;
}
.url-input-group.bulk textarea {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 12px 14px;
    border-radius: 10px;
    font-size: 13px;
    font-family: monospace;
    resize: vertical;
    line-height: 1.5;
}
.url-input-group.bulk textarea:focus {
    outline: none;
    border-color: var(--brand);
}
.bulk-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-bottom: 1px solid var(--border);
    font-size: 12px;
}
.bulk-item:last-child { border-bottom: none; }
.bulk-item .bi-idx { color: var(--text-muted); font-weight: 700; min-width: 24px; }
.bulk-item .bi-url { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); font-family: monospace; font-size: 11px; }
.bulk-item .bi-status { font-size: 11px; font-weight: 700; white-space: nowrap; }
.bulk-item .bi-status.waiting { color: var(--text-muted); }
.bulk-item .bi-status.running { color: #58a6ff; }
.bulk-item .bi-status.done { color: #3fb950; }
.bulk-item .bi-status.fail { color: #ff6b6b; }

/* ═══════════════════════════════════════════════════════
   A3: 빠른 승인 모드 오버레이
   ═══════════════════════════════════════════════════════ */
.quick-approval-btn {
    background: linear-gradient(135deg, #f39c12, #e94560);
    border: none;
    color: #fff;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 800;
    margin-right: 8px;
    white-space: nowrap;
    transition: transform .2s, box-shadow .2s;
}
.quick-approval-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(233,69,96,.3);
}

.quick-approval-overlay {
    position: fixed;
    inset: 0;
    background: rgba(13,17,23,.92);
    backdrop-filter: blur(10px);
    z-index: 9000;
    display: none;
    flex-direction: column;
}
.quick-approval-overlay.active { display: flex; }

.qa-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 40px;
    background: var(--card);
    border-bottom: 1px solid var(--border);
    gap: 16px;
    flex-wrap: wrap;
}
.qa-title { font-size: 1.3rem; font-weight: 900; color: var(--text); }
.qa-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.qa-keys-help {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    font-size: 11px;
    color: var(--text-muted);
    align-items: center;
}
.qa-key {
    display: inline-block;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 2px 8px;
    margin-right: 3px;
    font-family: monospace;
    font-weight: 700;
    color: var(--text);
}
.qa-close {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
}
.qa-close:hover { color: var(--text); border-color: var(--text); }

.qa-stack {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    overflow: hidden;
    position: relative;
}
.qa-empty {
    color: var(--text-muted);
    font-size: 15px;
    text-align: center;
}
.qa-card {
    background: var(--card);
    border: 2px solid var(--border);
    border-radius: 20px;
    width: min(720px, 90%);
    max-height: 75vh;
    overflow-y: auto;
    padding: 32px;
    box-shadow: 0 24px 80px rgba(0,0,0,.5);
    transition: transform .3s, opacity .3s;
}
.qa-card.swipe-right { transform: translateX(400px) rotate(8deg); opacity: 0; }
.qa-card.swipe-left  { transform: translateX(-400px) rotate(-8deg); opacity: 0; }
.qa-card.swipe-up    { transform: translateY(-200px); opacity: 0; }
.qa-card.swipe-down  { transform: translateY(100px); opacity: 0; }

.qa-card-top {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.qa-score-big {
    font-size: 3.2rem;
    font-weight: 900;
    line-height: 1;
    min-width: 100px;
    text-align: center;
    padding: 14px 10px;
    border-radius: 14px;
    background: var(--bg);
}
.qa-score-big.high { color: #3fb950; border: 2px solid #3fb950; }
.qa-score-big.mid  { color: #f39c12; border: 2px solid #f39c12; }
.qa-score-big.low  { color: #ff6b6b; border: 2px solid #ff6b6b; }
.qa-card-meta { flex: 1; min-width: 200px; }
.qa-card-title {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--text);
    line-height: 1.35;
    margin-bottom: 6px;
}
.qa-card-sub { font-size: 12px; color: var(--text-muted); }
.qa-card-price {
    font-size: 1.4rem;
    font-weight: 900;
    color: var(--brand);
    margin-top: 8px;
}

.qa-card-section {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}
.qa-card-section-title {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 700;
    margin-bottom: 8px;
}
.qa-risk-list { display: flex; flex-wrap: wrap; gap: 6px; }
.qa-risk {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
}
.qa-risk.red    { background: rgba(255,107,107,.12); color: #ff6b6b; }
.qa-risk.yellow { background: rgba(243,156,18,.12);  color: #f39c12; }
.qa-risk.green  { background: rgba(63,185,80,.12);   color: #3fb950; }

.qa-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 20px;
    background: var(--card);
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
}
.qa-action {
    padding: 10px 24px;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    font-size: 13px;
    font-weight: 800;
    transition: transform .15s;
}
.qa-action:hover { transform: translateY(-1px); }
.qa-action.approve { background: #3fb950; color: #fff; }
.qa-action.hold    { background: #f39c12; color: #fff; }
.qa-action.reject  { background: #ff6b6b; color: #fff; }
.qa-action.skip    { background: var(--bg); color: var(--text); border: 1px solid var(--border); }
.qa-action.detail  { background: var(--brand); color: #fff; }

/* ═══════════════════════════════════════════════════════
   Responsive: narrow screens
   ═══════════════════════════════════════════════════════ */
@media (max-width: 900px) {
    .progress-sidebar {
        width: 60px;
        padding: 16px 6px;
    }
    .ps-title { display: none; }
    .ps-info { display: none; }
    .ps-step { justify-content: center; padding: 8px 0; }
    .ps-connector { margin-left: 22px; }
    .wb-main { padding: 16px 12px 60px; }
    .sourcing-fields { grid-template-columns: 1fr 1fr; }
}
