/* 글꼴: Pretendard (SIL OFL, fonts/LICENSE.txt). 상용 한글 2,350자 서브셋이라 드문 글자는 시스템 글꼴로 보입니다 */
@font-face { font-family: Pretendard; font-weight: 400; font-display: swap; src: url(fonts/Pretendard-Regular.subset.woff2) format("woff2"); }
@font-face { font-family: Pretendard; font-weight: 600; font-display: swap; src: url(fonts/Pretendard-SemiBold.subset.woff2) format("woff2"); }
@font-face { font-family: Pretendard; font-weight: 700; font-display: swap; src: url(fonts/Pretendard-Bold.subset.woff2) format("woff2"); }

:root {
  --bg: #ffffff;
  --bg-soft: #f8f7f6;
  --surface: #ffffff;
  --hover: #f1efed;
  --text: #1f1e1d;
  --muted: #6e6a67;
  --border: #e7e4e1;
  --border-strong: #d6d2ce;
  --primary: #2556d9;
  --primary-hover: #1d46b5;
  --primary-soft: #eef3ff;
  --danger: #c62828;
  --ok: #1b7f4b;
  --warn-bg: #fff7e0;
  --warn-text: #7a5a00;
  --radius: 8px;
  --sidebar-w: 248px;
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg-soft);
  color: var(--text);
  font: 16px/1.6 Pretendard, -apple-system, BlinkMacSystemFont, system-ui, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  word-break: keep-all;
  -webkit-font-smoothing: antialiased;
}

main { margin: 0 auto; padding: 24px 16px 64px; }
main.narrow { max-width: 480px; }
main.wide { max-width: 1120px; }
main.full { max-width: none; }

h1 { font-size: 1.45rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1.35; margin: 0 0 12px; }
h2 { font-size: 1.08rem; font-weight: 600; letter-spacing: -0.01em; margin: 0 0 12px; }
a {
  color: var(--primary);
  text-decoration: underline;
  text-decoration-color: rgba(37, 86, 217, 0.3);
  text-underline-offset: 3px;
}
a:hover { text-decoration-color: currentColor; }
.muted { color: var(--muted); font-size: 0.9rem; }
.pre { white-space: pre-wrap; }
.center { text-align: center; }
.icon { flex: none; vertical-align: -3px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 16px;
}

/* 폼 */
form label { display: block; margin-bottom: 14px; font-weight: 600; font-size: 0.95rem; }
form label .muted { font-weight: 400; }
input:not([type=checkbox]):not([type=radio]), select, textarea {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  font: inherit;
  font-weight: 400;
  color: var(--text);
  background: #fff;
}
input::placeholder, textarea::placeholder { color: #a29d99; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 86, 217, 0.18); }
input[type=checkbox], input[type=radio] { accent-color: var(--primary); }
fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px 2px; margin: 0 0 14px; }
legend { font-weight: 600; font-size: 0.95rem; padding: 0 4px; }

button, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.5;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(31, 30, 29, 0.05);
}
button:hover, .button:hover { background: var(--bg-soft); }
button.primary, .button.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
button.primary:hover, .button.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
main.narrow button.primary { width: 100%; padding: 13px; font-size: 1.05rem; }
button.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
button.danger:hover { background: #a82020; border-color: #a82020; }
button.link { border: 0; background: none; box-shadow: none; padding: 0; color: var(--primary); font-weight: 400; }

.error { color: var(--danger); background: #fdecec; padding: 10px 12px; border-radius: 6px; }
.notice { background: var(--primary-soft); color: #1d3f9e; padding: 12px 14px; border-radius: 6px; font-size: 0.93rem; }
.banner { background: var(--warn-bg); color: var(--warn-text); padding: 10px 14px; border-radius: 6px; font-size: 0.9rem; }

/* 사무실 표시 (첫 글자 마크 + 이름) */
.brand-line { display: inline-flex; align-items: center; gap: 10px; text-align: left; line-height: 1.3; }
.brand-line b { display: block; font-weight: 700; letter-spacing: -0.01em; }
.brand-line small { display: block; color: var(--muted); font-size: 0.82rem; }
.mark {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
}

/* 로그인·첫 화면: 가운데 카드 */
.auth { min-height: calc(100vh - 88px); display: flex; flex-direction: column; justify-content: center; }
.auth-brand { margin-bottom: 20px; text-align: center; }
.auth .card { padding: 32px 28px; box-shadow: 0 1px 3px rgba(31, 30, 29, 0.04), 0 8px 24px rgba(31, 30, 29, 0.05); }
.auth h1 { font-size: 1.6rem; margin-bottom: 6px; }
.auth h1 + .muted { margin: 0 0 22px; }
.auth-foot { margin: 18px 0 0; text-align: center; color: var(--muted); font-size: 0.88rem; }
.button.block { display: flex; width: 100%; padding: 13px; font-size: 1.05rem; }

.checks { list-style: none; padding: 16px 18px; margin: 16px 0 22px; background: var(--bg-soft); border-radius: var(--radius); }
.checks li { display: flex; gap: 10px; align-items: flex-start; margin: 4px 0; font-size: 0.95rem; }
.checks .icon { margin-top: 4px; color: var(--primary); }
.group-label { margin: 22px 0 8px; font-weight: 600; font-size: 0.95rem; }
.group-label .muted { font-weight: 400; font-size: 0.82rem; }

/* 고객 화면 */
.client-header { background: var(--surface); border-bottom: 1px solid var(--border); padding: 12px 16px; }
.client-header > div { max-width: 448px; margin: 0 auto; }
main.narrow .card { border-radius: 12px; padding: 28px 24px; box-shadow: 0 1px 3px rgba(31, 30, 29, 0.04); }
main.narrow .card h1 { font-size: 1.5rem; }

/* 진행 단계: 번호 동그라미를 선으로 잇습니다 */
.steps { display: flex; list-style: none; padding: 0; margin: 4px 0 20px; counter-reset: step; }
.steps li {
  position: relative;
  flex: 1;
  padding-top: 32px;
  text-align: center;
  font-size: 0.78rem;
  color: var(--muted);
  counter-increment: step;
}
.steps li::before {
  content: counter(step);
  position: absolute;
  z-index: 1;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 26px;
  height: 26px;
  border: 2px solid var(--border-strong);
  border-radius: 50%;
  background: var(--bg-soft);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 22px;
}
.steps li + li::after { content: ""; position: absolute; top: 12px; left: -50%; right: 50%; height: 2px; background: var(--border-strong); }
.steps li.done::before { content: "✓"; border-color: var(--primary); background: var(--primary); color: #fff; }
.steps li.active::before { border-color: var(--primary); background: #fff; color: var(--primary); }
.steps li.done::after, .steps li.active::after { background: var(--primary); }
.steps li.active { color: var(--text); font-weight: 700; }

/* 동의 항목: 제목을 누르면 내용이 펼쳐집니다 */
.consent-all {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 8px;
  padding: 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: #fff;
  font-weight: 700;
  cursor: pointer;
}
.consent-all:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.consent-all input { width: 18px; height: 18px; margin: 0; }
.consent { border: 1px solid var(--border-strong); border-radius: var(--radius); padding: 0; margin-bottom: 8px; background: #fff; }
.consent:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.consent summary { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 13px 14px; cursor: pointer; list-style: none; }
.consent summary::-webkit-details-marker { display: none; }
.consent summary::after { content: ""; flex: none; width: 8px; height: 8px; margin-right: 4px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg) translateY(-2px); transition: transform 0.15s; }
.consent[open] summary::after { transform: rotate(-135deg) translateY(-2px); }
.consent summary label { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 0.93rem; }
.consent input[type=checkbox] { width: 18px; height: 18px; margin: 0; }
.consent pre { white-space: pre-wrap; font: inherit; font-size: 0.85rem; color: var(--muted); margin: 0; padding: 0 14px 14px; max-height: 260px; overflow-y: auto; }
.consent + .error, .consent + button { margin-top: 18px; }

.providers { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding-bottom: 12px; }
.providers legend { grid-column: 1 / -1; }
.provider { margin: 0; padding: 12px; border: 1px solid var(--border-strong); border-radius: var(--radius); font-weight: 600; cursor: pointer; }
.provider:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }

.guide { padding-left: 20px; margin: 0 0 14px; }
.guide li { margin-bottom: 4px; }

/* 관리 화면: 왼쪽 메뉴 + 본문 */
body.admin { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; background: var(--bg); }
body.admin main { margin: 0; min-width: 0; padding: 40px 48px 96px; }

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  background: var(--bg-soft);
  border-right: 1px solid var(--border);
}
.sidebar .brand { display: block; padding: 20px 20px 18px; border-bottom: 1px solid var(--border); color: var(--text); text-decoration: none; font-weight: 700; letter-spacing: -0.01em; }
.sidebar .brand small { display: block; color: var(--muted); font-size: 0.82rem; font-weight: 400; }
.side-nav { display: flex; flex-direction: column; gap: 2px; padding: 12px 8px; }
.side-nav a {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 6px;
  color: var(--text);
  text-decoration: none;
}
.side-nav a:hover { background: var(--hover); }
.side-nav a.active { background: var(--hover); font-weight: 600; }
.side-nav a.active::before { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; border-radius: 2px; background: var(--text); }
.side-nav .icon { color: var(--muted); }
.side-nav a.active .icon { color: var(--text); }
.side-foot { margin-top: auto; }
.me { display: flex; align-items: center; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--border); }
.me form { margin: 0; }
.me b { display: block; font-weight: 600; font-size: 0.95rem; line-height: 1.3; }
.me button.link { color: var(--muted); font-size: 0.85rem; }
.avatar {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #1f4f3c;
  color: #fff;
  font-size: 0.8rem;
  font-weight: 600;
}

.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head h1 { font-size: 1.9rem; margin: 0 0 4px; }
.page-head p { margin: 0; color: var(--text); }
.back { display: inline-flex; align-items: center; gap: 4px; margin-bottom: 16px; color: var(--muted); text-decoration: none; font-size: 0.92rem; }
.back:hover { color: var(--text); }

/* 고객 상세: 경로, 제목줄 버튼, 요약 줄, 바깥 제목이 있는 구역 */
.crumbs { margin-bottom: 20px; color: var(--muted); font-size: 0.95rem; }
.crumbs span { margin: 0 6px; }
.detail-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding-bottom: 20px; border-bottom: 1px solid var(--border); }
.detail-head h1 { font-size: 1.9rem; margin: 0; }
.meta { display: flex; flex-wrap: wrap; gap: 12px 0; margin: 20px 0 48px; }
.meta > div { padding: 0 24px; border-left: 1px solid var(--border); }
.meta > div:first-child { padding-left: 0; border-left: 0; }
.meta span { display: block; color: var(--muted); font-size: 0.9rem; }
.section { margin-bottom: 40px; }
.section-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.section-head h2 { font-size: 1.3rem; margin: 0 0 4px; }
.section-head p { margin: 0; }
.section-head form { margin: 0; }
.section .card { margin-bottom: 0; }
.section .card > :last-child { margin-bottom: 0; }
.memo textarea { margin: 0 0 10px; resize: vertical; }
.fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px 32px; }
.fields > div { min-width: 0; overflow-wrap: anywhere; }
.fields span { display: block; color: var(--muted); font-size: 0.88rem; }
.fields .span2 { grid-column: span 2; }
.fields .wide { grid-column: 1 / -1; }

