/* ============================================================
   泛柯申请追踪系统 · 共享样式
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@300;400;500;600;700&family=IBM+Plex+Mono:wght@400;500&family=Noto+Sans+SC:wght@300;400;500;600;700&display=swap');

:root {
  --c-bg: #fafaf8;
  --c-surface: #ffffff;
  --c-surface-2: #f4f4f1;
  --c-border: #e7e5e0;
  --c-border-strong: #d4d2cc;
  --c-text: #0a0a0a;
  --c-text-2: #525252;
  --c-text-3: #8a8a8a;
  --c-black: #0a0a0a;

  --c-orange: #e04520;
  --c-orange-soft: #fdebe4;
  --c-orange-dark: #b8351a;

  --c-green: #16a34a;
  --c-green-soft: #dcfce7;
  --c-red: #dc2626;
  --c-red-soft: #fee2e2;
  --c-amber: #d97706;
  --c-amber-soft: #fef3c7;
  --c-blue: #2563eb;
  --c-blue-soft: #dbeafe;
  --c-purple: #7c3aed;
  --c-purple-soft: #ede9fe;
  --c-gray-soft: #f1f1ee;

  --shadow-sm: 0 1px 2px rgba(10,10,10,0.04);
  --shadow: 0 2px 12px rgba(10,10,10,0.06);
  --shadow-lg: 0 8px 32px rgba(10,10,10,0.10);
  --radius: 8px;
  --radius-lg: 12px;

  --font-sans: 'IBM Plex Sans', 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;
}

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

html, body {
  font-family: var(--font-sans);
  background: var(--c-bg);
  color: var(--c-text);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--c-orange); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ============== HEADER ============== */
.app-header {
  background: var(--c-black);
  color: white;
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #1f1f1f;
  position: sticky;
  top: 0;
  z-index: 100;
}
.app-header .brand {
  display: flex;
  align-items: center;
  gap: 14px;
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 0.3px;
}
.app-header .brand-mark {
  width: 32px;
  height: 32px;
  background: var(--c-orange);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 14px;
  letter-spacing: -0.5px;
  border-radius: 4px;
}
.app-header .brand-divider {
  width: 1px;
  height: 18px;
  background: #333;
}
.app-header .brand-sub {
  font-size: 12px;
  color: #a8a8a8;
  font-weight: 400;
  letter-spacing: 0.5px;
}
.app-header .user-area {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 13px;
}
.app-header .user-name {
  color: #f0f0f0;
  font-weight: 500;
}
.app-header .user-role {
  color: var(--c-orange);
  font-size: 11px;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  padding: 3px 8px;
  background: rgba(224,69,32,0.12);
  border-radius: 4px;
  font-weight: 600;
}
.app-header .btn-logout {
  background: transparent;
  border: 1px solid #333;
  color: #d8d8d8;
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  font-family: inherit;
  transition: all 0.15s;
}
.app-header .btn-logout:hover {
  background: #1f1f1f;
  border-color: #555;
}

/* ============== LAYOUT ============== */
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 28px;
}
.container-wide {
  max-width: 1600px;
  margin: 0 auto;
  padding: 28px;
}

.page-title {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 4px;
}
.page-subtitle {
  color: var(--c-text-2);
  font-size: 13px;
  margin-bottom: 24px;
}

/* ============== CARDS ============== */
.card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  padding: 20px;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 14px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--c-border);
}
.card-title {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.2px;
}

/* ============== STATS ============== */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}
.stat-box {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  position: relative;
  overflow: hidden;
}
.stat-box.accent::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--c-orange);
}
.stat-label {
  font-size: 11px;
  color: var(--c-text-3);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: 500;
  margin-bottom: 6px;
}
.stat-value {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -1px;
  font-family: var(--font-mono);
  line-height: 1;
}
.stat-sub {
  margin-top: 6px;
  font-size: 11px;
  color: var(--c-text-2);
}

/* ============== BUTTONS ============== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: white;
  color: var(--c-text);
  border: 1px solid var(--c-border-strong);
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  font-weight: 500;
  transition: all 0.15s;
  text-decoration: none;
}
.btn:hover {
  background: var(--c-surface-2);
  text-decoration: none;
}
.btn-primary {
  background: var(--c-black);
  color: white;
  border-color: var(--c-black);
}
.btn-primary:hover {
  background: #2a2a2a;
}
.btn-orange {
  background: var(--c-orange);
  color: white;
  border-color: var(--c-orange);
}
.btn-orange:hover {
  background: var(--c-orange-dark);
}
.btn-ghost {
  background: transparent;
  border-color: transparent;
}
.btn-ghost:hover {
  background: var(--c-surface-2);
}
.btn-danger {
  background: white;
  color: var(--c-red);
  border-color: var(--c-border-strong);
}
.btn-danger:hover {
  background: var(--c-red-soft);
  border-color: var(--c-red);
}
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-block { width: 100%; justify-content: center; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ============== INPUTS ============== */
.input, .select, .textarea {
  width: 100%;
  padding: 9px 12px;
  background: white;
  border: 1px solid var(--c-border-strong);
  border-radius: 6px;
  font-family: inherit;
  font-size: 13px;
  color: var(--c-text);
  transition: border 0.15s, box-shadow 0.15s;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--c-orange);
  box-shadow: 0 0 0 3px rgba(224,69,32,0.10);
}
.textarea {
  resize: vertical;
  min-height: 80px;
}
.field {
  margin-bottom: 14px;
}
.field-label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--c-text-2);
  margin-bottom: 5px;
  letter-spacing: 0.2px;
}
.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.field-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
}

