/* QMS Bug Tracker v3.0.0 - Styles */
:root {
  --primary: #0B5CFF;
  --primary-hover: #094de0;
  --secondary: #00C6FF;
  --dark: #08213F;
  --bg: #F7FAFF;
  --text: #10233F;
  --text-light: #6b7280;
  --border: #e5e7eb;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --radius: 8px;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans SC", sans-serif;
  background: var(--bg); color: var(--text); line-height: 1.6;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Layout */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 220px; background: var(--dark); color: #fff;
  display: flex; flex-direction: column; position: fixed; top: 0; left: 0; bottom: 0; z-index: 50;
}
.sidebar-header { padding: 20px 16px; border-bottom: 1px solid rgba(255,255,255,.1); }
.sidebar-header h1 { font-size: 16px; font-weight: 700; }
.sidebar-header .sub { font-size: 11px; color: rgba(255,255,255,.4); margin-top: 2px; }
.sidebar-nav { flex: 1; padding: 8px; }
.sidebar-nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 6px; color: rgba(255,255,255,.65);
  font-size: 14px; margin-bottom: 2px; transition: all .15s;
}
.sidebar-nav a:hover, .sidebar-nav a.active { background: rgba(255,255,255,.1); color: #fff; text-decoration: none; }
.sidebar-nav a.active { background: var(--primary); }
.sidebar-nav .icon { width: 18px; height: 18px; flex-shrink: 0; }
.sidebar-footer { padding: 12px 16px; border-top: 1px solid rgba(255,255,255,.1); font-size: 12px; color: rgba(255,255,255,.3); }
.sidebar-user { padding: 12px 16px; border-top: 1px solid rgba(255,255,255,.1); font-size: 13px; color: rgba(255,255,255,.7); }
.sidebar-user .name { font-weight: 600; }
.sidebar-user .role { font-size: 11px; color: rgba(255,255,255,.35); margin-top: 1px; }

.main { margin-left: 220px; flex: 1; padding: 24px 32px; max-width: 1200px; }

/* Page header */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.page-header h2 { font-size: 22px; font-weight: 700; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: var(--radius); font-size: 14px; font-weight: 500;
  border: none; cursor: pointer; transition: all .15s; white-space: nowrap;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: #fff; color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: #f9fafb; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { opacity: .9; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { opacity: .9; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-ghost { background: transparent; color: var(--text-light); border: none; }
.btn-ghost:hover { background: rgba(0,0,0,.05); }
.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }

/* Cards */
.card {
  background: #fff; border-radius: 10px; border: 1px solid var(--border); padding: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
}

/* Filters */
.filter-bar {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
  padding: 14px 16px; background: #fff; border-radius: var(--radius); border: 1px solid var(--border); margin-bottom: 16px;
}
.filter-bar select, .filter-bar input {
  padding: 7px 12px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 13px; background: #fff;
}
.filter-bar input { min-width: 180px; }
.filter-bar select:focus, .filter-bar input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 2px rgba(11,92,255,.15); }
.filter-bar .stat { font-size: 13px; color: var(--text-light); margin-left: auto; }
/* Dropdown multi-select */
.drop-wrap { position: relative; display: inline-block; align-self: flex-start; }
.drop-btn { padding: 7px 28px 7px 12px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 13px; background: #fff; cursor: pointer; white-space: nowrap; }
.drop-btn:hover { border-color: var(--primary); }
.drop-btn::after { content: ''; position: absolute; right: 10px; top: 50%; margin-top: -2px; border-left: 4px solid transparent; border-right: 4px solid transparent; border-top: 5px solid var(--text-light); }
.drop-panel { display: none; position: absolute; top: 100%; left: 0; width: max-content; min-width: 140px; max-width: 260px; z-index: 99; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 4px 16px rgba(0,0,0,.1); padding: 4px 0; margin-top: 3px; }
.drop-wrap.open .drop-panel { display: block; }
.drop-panel .opt { display: block; padding: 5px 12px; font-size: 13px; cursor: pointer; white-space: nowrap; }
.drop-panel .opt:hover { background: var(--bg); }
.drop-panel .opt input { margin: 0 3px 0 0; width: 13px; height: 13px; vertical-align: text-bottom; }

/* Table */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { font-weight: 600; color: var(--text-light); font-size: 11px; }
tr:hover td { background: #f9fafb; }
td .title { font-weight: 600; color: var(--primary); cursor: pointer; white-space: nowrap; }
td .title:hover { text-decoration: underline; }

/* Badge */
.badge {
  display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 12px; font-weight: 500;
}
.badge-p1 { background: #fee2e2; color: #dc2626; }
.badge-p2 { background: #fef3c7; color: #d97706; }
.badge-p3 { background: #dbeafe; color: #2563eb; }
.badge-new { background: #dbeafe; color: #2563eb; }
.badge-processing { background: #fef3c7; color: #d97706; }
.badge-resolved { background: #d1fae5; color: #059669; }
.badge-closed { background: #e5e7eb; color: #6b7280; }
.badge-suspended { background: #f3e8ff; color: #7c3aed; }
.badge-type { background: #f3f4f6; color: var(--text-light); }

/* Status select inline */
.status-select { padding: 3px 8px; border-radius: 20px; border: none; font-size: 12px; font-weight: 500; cursor: pointer; }

/* Form */
.form { max-width: 720px; }
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.form-group label .optional { font-weight: 400; color: var(--text-light); font-size: 12px; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius);
  font-size: 14px; font-family: inherit; transition: border-color .15s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 2px rgba(11,92,255,.15);
}
.form-group textarea { min-height: 100px; resize: vertical; }
.form-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.form-actions { display: flex; gap: 10px; margin-top: 24px; }

/* Detail page */
.detail-header { margin-bottom: 24px; }
.detail-header h2 { font-size: 24px; margin-bottom: 8px; }
.detail-meta { display: flex; flex-wrap: wrap; gap: 12px; font-size: 13px; color: var(--text-light); }
.detail-meta span { display: flex; align-items: center; gap: 4px; }
.detail-section { margin-bottom: 24px; }
.detail-section h3 { font-size: 14px; font-weight: 600; color: var(--text-light); margin-bottom: 8px; }
.detail-desc { background: #f9fafb; padding: 14px 16px; border-radius: var(--radius); white-space: pre-wrap; line-height: 1.7; }

/* Timeline */
.timeline { position: relative; padding-left: 28px; }
.timeline::before { content: ''; position: absolute; left: 8px; top: 4px; bottom: 0; width: 2px; background: var(--border); }
.timeline-item { position: relative; margin-bottom: 16px; }
.timeline-item::before { content: ''; position: absolute; left: -24px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--primary); border: 2px solid #fff; box-shadow: 0 0 0 2px var(--primary); }
.timeline-item .time { font-size: 12px; color: var(--text-light); }
.timeline-item .content { margin-top: 4px; font-size: 14px; white-space: pre-wrap; }

/* Charts */
.charts-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.chart-card { background: #fff; border-radius: 10px; border: 1px solid var(--border); padding: 20px; }
.chart-card h3 { font-size: 15px; font-weight: 600; margin-bottom: 12px; }
.chart-card.full { grid-column: 1 / -1; }
.chart-card .chart-wrap { position: relative; height: 280px; }
.chart-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 20px; }
.stat-item { background: #fff; border-radius: 10px; border: 1px solid var(--border); padding: 16px; text-align: center; }
.stat-item .num { font-size: 28px; font-weight: 700; color: var(--dark); }
.stat-item .label { font-size: 13px; color: var(--text-light); margin-top: 2px; }

/* Settings */
.settings-section { margin-bottom: 32px; }
.settings-section h3 { font-size: 16px; font-weight: 700; margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.config-list { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.config-tag {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 12px; background: #f3f4f6; border-radius: 20px; font-size: 13px;
}
.config-tag .del { cursor: pointer; color: var(--text-light); font-size: 16px; line-height: 1; }
.config-tag .del:hover { color: var(--danger); }
.config-add { display: flex; gap: 8px; align-items: center; }
.config-add input { padding: 6px 12px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 13px; }

/* Empty state */
.empty { text-align: center; padding: 60px 20px; color: var(--text-light); }
.empty .icon { font-size: 48px; margin-bottom: 12px; opacity: .3; }
.empty p { font-size: 15px; }

/* Toast */
.toast {
  position: fixed; top: 20px; right: 20px; z-index: 9999;
  padding: 12px 20px; border-radius: var(--radius); font-size: 14px; font-weight: 500;
  box-shadow: 0 4px 12px rgba(0,0,0,.15); transform: translateX(120%); transition: transform .3s;
}
.toast.show { transform: translateX(0); }
.toast-success { background: var(--success); color: #fff; }
.toast-error { background: var(--danger); color: #fff; }

/* Responsive */
@media (max-width: 768px) {
  .sidebar { width: 56px; }
  .sidebar .hide-mobile { display: none; }
  .sidebar-header h1 { font-size: 0; }
  .sidebar-header .sub { display: none; }
  .sidebar-nav a { justify-content: center; padding: 12px; }
  .sidebar-user { text-align: center; padding: 8px 4px; }
  .sidebar-user .name { font-size: 11px; }
  .sidebar-user .role { font-size: 10px; }
  .main { margin-left: 56px; padding: 16px; }
  .form-row { grid-template-columns: 1fr; }
  .charts-grid { grid-template-columns: 1fr; }
  .chart-stats { grid-template-columns: repeat(2, 1fr); }
  .filter-bar .stat { width: 100%; margin-left: 0; }
}

/* Modal */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal-box { background: #fff; border-radius: 12px; padding: 24px; width: 100%; max-width: 500px; max-height: 80vh; overflow-y: auto; }
.modal-box h3 { font-size: 18px; font-weight: 700; margin-bottom: 16px; }

/* List table column sizing */
.list-table { table-layout: fixed; }
.list-table th:nth-child(1) { width: 110px; }  /* 单据号 */
.list-table th:nth-child(2) { width: 80px; }   /* 发现日期 */
.list-table th:nth-child(3) { width: 50px; }   /* 阶段 */
.list-table th:nth-child(4) { width: 55px; }   /* 部门 */
.list-table th:nth-child(5) { width: 55px; }   /* 提出人 */
.list-table th:nth-child(6) { width: 80px; }   /* 系统模块 */
.list-table td:nth-child(6) { max-width: 80px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-table th:nth-child(7) { width: 55px; }   /* 类型 */
.list-table th:nth-child(8) { max-width: 120px; width: 120px; }  /* 问题描述 */
.list-table th:nth-child(9) { width: 55px; }   /* 严重程度 */
.list-table th:nth-child(10) { width: 65px; }  /* 状态 */
.list-table th:nth-child(11) { width: 60px; }  /* 责任部门 */
.list-table th:nth-child(12) { width: 55px; }  /* 责任人 */
.list-table th:nth-child(13) { width: 80px; }  /* 计划完成 */
.list-table th:nth-child(14) { width: 80px; }  /* 实际完成 */
.list-table th:nth-child(15) { width: 55px; }  /* 计划到期 */
.list-table th:nth-child(16) { width: 55px; }  /* 处理超时 */
.list-table th:nth-child(17) { width: 28px; }  /* 图 */
.list-table th:nth-child(18) { width: 28px; }  /* 删除 */

/* Status indicators */
.st-normal { color: var(--success); font-weight: 500; font-size: 12px; }
.st-warning { color: var(--warning); font-weight: 500; font-size: 12px; }
.st-overdue { color: var(--danger); font-weight: 600; font-size: 12px; }
.st-none { color: var(--text-light); font-size: 12px; }

/* Inline edit for list */
.inline-status { padding: 2px 8px; border-radius: 20px; border: 1px solid transparent; font-size: 12px; font-weight: 500; cursor: pointer; background: #f3f4f6; }
.inline-status:focus { outline: none; border-color: var(--primary); }

/* Image grid */
.image-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.image-item { position: relative; border-radius: 6px; overflow: hidden; border: 1px solid var(--border); background: #f9fafb; cursor: pointer; }
.image-item img { width: 100%; height: 100px; object-fit: cover; display: block; }
.image-item .image-name { font-size: 11px; color: var(--text-light); padding: 4px 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: #fff; }
.image-del { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%; background: rgba(0,0,0,.5); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 14px; cursor: pointer; line-height: 1; }
.image-del:hover { background: var(--danger); }

/* Gallery (detail page) */
#detail-images .image-grid { margin-top: 8px; }
#detail-images .gallery-img { cursor: zoom-in; }
#detail-images .gallery-img:hover { border-color: var(--primary); }
