:root {
  --run-blue: #0057C8;
  --run-blue-dark: #003B8F;
  --run-blue-bright: #1683E8;
  --run-blue-soft: #EAF4FF;
  --run-orange: #FF6A00;
  --run-orange-bright: #FF8A2A;
  --run-orange-soft: #FFF2E8;
  --run-text: #111827;
  --run-muted: #6B7280;
  --run-border: #E5E7EB;
  --run-bg: #F7FAFC;
}

/* RUN ERP - 全局样式 */
* {
  box-sizing: border-box;
}

html, body, #app {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: Inter, -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--run-bg);
  color: var(--run-text);
}

.layout {
  min-height: 100vh;
}

/* ========== Header ========== */
.app-header {
  background: #fff;
  border-bottom: 1px solid var(--run-border);
  padding: 0 !important;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  height: 60px;
  padding: 0 24px;
  gap: 20px;
}

.brand {
  display: flex;
  align-items: center;
  text-decoration: none;
  font-size: 18px;
  font-weight: 600;
  color: var(--run-text);
}

.brand-logo {
  width: 38px;
  height: 38px;
  object-fit: contain;
  margin-right: 10px;
}

.brand-copy {
  display: flex;
  flex-direction: column;
  line-height: 1.05;
}

.brand-text {
  font-size: 20px;
  letter-spacing: 0;
  background: linear-gradient(135deg, var(--run-blue-dark), var(--run-blue-bright));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.brand-subtext {
  font-size: 11px;
  color: var(--run-muted);
  font-weight: 500;
}

.nav {
  display: flex;
  gap: 16px;
  flex: 1;
}

.nav-link {
  color: var(--run-muted);
  text-decoration: none;
  font-size: 14px;
  padding: 6px 0;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}

.nav-link:hover,
.nav-link.router-link-exact-active {
  color: var(--run-blue);
  border-bottom-color: var(--run-blue);
}

.nav-dropdown {
  display: flex;
  align-items: center;
  gap: 2px;
  cursor: pointer;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 20px;
  transition: background 0.2s;
}

.user-chip:hover {
  background: var(--run-blue-soft);
}

.avatar {
  background: linear-gradient(135deg, var(--run-blue), var(--run-orange)) !important;
  color: #fff !important;
}

.nickname {
  font-size: 14px;
  color: var(--run-text);
}

/* ========== Tab Bar ========== */
.tab-bar {
  background: #fff;
  border-bottom: 1px solid var(--run-border);
  padding: 0 24px;
  display: flex;
  gap: 4px;
  overflow-x: auto;
}
.tab-item {
  padding: 6px 12px;
  font-size: 12px;
  cursor: pointer;
  border-radius: 4px 4px 0 0;
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  color: #606266;
  transition: background 0.2s, color 0.2s;
}
.tab-item:hover {
  background: #f5f7fa;
}
.tab-item.active {
  background: var(--run-blue);
  color: #fff;
}
.tab-close {
  cursor: pointer;
  font-size: 10px;
  line-height: 1;
  border-radius: 50%;
  width: 14px;
  height: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.tab-close:hover {
  background: rgba(0,0,0,0.1);
}

/* ========== Main ========== */
.app-main {
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
  padding: 24px !important;
}

/* ========== Footer ========== */
.app-footer {
  text-align: center;
  color: var(--run-muted);
  font-size: 12px;
  height: 50px !important;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ========== 卡片 ========== */
.page-card {
  background: #fff;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

/* ========== Auth 页面 ========== */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 78% 20%, rgba(255, 106, 0, 0.18), transparent 28%),
    linear-gradient(135deg, var(--run-blue-dark) 0%, var(--run-blue) 48%, var(--run-blue-bright) 100%);
  padding: 24px;
}

.auth-card {
  background: #fff;
  border-radius: 16px;
  padding: 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
}

.auth-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-bottom: 10px;
}

.auth-brand img {
  width: 72px;
  height: 72px;
  object-fit: contain;
}

.auth-brand h1 {
  margin: 0 0 4px;
  font-size: 30px;
  background: linear-gradient(135deg, var(--run-blue-dark), var(--run-blue-bright));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.auth-brand p {
  margin: 0;
  color: var(--run-muted);
  font-size: 13px;
}

.auth-card .subtitle {
  text-align: center;
  color: var(--run-muted);
  margin-bottom: 32px;
  font-size: 14px;
}

.auth-card .el-button {
  width: 100%;
}

.auth-switch {
  text-align: center;
  margin-top: 16px;
  color: var(--run-muted);
  font-size: 14px;
}

.auth-switch a {
  color: var(--run-blue);
  text-decoration: none;
  margin-left: 4px;
}

/* ========== Case 列表 ========== */
.case-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.case-list-header h2 {
  margin: 0;
  font-size: 20px;
}

.case-filters {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

.case-item {
  background: #fff;
  border-radius: 8px;
  padding: 16px 20px;
  margin-bottom: 12px;
  cursor: pointer;
  transition: all 0.2s;
  border-left: 3px solid transparent;
}

.case-item:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  border-left-color: var(--run-blue);
  transform: translateX(2px);
}

.case-item-title {
  font-size: 16px;
  font-weight: 500;
  color: #303133;
  margin: 0 0 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.case-item-meta {
  font-size: 12px;
  color: #909399;
  display: flex;
  gap: 16px;
  align-items: center;
}

.case-item-meta .stat {
  display: flex;
  align-items: center;
  gap: 4px;
}

.empty {
  text-align: center;
  padding: 60px 20px;
  color: #909399;
}

.pagination-wrap {
  margin-top: 24px;
  display: flex;
  justify-content: center;
}

/* ========== Case 详情 ========== */
.case-detail-card {
  background: #fff;
  border-radius: 8px;
  padding: 32px;
  margin-bottom: 16px;
}

.case-detail-card .case-title {
  margin: 0 0 12px;
  font-size: 24px;
  font-weight: 600;
}

.case-detail-card .case-meta {
  color: #909399;
  font-size: 13px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.case-detail-card .case-content {
  font-size: 15px;
  line-height: 1.8;
  color: #303133;
  white-space: pre-wrap;
  word-break: break-word;
}

.case-actions {
  margin-top: 24px;
  display: flex;
  gap: 12px;
  align-items: center;
  padding-top: 16px;
  border-top: 1px solid #ebeef5;
}

/* 回复区 */
.replies-section {
  background: #fff;
  border-radius: 8px;
  padding: 24px 32px;
}

.replies-header {
  font-size: 16px;
  font-weight: 500;
  margin-bottom: 16px;
  color: #303133;
}

.reply-item {
  padding: 16px 0;
  border-bottom: 1px solid #f0f2f5;
  position: relative;
}

.reply-item:last-child {
  border-bottom: none;
}

.reply-item.accepted {
  background: linear-gradient(90deg, rgba(103, 194, 58, 0.06), transparent);
  padding: 16px;
  border-radius: 6px;
  border-bottom: none;
  margin-bottom: 8px;
}

.reply-author {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 13px;
  color: #606266;
}

.reply-content {
  font-size: 14px;
  line-height: 1.7;
  color: #303133;
  white-space: pre-wrap;
  word-break: break-word;
}

.reply-actions {
  margin-top: 8px;
  display: flex;
  gap: 8px;
}

.accepted-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #67c23a;
  color: #fff;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
}

.reply-form {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid #ebeef5;
}

.reply-form .el-button {
  margin-top: 12px;
}

/* 状态标签 */
.status-tag {
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
}

.status-tag.open {
  background: #ecf5ff;
  color: #409eff;
}

.status-tag.resolved {
  background: #f0f9eb;
  color: #67c23a;
}

/* 个人中心 */
.profile-section {
  margin-bottom: 32px;
}

.profile-section h3 {
  margin: 0 0 16px;
  font-size: 16px;
  color: #303133;
}

.profile-form {
  max-width: 400px;
}

/* 邀请码管理 */
.invite-code {
  font-family: "Consolas", "Monaco", monospace;
  background: #f5f7fa;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 13px;
}

/* 图片上传栏 */
.upload-bar {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.upload-bar .upload-hint {
  font-size: 12px;
  color: #909399;
}

/* 正文/回复中的图片 */
.case-content,
.reply-content {
  white-space: pre-wrap;
  word-break: break-word;
}

.case-content .content-image,
.reply-content .content-image {
  display: block;
  max-width: 100%;
  max-height: 480px;
  margin: 12px 0;
  border-radius: 6px;
  border: 1px solid #ebeef5;
  cursor: zoom-in;
  background: #fafafa;
}

.case-content .content-image:hover,
.reply-content .content-image:hover {
  border-color: var(--run-blue);
}

/* el-image 的容器也要限制宽度 */
.case-content .el-image,
.reply-content .el-image {
  max-width: 100%;
}

/* 审计日志 */
.filter-row {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
}

.mono {
  font-family: "Consolas", "Monaco", "Courier New", monospace;
}

/* 财务汇总卡片 */
.stat-card {
  background: #f5f7fa;
  border-radius: 8px;
  padding: 12px 20px;
  min-width: 120px;
}

.stat-label {
  font-size: 12px;
  color: #909399;
  margin-bottom: 4px;
}

.stat-value {
  font-size: 18px;
  font-weight: 600;
  color: #303133;
}

/* ========== 看板 ========== */
.dashboard-welcome {
  background:
    linear-gradient(135deg, var(--run-blue-dark) 0%, var(--run-blue) 58%, var(--run-blue-bright) 100%);
  border-radius: 14px;
  padding: 28px 32px;
  color: #fff;
  margin-bottom: 20px;
}

.dashboard-welcome h2 {
  color: #fff;
}

.dashboard-welcome p {
  color: rgba(255, 255, 255, 0.85) !important;
}

.dashboard-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.kpi-card {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  cursor: pointer;
  transition: all 0.3s ease;
  border-left: 4px solid #dcdfe6;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.kpi-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

.kpi-icon {
  color: inherit;
}

.kpi-body {
  flex: 1;
}

.kpi-value {
  font-size: 26px;
  font-weight: 700;
  line-height: 1.2;
}

.kpi-label {
  font-size: 13px;
  color: #909399;
  margin-top: 4px;
}

.kpi-sub {
  font-size: 12px;
  color: #909399;
}

/* KPI 颜色 */
.kpi-blue  { border-left-color: #409eff; }
.kpi-blue  .kpi-icon { color: #409eff; }
.kpi-blue  .kpi-value { color: #409eff; }

.kpi-orange { border-left-color: var(--run-orange); }
.kpi-orange .kpi-icon { color: var(--run-orange); }
.kpi-orange .kpi-value { color: var(--run-orange); }

.kpi-yellow { border-left-color: #e6a23c; }
.kpi-yellow .kpi-icon { color: #e6a23c; }
.kpi-yellow .kpi-value { color: #e6a23c; }

.kpi-green  { border-left-color: #67c23a; }
.kpi-green  .kpi-icon { color: #67c23a; }
.kpi-green  .kpi-value { color: #67c23a; }

.kpi-purple { border-left-color: #9b59b6; }
.kpi-purple .kpi-icon { color: #9b59b6; }
.kpi-purple .kpi-value { color: #9b59b6; }

.kpi-cyan   { border-left-color: #17a2b8; }
.kpi-cyan   .kpi-icon { color: #17a2b8; }
.kpi-cyan   .kpi-value { color: #17a2b8; }

.kpi-red    { border-left-color: #e74c3c; }
.kpi-red    .kpi-icon { color: #e74c3c; }
.kpi-red    .kpi-value { color: #e74c3c; }

.kpi-gray   { border-left-color: #909399; }
.kpi-gray   .kpi-icon { color: #909399; }
.kpi-gray   .kpi-value { color: #606266; }

/* 快捷操作 */
.dashboard-shortcuts {
  background: #fff;
  border-radius: 10px;
  padding: 20px 24px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

.shortcut-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
}

.shortcut-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 8px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s;
  font-size: 13px;
  color: #606266;
}

.shortcut-btn:hover {
  background: #f5f7fa;
}

/* 表情选择器 */
.emoji-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 4px;
  max-height: 300px;
  overflow-y: auto;
}

.emoji-item {
  font-size: 22px;
  padding: 6px 4px;
  text-align: center;
  cursor: pointer;
  border-radius: 4px;
  user-select: none;
  line-height: 1;
  transition: background 0.15s;
}

.emoji-item:hover {
  background: #f5f7fa;
}

/* ========== 工作区弹出菜单网格 ========== */
.workspace-menu-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 16px; }
.workspace-menu-col { }
.workspace-menu-title { font-weight: 600; color: #303133; font-size: 13px; margin-bottom: 8px; padding-bottom: 4px; border-bottom: 2px solid var(--run-blue); }
.workspace-menu-item { font-size: 13px; color: #606266; padding: 6px 0; cursor: pointer; transition: color 0.2s; }
.workspace-menu-item:hover { color: var(--run-blue); }

/* ========== 打印/PDF导出 ========== */
@media print {
  .app-header, .app-footer, .nav, .user-chip, .el-pagination, .filter-row button { display: none !important; }
  .app-main { padding: 0 !important; max-width: 100% !important; }
  .page-card { box-shadow: none !important; }
}

/* ========== 手机适配 ========== */
@media (max-width: 768px) {
  .header-inner {
    padding: 0 12px;
    gap: 8px;
  }
  .brand-text { display: none; }
  .brand-icon { font-size: 20px; margin-right: 0; }
  .nav { gap: 6px; }
  .nav-link { font-size: 13px; }
  .nickname { display: none; }

  .app-main { padding: 12px !important; }

  .page-card { padding: 12px; }

  .dashboard-welcome { padding: 16px; }
  .dashboard-cards {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  .kpi-card { padding: 14px; }
  .kpi-value { font-size: 22px; }
  .shortcut-grid { grid-template-columns: repeat(4, 1fr); gap: 8px; }
  .shortcut-btn { padding: 10px 4px; font-size: 12px; }

  .case-list-header { flex-direction: column; gap: 8px; align-items: flex-start; }
  .case-filters { flex-wrap: wrap; }

  .filter-row { flex-wrap: wrap; gap: 8px; }

  .el-table { font-size: 12px; }
  .el-table-column { min-width: auto; }

  .el-dialog { width: 95% !important; margin: 8px auto !important; }
  .el-dialog__body { padding: 12px 16px; }

  .el-pagination { flex-wrap: wrap; justify-content: center; }
}
