:root {
  --bg: #f4f6fb;
  --card: #ffffff;
  --ink: #1a2233;
  --ink-soft: #5b6577;
  --line: #e4e8f0;
  --brand: #3b5bfd;
  --brand-soft: #eaeefe;
  --shadow: 0 1px 3px rgba(20, 30, 60, .06), 0 6px 20px rgba(20, 30, 60, .06);
  --radius: 14px;
}

* { box-sizing: border-box; }

/* hidden 속성은 항상 우선 적용 (display:flex 등이 덮어쓰지 않도록) */
[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: "Noto Sans KR", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

/* ===== Topbar ===== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, .85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.logo { font-size: 20px; font-weight: 900; margin: 0; }
.topbar-actions { display: flex; gap: 8px; }

/* ===== Buttons ===== */
.btn {
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 9px 16px;
  cursor: pointer;
  transition: .15s;
}
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: #2a47e0; }
.btn-ghost { background: #fff; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: var(--bg); }
.btn-accent { background: #0fb37a; color: #fff; }
.btn-accent:hover { background: #0a9967; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ===== Layout ===== */
.container { max-width: 1180px; margin: 0 auto; padding: 24px 20px 80px; }

/* ===== Stats ===== */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 22px;
}
.stat-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
}
.stat-num { font-size: 28px; font-weight: 900; line-height: 1; }
.stat-label { font-size: 13px; color: var(--ink-soft); margin-top: 6px; }

/* ===== Controls ===== */
.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 20px;
}
.search-input {
  flex: 1 1 240px;
  min-width: 200px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
}
.search-input:focus, .sort-select:focus { outline: 2px solid var(--brand-soft); border-color: var(--brand); }
.filter-group { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  font-size: 13px;
  font-weight: 500;
  padding: 7px 13px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #fff;
  cursor: pointer;
  color: var(--ink-soft);
  transition: .15s;
}
.chip.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.sort-select {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
  cursor: pointer;
}

/* ===== Card grid ===== */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 16px;
}
.job-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: relative;
  transition: .15s;
}
.job-card:hover { transform: translateY(-2px); box-shadow: 0 8px 28px rgba(20,30,60,.12); }

.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.card-company { font-size: 18px; font-weight: 900; margin: 0; }
.card-position { font-size: 14px; color: var(--ink-soft); margin: 2px 0 0; }

