:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --panel: #ffffff;
  --ink: #111827;
  --muted: #64748b;
  --line: #dbe3ee;
  --soft: #eef4f8;
  --accent: #0f766e;
  --accent-2: #f97316;
  --danger: #dc2626;
  --warn: #b45309;
  --good: #15803d;
  --shadow: 0 18px 50px rgba(15, 23, 42, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

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

button,
input,
select {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 320px 1fr;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
  border-right: 1px solid var(--line);
  background: #fbfdff;
  padding: 22px;
}

.brand {
  display: flex;
  gap: 16px;
  align-items: center;
  margin-bottom: 24px;
}

.brand-mark {
  width: 68px;
  height: 68px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--ink) url("./assets/brand-icon.jpg") center / cover no-repeat;
  color: transparent;
  font-weight: 800;
  font-size: 21px;
  overflow: hidden;
  text-indent: -9999px;
  cursor: zoom-in;
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.icon-dialog {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0;
  width: min(560px, calc(100vw - 32px));
  background: #fff;
  box-shadow: var(--shadow);
}

.icon-dialog::backdrop {
  background: rgba(15, 23, 42, 0.45);
}

.icon-dialog img {
  display: block;
  width: 100%;
  height: auto;
}

.icon-dialog-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.88);
  color: var(--ink);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.brand h1,
.topbar h2,
.drawer h2 {
  margin: 0;
  letter-spacing: 0;
}

.brand h1 {
  font-size: 19px;
}

.brand p,
.drawer-head p,
.eyebrow {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.search {
  display: grid;
  gap: 8px;
  margin-bottom: 22px;
  font-weight: 700;
}

.search input,
select {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 11px 12px;
  color: var(--ink);
  outline: none;
}

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

.filter-group {
  border-top: 1px solid var(--line);
  padding: 18px 0;
}

.filter-group h2 {
  margin: 0 0 10px;
  font-size: 14px;
  letter-spacing: 0;
}

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

.chip {
  border: 1px solid var(--line);
  background: #fff;
  color: #334155;
  border-radius: 999px;
  padding: 7px 10px;
  cursor: pointer;
  min-height: 34px;
}

.chip.active {
  border-color: var(--accent);
  background: #dff7f2;
  color: #0f4f49;
  font-weight: 700;
}

.location-filter details {
  display: grid;
  gap: 12px;
}

.location-filter summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
  font-weight: 800;
}

.location-filter summary::-webkit-details-marker {
  display: none;
}

.location-filter summary::after {
  content: "⌄";
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--muted);
  flex: 0 0 auto;
}

.location-filter details[open] summary::after {
  transform: rotate(180deg);
}

.location-filter summary strong {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-align: right;
}

.map-open-btn {
  width: 100%;
  margin-top: 12px;
  min-height: 42px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: #e7f7f4;
  color: #0f4f49;
  font-weight: 800;
  cursor: pointer;
}

.map-dialog {
  width: min(1120px, calc(100vw - 36px));
  max-height: calc(100vh - 32px);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0;
  background: #fff;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.map-dialog::backdrop {
  background: rgba(15, 23, 42, 0.42);
}

.map-dialog-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.map-dialog-head strong {
  display: block;
  font-size: 18px;
}

.map-dialog-head span {
  color: var(--muted);
  font-size: 13px;
}

.map-selected {
  margin: 5px 0 0;
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
}

.map-clear-btn {
  min-width: 112px;
  margin-left: auto;
}

.china-map-wrap {
  padding: 12px;
  background: #f8fbff;
  height: calc(100vh - 156px);
  max-height: 720px;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 8px;
}

.china-map-canvas {
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #eef7fb, #f8fbff 45%, #eef6f4);
  overflow: hidden;
}

.china-map-svg {
  display: block;
  width: 100%;
  height: 100%;
}

.province-shape {
  stroke: #ffffff;
  stroke-width: 1.2;
  vector-effect: non-scaling-stroke;
  cursor: pointer;
  transition: fill 0.15s ease, stroke 0.15s ease;
}

