* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f3f4f6;
  color: #1f2937;
  min-height: 100vh;
  padding-bottom: 70px;
}

/* Navigation */
.nav-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: white;
  display: flex;
  justify-content: space-around;
  align-items: center;
  height: 56px;
  border-top: 1px solid #e5e7eb;
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom);
}
.nav-bar a {
  color: #9ca3af;
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: 8px;
  transition: all 0.2s;
  display: flex;
  align-items: center;
}
.nav-bar a.active {
  color: #6366f1;
  background: #eef2ff;
}

/* Container */
.container {
  max-width: 600px;
  margin: 0 auto;
  padding: 16px;
}

/* Cards */
.card {
  background: white;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

/* Forms */
input[type="text"], input[type="password"], input[type="number"],
input[type="date"], select, textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  transition: border 0.2s;
  background: white;
}
input:focus, select:focus, textarea:focus {
  border-color: #6366f1;
}
textarea { resize: vertical; font-family: inherit; }

/* Buttons */
.btn-primary {
  background: #6366f1;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.btn-primary:active { background: #4f46e5; }

.btn-sm {
  padding: 6px 12px;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: inline-block;
}
.btn-success { background: #d1fae5; color: #065f46; }
.btn-success:active { background: #a7f3d0; }
.btn-warning { background: #fef3c7; color: #92400e; }
.btn-warning:active { background: #fde68a; }
.btn-danger { background: #fee2e2; color: #991b1b; }
.btn-danger:active { background: #fecaca; }
.btn-secondary { background: #f3f4f6; color: #374151; }
.btn-secondary:active { background: #e5e7eb; }

/* Tabs */
.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  background: white;
  border-radius: 10px;
  padding: 4px;
}
.tab {
  flex: 1;
  text-align: center;
  padding: 8px;
  border-radius: 8px;
  text-decoration: none;
  color: #6b7280;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.2s;
}
.tab.active {
  background: #6366f1;
  color: white;
}

/* Flash messages */
.flash {
  padding: 10px 14px;
  border-radius: 8px;
  margin-bottom: 12px;
  font-size: 14px;
}
.flash.success { background: #d1fae5; color: #065f46; }
.flash.error { background: #fee2e2; color: #991b1b; }

/* Tasks */
.task-card { transition: opacity 0.3s; }
.task-done { opacity: 0.6; }
.task-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}
.task-title { font-weight: 600; font-size: 15px; flex: 1; }
.task-desc { font-size: 13px; color: #6b7280; margin: 6px 0; }
.task-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12px;
  color: #9ca3af;
  margin: 8px 0;
}
.task-actions { display: flex; gap: 6px; flex-wrap: wrap; }

.badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 10px;
  white-space: nowrap;
}
.badge-new { background: #dbeafe; color: #1e40af; }
.badge-in_progress { background: #fef3c7; color: #92400e; }
.badge-done { background: #d1fae5; color: #065f46; }

/* Stats */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 16px;
}
.stat-card {
  background: white;
  border-radius: 12px;
  padding: 16px;
  text-align: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.stat-value { font-size: 28px; font-weight: 700; }
.stat-label { font-size: 12px; color: #6b7280; margin-top: 4px; }
.stat-new .stat-value { color: #2563eb; }
.stat-progress .stat-value { color: #d97706; }
.stat-done .stat-value { color: #059669; }

/* Progress circle */
.progress-circle {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: conic-gradient(#6366f1 calc(var(--pct) * 1%), #e5e7eb 0%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.progress-circle::before {
  content: '';
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: white;
  position: absolute;
}
.progress-value {
  position: relative;
  z-index: 1;
  font-size: 24px;
  font-weight: 700;
  color: #6366f1;
}

/* User stats */
.user-stat-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid #f3f4f6;
}
.user-stat-row:last-child { border-bottom: none; }
.user-stat-name { font-size: 14px; font-weight: 500; min-width: 80px; }
.user-stat-bar-bg {
  flex: 1;
  height: 8px;
  background: #e5e7eb;
  border-radius: 4px;
  overflow: hidden;
}
.user-stat-bar {
  height: 100%;
  background: #6366f1;
  border-radius: 4px;
  transition: width 0.5s;
}
.user-stat-nums { font-size: 13px; color: #6b7280; min-width: 40px; text-align: right; }

/* Payments */
.payment-card { border-left: 4px solid #6366f1; }
.payment-paid { border-left-color: #10b981; opacity: 0.7; }
.payment-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.payment-day {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: #eef2ff;
  color: #6366f1;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 700;
  margin-right: 8px;
}
.payment-paid .payment-day { background: #d1fae5; color: #059669; }
.payment-amount { font-weight: 700; color: #1f2937; white-space: nowrap; }
.payment-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
}

/* Login */
.login-card {
  max-width: 320px;
  margin: 80px auto 0;
  background: white;
  padding: 32px 24px;
  border-radius: 16px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.08);
  text-align: center;
}
.login-card h1 {
  font-size: 22px;
  margin-bottom: 24px;
  color: #6366f1;
}
.login-card input { margin-bottom: 12px; }
.login-card button { width: 100%; }

/* Empty state */
.empty {
  text-align: center;
  color: #9ca3af;
  padding: 40px 16px;
  font-size: 14px;
}

/* Details/Summary */
details summary { list-style: none; }
details summary::-webkit-details-marker { display: none; }
