@import url('https://cdn.jsdelivr.net/gh/wanteddev/wanted-sans@v1.0.1/packages/wanted-sans/fonts/webfonts/variable/split/WantedSansVariable.min.css');
@import url('./help-chat.css');

/* ─────────────────────────────────────────────────────────────
   nfee 디자인 시스템
   · 한글은 어절 단위로 끊는다(keep-all). 첫 커밋부터 없으면 나중에 전부 뜯는다.
   · 그림자는 "떠 있는 것"에만. 카드는 선과 여백으로 나눈다.
   · 숫자는 tabular — 금액·차시가 표에서 흔들리면 안 된다.
   ───────────────────────────────────────────────────────────── */

:root {
  /* 브랜드 4색(물방울 로고). 옅은 원색은 면(面)에, 글자는 어두운 짝으로. */
  --mint:  #7ED0B2; --mint-ink:  #23705a; --mint-soft:  #ecf7f3;
  --coral: #DD8489; --coral-ink: #a94b52; --coral-soft: #fdeff0;
  --lilac: #BEA6CB; --lilac-ink: #71547f; --lilac-soft: #f5f0f8;
  --blue:  #93B2E5; --blue-ink:  #3f66ab; --blue-soft:  #edf3fc;

  /* 회색은 한 가족으로만. 따뜻한 회색과 찬 회색을 섞지 않는다. */
  --bg:      #f5f5ef;
  --panel:   #fffefb;
  --panel-2: #fafaf5;
  --line:    #e3e6dd;
  --line-2:  #d0d7cc;
  --ink:     #29362f;
  --ink-2:   #536259;
  --ink-3:   #647167;

  /* 주황은 「미착수·주의」 한 뜻으로만 쓴다. 세 자리에 흩어져 있던 것을 토큰으로 올렸다.
     브랜드 4색이 아니므로 -soft/-ink 두 벌만 둔다. */
  --amber:      #d9a760;
  --amber-ink:  #96682e;
  --amber-soft: #fbf3e8;

  /* 중립 회색의 옅은 단계. .chip.draft·.bar 바탕·skeleton 이 각자 갖고 있던 값을 모았다. */
  --fill:    #edf0e8;
  --fill-2:  #f0f2eb;
  --ink-4:   #5e6a60;

  /* 손이 닿았을 때만 나타나는 단계. 평상시 색과 붙어 있어야 눌린 것처럼 안 보인다. */
  --hover:   #f1f3ec;
  --line-3:  #bdc8bb;

  --accent: var(--blue-ink);
  --accent-soft: var(--blue-soft);
  --accent-deep: #365a99;   /* primary 버튼이 눌릴 때만 */

  --r-xs: 6px; --r-sm: 10px; --r: 14px; --r-lg: 20px; --r-pill: 999px;

  /* 그림자는 배경 색조를 띤다. 순수 검정 반투명은 회색 때가 낀 것처럼 보인다. */
  --lift: 0 1px 2px rgba(63, 102, 171, .07), 0 10px 30px -14px rgba(28, 34, 46, .35);
  --lift-lg: 0 24px 60px -20px rgba(28, 34, 46, .35);

  --z-header: 20; --z-bar: 30; --z-overlay: 60; --z-toast: 80;
  --ease: cubic-bezier(.2, .7, .3, 1);
}

