/* ==========================================================================
   common.css — 인가자 관리 시스템(ADMS) 유일한 스타일시트
   기준: design.md (토큰 이름·값 1:1). 색은 아래 :root 변수로만 사용 (HEX 직접 기입 금지)
   브레이크포인트 (design.md 10장 4구간 — 이 외 추가 금지)
     기준      1280px 이상
     --bp-lg   1024–1279px  패널이 표 위에 겹침
     --bp-md    768–1023px  서랍 메뉴, 패널 80%
     --bp-sm    767px 이하  상단 바, 패널·모달 전체 화면
   ========================================================================== */

/* ── 1. 토큰 (design.md 2·3·4장) ── */
:root {
  /* 브랜드 */
  --navy: #16243D;
  --navy-2: #23365C;
  --navy-text: #C9D3E6;
  --navy-sub: #8E9BB5;
  --navy-line: #2E4167;
  --navy-mileage: #7FD8CB;
  --primary: #2E5BD8;
  --primary-hover: #234BBA;
  --primary-weak: #EAF0FD;
  --mileage: #0F7F74;
  --mileage-weak: #E2F3F0;
  /* 바탕·글자 (쿨 그레이) */
  --bg: #F4F6FA;
  --surface: #FFFFFF;
  --surface-2: #F8F9FC;
  --surface-hover: #F6F8FD;
  --surface-soft: #FBFCFE;
  --line: #E1E6EF;
  --line-strong: #CBD3E1;
  --text: #1A2333;
  --text-2: #4A5568;
  --muted: #7A8599;
  /* 상태 */
  --success: #1F8A5B;  --success-weak: #E4F4EB;
  --warning: #A86500;  --warning-weak: #FFF2D9;
  --danger:  #CF3A3A;  --danger-weak:  #FDECEC;
  --neutral: #697186;  --neutral-weak: #EDEFF3;
  /* 기타 */
  --toast-ok: #5ED39C;
  --focus-ring: rgba(46, 91, 216, 0.35);
  --overlay: rgba(13, 22, 40, 0.48);
  /* 간격 · 모서리 · 그림자 */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 24px; --sp-6: 32px;
  --radius: 8px;
  --radius-sm: 6px;
  --radius-lg: 12px;
  --shadow-float: 0 12px 28px -12px rgba(10, 20, 40, 0.45);
  --shadow-panel: -8px 0 24px -16px rgba(10, 20, 40, 0.3);
  /* 글꼴 */
  --font: "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  color-scheme: light;
}

/* ── 2. 글꼴 (assets/fonts 자체 호스팅, 굵기 400·600·700만) ── */
@font-face { font-family: "Pretendard"; font-weight: 400; font-style: normal; font-display: swap; src: url("../fonts/Pretendard-Regular.woff2") format("woff2"); }
@font-face { font-family: "Pretendard"; font-weight: 600; font-style: normal; font-display: swap; src: url("../fonts/Pretendard-SemiBold.woff2") format("woff2"); }
@font-face { font-family: "Pretendard"; font-weight: 700; font-style: normal; font-display: swap; src: url("../fonts/Pretendard-Bold.woff2") format("woff2"); }

