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

:root {
  --bg: #f8f9fc;
  --surface: #ffffff;
  --surface-2: #f1f3f7;
  --border: #e2e5eb;
  --border-hover: #cdd1d9;
  --text: #1a1d26;
  --text-secondary: #5f6577;
  --text-muted: #8c90a0;
  --brand: #4f6ef7;
  --brand-hover: #3b5ce4;
  --brand-light: #eef1fe;
  --green: #22c55e;
  --green-light: #ecfdf5;
  --red: #ef4444;
  --red-light: #fef2f2;
  --amber: #f59e0b;
  --amber-light: #fffbeb;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow: 0 2px 8px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
}

body {
  font-family: 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

#app { min-height: 100vh; display: flex; flex-direction: column; }
.hidden { display: none !important; }

/* ── Header ── */
#header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 32px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}

.logo { display: flex; align-items: center; gap: 14px; }
.logo-icon {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, var(--brand), #7c3aed);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: white;
  box-shadow: 0 2px 8px rgba(79,110,247,0.3);
}
.logo-text { display: flex; flex-direction: column; }
.logo-name { font-size: 18px; font-weight: 700; letter-spacing: -0.3px; }
.logo-sub { font-size: 11px; color: var(--text-muted); font-weight: 500; }

/* ── Main Content ── */
#main-content {
  flex: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 28px 32px;
  width: 100%;
  padding-bottom: 100px;
}

/* ── Summary Cards ── */
.summary-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 28px;
}

.summary-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: all 0.2s;
  box-shadow: var(--shadow-sm);
}

.summary-card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow);
}

.summary-card .label {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
  font-weight: 500;
}

.summary-card .value {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.5px;
  font-variant-numeric: tabular-nums;
}

.summary-card .value.green { color: var(--green); }
.summary-card .value.red { color: var(--red); }
.summary-card .value.brand { color: var(--brand); }

/* ── Section Headers ── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.section-header h2 {
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── Category Tabs ── */
.category-tabs {
  display: flex;
  gap: 4px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 4px;
  margin-bottom: 20px;
  border: 1px solid var(--border);
}

.category-tab {
  flex: 1;
  padding: 10px 16px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  transition: all 0.2s;
}

.category-tab.active {
  background: var(--surface);
  color: var(--brand);
  box-shadow: var(--shadow-sm);
}

.category-tab:hover:not(.active) {
  color: var(--text);
}

/* ── Tables ── */
.table-container {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

table { width: 100%; border-collapse: collapse; }

th {
  background: var(--surface-2);
  padding: 12px 16px;
  text-align: right;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  font-weight: 600;
  border-bottom: 1px solid var(--border);
}

td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(79,110,247,0.02); }

/* ── Buttons ── */
.btn {
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  border: none;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
  white-space: nowrap;
}

.btn-primary {
  background: var(--brand);
  color: white;
  box-shadow: 0 2px 6px rgba(79,110,247,0.3);
}

.btn-primary:hover {
  background: var(--brand-hover);
  box-shadow: 0 4px 12px rgba(79,110,247,0.4);
  transform: translateY(-1px);
}

.btn-primary:active { transform: translateY(0); }

.btn-success {
  background: var(--green);
  color: white;
  box-shadow: 0 2px 6px rgba(34,197,94,0.3);
}

.btn-success:hover {
  background: #16a34a;
  box-shadow: 0 4px 12px rgba(34,197,94,0.4);
  transform: translateY(-1px);
}

.btn-danger { background: var(--red); color: white; }
.btn-danger:hover { background: #dc2626; }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  color: var(--text);
  border-color: var(--border-hover);
  background: var(--surface-2);
}

.btn-sm { padding: 6px 12px; font-size: 12px; border-radius: 8px; }

.btn-icon {
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
}

.btn-icon:hover { color: var(--red); border-color: var(--red); background: var(--red-light); }

/* ── Floating Action Button (Mobile) ── */
.fab {
  display: none;
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--green);
  color: white;
  border: none;
  font-size: 28px;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(34,197,94,0.4);
  z-index: 90;
  transition: all 0.2s;
}

.fab:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(34,197,94,0.5);
}

.fab:active {
  transform: scale(0.95);
}

/* ── Forms ── */
.form-group { margin-bottom: 18px; }

.form-label {
  display: block;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 8px;
  font-weight: 600;
}

.form-input, .form-select {
  width: 100%;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 16px;
  font-family: inherit;
  transition: all 0.2s;
  outline: none;
}

.form-input:focus, .form-select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(79,110,247,0.1);
}

.form-input::placeholder { color: var(--text-muted); }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }

/* ── Modal ── */
#modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  backdrop-filter: blur(4px);
  animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--surface);
  border-radius: 16px;
  padding: 28px;
  width: 92%;
  max-width: 520px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.25s ease-out;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.modal-header h2 { font-size: 20px; font-weight: 700; }

.modal-close {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}

.modal-close:hover { color: var(--text); background: var(--border); }

.modal-footer {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

/* ── Badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 600;
}

.badge-active { background: var(--brand-light); color: var(--brand); }
.badge-completed { background: var(--green-light); color: var(--green); }
.badge-paused { background: var(--amber-light); color: var(--amber); }

/* ── Empty State ── */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
}

.empty-state .icon { font-size: 40px; margin-bottom: 12px; opacity: 0.5; }
.empty-state p { font-size: 14px; margin-bottom: 16px; }

/* ── Print ── */
@media print {
  .no-print { display: none !important; }
  #header { position: static; border-bottom: 2px solid #000; }
  #main-content { padding: 16px; }
  body { background: white; }
  .summary-card { border: 1px solid #ddd; box-shadow: none; }
  .table-container { box-shadow: none; border: 1px solid #ddd; }
  th { background: #f5f5f5; }
  .summary-card .value { color: #111 !important; }
}

/* ── Responsive ── */
@media (max-width: 768px) {
  #header { padding: 12px 16px; }
  #main-content { padding: 16px; padding-bottom: 120px; }
  .summary-cards { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .form-row-3 { grid-template-columns: 1fr; }
  .category-tabs { flex-wrap: wrap; }
  .category-tab { padding: 8px 12px; font-size: 12px; }
  
  /* Show FAB on mobile */
  .fab { display: flex; align-items: center; justify-content: center; }
  
  /* Hide desktop add button on mobile */
  .section-header .btn-success { display: none; }
  
  /* Make delete button bigger on mobile */
  .btn-sm { padding: 10px 16px; font-size: 14px; }
  
  /* Make table more mobile-friendly */
  th, td { padding: 12px 10px; font-size: 12px; }
  
  /* Stack modal footer buttons on mobile */
  .modal-footer { flex-direction: column; }
  .modal-footer .btn { width: 100%; }
  
  /* Make modal full width on mobile */
  .modal { width: 95%; padding: 20px; }
}
