/* WorkLog — 공통 스타일
   로그인 페이지 (body.login-page) + 메인 페이지 (body.main-page) */

:root {
  --color-primary: #2563eb;
  --color-primary-dark: #1d4ed8;
  --color-bg: #f5f7fb;
  --color-card: #ffffff;
  --color-text: #1f2937;
  --color-text-mute: #6b7280;
  --color-border: #e5e7eb;
  --color-error: #dc2626;
  --color-success: #16a34a;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --radius: 10px;
  --gap: 16px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo",
               "Malgun Gothic", "맑은 고딕", sans-serif;
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
}

button { font-family: inherit; }

/* =====================================
   로그인 페이지 (body.login-page)
   ===================================== */

.login-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.login-header {
  background: linear-gradient(135deg, #2563eb 0%, #6d28d9 100%);
  padding: 32px 16px 48px;
  display: flex;
  justify-content: center;
}

.login-card {
  background: var(--color-card);
  width: 100%;
  max-width: 420px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 28px 24px;
}

.brand {
  margin: 0;
  font-size: 28px;
  font-weight: 800;
  color: var(--color-primary-dark);
  letter-spacing: -0.5px;
}

.brand-tag {
  margin: 4px 0 20px;
  color: var(--color-text-mute);
  font-size: 14px;
}

.login-form { display: flex; flex-direction: column; gap: 14px; }

.form-row { display: flex; flex-direction: column; gap: 6px; }

.form-row label {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text);
}

.form-row input {
  padding: 11px 12px;
  font-size: 15px;
  border: 1.5px solid var(--color-border);
  border-radius: 8px;
  outline: none;
  transition: border-color 0.15s;
}

.form-row input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.btn-login {
  margin-top: 6px;
  padding: 12px;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  background: var(--color-primary);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-login:hover:not(:disabled) { background: var(--color-primary-dark); }
.btn-login:disabled { opacity: 0.6; cursor: not-allowed; }

.login-msg {
  min-height: 18px;
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--color-text-mute);
}

.login-msg.error { color: var(--color-error); }

/* 로그인 안내 블록 (이메일/비밀번호 폼 제거 후 자리 — 회원가입 불필요 + 무료 체험) */
.login-benefit {
  margin-top: 6px;
  text-align: center;
  padding: 18px 16px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
}
.login-benefit-badge {
  display: inline-block;
  padding: 6px 14px;
  background: #2a5776;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  border-radius: 999px;
  letter-spacing: -0.2px;
}
.login-benefit-lead {
  margin: 12px 0 4px;
  font-size: 15px;
  font-weight: 700;
  color: var(--color-text);
}
.login-benefit-sub {
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
  color: var(--color-text-mute);
}

/* 하단 소개 */
.intro {
  flex: 1;
  padding: 32px 16px 24px;
  max-width: 960px;
  margin: 0 auto;
  width: 100%;
}

.intro-hero { text-align: center; margin-bottom: 28px; }
.intro-hero h2 {
  margin: 0 0 8px;
  font-size: 24px;
  color: var(--color-text);
}
.intro-hero p { margin: 0; color: var(--color-text-mute); font-size: 15px; }

.intro-features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.feature {
  background: var(--color-card);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.feature-icon { font-size: 28px; margin-bottom: 8px; }
.feature h3 { margin: 0 0 6px; font-size: 16px; }
.feature p { margin: 0; color: var(--color-text-mute); font-size: 14px; line-height: 1.5; }

.intro-footnote { text-align: center; color: var(--color-text-mute); font-size: 13px; }
.intro-footnote p { margin: 4px 0; }
.copyright { font-size: 12px; opacity: 0.7; }

/* =====================================
   메인 페이지 (body.main-page)
   ===================================== */

.main-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  background: var(--color-primary-dark);
  color: #fff;
  padding: 10px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow-sm);
}

.topbar-brand {
  font-weight: 800;
  font-size: 18px;
  letter-spacing: -0.3px;
  color: #fff;
  text-decoration: none;
  cursor: pointer;
  transition: opacity 0.15s;
}
.topbar-brand:hover { opacity: 0.85; }
.topbar-user { display: flex; align-items: center; gap: 12px; font-size: 13px; }
.user-email { opacity: 0.9; }

.btn-logout {
  padding: 6px 12px;
  background: transparent;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
}
.btn-logout:hover { background: rgba(255, 255, 255, 0.1); }

.tabbar {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  background: var(--color-card);
  border-bottom: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 10;
}

.tab-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 12px 4px;
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  color: var(--color-text-mute);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.tab-btn:hover { color: var(--color-primary); }

.tab-btn.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
  background: rgba(37, 99, 235, 0.04);
}

