/* CRM 财务系统 — 深色主题 */
:root {
  --sidebar-bg: #0a1f3c;
  --sidebar-hover: rgba(97, 218, 251, 0.1);
  --sidebar-active: rgba(97, 218, 251, 0.15);
  --accent: #61dafb;
  --accent-hover: #4ac8e8;
  --success: #16a34a;
  --danger: #dc2626;
  --warning: #f59e0b;
  --primary: #3b82f6;
  --gray-50: #f0f2f5;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-lg: 0 4px 16px rgba(0,0,0,0.12);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif; background: var(--gray-50); color: var(--gray-800); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }

/* Layout */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 220px; background: var(--sidebar-bg); color: white;
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 10;
  display: flex; flex-direction: column;
}
.sidebar .nav-wrap { flex: 1; min-height: 0; overflow-y: auto; }
.sidebar .user-foot { flex-shrink: 0; }
.sidebar h1 {
  font-size: 15px; padding: 24px 20px 20px; margin-bottom: 8px;
  color: var(--accent); font-weight: 600; letter-spacing: 0.5px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.sidebar .nav-item {
  display: flex; align-items: center; gap: 12px; padding: 14px 20px;
  color: rgba(255,255,255,0.7); cursor: pointer; transition: all 0.2s;
  font-size: 14px; border-left: 3px solid transparent; letter-spacing: 0.3px;
}
.sidebar .nav-item:hover { background: var(--sidebar-hover); color: white; }
.sidebar .nav-item.active {
  background: var(--sidebar-active); color: var(--accent); border-left-color: var(--accent);
  font-weight: 600;
}

.main { flex: 1; padding: 24px 28px; min-height: 100vh; background: var(--gray-50); margin-left: 220px; }

/* User bar */
/* User bar removed */

/* Header */
.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.page-header h2 { font-size: 20px; font-weight: 600; color: var(--gray-800); }

/* Cards */
.card {
  background: white; border-radius: 12px; box-shadow: var(--shadow); 
  padding: 20px; margin-bottom: 20px; border: 1px solid var(--gray-200);
}
.card:hover { box-shadow: var(--shadow-lg); }
.card h3 { font-size: 13px; color: var(--gray-500); margin-bottom: 8px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.5px; }
.card .value { font-size: 26px; font-weight: 700; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 18px; border: none;
  border-radius: 8px; font-size: 14px; cursor: pointer; transition: all 0.2s; font-weight: 500;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: #2563eb; }
.btn-success { background: var(--success); color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-outline { background: white; border: 1px solid var(--gray-300); color: var(--gray-600); }
.btn-outline:hover { background: var(--gray-50); border-color: var(--gray-400); }

/* Table */
.table-wrap { overflow-x: auto; border-radius: 8px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--gray-100); white-space: nowrap; }
th { 
  background: var(--gray-50); font-weight: 600; color: var(--gray-500); 
  font-size: 12px; letter-spacing: 0.5px; text-transform: uppercase;
}
tr:hover { background: var(--gray-50); }
tr:last-child td { border-bottom: none; }

/* Badges */
.badge {
  display: inline-block; padding: 2px 10px; border-radius: 12px; font-size: 12px; font-weight: 500; letter-spacing: 0.2px;
}
.badge-success { background: #dcfce7; color: #166534; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-info { background: #dbeafe; color: #1e40af; }
.badge-gray { background: var(--gray-100); color: var(--gray-500); }

/* Filter bar */
.filter-bar { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.filter-bar .filter-btn {
  padding: 6px 14px; border: 1px solid var(--gray-200); border-radius: 20px; background: white;
  cursor: pointer; font-size: 13px; transition: all 0.2s; color: var(--gray-500);
}
.filter-bar .filter-btn:hover { border-color: var(--primary); color: var(--primary); }
.filter-bar .filter-btn.active { background: var(--primary); color: white; border-color: var(--primary); }

/* Modal */
.modal-overlay {
  display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.4); z-index: 1000; justify-content: center; align-items: center;
  backdrop-filter: blur(4px);
}
.modal-overlay.show { display: flex; }
.modal {
  background: white; border-radius: 16px; box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  width: 520px; max-width: 90vw; max-height: 80vh; overflow-y: auto; padding: 28px;
}
.modal h3 { font-size: 18px; margin-bottom: 20px; color: var(--gray-800); }
.modal .modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--gray-100); }

/* Forms */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 500; color: var(--gray-600); margin-bottom: 4px; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 8px 12px; border: 1px solid var(--gray-300); border-radius: 8px;
  font-size: 14px; transition: all 0.2s; outline: none; background: white;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { 
  border-color: var(--primary); box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }



/* Drawer (slide-in panel) */
.drawer-overlay {
  display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.4); z-index: 1000; justify-content: flex-end;
  backdrop-filter: blur(4px);
}
.drawer-overlay.show { display: flex; }
.drawer {
  background: white; box-shadow: -10px 0 40px rgba(0,0,0,0.15);
  width: 560px; max-width: 90vw; height: 100vh; overflow-y: auto;
  transform: translateX(100%); transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex; flex-direction: column;
}
.drawer-overlay.show .drawer { transform: translateX(0); }
.drawer-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 20px 24px; border-bottom: 1px solid var(--gray-100); flex-shrink: 0;
}
.drawer-header h3 { font-size: 18px; color: var(--gray-800); margin: 0; }
.drawer-close {
  background: var(--gray-100); border: none; border-radius: 50%;
  width: 32px; height: 32px; font-size: 14px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--gray-500); transition: all 0.2s;
}
.drawer-close:hover { background: var(--gray-200); color: var(--gray-700); }
.drawer-content {
  padding: 24px; flex: 1; overflow-y: auto;
}
.drawer .form-group { margin-bottom: 16px; }
.drawer .modal-actions {
  display: flex; gap: 8px; justify-content: flex-end;
  margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--gray-100);
}

