/* 简历雷达共用设计层（明亮工作台）：令牌 + 基础组件，发布页与管理后台共用。
   页面只写自己的布局。 */

:root {
  color-scheme: light;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", "PingFang SC", "Microsoft YaHei", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "PingFang SC", monospace;

  --ink: #111827;
  --ink-2: #374151;
  --muted: #6b7280;
  --muted-2: #9ca3af;

  --canvas: #f7f8fa;
  --surface: #ffffff;
  --surface-2: #fafbfc;
  --line: #e8ebef;
  --line-2: #f1f3f6;

  --accent: #5b5bd6;
  --accent-strong: #4343b8;
  --accent-soft: #eef0ff;
  --accent-line: #d8dbff;

  --ok: #0f9d58;
  --ok-soft: #e9f7ef;
  --ok-line: #b7e3c9;
  --warn: #b45309;
  --warn-soft: #fef6e7;
  --warn-line: #f0d9a8;
  --bad: #d92d20;
  --bad-soft: #fef1f0;
  --bad-line: #f5c6c2;

  --radius: 16px;
  --radius-sm: 10px;
  --radius-xs: 8px;
  --radius-pill: 999px;

  --shadow-1: 0 1px 2px rgba(16, 24, 40, .04), 0 8px 24px -12px rgba(16, 24, 40, .14);
  --shadow-2: 0 2px 4px rgba(16, 24, 40, .04), 0 14px 32px -18px rgba(16, 24, 40, .24);
  --shadow-3: 0 24px 60px -28px rgba(16, 24, 40, .4);

  --fs-xs: 12px;
  --fs-sm: 13px;
  --fs-base: 14px;
  --fs-md: 15px;
  --fs-lg: 17px;
  --fs-xl: 20px;
  --fs-2xl: 22px;
  --fs-3xl: 30px;

  font-family: var(--font);
  font-size: var(--fs-base);
  color: var(--ink);
  background: var(--canvas);
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

* { box-sizing: border-box; }
html { min-width: 300px; }
body { margin: 0; background: var(--canvas); color: var(--ink); }
h1, h2, h3, h4, p, figure, dl, dd { margin: 0; }
h1, h2, h3 { text-wrap: balance; }
p, li { text-wrap: pretty; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .6; }
a { color: var(--accent); text-underline-offset: 3px; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
h1:focus, h2:focus { outline: none; }

.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; }
.skip-link { position: fixed; top: -80px; left: 16px; z-index: 60; padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); box-shadow: var(--shadow-2); font-size: var(--fs-sm); }
.skip-link:focus { top: 12px; }
.muted { color: var(--muted); }
.mono, .num { font-variant-numeric: tabular-nums; }
.clamp-1, .clamp-2, .clamp-3 { display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden; }
.clamp-1 { -webkit-line-clamp: 1; }
.clamp-2 { -webkit-line-clamp: 2; }
.clamp-3 { -webkit-line-clamp: 3; }

.brand-mark { display: grid; place-items: center; width: 32px; height: 32px; flex: 0 0 32px; border-radius: var(--radius-sm); background: linear-gradient(140deg, #6d6df0, #4b4bd0); box-shadow: 0 4px 12px -4px rgba(91, 91, 214, .8); }
.brand-mark img { width: 17px; height: 17px; filter: brightness(0) invert(1); }

/* ---------- 顶部应用栏（发布页使用） ---------- */
.app-bar { display: flex; align-items: center; gap: 14px; min-height: 64px; padding: 0 max(20px, calc((100% - 1160px) / 2)); background: var(--surface); border-bottom: 1px solid var(--line); }
.app-bar__brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); font-size: var(--fs-lg); font-weight: 700; letter-spacing: -.01em; text-decoration: none; white-space: nowrap; }
.app-bar__crumb { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: var(--fs-sm); }
.app-bar__crumb b { color: var(--ink); font-weight: 600; }
.app-bar__actions { display: flex; align-items: center; gap: 10px; margin-left: auto; min-width: 0; }
.app-bar__user { max-width: 190px; overflow: hidden; color: var(--muted); font-size: var(--fs-sm); text-overflow: ellipsis; white-space: nowrap; }
.app-bar .text-button { min-height: 34px; padding: 6px 10px; border: 1px solid transparent; border-radius: var(--radius-sm); background: transparent; color: var(--ink-2); font-size: var(--fs-sm); font-weight: 500; }
.app-bar .text-button:hover { background: var(--canvas); border-color: var(--line); }

