/* Clearline · C안(기록) — 2026-09-15 시안에서 고른 방향.
   한 가지 모습으로 고정한다: 명세가 '짙은 흑연 바탕 · 절제된 회복 도구' 라 밝은 테마를 두지 않는다.
   대비(흑연 #141619 위): 본문 14.8 · 보조 6.97 · 민트 10.7 · 코랄 6.99 · 앰버 9.36 · 민트/코랄 면 위 잉크 10.7/6.99
   --line(1.56)은 테두리 전용이다. 글자에 쓰지 않는다. */
:root {
  --ground: #141619;
  --surface: #1C1F23;
  --surface-2: #23272C;
  --line: #343940;
  --text: #ECE8E1;
  --mute: #9CA1A8;
  --mint: #7FD8B6;
  --coral: #F2806F;
  --coral-tint: #2A1C1A;
  --amber: #E6B24E;
  --ink: #141619;
  --sans: "IBM Plex Sans KR", "Apple SD Gothic Neo", "Noto Sans KR", system-ui, sans-serif;
  --r-sm: 10px;
  --r-md: 14px;
  --col: 480px;
  --tabbar: 64px;
}

* { box-sizing: border-box; }
html, body { overflow-x: clip; }
body {
  margin: 0;
  background: var(--ground);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  word-break: keep-all;
  overflow-wrap: break-word;
  -webkit-tap-highlight-color: transparent;
}
body.is-locked { overflow: hidden; }
button { font: inherit; color: inherit; cursor: pointer; }
input, textarea { font: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--mint); outline-offset: 2px; }
.num { font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }

.app {
  max-width: var(--col);
  margin: 0 auto;
  min-height: 100dvh;
  padding-inline: 20px;
  padding-block: calc(env(safe-area-inset-top) + 16px) calc(var(--tabbar) + env(safe-area-inset-bottom) + 28px);
}
.app.is-onboarding { padding-bottom: calc(env(safe-area-inset-bottom) + 28px); }

/* ---------- 공통 ---------- */
.cl-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 40px; }
.cl-brand { font-weight: 700; letter-spacing: 0.02em; }
.cl-lbl { font-size: 13px; color: var(--mute); }
.cl-h2 { margin: 0; font-size: 18px; font-weight: 700; line-height: 1.35; }
.cl-sec { display: grid; gap: 12px; }
.cl-stack { display: grid; gap: 22px; }
.cl-card { background: var(--surface); border-radius: var(--r-md); padding: 16px; display: grid; gap: 12px; }
.cl-note { margin: 0; font-size: 14px; color: var(--mute); }
.cl-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }

.cl-btn {
  display: block; width: 100%; border-radius: var(--r-md); padding: 14px 16px;
  font-weight: 600; font-size: 15px; text-align: center; border: 1px solid transparent; background: none;
}
.cl-btn--hold { background: var(--mint); color: var(--ink); }
.cl-btn--save { background: var(--surface-2); border-color: var(--line); }
.cl-btn--urge { border-color: var(--coral); color: var(--coral); }
.cl-btn--quiet { border-color: var(--line); }
.cl-btn:disabled { background: none; border-color: var(--line); color: var(--mute); cursor: default; }
.cl-link { background: none; border: 0; padding: 6px 0; color: var(--mute); font-size: 14px; text-decoration: underline; text-underline-offset: 3px; }
.cl-mini { border: 1px solid var(--coral); color: var(--coral); background: none; border-radius: 999px; padding: 5px 12px; font-size: 13px; font-weight: 600; }

.cl-saved { font-size: 13px; color: var(--mint); min-height: 20px; }
.cl-warn { color: var(--coral); }
.cl-mint { color: var(--mint); }
.cl-amber { color: var(--amber); }

