:root {
  --ink: #1a2332;
  --navy: #1c2c4a;
  --paper: #efe9dc;
  --card: #fffcf6;
  --line: #e4d9c6;
  --gold: #b08d57;
  --seal: #9a2b2b;
  --mute: #6d665b;
  --ok: #2f6b4f;
  --bad: #8f2d2d;
  --tap: 44px;
  --radius: 14px;
  --shadow: 0 8px 24px rgba(28, 44, 74, 0.08);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
}
body {
  font-family: "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", sans-serif;
  color: var(--ink);
  background: var(--paper);
  -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea {
  font: inherit;
  color: inherit;
  font-size: 16px;
}
button { cursor: pointer; }
.app {
  display: grid;
  grid-template-columns: 220px 1fr;
  height: 100%;
  min-height: 0;
}
.sider {
  background: #1c2c4a;
  color: #f6f0e4;
  padding: 28px 18px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  min-height: 0;
  overflow: auto;
}
.brand { display: flex; gap: 12px; align-items: center; }
.seal {
  width: 44px;
  height: 44px;
  border: 1.5px solid #e8c989;
  color: #e8c989;
  display: grid;
  place-items: center;
  font-family: "Songti SC", "STSong", serif;
  letter-spacing: 1px;
  border-radius: 10px;
  flex-shrink: 0;
}
.brand strong { display: block; font-size: 16px; }
.brand p { margin: 4px 0 0; color: #c9c0b0; font-size: 12px; }
.sider nav { display: grid; gap: 6px; }
.nav-btn {
  background: transparent;
  border: 0;
  color: #d8d0c4;
  text-align: left;
  padding: 11px 14px;
  min-height: var(--tap);
  border-radius: 12px;
}
.nav-btn.active, .nav-btn:hover {
  background: #2a3d60;
  color: #f6f0e4;
}
.sider-foot {
  margin-top: auto;
  font-size: 12px;
  color: #c9c0b0;
  line-height: 1.6;
  white-space: pre-line;
}
main {
  min-width: 0;
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 14px 18px 12px;
  overflow: hidden;
}
.top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 10px;
  flex-shrink: 0;
}
h1, h2 {
  font-family: "Songti SC", "STSong", "Noto Serif SC", serif;
  font-weight: 600;
}
h1 { font-size: 22px; margin: 0; }
h2 { font-size: 20px; margin: 0 0 12px; }
.top p { display: none; }
.top p, .hint, .empty { color: var(--mute); line-height: 1.6; }
.selected-pill {
  border: 0;
  color: var(--navy);
  padding: 10px 14px;
  font-size: 13px;
  max-width: 280px;
  background: #fff;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-radius: 999px;
  box-shadow: var(--shadow);
  flex-shrink: 0;
}
.view {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.hidden { display: none !important; }
.filters {
  position: relative;
  z-index: 8;
  background: #fffcf6;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 8px 10px;
  margin-bottom: 10px;
  flex-shrink: 0;
}
.search-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.search-input {
  flex: 1 1 200px;
  min-height: 40px;
}
.search-input, input, textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 12px;
  padding: 11px 14px;
  min-height: var(--tap);
  outline: none;
}
.search-input:focus, input:focus, textarea:focus {
  border-color: #c4a56a;
  box-shadow: 0 0 0 3px rgba(176, 141, 87, 0.16);
}
textarea { min-height: 240px; resize: vertical; }
.btn, button.btn {
  background: var(--navy);
  color: #f6f0e4;
  border: 0;
  border-radius: 12px;
  min-height: 40px;
  padding: 0 16px;
  white-space: nowrap;
}
.btn.ghost, button.ghost, .filter-toggle {
  background: #fff;
  color: var(--navy);
  border: 1px solid var(--line);
}
.btn:disabled { opacity: 0.45; }
.filter-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  margin: 0;
  border-radius: 12px;
  min-height: 40px;
  padding: 0 14px;
}
.seg {
  display: inline-flex;
  gap: 4px;
  background: #efe6d4;
  padding: 4px;
  border-radius: 12px;
}
.seg-item {
  border: 0;
  background: transparent;
  color: #3f4654;
  border-radius: 9px;
  min-height: 36px;
  padding: 0 14px;
  font-size: 13px;
  white-space: nowrap;
}
.seg-item.active {
  background: #fff;
  color: var(--navy);
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(28, 44, 74, 0.08);
}
.filter-more {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 10px 16px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}
.filter-more .field:nth-child(n + 2) { grid-column: 1 / -1; }
.filter-more.collapsed { display: none; }
.field { display: grid; gap: 6px; }
.field-label {
  font-size: 12px;
  color: var(--mute);
}
.dropdown { position: relative; }
.dropdown-btn {
  width: 100%;
  max-width: 320px;
  text-align: left;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  min-height: var(--tap);
  padding: 0 40px 0 14px;
  position: relative;
}
.dropdown-btn::after {
  content: "";
  position: absolute;
  right: 16px;
  top: 50%;
  width: 7px;
  height: 7px;
  border-right: 2px solid var(--navy);
  border-bottom: 2px solid var(--navy);
  transform: translateY(-70%) rotate(45deg);
}
.dropdown.open .dropdown-btn::after {
  transform: translateY(-20%) rotate(225deg);
}
.dropdown-panel {
  display: none;
  position: absolute;
  left: 0;
  top: calc(100% + 6px);
  width: min(320px, 100%);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 18px 40px rgba(28, 44, 74, 0.16);
  max-height: 280px;
  overflow: auto;
  z-index: 30;
  padding: 6px;
}
.dropdown.open .dropdown-panel { display: block; }
.dropdown-option {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: #fff;
  border-radius: 8px;
  padding: 10px 12px;
  min-height: 40px;
  color: var(--ink);
}
.dropdown-option:hover,
.dropdown-option.active {
  background: #f4ead6;
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chip {
  border: 1px solid var(--line);
  background: #fff;
  color: #3d4658;
  border-radius: 999px;
  min-height: 34px;
  padding: 0 14px;
  font-size: 13px;
}
.chip.active {
  background: var(--navy);
  border-color: var(--navy);
  color: #f6f0e4;
}
.layout {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(280px, 0.9fr);
  gap: 14px;
  align-items: stretch;
}
.job-list,
.job-detail,
.card {
  background: var(--card);
  min-height: 0;
  overflow: auto;
}
.job-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-right: 4px;
  background: transparent;
}
.job-detail,
.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
}
.job-item {
  position: relative;
  z-index: 1;
  background: #fffcf6;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  cursor: pointer;
  flex-shrink: 0;
}
.job-item.active,
.job-item:hover {
  border-color: #d3c09a;
  background: #fff8ec;
}
.job-item h3 { margin: 0 0 6px; font-size: 15px; font-weight: 600; }
.job-item .chevron { display: none; }
.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  color: var(--mute);
  font-size: 12px;
  align-items: center;
}
.time-line {
  margin-top: 6px;
  font-size: 12px;
  color: #7a6a4e;
}
.tag {
  background: #f3ead8;
  color: #6a5a3c;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
}
.tag.central { background: #f5e1e1; color: var(--seal); }
.sheet-bar { display: none; }
.block { margin-top: 16px; white-space: pre-wrap; line-height: 1.8; }
.block h3 {
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--gold);
  letter-spacing: 1px;
  font-family: inherit;
}
.match-grid {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
#candidateName, .settings-card input, .settings-card textarea { width: 100%; margin: 8px 0 12px; }
.row-actions { display: flex; gap: 8px; margin: 12px 0; flex-wrap: wrap; }
.score { display: flex; align-items: baseline; gap: 12px; }
.score b {
  font-size: 42px;
  font-family: "Songti SC", serif;
  color: var(--navy);
}
.item {
  display: grid;
  grid-template-columns: 16px 1fr;
  gap: 8px;
  margin: 10px 0;
  font-size: 14px;
}
.dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 6px; }
.dot.ok { background: var(--ok); }
.dot.bad { background: var(--bad); }
.rewrite { border-top: 1px dashed var(--line); padding-top: 12px; margin-top: 12px; }
.settings-card { max-width: 640px; overflow: auto; }
.settings-card label { display: block; font-size: 13px; color: var(--mute); }
.linkbox {
  margin-top: 12px;
  padding: 12px;
  background: #f7f1e4;
  border-radius: 12px;
  word-break: break-all;
}
.pager {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 10px 0 2px;
  position: sticky;
  bottom: 0;
  background: var(--paper);
  z-index: 2;
}

