/* ============================================================
   CJ 그룹 SNS 채널 대시보드 — 모바일 웹앱

   색은 CJ 컬러셋 그대로 씁니다.
     CJ Blue   #006ECD   기본 동작 · 링크
     CJ Yellow #FF9700   보조 강조
     CJ Red    #EF151E   포인트 · 최신
     CJ Black  #000000   본문
     CJ Gray   #97999B   보조 텍스트
     CJ White  #FFFFFF   면
   ============================================================ */
:root {
  --cj-blue:   #006ECD;
  --cj-yellow: #FF9700;
  --cj-red:    #EF151E;
  --cj-black:  #000000;
  --cj-gray:   #97999B;
  --cj-white:  #FFFFFF;

  /* 위 여섯 색에서 파생한 보조 톤 */
  --ink:       #14161A;
  --ink-2:     #4A4F57;
  --muted:     #7C8087;
  --line:      #E6E7EA;
  --line-soft: #F1F2F4;
  --paper:     #FFFFFF;
  --bg:        #F5F6F8;
  --navy:      #0A1929;

  --blue-soft: #E7F1FC;
  --red-soft:  #FDE9EA;

  --radius:    18px;
  --shadow:    0 1px 2px rgba(20,22,26,.05), 0 8px 24px rgba(20,22,26,.06);
  --tap:       48px;   /* 손가락으로 누르는 최소 크기 */
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont,
               'Apple SD Gothic Neo', 'Noto Sans KR', 'Malgun Gothic', system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
}
.mono { font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }

a { color: var(--cj-blue); }
button, input { font: inherit; color: inherit; }

/* ------------------------------------------------------------ 레이아웃 */
.wrap {
  max-width: 560px;
  margin: 0 auto;
  padding: 0 20px;
}
.safe-top    { padding-top: env(safe-area-inset-top); }
.safe-bottom { padding-bottom: env(safe-area-inset-bottom); }

/* ------------------------------------------------------------ 로그인 */
.auth {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
}
.auth-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 32px 20px 24px;
  max-width: 560px;
  width: 100%;
  margin: 0 auto;
}
.auth-logo {
  width: 82px;
  height: auto;
  display: block;
  margin-bottom: 30px;
}
.auth h1 {
  font-size: 27px;
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1.22;
  margin-bottom: 10px;
}
.auth h1 .accent { color: var(--cj-red); }
.auth .lead {
  color: var(--muted);
  font-size: 14.5px;
  margin-bottom: 34px;
}

/* CI 4색 띠 — 로고의 세 페탈 색을 그대로 씁니다 */
.brandbar {
  display: flex;
  height: 4px;
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 26px;
  max-width: 132px;
}
.brandbar i { flex: 1; display: block; }
.brandbar i:nth-child(1) { background: var(--cj-blue); }
.brandbar i:nth-child(2) { background: var(--cj-yellow); }
.brandbar i:nth-child(3) { background: var(--cj-red); }
.brandbar i:nth-child(4) { background: var(--cj-black); }

.field { margin-bottom: 18px; }
.field label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 8px;
  text-transform: uppercase;
}
.input {
  width: 100%;
  height: 54px;
  padding: 0 16px;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  background: var(--paper);
  font-size: 16px;               /* 16px 미만이면 iOS 가 화면을 확대합니다 */
  transition: border-color .15s, box-shadow .15s;
}
.input:focus {
  outline: none;
  border-color: var(--cj-blue);
  box-shadow: 0 0 0 4px var(--blue-soft);
}
.input[readonly] { background: var(--line-soft); color: var(--ink-2); }

/* 인증번호 6칸 */
.code-row {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  margin-bottom: 6px;
}
.code-row input {
  /* input 은 기본 최소 폭이 커서, 그리드 칸을 벌려 6칸이 한 줄에 안 들어갑니다 */
  min-width: 0;
  width: 100%;
  padding: 0;
  height: 58px;
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  border: 1.5px solid var(--line);
  border-radius: 13px;
  background: var(--paper);
  font-variant-numeric: tabular-nums;
  transition: border-color .15s, box-shadow .15s;
}
.code-row input:focus {
  outline: none;
  border-color: var(--cj-blue);
  box-shadow: 0 0 0 4px var(--blue-soft);
}
.code-row input.filled { border-color: var(--cj-blue); }