/* ── 3. 기본 ── */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 14px; line-height: 1.5; }
h1, h2, h3, h4, h5, p { margin: 0; }
a { color: var(--primary); }
img { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 2px; }
.num { font-variant-numeric: tabular-nums; }
.mut { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ── 4. 레이아웃 (design.md 5장) ── */
.app-shell { display: grid; grid-template-columns: 200px minmax(0, 1fr); min-height: 100vh; }
.content { min-width: 0; display: flex; flex-direction: column; }
.main { padding: var(--sp-5); display: grid; gap: var(--sp-4); align-content: start; min-width: 0; }

/* GNB */
.gnb { background: var(--navy); color: var(--navy-text); padding: var(--sp-5) var(--sp-3); display: flex; flex-direction: column; gap: var(--sp-1); position: sticky; top: 0; height: 100vh; overflow-y: auto; }
/* 창 높이가 낮으면 항목을 줄이지 않고 GNB가 스크롤 (flex 기본 shrink로 로고가 눌리던 문제) */
.gnb > * { flex-shrink: 0; }
.gnb .logo { padding: 0 10px var(--sp-4); display: grid; gap: 2px; text-decoration: none; min-height: 0; }
.gnb .logo:hover { background: transparent; }
.logo b { color: var(--surface); font-size: 18px; font-weight: 700; letter-spacing: 0.04em; line-height: 1.2; }
.logo small { font-size: 11px; color: var(--navy-text); }
.wallet { margin: 0 var(--sp-1) var(--sp-4); padding: var(--sp-3); border-radius: var(--radius); background: var(--navy-2); display: grid; gap: var(--sp-1); font-size: 12px; }
.wallet .co { color: var(--surface); font-weight: 600; font-size: 12px; padding-bottom: var(--sp-1); border-bottom: 1px solid var(--navy-line); margin-bottom: 2px; overflow-wrap: anywhere; }
.wallet div { display: flex; justify-content: space-between; gap: var(--sp-2); }
.wallet b { color: var(--surface); font-weight: 600; font-variant-numeric: tabular-nums; }
.wallet .m b { color: var(--navy-mileage); }
.gnb a { color: inherit; text-decoration: none; padding: 9px var(--sp-3); border-radius: var(--radius-sm); font-size: 14px; display: flex; align-items: center; gap: 10px; min-height: 38px; }
.gnb a:hover { background: var(--navy-2); color: var(--surface); }
.gnb a.on { background: var(--primary); color: var(--surface); font-weight: 600; }
/* 로그아웃은 POST 폼 버튼 — 메뉴 링크와 같은 모양 */
.gnb-logout { margin: 0; }
.gnb-logout button { width: 100%; background: transparent; border: 0; color: inherit; cursor: pointer; text-align: left; padding: 9px var(--sp-3); border-radius: var(--radius-sm); font-size: 14px; min-height: 38px; }
.gnb-logout button:hover { background: var(--navy-2); color: var(--surface); }
.gnb a:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 1px; }
.gnb .sep { font-size: 11px; letter-spacing: 0.08em; padding: var(--sp-4) var(--sp-3) 6px; color: var(--navy-sub); display: flex; align-items: center; gap: var(--sp-2); }
.gnb .sep::after { content: ""; flex: 1; height: 1px; background: var(--navy-line); }
.badge-n { margin-left: auto; background: var(--warning); color: var(--surface); font-size: 11px; font-weight: 600; padding: 0 7px; border-radius: 10px; line-height: 18px; font-variant-numeric: tabular-nums; }

/* 상단 바 (태블릿·휴대폰) · 서랍 배경 */
.topbar { display: none; background: var(--navy); color: var(--surface); padding: 10px var(--sp-4); align-items: center; gap: var(--sp-3); }
.topbar b { font-size: 16px; letter-spacing: 0.04em; }
.topbar .tb-wallet { margin-left: auto; font-size: 12px; color: var(--navy-text); font-variant-numeric: tabular-nums; display: none; }
.topbar .tb-wallet em { font-style: normal; color: var(--surface); font-weight: 600; }
.topbar .tb-wallet .mi { color: var(--navy-mileage); font-weight: 600; }
.hamb { background: transparent; border: 1px solid var(--navy-line); color: var(--surface); width: 38px; height: 38px; border-radius: var(--radius-sm); cursor: pointer; font-size: 18px; line-height: 1; }
.scrim { position: fixed; inset: 0; background: var(--overlay); z-index: 30; }

