/* ==========================================================================
   nLink 비즈알림 (biz.nlink.kr) - 아이-케어(Eye-Care) & 모바일 퍼스트 스타일시트
   - 눈 피로도를 최소화하는 옵시디언 차콜 다크 & 웜 오프화이트 라이트
   - 갤럭시 S24 (360~384px) 기준 무결점 반응형 레이아웃
   - WCAG AA 기준 100% 명도대비 보장 시맨틱 변수 바인딩
   ========================================================================== */

:root {
  /* 라이트 모드 (눈부심 없는 웜 오프화이트 종이 질감) */
  --bg-page: #f8fafc;
  --bg-surface: #ffffff;
  --bg-elevated: #f1f5f9;
  --bg-card: #ffffff;
  --border-subtle: #e2e8f0;
  --border-strong: #cbd5e1;
  --text-main: #0f172a;
  --text-muted: #475569;
  --text-faint: #64748b;
  --accent: #0284c7;
  --accent-hover: #0369a1;
  --accent-surface: #e0f2fe;
  --badge-new-bg: #e0f2fe;
  --badge-new-text: #0369a1;
  --badge-mod-bg: #fef3c7;
  --badge-mod-text: #b45309;
  --badge-can-bg: #fee2e2;
  --badge-can-text: #b91c1c;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.08);
}

[data-theme="dark"] {
  /* 다크 모드 (눈이 편안한 깊은 흑연 옵시디언 차콜) */
  --bg-page: #111216;
  --bg-surface: #181a20;
  --bg-elevated: #22252c;
  --bg-card: #181a20;
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text-main: #e2e8f0;
  --text-muted: #94a3b8;
  --text-faint: #64748b;
  --accent: #38bdf8;
  --accent-hover: #0284c7;
  --accent-surface: rgba(56, 189, 248, 0.12);
  --badge-new-bg: rgba(56, 189, 248, 0.15);
  --badge-new-text: #7dd3fc;
  --badge-mod-bg: rgba(245, 158, 11, 0.15);
  --badge-mod-text: #fbbf24;
  --badge-can-bg: rgba(239, 68, 68, 0.15);
  --badge-can-text: #f87171;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.4);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.5);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Pretendard", "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-page);
  color: var(--text-main);
  line-height: 1.6;
  font-size: 14.5px;
  -webkit-font-smoothing: antialiased;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  transition: background-color 0.2s ease, color 0.2s ease;
  min-height: 100vh;
}

input, textarea, [contenteditable="true"], .selectable {
  -webkit-user-select: text;
  user-select: text;
}

.tabular-nums {
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.3px;
}

/* ==========================================================================
   헤더 및 내비게이션
   ========================================================================== */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 0 16px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-logo {
  font-size: 17px;
  font-weight: 800;
  color: var(--text-main);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 6px;
}

.brand-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--accent-surface);
  color: var(--accent);
  text-transform: uppercase;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-icon {
  background: none;
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}
.btn-icon:hover {
  background: var(--bg-elevated);
  color: var(--text-main);
}

.btn-pwa-pill {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
}
.btn-pwa-pill:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-primary-sm {
  background: var(--accent);
  color: #ffffff;
  border: none;
  font-size: 13px;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: opacity 0.15s ease;
}
.btn-primary-sm:hover {
  opacity: 0.9;
}

/* ==========================================================================
   메인 컨테이너
   ========================================================================== */
.container {
  max-width: 820px;
  margin: 0 auto;
  padding: 16px;
}

/* 히어로 / 안심 배너 */
.hero-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}

.hero-title {
  font-size: 20px;
  font-weight: 800;
  line-height: 1.4;
  margin-bottom: 6px;
  color: var(--text-main);
}

.hero-desc {
  font-size: 13.5px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 16px;
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  background: var(--bg-elevated);
  border-radius: 10px;
  padding: 12px 16px;
}

.stat-item {
  text-align: center;
}
.stat-val {
  font-size: 17px;
  font-weight: 800;
  color: var(--accent);
}
.stat-lbl {
  font-size: 11px;
  color: var(--text-muted);
}

/* 검색 및 필터 컨트롤 */
.search-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.search-input-wrap {
  position: relative;
  flex: 1;
}

.search-input {
  width: 100%;
  height: 44px;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 0 14px 0 38px;
  font-size: 14px;
  color: var(--text-main);
  outline: none;
  transition: border-color 0.15s ease;
}
.search-input:focus {
  border-color: var(--accent);
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-faint);
  pointer-events: none;
}