.hint { font-size: 12.5px; color: var(--muted); margin-top: 10px; }
.hint b { color: var(--ink-2); }

.alert {
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 13.5px;
  line-height: 1.5;
  margin-bottom: 18px;
  background: var(--red-soft);
  border: 1px solid rgba(239,21,30,.24);
  color: #A50E15;
}
.alert.warn {
  background: #FFF6E8;
  border-color: rgba(255,151,0,.32);
  color: #8A5300;
}

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: var(--tap);
  height: 54px;
  border: none;
  border-radius: 14px;
  background: var(--cj-blue);
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s, transform .08s;
}
.btn:active { transform: scale(.985); }
.btn:hover { background: #0060B4; }
.btn:focus-visible { outline: 3px solid var(--cj-yellow); outline-offset: 2px; }
.btn.ghost {
  background: transparent;
  color: var(--ink-2);
  border: 1.5px solid var(--line);
  font-weight: 600;
}
.btn.ghost:hover { background: var(--line-soft); }

.auth-foot {
  padding: 18px 20px calc(18px + env(safe-area-inset-bottom));
  text-align: center;
  font-size: 11.5px;
  color: var(--gray, #97999B);
  letter-spacing: 0.04em;
}

/* ------------------------------------------------------------ 목록 */
.appbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top);
}
.appbar-in {
  max-width: 560px;
  margin: 0 auto;
  padding: 0 20px;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.appbar img { width: 34px; height: auto; display: block; }
.appbar .t {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-right: auto;
}
.appbar .who {
  font-size: 11.5px;
  color: var(--muted);
  max-width: 42%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.iconbtn {
  width: 40px; height: 40px;
  border: none; background: transparent;
  border-radius: 12px;
  color: var(--muted);
  display: grid; place-items: center;
  cursor: pointer;
}
.iconbtn:hover { background: var(--line-soft); color: var(--ink); }

.hero {
  background: var(--navy);
  color: #fff;
  padding: 28px 0 30px;
  position: relative;
  overflow: hidden;
}
.hero::after {
  content: '';
  position: absolute;
  right: -70px; top: -90px;
  width: 260px; height: 260px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0,110,205,.55) 0%, transparent 68%);
}
.hero .eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 10.5px; font-weight: 700;
  letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--cj-yellow);
  margin-bottom: 12px;
  position: relative;
}
.hero .eyebrow::before {
  content: ''; width: 22px; height: 1px; background: var(--cj-yellow);
}
.hero h2 {
  font-size: 23px; font-weight: 800;
  letter-spacing: -0.035em; line-height: 1.25;
  position: relative;
}
.hero p {
  margin-top: 8px;
  font-size: 13.5px;
  color: rgba(255,255,255,.66);
  position: relative;
}

/* .wrap 의 좌우 여백을 지우지 않도록 위아래만 지정합니다 */
.list { padding-top: 20px; padding-bottom: 40px; }
.list-head {
  display: flex; align-items: baseline; gap: 8px;
  margin-bottom: 12px;
}
.list-head h3 { font-size: 15px; font-weight: 800; letter-spacing: -0.02em; }
.list-head .count {
  font-size: 11.5px; font-weight: 700; color: var(--muted);
  background: var(--line-soft); padding: 2px 9px; border-radius: 10px;
}

