/* ============================================================
   依诺线上云服务 · 设计系统
   变量 / 基础元素 / 布局 / 组件 / 响应式
   ============================================================ */

:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #eff6ff;
  --primary-border: #bfdbfe;

  --navy: #1a365d;
  --navy-2: #2d5a8e;

  --success: #16a34a;
  --success-bg: #f0fdf4;
  --warning: #d97706;
  --warning-bg: #fffbeb;
  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --info: #0891b2;
  --info-bg: #ecfeff;
  --purple: #7c3aed;
  --purple-bg: #f5f3ff;

  --text: #1a1a1a;
  --text-2: #4b5563;
  --text-3: #6b7280;
  --text-muted: #9ca3af;
  --line: #e5e7eb;
  --line-2: #f3f4f6;
  --bg: #f5f6f7;
  --bg-2: #fafbfc;
  --white: #fff;

  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 1px 3px rgba(0, 0, 0, .08);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, .15);

  --topbar-h: 48px;
  --sidenav-w: 210px;
  --bottomnav-h: 56px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei",
    "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
button { font-family: inherit; }

/* ============================================================ 登录页 */
/* 结构参照 phbx.top：深色渐变背景 + 白色卡片 + 渐变头部。
   图标一律内联 SVG，不引用任何外部字体或 CDN，保持零依赖。 */

.login-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #1F2329 0%, #2B2F36 50%, #1F2329 100%);
  padding: 20px;
}
.login-card {
  width: 100%; max-width: 360px;
  background: var(--white);
  border-radius: 12px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, .25);
  overflow: hidden;
}

