/* ============================================================
   生活管家 - 个人生活管理平台 样式表
   ============================================================ */

/* --- CSS Variables --- */
:root {
  --primary: #4f46e5;
  --primary-light: #818cf8;
  --primary-dark: #3730a3;
  --primary-bg: #eef2ff;
  --secondary: #0ea5e9;
  --success: #22c55e;
  --success-bg: #f0fdf4;
  --warning: #eab308;
  --warning-bg: #fefce8;
  --danger: #ef4444;
  --danger-bg: #fef2f2;
  --info: #8b5cf6;
  --info-bg: #f5f3ff;

  --bg: #f8fafc;
  --bg-card: #ffffff;
  --bg-sidebar: #1e293b;
  --bg-hover: #f1f5f9;
  --bg-input: #ffffff;

  --text: #1e293b;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --text-inverse: #ffffff;
  --text-sidebar: #cbd5e1;
  --text-sidebar-active: #ffffff;

  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 15px rgba(0,0,0,.1), 0 4px 6px rgba(0,0,0,.05);
  --radius: 8px;
  --radius-lg: 12px;
  --radius-full: 9999px;

  --sidebar-width: 240px;
  --sidebar-collapsed: 60px;
  --header-height: 56px;
  --transition: .2s ease;
  --font: -apple-system, 'PingFang SC', 'Microsoft YaHei', 'Helvetica Neue', sans-serif;
}

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  overflow: hidden;
  height: 100vh;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
ul { list-style: none; }
img { max-width: 100%; display: block; }

/* --- Scrollbar --- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--text-muted); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-secondary); }

/* --- Typography --- */
h1 { font-size: 1.75rem; font-weight: 700; }
h2 { font-size: 1.4rem; font-weight: 600; }
h3 { font-size: 1.15rem; font-weight: 600; }
h4 { font-size: 1rem; font-weight: 600; }

/* --- App Layout --- */
#app { display: flex; height: 100vh; overflow: hidden; }

/* --- Sidebar --- */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--bg-sidebar);
  color: var(--text-sidebar);
  display: flex;
  flex-direction: column;
  transition: width var(--transition), min-width var(--transition);
  z-index: 100;
  overflow: hidden;
}
.sidebar-header {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  min-height: var(--header-height);
}
.sidebar-logo {
  font-size: 1.5rem;
  flex-shrink: 0;
  width: 32px;
  text-align: center;
}
.sidebar-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-sidebar-active);
  white-space: nowrap;
  overflow: hidden;
}
.sidebar-nav { flex: 1; overflow-y: auto; padding: 8px 0; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  border: none;
  background: none;
  color: var(--text-sidebar);
  width: 100%;
  text-align: left;
  font-size: .9rem;
  font-family: var(--font);
}
.nav-item:hover { background: rgba(255,255,255,.08); color: var(--text-sidebar-active); }
.nav-item.active { background: var(--primary); color: #fff; }
.nav-icon { font-size: 1.2rem; width: 24px; text-align: center; flex-shrink: 0; }
.nav-label { overflow: hidden; text-overflow: ellipsis; }
.nav-badge {
  margin-left: auto;
  background: var(--danger);
  color: #fff;
  font-size: .7rem;
  min-width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  padding: 0 6px;
}
.sidebar-footer {
  padding: 12px 20px;
  border-top: 1px solid rgba(255,255,255,.08);
}
.nav-item.logout { color: #f87171; }
.nav-item.logout:hover { background: rgba(239,68,68,.15); color: #fca5a5; }

/* --- Main Content --- */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}
.main-header {
  height: var(--header-height);
  min-height: var(--header-height);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}
.header-left { display: flex; align-items: center; gap: 12px; }
.menu-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.3rem;
  cursor: pointer;
  color: var(--text);
  padding: 4px;
  border-radius: var(--radius);
}
.menu-toggle:hover { background: var(--bg-hover); }
.page-title { font-size: 1.15rem; font-weight: 600; }
.header-right { display: flex; align-items: center; gap: 12px; }
.header-time { color: var(--text-secondary); font-size: .85rem; }
.main-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

/* --- Cards --- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow);
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.card-title { font-size: 1rem; font-weight: 600; }

/* --- Grid --- */
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* --- Stats Widget --- */
.stat-card {
  padding: 20px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
}
.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}
.stat-icon.blue { background: var(--primary-bg); color: var(--primary); }
.stat-icon.green { background: var(--success-bg); color: var(--success); }
.stat-icon.yellow { background: var(--warning-bg); color: var(--warning); }
.stat-icon.red { background: var(--danger-bg); color: var(--danger); }
.stat-icon.purple { background: var(--info-bg); color: var(--info); }
.stat-info { flex: 1; min-width: 0; }
.stat-label { color: var(--text-secondary); font-size: .85rem; }
.stat-value { font-size: 1.75rem; font-weight: 700; line-height: 1.2; }
.stat-change { font-size: .8rem; margin-top: 2px; }
.stat-change.up { color: var(--success); }
.stat-change.down { color: var(--danger); }

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  font-size: .875rem;
  font-family: var(--font);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  font-weight: 500;
}
.btn:hover { background: var(--bg-hover); border-color: var(--text-muted); }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: #fff; border-color: var(--success); }
.btn-success:hover { background: #16a34a; }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { background: #dc2626; }
.btn-warning { background: var(--warning); color: #fff; border-color: var(--warning); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--bg-hover); }
.btn-sm { padding: 4px 10px; font-size: .8rem; }
.btn-lg { padding: 12px 24px; font-size: 1rem; }
.btn-icon { padding: 6px; width: 32px; height: 32px; }
.btn-icon.btn-lg-icon { width: 40px; height: 40px; font-size: 1.1rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* --- Forms --- */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  margin-bottom: 4px;
  font-size: .85rem;
  font-weight: 500;
  color: var(--text-secondary);
}
.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: .9rem;
  font-family: var(--font);
  background: var(--bg-input);
  color: var(--text);
  transition: border-color var(--transition);
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,.1);
}
.form-textarea { resize: vertical; min-height: 80px; }
.form-input-error { border-color: var(--danger); }
.form-error { color: var(--danger); font-size: .8rem; margin-top: 2px; }
.form-row { display: flex; gap: 12px; }
.form-row > * { flex: 1; }
.form-inline {
  display: flex;
  align-items: center;
  gap: 8px;
}
.form-inline .form-label { margin-bottom: 0; }