@media (max-width: 680px) {
  .app-bar { gap: 8px; min-height: 56px; padding: 0 14px; }
  .app-bar__crumb { display: none; }
  .app-bar__brand { font-size: var(--fs-md); gap: 8px; }
  .app-bar__user { max-width: 84px; }
}

/* ---------- 按钮 ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 38px; padding: 8px 15px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink-2); font-size: var(--fs-sm); font-weight: 600; line-height: 1.4; text-decoration: none; white-space: nowrap; box-shadow: 0 1px 2px rgba(16, 24, 40, .04); transition: background .16s, border-color .16s, color .16s, box-shadow .16s; }
.btn:hover { border-color: #d6dae2; background: var(--surface-2); color: var(--ink); }
.btn--primary { border-color: var(--accent); background: var(--accent); color: #fff; box-shadow: 0 6px 16px -8px rgba(91, 91, 214, .9); }
.btn--primary:hover { border-color: var(--accent-strong); background: var(--accent-strong); color: #fff; }
.btn--ghost { border-color: transparent; background: transparent; box-shadow: none; color: var(--muted); }
.btn--ghost:hover { background: var(--canvas); border-color: var(--line); color: var(--ink-2); }
.btn--danger { border-color: var(--bad-line); color: var(--bad); }
.btn--danger:hover { background: var(--bad-soft); color: var(--bad); }
.btn--sm { min-height: 32px; padding: 5px 11px; font-size: var(--fs-xs); }
.btn img { width: 15px; height: 15px; }
.btn--primary img { filter: invert(1); }
.icon-button { display: inline-grid; place-items: center; width: 38px; height: 38px; flex: 0 0 38px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); color: var(--muted); box-shadow: 0 1px 2px rgba(16, 24, 40, .04); }
.icon-button:hover { border-color: var(--accent-line); color: var(--accent-strong); background: var(--accent-soft); }
.icon-button img { width: 16px; height: 16px; }
.link-btn { padding: 4px 0; border: 0; background: transparent; color: var(--accent); font-size: var(--fs-sm); font-weight: 600; text-align: left; }
.link-btn:hover { color: var(--accent-strong); text-decoration: underline; }
.link-btn + .link-btn { margin-left: 14px; }

/* ---------- 表单 ---------- */
.field { display: block; margin-bottom: 16px; }
.field > span, .field > label, label.field-label { display: block; margin-bottom: 7px; color: var(--ink-2); font-size: var(--fs-sm); font-weight: 600; }
input, select, textarea { width: 100%; min-height: 40px; padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
input::placeholder, textarea::placeholder { color: var(--muted-2); }
textarea { min-height: 96px; resize: vertical; line-height: 1.6; }
.field-help, .form-help { margin-bottom: 16px; color: var(--muted); font-size: var(--fs-sm); line-height: 1.75; }
.field-help { margin: 6px 0 0; font-size: var(--fs-xs); }
.form-error { margin-bottom: 16px; padding: 10px 13px; border: 1px solid var(--bad-line); border-radius: var(--radius-sm); background: var(--bad-soft); color: var(--bad); font-size: var(--fs-sm); line-height: 1.65; overflow-wrap: anywhere; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; flex-wrap: wrap; }
.password-field { position: relative; }
.password-field input { padding-right: 62px; }
.reveal-password { position: absolute; top: 1px; right: 2px; height: 38px; padding: 0 10px; border: 0; background: transparent; color: var(--muted); font-size: var(--fs-sm); }

/* ---------- 卡片与区块 ---------- */
.card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-1); }
.sec { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-1); overflow: hidden; }
.sec > h2, .sec > h3 { display: flex; align-items: center; gap: 10px; padding: 15px 18px 12px; font-size: var(--fs-md); font-weight: 650; }
.sec > h2 small, .sec > h3 small { color: var(--muted); font-size: var(--fs-xs); font-weight: 500; }
.sec__body { padding: 0 18px 18px; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.section-head h2 { font-size: var(--fs-lg); font-weight: 700; letter-spacing: -.01em; }
.count { color: var(--muted); font-size: var(--fs-xs); font-variant-numeric: tabular-nums; white-space: nowrap; }
.spacer { margin-left: auto; }

/* ---------- 标签与徽标 ---------- */
.tag, .badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: var(--radius-pill); background: #f3f4f6; color: var(--muted); font-size: var(--fs-xs); font-weight: 600; line-height: 1.6; white-space: nowrap; }
.tag--accent, .badge--accent { background: var(--accent-soft); color: var(--accent-strong); }
.tag--success, .badge--success { background: var(--ok-soft); color: var(--ok); }
.tag--warn, .badge--warn { background: var(--warn-soft); color: var(--warn); }
.tag--warning { background: var(--warn-soft); color: var(--warn); }
.tag--danger { background: var(--bad-soft); color: var(--bad); }
.pill { display: inline-flex; align-items: baseline; gap: 2px; padding: 5px 11px; border-radius: var(--radius-pill); font-size: var(--fs-lg); font-weight: 700; font-variant-numeric: tabular-nums; }
.pill small { font-size: var(--fs-xs); font-weight: 600; opacity: .7; }
.pill--hi { background: var(--ok-soft); color: #0b7a44; }
.pill--mid { background: var(--warn-soft); color: #a35a06; }
.pill--low { background: var(--bad-soft); color: #b42318; }
.pill--none { background: #f3f4f6; color: var(--muted); font-size: var(--fs-sm); padding: 6px 12px; }
.avatar { display: grid; place-items: center; width: 34px; height: 34px; flex: 0 0 34px; border-radius: var(--radius-pill); color: #fff; font-size: var(--fs-sm); font-weight: 600; }
.avatar--sm { width: 26px; height: 26px; flex-basis: 26px; font-size: var(--fs-xs); }
.a-1 { background: linear-gradient(140deg, #7c7cf2, #5b5bd6); }
.a-2 { background: linear-gradient(140deg, #fb7185, #e11d48); }
.a-3 { background: linear-gradient(140deg, #2dd4bf, #0d9488); }
.a-4 { background: linear-gradient(140deg, #fbbf24, #d97706); }
.a-5 { background: linear-gradient(140deg, #a78bfa, #7c3aed); }
.a-6 { background: linear-gradient(140deg, #94a3b8, #475569); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 99px; background: var(--muted-2); }
.track { height: 8px; border-radius: var(--radius-pill); background: var(--line-2); overflow: hidden; }
.track > i { display: block; height: 100%; border-radius: var(--radius-pill); background: linear-gradient(90deg, #8b8bf5, var(--accent)); }

/* ---------- 数据表 ---------- */
.table-wrap { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-1); overflow: auto; }
table { width: 100%; border-collapse: collapse; }
th { position: sticky; top: 0; z-index: 1; padding: 11px 16px; border-bottom: 1px solid var(--line); background: var(--surface-2); color: var(--muted); font-size: var(--fs-xs); font-weight: 600; text-align: left; white-space: nowrap; }
td { padding: 13px 16px; border-bottom: 1px solid var(--line-2); font-size: var(--fs-sm); vertical-align: middle; overflow-wrap: anywhere; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #fafbfd; }
.candidate { font-weight: 600; }
.subline { display: block; margin-top: 3px; color: var(--muted); font-size: var(--fs-xs); }
.truncate { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty { padding: 40px 16px !important; color: var(--muted); text-align: center; }
.score { font-size: var(--fs-lg); font-weight: 700; font-variant-numeric: tabular-nums; }
.high { color: var(--ok); }
.mid { color: var(--warn); }
.low { color: var(--bad); }
.row-actions { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.company-heading td { background: var(--surface-2); font-size: var(--fs-xs); font-weight: 600; color: var(--ink-2); }
.inline-count { font-variant-numeric: tabular-nums; }
td[data-label="时间"], td[data-label="账号"], td[data-label="评分"], td[data-label="状态"] { white-space: nowrap; }
td[data-label="账号"] .truncate { max-width: 132px; }

/* 窄屏：表格自动变卡片（依赖每格上的 data-label） */
@media (max-width: 760px) {
  .table-wrap { border: 0; background: transparent; box-shadow: none; overflow: visible; }
  .table-wrap table { table-layout: auto; }
  .table-wrap colgroup, .table-wrap col { display: none; }
  .table-wrap table, .table-wrap tbody, .table-wrap tr, .table-wrap td { display: block; width: 100%; }
  .table-wrap thead { display: none; }
  .table-wrap tr { margin-bottom: 12px; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-1); }
  .table-wrap td { display: grid; grid-template-columns: 84px minmax(0, 1fr); gap: 10px; padding: 6px 0; border: 0; }
  .table-wrap td::before { content: attr(data-label); color: var(--muted); font-size: var(--fs-xs); line-height: 1.7; }
  .table-wrap td[data-card="title"] { display: block; padding-bottom: 10px; margin-bottom: 6px; border-bottom: 1px solid var(--line-2); }
  .table-wrap td[data-card="title"]::before { display: none; }
  .table-wrap td[data-card="actions"] { display: block; padding-top: 10px; }
  .table-wrap td[data-card="actions"]::before { display: none; }
  .table-wrap td > .tag, .table-wrap td > .badge, .table-wrap td > .pill, .table-wrap td > .score { justify-self: start; }
  .table-wrap .truncate { max-width: none; white-space: normal; }
  .company-heading { display: none; }
}

/* ---------- 弹层 ---------- */
dialog { border: 0; border-radius: var(--radius); background: var(--surface); color: var(--ink); box-shadow: var(--shadow-3); }
dialog::backdrop { background: rgba(17, 24, 39, .38); }
html:has(dialog[open]) { overflow: hidden; }
.modal { width: min(620px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); padding: 0; overflow: auto; }
.modal__head { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 18px 20px 14px; }
.modal__head h2 { font-size: var(--fs-lg); font-weight: 700; }
.modal__body { padding: 0 20px 20px; }
.drawer { position: fixed; inset: 0 0 0 auto; width: min(720px, 100vw); max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; padding: 0; border: 0; border-radius: 0; overflow: auto; }
.drawer-head { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 16px 20px 12px; background: var(--surface); border-bottom: 1px solid var(--line-2); }
.drawer-head h2 { font-size: var(--fs-lg); font-weight: 700; overflow-wrap: anywhere; }
.drawer-body { padding: 18px 20px 28px; }
.credential-row { display: flex; gap: 10px; align-items: flex-end; margin: 14px 0; }
.credential-row .field { flex: 1; min-width: 0; margin: 0; }
.credential-row input { font-family: var(--mono); font-size: var(--fs-sm); }
.copy-status { min-height: 20px; color: var(--ok); font-size: var(--fs-xs); }

/* ---------- 状态 ---------- */
.spinner { width: 16px; height: 16px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-bar { position: relative; height: 3px; overflow: hidden; background: transparent; }
.loading-bar::after { content: ""; position: absolute; top: 0; bottom: 0; border-radius: 3px; background: var(--accent); animation: loading 1.1s ease-in-out infinite; }
@keyframes loading { 0% { left: 0; right: 80%; } 50% { left: 18%; right: 18%; } 100% { left: 80%; right: 0; } }
.empty-state { display: grid; gap: 7px; justify-items: center; padding: 40px 20px; color: var(--muted); text-align: center; }
.empty-state strong { color: var(--ink-2); font-size: var(--fs-md); }
.empty-state span { font-size: var(--fs-sm); line-height: 1.7; }

@media (pointer: coarse) {
  .btn { min-height: 44px; }
  .icon-button { width: 44px; height: 44px; flex-basis: 44px; }
  .link-btn { min-height: 40px; padding: 8px 0; }
  .app-bar .text-button { min-height: 44px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* 账号插件版本分级：最新线绿色（已有 success）、上一档蓝色、更早灰色、未上报红色 */
.tag--info, .badge--info { background: #eaf1ff; color: #2563eb; }
.tag--muted, .badge--muted { background: #f3f4f6; color: #6b7280; }