/* 페이지 헤더 */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: var(--sp-3); flex-wrap: wrap; }
.page-head h1 { font-size: 20px; font-weight: 700; letter-spacing: -0.01em; line-height: 1.3; }
.page-head p { color: var(--muted); font-size: 13px; }
.stats { display: flex; gap: var(--sp-2); flex-wrap: wrap; align-items: stretch; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--sp-2) 14px; display: grid; min-width: 112px; }
.stat small { font-size: 12px; color: var(--muted); }
.stat b { font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat.m b { color: var(--mileage); }

/* 로그인 · 회원가입 (비로그인) */
.login-stage { min-height: 100vh; background: var(--bg); padding: 48px var(--sp-4); display: grid; place-items: center; }
.login-box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); width: min(400px, 100%); padding: var(--sp-6) 28px; display: grid; gap: var(--sp-4); }
.login-box.join-box { width: min(560px, 100%); }
.login-head { text-align: center; display: grid; gap: 2px; margin-bottom: var(--sp-2); }
.login-head small:first-child { font-size: 12px; font-weight: 600; color: var(--primary); letter-spacing: 0.08em; }
.login-head b { font-size: 22px; font-weight: 700; color: var(--text); }
.login-head small:last-child { font-size: 12px; color: var(--muted); }
.join-title { font-size: 20px; font-weight: 700; text-align: center; }
.login-box > .btn { width: 100%; }
.login-foot { text-align: center; font-size: 13px; color: var(--muted); display: grid; gap: 6px; }
.login-foot a { color: var(--primary); font-weight: 600; text-decoration: none; }
.privacy-box { background: var(--bg); height: 160px; overflow-y: auto; padding: var(--sp-3); border-radius: var(--radius-sm); font-size: 13px; color: var(--text-2); display: grid; gap: var(--sp-2); align-content: start; }
.privacy-box b { color: var(--text); font-weight: 600; }

/* 내정보: 기본 정보 + 비밀번호 변경 2단 (1024px 미만은 세로) */
.myinfo-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: var(--sp-4); align-items: start; }

/* ── 5. 버튼 (design.md 6장) ── */
.btn { font-size: 14px; font-weight: 600; border-radius: var(--radius-sm); padding: 0 var(--sp-4); height: 38px; border: 1px solid transparent; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap; text-decoration: none; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: var(--surface); }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }
.btn-line { background: var(--surface); color: var(--text); border-color: var(--line-strong); }
.btn-line:hover:not(:disabled) { background: var(--bg); }
.btn-danger { background: var(--danger); color: var(--surface); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover:not(:disabled) { background: var(--bg); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 13px; }

/* ── 6. 입력창 ── */
.input { font-size: 14px; height: 38px; padding: 0 var(--sp-3); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); min-width: 0; width: 100%; }
.input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-weak); }
.input.err { border-color: var(--danger); }
.input.err:focus { box-shadow: 0 0 0 3px var(--danger-weak); }
.input:disabled { background: var(--bg); color: var(--muted); }
textarea.input { height: auto; min-height: 96px; padding: 10px var(--sp-3); line-height: 1.6; resize: vertical; }
select.input { padding-right: var(--sp-6); }
input[type="file"].input { height: auto; min-height: 38px; padding: 6px var(--sp-3); }
.field { display: grid; gap: var(--sp-1); align-content: start; }
.field label, .field .label { font-size: 12px; font-weight: 600; color: var(--text-2); }
.field .req { color: var(--danger); margin-left: 2px; }
.field .msg { font-size: 12px; color: var(--danger); }
.field .hint { font-size: 12px; color: var(--muted); }
.field-row { display: flex; gap: var(--sp-2); }
.field-row > .input { flex: 1; }
.ro { min-height: 38px; display: flex; align-items: center; padding: 0 var(--sp-3); background: var(--bg); border-radius: var(--radius-sm); color: var(--text-2); }
.amount-in { position: relative; }
.amount-in .input { text-align: right; padding-right: 34px; font-variant-numeric: tabular-nums; }
.amount-in span { position: absolute; right: var(--sp-3); top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 14px; pointer-events: none; }
.check { display: flex; align-items: center; gap: var(--sp-2); font-size: 14px; cursor: pointer; min-height: 38px; }
.check input { width: 18px; height: 18px; margin: 0; accent-color: var(--primary); }
.form-grid { display: grid; gap: var(--sp-3); }
.form-grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid .full { grid-column: 1 / -1; }