/* --- Tables --- */
.table-container { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: .875rem;
}
th {
  font-weight: 600;
  color: var(--text-secondary);
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .03em;
}
tr:hover td { background: var(--bg-hover); }

/* --- Badges & Tags --- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: .75rem;
  font-weight: 500;
}
.badge-primary { background: var(--primary-bg); color: var(--primary); }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-info { background: var(--info-bg); color: var(--info); }
.tag {
  display: inline-block;
  padding: 1px 6px;
  background: var(--bg-hover);
  border-radius: var(--radius);
  font-size: .75rem;
  margin: 1px;
}

/* --- Priority Colors --- */
.priority-0 { color: var(--text-muted); }
.priority-1 { color: var(--warning); }
.priority-2 { color: #f97316; }
.priority-3 { color: var(--danger); }

/* --- Status Colors --- */
.status-pending { color: var(--warning); }
.status-completed { color: var(--success); }
.status-cancelled { color: var(--text-muted); }

/* --- Modal --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn .15s ease;
}
.modal {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 520px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: slideUp .2s ease;
}
.modal-lg { max-width: 720px; }
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 1.05rem; font-weight: 600; }
.modal-close {
  background: none;
  border: none;
  font-size: 1.3rem;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px;
  border-radius: var(--radius);
}
.modal-close:hover { background: var(--bg-hover); color: var(--text); }
.modal-body { padding: 20px; }
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 20px;
  border-top: 1px solid var(--border);
}

/* --- Toast --- */
.toast-container {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  padding: 12px 20px;
  border-radius: var(--radius);
  color: #fff;
  font-size: .875rem;
  box-shadow: var(--shadow-lg);
  animation: slideInRight .25s ease;
  max-width: 360px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-warning { background: var(--warning); }
.toast-info { background: var(--primary); }
.toast-remove { animation: slideOutRight .25s ease forwards; }

/* --- Empty State --- */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}
.empty-state-icon { font-size: 3rem; margin-bottom: 12px; }
.empty-state-text { font-size: .95rem; }

/* --- Loading --- */
.sidebar-overlay { display: none; }
.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .6s linear infinite;
}
.loading-overlay {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px;
  gap: 12px;
  color: var(--text-secondary);
}

/* --- Login Page --- */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  width: 100vw;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}
.login-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 40px;
  width: 400px;
  max-width: 90vw;
  box-shadow: var(--shadow-lg);
}
.login-logo { text-align: center; margin-bottom: 8px; font-size: 3rem; }
.login-title { text-align: center; font-size: 1.5rem; font-weight: 700; margin-bottom: 4px; }
.login-subtitle { text-align: center; color: var(--text-secondary); margin-bottom: 32px; }
.login-btn { width: 100%; padding: 12px; font-size: 1rem; }

/* --- Dashboard --- */
.dashboard-widgets { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.widget { min-height: 200px; }
.widget-list { list-style: none; }
.widget-list li {
  display: flex;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-light);
  gap: 8px;
}
.widget-list li:last-child { border-bottom: none; }
.widget-more {
  display: block;
  text-align: center;
  padding: 8px;
  margin-top: 8px;
  color: var(--text-muted);
  font-size: .85rem;
  cursor: pointer;
}
.widget-more:hover { color: var(--primary); }

