/* ======================================================================
   TBNC — 기업상태표(상담일지) 페이지 + 관리자 현황 페이지 전용 스타일
   colors_and_type.css + styles.css 위에 얹어서 사용합니다.
   ====================================================================== */

/* hidden 속성이 .btn 등의 display 지정에 덮이지 않도록 */
[hidden] { display: none !important; }

/* ---------- 공통 레이아웃 ---------- */
.sheet-main {
  padding: 110px 0 80px;
  min-height: 100vh;
}
.sheet-intro {
  max-width: 720px;
  margin: 0 auto 40px;
  text-align: center;
}
.sheet-intro .eyebrow { margin-bottom: 18px; }
.sheet-title {
  font-family: var(--font-heading);
  font-size: clamp(1.6rem, 4.5vw, 2.4rem);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.02em;
  margin: 0 0 14px;
}
.sheet-lead {
  color: var(--muted-foreground);
  font-size: 0.9375rem;
  line-height: 1.7;
  margin: 0;
}

/* ---------- 섹션 카드 ---------- */
.sheet-form {
  max-width: 860px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.sheet-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 24px 22px 28px;
}
.sheet-card-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding-bottom: 16px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
}
.sheet-card-num {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--primary);
  letter-spacing: 0.08em;
}
.sheet-card-title {
  font-family: var(--font-heading);
  font-size: 1.125rem;
  font-weight: 600;
  margin: 0;
}
.sheet-card-note {
  margin-left: auto;
  font-size: 0.75rem;
  color: var(--muted-foreground);
}

/* ---------- 필드 그리드 ---------- */
.sheet-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}
.sheet-grid .full { grid-column: 1 / -1; }
@media (min-width: 720px) {
  .sheet-grid { grid-template-columns: 1fr 1fr; gap: 16px 20px; }
}
.field-hint {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  line-height: 1.5;
}

/* ---------- 예/아니오 등 칩 그룹 ---------- */
.chip-group { display: flex; gap: 8px; flex-wrap: wrap; }
.chip-sm {
  padding: 8px 16px;
  font-size: 0.8125rem;
}

/* ---------- 매출액 연도 행 ---------- */
.sales-row {
  display: grid;
  grid-template-columns: 96px 1fr 112px;
  gap: 10px;
  align-items: center;
}
.sales-row-label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--muted-foreground);
}
.select {
  background: var(--input);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 12px;
  color: var(--foreground);
  font-family: inherit;
  font-size: 0.875rem;
  width: 100%;
  outline: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23a7a29a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 34px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in oklch, var(--primary) 25%, transparent);
}
.select option { background: #26241f; color: var(--foreground); }

/* ---------- 가점사항 체크 필드 ---------- */
.check-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
@media (min-width: 720px) {
  .check-grid { grid-template-columns: repeat(3, 1fr); }
}
.check-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  cursor: pointer;
  font-size: 0.875rem;
  transition: all 0.15s ease;
  user-select: none;
  background: var(--input);
}
.check-pill:hover { border-color: color-mix(in oklch, var(--primary) 50%, var(--border)); }
.check-pill input { display: none; }
.check-pill .box {
  width: 18px; height: 18px;
  flex: 0 0 18px;
  border: 1.5px solid var(--muted-foreground);
  border-radius: 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}
.check-pill .box svg { opacity: 0; transition: opacity 0.15s; }
.check-pill input:checked ~ .box {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--primary-foreground);
}
.check-pill input:checked ~ .box svg { opacity: 1; }
.check-pill input:checked ~ .txt { color: var(--primary); }

/* ---------- 정책자금 기대출 표 ---------- */
.pf-table { display: flex; flex-direction: column; gap: 12px; }
.pf-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  background: color-mix(in oklch, var(--input) 55%, transparent);
}
.pf-row-name {
  font-size: 0.8438rem;
  font-weight: 600;
}
.pf-row-fields {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}
.pf-row-fields .input { padding: 10px 12px; font-size: 0.8438rem; }
@media (min-width: 720px) {
  .pf-row { grid-template-columns: 170px 1fr; align-items: center; }
}
.pf-head {
  display: none;
}
@media (min-width: 720px) {
  .pf-head {
    display: grid;
    grid-template-columns: 170px 1fr 1fr 1fr;
    gap: 8px;
    padding: 0 14px;
    font-size: 0.75rem;
    color: var(--muted-foreground);
  }
  .pf-head span:first-child { visibility: hidden; }
}

/* ---------- 제출 영역 ---------- */
.sheet-submit {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 6px;
}

/* ---------- 제출 완료 오버레이 ---------- */
.done-overlay {
  position: fixed;
  inset: 0;
  background: color-mix(in oklch, var(--background) 88%, transparent);
  backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 24px;
}
.done-overlay.show { display: flex; }
.done-box {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 40px 32px;
  max-width: 420px;
  text-align: center;
}
.done-box .icon {
  width: 56px; height: 56px;
  margin: 0 auto 18px;
  border-radius: 999px;
  background: color-mix(in oklch, var(--primary) 18%, transparent);
  color: var(--primary);
  display: flex; align-items: center; justify-content: center;
}
.done-box h3 { margin: 0 0 10px; font-size: 1.25rem; }
.done-box p { margin: 0; font-size: 0.875rem; color: var(--muted-foreground); line-height: 1.65; }