/* ============== BADGES ============== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
  white-space: nowrap;
}
.badge-gray { background: var(--c-gray-soft); color: var(--c-text-2); }
.badge-green { background: var(--c-green-soft); color: var(--c-green); }
.badge-red { background: var(--c-red-soft); color: var(--c-red); }
.badge-amber { background: var(--c-amber-soft); color: var(--c-amber); }
.badge-blue { background: var(--c-blue-soft); color: var(--c-blue); }
.badge-purple { background: var(--c-purple-soft); color: var(--c-purple); }
.badge-yellow { background: #fef9c3; color: #a16207; }
.badge-orange { background: var(--c-orange-soft); color: var(--c-orange-dark); }

/* ============== TABLE ============== */
.tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.tbl th {
  text-align: left;
  font-weight: 600;
  color: var(--c-text-2);
  padding: 10px 12px;
  border-bottom: 1px solid var(--c-border);
  background: var(--c-surface-2);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}
.tbl td {
  padding: 12px;
  border-bottom: 1px solid var(--c-border);
  vertical-align: middle;
}
.tbl tr:hover td {
  background: var(--c-surface-2);
}
.tbl tr.row-clickable {
  cursor: pointer;
}

/* ============== TOOLBAR ============== */
.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.toolbar .input {
  max-width: 280px;
}
.toolbar .select {
  max-width: 160px;
}

/* ============== TABS ============== */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--c-border);
  margin-bottom: 24px;
}
.tab {
  padding: 12px 18px;
  cursor: pointer;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--c-text-2);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all 0.15s;
}
.tab:hover { color: var(--c-text); }
.tab.active {
  color: var(--c-black);
  border-bottom-color: var(--c-orange);
  font-weight: 600;
}
.tab-count {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  background: var(--c-surface-2);
  border-radius: 10px;
  font-size: 11px;
  color: var(--c-text-2);
}
.tab.active .tab-count {
  background: var(--c-orange-soft);
  color: var(--c-orange-dark);
}

/* ============== MODAL ============== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10,10,10,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}
.modal {
  background: white;
  border-radius: var(--radius-lg);
  padding: 28px;
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}
.modal-wide { max-width: 800px; }
.modal-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 4px;
  letter-spacing: -0.3px;
}
.modal-subtitle {
  color: var(--c-text-2);
  font-size: 12px;
  margin-bottom: 20px;
}
.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--c-border);
}

/* ============== EMPTY STATE ============== */
.empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--c-text-3);
}
.empty-title {
  font-size: 14px;
  color: var(--c-text-2);
  font-weight: 500;
  margin-bottom: 6px;
}
.empty-sub {
  font-size: 12px;
}

/* ============== UTILS ============== */
.spacer-sm { height: 12px; }
.spacer { height: 20px; }
.spacer-lg { height: 32px; }
.flex { display: flex; }
.flex-1 { flex: 1; }
.gap-sm { gap: 8px; }
.gap { gap: 14px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.text-mono { font-family: var(--font-mono); }
.text-sm { font-size: 12px; }
.text-xs { font-size: 11px; }
.text-muted { color: var(--c-text-2); }
.text-faint { color: var(--c-text-3); }
.text-right { text-align: right; }
.bold { font-weight: 600; }

/* ============== ALERTS ============== */
.alert {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 16px;
  border-left: 3px solid;
}
.alert-warn {
  background: var(--c-amber-soft);
  border-color: var(--c-amber);
  color: var(--c-amber);
}
.alert-err {
  background: var(--c-red-soft);
  border-color: var(--c-red);
  color: var(--c-red);
}
.alert-info {
  background: var(--c-blue-soft);
  border-color: var(--c-blue);
  color: var(--c-blue);
}
.alert-ok {
  background: var(--c-green-soft);
  border-color: var(--c-green);
  color: var(--c-green);
}

/* ============== TOAST ============== */
.toast-host {
  position: fixed;
  top: 80px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.toast {
  padding: 12px 16px;
  background: var(--c-black);
  color: white;
  border-radius: 8px;
  font-size: 13px;
  box-shadow: var(--shadow-lg);
  animation: slideIn 0.2s ease-out;
  max-width: 320px;
}
.toast.toast-error { background: var(--c-red); }
.toast.toast-success { background: var(--c-green); }
@keyframes slideIn {
  from { transform: translateX(20px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ============== LOADING ============== */
.loader {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid var(--c-border);
  border-top-color: var(--c-orange);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-page {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 60vh;
  color: var(--c-text-3);
  gap: 10px;
}

/* inline 状态下拉（卡片上直接改） */
.inline-status {
  cursor: pointer;
  border: 1px solid rgba(0,0,0,0.08);
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  padding: 2px 24px 2px 8px;
  appearance: none;
  -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 12px) 50%, calc(100% - 7px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
.inline-status:hover { filter: brightness(0.95); }
.inline-status:focus { outline: 2px solid var(--c-orange); outline-offset: 1px; }

/* 推荐人板块 */
.app-rec-section { margin-top: 12px; padding: 10px 12px; background: #faf8f4;
                   border-left: 3px solid var(--c-orange); border-radius: 0 6px 6px 0; }
.app-rec-header { display: flex; justify-content: space-between; align-items: center;
                  font-size: 13px; font-weight: 600; cursor: pointer; user-select: none; }
.app-rec-body { margin-top: 8px; }
.app-rec-row { display: flex; align-items: center; gap: 10px; padding: 6px 0;
               border-bottom: 1px dashed #e5e5e2; font-size: 13px; }
.app-rec-row:last-child { border-bottom: none; }
.app-rec-name { flex: 1; min-width: 0; }
.app-rec-email { font-size: 11px; color: var(--c-text-3); margin-top: 1px; }
