/* ================================================================
   2027 国考职位查询 · 样式
   ================================================================ */

:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #f8f9fb;
  --surface-3: #eef0f4;
  --text: #14171a;
  --text-2: #5b6472;
  --text-3: #8b95a5;
  --border: #e2e5ea;
  --border-2: #cdd3dc;
  --accent: #1e5fd8;
  --accent-soft: #e8efff;
  --ok: #12805c;
  --ok-soft: #e3f6ef;
  --warn: #a5651a;
  --warn-soft: #fdf1dd;
  --muted-soft: #eef0f3;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 8px 24px rgba(16, 24, 40, .06);
  --radius: 12px;
  --radius-sm: 8px;
  --row-h: 108px;
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #101215;
  --surface: #17191d;
  --surface-2: #1d2025;
  --surface-3: #24282e;
  --text: #e9ecf1;
  --text-2: #a2acbb;
  --text-3: #78828f;
  --border: #2b3038;
  --border-2: #3a414b;
  --accent: #6ea1ff;
  --accent-soft: #1b2740;
  --ok: #4bd0a0;
  --ok-soft: #14302a;
  --warn: #e0a45c;
  --warn-soft: #33260f;
  --muted-soft: #24282e;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .3);
  color-scheme: dark;
}

* { box-sizing: border-box; }

/* 注意：下面这些元素带 display:flex，类选择器优先级高于 UA 的 [hidden]{display:none}，
   不加 !important 的话 el.hidden = true 会失效，面板会一直盖在页面上。 */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
               "Microsoft YaHei", "Source Han Sans SC", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
}

h1, h2, h3 { margin: 0; font-weight: 600; }

/* ---------------------------------------------------------- 顶栏 */
.topbar {
  flex: 0 0 auto;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  z-index: 30;
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 18px;
  max-width: 1680px;
  margin: 0 auto;
}

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

.brand-mark {
  flex: 0 0 auto;
  width: 38px; height: 38px;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600; letter-spacing: .5px;
}

.brand-text { min-width: 0; }
.brand-text h1 { font-size: 16px; letter-spacing: .2px; }
.brand-text p { margin: 1px 0 0; font-size: 12px; color: var(--text-2); }

.topbar-actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }

