/* ============== Base ============== */
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 13px;
  color: #303133;
  background: #f0f2f5;
  height: 100%;
}
a { text-decoration: none; color: inherit; cursor: pointer; }
button { border: none; background: none; cursor: pointer; font-family: inherit; font-size: inherit; }
input { font-family: inherit; outline: none; }
table { border-collapse: collapse; width: 100%; }

/* ============== Top Bar ============== */
.topbar {
  height: 56px;
  background: #fff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 16px;
  border-bottom: 1px solid #e8eaec;
  position: sticky; top: 0; z-index: 100;
}
.topbar-left { display: flex; align-items: center; height: 100%; flex: 1; min-width: 0; }
.brand { display: flex; align-items: center; gap: 6px; margin-right: 20px; flex-shrink: 0; }
.brand-logo {
  width: 28px; height: 28px; border-radius: 4px;
  background: linear-gradient(135deg, #2BB46A, #1FA15B);
  color: white; display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 16px;
}
.brand-name { font-size: 17px; font-weight: 700; color: #1FA15B; letter-spacing: 1px; white-space: nowrap; }
.brand-tag {
  background: #FF4D4F; color: white; font-size: 10px;
  padding: 1px 6px; border-radius: 8px; margin-left: 2px;
}

.topnav { display: flex; height: 100%; overflow-x: auto; flex: 1; min-width: 0; scrollbar-width: thin; }
.topnav::-webkit-scrollbar { height: 4px; }
.topnav::-webkit-scrollbar-thumb { background: #dcdfe6; border-radius: 2px; }
.nav-item {
  position: relative;
  padding: 0 20px;
  display: flex; align-items: center;
  font-size: 14px; color: #606266;
  height: 100%;
  cursor: pointer;
  transition: color .15s;
  white-space: nowrap;
  flex-shrink: 0;
}
.nav-item:hover { color: #1FA15B; }
.nav-item.active { color: #1FA15B; font-weight: 600; background: #f0fbf5; }
.nav-item.active::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 0;
  height: 2px; background: #1FA15B;
}
.nav-item.more { font-size: 18px; padding: 0 14px; }

.topbar-right { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.icon-btn {
  width: 32px; height: 32px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  color: #606266; font-size: 14px;
  position: relative;
}
.icon-btn:hover { background: #f5f7fa; }
.service-btn {
  background: #f0fbf5; color: #1FA15B; padding: 6px 12px;
  border-radius: 16px; font-size: 13px; font-weight: 500;
}
.badge-num {
  position: absolute; top: -2px; right: -4px;
  background: #FF4D4F; color: white;
  font-size: 10px; padding: 1px 4px; border-radius: 8px;
  min-width: 20px; text-align: center;
}
.user-area { display: flex; align-items: center; gap: 8px; }
.user-info { text-align: right; font-size: 12px; line-height: 1.4; }
.user-name { font-weight: 600; color: #303133; }
.admin-tag {
  background: #FFF7E6; color: #FAA22D; font-size: 10px;
  padding: 0 4px; border-radius: 2px; margin-left: 2px; font-weight: normal;
}
.user-points { color: #FAA22D; font-size: 11px; }

/* ============== Tab Bar ============== */
.tabbar {
  background: #fff; padding: 0 16px;
  display: flex; align-items: flex-end;
  border-bottom: 1px solid #e8eaec;
  height: 40px; overflow-x: auto;
}
.tab {
  position: relative;
  padding: 0 16px;
  height: 32px;
  line-height: 32px;
  font-size: 13px;
  color: #606266;
  border-radius: 4px 4px 0 0;
  margin-right: 4px;
  cursor: pointer;
  white-space: nowrap;
}
.tab:hover { color: #1FA15B; }
.tab.active {
  background: #f0fbf5; color: #1FA15B; font-weight: 600;
  border: 1px solid #e8eaec; border-bottom: 1px solid #f0fbf5;
}
.tab .close {
  margin-left: 8px; color: #909399;
  opacity: 0; transition: opacity .15s;
}
.tab.active .close, .tab:hover .close { opacity: 1; }
.tab .close:hover { color: #303133; }

/* ============== Page Layout ============== */
#app {
  min-height: calc(100vh - 96px);
  padding: 12px;
}
.page {
  background: #fff;
  border-radius: 4px;
  min-height: calc(100vh - 120px);
  display: flex;
}
.page-sidebar {
  width: 180px;
  border-right: 1px solid #e8eaec;
  padding: 16px 0;
  flex-shrink: 0;
}
.page-sidebar .sb-group {
  padding: 0 12px;
}
.page-sidebar .sb-title {
  font-size: 13px; font-weight: 600; color: #303133;
  padding: 10px 12px;
  display: flex; justify-content: space-between; align-items: center;
}
.page-sidebar .sb-title .ico { color: #909399; }
.page-sidebar .sb-item {
  padding: 8px 12px 8px 36px;
  font-size: 13px; color: #606266;
  border-radius: 4px;
  cursor: pointer;
  margin-bottom: 2px;
}
.page-sidebar .sb-item:hover { background: #f5f7fa; }
.page-sidebar .sb-item.active {
  background: #f0fbf5; color: #1FA15B; font-weight: 500;
}
.page-content {
  flex: 1; padding: 16px;
  min-width: 0;
}

/* ============== Common Components ============== */
.toolbar {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0;
  flex-wrap: wrap;
}
.toolbar .spacer { flex: 1; }
.input-search {
  display: flex; align-items: center;
  border: 1px solid #dcdfe6; border-radius: 4px;
  height: 32px; overflow: hidden;
  background: #fff;
}
.input-search input {
  border: none; padding: 0 8px; flex: 1; min-width: 220px;
  background: transparent;
}
.input-search button {
  width: 36px; height: 32px;
  background: #f5f7fa; color: #606266;
  border-left: 1px solid #dcdfe6;
}
.input-search button:hover { background: #ecf5ff; color: #1FA15B; }

.btn {
  height: 32px; padding: 0 14px; border-radius: 4px;
  font-size: 13px; display: inline-flex; align-items: center; gap: 4px;
  border: 1px solid transparent;
  cursor: pointer; transition: all .15s;
}
.btn-primary { background: #1FA15B; color: white; }
.btn-primary:hover { background: #1A8A4D; }
.btn-default { background: #fff; color: #606266; border-color: #dcdfe6; }
.btn-default:hover { color: #1FA15B; border-color: #1FA15B; background: #f0fbf5; }
.btn-text { color: #1FA15B; padding: 0 4px; height: auto; }
.btn-text:hover { color: #1A8A4D; }
.btn-danger { color: #F56C6C; }
.btn-danger:hover { color: #C45656; }

.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; }
.btn-group .btn:first-child { border-radius: 4px 0 0 4px; }
.btn-group .btn:last-child { border-radius: 0 4px 4px 0; }

select.btn, .select-box {
  height: 32px; padding: 0 28px 0 10px;
  border: 1px solid #dcdfe6; border-radius: 4px;
  background: #fff url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='%23909399' d='M4 6l4 4 4-4z'/%3E%3C/svg%3E") no-repeat right 8px center;
  background-size: 14px;
  font-size: 13px;
  color: #606266;
  min-width: 120px;
}

.tag {
  display: inline-flex; align-items: center;
  padding: 1px 6px;
  border-radius: 2px;
  font-size: 11px;
  margin-right: 4px;
}
.tag-blue { background: #ECF5FF; color: #409EFF; }
.tag-green { background: #F0F9EB; color: #1FA15B; }
.tag-yellow { background: #FDF6EC; color: #E6A23C; }
.tag-red { background: #FEF0F0; color: #F56C6C; }
.tag-gray { background: #F4F4F5; color: #909399; }
.tag-orange { background: #FFF1E6; color: #FF7D00; }

.badge-corner {
  position: absolute; top: 0; right: 0;
  background: #1FA15B; color: white;
  font-size: 10px; padding: 1px 4px;
  border-radius: 0 2px 0 8px;
}

/* Table */
.tbl-wrap { overflow-x: auto; border: 1px solid #e8eaec; border-radius: 4px; }
.tbl { font-size: 13px; }
.tbl thead th {
  background: #f5f7fa;
  color: #606266;
  font-weight: 500;
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid #e8eaec;
  white-space: nowrap;
}
.tbl tbody td {
  padding: 12px;
  border-bottom: 1px solid #f0f2f5;
  color: #303133;
}
.tbl tbody tr:hover { background: #fafcff; }
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl .cell-name { font-weight: 500; }
.tbl .cell-id { color: #909399; font-size: 12px; margin-top: 2px; font-family: monospace; }
.cell-flex { display: flex; align-items: center; gap: 6px; position: relative; }
.copy-btn { color: #c0c4cc; cursor: pointer; font-size: 12px; }
.copy-btn:hover { color: #1FA15B; }

/* Pagination */
.pagination {
  display: flex; align-items: center; justify-content: flex-end;
  gap: 6px; padding: 16px 12px; font-size: 13px; color: #606266;
}
.pagination .pg {
  min-width: 28px; height: 28px; padding: 0 6px;
  display: inline-flex; align-items: center; justify-content: center;
  background: #f5f7fa; border-radius: 2px; cursor: pointer;
}
.pagination .pg:hover { color: #1FA15B; }
.pagination .pg.active { background: #fff; color: #1FA15B; border: 1px solid #1FA15B; }
.pagination .pg-info { margin-right: 8px; }

/* Dashboard Cards */
.section-title {
  font-size: 14px; font-weight: 600; color: #303133;
  border-left: 3px solid #1FA15B; padding-left: 8px;
  margin: 8px 0;
  display: flex; justify-content: space-between; align-items: center;
}
.section-title .extra { font-size: 12px; color: #909399; font-weight: normal; cursor: pointer; }
.section-title .extra:hover { color: #1FA15B; }

.progress-cards {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px;
  margin: 12px 0;
}
.progress-card {
  background: #fff;
  border: 1px solid #e8eaec;
  border-radius: 4px;
  padding: 16px;
  display: flex; align-items: center; gap: 16px;
}
.progress-card .ring {
  width: 80px; height: 80px; flex-shrink: 0; position: relative;
}
.progress-card .ring-center {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}
.progress-card .ring-num { font-size: 18px; font-weight: 700; color: #303133; }
.progress-card .ring-label { font-size: 11px; color: #909399; }
.progress-card .pc-info { flex: 1; }
.progress-card .pc-title {
  font-size: 13px; color: #606266; margin-bottom: 8px;
  display: flex; align-items: center; gap: 6px;
}
.progress-card .pc-title .ai-tag {
  background: #f0e7ff; color: #7C4DFF;
  font-size: 10px; padding: 1px 4px; border-radius: 2px;
}
.progress-card .pc-percent { color: #1FA15B; font-weight: 600; }
.progress-card .pc-row {
  display: flex; justify-content: space-between;
  font-size: 12px; margin: 4px 0;
}
.progress-card .pc-row .dot {
  display: inline-block; width: 6px; height: 6px; border-radius: 50%;
  margin-right: 4px;
}
.progress-card .pc-row .label { color: #606266; }
.progress-card .pc-row .pct { color: #303133; font-weight: 500; min-width: 50px; text-align: right; }
.progress-card .pc-row .val { color: #303133; min-width: 50px; text-align: right; }
.pc-row.unstarted .dot { background: #c0c4cc; }
.pc-row.unstarted .pct { color: #c0c4cc; }
.pc-row.inprogress .dot { background: #E6A23C; }
.pc-row.inprogress .pct { color: #E6A23C; }
.pc-row.done .dot { background: #1FA15B; }
.pc-row.done .pct { color: #1FA15B; }
.pc-row.failed .dot { background: #F56C6C; }
.pc-row.failed .pct { color: #F56C6C; }

.alert-banner {
  background: #FFF7E6; border: 1px solid #FFE4A8;
  padding: 8px 12px; border-radius: 4px;
  font-size: 12px; color: #E6A23C;
  display: flex; align-items: center; gap: 6px;
  margin: 8px 0;
}
.alert-banner .close { margin-left: auto; cursor: pointer; color: #909399; }
.alert-banner a { color: #1FA15B; font-weight: 500; }

.stat-tabs {
  display: flex; gap: 4px;
  border-bottom: 1px solid #e8eaec;
  margin-bottom: 12px;
}
.stat-tab {
  padding: 10px 16px;
  font-size: 14px; color: #606266;
  cursor: pointer; position: relative;
}
.stat-tab.active { color: #1FA15B; font-weight: 600; }
.stat-tab.active::after {
  content: ''; position: absolute; bottom: -1px; left: 0; right: 0;
  height: 2px; background: #1FA15B;
}
.stat-tab .num { color: #1FA15B; margin-left: 4px; }

/* Filter dropdowns */
.filter-row {
  display: flex; gap: 8px; align-items: center;
  background: #FFF7E6; padding: 10px 12px; border-radius: 4px;
  margin: 8px 0;
}
.filter-row .label { color: #E6A23C; font-weight: 500; font-size: 13px; }

/* Header stats */
.head-stats {
  display: flex; align-items: center; gap: 24px;
  padding: 16px;
  background: #fff;
  border-radius: 4px;
  margin-bottom: 12px;
}
.head-stat {
  display: flex; align-items: center; gap: 12px;
}
.head-stat .icon-box {
  width: 44px; height: 44px; border-radius: 4px;
  background: #f0fbf5; color: #1FA15B;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 20px;
}
.head-stat .label { font-size: 12px; color: #606266; }
.head-stat .value { font-size: 18px; font-weight: 700; color: #303133; }
.head-stat .value .unit { font-size: 12px; font-weight: normal; color: #606266; margin-left: 2px; }

.head-ring {
  display: flex; align-items: center; gap: 12px;
  padding: 0 24px;
  border-left: 1px solid #e8eaec;
}
.head-ring:first-of-type { border-left: none; }
.mini-ring { width: 52px; height: 52px; position: relative; }
.mini-ring .mc {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  font-size: 11px; color: #606266;
}
.head-ring-info { font-size: 12px; }
.head-ring-info .t { color: #606266; margin-bottom: 4px; }
.head-ring-info .n { font-size: 18px; font-weight: 700; color: #303133; }
.head-ring-info .li { display: flex; gap: 4px; align-items: center; font-size: 11px; line-height: 1.6; }
.head-ring-info .li .dot { width: 5px; height: 5px; border-radius: 50%; }
.head-ring-info .li .v { color: #606266; }

/* Quick float */
.quick-float {
  position: fixed; right: 8px; top: 50%;
  transform: translateY(-50%);
  z-index: 50;
}
.quick-btn {
  width: 36px; padding: 6px 0;
  background: #FFF7E6; color: #E6A23C;
  text-align: center;
  font-size: 11px; line-height: 1.2;
  border-radius: 4px 0 0 4px;
  cursor: pointer;
  box-shadow: -2px 0 6px rgba(0,0,0,0.05);
}

/* Tax type badges */
.tax-badge {
  display: inline-block;
  width: 20px; height: 20px; border-radius: 4px;
  background: #ECF5FF; color: #409EFF;
  font-size: 11px; line-height: 20px; text-align: center;
  margin-right: 6px;
  font-weight: 500;
}
.tax-badge.small { background: #FEF2D8; color: #E6A23C; }
.tax-badge.general { background: #FFE4D1; color: #FF7D00; }
.tax-badge.dot {
  position: absolute; top: -4px; right: -4px;
  background: #1FA15B; color: white;
  font-size: 9px; padding: 0 4px; border-radius: 2px;
  width: auto; height: auto;
}

.status-pill {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px;
}
.status-pill::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%;
  background: currentColor;
}
.pill-success { color: #1FA15B; }
.pill-warning { color: #E6A23C; }
.pill-danger { color: #F56C6C; }
.pill-info { color: #909399; }

/* Sidebar tree */
.dept-tree {
  font-size: 13px; padding: 0 12px;
}
.dept-tree .node {
  padding: 6px 8px; cursor: pointer;
  border-radius: 4px;
  display: flex; align-items: center; gap: 4px;
}
.dept-tree .node:hover { background: #f5f7fa; }
.dept-tree .node.active { background: #f0fbf5; color: #1FA15B; }
.dept-tree .node .icon { color: #909399; width: 14px; text-align: center; }
.dept-tree .children { padding-left: 16px; }

/* Switch */
.switch {
  width: 36px; height: 18px;
  background: #1FA15B; border-radius: 9px;
  position: relative; cursor: pointer;
  display: inline-flex; align-items: center; padding: 0 4px;
  color: white; font-size: 10px;
}
.switch::after {
  content: ''; position: absolute; right: 2px; top: 2px;
  width: 14px; height: 14px; border-radius: 50%; background: white;
}
.switch.off { background: #c0c4cc; justify-content: flex-end; }
.switch.off::after { left: 2px; right: auto; }
.switch span { line-height: 18px; }
.switch.on span { padding-right: 18px; }
.switch.off span { padding-left: 18px; }

/* Top 3 ranking */
.rank-list { padding: 0 4px; }
.rank-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 8px;
  border-bottom: 1px dashed #f0f2f5;
}
.rank-item:last-child { border-bottom: none; }
.rank-medal {
  width: 24px; height: 24px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 14px;
}
.rank-name { flex: 1; font-size: 13px; }
.rank-pct { color: #1FA15B; font-weight: 600; font-size: 13px; }

.card {
  background: #fff; border: 1px solid #e8eaec; border-radius: 4px;
  padding: 16px;
}
.card-title {
  font-size: 13px; font-weight: 600; color: #303133;
  margin-bottom: 12px; display: flex; justify-content: space-between; align-items: center;
}
.card-title .border-l {
  border-left: 3px solid #1FA15B; padding-left: 8px;
}

/* Calendar */
.cal-grid {
  display: grid; grid-template-columns: 60px repeat(3, 1fr);
  gap: 4px; text-align: center; padding: 4px 0;
}
.cal-month { color: #1FA15B; font-weight: 600; }
.cal-month .big { font-size: 22px; display: block; line-height: 1; }
.cal-month .small { font-size: 12px; color: #909399; font-weight: normal; }
.cal-day { padding: 6px; font-size: 13px; color: #606266; border-radius: 4px; cursor: pointer; }
.cal-day:hover { background: #f5f7fa; }
.cal-day.today { background: #1FA15B; color: white; }
.cal-day.weekend { color: #c0c4cc; }
.cal-year { color: #909399; font-size: 12px; align-self: center; }

/* Checkbox */
.cb {
  width: 14px; height: 14px;
  border: 1px solid #dcdfe6; border-radius: 2px;
  display: inline-block; cursor: pointer;
  vertical-align: middle; position: relative;
}
.cb.checked { background: #1FA15B; border-color: #1FA15B; }
.cb.checked::after {
  content: ''; position: absolute; top: 1px; left: 4px;
  width: 4px; height: 8px; border: solid white;
  border-width: 0 1.5px 1.5px 0; transform: rotate(45deg);
}

/* tooltip strip */
.tip-strip {
  position: absolute; top: 0; right: 0;
  background: #1FA15B; color: white;
  padding: 1px 6px; font-size: 10px;
  border-radius: 0 0 0 4px;
}

/* legend */
.legend {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; color: #606266; margin-left: 16px;
}
.legend .dot { width: 8px; height: 8px; border-radius: 50%; }

.empty-row td { text-align: center; padding: 40px; color: #909399; }