/* ---------- 인증코드 게이트 (status.html) ---------- */
.code-gate {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: var(--background);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 24px;
  overflow-y: auto;
}
.code-gate.unlocked { display: none; }
body.gate-locked { overflow: hidden; }
.code-gate-box { margin-top: 16vh; width: 100%; }
.code-gate-icon {
  width: 52px; height: 52px;
  margin: 0 auto 16px;
  border-radius: 999px;
  background: color-mix(in oklch, var(--primary) 16%, transparent);
  color: var(--primary);
  display: flex; align-items: center; justify-content: center;
}
.code-gate-input {
  text-align: center;
  font-size: 1.125rem;
  letter-spacing: 0.35em;
  font-family: var(--font-mono);
}
.code-gate-input::placeholder { letter-spacing: normal; font-family: var(--font-sans); font-size: 0.9375rem; }
.code-gate-help {
  margin: 18px 0 0;
  font-size: 0.8125rem;
  color: var(--muted-foreground);
}
.code-gate-help a {
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ======================================================================
   관리자 페이지
   ====================================================================== */
.admin-main { padding: 100px 0 80px; min-height: 100vh; }
.admin-wrap { max-width: 1080px; margin: 0 auto; }

/* 로그인 게이트 */
.gate {
  max-width: 400px;
  margin: 10vh auto 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 32px 28px;
  text-align: center;
}
.gate h1 { font-size: 1.25rem; margin: 0 0 8px; }
.gate p { font-size: 0.8438rem; color: var(--muted-foreground); margin: 0 0 20px; }
.gate form { display: flex; flex-direction: column; gap: 12px; }
.gate .error { color: var(--destructive); font-size: 0.8125rem; min-height: 1.2em; margin: 0; }

/* 목록 툴바 */
.admin-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.admin-toolbar h1 {
  font-size: 1.375rem;
  margin: 0;
  margin-right: auto;
}
.admin-count {
  font-size: 0.8125rem;
  color: var(--muted-foreground);
}
.btn-sm { height: 38px; padding: 0 16px; font-size: 0.8125rem; }

/* 목록 테이블 */
.admin-table-wrap {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow-x: auto;
}
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8438rem;
  min-width: 640px;
}
.admin-table th {
  text-align: left;
  padding: 12px 16px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--muted-foreground);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.admin-table td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.admin-table tbody tr { cursor: pointer; transition: background 0.12s; }
.admin-table tbody tr:hover { background: var(--muted); }
.admin-table tbody tr:last-child td { border-bottom: none; }
.admin-table .co { font-weight: 600; }
.admin-empty {
  padding: 48px 20px;
  text-align: center;
  color: var(--muted-foreground);
  font-size: 0.875rem;
}

/* 상세 패널 */
.detail-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  color: var(--muted-foreground);
  font-family: inherit;
  font-size: 0.8438rem;
  cursor: pointer;
  padding: 0;
  margin-bottom: 16px;
}
.detail-back:hover { color: var(--foreground); }
.detail-head {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}
.detail-head-info { margin-right: auto; }
.detail-head h2 { margin: 0 0 6px; font-size: 1.375rem; }
.detail-head .meta { font-size: 0.8125rem; color: var(--muted-foreground); }
.detail-sections { display: flex; flex-direction: column; gap: 18px; }
.detail-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
}
.detail-card h3 {
  font-size: 0.9375rem;
  margin: 0 0 14px;
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.detail-card h3 .n {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--primary);
}
.detail-rows { display: grid; grid-template-columns: 1fr; gap: 0; }
@media (min-width: 860px) { .detail-rows { grid-template-columns: 1fr 1fr; gap: 0 28px; } }
.detail-row {
  display: grid;
  grid-template-columns: minmax(140px, 42%) 1fr;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px dashed color-mix(in oklch, var(--border) 80%, transparent);
  font-size: 0.8438rem;
}
.detail-row dt { color: var(--muted-foreground); margin: 0; line-height: 1.5; }
.detail-row dd { margin: 0; line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
.detail-row dd:empty::before,
.detail-row dd.empty::before { content: '—'; color: var(--muted-foreground); opacity: 0.5; }

/* 상태 뱃지/스피너 */
.admin-status {
  padding: 40px;
  text-align: center;
  color: var(--muted-foreground);
  font-size: 0.875rem;
}
.spin {
  display: inline-block;
  width: 18px; height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 999px;
  animation: tbnc-spin 0.7s linear infinite;
  vertical-align: -4px;
  margin-right: 8px;
}
@keyframes tbnc-spin { to { transform: rotate(360deg); } }

/* 헤더 간소화 (숨은 페이지 공통) */
.sheet-header-cta { display: flex; align-items: center; gap: 10px; }