* { box-sizing: border-box; }
.startup-error { max-width: 720px; margin: 24px auto; padding: 24px; }
.startup-error h2 { margin-top: 0; }
.startup-error .btn { margin: 8px; }
.site-footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 12px 20px; padding: 24px 16px 100px; margin-top: 32px; border-top: 1px solid var(--line); color: var(--ink-2); font-size: 16px; }
.system-version { font-variant-numeric: tabular-nums; }
.support-button { min-height: 44px; color: var(--accent); background: var(--panel); }
.footer-guide { flex-basis: 100%; text-align: center; }
.feedback-dialog { width: min(560px, calc(100vw - 24px)); }
.feedback-dialog .body { padding: 24px; }
.feedback-dialog h2 { font-size: 24px; margin: 0 0 12px; }
.feedback-dialog p { color: var(--ink-2); }
.feedback-dialog .field { margin-top: 18px; }
.feedback-dialog :is(input, select, textarea, button) { font-size: 16px; min-height: 44px; }
.feedback-dialog textarea { resize: vertical; }
.feedback-dialog .feedback-eyebrow { color: var(--mint-ink); font-weight: 650; margin: 0 0 8px; }
.feedback-privacy { padding: 14px; background: var(--fill); border-radius: var(--r-sm); font-size: 15px; }
.feedback-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.feedback-receipt { padding: 16px; background: var(--mint-soft); border-radius: var(--r-sm); }
.feedback-success button { width: 100%; }
.feedback-message { white-space: pre-wrap; overflow-wrap: anywhere; }
.feedback-list { display: grid; gap: 16px; margin-bottom: 20px; }
#tab-feedback h2 { font-size: 24px; }
.feedback-list h3 { font-size: 18px; }
.feedback-list .feedback-message { font-size: 16px; }
@media (max-width: 767px) {
  .feedback-dialog .body { padding: 20px; }
  .feedback-actions button { flex: 1; }
  .startup-error { margin-inline: 16px; }
}
@media print { .site-footer, .feedback-dialog, .startup-error { display: none !important; } }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-height, 90px) + 16px); scroll-padding-bottom: 180px; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.65 "Wanted Sans Variable", "Wanted Sans", -apple-system, BlinkMacSystemFont,
        "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  word-break: keep-all;
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }

:focus-visible {
  outline: 2px solid var(--blue-ink);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}

.skip {
  position: absolute; left: 12px; top: -48px; z-index: var(--z-toast);
  background: var(--ink); color: var(--panel); padding: 8px 14px; border-radius: var(--r-sm);
  transition: top .16s var(--ease);
}
.skip:focus { top: 12px; text-decoration: none; }

/* ── 상단 바 ─────────────────────────────────────────── */
header.top {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  padding: 14px max(22px, calc((100vw - 1076px) / 2)); background: var(--panel);
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: var(--z-header);
}
header.top .brand { display: flex; align-items: center; gap: 9px; font-weight: 700; letter-spacing: -.03em; font-size: 20px; }
header.top .brand svg { display: block; }
header.top .brand span { color: var(--ink-3); font-weight: 450; font-size: 12.5px; letter-spacing: 0; }
header.top nav { display: flex; gap: 8px; flex-wrap: wrap; }
header.top nav a {
  padding: 10px 15px; border-radius: var(--r-pill); color: var(--ink-2);
  font-size: 14px; font-weight: 500; transition: background .16s var(--ease), color .16s var(--ease);
}
header.top nav a:hover { background: var(--fill); color: var(--ink); text-decoration: none; }
header.top nav a.on { background: var(--mint-soft); color: var(--mint-ink); font-weight: 650; }
header.top .spacer { flex: 1; }
header.top .who { color: var(--ink-2); font-size: 13px; }

main { max-width: 1120px; margin: 0 auto; padding: 36px 22px 96px; }
main.wide { max-width: 1240px; }
.menu-toggle { display: none; }
.account-tools { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }

/* ── 타이포 ──────────────────────────────────────────── */
h1 {
  font-size: 29px; font-weight: 700; letter-spacing: -.035em; line-height: 1.25;
  margin: 0 0 3px; text-wrap: balance;
}
h2 { font-size: 15px; font-weight: 650; letter-spacing: -.015em; margin: 34px 0 12px; }
h3 { font-size: 14.5px; font-weight: 650; letter-spacing: -.015em; margin: 0; }
.sub { color: var(--ink-2); font-size: 14px; margin: 0; max-width: 62ch; text-wrap: pretty; }
.small { font-size: 13px; }
/* 한 어절로 묶는다 — ·괄호·하이픈으로 이어진 덩어리(「이름·이메일·연락처」·전화번호)는 keep-all 로도 그 기호에서 갈라진다.
   ⚠️ 320px 에서 한 줄(약 290px)을 넘는 덩어리에 쓰지 마라. 안 갈라지는 대신 옆으로 넘친다. 그럴 땐 문장을 고친다. */