/* --- Todo Specific --- */
.todo-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-light);
  transition: background var(--transition);
}
.todo-item:hover { background: var(--bg-hover); border-radius: var(--radius); }
.todo-checkbox {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--text-muted);
  cursor: pointer;
  flex-shrink: 0;
  margin-top: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}
.todo-checkbox:hover { border-color: var(--primary); }
.todo-checkbox.checked {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
  font-size: .7rem;
}
.todo-content { flex: 1; min-width: 0; }
.todo-title { font-weight: 500; }
.todo-title.done { text-decoration: line-through; color: var(--text-muted); }
.todo-meta { font-size: .8rem; color: var(--text-secondary); margin-top: 2px; display: flex; gap: 8px; flex-wrap: wrap; }
.todo-actions { display: flex; gap: 4px; flex-shrink: 0; }
.todo-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.todo-filters {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.filter-btn {
  padding: 4px 12px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: .8rem;
  font-family: var(--font);
  transition: all var(--transition);
}
.filter-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.filter-btn:hover:not(.active) { border-color: var(--primary); color: var(--primary); }
.todo-search {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-size: .85rem;
  font-family: var(--font);
  min-width: 200px;
}
.todo-search:focus { outline: none; border-color: var(--primary); }

/* --- Calendar Specific --- */
.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.calendar-nav { display: flex; align-items: center; gap: 12px; }
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.calendar-cell {
  background: var(--bg-card);
  padding: 8px;
  min-height: 90px;
  cursor: pointer;
  transition: background var(--transition);
}
.calendar-cell:hover { background: var(--bg-hover); }
.calendar-cell.other-month { background: var(--bg); }
.calendar-cell.other-month .cal-day-num { color: var(--text-muted); }
.calendar-cell.today { background: var(--primary-bg); }
.calendar-cell.selected { background: #e0e7ff; }
.cal-day-num {
  font-size: .85rem;
  font-weight: 600;
  margin-bottom: 4px;
}
.cal-events { display: flex; flex-direction: column; gap: 2px; }
.cal-event {
  padding: 1px 6px;
  border-radius: 3px;
  font-size: .7rem;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}
.cal-weekday {
  background: var(--bg-hover);
  padding: 8px;
  text-align: center;
  font-weight: 600;
  font-size: .8rem;
  color: var(--text-secondary);
}
.event-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-left: 4px solid var(--primary);
  border-radius: var(--radius);
  margin-bottom: 8px;
  background: var(--bg);
}
.event-item:hover { background: var(--bg-hover); }
.event-time { font-size: .8rem; color: var(--text-secondary); min-width: 80px; }
.event-info { flex: 1; }
.event-title { font-weight: 500; }
.event-location { font-size: .8rem; color: var(--text-secondary); }

/* --- Finance Specific --- */
.finance-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.finance-summary-card {
  text-align: center;
  padding: 20px;
}
.finance-amount { font-size: 1.75rem; font-weight: 700; }
.finance-amount.income { color: var(--success); }
.finance-amount.expense { color: var(--danger); }
.finance-amount.balance { color: var(--primary); }
.finance-label { color: var(--text-secondary); font-size: .85rem; margin-top: 4px; }
.transaction-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-light);
}
.transaction-item:last-child { border-bottom: none; }
.transaction-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}
.transaction-info { flex: 1; }
.transaction-category { font-weight: 500; }
.transaction-desc { font-size: .8rem; color: var(--text-secondary); }
.transaction-amount { font-weight: 600; text-align: right; }
.transaction-amount.income { color: var(--success); }
.transaction-amount.expense { color: var(--danger); }
.transaction-date { font-size: .8rem; color: var(--text-muted); text-align: right; }