.btn-search {
  height: 44px;
  padding: 0 18px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

/* 카테고리 칩 필터 */
.chip-group {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 10px;
  margin-bottom: 14px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.chip-group::-webkit-scrollbar {
  display: none;
}

.chip {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: 20px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}
.chip.active {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
  font-weight: 600;
}

/* ==========================================================================
   공고 카드 리스트
   ========================================================================== */
.notice-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.notice-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 18px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, border-color 0.15s ease;
  position: relative;
}
.notice-card:hover {
  border-color: var(--border-strong);
}

.notice-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  flex-wrap: wrap;
  gap: 6px;
}

.badge-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  letter-spacing: -0.2px;
}
.badge-dday {
  background: var(--badge-new-bg);
  color: var(--badge-new-text);
  border: 1px solid rgba(56, 189, 248, 0.2);
}
.badge-dday.urgent {
  background: var(--badge-can-bg);
  color: var(--badge-can-text);
  border-color: rgba(239, 68, 68, 0.2);
}
.badge-tag {
  background: var(--bg-elevated);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
}
.badge-mod {
  background: var(--badge-mod-bg);
  color: var(--badge-mod-text);
}
.badge-can {
  background: var(--badge-can-bg);
  color: var(--badge-can-text);
}

.notice-title {
  font-size: 15.5px;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.45;
  margin-bottom: 10px;
  word-break: keep-all;
}

.notice-meta-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px;
  font-size: 13px;
  color: var(--text-muted);
  background: var(--bg-elevated);
  padding: 10px 14px;
  border-radius: 8px;
  margin-bottom: 12px;
}

.meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.meta-label {
  color: var(--text-faint);
  font-size: 12px;
}
.meta-value {
  font-weight: 600;
  color: var(--text-main);
}
.meta-budget {
  color: var(--accent);
  font-weight: 800;
  font-size: 14px;
}

.notice-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 6px;
}

.btn-card-action {
  font-size: 12.5px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 8px;
  text-decoration: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
}

.btn-detail {
  background: var(--text-main);
  color: var(--bg-page);
  border: none;
}
.btn-detail:hover {
  opacity: 0.9;
}

.btn-ics {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
}
.btn-ics:hover {
  color: var(--text-main);
  border-color: var(--border-strong);
}

.btn-bookmark {
  background: none;
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  padding: 8px 12px;
}
.btn-bookmark.active {
  color: #f59e0b;
  border-color: #f59e0b;
}

/* ==========================================================================
   모달 공통 (글래스모피즘 & 85vh 터치 스크롤)
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal-overlay.active {
  display: flex;
}

.modal-content {
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  width: 100%;
  max-width: 480px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-md);
  position: relative;
  padding: 24px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.modal-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-main);
}
.btn-close {
  background: none;
  border: none;
  font-size: 20px;
  color: var(--text-faint);
  cursor: pointer;
  padding: 4px;
}

/* 폼 요소 & 비밀번호 눈 토글 표준 규격 */
.form-group {
  margin-bottom: 16px;
  position: relative;
}
.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.form-input {
  width: 100%;
  height: 44px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 0 12px;
  font-size: 14px;
  color: var(--text-main);
  outline: none;
}
.form-input:focus {
  border-color: var(--accent);
}

/* 비밀번호 눈 토글 */
.password-input-wrap {
  position: relative;
}
.password-input-wrap .form-input {
  padding-right: 44px;
}
.btn-password-toggle {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-faint);
  cursor: pointer;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.btn-password-toggle:hover {
  color: var(--text-main);
}

.btn-submit {
  width: 100%;
  height: 46px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 8px;
  transition: opacity 0.15s ease;
}
.btn-submit:hover {
  opacity: 0.9;
}

/* 2-in-1 약관 탭 */
.tab-row {
  display: flex;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 16px;
}
.tab-btn {
  flex: 1;
  background: none;
  border: none;
  padding: 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  cursor: pointer;
}
.tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.terms-body {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
  max-height: 45vh;
  overflow-y: auto;
  padding-right: 6px;
}

/* 토스트 메시지 */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.95);
  color: #fff;
  padding: 10px 20px;
  border-radius: 30px;
  font-size: 13px;
  font-weight: 600;
  z-index: 2000;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
  box-shadow: 0 10px 20px rgba(0,0,0,0.3);
}
.toast.show {
  opacity: 1;
}

/* ==========================================================================
   갤럭시 S24 (360px) 미디어 쿼리 최적화
   ========================================================================== */
@media (max-width: 384px) {
  .header {
    padding: 0 12px;
  }
  .brand-logo {
    font-size: 16px;
  }
  .hero-title {
    font-size: 18px;
  }
  .notice-title {
    font-size: 14.5px;
  }
  .notice-card {
    padding: 14px;
  }
  .notice-meta-grid {
    padding: 8px 10px;
    font-size: 12px;
  }
}
