/* 데일리 플래너 공통 스타일. 폰 우선(모바일 퍼스트). */

* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --teal: #0d9488;
  --teal-dark: #0f766e;
  --teal-bg: #f0fdfa;
  --ink: #1f2937;
  --ink-soft: #6b7280;
  --line: #e5e7eb;
  --bg: #f8fafc;
  --card: #ffffff;
  --danger: #dc2626;
  --amber: #f59e0b;
}

body {
  font-family: "Pretendard", -apple-system, "Malgun Gothic", sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  padding-bottom: 60px;
}

.wrap { max-width: 640px; margin: 0 auto; padding: 12px 14px; }

/* 상단 머리 */
header.top {
  background: var(--teal);
  color: #fff;
  padding: 14px 0 12px;
}
header.top .wrap { padding-top: 0; padding-bottom: 0; }
.top h1 { font-size: 1.15rem; font-weight: 700; }
.top .date { font-size: .9rem; opacity: .95; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.badge {
  background: rgba(255,255,255,.18);
  border: 1px solid rgba(255,255,255,.35);
  color: #fff; border-radius: 999px;
  padding: 3px 12px; font-size: .82rem; font-weight: 600;
}
.badge.warn { background: #b45309; border-color: #d97706; }

nav.tabs {
  display: flex; gap: 4px; margin-top: 10px;
}
nav.tabs a {
  flex: 1; text-align: center; text-decoration: none;
  color: #fff; background: rgba(255,255,255,.14);
  border-radius: 10px; padding: 9px 0; font-size: .95rem; font-weight: 600;
  min-height: 44px; display: flex; align-items: center; justify-content: center;
}
nav.tabs a.active { background: #fff; color: var(--teal-dark); }

/* 카드 */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; padding: 16px; margin-top: 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,.05);
}
.card h2 { font-size: 1.02rem; margin-bottom: 10px; color: var(--teal-dark); }
.card h2 .sub { font-weight: 400; color: var(--ink-soft); font-size: .85rem; }

.rehab-card { border-left: 5px solid var(--teal); background: var(--teal-bg); }

.muted { color: var(--ink-soft); font-size: .85rem; }
.disclaimer {
  margin-top: 12px; padding: 8px 10px; font-size: .8rem;
  background: #fef3c7; border-radius: 8px; color: #92400e;
}

/* 체크 행 (터치 크기 44px 이상) */
.check-row {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 6px; min-height: 48px;
  border-bottom: 1px solid var(--line); cursor: pointer;
}
.check-row:last-child { border-bottom: none; }
.check-row input[type=checkbox] { width: 22px; height: 22px; margin-top: 3px; accent-color: var(--teal); flex-shrink: 0; }
.check-row.done .row-title { text-decoration: line-through; color: var(--ink-soft); }
.row-title { font-weight: 600; font-size: .96rem; }
.row-detail { font-size: .83rem; color: var(--ink-soft); }
.row-time {
  font-size: .82rem; font-weight: 700; color: var(--teal-dark);
  min-width: 48px; margin-top: 4px; flex-shrink: 0;
}

.type-tag { font-size: .72rem; border-radius: 6px; padding: 1px 6px; margin-left: 6px; vertical-align: middle; }
.type-rehab { background: #ccfbf1; color: #115e59; }
.type-study { background: #dbeafe; color: #1e40af; }
.type-rest  { background: #fef9c3; color: #854d0e; }
.type-life  { background: #f3e8ff; color: #6b21a8; }

/* 접기/펼치기 */
details.rules { margin-top: 8px; }
details.rules summary {
  cursor: pointer; font-weight: 700; font-size: .9rem; color: var(--danger);
  padding: 6px 0; list-style: none;
}
details.rules summary::before { content: "⚠ "; }
details.rules li { margin-left: 18px; font-size: .87rem; padding: 2px 0; }

/* 입력 요소 */
input[type=text], input[type=password], input[type=date], input[type=time], input[type=number], select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 10px; font-size: .95rem; font-family: inherit; background: #fff;
  min-height: 44px;
}
label.field { display: block; margin-top: 10px; font-size: .88rem; font-weight: 600; }
label.field > span { display: block; margin-bottom: 4px; }

button, .btn {
  min-height: 44px; padding: 10px 16px; border: none; border-radius: 10px;
  background: var(--teal); color: #fff; font-size: .95rem; font-weight: 700;
  cursor: pointer; font-family: inherit;
}
button.ghost { background: #fff; color: var(--teal-dark); border: 1.5px solid var(--teal); }
button.small { min-height: 36px; padding: 6px 12px; font-size: .85rem; }
button.gray { background: #e5e7eb; color: var(--ink); }
button:active { opacity: .85; }

/* 통증 슬라이더 */
.pain-row { display: flex; align-items: center; gap: 10px; margin-top: 6px; }
.pain-row input[type=range] { flex: 1; accent-color: var(--teal); height: 30px; }
.pain-value { font-size: 1.3rem; font-weight: 800; color: var(--teal-dark); min-width: 34px; text-align: center; }

/* 걷기 기록 */
.walk-summary { font-weight: 700; color: var(--teal-dark); margin: 6px 0; }
.walk-list { font-size: .85rem; color: var(--ink-soft); }
.walk-add { display: flex; gap: 8px; margin-top: 8px; }
.walk-add input { width: 90px; }

/* Top3 */
.top3-row { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
.top3-row .num { font-weight: 800; color: var(--teal); width: 20px; }
.top3-row input[type=checkbox] { width: 22px; height: 22px; accent-color: var(--teal); }

/* 기록 화면 */
.history-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 4px; border-bottom: 1px solid var(--line); gap: 8px;
}
.history-item .h-date { font-weight: 700; min-width: 92px; }
.history-item .h-meta { font-size: .84rem; color: var(--ink-soft); text-align: right; flex: 1; }
.streak { font-size: 1.05rem; font-weight: 800; color: var(--teal-dark); }
svg.chart { width: 100%; height: 140px; margin-top: 8px; }

/* 로그인 */
#login-card { max-width: 380px; margin: 40px auto; }
#login-msg { color: var(--danger); font-size: .85rem; margin-top: 8px; min-height: 20px; }

/* 설정 루틴 편집표 */
table.routine { width: 100%; border-collapse: collapse; margin-top: 8px; }
table.routine td { padding: 4px 3px; vertical-align: middle; }
table.routine input[type=time] { min-width: 86px; padding: 8px 6px; }
table.routine select { padding: 8px 4px; min-width: 70px; }
table.routine .del { background: #fee2e2; color: var(--danger); min-height: 40px; min-width: 40px; padding: 0; }

.save-bar {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: #fff; border-top: 1px solid var(--line); padding: 10px 14px;
  display: flex; gap: 10px; justify-content: center; z-index: 10;
}
.save-bar button { flex: 1; max-width: 400px; }
.save-msg { text-align: center; font-size: .85rem; color: var(--teal-dark); }

.hidden { display: none; }