/* --- Notes Specific --- */
.notes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.note-card {
  padding: 16px;
  cursor: pointer;
  transition: all var(--transition);
}
.note-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.note-card-title { font-weight: 600; margin-bottom: 8px; }
.note-card-summary {
  font-size: .85rem;
  color: var(--text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.note-card-meta { font-size: .75rem; color: var(--text-muted); margin-top: 12px; display: flex; justify-content: space-between; }
.note-card.pinned { border-left: 3px solid var(--warning); }
.note-editor { min-height: 300px; }

/* --- Health Specific --- */
.health-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.health-metric {
  text-align: center;
  padding: 20px;
}
.health-value { font-size: 2rem; font-weight: 700; }
.health-unit { color: var(--text-secondary); font-size: .85rem; }
.health-label { color: var(--text-secondary); font-size: .85rem; margin-top: 4px; }
.health-chart { height: 200px; margin-top: 16px; }

/* --- Habits Specific --- */
.habit-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-bottom: 1px solid var(--border-light);
}
.habit-item:last-child { border-bottom: none; }
.habit-check {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  flex-shrink: 0;
}
.habit-check:hover { transform: scale(1.1); }
.habit-check.done {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
}
.habit-info { flex: 1; }
.habit-name { font-weight: 500; }
.habit-streak { font-size: .8rem; color: var(--text-secondary); display: flex; gap: 4px; align-items: center; }
.habit-streak .streak-fire { color: #f97316; }
.habit-weekly {
  display: flex;
  gap: 4px;
}
.habit-weekly-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .6rem;
  background: var(--bg);
}
.habit-weekly-dot.done { background: var(--success); border-color: var(--success); color: #fff; }
.habit-weekly-dot.today { border-color: var(--primary); border-width: 2px; }

/* --- Contacts Specific --- */
.contacts-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}
.contact-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  transition: background var(--transition);
}
.contact-item:hover { background: var(--bg-hover); border-radius: var(--radius); }
.contact-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: #fff;
  flex-shrink: 0;
}
.contact-info { flex: 1; }
.contact-name { font-weight: 500; }
.contact-detail { font-size: .8rem; color: var(--text-secondary); }
.contact-actions { flex-shrink: 0; display: flex; gap: 4px; }

/* --- Search Bar --- */
.search-bar {
  position: relative;
}
.search-bar .form-input { padding-left: 36px; }
.search-bar-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

/* --- Tabs --- */
.tabs {
  display: flex;
  border-bottom: 2px solid var(--border);
  margin-bottom: 16px;
  gap: 0;
}
.tab {
  padding: 8px 16px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  color: var(--text-secondary);
  font-size: .875rem;
  font-weight: 500;
  transition: all var(--transition);
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
  font-family: var(--font);
}
.tab:hover { color: var(--text); }
.tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* --- Progress Bar --- */
.progress-bar {
  height: 8px;
  background: var(--bg-hover);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width .3s ease;
}
.progress-fill.primary { background: var(--primary); }
.progress-fill.success { background: var(--success); }
.progress-fill.warning { background: var(--warning); }
.progress-fill.danger { background: var(--danger); }

/* --- Dropdown --- */
.dropdown {
  position: relative;
  display: inline-block;
}
.dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  min-width: 160px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 100;
  padding: 4px;
  display: none;
  margin-top: 4px;
}
.dropdown-menu.show { display: block; }
.dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: .875rem;
  transition: background var(--transition);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: var(--font);
  color: var(--text);
}
.dropdown-item:hover { background: var(--bg-hover); }
.dropdown-item.danger { color: var(--danger); }
.dropdown-divider { height: 1px; background: var(--border); margin: 4px 0; }

/* --- Pagination --- */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin-top: 16px;
}
.page-btn {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  cursor: pointer;
  font-size: .85rem;
  transition: all var(--transition);
}
.page-btn:hover { border-color: var(--primary); color: var(--primary); }
.page-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.page-btn:disabled { opacity: .5; cursor: not-allowed; }

/* --- Inline Edit --- */
.inline-edit {
  border: none;
  border-bottom: 1px dashed var(--border);
  background: transparent;
  font-size: inherit;
  font-family: var(--font);
  color: var(--text);
  padding: 2px 4px;
  width: 100%;
}
.inline-edit:focus { outline: none; border-bottom-color: var(--primary); }

/* --- Color Dots --- */
.color-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
}

/* --- Responsive --- */
@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .finance-summary { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    transform: translateX(-100%);
    z-index: 200;
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar.open ~ .sidebar-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.4);
    z-index: 199;
  }
  .menu-toggle { display: block; }
  .main-body { padding: 16px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .finance-summary { grid-template-columns: 1fr; }
  .form-row { flex-direction: column; gap: 0; }
  .dashboard-widgets { grid-template-columns: 1fr; }
  .notes-grid { grid-template-columns: 1fr; }
  .todo-header { flex-direction: column; align-items: stretch; }
  .contacts-header { flex-direction: column; align-items: stretch; }
}
@media (max-width: 480px) {
  .main-body { padding: 12px; }
  .card { padding: 14px; }
  h1 { font-size: 1.4rem; }
  h2 { font-size: 1.2rem; }
}

/* --- Animations --- */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideInRight { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: translateX(0); } }
@keyframes slideOutRight { from { opacity: 1; transform: translateX(0); } to { opacity: 0; transform: translateX(40px); } }
@keyframes spin { to { transform: rotate(360deg); } }

/* --- Utility --- */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-sm { font-size: .85rem; }
.text-xs { font-size: .75rem; }
.font-medium { font-weight: 500; }
.font-bold { font-weight: 700; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.w-full { width: 100%; }
.hidden { display: none; }
