/* CATSEYE — 인플루언서 방송 모니터링 · 팀 공통 톤앤매너 (virusmachine 기준) */
:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface2: #f8f9fa;
  --surface3: #fafbfc;
  --ink: #1f2328;
  --muted: #6d6e6f;
  --faint: #9b9ca0;
  --line: #e6e7eb;
  --line-soft: #f0f1f3;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .06), 0 4px 14px rgba(0, 0, 0, .05);
  --accent: #2eb88a;
  --accent-deep: #1f7a4d;
  --accent-soft: #e7f6ef;
  --accent-line: #cdeadd;
  --blue: #4573d2;
  --blue-soft: #eaf0fb;
  --orange: #cf8a2c;
  --orange-ink: #9a6314;
  --orange-soft: #f9efdc;
  --green: #1f7a4d;
  --green-soft: #e7f6ef;
  --purple: #7b68ee;
  --purple-ink: #5b48d6;
  --purple-soft: #efeafe;
  --red: #d9534f;
  --red-soft: #fdecec;
  --red-line: #f3cccb;
  --live: #d9534f;
}
:root[data-theme="dark"] {
  --bg: #15171c;
  --surface: #1d2026;
  --surface2: #23262d;
  --surface3: #262a32;
  --ink: #e8eaed;
  --muted: #a6abb3;
  --faint: #71767f;
  --line: #2c313b;
  --line-soft: #262a32;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 6px 18px rgba(0, 0, 0, .35);
  --accent: #2eb88a;
  --accent-deep: #2eb88a;
  --accent-soft: #17352a;
  --accent-line: #245c44;
  --blue: #8fadf0;
  --blue-soft: #222c43;
  --orange: #eec272;
  --orange-ink: #eec272;
  --orange-soft: #362c17;
  --green: #5ccfc4;
  --green-soft: #14333a;
  --purple: #c9b3ff;
  --purple-ink: #c9b3ff;
  --purple-soft: #2b2547;
  --red: #f08a8a;
  --red-soft: #3a2224;
  --red-line: #6b3a3c;
  --live: #f08a8a;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: Tahoma, "Paperlogy", "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; }
a { color: var(--accent); text-decoration: none; }

/* ── 로그인 게이트 ── */
.gate {
  min-height: 100vh; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent-soft), var(--bg) 60%);
}
.gate-card {
  background: var(--surface); border-radius: 18px; box-shadow: var(--shadow);
  padding: 40px 36px; width: 380px; max-width: calc(100vw - 40px); text-align: center;
}
.gate-logo {
  width: 56px; height: 56px; border-radius: 15px; margin: 0 auto 14px;
  background: linear-gradient(135deg, #2eb88a, #5ccfc4);
  display: grid; place-items: center; font-size: 28px;
}
.gate h1 { font-size: 22px; letter-spacing: 2px; margin: 0 0 4px; }
.gate .sub { color: var(--muted); font-size: 13px; margin: 0 0 24px; }
.gbtn {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 10px;
  background: var(--ink); color: var(--bg); border: none; border-radius: 10px;
  padding: 13px; font-size: 14.5px; font-weight: 700; cursor: pointer;
}
.gate .note { margin-top: 16px; font-size: 12px; color: var(--faint); }

/* ── 앱 레이아웃 ── */
#app { display: flex; min-height: 100vh; }
.sidebar {
  width: 224px; min-width: 224px; background: var(--surface);
  border-right: 1px solid var(--line); display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.side-logo { padding: 20px 18px 16px; border-bottom: 1px solid var(--line-soft); }
.side-logo h1 { font-size: 17px; letter-spacing: 2.5px; margin: 0; }
.side-logo h1 b { color: var(--accent); }
.side-logo p { font-size: 11px; color: var(--faint); margin: 3px 0 0; }
.side-nav { flex: 1; padding: 12px 10px; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 9px; padding: 9px 11px; border-radius: 8px;
  cursor: pointer; color: var(--muted); font-size: 13.5px; font-weight: 600; user-select: none;
  transition: background .12s, color .12s;
}
.nav-item:hover { background: var(--surface2); color: var(--ink); }
.nav-item.on { background: var(--accent-soft); color: var(--accent-deep); }
.nav-item .ic { width: 18px; text-align: center; }
.side-foot { padding: 12px 16px; border-top: 1px solid var(--line-soft); font-size: 11.5px; color: var(--faint); display: flex; align-items: center; justify-content: space-between; }
.side-foot button { background: none; border: none; color: var(--faint); cursor: pointer; font-size: 12px; }
.side-foot button:hover { color: var(--ink); }

main { flex: 1; padding: 26px 32px 60px; min-width: 0; }
main > * { max-width: 1400px; }   /* 초광폭에서 카드가 과도하게 늘어나지 않게 */
.pagehead { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; padding-right: 150px; }
.pagehead h2 { font-size: 20px; margin: 0; }
.pagehead .crumb { color: var(--faint); font-weight: 400; }

/* ── 컴포넌트 ── */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px 20px; margin-bottom: 14px;
}
.card h3 { font-size: 14.5px; margin: 0 0 12px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
@media (max-width: 1100px) { .grid4 { grid-template-columns: repeat(2, 1fr); } .grid3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 620px) { .grid2, .grid3, .grid4 { grid-template-columns: 1fr; } }

.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.stat .k { font-size: 12px; color: var(--muted); }
.stat .v { font-size: 22px; font-weight: 800; margin-top: 2px; }
.stat .s { font-size: 11.5px; color: var(--faint); margin-top: 2px; }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--accent); color: #fff; border: none; border-radius: 9px;
  padding: 9px 15px; font-size: 13.5px; font-weight: 700; cursor: pointer;
}
.btn:hover { background: var(--accent-deep); }
.btn.ghost { background: var(--surface); color: var(--ink); border: 1px solid var(--line); }
.btn.ghost:hover { border-color: var(--accent); color: var(--accent-deep); background: var(--surface); }
.btn.sm { padding: 6px 11px; font-size: 12.5px; border-radius: 7px; }
.btn.danger { background: var(--red); }

