/* ============================================
   ASSA 后台管理 - 蓝白苹果风B端设计
   ============================================ */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: #f5f5f7;
    color: #1d1d1f;
    font-size: 14px;
    line-height: 1.5;
}
a { color: #007AFF; text-decoration: none; }
a:hover { color: #0056b3; }

/* ========== 布局 ========== */
.layout { display: flex; min-height: 100vh; }

/* ========== 侧边栏 ========== */
.sidebar {
    width: 240px;
    background: #ffffff;
    border-right: 1px solid #e5e5ea;
    padding: 20px 0;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    overflow-y: auto;
    z-index: 100;
}
.sidebar-logo {
    padding: 0 20px 24px;
    border-bottom: 1px solid #f0f0f0;
    margin-bottom: 12px;
}
.sidebar-logo h2 {
    font-size: 20px;
    font-weight: 700;
    background: linear-gradient(135deg, #007AFF, #5856d6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 4px;
}
.sidebar-logo p {
    font-size: 11px;
    color: #86868b;
}
.sidebar-menu { list-style: none; padding: 0 12px; }
.sidebar-menu li { margin-bottom: 2px; }
.sidebar-menu a {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    border-radius: 10px;
    color: #1d1d1f;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}
.sidebar-menu a:hover {
    background: #f5f5f7;
    color: #007AFF;
}
.sidebar-menu a.active {
    background: linear-gradient(135deg, #007AFF, #5856d6);
    color: #fff;
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.3);
}
.sidebar-menu .menu-icon {
    margin-right: 10px;
    font-size: 16px;
    width: 20px;
    text-align: center;
}
.sidebar-section {
    padding: 16px 20px 8px;
    font-size: 11px;
    font-weight: 600;
    color: #86868b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ========== 主内容区 ========== */
.main {
    flex: 1;
    margin-left: 240px;
    min-height: 100vh;
}
.header {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid #e5e5ea;
    padding: 16px 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 50;
}
.header h1 {
    font-size: 22px;
    font-weight: 700;
    color: #1d1d1f;
}
.user-info {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 13px;
}
.user-info a {
    color: #007AFF;
    font-weight: 500;
}
.user-info span {
    color: #1d1d1f;
    font-weight: 500;
}
.content { padding: 24px 32px; }

/* ========== 卡片 ========== */
.card {
    background: #ffffff;
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(0, 0, 0, 0.04);
}
.card-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    font-size: 16px;
    font-weight: 600;
    color: #1d1d1f;
}

/* ========== 统计卡片 ========== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}
.stat-card {
    background: #ffffff;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(0, 0, 0, 0.04);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}
.stat-card.blue .stat-icon { background: linear-gradient(135deg, #007AFF, #5856d6); }
.stat-card.green .stat-icon { background: linear-gradient(135deg, #34c759, #30d158); }
.stat-card.orange .stat-icon { background: linear-gradient(135deg, #ff9500, #ff6b00); }
.stat-card.red .stat-icon { background: linear-gradient(135deg, #ff3b30, #ff453a); }
.stat-card.purple .stat-icon { background: linear-gradient(135deg, #af52de, #bf5af2); }
.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    margin-bottom: 12px;
    color: #fff;
}
.stat-label {
    font-size: 13px;
    color: #86868b;
    margin-bottom: 4px;
}
.stat-value {
    font-size: 26px;
    font-weight: 700;
    color: #1d1d1f;
}
.stat-trend {
    font-size: 12px;
    margin-top: 4px;
}
.stat-trend.up { color: #34c759; }
.stat-trend.down { color: #ff3b30; }

/* ========== 表格 ========== */
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.table th {
    text-align: left;
    padding: 12px 16px;
    background: #f5f5f7;
    color: #86868b;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    border-bottom: 1px solid #e5e5ea;
}
.table th:first-child { border-radius: 10px 0 0 10px; }
.table th:last-child { border-radius: 0 10px 10px 0; }
.table td {
    padding: 14px 16px;
    border-bottom: 1px solid #f0f0f0;
    color: #1d1d1f;
}
.table tr:hover { background: #f5f5f7; }
.table tr:last-child td { border-bottom: none; }
.table .actions { display: flex; gap: 12px; }
.table .actions a { font-size: 13px; font-weight: 500; }
.table .actions .edit { color: #007AFF; }
.table .actions .delete { color: #ff3b30; }

/* ========== 表单 ========== */
.form-group { margin-bottom: 18px; }
.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 600;
    color: #1d1d1f;
}
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #d2d2d7;
    border-radius: 10px;
    font-size: 14px;
    color: #1d1d1f;
    background: #fff;
    transition: all 0.2s ease;
    font-family: inherit;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #007AFF;
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
}
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* ========== 按钮 ========== */
.btn {
    display: inline-block;
    padding: 10px 20px;
    background: linear-gradient(135deg, #007AFF, #5856d6);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    font-family: inherit;
}
.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(0, 122, 255, 0.3);
    color: #fff;
}
.btn-sm { padding: 6px 14px; font-size: 12px; border-radius: 8px; }
.btn-default {
    background: #f5f5f7;
    color: #1d1d1f;
}
.btn-default:hover { background: #e8e8ed; box-shadow: none; color: #1d1d1f; }
.btn-success { background: linear-gradient(135deg, #34c759, #30d158); }
.btn-danger { background: linear-gradient(135deg, #ff3b30, #ff453a); }
.btn-warning { background: linear-gradient(135deg, #ff9500, #ff6b00); }

/* ========== 徽章 ========== */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}
.badge-success { background: rgba(52, 199, 89, 0.12); color: #248a3d; }
.badge-warning { background: rgba(255, 149, 0, 0.12); color: #b25e00; }
.badge-danger { background: rgba(255, 59, 48, 0.12); color: #d70015; }
.badge-info { background: rgba(0, 122, 255, 0.12); color: #0056b3; }
.badge-default { background: #f5f5f7; color: #86868b; }

/* ========== 提示框 ========== */
.alert {
    padding: 14px 18px;
    border-radius: 12px;
    margin-bottom: 20px;
    font-size: 14px;
    font-weight: 500;
}
.alert-success { background: rgba(52, 199, 89, 0.1); color: #248a3d; border: 1px solid rgba(52, 199, 89, 0.2); }
.alert-error { background: rgba(255, 59, 48, 0.1); color: #d70015; border: 1px solid rgba(255, 59, 48, 0.2); }
.alert-info { background: rgba(0, 122, 255, 0.1); color: #0056b3; border: 1px solid rgba(0, 122, 255, 0.2); }

/* ========== 登录页 ========== */
.login-page {
    background: linear-gradient(135deg, #f5f5f7 0%, #e8e8ed 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.login-box {
    background: #ffffff;
    border-radius: 20px;
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.1);
}
.login-logo { text-align: center; margin-bottom: 32px; }
.login-logo h1 {
    font-size: 28px;
    font-weight: 800;
    background: linear-gradient(135deg, #007AFF, #5856d6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 8px;
}
.login-logo p { color: #86868b; font-size: 14px; }

/* ========== 快捷链接 ========== */
.quick-links {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
}
.quick-link {
    text-align: center;
    padding: 18px 12px;
    background: #f5f5f7;
    border-radius: 14px;
    text-decoration: none;
    transition: all 0.2s ease;
}
.quick-link:hover {
    background: rgba(0, 122, 255, 0.08);
    transform: translateY(-2px);
}
.quick-link .icon { font-size: 28px; margin-bottom: 8px; }
.quick-link .text { font-size: 13px; color: #1d1d1f; font-weight: 500; }

/* ========== 图表容器 ========== */
.chart-container {
    width: 100%;
    height: 320px;
    margin-bottom: 20px;
}
.chart-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

/* ========== AI聊天 ========== */
.ai-chat-container {
    background: #f5f5f7;
    border-radius: 16px;
    height: 500px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.ai-chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}
.ai-message {
    display: flex;
    margin-bottom: 16px;
    gap: 10px;
}
.ai-message.ai { flex-direction: row; }
.ai-message.user { flex-direction: row-reverse; }
.ai-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}
.ai-message.ai .ai-avatar { background: linear-gradient(135deg, #007AFF, #5856d6); color: #fff; }
.ai-message.user .ai-avatar { background: #e5e5ea; }
.ai-bubble {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.6;
}
.ai-message.ai .ai-bubble { background: #fff; color: #1d1d1f; border-bottom-left-radius: 4px; }
.ai-message.user .ai-bubble { background: linear-gradient(135deg, #007AFF, #5856d6); color: #fff; border-bottom-right-radius: 4px; }
.ai-chat-input {
    display: flex;
    gap: 10px;
    padding: 16px;
    background: #fff;
    border-top: 1px solid #e5e5ea;
}
.ai-chat-input input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #d2d2d7;
    border-radius: 24px;
    font-size: 14px;
    outline: none;
}
.ai-chat-input input:focus { border-color: #007AFF; }
.ai-chat-input button {
    padding: 12px 24px;
    background: linear-gradient(135deg, #007AFF, #5856d6);
    color: #fff;
    border: none;
    border-radius: 24px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}
.ai-quick-questions {
    display: flex;
    gap: 8px;
    padding: 12px 20px;
    flex-wrap: wrap;
}
.ai-quick-questions span {
    padding: 6px 14px;
    background: #fff;
    border: 1px solid #e5e5ea;
    border-radius: 20px;
    font-size: 12px;
    color: #007AFF;
    cursor: pointer;
    transition: all 0.2s;
}
.ai-quick-questions span:hover { background: rgba(0, 122, 255, 0.08); }

/* ========== 空状态 ========== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #86868b;
}
.empty-state .empty-icon { font-size: 48px; margin-bottom: 16px; opacity: 0.5; }

/* ========== 分页 ========== */
.pagination {
    display: flex;
    gap: 6px;
    justify-content: center;
    margin-top: 20px;
}
.pagination a, .pagination span {
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 13px;
    text-decoration: none;
    color: #1d1d1f;
    background: #fff;
    border: 1px solid #e5e5ea;
}
.pagination .current {
    background: linear-gradient(135deg, #007AFF, #5856d6);
    color: #fff;
    border-color: transparent;
}

/* ========== 响应式 ========== */
@media (max-width: 768px) {
    .sidebar { width: 60px; }
    .sidebar-logo h2, .sidebar-logo p, .sidebar-menu a span:not(.menu-icon) { display: none; }
    .main { margin-left: 60px; }
    .header { padding: 12px 16px; }
    .content { padding: 16px; }
    .form-row { grid-template-columns: 1fr; }
    .chart-row { grid-template-columns: 1fr; }
}