@media (max-width: 860px) {
  html, body {
    height: auto;
    overflow: auto;
  }
  .app {
    display: block;
    height: auto;
    min-height: 100%;
  }
  .sider {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 50;
    flex-direction: row;
    padding: 8px 10px var(--safe-bottom);
    gap: 0;
    overflow: visible;
    height: auto;
  }
  .brand, .sider-foot { display: none; }
  .sider nav {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    width: 100%;
    gap: 6px;
  }
  .nav-btn { text-align: center; font-size: 13px; }
  main {
    display: block;
    height: auto;
    overflow: visible;
    padding: 16px 14px calc(88px + var(--safe-bottom));
  }
  .view { display: block; }
  h1 { font-size: 22px; }
  .top { flex-direction: column; gap: 10px; align-items: stretch; }
  .top p { display: block; }
  .selected-pill {
    max-width: none;
    width: 100%;
    white-space: normal;
  }
  .filters { overflow: visible; }
  .search-row { display: grid; grid-template-columns: 1fr 1fr; }
  .search-input,
  .seg { grid-column: 1 / -1; }
  .seg { display: flex; width: 100%; }
  .seg-item { flex: 1; padding: 0 6px; font-size: 12px; }
  .filter-toggle { width: 100%; }
  .filter-more {
    grid-template-columns: 1fr;
  }
  .filter-more .field:nth-child(n + 2) { grid-column: auto; }
  .dropdown-btn { max-width: none; }
  .dropdown-panel {
    position: fixed;
    left: 14px;
    right: 14px;
    top: auto;
    bottom: calc(76px + var(--safe-bottom));
    width: auto;
    max-height: 46vh;
    z-index: 60;
  }
  .dropdown.open .dropdown-panel { display: block; }
  .layout { display: block; }
  .job-list, .card {
    overflow: visible;
  }
  .job-item {
    display: grid;
    grid-template-columns: 1fr 16px;
    gap: 8px;
  }
  .job-item .chevron {
    display: block;
    color: var(--gold);
    font-size: 20px;
  }
  .job-detail {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 40;
    border-radius: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: none;
    visibility: hidden;
    pointer-events: none;
    padding: calc(12px + env(safe-area-inset-top, 0px)) 16px calc(58px + var(--safe-bottom));
  }
  .job-detail.open {
    visibility: visible;
    pointer-events: auto;
  }
  .sheet-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    position: relative;
    top: auto;
    background: #fffcf6;
    padding: 4px 0 12px;
    z-index: 2;
  }
  .job-detail-body {
    flex: 1;
    min-height: 0;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 20px;
  }
  .detail-actions {
    position: relative;
    left: auto;
    right: auto;
    bottom: auto;
    flex-shrink: 0;
    width: auto;
    margin: 0 -16px 0;
    background: #fffcf6;
    padding: 10px 16px;
    border-top: 1px solid var(--line);
    z-index: 2;
    box-shadow: 0 -8px 20px rgba(28, 44, 74, 0.06);
  }
  .detail-actions .btn, .row-actions .btn, .settings-card .btn { width: 100%; }
  .detail-actions .btn { min-height: 48px; }
  .row-actions { flex-direction: column; }
  .match-grid { display: block; }
  .match-grid .card { margin-bottom: 12px; }
  textarea { min-height: 180px; }
  .pager {
    position: static;
    background: transparent;
  }
}
