/* =====================================================
   SINOVATION ERP 系统统一样式
   主题配色：蓝色(#409EFF) | 橙色(#E6A23C) | 绿色(#67C23A)
   ===================================================== */

:root {
    /* 蓝色主题 - 产品数据库 */
    --blue-primary: #1E3A5F;
    --blue-light: #409EFF;
    --blue-bg: #f0f7ff;
    --blue-gradient: linear-gradient(135deg, #1E3A5F 0%, #409EFF 100%);
    
    /* 橙色主题 - CRM客户管理 */
    --orange-primary: #E6A23C;
    --orange-light: #F56C6C;
    --orange-bg: #fff8f0;
    --orange-gradient: linear-gradient(135deg, #E6A23C 0%, #F56C6C 100%);
    
    /* 绿色主题 - 合同执行 */
    --green-primary: #67C23A;
    --green-light: #85CE61;
    --green-bg: #f0fff0;
    --green-gradient: linear-gradient(135deg, #67C23A 0%, #85CE61 100%);
    
    /* 通用颜色 */
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    
    --success: #67C23A;
    --warning: #E6A23C;
    --danger: #F56C6C;
    --info: #409EFF;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    background: var(--gray-50);
    color: var(--gray-800);
    font-size: 14px;
    line-height: 1.5;
}

/* =====================================================
   统一顶部导航栏
   ===================================================== */
.erp-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: linear-gradient(135deg, #1E3A5F 0%, #2d4a6f 100%);
    display: flex;
    align-items: center;
    padding: 0 24px;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.erp-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    color: white;
    font-weight: 700;
    font-size: 18px;
}

.erp-logo svg {
    width: 36px;
    height: 36px;
}

#sysVersionBadge {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 2px 0;
}

.erp-modules {
    display: flex;
    gap: 4px;
    margin-left: 60px;
    background: rgba(255,255,255,0.1);
    padding: 4px;
    border-radius: 8px;
}

.erp-module-btn {
    padding: 10px 24px;
    border: none;
    background: transparent;
    color: rgba(255,255,255,0.7);
    font-size: 14px;
    font-weight: 500;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.erp-module-btn:hover {
    color: white;
    background: rgba(255,255,255,0.1);
}

.erp-module-btn.active {
    color: white;
    font-weight: 600;
}

.erp-module-btn.active[data-module="products"] {
    background: var(--blue-light);
}

.erp-module-btn.active[data-module="crm"] {
    background: var(--orange-primary);
}

.erp-module-btn.active[data-module="contract"] {
    background: var(--green-primary);
}

.erp-header-right {
    position: relative;
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 16px;
}

.erp-search {
    display: flex;
    align-items: center;
    background: rgba(255,255,255,0.1);
    border-radius: 20px;
    padding: 8px 16px;
    gap: 8px;
}

.erp-search input {
    background: transparent;
    border: none;
    color: white;
    outline: none;
    width: 200px;
}

.erp-search input::placeholder {
    color: rgba(255,255,255,0.6);
}

.erp-user {
    display: flex;
    align-items: center;
    gap: 8px;
    color: white;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 6px;
}

.erp-user:hover {
    background: rgba(255,255,255,0.1);
}

.erp-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--orange-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
}

.erp-user .dropdown-arrow {
    font-size: 10px;
    margin-left: 2px;
    transition: transform 0.2s;
}

.erp-user.open .dropdown-arrow {
    transform: rotate(180deg);
}

/* 用户下拉菜单 */
.user-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    min-width: 200px;
    z-index: 1000;
    display: none;
    overflow: hidden;
}

.erp-user.open .user-dropdown {
    display: block;
    animation: dropdownFadeIn 0.2s ease;
}

@keyframes dropdownFadeIn {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.dropdown-user-info {
    padding: 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.dropdown-user-name {
    font-weight: 600;
    font-size: 15px;
    margin-bottom: 4px;
}

.dropdown-user-role {
    font-size: 12px;
    opacity: 0.85;
}

.dropdown-divider {
    height: 1px;
    background: #e4e7ed;
    margin: 0;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    color: #303133;
    text-decoration: none;
    font-size: 14px;
    transition: background 0.15s;
}

.dropdown-item:hover {
    background: #f5f7fa;
}

.dropdown-item.logout-item {
    color: #f56c6c;
}

.dropdown-item.logout-item:hover {
    background: #fef0f0;
}

/* =====================================================
   侧边栏
   ===================================================== */
.erp-sidebar {
    position: fixed;
    top: 64px;
    left: 0;
    width: 240px;
    height: calc(100vh - 64px);
    background: white;
    border-right: 1px solid var(--gray-200);
    overflow-y: auto;
    padding: 16px 0;
}

.erp-sidebar-menu {
    list-style: none;
}

.erp-sidebar-item {
    padding: 12px 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--gray-600);
    cursor: pointer;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.erp-sidebar-item:hover {
    background: var(--gray-50);
    color: var(--gray-800);
}

.erp-sidebar-item.active {
    background: var(--gray-100);
    color: var(--gray-900);
    font-weight: 500;
}

.erp-sidebar-item.active[data-theme="blue"] {
    border-left-color: var(--blue-light);
    background: var(--blue-bg);
}

.erp-sidebar-item.active[data-theme="orange"] {
    border-left-color: var(--orange-primary);
    background: var(--orange-bg);
}

.erp-sidebar-item.active[data-theme="green"] {
    border-left-color: var(--green-primary);
    background: var(--green-bg);
}

.erp-sidebar-divider {
    height: 1px;
    background: var(--gray-200);
    margin: 12px 24px;
}

/* =====================================================
   主内容区
   ===================================================== */
.erp-main {
    margin-left: 240px;
    margin-top: 64px;
    padding: 24px;
    min-height: calc(100vh - 64px);
}

/* =====================================================
   模块卡片
   ===================================================== */
.module-card {
    background: white;
    border-radius: 12px;
    padding: 32px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    transition: all 0.3s;
}

.module-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}

.module-card-icon {
    width: 64px;
    height: 64px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    margin-bottom: 20px;
}

.module-card[data-theme="blue"] .module-card-icon {
    background: var(--blue-bg);
    color: var(--blue-light);
}

.module-card[data-theme="orange"] .module-card-icon {
    background: var(--orange-bg);
    color: var(--orange-primary);
}

.module-card[data-theme="green"] .module-card-icon {
    background: var(--green-bg);
    color: var(--green-primary);
}

.module-card-title {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 8px;
}

.module-card[data-theme="blue"] .module-card-title {
    color: var(--blue-primary);
}

.module-card[data-theme="orange"] .module-card-title {
    color: var(--orange-light);
}

.module-card[data-theme="green"] .module-card-title {
    color: var(--green-primary);
}

.module-card-desc {
    color: var(--gray-500);
    margin-bottom: 16px;
}

.module-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}

.module-card-tag {
    padding: 4px 12px;
    background: var(--gray-100);
    border-radius: 16px;
    font-size: 12px;
    color: var(--gray-600);
}

.module-card-stats {
    display: flex;
    gap: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--gray-200);
    color: var(--gray-500);
    font-size: 13px;
}

