/* ───────── 제플 매거진 운영 대시보드 · 디자인 시스템 ───────── */
:root {
  --bg: #F6F5F2;
  --panel: #FFFFFF;
  --soft: #F0EEEA;
  --ink: #141414;
  --ink-2: #3A3835;
  --muted: #8A857E;
  --line: #E7E4DE;
  --line-2: #D9D5CD;
  --accent: #141414;          /* 주요 버튼: 블랙 */
  --accent-ink: #FFFFFF;
  --rose: #A9523F;            /* 포인트 컬러 */
  --rose-soft: #F5E9E5;
  --ok: #3E7B5E;  --ok-soft: #E7F0EA;
  --warn: #A2711F; --warn-soft: #F6EEDD;
  --bad: #B23B32; --bad-soft: #F8E6E3;
  --accent-soft: var(--rose-soft);
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 18, 15, .04), 0 4px 16px rgba(20, 18, 15, .04);
  --font: "Pretendard Variable", Pretendard, -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  --serif: "Cormorant Garamond", "Noto Serif KR", serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111110; --panel: #1A1A19; --soft: #222220; --ink: #F2F0EC; --ink-2: #D2CEC7; --muted: #8F8A83;
    --line: #2A2927; --line-2: #3A3835; --accent: #F2F0EC; --accent-ink: #141414;
    --rose: #D8806B; --rose-soft: #33221D; --ok-soft: #1D2D24; --warn-soft: #30271A; --bad-soft: #35201D;
    --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111110; --panel: #1A1A19; --soft: #222220; --ink: #F2F0EC; --ink-2: #D2CEC7; --muted: #8F8A83;
  --line: #2A2927; --line-2: #3A3835; --accent: #F2F0EC; --accent-ink: #141414;
  --rose: #D8806B; --rose-soft: #33221D; --ok-soft: #1D2D24; --warn-soft: #30271A; --bad-soft: #35201D;
  --shadow: none; color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 14px; line-height: 1.6; letter-spacing: -0.005em; -webkit-font-smoothing: antialiased; }
button, input, textarea, select { font: inherit; color: inherit; letter-spacing: inherit; }
a { color: var(--ink); cursor: pointer; text-underline-offset: 3px; }
::selection { background: var(--rose-soft); }

/* ── 상단 바 ── */
.topbar { position: sticky; top: 0; z-index: 10; display: flex; gap: 20px; align-items: center; height: 64px; padding: 0 24px; background: color-mix(in srgb, var(--panel) 88%, transparent); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 12px; white-space: nowrap; min-width: 210px; }
.brand .mark { font-family: var(--serif); font-size: 26px; font-weight: 600; letter-spacing: .06em; line-height: 1; }
.brand .mark-img { height: 30px; width: auto; display: block; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .brand .mark-img { filter: invert(1); } }
:root[data-theme="dark"] .brand .mark-img { filter: invert(1); }
.brand .divider { width: 1px; height: 18px; background: var(--line-2); }
.brand .title { font-size: 13px; font-weight: 600; color: var(--ink-2); letter-spacing: -0.01em; }
.command { flex: 1; display: flex; gap: 8px; max-width: 720px; margin: 0 auto; }
.command input { flex: 1; height: 40px; padding: 0 16px; border: 1px solid var(--line); border-radius: 999px; background: var(--soft); transition: border-color .15s, background .15s; }
.command input::placeholder { color: var(--muted); }
.command input:focus { outline: none; background: var(--panel); border-color: var(--ink); }
.command button { height: 40px; border: 0; background: var(--accent); color: var(--accent-ink); border-radius: 999px; padding: 0 20px; font-weight: 600; cursor: pointer; }
.status { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 500; padding: 4px 10px; border-radius: 999px; background: var(--soft); color: var(--muted); white-space: nowrap; }
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .7; }
.chip.on { color: var(--ok); background: var(--ok-soft); }
.chip.off { color: var(--warn); background: var(--warn-soft); }

