/* THE SC 인스타그램 피드 자동화 시스템 — CTI와 같은 토큰(흰 바탕 · 블루 포인트 · night 상단바) */
:root {
  color-scheme: light;
  --night: #0a0d22; --navy: #0b1f6b; --navy2: #14298a; --blue: #1f4fe0; --blue-l: #3d7bff;
  --bg: #f3f5fa; --panel: #ffffff; --panel2: #f7f9fd; --hover: #eef3ff; --sel: #e3ebff;
  --line: #e4e8f1; --line2: #edf0f6; --ink: #111421; --sub: #5d6478; --mute: #8d93a6;
  --on-dark: #ffffff; --on-dark-sub: #aab4d8;
  --ok: #0f8a4b; --ok-bg: #e6f6ed; --warn: #b26a00; --warn-bg: #fff3dc; --bad: #c62a2a; --bad-bg: #fde9e9; --info-bg: #e8efff;
  --r: 6px; --shadow: 0 1px 2px rgba(17, 20, 33, .06);
  --font: 'Pretendard Variable', Pretendard, 'Noto Sans KR', -apple-system, 'Segoe UI', 'Malgun Gothic', sans-serif;
  --num: Montserrat, 'Pretendard Variable', Pretendard, 'Noto Sans KR', sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--ink); font: 13px/1.5 var(--font); }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
h1, h2, p { margin: 0; }
.mut { color: var(--sub); } .sm { font-size: 12px; } .mono { font-variant-numeric: tabular-nums; font-size: 12px; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--blue-l); outline-offset: 1px; }

/* 버튼·입력 */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 6px 12px; border-radius: var(--r); border: 1px solid var(--line); background: var(--panel); cursor: pointer; white-space: nowrap; color: var(--ink); font-weight: 500; }
.btn:hover { border-color: #c9d2e6; background: var(--panel2); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.sm { padding: 3px 9px; font-size: 12px; }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; } .btn.primary:hover { background: var(--navy2); border-color: var(--navy2); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--sub); } .btn.ghost:hover { background: var(--hover); color: var(--ink); }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.danger.ghost { background: var(--panel); border-color: #f0c4c4; color: var(--bad); } .btn.danger.ghost:hover { background: var(--bad-bg); }
.btn.wide { width: 100%; } .grow { flex: 1; }
.inp { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 6px 9px; min-width: 0; width: 100%; }
.inp:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(31, 79, 224, .12); }
.inp::placeholder { color: var(--mute); }
.inp.sm { padding: 4px 8px; font-size: 12px; } textarea.inp { resize: vertical; line-height: 1.6; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: var(--panel); max-width: 100%; }
.seg button { border: 0; background: transparent; padding: 6px 12px; cursor: pointer; color: var(--sub); white-space: nowrap; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--navy); color: #fff; }
.row { display: flex; gap: 8px; align-items: center; } .row.end { justify-content: flex-end; margin-top: 16px; }

