* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: #f5f7fa; color: #333; font-size: 14px; }

/* 顶部导航 */
.topbar { background: linear-gradient(135deg, #1a73e8, #0d47a1); color: #fff; padding: 12px 20px; display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 100; box-shadow: 0 2px 8px rgba(0,0,0,0.15); }
.topbar-title { font-size: 18px; font-weight: 600; }
.topbar-user { display: flex; align-items: center; gap: 12px; }
.topbar-user a { color: #fff; text-decoration: none; font-size: 13px; opacity: 0.9; }
.topbar-user a:hover { opacity: 1; }
.topbar-user a::before { content: "\f08b"; font-family: "Font Awesome 6 Free"; font-weight: 900; margin-right: 4px; }

/* 侧边栏 */
.sidebar { width: 220px; background: #fff; height: calc(100vh - 56px); position: fixed; top: 56px; left: 0; box-shadow: 2px 0 8px rgba(0,0,0,0.05); overflow-y: auto; display: flex; flex-direction: column; }
.sidebar-menu { list-style: none; padding: 8px 0; flex: 1; }
.sidebar-menu li a { display: flex; align-items: center; gap: 10px; padding: 12px 20px; color: #555; text-decoration: none; transition: all 0.2s; border-left: 3px solid transparent; }
.sidebar-menu li a:hover { background: #f0f4ff; color: #1a73e8; }
.sidebar-menu li a.active { background: #e8f0fe; color: #1a73e8; border-left-color: #1a73e8; font-weight: 600; }

/* 侧边栏分组 */
.menu-group-header { display: flex; align-items: center; gap: 8px; padding: 10px 20px; cursor: pointer; color: #888; font-size: 13px; font-weight: 600; user-select: none; border-top: 1px solid #f0f0f0; margin-top: 4px; }
.menu-group-header:hover { background: #f5f7fa; }
.group-toggle-icon { width: 14px; text-align: center; font-size: 11px; }
.group-label { flex: 1; }
.menu-group { list-style: none; }
.menu-group li a { padding-left: 36px; font-size: 13px; }

/* 侧边栏底部打包按钮 */
.sidebar-bottom { padding: 12px 16px; border-top: 2px solid #e8f0fe; }
.build-btn { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 8px; color: #fff; text-decoration: none; font-weight: 600; font-size: 14px; background: linear-gradient(135deg, #1a73e8, #0d47a1); transition: all 0.2s; }
.build-btn:hover { background: linear-gradient(135deg, #1557b0, #08306b); color: #fff; }
.build-btn.active { background: linear-gradient(135deg, #0d47a1, #062a5e); box-shadow: 0 2px 8px rgba(26,115,232,0.3); }

/* 主内容区 */
.main-content { margin-left: 220px; padding: 20px; min-height: calc(100vh - 56px); }
.content-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.content-header h2 { font-size: 20px; color: #1a237e; }

/* 卡片 */
.card { background: #fff; border-radius: 8px; padding: 20px; box-shadow: 0 1px 4px rgba(0,0,0,0.06); margin-bottom: 16px; }
.card-title { font-size: 16px; font-weight: 600; color: #333; margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px solid #eee; }

/* 统计卡片 */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat-card { background: #fff; border-radius: 8px; padding: 20px; box-shadow: 0 1px 4px rgba(0,0,0,0.06); display: flex; align-items: center; gap: 16px; }
.stat-icon { width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 24px; }
.stat-icon-blue { background: #e8f0fe; color: #1a73e8; }
.stat-icon-green { background: #e6f4ea; color: #34a853; }
.stat-icon-orange { background: #fef7e0; color: #f9ab00; }
.stat-icon-red { background: #fce8e6; color: #ea4335; }
.stat-icon-purple { background: #f3e8fd; color: #9c27b0; }
.stat-info h3 { font-size: 24px; font-weight: 700; color: #333; }
.stat-info p { font-size: 13px; color: #888; margin-top: 2px; }

/* 表格 */
.data-table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 8px; overflow: hidden; box-shadow: 0 1px 4px rgba(0,0,0,0.06); }
.data-table th { background: #f5f7fa; padding: 12px 16px; text-align: left; font-weight: 600; color: #555; font-size: 13px; border-bottom: 2px solid #e0e0e0; }
.data-table td { padding: 12px 16px; border-bottom: 1px solid #eee; font-size: 13px; }
.data-table tr:hover { background: #f9fbff; }
.data-table tr:last-child td { border-bottom: none; }

/* 状态徽章 */
.status-badge { display: inline-block; padding: 3px 10px; border-radius: 12px; font-size: 12px; font-weight: 500; }
.status-pending { background: #fef7e0; color: #f9ab00; }
.status-assigned { background: #e8f0fe; color: #1a73e8; }
.status-processing { background: #f3e8fd; color: #9c27b0; }
.status-done { background: #e6f4ea; color: #34a853; }
.status-cancel { background: #fce8e6; color: #ea4335; }
.status-rated { background: #e0f2f1; color: #00897b; }

.priority-normal { background: #e8f0fe; color: #1a73e8; }
.priority-urgent { background: #fef7e0; color: #f9ab00; }
.priority-critical { background: #fce8e6; color: #ea4335; }

/* 按钮 */
.btn { display: inline-block; padding: 8px 18px; border-radius: 6px; font-size: 14px; cursor: pointer; border: none; text-decoration: none; transition: all 0.2s; }
.btn-primary { background: #1a73e8; color: #fff; }
.btn-primary:hover { background: #1557b0; }
.btn-success { background: #34a853; color: #fff; }
.btn-success:hover { background: #2d8e47; }
.btn-danger { background: #ea4335; color: #fff; }
.btn-danger:hover { background: #c5221f; }
.btn-warning { background: #f9ab00; color: #fff; }
.btn-warning:hover { background: #d89000; }
.btn-default { background: #f5f7fa; color: #555; border: 1px solid #ddd; }
.btn-default:hover { background: #e8eaed; }
.btn-sm { padding: 4px 10px; font-size: 12px; }

/* 表单 */
.form-group { margin-bottom: 16px; }
.form-label { display: block; margin-bottom: 6px; font-weight: 500; color: #555; font-size: 14px; }
.form-input, .form-select, .form-textarea { width: 100%; padding: 10px 12px; border: 1px solid #ddd; border-radius: 6px; font-size: 14px; transition: border-color 0.2s; }
.form-input:focus, .form-select:focus, .form-textarea:focus { border-color: #1a73e8; outline: none; box-shadow: 0 0 0 3px rgba(26,115,232,0.1); }
.form-textarea { min-height: 100px; resize: vertical; }
.form-row { display: flex; gap: 16px; }
.form-row .form-group { flex: 1; }

/* 分页 */
.pagination { display: flex; justify-content: center; gap: 6px; margin-top: 20px; }
.pagination a { padding: 6px 12px; border: 1px solid #ddd; border-radius: 4px; text-decoration: none; color: #555; font-size: 13px; }
.pagination a:hover { background: #f0f4ff; border-color: #1a73e8; color: #1a73e8; }
.pagination a.active { background: #1a73e8; color: #fff; border-color: #1a73e8; }

/* 移动端适配 */
.mobile-page { max-width: 480px; margin: 0 auto; min-height: 100vh; background: #f5f7fa; }
.mobile-header { background: linear-gradient(135deg, #1a73e8, #0d47a1); color: #fff; padding: 14px 16px; display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 100; }
.mobile-header-title { font-size: 16px; font-weight: 600; }
.mobile-header-back { color: #fff; text-decoration: none; font-size: 14px; }
.mobile-content { padding: 16px; }
.mobile-tabbar { display: flex; background: #fff; position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 480px; box-shadow: 0 -2px 8px rgba(0,0,0,0.06); z-index: 100; }
.mobile-tabbar a { flex: 1; text-align: center; padding: 8px 0; color: #888; text-decoration: none; font-size: 12px; }
.mobile-tabbar a.active { color: #1a73e8; }
.mobile-tabbar a .tab-icon { font-size: 20px; display: block; margin-bottom: 2px; }

/* 列表项 */
.list-item { background: #fff; border-radius: 8px; padding: 14px 16px; margin-bottom: 10px; box-shadow: 0 1px 3px rgba(0,0,0,0.04); }
.list-item-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.list-item-title { font-weight: 600; font-size: 15px; color: #333; }
.list-item-body { color: #666; font-size: 13px; line-height: 1.6; }
.list-item-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; padding-top: 8px; border-top: 1px solid #f0f0f0; }

/* 空状态 */
.empty-state { text-align: center; padding: 40px 20px; color: #999; }
.empty-state-icon { font-size: 48px; margin-bottom: 12px; }

/* 搜索栏 */
.search-bar { display: flex; gap: 10px; margin-bottom: 16px; }
.search-bar input { flex: 1; padding: 8px 12px; border: 1px solid #ddd; border-radius: 6px; font-size: 14px; }
.search-bar select { padding: 8px 12px; border: 1px solid #ddd; border-radius: 6px; font-size: 14px; }

/* 模态框 */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center; z-index: 200; }
.modal-box { background: #fff; border-radius: 8px; padding: 24px; max-width: 500px; width: 90%; max-height: 80vh; overflow-y: auto; }
.modal-title { font-size: 18px; font-weight: 600; margin-bottom: 16px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }


/* 登录页 */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #1a73e8, #0d47a1); }
.login-box { background: #fff; border-radius: 12px; padding: 40px; max-width: 400px; width: 90%; box-shadow: 0 8px 32px rgba(0,0,0,0.2); }
.login-title { text-align: center; font-size: 24px; font-weight: 700; color: #1a237e; margin-bottom: 30px; }
.login-tabs { display: flex; border-bottom: 2px solid #eee; margin-bottom: 24px; }
.login-tab { flex: 1; text-align: center; padding: 10px; cursor: pointer; color: #888; font-weight: 500; }
.login-tab.active { color: #1a73e8; border-bottom: 2px solid #1a73e8; }

/* 提示消息 */
.alert { padding: 12px 16px; border-radius: 6px; margin-bottom: 16px; font-size: 14px; }
.alert-success { background: #e6f4ea; color: #34a853; border: 1px solid #34a853; }
.alert-error { background: #fce8e6; color: #ea4335; border: 1px solid #ea4335; }
.alert-info { background: #e8f0fe; color: #1a73e8; border: 1px solid #1a73e8; }

/* 详情页 */
.detail-section { background: #fff; border-radius: 8px; padding: 20px; margin-bottom: 16px; box-shadow: 0 1px 4px rgba(0,0,0,0.06); }
.detail-row { display: flex; padding: 8px 0; border-bottom: 1px solid #f5f5f5; }
.detail-label { width: 120px; color: #888; font-size: 13px; }
.detail-value { flex: 1; color: #333; font-size: 14px; }
.detail-row:last-child { border-bottom: none; }

/* 移动端菜单按钮 */
.mobile-menu-btn { display: none; }

/* 响应式 */
@media (max-width: 768px) {
    /* 顶部导航 */
    .mobile-menu-btn { display: flex; align-items: center; justify-content: center; width: 36px; height: 36px; background: rgba(255,255,255,0.15); border: 1px solid rgba(255,255,255,0.25); border-radius: 6px; cursor: pointer; color: #fff; font-size: 16px; margin-right: 10px; flex-shrink: 0; }
    .topbar { padding: 10px 12px; }
    .topbar-title { font-size: 14px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .topbar-user { gap: 8px; flex-shrink: 0; }
    .topbar-user span { font-size: 12px; max-width: 60px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

    /* 侧边栏抽屉 */
    .sidebar { transform: translateX(-100%); transition: transform 0.25s ease; z-index: 200; width: 240px; }
    .sidebar.open { transform: translateX(0); }
    .sidebar-overlay { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.4); z-index: 150; }
    .sidebar-overlay.show { display: block; }

    /* 主内容区 */
    .main-content { margin-left: 0; padding: 12px; }

    /* 页面标题栏 - 允许换行 */
    .content-header { flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
    .content-header h2 { font-size: 16px; flex: 1 1 auto; min-width: 0; }
    .content-header .btn { flex-shrink: 0; }

    /* 统计卡片 */
    .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .stat-card { padding: 14px; gap: 10px; }
    .stat-icon { width: 36px; height: 36px; font-size: 18px; border-radius: 8px; flex-shrink: 0; }
    .stat-info h3 { font-size: 18px; }
    .stat-info p { font-size: 11px; }

    /* 仪表盘统计 */
    .dash-stat-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .dash-stat-card { padding: 12px; gap: 8px; }
    .dash-stat-icon { width: 32px; height: 32px; font-size: 16px; border-radius: 8px; flex-shrink: 0; }
    .dash-stat-info h3 { font-size: 16px; }
    .dash-stat-info p { font-size: 11px; }
    .dash-section { grid-template-columns: 1fr; gap: 12px; }
    .dash-refresh-bar { flex-wrap: wrap; gap: 8px; }
    .dash-refresh-info { font-size: 11px; flex: 1 1 100%; }

    /* 表格滚动 */
    .table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .data-table { min-width: 600px; }

    /* 搜索栏 */
    .search-bar form { flex-direction: column; gap: 8px; }
    .search-bar input, .search-bar select { width: 100%; }
    .search-bar select { min-width: 100%; }

    /* 详情页 */
    .detail-section { padding: 14px; }
    .detail-row { flex-direction: column; gap: 2px; padding: 6px 0; }
    .detail-label { width: auto; font-size: 12px; }
    .detail-value { font-size: 14px; }

    /* 详情页内表单堆叠（分配技术员、取消工单等） */
    .detail-section form { flex-direction: column !important; gap: 8px !important; align-items: stretch !important; }
    .detail-section form > select,
    .detail-section form > input { width: 100% !important; flex: none !important; }
    .detail-section form > button { width: 100% !important; }
    .detail-section form > .btn { width: 100% !important; }

    /* 操作按钮区堆叠 */
    .detail-section .card-title + div[style*="display:flex"] { flex-direction: column !important; gap: 8px !important; }
    .detail-section .card-title + div[style*="display:flex"] > * { width: 100%; }

    /* 表单行 */
    .form-row { flex-direction: column; gap: 0; }

    /* 分页 */
    .pagination { gap: 4px; flex-wrap: wrap; }
    .pagination a { padding: 4px 8px; font-size: 12px; }

    /* 按钮 */
    .btn { padding: 6px 14px; font-size: 13px; }
    .btn-sm { padding: 3px 8px; font-size: 11px; }

    /* 卡片 */
    .card { padding: 14px; }
    .card-title { font-size: 14px; }

    /* 模态框 */
    .modal-box { padding: 16px; width: 95%; max-height: 85vh; }
    .modal-footer { flex-direction: column; gap: 8px; }
    .modal-footer .btn { width: 100%; }

    /* subscriptions 添加订阅表单堆叠 */
    .detail-section form[style*="flex-wrap"] { flex-direction: column !important; flex-wrap: nowrap !important; gap: 8px !important; }
    .detail-section form[style*="flex-wrap"] > * { width: 100% !important; }

    /* app_build 配置区块减小内边距 */
    .card div[style*="background:#f5f7fa"] { padding: 12px !important; }

    /* code 元素换行（SHA1等长字符串） */
    .card code { word-break: break-all; }

    /* app_build 内联表格标签列不换行 */
    .card table[style*="border-collapse"] td:first-child { white-space: nowrap; }

    /* 状态徽章 */
    .status-badge { font-size: 11px; padding: 2px 8px; }

    /* 登录页 */
    .login-box { padding: 24px 20px; }
    .login-title { font-size: 20px; }

    /* 需求图片 */
    .detail-section img[style*="width:100px"] { width: 80px !important; height: 80px !important; }
}