/* 싹다챙겨 — 디자인 토큰: 메인 네이비 1 + 성취 앰버 1 + 중립 */
:root {
  color-scheme: light;
  --bg: #F5F6F8;
  --surface: #FFFFFF;
  --field: #FFFFFF;
  --line: #E5E7EB;
  --line-2: #F0F1F3;
  --text: #111827;
  --sub: #5B6472;
  --mute: #6B7280;
  --main: #1E4B8F;
  --on-main: #FFFFFF;
  --main-soft: #EEF3FA;
  --main-soft-ink: #1E3A66;
  --day: #DCE8F8;
  --day-ink: #1E3A66;
  --off: #EEF0F3;
  --off-ink: #374151;
  --custom: #DDF1EE;
  --custom-ink: #0F5B54;
  --warm: #FFF4DB;
  --warm-ink: #5A3B00;
  --warm-pill: #FFD98A;
  --amber: #E39A12;
  --teal: #0F766E;
  --on-teal: #FFFFFF;
  --red: #B42318;
  --r-lg: 18px;
  --r-md: 12px;
  --r-sm: 8px;
  --font: 'Pretendard Variable', Pretendard, -apple-system, 'Noto Sans KR', sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #0F1318;
    --surface: #171C23;
    --field: #12161C;
    --line: #29313C;
    --line-2: #1F252E;
    --text: #E8EBF0;
    --sub: #A3ABB8;
    --mute: #8A93A1;
    --main: #3D74CC;
    --on-main: #FFFFFF;
    --main-soft: #1B2840;
    --main-soft-ink: #B9CEF2;
    --day: #22334F;
    --day-ink: #CFE0FA;
    --off: #252B34;
    --off-ink: #C7CDD6;
    --custom: #163A37;
    --custom-ink: #9FE3D8;
    --warm: #33280F;
    --warm-ink: #F5D592;
    --warm-pill: #5C4512;
    --amber: #E8A93A;
    --teal: #3CC2B2;
    --on-teal: #0F1318;
    --red: #F2867A;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-tap-highlight-color: transparent;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--main); outline-offset: 2px; }
.i { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.view {
  max-width: 480px;
  margin: 0 auto;
  padding: calc(12px + env(safe-area-inset-top)) 20px calc(96px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* 헤더 */
.mhead { display: flex; align-items: center; justify-content: space-between; padding: 6px 0 2px; }
.mhead .mt { text-align: center; }
.mhead h1, .phead h1 { margin: 0; font-size: 20px; font-weight: 700; letter-spacing: -0.02em; }
.mhead p { margin: 0; font-size: 13px; color: var(--sub); }
.phead { padding: 8px 2px 2px; }
.phead h1 { font-size: 24px; }
.ib { width: 44px; height: 44px; border: 0; border-radius: var(--r-md); background: var(--surface); display: grid; place-items: center; color: var(--off-ink); }
.ib.sm { width: 36px; height: 36px; background: transparent; }
.ib.sm .i { width: 18px; height: 18px; }

/* 카드 */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.h2 { margin: 0; font-size: 16px; font-weight: 700; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.grid2, .grid3 { display: grid; gap: 8px; }
.grid2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.sub { margin: 0; font-size: 12px; color: var(--sub); }
.fine { margin: 0 4px; font-size: 11px; line-height: 1.6; color: var(--sub); }

/* 입력 */
.fld { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.fld > span { font-size: 12px; color: var(--sub); font-weight: 500; }
.fld input, .fld select {
  height: 44px; width: 100%; min-width: 0;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--field); padding: 0 12px; font-size: 15px; font-weight: 600;
}
.fld.inline { flex-direction: row; align-items: center; justify-content: space-between; }
.fld.inline > span { font-size: 14px; color: var(--text); }
.fld.inline input, .fld.inline select { width: auto; max-width: 60%; }
.fld.inline input[inputmode] { width: 96px; text-align: right; }
.fld.big input { height: 54px; text-align: center; font-size: 22px; font-weight: 700; border: 1.5px solid var(--main); border-radius: var(--r-md); padding: 0 4px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.check input { width: 20px; height: 20px; accent-color: var(--main); }

/* 버튼 */
.btn { height: 50px; border-radius: 14px; border: 0; font-size: 15px; font-weight: 600; }
.btn.primary { background: var(--main); color: var(--on-main); }
.btn.ghost { background: transparent; border: 1px solid var(--line); height: 46px; }
.mini { height: 34px; padding: 0 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); font-size: 13px; font-weight: 600; }
.link { border: 0; background: none; padding: 6px 0; color: var(--main); font-size: 13px; font-weight: 600; text-align: left; text-decoration: none; }
.link.danger { color: var(--red); }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; background: var(--off); border-radius: 10px; padding: 3px; }
.seg button { height: 38px; border: 0; border-radius: 8px; background: transparent; font-size: 13px; color: var(--sub); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); font-weight: 700; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08); }

/* 배지·알림 */
.badge { font-size: 11px; font-weight: 700; border-radius: 999px; padding: 3px 9px; }
.badge.cool { background: var(--main-soft); color: var(--main-soft-ink); }
.badge.warm { background: var(--warm); color: var(--warm-ink); }
.pill { font-size: 11px; font-weight: 700; color: var(--warm-ink); background: var(--warm-pill); border-radius: 999px; padding: 2px 8px; }
.bar-note { display: flex; align-items: center; justify-content: space-between; gap: 8px; background: var(--main-soft); color: var(--main-soft-ink); border-radius: 10px; padding: 8px 8px 8px 12px; font-size: 12px; }
.bar-note .mini { border: 0; }
#warn:empty, #note:empty { display: none; }
.warn { background: var(--warm); color: var(--warm-ink); border-radius: var(--r-md); padding: 12px 14px; font-size: 13px; margin: 0; }

/* 계산 결과 */
.why summary, .fold summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--main); list-style: none; padding: 4px 0; }
.fold { display: block; padding: 14px 16px; }
.fold[open] summary { margin-bottom: 4px; }
.fold summary { font-size: 14px; color: var(--text); text-align: center; padding: 2px 0; }
.why summary::-webkit-details-marker, .fold summary::-webkit-details-marker { display: none; }
.why dl { margin: 8px 0 0; background: var(--bg); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.why dl div, .lines div { display: flex; justify-content: space-between; gap: 8px; }
.why dt, .lines span:first-child { color: var(--sub); }
.why dd { margin: 0; font-weight: 600; }
.kicker { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--sub); font-weight: 500; }
.amount { margin: 0; font-size: 34px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; }
.amount small { font-size: 18px; font-weight: 600; margin-left: 2px; }
.lines { display: flex; flex-direction: column; gap: 10px; border-top: 1px solid var(--line-2); padding-top: 12px; font-size: 14px; }
.lines span:last-child { font-weight: 600; }
.ranks { display: flex; flex-direction: column; margin-top: 8px; }
.ranks div { display: flex; justify-content: space-between; padding: 12px; border-radius: var(--r-md); font-weight: 700; }
.ranks .me { background: var(--warm); box-shadow: inset 0 0 0 1.5px var(--amber); }