.province-shape:hover,
.province-shape.active {
  stroke: var(--accent);
  stroke-width: 2.2;
  fill: rgba(15, 118, 110, 0.72);
}

.map-boundary {
  fill: none;
  stroke: #94a3b8;
  stroke-width: 1.1;
  stroke-dasharray: 5 5;
  vector-effect: non-scaling-stroke;
}

.province-label {
  cursor: pointer;
}

.province-label rect {
  fill: rgba(255, 255, 255, 0.88);
  stroke: rgba(100, 116, 139, 0.34);
}

.province-label.active rect {
  fill: #dff7f2;
  stroke: var(--accent);
  stroke-width: 1.5;
}

.province-label text {
  text-anchor: middle;
  font-size: 12px;
  font-weight: 800;
  fill: #0f172a;
  pointer-events: none;
}

.province-label .label-count {
  fill: var(--accent);
  font-size: 14px;
}

.map-loading {
  min-height: 100%;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-weight: 800;
}

.map-footer-status {
  min-height: 42px;
  display: flex;
  align-items: center;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--accent);
  font-size: 15px;
  font-weight: 800;
}

.clear-location {
  width: 100%;
  margin-top: 10px;
}

.main {
  min-width: 0;
  padding: 24px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

.eyebrow {
  text-transform: uppercase;
  font-weight: 800;
  color: var(--accent);
  margin-bottom: 3px;
}

.topbar h2 {
  font-size: 28px;
}

.top-actions,
.drawer-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.primary,
.ghost,
.icon-btn {
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 13px;
  cursor: pointer;
}

.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
  font-weight: 800;
}

.primary.disabled,
.primary[aria-disabled="true"] {
  border-color: #cbd5e1;
  background: #e5e7eb;
  color: #94a3b8;
  cursor: not-allowed;
  pointer-events: auto;
}

.ghost,
.icon-btn {
  background: #fff;
  color: #1f2937;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.metric {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

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

.metric strong {
  display: block;
  margin-top: 5px;
  font-size: 26px;
  line-height: 1;
}

.board {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.board-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: #fbfdff;
}

#activeFilters {
  color: var(--muted);
  margin-left: 8px;
  font-size: 14px;
}

.legend {
  display: flex;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
  flex-wrap: wrap;
}

.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 5px;
  background: var(--muted);
}

.dot.strong {
  background: var(--good);
}

.dot.warn {
  background: var(--warn);
}

.dot.risk {
  background: var(--danger);
}

.job-list {
  display: grid;
}

.job-card {
  display: grid;
  grid-template-columns: minmax(210px, 1.05fr) minmax(260px, 1.35fr) minmax(250px, 0.9fr);
  gap: 14px;
  align-items: center;
  padding: 15px 16px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}

.job-card:hover {
  background: #f8fbfc;
}

.company-cell h3,
.role-cell p,
.status-cell p {
  margin: 0;
}

.company-cell h3 {
  font-size: 17px;
  letter-spacing: 0;
}

.company-cell small,
.role-cell small,
.status-cell small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.role-cell p,
.status-cell p {
  color: #334155;
  font-size: 14px;
}

.role-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: flex-start;
  max-height: none;
}

.role-tags span {
  display: inline-flex;
  max-width: 100%;
  padding: 4px 7px;
  border-radius: 7px;
  background: #eef6ff;
  color: #1e3a5f;
  font-size: 13px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.badge,
.mini-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 800;
  background: var(--soft);
  color: #334155;
}

.badge.grade-S,
.mini-badge.grade-S {
  background: #dcfce7;
  color: #166534;
}

.badge.grade-A,
.mini-badge.grade-A {
  background: #e0f2fe;
  color: #075985;
}

.badge.grade-B,
.mini-badge.grade-B {
  background: #fef3c7;
  color: #92400e;
}

