@import url("../fonts/fonts.css");

:root {
  --wall: #DCE3EA;
  --paper: #FDFDFB;
  --paper-2: #EEF1F4;
  --ink: #20242A;
  --ink-2: #4B535D;
  --ink-3: #8A939D;
  --line: #D5DAE0;
  --red: #C42B22;
  --pen: #1F4FA0;
  --band: #2B3138;
  --sans: "IBM Plex Sans KR", system-ui, -apple-system, "Malgun Gothic", sans-serif;
  --hand: "Nanum Pen Script", "IBM Plex Sans KR", cursive;
  --gutter: 16px;
  --sheet-shadow: 0 1px 0 rgba(32, 36, 42, .08), 0 14px 22px -16px rgba(32, 36, 42, .45);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--wall); color: var(--ink);
  font: 400 1rem/1.7 var(--sans); word-break: keep-all; overflow-wrap: break-word;
  font-variant-numeric: tabular-nums;
}
a { color: var(--pen); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--pen); outline-offset: 2px; border-radius: 3px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 var(--gutter); }

/* 상단 */
.top .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; }
.brand { display: inline-flex; align-items: center; gap: 8px; font: 700 1.25rem/1 var(--sans); color: var(--ink); text-decoration: none; letter-spacing: -0.02em; }
.brand i { font-style: normal; display: inline-block; padding: 3px 5px; border: 2px solid var(--red); color: var(--red); border-radius: 3px; transform: rotate(-5deg); font-size: 1rem; }
.nav { display: flex; gap: 20px; font-size: .9375rem; }
.nav a { color: var(--ink-2); text-decoration: none; padding: 10px 0; }
.nav a:hover, .nav a[aria-current] { color: var(--ink); text-decoration: underline; text-decoration-thickness: 2px; }

/* 도구 */
.tool { display: grid; gap: 28px; padding: 20px 0 56px; }
.lede h1 { font: 700 clamp(1.875rem, 6vw, 3.25rem)/1.2 var(--sans); margin: 0 0 12px; letter-spacing: -0.035em; max-width: 15em; }
.lede p { margin: 0; color: var(--ink-2); max-width: 34em; }