.nb { white-space: nowrap; }
.muted { color: var(--ink-3); }
.num, .money { font-variant-numeric: tabular-nums; }
.right { text-align: right; }

.page-head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head .spacer { flex: 1; }

/* ── 카드 ────────────────────────────────────────────── */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); }
.panel + .panel { margin-top: 14px; }
.panel > .body { padding: 20px; }
.panel > .head {
  padding: 14px 20px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: var(--panel-2); border-radius: var(--r-lg) var(--r-lg) 0 0;
}
.panel > .head .spacer { flex: 1; }

.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grid { display: grid; gap: 14px; }
/* ⚠️ grid 칸의 기본 최소 크기는 auto 다 — 자식의 min-content 가 칸을 밀어낸다.
   표 하나가 안 접히면 그 칸이 부풀고, 부푼 칸이 본문 전체를 옆으로 민다.
   붕괴를 **허용**해 두고, 진짜 스크롤은 .table-wrap · .sheet-scroll 안에서만 나게 한다. */
.grid > * { min-width: 0; }
.grid.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
/* 왼쪽 입력 단 + 오른쪽 미리보기. 인라인 style 로 360px 을 박으면 아래 760px 접힘이 안 먹는다. */
.grid.side { grid-template-columns: minmax(0, 360px) minmax(0, 1fr); gap: 18px; }
/* ⚠️ minmax(310px, …) 는 310px 아래로 못 줄어든다. 320px 화면에서 좌우 여백을 빼면 292px 뿐이라
   카드가 화면을 넘긴다. min() 으로 하한 자체를 화면에 묶는다. */
.grid.cards { grid-template-columns: repeat(auto-fill, minmax(min(310px, 100%), 1fr)); align-items: stretch; }
/* 카드 내용 길이가 달라도 버튼은 같은 높이에 선다. */
.grid.cards > article { display: flex; }
.grid.cards > article > .body { display: flex; flex-direction: column; width: 100%; }
.grid.cards .card-actions { margin-top: auto; padding-top: 14px; }

/* ── 폼 ──────────────────────────────────────────────── */
label.field { display: block; }
label.field > span {
  display: block; font-size: 12.5px; color: var(--ink-2); margin-bottom: 5px;
  font-weight: 550; letter-spacing: .005em;
}
input[type=tel], input[type=search], input[type=text], input[type=email], input[type=password], input[type=date],
input[type=time], input[type=number], select, textarea {
  width: 100%; padding: 9px 11px; font: inherit; color: inherit;
  border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--panel);
  transition: border-color .14s var(--ease), box-shadow .14s var(--ease);
}
/* Safari의 기본 선택창도 입력칸과 같은 조작 높이를 유지한다. */
select {
  appearance: none; -webkit-appearance: none; padding-right: 34px;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%), linear-gradient(135deg, var(--ink-3) 50%, transparent 50%);
  background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%;
  background-size: 5px 5px; background-repeat: no-repeat;
}
input[type=number], input[type=date], input[type=time] { font-variant-numeric: tabular-nums; }
input:hover, select:hover, textarea:hover { border-color: var(--line-3); }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--blue-ink); box-shadow: 0 0 0 3px var(--blue-soft);
}
input:disabled, textarea:disabled { background: var(--panel-2); color: var(--ink-3); }
textarea { resize: vertical; min-height: 70px; line-height: 1.58; }
.empty-field { border-color: var(--coral); background-color: var(--coral-soft); }

