:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --ink: #1c232c;
  --muted: #68717d;
  --line: #e2e6eb;
  --accent: #0e9b72;
  --accent-strong: #0a7c5b;
  --accent-soft: #e7f6f0;
  --warn: #c16a21;
  --warn-soft: #fdf1e5;
  --danger: #c8423d;
  --danger-soft: #fdecea;
  --info: #2f6db8;
  --info-soft: #eaf1fa;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.05);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.55;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow);
}

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

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border-radius: 8px;
  background: var(--accent);
  color: #ffffff;
  font-size: 20px;
  font-weight: 800;
}

.brand h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.2;
}

.brand p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 7px;
  font-weight: 600;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.btn svg {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
}

.btn.primary {
  background: var(--accent);
  color: #ffffff;
}

.btn.primary:hover {
  background: var(--accent-strong);
}

.btn.primary:disabled {
  opacity: 0.7;
  cursor: wait;
}

.btn.ghost {
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink);
}

.btn.ghost:hover {
  border-color: #c9d0d8;
  background: #fafbfc;
}

.btn.ghost.active {
  background: var(--accent-soft);
  border-color: #b9e3d3;
  color: var(--accent-strong);
}

.stats {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 10px;
  margin: 18px 24px 0;
}

.stat {
  min-width: 0;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.stat span {
  display: block;
  font-size: 22px;
  font-weight: 750;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stat small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin: 14px 24px 0;
  padding: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.tabs {
  display: inline-flex;
  padding: 3px;
  background: #eef0f3;
  border-radius: 8px;
}

.tab {
  min-height: 30px;
  padding: 0 14px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
}

.tab.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.08);
}

.view-tabs {
  display: flex;
  width: fit-content;
  gap: 4px;
  margin: 14px 24px 0;
  padding: 4px;
  background: #e9edf1;
  border-radius: 9px;
}

.view-tab {
  min-height: 34px;
  padding: 0 18px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-weight: 650;
}

.view-tab.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(16, 24, 40, 0.1);
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1 1 220px;
  min-width: 200px;
  max-width: 380px;
}

.search-box svg {
  position: absolute;
  left: 11px;
  width: 16px;
  height: 16px;
  color: var(--muted);
  pointer-events: none;
}

.search-box input {
  width: 100%;
  min-height: 36px;
  padding: 0 12px 0 34px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--ink);
  outline: none;
}

.search-box input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(14, 155, 114, 0.14);
}

.toolbar select {
  min-height: 36px;
  padding: 0 30px 0 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--ink);
  outline: none;
}

.hidden {
  display: none !important;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 14px;
  align-items: start;
  margin: 14px 24px 28px;
}

.table-panel,
.history-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.table-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--line);
}

.table-meta h2,
.history-panel h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0;
}

.table-meta span {
  color: var(--muted);
  font-size: 12px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 1180px;
  border-collapse: collapse;
  table-layout: fixed;
}

th,
td {
  padding: 11px 12px;
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid var(--line);
}

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  background: #fafbfc;
  white-space: nowrap;
}

tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover {
  background: #fafcfb;
}

.col-status {
  width: 72px;
}

.col-job {
  width: 210px;
}

.col-company {
  width: 110px;
}

.col-source {
  width: 64px;
}

.col-city {
  width: 96px;
}

.col-salary {
  width: 110px;
}

.col-graduate {
  width: 96px;
}

.col-tags {
  width: 150px;
}

.col-time {
  width: 118px;
}

.col-apply {
  width: 108px;
}

.col-link {
  width: 64px;
}

.col-company-wide {
  width: 210px;
}

.col-industry {
  width: 150px;
}

.col-scale {
  width: 150px;
}

.col-count {
  width: 70px;
}

.col-note {
  width: auto;
}

.job-cell {
  min-width: 0;
}