/* 메모지(입력) */
.form {
  display: grid; gap: 20px; background: var(--paper); padding: 22px 18px 20px; box-shadow: var(--sheet-shadow);
  border-radius: 2px; position: relative;
}
.form h2 { font: 700 1.125rem/1.3 var(--sans); margin: 0; }
.field { display: grid; gap: 6px; border: 0; margin: 0; padding: 0; min-width: 0; }
.field > label, .field > legend { font-weight: 500; font-size: .9375rem; padding: 0; }
.hint { font-size: .8125rem; color: var(--ink-2); line-height: 1.55; }
input[type="date"], input[type="number"], select {
  width: 100%; min-height: 48px; padding: 8px 12px; font: inherit; color: var(--ink);
  background: var(--paper); border: 1.5px solid var(--ink-3); border-radius: 4px;
}
input[type="date"].big { font: 500 1.375rem/1.2 var(--sans); min-height: 60px; border: 2px solid var(--pen); }
input:hover, select:hover { border-color: var(--ink); }
.choice { display: grid; gap: 8px; }
.choice label { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 8px 12px; border: 1.5px solid var(--line); border-radius: 4px; cursor: pointer; }
.choice input { width: 18px; height: 18px; accent-color: var(--pen); flex: none; }
.choice label:has(input:checked) { border-color: var(--pen); background: color-mix(in srgb, var(--pen) 7%, var(--paper)); }
.choice.cols { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; font-size: .9375rem; }
.check input { width: 20px; height: 20px; accent-color: var(--pen); flex: none; margin-top: 2px; }
.group { border-top: 1px dashed var(--ink-3); padding-top: 18px; display: grid; gap: 20px; }
.group > h3 { margin: 0; font: 700 1rem/1.3 var(--sans); }
.unit { position: relative; }
.unit input { padding-right: 44px; }
.unit::after { content: attr(data-unit); position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--ink-2); pointer-events: none; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.btn { font: 500 1rem/1 var(--sans); min-height: 48px; padding: 0 18px; border-radius: 4px; cursor: pointer; border: 1.5px solid var(--ink); background: var(--ink); color: var(--paper); }
.btn:hover { background: var(--pen); border-color: var(--pen); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.quiet { background: transparent; color: var(--ink); border-color: var(--ink-3); }
.btn.quiet:hover { border-color: var(--ink); background: transparent; color: var(--ink); }
.saved { font-size: .8125rem; color: var(--ink-2); }

/* 결과 */
.result { min-width: 0; display: grid; gap: 28px; }
.sample-tag { display: inline-block; margin-left: 8px; padding: 1px 8px; font: 500 .75rem/1.6 var(--sans); background: var(--paper); color: var(--ink-2); border-radius: 99px; vertical-align: middle; border: 1px solid var(--ink-3); }
.next { margin: 0; font-size: 1.0625rem; }
.next b { font-weight: 700; }
.next .pen-u { background: linear-gradient(transparent 82%, var(--pen) 82% 90%, transparent 90%); padding: 0 2px; }
.next small { display: block; color: var(--ink-2); font-size: .875rem; }

/* 장부(영수증) */
.ledger { background: var(--paper); padding: 22px 18px 26px; box-shadow: var(--sheet-shadow); position: relative; margin-bottom: 8px; }
.ledger::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -8px; height: 8px;
  background: linear-gradient(135deg, var(--paper) 25%, transparent 25%) -8px 0, linear-gradient(225deg, var(--paper) 25%, transparent 25%) -8px 0;
  background-size: 16px 16px;
}
.ledger h2 { font: 700 1.125rem/1.3 var(--sans); margin: 0 0 14px; }
.lines { list-style: none; margin: 0; padding: 0; display: grid; gap: 18px; }
.line .row { display: flex; align-items: baseline; gap: 8px; }
.line .name { font-weight: 700; font-size: 1.0625rem; white-space: nowrap; }
.line .dots { flex: 1; min-width: 12px; border-bottom: 2px dotted var(--ink-3); transform: translateY(-5px); }
.line .amt { font: 700 clamp(1.25rem, 4.6vw, 1.75rem)/1.2 var(--sans); letter-spacing: -0.02em; text-align: right; }
.line .amt.dim { font-size: 1rem; font-weight: 500; color: var(--ink-2); }
.line .sub { margin: 2px 0 0; color: var(--ink-2); font-size: .875rem; line-height: 1.6; }
.line.total { border-top: 2px solid var(--ink); padding-top: 14px; }
.line.total .name { font-size: 1.125rem; }
.line.total .amt { font-size: clamp(1.5rem, 5.4vw, 2.125rem); color: var(--pen); }
.warn-line { margin: 16px 0 0; padding: 10px 12px; border: 2px solid var(--red); color: var(--red); font-weight: 500; border-radius: 3px; transform: rotate(-.4deg); }
.how { margin-top: 14px; }
.how summary { cursor: pointer; font-weight: 500; padding: 8px 0; }
.calc { margin: 6px 0 0; padding: 0; list-style: none; display: grid; gap: 6px; font-size: .9375rem; color: var(--ink-2); }
.calc b { color: var(--ink); font-weight: 500; }
.hand { font: 400 1.5rem/1.2 var(--hand); color: var(--pen); transform: rotate(-2deg); display: inline-block; margin: 14px 0 0; }