/* ── 버튼 ────────────────────────────────────────────── */
button, .btn {
  display: inline-flex; align-items: center; gap: 6px; justify-content: center;
  padding: 8px 14px; border-radius: var(--r-sm); border: 1px solid var(--line-2);
  background: var(--panel); color: var(--ink); cursor: pointer; font-family: inherit; font-size: 14px; font-weight: 550; line-height: 1.4;
  transition: background .14s var(--ease), border-color .14s var(--ease), transform .08s var(--ease);
}
button svg, .btn svg { flex: none; }
button:hover, .btn:hover { background: var(--hover); border-color: var(--line-3); text-decoration: none; }
button:active, .btn:active { transform: translateY(1px); }
button.primary, .btn.primary { background: var(--blue-ink); border-color: var(--blue-ink); color: var(--panel); }
button.primary:hover, .btn.primary:hover { background: var(--accent-deep); border-color: var(--accent-deep); }
button.ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
button.ghost:hover { background: var(--fill); border-color: transparent; color: var(--ink); }
button.danger { color: var(--coral-ink); border-color: var(--coral); }
button.danger:hover { background: var(--coral-soft); border-color: var(--coral-ink); }
button.sm, .btn.sm { padding: 5px 10px; font-size: 13px; }
button:disabled { opacity: .45; cursor: not-allowed; transform: none; }

/* ── 표 ──────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th, table.data td { padding: 11px 14px; border-bottom: 1px solid var(--line); text-align: left; }
table.data th {
  font-size: 12px; color: var(--ink-3); font-weight: 600; letter-spacing: .02em;
  background: var(--panel-2); white-space: nowrap;
}
table.data tbody tr:last-child td { border-bottom: none; }
table.data tbody tr:hover { background: var(--panel-2); }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ── 상태 태그 ───────────────────────────────────────── */
.chip {
  display: inline-flex; align-items: center; padding: 2px 8px 2px 7px; border-radius: var(--r-xs);
  font-size: 12px; font-weight: 600; white-space: nowrap; border-left: 3px solid currentColor;
  letter-spacing: -.01em;
}
.chip.draft     { background: var(--fill-2); color: var(--ink-4); }
.chip.submitted { background: var(--lilac-soft); color: var(--lilac-ink); }
.chip.approved  { background: var(--mint-soft);  color: var(--mint-ink); }
.chip.rejected  { background: var(--coral-soft); color: var(--coral-ink); }
.chip.none      { background: var(--amber-soft); color: var(--amber-ink); }
.chip.deleted   { background: var(--fill-2); color: var(--ink-3); text-decoration: line-through; }

/* ── 진행률 ──────────────────────────────────────────── */
.bar { height: 5px; border-radius: 999px; background: var(--fill); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--blue); border-radius: 999px; transition: width .3s var(--ease); }
.bar.done > i { background: var(--mint); }
.progress-line { display: flex; align-items: center; gap: 9px; }
.progress-line .bar { flex: 1; min-width: 56px; }
.progress-line b { font-size: 12px; font-variant-numeric: tabular-nums; color: var(--ink-3);
  width: 40px; text-align: right; font-weight: 600; white-space: nowrap; }

/* ── 요약 띠 — 균등 8칸 대신 지배적인 숫자 하나 ──────── */
.summary {
  display: flex; align-items: stretch; gap: 0; flex-wrap: wrap;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden;
}
.summary .lead { padding: 20px 24px; min-width: 240px; }
.summary .lead .k { font-size: 12.5px; color: var(--ink-2); font-weight: 550; }
.summary .lead .v {
  font-size: 34px; font-weight: 700; letter-spacing: -.045em; line-height: 1.15; margin-top: 3px;
  font-variant-numeric: tabular-nums;
}
.summary .lead .v small { font-size: 15px; font-weight: 550; color: var(--ink-3); letter-spacing: -.01em; }
.summary .rest { display: flex; flex-wrap: wrap; flex: 1; border-left: 1px solid var(--line); }
.summary .rest > div { padding: 20px 22px; min-width: 116px; }
.summary .rest .k { font-size: 12.5px; color: var(--ink-3); }
.summary .rest .v { font-size: 19px; font-weight: 650; letter-spacing: -.03em; margin-top: 2px; font-variant-numeric: tabular-nums; }
.summary .rest .v small { font-size: 13px; font-weight: 500; color: var(--ink-3); }
.summary .rest .v.warn { color: var(--amber-ink); }
.summary .rest .v.bad { color: var(--coral-ink); }