/* 근무 칩 */
.chip { width: 26px; height: 20px; border-radius: 6px; display: inline-grid; place-items: center; font-size: 11px; font-weight: 700; font-style: normal; }
.chip.lg { width: 38px; height: 38px; border-radius: 10px; font-size: 14px; border: 0; }
.t-day { background: var(--day); color: var(--day-ink); }
.t-night { background: var(--main); color: var(--on-main); }
.t-off { background: var(--off); color: var(--off-ink); }
.t-rest { background: transparent; color: var(--off-ink); box-shadow: inset 0 0 0 1px var(--mute); }
.t-custom { background: var(--custom); color: var(--custom-ink); }
.t-leave { background: var(--warm); color: var(--warm-ink); }

/* 달력 */
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); text-align: center; }
.stats div { display: flex; flex-direction: column; }
.stats div + div { border-left: 1px solid var(--line-2); }
.stats span { font-size: 12px; color: var(--sub); }
.stats b { font-size: 20px; }
.stats b.main { color: var(--main); }
.stats small { font-size: 13px; }
.meta { margin: 0; text-align: center; font-size: 12px; color: var(--sub); background: var(--bg); border-radius: var(--r-sm); padding: 6px 0; }
.cal { padding: 12px 8px; gap: 6px; }
.wk, .days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; }
.wk { text-align: center; font-size: 12px; font-weight: 600; color: var(--sub); }
.wk span:first-child, .cell.red .dn { color: var(--red); }
.wk span:last-child, .cell.blue .dn { color: var(--main); }
.cell { position: relative; height: 66px; border: 0; border-radius: 10px; background: transparent; padding: 5px 0 0; display: flex; flex-direction: column; align-items: center; gap: 3px; }
.cell.jw { background: var(--main-soft); }
.cell.sel { box-shadow: inset 0 0 0 2px var(--main); }
.cell.edited .chip { box-shadow: inset 0 0 0 1.5px var(--amber); }
.dn { font-size: 12px; font-weight: 600; }
.ob { display: inline-block; min-width: 26px; height: 16px; padding: 0 5px; border-radius: 999px; background: var(--main); color: var(--on-main); font-size: 10px; font-weight: 700; line-height: 16px; text-align: center; font-style: normal; }
.ob.edu { background: var(--teal); color: var(--on-teal); }
.ob.none { background: none; }
.hd { position: absolute; top: 5px; right: 5px; width: 6px; height: 6px; border-radius: 50%; background: var(--amber); }
.legend { display: flex; flex-wrap: wrap; gap: 12px; padding: 6px 6px 2px; font-size: 11px; color: var(--sub); }
.legend span { display: flex; align-items: center; gap: 4px; }
.legend i { width: 6px; height: 6px; border-radius: 50%; background: var(--amber); }
.ot .seg button { font-size: 12px; }
.ot { display: flex; flex-direction: column; gap: 10px; background: var(--bg); border-radius: var(--r-md); padding: 12px; }
.empty p { margin: 0; color: var(--sub); font-size: 14px; }