/* 상단바 (CTI와 동일) */
.top { height: 52px; display: flex; align-items: center; gap: 16px; padding: 0 18px; background: var(--night); color: var(--on-dark); position: sticky; top: 0; z-index: 20; }
.brand { font-family: var(--num); font-weight: 800; letter-spacing: .5px; font-size: 16px; display: flex; align-items: center; gap: 8px; white-space: nowrap; color: #fff; }
.brand i { display: inline-block; width: 22px; height: 22px; border-radius: 5px; background: linear-gradient(135deg, var(--blue-l), var(--blue)); font-style: normal; font-size: 11px; line-height: 22px; text-align: center; font-weight: 800; }
.brand small { font-family: var(--font); color: var(--on-dark-sub); font-weight: 400; letter-spacing: 0; font-size: 12px; }
.flag { background: rgba(61, 123, 255, .18); color: #cfe0ff; padding: 2px 8px; border-radius: 4px; font-size: 11px; white-space: nowrap; }
.nav { display: flex; gap: 2px; margin-left: auto; }
.nav a { color: var(--on-dark-sub); padding: 6px 14px; border-radius: var(--r); font-weight: 500; white-space: nowrap; }
.nav a:hover { color: #fff; } .nav a.on { background: rgba(255, 255, 255, .1); color: #fff; }
.who { display: flex; align-items: center; gap: 8px; color: var(--on-dark-sub); }
.who .btn.ghost { color: var(--on-dark-sub); } .who .btn.ghost:hover { background: rgba(255, 255, 255, .1); color: #fff; }

main { padding: 20px 24px 60px; max-width: 1480px; margin: 0 auto; }
.page-h { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.page-h h2 { margin: 0; font-size: 20px; font-weight: 700; letter-spacing: -.2px; }
.page-h .sub { color: var(--sub); font-size: 12px; margin-right: auto; }

/* 요약 카드 */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 12px; }
.stat { text-align: left; background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--line); border-radius: 8px; padding: 12px 14px; cursor: pointer; display: grid; gap: 1px; box-shadow: var(--shadow); }
.stat:hover { background: var(--hover); } .stat.on { border-color: var(--blue); background: var(--sel); }
.stat .lbl { font-size: 12px; font-weight: 600; color: var(--sub); }
.stat b { font-family: var(--num); font-size: 26px; font-weight: 700; line-height: 1.25; font-variant-numeric: tabular-nums; }
.stat .sm { color: var(--mute); font-size: 11px; }
.stat[data-f=review] { border-left-color: var(--warn); } .stat[data-f=review] b { color: var(--warn); }
.stat[data-f=approved] { border-left-color: var(--blue); } .stat[data-f=approved] b { color: var(--blue); }
.stat[data-f=published] { border-left-color: var(--ok); }
.stat.alert { border-left-color: var(--bad); } .stat.alert b { color: var(--bad); }

/* 검색·필터 */
.bar { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 12px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; box-shadow: var(--shadow); }
.search { flex: 1 1 240px; width: auto; }

/* 목록 */
.list { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--panel); box-shadow: var(--shadow); }
.lhead, .lrow { display: grid; grid-template-columns: 40px minmax(200px, 1.6fr) 92px repeat(var(--n, 4), minmax(92px, 1fr)) 20px; gap: 14px; align-items: center; padding: 8px 14px; }
.lhead { font-size: 12px; font-weight: 600; color: var(--sub); border-bottom: 1px solid var(--line); background: var(--panel2); }
.lrow { border-bottom: 1px solid var(--line2); } .lrow:last-child { border-bottom: 0; } .lrow:hover { background: var(--hover); }
.lrow img { width: 40px; height: 50px; object-fit: cover; border-radius: 4px; background: var(--line2); border: 1px solid var(--line); display: block; }
.ttl { display: grid; min-width: 0; } .ttl b { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cc { display: grid; gap: 2px; justify-items: start; } .cc i { font-style: normal; font-size: 11px; }
.lhead .cc, b.cc { font-family: var(--num); font-weight: 700; color: var(--navy); }
.go { color: var(--mute); } .lrow:hover .go { color: var(--blue); }
.chip { display: inline-block; padding: 0 7px; border-radius: 4px; font-size: 11px; line-height: 19px; font-weight: 600; white-space: nowrap; background: var(--line2); color: var(--sub); }
.s-review { background: var(--warn-bg); color: var(--warn); } .s-approved, .s-publishing { background: var(--info-bg); color: var(--blue); }
.s-published { background: var(--ok-bg); color: var(--ok); } .s-failed { background: var(--bad-bg); color: var(--bad); } .s-removed { text-decoration: line-through; color: var(--mute); }
.empty { display: grid; gap: 4px; justify-items: center; padding: 56px 20px; text-align: center; color: var(--sub); }

/* 검수 */
.back { color: var(--sub); font-size: 12px; display: inline-block; margin-bottom: 6px; } .back:hover { color: var(--blue); }
.rt { display: flex; align-items: baseline; gap: 10px; margin-right: auto; min-width: 0; flex-wrap: wrap; }
.cols { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(240px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 6px; align-items: start; }
.col { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 12px; display: grid; gap: 8px; align-content: start; box-shadow: var(--shadow); }
.col.src { background: var(--panel2); box-shadow: none; }
.col header { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--sub); min-height: 20px; }
.col header b { font-family: var(--num); font-weight: 800; font-size: 14px; color: var(--navy); }
.col header span:first-of-type { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.car { position: relative; aspect-ratio: 4 / 5; border-radius: var(--r); overflow: hidden; background: var(--line2); border: 1px solid var(--line); }
.car img { width: 100%; height: 100%; object-fit: cover; display: block; }
.car.none { display: grid; place-items: center; border-style: dashed; background: var(--panel2); }
.car button { position: absolute; top: 50%; left: 6px; transform: translateY(-50%); width: 26px; height: 26px; border-radius: 50%; border: 0; background: rgba(10, 13, 34, .55); color: #fff; font-size: 16px; line-height: 1; cursor: pointer; opacity: 0; transition: opacity .15s; }
.car button.nx { left: auto; right: 6px; } .car:hover button, .car button:focus-visible { opacity: 1; }
.car .cnt { position: absolute; top: 6px; right: 6px; background: rgba(10, 13, 34, .6); color: #fff; font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 4px; }
.cap.ro { line-height: 1.65; white-space: pre-wrap; word-break: break-word; } .cap .tags { display: block; margin-top: 4px; color: var(--blue); }
.warn { font-size: 12px; font-weight: 600; color: var(--warn); background: var(--warn-bg); padding: 4px 8px; border-radius: 4px; }
.err { font-size: 12px; font-weight: 600; color: var(--bad); background: var(--bad-bg); padding: 6px 8px; border-radius: 4px; }
.at { display: grid; grid-template-columns: auto 1fr; gap: 8px; align-items: center; }
.meta { display: flex; gap: 8px; align-items: baseline; } .meta b { font-variant-numeric: tabular-nums; }
.lnk { font-size: 12px; font-weight: 600; color: var(--blue); justify-self: start; } .lnk:hover { text-decoration: underline; }
.logs, .panel { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; margin-top: 12px; box-shadow: var(--shadow); }
.logs h2, .panel h2 { font-size: 14px; font-weight: 700; margin-bottom: 6px; }
.log { display: grid; grid-template-columns: 84px 110px 1fr auto; gap: 12px; padding: 7px 0; border-top: 1px solid var(--line2); font-size: 12px; }

/* 설정 */
.panel > p { margin-bottom: 12px; font-size: 12px; }
.tbl { display: grid; gap: 6px; overflow-x: auto; } .tr { display: grid; gap: 6px; align-items: center; min-width: 760px; }
.acc .tr { grid-template-columns: 30px 110px 150px 110px 1fr 56px auto; }
.gl .tr { grid-template-columns: 1fr repeat(var(--n, 4), 1fr) 1.2fr 92px; } .tr.th { font-size: 12px; font-weight: 600; color: var(--sub); }

/* 대화상자 · 알림 · 로그인 */
.scrim { position: fixed; inset: 0; z-index: 50; background: rgba(10, 13, 34, .45); display: grid; place-items: center; padding: 20px; }
.sheet { width: min(500px, 100%); max-height: 90vh; overflow: auto; background: var(--panel); border-radius: 10px; padding: 20px; box-shadow: 0 20px 50px rgba(10, 13, 34, .25); }
.sheet h2 { font-size: 16px; font-weight: 700; margin-bottom: 4px; } .sheet form { margin-top: 14px; display: grid; gap: 12px; }
.field { display: grid; gap: 4px; } .field > span { font-size: 12px; font-weight: 600; color: var(--sub); }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 16px); z-index: 60; background: var(--night); color: #fff; font-weight: 500; padding: 10px 16px; border-radius: var(--r); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; max-width: calc(100vw - 32px); box-shadow: 0 8px 24px rgba(10, 13, 34, .25); }
.toast.on { opacity: 1; transform: translate(-50%, 0); } .toast.bad { background: var(--bad); }
.login { max-width: 360px; margin: 12vh auto 0; display: grid; gap: 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 24px; box-shadow: var(--shadow); }
.login h1 { font-size: 16px; font-weight: 700; }

@media (max-width: 900px) {
  .top { padding: 0 12px; gap: 10px; } .brand small, .who, .flag { display: none; } .nav a { padding: 6px 10px; } main { padding: 14px 12px 60px; }
  .stats { grid-template-columns: repeat(2, 1fr); } .seg { overflow-x: auto; }
  .lhead { display: none; } .lrow { grid-template-columns: 40px 1fr 16px; row-gap: 8px; padding: 12px; }
  .lrow .when { display: none; } .lrow .cc { grid-column: 1 / -1; grid-auto-flow: column; justify-content: start; align-items: center; gap: 8px; }
  .lrow .cc::before { content: attr(data-c); font: 700 11px var(--num); color: var(--navy); width: 22px; } .lrow .go { grid-column: 3; grid-row: 1; }
  .cols { grid-auto-columns: 78vw; } .log { grid-template-columns: 76px 1fr; } .log span:nth-child(n+3) { grid-column: 2; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