/* 툴바 · 상세검색 */
.toolbar { display: flex; gap: var(--sp-2); flex-wrap: wrap; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--sp-3); }
.toolbar .input { flex: 1 1 220px; width: auto; }
.toolbar .input-auto { flex: 0 1 200px; }
.toolbar .check-inline { white-space: nowrap; font-size: 13px; color: var(--text-2); }
.adv-search { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--sp-4); display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: var(--sp-3); }
.adv-search .adv-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: var(--sp-2); }

/* ── 7. 표 ── */
.list-area { position: relative; min-width: 0; }
.body2 { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--sp-4); align-items: start; position: relative; }
.body2.panel-open { grid-template-columns: minmax(0, 1fr) 360px; }
.tbl-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; min-width: 0; }
.tbl-scroll { overflow-x: auto; }
.loading-bar { height: 3px; background: var(--primary-weak); position: relative; overflow: hidden; }
.loading-bar::after { content: ""; position: absolute; inset: 0 auto 0 0; width: 35%; background: var(--primary); }
.loading-msg { font-size: 12px; color: var(--muted); padding: 6px var(--sp-3); border-bottom: 1px solid var(--line); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; font-weight: 600; color: var(--text-2); background: var(--surface-2); padding: 10px var(--sp-3); border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 11px var(--sp-3); border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr.row { cursor: pointer; }
.tbl tbody tr.row:hover td { background: var(--surface-hover); }
.tbl tbody tr.row.sel td { background: var(--primary-weak); }
.tbl .r { text-align: right; font-variant-numeric: tabular-nums; }
.tbl .c { text-align: center; }
.tbl .num { font-variant-numeric: tabular-nums; }
.is-loading tbody { opacity: 0.5; }
.empty { padding: 48px var(--sp-4); text-align: center; display: grid; gap: var(--sp-3); justify-items: center; color: var(--muted); }
.empty b { color: var(--text-2); font-size: 15px; }
.pager { display: flex; justify-content: center; gap: var(--sp-1); padding: var(--sp-3); border-top: 1px solid var(--line); flex-wrap: wrap; }
.pager a, .pager span { min-width: 30px; height: 30px; padding: 0 var(--sp-1); display: inline-grid; place-items: center; border-radius: var(--radius-sm); font-size: 13px; color: var(--text-2); text-decoration: none; font-variant-numeric: tabular-nums; }
.pager a:hover { background: var(--bg); }
.pager .on { background: var(--navy); color: var(--surface); font-weight: 600; }

/* 금액 증감 (design.md 8장) */
.amt-plus { color: var(--primary); font-weight: 600; font-variant-numeric: tabular-nums; }
.amt-minus { color: var(--danger); font-weight: 600; font-variant-numeric: tabular-nums; }
.amt-zero { color: var(--muted); font-variant-numeric: tabular-nums; }
.amt-mileage { color: var(--mileage); font-variant-numeric: tabular-nums; }

/* ── 8. 상태 배지 (design.md 6·7장) ── */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; padding: 2px 9px 2px 8px; border-radius: 20px; line-height: 18px; white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.b-success { color: var(--success); background: var(--success-weak); }
.b-warning { color: var(--warning); background: var(--warning-weak); }
.b-danger  { color: var(--danger);  background: var(--danger-weak); }
.b-neutral { color: var(--neutral); background: var(--neutral-weak); }
.b-info    { color: var(--primary); background: var(--primary-weak); }

/* ── 9. 슬라이드 패널 ── */
.slide { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-panel); display: grid; grid-template-rows: auto minmax(0, 1fr) auto; position: sticky; top: var(--sp-4); max-height: calc(100vh - var(--sp-6)); }
.slide-h { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-2); padding: 14px var(--sp-4); border-bottom: 1px solid var(--line); }
.slide-h h2, .slide-h b { font-size: 16px; font-weight: 600; }
/* grid-auto-rows: max-content — 높이가 정해진 스크롤 영역 안에서 overflow 요소(탭 줄·표)가 0에 가깝게 눌리지 않게 */
.slide-b { padding: var(--sp-4); display: grid; gap: var(--sp-3); align-content: start; grid-auto-rows: max-content; overflow-y: auto; }
.slide-f { display: flex; gap: var(--sp-2); justify-content: flex-end; padding: var(--sp-3) var(--sp-4); border-top: 1px solid var(--line); }
/* 비용 안내 박스 · 모달 금액 요약 */
.cost { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px var(--sp-3); display: grid; gap: var(--sp-1); font-size: 13px; background: var(--surface-soft); }
.cost div { display: flex; justify-content: space-between; gap: var(--sp-2); }
.cost b { font-variant-numeric: tabular-nums; }
.cost .mi b { color: var(--mileage); }
.cost .cost-warn { color: var(--danger); font-weight: 600; }
/* 패널 안 읽기 전용 정보 · 문자발송 내역 */
.info-list { display: grid; gap: var(--sp-1); font-size: 13px; color: var(--text-2); border-top: 1px solid var(--line); padding-top: var(--sp-3); }
.info-list div { display: flex; justify-content: space-between; gap: var(--sp-2); }
.info-list b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.sms-history { display: grid; gap: var(--sp-2); font-size: 13px; }
.sms-item { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: var(--sp-2) var(--sp-3); display: grid; gap: 2px; }
.sms-item p { color: var(--text-2); overflow-wrap: anywhere; }
.slide-f .btn-delete { margin-right: auto; color: var(--danger); }
/* 문자 내역: 목록 내용 한 줄, 패널 전체 문구(줄바꿈 유지), 인가자 조건 칩 */
.tbl .sms-preview { max-width: 320px; overflow: hidden; text-overflow: ellipsis; color: var(--text-2); }
.sms-full { white-space: pre-wrap; overflow-wrap: anywhere; background: var(--surface-soft); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: var(--sp-3); font-size: 14px; line-height: 1.6; }
/* 메인 대시보드: 요약 카드(링크 카드·경고 카드), 구역 */
.dash-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: var(--sp-3); }
.dash-cards .stat { min-width: 0; gap: 2px; }
.stat-link { color: inherit; text-decoration: none; }
.stat-link:hover { border-color: var(--line-strong); background: var(--surface-hover); }
.stat.stat-warn { background: var(--warning-weak); border-color: var(--warning-weak); }
.stat.stat-warn b, .stat.stat-warn .stat-sub { color: var(--warning); }
.dash-section { display: grid; gap: var(--sp-2); align-content: start; min-width: 0; }
.dash-section h2 .mut { font-size: 13px; font-weight: 400; }
/* 구역 제목 줄 높이를 같게 → 왼쪽 표와 오른쪽 카드의 윗선이 맞음 */
.dash-section > .report-section-head { min-height: 30px; }
.dash-section > .report-section-head h2 { font-size: 16px; font-weight: 600; }
/* 누를 수 있는 카드만 오른쪽 위 › 표시 */
.stat-link { position: relative; padding-right: var(--sp-6); }
.stat-link::after { content: "›"; position: absolute; top: var(--sp-2); right: var(--sp-3); font-size: 18px; line-height: 1; color: var(--muted); }
/* 핵심 숫자 카드 (회원: 등록 가능 건수) — 두 칸 폭, 큰 숫자 */
.dash-cards .stat-hero { grid-column: span 2; border-color: var(--primary); }
.stat-hero b { font-size: 24px; }
.stat.stat-muted { background: var(--surface-2); }
.stat.stat-muted b, .stat.stat-muted small { color: var(--muted); }
.info-box.quiet { color: var(--muted); padding: var(--sp-3) var(--sp-4); }
/* 넓은 화면: 주 목록 + 오른쪽 좁은 칸 (1280px 미만은 세로로) */
.dash-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: var(--sp-4); align-items: start; }
.dash-side { display: grid; gap: var(--sp-4); align-content: start; min-width: 0; }
.side-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--sp-4); display: grid; gap: var(--sp-2); }
.side-card h2 { font-size: 15px; font-weight: 600; }
.side-card.side-warn { border-color: var(--warning); }
.side-list { list-style: none; margin: 0; padding: 0; display: grid; }
.side-list li { border-top: 1px solid var(--line); }
.side-list li:first-child { border-top: 0; }
.side-list a { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-2); padding: 10px 0; color: var(--text); text-decoration: none; }
.side-list a:hover b { color: var(--primary); }
.side-list a b::after { content: " ›"; color: var(--muted); }
.side-list .dep-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px var(--sp-2); align-items: center; padding: var(--sp-2) 0; font-size: 13px; }
.dep-item .dep-memo { grid-column: 1 / -1; color: var(--text-2); font-size: 12px; }
.side-more { justify-self: end; font-size: 13px; font-weight: 600; text-decoration: none; }
.tbl-more { padding: var(--sp-2) var(--sp-3); border-top: 1px solid var(--line); font-size: 13px; }
/* 다가오는 변제일: 오늘 행 강조, 요약 줄 */
.tbl tbody tr.row-today td { background: var(--danger-weak); }
.tbl tbody tr.row-today:hover td { background: var(--danger-weak); }
.upcoming-sum { font-size: 13px; color: var(--text-2); }
.t-danger { color: var(--danger); }
.t-warning { color: var(--warning); }