.status-badge {
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 20px;
  white-space: nowrap;
}
.st-관심 { background: #eef1f6; color: #5b6577; }
.st-지원예정 { background: #fff3d6; color: #9a6b00; }
.st-지원완료 { background: #dbe6ff; color: #1f49c2; }
.st-서류합격 { background: #d6f5e3; color: #1a7a45; }
.st-면접 { background: #e7dcff; color: #6a3bce; }
.st-최종합격 { background: #c9f7d2; color: #0f7a2e; }
.st-불합격 { background: #ffe0e0; color: #b53030; }

.deadline-tag { font-size: 13px; color: var(--ink-soft); }
.deadline-tag.urgent { color: #d23030; font-weight: 700; }

/* 직무 요약 + 기술 칩 */
.job-summary {
  font-size: 13px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  border-radius: 10px;
  padding: 10px 12px;
}
.tag-group { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.tag-label { font-size: 11px; font-weight: 700; color: var(--ink-soft); }
.tag-row { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  font-size: 12px;
  font-weight: 500;
  padding: 4px 9px;
  border-radius: 7px;
  white-space: nowrap;
}
.tag-skill { background: #e3f0ff; color: #1f49c2; }
.tag-pref { background: #eef6e8; color: #3f7a26; }

/* 종합 정보 그리드 */
.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.info-box {
  background: var(--bg);
  border-radius: 10px;
  padding: 10px 12px;
}
.info-box .ib-label { font-size: 11px; color: var(--ink-soft); display: flex; align-items: center; gap: 4px; }
.info-box .ib-value { font-size: 15px; font-weight: 700; margin-top: 3px; }
.info-box .ib-sub { font-size: 12px; color: var(--ink-soft); margin-top: 2px; line-height: 1.45; }

.rating-stars { color: #f5a623; }

.card-memo {
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.5;
  background: #fffdf5;
  border: 1px dashed #f0e2b8;
  border-radius: 8px;
  padding: 8px 10px;
  white-space: pre-wrap;
}

.card-links { display: flex; flex-wrap: wrap; gap: 8px; }
.link-pill {
  font-size: 12px;
  font-weight: 500;
  text-decoration: none;
  color: var(--brand);
  background: var(--brand-soft);
  padding: 5px 10px;
  border-radius: 8px;
}
.link-pill:hover { background: #dbe2fe; }

.card-foot { display: flex; gap: 8px; border-top: 1px solid var(--line); padding-top: 12px; margin-top: auto; }
.icon-btn {
  flex: 1;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px;
  cursor: pointer;
  color: var(--ink-soft);
}
.icon-btn:hover { background: var(--bg); color: var(--ink); }
.icon-btn.danger:hover { background: #ffecec; color: #b53030; border-color: #ffc9c9; }

/* ===== Empty ===== */
.empty-state { text-align: center; padding: 80px 20px; color: var(--ink-soft); }
.empty-emoji { font-size: 54px; margin: 0; }
.empty-title { font-size: 18px; font-weight: 700; color: var(--ink); margin: 14px 0 6px; }
.empty-desc { font-size: 14px; line-height: 1.6; }

/* ===== Modal ===== */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(20, 30, 60, .45);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 40px 16px;
  z-index: 100;
  overflow-y: auto;
}
.modal {
  background: #fff;
  border-radius: 16px;
  width: 100%;
  max-width: 620px;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
.modal-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--line);
}
.modal-head h2 { margin: 0; font-size: 19px; font-weight: 900; }
.modal-close { background: none; border: none; font-size: 20px; cursor: pointer; color: var(--ink-soft); }
.modal-body { padding: 20px 24px; }

.field-section { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px 16px; margin: 0 0 16px; }
.field-section legend { font-size: 14px; font-weight: 700; padding: 0 6px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.field:last-child { margin-bottom: 0; }
.field > span { font-size: 13px; font-weight: 500; color: var(--ink-soft); }
.field input, .field select, .field textarea {
  font-family: inherit;
  font-size: 14px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  color: var(--ink);
  resize: vertical;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: 2px solid var(--brand-soft); border-color: var(--brand);
}
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 4px; }

/* ===== Screenshot overlay / spinner ===== */
.overlay {
  position: fixed; inset: 0;
  background: rgba(20, 30, 60, .55);
  display: flex; align-items: center; justify-content: center;
  z-index: 200;
}
.overlay-box {
  background: #fff;
  border-radius: 16px;
  padding: 32px 40px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
.spinner {
  width: 42px; height: 42px;
  border: 4px solid var(--line);
  border-top-color: var(--brand);
  border-radius: 50%;
  margin: 0 auto 16px;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.overlay-text { font-size: 16px; font-weight: 700; margin: 0; }
.overlay-sub { font-size: 13px; color: var(--ink-soft); margin: 6px 0 0; }

/* ===== Screenshot hint toast ===== */
.shot-hint {
  position: fixed;
  bottom: 24px; left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  font-size: 14px;
  padding: 12px 16px;
  border-radius: 12px;
  box-shadow: 0 8px 28px rgba(0,0,0,.3);
  z-index: 150;
  display: flex; align-items: center; gap: 12px;
  max-width: 92vw;
}
.shot-hint.dragover { outline: 3px dashed #0fb37a; outline-offset: 3px; }
.hint-link {
  background: #0fb37a; color: #fff; border: none;
  font-family: inherit; font-size: 13px; font-weight: 700;
  padding: 6px 12px; border-radius: 8px; cursor: pointer;
}
.hint-close { background: none; border: none; color: #fff; cursor: pointer; font-size: 15px; opacity: .8; }

@media (max-width: 560px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .topbar-actions .btn { padding: 9px 11px; }
}