/* ── 알림 ────────────────────────────────────────────── */
.notice { padding: 11px 14px; border-radius: var(--r-sm); font-size: 14px; border-left: 3px solid currentColor; }
.notice.err  { background: var(--coral-soft); color: var(--coral-ink); }
.notice.ok   { background: var(--mint-soft);  color: var(--mint-ink); }
.notice.warn { background: var(--amber-soft); color: var(--amber-ink); }
.notice.info { background: var(--lilac-soft); color: var(--lilac-ink); }
.notice b { font-weight: 650; }

/* ── 빈 상태 ─────────────────────────────────────────── */
.empty { text-align: center; padding: 44px 24px; }
.empty svg { color: var(--line-2); margin-bottom: 12px; }
.empty h4 { margin: 0 0 5px; font-size: 15px; font-weight: 650; letter-spacing: -.02em; }
.empty p { margin: 0 auto 16px; color: var(--ink-3); font-size: 13.5px; max-width: 42ch; text-wrap: pretty; }

/* ── 스켈레톤 ────────────────────────────────────────── */
.skel { background: linear-gradient(90deg, var(--fill) 25%, var(--bg) 37%, var(--fill) 63%); background-size: 400% 100%;
  animation: shimmer 1.3s ease-in-out infinite; border-radius: var(--r-xs); height: 13px; }
.skel.big { height: 30px; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  html { scroll-behavior: auto; }
}

/* ── 회차 편집 ───────────────────────────────────────── */
.session { border: 1px solid var(--line); border-radius: var(--r); padding: 15px; background: var(--panel); }
.session + .session { margin-top: 10px; }
.session > .head { display: flex; align-items: center; gap: 8px; margin-bottom: 13px; }
.session > .head .spacer { flex: 1; }
.session .seq {
  font-weight: 700; font-size: 12px; letter-spacing: .04em; color: var(--ink-2);
  background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--r-xs); padding: 2px 8px;
  font-variant-numeric: tabular-nums;
}

/* ── 하단 고정 바 ────────────────────────────────────── */
.toolbar {
  position: sticky; bottom: 0; background: rgba(255,255,255,.94); backdrop-filter: blur(10px);
  border-top: 1px solid var(--line); padding: 12px 22px; display: flex; gap: 10px; align-items: center;
  flex-wrap: wrap; z-index: var(--z-bar); box-shadow: 0 -8px 24px -18px rgba(28,34,46,.4);
}
.toolbar .spacer { flex: 1; }

/* ── 탭 ──────────────────────────────────────────────── */
/* 탭이 늘면 좁은 화면에서 줄을 넘친다. 넘치는 것은 탭 줄 **안에서만** 일어나야 한다.
   실제로 「개인정보」 탭을 더하자 320px 에서 본문이 통째로 옆으로 밀렸다. */
.tabs {
  display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 20px;
  overflow-x: auto; scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  border: none; background: none; padding: 9px 14px; border-radius: 0; color: var(--ink-3);
  border-bottom: 2px solid transparent; font-weight: 600; font-size: 14px;
  flex: none; white-space: nowrap;
}
.tabs button:hover { background: transparent; color: var(--ink); border-color: var(--line-2); }
.tabs button.on { color: var(--ink); border-bottom-color: var(--blue-ink); }

