/* 日常管理系统 - 样式 */

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --success: #16a34a;
  --warning: #f59e0b;
  --danger: #dc2626;
  --bg: #f1f5f9;
  --card: #ffffff;
  --text: #1e293b;
  --text-secondary: #64748b;
  --border: #e2e8f0;
  --shadow: 0 1px 3px rgba(0,0,0,0.1);
  --radius: 8px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

/* ========== 登录页 ========== */
.login-container {
  display: flex; justify-content: center; align-items: center;
  min-height: 100vh; padding: 20px;
  background: linear-gradient(135deg, #1e3a5f 0%, #2563eb 100%);
}
.login-card {
  background: #fff; border-radius: 12px; padding: 40px;
  width: 100%; max-width: 400px; box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.login-card h1 { text-align: center; margin-bottom: 8px; font-size: 24px; }
.login-card .subtitle { text-align: center; color: var(--text-secondary); margin-bottom: 32px; font-size: 14px; }
.login-card .logo { text-align: center; font-size: 48px; margin-bottom: 16px; }

/* ========== 表单 ========== */
.form-group { margin-bottom: 20px; }
.form-group label { display: block; margin-bottom: 6px; font-weight: 500; font-size: 14px; color: var(--text); }
.form-control {
  width: 100%; padding: 10px 14px; border: 1px solid var(--border);
  border-radius: var(--radius); font-size: 15px; transition: border-color 0.2s;
  background: #fff;
}
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }
.password-wrapper { position: relative; }
.password-wrapper .form-control { padding-right: 42px; }
.password-toggle {
  position: absolute; right: 1px; top: 1px; bottom: 1px;
  width: 38px; border: none; background: #fff; cursor: pointer;
  font-size: 18px; display: flex; align-items: center; justify-content: center;
  border-radius: 0 var(--radius) var(--radius) 0; user-select: none;
}
.password-toggle:hover { background: var(--bg); }
textarea.form-control { resize: vertical; min-height: 80px; }
select.form-control { cursor: pointer; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 20px; border: none; border-radius: var(--radius);
  font-size: 15px; font-weight: 500; cursor: pointer; transition: all 0.2s;
  white-space: nowrap;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-outline { background: #fff; color: var(--primary); border: 1px solid var(--primary); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

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

/* 侧边栏 */
.sidebar {
  width: 240px; background: #1e293b; color: #fff;
  flex-shrink: 0; display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 100;
  transition: transform 0.3s;
}
.sidebar-header {
  padding: 20px; border-bottom: 1px solid rgba(255,255,255,0.1);
  text-align: center;
}
.sidebar-header h2 { font-size: 18px; }
.sidebar-header .user-name { font-size: 13px; opacity: 0.7; margin-top: 4px; }
.sidebar-nav { flex: 1; padding: 12px 0; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 20px; cursor: pointer; transition: background 0.2s;
  font-size: 14px; color: rgba(255,255,255,0.7);
}
.nav-item:hover { background: rgba(255,255,255,0.1); color: #fff; }
.nav-item.active { background: var(--primary); color: #fff; }
.nav-item .icon { font-size: 18px; width: 24px; text-align: center; }

/* 主内容区 */
.main-content { flex: 1; margin-left: 240px; padding: 24px; min-height: 100vh; }

/* 移动端顶部栏 */
.mobile-header {
  display: none; background: #1e293b; color: #fff;
  padding: 12px 16px; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 99;
}
.mobile-header .menu-btn { background: none; border: none; color: #fff; font-size: 24px; cursor: pointer; }
.mobile-header h2 { font-size: 16px; }

/* 底部导航（移动端） */
.bottom-nav {
  display: none; position: fixed; bottom: 0; left: 0; right: 0;
  background: #fff; border-top: 1px solid var(--border);
  z-index: 100; justify-content: space-around; padding: 8px 0;
}
.bottom-nav .bn-item {
  display: flex; flex-direction: column; align-items: center;
  gap: 2px; cursor: pointer; padding: 4px 12px; font-size: 11px;
  color: var(--text-secondary);
}
.bottom-nav .bn-item.active { color: var(--primary); }
.bottom-nav .bn-item .icon { font-size: 20px; }

/* ========== 通用组件 ========== */
.page { display: none; }
.page.active { display: block; }

.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px; flex-wrap: wrap; gap: 12px;
}
.page-header h3 { font-size: 20px; }

.card {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px; margin-bottom: 16px;
}

/* 统计卡片 */
.stats-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px; margin-bottom: 24px;
}
.stat-card {
  background: var(--card); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow); text-align: center;
}
.stat-card .stat-value { font-size: 32px; font-weight: 700; color: var(--primary); }
.stat-card .stat-label { font-size: 13px; color: var(--text-secondary); margin-top: 4px; }

/* 表格 */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); }
th { background: #f8fafc; font-weight: 600; font-size: 13px; color: var(--text-secondary); white-space: nowrap; }
tr:hover { background: #f8fafc; }

/* 标签/徽章 */
.badge {
  display: inline-block; padding: 2px 10px; border-radius: 20px;
  font-size: 12px; font-weight: 500;
}
.badge-success { background: #dcfce7; color: #166534; }
.badge-danger { background: #fef2f2; color: #991b1b; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-info { background: #dbeafe; color: #1e40af; }

/* 弹窗 */
.modal-overlay {
  display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5); z-index: 200;
  align-items: center; justify-content: center;
}
.modal-overlay.show { display: flex; }
.modal {
  background: #fff; border-radius: 12px; padding: 24px;
  width: 90%; max-width: 500px; max-height: 85vh; overflow-y: auto;
}
.modal h3 { margin-bottom: 16px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

/* Toast */
.toast {
  position: fixed; top: 20px; right: 20px; z-index: 300;
  padding: 12px 24px; border-radius: var(--radius);
  color: #fff; font-size: 14px; animation: slideIn 0.3s ease;
  max-width: 360px;
}
.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-info { background: var(--primary); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* 提醒弹窗 */
.reminder-popup {
  display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.6); z-index: 250;
  align-items: center; justify-content: center;
}
.reminder-popup.show { display: flex; }
.reminder-popup .popup-card {
  background: #fff; border-radius: 12px; padding: 24px;
  width: 90%; max-width: 420px; text-align: center;
}
.reminder-popup .popup-card .bell { font-size: 48px; margin-bottom: 12px; }
.reminder-popup .popup-card .reminder-text { font-size: 16px; margin-bottom: 20px; line-height: 1.6; }

/* 拍照打卡 */
.camera-area {
  background: #000; border-radius: var(--radius); overflow: hidden;
  position: relative; aspect-ratio: 4/3; margin-bottom: 16px;
  display: flex; align-items: center; justify-content: center; color: #fff;
}
.camera-area video { width: 100%; height: 100%; object-fit: cover; }
.camera-area .placeholder { text-align: center; color: #666; }
.camera-area .placeholder .icon { font-size: 64px; display: block; margin-bottom: 8px; }
.capture-btn {
  width: 64px; height: 64px; border-radius: 50%; border: 4px solid #fff;
  background: rgba(255,255,255,0.3); cursor: pointer; margin: 0 auto; display: block;
}
.capture-btn:active { transform: scale(0.95); }
.photo-preview { width: 100%; border-radius: var(--radius); margin-bottom: 16px; }
.photo-preview img { width: 100%; border-radius: var(--radius); }

/* 定位信息 */
.location-info {
  background: #f0fdf4; border: 1px solid #bbf7d0;
  padding: 12px; border-radius: var(--radius); margin-bottom: 16px;
  font-size: 13px; color: #166534;
}
.location-info .loc-address { font-weight: 500; }
.location-info.out-range {
  background: #fef2f2; border-color: #fecaca; color: #991b1b;
}

/* 花销类别选择 */
.category-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 10px; margin-bottom: 16px;
}
.cat-item {
  padding: 10px; text-align: center; border: 2px solid var(--border);
  border-radius: var(--radius); cursor: pointer; font-size: 14px; transition: all 0.2s;
}
.cat-item.selected { border-color: var(--primary); background: #eff6ff; color: var(--primary); }
.cat-item .cat-icon { font-size: 24px; display: block; margin-bottom: 4px; }

/* 空状态 */
.empty-state { text-align: center; padding: 40px 20px; color: var(--text-secondary); }
.empty-state .icon { font-size: 48px; display: block; margin-bottom: 12px; }

/* 响应式 */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; padding: 16px; padding-bottom: 80px; }
  .mobile-header { display: flex; }
  .bottom-nav { display: flex; }
  .page-header h3 { font-size: 17px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .stat-card .stat-value { font-size: 24px; }
  table { font-size: 12px; }
  th, td { padding: 8px 6px; }
  .modal { width: 95%; padding: 16px; }
    .expense-card .ec-amount { font-size: 16px; }
    .expense-card .ec-actions .btn { font-size: 11px; padding: 4px 8px; }
}

/* 侧边栏遮罩 */
.sidebar-overlay {
  display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5); z-index: 99;
}
.sidebar-overlay.show { display: block; }

/* 权限开关 */
.toggle-switch {
  position: relative; display: inline-block; width: 44px; height: 24px;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0;
  background: #cbd5e1; border-radius: 24px; transition: 0.3s;
}
.toggle-slider:before {
  content: ""; position: absolute; height: 18px; width: 18px;
  left: 3px; bottom: 3px; background: #fff; border-radius: 50%; transition: 0.3s;
}
.toggle-switch input:checked + .toggle-slider { background: var(--primary); }
.toggle-switch input:checked + .toggle-slider:before { transform: translateX(20px); }

/* 筛选栏 */
.filter-bar {
  display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; align-items: center;
}
.filter-bar select, .filter-bar input { width: auto; min-width: 140px; }

/* 打卡状态卡片 */
.attendance-card {
  text-align: center; padding: 30px;
}
.attendance-card .clock-icon { font-size: 64px; margin-bottom: 12px; }
.attendance-card .current-time { font-size: 36px; font-weight: 700; margin-bottom: 4px; }
.attendance-card .current-date { color: var(--text-secondary); margin-bottom: 20px; }
.attendance-card .btn-group { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }

/* 花销卡片列表 */
.expense-card-list { display: flex; flex-direction: column; gap: 10px; }
.expense-card {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; background: #fff; border-radius: var(--radius);
  border-left: 4px solid var(--primary); box-shadow: var(--shadow);
  flex-wrap: wrap; gap: 10px;
}
.expense-card.work { border-left-color: #3b82f6; }
.expense-card.personal { border-left-color: #f59e0b; }
.expense-card .ec-info { flex: 1; min-width: 180px; }
.expense-card .ec-cat { font-weight: 600; font-size: 15px; }
.expense-card .ec-meta { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.expense-card .ec-amount { font-size: 20px; font-weight: 700; white-space: nowrap; }
.expense-card .ec-amount.work { color: #3b82f6; }
.expense-card .ec-amount.personal { color: #f59e0b; }
.expense-card .ec-actions { display: flex; gap: 6px; }
.expense-card .ec-actions .btn { font-size: 13px; padding: 6px 10px; }
.expense-card .ec-thumb { width: 48px; height: 48px; border-radius: 6px; object-fit: cover; cursor: pointer; border: 1px solid var(--border); }

/* 月份导航 */
.month-nav {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px solid var(--border);
}
.month-nav .mn-title { font-weight: 600; font-size: 16px; }
.month-nav .mn-btn {
  background: none; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 6px 12px; cursor: pointer; font-size: 14px; color: var(--text);
  transition: all 0.2s;
}
.month-nav .mn-btn:hover { background: var(--primary); color: #fff; border-color: var(--primary); }

/* 类别管理 */
.cat-mgmt-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 10px; border-bottom: 1px solid var(--border); font-size: 14px;
}
.cat-mgmt-item:last-child { border-bottom: none; }
.cat-mgmt-item .del-cat-btn {
  background: none; border: none; color: var(--danger); cursor: pointer;
  font-size: 16px; padding: 2px 6px; border-radius: 4px;
}
.cat-mgmt-item .del-cat-btn:hover { background: #fef2f2; }

/* 照片放大弹窗 */
.photo-zoom-overlay {
  display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.9); z-index: 300;
  align-items: center; justify-content: center; cursor: pointer;
}
.photo-zoom-overlay.show { display: flex; }
.photo-zoom-overlay img { max-width: 95%; max-height: 95%; border-radius: 8px; }

/* 花销汇总行 */
.expense-summary {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 0; margin-top: 12px; border-top: 2px solid var(--primary);
  font-weight: 700; font-size: 15px;
}

/* 区域自动补全建议 */
.region-wrapper { position: relative; }
.region-suggestions {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 100;
  background: #fff; border: 1px solid var(--border); border-top: none;
  border-radius: 0 0 var(--radius) var(--radius); max-height: 240px;
  overflow-y: auto; box-shadow: 0 4px 12px rgba(0,0,0,0.1); display: none;
}
.region-suggestions.show { display: block; }
.region-suggestion-item {
  padding: 10px 14px; cursor: pointer; font-size: 14px;
  border-bottom: 1px solid var(--border);
}
.region-suggestion-item:last-child { border-bottom: none; }
.region-suggestion-item:hover, .region-suggestion-item.active { background: var(--bg); color: var(--primary); }

/* 回访历史 */
.followup-badge {
  display: inline-flex; align-items: center; gap: 4px; cursor: pointer;
  background: #dbeafe; color: #1e40af; padding: 2px 8px; border-radius: 10px;
  font-size: 12px; font-weight: 500;
}
.followup-badge:hover { background: #bfdbfe; }
.followup-list { max-height: 200px; overflow-y: auto; margin-top: 8px; }
.followup-item {
  padding: 10px 0; border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.followup-item:last-child { border-bottom: none; }
.followup-item .fw-date { color: var(--text-secondary); font-size: 12px; }
.modal .followup-list { margin-bottom: 16px; }

/* 日报筛选栏 */
.report-filters {
  display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px;
  padding: 12px; background: var(--card); border-radius: var(--radius);
  border: 1px solid var(--border);
}
.report-filters input { min-width: 120px; }

/* 跨员工选择器 */
.view-employee-selector {
  margin-bottom: 12px; padding: 10px 12px;
  background: #eff6ff; border-radius: var(--radius);
  border: 1px solid #bfdbfe; display: flex; align-items: center; gap: 10px;
}
.view-employee-selector label { font-weight: 500; white-space: nowrap; }

/* 阅览权限复选框列表 */
.view-perm-list {
  max-height: 200px; overflow-y: auto; border: 1px solid var(--border);
  border-radius: var(--radius); padding: 8px;
}
.view-perm-list label {
  display: flex; align-items: center; gap: 8px; padding: 6px 8px;
  border-radius: 4px; cursor: pointer;
}
.view-perm-list label:hover { background: var(--bg); }

/* 禁用按钮 */
.btn-disabled { opacity: 0.4; cursor: not-allowed !important; pointer-events: none; }
.btn-disabled:hover { background: inherit; }

/* 回访历史中的操作 */
.followup-item-header { display: flex; justify-content: space-between; align-items: center; }
.followup-delete-btn {
  background: none; border: none; color: var(--danger); cursor: pointer;
  font-size: 12px; padding: 2px 6px;
}
.followup-delete-btn:hover { text-decoration: underline; }

/* 日报历史操作按钮组 */
.action-btns { display: flex; gap: 4px; flex-wrap: wrap; }
.action-btns .btn { font-size: 11px; padding: 3px 8px; }