/* 문자 수신거부 체크 영역 */
.optout-field { border-top: 1px solid var(--line); padding-top: var(--sp-3); }
.optout-field .check { min-height: 30px; font-weight: 600; }
.filter-chip { display: inline-flex; align-items: center; gap: var(--sp-2); justify-self: start; background: var(--primary-weak); color: var(--text-2); border-radius: 20px; padding: 2px 4px 2px var(--sp-3); font-size: 13px; }
.search-form { display: grid; gap: var(--sp-2); }

/* ── 10. 탭 ── */
/* 아래 구분선은 inset 그림자로 — 현재 탭 밑줄(2px)이 그 위를 덮고, 음수 margin 넘침으로 세로 스크롤이 생기지 않게 */
.tabs { display: flex; gap: var(--sp-5); box-shadow: inset 0 -1px 0 var(--line); overflow-x: auto; overflow-y: hidden; }
.tabs [role="tab"] { font-size: 14px; background: transparent; border: 0; border-bottom: 2px solid transparent; padding: 10px 2px; color: var(--text-2); cursor: pointer; white-space: nowrap; text-decoration: none; }
.tabs [role="tab"][aria-selected="true"] { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

/* ── 11. 안내 박스 · 폼 카드 ── */
.info-box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--sp-4); display: grid; gap: var(--sp-2); }
.info-box h2, .info-box h5 { font-size: 13px; font-weight: 600; color: var(--text-2); }
.info-box p { font-size: 13px; color: var(--muted); }
.info-box.unset { background: var(--warning-weak); border-color: var(--warning-weak); color: var(--warning); font-weight: 600; }
.info-box.note { background: var(--primary-weak); border-color: var(--primary-weak); color: var(--text-2); }
.acct { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; }
.acct b { font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; }
.acct span { color: var(--text-2); }
.form-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--sp-4); display: grid; gap: var(--sp-3); }
.form-card h2, .form-card h5 { font-size: 16px; font-weight: 600; }
.form-card[aria-disabled="true"] { opacity: 0.55; pointer-events: none; }
fieldset.plain { border: 0; margin: 0; padding: 0; min-width: 0; }