/* ── 이력 타임라인 ───────────────────────────────────── */
.timeline { position: relative; padding-left: 26px; }
.timeline::before { content: ""; position: absolute; left: 7px; top: 8px; bottom: 8px; width: 1px; background: var(--line-2); }
.rev { position: relative; padding: 0 0 20px; }
.rev:last-child { padding-bottom: 0; }
.rev::before {
  content: ""; position: absolute; left: -23px; top: 5px; width: 9px; height: 9px; border-radius: 50%;
  background: var(--panel); border: 2px solid var(--line-2);
}
.rev.ok::before   { border-color: var(--mint); }
.rev.bad::before  { border-color: var(--coral); }
.rev.info::before { border-color: var(--lilac); }
.rev.warn::before { border-color: var(--amber); }
.rev .line { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.rev .act { font-weight: 650; font-size: 14px; letter-spacing: -.01em; }
.rev .meta { font-size: 12.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.rev .ver {
  font-size: 11.5px; font-weight: 650; color: var(--ink-3); background: var(--panel-2);
  border: 1px solid var(--line); border-radius: var(--r-xs); padding: 1px 6px; font-variant-numeric: tabular-nums;
}
.rev .sum { font-size: 13.5px; color: var(--ink-2); margin-top: 3px; }
.rev .memo { font-size: 13px; color: var(--ink-2); margin-top: 5px; padding: 7px 10px; background: var(--panel-2); border-radius: var(--r-xs); }
.diff { margin-top: 9px; border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden; }
.diff div.d {
  display: grid; grid-template-columns: minmax(96px, 150px) 1fr; gap: 0;
  border-bottom: 1px solid var(--line); font-size: 13px;
}
.diff div.d:last-child { border-bottom: none; }
.diff .dk { padding: 7px 11px; background: var(--panel-2); color: var(--ink-2); font-weight: 550; }
.diff .dv { padding: 7px 11px; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.diff .was { color: var(--coral-ink); text-decoration: line-through; text-decoration-color: rgba(169,75,82,.4); }
.diff .now { color: var(--mint-ink); font-weight: 550; }
.diff .arw { color: var(--ink-3); }

/* ── 대화상자(슬라이드 시트) ─────────────────────────── */
dialog {
  border: none; border-radius: var(--r-lg); padding: 0; box-shadow: var(--lift-lg);
  max-width: 480px; width: calc(100% - 32px); color: var(--ink);
}
dialog::backdrop { background: rgba(24,28,36,.34); backdrop-filter: blur(2px); }
dialog > .body { padding: 22px; }
dialog h3 { margin: 0 0 4px; font-size: 17px; letter-spacing: -.025em; }
dialog .dlg-sub { color: var(--ink-3); font-size: 13.5px; margin: 0 0 16px; }
dialog[open] { animation: pop .18s var(--ease); }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.99); } }

/* ── 토스트 ──────────────────────────────────────────── */
.toast {
  position: fixed; right: 22px; bottom: 22px; z-index: var(--z-toast);
  box-shadow: var(--lift); background: var(--panel); animation: rise .2s var(--ease);
}
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

@media (max-width: 767px) {
  /* ⚠️ 1fr 만 쓰면 칸이 **내용 폭만큼 부푼다**(grid 칸의 기본 min-width 는 auto 다).
     A4 양식(794px)이 든 칸이 그렇게 부풀어 320px 화면에서 본문 전체가 옆으로 밀렸다. */
  .grid.c2, .grid.c3, .grid.side { grid-template-columns: minmax(0, 1fr); }
  main { padding: 20px clamp(16px, 4.3vw, 20px) 80px; }
  /* 모바일 입력 시 자동 확대를 피하고 손가락으로 누를 공간을 확보한다. */
  input[type=tel], input[type=search], input[type=text], input[type=email], input[type=password], input[type=date],
  input[type=time], input[type=number], select, textarea { font-size: 16px; min-height: 44px; min-width: 0; }
  button, .btn, header.top nav a { min-height: 44px; }
  header.top { gap: 10px; padding: 10px 15px; }
  header.top { padding: 8px 16px; gap: 8px; }
  header.top .brand span { display: none; }
  header.top .brand { margin-right: auto; }
  header.top .menu-toggle { display: inline-flex; }
  header.top .spacer { display: none; }
  header.top nav { display: flex; width: 100%; flex-wrap: nowrap; gap: 8px; }
  header.top nav a { flex: 1; justify-content: center; padding-inline: 6px; font-size: 16px; }
  header.top .account-tools { display: none; width: 100%; }
  header.top[data-expanded=true] .account-tools { display: flex; }
  header.top[data-expanded=true] .who { display: block; flex: 1; }
  header.top[data-expanded=true] #logout { display: inline-flex; }

  header.top nav a { display: inline-flex; align-items: center; }

  h1 { font-size: 22px; }
  .summary .rest { border-left: none; border-top: 1px solid var(--line); }
  .summary .lead .v { font-size: 28px; }
}

