* { margin:0; padding:0; box-sizing:border-box; font-family:system-ui, -apple-system, 'Microsoft YaHei', sans-serif; }
body { background:#f5f7fb; padding:20px; }

.modal-overlay {
  position:fixed; top:0; left:0; width:100%; height:100%;
  background:rgba(0,0,0,0.5); display:flex; justify-content:center; align-items:center;
  z-index:999;
}
.login-box, .modal-box {
  background:#fff; padding:40px 36px; border-radius:24px; max-width:550px; width:90%;
  box-shadow:0 20px 60px rgba(0,0,0,0.2);
  max-height:85vh; overflow-y:auto;
}

.login-box h2 { text-align:center; margin-bottom:24px; }

.form-group { margin-bottom:18px; }
.form-group label { display:block; font-weight:600; margin-bottom:4px; font-size:14px; }
.form-group input, .form-group select, .form-group textarea {
  width:100%; padding:10px 12px; border:1px solid #d0d7de; border-radius:10px;
  font-size:14px; transition:0.2s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline:none; border-color:#409eff; box-shadow:0 0 0 3px rgba(64,158,255,0.2);
}

button { padding:10px 24px; border:none; border-radius:30px; font-weight:600; cursor:pointer; transition:0.2s; }
button.primary { background:#409eff; color:#fff; }
button.primary:hover { background:#2d8bdf; }
button.secondary { background:#e4e7ed; color:#333; }
button.secondary:hover { background:#cdd0d6; }
button.logout { background:#f56c6c; color:#fff; }
button.logout:hover { background:#e04e4e; }
button.danger { background:#f56c6c; color:#fff; }
button.danger:hover { background:#e04e4e; }

#loginBtn { width:100%; padding:12px; background:#409eff; color:#fff; font-size:16px; border-radius:30px; }
#loginBtn:hover { background:#2d8bdf; }

/* ===== 顶栏 ===== */
.top-bar {
  display:flex; justify-content:space-between; align-items:center;
  background:#fff; padding:8px 20px; border-radius:16px;
  box-shadow:0 2px 8px rgba(0,0,0,0.04); margin-bottom:12px;
  flex-wrap:wrap; gap:8px;
}
.top-left { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.top-title { font-weight:700; font-size:17px; color:#1e466e; }
.top-role { background:#eee; padding:2px 12px; border-radius:20px; font-size:12px; }
.top-user { font-size:13px; color:#555; }
.btn-top {
  padding:4px 14px !important; border-radius:30px !important;
  font-weight:500; font-size:12px; cursor:pointer; border:none;
  transition:0.2s;
}
.btn-change-pwd {
  background:transparent; color:#409eff; border:1px solid #409eff;
}
.btn-change-pwd:hover { background:#ecf5ff; }
.btn-admin {
  background:#e4e7ed; color:#333;
}
.btn-admin:hover { background:#cdd0d6; }

.top-right { display:flex; align-items:center; gap:16px; flex-wrap:wrap; }
.tab-switch { display:flex; background:#f0f2f5; border-radius:30px; padding:3px; }
.tab-switch .tab-btn {
  padding:5px 16px; border:none; border-radius:30px; font-size:13px;
  font-weight:600; cursor:pointer; transition:0.2s;
  background:transparent; color:#888;
}
.tab-switch .tab-btn.active { background:#409eff; color:#fff; }
.tab-switch .tab-btn:hover:not(.active) { background:#e4e7ed; }

.top-stats { display:flex; gap:16px; font-size:13px; color:#666; }
.top-stats strong { color:#1e466e; font-size:15px; margin:0 2px; }

/* ===== 筛选栏 ===== */
.filters {
  display:flex; flex-wrap:wrap; align-items:center; gap:10px;
  background:#fff; padding:8px 16px; border-radius:16px;
  box-shadow:0 2px 8px rgba(0,0,0,0.04); margin-bottom:16px;
}
.filter-group { display:flex; flex-wrap:wrap; align-items:center; gap:8px; flex:1; }
.filters select, .filters input {
  padding:6px 12px; border:1px solid #d0d7de; border-radius:20px;
  font-size:13px; background:#fafafa; outline:none;
}
.filters select:focus, .filters input:focus { border-color:#409eff; }
.filter-right { display:flex; align-items:center; gap:8px; flex-wrap:wrap; margin-left:auto; }

.btn-knowledge-filter {
  padding:4px 14px !important; font-size:12px !important; border-radius:30px !important;
  border:none; cursor:pointer; transition:0.2s; font-weight:600;
  background:#ecf5ff; color:#409eff;
}
.btn-knowledge-filter:hover { background:#d9ecff; }

.btn-schedule-new {
  padding:4px 14px !important; font-size:12px !important; border-radius:30px !important;
  border:none; cursor:pointer; transition:0.2s; font-weight:600;
  background:#e8f5e9; color:#388e3c;
}
.btn-schedule-new:hover { background:#c8e6c9; }

.btn-memo-new {
  padding:4px 14px !important; font-size:12px !important; border-radius:30px !important;
  border:none; cursor:pointer; transition:0.2s; font-weight:600;
  background:#fff3e0; color:#e67e22;
}
.btn-memo-new:hover { background:#ffe0b2; }

#myTicketsFilter, #mySubmittedFilter {
  display:inline-flex; align-items:center; gap:4px;
  padding:2px 10px; background:#f5f7fb; border-radius:30px;
  font-size:12px; color:#555;
}
#myTicketsFilter input[type="checkbox"], #mySubmittedFilter input[type="checkbox"] {
  width:15px; height:15px; accent-color:#409eff; cursor:pointer; margin:0;
}
#myTicketsFilter label, #mySubmittedFilter label {
  cursor:pointer; user-select:none; font-size:12px; color:#555;
}

.btn-new-ticket-filter { padding:6px 20px; font-size:13px; border-radius:30px; }
.btn-refresh {
  padding:6px 20px; font-size:13px; border-radius:30px;
  background:#e4e7ed; color:#333; border:none; font-weight:600; cursor:pointer;
}
.btn-refresh:hover { background:#cdd0d6; }

/* ===== 卡片布局 ===== */
.ticket-card {
  background:#fff; padding:12px 16px; border-radius:12px;
  box-shadow:0 2px 8px rgba(0,0,0,0.04); margin-bottom:10px;
}
.ticket-row {
  display:flex; justify-content:space-between; align-items:flex-start; gap:6px;
}
.ticket-left { display:flex; align-items:center; gap:8px; flex-wrap:wrap; flex:1; min-width:0; }
.ticket-title { font-weight:600; font-size:15px; color:#1e466e; max-width:400px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.ticket-actions { display:flex; gap:6px; flex-wrap:wrap; flex-shrink:0; }
.ticket-actions button { padding:4px 14px !important; font-size:12px !important; border-radius:30px !important; }
.ticket-actions .secondary { background:#e4e7ed; color:#333; border:none; }
.ticket-actions .secondary:hover { background:#cdd0d6; }
.ticket-actions .primary { background:#409eff; color:#fff; border:none; }
.ticket-actions .primary:hover { background:#2d8bdf; }
.ticket-meta {
  display:flex; flex-wrap:wrap; align-items:center; gap:4px;
  margin-top:6px; font-size:12px; color:#666;
}
.ticket-meta span { display:inline-flex; align-items:center; }

/* ===== 工单详情 - 展开/收起 ===== */
.ticket-detail {
  margin-top: 8px;
  padding: 8px 12px;
  padding-bottom: 30px;
  background: #f8fafc;
  border-radius: 8px;
  font-size: 13px;
  color: #333;
  line-height: 1.6;
  white-space: pre-wrap !important;
  word-break: break-word;
  overflow-wrap: break-word;
  max-height: 90px;
  overflow: hidden;
  position: relative;
  cursor: pointer;
  transition: max-height 0.3s ease;
}

/* 折叠状态：底部一整条渐变遮罩 */
.ticket-detail:not(.expanded):not(.no-fold)::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 50px;
  background: linear-gradient(to bottom, transparent, #f8fafc 60%, #f8fafc 100%);
  pointer-events: none;
  border-radius: 0 0 8px 8px;
}

/* 展开状态：取消 max-height 限制 */
.ticket-detail.expanded {
  max-height: none;
}

/* 内容不超长时：不显示任何额外元素 */
.ticket-detail.no-fold {
  max-height: none;
  cursor: default;
}
.ticket-detail.no-fold::after {
  content: none !important;
  display: none !important;
}

/* ===== 右下角的展开/收起文字按钮 ===== */
.fold-toggle {
  position: absolute;
  bottom: 4px;
  right: 12px;
  font-size: 13px;
  font-weight: 500;
  color: #409eff;
  cursor: pointer;
  pointer-events: auto;
  z-index: 2;
  user-select: none;
  background: #f8fafc;
  padding: 0 4px;
  border-radius: 4px;
}
.fold-toggle:hover {
  color: #2d8bdf;
}

/* 内容不超长时，隐藏 fold-toggle */
.ticket-detail.no-fold .fold-toggle {
  display: none !important;
}

/* 展开状态下，fold-toggle 背景透明 */
.ticket-detail.expanded .fold-toggle {
  background: transparent;
}

/* 详情内的链接样式 */
.ticket-detail a {
  color: #409eff;
  text-decoration: underline;
  word-break: break-all;
}
.ticket-detail a:hover {
  color: #2d8bdf;
}

/* 图片处理 */
.ticket-detail .images {
  margin-top: 8px;
}
.ticket-detail:not(.expanded) .images {
  max-height: 60px;
  overflow: hidden;
}
.ticket-detail.expanded .images {
  max-height: none;
}

.ticket-status {
  padding:2px 12px !important; font-size:12px !important; border-radius:30px;
  font-weight:600; display:inline-block;
}
.status-pending { background:#fdf6ec; color:#e6a23c; }
.status-handled { background:#e8f9ed; color:#67c23a; }
.status-waiting { background:#ecf5ff; color:#409eff; }
.status-operated { background:#f0f0f0; color:#888; }
.status-deleted { background:#f5f5f5; color:#999; }
.status-in_progress { background:#e3f2fd; color:#1976d2; }
.status-testing { background:#f3e5f5; color:#7b1fa2; }
.status-interrupted { background:#fbe9e7; color:#d84315; }
.status-completed { background:#e8f5e9; color:#388e3c; }

.images { display:flex; gap:6px; flex-wrap:wrap; margin-top:6px; }
.images img { max-width:80px; max-height:80px; border-radius:6px; object-fit:cover; cursor:pointer; }

/* ===== 优先级标签 ===== */
.priority-label {
  display:inline-block; padding:1px 8px; border-radius:30px; font-size:10px; font-weight:600;
}
.priority-critical { background:#fee; color:#d93030; }
.priority-high { background:#fef9e7; color:#e67e22; }
.priority-normal { display:none; }
.priority-delayed { background:#f5f5f5; color:#888; }

/* ===== 优先级标签点击（表单内） ===== */
.priority-tags {
  display:flex; flex-wrap:wrap; gap:6px; align-items:center;
}
.priority-tags .tag {
  padding:4px 14px; border-radius:30px; font-size:13px; font-weight:500;
  background:#f0f2f5; color:#666; cursor:pointer; transition:0.2s; border:2px solid transparent;
  user-select:none;
}
.priority-tags .tag:hover { background:#e4e7ed; }
.priority-tags .tag.active { background:#ecf5ff; color:#409eff; border-color:#409eff; }
.priority-tags .tag[data-priority="critical"] { color:#d93030; }
.priority-tags .tag[data-priority="critical"].active { background:#fee; border-color:#d93030; color:#d93030; }
.priority-tags .tag[data-priority="high"] { color:#e67e22; }
.priority-tags .tag[data-priority="high"].active { background:#fef9e7; border-color:#e67e22; color:#e67e22; }
.priority-tags .tag[data-priority="normal"] { color:#999; }
.priority-tags .tag[data-priority="normal"].active { background:#f0f0f0; border-color:#bbb; color:#666; }
.priority-tags .tag[data-priority="delayed"] { color:#888; }
.priority-tags .tag[data-priority="delayed"].active { background:#f5f5f5; border-color:#aaa; color:#666; }

/* ===== 分组标题 ===== */
.group-title {
  display:flex; justify-content:space-between; align-items:center;
  font-size:14px; font-weight:600; color:#1e466e;
  padding:8px 0 6px 0; border-bottom:2px solid #e8ecf1;
  margin-top:8px; margin-bottom:8px;
}
.group-title:first-child { margin-top:0; }
.group-title .toggle-btn {
  background:none; border:none; color:#409eff; font-size:12px;
  font-weight:500; cursor:pointer; padding:2px 8px;
  border-radius:30px; transition:0.2s;
}
.group-title .toggle-btn:hover { background:#ecf5ff; }

/* ===== Toast ===== */
.toast-container {
  position:fixed; top:80px; left:50%; transform:translateX(-50%);
  z-index:99999; background:rgba(0,0,0,0.75); color:#fff;
  padding:10px 24px; border-radius:12px;
  font-size:14px; font-weight:500; box-shadow:0 4px 20px rgba(0,0,0,0.2);
  transition:opacity 0.3s ease; opacity:1; pointer-events:none;
  font-family:system-ui,-apple-system,"Microsoft YaHei",sans-serif;
  animation:toastFadeIn 0.3s ease;
}
@keyframes toastFadeIn {
  from { opacity:0; transform:translateX(-50%) translateY(-10px); }
  to { opacity:1; transform:translateX(-50%) translateY(0); }
}

/* ===== 需求操作按钮 ===== */
.request-action-btn.selected {
  outline:2px solid #409eff !important; background:#ecf5ff !important; color:#409eff !important;
}
.request-action-btn:not(.selected) {
  background:#e4e7ed !important; color:#333 !important;
}
.request-action-btn:not(.selected):hover { background:#cdd0d6 !important; }

/* ===== 时间线 ===== */
.timeline-item { display:flex; gap:16px; padding:6px 0; border-bottom:1px solid #f0f0f0; font-size:13px; }
.timeline-item .time { color:#888; min-width:160px; flex-shrink:0; }
.timeline-item .content { flex:1; }
.timeline-item .content .action { font-weight:500; }
.timeline-item .content .remark { color:#666; margin-top:2px; }

/* ===== 账号管理 ===== */
#userListContainer table { width:100%; border-collapse:collapse; font-size:13px; }
#userListContainer th, #userListContainer td { padding:6px 10px; text-align:left; border-bottom:1px solid #eee; }
#userListContainer th { background:#f5f7fb; font-weight:600; }
#userListContainer .status-badge { padding:2px 10px; border-radius:30px; font-size:11px; }
#userListContainer .status-badge.active { background:#e8f9ed; color:#67c23a; }
#userListContainer .status-badge.disabled { background:#fef0f0; color:#f56c6c; }

/* ===== 登录日志 ===== */
.login-log-item { display:flex; gap:16px; padding:4px 0; border-bottom:1px solid #f0f0f0; font-size:12px; color:#555; }
.login-log-item .time { min-width:180px; }

/* ===== 排班表 ===== */
#scheduleTable { border-collapse:collapse; width:100%; }
#scheduleTable th, #scheduleTable td {
  border:1px solid #b0b8c4 !important; padding:4px 6px;
  text-align:center; min-width:60px; font-size:12px; background:#ffffff !important;
}
#scheduleTable th { background:#f5f7fb !important; font-weight:600; }
#scheduleTable .row-label { font-weight:600; background:#f5f7fb; min-width:60px; }
#scheduleTable .cell-today { border:1.5px solid #67c23a !important; background:#ffffff !important; }
#scheduleTable .cell-today-prev { border-right:1.5px solid #67c23a !important; }
#scheduleTable .row-current-user { background:#e8f5e9 !important; }
#scheduleTable .row-current-user td { background:#e8f5e9 !important; }
#scheduleTable .row-current-user .row-label { background:#c8e6c9 !important; font-weight:700; }
#scheduleTable .cell-clickable { cursor:pointer; }
#scheduleTable .cell-clickable:hover { opacity:0.8; }
#scheduleTable .cell-readonly { cursor:default; }
#scheduleTable td:focus, #scheduleTable td:active { outline:none !important; }

.schedule-mode-select {
  padding:2px 6px; border:1px solid #d0d7de; border-radius:12px; font-size:11px;
  background:#fafafa; cursor:pointer; outline:none;
}
.schedule-mode-select:focus { border-color:#409eff; }
.schedule-mode-select:hover { background:#f0f2f5; }

#btnQuickGenerate { background:#409eff; color:#fff; border:none; padding:4px 16px; border-radius:30px; font-weight:600; font-size:12px; cursor:pointer; }
#btnQuickGenerate:hover { background:#2d8bdf; }

/* ===== 排期表 ===== */
.tech-schedule-item {
  display:flex; align-items:center; padding:8px 12px; border-bottom:1px solid #f0f0f0;
}
.tech-schedule-item .tech-name { font-weight:600; min-width:80px; font-size:14px; }
.tech-schedule-item .tech-count { background:#409eff; color:#fff; border-radius:30px; padding:0 10px; font-size:12px; min-width:24px; text-align:center; margin-right:12px; }
.tech-schedule-item .tech-tickets { display:flex; flex-wrap:wrap; gap:4px; flex:1; }
.tech-schedule-item .tech-tickets .ticket-link {
  background:#ecf5ff; color:#409eff; padding:2px 10px; border-radius:30px;
  font-size:12px; cursor:pointer; transition:0.2s; border:1px solid transparent;
}
.tech-schedule-item .tech-tickets .ticket-link:hover {
  background:#d9ecff; border-color:#409eff;
}
.tech-empty { color:#999; padding:16px; text-align:center; }

/* ===== 角色权限管理 ===== */
.role-tab {
  padding:8px 14px; border:1px solid #d0d7de; background:#fff; color:#333;
  border-radius:10px; font-size:13px; font-weight:600; cursor:pointer; transition:0.2s;
  text-align:left;
}
.role-tab:hover { background:#f0f2f5; }
.role-tab.active { background:#409eff; color:#fff; border-color:#409eff; }

.perm-group { margin-bottom:14px; }
.perm-group-title {
  font-size:12px; font-weight:700; color:#1e466e;
  padding:4px 0; border-bottom:1px solid #eef0f3; margin-bottom:6px;
}
.perm-item {
  display:flex; align-items:center; gap:8px;
  padding:6px 10px; border-radius:8px; cursor:pointer; transition:0.15s;
}
.perm-item:hover { background:#f5f7fb; }
.perm-item.disabled { cursor:not-allowed; opacity:0.85; }
.perm-item.disabled:hover { background:transparent; }
.perm-item input[type="checkbox"] { width:16px; height:16px; accent-color:#409eff; cursor:pointer; margin:0; }
.perm-item.disabled input[type="checkbox"] { cursor:not-allowed; }
.perm-name { font-size:13px; color:#333; min-width:90px; }
.perm-code { font-size:11px; color:#999; font-family:monospace; }

/* RBAC Tab */
.rbac-tab {
  padding:8px 18px; border:none; background:transparent; color:#888;
  font-size:14px; font-weight:600; cursor:pointer; border-bottom:2px solid transparent;
  transition:0.2s;
}
.rbac-tab:hover { color:#409eff; }
.rbac-tab.active { color:#409eff; border-bottom-color:#409eff; }

/* 角色列表项（含操作按钮） */
.role-tab-wrap {
  display:flex; align-items:center; gap:2px;
  border:1px solid #d0d7de; border-radius:10px; overflow:hidden; background:#fff;
}
.role-tab-wrap.active { border-color:#409eff; }
.role-tab-wrap .role-tab { flex:1; border:none; border-radius:0; }
.role-tab-acts { display:flex; gap:2px; padding-right:6px; }
.role-tab-act {
  display:inline-flex; align-items:center; justify-content:center;
  width:22px; height:22px; border-radius:6px; font-size:12px; cursor:pointer;
  color:#888; transition:0.15s;
}
.role-tab-act.edit:hover { background:#ecf5ff; color:#409eff; }
.role-tab-act.del:hover { background:#fef0f0; color:#f56c6c; }

/* 权限项表格 */
.perm-table { width:100%; border-collapse:collapse; font-size:13px; }
.perm-table th, .perm-table td { padding:6px 10px; text-align:left; border-bottom:1px solid #eee; }
.perm-table th { background:#f5f7fb; font-weight:600; }
.perm-code-cell { font-family:monospace; color:#555; }

/* ===== 需求工单评论 ===== */
.comment-item { padding:8px 0; border-bottom:1px solid #f0f0f0; }
.comment-head { display:flex; justify-content:space-between; align-items:center; margin-bottom:4px; }
.comment-author { font-weight:600; font-size:13px; color:#1e466e; }
.comment-time { font-size:11px; color:#999; }
.comment-body { font-size:13px; color:#333; line-height:1.6; white-space:pre-wrap; word-break:break-word; }
.inline-img { max-width:200px; max-height:200px; border-radius:6px; cursor:pointer; margin:6px 0; display:block; border:1px solid #eee; }

/* ===== 响应式 ===== */
@media (max-width:768px) {
  .top-bar { flex-direction:column; align-items:stretch; gap:6px; }
  .top-left, .top-right { flex-wrap:wrap; justify-content:center; }
  .top-stats { gap:8px; font-size:12px; }
  .filters { flex-direction:column; align-items:stretch; }
  .filter-right { margin-left:0; justify-content:center; flex-wrap:wrap; }
  .ticket-row { flex-direction:column; align-items:flex-start; }
  .ticket-actions { width:100%; }
  .ticket-meta { gap:2px; font-size:11px; }
  .timeline-item { flex-direction:column; gap:2px; }
  .timeline-item .time { min-width:auto; }
  #scheduleTable th, #scheduleTable td { min-width:40px; font-size:11px; padding:2px 4px; }
  .tab-switch { width:100%; }
  .tab-switch .tab-btn { flex:1; text-align:center; }
  .filter-group { flex-direction:column; align-items:stretch; }
  .filter-group .btn-knowledge-filter,
  .filter-group .btn-schedule-new,
  .filter-group .btn-memo-new { display:inline-block; width:auto; }
}