/* ── 레이아웃 ── */
.layout { display: grid; grid-template-columns: 232px 1fr; min-height: calc(100vh - 64px); }
.sidebar { position: sticky; top: 64px; height: calc(100vh - 64px); border-right: 1px solid var(--line); padding: 20px 12px; display: flex; flex-direction: column; gap: 2px; background: var(--panel); }
.sidebar .sec { font-size: 10.5px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); padding: 14px 12px 6px; }
.sidebar a { display: flex; justify-content: space-between; align-items: center; padding: 9px 12px; border-radius: 10px; color: var(--ink-2); text-decoration: none; font-weight: 500; transition: background .12s; }
.sidebar a:hover { background: var(--soft); }
.sidebar a.active { background: var(--accent); color: var(--accent-ink); }
.sidebar a b { font-size: 11px; font-weight: 600; min-width: 20px; text-align: center; background: var(--rose); color: #fff; border-radius: 999px; padding: 0 7px; line-height: 19px; }
.sidebar a.active b { background: var(--accent-ink); color: var(--accent); }
.sidebar a b:empty { display: none; }
.jobs { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
.job { font-size: 12px; padding: 9px 11px; border-radius: 10px; background: var(--soft); }
.job .t { font-weight: 600; }
.job .m { color: var(--muted); font-size: 11px; line-height: 1.45; margin-top: 2px; }
.job.running { background: var(--rose-soft); }
.job.running .t::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 7px; border-radius: 50%; border: 2px solid var(--rose); border-top-color: transparent; animation: spin .8s linear infinite; vertical-align: -1px; }
.job.error { background: var(--bad-soft); }
@keyframes spin { to { transform: rotate(360deg); } }

main { padding: 36px 40px 80px; max-width: 1320px; width: 100%; }
h1 { font-size: 28px; font-weight: 700; letter-spacing: -0.03em; line-height: 1.25; margin: 0 0 6px; }
h1 .eyebrow { display: block; font-size: 11px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--rose); margin-bottom: 8px; }
h2 { font-size: 15px; font-weight: 700; letter-spacing: -0.01em; margin: 36px 0 12px; }
h3 { font-size: 13px; font-weight: 700; margin: 20px 0 8px; color: var(--ink-2); }
.sub { color: var(--muted); margin: 0 0 24px; max-width: 760px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }

