/* ============================================================
   체험단 예약 — 카카오 순정 톤 (~/projects/design/kakao-native)
   ------------------------------------------------------------
   색·컴포넌트 규칙 : accounts.kakao.com 실측 CSS (tokens.md)
   레이아웃 어법     : toss.im 실측 — 여백·좌측정렬·큰 제목, 그림자 없음
   폰트             : Pretendard Variable (자체 호스팅 서브셋,
                     /static/fonts/pretendard.css 가 선언)
   ------------------------------------------------------------
   기존 템플릿의 클래스 이름은 바꾸지 않았다. 이 파일이 그 이름들을
   카카오 문법으로 다시 정의한다. 다크모드는 시스템 설정을 따른다.
   ============================================================ */

:root {
  --kb-yellow:       #fee500;            /* YELLOW500S — 카카오 액션 전용 */
  --kb-yellow-press: #f4dc00;

  --bg:            #f7f7f7;              /* GRAY000S — 관리자: 회색 바탕 + 흰 면 */
  --surface:       #fff;
  --surface-press: rgba(0,0,0,.04);      /* GRAY050A */
  --fill:          rgba(0,0,0,.06);      /* GRAY070A — 보조 버튼 */

  --fg:      #191919;                    /* GRAY900S */
  --fg-sub:  #595959;                    /* GRAY600S */
  --fg-mute: #767676;                    /* GRAY550S */
  --fg-dim:  #a6a6a6;

  --line:        rgba(0,0,0,.08);        /* GRAY100A */
  --line-strong: #ccc;                   /* GRAY300S — 입력 밑줄 */

  --point:    #f4551e;                   /* RED500S */
  --point-bg: rgba(244,85,30,.1);
  --ok:       #00a83e;                   /* GREEN 계열 — 흰 바탕 대비 확보 */
  --ok-bg:    rgba(0,205,60,.1);

  --r-s:  8px;
  --r-m: 14px;
  --r-l: 20px;

  /* 옛 템플릿이 쓰던 변수명. 지우지 말 것 — 인라인 style 이 참조한다. */
  --muted:  var(--fg-mute);
  --accent: var(--point);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:            #151515;
    --surface:       #202020;
    --surface-press: hsla(0,0%,100%,.08);
    --fill:          hsla(0,0%,100%,.1);

    --fg:      #f2f2f2;
    --fg-sub:  #c9c9c9;
    --fg-mute: #a6a6a6;
    --fg-dim:  #7c7c7c;

    --line:        hsla(0,0%,100%,.12);
    --line-strong: #595959;

    --point:    #ff7849;
    --point-bg: rgba(255,120,73,.14);
    --ok:       #00cd3c;
    --ok-bg:    rgba(0,205,60,.16);
  }
}

/* ── 바탕 ─────────────────────────────────────────── */

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: 'Pretendard Variable', Pretendard, system-ui, -apple-system,
               BlinkMacSystemFont, 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
  /* Pretendard 는 자간이 이미 맞춰져 있다. 여기서 또 조이면 글자가 붙는다. */
  letter-spacing: 0;
  font-size: 15px;
  line-height: 1.6;
  -webkit-text-size-adjust: none;
  min-height: 100vh;
}

h1 { font-size: 22px; font-weight: 700; line-height: 1.35; margin: 0 0 4px; }
h2 { font-size: 16px; font-weight: 700; margin: 28px 0 10px; }
a  { color: var(--point); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-size: 13px; background: var(--fill); border-radius: 4px; padding: 1px 5px; }

.sub   { color: var(--fg-mute); font-size: 13px; margin-bottom: 16px; }
.muted { color: var(--fg-mute); }

/* ── 관리자 상단 ──────────────────────────────────── */

header.top {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 12px 20px;
  display: flex; justify-content: space-between; align-items: center;
}
header.top > a { color: var(--fg); font-weight: 700; font-size: 16px; }
header.top > a:hover { text-decoration: none; }