/* ---------- 칩(감정·선택지) ---------- */
.cl-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.cl-chip {
  border: 1px solid var(--line); background: none; border-radius: 999px;
  min-height: 38px; padding: 6px 14px; font-size: 14px; white-space: nowrap;
}
.cl-chip[aria-pressed="true"] { background: var(--text); color: var(--ink); border-color: var(--text); }
.cl-emo-groups { display: grid; gap: 12px; padding-top: 4px; }
.cl-emo-group { display: grid; gap: 6px; }

/* ---------- 충동 0~10 칸 ---------- */
.cl-scale { display: grid; grid-template-columns: repeat(11, minmax(0, 1fr)); gap: 4px; }
.cl-scale button {
  aspect-ratio: 1 / 1.3; border: 1px solid var(--line); background: none; border-radius: 8px;
  font-size: 15px; padding: 0; font-variant-numeric: tabular-nums;
}
.cl-scale button[aria-pressed="true"][data-lv="ok"] { background: var(--mint); border-color: var(--mint); color: var(--ink); }
.cl-scale button[aria-pressed="true"][data-lv="warn"] { background: var(--amber); border-color: var(--amber); color: var(--ink); }
.cl-scale button[aria-pressed="true"][data-lv="stop"] { background: var(--coral); border-color: var(--coral); color: var(--ink); }
.cl-scale-ends { display: flex; justify-content: space-between; font-size: 12px; color: var(--mute); margin-top: -6px; }
.cl-level { font-size: 14px; min-height: 22px; }
.cl-level[data-lv="ok"] { color: var(--mint); }
.cl-level[data-lv="warn"] { color: var(--amber); }
.cl-level[data-lv="stop"] { color: var(--coral); }

/* ---------- 입력 ---------- */
.cl-field { display: grid; gap: 6px; }
.cl-field > label, .cl-field > .cl-lbl { font-size: 14px; color: var(--text); }
.cl-input, .cl-text {
  width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm);
  color: var(--text); font-size: 16px; padding: 11px 12px;
}
.cl-text { resize: none; line-height: 1.5; min-height: 88px; }
.cl-input::placeholder, .cl-text::placeholder { color: var(--mute); }
input[type="date"].cl-input { color-scheme: dark; }
.cl-money { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; }
.cl-unit { display: flex; border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden; }
.cl-unit button { border: 0; background: none; padding: 0 12px; font-size: 14px; color: var(--mute); }
.cl-unit button[aria-pressed="true"] { background: var(--surface-2); color: var(--text); }
.cl-help { font-size: 13px; color: var(--mute); min-height: 20px; }
.cl-check { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; }
.cl-check input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--mint); flex: none; }

/* ---------- 오늘: 90일 기록 ---------- */
.cl-count { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.cl-count .big { font-size: 56px; line-height: 1; font-weight: 500; color: var(--mint); }
.cl-count .big.is-zero { color: var(--text); }
/* 10열이면 90칸이 390px 화면의 3분의 2(630px)를 먹어 체크인이 접힘선 아래로 갔다. 15열 6행이면 약 290px. */
.cl-grid { display: grid; grid-template-columns: repeat(15, minmax(0, 1fr)); gap: 4px; }
.cl-grid i { aspect-ratio: 1; border-radius: 3px; background: var(--surface-2); }
.cl-grid i.kept { background: var(--mint); }
.cl-grid i.re { background: none; box-shadow: inset 0 0 0 2px var(--amber); }
.cl-grid i.today { box-shadow: 0 0 0 2px var(--ground), 0 0 0 3.5px var(--text); }
.cl-grid i.re.today { box-shadow: inset 0 0 0 2px var(--amber), 0 0 0 2px var(--ground), 0 0 0 3.5px var(--text); }
.cl-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; color: var(--mute); }
.cl-legend em { font-style: normal; display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.cl-marks { display: flex; justify-content: space-between; font-size: 13px; color: var(--mute); border-top: 1px solid var(--line); padding-top: 10px; }
.cl-marks .past { color: var(--text); }
.cl-marks .next { color: var(--mint); }
.cl-money3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; font-size: 13px; color: var(--mute); }
.cl-money3 b { display: block; color: var(--text); font-size: 17px; font-weight: 500; }
.cl-money3 > span:last-child { text-align: right; }
.cl-quote { margin: 0; font-size: 16px; font-weight: 600; line-height: 1.5; text-wrap: balance; }

