/* ══════════════════════════════════════════════════════════
   Affilinity
   단일 서체(Pretendard), 절제된 2단계 표면, 숲녹색 브랜드
   ══════════════════════════════════════════════════════════ */
@import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/variable/pretendardvariable-dynamic-subset.min.css');

:root {
  /* 색 */
  --bg: #F6F7F5;
  --surface: #FFFFFF;
  --surface-2: #F1F3F0;
  --line: #E3E7E2;
  --line-strong: #CBD2CC;
  --ink: #1B2420;
  --ink-2: #4A5650;
  --ink-3: #7C877F;
  --ink-4: #A9B2AC;
  --brand: #1F5F4A;
  --brand-hover: #184C3B;
  --brand-tint: #E9F2EE;
  --brand-line: #BFD9CD;
  --amber: #B7791F;
  --amber-tint: #FBF3E3;
  --red: #B23A34;
  --red-tint: #F9E9E7;
  --blue: #2F5F9E;
  --blue-tint: #E8EFF8;
  /* 형태 */
  --r: 10px;
  --r-s: 6px;
  --ring: 0 0 0 3px rgba(31,95,74,.18);
  --elev: 0 12px 40px rgba(27,36,32,.14), 0 2px 8px rgba(27,36,32,.08);
  /* 타이포 */
  --font: 'Pretendard Variable', Pretendard, -apple-system, 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
}
body.dark {
  --bg: #121614; --surface: #1A1F1C; --surface-2: #202622; --line: #2B332E; --line-strong: #3B453F;
  --ink: #EDF0EE; --ink-2: #B9C2BD; --ink-3: #7F8A84; --ink-4: #566059;
  --brand: #4FA283; --brand-hover: #63B594; --brand-tint: #1B2E27; --brand-line: #2F5446;
  --amber: #D9A24A; --amber-tint: #2E2618; --red: #E07A73; --red-tint: #33201E; --blue: #7FA6DC; --blue-tint: #1C2733;
  --ring: 0 0 0 3px rgba(79,162,131,.28);
  --elev: 0 12px 40px rgba(0,0,0,.5), 0 2px 8px rgba(0,0,0,.35);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 14px/1.6 var(--font); letter-spacing: -0.005em; word-break: keep-all; overflow-wrap: anywhere;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; }
::selection { background: var(--brand-tint); }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--r-s); }
.num { font-variant-numeric: tabular-nums; font-weight: 600; }
.muted { color: var(--ink-3); font-size: 12.5px; }
.hide { display: none !important; }
code { font: 12px/1 ui-monospace, Menlo, monospace; background: var(--surface-2); padding: 2px 6px; border-radius: 4px; }

/* ── 아이콘 ── */
.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.i.s { width: 14px; height: 14px; }