/* ── 개인정보 동의 · 처리방침 ────────────────────────── */
/* 가입 화면과 「내 정보」가 같은 모양을 쓴다. 동의를 화면마다 다르게 그리면
   어디서 동의했는지 사용자가 헷갈리고, 우리도 어느 쪽이 정본인지 잃는다. */
.consent {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 11px 13px; border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--panel-2);
}
.consent .check { flex: 1 1 15rem; }
.consent .linky { margin-left: auto; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13.5px; cursor: pointer; }
.check span { text-wrap: pretty; }
.check input { width: auto; margin: 0; accent-color: var(--accent); }
.check .req { color: var(--coral-ink); font-weight: 650; }

/* 글처럼 보이지만 버튼인 것. 새 창을 열면 쓰던 폼이 날아가므로 링크를 안 쓴다. */
.linky {
  padding: 0; border: 0; background: none; color: var(--accent);
  font: inherit; font-size: 13px; font-weight: 550; text-decoration: underline;
  text-underline-offset: 2px; cursor: pointer;
}
.linky:hover { background: none; border-color: transparent; color: var(--accent-deep); }

.policy-dialog { width: min(560px, calc(100vw - 32px)); }
.policy section + section { margin-top: 16px; }
.policy h4 { margin: 0 0 6px; font-size: 14px; font-weight: 650; letter-spacing: -.02em; }
.policy ul { margin: 0; padding-left: 18px; color: var(--ink-2); font-size: 13.5px; line-height: 1.62; }
.policy li + li { margin-top: 4px; }
.policy > .small { margin: 18px 0 0; }

/* ── 되돌릴 수 없는 일 ───────────────────────────────── */
/* 파기·영구 삭제처럼 되돌릴 수 없는 자리. 코랄(반려)과 구분해 테두리를 실선으로 두른다 —
   「실패」가 아니라 「경고」이기 때문이다. */
.danger-zone {
  border: 1px solid var(--coral); border-radius: var(--r); padding: 16px;
  background: var(--coral-soft);
}
.danger-zone h4 { margin: 0 0 4px; font-size: 14px; font-weight: 650; color: var(--coral-ink); }
.danger-zone p { margin: 0 0 12px; font-size: 13.5px; color: var(--ink-2); max-width: 62ch; text-wrap: pretty; }

/* ── 숨김 ────────────────────────────────────────────── */
/* style="display:none" 을 화면마다 쓰던 것을 한 자리로. hidden 속성은 CSS display 에 지므로
   여기서 다시 못 박는다 — 안 그러면 .grid 인 폼이 hidden 인데도 보인다. */
[hidden] { display: none !important; }

/* 길지만 꼭 있어야 하는 글(처리방침)을 접어 둔다. 펼치기 전에는 한 줄만 차지한다. */
.policy-fold > summary {
  cursor: pointer; font-size: 14px; font-weight: 650; letter-spacing: -.02em;
  padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--panel-2);
}
.policy-fold > summary:hover { background: var(--hover); }
.policy-fold[open] > summary { margin-bottom: 14px; }

/* A4 양식(210mm)은 좁은 화면보다 넓다. 가로 스크롤은 **양식 안에서만** 일어나야 한다.
   min-width:0 이 없으면 grid/flex 칸이 내용 폭(794px)만큼 부풀어 본문 전체가 옆으로 밀린다. */
.sheet-scroll { overflow-x: auto; min-width: 0; }

/* ── 데이터 사전 ─────────────────────────────────────── */
/* 낱말·지표·레시피를 한 화면에 늘어놓는 자리. 항목 사이를 선으로 나눈다 —
   카드로 감싸면 카드 안에 카드가 되어 화면이 상자 무더기가 된다. */