/* 渐变头部 */
.login-head {
  background: linear-gradient(135deg, var(--primary), #5E7FF5);
  padding: 28px 24px 22px;
  text-align: center;
  color: #fff;
}
.login-mark {
  width: 52px; height: 52px;
  background: rgba(255, 255, 255, .2);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 10px;
  font-size: 24px; font-weight: 700; line-height: 1;
}
.login-head h1 { font-size: 17px; font-weight: 700; margin: 0 0 2px; }
.login-head p { font-size: 12px; opacity: .85; margin: 0; }

.login-body { padding: 22px; }

/* 带图标的输入框 */
.login-field {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 4px;
  margin-bottom: 12px;
  transition: border-color .25s, box-shadow .25s;
}
.login-field:hover { border-color: #d8d9dd; }
.login-field:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .1);
}
.login-icon { flex: none; display: flex; color: var(--text-muted); }
.login-icon svg { width: 15px; height: 15px; display: block; }
.login-field input {
  flex: 1; min-width: 0;
  border: none; outline: none; background: none;
  font-family: inherit; font-size: 14px; color: var(--text);
}
.login-field input::placeholder { color: #bbb; }
/* Chrome 自动填充会盖住图标颜色，这里固定填充色 */
.login-field input:-webkit-autofill {
  -webkit-text-fill-color: var(--text);
  transition: background-color 9999s ease-out;
}

.login-btn {
  width: 100%;
  display: flex; align-items: center; justify-content: center;
  padding: 10px; margin-top: 4px;
  background: var(--primary); color: #fff;
  border: none; border-radius: 4px;
  font-family: inherit; font-size: 15px; font-weight: 500; cursor: pointer;
  transition: background .15s, transform .1s;
}
.login-btn:hover { background: var(--primary-dark); }
.login-btn:active { background: #1a45c0; transform: scale(.98); }
.login-btn:disabled { opacity: .6; cursor: not-allowed; transform: none; }

/* 记住密码（下次自动登录） */
.login-remember {
  display: flex; align-items: center; gap: 6px;
  margin-top: 10px;
  font-size: 13px; color: var(--text-2); cursor: pointer;
  user-select: none; -webkit-user-select: none;
}
.login-remember input {
  width: 14px; height: 14px; margin: 0; cursor: pointer;
  accent-color: var(--primary);
}

.login-error {
  margin-top: 10px; padding: 8px 12px;
  background: #fef2f2; color: #dc2626;
  border-radius: 4px; font-size: 13px; text-align: center;
  display: none;
}
.login-tip {
  text-align: center; font-size: 12px; color: var(--text-muted); margin-top: 16px;
}

@media (max-width: 400px) {
  .login-card { margin: 0; }
  .login-body { padding: 20px 18px; }
}

/* ============================================================ 布局 */

.app-shell { min-height: 100vh; }

/* 顶部导航 */
.topbar {
  height: var(--topbar-h);
  background: var(--white);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 14px;
  padding: 0 16px;
  position: fixed; top: 0; left: 0; right: 0;
  z-index: 100;
}
.topbar .logo {
  display: flex; align-items: center; gap: 8px;
  font-weight: 700; font-size: 15px; color: var(--navy);
  cursor: pointer; white-space: nowrap;
}
.topbar .logo-mark {
  width: 26px; height: 26px; border-radius: 6px;
  background: linear-gradient(135deg, var(--navy), var(--navy-2));
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700;
}
.topbar-nav { display: flex; gap: 2px; overflow-x: auto; flex: 1; }
.topbar-nav::-webkit-scrollbar { display: none; }
.top-nav-link {
  padding: 7px 12px; border-radius: 6px;
  font-size: 13.5px; color: var(--text-2); cursor: pointer;
  white-space: nowrap; transition: all .15s;
}
.top-nav-link:hover { background: var(--bg-2); color: var(--primary); }
.top-nav-link.active { background: var(--primary-light); color: var(--primary); font-weight: 500; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.user-chip {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 10px; border-radius: 20px;
  background: var(--bg-2); cursor: pointer; font-size: 13px;
}
.user-chip:hover { background: var(--line-2); }
.user-chip .role-tag {
  font-size: 11px; padding: 1px 6px; border-radius: 10px;
  background: var(--primary-light); color: var(--primary);
}

/* 主体 */
.page-wrap { padding-top: var(--topbar-h); min-height: 100vh; }
.page-container { max-width: 1500px; margin: 0 auto; padding: 18px 20px 40px; }

.page-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; margin-bottom: 16px; flex-wrap: wrap;
}
.page-title { font-size: 19px; font-weight: 600; margin: 0; }
.page-subtitle { font-size: 12.5px; color: var(--text-muted); margin-top: 3px; }

/* ============================================================ 卡片 */

.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 14px;
}
.card-title {
  font-size: 14.5px; font-weight: 600; margin: 0 0 14px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px;
}
.card-title .sub { font-size: 12px; color: var(--text-muted); font-weight: 400; }

/* 统计卡 */
.stat-grid {
  display: grid; gap: 12px; margin-bottom: 14px;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}
.stat-card {
  background: var(--white); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px 18px;
  border-left: 3px solid var(--primary);
}
.stat-label { font-size: 12.5px; color: var(--text-3); margin-bottom: 6px; }
.stat-value { font-size: 24px; font-weight: 700; color: var(--text); line-height: 1.2; }
.stat-sub { font-size: 12px; margin-top: 5px; color: var(--text-muted); }
.stat-sub.up { color: var(--success); }
.stat-sub.down { color: var(--danger); }

/* ============================================================ 表格 */

.table-wrap {
  background: var(--white); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden;
}
.table-toolbar {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 14px; border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.table-scroll { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th {
  background: var(--bg-2); padding: 10px 12px; text-align: left;
  font-weight: 600; color: var(--text-2); font-size: 12px;
  border-bottom: 2px solid var(--line); white-space: nowrap;
  position: sticky; top: 0; z-index: 2;
}
.data-table td {
  padding: 10px 12px; border-bottom: 1px solid var(--line-2);
  vertical-align: middle;
  /* 窄屏下中文会被逐字折行（"王小明"竖成一列），默认不换行改为横向滚动 */
  white-space: nowrap;
}
/* 长文本列（摘要、备注、地址）需要正常换行时加 .wrap */
.data-table td.wrap { white-space: normal; min-width: 180px; }
.data-table tbody tr:hover { background: #f8fbff; }
.data-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.data-table .actions { display: flex; gap: 6px; justify-content: center; }
.data-table-empty { text-align: center; padding: 44px 12px; color: var(--text-muted); }
.table-sort { cursor: pointer; user-select: none; }
.table-sort:hover { color: var(--primary); }

.pagination {
  display: flex; align-items: center; justify-content: flex-end;
  gap: 8px; padding: 12px 14px; font-size: 13px; color: var(--text-3);
}
.page-btn {
  min-width: 32px; height: 32px; padding: 0 8px;
  border: 1px solid var(--line); background: var(--white);
  border-radius: 6px; cursor: pointer; font-size: 13px; color: var(--text-2);
}
.page-btn:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
.page-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.page-btn:disabled { opacity: .45; cursor: not-allowed; }

/* ============================================================ 表单 */

.form-grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group.full { grid-column: 1 / -1; }
.form-label { font-size: 12.5px; color: var(--text-2); font-weight: 500; }
.form-label.required::after { content: " *"; color: var(--danger); }
.form-control {
  padding: 8px 11px; border: 1px solid var(--line);
  border-radius: 6px; font-size: 13.5px; outline: none;
  background: var(--white); color: var(--text);
  width: 100%; font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
}
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, .1); }
.form-control:disabled { background: var(--bg-2); color: var(--text-muted); }
textarea.form-control { min-height: 76px; resize: vertical; }
.form-hint { font-size: 11.5px; color: var(--text-muted); }

/* 过滤栏 */
.filter-bar {
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
  padding: 12px 14px; background: var(--white);
  border-bottom: 1px solid var(--line);
}
.filter-bar .form-control { width: auto; min-width: 130px; }
.filter-bar .search-input { min-width: 200px; flex: 1; max-width: 320px; }

/* ============================================================ 按钮 */

.btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 7px 14px; border-radius: 6px;
  border: 1px solid var(--line); background: var(--white);
  color: var(--text-2); font-size: 13px; cursor: pointer;
  transition: all .15s; white-space: nowrap;
}
.btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: #fff; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; border-color: #b91c1c; color: #fff; }
.btn-success { background: var(--success); border-color: var(--success); color: #fff; }
.btn-success:hover { background: #15803d; border-color: #15803d; color: #fff; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-icon {
  border: none; background: transparent; cursor: pointer;
  color: var(--text-3); padding: 4px; border-radius: 4px;
  font-size: 16px; line-height: 1;
}
.btn-icon:hover { background: var(--line-2); color: var(--text); }

.action-bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ============================================================ 标签 */

.tag {
  display: inline-block; padding: 2px 8px; border-radius: 10px;
  font-size: 11.5px; font-weight: 500; white-space: nowrap;
}
.tag-blue   { background: var(--primary-light); color: var(--primary); }
.tag-green  { background: var(--success-bg); color: var(--success); }
.tag-orange { background: var(--warning-bg); color: var(--warning); }
.tag-red    { background: var(--danger-bg);  color: var(--danger); }
.tag-purple { background: var(--purple-bg);  color: var(--purple); }
.tag-cyan   { background: var(--info-bg);    color: var(--info); }
.tag-gray   { background: var(--line-2);     color: var(--text-3); }

.score-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 26px; height: 22px; padding: 0 6px;
  border-radius: 11px; font-size: 11px; font-weight: 700;
}

/* ============================================================ 弹窗 */

.modal-overlay {
  position: fixed; inset: 0; background: rgba(0, 0, 0, .45);
  z-index: 1000; display: flex; align-items: center; justify-content: center;
  padding: 20px; overflow-y: auto;
}
.modal-overlay[hidden] { display: none; }
.modal {
  background: var(--white); border-radius: var(--radius-lg);
  width: 100%; max-width: 640px; max-height: 88vh;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg);
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--line);
}
.modal-header h3 { margin: 0; font-size: 15.5px; font-weight: 600; }
.modal-body { padding: 20px; overflow-y: auto; flex: 1; }
.modal-footer {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 14px 20px; border-top: 1px solid var(--line);
}