/* 설정 */
.type { display: flex; flex-direction: column; gap: 10px; padding: 12px 0; border-top: 1px solid var(--line-2); }
.type:first-of-type { border-top: 0; padding-top: 0; }
.trow { display: flex; align-items: center; gap: 8px; }
.trow input { height: 40px; border: 1px solid var(--line); border-radius: 10px; background: var(--field); padding: 0 10px; font-weight: 600; min-width: 0; }
.tname { flex: 1; }
.tshort { width: 52px; text-align: center; }
.pat { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-height: 40px; }
.pat .sep { color: var(--mute); }
.adds { display: flex; flex-wrap: wrap; gap: 6px; }

/* 기록 */
.bars { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 6px; height: 150px; align-items: end; }
.bars div { height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 6px; }
.bars i { width: 100%; border-radius: 5px; background: var(--line); }
.bars i.on { background: var(--main); }
.bars i.now { background: var(--amber); }
.bars span { font-size: 11px; color: var(--sub); }
.recs { padding: 4px 16px; gap: 0; }
.rec { display: flex; align-items: center; gap: 8px; padding: 12px 0; border-top: 1px solid var(--line-2); }
.rec:first-child { border-top: 0; }
.rec button.open { flex: 1; display: flex; justify-content: space-between; align-items: center; border: 0; background: none; padding: 0; text-align: left; }
.rec b { font-size: 15px; display: block; }
.rec small { font-size: 12px; color: var(--sub); }
.rec strong { font-size: 16px; }

/* 하단 탭 */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: flex; justify-content: center;
  background: var(--surface); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tab { flex: 1; max-width: 120px; height: 64px; border: 0; background: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-size: 11px; color: var(--mute); }
.tab[aria-current="page"] { color: var(--main); font-weight: 700; }

.toast {
  position: fixed; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom)); z-index: 20;
  transform: translate(-50%, 8px); opacity: 0; pointer-events: none;
  background: var(--text); color: var(--bg); font-size: 14px; padding: 10px 16px; border-radius: 999px;
  transition: opacity 0.2s, transform 0.2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }

/* 단가표 */
.rtable { display: flex; flex-direction: column; gap: 4px; }
.rrow { display: grid; grid-template-columns: 52px repeat(3, minmax(0, 1fr)); gap: 6px; align-items: center; padding: 4px; border-radius: 10px; }
.rrow span:first-child { font-size: 14px; font-weight: 700; }
.rrow.head span { font-size: 11px; color: var(--sub); text-align: right; padding-right: 8px; }
.rrow.me { background: var(--warm); }
.rrow input { height: 40px; min-width: 0; width: 100%; border: 1px solid var(--line); border-radius: 8px; background: var(--field); padding: 0 8px; font-size: 14px; font-weight: 600; text-align: right; }

/* 설정 목록 */
.list { padding: 4px 16px; gap: 0; }
.li {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px;
  padding: 10px 0; border: 0; border-top: 1px solid var(--line-2); background: none;
  text-align: left; text-decoration: none; color: var(--text); font-size: 15px;
}
.li:first-child { border-top: 0; }
.li > span:first-child { font-weight: 500; }
.li em { margin-left: auto; font-style: normal; font-size: 14px; color: var(--sub); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.li .chev { width: 18px; height: 18px; color: var(--mute); flex: none; }
.li.static { justify-content: space-between; }
.li.danger span { color: var(--red); font-weight: 500; }
.li .grow { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.li .grow b { font-size: 15px; }
.li .grow small { font-size: 12px; color: var(--sub); }
.seg.sm { width: 150px; }
.seg.sm button { height: 32px; }
select.plain { border: 0; background: none; font-size: 15px; font-weight: 700; color: var(--main); text-align: right; padding: 4px 0; }
.shead { display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; padding: 6px 0 2px; }
.shead h1 { margin: 0; text-align: center; font-size: 17px; font-weight: 700; }
.btn.ghost.danger { color: var(--red); }
.fine.center { text-align: center; }

/* 화면 전환 */
@keyframes push { from { transform: translateX(28px); opacity: 0; } }
@keyframes pop { from { transform: translateX(-28px); opacity: 0; } }
.view.push { animation: push 0.22s ease-out; }
.view.pop { animation: pop 0.22s ease-out; }
@media (prefers-reduced-motion: reduce) { .view.push, .view.pop { animation: none; } }