.ghost-btn {
  appearance: none;
  border: 1px solid var(--border-2);
  background: var(--surface);
  color: var(--text-2);
  font: inherit;
  font-size: 13px;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, color .15s, border-color .15s;
}
.ghost-btn:hover { background: var(--surface-3); color: var(--text); }
.ghost-btn[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.icon-btn { padding: 6px 10px; font-size: 15px; line-height: 1; }

.link-btn {
  appearance: none; border: 0; background: none; color: var(--accent);
  font: inherit; font-size: 13px; cursor: pointer; padding: 2px 4px;
}

/* ---------------------------------------------------------- 布局 */
.layout {
  flex: 1 1 auto;
  display: flex;
  min-height: 0;
  max-width: 1680px;
  width: 100%;
  margin: 0 auto;
}

/* ---------------------------------------------------------- 筛选栏 */
.filters {
  flex: 0 0 320px;
  width: 320px;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 16px 16px 40px;
}

.filters-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.filters-head h2 { font-size: 14px; }
.fh-right { display: flex; align-items: center; gap: 6px; }
.filters-mask { display: none; }
body.no-scroll { overflow: hidden; }
.filters h2.sec {
  font-size: 14px;
  margin: 22px 0 12px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.field { margin-bottom: 14px; }
.field > label {
  display: block;
  font-size: 12.5px;
  color: var(--text-2);
  margin-bottom: 5px;
  font-weight: 500;
}

input[type="text"], input:not([type]), select, .kw {
  width: 100%;
  appearance: none;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font: inherit;
  font-size: 13.5px;
  padding: 8px 10px;
  transition: border-color .15s, box-shadow .15s;
}
select {
  background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%),
                    linear-gradient(135deg, var(--text-3) 50%, transparent 50%);
  background-position: right 14px center, right 9px center;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 28px;
}
input:focus, select:focus, .kw:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.hint { margin: 5px 0 0; font-size: 11.5px; color: var(--text-3); line-height: 1.45; }

.checks { display: flex; flex-wrap: wrap; gap: 6px; }
.chk {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12.5px;
  color: var(--text-2);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 10px 4px 8px;
  cursor: pointer;
  user-select: none;
  transition: background .15s, border-color .15s, color .15s;
}
.chk:hover { border-color: var(--border-2); }
.chk input { appearance: none; width: 13px; height: 13px; margin: 0; border: 1.5px solid var(--border-2); border-radius: 3px; background: var(--surface); cursor: pointer; position: relative; }
.chk input:checked { background: var(--accent); border-color: var(--accent); }
.chk input:checked::after {
  content: ""; position: absolute; left: 3.5px; top: 0.5px;
  width: 3px; height: 7px; border: solid #fff; border-width: 0 1.5px 1.5px 0; transform: rotate(45deg);
}
.chk:has(input:checked) { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

/* 多选下拉 */
.multi { position: relative; }
.multi-btn {
  width: 100%;
  text-align: left;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 28px 8px 10px;
  font: inherit; font-size: 13.5px; color: var(--text);
  cursor: pointer;
  position: relative;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.multi-btn::after {
  content: ""; position: absolute; right: 12px; top: 50%; margin-top: -3px;
  border-left: 4.5px solid transparent; border-right: 4.5px solid transparent;
  border-top: 5px solid var(--text-3);
}
.multi-btn.placeholder { color: var(--text-3); }
.multi-panel {
  position: absolute; z-index: 40; left: 0; right: 0; top: calc(100% + 4px);
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  max-height: 280px;
  display: flex; flex-direction: column;
}
.multi-tools { display: flex; gap: 10px; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.multi-opts { overflow-y: auto; padding: 6px; }
.multi-opt {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px; border-radius: 6px; font-size: 13px; cursor: pointer;
  color: var(--text-2);
}
.multi-opt:hover { background: var(--surface-3); }
.multi-opt input { appearance: none; width: 13px; height: 13px; margin: 0; border: 1.5px solid var(--border-2); border-radius: 3px; background: var(--surface); position: relative; }
.multi-opt input:checked { background: var(--accent); border-color: var(--accent); }
.multi-opt input:checked::after {
  content: ""; position: absolute; left: 3.5px; top: 0.5px;
  width: 3px; height: 7px; border: solid #fff; border-width: 0 1.5px 1.5px 0; transform: rotate(45deg);
}
.multi-opt .n { margin-left: auto; font-size: 11.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }

.more { border-top: 1px solid var(--border); margin-top: 22px; padding-top: 14px; }
.more > summary {
  font-size: 13.5px; font-weight: 500; cursor: pointer; list-style: none;
  color: var(--text); display: flex; align-items: center; gap: 6px; margin-bottom: 4px;
}
.more > summary::-webkit-details-marker { display: none; }
.more > summary::before { content: "＋"; color: var(--text-3); font-size: 12px; }
.more[open] > summary::before { content: "－"; }
.more .field { margin-top: 14px; }

.disclaimer-mini { margin: 20px 0 0; font-size: 11.5px; color: var(--text-3); line-height: 1.5; }

/* ---------------------------------------------------------- 结果区 */
.results { flex: 1 1 auto; display: flex; flex-direction: column; min-width: 0; min-height: 0; }

.resultbar {
  flex: 0 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.rb-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.rb-right { display: flex; align-items: center; gap: 8px; min-width: 0; }
.count { font-size: 13.5px; color: var(--text-2); white-space: nowrap; }
.count b { color: var(--text); font-size: 15px; font-variant-numeric: tabular-nums; }
.kw { width: 240px; }
.sort { width: 132px; flex: 0 0 auto; }
.only-mobile { display: none; }

.activebar { flex: 0 0 auto; }
.activebar:not(:empty) {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 8px 16px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; color: var(--accent);
  background: var(--accent-soft);
  border-radius: 999px; padding: 3px 8px;
}
.chip button { appearance: none; border: 0; background: none; color: inherit; cursor: pointer; font-size: 13px; line-height: 1; padding: 0; opacity: .7; }
.chip button:hover { opacity: 1; }

.list {
  flex: 1 1 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  position: relative;
  padding: 0;
}
.list-inner { position: relative; width: 100%; }

.row {
  position: absolute; left: 0; right: 0;
  height: var(--row-h);
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  display: flex; gap: 12px;
  cursor: pointer;
  overflow: hidden;
  transition: background .12s;
}
.row:hover { background: var(--surface); }
.row.is-fav { background: linear-gradient(90deg, var(--accent-soft), transparent 60%); }

.row-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 3px; justify-content: center; }
.row-title {
  font-size: 14.5px; font-weight: 600; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.row-sub {
  font-size: 12.5px; color: var(--text-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.row-tags { display: flex; flex-wrap: wrap; gap: 6px; font-size: 12px; margin-top: 1px; }
.tag {
  display: inline-flex; align-items: center; gap: 3px;
  background: var(--surface-3); color: var(--text-2);
  border-radius: 5px; padding: 1px 6px; white-space: nowrap;
}
.tag.accent { background: var(--accent-soft); color: var(--accent); }
.tag.ok { background: var(--ok-soft); color: var(--ok); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.tag.mute { background: var(--muted-soft); color: var(--text-3); }

.row-side { flex: 0 0 auto; display: flex; flex-direction: column; align-items: flex-end; justify-content: center; gap: 6px; }
.row-code { font-size: 11.5px; color: var(--text-3); font-variant-numeric: tabular-nums; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.fav-btn {
  appearance: none; border: 1px solid var(--border); background: var(--surface);
  color: var(--text-3); font-size: 15px; line-height: 1;
  width: 30px; height: 30px; border-radius: 8px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.fav-btn:hover { border-color: var(--accent); color: var(--accent); }
.fav-btn.on { background: var(--accent); border-color: var(--accent); color: #fff; }

.loading, .empty {
  flex: 1 1 auto;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; color: var(--text-2); padding: 40px;
}
.empty-title { font-size: 15px; font-weight: 600; color: var(--text); margin: 0; }
.empty-sub { font-size: 13px; margin: 0; }
.spinner {
  width: 26px; height: 26px; border-radius: 50%;
  border: 2.5px solid var(--border-2); border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------- 详情抽屉 */
.drawer-mask {
  position: fixed; inset: 0; background: rgba(10, 14, 20, .45);
  z-index: 60; animation: fade .18s ease;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: min(560px, 100vw);
  background: var(--surface);
  border-left: 1px solid var(--border);
  z-index: 61;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow);
  animation: slide .22s cubic-bezier(.2, .7, .3, 1);
}
@keyframes slide { from { transform: translateX(24px); opacity: .4; } to { transform: none; opacity: 1; } }

.drawer-head {
  flex: 0 0 auto;
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--border);
}
.drawer-head h2 { font-size: 16px; line-height: 1.4; }
.drawer-body { flex: 1 1 auto; overflow-y: auto; padding: 16px 18px 40px; }

.dsec { margin-bottom: 18px; }
.dsec h3 { font-size: 12.5px; color: var(--text-3); font-weight: 500; margin-bottom: 7px; letter-spacing: .3px; }
.dgrid { display: grid; grid-template-columns: 92px 1fr; gap: 7px 12px; font-size: 13.5px; }
.dgrid dt { color: var(--text-3); font-size: 12.5px; }
.dgrid dd { margin: 0; word-break: break-word; }
.dnote {
  white-space: pre-wrap; word-break: break-word;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 12px; font-size: 13px; line-height: 1.65;
}
.dmatch {
  border-radius: var(--radius-sm); padding: 10px 12px; font-size: 13px; line-height: 1.6;
  margin-bottom: 16px;
}
.dmatch.ok { background: var(--ok-soft); color: var(--ok); }
.dmatch.warn { background: var(--warn-soft); color: var(--warn); }
.dmatch.na { background: var(--muted-soft); color: var(--text-2); }
.dactions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.dactions button {
  appearance: none; font: inherit; font-size: 13px; cursor: pointer;
  border: 1px solid var(--border-2); background: var(--surface); color: var(--text-2);
  border-radius: 999px; padding: 6px 14px;
}
.dactions button:hover { border-color: var(--accent); color: var(--accent); }

/* ---------------------------------------------------------- 岗位对比 */
.cmp-mask {
  position: fixed; inset: 0; background: rgba(10, 14, 20, .5);
  z-index: 70; animation: fade .18s ease;
}
.cmp-panel {
  position: fixed; top: 3vh; bottom: 3vh; left: 2vw; right: 2vw;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  z-index: 71;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow);
  overflow: hidden;
  animation: fade .2s ease;
}
.cmp-head {
  flex: 0 0 auto;
  display: flex; align-items: baseline; gap: 10px;
  padding: 14px 18px 12px;
  border-bottom: 1px solid var(--border);
}
.cmp-head h2 { font-size: 15px; }
.cmp-sub { margin: 0; font-size: 12.5px; color: var(--text-3); }
.cmp-head .icon-btn { margin-left: auto; align-self: center; }
.cmp-hint {
  flex: 0 0 auto;
  padding: 8px 18px;
  font-size: 12px; color: var(--text-3); line-height: 1.5;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.cmp-body { flex: 1 1 auto; overflow: auto; overscroll-behavior: contain; }

.cmp-table { border-collapse: separate; border-spacing: 0; font-size: 13px; }
.cmp-table th, .cmp-table td {
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  padding: 9px 12px;
  text-align: left; vertical-align: top;
  min-width: 190px; max-width: 300px;
  word-break: break-word;
}
.cmp-table thead th {
  position: sticky; top: 0; z-index: 3;
  background: var(--surface-2);
  font-weight: 500; font-size: 13px; color: var(--text);
}
.cmp-code { display: block; font-size: 11.5px; color: var(--text-3); font-weight: 400; margin-top: 2px; }
.cmp-table tbody th {
  position: sticky; left: 0; z-index: 2;
  background: var(--surface-2);
  color: var(--text-3); font-weight: 500; font-size: 12.5px;
  white-space: nowrap;
  min-width: 90px; max-width: 90px;
}
.cmp-table thead th:first-child { left: 0; z-index: 4; min-width: 90px; max-width: 90px; }
/* 有差异的字段整行高亮，便于一眼看出关键区别 */
.cmp-table tr.diff td, .cmp-table tr.diff th { background: var(--warn-soft); }
.cmp-table tr.diff th { color: var(--warn); }
.cmp-table td.cmp-null { color: var(--text-3); }
.cmp-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.cmp-tag {
  display: inline-block; font-size: 11.5px; line-height: 1.55;
  padding: 0 7px; border-radius: 999px;
  background: var(--muted-soft); color: var(--text-2);
}
.cmp-tag.warn { background: var(--warn-soft); color: var(--warn); }
.cmp-tag.ok { background: var(--ok-soft); color: var(--ok); }

@media (max-width: 860px) {
  .cmp-panel { top: 0; bottom: 0; left: 0; right: 0; border-radius: 0; border: 0; }
  .cmp-table th, .cmp-table td { min-width: 155px; max-width: 58vw; font-size: 12.5px; }
  .cmp-head { padding: 12px 14px 10px; }
  .cmp-hint { padding: 7px 14px; }
}

/* ---------------------------------------------------------- 页脚 */
.footer {
  flex: 0 0 auto;
  max-height: 30vh; overflow-y: auto;
  padding: 14px 18px 18px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  font-size: 11.5px; color: var(--text-3); line-height: 1.6;
}
.footer > p { margin: 0 auto; max-width: 1000px; }
.warn-line { margin-top: 6px !important; color: var(--warn); }

/* ---------------------------------------------------------- 移动端 */
@media (max-width: 860px) {
  :root { --row-h: 124px; }
  .only-mobile { display: inline-flex; }
  .brand-text p { display: none; }
  .kw { width: 100%; min-width: 0; }
  .rb-right { flex: 1 1 auto; }
  .sort { display: none; }

  .filters {
    position: fixed; top: 0; bottom: 0; left: 0;
    width: min(340px, 88vw);
    z-index: 65;
    transform: translateX(-102%);
    transition: transform .24s cubic-bezier(.2, .7, .3, 1);
    box-shadow: var(--shadow);
    padding-top: 18px;
  }
  .filters.open { transform: none; }
  /* 遮罩：点它关闭抽屉，同时挡住被压在下面的"筛选"按钮 */
  .filters-mask {
    display: block;
    position: fixed; inset: 0; z-index: 64;
    background: rgba(0, 0, 0, .45);
    animation: fade .18s ease;
  }
  .row { padding: 10px 12px; }
  .row-code { display: none; }
  .footer { max-height: 22vh; }
}

@media (max-width: 520px) {
  .topbar-inner { padding: 8px 12px; }
  .brand-text h1 { font-size: 14.5px; }
  .resultbar { padding: 8px 12px; gap: 8px; flex-wrap: wrap; }
  .rb-left, .rb-right { width: 100%; }
  .rb-right { order: 2; }
  .count { font-size: 12.5px; }
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