.chip { display: inline-block; font-size: 11.5px; font-weight: 700; border-radius: 6px; padding: 2px 8px; vertical-align: middle; }
.chip.acc { background: var(--accent-soft); color: var(--accent-deep); }
.chip.blue { background: var(--blue-soft); color: var(--blue); }
.chip.orange { background: var(--orange-soft); color: var(--orange-ink); }
.chip.purple { background: var(--purple-soft); color: var(--purple-ink); }
.chip.red { background: var(--red-soft); color: var(--red); }
.chip.gray { background: var(--surface2); color: var(--muted); }
.chip.live { background: var(--red-soft); color: var(--live); animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .55; } }

table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; font-size: 11.5px; color: var(--muted); font-weight: 700; padding: 8px 10px; border-bottom: 1px solid var(--line); background: var(--surface2); white-space: nowrap; }
.tbl td { padding: 9px 10px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.tbl tr:hover td { background: var(--surface3); }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.tblwrap { overflow-x: auto; }

input, select, textarea {
  width: 100%; background: var(--surface2); border: 1px solid var(--line);
  border-radius: 8px; color: var(--ink); padding: 9px 11px; font-family: inherit; font-size: 13.5px;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }
label.f { display: block; margin-bottom: 12px; }
label.f > span { display: block; font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 5px; }
.frow { display: flex; gap: 12px; } .frow > * { flex: 1; }
.frow-end { align-items: flex-end; }

.empty { text-align: center; padding: 44px 20px; color: var(--faint); font-size: 13.5px; border: 1px dashed var(--line); border-radius: var(--radius); }

/* 탭 (캠페인 상세) */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; flex-wrap: wrap; }
.tabs .tab {
  padding: 10px 14px; font-size: 13.5px; font-weight: 700; color: var(--muted);
  border-bottom: 2.5px solid transparent; margin-bottom: -1px; cursor: pointer; user-select: none;
}
.tabs .tab:hover { color: var(--ink); }
.tabs .tab.on { color: var(--accent-deep); border-bottom-color: var(--accent); }

/* 신호등 */
.light { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: baseline; }
.light.ok { background: var(--accent); }
.light.warn { background: var(--orange); }
.light.fail { background: var(--red); }
.light.na { background: var(--faint); opacity: .4; }