/* =====================================================
   仪表盘卡片
   ===================================================== */
.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.stat-card-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    margin-bottom: 16px;
}

.stat-card[data-theme="blue"] .stat-card-icon {
    background: var(--blue-bg);
    color: var(--blue-light);
}

.stat-card[data-theme="orange"] .stat-card-icon {
    background: var(--orange-bg);
    color: var(--orange-primary);
}

.stat-card[data-theme="green"] .stat-card-icon {
    background: var(--green-bg);
    color: var(--green-primary);
}

.stat-card-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 4px;
}

.stat-card-label {
    color: var(--gray-500);
    font-size: 13px;
}

/* =====================================================
   表格
   ===================================================== */
.data-table {
    width: 100%;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.data-table table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    background: var(--gray-50);
    padding: 14px 16px;
    text-align: left;
    font-weight: 600;
    color: var(--gray-600);
    font-size: 13px;
    border-bottom: 1px solid var(--gray-200);
}

.data-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--gray-100);
    color: var(--gray-700);
}

.data-table tr:hover {
    background: var(--gray-50);
}

/* =====================================================
   按钮
   ===================================================== */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-primary {
    background: var(--blue-light);
    color: white;
}

.btn-primary:hover {
    background: #3a8ee6;
}

.btn-orange {
    background: var(--orange-primary);
    color: white;
}

.btn-orange:hover {
    background: #d4940f;
}

.btn-green {
    background: var(--green-primary);
    color: white;
}

.btn-green:hover {
    background: #5daf34;
}

.btn-outline {
    background: white;
    border: 1px solid var(--gray-300);
    color: var(--gray-600);
}

.btn-outline:hover {
    border-color: var(--gray-400);
    color: var(--gray-800);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

/* =====================================================
   标签/徽章
   ===================================================== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.badge-blue {
    background: var(--blue-bg);
    color: var(--blue-light);
}

.badge-orange {
    background: var(--orange-bg);
    color: var(--orange-primary);
}

.badge-green {
    background: var(--green-bg);
    color: var(--green-primary);
}

.badge-yellow {
    background: #fdf6ec;
    color: #e6a23c;
}

.badge-red {
    background: #fef0f0;
    color: #f56c6c;
}

.badge-gray {
    background: var(--gray-100);
    color: var(--gray-500);
}

/* =====================================================
   表单
   ===================================================== */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--gray-700);
}