.dict-item + .dict-item,
.dict-item ~ .sqlbox + .dict-item { margin-top: 22px; padding-top: 22px; border-top: 1px solid var(--line); }
.dict-item h4 { margin: 0 0 4px; font-size: 15px; font-weight: 650; letter-spacing: -.02em; }
.dict-item p { margin: 0 0 6px; text-wrap: pretty; }
.dict-item code { font-size: 12.5px; }

/* SQL 은 길다. 가로 스크롤은 이 상자 안에서만 난다(rules/design.md 13번). */
.sqlbox { position: relative; margin: 8px 0; }
.sqlbox pre {
  margin: 0; padding: 13px 15px; overflow-x: auto;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--r-sm);
}
.sqlbox code {
  font: 12.5px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--ink); white-space: pre; word-break: normal;   /* SQL 은 어절로 안 끊는다 */
}
.sqlbox .copy { position: absolute; top: 7px; right: 7px; opacity: 0; transition: opacity .14s var(--ease); }
.sqlbox:hover .copy, .sqlbox .copy:focus-visible { opacity: 1; }

/* 모바일 준용 기준: 본문 가독성·손가락 조작·키보드와 화면 가장자리 여백. */
@media screen and (max-width: 767px) {
  body { font-size: 16px; line-height: 1.65; }
  body :is(p, li, label.field > span, .sub, .small, .muted, .notice, .check, .field-help, .section-help, .save-status, .report-save-state, .dlg-sub, .policy ul, .policy h4):not(.sheet *) { font-size: 16px !important; line-height: 1.6; }
  button, .btn, .tabs button, .linky { min-width: 44px; min-height: 44px; font-size: 16px; }
  a:not(.skip):not(.sheet a) { display: inline-flex; align-items: center; min-width: 44px; min-height: 44px; }
  .row, .tabs, header.top nav { gap: 8px; }
  .check, summary { min-height: 44px; }
  summary { padding-block: 8px; }
  table.data, .chip, .session .seq { font-size: 16px; }
  input[type=checkbox] { width: 24px; height: 24px; accent-color: var(--accent); }
  .tabs button { padding-inline: 12px; }
  .toolbar { padding-bottom: max(12px, env(safe-area-inset-bottom)); }
  .toast { left: 16px; right: 16px; bottom: max(16px, env(safe-area-inset-bottom)); max-height: 35dvh; overflow: auto; }
  dialog { max-height: calc(100dvh - 48px); overflow-y: auto; overscroll-behavior: contain; }
  dialog > .body { padding: 20px; }
  .sub, .section-help, .field-help, .dlg-sub { max-width: 40ch; }
  .panel > .body { padding: 16px; }
}
@media screen and (min-width: 48em) and (max-width: 1023px) {
  main, main.wide { max-width: 764px; }
  .grid.c3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.side { grid-template-columns: minmax(0, 1fr); }
}
@media (hover: none) {
  button:hover, .btn:hover { transform: none; }
}

/* 익숙하지 않은 사용자도 조작 위치와 결과를 놓치지 않도록 공통 부품을 맞춘다. */
button, .btn, .linky { min-height: 44px; }
label.field > span { font-size: 15px; }
input:not([type=checkbox]):not([type=radio]), select { min-height: 46px; }
.toast { display: flex; align-items: flex-start; gap: 12px; max-width: min(520px, calc(100vw - 32px)); }
.toast > span { flex: 1; }
.toast button { flex-shrink: 0; }
@media screen {
  html[data-large-text=true] body :is(p, li, label, input, select, textarea, button, a, .sub, .small, .muted, .field-help, .save-status, .section-help, .dlg-sub):not(.sheet *):not(.sheet) { font-size: 18px !important; line-height: 1.65; }
  html[data-large-text=true] body :is(h1, h2, h3):not(.sheet *) { font-size: 24px !important; }
}
@media screen and (max-width: 767px) {
  header.top nav { order: 3; }
  header.top .account-tools { order: 4; }
  html[data-large-text=true] header.top nav { flex-wrap: nowrap; }
  html[data-large-text=true] header.top nav a { flex: 1 1 0; min-width: 0; padding-inline: 4px; }
}

.grid.cards > .panel { margin-top: 0; }