/* ══════════ 로그인 ══════════ */
#authWrap { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.auth-brand-panel {
  background: var(--brand); color: #fff; padding: 56px 64px; display: flex; flex-direction: column; justify-content: space-between;
  position: relative; overflow: hidden;
}
.auth-brand-panel .mark { display: flex; align-items: center; gap: 12px; font-weight: 700; font-size: 17px; letter-spacing: -0.01em; }
.auth-brand-panel .mark .logo { background: rgba(255,255,255,.14); }
.auth-brand-panel h2 { font-size: 32px; line-height: 1.3; font-weight: 700; letter-spacing: -0.02em; margin: 0 0 18px; max-width: 22ch; }
.auth-brand-panel p { font-size: 15px; line-height: 1.7; color: rgba(255,255,255,.78); max-width: 42ch; margin: 0; }
.flow-diagram { display: flex; align-items: center; gap: 10px; margin-top: 40px; font-size: 13px; color: rgba(255,255,255,.85); }
.flow-diagram span { padding: 8px 14px; border: 1px solid rgba(255,255,255,.28); border-radius: 999px; }
.flow-diagram i { width: 24px; height: 1px; background: rgba(255,255,255,.4); }
.auth-brand-panel .foot { font-size: 12px; color: rgba(255,255,255,.5); }
.auth-form-panel { display: grid; place-items: center; padding: 40px 24px; }
.auth-card { width: 380px; max-width: 100%; }
.auth-card h1 { font-size: 24px; letter-spacing: -0.02em; margin: 0 0 6px; }
.auth-card .sub { color: var(--ink-3); font-size: 13.5px; margin: 0 0 28px; }
.auth-tabs { display: flex; border-bottom: 1px solid var(--line); margin-bottom: 22px; }
.auth-tabs button { flex: 1; padding: 10px 0 12px; border: 0; background: none; font-weight: 600; color: var(--ink-3); cursor: pointer; position: relative; }
.auth-tabs button.on { color: var(--ink); }
.auth-tabs button.on:after { content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--brand); }
@media (max-width: 900px) { #authWrap { grid-template-columns: 1fr; } .auth-brand-panel { display: none; } }

/* ══════════ 앱 골격 ══════════ */
#app { display: flex; min-height: 100vh; }
#sidebar {
  width: 236px; flex: none; background: var(--surface); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 22px 14px 16px; position: sticky; top: 0; height: 100vh;
}
.brandmark { display: flex; align-items: center; gap: 10px; padding: 0 10px 22px; font-weight: 700; font-size: 15px; letter-spacing: -0.01em; }
.logo { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--brand); color: #fff; flex: none; }
.logo .i { width: 15px; height: 15px; stroke-width: 2; }
.nav-group { font-size: 11.5px; font-weight: 600; color: var(--ink-4); padding: 14px 12px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  padding: 9px 12px; border: 0; border-radius: var(--r-s); background: none; color: var(--ink-2);
  font-weight: 500; cursor: pointer; position: relative; transition: background .12s, color .12s;
}
.nav-item .i { color: var(--ink-4); transition: color .12s; }
a.nav-item { box-sizing: border-box; font: inherit; font-weight: 500; }
/* new screens (affiliate / HQ ads / earnings / account / billing) */
.screen h3 { font-size: 14px; font-weight: 700; margin: 0 0 10px; }
.screen h4 { font-size: 13.5px; font-weight: 700; margin: 16px 0 6px; }
.screen label > input[type=checkbox] { width: auto; margin-right: 4px; accent-color: var(--brand); vertical-align: middle; }
.card > table.tbl code { font-size: 12px; background: var(--surface-2); padding: 2px 6px; border-radius: 4px; word-break: break-all; }
.kpi-row + h3 { margin-top: 4px; }
.nav-item:hover { background: var(--surface-2); color: var(--ink); }
.nav-item:hover .i { color: var(--ink-2); }
.nav-item.active { background: var(--brand-tint); color: var(--brand); font-weight: 600; }
.nav-item.active .i { color: var(--brand); }
.nav-item.active:before { content: ''; position: absolute; left: -14px; top: 8px; bottom: 8px; width: 3px; background: var(--brand); border-radius: 0 3px 3px 0; }
#sidebar .grow { flex: 1; }
.side-agent { margin: 8px 4px 0; padding: 10px 12px; border-radius: var(--r-s); background: var(--surface-2); font-size: 12.5px; display: flex; align-items: center; gap: 8px; color: var(--ink-2); }
.side-agent .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-4); flex: none; }
.side-agent .dot.on { background: var(--brand); box-shadow: 0 0 0 3px var(--brand-tint); }
.side-user { display: flex; align-items: center; justify-content: space-between; padding: 14px 12px 0; font-size: 13px; }
.side-user .nm { font-weight: 600; }
.side-user a { color: var(--ink-3); cursor: pointer; font-size: 12.5px; }
.side-user a:hover { color: var(--ink); }

#content { flex: 1; min-width: 0; padding: 32px 40px 64px; }
.screen { display: none; max-width: 1240px; margin: 0 auto; }
.screen.active { display: block; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 26px; }
.page-title { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; margin: 0; line-height: 1.2; }
.page-sub { color: var(--ink-3); font-size: 13.5px; margin: 6px 0 0; max-width: 64ch; }
.head-rule { display: none; }

/* ══════════ 표면 ══════════ */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); margin-bottom: 18px; }
.card-h { padding: 14px 18px; border-bottom: 1px solid var(--line); font-weight: 600; font-size: 14px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card-b { padding: 18px; }
.kpi-row { display: grid; grid-template-columns: repeat(4, 1fr); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); margin-bottom: 18px; overflow: hidden; }
.kpi { padding: 18px 22px; border-right: 1px solid var(--line); }
.kpi:last-child { border-right: 0; }
.kpi .k-label { font-size: 12.5px; color: var(--ink-3); font-weight: 500; }
.kpi .k-value { font-size: 30px; font-weight: 700; letter-spacing: -0.03em; margin-top: 4px; font-variant-numeric: tabular-nums; line-height: 1.1; }
.kpi .k-value small { font-size: 13px; font-weight: 500; color: var(--ink-3); margin-left: 4px; letter-spacing: 0; }
.kpi .k-sub { font-size: 12px; color: var(--ink-3); margin-top: 6px; }
.kpi.brand .k-value { color: var(--brand); }
.kpi.warn .k-value { color: var(--amber); }
.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.chan-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.chan-row:last-of-type { border-bottom: 0; }
.chan-row .nm { font-weight: 600; }