.form-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.form-input:focus {
    outline: none;
    border-color: var(--blue-light);
    box-shadow: 0 0 0 3px rgba(64, 158, 255, 0.1);
}

/* =====================================================
   页面标题区
   ===================================================== */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.page-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--gray-900);
}

.page-subtitle {
    color: var(--gray-500);
    font-size: 13px;
    margin-top: 4px;
}

/* =====================================================
   筛选栏
   ===================================================== */
.filter-bar {
    background: white;
    padding: 16px 20px;
    border-radius: 8px;
    margin-bottom: 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

.filter-bar select,
.filter-bar input {
    padding: 8px 12px;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    font-size: 13px;
    min-width: 150px;
}

.filter-bar select:focus,
.filter-bar input:focus {
    outline: none;
    border-color: var(--blue-light);
}

/* =====================================================
   进度条
   ===================================================== */
.progress-bar {
    height: 8px;
    background: var(--gray-200);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s;
}

.progress-bar-fill.blue {
    background: var(--blue-light);
}

.progress-bar-fill.orange {
    background: var(--orange-primary);
}

.progress-bar-fill.green {
    background: var(--green-primary);
}

/* =====================================================
   流程进度
   ===================================================== */
.process-flow {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    background: white;
    border-radius: 12px;
    margin-bottom: 24px;
}

.process-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.process-step-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gray-200);
    color: var(--gray-500);
    font-size: 16px;
}

.process-step.completed .process-step-icon {
    background: var(--green-primary);
    color: white;
}

.process-step.current .process-step-icon {
    background: var(--blue-light);
    color: white;
}

.process-step.bottleneck .process-step-icon {
    background: var(--danger);
    color: white;
}

.process-step-label {
    font-size: 12px;
    color: var(--gray-500);
    text-align: center;
}

.process-step-count {
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-700);
}

.process-arrow {
    color: var(--gray-300);
    font-size: 20px;
}

/* =====================================================
   模态框
   ===================================================== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    overflow: auto;
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
}

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--gray-100);
    border-radius: 6px;
    cursor: pointer;
    font-size: 18px;
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--gray-200);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* =====================================================
   侧滑面板
   ===================================================== */
.slide-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 500px;
    height: 100vh;
    background: white;
    box-shadow: -4px 0 20px rgba(0,0,0,0.15);
    z-index: 2000;
    transform: translateX(100%);
    transition: transform 0.3s;
}

.slide-panel.open {
    transform: translateX(0);
}

/* =====================================================
   Toast 提示
   ===================================================== */
.toast {
    position: fixed;
    top: 80px;
    right: 24px;
    padding: 14px 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    gap: 10px;
    transform: translateX(120%);
    transition: transform 0.3s;
    z-index: 3000;
}

.toast.show {
    transform: translateX(0);
}

.toast.success {
    border-left: 4px solid var(--success);
}

.toast.error {
    border-left: 4px solid var(--danger);
}

.toast.warning {
    border-left: 4px solid var(--warning);
}

/* =====================================================
   权限提示
   ===================================================== */
.auth-hint {
    background: #fef0f0;
    border: 1px solid #fde2e2;
    padding: 12px 16px;
    border-radius: 6px;
    color: var(--danger);
    font-size: 13px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* =====================================================
   工具类
   ===================================================== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--gray-500); }
.text-primary { color: var(--blue-light); }
.text-orange { color: var(--orange-primary); }
.text-green { color: var(--green-primary); }
.text-danger { color: var(--danger); }

.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }

.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }

/* 隐藏/显示 */
.hidden { display: none !important; }
.visible { display: block !important; }

/* =====================================================
   登录页
   ===================================================== */
.login-page {
    position: fixed;
    inset: 0;
    background: linear-gradient(135deg, #1E3A5F 0%, #0f172a 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.login-container {
    background: white;
    border-radius: 16px;
    padding: 48px;
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.login-logo {
    font-size: 24px;
    font-weight: 800;
    color: var(--gray-900);
    margin-bottom: 8px;
}

.login-logo span {
    color: var(--blue-light);
}

.login-subtitle {
    color: var(--gray-500);
    margin-bottom: 32px;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.login-input {
    padding: 14px 16px;
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.login-input:focus {
    border-color: var(--blue-light);
    box-shadow: 0 0 0 3px rgba(64, 158, 255, 0.1);
}

.login-btn {
    background: var(--blue-light);
    color: white;
    padding: 14px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: background 0.2s;
}

.login-btn:hover {
    background: #3a8ee6;
}

.login-error {
    color: var(--danger);
    font-size: 13px;
    background: #fef0f0;
    padding: 10px;
    border-radius: 6px;
    display: none;
}

.login-error.show {
    display: block;
}