/* 점검 */
.checks { background: var(--paper); padding: 20px 18px; box-shadow: var(--sheet-shadow); }
.checks h2 { font: 700 1.125rem/1.3 var(--sans); margin: 0 0 4px; }
.checks h3 { font: 700 1rem/1.4 var(--sans); margin: 18px 0 8px; }
.checks h3 span { font-weight: 500; color: var(--ink-2); font-size: .875rem; margin-left: 6px; }
.reasons { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.reasons li { display: grid; grid-template-columns: 1.6em 1fr; gap: 6px; font-size: .96875rem; }
.reasons .g { font-weight: 700; font-size: 1.125rem; line-height: 1.5; text-align: center; }
.reasons .ok .g { color: var(--pen); }
.reasons .warn .g { color: var(--ink); }
.reasons .no .g { color: var(--red); }

/* 달력 */
.cal-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.cal-head h2 { font: 700 1.375rem/1.3 var(--sans); margin: 0; letter-spacing: -0.02em; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: .8125rem; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend .sw { width: 16px; height: 16px; display: inline-block; flex: none; }
.legend .sw.ring { border: 2px solid var(--pen); border-radius: 52% 48% 55% 45% / 48% 55% 45% 52%; }
.legend .sw.st { border: 2px solid var(--red); border-radius: 3px; transform: rotate(-6deg); }
.legend .sw.hatch { background: repeating-linear-gradient(135deg, transparent 0 3px, rgba(32,36,42,.35) 3px 4px); border: 1px solid var(--ink-3); }
.legend .sw.tint { background: rgba(31, 79, 160, .12); }
.sheets { display: grid; gap: 22px; }
.sheet { background: var(--paper); box-shadow: var(--sheet-shadow); position: relative; padding-bottom: 8px; }
.sheet::before {
  content: ""; display: block; height: 18px; background:
    radial-gradient(circle at 22% 50%, var(--wall) 0 4px, transparent 4.5px),
    radial-gradient(circle at 78% 50%, var(--wall) 0 4px, transparent 4.5px), var(--band);
}
.sheet header { display: flex; align-items: baseline; gap: 10px; padding: 12px 14px 6px; }
.sheet .y { color: var(--ink-3); font-weight: 500; }
.sheet .mo { font: 700 clamp(2.25rem, 8vw, 3.25rem)/1 var(--sans); letter-spacing: -0.04em; }
.dow, .days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.dow { padding: 0 6px; font-size: .75rem; font-weight: 500; text-align: center; color: var(--ink-2); }
.dow .su, .c.su .n { color: var(--red); }
.dow .sa, .c.sa .n { color: var(--pen); }
.days { padding: 4px 6px 0; }
.c { position: relative; min-height: 56px; padding: 4px 3px; border-top: 1px solid var(--line); display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.c.off { border-top-color: transparent; }
.c .n { font-weight: 500; font-size: .9375rem; line-height: 1.2; position: relative; display: inline-block; padding: 1px 3px; }
.c.past .n { color: var(--ink-3); }
.c.tint { background: rgba(31, 79, 160, .065); }
.c.wait { background: repeating-linear-gradient(135deg, transparent 0 5px, rgba(32, 36, 42, .13) 5px 6px); }
.c.today .n { font-weight: 700; box-shadow: inset 0 -3px 0 var(--pen); }
.c .ring::after { content: ""; position: absolute; inset: -4px -6px; border: 2px solid var(--pen); border-radius: 52% 48% 55% 45% / 48% 55% 45% 52%; transform: rotate(-6deg); pointer-events: none; }
.c .lab { font-size: .6875rem; font-weight: 700; line-height: 1.2; color: var(--pen); padding-left: 3px; }
.stamp { display: inline-block; margin: 1px 0 0 1px; padding: 0 3px; font-size: .6875rem; font-weight: 700; line-height: 1.4; color: var(--red); border: 2px solid var(--red); border-radius: 3px; transform: rotate(-6deg); opacity: .92; white-space: nowrap; }
.stamp.end { background: var(--red); color: var(--paper); }

/* 날짜 목록 */
.dates { background: var(--paper); box-shadow: var(--sheet-shadow); padding: 20px 18px; }
.dates h2 { font: 700 1.125rem/1.3 var(--sans); margin: 0 0 6px; }
.dl { list-style: none; margin: 0; padding: 0; }
.dl li { display: grid; grid-template-columns: 5.2rem minmax(0, 1fr); gap: 0 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.dl li:first-child { border-top: 0; }
.dl .d b { display: block; font-weight: 700; font-size: 1.0625rem; line-height: 1.4; }
.dl .d span { font-size: .8125rem; color: var(--ink-2); }
.dl h3 { margin: 0; font: 500 1rem/1.5 var(--sans); }
.dl p { margin: 2px 0 0; font-size: .875rem; color: var(--ink-2); line-height: 1.6; }
.dl .amt { font-weight: 700; color: var(--ink); }
.dl li.is-past { opacity: .5; }
.dl li.is-next h3 { font-weight: 700; }
.dl li.is-next .d b { background: linear-gradient(transparent 82%, var(--pen) 82% 90%, transparent 90%); display: inline-block; }
.dl .when { font-size: .8125rem; font-weight: 500; color: var(--pen); }
.dl li.is-sev h3::before, .dl li.is-expire h3::before { content: ""; display: inline-block; width: 9px; height: 9px; margin-right: 8px; border: 2px solid var(--red); border-radius: 2px; transform: rotate(-6deg); }
.after-list { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 12px; }

/* 체크리스트 */
.todo { background: var(--paper); box-shadow: var(--sheet-shadow); padding: 20px 18px; }
.cl-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.cl-head h2 { margin: 0; font: 700 1.125rem/1.3 var(--sans); }
.cl-count { font-weight: 500; color: var(--pen); }
.cl-bar { height: 6px; background: var(--paper-2); margin: 10px 0 18px; overflow: hidden; }
.cl-bar i { display: block; height: 100%; width: 0; background: var(--pen); transition: width .35s ease; }
.cl-group { margin: 0 0 16px; }
.cl-group h3 { font: 500 .9375rem/1.4 var(--sans); margin: 0 0 4px; color: var(--ink-2); }
.cl { list-style: none; margin: 0; padding: 0; }
.cl label { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-top: 1px solid var(--line); cursor: pointer; }
.cl li:first-child label { border-top: 0; }
.cl input { width: 20px; height: 20px; margin-top: 3px; accent-color: var(--pen); flex: none; }
.cl input:checked + span { color: var(--ink-3); text-decoration: line-through; }

.disclaimer { font-size: .8125rem; color: var(--ink-2); line-height: 1.65; margin: 0; }

/* 가이드 띠 */
.band .wrap { padding-top: 36px; padding-bottom: 48px; }
.band h2 { font: 700 1.375rem/1.35 var(--sans); margin: 0 0 6px; letter-spacing: -0.02em; }
.guides { list-style: none; padding: 0; margin: 18px 0 0; display: grid; gap: 14px; }
.guides li { background: var(--paper); box-shadow: var(--sheet-shadow); }
.guides a { display: block; padding: 16px 18px; text-decoration: none; color: var(--ink); }
.guides a b { display: block; font: 700 1.0625rem/1.5 var(--sans); }
.guides a span { color: var(--ink-2); font-size: .9375rem; }
.guides a:hover b { text-decoration: underline; text-decoration-color: var(--pen); text-decoration-thickness: 2px; }

/* 글 */
.article { max-width: 44rem; margin: 20px auto 56px; background: var(--paper); box-shadow: var(--sheet-shadow); padding: 28px 20px 40px; }
.article h1 { font: 700 clamp(1.625rem, 4.8vw, 2.25rem)/1.3 var(--sans); margin: 0 0 12px; letter-spacing: -0.03em; }
.article .meta { color: var(--ink-2); font-size: .875rem; margin: 0 0 28px; }
.article h2 { font: 700 1.3125rem/1.4 var(--sans); margin: 36px 0 10px; letter-spacing: -0.02em; }
.article p, .article li { line-height: 1.85; }
.article p { margin: 0 0 14px; }
.article ul, .article ol { padding-left: 1.3em; margin: 0 0 14px; }
.article li { margin-bottom: 6px; }
.article table { border-collapse: collapse; width: 100%; margin: 12px 0 18px; font-size: .9375rem; }
.article th, .article td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.article th { font-weight: 500; color: var(--ink-2); border-bottom: 2px solid var(--ink); }
.article .cta { margin: 28px 0 0; padding: 18px; border: 2px dashed var(--ink-3); }
.article .cta a.btn { display: inline-flex; align-items: center; text-decoration: none; margin-top: 8px; color: var(--paper); }
.src { font-size: .875rem; color: var(--ink-2); }
.src li { line-height: 1.7; }

.foot { border-top: 1px solid rgba(32, 36, 42, .18); font-size: .875rem; color: var(--ink-2); }
.foot .wrap { padding-top: 28px; padding-bottom: 36px; display: grid; gap: 10px; }
.foot nav { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.foot a { color: var(--ink-2); }

@media (min-width: 640px) {
  .sheets { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .guides { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .article { padding: 40px 44px 52px; }
}
@media (min-width: 960px) {
  :root { --gutter: 24px; }
  .tool { grid-template-columns: minmax(300px, 360px) minmax(0, 1fr); column-gap: 44px; align-items: start; padding-top: 32px; }
  .tool .lede { grid-column: 1 / -1; }
  .c { min-height: 62px; }
  .dl li { grid-template-columns: 6.5rem minmax(0, 1fr); }
}
@media (prefers-reduced-motion: no-preference) {
  .sheets.draw .sheet { animation: drop .7s cubic-bezier(.2, .8, .2, 1) both; transform-origin: 50% 0; }
  .sheets.draw .sheet:nth-child(2) { animation-delay: .08s; }
  .sheets.draw .sheet:nth-child(3) { animation-delay: .16s; }
  .sheets.draw .sheet:nth-child(n+4) { animation-delay: .24s; }
}
@keyframes drop { from { opacity: 0; transform: translateY(-14px) rotate(-1.2deg); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .cl-bar i { transition: none; } }
@media print {
  .top, .form, .foot, .band, .actions, .after-list { display: none; }
  body { background: #fff; color: #000; }
  .tool { display: block; }
  .sheet, .ledger, .dates, .todo, .checks { box-shadow: none; border: 1px solid #999; break-inside: avoid; }
}

[hidden] { display: none !important; }
.jump { display: inline-flex; align-items: center; text-decoration: none; }
@media (min-width: 960px) { .jump { display: none; } }
