:root {
  --bg: #f6f5f0;
  --surface: #ffffff;
  --surface-2: #f0f6f4;
  --ink: #172426;
  --muted: #667477;
  --line: #d9dfdc;
  --teal: #0f766e;
  --teal-soft: #d7ebe6;
  --coral: #c94f4f;
  --berry: #8f3f71;
  --amber: #bd7b18;
  --blue: #3158a4;
  --green: #567a45;
  --shadow: 0 16px 40px rgba(23, 36, 38, 0.11);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family:
    Inter, "Avenir Next", "Helvetica Neue", Arial, "PingFang SC",
    "Microsoft YaHei", sans-serif;
  line-height: 1.55;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  display: block;
  max-width: 100%;
}

button,
input,
select {
  font: inherit;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 68px;
  border-bottom: 1px solid rgba(23, 36, 38, 0.1);
  background: rgba(246, 245, 240, 0.92);
  padding: 12px clamp(18px, 4vw, 42px);
  backdrop-filter: blur(16px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  display: inline-grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-size: 22px;
  font-weight: 900;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 16px;
  line-height: 1.15;
}

.brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  white-space: nowrap;
}

.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  padding: 7px 11px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.live-pill::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--amber);
}

.live-pill.is-live::before {
  background: var(--teal);
}

.live-pill.is-error::before {
  background: var(--coral);
}

.text-link {
  color: var(--teal);
  font-size: 13px;
  font-weight: 800;
}

.text-button {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--teal);
  cursor: pointer;
  padding: 7px 11px;
  font-size: 13px;
  font-weight: 800;
}

.text-button:hover {
  border-color: rgba(15, 118, 110, 0.35);
  background: var(--teal-soft);
}

.app-shell {
  padding: 24px clamp(18px, 4vw, 42px) 42px;
}

.control-band {
  display: grid;
  grid-template-columns: minmax(280px, 0.8fr) minmax(420px, 1.2fr);
  gap: 26px;
  align-items: stretch;
  border-bottom: 1px solid var(--line);
  padding-bottom: 24px;
}

.control-copy {
  max-width: 700px;
}

.kicker {
  margin: 0 0 8px;
  color: var(--berry);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 12px;
  font-size: clamp(28px, 4vw, 52px);
  line-height: 1.05;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 10px;
  font-size: 22px;
  line-height: 1.2;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 12px;
  font-size: 23px;
  line-height: 1.22;
  letter-spacing: 0;
}

.control-copy p:not(.kicker) {
  max-width: 660px;
  color: var(--muted);
  font-size: 15px;
}

.filters {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 12px;
  align-content: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 16px;
  box-shadow: 0 1px 0 rgba(23, 36, 38, 0.04);
}

.filters label {
  position: relative;
  display: grid;
  gap: 6px;
  min-width: 0;
}

.filters datalist {
  display: none;
}

.filters span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.filters input,
.filters select {
  min-height: 42px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  padding: 8px 10px;
  outline: none;
}

.filters input:focus,
.filters select:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.13);
}