/* 버튼을 누르면 아래로 펼쳐지는 창 */
.menu { position: relative; }
.menu > summary { list-style: none; }
.menu > summary::-webkit-details-marker { display: none; }
.menu[open] > summary { background: var(--hover); }
.menu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 5;
  width: min(400px, calc(100vw - 32px));
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(31, 30, 29, 0.12);
}
.menu-panel h3 { font-size: 1rem; margin: 0 0 6px; }
.menu-panel p { margin: 0 0 10px; }

/* 고객 상세 제목 옆 상태 배지: 누르면 진행 상태 메뉴 */
.title-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.status-menu > summary.badge { display: inline-flex; align-items: center; gap: 2px; padding: 3px 6px 3px 10px; font-size: 0.88rem; cursor: pointer; }
.status-menu > summary.badge:hover, .status-menu[open] > summary.badge { filter: brightness(0.95); box-shadow: 0 0 0 2px var(--border-strong); }
.status-menu > summary.badge:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(37, 86, 217, 0.35); }
.status-menu .menu-panel { left: 0; right: auto; width: 220px; padding: 8px; }
.status-menu form { margin: 0; }
.status-menu button.next { width: 100%; margin-bottom: 8px; }
.status-menu ul { list-style: none; margin: 0; padding: 0; }
.status-menu .option, .status-menu .current { display: flex; align-items: center; gap: 6px; width: 100%; padding: 6px 8px 6px 30px; border-radius: 6px; font-size: 0.92rem; }
.status-menu .option { justify-content: flex-start; border: 0; background: none; box-shadow: none; font-weight: 400; }
.status-menu .option:hover { background: var(--hover); }
.status-menu .current { padding-left: 8px; font-weight: 600; color: var(--primary); }