/* ============================================================ 提示 */

.toast {
  position: fixed; top: 64px; left: 50%; transform: translateX(-50%);
  background: rgba(26, 26, 26, .92); color: #fff;
  padding: 10px 20px; border-radius: 8px; font-size: 13.5px;
  z-index: 2000; display: flex; align-items: center; gap: 8px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .2);
}
.toast[hidden] { display: none; }
.toast.success { background: rgba(22, 163, 74, .95); }
.toast.error { background: rgba(220, 38, 38, .95); }
.toast.warning { background: rgba(217, 119, 6, .95); }

/* 加载 */
.loading { text-align: center; padding: 50px 20px; color: var(--text-muted); font-size: 13px; }
.spinner {
  display: inline-block; width: 22px; height: 22px;
  border: 2px solid var(--line); border-top-color: var(--primary);
  border-radius: 50%; animation: spin .7s linear infinite;
  vertical-align: middle; margin-bottom: 10px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* 空状态 */
.empty-state { text-align: center; padding: 48px 20px; color: var(--text-muted); }
.empty-state .icon { font-size: 34px; margin-bottom: 12px; opacity: .35; }
.empty-state .text { font-size: 13.5px; }

/* ============================================================ 工具类 */

.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-strong { font-weight: 600; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }
.mt-0 { margin-top: 0; } .mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; }
.mb-0 { margin-bottom: 0; } .mb-8 { margin-bottom: 8px; } .mb-16 { margin-bottom: 16px; }
.flex { display: flex; } .flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-center { display: flex; align-items: center; gap: 8px; }
.gap-8 { gap: 8px; } .gap-12 { gap: 12px; }
.hidden { display: none !important; }
.nowrap { white-space: nowrap; }
.w-full { width: 100%; }

