/* 단기어트 — Lifesum 스타일 테마 */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
  --bg: #F1F0EA;          /* 따뜻한 크림 배경 */
  --surface: #FFFFFF;
  --ink: #1C1D1A;         /* 거의 검정 */
  --muted: #8C9088;       /* 따뜻한 회색 */
  --green: #2FBE6E;       /* 선명한 포인트 그린(FAB) */
  --green-dark: #1F9D58;
  --green-deep: #15402A;  /* 다크 포레스트(로고/CTA) */
  --lime: #CFEA6A;        /* 라임(히어로 상단) */
  --green-soft: #E9F7EE;
  --line: #E7E5DC;
  --radius: 20px;
  --radius-sm: 15px;
  --shadow: 0 3px 14px rgba(28, 29, 26, 0.06);
  --font: 'Plus Jakarta Sans', -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body { margin: 0; font-family: var(--font); color: var(--ink); background: #e5e3d9;
       display: flex; justify-content: center; }

.app { width: 100%; max-width: 460px; height: 100dvh; background: var(--bg);
       display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 0 50px rgba(0,0,0,.1); }

/* 상단바 (관리/로그 페이지 기본형) */
.topbar { display: flex; align-items: center; justify-content: space-between;
          padding: 18px 20px 14px; background: var(--bg); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 8px; font-size: 20px; font-weight: 800;
         letter-spacing: -0.4px; color: var(--green-deep); }
.brand svg { width: 22px; height: 22px; }
.dot { width: 11px; height: 11px; border-radius: 50%; background: var(--green); display: inline-block; }
.topbar a, .topbar .navbtn { display: inline-flex; align-items: center; gap: 5px; font-size: 13px;
  font-weight: 700; color: var(--green-dark); text-decoration: none; background: var(--green-soft);
  padding: 8px 13px; border-radius: 999px; border: none; cursor: pointer; }

