/* ===== 全局兜底：确保 [hidden] 永远生效 ===== */
[hidden] { display: none !important; }

/* ===== Reset ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    background: #f0f2f5;
    color: #333;
    line-height: 1.6;
}
a { text-decoration: none; color: inherit; }
input, select, textarea, button { font-family: inherit; font-size: inherit; }

/* ===== 登录页 ===== */
.login-body {
    display: flex; align-items: center; justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}
.login-card {
    background: #fff; border-radius: 16px; padding: 48px 40px;
    width: 520px; max-width: 90vw;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
    text-align: center;
}
.login-logo { font-size: 48px; margin-bottom: 12px; }
.login-title { font-size: 26px; font-weight: 700; color: #1a1a2e; }
.login-subtitle { color: #888; margin-bottom: 32px; font-size: 14px; }
.login-error {
    background: #fff0f0; color: #e74c3c; border: 1px solid #ffd5d5;
    border-radius: 8px; padding: 10px 14px; margin-bottom: 20px; font-size: 13px;
}
.login-form { display: flex; flex-direction: column; gap: 16px; }
.login-field { text-align: left; }
.login-field label { display: block; font-size: 13px; color: #555; margin-bottom: 6px; font-weight: 500; }
.login-field input {
    width: 100%; padding: 12px 16px; border: 2px solid #e0e0e0;
    border-radius: 10px; transition: border-color .2s;
}
.login-field input:focus { outline: none; border-color: #667eea; }
.login-btn {
    width: 100%; padding: 13px; border: none; border-radius: 10px;
    background: #667eea; color: #fff; font-size: 16px; font-weight: 600;
    cursor: pointer; transition: background .2s; margin-top: 4px;
}
.login-btn:hover { background: #5568d3; }
.login-btn:disabled { opacity: .6; cursor: wait; }
.login-hint { margin-top: 24px; font-size: 12px; color: #aaa; }

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

/* 侧边栏 */
.sidebar {
    width: 200px; background: #1a1a2e; color: #ccc;
    display: flex; flex-direction: column; flex-shrink: 0;
    position: sticky; top: 0; height: 100vh;
}
.brand {
    padding: 22px 30px; display: flex; align-items: center; gap: 10px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.brand-icon { font-size: 24px; }
.brand-text { font-size: 18px; font-weight: 700; color: #fff; }
.nav { flex: 1; padding: 12px 0; }
.nav-item {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 32px; color: #aab; cursor: pointer;
    transition: all .15s; font-size: 14px;
}
.nav-item:hover { background: rgba(255,255,255,0.06); color: #fff; }
.nav-item.active { background: rgba(102,126,234,0.2); color: #fff; border-left: 3px solid #667eea; }
.nav-ico { font-size: 17px; width: 22px; text-align: center; }
.sidebar-foot {
    padding: 16px 30px; border-top: 1px solid rgba(255,255,255,0.08);
    display: flex; flex-direction: column; gap: 4px;
}
.btn-text {
    background: none; border: none; color: #888; cursor: pointer;
    padding: 8px 4px; text-align: left; font-size: 13px; transition: color .15s;
}
.btn-text:hover { color: #fff; }

/* 主区域 */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
    background: #fff; padding: 16px 28px; display: flex;
    align-items: center; justify-content: space-between;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06); position: sticky; top: 0; z-index: 10;
}
.page-title { font-size: 20px; font-weight: 600; color: #1a1a2e; }
.user-chip { font-size: 14px; color: #555; background: #f0f2f5; padding: 6px 14px; border-radius: 20px; }
.content { padding: 24px 28px; flex: 1; }

/* ===== 卡片 ===== */
.card {
    background: #fff; border-radius: 12px; padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05); margin-bottom: 20px;
}
.card-title { font-size: 15px; font-weight: 600; color: #333; margin-bottom: 16px; }

/* ===== 统计卡片 ===== */
.stat-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px; margin-bottom: 24px;
}
.stat-card {
    background: #fff; border-radius: 12px; padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    border-left: 4px solid #667eea;
}
.stat-card.green { border-left-color: #27ae60; }
.stat-card.orange { border-left-color: #f39c12; }
.stat-card.red { border-left-color: #e74c3c; }
.stat-card.blue { border-left-color: #3498db; }
.stat-label { font-size: 13px; color: #888; margin-bottom: 8px; }
.stat-value { font-size: 26px; font-weight: 700; color: #1a1a2e; }
.stat-sub { font-size: 12px; color: #aaa; margin-top: 4px; }

/* ===== 两栏布局 ===== */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

/* ===== 工具栏 ===== */
.toolbar {
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
    margin-bottom: 16px;
}
.toolbar-spacer { flex: 1; }

/* ===== 搜索框 ===== */
.search-input {
    padding: 6px 14px; border: 2px solid #e0e0e0; border-radius: 8px;
    width: 240px; transition: border-color .2s;
}
.search-input:focus { outline: none; border-color: #667eea; }

/* ===== 筛选下拉 ===== */
.filter-select {
    padding: 6px 14px; border: 2px solid #e0e0e0; border-radius: 8px;
    background: #fff; cursor: pointer;
}
.filter-select:focus { outline: none; border-color: #667eea; }
.filter-select2 {
    padding: 0 8px; border: 2px solid #e0e0e0; border-radius: 8px;
    background: #fff; cursor: pointer;
}
.filter-select2:focus { outline: none; border-color: #667eea; }

/* ===== 表格 ===== */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
    text-align: left; padding: 12px 14px; background: #f8f9fa;
    color: #666; font-weight: 600; border-bottom: 2px solid #e8e8e8;
    white-space: nowrap;
}
tbody td { padding: 11px 14px; border-bottom: 1px solid #f0f0f0; }
tbody tr:hover { background: #f8f9ff; }
tbody tr.row-expired { background: #fff5f5; }
tbody tr.row-expired:hover { background: #ffe8e8; }
tbody tr.row-warning { background: #fffef5; }
tbody tr.row-warning:hover { background: #fffde0; }

/* ===== 按钮 ===== */
.btn {
    padding: 9px 18px; border: none; border-radius: 8px; cursor: pointer;
    font-size: 13px; font-weight: 500; transition: all .15s;
    display: inline-flex; align-items: center; gap: 6px;
}
.btn-primary { background: #667eea; color: #fff; }
.btn-primary:hover { background: #5568d3; }
.btn-success { background: #27ae60; color: #fff; }
.btn-success:hover { background: #229954; }
.btn-danger { background: #e74c3c; color: #fff; }
.btn-danger:hover { background: #c0392b; }
.btn-secondary { background: #ecf0f1; color: #555; }
.btn-secondary:hover { background: #d5dbdb; }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ===== 徽章 ===== */
.badge {
    display: inline-block; padding: 2px 10px; border-radius: 12px;
    font-size: 12px; font-weight: 500;
}
.badge-active { background: #e8f5e9; color: #27ae60; }
.badge-done { background: #e0e0e0; color: #888; }
.badge-cancel { background: #fdecea; color: #e74c3c; }
.badge-expired { background: #fdecea; color: #e74c3c; }
.badge-soon { background: #fff3cd; color: #856404; }
.badge-vip { background: #fce4ec; color: #c2185b; }
.badge-normal { background: #e3f2fd; color: #1976d2; }

/* ===== 模态框 ===== */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.4);
    display: flex; align-items: center; justify-content: center; z-index: 1000;
    padding: 20px;
}
.modal-card {
    background: #fff; border-radius: 14px; width: 640px; max-width: 95vw;
    max-height: 88vh; display: flex; flex-direction: column;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.modal-header {
    padding: 18px 24px; border-bottom: 1px solid #eee;
    display: flex; align-items: center; justify-content: space-between;
}
.modal-header h2 { font-size: 17px; font-weight: 600; color: #1a1a2e; }
.modal-close {
    background: none; border: none; font-size: 24px; cursor: pointer;
    color: #aaa; line-height: 1; padding: 0 4px;
}
.modal-close:hover { color: #333; }
.modal-body { padding: 24px; overflow-y: auto; flex: 1; }

/* ===== 表单 ===== */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid .full { grid-column: 1 / -1; }
.form-field { display: flex; flex-direction: column; gap: 6px; }
.form-field label { font-size: 13px; color: #555; font-weight: 500; }
.form-field input, .form-field select, .form-field textarea {
    padding: 10px 14px; border: 2px solid #e0e0e0; border-radius: 8px;
    transition: border-color .2s;
}
.form-field input:focus, .form-field select:focus, .form-field textarea:focus {
    outline: none; border-color: #667eea;
}
.form-field textarea { resize: vertical; min-height: 72px; }
.form-actions { display: flex; gap: 12px; justify-content: flex-end; margin-top: 24px; }

/* ===== 项目详情 ===== */
.project-detail { margin-bottom: 20px; }
.project-detail-row { display: flex; padding: 8px 0; border-bottom: 1px solid #f5f5f5; }
.project-detail-label { width: 120px; color: #888; font-size: 13px; flex-shrink: 0; }
.project-detail-value { flex: 1; font-size: 13px; color: #333; }

/* 跟进时间线 */
.followup-timeline { position: relative; padding-left: 24px; }
.followup-timeline::before {
    content: ''; position: absolute; left: 7px; top: 4px; bottom: 4px;
    width: 2px; background: #e0e0e0;
}
.followup-item { position: relative; padding-bottom: 16px; }
.followup-item::before {
    content: ''; position: absolute; left: -21px; top: 4px;
    width: 12px; height: 12px; border-radius: 50%;
    background: #667eea; border: 2px solid #fff; box-shadow: 0 0 0 2px #e0e0e0;
}
.followup-date { font-size: 12px; color: #667eea; font-weight: 600; }
.followup-content { font-size: 13px; color: #333; margin-top: 2px; }
.followup-next { font-size: 12px; color: #888; margin-top: 2px; }
.followup-meta { font-size: 11px; color: #aaa; margin-top: 2px; display: flex; align-items: center; gap: 8px; }
.followup-del { background: none; border: none; color: #e74c3c; cursor: pointer; font-size: 11px; padding: 0; }

/* ===== Toast ===== */
.toast {
    position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%);
    padding: 12px 28px; border-radius: 10px; font-size: 14px; z-index: 2000;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15); transition: opacity .3s;
}
.toast.ok { background: #27ae60; color: #fff; }
.toast.err { background: #e74c3c; color: #fff; }

/* ===== 空状态 ===== */
.empty { text-align: center; padding: 40px 20px; color: #aaa; font-size: 14px; }

/* ===== 进度条 ===== */
.progress-bar { width: 100%; height: 6px; background: #f0f0f0; border-radius: 3px; overflow: hidden; }
.progress-bar-fill { height: 100%; border-radius: 3px; transition: width .3s; }

/* ===== 可搜索下拉框 ===== */
.search-select { position: relative; }
.search-select .ss-input {
    width: 100%; padding: 10px 14px; border: 2px solid #e0e0e0;
    border-radius: 8px; transition: border-color .2s; cursor: pointer;
    background: #fff;
}
.search-select .ss-input:focus {
    outline: none; border-color: #667eea;
}
.search-select .ss-dropdown {
    position: absolute; top: 100%; left: 0; right: 0; z-index: 100;
    max-height: 240px; overflow-y: auto;
    background: #fff; border: 2px solid #667eea; border-top: none;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}
.search-select .ss-option {
    padding: 10px 14px; cursor: pointer; font-size: 13px;
    transition: background .15s;
}
.search-select .ss-option:hover, .search-select .ss-option.ss-active {
    background: #f0f2ff; color: #667eea;
}
.search-select .ss-option.ss-selected {
    background: #eef0ff; font-weight: 600;
}
.search-select .ss-empty {
    padding: 10px 14px; font-size: 13px; color: #999; text-align: center;
}

/* ===== 分页 ===== */
.pagination {
    display: flex; align-items: center; gap: 6px;
    padding: 12px 16px; flex-wrap: wrap;
    border-top: 1px solid #f0f0f0;
}
.pagination .pag-info {
    font-size: 13px; color: #999; margin-right: auto;
}
.pagination .pag-btn {
    min-width: 34px; height: 34px; padding: 0 8px;
    border: 1px solid #e0e0e0; border-radius: 6px;
    background: #fff; color: #333; font-size: 13px;
    cursor: pointer; transition: all .15s;
}
.pagination .pag-btn:hover:not(.disabled):not(.active) {
    border-color: #667eea; color: #667eea;
}
.pagination .pag-btn.active {
    background: #667eea; color: #fff; border-color: #667eea;
}
.pagination .pag-btn.disabled {
    opacity: .4; cursor: not-allowed;
}

/* ===== 响应式 ===== */
@media (max-width: 900px) {
    .sidebar { width: 64px; }
    .brand-text, .nav-item span:not(.nav-ico), .sidebar-foot { display: none; }
    .nav-item { justify-content: center; }
    .grid-2 { grid-template-columns: 1fr; }
    .form-grid { grid-template-columns: 1fr; }
    .search-input { width: 150px; }
}
