/* ============================================================
   实习投递跟踪系统 · 样式
   ============================================================ */

:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #fafbfe;
  --text: #17202e;
  --text-soft: #5b6478;
  --text-faint: #8a93a8;
  --border: #e3e7f0;
  --accent: #4f6ef7;
  --accent-soft: #ecefff;

  /* 状态色 */
  --s-applied: #4f6ef7;
  --s-screening: #d97706;
  --s-interview: #7c3aed;
  --s-offer: #0f9d63;
  --s-rejected: #94a3b8;

  --danger: #d92d20;
  --ok: #0f9d63;

  --shadow-sm: 0 1px 2px rgba(23, 32, 46, .05), 0 1px 6px rgba(23, 32, 46, .04);
  --shadow-md: 0 6px 20px rgba(23, 32, 46, .09), 0 2px 6px rgba(23, 32, 46, .05);
  --shadow-lg: 0 24px 60px rgba(20, 27, 40, .22);
  --radius: 12px;
}

* { box-sizing: border-box; }

/* 元素自带 display 时 [hidden] 会被覆盖，统一兜住 */
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Microsoft YaHei", "Hiragino Sans GB", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

.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;
}

.muted { color: var(--text-soft); }
.req { color: var(--danger); }

/* ---------------- 顶栏 ---------------- */
.topbar {
  flex: 0 0 auto;
  height: 58px;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  z-index: 20;
}

.brand { display: flex; align-items: center; gap: 9px; flex: 0 0 auto; }