/* ══════════ 컨트롤 ══════════ */
.btn {
  display: inline-flex; align-items: center; gap: 7px; height: 38px; padding: 0 16px; border-radius: var(--r-s);
  border: 1px solid var(--brand); background: var(--brand); color: #fff; font-weight: 600; font-size: 13.5px;
  cursor: pointer; white-space: nowrap; transition: background .12s, border-color .12s, color .12s;
}
.btn:hover { background: var(--brand-hover); border-color: var(--brand-hover); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.ghost { background: var(--surface); border-color: var(--line-strong); color: var(--ink); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.dark { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.btn.danger { background: var(--surface); border-color: var(--line-strong); color: var(--red); }
.btn.danger:hover { background: var(--red-tint); border-color: var(--red); }
.btn.sm { height: 31px; padding: 0 11px; font-size: 12.5px; }
.btn .i { width: 15px; height: 15px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
label.fl { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin: 16px 0 6px; }
label.fl .muted { font-weight: 400; }
input[type=text], input[type=email], input[type=url], input[type=password], input[type=date], input[type=time], input[type=number], select, textarea {
  width: 100%; height: 40px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: var(--r-s);
  background: var(--surface); color: var(--ink); font: inherit; outline: none; transition: border-color .12s, box-shadow .12s;
}
textarea { height: auto; min-height: 110px; padding: 10px 12px; resize: vertical; line-height: 1.65; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: var(--ring); }
input::placeholder, textarea::placeholder { color: var(--ink-4); }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%237C877F' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 34px; }
.chk { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13.5px; }
.chk input { width: 16px; height: 16px; accent-color: var(--brand); margin: 0; }
.chk.off { opacity: .45; }

.badge { display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.badge.ok { background: var(--brand-tint); color: var(--brand); }
.badge.warn { background: var(--amber-tint); color: var(--amber); }
.badge.danger { background: var(--red-tint); color: var(--red); }
.badge.brand { background: var(--brand-tint); color: var(--brand); }
.badge.info { background: var(--blue-tint); color: var(--blue); }

.sw { position: relative; display: inline-block; width: 40px; height: 22px; flex: none; }
.sw input { opacity: 0; width: 0; height: 0; }
.sw span { position: absolute; inset: 0; background: var(--line-strong); border-radius: 999px; cursor: pointer; transition: background .15s; }
.sw span:before { content: ''; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.sw input:checked + span { background: var(--brand); }
.sw input:checked + span:before { transform: translateX(18px); }
.sw input:focus-visible + span { box-shadow: var(--ring); }

/* ══════════ 목록 ══════════ */
.list-row { display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-bottom: 1px solid var(--line); transition: background .1s; }
.list-row:last-child { border-bottom: 0; }
.list-row:hover { background: var(--surface-2); }
.list-row .t { flex: 1; min-width: 0; }
.list-row .nm { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-row .mt { font-size: 12.5px; color: var(--ink-3); margin-top: 2px; }
.list-row .cover { width: 52px; height: 52px; flex: none; border-radius: var(--r-s); object-fit: cover; background: var(--surface-2); border: 1px solid var(--line); }
.list-row .cover.empty { display: grid; place-items: center; color: var(--ink-4); }
.list-row .cover.empty .i { width: 20px; height: 20px; }
.empty { padding: 48px 20px; text-align: center; color: var(--ink-3); font-size: 13.5px; }
.empty .i { width: 36px; height: 36px; color: var(--ink-4); margin: 0 auto 12px; display: block; stroke-width: 1.4; }
.empty b { display: block; color: var(--ink); font-size: 15px; margin-bottom: 4px; }
.empty .btn { margin-top: 16px; }

table.tbl { width: 100%; border-collapse: collapse; }
table.tbl th, table.tbl td { padding: 11px 16px; border-bottom: 1px solid var(--line); text-align: left; font-size: 13.5px; vertical-align: middle; }
table.tbl th { font-size: 12px; font-weight: 600; color: var(--ink-3); background: var(--surface-2); }
table.tbl tr:last-child td { border-bottom: 0; }
table.tbl tbody tr:hover td { background: var(--surface-2); }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.filter { display: grid; grid-template-columns: 2fr repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; align-items: end; }
.filter label.fl { margin-top: 0; }

/* ══════════ 모달 ══════════ */
.modal-mask { position: fixed; inset: 0; background: rgba(27,36,32,.45); display: none; align-items: flex-start; justify-content: center; z-index: 60; padding: 48px 16px; overflow-y: auto; }
.modal-mask.show { display: flex; }
.modal { width: 680px; max-width: 100%; background: var(--surface); border-radius: 14px; box-shadow: var(--elev); }
.modal.wide { width: 880px; }
.modal-h { padding: 18px 22px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; font-weight: 700; font-size: 16px; }
.modal-b { padding: 20px 22px; max-height: 68vh; overflow-y: auto; }
.modal-f { padding: 14px 22px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; }
.x-btn { width: 32px; height: 32px; border: 0; border-radius: var(--r-s); background: none; color: var(--ink-3); cursor: pointer; display: grid; place-items: center; }
.x-btn:hover { background: var(--surface-2); color: var(--ink); }

/* ══════════ 업로드 ══════════ */
.drop { border: 1.5px dashed var(--line-strong); border-radius: var(--r); padding: 22px; text-align: center; color: var(--ink-3); font-size: 13px; cursor: pointer; background: var(--surface-2); transition: border-color .12s, background .12s; }
.drop:hover, .drop.over { border-color: var(--brand); background: var(--brand-tint); color: var(--brand); }
.img-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(108px, 1fr)); gap: 10px; margin-top: 12px; }
.img-item { position: relative; border: 2px solid var(--line); border-radius: var(--r-s); overflow: hidden; background: var(--surface-2); }
.img-item img { width: 100%; height: 92px; object-fit: cover; display: block; }
.img-item.req { border-color: var(--brand); }
.img-item .tools { position: absolute; inset: auto 0 0 0; display: flex; justify-content: space-between; align-items: center; padding: 4px 7px; background: rgba(27,36,32,.78); }
.img-item .tools label { color: #fff; font-size: 11px; display: inline-flex; align-items: center; gap: 4px; cursor: pointer; }
.img-item .tools input { accent-color: var(--brand); }
.img-item .del { border: 0; background: none; color: #FFB3AC; cursor: pointer; font-size: 11.5px; }
.vid-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--r-s); margin-bottom: 6px; font-size: 13px; }
.vid-item .nm { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ══════════ 탭·헤더 블록·진행 ══════════ */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.tab { padding: 10px 14px; border: 0; background: none; font-weight: 600; color: var(--ink-3); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab.on { color: var(--brand); border-bottom-color: var(--brand); }
.sch-head { display: flex; gap: 22px; flex-wrap: wrap; padding: 12px 14px; background: var(--surface-2); border-radius: var(--r-s); font-size: 13px; }
.sch-head b { color: var(--brand); font-size: 15px; }
.prog { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; }
.prog .bar { width: 96px; height: 6px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.prog .bar i { display: block; height: 100%; background: var(--brand); transition: width .3s; }
.post-sec { border: 1px solid var(--line); border-radius: var(--r-s); margin-bottom: 12px; overflow: hidden; }
.post-sec .ph { padding: 9px 12px; background: var(--surface-2); font-weight: 600; font-size: 13px; display: flex; justify-content: space-between; align-items: center; }
.post-sec textarea { border: 0; border-radius: 0; min-height: 160px; padding: 14px 16px; font-size: 14px; line-height: 1.75; }
.post-sec textarea:focus { box-shadow: none; }
.post-media { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.post-media img { width: 80px; height: 80px; object-fit: cover; border-radius: var(--r-s); border: 1px solid var(--line); }
.post-media video { max-width: 100%; max-height: 260px; border-radius: var(--r-s); }
.ai-picker { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.ai-card { border: 1.5px solid var(--line); border-radius: var(--r); padding: 14px 16px; cursor: pointer; background: var(--surface); transition: border-color .12s, background .12s; }
.ai-card:hover { border-color: var(--line-strong); }
.ai-card.on { border-color: var(--brand); background: var(--brand-tint); }
.ai-card .ai-name { font-weight: 700; font-size: 15px; }
.ai-card .ai-maker { font-size: 12px; color: var(--ink-3); margin-top: 1px; }
.ai-card .ai-good { font-size: 12.5px; color: var(--ink-2); margin-top: 8px; line-height: 1.5; }
.guide-warn { background: var(--amber-tint); color: var(--amber); border-radius: var(--r-s); padding: 11px 13px; font-size: 13px; line-height: 1.6; }
.guide-steps { margin: 16px 0 0; padding-left: 20px; }
.guide-steps li { margin-bottom: 11px; line-height: 1.7; font-size: 13.5px; }
.time-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; background: var(--brand-tint); color: var(--brand); font-size: 12.5px; font-weight: 600; }
.pager { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 14px; border-top: 1px solid var(--line); }
.pager .info { font-size: 12.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }

/* ══════════ 토스트 ══════════ */
#toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(16px); background: var(--ink); color: var(--surface); padding: 11px 18px; border-radius: var(--r-s); font-size: 13.5px; font-weight: 500; box-shadow: var(--elev); opacity: 0; pointer-events: none; transition: opacity .18s, transform .18s; z-index: 90; }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.err { background: var(--red); color: #fff; }

/* ══════════ Select2 — 기본 컨트롤과 완전히 같은 모양으로 ══════════ */
.select2-container { width: 100% !important; font: inherit; }
.select2-container .select2-selection--single {
  height: 40px !important; border: 1px solid var(--line-strong) !important; border-radius: var(--r-s) !important;
  background: var(--surface) !important; display: flex; align-items: center; outline: none; transition: border-color .12s, box-shadow .12s;
}
.select2-container .select2-selection--single .select2-selection__rendered {
  color: var(--ink) !important; padding-left: 12px !important; padding-right: 34px !important; line-height: 38px !important; font-size: 14px;
}
.select2-container .select2-selection--single .select2-selection__placeholder { color: var(--ink-4) !important; }
.select2-container .select2-selection--single .select2-selection__arrow {
  height: 38px !important; width: 34px !important; right: 0 !important; top: 0 !important;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%237C877F' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat center;
}
.select2-container .select2-selection--single .select2-selection__arrow b { display: none !important; }
.select2-container .select2-selection--single .select2-selection__clear { color: var(--ink-3); font-size: 18px; margin-right: 8px; }
.select2-container--focus .select2-selection--single, .select2-container--open .select2-selection--single { border-color: var(--brand) !important; box-shadow: var(--ring); }
.select2-dropdown { background: var(--surface) !important; border: 1px solid var(--line) !important; border-radius: var(--r-s) !important; box-shadow: var(--elev); overflow: hidden; margin-top: 4px; }
.select2-container--open .select2-dropdown--below { border-top: 1px solid var(--line) !important; }
.select2-search--dropdown { padding: 8px !important; }
.select2-search--dropdown .select2-search__field { height: 36px; background: var(--surface) !important; color: var(--ink) !important; border: 1px solid var(--line-strong) !important; border-radius: var(--r-s) !important; padding: 0 10px !important; font: inherit; }
.select2-search--dropdown .select2-search__field:focus { border-color: var(--brand) !important; box-shadow: var(--ring); outline: none; }
.select2-results__option { color: var(--ink) !important; padding: 9px 12px !important; font-size: 13.5px; }
.select2-results__option--highlighted { background: var(--brand-tint) !important; color: var(--brand) !important; }
.select2-results__option[aria-selected=true] { background: var(--surface-2) !important; color: var(--ink) !important; }
.select2-results__option.loading-results, .select2-results__message { color: var(--ink-3) !important; }
.select2-results > .select2-results__options { max-height: 260px !important; }

/* ══════════ 네이티브 입력 정돈 ══════════ */
input[type=date], input[type=time] { color-scheme: light; }
body.dark input[type=date], body.dark input[type=time] { color-scheme: dark; }
input::-webkit-calendar-picker-indicator { opacity: .55; cursor: pointer; filter: grayscale(1); }
input::-webkit-calendar-picker-indicator:hover { opacity: 1; }
input[type=number] { -moz-appearance: textfield; }
input[type=number]::-webkit-inner-spin-button, input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[type=checkbox], input[type=radio] { width: 16px; height: 16px; accent-color: var(--brand); cursor: pointer; }
input[type=file] { font: inherit; }

/* ══════════ 반응형 ══════════ */
@media (max-width: 1080px) { .kpi-row { grid-template-columns: repeat(2, 1fr); } .kpi:nth-child(2) { border-right: 0; } .kpi:nth-child(-n+2) { border-bottom: 1px solid var(--line); } .grid-3 { grid-template-columns: 1fr 1fr; } .dash-grid { grid-template-columns: 1fr; } }
@media (max-width: 760px) {
  #app { flex-direction: column; }
  #sidebar { width: 100%; height: auto; position: static; flex-direction: row; flex-wrap: wrap; padding: 10px; border-right: 0; border-bottom: 1px solid var(--line); }
  .nav-group, #sidebar .grow, .side-agent { display: none; }
  .nav-item { width: auto; padding: 8px 10px; }
  .nav-item.active:before { display: none; }
  .brandmark { padding: 0 8px 0 4px; }
  .side-user { padding: 0 8px; margin-left: auto; }
  #content { padding: 18px 16px 40px; }
  .grid-2, .grid-3, .filter { grid-template-columns: 1fr; }
  .page-head { flex-direction: column; align-items: flex-start; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ── 포스팅 보기: 채널 요약 행 · 대형 편집기 · 미디어 갤러리 ── */
.ch-row { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-s); margin-bottom: 8px; }
.ch-row .nm { font-weight: 600; width: 96px; flex: none; }
.ch-row .pv { flex: 1; min-width: 0; color: var(--ink-3); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch-row .pv.none { color: var(--ink-4); font-style: italic; }
.ch-row { flex-wrap: wrap; }
.ch-row .ch-media { flex-basis: 100%; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding-top: 10px; margin-top: 2px; border-top: 1px dashed var(--line); }
.ch-row .ch-media .th { position: relative; width: 64px; height: 64px; border-radius: var(--r-s); overflow: hidden; border: 1px solid var(--line); background: var(--surface-2); display: block; flex: none; }
.ch-row .ch-media .th img, .ch-row .ch-media .th video { width: 100%; height: 100%; object-fit: cover; display: block; background: #000; }
.ch-row .ch-media .th .n { position: absolute; top: 3px; left: 3px; background: var(--brand); color: #fff; font-size: 10.5px; font-weight: 700; border-radius: 999px; min-width: 18px; height: 18px; display: inline-flex; align-items: center; justify-content: center; padding: 0 5px; }
.ch-row .ch-media .th .vt { position: absolute; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,.55); color: #fff; font-size: 10.5px; padding: 2px 4px; text-align: center; }
.ch-row .ch-media .th:hover { border-color: var(--brand); }
.ch-row .ch-media .none { color: var(--ink-4); font-size: 12.5px; font-style: italic; }
textarea.editor { min-height: 56vh; font-size: 14.5px; line-height: 1.8; padding: 16px 18px; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.gallery a { display: block; border: 1px solid var(--line); border-radius: var(--r-s); overflow: hidden; background: var(--surface-2); }
.gallery img { width: 100%; height: 150px; object-fit: cover; display: block; }
.gallery .cap { font-size: 12px; color: var(--ink-3); padding: 6px 8px; }
.gallery-video { margin-top: 16px; }
.gallery-video video { width: 100%; max-height: 420px; border-radius: var(--r-s); background: #000; }

/* ── Select2 multiple (참고 자료 선택) ── */
.select2-container .select2-selection--multiple {
  display: flex !important; flex-wrap: wrap; align-items: center; gap: 4px;
  min-height: 40px !important; border: 1px solid var(--line-strong) !important; border-radius: var(--r-s) !important;
  background: var(--surface) !important; padding: 4px 8px !important; cursor: text;
}
.select2-container--focus .select2-selection--multiple, .select2-container--open .select2-selection--multiple { border-color: var(--brand) !important; box-shadow: var(--ring); }
.select2-container .select2-selection--multiple .select2-selection__rendered {
  display: contents !important; margin: 0 !important; padding: 0 !important; list-style: none;
}
.select2-container .select2-selection--multiple .select2-selection__choice {
  display: inline-flex !important; align-items: center; gap: 2px;
  background: var(--brand-tint) !important; border: 0 !important; border-radius: 999px !important; color: var(--brand) !important;
  font-size: 12.5px; font-weight: 600; line-height: 1; padding: 0 10px 0 4px !important; margin: 0 !important; height: 26px;
}
.select2-container .select2-selection--multiple .select2-selection__choice__remove {
  position: static !important; display: inline-grid !important; place-items: center; width: 18px; height: 18px; border-radius: 50%;
  color: var(--brand) !important; border: 0 !important; background: none !important; font-size: 15px; line-height: 1; padding: 0 !important; margin: 0 2px 0 0 !important; cursor: pointer;
}
.select2-container .select2-selection--multiple .select2-selection__choice__remove:hover { background: rgba(31,95,74,.15) !important; color: var(--red) !important; }
.select2-container .select2-selection--multiple .select2-selection__choice__display { padding: 0 !important; margin: 0 !important; }
.select2-container .select2-search--inline { display: inline-flex !important; align-items: center; flex: 1; min-width: 120px; }
.select2-container .select2-search--inline .select2-search__field {
  width: 100% !important; margin: 0 !important; height: 26px !important; min-height: 0 !important; padding: 0 4px !important;
  border: 0 !important; box-shadow: none !important; background: transparent !important; resize: none; font: inherit; color: var(--ink); line-height: 26px;
}
.select2-container .select2-search--inline .select2-search__field::placeholder { color: var(--ink-4); }
.select2-search__field { min-height: 0 !important; }

/* ── 주제 모달: 참고 자료 연결 ── */
.ref-link { border: 1px solid var(--line); border-radius: var(--r-s); padding: 12px 14px; background: var(--surface-2); }
.ref-link-h { font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin-bottom: 8px; }
.cat-chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px; border: 1px solid var(--line-strong);
  background: var(--surface); font-size: 12.5px; cursor: pointer; user-select: none; transition: background .1s, border-color .1s, color .1s; }
.cat-chip:hover { border-color: var(--brand); }
.cat-chip.on { background: var(--brand-tint); border-color: var(--brand); color: var(--brand); font-weight: 600; }
.cat-chip .n { color: var(--ink-3); font-size: 11.5px; }
.cat-chip.on .n { color: var(--brand); }
.ref-link .select2-container .select2-selection--multiple { background: var(--surface) !important; }

/* ── 포스팅 미디어 선택 ── */
.pm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.pm-item { position: relative; border: 2px solid var(--line); border-radius: var(--r-s); overflow: hidden; cursor: pointer; background: var(--surface-2); transition: border-color .1s; }
.pm-item img { width: 100%; height: 100px; object-fit: cover; display: block; }
.pm-item.on { border-color: var(--brand); }
.pm-item .ord { position: absolute; top: 6px; left: 6px; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; background: var(--brand); color: #fff; font-size: 12px; font-weight: 700; display: none; align-items: center; justify-content: center; }
.pm-item.on .ord { display: inline-flex; }
.pm-item .new { position: absolute; right: 6px; top: 6px; background: var(--amber); color: #fff; font-size: 10.5px; font-weight: 700; padding: 1px 6px; border-radius: 999px; }
.pm-vid { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: 2px solid var(--line); border-radius: var(--r-s); margin-bottom: 6px; cursor: pointer; font-size: 13px; }
.pm-vid.on { border-color: var(--brand); background: var(--brand-tint); }
.pm-vid .nm { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── 사진 코멘트 ── */
.img-item .cap { width: 100%; height: 30px; border: 0; border-top: 1px solid var(--line); border-radius: 0; font-size: 12px; padding: 0 8px; background: var(--surface); }
.img-item .cap:focus { box-shadow: none; background: var(--brand-tint); }
.img-item .tools { bottom: 30px; }
.pm-item .pm-cap { font-size: 11px; color: var(--ink-3); padding: 4px 6px; background: var(--surface); border-top: 1px solid var(--line); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── 편집 화면 사진·영상 제거/삭제 버튼 ── */
.pm-item .pm-x { position: absolute; top: 6px; right: 6px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: var(--ink); color: #fff; font-size: 15px; line-height: 1; cursor: pointer; display: grid; place-items: center; }
.pm-item .pm-x:hover { background: var(--red); }
.pm-item.on .new { right: 32px; }

/* ── 프로젝트 선택 ── */
.proj-box { margin: 0 4px 6px; padding: 10px 10px 6px; border: 1px solid var(--line); border-radius: var(--r-s); background: var(--surface-2); }
.proj-label { font-size: 11px; font-weight: 600; color: var(--ink-4); margin: 0 2px 6px; }
.proj-select { height: 36px !important; font-weight: 600; background-color: var(--surface) !important; }
.proj-manage { padding: 7px 8px; margin-top: 4px; font-size: 12.5px; }
.proj-manage.active:before { display: none; }
.proj-row { display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.proj-row:last-child { border-bottom: 0; }
.proj-row.cur { background: var(--brand-tint); }
.proj-row .nm { font-weight: 700; font-size: 15px; }
.proj-row .stats { display: flex; gap: 14px; font-size: 12.5px; color: var(--ink-3); margin-top: 4px; flex-wrap: wrap; }
.proj-row .stats b { color: var(--ink); font-variant-numeric: tabular-nums; }
@media (max-width: 760px) { .proj-box { display: none; } }

/* ── 편집 화면: 업로드될 항목 표시 스트립 ── */
.sel-strip { border: 2px solid var(--brand); background: var(--brand-tint); border-radius: var(--r-s); padding: 10px 12px; }
.sel-strip .sh { font-size: 12.5px; font-weight: 700; color: var(--brand); margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.sel-strip .sh .cnt { background: var(--brand); color: #fff; border-radius: 999px; padding: 1px 8px; font-size: 11.5px; }
.sel-strip .thumbs { display: flex; gap: 8px; flex-wrap: wrap; }
.sel-strip .th { position: relative; width: 64px; height: 64px; border-radius: var(--r-s); overflow: hidden; border: 1px solid var(--brand-line); background: var(--surface); }
.sel-strip .th img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sel-strip .th .n { position: absolute; top: 3px; left: 3px; background: var(--brand); color: #fff; font-size: 10.5px; font-weight: 700; border-radius: 999px; min-width: 18px; height: 18px; display: inline-flex; align-items: center; justify-content: center; padding: 0 5px; }
.sel-strip .th .rm { position: absolute; top: 3px; right: 3px; width: 18px; height: 18px; border: 0; border-radius: 50%; background: var(--ink); color: #fff; font-size: 13px; line-height: 1; cursor: pointer; display: grid; place-items: center; }
.sel-strip .th .rm:hover { background: var(--red); }
.sel-strip .none { color: var(--ink-3); font-size: 13px; }
.sel-strip video { width: 100%; max-height: 220px; border-radius: var(--r-s); background: #000; margin-top: 6px; }
.pm-item.on::after { content: ''; position: absolute; inset: 0; box-shadow: inset 0 0 0 3px var(--brand); border-radius: 4px; pointer-events: none; }
.pm-item.on img { opacity: .85; }

/* ── 미디어 라이트박스 (포스팅 보기) ── */
.lb-mask { position: fixed; inset: 0; background: rgba(10,14,12,.88); display: none; align-items: center; justify-content: center; z-index: 90; }
.lb-mask.show { display: flex; }
.lb-body { max-width: min(92vw, 1200px); max-height: 84vh; display: flex; align-items: center; justify-content: center; }
.lb-body img, .lb-body video { max-width: 92vw; max-height: 84vh; border-radius: var(--r-s); box-shadow: 0 20px 60px rgba(0,0,0,.5); background: #000; }
.lb-cap { position: absolute; left: 0; right: 0; bottom: 18px; text-align: center; color: #fff; font-size: 13.5px; text-shadow: 0 1px 3px rgba(0,0,0,.8); padding: 0 80px; }
.lb-cap .cnt { display: inline-block; margin-right: 10px; background: rgba(255,255,255,.18); border-radius: 999px; padding: 1px 9px; font-size: 12px; }
.lb-x { position: absolute; top: 16px; right: 18px; width: 40px; height: 40px; border: 0; border-radius: 50%; background: rgba(255,255,255,.14); color: #fff; cursor: pointer; display: grid; place-items: center; }
.lb-x:hover { background: rgba(255,255,255,.28); }
.lb-x svg { width: 20px; height: 20px; }
.lb-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 48px; height: 64px; border: 0; border-radius: var(--r-s); background: rgba(255,255,255,.12); color: #fff; font-size: 34px; line-height: 1; cursor: pointer; }
.lb-nav:hover { background: rgba(255,255,255,.26); }
.lb-nav.prev { left: 16px; } .lb-nav.next { right: 16px; }
.lb-nav.hide { display: none; }