.score {
  font-size: 22px;
  font-weight: 900;
  text-align: right;
}

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

.actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.actions a,
.actions button {
  min-width: 48px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  padding: 8px 10px;
  cursor: pointer;
  color: #1f2937;
}

.actions .mark {
  background: #f8fafc;
}

.actions .mark.active {
  border-color: var(--accent-2);
  background: #ffedd5;
  color: #9a3412;
  font-weight: 800;
}

.actions .danger-mini {
  border-color: #fecaca;
  background: #fff1f2;
  color: #be123c;
}

.actions [data-action="hide"],
.actions [data-action="unhide"] {
  background: #f8fafc;
}

.status-select {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  min-height: 36px;
  padding: 7px 9px;
  color: #1f2937;
  font-weight: 800;
}

.status-select.status-new,
.status-pill.status-new {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #334155;
}

.status-select.status-ready,
.status-pill.status-ready {
  background: #fef3c7;
  border-color: #f59e0b;
  color: #92400e;
}

.status-select.status-sent,
.status-pill.status-sent {
  background: #dbeafe;
  border-color: #60a5fa;
  color: #1d4ed8;
}

.status-select.status-test,
.status-pill.status-test {
  background: #ede9fe;
  border-color: #a78bfa;
  color: #6d28d9;
}

.status-select.status-interview,
.status-pill.status-interview {
  background: #e0f2fe;
  border-color: #38bdf8;
  color: #0369a1;
}

.status-select.status-hr,
.status-pill.status-hr {
  background: #fae8ff;
  border-color: #d946ef;
  color: #a21caf;
}

.status-select.status-offer,
.status-pill.status-offer {
  background: #dcfce7;
  border-color: #22c55e;
  color: #166534;
}

.status-select.status-paused,
.status-pill.status-paused {
  background: #ffedd5;
  border-color: #fb923c;
  color: #9a3412;
}

.status-select.status-giveup,
.status-pill.status-giveup {
  background: #fee2e2;
  border-color: #f87171;
  color: #b91c1c;
}

.auth-panel {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background: rgba(15, 23, 42, 0.55);
  padding: 18px;
}

.auth-panel[hidden] {
  display: none !important;
}

.login-box {
  width: min(420px, 100%);
  display: grid;
  gap: 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 22px;
}

.login-box h2,
.login-box p {
  margin: 0;
}

.login-box p,
#loginError {
  color: var(--muted);
  font-size: 14px;
}

.login-box input,
.admin-panel input {
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 40px;
  padding: 9px 11px;
}

#loginError {
  color: var(--danger);
}

.user-bar,
.admin-panel {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 14px;
}

.account-dock {
  position: sticky;
  bottom: 0;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
  padding: 12px 0 0;
  border-top: 1px solid var(--line);
  background: #fbfdff;
}

.avatar-btn {
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--ink);
  color: #5eead4;
  font-weight: 900;
  cursor: pointer;
  overflow: hidden;
  padding: 0;
}

.avatar-btn img,
.avatar-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.account-main {
  min-width: 0;
}

.account-main strong,
.account-main span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-main span {
  color: var(--muted);
  font-size: 13px;
}

.logout-mini {
  min-height: 36px;
  padding: 7px 10px;
}

.status-top-filter {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.status-top-filter select {
  min-width: 120px;
}

.profile-dialog {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
  width: min(390px, calc(100vw - 32px));
  box-shadow: var(--shadow);
}

.profile-dialog::backdrop {
  background: rgba(15, 23, 42, 0.35);
}

.profile-dialog form {
  display: grid;
  gap: 12px;
  padding: 18px;
}

.avatar-preview {
  width: 72px;
  height: 72px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--ink);
  color: #5eead4;
  font-size: 24px;
  font-weight: 900;
  overflow: hidden;
}

.profile-dialog h2 {
  margin: 0;
}

.profile-dialog label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.profile-dialog input {
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 40px;
  padding: 9px 11px;
  color: var(--ink);
}