/* 입금 관리: 계좌 안내·신청 폼 320px + 내역 표 (1024px 미만은 세로) */
.dep-grid { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: var(--sp-4); align-items: start; }
.dep-side { display: grid; gap: var(--sp-4); min-width: 0; }
.acct-holder { font-size: 13px; color: var(--text-2); }
.history-panel { display: grid; gap: var(--sp-3); }
.history-panel .toolbar { padding: var(--sp-2) var(--sp-3); }
#history-body.is-loading { opacity: 0.5; }

/* ── 12. 문자 문구 편집 (design.md 6장) ── */
.tpl-list { display: grid; gap: var(--sp-4); }
.tpl-block { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--sp-4); display: grid; gap: var(--sp-3); }
.tpl-head { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-2); }
.tpl-head h2, .tpl-head b { font-size: 14px; font-weight: 600; }
.tpl-chips { display: flex; flex-wrap: wrap; gap: var(--sp-1); }
textarea.tpl-text { min-height: 240px; font-size: 14px; line-height: 1.6; resize: vertical; }
.tpl-foot { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--sp-3); }
.tpl-foot .msg { font-size: 12px; color: var(--danger); }
.tpl-bytes { margin-left: auto; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.tpl-bytes.over { color: var(--danger); }
.tpl-actions { display: flex; justify-content: flex-end; gap: var(--sp-2); }

/* ── 관리자 화면 ── */
/* 환경설정: 비용·적립 + 입금 계좌 2단 */
.settings-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: var(--sp-4); align-items: start; }
.preview-title { font-size: 13px; font-weight: 600; color: var(--text-2); }
/* 패널 안 탭·구역 */
.tabs.tabs-sm { gap: var(--sp-4); }
.tabs.tabs-sm [role="tab"] { font-size: 13px; padding: 8px 2px; }
.panel-section { display: grid; gap: var(--sp-3); align-content: start; }
.panel-section.boxed { border-top: 1px solid var(--line); padding-top: var(--sp-4); }
.section-title { font-size: 14px; font-weight: 600; }
/* 정산 리포트 */
.report-toolbar { align-items: center; }
.quick-range { display: flex; gap: var(--sp-1); flex-wrap: wrap; }
.toolbar .input-date { flex: 0 1 160px; }
.range-sep { color: var(--muted); }
.report-body { display: grid; gap: var(--sp-5); }
.report-body.is-loading, #member-history.is-loading { opacity: 0.5; }
.report-range { font-size: 13px; color: var(--muted); }
.report-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: var(--sp-3); }
.report-cards .stat { min-width: 0; gap: 2px; }
.stat-sub { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.stat.stat-key { border-color: var(--primary); }
.report-section { display: grid; gap: var(--sp-2); }
.report-section-head { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-2); }
.report-section-head h2 { font-size: 16px; font-weight: 600; }
.tbl tfoot th { background: var(--surface-2); border-top: 1px solid var(--line); padding: 10px var(--sp-3); white-space: nowrap; }