.testbar {
  background: var(--point);
  color: #fff;
  padding: 8px 20px;
  font-size: 13px;
  text-align: center;
}
.testbar code { background: rgba(255,255,255,.2); color: #fff; }

/* 매장 이동줄 — 어느 화면에서도 같은 자리 */
.storebar { background: var(--surface); border-bottom: 1px solid var(--line); padding: 10px 20px; }
.storebar .inner {
  max-width: 960px; margin: 0 auto;
  display: flex; gap: 12px; align-items: baseline;
  justify-content: space-between; flex-wrap: wrap;
}
.storebar .who  { font-weight: 700; font-size: 16px; }
.storebar .back { font-size: 13px; color: var(--fg-mute); }
.storebar nav { display: flex; gap: 6px; flex-wrap: wrap; }
.storebar nav a {
  display: inline-block; padding: 6px 12px;
  border-radius: 999px;                       /* 알약 탭 */
  font-size: 13px; font-weight: 500;
  color: var(--fg-sub); background: transparent;
}
.storebar nav a:hover { background: var(--fill); text-decoration: none; }
.storebar nav a.on { background: var(--fg); color: var(--bg); font-weight: 600; }

main { max-width: 960px; margin: 20px auto; padding: 0 16px 60px; }

/* ── 면(카드) — 그림자 없이 배경 차 + 1px 선으로만 가른다 ── */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-m);
  padding: 18px;
  margin-bottom: 16px;
}

/* ── 표 — 칸막이 격자 대신 가로줄만 ─────────────────── */

table { width: 100%; border-collapse: collapse; background: var(--surface); }
th, td { padding: 9px 10px; text-align: left; font-size: 14px; border: 0; border-bottom: 1px solid var(--line); }
th { font-weight: 600; font-size: 13px; color: var(--fg-mute); }
main > table, main form > table {
  border: 1px solid var(--line); border-radius: var(--r-m);
  overflow: hidden; border-style: solid;
}
/* border-radius 는 collapse 와 같이 못 쓴다 — 표를 면으로 감싸는 쪽으로 처리 */
main > table, main form > table { border-collapse: separate; border-spacing: 0; }
main > table tr:last-child td, main form > table tr:last-child td { border-bottom: 0; }
.card table { border: 0; }
.card table tr:last-child td { border-bottom: 0; }
td.nowrap { white-space: nowrap; }

/* 좁은 화면: 달력 아닌 표는 옆으로 민다 */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
@media (max-width: 640px) {
  main table:not(.cal):not(.picker) { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  /* 칸이 세로로 눌려 한 글자씩 꺾이는 것을 막는다 — 대신 옆으로 민다.
     아주 긴 내용은 줄임표로 자른다. */
  main table:not(.cal):not(.picker) th,
  main table:not(.cal):not(.picker) td {
    white-space: nowrap; max-width: 70vw; overflow: hidden; text-overflow: ellipsis;
  }
}

/* ── 입력 — 카카오는 상자가 아니라 밑줄이다 ─────────── */

input, textarea {
  font: inherit; letter-spacing: inherit; color: var(--fg);
  border: 0; border-bottom: 2px solid var(--line-strong); border-radius: 0;
  background: transparent;
  padding: 7px 2px; font-size: 15px; line-height: 1.5;
  outline: none;
  transition: border-color .15s;
}
input:focus, textarea:focus { border-bottom-color: var(--fg); }
input::placeholder, textarea::placeholder { color: var(--fg-dim); }
input[type="checkbox"], input[type="radio"] {
  border: 0; width: 20px; height: 20px; accent-color: var(--fg); cursor: pointer;
}
textarea {
  /* 여러 줄 글은 밑줄로는 경계가 안 보인다 — 채움면을 쓴다 */
  background: var(--fill); border: 0; border-radius: var(--r-s);
  padding: 10px 12px; resize: vertical;
}
select {
  font: inherit; color: var(--fg);
  border: 0; border-radius: var(--r-s);
  background: var(--fill);
  padding: 8px 10px; cursor: pointer;
}

/* ── 버튼 — 기본은 잉크색, 보조는 채움면. 노랑은 카카오 액션 전용 ── */

button {
  font: inherit; letter-spacing: inherit; font-weight: 600;
  border: 0; border-radius: var(--r-s);
  padding: 9px 16px; font-size: 14px;
  background: var(--fg); color: var(--bg);
  cursor: pointer;
  transition: opacity .15s, background .15s;
}
button:active { opacity: .7; }
button:disabled { background: var(--fill); color: var(--fg-dim); cursor: not-allowed; }
button.plain { background: var(--fill); color: var(--fg); font-weight: 500; }
button.plain:active { background: var(--surface-press); opacity: 1; }
button.danger, button.plain.danger { background: var(--point-bg); color: var(--point); }

form.inline { display: inline-flex; gap: 6px; align-items: center; margin: 0; }

.row { display: flex; gap: 14px; flex-wrap: wrap; align-items: flex-end; }
.row label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--fg-mute); }

/* ── 알림 ─────────────────────────────────────────── */

.flash { padding: 12px 14px; border-radius: var(--r-s); margin-bottom: 14px; font-size: 14px; font-weight: 500; }
.flash.ok  { background: var(--ok-bg); color: var(--ok); }
.flash.err { background: var(--point-bg); color: var(--point); }

