:root {
  color-scheme: light;
  --ink: #142033;
  --muted: #667085;
  --line: #dce3ed;
  --surface: #ffffff;
  --canvas: #f4f7fb;
  --soft: #edf3fa;
  --green: #0969e8;
  --green-dark: #082f73;
  --red: #c74b3c;
  --amber: #d98200;
  --blue: #075fcf;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  font-synthesis: none;
  letter-spacing: 0;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: var(--canvas);
}

button, input, select { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }
a { color: inherit; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 232px minmax(0, 1fr); }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 232px;
  display: flex;
  flex-direction: column;
  padding: 24px 16px;
  color: #f7fbf9;
  background: #071f4e;
  border-right: 1px solid #153a78;
  z-index: 5;
}

.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 24px; border-bottom: 1px solid #224580; }
.brand-mark { width: 36px; height: 36px; display: grid; place-items: center; background: #f4f7fb; color: var(--green-dark); border-radius: 6px; font-weight: 800; }
.brand strong, .brand span { display: block; }
.brand strong { font-size: 16px; }
.brand span { margin-top: 3px; color: #afc4e8; font-size: 12px; }

.main-nav { display: grid; gap: 6px; padding-top: 24px; }
.nav-item { width: 100%; min-height: 44px; display: flex; align-items: center; gap: 12px; border: 0; border-radius: 6px; padding: 0 12px; color: #c6d5ef; background: transparent; text-align: left; }
.nav-item:hover { color: #fff; background: #12366f; }
.nav-item.is-active { color: #fff; background: #1555ae; box-shadow: inset 3px 0 #ffad00; }
.nav-icon { width: 20px; text-align: center; font-size: 19px; }

.scope-note { margin-top: auto; padding: 14px 12px; border: 1px solid #2a4f8b; border-radius: 6px; background: #0d2a5d; }
.scope-note p { margin: 8px 0 0; color: #afc4e8; font-size: 12px; line-height: 1.6; }
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #4ea1ff; box-shadow: 0 0 0 4px rgb(78 161 255 / 14%); }

.workspace { grid-column: 2; min-width: 0; }
.topbar { min-height: 88px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 18px 32px; background: var(--surface); border-bottom: 1px solid var(--line); }
.eyebrow, .section-index { margin: 0 0 5px; color: var(--green); font-size: 11px; font-weight: 700; text-transform: uppercase; }
.topbar h1 { margin: 0; font-size: 22px; line-height: 1.2; }
.topbar-meta { display: flex; align-items: center; gap: 18px; color: var(--muted); font-size: 13px; }
.live-indicator { display: inline-flex; align-items: center; gap: 7px; }
.live-indicator i { width: 7px; height: 7px; border-radius: 50%; background: #38a76f; }

.view { display: none; }
.view.is-active { display: block; }
.matcher-layout { display: grid; grid-template-columns: minmax(300px, 380px) minmax(0, 1fr); min-height: calc(100vh - 89px); }
.resume-column { padding: 28px 28px 40px 32px; background: #fafbfa; border-right: 1px solid var(--line); }
.results-column { padding: 28px 32px 60px; }
.section-heading, .results-toolbar, .panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.section-heading h2, .results-toolbar h2, .panel-heading h2 { margin: 0; font-size: 17px; }
.section-heading.compact { margin-top: 30px; }
.file-support { color: var(--muted); font-size: 11px; }

.upload-zone { min-height: 164px; display: grid; place-items: center; align-content: center; gap: 8px; margin-top: 18px; border: 1px dashed #9ab3a6; border-radius: 8px; background: var(--surface); transition: border-color .2s, background .2s; }
.upload-zone:hover { border-color: var(--green); background: #f5f9ff; }
.upload-zone input { position: absolute; opacity: 0; pointer-events: none; }
.upload-zone strong { font-size: 14px; }
.upload-zone span:last-child { color: var(--muted); font-size: 12px; }
.upload-symbol { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; background: #e7f1ff; color: var(--green); font-size: 22px; }
.upload-progress { margin-top: 14px; color: var(--muted); font-size: 12px; }
.progress-track { height: 3px; overflow: hidden; margin-bottom: 8px; background: #dfe8e3; }
.progress-track i { display: block; width: 45%; height: 100%; background: var(--green); animation: progress 1s infinite alternate ease-in-out; }
@keyframes progress { from { transform: translateX(-20%); } to { transform: translateX(150%); } }

.resume-summary { margin-top: 16px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 16px 0; }
.resume-file-row { display: grid; grid-template-columns: 38px minmax(0, 1fr) 34px; align-items: center; gap: 10px; }
.file-badge { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 5px; color: #fff; background: var(--green); font-size: 11px; font-weight: 800; }
.resume-file-row strong, .resume-file-row span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.resume-file-row strong { font-size: 13px; }
.resume-file-row span { margin-top: 4px; color: var(--muted); font-size: 11px; }
.icon-command { width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 5px; color: var(--muted); background: #fff; font-size: 18px; }
.profile-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 18px; margin: 16px 0 0; }
.profile-facts div { min-width: 0; }
.profile-facts dt { color: var(--muted); font-size: 10px; }
.profile-facts dd { margin: 4px 0 0; overflow: hidden; color: #31423a; font-size: 12px; line-height: 1.45; }

.control-group { display: grid; gap: 8px; margin-top: 18px; }
.control-label { color: #435148; font-size: 12px; font-weight: 700; }
.segmented { display: grid; grid-template-columns: repeat(3, 1fr); padding: 3px; border-radius: 6px; background: #e8edeb; }
.segmented button { min-height: 34px; border: 0; border-radius: 4px; color: var(--muted); background: transparent; font-size: 12px; }
.segmented button.is-active { color: var(--green-dark); background: #fff; box-shadow: 0 1px 3px rgb(25 45 35 / 10%); font-weight: 700; }
.text-input, .inline-form input, .sync-form input, .sync-form select, .table-filters input, .table-filters select { width: 100%; height: 40px; border: 1px solid #ccd6d1; border-radius: 5px; padding: 0 11px; color: var(--ink); background: #fff; outline: none; }
.text-input:focus, input:focus, select:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgb(9 105 232 / 12%); }
.primary-command { position: relative; width: 100%; min-height: 44px; display: flex; align-items: center; justify-content: center; margin-top: 22px; border: 0; border-radius: 5px; padding: 0 44px; color: #fff; background: var(--green); font-weight: 700; text-align: center; }
.primary-command > span:last-child { position: absolute; right: 16px; }
.primary-command:hover:not(:disabled) { background: var(--green-dark); }

.results-toolbar { min-height: 42px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.result-counts { display: flex; gap: 18px; text-align: right; }
.result-counts strong { display: block; color: var(--green); font-size: 22px; }
.result-counts span { color: var(--muted); font-size: 11px; }
.result-counts div:last-child strong { color: var(--amber); }
.empty-results { min-height: 420px; display: grid; place-items: center; align-content: center; text-align: center; }
.empty-results h3 { margin: 20px 0 7px; font-size: 16px; }
.empty-results p { margin: 0; color: var(--muted); font-size: 13px; }
.empty-visual { display: flex; align-items: center; color: var(--muted); }
.empty-visual span { width: 48px; height: 48px; display: grid; place-items: center; border: 1px solid #becbc5; border-radius: 50%; background: #fff; font-size: 12px; font-weight: 700; }
.empty-visual span:first-child { color: var(--green); border-color: #77aceb; }
.empty-visual i { width: 42px; height: 1px; background: #cbd5d0; }
.threshold-notice { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: 18px 0 14px; padding: 11px 14px; border-left: 3px solid var(--green); background: #edf4ff; }
.threshold-notice strong, .threshold-notice span { display: block; }
.threshold-notice strong { font-size: 12px; }
.threshold-notice span { margin-top: 3px; color: var(--muted); font-size: 11px; }
.secondary-command, .primary-small, .text-command { min-height: 34px; border-radius: 5px; padding: 0 12px; font-size: 12px; }
.secondary-command { border: 1px solid #b6c7bf; color: var(--green-dark); background: #fff; }
.primary-small { border: 0; color: #fff; background: var(--green); }
.text-command { border: 0; color: var(--muted); background: transparent; }

.job-list { display: grid; gap: 10px; }
.job-card { display: grid; grid-template-columns: 88px minmax(0, 1fr); border: 1px solid var(--line); border-radius: 8px; background: #fff; overflow: hidden; }
.score-block { display: grid; place-items: center; align-content: center; border-right: 1px solid var(--line); background: #f5f9ff; }
.score-block strong { color: var(--green); font-size: 28px; line-height: 1; }
.score-block span { margin-top: 6px; color: var(--muted); font-size: 10px; }
.score-block em { margin-top: 10px; padding: 3px 6px; border-radius: 3px; color: var(--green-dark); background: #dfeeff; font-size: 9px; font-style: normal; font-weight: 800; }
.job-card.try .score-block strong { color: var(--amber); }
.job-card.try .score-block em { color: #744c0a; background: #fff0d6; }
.job-card.low .score-block strong { color: var(--red); }
.job-card.low .score-block em { color: #864237; background: #fbe7e3; }
.job-main { min-width: 0; padding: 16px; }
.job-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.job-title-row h3 { margin: 0; font-size: 16px; line-height: 1.4; }
.job-title-row p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.source-link { width: 30px; height: 30px; display: grid; place-items: center; flex: 0 0 auto; border: 1px solid var(--line); border-radius: 5px; color: var(--green); text-decoration: none; }
.source-link > span { display: block; font-family: Arial, sans-serif; font-size: 16px; font-weight: 700; line-height: 1; }
.job-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.job-tags span, .table-badge { padding: 4px 7px; border-radius: 4px; color: #405149; background: #edf1ef; font-size: 10px; }
.job-tags .third-party { color: #7d4f08; background: #fff3dc; }
.job-facts { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 12px; color: var(--muted); font-size: 11px; }
.job-facts strong { color: var(--red); }
.match-reasons { display: grid; gap: 6px; margin-top: 14px; padding-top: 12px; border-top: 1px solid #edf0ee; }
.match-reasons div { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 8px; }
.match-reasons span { color: var(--green); font-size: 10px; font-weight: 800; }
.match-reasons p { margin: 0; color: #4c5d54; font-size: 11px; line-height: 1.6; }
.match-reasons .gap span { color: var(--amber); }
.match-reasons .caution span { color: var(--blue); }
.attachments { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; font-size: 11px; }
.attachments > span { color: var(--muted); }
.attachments a { color: var(--blue); }
.load-sentinel { min-height: 54px; display: flex; align-items: center; justify-content: center; gap: 9px; color: var(--muted); font-size: 11px; }
.loading-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); }
.no-match { padding: 60px 20px; border: 1px solid var(--line); text-align: center; background: #fff; }
.no-match strong, .no-match span { display: block; }
.no-match span { margin-top: 8px; color: var(--muted); font-size: 12px; }

#admin-view { padding: 24px 32px 60px; }
.admin-summary { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--line); background: #fff; }
.admin-summary div { min-height: 86px; display: flex; flex-direction: column; justify-content: center; padding: 15px 20px; border-right: 1px solid var(--line); }
.admin-summary div:last-child { border-right: 0; }
.admin-summary span { color: var(--muted); font-size: 11px; }
.admin-summary strong { margin-top: 5px; font-size: 24px; }
.admin-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(320px, .75fr); gap: 16px; margin-top: 16px; }
.admin-panel, .jobs-browser, .sync-history { border: 1px solid var(--line); background: #fff; }
.admin-panel { padding: 20px; }
.panel-heading { min-height: 42px; }
.inline-form { display: grid; grid-template-columns: 180px minmax(240px, 1fr) auto; gap: 12px; margin: 16px 0; padding: 14px; background: var(--soft); }
.inline-form label, .sync-form > label, .month-fields label { display: grid; gap: 6px; }
.inline-form label span, .sync-form label > span, .sync-form legend { color: var(--muted); font-size: 10px; font-weight: 700; }
.form-actions { display: flex; align-items: end; gap: 5px; }
.source-list { display: grid; margin-top: 16px; border-top: 1px solid var(--line); }
.source-row { display: grid; grid-template-columns: 38px minmax(0, 1fr) 66px auto; align-items: center; gap: 12px; min-height: 72px; border-bottom: 1px solid var(--line); }
.source-avatar { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 5px; color: #fff; background: var(--green); font-size: 12px; font-weight: 800; }
.source-info { min-width: 0; }
.source-info strong, .source-info a { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.source-info strong { font-size: 13px; }
.source-info a { margin-top: 4px; color: var(--muted); font-size: 10px; text-decoration: none; }
.source-health { margin: 4px 0 0; overflow: hidden; color: var(--muted); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.source-health.failed { color: var(--red); }
.source-health.completed { color: var(--green); }
.source-stats { text-align: right; }
.source-stats strong, .source-stats span { display: block; }
.source-stats strong { font-size: 16px; }
.source-stats span { color: var(--muted); font-size: 9px; }
.adapter-badge { padding: 5px 7px; border-radius: 4px; color: var(--green-dark); background: #e7f1ff; font-size: 9px; }
.sync-form { display: grid; gap: 14px; margin-top: 16px; }
.month-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.month-picker { display: grid; gap: 6px; }
.month-picker-label { color: var(--muted); font-size: 10px; font-weight: 700; }
.month-picker > div { display: grid; grid-template-columns: minmax(92px, 1.2fr) minmax(72px, .8fr); gap: 7px; }
.sync-form fieldset { display: flex; gap: 16px; margin: 0; border: 0; padding: 0; }
.sync-form legend { margin-bottom: 8px; }
.check-control { display: inline-flex; align-items: center; gap: 7px; color: #35463d; font-size: 12px; }
.check-control input { width: 15px; height: 15px; accent-color: var(--green); }
.rule-strip { display: flex; align-items: flex-start; gap: 9px; padding: 10px; background: #f3f6f4; }
.rule-strip .status-dot { flex: 0 0 auto; margin-top: 4px; }
.rule-strip p { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.5; }
.sync-feedback { display: grid; gap: 4px; margin-top: 12px; border-left: 3px solid var(--green); padding: 10px 12px; background: #edf4ff; }
.sync-feedback strong { font-size: 12px; }
.sync-feedback span { color: var(--muted); font-size: 10px; }

.jobs-browser, .sync-history { margin-top: 16px; padding: 20px; }
.table-filters { display: grid; grid-template-columns: 200px 130px; gap: 8px; }
.table-wrap { overflow-x: auto; margin-top: 16px; }
table { width: 100%; border-collapse: collapse; font-size: 11px; }
th { height: 36px; color: var(--muted); background: #f4f6f5; text-align: left; font-size: 10px; }
th, td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
td:first-child { min-width: 260px; }
td a { text-decoration: none; }
td a strong, td a span { display: block; }
td a strong { font-size: 12px; }
td a span { margin-top: 4px; color: var(--muted); font-size: 10px; }
td small { display: block; margin-top: 4px; color: var(--amber); font-size: 9px; }
.table-empty { height: 90px; color: var(--muted); text-align: center; }
.table-load { width: 100%; height: 36px; margin-top: 8px; border: 0; color: var(--green); background: #f4f7f5; }
.history-list { margin-top: 14px; }
.history-row { display: grid; grid-template-columns: 12px minmax(180px, 1fr) repeat(4, 70px) 110px; align-items: center; gap: 12px; min-height: 58px; border-top: 1px solid var(--line); padding: 8px 0; font-size: 11px; }
.history-row > div strong, .history-row > div span { display: block; }
.history-row > div span, .history-row time { color: var(--muted); font-size: 9px; }
.history-row > div strong { margin-top: 3px; }
.history-row .history-error { max-width: 560px; margin-top: 4px; color: var(--red); font-size: 9px; line-height: 1.4; }
.run-status { width: 7px; height: 7px; border-radius: 50%; background: #9aa7a0; }
.run-status.completed { background: var(--green); }
.run-status.failed { background: var(--red); }
.history-empty { padding: 30px; color: var(--muted); text-align: center; font-size: 11px; }

.toast-region { position: fixed; right: 20px; bottom: 20px; display: grid; gap: 8px; z-index: 20; }
.toast { max-width: 360px; padding: 11px 14px; border-radius: 6px; color: #fff; background: #082f73; box-shadow: 0 10px 30px rgb(8 47 115 / 20%); font-size: 12px; }
.toast.error { background: #9b352c; }

@media (max-width: 1100px) {
  .matcher-layout { grid-template-columns: 320px minmax(0, 1fr); }
  .admin-grid { grid-template-columns: 1fr; }
  .history-row { grid-template-columns: 12px minmax(160px, 1fr) repeat(4, 54px) 90px; }
}

@media (max-width: 820px) {
  .app-shell { display: block; padding-bottom: 64px; }
  .sidebar { position: fixed; inset: auto 0 0; width: auto; height: 64px; flex-direction: row; padding: 7px 12px; border: 0; border-top: 1px solid #224580; }
  .brand, .scope-note { display: none; }
  .main-nav { width: 100%; grid-template-columns: 1fr 1fr; padding: 0; gap: 8px; }
  .nav-item { justify-content: center; }
  .workspace { min-width: 0; }
  .topbar { min-height: 76px; padding: 14px 18px; }
  .topbar-meta { display: none; }
  .matcher-layout { display: block; }
  .resume-column, .results-column, #admin-view { padding: 20px 16px 36px; border: 0; }
  .resume-column { border-bottom: 1px solid var(--line); }
  .empty-results { min-height: 280px; }
  .job-card { grid-template-columns: 68px minmax(0, 1fr); }
  .score-block strong { font-size: 23px; }
  .admin-summary { grid-template-columns: 1fr 1fr; }
  .admin-summary div:nth-child(2) { border-right: 0; }
  .admin-summary div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .inline-form { grid-template-columns: 1fr; }
  .source-row { grid-template-columns: 38px minmax(0, 1fr) 55px; }
  .adapter-badge { display: none; }
  .table-filters { grid-template-columns: 1fr; width: 100%; }
  .panel-heading { align-items: flex-start; flex-wrap: wrap; }
  .history-row { grid-template-columns: 12px minmax(150px, 1fr) 50px 50px; }
  .history-row > div:nth-of-type(4), .history-row > div:nth-of-type(5), .history-row time { display: none; }
}

@media (max-width: 480px) {
  .topbar h1 { font-size: 19px; }
  .month-fields { grid-template-columns: 1fr; }
  .threshold-notice { align-items: flex-start; flex-direction: column; }
  .job-card { display: block; }
  .score-block { min-height: 54px; display: flex; align-items: center; justify-content: flex-start; gap: 6px; border: 0; border-bottom: 1px solid var(--line); padding: 0 14px; }
  .score-block span { margin: 0; }
  .score-block em { margin: 0 0 0 auto; }
  .profile-facts { grid-template-columns: 1fr; }
}