/* ── 13. 모달 · 토스트 (design.md 9장) ── */
.overlay { position: fixed; inset: 0; background: var(--overlay); display: grid; place-items: center; padding: 20px; z-index: 50; }
.modal { background: var(--surface); color: var(--text); border-radius: var(--radius-lg); width: min(420px, 100%); box-shadow: var(--shadow-float); overflow: hidden; display: grid; grid-template-rows: minmax(0, 1fr) auto; max-height: calc(100vh - 40px); }
.modal-b { padding: var(--sp-5) var(--sp-5) var(--sp-2); display: grid; gap: 10px; align-content: start; overflow-y: auto; }
.modal-b .ic { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 18px; }
.ic.warn { background: var(--warning-weak); color: var(--warning); }
.ic.info { background: var(--primary-weak); color: var(--primary); }
.ic.danger { background: var(--danger-weak); color: var(--danger); }
.modal-b h2 { font-size: 17px; font-weight: 700; }
.modal-b p { font-size: 14px; color: var(--text-2); }
.modal-f { display: flex; gap: var(--sp-2); justify-content: flex-end; padding: var(--sp-4) var(--sp-5) 20px; }

/* 토스트는 누를 일이 없는 알림 → 클릭은 아래 요소(패널 버튼 등)로 통과 */
.toast-zone { pointer-events: none; position: fixed; right: 20px; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); display: grid; gap: var(--sp-2); z-index: 60; justify-items: end; }
.toast { background: var(--navy); color: var(--surface); font-size: 14px; padding: var(--sp-3) var(--sp-4); border-radius: var(--radius); display: flex; gap: 10px; align-items: center; box-shadow: var(--shadow-float); max-width: min(360px, calc(100vw - 40px)); }
.toast i { width: 8px; height: 8px; border-radius: 50%; background: var(--toast-ok); flex: none; }
.toast.error i { background: var(--danger); }

