/* 50~60대 기준 화면 규칙(PRD 7절): 본문 18px+, 제목 24px, 버튼 56px+, 대비 7:1 이상, 회색·연한 글씨 금지 */
@import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/static/pretendard.min.css');

:root {
  color-scheme: light;
  --ink: #111111;
  --ink-2: #2b2b2b;        /* 보조 글씨도 12:1 이상 */
  --paper: #ffffff;
  --panel: #f3f5f8;
  --line: #6b7280;         /* 테두리용(글씨에는 쓰지 않음) */
  --primary: #0b3d91;      /* 흰 글씨와 대비 10:1 */
  --primary-ink: #ffffff;
  --late: #a40000;         /* 기한 지남 */
  --late-bg: #fdecec;
  --soon: #7a4100;         /* 7일 안 */
  --soon-bg: #fff3e0;
  --done: #0b5d1e;         /* 끝남 */
  --done-bg: #e8f5ec;
  --focus: #ffbf00;
  --base: 18px;
  --radius: 14px;
}
:root[data-size='large'] { --base: 21px; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { font-size: var(--base); -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: Pretendard, 'Apple SD Gothic Neo', 'Noto Sans KR', 'Malgun Gothic', sans-serif;
  font-weight: 500; line-height: 1.55; padding-bottom: 96px;
}
h1, h2, h3 { line-height: 1.3; margin: 0 0 12px; font-weight: 800; }
h1 { font-size: 1.45rem; }     /* 약 26px */
h2 { font-size: 1.34rem; }     /* 24px */
h3 { font-size: 1.12rem; }
p { margin: 0 0 12px; }
a { color: var(--primary); font-weight: 700; }
:focus-visible { outline: 4px solid var(--focus); outline-offset: 2px; }

.top {
  position: sticky; top: 0; z-index: 10; background: var(--primary); color: var(--primary-ink);
  display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 16px;
}
.top .org { font-weight: 800; font-size: 1.05rem; }
.top button { min-height: 44px; background: transparent; color: #fff; border: 2px solid #fff; border-radius: 10px; padding: 0 12px; font: inherit; font-weight: 700; }
main { max-width: 760px; margin: 0 auto; padding: 16px; }
main.wide { max-width: 1100px; }

.nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 10; display: grid; grid-template-columns: repeat(4, 1fr);
  background: #fff; border-top: 2px solid var(--line);
}
.nav a {
  min-height: 72px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--ink); text-decoration: none; font-size: 0.95rem; font-weight: 800;
}
.nav a .ic { font-size: 1.4rem; line-height: 1; }
.nav a[aria-current='page'] { color: var(--primary); background: #e7eefb; box-shadow: inset 0 4px 0 var(--primary); }

.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 56px; padding: 12px 18px;
  border-radius: var(--radius); border: 2px solid var(--primary); background: var(--primary); color: var(--primary-ink);
  font: inherit; font-size: 1.05rem; font-weight: 800; cursor: pointer; text-align: center; text-decoration: none;
}
.btn.ghost { background: #fff; color: var(--primary); }
.btn.danger { background: #fff; color: var(--late); border-color: var(--late); }
.btn.small { min-height: 56px; font-size: 0.95rem; width: auto; white-space: nowrap; }
.btn[disabled] { background: #d9dde3; border-color: #9aa1ab; color: #222; cursor: not-allowed; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stack > * + * { margin-top: 10px; }
.spacer { height: 16px; }

.card {
  border: 2px solid var(--line); border-radius: var(--radius); padding: 16px; background: #fff; margin-bottom: 12px;
}
.card.late { border-color: var(--late); background: var(--late-bg); }
.card.soon { border-color: var(--soon); background: var(--soon-bg); }
.card.done { border-color: var(--done); background: var(--done-bg); }
.card .title { font-size: 1.1rem; font-weight: 800; margin-bottom: 4px; }
.card .sub { color: var(--ink-2); margin-bottom: 10px; }
.due { display: inline-block; font-weight: 800; padding: 2px 10px; border-radius: 999px; border: 2px solid currentColor; margin-right: 6px; }
.due.late { color: var(--late); }
.due.soon { color: var(--soon); }
.due.later { color: var(--ink); }
.tag { display: inline-block; font-size: 0.85rem; font-weight: 800; padding: 1px 8px; border-radius: 6px; background: #e7eefb; color: #0b2a66; margin-right: 4px; }
.tag.ai { background: #f2e7ff; color: #3d0a75; }
.tag.late { background: var(--late-bg); color: var(--late); }
.tag.ok { background: var(--done-bg); color: var(--done); }
.section-title { font-size: 1.05rem; font-weight: 800; margin: 20px 0 10px; }
.greet { font-size: 1.35rem; font-weight: 800; margin-bottom: 12px; }
.banner { border: 2px solid var(--primary); background: #e7eefb; border-radius: var(--radius); padding: 14px; margin-bottom: 12px; }
.banner.warn { border-color: var(--soon); background: var(--soon-bg); }

.progress { height: 18px; border: 2px solid var(--line); border-radius: 999px; overflow: hidden; background: #fff; }
.progress > span { display: block; height: 100%; background: var(--done); }

/* 단계형 입력 */
.stepbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; font-weight: 800; }
.question { font-size: 1.34rem; font-weight: 800; margin: 8px 0 16px; }
.hint { border-left: 5px solid var(--soon); background: var(--soon-bg); padding: 10px 12px; border-radius: 8px; margin-bottom: 12px; }
.choices { display: grid; gap: 10px; }
.choice {
  min-height: 60px; border: 3px solid var(--line); border-radius: var(--radius); background: #fff; color: var(--ink);
  font: inherit; font-size: 1.1rem; font-weight: 800; padding: 10px 14px; text-align: left; cursor: pointer;
}
.choice[aria-pressed='true'] { border-color: var(--primary); background: #e7eefb; box-shadow: inset 0 0 0 2px var(--primary); }
.choice[aria-pressed='true']::before { content: '✔ '; color: var(--primary); }
input[type='text'], input[type='password'], input[type='month'], input[type='datetime-local'], input[type='tel'], input[type='number'], input[type='date'], input[type='time'], input[type='search'], select, textarea {
  width: 100%; min-height: 56px; border: 2px solid var(--line); border-radius: 12px; padding: 12px 14px;
  font: inherit; font-size: 1.1rem; color: var(--ink); background: #fff;
}
textarea { min-height: 160px; resize: vertical; line-height: 1.6; }
label.lbl { display: block; font-weight: 800; margin: 12px 0 6px; }
.err { color: var(--late); font-weight: 800; margin: 10px 0; }
.err::before { content: '⚠ '; }
.field-error { border-color: var(--late) !important; box-shadow: 0 0 0 3px var(--late-bg); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.chip {
  min-height: 52px; border: 2px solid var(--line); border-radius: 999px; padding: 6px 14px; background: #fff; color: var(--ink);
  font: inherit; font-weight: 700; cursor: pointer;
}
.chip[aria-pressed='true'] { background: var(--primary); color: #fff; border-color: var(--primary); }
.cat { font-weight: 800; margin: 10px 0 6px; }
.mic { font-size: 1.15rem; }
.mic.on { background: var(--late); border-color: var(--late); color: #fff; }

.para { border: 2px solid var(--line); border-radius: 12px; padding: 12px; margin-bottom: 8px; }
.para.ok { border-color: var(--done); background: var(--done-bg); }
.kv { display: grid; grid-template-columns: 9em 1fr; gap: 6px 12px; }
.kv dt { font-weight: 800; }
.kv dd { margin: 0; white-space: pre-wrap; }

.toast {
  position: fixed; left: 16px; right: 16px; bottom: 88px; z-index: 30; max-width: 728px; margin: 0 auto;
  background: #111; color: #fff; border-radius: var(--radius); padding: 14px 16px; font-weight: 700;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.toast button { min-height: 48px; background: #fff; color: #111; border: 0; border-radius: 10px; padding: 0 14px; font: inherit; font-weight: 800; }
.modal-back { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.55); z-index: 40; display: flex; align-items: flex-end; justify-content: center; }
.modal { background: #fff; width: 100%; max-width: 760px; max-height: 88vh; overflow: auto; border-radius: 18px 18px 0 0; padding: 20px 16px 28px; }

.scorebig { font-size: 2.2rem; font-weight: 900; line-height: 1.2; margin: 6px 0; }
.bar { display: grid; grid-template-columns: 7em 1fr 5em; gap: 8px; align-items: center; margin-bottom: 8px; }
.bar .progress > span { background: var(--primary); }
table.plain { width: 100%; border-collapse: collapse; }
table.plain th, table.plain td { border-bottom: 2px solid #c9ced6; padding: 10px 6px; text-align: left; vertical-align: top; }
.thumb { max-width: 180px; max-height: 180px; border: 2px solid var(--line); border-radius: 10px; display: block; margin-top: 8px; }
.scale-item { border: 2px solid var(--line); border-radius: 12px; padding: 12px; margin-bottom: 10px; }
.scale-total { font-size: 1.2rem; font-weight: 900; margin: 12px 0; }
.drill { border: 3px double var(--primary); border-radius: var(--radius); padding: 14px; margin-bottom: 16px; }
.muted-box { background: var(--panel); border-radius: 12px; padding: 12px; }

@media (min-width: 900px) {
  .two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
}
@media print {
  .top, .nav, .noprint, .toast { display: none !important; }
  body { padding: 0; }
  main { max-width: none; }
  .card { break-inside: avoid; }
}
@media print { .print-record { break-before: page; border: 0; } .print-record:first-of-type { break-before: auto; } }