/* ── 버튼·입력 ── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; border: 1px solid var(--line-2); background: var(--panel); padding: 0 14px; border-radius: 10px; cursor: pointer; white-space: nowrap; font-weight: 500; text-decoration: none; transition: border-color .12s, background .12s, transform .05s; }
.btn:hover { border-color: var(--ink); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.danger { color: var(--bad); }
.btn.danger:hover { border-color: var(--bad); }
.btn.sm { height: 30px; padding: 0 11px; font-size: 12.5px; border-radius: 8px; }
.btn:disabled { opacity: .4; cursor: default; transform: none; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
input.f, textarea.f, select.f { width: 100%; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); transition: border-color .15s; }
input.f:focus, textarea.f:focus, select.f:focus { outline: none; border-color: var(--ink); }
textarea.f { resize: vertical; min-height: 76px; line-height: 1.55; }
label.l { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin: 14px 0 6px; }
input[type="checkbox"] { accent-color: var(--ink); }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; box-shadow: var(--shadow); }

/* ── 개요: 파이프라인 ── */
.pipeline { display: grid; grid-template-columns: repeat(5, 1fr); gap: 0; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.stage { padding: 18px 20px; cursor: pointer; position: relative; border-right: 1px solid var(--line); transition: background .12s; }
.stage:last-child { border-right: 0; }
.stage:hover { background: var(--soft); }
.stage .n { font-size: 34px; font-weight: 700; letter-spacing: -0.04em; line-height: 1.15; margin: 6px 0 2px; }
.stage .k { font-size: 12px; color: var(--muted); }
.stage .k:first-child { font-weight: 600; color: var(--ink-2); }

.board { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.col { background: var(--soft); border-radius: var(--radius); padding: 10px; min-height: 140px; }
.col > .h { font-size: 11.5px; font-weight: 700; letter-spacing: .04em; color: var(--muted); padding: 4px 6px 10px; }
.card { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 8px; cursor: pointer; background: var(--panel); box-shadow: var(--shadow); transition: border-color .12s, transform .12s; }
.card:hover { border-color: var(--ink); transform: translateY(-1px); }
.card .t { font-weight: 600; line-height: 1.45; }
.card .meta { font-size: 11.5px; color: var(--muted); margin-top: 6px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

.badge { display: inline-flex; align-items: center; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--soft); color: var(--muted); white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.accent { background: var(--rose-soft); color: var(--rose); }

.two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.logs { max-height: 380px; overflow: auto; font-size: 12.5px; }
.logs div { padding: 8px 0; border-bottom: 1px solid var(--line); line-height: 1.5; }
.logs div:last-child { border-bottom: 0; }
.logs .warn { color: var(--warn); }
.logs .error { color: var(--bad); }

/* ── 자료 ── */
.src { display: grid; grid-template-columns: 24px 1fr auto; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.src:last-child { border-bottom: 0; }
.src .t { font-weight: 600; }
.src.dim { opacity: .5; }
.tabs { display: flex; gap: 4px; margin-bottom: 16px; border-bottom: 1px solid var(--line); }
.tabs a { padding: 10px 14px; color: var(--muted); text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 600; }
.tabs a.on { color: var(--ink); border-bottom-color: var(--ink); }
.tabs a b { font-size: 11px; background: var(--rose); color: #fff; border-radius: 999px; padding: 0 7px; margin-left: 6px; }
.tabs a b:empty { display: none; }
.sns-body { display: flex; gap: 12px; align-items: flex-start; }
.sns-body .thumb { flex: 0 0 88px; aspect-ratio: 4/5; border-radius: 8px; overflow: hidden; background: var(--soft); display: block; }
.sns-body .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sns-body .thumb.noimg { display: none; }

.banner { padding: 11px 24px; font-size: 13px; font-weight: 500; border-bottom: 1px solid var(--line); }
.banner.exhausted { background: var(--bad-soft); color: var(--bad); }
.banner.low { background: var(--warn-soft); color: var(--warn); }
.budget { margin-bottom: 16px; }
.budget .bar { height: 6px; border-radius: 999px; background: var(--soft); overflow: hidden; margin: 10px 0 8px; }
.budget .bar span { display: block; height: 100%; background: var(--ink); border-radius: 999px; }

.filters { margin: 4px 0 14px; gap: 6px; }
.filters .sep { width: 1px; height: 18px; background: var(--line-2); margin: 0 6px; }
.chip-f { font-size: 12px; font-weight: 500; padding: 5px 12px; border-radius: 999px; border: 1px solid var(--line); color: var(--ink-2); text-decoration: none; cursor: pointer; background: var(--panel); }
.chip-f.on { border-color: var(--ink); background: var(--ink); color: var(--accent-ink); }
.sns-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(196px, 1fr)); gap: 16px; }
.sns-tile { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; cursor: pointer; transition: transform .15s, border-color .15s; box-shadow: var(--shadow); }
.sns-tile:hover { border-color: var(--ink); transform: translateY(-2px); }
.sns-tile.dim { opacity: .55; }
.sns-tile .th { position: relative; aspect-ratio: 4/5; background: var(--soft); }
.sns-tile .th img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sns-tile .fmt, .sns-tile .ratio { position: absolute; font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 999px; color: #fff; background: rgba(17,17,17,.6); backdrop-filter: blur(4px); }
.sns-tile .fmt { left: 10px; top: 10px; }
.sns-tile .ratio { left: 10px; bottom: 10px; background: rgba(62,123,94,.92); }
.sns-tile .sel { position: absolute; right: 10px; top: 10px; width: 18px; height: 18px; }
.sns-tile .b { padding: 10px 12px 12px; }
.sns-tile .t { font-weight: 600; font-size: 13px; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.viewer { position: fixed; inset: 0; z-index: 25; background: rgba(12, 10, 9, .62); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; padding: 24px; }
.viewer[hidden] { display: none; }
.viewer-inner { background: var(--bg); border-radius: 18px; width: min(1060px, 100%); height: min(780px, 100%); display: grid; grid-template-columns: minmax(320px, 440px) 1fr; overflow: hidden; box-shadow: 0 24px 80px rgba(0,0,0,.35); }
.v-media { background: #fff; display: flex; align-items: center; justify-content: center; overflow: auto; }
.v-media iframe { width: 100%; height: 100%; border: 0; min-height: 600px; }
.v-media img { max-width: 100%; max-height: 100%; object-fit: contain; }
.v-info { padding: 22px 26px; overflow: auto; }
.v-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(76px, 1fr)); gap: 8px; margin: 16px 0 6px; }
.v-stats div { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px; text-align: center; }
.v-stats b { display: block; font-size: 18px; font-weight: 700; letter-spacing: -0.03em; }
.v-stats span { font-size: 11px; color: var(--muted); }
.accts { margin-top: 12px; max-height: 360px; overflow: auto; }
.acct { display: flex; gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.acct a { font-weight: 600; text-decoration: none; }

/* ── 콘텐츠 그리드 ── */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); gap: 16px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; cursor: pointer; box-shadow: var(--shadow); transition: transform .15s, border-color .15s; }
.tile:hover { border-color: var(--ink); transform: translateY(-2px); }
.tile .img { aspect-ratio: 4/5; background: var(--soft) center/cover no-repeat; display: grid; place-items: center; color: var(--muted); font-size: 12px; }
.tile .b { padding: 12px 14px 14px; }

/* ── 상세 드로어 ── */
.drawer { position: fixed; inset: 0; background: rgba(12, 10, 9, .4); backdrop-filter: blur(2px); z-index: 20; display: flex; justify-content: flex-end; }
.drawer[hidden] { display: none; }
.drawer-inner { width: min(920px, 100%); height: 100%; overflow: auto; background: var(--bg); padding: 28px 34px 90px; box-shadow: -12px 0 40px rgba(0,0,0,.14); }
.issue { padding: 10px 12px; border-radius: 10px; margin-bottom: 6px; background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--line-2); }
.issue.high { border-left-color: var(--bad); }
.issue.medium { border-left-color: var(--warn); }
.score { font-size: 44px; font-weight: 700; letter-spacing: -0.05em; line-height: 1; margin-right: 8px; }

.slides { display: grid; gap: 14px; }
.slide { display: grid; grid-template-columns: 240px 1fr; gap: 18px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); }
.slide .preview { aspect-ratio: 4/5; border-radius: 10px; background: var(--soft) center/cover no-repeat; position: relative; overflow: hidden; display: flex; align-items: flex-end; }
.slide .preview .empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: 12px; text-align: center; padding: 14px; line-height: 1.5; }
.slide .preview .making { position: absolute; left: 10px; bottom: 10px; font-size: 11px; font-weight: 600; padding: 4px 10px; border-radius: 999px; background: rgba(17,17,17,.7); color: #fff; }
.slide .photo-thumb { width: 44px; height: 55px; border-radius: 6px; background: var(--soft) center/cover; border: 1px solid var(--line); }
.plan-slide { padding: 10px 0; border-bottom: 1px solid var(--line); }
.plan-slide:last-child { border-bottom: 0; }

/* ── 수집 기준·주기 ── */
.crit-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 24px; }
.chip-c { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; font-size: 12.5px; font-weight: 500; cursor: pointer; background: var(--panel); user-select: none; }
.chip-c input { display: none; }
.chip-c:has(input:checked) { background: var(--ink); color: var(--accent-ink); border-color: var(--ink); }
.chip-c.day { width: 38px; justify-content: center; padding: 6px 0; }
.sched { padding: 16px 0; border-bottom: 1px solid var(--line); }
.sched:last-of-type { border-bottom: 0; }
.sched-auto[data-off] { opacity: .4; pointer-events: none; }
@media (max-width: 900px) { .crit-grid { grid-template-columns: 1fr; } }