@media (max-width: 768px) {
  .drawer { width: 100vw; max-width: 100vw; }
}

/* Empty state */
.empty-state { text-align: center; padding: 40px 20px; color: var(--gray-400); }
.empty-state .icon { font-size: 48px; margin-bottom: 12px; }

/* Summary dashboard cards - tighter grid */
.row .card .value { font-size: 22px; }

/* Ensure card details expand properly */
.card-detail { display: none; padding-top: 12px; margin-top: 12px; border-top: 1px solid var(--gray-100); }

/* Menu toggle (mobile/tablet) */
.menu-toggle {
  display: none; position: fixed; top: 12px; left: 12px; z-index: 100;
  background: var(--sidebar-bg); color: white; border: none; border-radius: 8px;
  width: 40px; height: 40px; font-size: 20px; cursor: pointer;
  align-items: center; justify-content: center; box-shadow: var(--shadow-lg);
}
.menu-toggle:hover { background: #0d2b52; }

/* Sidebar overlay (mobile) */
.sidebar-overlay {
  display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.5); z-index: 9;
}
.sidebar-overlay.show { display: block; }

/* Tablet responsive */
@media (max-width: 1024px) {
  .main { margin-left: 0; padding: 20px 24px; }
  .sidebar { transform: translateX(-100%); z-index: 20; }
  .sidebar.open { transform: translateX(0); }
  .menu-toggle { display: flex; }
  .sidebar-overlay.show { display: block; }
  .row { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
  th, td { font-size: 13px; padding: 8px 12px; }
}

/* Mobile responsive */
@media (max-width: 768px) {
  .menu-toggle { display: flex; }
  
  .sidebar {
    transform: translateX(-100%); transition: transform 0.3s ease;
    width: 260px; z-index: 20;
  }
  .sidebar.open { transform: translateX(0); }
  
  .main { padding: 16px; margin-left: 0; }
  
  .sidebar { width: 260px; z-index: 20; }
  
  .row { grid-template-columns: 1fr; gap: 12px; }
  
  .row .card .value { font-size: 20px; }
  
  .form-row { grid-template-columns: 1fr; gap: 0; }
  
  .page-header { flex-direction: column; align-items: flex-start; gap: 12px; }
  
  .page-header .btn { width: 100%; justify-content: center; }
  
  .card { padding: 16px; }
  
  .table-wrap { margin: 0 -16px; border-radius: 0; }
  
  th, td { padding: 8px 10px; font-size: 13px; white-space: nowrap; }
  
  .modal { width: 100%; max-width: 100vw; max-height: 100vh; border-radius: 0; padding: 20px; }
  
  .filter-bar { gap: 6px; }
  .filter-bar .filter-btn { padding: 5px 10px; font-size: 12px; }
  
  table { font-size: 13px; }
}

@media (max-width: 480px) {
  .main { padding: 12px; }
  .card { padding: 12px; }
  .card .value { font-size: 18px; }
  th, td { padding: 6px 8px; font-size: 12px; white-space: normal; }
  .page-header h2 { font-size: 17px; }
  .btn { font-size: 13px; padding: 7px 14px; }
  .filter-bar .filter-btn { padding: 4px 8px; font-size: 11px; }
  .badge { font-size: 11px; padding: 1px 8px; }
}

/* Utility */
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.amount { font-variant-numeric: tabular-nums; }


/* Text truncation */
.text-truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }


/* Admin expense table */
.expense-table td { vertical-align: middle; }
.settle-row { display:flex; justify-content:space-between; align-items:center; padding:6px 0; font-size:14px; }
.settle-row span { color:var(--gray-400); }
.settle-row strong { font-size:16px; color:var(--gray-800); }
/* PM Kanban v2 */
.pm-stats { display:flex; gap:10px; margin-bottom:16px; flex-wrap:wrap; }
.pm-stat { background:white; border-radius:12px; padding:12px 16px; flex:1; min-width:120px; display:flex; align-items:center; gap:10px; border:1px solid var(--gray-200); box-shadow:var(--shadow); }
.pm-stat-icon { width:34px; height:34px; border-radius:10px; display:flex; align-items:center; justify-content:center; font-size:15px; }
.pm-stat-lbl { font-size:12px; color:var(--gray-400); }
.pm-stat-val { font-size:17px; font-weight:700; color:var(--gray-800); margin-top:1px; }

.pm-filter { display:flex; gap:10px; margin-bottom:14px; align-items:center; flex-wrap:wrap; }
.pm-filter input { flex:1; min-width:160px; max-width:260px; padding:8px 14px; border:1px solid #000; border-radius:8px; font-size:13px; outline:none; background:var(--gray-50); color:var(--gray-800); }
.pm-filter input:focus { border-color:var(--accent); }
.pm-tabs { display:flex; gap:4px; }
.pm-tab { padding:5px 13px; border-radius:20px; font-size:12px; cursor:pointer; border:1px solid #000; color:var(--gray-400); background:var(--gray-50); transition:all 0.15s; }
.pm-tab.active { background:var(--accent); color:white; border-color:var(--accent); }
.pm-tab:hover { border-color:var(--accent); color:var(--accent); }
.pm-tab.active:hover { color:white; }

.pm-board { display:flex; flex-direction:column; }
.pm-card { background:white; border-radius:12px; padding:16px 20px; cursor:pointer; border:1px solid var(--gray-200); box-shadow:var(--shadow); margin-bottom:12px; transition:all 0.15s; }
.pm-card:hover { box-shadow:var(--shadow-lg); border-color:var(--gray-300); }
.pm-card-top { display:flex; justify-content:space-between; align-items:center; margin-bottom:8px; }
.pm-card-tleft { display:flex; align-items:center; gap:10px; }
.pm-card-tleft h3 { font-size:14px; font-weight:600; color:var(--gray-800); }
.pm-card-tright { display:flex; gap:10px; flex-wrap:wrap; }
.pm-card-bottom { display:flex; align-items:center; gap:16px; }
.pm-bm { flex:1; }
.pm-bval { font-size:15px; font-weight:700; color:var(--gray-800); }
.pm-blbl { font-size:11px; color:var(--gray-400); }
.pm-bprog { width:120px; }
.pm-bprog .pm-bar { height:5px; background:var(--gray-100); border-radius:3px; overflow:hidden; }
.pm-bprog .pm-fill { height:100%; border-radius:3px; background:linear-gradient(90deg,var(--accent),#6366f1); }
.pm-bprog .pm-brow { display:flex; justify-content:space-between; font-size:11px; color:var(--gray-400); margin-top:2px; }
.pm-bprog .pm-brow strong { color:var(--gray-600); }

.pm-tag-green { background:#f0fdf4; color:#16a34a; }
.pm-tag-orange { background:#fff7ed; color:#c2410c; }
.pm-tag-yellow { background:#fefce8; color:#a16207; }

.pm-badge { font-size:11px; padding:2px 9px; border-radius:20px; font-weight:500; }
.pm-bg-blue { background:#dbeafe; color:#1d4ed8; }
.pm-bg-green { background:#dcfce7; color:#16a34a; }
.pm-bg-yellow { background:#fef3c7; color:#b45309; }

.pm-empty { text-align:center; padding:40px; color:var(--gray-400); }
.pm-tag-blue { background:#eff6ff; color:#1d4ed8; }