/* ── 14. 애니메이션 (패널 0.2s · 토스트 0.22s만, 동작 줄이기 설정 시 끔) ── */
@media (prefers-reduced-motion: no-preference) {
  .loading-bar::after { animation: lb 1.1s ease-in-out infinite; }
  @keyframes lb { from { transform: translateX(-100%); } to { transform: translateX(300%); } }
  .slide { animation: slide-in 0.2s ease-out; }
  @keyframes slide-in { from { transform: translateX(16px); } to { transform: none; } }
  .toast { animation: tin 0.22s ease-out; }
  @keyframes tin { from { transform: translateY(8px); opacity: 0.4; } to { transform: none; opacity: 1; } }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ── 15. 반응형 (design.md 10장 4구간) ── */
/* --bp-lg: 1024–1279px — 패널이 표 위에 겹침 */
@media (max-width: 1279px) {
  .dash-grid { grid-template-columns: minmax(0, 1fr); }
  .body2.panel-open { grid-template-columns: minmax(0, 1fr); }
  .body2 .slide { position: absolute; top: 0; right: 0; width: 360px; z-index: 10; max-height: none; }
}
/* --bp-md: 768–1023px — 서랍 메뉴, 패널 80% */
@media (max-width: 1023px) {
  .app-shell { grid-template-columns: minmax(0, 1fr); }
  .myinfo-grid, .dep-grid, .settings-grid { grid-template-columns: minmax(0, 1fr); }
  .topbar { display: flex; position: sticky; top: 0; z-index: 20; padding-top: calc(10px + env(safe-area-inset-top, 0px)); }
  .gnb { position: fixed; top: 0; bottom: 0; left: 0; width: 240px; height: auto; z-index: 31; transform: translateX(-100%); visibility: hidden; }
  .app-shell.drawer .gnb { transform: none; visibility: visible; }
  .body2 .slide { width: 80%; }
}
@media (prefers-reduced-motion: no-preference) and (max-width: 1023px) {
  .gnb { transition: transform 0.2s ease, visibility 0.2s; }
}
/* --bp-sm: 767px 이하 — 상단 바, 패널·모달 전체 화면 */
@media (max-width: 767px) {
  .topbar .tb-wallet { display: block; }
  .main { padding: var(--sp-4); }
  .stats { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
  .stats .btn { grid-column: 1 / -1; }
  .form-grid.cols-2 { grid-template-columns: minmax(0, 1fr); }
  .report-section { display: none; } /* 휴대폰: 정산 리포트는 요약 카드만 (design.md 10장) */
  .dash-cards { grid-template-columns: 1fr 1fr; } /* 요약 숫자 2열 (design.md 10장) */
  .body2 .slide { position: fixed; inset: 0; width: auto; border-radius: 0; z-index: 40; max-height: none; }
  .overlay { padding: 0; }
  .modal { width: 100%; height: 100%; max-height: none; border-radius: 0; }
  .toast-zone { left: 20px; right: 20px; justify-items: center; }
  .login-box { padding: var(--sp-5) var(--sp-4); }
  .login-stage { padding: var(--sp-5) var(--sp-4); }
}