.profile-actions {
  display: flex;
  gap: 9px;
  justify-content: flex-end;
}

.user-bar span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.user-actions,
.admin-panel form {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
}

.user-actions label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.user-actions select {
  min-width: 130px;
}

.admin-panel {
  background: #f8fbfc;
}

.admin-panel form {
  flex: 1;
  justify-content: flex-end;
}

.admin-panel input {
  min-width: 150px;
}

.actions a.primary-mini {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

.empty {
  padding: 52px 20px;
  text-align: center;
  color: var(--muted);
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 16px;
  border-top: 1px solid var(--line);
  background: #fbfdff;
}

.pagination button,
.page-jump input {
  border: 1px solid var(--line);
  background: #fff;
  color: #1f2937;
  border-radius: 8px;
  min-height: 38px;
  padding: 8px 14px;
}

.pagination button {
  cursor: pointer;
}

.pagination button:disabled {
  cursor: not-allowed;
  color: #94a3b8;
  background: #f1f5f9;
}

.pagination span {
  min-width: 110px;
  text-align: center;
  color: var(--muted);
  font-weight: 800;
  font-size: 14px;
}

.page-jump {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.page-jump input {
  width: 76px;
  text-align: center;
}

.page-jump input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.14);
}

.empty strong {
  display: block;
  color: var(--ink);
  margin-bottom: 4px;
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.3);
  z-index: 20;
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(720px, 100vw);
  height: 100vh;
  overflow: auto;
  background: #fff;
  z-index: 30;
  box-shadow: var(--shadow);
  transform: translateX(105%);
  transition: transform 180ms ease;
  padding: 22px;
}

.drawer.open {
  transform: translateX(0);
}

.drawer-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 16px;
}

.drawer h2 {
  margin-top: 8px;
  font-size: 26px;
}

.icon-btn {
  width: 40px;
  padding: 0;
  font-size: 28px;
  line-height: 1;
}

.drawer-actions {
  margin: 16px 0;
}

.drawer-actions a {
  min-width: 92px;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.detail-grid section {
  border: 1px solid var(--line);
  background: #fbfdff;
  border-radius: 8px;
  padding: 14px;
}

.detail-grid section:first-child,
.detail-grid section:last-child,
.comments-section {
  grid-column: 1 / -1;
}

.detail-grid h3 {
  margin: 0 0 8px;
  font-size: 14px;
  color: var(--accent);
}

.detail-grid p {
  margin: 0;
  color: #334155;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.comments-list {
  display: grid;
  gap: 9px;
  margin-bottom: 12px;
}

.comment-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px;
}

.comment-item strong,
.comment-item span {
  display: block;
}

.comment-item span,
.comment-empty {
  color: var(--muted);
  font-size: 13px;
}

.comment-item p {
  margin-top: 7px;
}

.comment-form {
  display: grid;
  gap: 9px;
}

.comment-form textarea {
  width: 100%;
  min-height: 86px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  font: inherit;
}

@media (max-width: 1100px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

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

  .score,
  .actions {
    text-align: left;
    justify-content: flex-start;
  }
}

@media (max-width: 760px) {
  .main,
  .sidebar,
  .drawer {
    padding: 16px;
  }

  .topbar,
  .board-head,
  .user-bar,
  .admin-panel {
    align-items: flex-start;
    flex-direction: column;
  }

  .top-actions {
    width: 100%;
  }

  .top-actions > * {
    flex: 1;
  }

  .user-actions,
  .admin-panel form {
    width: 100%;
  }

  .admin-panel input,
  .admin-panel button,
  .user-actions label,
  .user-actions button {
    width: 100%;
  }

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

  .pagination {
    justify-content: space-between;
  }

  .pagination span {
    min-width: auto;
  }

  .page-jump {
    order: 3;
    width: 100%;
    justify-content: center;
  }

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

  .detail-grid section {
    grid-column: 1 / -1;
  }
}