.suggestion-box {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  left: 0;
  z-index: 30;
  overflow-y: auto;
  max-height: 360px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

.suggestion-box button {
  display: block;
  width: 100%;
  border: 0;
  border-bottom: 1px solid rgba(217, 223, 220, 0.72);
  background: transparent;
  padding: 9px 11px;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
}

.suggestion-box button:hover {
  background: var(--surface-2);
  color: var(--teal);
}

.score-filter {
  grid-column: span 2;
}

.refresh-button {
  align-self: end;
}

.score-filter input {
  padding: 0;
  accent-color: var(--teal);
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  border: 0;
  border-radius: 7px;
  background: var(--ink);
  color: #fff;
  cursor: pointer;
  font-weight: 900;
}

.icon-button[disabled] {
  cursor: wait;
  opacity: 0.6;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(270px, 350px) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
  padding-top: 24px;
}

.side-panel {
  position: sticky;
  top: 92px;
  display: grid;
  gap: 16px;
  max-height: calc(100vh - 116px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 6px;
  scrollbar-gutter: stable;
}

.side-panel::-webkit-scrollbar {
  width: 8px;
}

.side-panel::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(23, 36, 38, 0.18);
}

.panel-visual {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 8px;
  border: 1px solid var(--line);
  object-fit: cover;
  background: var(--surface);
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.stat-grid div,
.profile-box,
.source-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.stat-grid div {
  padding: 12px;
}

.stat-grid strong {
  display: block;
  font-size: 26px;
  line-height: 1;
}

.stat-grid span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.profile-box,
.source-box {
  padding: 15px;
}

.profile-box p {
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 13px;
}

.profile-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.profile-tags span {
  border-radius: 999px;
  background: var(--teal-soft);
  padding: 5px 8px;
  color: #27584f;
  font-size: 12px;
  font-weight: 900;
}

code {
  overflow: hidden;
  border-radius: 5px;
  background: var(--surface-2);
  padding: 4px 6px;
  color: var(--teal);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 11px;
  text-overflow: ellipsis;
}

.source-list {
  display: grid;
  gap: 7px;
  max-height: 360px;
  overflow: auto;
  overscroll-behavior: contain;
  padding-right: 4px;
  scroll-behavior: smooth;
  scrollbar-width: thin;
}

.source-audit {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
  padding: 10px;
}

.source-audit[hidden] {
  display: none;
}

.source-audit-title,
.audit-metrics {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.source-audit-title strong,
.source-audit a {
  color: var(--ink);
  font-weight: 900;
}

.source-audit-title span {
  border-radius: 999px;
  background: var(--teal-soft);
  padding: 2px 7px;
  color: var(--teal);
  font-size: 11px;
  font-weight: 900;
}

.audit-metrics span {
  color: var(--muted);
  font-size: 11px;
}

.audit-metrics b {
  color: var(--ink);
}

.source-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  border-bottom: 1px solid rgba(217, 223, 220, 0.7);
  padding-bottom: 7px;
  color: var(--muted);
  font-size: 12px;
}

.source-row strong {
  color: var(--ink);
  font-weight: 800;
}

.source-row span:last-child {
  border-radius: 999px;
  background: var(--surface-2);
  padding: 2px 7px;
  color: var(--teal);
  font-weight: 900;
}

.lead-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.lead-links b {
  width: 100%;
  color: var(--ink);
}

.lead-links a {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  padding: 5px 9px;
  color: var(--teal);
  font-size: 12px;
  font-weight: 900;
}

.feed-column {
  min-width: 0;
}

.favorites-section {
  margin-bottom: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  padding: 16px;
  box-shadow: 0 1px 0 rgba(23, 36, 38, 0.04);
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.section-heading h2 {
  margin: 2px 0 0;
}

.favorite-grid {
  display: grid;
  gap: 14px;
}

.favorite-empty {
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fbfcfa;
  padding: 18px;
  color: var(--muted);
  font-size: 14px;
}

.feed-toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.feed-toolbar h2 {
  margin: 0;
}

.ranking-note {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.timestamp {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.feed {
  display: grid;
  gap: 13px;
}

.job-card {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 16px;
  box-shadow: 0 1px 0 rgba(23, 36, 38, 0.04);
}

.job-card:hover {
  border-color: rgba(15, 118, 110, 0.55);
  box-shadow: var(--shadow);
}

.job-score {
  display: grid;
  align-content: start;
  gap: 6px;
  min-height: 76px;
  border-left: 5px solid var(--teal);
  background: var(--teal-soft);
  padding: 10px;
}

.job-score strong {
  font-size: 26px;
  line-height: 1;
}

.job-score span {
  color: #27584f;
  font-size: 12px;
  font-weight: 900;
}

.job-topline {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.job-topline span {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: var(--surface-2);
  padding: 3px 8px;
}

.company-head {
  display: grid;
  grid-template-columns: 50px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.company-logo-link {
  display: grid;
  overflow: hidden;
  width: 52px;
  height: 52px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbf8;
}

.company-logo {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 8px;
}

.company-logo-fallback {
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
  background:
    linear-gradient(135deg, rgba(22, 126, 112, 0.12), rgba(255, 244, 228, 0.75));
  color: var(--ink);
  font-size: 10px;
  font-weight: 950;
  letter-spacing: 0;
  line-height: 1.05;
  overflow-wrap: anywhere;
  padding: 6px;
  text-align: center;
}

.company-identity {
  min-width: 0;
}

.company-eyebrow {
  display: block;
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.company-name {
  display: inline-block;
  color: var(--ink);
  font-size: 18px;
  font-weight: 950;
  line-height: 1.15;
}

.company-name:hover {
  color: var(--teal);
}

.origin-badge {
  flex: 0 0 auto;
  border-radius: 999px;
  background: #eaf1ff;
  padding: 5px 10px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.job-title {
  margin-bottom: 8px;
  font-size: clamp(22px, 2.4vw, 31px);
  line-height: 1.16;
}

.job-main h3 a {
  color: var(--ink);
}

.job-main h3 a:hover {
  color: var(--teal);
}

.job-meta {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.job-meta div {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fbfcfa;
  padding: 9px;
}

.job-meta span,
.job-meta strong {
  display: block;
}

.job-meta span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.job-meta strong {
  overflow: hidden;
  margin-top: 2px;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tag-group {
  display: grid;
  gap: 6px;
  margin-bottom: 10px;
}

.tag-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  border-radius: 999px;
  background: #fff4e4;
  padding: 3px 8px;
  color: #724200;
  font-size: 12px;
  font-weight: 800;
}

.job-insight {
  display: grid;
  gap: 7px;
  margin-bottom: 12px;
  border-left: 4px solid rgba(22, 126, 112, 0.3);
  background: #f8fbf8;
  padding: 10px 12px;
}

.job-insight p {
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr);
  gap: 9px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.job-insight strong {
  color: var(--green);
  font-weight: 950;
}

.jd-panel {
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}

.jd-panel summary {
  cursor: pointer;
  padding: 8px 10px;
  color: var(--blue);
  font-size: 13px;
  font-weight: 900;
}

.jd-summary-grid {
  display: grid;
  gap: 14px;
  max-height: 340px;
  overflow: auto;
  margin: 0;
  border-top: 1px solid var(--line);
  padding: 12px;
}

.jd-language-section {
  display: grid;
  gap: 7px;
}

.jd-language-section h4 {
  margin: 0;
  color: var(--ink);
  font-size: 13px;
}

.jd-language-section ul {
  display: grid;
  gap: 7px;
  margin: 0;
  padding-left: 20px;
}

.jd-language-section li {
  color: var(--ink);
  font-size: 13px;
  line-height: 1.45;
}

.jd-empty-note {
  color: var(--muted);
  font-size: 13px;
}

.keyword-mark {
  border-radius: 4px;
  background: #fff0bf;
  padding: 0 3px;
  color: #6c4700;
  font-weight: 900;
}

.job-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.apply-link,
.favorite-button {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  border-radius: 7px;
  padding: 7px 11px;
  font-size: 13px;
  font-weight: 900;
}

.apply-link {
  background: var(--teal);
  color: #fff;
}

.favorite-button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--teal);
  cursor: pointer;
}

.favorite-button.is-saved {
  border-color: rgba(15, 118, 110, 0.25);
  background: var(--teal-soft);
  color: #27584f;
}

.empty-state,
.loading-state {
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.62);
  padding: 28px;
  color: var(--muted);
}

.empty-state strong,
.loading-state strong {
  display: block;
  margin-bottom: 6px;
  color: var(--ink);
  font-size: 18px;
}

.loading-state span,
.loading-state em {
  display: block;
}

.loading-state em {
  margin-top: 8px;
  color: var(--teal);
  font-style: normal;
  font-weight: 900;
}

.progress-track {
  overflow: hidden;
  width: min(520px, 100%);
  height: 9px;
  margin-top: 16px;
  border-radius: 999px;
  background: var(--line);
}

.progress-track div {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: var(--teal);
  transition: width 0.45s ease;
}

.back-top {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 35;
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid rgba(23, 36, 38, 0.12);
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  box-shadow: var(--shadow);
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
  font-size: 18px;
  font-weight: 900;
}

.back-top.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

@media (max-width: 1120px) {
  .control-band,
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .side-panel {
    position: static;
    grid-template-columns: 220px 1fr;
    align-items: start;
    max-height: none;
    overflow: visible;
    padding-right: 0;
  }

  .source-box {
    grid-column: 1 / -1;
  }

  .filters {
    grid-template-columns: repeat(2, minmax(160px, 1fr));
  }

  .job-meta {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .app-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .header-actions {
    width: 100%;
    justify-content: space-between;
  }

  .filters {
    grid-template-columns: 1fr;
  }

  .score-filter {
    grid-column: auto;
  }

  .side-panel {
    grid-template-columns: 1fr;
  }

  .job-card {
    grid-template-columns: 1fr;
  }

  .job-score {
    grid-template-columns: auto 1fr;
    align-items: end;
    min-height: 0;
  }

  .company-head {
    grid-template-columns: 46px minmax(0, 1fr);
    align-items: center;
  }

  .origin-badge {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .job-meta {
    grid-template-columns: 1fr;
  }
}