.brand-mark {
  width: 30px; height: 30px; display: grid; place-items: center;
  border-radius: 9px; color: #fff;
  background: linear-gradient(135deg, var(--accent), #7c8cff);
}

.brand-name { font-weight: 800; letter-spacing: .3px; }
.brand-sub { font-size: 12px; color: var(--text-faint); padding-left: 2px; }

.tabs { display: flex; gap: 4px; flex: 0 0 auto; }

.tab {
  appearance: none; border: none; background: none; cursor: pointer;
  font-family: inherit; font-size: 13.5px; color: var(--text-soft);
  padding: 7px 14px; border-radius: 9px; transition: background .15s, color .15s;
}
.tab:hover { background: var(--surface-2); color: var(--text); }
.tab.is-active { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.tab:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.topbar-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }

.search {
  width: 240px; padding: 8px 12px; font-family: inherit; font-size: 13px;
  border: 1px solid var(--border); border-radius: 9px; background: var(--surface-2);
  transition: border-color .15s, background .15s;
}
.search:focus { outline: none; border-color: var(--accent); background: #fff; }

/* ---------------- 按钮 ---------------- */
.btn {
  appearance: none; border: 1px solid var(--border); background: #fff; color: var(--text);
  font-family: inherit; font-size: 13px; padding: 7px 14px; border-radius: 9px;
  cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .1s, box-shadow .15s;
}
.btn:hover { background: var(--surface-2); border-color: #d3d9e6; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-primary {
  background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600;
  box-shadow: 0 2px 10px rgba(79, 110, 247, .28);
}
.btn-primary:hover { background: #4361ef; border-color: #4361ef; }

.btn-ghost { background: transparent; border-color: transparent; color: var(--text-soft); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }

.btn-danger { background: #fff; border-color: #f3c9c5; color: var(--danger); }
.btn-danger:hover { background: #fef3f2; }

.btn-sm { padding: 4px 10px; font-size: 12px; }

/* ---------------- 筛选条 ---------------- */
.filterbar {
  flex: 0 0 auto;
  display: flex; align-items: center; gap: 14px;
  padding: 9px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.tag-filter { display: flex; gap: 7px; flex-wrap: wrap; flex: 1 1 auto; min-width: 0; }

.tag-chip {
  appearance: none; cursor: pointer; font-family: inherit; font-size: 12px;
  padding: 3px 10px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text-soft);
  transition: all .15s;
}
.tag-chip:hover { border-color: #c8d0e4; color: var(--text); }
.tag-chip.is-active { background: var(--accent); border-color: var(--accent); color: #fff; }

.filterbar-right { display: flex; align-items: center; gap: 12px; flex: 0 0 auto; }

.select {
  font-family: inherit; font-size: 13px; padding: 7px 10px;
  border: 1px solid var(--border); border-radius: 9px; background: #fff;
}
.select:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }

/* ---------------- 视图 ---------------- */
.view { flex: 1 1 auto; min-height: 0; overflow: auto; }
.view[hidden] { display: none !important; }

/* ---------------- 看板 ---------------- */
.view-board { padding: 18px 20px 28px; }

.board {
  display: grid;
  grid-template-columns: repeat(5, minmax(210px, 1fr));
  gap: 14px;
  align-items: start;
  min-height: 100%;
}

.column {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px;
  display: flex; flex-direction: column; gap: 10px;
  min-height: 120px;
}

.column-head {
  display: flex; align-items: center; gap: 8px;
  padding: 2px 4px 6px;
}
.column-dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }
.column-name { font-size: 12.5px; font-weight: 700; letter-spacing: .3px; }
.column-count {
  margin-left: auto; font-size: 11.5px; font-weight: 700;
  background: #fff; border: 1px solid var(--border); color: var(--text-soft);
  padding: 0 7px; border-radius: 999px;
}

.card {
  background: #fff; border: 1px solid var(--border); border-radius: 10px;
  padding: 11px 12px; cursor: pointer; text-align: left;
  font-family: inherit; font-size: inherit; color: inherit; width: 100%;
  box-shadow: var(--shadow-sm);
  transition: transform .14s, box-shadow .14s, border-color .14s;
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: #cfd8ea; }
.card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.card-company { font-weight: 700; font-size: 13.5px; margin-bottom: 2px; }
.card-position { font-size: 12.5px; color: var(--text-soft); margin-bottom: 7px; }
.card-meta {
  display: flex; align-items: center; gap: 8px;
  font-size: 11.5px; color: var(--text-faint); flex-wrap: wrap;
}
.card-tag {
  background: var(--accent-soft); color: var(--accent);
  padding: 1px 7px; border-radius: 999px; font-size: 11px;
}
.card-itv {
  background: #f3f0ff; color: var(--s-interview);
  padding: 1px 7px; border-radius: 999px; font-size: 11px;
}

.column-empty {
  font-size: 12px; color: var(--text-faint); text-align: center;
  padding: 14px 0; border: 1px dashed var(--border); border-radius: 9px;
}

/* ---------------- 列表 ---------------- */
.view-list { padding: 18px 20px; }

.table-wrap {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: auto;
}

.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th, .table td {
  padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table th {
  background: var(--surface-2); font-size: 12px; font-weight: 700;
  color: var(--text-soft); position: sticky; top: 0; z-index: 1;
}
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: none; }

.pill {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 700;
}
.pill-applied { background: #eef1ff; color: var(--s-applied); }
.pill-screening { background: #fff4e5; color: var(--s-screening); }
.pill-interview { background: #f3ecff; color: var(--s-interview); }
.pill-offer { background: #e6f7ef; color: var(--s-offer); }
.pill-rejected { background: #f1f3f8; color: var(--s-rejected); }

.row-actions { display: flex; gap: 6px; }

.pager {
  display: flex; align-items: center; justify-content: center; gap: 14px;
  padding: 14px 0 4px;
}

/* ---------------- 统计 ---------------- */
.view-stats { padding: 18px 20px 32px; }

.stat-cards {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px; margin-bottom: 16px;
}

.stat-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow-sm);
}
.stat-label { font-size: 12px; color: var(--text-soft); margin-bottom: 6px; }
.stat-value { font-size: 26px; font-weight: 800; letter-spacing: -.5px; line-height: 1.1; }
.stat-unit { font-size: 12px; color: var(--text-faint); font-weight: 600; margin-left: 3px; }

.panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 18px; margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
}
.panel h2 { margin: 0 0 14px; font-size: 13.5px; letter-spacing: .3px; color: var(--text-soft); }
.panel h3 { margin: 0 0 10px; font-size: 13px; color: var(--text-soft); }
.panel-inline { box-shadow: none; border: none; padding: 0; margin: 18px 0 0; }

/* 横向条形图 */
.chart { display: flex; flex-direction: column; gap: 9px; }

.bar-row { display: grid; grid-template-columns: 78px 1fr 44px; align-items: center; gap: 10px; }
.bar-label { font-size: 12.5px; color: var(--text-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { height: 20px; background: var(--surface-2); border-radius: 6px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 6px; min-width: 3px; transition: width .4s ease; }
.bar-value { font-size: 12.5px; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }

.chart-empty { font-size: 12.5px; color: var(--text-faint); padding: 8px 0; }

/* 竖直柱状图（月份趋势） */
.chart-cols { display: flex; align-items: flex-end; gap: 14px; height: 140px; padding-top: 8px; }
.col { flex: 1 1 0; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.col-bar { width: 100%; max-width: 46px; background: linear-gradient(180deg, #7c8cff, var(--accent)); border-radius: 6px 6px 0 0; min-height: 3px; transition: height .4s ease; }
.col-label { font-size: 11.5px; color: var(--text-faint); }
.col-value { font-size: 12px; font-weight: 700; }

.activity { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.activity li { font-size: 12.5px; color: var(--text-soft); display: flex; gap: 10px; }
.activity-time { color: var(--text-faint); flex: 0 0 auto; font-variant-numeric: tabular-nums; }

/* ---------------- 抽屉 ---------------- */
.drawer-mask {
  position: fixed; inset: 0; background: rgba(20, 27, 40, .32); z-index: 40;
  animation: fade .18s ease;
}

.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(460px, 94vw);
  background: var(--surface); border-left: 1px solid var(--border);
  box-shadow: var(--shadow-lg); z-index: 41;
  overflow-y: auto; padding: 18px 20px 26px;
  animation: slide .22s cubic-bezier(.22,.61,.36,1);
}
@keyframes slide { from { transform: translateX(18px); opacity: .6; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.drawer-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.drawer-head h2 { margin: 0; font-size: 15px; }

/* ---------------- 表单 ---------------- */
.form { display: flex; flex-direction: column; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 5px; flex: 1 1 0; min-width: 0; }
.field-row { display: flex; gap: 12px; }
.field label { font-size: 12.5px; font-weight: 600; color: var(--text-soft); }
.field input, .field textarea, .field select {
  width: 100%; padding: 8px 11px; font-family: inherit; font-size: 13px;
  border: 1px solid var(--border); border-radius: 9px; background: #fff; color: var(--text);
}
.field textarea { resize: vertical; line-height: 1.6; }
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
.field-hint { margin: 0; font-size: 11.5px; color: var(--danger); min-height: 14px; }
.field-hint:empty { min-height: 0; }

.modal-actions { display: flex; gap: 9px; margin-top: 6px; }

.inline-form { display: flex; gap: 7px; align-items: center; margin-top: 10px; }
.inline-form input, .inline-form select {
  padding: 6px 9px; font-family: inherit; font-size: 12.5px;
  border: 1px solid var(--border); border-radius: 8px; background: #fff;
}
.mini { width: 62px; flex: 0 0 auto; }
.grow { flex: 1 1 auto; min-width: 0; }

.interview-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 7px; }
.interview-list li {
  display: flex; align-items: center; gap: 9px; font-size: 12.5px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 9px; padding: 7px 10px;
}
.itv-round { font-weight: 700; color: var(--text-soft); }
.itv-time { color: var(--text-faint); font-size: 12px; }
.itv-result { margin-left: auto; font-size: 11.5px; font-weight: 700; padding: 1px 8px; border-radius: 999px; }
.itv-pending { background: #fff4e5; color: var(--s-screening); }
.itv-pass { background: #e6f7ef; color: var(--ok); }
.itv-fail { background: #f1f3f8; color: var(--s-rejected); }
.itv-del {
  border: none; background: none; cursor: pointer; color: var(--text-faint);
  font-size: 12px; border-radius: 6px; padding: 2px 5px;
}
.itv-del:hover { background: #ffeceb; color: var(--danger); }

/* ---------------- 弹窗 ---------------- */
.modal {
  position: fixed; inset: 0; background: rgba(20, 27, 40, .36);
  display: grid; place-items: center; padding: 24px; z-index: 60;
}
.modal[hidden] { display: none !important; }

.modal-card {
  width: 100%; max-width: 420px; background: var(--surface);
  border-radius: 16px; box-shadow: var(--shadow-lg); padding: 20px 22px 18px;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; }
.modal-head h2 { margin: 0; font-size: 16px; }
.modal-desc { margin: 10px 0 16px; font-size: 12.5px; color: var(--text-soft); line-height: 1.7; }

.health-box {
  margin-top: 12px; padding: 11px 13px; border-radius: 10px; font-size: 12.5px; line-height: 1.7;
  background: #f0fdf6; border: 1px solid #cdeedd; color: #0b6b45;
}
.health-box.is-warn { background: #fffbeb; border-color: #f6e3b4; color: #92400e; }
.health-box ul { margin: 6px 0 0; padding-left: 18px; }

/* ---------------- 轻提示 ---------------- */
.toast {
  position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%) translateY(8px);
  background: #17202e; color: #fff; font-size: 13px; padding: 10px 18px; border-radius: 10px;
  box-shadow: 0 10px 30px rgba(20, 27, 40, .3);
  opacity: 0; transition: opacity .2s, transform .2s; z-index: 90; max-width: 82vw;
}
.toast.is-show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast[hidden] { display: none !important; }
.toast.is-error { background: #b3261e; }

/* ---------------- 空态 ---------------- */
.empty-state {
  grid-column: 1 / -1; text-align: center; padding: 46px 20px; color: var(--text-faint);
}
.empty-state h3 { margin: 0 0 6px; font-size: 15px; color: var(--text-soft); }

/* ---------------- 滚动条 ---------------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb {
  background: #cfd6e6; border-radius: 8px; border: 3px solid transparent; background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: #b8c1d6; background-clip: content-box; }

/* ---------------- 窄屏 ---------------- */
@media (max-width: 1100px) {
  .board { grid-template-columns: repeat(3, minmax(200px, 1fr)); }
  .brand-sub { display: none; }
  .search { width: 160px; }
}

@media (max-width: 820px) {
  .topbar { flex-wrap: wrap; height: auto; padding: 10px 14px; gap: 10px; }
  .tabs { order: 3; width: 100%; }
  .topbar-actions { width: 100%; order: 2; }
  .search { flex: 1 1 auto; width: auto; }
  .board { grid-template-columns: 1fr; }
  .field-row { flex-direction: column; gap: 10px; }
  .filterbar { flex-wrap: wrap; }
}
