/* ==========================================================================
   新员工聘转全生命周期管理平台 Design System
   - Brand: Indigo gradient
   - Surface: White card on light gray base
   - Density: Comfortable
   ========================================================================== */

:root {
  --brand-from: #4F46E5;
  --brand-to:   #7C3AED;
  --brand-soft: #EEF2FF;
  --brand-line: #C7D2FE;

  --ink-900: #0F172A;
  --ink-700: #334155;
  --ink-500: #64748B;
  --ink-400: #94A3B8;

  --surface-base: #F8FAFC;
  --surface-card: #FFFFFF;
  --surface-line: #E2E8F0;
  --surface-soft: #F1F5F9;

  --ok:    #10B981;
  --warn:  #F59E0B;
  --danger:#EF4444;
  --info:  #6366F1;
  --mute:  #94A3B8;
}

html, body, #app { height: 100%; }
body {
  font-feature-settings: "tnum" 1, "ss01" 1;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #94A3B8; }

/* ---------- Brand gradient ---------- */
.bg-brand-grad {
  background: linear-gradient(135deg, var(--brand-from) 0%, var(--brand-to) 100%);
}
.bg-brand-grad-soft {
  background: linear-gradient(135deg, #EEF2FF 0%, #F5F3FF 100%);
}
.text-brand-grad {
  background: linear-gradient(135deg, var(--brand-from), var(--brand-to));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* ---------- Card ---------- */
.card {
  background: var(--surface-card);
  border: 1px solid var(--surface-line);
  border-radius: 14px;
  box-shadow: 0 1px 2px 0 rgba(15,23,42,0.04);
}
.card-soft { background: var(--surface-soft); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 36px; padding: 0 14px;
  font-size: 13px; font-weight: 500;
  border-radius: 8px; border: 1px solid transparent;
  transition: all .15s ease; white-space: nowrap;
  cursor: pointer;
}
.btn-primary {
  background: var(--brand-from); color: #fff;
  border-color: var(--brand-from);
}
.btn-primary:hover { background: #4338CA; border-color: #4338CA; }
.btn-secondary {
  background: #fff; color: var(--ink-700); border-color: var(--surface-line);
}
.btn-secondary:hover { background: var(--surface-soft); }
.btn-ghost { background: transparent; color: var(--ink-700); }
.btn-ghost:hover { background: var(--surface-soft); }
.btn-danger {
  background: #fff; color: var(--danger); border-color: #FECACA;
}
.btn-danger:hover { background: #FEF2F2; }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12px; }
.btn-lg { height: 44px; padding: 0 20px; font-size: 14px; }

/* ---------- Inputs ---------- */
.input, .select, .textarea {
  width: 100%; height: 36px; padding: 0 12px;
  background: #fff; color: var(--ink-900);
  border: 1px solid var(--surface-line); border-radius: 8px;
  font-size: 13px; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--brand-from);
  box-shadow: 0 0 0 3px rgba(79,70,229,0.12);
}
.textarea { height: auto; padding: 8px 12px; min-height: 72px; line-height: 1.55; }
.input-search { padding-left: 32px; }

label.field-label {
  display: block; font-size: 12px; color: var(--ink-500);
  margin-bottom: 6px; font-weight: 500;
}

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; font-size: 12px; font-weight: 500;
  border-radius: 999px; line-height: 18px; white-space: nowrap;
}
.badge-ok    { background: #ECFDF5; color: #047857; }
.badge-warn  { background: #FFFBEB; color: #B45309; }
.badge-danger{ background: #FEF2F2; color: #B91C1C; }
.badge-info  { background: #EEF2FF; color: #4338CA; }
.badge-mute  { background: #F1F5F9; color: #475569; }

.badge-dot::before {
  content: ''; width: 6px; height: 6px; border-radius: 999px;
  background: currentColor; display: inline-block;
}

/* ---------- Tables ---------- */
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.table thead th {
  background: #F8FAFC; color: var(--ink-500);
  font-weight: 500; text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--surface-line);
  white-space: nowrap;
}
.table tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid #F1F5F9;
  color: var(--ink-700);
}
.table tbody tr:hover { background: #F8FAFC; }
.table tbody tr.row-selected { background: #EEF2FF; }
.table tbody tr.row-selected td { color: var(--ink-900); }
.table-actions a { color: var(--brand-from); }
.table-actions a:hover { text-decoration: underline; }

/* ---------- Topbar ---------- */
.topbar {
  height: 56px; background: #fff; border-bottom: 1px solid var(--surface-line);
  box-shadow: 0 1px 2px rgba(15,23,42,0.03);
  display: flex; align-items: center; padding: 0 24px;
}

/* ---------- Sidebar ---------- */
.sidebar {
  width: 232px; background: #fff; border-right: 1px solid var(--surface-line);
  height: calc(100vh - 56px); padding: 16px 12px;
  overflow-y: auto;
}
.nav-group { margin-bottom: 18px; }
.nav-group-title {
  font-size: 11px; font-weight: 600; color: var(--ink-400);
  text-transform: uppercase; letter-spacing: 0.06em;
  padding: 4px 12px; margin-bottom: 4px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; border-radius: 8px;
  font-size: 13.5px; color: var(--ink-700);
  cursor: pointer; transition: all .15s;
}
.nav-item:hover { background: var(--surface-soft); }
.nav-item.active {
  background: var(--brand-soft); color: var(--brand-from);
  font-weight: 500;
}
.nav-item.active .nav-icon { color: var(--brand-from); }
.nav-icon { width: 16px; height: 16px; color: var(--ink-500); }
.nav-item.active .nav-icon { color: var(--brand-from); }

/* ---------- Modal ---------- */
.modal-mask {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(15,23,42,0.45);
  display: flex; align-items: center; justify-content: center;
  padding: 24px; backdrop-filter: blur(2px);
}
.modal-shell {
  width: 100%; max-width: 960px; max-height: 90vh;
  background: #fff; border-radius: 16px; overflow: hidden;
  box-shadow: 0 24px 48px -12px rgba(15,23,42,0.18);
  animation: pop-in .18s ease;
  /* The inner component provides its own grid (e.g. grid-cols-[280px_1fr]) */
  display: block;
}
.modal-shell.modal-sm,
.modal-shell.modal-sm,
.modal-shell.modal-shell-sm { max-width: 520px; }
.modal-shell.modal-md,
.modal-shell.modal-shell-md { max-width: 640px; }
.modal-brand {
  background: linear-gradient(135deg, var(--brand-from) 0%, var(--brand-to) 100%);
  color: #fff; padding: 32px 28px;
  display: flex; flex-direction: column; gap: 16px;
}
.modal-body {
  padding: 24px 28px; overflow-y: auto;
}
@keyframes pop-in { from { transform: scale(0.96); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ---------- KPI card ---------- */
.kpi {
  background: #fff; border: 1px solid var(--surface-line);
  border-radius: 14px; padding: 18px 20px;
  position: relative; overflow: hidden;
}
.kpi-label { font-size: 12.5px; color: var(--ink-500); font-weight: 500; }
.kpi-value { font-size: 28px; font-weight: 600; color: var(--ink-900); margin-top: 6px; letter-spacing: -0.01em; }
.kpi-sub   { font-size: 12px; color: var(--ink-500); margin-top: 4px; }
.kpi-icon  {
  position: absolute; top: 16px; right: 16px;
  width: 36px; height: 36px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  background: var(--brand-soft); color: var(--brand-from);
}
.kpi-trend-up   { color: var(--ok); font-size: 12px; }
.kpi-trend-down { color: var(--danger); font-size: 12px; }

/* ---------- Welcome bar ---------- */
.welcome-bar {
  border-radius: 16px; padding: 24px 28px;
  background: linear-gradient(120deg, #4F46E5 0%, #7C3AED 60%, #A78BFA 100%);
  color: #fff; position: relative; overflow: hidden;
}
.welcome-bar::after {
  content: ''; position: absolute; right: -40px; top: -40px;
  width: 220px; height: 220px; border-radius: 999px;
  background: rgba(255,255,255,0.08);
}
.welcome-bar::before {
  content: ''; position: absolute; right: 60px; bottom: -80px;
  width: 180px; height: 180px; border-radius: 999px;
  background: rgba(255,255,255,0.05);
}

/* ---------- Tag / chip ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; font-size: 11.5px; font-weight: 500;
  background: #F1F5F9; color: var(--ink-700);
  border-radius: 6px;
}
.chip-p0 { background: #FEE2E2; color: #B91C1C; }
.chip-p1 { background: #FEF3C7; color: #B45309; }
.chip-p2 { background: #E0E7FF; color: #4338CA; }

/* ---------- Tabs ---------- */
.tabs {
  display: inline-flex; background: #F1F5F9;
  padding: 4px; border-radius: 10px; gap: 2px;
}
.tab {
  padding: 6px 14px; font-size: 13px; font-weight: 500;
  color: var(--ink-500); border-radius: 7px; cursor: pointer;
  transition: all .15s;
}
.tab:hover { color: var(--ink-700); }
.tab.active { background: #fff; color: var(--brand-from); box-shadow: 0 1px 2px rgba(15,23,42,0.06); }

/* ---------- Section title ---------- */
.section-title { font-size: 14px; font-weight: 600; color: var(--ink-900); }
.section-sub   { font-size: 12px; color: var(--ink-500); margin-top: 2px; }

/* ---------- Helpers ---------- */
.divider { height: 1px; background: var(--surface-line); }
.h-divider { width: 1px; background: var(--surface-line); align-self: stretch; }
.muted { color: var(--ink-500); }
.text-num { font-feature-settings: "tnum" 1; font-variant-numeric: tabular-nums; }

/* ---------- Stepper ---------- */
.stepper { display: flex; align-items: center; gap: 0; }
.step {
  display: flex; align-items: center; gap: 8px;
  color: var(--ink-400); font-size: 12.5px;
}
.step .step-num {
  width: 22px; height: 22px; border-radius: 999px;
  background: #F1F5F9; color: var(--ink-500);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600;
}
.step.active { color: var(--brand-from); }
.step.active .step-num { background: var(--brand-from); color: #fff; }
.step.done   { color: var(--ok); }
.step.done   .step-num { background: var(--ok); color: #fff; }
.step-line {
  width: 36px; height: 1px; background: var(--surface-line); margin: 0 8px;
}
.step.done + .step-line, .step.active + .step-line { background: var(--brand-from); }

/* ---------- Empty ---------- */
.empty {
  text-align: center; padding: 48px 16px; color: var(--ink-500); font-size: 13px;
}
.empty-icon {
  width: 56px; height: 56px; border-radius: 14px;
  background: var(--brand-soft); color: var(--brand-from);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 12px;
}

/* ---------- Toast ---------- */
.toast {
  position: fixed; top: 16px; left: 50%; transform: translateX(-50%);
  z-index: 100; background: #0F172A; color: #fff;
  padding: 10px 16px; border-radius: 10px; font-size: 13px;
  box-shadow: 0 12px 24px rgba(15,23,42,0.2);
  display: flex; align-items: center; gap: 8px;
  animation: toast-in .2s ease;
}
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, -8px); } to { opacity: 1; transform: translate(-50%, 0); } }
.toast-ok    { background: #065F46; }
.toast-warn  { background: #92400E; }
.toast-danger{ background: #991B1B; }

/* ---------- External link banner ---------- */
.external-banner {
  background: linear-gradient(135deg, #EEF2FF 0%, #F5F3FF 100%);
  border: 1px dashed var(--brand-line);
  border-radius: 12px; padding: 16px 20px;
  display: flex; align-items: center; gap: 12px;
}