.job-cell strong {
  display: block;
  font-size: 14px;
  font-weight: 650;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.job-cell p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.cell-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.badge {
  display: inline-block;
  min-width: 42px;
  padding: 3px 7px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 650;
  text-align: center;
}

.badge.new {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.badge.updated {
  background: var(--warn-soft);
  color: var(--warn);
}

.badge.removed {
  background: var(--danger-soft);
  color: var(--danger);
}

.badge.plain {
  background: #eef0f3;
  color: var(--muted);
}

.status-badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
}

.status-badge.status-未投递 {
  background: #eef0f3;
  color: var(--muted);
}

.status-badge.status-已投递 {
  background: var(--info-soft);
  color: var(--info);
}

.status-badge.status-笔试中 {
  background: var(--warn-soft);
  color: var(--warn);
}

.status-badge.status-面试中 {
  background: #f0eafb;
  color: #6b47b8;
}

.status-badge.status-已拿Offer {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.status-badge.status-暂不投递 {
  background: var(--danger-soft);
  color: var(--danger);
}

.apply-select {
  width: 100%;
  min-height: 30px;
  padding: 0 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  font-size: 12px;
  outline: none;
}

.apply-select:focus {
  border-color: var(--accent);
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.tag-chip {
  max-width: 100%;
  padding: 2px 6px;
  border-radius: 5px;
  background: #f0f3f6;
  color: #4b5663;
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.detail-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--info);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.detail-link:hover {
  text-decoration: underline;
}

.detail-link svg {
  width: 14px;
  height: 14px;
}

.company-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.company-avatar {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  border-radius: 8px;
  background: #edf0f3;
  color: #4b5663;
  font-size: 15px;
  font-weight: 750;
  overflow: hidden;
}

.company-avatar img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.company-cell strong,
.company-cell small {
  display: block;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.company-cell strong {
  font-size: 14px;
  font-weight: 650;
}

.company-cell small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.company-link {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.company-link:hover strong {
  color: var(--accent-strong);
}

.company-cell-text {
  display: block;
  min-width: 0;
}

.company-cell-text strong,
.company-cell-text small {
  display: block;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.company-cell-text strong {
  font-size: 14px;
  font-weight: 650;
}

.company-cell-text small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.empty-row td {
  padding: 42px 16px;
  color: var(--muted);
  text-align: center;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.pager-buttons {
  display: flex;
  gap: 8px;
}

.history-panel {
  position: sticky;
  top: 92px;
  max-height: calc(100vh - 112px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.history-panel h2 {
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--line);
}

.version-list {
  overflow-y: auto;
  padding: 12px;
}

.version-item {
  display: block;
  width: 100%;
  margin-bottom: 8px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  text-align: left;
  color: var(--ink);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.version-item:hover {
  border-color: #bfd9ce;
}

.version-item.current {
  border-color: #9ed5c0;
  background: var(--accent-soft);
}

.version-head,
.version-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.version-head strong {
  font-size: 14px;
  font-weight: 700;
}

.version-head span {
  color: var(--muted);
  font-size: 12px;
}

.version-meta {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

.delta {
  color: var(--accent-strong);
  font-weight: 650;
}

.empty-state {
  padding: 24px 12px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.tracking-summary,
.tracking-filters {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}

.summary-chip,
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 32px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fafbfc;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.summary-chip strong {
  color: var(--ink);
  font-size: 15px;
}

.filter-chip {
  cursor: pointer;
}

.filter-chip.active {
  border-color: #9ed5c0;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 650;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal.hidden {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(14, 20, 26, 0.46);
}

.modal-panel {
  position: relative;
  width: min(780px, 100%);
  max-height: 86vh;
  overflow-y: auto;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 18px 50px rgba(16, 24, 40, 0.25);
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 7px;
  background: #f1f3f5;
  color: var(--ink);
}

.modal-close svg {
  width: 17px;
  height: 17px;
}

.modal-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-right: 36px;
}

.modal-head .company-avatar {
  width: 52px;
  height: 52px;
  flex-basis: 52px;
  font-size: 22px;
}

.modal-head h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 750;
  letter-spacing: 0;
}

.modal-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.company-facts {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 10px;
  margin: 18px 0 6px;
}

.fact {
  min-width: 0;
  padding: 10px 12px;
  background: #f7f8fa;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.fact span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.fact strong {
  display: block;
  margin-top: 3px;
  font-size: 13px;
  font-weight: 650;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.company-jobs {
  margin-top: 18px;
}

.company-jobs h3 {
  margin: 0 0 8px;
  font-size: 15px;
  font-weight: 700;
}

.company-job-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--line);
}

.company-job-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.company-job-row strong {
  display: block;
  font-size: 13px;
  font-weight: 600;
}

.company-job-row small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.tracking-form {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.tracking-form select,
.tracking-form input {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--ink);
  outline: none;
}

.tracking-form select {
  padding: 0 30px 0 12px;
}

.tracking-form input {
  flex: 1 1 220px;
  min-width: 180px;
  padding: 0 12px;
}

.note-cell {
  display: block;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: 50;
  max-width: min(420px, calc(100vw - 32px));
  padding: 10px 16px;
  border-radius: 8px;
  background: #20272f;
  color: #ffffff;
  font-size: 13px;
  box-shadow: 0 8px 24px rgba(16, 24, 40, 0.22);
  opacity: 0;
  transform: translate(-50%, 12px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast.error {
  background: var(--danger);
}

@media (max-width: 1180px) {
  .stats {
    grid-template-columns: repeat(3, minmax(140px, 1fr));
  }

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

  .history-panel {
    position: static;
    max-height: 360px;
  }
}

@media (max-width: 720px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    padding: 12px 16px;
  }

  .top-actions {
    width: 100%;
  }

  .top-actions .btn {
    flex: 1;
  }

  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin: 14px 16px 0;
  }

  .toolbar {
    margin: 12px 16px 0;
  }

  .layout {
    margin: 12px 16px 20px;
  }

  .view-tabs {
    width: 100%;
    margin: 12px 16px 0;
  }

  .view-tab {
    flex: 1;
  }

  .search-box {
    max-width: none;
    flex-basis: 100%;
  }

  .company-facts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .modal {
    padding: 12px;
  }

  .modal-panel {
    padding: 18px;
  }
}