/* 详情网格 */
.detail-grid {
  display: grid; gap: 10px 16px;
  grid-template-columns: 110px 1fr; font-size: 13.5px;
}
.detail-label { color: var(--text-3); text-align: right; }
.detail-value { color: var(--text); word-break: break-all; }

/* 时间线 */
.timeline { position: relative; padding-left: 20px; }
.timeline::before {
  content: ''; position: absolute; left: 5px; top: 4px; bottom: 4px;
  width: 2px; background: var(--line);
}
.timeline-item { position: relative; padding-bottom: 16px; }
.timeline-item::before {
  content: ''; position: absolute; left: -18px; top: 5px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--primary); border: 2px solid var(--white);
  box-shadow: 0 0 0 2px var(--primary-light);
}
.timeline-time { font-size: 12px; color: var(--text-muted); }
.timeline-title { font-size: 13.5px; font-weight: 500; margin: 2px 0; }
.timeline-desc { font-size: 13px; color: var(--text-2); }

/* 看板图表 */
.chart-box { width: 100%; height: 260px; }
.chart-grid { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; }
.bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 9px; font-size: 13px; }
.bar-label { width: 90px; color: var(--text-2); text-align: right; flex-shrink: 0; }
.bar-track { flex: 1; height: 16px; background: var(--line-2); border-radius: 8px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--primary); border-radius: 8px; transition: width .3s; }
.bar-value { width: 70px; text-align: right; font-variant-numeric: tabular-nums; color: var(--text-2); }

/* 分段筛选条 */
.chips { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 12px; }
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 12px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--white); color: var(--text-2);
  font-size: 13px; cursor: pointer; user-select: none; transition: all .15s;
}
.chip:hover { border-color: var(--primary); color: var(--primary); }
.chip.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.chip b { font-weight: 400; color: var(--text-muted); }
.chip.on b { color: rgba(255, 255, 255, .85); }
.chip.zero { color: #bbb; border-color: #eee; }

/* 底部导航（移动端） */
.bottom-nav {
  display: none; position: fixed; bottom: 0; left: 0; right: 0;
  height: var(--bottomnav-h); background: rgba(255, 255, 255, .96);
  backdrop-filter: saturate(180%) blur(20px);
  border-top: 1px solid var(--line); z-index: 99;
  overflow-x: auto; scrollbar-width: none;
}
.bottom-nav::-webkit-scrollbar { display: none; }
.bn-scroll { display: flex; height: 100%; }
.bn-item {
  flex: 1 0 auto; min-width: 62px; height: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; font-size: 10.5px; color: var(--text-3);
  cursor: pointer; white-space: nowrap; padding: 0 8px;
}
.bn-item.active { color: var(--primary); }
.bn-item .bi { font-size: 18px; line-height: 1; }

/* ============================================================ 响应式 */

@media (max-width: 1024px) {
  .topbar-nav { display: none; }
  .bottom-nav { display: block; }
  .page-container { padding: 12px 12px 76px; }
  .chart-grid { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .stat-card { padding: 12px 14px; }
  .stat-value { font-size: 20px; }
  .modal { max-height: 92vh; }
  .modal-overlay { padding: 10px; align-items: flex-end; }
  .data-table th, .data-table td { padding: 9px 10px; }
  .filter-bar .form-control, .filter-bar .search-input { flex: 1 1 45%; min-width: 0; }
  .detail-grid { grid-template-columns: 88px 1fr; gap: 8px 10px; }
  .bar-label { width: 68px; }
}

@media (max-width: 560px) {
  .form-grid { grid-template-columns: 1fr; }
  .page-title { font-size: 17px; }
  .modal-footer { flex-direction: column-reverse; }
  .modal-footer .btn { width: 100%; justify-content: center; }
}