.tab-icon { font-size: 22px; line-height: 1; }
.tab-label { font-size: 13px; }

.tab-content {
  flex: 1;
  padding: 20px 16px;
  max-width: 960px;
  margin: 0 auto;
  width: 100%;
}

.panel {
  background: var(--color-card);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.panel-title { margin: 0 0 12px; font-size: 20px; }
.panel-placeholder { color: var(--color-text-mute); font-size: 14px; margin: 0; }

/* =====================================
   업체등록 탭 — PDF 드롭존 + 폼
   ===================================== */

.panel-register .pdf-drop-row { margin-bottom: 16px; }

.pdf-dropzone {
  border: 2px dashed var(--color-primary);
  border-radius: var(--radius);
  padding: 28px 16px;
  text-align: center;
  background: #f0f5ff;
  cursor: pointer;
  transition: all 0.2s;
}
.pdf-dropzone:hover,
.pdf-dropzone:focus { background: #e3edff; outline: none; }
.pdf-dropzone.drag-over {
  border-style: solid;
  border-color: var(--color-success);
  background: #e8f8ec;
}
.pdf-dropzone-icon { font-size: 36px; line-height: 1; margin-bottom: 8px; }
.pdf-dropzone-text { font-size: 14px; color: var(--color-text); }
.pdf-dropzone-text strong { color: var(--color-primary-dark); }
.pdf-dropzone-sub {
  margin-top: 6px;
  font-size: 12px;
  color: var(--color-text-mute);
}

.parse-preview {
  border: 1px solid var(--color-success);
  background: #f3fbf4;
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 16px;
}
.parse-preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #d4ecd9;
  padding-bottom: 8px;
  margin-bottom: 8px;
}
.parse-preview-header h4 { margin: 0; font-size: 14px; color: var(--color-success); }
.parse-preview-clear {
  background: transparent;
  border: none;
  color: var(--color-error);
  font-size: 12px;
  cursor: pointer;
}
.parse-preview-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  font-size: 13px;
}
.parse-preview-item label {
  min-width: 80px;
  font-weight: 600;
  color: var(--color-text);
}
.parse-preview-item span { color: var(--color-text-mute); }

.register-form { display: flex; flex-direction: column; gap: 12px; }
.register-form .form-row { display: flex; flex-direction: column; gap: 6px; }
.register-form label { font-size: 13px; font-weight: 600; }
.register-form input,
.register-form textarea {
  padding: 10px 12px;
  font-size: 14px;
  border: 1.5px solid var(--color-border);
  border-radius: 8px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}
.register-form input:focus,
.register-form textarea:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
.register-form textarea { resize: vertical; min-height: 70px; }

.form-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
}
.btn-primary {
  padding: 11px 22px;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  background: var(--color-primary);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-primary:hover:not(:disabled) { background: var(--color-primary-dark); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

.form-msg { font-size: 13px; color: var(--color-text-mute); }
.form-msg.error { color: var(--color-error); }
.form-msg.success { color: var(--color-success); }

.btn-secondary {
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-primary-dark);
  background: #fff;
  border: 1.5px solid var(--color-primary);
  border-radius: 8px;
  cursor: pointer;
}
.btn-secondary:hover:not(:disabled) { background: #eef4ff; }
.btn-secondary:disabled { opacity: 0.6; cursor: not-allowed; }

/* =====================================
   업체조회 탭 — 검색 + 카드 그리드 + 모달
   ===================================== */

.search-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.search-header .panel-title { margin: 0; flex: 1; }
.search-count {
  font-size: 13px;
  color: var(--color-text-mute);
}

.search-toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.search-input {
  flex: 1;
  min-width: 200px;
  padding: 10px 14px;
  font-size: 14px;
  border: 1.5px solid var(--color-border);
  border-radius: 8px;
  outline: none;
  transition: border-color 0.15s;
}
.search-input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
.search-mine {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--color-text);
  cursor: pointer;
  user-select: none;
}
.search-mine input { accent-color: var(--color-primary); }

.search-select {
  padding: 9px 10px;
  font-size: 13px;
  border: 1.5px solid var(--color-border);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  min-width: 120px;
}
.search-select:focus {
  border-color: var(--color-primary);
  outline: none;
}
.search-select:disabled { background: #f5f5f7; cursor: not-allowed; opacity: 0.6; }

/* 업체위치 검색 버튼 (시/도·시/군/구 선택 후 클릭 시 표시) */
.map-search-btn { padding: 9px 18px; font-size: 14px; flex: 0 0 auto; white-space: nowrap; }

/* --- 한 줄 테이블 형식 (1000+ 대응) --- */
.company-table-wrap {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: auto;
  max-height: 65vh;
}
.company-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.company-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f7f8fa;
  color: var(--color-text);
  font-weight: 600;
  text-align: left;
  padding: 10px 12px;
  border-bottom: 2px solid var(--color-border);
  white-space: nowrap;
}
.company-table tbody td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
}
.company-table tbody tr {
  cursor: pointer;
  transition: background 0.1s;
}
.company-table tbody tr:hover,
.company-table tbody tr:focus {
  background: #eef4ff;
  outline: none;
}
.company-table tbody tr:last-child td { border-bottom: none; }