.warn {
  display: inline-block;
  background: var(--point-bg); color: var(--point);
  border-radius: 999px; padding: 2px 9px;
  font-size: 12px; font-weight: 600; margin-right: 4px;
}
.tag { font-size: 11px; color: var(--fg-mute); }
.tag.badge {
  background: var(--fill); border-radius: 999px; padding: 2px 8px;
  font-size: 11px; font-weight: 600; color: var(--fg-sub);
}

/* ── 관리자 달력 ──────────────────────────────────── */

table.cal { table-layout: fixed; }
table.cal td { height: 78px; vertical-align: top; padding: 6px; }
table.cal td.out     { background: var(--bg); color: var(--fg-dim); }
table.cal td.blocked { background: var(--bg); }
table.cal td.full    { background: var(--point-bg); }
table.cal td.today   { box-shadow: inset 0 0 0 2px var(--fg); }
.daynum { font-size: 12px; color: var(--fg-mute); }
.count { font-size: 17px; font-weight: 700; margin-top: 6px; display: block; text-decoration: none; }
.sun { color: var(--point); } .sat { color: var(--fg-sub); }
.bk { display: block; font-size: 12px; text-decoration: none; margin-top: 2px;
      overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--fg-sub); }
.bk.cancelled { opacity: .4; text-decoration: line-through; }
table.cal details summary { font-size: 12px; color: var(--fg-mute); cursor: pointer; }

@media (max-width: 640px) {
  main { margin-top: 12px; }
  h1 { font-size: 20px; }
  .card { padding: 14px; border-radius: var(--r-s); }
  th, td { padding: 8px 6px; font-size: 13px; }
  table.cal td { height: 64px; padding: 3px; }
  .count { font-size: 14px; }
  .bk { font-size: 10px; }
  .storebar, header.top { padding-left: 14px; padding-right: 14px; }
}

/* ── 공개 화면(신청·사장 링크) — 토스 어법: 흰 바탕, 큰 제목 ── */

body.public { background: var(--surface); }
body.public .wrap { max-width: 480px; margin: 0 auto; padding: 24px 20px 48px; }
body.public h1 { font-size: 24px; font-weight: 700; }
body.public .sub { font-size: 14px; }
body.public .card {
  border: 0; border-radius: var(--r-m);
  padding: 18px 0; margin-bottom: 6px;
  border-bottom: 1px solid var(--line);
}
body.public .card:last-child { border-bottom: 0; }
/* 강조가 필요한 면(확정·취소·가이드)은 클래스로 다시 면을 세운다 */
body.public .card.boxed {
  border: 1px solid var(--line); border-radius: var(--r-m);
  padding: 18px; margin-bottom: 14px;
}

label.field { display: block; margin-bottom: 16px; font-size: 14px; color: var(--fg-mute); }
label.field input, label.field textarea {
  width: 100%; margin-top: 4px;
  font-size: 17px; font-weight: 500;
  min-height: 44px;
}
label.field textarea { font-size: 15px; font-weight: 400; }

button.primary {
  width: 100%; height: 56px; margin-top: 4px;
  border-radius: var(--r-m);
  font-size: 17px; font-weight: 600;
  background: var(--fg); color: var(--bg);
}
button.primary:disabled { background: var(--fill); color: var(--fg-dim); }

.err { background: var(--point-bg); color: var(--point); padding: 12px 14px;
       border-radius: var(--r-s); margin-bottom: 14px; font-size: 14px; font-weight: 500; }
.ok  { background: var(--ok-bg); color: var(--ok); padding: 12px 14px;
       border-radius: var(--r-s); margin-bottom: 14px; font-size: 14px; font-weight: 500; }

.req { white-space: pre-wrap; background: var(--fill); border-radius: var(--r-s);
       padding: 12px 14px; font-size: 14px; color: var(--fg-sub); }

/* 사장이 폰에서 고르는 줄 — 줄 전체가 눌린다 */
.pick {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 14px; font-size: 15px;
  border: 0; box-shadow: inset 0 0 0 1px var(--line);   /* 당근 방식 — 1px 이 밀리지 않는다 */
  border-radius: var(--r-s); margin-bottom: 8px; cursor: pointer;
}
.pick:has(input:checked) { box-shadow: inset 0 0 0 2px var(--fg); font-weight: 600; }

