:root {
  --ink: #17221f;
  --muted: #66736f;
  --line: #dfe5e2;
  --soft: #f3f6f4;
  --canvas: #f7f8f6;
  --surface: #ffffff;
  --green: #146a57;
  --green-dark: #0f5245;
  --green-soft: #e7f2ee;
  --orange: #c86532;
  --orange-soft: #fdf0e8;
  --blue: #326d92;
  --blue-soft: #eaf2f7;
  --red: #b5443b;
  --red-soft: #f9ecea;
  --gold: #947126;
  --gold-soft: #faf3df;
  --plum: #77557f;
  --plum-soft: #f3edf5;
  --shadow: 0 14px 36px rgba(27, 46, 40, .12);
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--canvas); }
body { margin: 0; color: var(--ink); background: var(--canvas); font-family: "Microsoft YaHei UI", "Microsoft YaHei", sans-serif; font-size: 14px; letter-spacing: 0; }
button, input, select { font: inherit; color: inherit; letter-spacing: 0; }
button, select { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible { outline: 3px solid rgba(20, 106, 87, .2); outline-offset: 2px; }
svg { width: 18px; height: 18px; flex: 0 0 auto; }

.app-shell { min-height: 100vh; }
.topbar { height: 68px; display: flex; align-items: center; justify-content: space-between; padding: 0 24px; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.brand { display: inline-flex; align-items: center; gap: 11px; color: var(--ink); text-decoration: none; }
.brand-mark { width: 38px; height: 38px; display: grid; place-items: center; background: var(--green); color: white; border-radius: 7px; }
.brand-mark svg { width: 21px; height: 21px; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 17px; line-height: 1.3; }
.brand small { color: var(--muted); font-size: 11px; margin-top: 1px; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.icon-button { width: 38px; height: 38px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 7px; display: inline-grid; place-items: center; position: relative; text-decoration: none; }
.icon-button:hover { background: var(--soft); }
.count-dot { position: absolute; right: -5px; top: -5px; min-width: 18px; height: 18px; padding: 0 4px; display: grid; place-items: center; background: var(--orange); color: white; border: 2px solid var(--surface); border-radius: 9px; font-size: 10px; font-weight: 700; }
.avatar-button { border: 0; background: var(--green-soft); color: var(--green-dark); width: 40px; height: 40px; border-radius: 50%; font-size: 12px; font-weight: 700; margin-left: 3px; }

.workspace { display: grid; grid-template-columns: 292px minmax(0, 1fr); max-width: 1440px; margin: 0 auto; }
.filter-panel { height: calc(100vh - 68px); padding: 28px 24px; background: var(--surface); border-right: 1px solid var(--line); position: sticky; top: 68px; align-self: start; overflow-y: auto; }
.panel-heading { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 22px; }
.eyebrow { display: block; color: var(--green); font-size: 12px; font-weight: 700; margin-bottom: 4px; }
.panel-heading h1 { margin: 0; font-size: 20px; line-height: 1.45; }
.field-label { display: block; margin: 17px 0 8px; font-size: 13px; font-weight: 600; }
.paired-filter-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.paired-filter-row .input-with-icon input, .paired-filter-row .input-with-icon select { min-width: 0; padding-left: 34px; padding-right: 28px; font-size: 12px; }
.paired-filter-row .input-with-icon > svg { left: 10px; width: 15px; }
.paired-filter-row .select-wrap::after { right: 11px; }
.input-with-icon { position: relative; }
.input-with-icon > svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 16px; color: var(--muted); pointer-events: none; }
.input-with-icon input, .input-with-icon select, #sortSelect { width: 100%; height: 42px; border: 1px solid #cfd8d4; border-radius: 6px; background: var(--surface); padding: 0 34px 0 38px; }
.input-with-icon input:hover, .input-with-icon select:hover, #sortSelect:hover { border-color: #aab8b2; }
.input-with-icon input:focus, .input-with-icon select:focus, #sortSelect:focus { border-color: var(--green); }
.input-with-icon select:disabled { cursor: not-allowed; color: #89938f; background: var(--soft); border-color: var(--line); }
.certificate-detail[hidden] { display: none; }
.select-wrap::after { content: ""; position: absolute; right: 13px; top: 17px; width: 7px; height: 7px; border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted); transform: rotate(45deg); pointer-events: none; }
select { appearance: none; }
.quick-majors { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.quick-majors button { white-space: nowrap; border: 0; background: var(--soft); color: var(--muted); padding: 5px 8px; border-radius: 4px; font-size: 11px; }
.quick-majors button:hover { color: var(--green); background: var(--green-soft); }
.major-catalog-info { display: grid; gap: 6px; margin-top: 10px; padding: 9px 10px; border-left: 3px solid var(--green); background: var(--green-soft); }
.major-catalog-info[hidden] { display: none; }
.catalog-row { display: grid; grid-template-columns: 68px minmax(0, 1fr); gap: 7px; align-items: start; font-size: 11px; line-height: 1.55; }
.catalog-row span { color: var(--green-dark); font-weight: 700; }
.catalog-row p { min-width: 0; margin: 0; color: var(--ink); overflow-wrap: anywhere; }
.catalog-row p.catalog-missing { color: var(--muted); }
.check-option { display: flex; align-items: center; gap: 8px; min-height: 36px; margin-top: 7px; color: var(--muted); font-size: 12px; cursor: pointer; }
.check-option input { width: 16px; height: 16px; margin: 0; accent-color: var(--green); }
.choice-group { border: 0; padding: 0; margin: 0; }
.segmented { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid #cfd8d4; border-radius: 6px; padding: 3px; gap: 3px; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span { height: 34px; display: grid; place-items: center; border-radius: 4px; color: var(--muted); cursor: pointer; }
.segmented input:checked + span { background: var(--green); color: white; font-weight: 600; }
.primary-button, .secondary-button { min-height: 42px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: 6px; font-weight: 600; }
.primary-button { width: 100%; border: 0; background: var(--green); color: white; margin-top: 22px; }
.primary-button:hover { background: var(--green-dark); }
.secondary-button { border: 1px solid var(--line); background: var(--surface); padding: 0 16px; }
.text-button { display: block; border: 0; background: transparent; color: var(--muted); padding: 9px 12px; margin: 2px auto 0; }
.text-button:hover { color: var(--green); }
.profile-status { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; padding-top: 18px; margin-top: 14px; border-top: 1px solid var(--line); }
.profile-status svg { width: 16px; color: var(--green); }

.main-content { padding: 32px clamp(20px, 4vw, 58px) 72px; min-width: 0; }
.content-header { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin-bottom: 20px; }
.breadcrumb { color: var(--muted); font-size: 12px; display: flex; align-items: center; gap: 5px; margin-bottom: 7px; }
.breadcrumb svg { width: 13px; }
.content-header h2 { margin: 0; font-size: 26px; }
.content-header p { margin: 7px 0 0; color: var(--muted); }
.filter-trigger { display: none; border: 1px solid var(--line); background: var(--surface); border-radius: 6px; min-height: 40px; padding: 0 14px; align-items: center; gap: 7px; }
.notice-bar { min-height: 44px; display: flex; align-items: center; gap: 9px; background: var(--gold-soft); color: #70561f; padding: 9px 12px; border-left: 3px solid var(--gold); margin-bottom: 20px; }
.notice-bar > svg { width: 17px; }
.notice-bar button { margin-left: auto; border: 0; background: transparent; color: inherit; width: 32px; height: 32px; display: grid; place-items: center; }
.notice-bar button svg { width: 16px; }

.category-tabs { display: flex; gap: 26px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.category-tabs::-webkit-scrollbar { display: none; }
.category-tabs button { border: 0; background: transparent; min-height: 46px; display: flex; align-items: center; gap: 7px; color: var(--muted); position: relative; white-space: nowrap; padding: 0 1px; }
.category-tabs button.active { color: var(--ink); font-weight: 700; }
.category-tabs button.active::after { content: ""; position: absolute; height: 3px; left: 0; right: 0; bottom: -1px; background: var(--green); }
.category-tabs b { display: inline-grid; place-items: center; min-width: 21px; height: 20px; padding: 0 5px; border-radius: 4px; background: var(--soft); color: var(--muted); font-size: 11px; }
.category-tabs button.active b { background: var(--green-soft); color: var(--green); }
.result-toolbar { min-height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 14px; border-bottom: 1px solid var(--line); }
.status-filters { display: flex; gap: 5px; flex-wrap: wrap; }
.status-filters button { border: 0; background: transparent; color: var(--muted); padding: 6px 9px; border-radius: 4px; }
.status-filters button.active { background: var(--green-soft); color: var(--green-dark); font-weight: 600; }
.toolbar-actions { display: flex; align-items: center; gap: 8px; }
.report-button { min-height: 36px; padding: 0 12px; white-space: nowrap; color: var(--green-dark); }
.report-button svg { width: 16px; }
.sort-label { color: var(--muted); font-size: 12px; }
#sortSelect { width: 140px; height: 36px; padding: 0 28px 0 10px; }
.toolbar-actions .icon-button { width: 36px; height: 36px; }

.result-list { min-height: 320px; }
.job-row { display: grid; grid-template-columns: minmax(0, 1fr) 164px 44px; gap: 22px; padding: 22px 0; border-bottom: 1px solid var(--line); align-items: center; transition: background-color .18s ease; }
.job-row:hover { background: rgba(255,255,255,.62); }
.job-row-main { min-width: 0; cursor: pointer; }
.job-title-line { display: flex; align-items: flex-start; gap: 10px; }
.type-icon { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 6px; flex: 0 0 auto; }
.type-icon svg { width: 19px; }
.type-civil { background: var(--red-soft); color: var(--red); }
.type-selected { background: var(--gold-soft); color: var(--gold); }
.type-national { background: var(--orange-soft); color: var(--orange); }
.type-institution { background: var(--blue-soft); color: var(--blue); }
.type-teacher { background: var(--plum-soft); color: var(--plum); }
.type-threeSupports { background: var(--blue-soft); color: var(--green-dark); }
.type-soe { background: var(--green-soft); color: var(--green); }
.type-bank { background: var(--gold-soft); color: var(--gold); }
.job-heading { min-width: 0; }
.job-heading h3 { font-size: 16px; line-height: 1.45; margin: -2px 0 4px; font-weight: 700; }
.job-org { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.job-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 16px; color: var(--muted); font-size: 12px; margin: 14px 0 0 48px; }
.job-meta span { display: inline-flex; align-items: center; gap: 5px; }
.job-meta svg { width: 14px; }
.job-meta .cutoff-meta { color: var(--gold); font-weight: 600; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 0 48px; }
.tag { display: inline-flex; align-items: center; min-height: 24px; background: var(--soft); color: #56645f; padding: 3px 7px; border-radius: 4px; font-size: 11px; }
.match-tag { background: var(--green-soft); color: var(--green-dark); }
.mismatch-tag { background: var(--orange-soft); color: #9b4a24; }
.job-deadline { border-left: 1px solid var(--line); padding-left: 22px; }
.status-badge { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 700; margin-bottom: 8px; }
.status-badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status-open { color: var(--green); }
.status-upcoming { color: var(--orange); }
.status-closed { color: #89938f; }
.deadline-date { display: block; font-weight: 700; font-size: 14px; margin-bottom: 3px; }
.deadline-note { color: var(--muted); font-size: 11px; }
.save-job { border: 0; background: transparent; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 6px; color: var(--muted); }
.save-job:hover { background: var(--green-soft); color: var(--green); }
.save-job.saved { color: var(--green); background: var(--green-soft); }
.save-job.saved svg { fill: currentColor; }
.empty-state { text-align: center; padding: 68px 20px; color: var(--muted); }
.empty-state > svg { width: 42px; height: 42px; color: #98a49f; }
.empty-state h3 { color: var(--ink); font-size: 17px; margin: 14px 0 6px; }
.empty-state p { margin: 0 0 18px; }
.pagination { display: flex; align-items: center; justify-content: center; gap: 14px; padding: 24px 0 4px; }
.pagination[hidden] { display: none; }
.pagination span { min-width: 92px; color: var(--muted); text-align: center; font-size: 12px; }
.pagination .secondary-button { min-height: 38px; }
.pagination button:disabled { cursor: not-allowed; opacity: .45; }

.drawer-backdrop { position: fixed; inset: 0; background: rgba(13, 25, 21, .28); z-index: 30; }
.detail-drawer { position: fixed; z-index: 31; top: 0; right: 0; width: min(510px, 100%); height: 100vh; background: var(--surface); box-shadow: var(--shadow); padding: 24px 30px 40px; overflow-y: auto; transform: translateX(103%); transition: transform .24s ease; }
.detail-drawer.open { transform: translateX(0); }
.drawer-header { display: flex; justify-content: space-between; align-items: flex-start; }
.drawer-content-title { font-size: 24px; line-height: 1.45; margin: 12px 0 7px; }
.drawer-org { color: var(--muted); margin: 0 0 20px; }
.match-banner { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 7px; background: var(--green-soft); margin-bottom: 24px; }
.match-banner.warn { background: var(--orange-soft); }
.match-score { font-size: 24px; font-weight: 700; color: var(--green-dark); }
.match-banner.warn .match-score { color: #94421e; }
.match-copy strong, .match-copy span { display: block; }
.match-copy span { color: var(--muted); font-size: 12px; margin-top: 2px; }
.drawer-section { padding: 20px 0; border-top: 1px solid var(--line); }
.drawer-section h3 { font-size: 15px; margin: 0 0 14px; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px 20px; }
.detail-item span, .timeline-item span { display: block; color: var(--muted); font-size: 11px; margin-bottom: 4px; }
.detail-item strong { display: block; font-size: 13px; line-height: 1.65; overflow-wrap: anywhere; white-space: pre-wrap; }
.detail-item.detail-wide { grid-column: 1 / -1; }
.detail-grid-long { gap: 13px; }
.detail-prose { margin: 0; color: var(--ink); font-size: 13px; line-height: 1.75; white-space: pre-wrap; overflow-wrap: anywhere; }
.detail-loading { min-height: 180px; display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--muted); }
.detail-loading span { width: 18px; height: 18px; border: 2px solid var(--line); border-top-color: var(--green); border-radius: 50%; animation: detail-spin .8s linear infinite; }
.detail-loading strong { font-size: 13px; }
.detail-load-error { display: flex; gap: 9px; align-items: flex-start; padding: 12px 14px; margin-bottom: 16px; background: #fff6e8; border: 1px solid #f0d7aa; color: #74501b; font-size: 12px; line-height: 1.6; }
.detail-load-error svg { width: 17px; height: 17px; flex: 0 0 auto; margin-top: 1px; }
@keyframes detail-spin { to { transform: rotate(360deg); } }
.cutoff-detail strong { color: var(--gold); }
.cutoff-source { margin: 14px 0 0; color: var(--muted); font-size: 11px; line-height: 1.65; }
.cutoff-source a { color: var(--green-dark); overflow-wrap: anywhere; text-underline-offset: 2px; }
.requirement-list { display: grid; gap: 10px; }
.requirement { display: flex; align-items: flex-start; gap: 8px; }
.requirement svg { width: 17px; margin-top: 2px; color: var(--green); }
.requirement.fail svg { color: var(--orange); }
.timeline { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.timeline-item strong { font-size: 13px; }
.drawer-actions { display: grid; grid-template-columns: 1fr auto; gap: 10px; margin-top: 8px; }
.drawer-actions a { text-decoration: none; }
.drawer-actions.has-two-sources { grid-template-columns: 1fr 1fr; }
.drawer-actions.has-two-sources .primary-button { grid-column: 1 / -1; }
.source-note { color: var(--muted); font-size: 11px; line-height: 1.65; margin-top: 12px; }
.toast { position: fixed; left: 50%; bottom: 28px; z-index: 60; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; background: var(--ink); color: white; padding: 10px 14px; border-radius: 6px; box-shadow: var(--shadow); transition: .2s ease; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.tooltip { position: fixed; z-index: 80; pointer-events: none; background: var(--ink); color: white; padding: 6px 8px; border-radius: 4px; font-size: 11px; opacity: 0; transition: opacity .12s; }
.tooltip.show { opacity: 1; }
.mobile-only { display: none; }

@media (max-width: 900px) {
  .workspace { display: block; }
  .filter-panel { position: fixed; z-index: 41; inset: 0 auto 0 0; top: 0; width: min(340px, 92vw); height: 100vh; min-height: 100vh; transform: translateX(-103%); transition: transform .24s ease; overflow-y: auto; box-shadow: var(--shadow); }
  .filter-panel.open { transform: translateX(0); }
  .mobile-only, .filter-trigger { display: inline-grid; }
  .filter-trigger { display: inline-flex; }
  .main-content { padding-top: 26px; }
}

@media (max-width: 660px) {
  .topbar { height: 62px; padding: 0 15px; }
  .brand small { display: none; }
  .topbar-actions { gap: 5px; }
  .main-content { padding: 22px 15px 60px; }
  .content-header { align-items: center; }
  .content-header h2 { font-size: 22px; }
  .content-header p { font-size: 12px; }
  .filter-trigger { flex: 0 0 auto; white-space: nowrap; }
  .category-tabs { gap: 14px; }
  .category-tabs b { display: none; }
  .result-toolbar { align-items: flex-start; padding: 12px 0; flex-direction: column; }
  .toolbar-actions { width: 100%; flex-wrap: wrap; }
  .report-button { width: 100%; }
  .sort-label { margin-left: auto; }
  .job-row { grid-template-columns: minmax(0, 1fr) 40px; gap: 8px; padding: 18px 0; }
  .job-deadline { grid-column: 1 / -1; grid-row: 2; margin-left: 48px; border-left: 0; padding-left: 0; display: flex; align-items: center; gap: 9px; }
  .deadline-date, .status-badge { margin: 0; }
  .deadline-note { display: none; }
  .job-meta, .tags { margin-left: 0; }
  .job-meta { gap: 8px 12px; }
  .job-heading h3 { font-size: 15px; }
  .detail-drawer { padding: 20px 18px 34px; }
  .detail-grid { grid-template-columns: 1fr; }
}

@media (max-width: 350px) {
  .paired-filter-row { grid-template-columns: 1fr; gap: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