/* ── 디자인 화면 ── */
.design-grid { display: grid; grid-template-columns: minmax(0, 1fr) 420px; gap: 20px; align-items: start; }
.previews { position: sticky; top: 88px; }
.preview-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.pv { position: relative; aspect-ratio: 4/5; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: var(--soft); }
.pv iframe { position: absolute; left: 0; top: 0; width: 1080px; height: 1350px; border: 0; transform-origin: 0 0; pointer-events: none; }
.swatches { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.swatch { display: flex; flex-direction: column; gap: 6px; }
.swatch input[type="color"] { width: 100%; height: 40px; padding: 0; border: 1px solid var(--line); border-radius: 10px; background: none; cursor: pointer; }
.swatch input[type="color"]::-webkit-color-swatch-wrapper { padding: 4px; }
.swatch input[type="color"]::-webkit-color-swatch { border: 0; border-radius: 7px; }
.ref-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; margin-top: 12px; }
.ref { position: relative; aspect-ratio: 4/5; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: var(--soft) center/cover; }
.ref button { position: absolute; right: 6px; top: 6px; width: 24px; height: 24px; border-radius: 50%; border: 0; background: rgba(17,17,17,.65); color: #fff; cursor: pointer; font-size: 12px; }
.dropzone { display: flex; align-items: center; justify-content: center; aspect-ratio: 4/5; border: 1.5px dashed var(--line-2); border-radius: 10px; color: var(--muted); font-size: 12px; cursor: pointer; text-align: center; padding: 8px; }
.dropzone:hover { border-color: var(--ink); color: var(--ink); }
.seg { display: inline-flex; background: var(--soft); border-radius: 10px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg label { padding: 6px 12px; border-radius: 8px; cursor: pointer; font-size: 12.5px; font-weight: 500; color: var(--ink-2); }
.seg input { display: none; }
.seg label:has(input:checked) { background: var(--panel); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08); font-weight: 600; }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 11px 20px; border-radius: 999px; z-index: 30; font-size: 13px; font-weight: 500; max-width: 90vw; box-shadow: 0 8px 30px rgba(0,0,0,.2); }
.empty-state { padding: 36px; text-align: center; color: var(--muted); }

@media (max-width: 1100px) {
  .design-grid { grid-template-columns: 1fr; }
  .previews { position: static; }
}
@media (max-width: 900px) {
  .topbar { height: auto; flex-wrap: wrap; padding: 12px 16px; gap: 10px; }
  .brand { min-width: 0; }
  .command { order: 3; flex-basis: 100%; }
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 8px 12px; }
  .sidebar .sec, .sidebar .jobs { display: none; }
  .sidebar a { white-space: nowrap; }
  .pipeline { grid-template-columns: 1fr 1fr; }
  .stage { border-bottom: 1px solid var(--line); }
  .board, .two { grid-template-columns: 1fr; }
  .slide { grid-template-columns: 1fr; }
  main { padding: 20px 16px 60px; }
  .viewer-inner { grid-template-columns: 1fr; height: 100%; overflow: auto; }
  .v-media { min-height: 520px; }
  .drawer-inner { padding: 20px 16px 80px; }
}