/* 채팅 화면 히어로: 라임 → 크림 그라데이션 (topbar+CTA를 감쌈) */
.hero { background: linear-gradient(180deg, #CFEA6A 0%, #AFE389 34%, var(--bg) 100%); }
.hero .topbar { background: transparent; border-bottom: none; padding-bottom: 6px; }
.hero .topbar a, .hero .topbar .navbtn { background: rgba(255,255,255,.7); }

/* 전환 CTA 배너 (프리미엄) */
.cta { position: relative; display: block; text-decoration: none; margin: 6px 16px 14px; overflow: hidden;
  background: radial-gradient(135% 130% at 88% 0%, #2C8052 0%, #15402A 58%);
  color: #fff; border-radius: var(--radius); padding: 20px 21px;
  box-shadow: 0 14px 32px rgba(21,64,42,.32); transition: transform .14s ease, box-shadow .14s ease; }
.cta::after { content: ""; position: absolute; right: -34px; top: -34px; width: 130px; height: 130px;
  background: radial-gradient(circle, rgba(207,234,106,.38), transparent 70%); pointer-events: none; }
.cta:hover { transform: translateY(-2px); box-shadow: 0 20px 40px rgba(21,64,42,.38); }
.cta:active { transform: scale(0.99); }
.cta-title { position: relative; font-size: 17px; font-weight: 800; line-height: 1.5; letter-spacing: -0.4px; color: #fff; }
.cta-hl { color: #F4E85B; }  /* 노란 글씨 강조 */
.cta-btn { position: relative; display: inline-flex; align-items: center; gap: 6px; margin-top: 15px;
  background: var(--lime); color: var(--green-deep); font-weight: 800; font-size: 14px;
  padding: 11px 20px; border-radius: 999px; box-shadow: 0 5px 14px rgba(207,234,106,.45);
  transition: gap .14s ease; }
.cta:hover .cta-btn { gap: 9px; }
.cta-btn svg { width: 16px; height: 16px; }

/* 채팅 영역 */
#chat { flex: 1; overflow-y: auto; padding: 14px 16px 18px; display: flex; flex-direction: column; gap: 11px; }
#chat::-webkit-scrollbar { width: 0; }
@keyframes msgIn { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: none; } }
@keyframes pulse { 0%, 100% { opacity: .5; } 50% { opacity: .95; } }
.msg { max-width: 84%; padding: 13px 16px; line-height: 1.6; font-size: 15px;
       white-space: pre-wrap; word-break: break-word; letter-spacing: -0.2px;
       animation: msgIn .26s cubic-bezier(.22,.61,.36,1) both; }
.bot { align-self: flex-start; background: var(--surface); color: var(--ink);
       border: 1px solid #F1EFE7; border-radius: 6px 20px 20px 20px; box-shadow: var(--shadow); }
.user { align-self: flex-end; background: linear-gradient(135deg, #35C977, #2AA864); color: #fff;
        border-radius: 20px 20px 6px 20px; font-weight: 500; box-shadow: 0 4px 14px rgba(42,168,100,.28); }
.bot.loading { color: var(--muted); animation: pulse 1.3s ease-in-out infinite; }
.msg img { max-width: 200px; border-radius: 14px; display: block; margin-top: 8px; }
.hint { align-self: center; color: var(--muted); font-size: 11.5px; margin-top: 4px; text-align: center;
        font-weight: 700; text-transform: uppercase; letter-spacing: .6px; }

/* 이미지 미리보기 */
#preview { padding: 10px 16px 0; display: none; }
#preview .chip { display: inline-flex; align-items: center; gap: 10px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px; box-shadow: var(--shadow); }
#preview img { max-height: 76px; border-radius: 10px; }
#preview .rm { background: none; border: none; color: #c0392b; font-size: 13px; font-weight: 700; cursor: pointer; padding: 0 6px; }

/* 하단 입력바 */
.composer { display: flex; align-items: center; gap: 9px;
  padding: 12px 14px calc(12px + env(safe-area-inset-bottom)); background: var(--bg); border-top: 1px solid var(--line); }
.composer #input { flex: 1; padding: 13px 18px; border: 1.5px solid var(--line); background: var(--surface);
  border-radius: 999px; font-size: 15px; font-family: var(--font); color: var(--ink); outline: none; }
.composer #input:focus { border-color: var(--green); }
.iconbtn { flex-shrink: 0; width: 46px; height: 46px; border-radius: 50%; cursor: pointer;
  display: grid; place-items: center; border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); padding: 0; }
.sendbtn { background: linear-gradient(135deg, #37C978, #2AA864); border-color: transparent; color: #fff;
  box-shadow: 0 6px 16px rgba(47,190,110,.42); transition: transform .1s ease; }
.sendbtn:not(:disabled):active { transform: scale(0.93); }
.sendbtn:disabled { background: #a9dcc0; border-color: transparent; box-shadow: none; cursor: default; }
.iconbtn svg { width: 22px; height: 22px; }

/* ===== 관리/로그 페이지 ===== */
.scroll { flex: 1; overflow-y: auto; padding: 20px 16px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.desc { color: var(--muted); font-size: 14px; line-height: 1.65; margin: 0 0 6px; }
label { display: block; font-weight: 700; margin: 16px 0 7px; font-size: 14px; letter-spacing: -0.2px; }
textarea { width: 100%; padding: 13px 15px; border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  font-size: 15px; font-family: var(--font); color: var(--ink); resize: vertical; outline: none; background: var(--bg); }
textarea:focus { border-color: var(--green); background: var(--surface); }
#q { min-height: 72px; } #a { min-height: 140px; }
.btn { margin-top: 18px; width: 100%; background: var(--green); color: #fff; border: none;
  border-radius: 999px; padding: 15px; font-size: 15px; font-weight: 700; font-family: var(--font); cursor: pointer; }
.btn:disabled { background: #a9dcc0; }
#status { margin-top: 14px; font-size: 14px; min-height: 20px; font-weight: 600; }
.ok { color: var(--green-dark); } .err { color: #c0392b; }
.count { color: var(--muted); font-size: 13px; margin-top: 10px; font-weight: 500; }
