* { box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", sans-serif;
       margin: 0; background: #f5f6f8; color: #1a1a1a; }
header { background: #1e293b; color: #fff; padding: 12px 24px; display: flex;
         align-items: center; gap: 24px; }
header h1 { margin: 0; font-size: 18px; }
header a { color: #fff; text-decoration: none; }
header nav a { margin-left: 16px; opacity: 0.85; }
header nav a:hover { opacity: 1; text-decoration: underline; }
main { max-width: none; margin: 24px auto; padding: 0 24px; }
.card { background: #fff; border-radius: 8px; padding: 20px; margin-bottom: 20px;
        box-shadow: 0 1px 2px rgba(0,0,0,0.06); overflow: visible; }
.card h2 { margin-top: 0; }
table { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 12px; }
th, td { padding: 6px 8px; border-bottom: 1px solid #eee; text-align: left; vertical-align: top; }
th { background: #f8fafc; color: #475569; font-weight: 600; font-size: 11px;
     text-transform: uppercase; letter-spacing: 0.02em; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.muted { color: #888; }
code { font-family: "SF Mono", Menlo, monospace; font-size: 12px;
       background: #f1f3f5; padding: 1px 5px; border-radius: 3px; }
input[type=text] { padding: 6px 8px; border: 1px solid #cbd5e1; border-radius: 4px; min-width: 0; }
button { padding: 6px 14px; background: #2563eb; color: #fff; border: none;
         border-radius: 4px; cursor: pointer; font-size: 13px; }
button:hover { background: #1d4ed8; }
.status-list { list-style: none; padding: 0; display: flex; gap: 12px; flex-wrap: wrap; }
.status-list li { padding: 6px 12px; border-radius: 4px; font-weight: 600; }
.status-list .match { background: #dcfce7; color: #166534; }
.status-list .short { background: #fef3c7; color: #92400e; }
.status-list .excess { background: #dbeafe; color: #1e40af; }
.status-list .missing { background: #fee2e2; color: #991b1b; }
.row-match { background: #f0fdf4; }
.row-short { background: #fffbeb; }
.row-excess { background: #eff6ff; }
.row-missing { background: #fef2f2; }
.filters a { margin-right: 12px; padding: 4px 10px; border-radius: 4px;
             text-decoration: none; color: #1e293b; }
.filters a.active { background: #1e293b; color: #fff; }
.tag { background: #e0e7ff; color: #3730a3; padding: 1px 6px;
       border-radius: 3px; font-size: 11px; margin-left: 4px; }
.tag-planned { background: #e0e7ff; color: #3730a3; }
.tag-onchain { background: #d1fae5; color: #065f46; }
/* 회차 칩: 거래 행 회차 표시 + 회차 필터와 시각적 연결 */
.tag-batch   { background: #fde68a; color: #78350f; font-weight: 600;
               margin-left: 0; padding: 1px 7px; }
/* 거래 통합 행 상태 — 한 행에 오프체인 계획 + 온체인 실거래가 합쳐졌을 때의 마크. */
.tag.confirm-confirmed { background: #d1fae5; color: #065f46; font-weight: 600; }
.tag.confirm-planned   { background: #fef3c7; color: #92400e; }
.tag.confirm-onchain   { background: #dbeafe; color: #1e40af; }
.row-confirm-onchain_only { background: #fafbff; }
.row-confirm-planned_only { background: #fffdf5; }
.filter-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; margin: 12px 0; }
.filter-row label { display: flex; flex-direction: column; font-size: 12px; color: #64748b; gap: 2px; }
.filter-row input, .filter-row select { padding: 6px 8px; border: 1px solid #cbd5e1; border-radius: 4px; min-width: 0; }
.filter-row input[type=text] { min-width: 260px; }
/* 호버 카드(.wallet-hover)가 잘리지 않도록 overflow를 visible로 둔다.
   가로 컬럼이 viewport보다 넓은 페이지는 body 단위 가로 스크롤로 처리. */
.table-wrap { overflow: visible; }
.copy { cursor: copy; user-select: all; transition: background 0.12s, color 0.12s; }
.copy:hover { background: #e2e8f0; }
.copy.copied { background: #bbf7d0; color: #166534; }
.copy.copied::after { content: " ✓"; font-weight: 700; }
.copy.copy-error { background: #fecaca; color: #991b1b; }
.copy.copy-error::after { content: " ✗"; font-weight: 700; }
.copy-wrap { display: inline-flex; align-items: center; gap: 3px; }
.copy-icon { color: #94a3b8; flex-shrink: 0; vertical-align: -1px;
             transition: color 0.12s; pointer-events: none; }
.copy-wrap:hover .copy-icon,
.wallet-cell:hover .copy-icon { color: #2563eb; }

/* wallet-cell: 주소 + 복사 아이콘 + 호버 카드 */
.wallet-cell { position: relative; display: inline-flex; align-items: center; gap: 3px; }
.wallet-cell .wallet-addr { cursor: copy; }
.wallet-hover { display: none; position: absolute; top: 100%; left: 0; z-index: 1000;
                margin-top: 2px; min-width: 240px; max-width: 360px;
                background: #1e293b; color: #f1f5f9; border-radius: 6px;
                padding: 10px 12px; box-shadow: 0 6px 24px rgba(0,0,0,0.22);
                font-size: 12px; line-height: 1.5;
                white-space: normal; word-break: break-all;
                font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
.wallet-cell:hover .wallet-hover { display: block; }
.wallet-hover-user { display: flex; flex-direction: column; gap: 2px;
                     color: #f1f5f9; text-decoration: none;
                     padding-bottom: 8px; margin-bottom: 8px;
                     border-bottom: 1px solid #334155; }
.wallet-hover-user:hover strong { text-decoration: underline; }
.wallet-hover-user strong { font-size: 13px; color: #fff; }
.wallet-hover-user .muted { color: #94a3b8; }
.wallet-hover-user small { font-size: 10px; margin-top: 4px; color: #60a5fa; }
.wallet-hover-nouser { display: block; padding-bottom: 8px; margin-bottom: 8px;
                       border-bottom: 1px solid #334155; color: #94a3b8 !important;
                       font-style: italic; }
.wallet-hover-full { display: block; font-family: "SF Mono", Menlo, monospace;
                     font-size: 11px; color: #cbd5e1; }
/* 마지막 행 호버 카드는 위로 띄워 잘림 방지 */
tbody tr:nth-last-child(-n+2) .wallet-hover {
  top: auto; bottom: 100%;
  margin-top: 0; margin-bottom: 4px;
}
/* 행의 마지막 컬럼 셀은 카드 우측 끝을 셀에 맞춰 viewport 우측 잘림 방지 */
tbody tr td:nth-last-child(-n+2) .wallet-hover {
  left: auto; right: 0;
}
.ext-link { font-size: 11px; color: #64748b; text-decoration: none; margin-left: 4px; }
.ext-link:hover { color: #1d4ed8; }
.user-cell { display: flex; flex-direction: column; gap: 1px; text-decoration: none; color: #1e293b; }
.user-cell strong { font-size: 12px; }
.user-cell small { font-size: 11px; color: #475569; }
.user-cell small.muted { color: #94a3b8; }
.user-cell:hover strong { text-decoration: underline; }
.pager { margin-top: 12px; display: flex; gap: 12px; align-items: center; justify-content: center; }
.pager a { padding: 4px 12px; background: #f1f5f9; border-radius: 4px; text-decoration: none; color: #1e293b; }
dl.meta { display: grid; grid-template-columns: 100px 1fr; gap: 4px 16px; margin: 8px 0; }
dl.meta dt { color: #64748b; font-weight: 600; }
.wallets { list-style: none; padding: 0; }
.wallets li { padding: 4px 0; }
.batch-grid { display: grid; grid-template-columns: 1fr;
              gap: 16px; margin-top: 12px; }
.batch-card { border: 1px solid #e2e8f0; border-radius: 6px; padding: 14px 16px;
              background: #fafbfc; }
.batch-card-head { display: flex; justify-content: space-between; align-items: baseline;
                   gap: 12px; margin-bottom: 4px; }
.batch-card h3 { margin: 0; font-size: 15px; color: #1e293b; }
.batch-tokens .tag { margin-left: 4px; }
.batch-summary { margin: 4px 0 8px; color: #475569; font-size: 13px; }
.batch-stats { font-size: 12px; color: #1e293b; margin-bottom: 8px; }
.batch-stats strong { font-variant-numeric: tabular-nums; }
.batch-card details { margin-top: 4px; }
.batch-card details summary { cursor: pointer; font-size: 12px; color: #64748b;
                              padding: 4px 0; user-select: none; }
.batch-card details[open] summary { color: #1e293b; font-weight: 600; }
.batch-files { font-size: 11px; margin-top: 4px; }
.batch-files td, .batch-files th { padding: 4px 6px; }
.batch-files code { font-size: 11px; }
/* 회차별 지급 룰 표 */
.pricing-details { margin: 8px 0; padding-top: 4px; border-top: 1px dashed #cbd5e1; }
.pricing-details > summary { font-size: 12px; color: #1e293b; font-weight: 600; }
.pricing-table { font-size: 11.5px; margin-top: 6px; width: 100%;
                 border-collapse: collapse; }
.pricing-table th { background: #eef2ff; color: #3730a3; padding: 6px 8px;
                    text-align: left; border-bottom: 1px solid #c7d2fe; }
.pricing-table td { padding: 6px 8px; vertical-align: top;
                    border-bottom: 1px solid #e2e8f0; }
.pricing-table tr:last-child td { border-bottom: none; }
.pricing-table code { background: #f1f5f9; padding: 1px 5px; border-radius: 3px;
                      font-size: 11px; color: #334155; }
.pricing-notes { margin-top: 4px; font-size: 10.5px; line-height: 1.45; }
.role { display: inline-block; padding: 1px 6px; border-radius: 3px; font-size: 10px;
        font-weight: 600; white-space: nowrap; }
.role-planned { background: #e0e7ff; color: #3730a3; }
.role-users   { background: #fde68a; color: #78350f; }
.role-wallets { background: #fcd34d; color: #78350f; }
.role-audit   { background: #ddd6fe; color: #5b21b6; }
.role-onchain { background: #d1fae5; color: #065f46; }
.role-aux     { background: #e2e8f0; color: #475569; }
/* /cases — 사람 중심 점검 화면 */
.cases-list { margin-top: 12px; }
.case-row { border: 1px solid #e2e8f0; border-radius: 6px;
            margin-bottom: 8px; background: #fff; overflow: hidden; }
.case-row[open] { box-shadow: 0 2px 6px rgba(0,0,0,0.06);
                  border-color: #cbd5e1; }
.case-row > summary { padding: 10px 14px; cursor: pointer; list-style: none;
                      display: flex; align-items: center; gap: 12px;
                      user-select: none; flex-wrap: wrap; }
.case-row > summary::-webkit-details-marker { display: none; }
.case-id { color: #94a3b8; font-size: 12px; font-variant-numeric: tabular-nums;
           min-width: 52px; }
.case-name { color: #1e293b; min-width: 140px; }
.case-meta { font-size: 12px; color: #64748b; flex: 1; min-width: 200px; }
.case-chev { color: #94a3b8; transition: transform 0.15s;
             margin-left: auto; font-size: 14px; }
.case-row[open] .case-chev { transform: rotate(180deg); }
.case-detail { padding: 4px 14px 14px; border-top: 1px solid #f1f5f9;
               background: #fafbfc; }
.resolved-badge { background: #dcfce7; color: #166534; padding: 1px 7px;
                  border-radius: 3px; font-size: 11px; font-weight: 600; }

.case-meta-grid { grid-template-columns: 70px 1fr; gap: 4px 14px; margin: 8px 0; }
.case-wallets { margin: 0; }
.case-issues-head { margin: 14px 0 6px; font-size: 14px; color: #334155; }
.case-issues-count { background: #fef3c7; color: #92400e; padding: 1px 8px;
                     border-radius: 3px; font-size: 12px; margin-left: 4px; }

.issue-list { padding-left: 24px; margin: 6px 0 12px;
              counter-reset: issue-counter; }
.issue-row { padding: 10px 0 10px 8px; border-bottom: 1px dashed #e2e8f0;
             counter-increment: issue-counter; }
.issue-row::marker { color: #94a3b8; font-weight: 600; }
.issue-row:last-child { border-bottom: none; }
.issue-form { margin: 0; }
.issue-check { display: inline-flex; align-items: center; gap: 8px;
               cursor: pointer; }
.issue-check input[type=checkbox] { width: 17px; height: 17px;
                                    cursor: pointer; margin: 0;
                                    accent-color: #2563eb; }
.issue-title { font-weight: 600; color: #1e293b; }
.issue-code { font-size: 10px; padding: 1px 5px; }
.issue-detail { margin: 4px 0 0 26px; font-size: 12px; }
.issue-meta { margin: 6px 0 0 26px; font-size: 11px; }
.issue-critical .issue-title { color: #b91c1c; }
.issue-warning .issue-title  { color: #b45309; }
.issue-resolved { opacity: 0.6; }
.issue-resolved .issue-title { color: #166534; text-decoration: line-through; }
.issue-empty { padding: 16px 0; text-align: center; }
.case-links { margin-top: 8px; font-size: 12px; }

footer { text-align: center; padding: 20px; color: #94a3b8; font-size: 12px; }

/* 풀스크린 로딩 오버레이: data-slow 링크 클릭 시 표시 */
.page-loader { position: fixed; inset: 0; z-index: 9999;
               background: rgba(15, 23, 42, 0.55);
               display: flex; flex-direction: column; align-items: center;
               justify-content: center; gap: 18px;
               color: #f1f5f9; font-size: 13px;
               backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); }
.page-loader[hidden] { display: none; }
.page-loader-spinner { width: 56px; height: 56px; border-radius: 50%;
                       border: 5px solid rgba(255,255,255,0.18);
                       border-top-color: #60a5fa;
                       animation: page-loader-spin 0.9s linear infinite; }
@keyframes page-loader-spin { to { transform: rotate(360deg); } }
.page-loader-text { text-align: center; max-width: 380px; padding: 0 16px;
                    line-height: 1.6; }
.page-loader-text strong { display: block; font-size: 15px;
                           margin-bottom: 4px; color: #fff; }
.page-loader-text small { color: #cbd5e1; }

/* 인트로 explainer (송금 점검 페이지 상단 설명) */
.intro-explainer { border: 1px solid #e2e8f0; border-radius: 6px;
                   padding: 8px 14px; margin: 8px 0 16px;
                   background: #f8fafc; }
.intro-explainer > summary { cursor: pointer; font-size: 13px; color: #1e293b;
                             padding: 6px 0; user-select: none; list-style: none; }
.intro-explainer > summary::before { content: "▸ "; color: #64748b;
                                     display: inline-block; width: 14px;
                                     transition: transform 0.15s; }
.intro-explainer[open] > summary::before { content: "▾ "; }
.intro-explainer h3 { font-size: 13px; margin: 14px 0 4px;
                      color: #334155; font-weight: 700;
                      letter-spacing: 0.01em; }
.intro-explainer p, .intro-explainer li { font-size: 13px; line-height: 1.65;
                                          color: #334155; }
.intro-explainer ul { margin: 4px 0 8px; padding-left: 22px; }
.intro-explainer li { margin-bottom: 4px; }
.intro-explainer .warn { color: #b45309; }
.intro-explainer em { color: #475569; font-style: normal;
                      border-bottom: 1px dashed #94a3b8; }

/* 토큰 정보 — CSS-only 탭 (라디오 + :checked 형제 선택자, JS 불필요) */
.table-scroll { overflow-x: auto; }
.token-tab-radio { position: absolute; opacity: 0; pointer-events: none; }
.token-tablist { display: flex; gap: 4px; border-bottom: 2px solid #e2e8f0;
                 margin-bottom: 14px; flex-wrap: wrap; }
.token-tab { cursor: pointer; padding: 8px 16px; font-size: 14px;
             color: #64748b; border: 1px solid transparent; border-bottom: none;
             border-radius: 6px 6px 0 0; margin-bottom: -2px; user-select: none; }
.token-tab:hover { color: #1e293b; background: #f1f5f9; }
.token-tab.is-disabled { cursor: not-allowed; color: #cbd5e1; }
.token-tab.is-disabled:hover { background: none; color: #cbd5e1; }
.token-tab-soon { font-size: 11px; color: #94a3b8; }
/* 선택된 탭 라벨 강조 */
#tt-utility:checked  ~ .token-tablist label[for="tt-utility"],
#tt-infra:checked    ~ .token-tablist label[for="tt-infra"],
#tt-contract:checked ~ .token-tablist label[for="tt-contract"] {
  color: #3730a3; border-color: #e2e8f0; background: #fff; font-weight: 700; }
/* 패널 토글: 기본 숨김, 해당 라디오 checked 시 표시 */
.token-panel { display: none; }
#tt-utility:checked  ~ #tt-panel-utility,
#tt-infra:checked    ~ #tt-panel-infra,
#tt-contract:checked ~ #tt-panel-contract { display: block; }
.token-empty { padding: 24px 12px; text-align: center;
               border: 1px dashed #e2e8f0; border-radius: 6px; background: #f8fafc; }

@media print {
  header, footer, button, .filters, .page-loader { display: none; }
  .card { box-shadow: none; border: 1px solid #ddd; page-break-inside: avoid; }
}