.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar h1, .toolbar h2 { margin: 0; }
body.admin .toolbar h1 { font-size: 1.9rem; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row form { margin: 0; }
.row select { width: auto; margin: 0; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.grid .card { margin-bottom: 0; }
.grid + .card { margin-top: 16px; }
.form-card { max-width: 520px; }

/* 고객 목록 첫 줄: 검색창에 붙은 → 버튼, 검색 결과 칩, 오른쪽 끝 고객 추가 (검색창과 버튼은 같은 높이) */
.filters { display: flex; gap: 8px 12px; flex-wrap: wrap; margin-bottom: 12px; }
.filters > .button { flex: none; margin-left: auto; }
.search { position: relative; display: flex; flex: 0 1 400px; min-width: 240px; margin: 0; }
.search > .icon { position: absolute; z-index: 2; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search input[name=q] { flex: 1; min-width: 0; margin: 0; padding-left: 38px; border-radius: 6px 0 0 6px; }
.search button { flex: none; margin-left: -1px; padding: 0 12px; border-radius: 0 6px 6px 0; box-shadow: none; }
.search input[name=q]:focus { position: relative; z-index: 1; }
.search button:disabled { color: #c4bfbb; background: #fff; cursor: default; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 16px; }
.tabs a { padding: 6px 12px; border: 1px solid transparent; border-radius: 6px; text-decoration: none; color: var(--muted); font-size: 0.9rem; }
.tabs a:hover { background: var(--hover); color: var(--text); }
.tabs a b { margin-left: 2px; font-weight: 600; }
.tabs a.active { background: #fff; border-color: var(--border-strong); color: var(--text); font-weight: 600; box-shadow: 0 1px 2px rgba(31, 30, 29, 0.05); }
.count { display: inline-flex; flex: none; align-self: center; align-items: center; gap: 4px; padding: 2px 6px 2px 10px; border-radius: 999px; background: var(--hover); font-size: 0.85rem; }
.count a { display: inline-flex; padding: 2px; border-radius: 50%; color: var(--muted); }
.count a:hover { background: var(--border); color: var(--text); }

/* 표: 바깥 테두리 없이 줄만 긋습니다 */
.table-wrap { overflow-x: auto; }
/* 숫자 폭을 같게 해서 날짜·번호·금액이 줄마다 반듯하게 맞습니다 (Pretendard tnum) */
table, .meta, .fields { font-variant-numeric: tabular-nums; }
table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
th, td { padding: 12px; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap; vertical-align: top; }
th { color: var(--muted); font-size: 0.8rem; font-weight: 600; letter-spacing: 0.04em; vertical-align: bottom; }
th:first-child, td:first-child { padding-left: 2px; }
.card th:first-child, .card td:first-child { padding-left: 0; }
td .title { color: var(--text); font-weight: 600; text-decoration: none; }
td .title:hover { text-decoration: underline; }
td .sub { display: block; color: var(--muted); }
/* 고객 목록 수집 자료 칸: 서류마다 동그란 한 글자 칩, 마우스를 올리면 바로 뜨는 말풍선 */
.kinds { display: inline-flex; gap: 4px; }
.kind { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border: 1px solid transparent; border-radius: 999px; font-size: 0.75rem; font-weight: 700; cursor: help; }
.kind.is-found.earned_income_statement { background: #dcefee; color: #00695c; }
.kind.is-found.income_tax_return { background: #fbe4ee; color: #a3195b; }
.kind.is-found.sme_tax_reduction { background: #fff0d9; color: #955800; }
.kind.is-found.insurance_history { background: #e6e9f7; color: #3949ab; }
.kind.is-empty { border-color: #d6d2ce; color: #a29d99; }
.kind.is-skipped { border-color: #d6d2ce; border-style: dashed; color: #a29d99; }
.kind.is-failed { background: #fde8e8; border-color: var(--danger); color: var(--danger); }
.kind.is-none { color: #d6d2ce; }
.kind[data-tip]:hover::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  z-index: 10;
  transform: translateX(-50%);
  padding: 4px 8px;
  border-radius: 6px;
  background: #1f1e1d;
  color: #fff;
  font-size: 0.8rem;
  font-weight: 500;
  white-space: nowrap;
  pointer-events: none;
}
table.num td:nth-child(n+5), table.num th:nth-child(n+5) { text-align: right; }
td.refund { color: var(--ok); font-weight: 700; }
.doc-links { display: flex; gap: 20px; flex-wrap: wrap; margin: 12px 0 0; font-size: 0.9rem; }
/* 원본·PDF 칸: 표가 넓어 가로로 넘겨도 오른쪽에 붙어 있게 */
th.links, td.links { position: sticky; right: 0; background: var(--surface); box-shadow: -8px 0 8px -8px rgba(31, 30, 29, 0.12); }
td.year-note { color: var(--muted); }
.raw-list { margin-top: 22px; }
.raw-list h3 { font-size: 1rem; margin: 0 0 8px; }
.raw-card { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 10px; }
dl.raw dd { word-break: break-all; }
td.year-note.failed, .year-note.failed { color: var(--danger); }
.empty { color: var(--muted); padding: 24px; text-align: center; }

.badge { display: inline-block; padding: 1px 6px; border-radius: 4px; font-size: 0.78rem; font-weight: 600; line-height: 1.6; background: #eeecea; color: var(--muted); vertical-align: middle; letter-spacing: 0; }
/* 회사 이름으로 짐작한 업종: 위첨자 점, 마우스를 올리면 분류 이름 */
.hint-dot { display: inline-block; width: 7px; height: 7px; margin-left: 3px; border-radius: 50%; vertical-align: super; background: #a29d99; cursor: help; }
.hint-dot.tax { background: #e08a00; }
.hint-dot.law { background: #7c4dcc; }
.hint-dot.medical { background: #d93025; }
/* 사업자번호: 누르면 머니핀 업종 보기. 표가 넓어 따로 링크 칸을 두지 않고 점선 밑줄만 */
a.bizno { color: inherit; text-decoration: underline dotted #b5b0ab; text-decoration-thickness: 1px; text-underline-offset: 4px; }
a.bizno:hover { color: var(--primary); text-decoration-color: currentColor; }
a.pdf-link { display: inline-flex; align-items: center; gap: 2px; color: #b42318; font-size: 0.82rem; font-weight: 600; text-decoration: none; }
a.pdf-link:hover { text-decoration: underline; }
.pdf-link.off { display: inline-flex; align-items: center; gap: 2px; color: #c4bfbb; font-size: 0.82rem; font-weight: 600; cursor: help; }
.status-in_progress { background: #fff4d6; color: #8a6100; }
.status-collected { background: #e2ecff; color: #1f47b8; }
.status-reviewing { background: #efe5ff; color: #5b2bb5; }
.status-filed { background: #dff3ea; color: var(--ok); }
.status-refunded { background: var(--ok); color: #fff; }

dl.info { display: grid; grid-template-columns: max-content 1fr; gap: 6px 20px; margin: 0 0 14px; }
dt { color: var(--muted); }
dd { margin: 0; }

textarea#sms { font-size: 0.9rem; margin-bottom: 10px; resize: vertical; }

/* 대시보드: 벤토 타일
   넓은 화면: 윗줄 검토 · 완료 · 진행(3등분), 아랫줄 오늘 · 최근(반반). 6칸 격자로 나눕니다 */
.bento {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  grid-template-areas:
    "review review done done progress progress"
    "today today today recent recent recent";
  gap: 16px;
}
.done-tile { grid-area: done; }
.progress-tile { grid-area: progress; }
.today-tile { grid-area: today; }
.review { grid-area: review; }
.recent-tile { grid-area: recent; }
.tile { min-width: 0; padding: 22px 24px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; }
.tile h2 { margin: 0 0 12px; font-size: 1.05rem; }
.tile-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.tile-head a { display: inline-flex; align-items: center; color: var(--muted); font-size: 0.88rem; text-decoration: none; }
.tile-head a:hover { color: var(--text); }
.tile .note { margin: 0 0 12px; color: var(--muted); font-size: 0.88rem; }
.tile .none { color: var(--muted); }
.big { margin: 2px 0 8px; font-size: 3.2rem; font-weight: 700; line-height: 1; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.big small { margin-left: 6px; font-size: 1rem; font-weight: 600; letter-spacing: 0; }

/* 검토: 가장 먼저 할 일이라 맑은 파랑 바탕에 흰 글씨 */
.tile.review { background: linear-gradient(150deg, #3d74ff 0%, #2556d9 100%); border: 0; color: #fff; }
.review .big { margin-bottom: 14px; color: #fff; }
.review .tile-head a { color: rgba(255, 255, 255, 0.85); }
.review .tile-head a:hover { color: #fff; }
.review .people li { border-color: rgba(255, 255, 255, 0.22); }
.review .people a { color: #fff; }
.review .people span:last-child, .review .none { color: rgba(255, 255, 255, 0.8); }

/* 완료·오늘의 숫자 목록: 이름 왼쪽, 숫자 오른쪽 */
.counts { list-style: none; margin: 0; padding: 0; }
.counts li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 0; border-top: 1px solid var(--border); }
.counts li:first-child { border-top: 0; }
.counts span { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 0.92rem; }
.counts b { font-size: 2rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.counts li.zero b { color: var(--border-strong); }
.counts.small li { padding: 6px 0; }
.counts.small li:first-child { border-top: 1px solid var(--border); padding-top: 6px; }
.counts.small b { font-size: 1.1rem; }
.dot { flex: none; width: 8px; height: 8px; border-radius: 50%; }
.fill-collected { background: var(--primary); }
.fill-filed { background: #2e9e63; }
.fill-refunded { background: #0f5c37; }

/* 진행 중 */
.stalled { list-style: none; margin: 0; padding: 0; }
.stalled li { display: grid; grid-template-columns: 2.2em 1fr; column-gap: 8px; padding: 8px 0; border-top: 1px solid var(--border); }
.stalled li:first-child { border-top: 0; }
.stalled b { grid-row: span 2; align-self: center; font-size: 1.6rem; line-height: 1.2; color: #c25e00; font-variant-numeric: tabular-nums; }
.stalled li.zero b { color: var(--border-strong); }
.stalled small { color: var(--muted); }
.stalled small a { color: inherit; }

/* 오늘 */
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.stats div { padding: 10px 12px; border-radius: 10px; background: var(--bg-soft); }
.stats b { display: block; font-size: 1.8rem; line-height: 1.2; font-variant-numeric: tabular-nums; }
.stats span { color: var(--muted); font-size: 0.85rem; }
.usage { margin-top: 14px; }
.usage > div { display: flex; justify-content: space-between; gap: 8px; font-size: 0.88rem; }
.usage > div span { color: var(--muted); }
.usage progress { display: block; width: 100%; height: 8px; margin: 6px 0 8px; border: 0; border-radius: 99px; background: var(--hover); overflow: hidden; appearance: none; }
.usage progress::-webkit-progress-bar { background: var(--hover); }
.usage progress::-webkit-progress-value { background: var(--primary); border-radius: 99px; }
.usage progress::-moz-progress-bar { background: var(--primary); border-radius: 99px; }
.usage progress.warn::-webkit-progress-value { background: var(--danger); }
.usage progress.warn::-moz-progress-bar { background: var(--danger); }
.usage .note { margin: 0; }

/* 고객 목록 (검토, 최근) */
.people { list-style: none; margin: 0; padding: 0; }
.people li { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 9px 0; border-top: 1px solid var(--border); }
.people a { color: var(--text); font-weight: 600; text-decoration: none; }
.people a:hover { text-decoration: underline; }
.people span:last-child { margin-left: auto; color: var(--muted); font-size: 0.88rem; white-space: nowrap; }

/* 같은 줄 칸들의 높이 맞추기: 목록 줄들이 남는 높이를 고르게 나눠 가져 위아래 여백이 늘어납니다 */
.bento .tile { display: flex; flex-direction: column; }
.bento .counts, .bento .stalled, .bento .people { flex: 1; display: flex; flex-direction: column; }
.bento .counts li, .bento .stalled li, .bento .people li { flex: 1; }
.bento .stalled li { align-content: center; }

@media (max-width: 1100px) {
  .bento {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-areas: "review review" "done progress" "today recent";
  }
}

@media (max-width: 600px) {
  .bento { grid-template-columns: 1fr; grid-template-areas: "review" "done" "progress" "today" "recent"; }
}

/* 의견 */
/* 오른쪽 의견 창: 열면 화면을 왼쪽으로 밀어서 보던 내용을 가리지 않습니다 */
:root { --feedback-w: 380px; }
.feedback-box summary {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 11;
  list-style: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}
.feedback-box summary::-webkit-details-marker { display: none; }
.feedback-box summary b { margin-left: 2px; color: var(--primary); }
.feedback-box .when-open, .feedback-box[open] .when-closed { display: none; }
.feedback-box[open] .when-open { display: inline; }
.feedback-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  width: var(--feedback-w);
  overflow-y: auto;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: -4px 0 16px rgba(0, 0, 0, 0.08);
  padding: 16px 16px 80px;
}
body:has(.feedback-box[open]) { margin-right: var(--feedback-w); }
.feedback-note { border-top: 1px solid var(--border); padding: 12px 0; font-size: 0.92rem; }
.feedback-status { display: inline-block; margin: 0; }
.feedback-status select { width: auto; margin: 0; padding: 3px 8px; border: 0; border-radius: 4px; font-size: 0.82rem; font-weight: 600; }
.feedback-list { max-width: 820px; }
.feedback-item header { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.reply { border-left: 3px solid var(--primary); padding-left: 12px; margin: 8px 0 0; }
.feedback-item details { margin-top: 12px; }
.feedback-item details summary { cursor: pointer; color: var(--primary); font-size: 0.9rem; }
.feedback-item details form { margin-top: 10px; }
.feedback-new { background: #fff4d6; color: #8a6100; }
.feedback-doing { background: #e2ecff; color: #1f47b8; }
.feedback-done { background: #dff3ea; color: var(--ok); }

@media (max-width: 900px) {
  /* 좁은 화면에서는 밀지 않고 위에 덮습니다 */
  body:has(.feedback-box[open]) { margin-right: 0; }
  .feedback-panel { width: 100%; }

  /* 왼쪽 메뉴를 위쪽 가로 줄로 바꿉니다 */
  body.admin { display: block; }
  body.admin main { padding: 24px 16px 96px; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; border-right: 0; border-bottom: 1px solid var(--border); }
  .sidebar .brand { border-bottom: 0; padding: 12px 16px; }
  /* 첫 줄: 이름과 계정, 둘째 줄: 메뉴 (::after가 줄을 바꿈) */
  .sidebar::after { content: ""; order: 3; flex-basis: 100%; }
  .side-nav { flex-direction: row; flex-wrap: wrap; padding: 0 8px 8px; order: 4; }
  .side-foot { order: 5; margin-top: 0; padding-left: 0; }
  .side-nav:not(.side-foot) { padding-right: 0; }
  .side-nav a.active::before { display: none; }
  .me { order: 2; margin: 0 0 0 auto; border-top: 0; padding: 12px 16px; }
  .page-head h1, .detail-head h1 { font-size: 1.5rem; }
  .fields { grid-template-columns: 1fr 1fr; }
  .menu-panel { right: auto; left: 0; }
}

@media (max-width: 600px) {
  .card { padding: 18px; }
  .fields { grid-template-columns: 1fr; }
  .fields .span2 { grid-column: auto; }
  .meta { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
  .meta > div { padding: 0; border-left: 0; }
}
