/* 셀러 홈 흐름판 · 상단 상태바 · 할 일함 · 상품 드로어 (mobile-first, 375px 기준) */

/* ---------- 공용 톤 ---------- */
.ssb, .sfb, .sti, .spd {
    --sb-ok: #16a34a;
    --sb-ok-soft: #ecfdf3;
    --sb-warn: #d97706;
    --sb-warn-soft: #fff7ed;
    --sb-danger: #dc2626;
    --sb-danger-soft: #fef2f2;
    --sb-wait: #2563eb;
    --sb-wait-soft: #eff6ff;
    --sb-neutral: #6b7280;
    --sb-neutral-soft: #f3f4f6;
    --sb-line: var(--line, #e5e7eb);
    --sb-ink: var(--ink, #111827);
    --sb-muted: var(--muted, #6b7280);
    --sb-surface: var(--surface, #ffffff);
    --sb-focus: var(--focus-ring, rgba(15,118,110,.18));
    --sb-touch: 44px;
    color: var(--sb-ink);
}
.ssb button:focus-visible, .sfb button:focus-visible, .sti button:focus-visible, .spd button:focus-visible,
.sfb .sfb-card:focus-visible, .spd .spd-title:focus-visible, .ssb .ssb-popover-title:focus-visible {
    outline: 3px solid var(--sb-focus);
    outline-offset: 2px;
    box-shadow: 0 0 0 2px var(--primary, #0f766e);
}
.ssb [hidden], .sfb [hidden], .sti [hidden], .spd [hidden] { display: none !important; }

/* ---------- 상단 상태바 ---------- */
.ssb {
    position: sticky;
    top: var(--topbar-height, 64px);
    z-index: 45;
    background: rgba(255,255,255,.94);
    border-bottom: 1px solid rgba(229,231,235,.9);
    backdrop-filter: blur(12px);
    padding: 8px 16px;
}
.ssb-strip {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 2px;
}
.ssb-strip::-webkit-scrollbar { display: none; }
.ssb-chip {
    flex: 0 0 auto;
    scroll-snap-align: start;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: var(--sb-touch);
    padding: 6px 12px;
    border: 1px solid var(--sb-line);
    border-radius: 999px;
    background: var(--sb-surface);
    color: var(--sb-ink);
    font-size: 13px;
    font-weight: 700;
    line-height: 1.2;
    cursor: pointer;
    white-space: nowrap;
}
.ssb-chip[aria-expanded="true"] { border-color: var(--primary, #0f766e); background: var(--primary-soft, #e6fffb); }
.ssb-chip-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--sb-neutral); flex: 0 0 auto; }
.ssb-chip[data-tone="ok"] .ssb-chip-dot { background: var(--sb-ok); }
.ssb-chip[data-tone="warn"] .ssb-chip-dot { background: var(--sb-warn); }
.ssb-chip[data-tone="danger"] .ssb-chip-dot { background: var(--sb-danger); }
.ssb-chip[data-tone="off"] .ssb-chip-dot { background: #cbd5e1; }
.ssb-chip-sub { font-size: 11px; font-weight: 600; color: var(--sb-muted); }
.ssb-popover {
    position: absolute;
    left: 16px;
    right: 16px;
    top: calc(100% + 6px);
    max-width: 480px;
    background: var(--sb-surface);
    border: 1px solid var(--sb-line);
    border-radius: 12px;
    box-shadow: var(--shadow-md, 0 12px 30px rgba(17,24,39,.12));
    padding: 14px 16px 16px;
    z-index: 46;
}
.ssb-popover-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.ssb-popover-title { font-size: 15px; font-weight: 800; margin: 0; line-height: 1.35; }
.ssb-popover-close { min-height: 36px; }
.ssb-popover-desc { font-size: 13px; color: var(--sb-muted); margin: 8px 0 0; line-height: 1.5; }
.ssb-list { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 6px; }
.ssb-list-item {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 8px 10px; border-radius: 8px; background: var(--sb-neutral-soft); font-size: 13px;
}
.ssb-list-item.is-muted { color: var(--sb-muted); justify-content: flex-start; }
.ssb-list-item.tone-ok { background: var(--sb-ok-soft); }
.ssb-list-item.tone-warn { background: var(--sb-warn-soft); }
.ssb-list-item.tone-wait { background: var(--sb-wait-soft); }
.ssb-list-item.tone-off { background: #f8fafc; color: var(--sb-muted); }
.ssb-list-item.tone-muted { color: var(--sb-muted); }
.ssb-list-market { font-weight: 700; }
.ssb-list-state { color: var(--sb-ink); text-align: right; }
.ssb-blocker-item { flex-direction: column; align-items: stretch; gap: 6px; }
.ssb-blocker-item.is-waiting { background: var(--sb-wait-soft); border-left: 3px solid var(--sb-wait); }
.ssb-blocker-sentence { font-weight: 700; line-height: 1.4; }
.ssb-blocker-note { font-size: 12px; color: var(--sb-muted); line-height: 1.4; }
.ssb-blocker-item .btn { align-self: flex-start; min-height: 36px; }
.ssb-popover-actions { margin-top: 14px; display: flex; justify-content: flex-end; }
.ssb-primary { min-height: var(--sb-touch); padding-left: 18px; padding-right: 18px; }

/* ---------- 흐름판 ---------- */
.sfb {
    background: rgba(255,255,255,.94);
    border: 1px solid rgba(229,231,235,.9);
    border-radius: 8px;
    box-shadow: var(--shadow-sm, 0 1px 2px rgba(17,24,39,.06));
    padding: 16px;
    margin-bottom: 24px;
}
.sfb-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.sfb-title { font-size: 15px; font-weight: 850; margin: 0; }
.sfb-meta { font-size: 12px; color: var(--sb-muted); margin: 4px 0 0; }
.sfb-refresh { min-height: 36px; white-space: nowrap; }
.sfb-tabs {
    display: flex; gap: 6px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none;
    margin: 0 -16px 12px; padding: 0 16px 4px;
}
.sfb-tabs::-webkit-scrollbar { display: none; }
.sfb-tab {
    flex: 0 0 auto; scroll-snap-align: start; display: inline-flex; align-items: center; gap: 6px;
    min-height: var(--sb-touch); padding: 6px 12px; border-radius: 999px; border: 1px solid var(--sb-line);
    background: var(--sb-surface); font-size: 13px; font-weight: 700; color: var(--sb-ink); cursor: pointer;
}
.sfb-tab.is-active { background: var(--sb-ink); color: #fff; border-color: var(--sb-ink); }
.sfb-tab-count { font-size: 12px; font-weight: 800; opacity: .8; }
.sfb-columns { display: grid; gap: 12px; }
.sfb-col { display: none; min-width: 0; }
.sfb-col.is-active { display: block; }
.sfb-col-head {
    display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%;
    min-height: var(--sb-touch); padding: 8px 10px; border: 0; border-bottom: 2px solid var(--sb-line);
    background: transparent; font-size: 13px; font-weight: 800; color: var(--sb-ink); text-align: left; cursor: pointer;
}
.sfb-col-head.is-static { cursor: default; }
.sfb-col-count {
    display: inline-flex; align-items: center; justify-content: center; min-width: 24px; height: 22px;
    padding: 0 8px; border-radius: 999px; background: var(--sb-neutral-soft); font-size: 12px; font-weight: 800;
}
.sfb-col[data-column="problem"] .sfb-col-head { border-bottom-color: var(--sb-danger); }
.sfb-col[data-column="requested"] .sfb-col-head { border-bottom-color: var(--sb-wait); }
.sfb-col[data-column="selling"] .sfb-col-head { border-bottom-color: var(--sb-ok); }
.sfb-col[data-column="review"] .sfb-col-head { border-bottom-color: var(--sb-warn); }
.sfb-col-note { font-size: 12px; color: var(--sb-muted); margin: 8px 0 0; line-height: 1.4; }
.sfb-col-link { padding: 6px 0; min-height: 36px; font-size: 12px; text-decoration: none; }
.sfb-cards { display: grid; gap: 10px; margin-top: 10px; }
.sfb-card {
    display: grid; grid-template-columns: 56px 1fr; gap: 10px 12px; padding: 12px; border-radius: 10px;
    border: 1px solid var(--sb-line); background: var(--sb-surface); cursor: default;
}
.sfb-card.tone-danger { border-color: rgba(220,38,38,.35); background: #fffafa; }
.sfb-card.tone-wait { border-color: rgba(37,99,235,.3); }
.sfb-thumb { width: 56px; height: 56px; border-radius: 8px; overflow: hidden; background: var(--sb-neutral-soft); display: flex; align-items: center; justify-content: center; }
.sfb-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sfb-thumb-empty { font-size: 10px; color: var(--sb-muted); }
.sfb-card-body { min-width: 0; }
.sfb-card-title { font-size: 13px; font-weight: 750; line-height: 1.35; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.sfb-card-price { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 13px; margin-top: 4px; }
.sfb-cost { color: var(--sb-muted); }
.sfb-arrow { color: var(--sb-muted); }
.sfb-price { font-weight: 800; color: var(--accent, #2563eb); }
.sfb-price.is-missing { color: var(--sb-warn); font-weight: 700; }
.sfb-card-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.sfb-dot { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; color: var(--sb-muted); }
.sfb-dot::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--sb-neutral); }
.sfb-dot.tone-ok::before { background: var(--sb-ok); }
.sfb-dot.tone-danger::before { background: var(--sb-danger); }
.sfb-chip { display: inline-flex; align-items: center; padding: 1px 8px; border-radius: 999px; background: var(--sb-neutral-soft); font-size: 11px; font-weight: 700; color: var(--sb-ink); }
.sfb-chip-market { background: var(--sb-wait-soft); color: var(--sb-wait); }
.sfb-card-stage { margin-top: 6px; font-size: 12px; font-weight: 700; color: var(--sb-muted); line-height: 1.4; }
.sfb-card-stage.tone-ok { color: var(--sb-ok); }
.sfb-card-stage.tone-warn { color: var(--sb-warn); }
.sfb-card-stage.tone-danger { color: var(--sb-danger); }
.sfb-card-stage.tone-wait { color: var(--sb-wait); }
.sfb-card-blocker { margin-top: 4px; font-size: 12px; color: var(--sb-danger); line-height: 1.4; }
.sfb-card-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.sfb-card-primary { display: inline-flex; }
.sfb-card-actions .btn, .sfb-card-primary .btn { min-height: var(--sb-touch); font-size: 13px; padding: 8px 14px; border-radius: 8px; margin: 0 !important; }
.sfb-empty { padding: 20px 12px; border: 1px dashed var(--sb-line); border-radius: 10px; text-align: center; color: var(--sb-muted); font-size: 13px; }
.sfb-empty p { margin: 0 0 10px; line-height: 1.5; }
.sfb-empty .btn, .sfb-more { min-height: var(--sb-touch); }

/* ---------- 할 일함 ---------- */
.sti {
    background: rgba(255,255,255,.94);
    border: 1px solid rgba(229,231,235,.9);
    border-radius: 8px;
    box-shadow: var(--shadow-sm, 0 1px 2px rgba(17,24,39,.06));
    padding: 16px;
    margin-bottom: 24px;
}
.sti-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.sti-title { font-size: 15px; font-weight: 850; margin: 0; }
.sti-count { font-size: 12px; color: var(--sb-muted); font-weight: 700; }
.sti-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.sti-item {
    display: grid; grid-template-columns: 20px 1fr; gap: 6px 10px; align-items: start;
    padding: 12px; border-radius: 10px; background: var(--sb-neutral-soft); font-size: 13px; line-height: 1.5;
}
.sti-item.kind-problem { background: var(--sb-danger-soft); }
.sti-item.kind-now { background: var(--sb-warn-soft); }
.sti-item.kind-waiting { background: var(--sb-wait-soft); }
.sti-item.is-empty { grid-template-columns: 1fr; color: var(--sb-muted); }
.sti-icon { font-size: 13px; font-weight: 900; line-height: 1.5; text-align: center; }
.sti-item.kind-problem .sti-icon { color: var(--sb-danger); }
.sti-item.kind-now .sti-icon { color: var(--sb-warn); }
.sti-item.kind-waiting .sti-icon { color: var(--sb-wait); }
.sti-item.kind-info .sti-icon { color: var(--sb-neutral); }
.sti-sentence { min-width: 0; }
.sti-action { grid-column: 2; justify-self: start; min-height: var(--sb-touch); font-size: 13px; padding: 8px 14px; border-radius: 8px; }

/* ---------- 상품 드로어 (375px: 전폭 바텀시트) ---------- */
.spd {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    background: var(--sb-surface);
    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
    box-shadow: 0 -12px 40px rgba(17,24,39,.18);
    z-index: 1045;
    overflow: hidden;
}
body.seller-drawer-open { overflow: hidden; }
.spd-head { display: grid; grid-template-columns: 56px 1fr auto; gap: 12px; align-items: start; padding: 16px 16px 12px; border-bottom: 1px solid var(--sb-line); }
.spd-thumb { width: 56px; height: 56px; border-radius: 8px; overflow: hidden; background: var(--sb-neutral-soft); display: flex; align-items: center; justify-content: center; }
.spd-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.spd-thumb-empty { font-size: 10px; color: var(--sb-muted); }
.spd-heading { min-width: 0; }
.spd-title { font-size: 15px; font-weight: 850; margin: 0; line-height: 1.35; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.spd-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.spd-badge { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 999px; background: var(--sb-neutral-soft); font-size: 11px; font-weight: 700; }
.spd-badge.prep-ready { background: var(--sb-ok-soft); color: var(--sb-ok); }
.spd-badge.prep-needs_review { background: var(--sb-warn-soft); color: var(--sb-warn); }
.spd-badge.prep-uploaded { background: var(--sb-wait-soft); color: var(--sb-wait); }
.spd-badge.market { background: var(--sb-wait-soft); color: var(--sb-wait); }
.spd-badge.account { background: #f1f5f9; color: var(--sb-ink); }
.spd-badge.tone-ok { background: var(--sb-ok-soft); color: var(--sb-ok); }
.spd-badge.tone-wait { background: var(--sb-wait-soft); color: var(--sb-wait); }
.spd-badge.tone-danger { background: var(--sb-danger-soft); color: var(--sb-danger); }
.spd-stage { margin-top: 6px; font-size: 12px; font-weight: 700; color: var(--sb-muted); }
.spd-stage-text.tone-ok { color: var(--sb-ok); }
.spd-stage-text.tone-warn { color: var(--sb-warn); }
.spd-stage-text.tone-danger { color: var(--sb-danger); }
.spd-stage-text.tone-wait { color: var(--sb-wait); }
.spd-close { min-height: 40px; }
.spd-tabs { display: flex; gap: 4px; padding: 8px 16px 0; border-bottom: 1px solid var(--sb-line); }
.spd-tab {
    flex: 1 1 0; min-height: var(--sb-touch); border: 0; border-bottom: 3px solid transparent; background: transparent;
    font-size: 13px; font-weight: 750; color: var(--sb-muted); cursor: pointer; padding: 8px 6px;
}
.spd-tab.is-active { color: var(--sb-ink); border-bottom-color: var(--primary, #0f766e); }
.spd-panel { padding: 16px; overflow-y: auto; flex: 1 1 auto; min-height: 0; }
.spd-tech-slot { padding: 0 16px 12px; }
.spd-lead { font-size: 13px; font-weight: 700; margin: 0 0 10px; line-height: 1.5; }
.spd-done { font-size: 13px; font-weight: 700; color: var(--sb-ok); margin: 0 0 10px; line-height: 1.5; }
.spd-muted { font-size: 12px; color: var(--sb-muted); margin: 8px 0 0; line-height: 1.5; }
.spd-checklist, .spd-warning-list, .spd-log-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.spd-check-item { display: grid; gap: 8px; padding: 10px 12px; border-radius: 10px; background: var(--sb-warn-soft); font-size: 13px; line-height: 1.5; }
.spd-check-item .btn { justify-self: start; min-height: 36px; }
.spd-warnings { margin-top: 12px; font-size: 12px; color: var(--sb-muted); }
.spd-warnings summary { cursor: pointer; font-weight: 700; min-height: 32px; display: flex; align-items: center; }
.spd-warning-list { margin-top: 6px; gap: 4px; }
.spd-actions { margin-top: 16px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.spd-actions .btn { min-height: var(--sb-touch); }
.spd-actions .spd-muted { flex-basis: 100%; margin: 0; }
.spd-link { padding-left: 0; text-decoration: none; }
.spd-stepper { list-style: none; margin: 0 0 12px; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; counter-reset: step; }
.spd-step { position: relative; text-align: center; font-size: 12px; font-weight: 700; color: var(--sb-muted); padding-top: 22px; }
.spd-step::before { content: ''; position: absolute; top: 4px; left: 50%; transform: translateX(-50%); width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--sb-line); background: var(--sb-surface); }
.spd-step.is-done { color: var(--sb-ok); }
.spd-step.is-done::before { background: var(--sb-ok); border-color: var(--sb-ok); }
.spd-step.is-current { color: var(--sb-ink); }
.spd-step.is-current::before { border-color: var(--primary, #0f766e); background: var(--primary, #0f766e); }
.spd-step.is-waiting { color: var(--sb-wait); }
.spd-step.is-waiting::before { border-color: var(--sb-wait); background: var(--sb-wait-soft); }
.spd-step.is-error { color: var(--sb-danger); }
.spd-step.is-error::before { border-color: var(--sb-danger); background: var(--sb-danger-soft); }
.spd-status { font-size: 13px; font-weight: 700; margin: 0 0 10px; padding: 10px 12px; border-radius: 10px; background: var(--sb-neutral-soft); line-height: 1.5; }
.spd-status.tone-ok { background: var(--sb-ok-soft); color: var(--sb-ok); }
.spd-status.tone-wait { background: var(--sb-wait-soft); color: var(--sb-wait); }
.spd-status.tone-danger { background: var(--sb-danger-soft); color: var(--sb-danger); }
.spd-chip-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.drawer-module-slot > .card { margin-bottom: 12px !important; box-shadow: none; }
.spd-subtitle { font-size: 13px; font-weight: 800; margin: 18px 0 8px; }
.spd-log-item { padding: 10px 12px; border-radius: 10px; background: var(--sb-neutral-soft); font-size: 13px; line-height: 1.5; display: grid; gap: 6px; }
.spd-log-item.status-failed, .spd-log-item.status-validation_failed { background: var(--sb-danger-soft); }
.spd-log-item.status-success { background: var(--sb-ok-soft); }
.spd-log-line { font-weight: 700; }
.spd-log-reason { color: var(--sb-ink); }
.spd-log-item .btn { justify-self: start; min-height: 36px; }
.spd-facts { margin: 0; display: grid; gap: 6px; }
.spd-fact { display: grid; grid-template-columns: 100px 1fr; gap: 8px; padding: 8px 10px; border-radius: 8px; background: var(--sb-neutral-soft); font-size: 13px; }
.spd-fact dt { margin: 0; color: var(--sb-muted); font-weight: 700; }
.spd-fact dd { margin: 0; word-break: break-word; }
.drawer-tech { font-size: 12px; color: var(--sb-muted); border-top: 1px dashed var(--sb-line); padding-top: 8px; }
.drawer-tech summary { cursor: pointer; min-height: 32px; display: flex; align-items: center; font-weight: 700; }
.drawer-tech-list { margin: 6px 0 0; padding-left: 16px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; word-break: break-all; }

/* 셀러 기본 모드: 드로어로 옮겨진 모듈 패널의 원문/식별자 표시는 숨기고 헤더의 이름 표기로 대체 */
body:not(.operator-view) #seller-product-drawer pre[id$="-result"],
body:not(.operator-view) #seller-product-drawer pre[id$="-payload"],
body:not(.operator-view) #seller-product-drawer [id$="-target"] { display: none !important; }

/* ---------- 768px 이상: 태블릿 ---------- */
@media (min-width: 768px) {
    .ssb { padding: 8px 28px; }
    .ssb-popover { left: 28px; right: auto; width: 480px; }
    .sfb-tabs { display: none; }
    .sfb-columns {
        grid-template-columns: repeat(6, minmax(220px, 1fr));
        overflow-x: auto;
        scroll-snap-type: x proximity;
        padding-bottom: 6px;
    }
    .sfb-col { display: block; scroll-snap-align: start; }
    .sfb-card { grid-template-columns: 48px 1fr; }
    .sfb-thumb { width: 48px; height: 48px; }
    .sti-item { grid-template-columns: 20px 1fr auto; align-items: center; }
    .sti-action { grid-column: 3; }
    .spd {
        top: 0; bottom: 0; left: auto; right: 0;
        width: 60vw; max-width: 640px; max-height: none;
        border-radius: 0; box-shadow: -12px 0 40px rgba(17,24,39,.18);
    }
    body.seller-drawer-open { overflow: auto; }
}

/* ---------- 1024px 이상: 데스크톱 ---------- */
@media (min-width: 1024px) {
    .sfb-columns { grid-template-columns: repeat(6, minmax(200px, 1fr)); }
    .spd { width: 480px; }
}

/* ---------- 1440px 이상: 카드가 넓어져 컬럼 스크롤 불필요 ---------- */
@media (min-width: 1440px) {
    .sfb-columns { grid-template-columns: repeat(6, minmax(0, 1fr)); overflow: visible; }
}

@media (prefers-reduced-motion: reduce) {
    .ssb-strip, .sfb-tabs, .sfb-columns { scroll-behavior: auto; }
}

/* 상태바 팝오버가 열린 동안에는 팝오버의 버튼만 주 버튼으로 남긴다(화면당 주 버튼 1개). */
body.ssb-popover-open .sti-action.btn-primary,
body.ssb-popover-open .sfb-card .btn-primary {
    background: transparent;
    color: var(--bs-primary, #0d6efd);
    border-color: var(--bs-primary, #0d6efd);
}