/* 정렬 가능한 헤더 (업체명/주소 클릭 정렬) */
.company-table thead th.sortable { cursor: pointer; user-select: none; }
.company-table thead th.sortable:hover { background: #eef4ff; }
.company-table thead th.sorted { color: var(--color-primary); }
.sort-arrow { font-size: 11px; color: var(--color-primary); }

.td-name {
  font-weight: 600;
  color: var(--color-primary-dark);
  display: flex;
  align-items: center;
  gap: 6px;
}
.row-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  background: #f0f0f4;
  color: var(--color-text-mute);
}
.row-badge.mine {
  background: rgba(37, 99, 235, 0.12);
  color: var(--color-primary-dark);
}

/* 모바일에서 좁아지면 사업자번호/대표자/연락처 숨김 → 업체명+주소만 표시 */
@media (max-width: 720px) {
  .company-table .col-business,
  .company-table .col-ceo,
  .company-table .col-phone { display: none; }
}

/* =====================================
   업무일지 탭
   ===================================== */

.panel-subtitle {
  margin: 0;
  font-size: 16px;
  color: var(--color-text);
}

.worklog-form-card {
  background: #f7f9fc;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 24px;
}
.worklog-form { display: flex; flex-direction: column; gap: 12px; }
.worklog-form .form-row { display: flex; flex-direction: column; gap: 6px; }
.worklog-form label { font-size: 13px; font-weight: 600; }
.worklog-form .wl-input {
  padding: 10px 12px;
  font-size: 14px;
  border: 1.5px solid var(--color-border);
  border-radius: 8px;
  background: #fff;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}
.worklog-form .wl-input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
.worklog-form textarea.wl-input { resize: vertical; min-height: 80px; }

/* 목록 업체 검색 행 (검색한 업체의 일지만 조회) */
.wl-search-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin: 4px 0 12px;
}
.wl-search-row .wl-input {
  flex: 1;
  min-width: 180px;
  padding: 10px 12px;
  font-size: 14px;
  border: 1.5px solid var(--color-border);
  border-radius: 8px;
  background: #fff;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}
.wl-search-row .wl-input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
.wl-search-row .btn-primary { padding: 10px 18px; }

/* 작성 폼의 시/도·시/군/구 필터 (가로 배치) */
.wl-loc-row {
  display: flex;
  gap: 8px;
  margin-bottom: 6px;
}
.wl-loc-select {
  flex: 1;
  min-width: 0;
  padding: 9px 10px;
  font-size: 13px;
  background: #fff;
}
.wl-loc-select:disabled { background: #f5f5f7; cursor: not-allowed; opacity: 0.6; }

/* 업체명 커스텀 자동완성 드롭다운 (datalist 대체 — 행 전체 색상 채우기) */
.wl-company-input-wrap { position: relative; width: 100%; }
.wl-company-input-wrap .wl-input { width: 100%; box-sizing: border-box; }
.wl-company-dropdown {
  position: absolute;
  top: calc(100% + 2px);
  left: 0;
  right: 0;
  z-index: 30;
  max-height: 240px;
  overflow-y: auto;
  background: #fff;
  border: 1.5px solid var(--color-border);
  border-radius: 8px;
  box-shadow: var(--shadow-md);
}
.wl-company-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-left: 5px solid transparent; /* 업체 색상(inline)으로 채워짐 */
  font-size: 14px;
  cursor: pointer;
}
/* 행 배경은 업체 색 tint(inline) — hover/active 는 inset 테두리로 표시(배경 안 덮음) */
.wl-company-option:hover,
.wl-company-option.active { box-shadow: inset 0 0 0 2px var(--color-primary); }
.wl-company-optname {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.wl-company-empty { color: var(--color-text-mute); cursor: default; border-left-color: transparent; }
.wl-company-empty:hover { box-shadow: none; }

.worklog-list-header { margin-top: 8px; }

/* 일지 목록 — content 길어도 한 줄 축약 */
.worklog-table .content-cell {
  max-width: 320px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--color-text-mute);
}

/* 결과 뱃지 (계약/제안/후속/거절/일반) */
.result-badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.result-contract { background: #d1fadf; color: #027a48; }
.result-proposal { background: #dbeafe; color: #1d4ed8; }
.result-followup { background: #fef3c7; color: #b45309; }
.result-rejected { background: #fee2e2; color: #b91c1c; }
.result-none     { background: #f0f0f4; color: #475467; }

/* 모달 — 일지 내용은 여러 줄 + pre-wrap */
.modal-row-stack { flex-direction: column; align-items: flex-start; gap: 4px; }
.modal-row-content {
  width: 100%;
  padding: 10px 12px;
  background: #f7f8fa;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--color-text);
}

/* 모달 footer (삭제 버튼 등) */
.modal-footer {
  display: flex;
  justify-content: flex-end;
  padding: 12px 20px 16px;
  border-top: 1px solid var(--color-border);
}
.btn-danger {
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  background: var(--color-error);
  border: none;
  border-radius: 8px;
  cursor: pointer;
}
.btn-danger:hover:not(:disabled) { background: #b91c1c; }
.btn-danger:disabled { opacity: 0.6; cursor: not-allowed; }

/* 모바일: 일지 테이블에서 내용 컬럼 숨김 */
@media (max-width: 720px) {
  .worklog-table .col-content { display: none; }
}

/* =====================================
   업체위치 탭 — 지도
   ===================================== */

.map-box {
  width: 100%;
  height: 65vh;
  min-height: 400px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
  background: #f0f0f4;
}

.map-info {
  padding: 6px 4px;
  font-size: 13px;
  max-width: 240px;
}
.map-info-title {
  font-weight: 700;
  font-size: 14px;
  color: var(--color-primary-dark);
  margin-bottom: 6px;
}
.map-info-row {
  display: flex;
  gap: 6px;
  padding: 2px 0;
}
.map-info-label {
  min-width: 44px;
  color: var(--color-text-mute);
  font-weight: 600;
}
.map-info-value {
  color: var(--color-text);
  word-break: break-word;
}

.search-status {
  text-align: center;
  padding: 24px 12px;
  color: var(--color-text-mute);
  font-size: 14px;
}
.search-status.error { color: var(--color-error); }
.search-status.loading { color: var(--color-primary); }

.company-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}

.company-card {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 14px;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.company-card:hover,
.company-card:focus {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
  outline: none;
}
.company-card-name {
  margin: 0 0 4px;
  font-size: 16px;
  color: var(--color-text);
  line-height: 1.3;
}
.company-card-meta {
  display: flex;
  gap: 8px;
  font-size: 13px;
  line-height: 1.4;
}
.meta-label {
  min-width: 50px;
  color: var(--color-text-mute);
  font-weight: 500;
}
.meta-value {
  color: var(--color-text);
  word-break: break-word;
}
.company-card-memo {
  margin: 6px 0 0;
  padding: 6px 8px;
  background: #f7f8fa;
  border-radius: 6px;
  font-size: 12px;
  color: var(--color-text-mute);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.company-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--color-border);
  font-size: 11px;
  color: var(--color-text-mute);
}
.company-card-author {
  padding: 2px 8px;
  border-radius: 999px;
  background: #f0f0f4;
}
.company-card-author.mine {
  background: rgba(37, 99, 235, 0.1);
  color: var(--color-primary-dark);
  font-weight: 600;
}

/* === 상세 모달 === */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}
.modal {
  background: #fff;
  border-radius: var(--radius);
  width: 100%;
  max-width: 500px;
  max-height: 86vh;
  overflow: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--color-border);
}
.modal-header h3 {
  margin: 0;
  font-size: 18px;
  color: var(--color-text);
}
.modal-close {
  background: transparent;
  border: none;
  font-size: 20px;
  color: var(--color-text-mute);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
}
.modal-close:hover { background: #f0f0f4; color: var(--color-text); }
.modal-body {
  padding: 16px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.modal-row {
  display: flex;
  gap: 10px;
  font-size: 14px;
  align-items: flex-start;
}
.modal-row-label {
  min-width: 84px;
  color: var(--color-text-mute);
  font-weight: 600;
}
.modal-row-value {
  flex: 1;
  color: var(--color-text);
  word-break: break-word;
}

/* 반응형 — 모바일 우선 */
@media (max-width: 480px) {
  .login-header { padding: 24px 12px 32px; }
  .login-card { padding: 22px 18px; }
  .brand { font-size: 24px; }
  .topbar-brand { font-size: 16px; }
  .user-email {
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

/* === 업체 상세 페이지 — 보고서형 레이아웃 === */
.detail-card { padding: 0; }

/* 상단 툴바 — [← 목록]  업체 상세 ········ [수정] [삭제] 한 줄 정렬 */
.detail-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #eef0f4;
}
.detail-head .detail-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: #64748b;
}
.detail-head .detail-actions {
  margin-left: auto;       /* 수정·삭제를 우측으로 */
  display: flex;
  gap: 8px;
}
/* 공통 버튼 높이/모양 통일 (헤더 한정) */
.detail-head .btn-back,
.detail-head .btn-wl-write,
.detail-head .btn-secondary,
.detail-head .btn-danger {
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
/* ← 목록: 중립 회색 칩 */
.detail-head .btn-back {
  color: #475467;
  background: #f4f6f9;
  border: 1px solid #e2e6ec;
  padding: 7px 12px;
}
.detail-head .btn-back:hover { background: #e9edf3; border-color: #d3d9e2; }
/* ✏️ 수정: 파란 아웃라인 */
.detail-head .btn-secondary {
  color: #2563eb;
  border: 1px solid #c7d7f5;
}
.detail-head .btn-secondary:hover:not(:disabled) { background: #eff5ff; border-color: #2563eb; }
/* 🗑 삭제: 평소 빨간 아웃라인 → hover 시 채워짐 (덜 요란하게) */
.detail-head .btn-danger {
  color: #dc2626;
  border: 1px solid #f0c4c4;
}
.detail-head .btn-danger:hover:not(:disabled) { background: #dc2626; color: #fff; border-color: #dc2626; }
.detail-name-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 0 0 18px;
  padding: 14px 18px;
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(37,99,235,.18);
}
.detail-name {
  margin: 0;
  font-size: 21px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.3px;
}

/* 공통 섹션 카드 (기본/재무/PDF/업무일지/일지작성) */
.detail-info-box,
.detail-fin-box,
.detail-pdf-box,
.detail-wl-form-box,
.detail-wl-box {
  margin-top: 16px;
  padding: 0 0 16px;
  border: 1px solid #e5e9f0;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 1px 3px rgba(16,24,40,.05);
  overflow: hidden;
}
.detail-fin-box { background: #f8fbff; }

/* 섹션 헤더 — 색 바 */
.detail-section-title {
  margin: 0 0 14px;
  padding: 11px 16px;
  font-size: 14px;
  font-weight: 700;
  color: #1e3a5f;
  background: #eef4ff;
  border-bottom: 1px solid #dce6f5;
}
.detail-fin-box > .detail-section-title { background: #e8f1fd; }

/* 정보 그리드 */
.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2px 22px;
  padding: 0 16px;
}
.detail-row {
  display: flex;
  gap: 10px;
  align-items: baseline;
  padding: 8px 0;
  border-bottom: 1px solid #f0f2f6;
  font-size: 14px;
  min-width: 0;
}
.detail-label {
  min-width: 92px;
  flex-shrink: 0;
  font-weight: 600;
  color: var(--color-text-mute);
}
.detail-value {
  flex: 1;
  color: var(--color-text);
  font-weight: 500;
  word-break: break-word;
}

/* 재무 하위 소제목 */
.detail-fin-subtitle {
  margin: 14px 16px 4px;
  font-size: 13px;
  font-weight: 700;
  color: #1d4ed8;
  border-left: 3px solid #2563eb;
  padding-left: 8px;
}
.detail-fin-grid .detail-row { border-bottom-color: #e6eef8; }
.detail-fin-note {
  margin: 12px 16px 0;
  font-size: 11px;
  color: var(--color-text-mute);
}

/* 업무일지 섹션 */
.detail-wl-titlerow { display: flex; align-items: center; gap: 8px; }
.detail-wl-titlerow .detail-section-title { flex: 1; margin-bottom: 0; }
.detail-wl-count {
  margin-right: 16px;
  font-size: 12px;
  font-weight: 700;
  color: #2563eb;
  background: #dbeafe;
  padding: 2px 10px;
  border-radius: 999px;
}
.detail-wl-list { padding: 12px 16px 0; display: flex; flex-direction: column; gap: 10px; }
.detail-wl-item {
  padding: 11px 13px;
  border: 1px solid #eceff4;
  border-left: 3px solid #2563eb;
  border-radius: 8px;
  background: #fafbfd;
}
.detail-wl-item-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 5px;
}
.detail-wl-date { font-size: 13px; font-weight: 700; color: #1e3a5f; }
.detail-wl-content {
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
  color: var(--color-text);
  white-space: pre-wrap;
  word-break: break-word;
}

/* 📝 업무일지 작성 (헤더 버튼) — 주 액션이라 채워진 파랑 */
.detail-head .btn-wl-write {
  color: #fff;
  background: #2563eb;
  border: 1px solid #2563eb;
}
.detail-head .btn-wl-write:hover:not(:disabled) { background: #1d4ed8; border-color: #1d4ed8; }
/* 버튼 3개 → 좁은 화면에서 줄바꿈 허용 (헤더 깨짐 방지) */
.detail-head .detail-actions { flex-wrap: wrap; justify-content: flex-end; }

/* 상세 인라인 업무일지 작성 폼 */
.detail-wl-form-box { background: #f7fbff; border-color: #cfe0fa; }
.detail-wl-form-box > .detail-section-title { background: #e3efff; border-bottom-color: #cfe0fa; }
.detail-wl-form { padding: 0 16px; display: flex; flex-direction: column; gap: 12px; }
.detail-wl-form .form-actions { margin-top: 2px; flex-wrap: wrap; }
.detail-wl-form .btn-secondary {
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 600;
  color: #475467;
  background: #fff;
  border: 1px solid #d3d9e2;
  border-radius: 8px;
  cursor: pointer;
}
.detail-wl-form .btn-secondary:hover { background: #f4f6f9; }

/* PDF 섹션 내부 패딩 (헤더 외) */
.detail-pdf-box > .detail-pdf-info,
.detail-pdf-box > .detail-pdf-actions,
.detail-pdf-box > .form-msg,
.detail-pdf-box > .detail-pdf-placeholder,
.detail-pdf-box > input,
.detail-pdf-box > button { margin-left: 16px; margin-right: 16px; }

/* 재무 미리보기 소제목 (업체등록 파싱 결과) */
.parse-preview-subtitle {
  margin: 10px 0 4px;
  padding-top: 8px;
  border-top: 1px dashed #d4ecd9;
  font-size: 13px;
  font-weight: 700;
  color: var(--color-success);
}

/* 상세 그리드 모바일 1열 */
@media (max-width: 560px) {
  .detail-grid { grid-template-columns: 1fr; }
}

/* === 업체 색상 태그 (등록/상세 드롭다운 + 조회 점) === */
.color-select-wrap { display: flex; align-items: center; gap: 8px; }
.color-select {
  padding: 6px 10px;
  font-size: 13px;
  font-weight: 600;
  border: 1.5px solid var(--color-border);
  border-radius: 8px;
  background: #fff;
  color: #1f2937;
  cursor: pointer;
}
.color-dot {
  width: 16px; height: 16px;
  border-radius: 50%;
  border: 1px solid rgba(0,0,0,.15);
  flex-shrink: 0;
  display: inline-block;
}
/* 상세 페이지 — 파란 배너 위 색상 컨트롤 (우측) */
.detail-color-ctrl { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.detail-color-label { font-size: 12px; color: rgba(255,255,255,.9); font-weight: 600; }
.detail-color-ctrl .color-select { padding: 5px 8px; }
/* 조회 목록 — 업체명 앞 색상 점 */
.color-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-mute);
  white-space: nowrap;
  cursor: pointer;
}
.color-toggle input { cursor: pointer; }
.row-color-dot {
  width: 11px; height: 11px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 8px;
  vertical-align: middle;
  border: 1px solid rgba(0,0,0,.12);
  flex-shrink: 0;
}

/* === 업체 상세 페이지 — PDF 섹션 (Cloudflare R2 통합) === */

.detail-pdf-info {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.detail-pdf-name {
  font-weight: 500;
  color: #111827;
}

.detail-pdf-date {
  font-size: 12px;
  color: #6b7280;
}

.detail-pdf-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.detail-pdf-placeholder {
  margin: 0 0 12px;
  color: #6b7280;
  font-size: 13px;
}

/* === OAuth 로그인 (Google 버튼) === */
.oauth-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0 0 14px;
}

.btn-oauth {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 11px 14px;
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: #1f2937;
  cursor: pointer;
  transition: all .15s ease;
}
.btn-oauth:hover:not(:disabled) {
  background: #f9fafb;
  border-color: #9ca3af;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.btn-oauth:disabled { opacity: 0.6; cursor: not-allowed; }
.oauth-icon { width: 18px; height: 18px; flex-shrink: 0; }

/* === 구독 만료 임박/체험 안내 배너 === */
.subscription-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  margin: 8px 12px 0;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  font-size: 13px;
  color: #1e40af;
}
.subscription-banner.warning {
  background: #fef3c7;
  border-color: #fcd34d;
  color: #92400e;
}
.subscription-banner-icon {
  font-size: 18px;
  flex-shrink: 0;
}
.subscription-banner-text {
  flex: 1;
  line-height: 1.4;
}
.subscription-banner-close {
  background: transparent;
  border: none;
  color: inherit;
  font-size: 14px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  flex-shrink: 0;
}
.subscription-banner-close:hover {
  background: rgba(0,0,0,0.06);
}

/* 카카오 — 공식 #FEE500 노란 배경 + 검정 텍스트 (가이드라인) */
.btn-kakao {
  background: #FEE500;
  border-color: #FEE500;
  color: #3C1E1E;
}
.btn-kakao:hover:not(:disabled) {
  background: #FDD800;
  border-color: #FDD800;
  color: #3C1E1E;
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
}

.login-divider {
  position: relative;
  text-align: center;
  margin: 14px 0;
  color: #9ca3af;
  font-size: 12px;
}
.login-divider::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 0; right: 0;
  height: 1px;
  background: #e5e7eb;
}
.login-divider span {
  position: relative;
  background: #fff;
  padding: 0 12px;
}

/* === 이용권 안내 화면 (inactive-screen) === */
.panel-inactive {
  max-width: 560px;
  margin: 24px auto;
  padding: 24px 20px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
}

.inactive-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-bottom: 16px;
  border-bottom: 1px solid #f3f4f6;
}
.inactive-icon { font-size: 36px; line-height: 1; }
.inactive-title {
  margin: 0;
  font-size: 19px;
  font-weight: 600;
  color: #111827;
}

.inactive-info {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 0;
  border-bottom: 1px solid #f3f4f6;
}
.inactive-info-row {
  margin: 0;
  font-size: 14px;
  color: #374151;
}

.inactive-offer {
  padding: 14px 0;
  border-bottom: 1px solid #f3f4f6;
}
.inactive-offer-title {
  margin: 0 0 8px;
  font-size: 15px;
  font-weight: 600;
  color: #1f2937;
}
.inactive-price {
  margin: 6px 0;
  font-size: 22px;
  font-weight: 700;
  color: #2563eb;
}
.inactive-offer-desc {
  margin: 0 0 12px;
  color: #4b5563;
  font-size: 13px;
}
.inactive-steps {
  margin: 6px 0 12px;
  padding-left: 20px;
  font-size: 13px;
  color: #374151;
  line-height: 1.7;
}
.inactive-steps li { margin: 2px 0; }

.inactive-contact {
  margin-top: 8px;
  padding: 10px 12px;
  background: #f9fafb;
  border-radius: 6px;
  font-size: 14px;
}
.inactive-mail {
  color: #2563eb;
  text-decoration: none;
}
.inactive-mail:hover { text-decoration: underline; }

.inactive-actions {
  padding-top: 16px;
  display: flex;
  justify-content: center;
}

@media (max-width: 480px) {
  .panel-inactive { margin: 12px; padding: 18px 14px; }
  .inactive-title { font-size: 17px; }
  .inactive-price { font-size: 20px; }
}

/* === 헤더 프로필 아바타 + 팝오버 (v1.1) === */
.topbar { position: relative; } /* 팝오버 기준점 */

.topbar-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  background-color: rgba(255, 255, 255, 0.25);
  background-size: cover;
  background-position: center;
  border: 1.5px solid rgba(255, 255, 255, 0.7);
  cursor: pointer;
  user-select: none;
  transition: transform 0.1s, box-shadow 0.1s;
}
.topbar-avatar:hover { transform: scale(1.06); box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.2); }
.topbar-avatar:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.topbar-avatar.has-photo { background-color: transparent; }

.profile-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 12px;
  z-index: 50;
  width: 240px;
  background: var(--color-card);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 18px 16px 16px;
  text-align: center;
}
.profile-popover[hidden] { display: none; }
.profile-popover-photo {
  width: 64px;
  height: 64px;
  margin: 0 auto 10px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  font-weight: 700;
  color: #fff;
  background-color: var(--color-primary);
  background-size: cover;
  background-position: center;
}
.profile-popover-photo.has-photo { background-color: transparent; }
.profile-popover-name { font-size: 15px; font-weight: 700; }
.profile-popover-email { font-size: 12px; color: var(--color-text-mute); margin-top: 2px; word-break: break-all; }
.profile-popover-provider { font-size: 12px; color: var(--color-text-mute); margin-top: 8px; }
.profile-popover-subscription {
  margin-top: 12px;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--color-primary-dark);
  background: #eff4ff;
  border: 1px solid #cdddff;
}
.profile-popover-subscription:empty { display: none; }
.profile-popover-subscription.warn {
  color: #b45309;
  background: #fff7ed;
  border-color: #fed7aa;
}
.profile-popover-actions { margin-top: 12px; }
.btn-photo-change {
  width: 100%;
  padding: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-primary-dark);
  background: #fff;
  border: 1.5px solid var(--color-primary);
  border-radius: 8px;
  cursor: pointer;
}
.btn-photo-change:hover:not(:disabled) { background: #eef4ff; }
.btn-photo-change:disabled { opacity: 0.6; cursor: not-allowed; }

/* === 로그인 페이지: 세션 확인 중 로그인 카드 숨김 (이미 로그인 시 구글 선택창 오노출 방지) === */
.login-page.auth-checking .login-card { visibility: hidden; }

/* === 사용품목 (v1.1) — 5번째 탭 + 상세 품목 편집 === */
/* 5개 탭이 좁은 화면에서 겹치지 않게 축소 */
@media (max-width: 480px) {
  .tab-icon { font-size: 19px; }
  .tab-label { font-size: 11px; }
  .tab-btn { padding-left: 2px; padding-right: 2px; }
}

/* 사용품목 검색 탭 */
.items-hint { color: var(--color-text-mute); font-size: 13px; margin: 0 0 12px; }
.items-toolbar .search-input { min-width: 0; }

/* 상세 페이지 — 사용 품목 편집 섹션 */
.detail-items-box { margin-top: 18px; }
.detail-items-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.detail-items-empty { color: var(--color-text-mute); font-size: 13px; margin: 4px 0; }
.detail-items-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 8px;
}
.detail-items-text { font-size: 14px; color: var(--color-text); word-break: break-all; }
.detail-items-del {
  flex: 0 0 auto;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 15px;
  padding: 2px 6px;
  border-radius: 6px;
}
.detail-items-del:hover { background: rgba(220, 38, 38, 0.1); }
.detail-items-add { display: flex; gap: 6px; flex-wrap: wrap; }
.detail-items-add .item-in {
  flex: 1 1 90px;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  font-size: 14px;
}
.detail-items-add .btn-secondary { flex: 0 0 auto; white-space: nowrap; }

/* 상세 페이지 — 담당자/명함 섹션 (v1.3, 품목 섹션 스타일 재사용 + 추가 규칙) */
.detail-contacts-box { margin-top: 18px; }
.detail-contact-row { flex-wrap: wrap; }
.detail-contact-name { font-weight: 600; }
.detail-contact-tel { color: var(--color-primary, #2a5776); text-decoration: none; white-space: nowrap; }
.detail-contact-tel:hover { text-decoration: underline; }
.detail-contact-btns { display: flex; align-items: center; gap: 4px; flex: 0 0 auto; }
.btn-mini {
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  cursor: pointer;
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 6px;
  white-space: nowrap;
}
.btn-mini:hover { background: rgba(42, 87, 118, 0.08); }
.btn-mini-danger { color: #dc2626; border-color: rgba(220, 38, 38, 0.4); }
.btn-mini-danger:hover { background: rgba(220, 38, 38, 0.08); }

/* 담당자 명함 드롭존 (v1.3.1 — 업체등록 PDF 드롭존 축소판) */
.card-dropzone {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  padding: 12px 14px;
  border: 2px dashed var(--color-border);
  border-radius: 10px;
  background: #f4f7fb;
  cursor: pointer;
  user-select: none;
}
.card-dropzone:hover,
.card-dropzone:focus { background: #e3edff; outline: none; }
.card-dropzone.drag-over { background: #dbeafe; border-color: var(--color-primary, #2a5776); }
.card-dropzone.has-file { border-style: solid; border-color: #16a34a; background: #f0fdf4; }
.card-dropzone-icon { font-size: 20px; line-height: 1; flex: 0 0 auto; }
.card-dropzone-text { font-size: 13px; color: var(--color-text-mute); flex: 1 1 auto; word-break: break-all; }
.card-dropzone.has-file .card-dropzone-text { color: var(--color-text); }
.card-dropzone-clear {
  flex: 0 0 auto;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 14px;
  padding: 2px 6px;
  border-radius: 6px;
  color: #dc2626;
}
.detail-contact-addbtn { margin-top: 8px; }

/* === 이메일 입력 강제 화면 (카카오 등 이메일 미보유) === */
.panel-email-required { max-width: 460px; margin: 48px auto; text-align: center; }
.email-required-desc { color: var(--color-text-mute); font-size: 14px; line-height: 1.65; margin: 8px 0 22px; }
.email-required-form { display: flex; flex-direction: column; gap: 12px; align-items: stretch; }
.email-required-input {
  padding: 12px 14px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  font-size: 15px;
  text-align: center;
}
.email-required-form .btn-primary { padding: 12px; font-size: 15px; }
