/* ==========================================================================
   致知职业规划 · 管理后台样式
   品牌 VI：主色 #2563EB / 辅助 #06B6D4 / 深色 #0F172A
   ========================================================================== */
:root {
  --blue-50: #EFF6FF;
  --blue-100: #DBEAFE;
  --blue-300: #93C5FD;
  --blue-400: #60A5FA;
  --blue-500: #3B82F6;
  --blue-600: #2563EB;
  --blue-800: #1E40AF;
  --cyan-500: #06B6D4;
  --ink: #0F172A;
  --gray-50: #F8FAFC;
  --gray-100: #F1F5F9;
  --gray-200: #E2E8F0;
  --gray-300: #CBD5E1;
  --gray-400: #94A3B8;
  --gray-500: #64748B;
  --gray-600: #475569;
  --gray-700: #334155;
  --red: #DC2626;
  --red-bg: #FEF2F2;
  --green: #16A34A;
  --green-bg: #F0FDF4;
  --amber: #D97706;
  --amber-bg: #FFFBEB;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(15, 23, 42, .08), 0 4px 12px rgba(15, 23, 42, .04);
  --shadow-lg: 0 8px 30px rgba(15, 23, 42, .12);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', 'Noto Sans SC', 'Segoe UI', sans-serif;
  background: var(--gray-50);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--blue-600); text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 14px; }

/* ============================ 登录页 ============================ */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0F172A 0%, #1E3A8A 55%, #2563EB 100%);
  padding: 20px;
}
.login-card {
  width: 100%;
  max-width: 400px;
  background: #fff;
  border-radius: 16px;
  padding: 40px 36px 32px;
  box-shadow: var(--shadow-lg);
}
.login-logo {
  width: 52px; height: 52px;
  border-radius: 14px;
  background: var(--blue-600);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; font-weight: 700;
  margin-bottom: 18px;
}
.login-card h1 { font-size: 22px; margin: 0 0 6px; letter-spacing: -.3px; }
.login-card .sub { color: var(--gray-500); font-size: 13px; margin-bottom: 26px; }

