:root {
  --bg: #f1f5f9;
  --surface: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --warn: #ea580c;
  --warn-bg: #fff7ed;
  --gold: #b45309;
  --gold-bg: #fffbeb;
  --border: #e2e8f0;
  --radius: 14px;
  --shadow: 0 4px 20px rgba(15, 23, 42, 0.06);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html {
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  padding-bottom: calc(72px + var(--safe-bottom));
  overflow-x: hidden;
  max-width: 100%;
  overscroll-behavior-x: none;
}

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

/* Header — trust in 3 seconds */
.header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 16px 12px;
  background: linear-gradient(165deg, var(--primary-dark), var(--primary));
  color: #fff;
  max-width: 100%;
}

.header-main { display: flex; gap: 12px; align-items: center; min-width: 0; flex: 1; }
.brand-mark {
  width: 44px; height: 44px; border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 2px solid rgba(255,255,255,.35);
  box-shadow: 0 2px 8px rgba(0,0,0,.12);
}
.header h1 { font-size: 17px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.3; }
.brand-title-link {
  color: inherit;
  text-decoration: none;
}
.brand-title-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.header-actions {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  flex-shrink: 0;
}
.xhs-btn {
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(255, 255, 255, 0.45);
  background: rgba(255, 45, 85, 0.28);
  color: #fff;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}
.xhs-btn:hover { background: rgba(255, 45, 85, 0.42); }
.meta { font-size: 12px; opacity: .88; margin-top: 4px; line-height: 1.45; overflow-wrap: anywhere; }

.help-btn {
  flex-shrink: 0;
  border: 1px solid rgba(255,255,255,.3);
  background: rgba(255,255,255,.1);
  color: #fff;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  opacity: .92;
}

.usage-panel {
  max-width: 720px;
  margin: 0 auto;
  padding: 6px 16px 8px;
  background: #fffbeb;
  border-bottom: 1px solid #fde68a;
  font-size: 12px;
  color: #78350f;
}
.usage-panel summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.usage-panel summary::-webkit-details-marker { display: none; }
.usage-trigger {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 6px 10px;
  border: 1px solid #fde68a;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.65);
}
.usage-trigger:active {
  background: #fff;
  border-color: #fcd34d;
}
.usage-label {
  flex: 1;
  font-weight: 600;
  font-size: 12px;
  color: #a16207;
}
.usage-label-open { display: none; }
.usage-panel[open] .usage-label-closed { display: none; }
.usage-panel[open] .usage-label-open { display: block; }
.usage-chevron {
  flex-shrink: 0;
  font-size: 9px;
  color: #ca8a04;
  transition: transform 0.2s;
}
.usage-panel[open] .usage-chevron { transform: rotate(180deg); }
.usage-body {
  margin-top: 8px;
  line-height: 1.55;
  font-size: 12px;
}
.usage-body p { margin-bottom: 6px; }
.usage-body p:last-child { margin-bottom: 0; }

/* Quick channels — return visits */
.channels {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  padding: 12px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  max-width: 100%;
}

.channel {
  border: 1px solid var(--border);
  background: var(--bg);
  border-radius: 10px;
  padding: 10px 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  line-height: 1.25;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.channel em {
  display: block;
  font-style: normal;
  font-size: 15px;
  font-weight: 800;
  color: var(--text);
  margin-top: 2px;
}
.channel.active {
  border-color: #93c5fd;
  background: #eff6ff;
  color: var(--primary);
}
.channel.active em { color: var(--primary); }
.channel-fav em { color: #b45309; }
.channel-fav.active { border-color: #fcd34d; background: #fffbeb; color: #b45309; }
.channel-fav.active em { color: #b45309; }

/* Filters — mobile first chips */
.filters {
  padding: 12px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  max-width: 100%;
  overflow: hidden;
}

.filter-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  max-width: 100%;
  min-width: 0;
}
.filter-row .label {
  flex: 0 0 36px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}
.filter-row-city { align-items: flex-start; }
.filter-row-city .label { margin-top: 8px; }
.filter-hint {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.45;
  margin: -4px 0 10px 46px;
}

.chips { display: flex; gap: 8px; flex: 1; min-width: 0; max-width: 100%; }
.scroll-x {
  overflow-x: auto;
  overflow-y: hidden;
  flex-wrap: nowrap;
  scrollbar-width: none;
  padding-bottom: 2px;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  touch-action: pan-x;
}
.scroll-x::-webkit-scrollbar { display: none; }

.chip {
  flex: 0 0 auto;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 13px;
  cursor: pointer;
  touch-action: manipulation;
  white-space: nowrap;
  font-family: inherit;
}
.chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  font-weight: 600;
}
.chip-more {
  flex-shrink: 0;
  border-style: dashed;
  color: var(--primary);
  font-weight: 600;
  background: #eff6ff;
}

.search-wrap { display: block; margin-top: 4px; }
#q {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 15px;
  background: var(--bg);
}

.filter-actions {
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
}
.text-btn {
  border: none;
  background: none;
  color: var(--primary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 0;
}

.list-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 12px;
  padding: 12px 16px 8px;
  font-size: 13px;
  color: var(--muted);
  max-width: 100%;
}

.list {
  padding: 0 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 720px;
  margin: 0 auto;
  width: 100%;
}

/* Job card — 10 second decision */
.job {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  max-width: 100%;
  overflow: hidden;
}
.job.expired { opacity: .55; }

.job-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
  min-width: 0;
}
.job-head > div:first-child {
  min-width: 0;
  flex: 1;
}
.head-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}
.fav-btn {
  border: none;
  background: var(--bg);
  border-radius: 8px;
  width: 32px;
  height: 32px;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  color: var(--muted);
}
.fav-btn.on { color: #f59e0b; }

.note-preview {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
  margin-bottom: 10px;
  padding: 8px 10px;
  background: var(--bg);
  border-radius: 8px;
}
.company {
  font-size: 13px;
  font-weight: 700;
  color: var(--primary);
  overflow-wrap: anywhere;
}
.role {
  font-size: 17px;
  font-weight: 700;
  line-height: 1.35;
  margin-top: 2px;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.deadline-badge {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 6px;
}
.deadline-badge.urgent { background: var(--danger-bg); color: var(--danger); }
.deadline-badge.soon { background: var(--warn-bg); color: var(--warn); }
.deadline-badge.ok { background: #f0fdf4; color: #15803d; }
.deadline-badge.expired { background: #f1f5f9; color: var(--muted); }
.deadline-badge.none { display: none; }

.job-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}
.job-tags span,
.job-tags .city-tag {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 8px;
  background: #f1f5f9;
  color: #475569;
}
.job-tags .city-tag {
  border: 0;
  font: inherit;
  font-size: 12px;
  line-height: inherit;
  cursor: default;
  max-width: 100%;
  text-align: left;
}
.job-tags .city-tag:not(.static) {
  cursor: pointer;
  background: #e8f0fe;
  color: #1d4ed8;
}
.job-tags .city-tag.expanded {
  white-space: normal;
}
.job-tags .mianbi { background: var(--gold-bg); color: var(--gold); font-weight: 600; }

.job-dates {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 12px;
}

.job-actions {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 8px;
}
.job-actions a {
  text-align: center;
  padding: 11px 12px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}
.btn-ghost {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary.disabled {
  pointer-events: none;
  background: #94a3b8;
}
.btn-ghost.disabled {
  pointer-events: none;
  opacity: 0.55;
}

.empty {
  text-align: center;
  padding: 48px 20px;
  color: var(--muted);
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px dashed var(--border);
}

.load-more-wrap {
  max-width: 720px;
  margin: 0 auto 16px;
  padding: 0 16px;
  text-align: center;
}
.load-more-hint {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 8px;
}
.load-more {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--primary);
  cursor: pointer;
}

/* Bottom tabbar */
.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 8px 4px calc(8px + var(--safe-bottom));
  z-index: 20;
  max-width: 100%;
}
.tab {
  border: none;
  background: none;
  font-size: 11px;
  color: var(--muted);
  padding: 6px 2px;
  cursor: pointer;
  font-weight: 600;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tab.active { color: var(--primary); }

.site-footer {
  max-width: 720px;
  margin: 0 auto;
  padding: 16px 16px calc(88px + var(--safe-bottom));
  font-size: 11px;
  line-height: 1.55;
  color: var(--muted);
  text-align: center;
  overflow-wrap: anywhere;
}
.footer-xhs {
  color: var(--primary);
  font-weight: 700;
  text-decoration: none;
}
.footer-xhs:hover { text-decoration: underline; }
.footer-note {
  margin-top: 6px;
  font-size: 10px;
  color: var(--muted);
  opacity: 0.9;
}

@media (min-width: 768px) {
  body { padding-bottom: 24px; }
  .tabbar { display: none; }
  .site-footer { padding-bottom: 24px; }
  .channels { max-width: 720px; margin: 0 auto; border-radius: 0 0 12px 12px; }
  .filters { max-width: 720px; margin: 0 auto; }
  .header { padding-left: max(16px, calc(50% - 360px)); padding-right: max(16px, calc(50% - 360px)); }
}

@media (min-width: 900px) {
  .list {
    max-width: 960px;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    align-items: start;
  }
  .empty { grid-column: 1 / -1; }
}

.today-brief-date {
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 8px;
}
.today-brief-lead {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 10px;
}
.today-brief-lead em {
  font-style: normal;
  color: var(--primary);
  font-size: 20px;
}
.today-brief-companies {
  margin: 0 0 12px 18px;
  font-size: 14px;
  line-height: 1.65;
  color: var(--text);
}
.today-brief-companies li { margin-bottom: 4px; }
.today-brief-meta {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
  margin-bottom: 4px;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(15, 23, 42, 0.55);
  display: grid;
  place-items: center;
  padding: 20px;
}
.modal-overlay[hidden] { display: none !important; }

.modal-card {
  width: min(100%, 400px);
  background: var(--surface);
  border-radius: 16px;
  padding: 22px 20px 18px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
}
.modal-card h2 {
  font-size: 18px;
  margin-bottom: 14px;
}
.modal-list {
  margin: 0 0 12px 18px;
  font-size: 14px;
  line-height: 1.65;
  color: var(--text);
}
.modal-list li { margin-bottom: 8px; }
.modal-list strong { color: var(--primary-dark); }
.modal-tip {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
  margin-bottom: 16px;
}
.modal-actions {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 10px;
}
.modal-actions-single {
  grid-template-columns: 1fr;
}
.modal-card-wide {
  width: min(100%, 440px);
  max-height: min(85vh, 640px);
  display: flex;
  flex-direction: column;
}
.modal-search {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 15px;
  margin-bottom: 12px;
  background: var(--bg);
}
.city-list {
  overflow-y: auto;
  max-height: min(50vh, 360px);
  margin-bottom: 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
}
.city-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 11px 14px;
  border: none;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  font-size: 14px;
  cursor: pointer;
  text-align: left;
}
.city-item:last-child { border-bottom: none; }
.city-item em {
  font-style: normal;
  font-size: 12px;
  color: var(--muted);
}
.city-item.active {
  background: #eff6ff;
  color: var(--primary);
  font-weight: 600;
}
.city-list-empty {
  padding: 24px 14px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}
.modal-btn {
  padding: 11px 12px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
}
.modal-btn.ghost {
  background: var(--bg);
  color: var(--muted);
  border: 1px solid var(--border);
}
.modal-btn.primary {
  background: var(--primary);
  color: #fff;
}