/* 날짜 타일 */
.dates { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.dates input { position: absolute; opacity: 0; pointer-events: none; }
.dates label {
  display: block; box-shadow: inset 0 0 0 1px var(--line); border-radius: var(--r-s);
  padding: 10px 8px; text-align: center; cursor: pointer; background: var(--surface);
}
.dates label .d { font-size: 16px; font-weight: 600; }
.dates label .left { font-size: 12px; color: var(--fg-mute); margin-top: 2px; }
.dates input:checked + label { box-shadow: inset 0 0 0 2px var(--fg); }

/* 완료 화면 — 큰 확인, 좌측 정렬은 카드가 좁아 가운데 유지 */
.done { text-align: center; padding: 8px 0 4px; }
.done .big { font-size: 26px; font-weight: 700; color: var(--fg); margin: 10px 0 4px; }

dl { margin: 0; }
dl div { display: flex; justify-content: space-between; gap: 12px;
         padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
dl div:last-child { border-bottom: 0; }
dt { color: var(--fg-mute); }
dd { margin: 0; font-weight: 600; text-align: right; word-break: break-all; }

/* ── 날짜 선택 달력(_calendar_picker) ───────────────── */

.calnav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.calnav span { font-weight: 700; font-size: 16px; }
.navbtn {
  background: var(--fill); color: var(--fg); border: 0; border-radius: var(--r-s);
  width: 40px; height: 36px; font-size: 18px; font-weight: 400; cursor: pointer;
}
.navbtn:disabled { opacity: .35; cursor: not-allowed; background: var(--fill); color: var(--fg); }
table.picker { width: 100%; border-collapse: collapse; table-layout: fixed; background: transparent; border: 0; }
table.picker th { padding: 6px 0; font-size: 12px; color: var(--fg-mute); font-weight: 600;
                  text-align: center; border: 0; }
table.picker td { padding: 2px; text-align: center; border: 0; }
.day { width: 100%; aspect-ratio: 1/1; border: 0; background: none; border-radius: 50%;
       font-size: 15px; font-weight: 400; color: var(--fg); cursor: pointer; padding: 0; }
.day.off { color: var(--fg-dim); cursor: not-allowed; background: none; }
.day.open { background: var(--fill); color: var(--fg); font-weight: 600; }
.day.open:hover { background: var(--surface-press); }
.day.sel { background: var(--fg); color: var(--bg); font-weight: 700; }
.times { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 8px; }
.tbtn { border: 0; box-shadow: inset 0 0 0 1px var(--line); background: var(--surface);
        color: var(--fg); border-radius: var(--r-s); padding: 12px 6px;
        cursor: pointer; font-size: 15px; font-weight: 500; }
.tbtn.sel { box-shadow: inset 0 0 0 2px var(--fg); font-weight: 700; background: var(--surface); }

/* ── 대화 보기(owner_thread) ───────────────────────── */

.msg { border-top: 1px solid var(--line); padding: 12px 0; }
.msg:first-of-type { border-top: 0; }
.msg .meta { font-size: 12px; color: var(--fg-mute); margin-bottom: 4px; }
.msg .body { white-space: pre-wrap; font-size: 15px; padding: 10px 14px;
             border-radius: var(--r-m); background: var(--fill); }
.msg.out .body { background: var(--point-bg); }
.msg .judge { font-size: 12px; color: var(--fg-mute); margin-top: 5px; }
.msg .judge .why { margin-top: 2px; }
.msg .meta .failed { color: var(--point); font-weight: 600; }

.compose { border-top: 1px solid var(--line); margin-top: 18px; padding-top: 16px; }
.compose textarea { width: 100%; }

/* 상태점 — 선정자 명단·예약 달력. 빨강 = 예약 전, 노랑 = 예약함, 파랑 = 방문완료 */
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%;
       margin-right: 5px; vertical-align: 1px; }
.dot.red    { background: #f04452; }
.dot.yellow { background: #f0b400; }
.dot.blue   { background: #3182f6; }

.bdg { display: inline-block; min-width: 20px; padding: 1px 7px;
       border-radius: 999px; color: #fff; font-size: 12px; font-weight: 700;
       text-align: center; vertical-align: 2px; }
.bdg.red  { background: var(--point); }
.bdg.gray { background: var(--fg-dim); }

/* 로그인 */
body.login { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.loginbox { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l);
            padding: 32px 26px; width: min(360px, 92vw); }
.loginbox h1 { font-size: 20px; margin: 0 0 20px; }
.loginbox input { width: 100%; font-size: 17px; margin-bottom: 20px; min-height: 44px; }
.loginbox button { width: 100%; height: 52px; border-radius: var(--r-m); font-size: 16px; }