/* ============================ 通用控件 ============================ */
.field { margin-bottom: 16px; }
.field label {
  display: block; font-size: 13px; font-weight: 500;
  color: var(--gray-700); margin-bottom: 6px;
}
.input, select.input {
  width: 100%; padding: 10px 12px;
  border: 1px solid var(--gray-300);
  border-radius: 8px; background: #fff;
  transition: border-color .15s, box-shadow .15s;
  outline: none;
}
.input:focus {
  border-color: var(--blue-500);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px; border-radius: 8px; border: 1px solid transparent;
  font-size: 14px; font-weight: 500; transition: all .15s;
  white-space: nowrap;
}
.btn-primary { background: var(--blue-600); color: #fff; }
.btn-primary:hover { background: var(--blue-800); }
.btn-ghost { background: #fff; color: var(--gray-700); border-color: var(--gray-300); }
.btn-ghost:hover { border-color: var(--blue-400); color: var(--blue-600); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #B91C1C; }
.btn-success { background: var(--green); color: #fff; }
.btn-success:hover { background: #15803D; }
.btn-block { width: 100%; padding: 12px; font-size: 15px; }
.btn-sm { padding: 5px 10px; font-size: 12.5px; border-radius: 6px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ============================ 布局 ============================ */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 216px; flex-shrink: 0;
  background: var(--ink); color: #fff;
  display: flex; flex-direction: column;
  position: fixed; top: 0; bottom: 0; left: 0;
  z-index: 20;
}
.sidebar .brand {
  padding: 22px 20px 18px;
  display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}
.sidebar .brand .mark {
  width: 32px; height: 32px; border-radius: 9px;
  background: var(--blue-600);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 16px; flex-shrink: 0;
}
.sidebar .brand .txt { font-size: 15px; font-weight: 600; line-height: 1.25; }
.sidebar .brand .txt small { display: block; font-size: 11px; color: var(--blue-300); font-weight: 400; }

.nav { flex: 1; padding: 12px 10px; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 8px;
  color: #CBD5E1; font-size: 13.5px; margin-bottom: 3px;
  border: none; background: none; width: 100%; text-align: left;
  transition: all .15s;
}
.nav-item:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.nav-item.active { background: var(--blue-600); color: #fff; font-weight: 500; }
.nav-item .ico { width: 18px; text-align: center; flex-shrink: 0; }
.nav-item .badge {
  margin-left: auto; background: var(--red); color: #fff;
  font-size: 11px; padding: 1px 6px; border-radius: 9px; min-width: 18px; text-align: center;
}

.sidebar-foot {
  padding: 14px 16px; border-top: 1px solid rgba(255, 255, 255, .08);
  font-size: 12px; color: var(--gray-400);
}
.sidebar-foot .who { color: #fff; font-size: 13px; margin-bottom: 6px; }

.main { flex: 1; margin-left: 216px; min-width: 0; }

.topbar {
  height: 60px; background: #fff; border-bottom: 1px solid var(--gray-200);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 26px; position: sticky; top: 0; z-index: 10;
}
.topbar h2 { font-size: 17px; margin: 0; font-weight: 600; }
.topbar .actions { display: flex; gap: 10px; align-items: center; }

.content { padding: 22px 26px 60px; }

/* ============================ 卡片 / 表格 ============================ */
.card {
  background: #fff; border: 1px solid var(--gray-200);
  border-radius: var(--radius); box-shadow: var(--shadow);
  margin-bottom: 18px; overflow: hidden;
}
.card-head {
  padding: 15px 18px; border-bottom: 1px solid var(--gray-200);
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}
.card-head h3 { font-size: 15px; margin: 0; font-weight: 600; }
.card-head .desc { font-size: 12.5px; color: var(--gray-500); margin-top: 2px; font-weight: 400; }
.card-body { padding: 18px; }
.card-body.p0 { padding: 0; }

.stat-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px; margin-bottom: 18px;
}
.stat {
  background: #fff; border: 1px solid var(--gray-200); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow);
}
.stat .label { font-size: 12.5px; color: var(--gray-500); display: flex; align-items: center; gap: 5px; }
.stat .value {
  font-size: 26px; font-weight: 700; margin: 6px 0 2px;
  letter-spacing: -.5px; font-variant-numeric: tabular-nums;
}
.stat .value .unit { font-size: 14px; font-weight: 500; color: var(--gray-500); margin-left: 3px; }
.stat .foot { font-size: 12px; color: var(--gray-500); }
.stat.hl { border-color: var(--blue-300); background: linear-gradient(180deg, #fff, var(--blue-50)); }
.stat.hl .value { color: var(--blue-600); }

table { width: 100%; border-collapse: collapse; }
th, td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--gray-100); vertical-align: middle; }
th {
  font-size: 12.5px; font-weight: 600; color: var(--gray-600);
  background: var(--gray-50); white-space: nowrap; position: sticky; top: 0;
}
td { font-size: 13.5px; }
tbody tr:hover { background: var(--blue-50); }
tbody tr:last-child td { border-bottom: none; }
.table-scroll { overflow-x: auto; max-height: 640px; overflow-y: auto; }
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: 'SF Mono', Consolas, Monaco, monospace; font-size: 12.5px; }

.pill {
  display: inline-block; padding: 2px 9px; border-radius: 20px;
  font-size: 12px; font-weight: 500; white-space: nowrap;
}
.pill-blue { background: var(--blue-100); color: var(--blue-800); }
.pill-green { background: var(--green-bg); color: var(--green); }
.pill-red { background: var(--red-bg); color: var(--red); }
.pill-amber { background: var(--amber-bg); color: var(--amber); }
.pill-gray { background: var(--gray-100); color: var(--gray-600); }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.toolbar .input, .toolbar select { width: auto; min-width: 150px; }

.empty { text-align: center; padding: 56px 20px; color: var(--gray-400); }
.empty .ico { font-size: 40px; margin-bottom: 10px; opacity: .5; }

.pager {
  display: flex; align-items: center; justify-content: center; gap: 14px;
  padding: 14px; border-top: 1px solid var(--gray-100); font-size: 13px; color: var(--gray-600);
}

/* ============================ 弹窗 ============================ */
.modal-mask {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .5);
  display: flex; align-items: center; justify-content: center;
  z-index: 100; padding: 20px; backdrop-filter: blur(2px);
}
.modal {
  background: #fff; border-radius: 14px; width: 100%; max-width: 620px;
  max-height: 88vh; display: flex; flex-direction: column; box-shadow: var(--shadow-lg);
}
.modal.wide { max-width: 860px; }
.modal-head {
  padding: 18px 22px; border-bottom: 1px solid var(--gray-200);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-head h3 { margin: 0; font-size: 16px; }
.modal-body { padding: 20px 22px; overflow-y: auto; }
.modal-foot {
  padding: 14px 22px; border-top: 1px solid var(--gray-200);
  display: flex; justify-content: flex-end; gap: 10px;
}
.close-x { background: none; border: none; font-size: 22px; color: var(--gray-400); line-height: 1; padding: 0 4px; }
.close-x:hover { color: var(--ink); }

.kv { display: grid; grid-template-columns: 110px 1fr; gap: 8px 14px; font-size: 13.5px; }
.kv dt { color: var(--gray-500); }
.kv dd { margin: 0; word-break: break-all; }

.tag-list { display: flex; flex-wrap: wrap; gap: 6px; }

.proof-img {
  max-width: 100%; border-radius: 8px; border: 1px solid var(--gray-200);
  cursor: zoom-in; background: var(--gray-100);
}

/* ============================ 提示 / 吐司 ============================ */
.toast-box { position: fixed; top: 18px; right: 18px; z-index: 999; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: #fff; border-left: 4px solid var(--blue-600);
  border-radius: 8px; padding: 12px 16px; box-shadow: var(--shadow-lg);
  font-size: 13.5px; min-width: 220px; max-width: 380px;
  animation: slideIn .22s ease;
}
.toast.success { border-left-color: var(--green); }
.toast.error { border-left-color: var(--red); }
@keyframes slideIn { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }

.alert {
  padding: 11px 14px; border-radius: 8px; font-size: 13px;
  margin-bottom: 14px; line-height: 1.65;
}
.alert-info { background: var(--blue-50); color: var(--blue-800); border: 1px solid var(--blue-100); }
.alert-warn { background: var(--amber-bg); color: #92400E; border: 1px solid #FDE68A; }
.alert-danger { background: var(--red-bg); color: #991B1B; border: 1px solid #FECACA; }

/* ============================ 图表 ============================ */
.bars { display: flex; flex-direction: column; gap: 9px; }
.bar-row { display: grid; grid-template-columns: 130px 1fr 56px; gap: 10px; align-items: center; font-size: 12.5px; }
.bar-track { height: 9px; background: var(--gray-100); border-radius: 5px; overflow: hidden; }
.bar-fill { height: 100%; background: linear-gradient(90deg, var(--blue-400), var(--blue-600)); border-radius: 5px; transition: width .5s; }
.bar-row .val { text-align: right; color: var(--gray-600); font-variant-numeric: tabular-nums; }

.trend { display: flex; align-items: flex-end; gap: 6px; height: 150px; padding-top: 10px; }
.trend .col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 5px; height: 100%; justify-content: flex-end; }
.trend .stick { width: 100%; max-width: 30px; background: linear-gradient(180deg, var(--blue-400), var(--blue-600)); border-radius: 4px 4px 0 0; min-height: 3px; }
.trend .stick.r { background: linear-gradient(180deg, var(--cyan-500), #0891B2); }
.trend .lbl { font-size: 10.5px; color: var(--gray-400); white-space: nowrap; }

.spinner {
  width: 30px; height: 30px; border: 3px solid var(--gray-200);
  border-top-color: var(--blue-600); border-radius: 50%;
  animation: spin .8s linear infinite; margin: 40px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

.hidden { display: none !important; }
.muted { color: var(--gray-500); }
.small { font-size: 12.5px; }
.mt10 { margin-top: 10px; } .mt16 { margin-top: 16px; } .mt24 { margin-top: 24px; }
.flex { display: flex; } .gap10 { gap: 10px; } .between { justify-content: space-between; }
.center { align-items: center; } .wrap { flex-wrap: wrap; }

@media (max-width: 820px) {
  .sidebar { width: 60px; }
  .sidebar .brand .txt, .nav-item span:not(.ico), .sidebar-foot { display: none; }
  .main { margin-left: 60px; }
  .content { padding: 16px; }
  .kv { grid-template-columns: 90px 1fr; }
}