/* 모달 */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: none; align-items: flex-start; justify-content: center; z-index: 100; padding: 6vh 16px; overflow-y: auto; }
.modal-bg.show { display: flex; }
.modal { background: var(--surface); border-radius: 16px; box-shadow: var(--shadow); width: 620px; max-width: 100%; padding: 22px 24px; }
.modal h3 { margin: 0 0 16px; font-size: 16px; }
.modal .m-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }

/* 토스트 */
#toast { position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%); background: var(--accent-deep); color: #fff; padding: 10px 20px; border-radius: 999px; font-size: 13px; display: none; z-index: 200; }

/* 캠페인 카드 목록 */
.camp-card { display: block; color: inherit; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 12px; cursor: pointer; }
.camp-card:hover { border-color: var(--accent-line); box-shadow: var(--shadow); }
.camp-card .t { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 800; }
.camp-card .meta { color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.camp-card .nums { display: flex; gap: 18px; margin-top: 10px; font-size: 12.5px; color: var(--muted); }
.camp-card .nums b { color: var(--ink); }

/* 통화 전환 토글 (우측 상단 고정) */
.fx-toggle {
  position: fixed; top: 16px; right: 20px; z-index: 60;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line);
  border-radius: 999px; padding: 7px 14px; font-size: 12.5px; font-weight: 800;
  cursor: pointer; box-shadow: var(--shadow); letter-spacing: .3px;
}
.fx-toggle:hover { border-color: var(--accent); color: var(--accent-deep); }
.fx-toggle .rate { font-weight: 500; color: var(--faint); margin-left: 6px; }

.muted { color: var(--muted); } .faint { color: var(--faint); } .sm { font-size: 12px; }
.mt0 { margin-top: 0; } .mb0 { margin-bottom: 0; }

/* 크리에이터 프로필 카드 */
.cr-card {
  display: flex; align-items: center; gap: 14px;
  padding: 13px 6px; border-bottom: 1px solid var(--line-soft);
}
.cr-card:last-child { border-bottom: none; }
.cr-thumb {
  width: 52px; height: 52px; border-radius: 50%; flex: 0 0 52px;
  background: var(--surface2); display: grid; place-items: center; font-size: 22px; overflow: hidden;
}
.cr-thumb img { width: 100%; height: 100%; object-fit: cover; }
.cr-main { flex: 1; min-width: 0; }
.cr-name { display: flex; align-items: center; gap: 8px; font-size: 14.5px; margin-bottom: 3px; flex-wrap: wrap; }
.cr-chan { margin-bottom: 3px; }
.cr-meta b { color: var(--ink); }
.cr-side { text-align: right; flex: 0 0 auto; }
@media (max-width: 620px) {
  .cr-card { flex-wrap: wrap; }
  .cr-side { text-align: left; width: 100%; display: flex; gap: 12px; align-items: center; }
  .cr-side button { margin-top: 0 !important; margin-left: auto; }
}

/* ── 반응형: 좁은 창에서 사이드바를 상단 바로 전환 ── */
@media (max-width: 860px) {
  #app { flex-direction: column; }
  .sidebar {
    width: 100%; min-width: 0; height: auto; position: static;
    border-right: none; border-bottom: 1px solid var(--line);
    flex-direction: row; align-items: center; flex-wrap: wrap;
  }
  .side-logo { padding: 12px 14px 8px; border-bottom: none; flex: 1 1 auto; }
  .side-logo p { display: none; }
  .side-nav { display: flex; gap: 4px; padding: 0 10px 8px; overflow-x: auto; flex: 1 1 100%; order: 3; }
  .nav-item { white-space: nowrap; padding: 8px 11px; }
  .side-foot { border-top: none; padding: 12px 14px 8px; flex: 0 0 auto; gap: 8px; }
  main { padding: 18px 14px 70px; }
  .pagehead { padding-right: 0; }
  .pagehead h2 { font-size: 18px; }
  .fx-toggle { top: auto; bottom: 16px; right: 14px; }
  .tabs { flex-wrap: nowrap; overflow-x: auto; }
  .tabs .tab { white-space: nowrap; padding: 10px 11px; }
  .frow { flex-direction: column; gap: 0; }
  .frow-end { align-items: stretch; gap: 10px; }
  .modal { padding: 18px 16px; }
}