/* ---------- 탭바 ---------- */
.cl-tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  background: var(--ground); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.cl-tabs div { max-width: var(--col); margin: 0 auto; display: grid; grid-template-columns: repeat(3, 1fr); }
.cl-tabs button {
  height: var(--tabbar); border: 0; background: none; color: var(--mute); font-size: 14px; font-weight: 600;
  position: relative;
}
.cl-tabs button[aria-current="page"] { color: var(--text); }
.cl-tabs button[aria-current="page"]::after {
  content: ""; position: absolute; left: 50%; top: 0; width: 28px; height: 2px; margin-left: -14px; background: var(--mint);
}

/* ---------- 일지 ---------- */
.cl-sum { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.cl-sum div { background: var(--surface); border-radius: var(--r-sm); padding: 10px 12px; display: grid; gap: 2px; }
.cl-sum b { font-size: 20px; font-weight: 500; }
.cl-day { display: grid; gap: 0; }
.cl-day-h {
  position: sticky; top: 0; z-index: 2; background: var(--ground);
  padding: 12px 0 8px; font-size: 13px; color: var(--mute); border-bottom: 1px solid var(--line);
}
.cl-day-h b { color: var(--text); font-weight: 600; margin-right: 6px; }
.cl-entry {
  display: grid; grid-template-columns: 44px 36px minmax(0, 1fr); gap: 10px; align-items: start;
  padding: 12px 0; border-bottom: 1px solid var(--line);
}
.cl-entry time { font-size: 13px; color: var(--mute); padding-top: 7px; font-variant-numeric: tabular-nums; }
.cl-badge {
  width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center;
  font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; border: 1.5px solid var(--line);
}
.cl-badge[data-lv="ok"] { border-color: var(--mint); color: var(--mint); }
.cl-badge[data-lv="warn"] { border-color: var(--amber); color: var(--amber); }
.cl-badge[data-lv="stop"] { border-color: var(--coral); color: var(--coral); }
.cl-badge.is-pause { border-color: var(--mint); color: var(--mint); font-size: 12px; }
.cl-badge.is-pause.is-closed { border-color: var(--line); color: var(--mute); }
.cl-badge.is-re { border-color: var(--amber); color: var(--amber); font-size: 12px; }
.cl-entry-body { display: grid; gap: 3px; min-width: 0; padding-top: 2px; }
.cl-entry-title { font-size: 15px; font-weight: 600; }
.cl-entry-meta { font-size: 13px; color: var(--mute); }
.cl-entry-note {
  margin: 2px 0 0; font-size: 14px; color: var(--text); white-space: pre-wrap;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden;
  background: none; border: 0; padding: 0; text-align: left;
}
.cl-entry-note.is-open { display: block; -webkit-line-clamp: unset; }
.cl-empty { padding: 32px 0; text-align: center; color: var(--mute); font-size: 14px; }

/* ---------- 보호 ---------- */
.cl-kv { display: grid; border-top: 1px solid var(--line); }
.cl-kv > div { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.cl-kv b { font-weight: 500; font-size: 16px; }
.cl-bucket { display: grid; grid-template-columns: minmax(0, 1fr) 48px; gap: 8px; align-items: end; }
.cl-bucket .pct { font-size: 14px; color: var(--mute); padding-bottom: 12px; text-align: right; font-variant-numeric: tabular-nums; }
.cl-todo { display: grid; }
.cl-todo button {
  display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; gap: 12px; align-items: center;
  border: 0; border-bottom: 1px solid var(--line); background: none; text-align: left; padding: 12px 0; font-size: 15px;
}
.cl-todo .box { width: 22px; height: 22px; border-radius: 6px; border: 1.5px solid var(--line); display: grid; place-items: center; }
.cl-todo .box svg { width: 14px; height: 14px; fill: none; stroke: var(--ink); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; opacity: 0; }
.cl-todo button[aria-pressed="true"] .box { background: var(--mint); border-color: var(--mint); }
.cl-todo button[aria-pressed="true"] .box svg { opacity: 1; }
.cl-todo .when { font-size: 12px; color: var(--mute); font-variant-numeric: tabular-nums; }
.cl-danger { border-color: var(--line); color: var(--mute); }
.cl-danger.is-armed { border-color: var(--coral); color: var(--coral); }

/* ---------- 온보딩 ---------- */
.cl-ob { min-height: calc(100dvh - 60px); display: flex; flex-direction: column; gap: 22px; }
.cl-ob h1 { margin: 0; font-size: 28px; line-height: 1.3; font-weight: 700; text-wrap: balance; }
.cl-ob p { margin: 0; }
.cl-ob .lead { font-size: 17px; line-height: 1.6; }
.cl-ob ul { margin: 0; padding-left: 20px; display: grid; gap: 6px; color: var(--mute); }
.cl-ob-foot { margin-top: auto; display: grid; gap: 8px; padding-top: 12px; }
.cl-steps { font-size: 13px; color: var(--mute); font-variant-numeric: tabular-nums; }

/* ---------- 충동 차단 화면 ---------- */
.cl-pause {
  position: fixed; inset: 0; z-index: 50; background: var(--ground); overflow-y: auto;
  padding: calc(env(safe-area-inset-top) + 20px) 20px calc(env(safe-area-inset-bottom) + 20px);
}
.cl-pause-in { max-width: var(--col); margin: 0 auto; min-height: 100%; display: flex; flex-direction: column; gap: 20px; }
.cl-anchor { display: grid; gap: 4px; padding-top: 8px; }
.cl-anchor .big { font-size: 60px; line-height: 1.02; font-weight: 500; }
.cl-anchor .big small { font-size: 28px; font-weight: 600; margin-left: 4px; }
.cl-anchor p { margin: 6px 0 0; font-size: 16px; font-weight: 600; text-wrap: balance; }
.cl-drain { height: 48px; border-radius: 12px; background: var(--surface-2); position: relative; overflow: hidden; }
.cl-drain i { position: absolute; inset: 0; background: #3A2521; transform-origin: left; transition: transform 0.9s linear; }
.cl-drain > span { position: absolute; inset: 0; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0 14px; font-size: 14px; }
.cl-drain b { font-size: 19px; font-weight: 600; color: var(--coral); font-variant-numeric: tabular-nums; }
.cl-drain.is-done i { background: none; }
.cl-drain.is-done b { color: var(--mint); }
.cl-qs { margin: 0; padding-left: 18px; color: var(--mute); font-size: 14px; display: grid; gap: 4px; }
.cl-pause-end { margin-top: auto; display: grid; gap: 8px; }
.cl-done { flex: 1; display: grid; place-content: center; gap: 14px; text-align: center; padding: 24px 8px; }
.cl-done strong { font-size: 24px; line-height: 1.4; text-wrap: balance; }
.cl-done span { color: var(--mute); font-size: 14px; }

/* ---------- 시트(재진입 기록) ---------- */
.cl-sheet-bg { position: fixed; inset: 0; z-index: 60; background: rgba(8, 9, 10, 0.72); display: flex; align-items: flex-end; justify-content: center; }
.cl-sheet {
  width: 100%; max-width: var(--col); max-height: 92dvh; overflow-y: auto; background: var(--surface);
  border-radius: 20px 20px 0 0; padding: 20px 20px calc(env(safe-area-inset-bottom) + 20px); display: grid; gap: 16px;
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