.card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 16px 16px 14px;
  margin-bottom: 10px;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
  transition: transform .12s, box-shadow .18s, border-color .18s;
}
.card:active { transform: scale(.99); }
.card:hover { border-color: #D6D8DD; box-shadow: 0 2px 4px rgba(20,22,26,.06), 0 14px 34px rgba(20,22,26,.09); }
.card::before {
  content: '';
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 4px;
  background: var(--accent, var(--cj-blue));
}
.card .mark {
  flex: 0 0 auto;
  width: 46px; height: 46px;
  border-radius: 14px;
  display: grid; place-items: center;
  background: var(--accent-soft, var(--blue-soft));
  color: var(--accent, var(--cj-blue));
  font-size: 15px; font-weight: 800;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}
.card .body { flex: 1; min-width: 0; }
.card .title {
  font-size: 15.5px; font-weight: 700; letter-spacing: -0.02em;
  margin-bottom: 3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card .meta {
  font-size: 12px; color: var(--muted);
  display: flex; flex-wrap: wrap; gap: 4px 10px;
}
.card .chev { flex: 0 0 auto; color: #C2C5CB; }
.badge-new {
  display: inline-block;
  font-size: 10px; font-weight: 800; letter-spacing: 0.04em;
  color: #fff; background: var(--cj-red);
  padding: 1px 7px; border-radius: 8px;
  vertical-align: 1px;
}

.empty {
  background: var(--paper);
  border: 1px dashed #D9DBE0;
  border-radius: var(--radius);
  padding: 34px 22px;
  text-align: center;
}
.empty .ico { font-size: 30px; margin-bottom: 12px; }
.empty h4 { font-size: 15.5px; font-weight: 700; margin-bottom: 8px; }
.empty p { font-size: 13.5px; color: var(--muted); line-height: 1.6; }
.empty code {
  background: var(--line-soft); padding: 1px 6px; border-radius: 6px;
  font-size: 12.5px;
}

.foot {
  text-align: center;
  font-size: 11.5px;
  color: var(--cj-gray);
  padding: 8px 20px calc(28px + env(safe-area-inset-bottom));
  letter-spacing: 0.03em;
}

/* ------------------------------------------------------------ 리포트 보기 */
.viewer {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}
.viewer-bar {
  flex: 0 0 auto;
  background: rgba(255,255,255,.94);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top);
}
.viewer-bar .in {
  height: 52px;
  display: flex; align-items: center; gap: 10px;
  padding: 0 14px;
}
.viewer-bar img { width: 30px; height: auto; }
.viewer-bar .t {
  font-size: 14px; font-weight: 700; letter-spacing: -0.02em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.viewer-frame {
  flex: 1 1 auto;
  width: 100%;
  border: 0;
  display: block;
  background: var(--paper);
}
.viewer-foot {
  flex: 0 0 auto;
  background: var(--paper);
  border-top: 1px solid var(--line);
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
}
/* 요청하신 하단 전체폭 버튼 */
.viewer-foot .btn { width: 100%; }

/* 리포트 로딩 표시 */
.loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: var(--paper);
  transition: opacity .25s;
}
.loading.done { opacity: 0; pointer-events: none; }
.loading .spin {
  width: 34px; height: 34px;
  border: 3px solid var(--line);
  border-top-color: var(--cj-blue);
  border-radius: 50%;
  animation: spin .8s linear infinite;
  margin: 0 auto 12px;
}
.loading p { font-size: 13px; color: var(--muted); text-align: center; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .loading .spin { animation: none; }
  .card, .btn { transition: none; }
}

/* 데스크톱에서도 앱처럼 가운데 정렬 */
@media (min-width: 900px) {
  .viewer { max-width: 480px; margin: 0 auto; box-shadow: 0 0 0 1px var(--line); }
}

/* ============================================================
   실서비스 추가 스타일
   앞의 규칙(색·버튼·카드)은 그대로 두고 필요한 것만 덧붙입니다.
   ============================================================ */

/* ---------------- 인증번호 한 칸 입력
   자릿수를 노출하지 않으려고 칸을 나누지 않았습니다.
   maxlength 도 12로 넉넉히 두어 몇 자리인지 드러나지 않습니다. */
.code-input {
  width: 100%;
  height: 58px;
  padding: 0 16px;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  background: var(--paper);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.28em;
  text-align: center;
  font-variant-numeric: tabular-nums;
  transition: border-color .15s, box-shadow .15s;
}
.code-input::placeholder { font-size: 15px; font-weight: 400; letter-spacing: 0; color: #B7BAC1; }
.code-input:focus {
  outline: none;
  border-color: var(--cj-blue);
  box-shadow: 0 0 0 4px var(--blue-soft);
}

/* ---------------- PWA 설치 버튼 (작게) */
.pwa-hint {
  display: none;
  margin-top: 18px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--paper);
  align-items: center;
  gap: 10px;
}
.pwa-hint.on { display: flex; }
.pwa-hint .ico {
  flex: 0 0 auto; width: 34px; height: 34px; border-radius: 10px;
  background: var(--blue-soft); color: var(--cj-blue);
  display: grid; place-items: center;
}
.pwa-hint .tx { flex: 1; min-width: 0; }
.pwa-hint .tx b { display: block; font-size: 13px; font-weight: 700; color: var(--ink); }
.pwa-hint .tx span { font-size: 11.5px; color: var(--muted); }
.btn-mini {
  flex: 0 0 auto;
  height: 34px; padding: 0 14px;
  border: none; border-radius: 10px;
  background: var(--cj-blue); color: #fff;
  font: inherit; font-size: 12.5px; font-weight: 700;
  cursor: pointer; white-space: nowrap;
}
.btn-mini:hover { background: #0060B4; }
.btn-mini.ghost { background: var(--line-soft); color: var(--ink-2); }

/* ---------------- 마이페이지 */
.tabs-line {
  display: flex; gap: 4px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 18px;
  overflow-x: auto; scrollbar-width: none;
}
.tabs-line::-webkit-scrollbar { display: none; }
.tabs-line a {
  flex: 0 0 auto;
  padding: 12px 14px;
  font-size: 13.5px; font-weight: 600;
  color: var(--muted); text-decoration: none;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}
.tabs-line a.on { color: var(--cj-red); border-bottom-color: var(--cj-red); }

.panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}
.panel h4 {
  font-size: 13.5px; font-weight: 800; letter-spacing: -.02em;
  margin-bottom: 4px;
}
.panel .sub { font-size: 12px; color: var(--muted); margin-bottom: 14px; }

.kv { display: flex; flex-direction: column; gap: 10px; }
.kv .row {
  display: flex; align-items: baseline; gap: 12px;
  padding-bottom: 10px; border-bottom: 1px solid var(--line-soft);
}
.kv .row:last-child { border-bottom: 0; padding-bottom: 0; }
.kv .k { flex: 0 0 88px; font-size: 12px; color: var(--muted); }
.kv .v { flex: 1; font-size: 13.5px; color: var(--ink); word-break: break-all; }

.logrow {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 0; border-bottom: 1px solid var(--line-soft);
  font-size: 13px;
}
.logrow:last-child { border-bottom: 0; }
.logrow .dot { flex: 0 0 auto; width: 7px; height: 7px; border-radius: 50%; }
.logrow .main { flex: 1; min-width: 0; }
.logrow .main b { font-weight: 700; color: var(--ink); }
.logrow .main span { display: block; font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.logrow .when { flex: 0 0 auto; font-size: 11.5px; color: var(--muted); text-align: right; }

/* 스위치 */
.switch { display: flex; align-items: center; gap: 12px; }
.switch .lbl { flex: 1; }
.switch .lbl b { display: block; font-size: 13.5px; font-weight: 700; color: var(--ink); }
.switch .lbl span { font-size: 11.5px; color: var(--muted); }
.sw {
  flex: 0 0 auto; width: 50px; height: 30px; border-radius: 15px;
  background: #D6D8DD; border: none; cursor: pointer; position: relative;
  transition: background .18s;
}
.sw::after {
  content: ''; position: absolute; top: 3px; left: 3px;
  width: 24px; height: 24px; border-radius: 50%; background: #fff;
  transition: transform .18s; box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.sw[aria-checked="true"] { background: var(--cj-blue); }
.sw[aria-checked="true"]::after { transform: translateX(20px); }
.sw:disabled { opacity: .5; cursor: not-allowed; }

/* 알림 문구 */
.toast {
  position: fixed; left: 50%; bottom: calc(22px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(12px);
  background: var(--navy); color: #fff;
  padding: 11px 18px; border-radius: 12px;
  font-size: 13px; font-weight: 600;
  opacity: 0; pointer-events: none; transition: .22s;
  z-index: 90; max-width: 90vw; text-align: center;
}
.toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }

.empty-sm {
  padding: 26px 16px; text-align: center;
  font-size: 13px; color: var(--muted);
}
