:root {
  --bg-color: #f6f8fa;
  --card-bg: #ffffff;
  --text-main: #1a1f36;
  --text-muted: #6b7280;
  --accent: #4f46e5;
  --accent-light: #eef2ff;
  --green: #10b981;
  --green-light: #ecfdf5;
  --orange: #f59e0b;
  --orange-light: #fffbe6;
  --red: #ef4444;
  --red-light: #fef2f2;
  --blue: #3b82f6;
  --blue-light: #eff6ff;
  --purple: #8b5cf6;
  --border: #e5e7eb;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  --radius: 14px;
}

/* Reset & Base */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: Arial, "Helvetica Neue", Helvetica, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-main);
  font-size: 14px;
  line-height: 1.5;
  padding-bottom: 76px; /* space for bottom nav */
}

#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
}

/* Header */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 12px;
  background: #ffffff;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.user-greeting {
  display: flex;
  align-items: center;
  gap: 12px;
}

.avatar-circle {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #a855f7);
  color: #fff;
  font-weight: 700;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.greeting-sub {
  font-size: 12px;
  color: var(--text-muted);
}

.greeting-title {
  font-size: 16px;
  font-weight: 700;
}

.score-badge {
  background: var(--accent-light);
  border: 1px solid rgba(79, 70, 229, 0.2);
  border-radius: 12px;
  padding: 6px 14px;
  text-align: center;
}

.score-badge-val {
  font-size: 20px;
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
}

.score-badge-lbl {
  font-size: 9px;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 600;
  margin-top: 2px;
}

/* PMZH Card */
.pmzh-card {
  margin: 16px 16px 8px;
  background: linear-gradient(135deg, #ffffff, #f0fdf4);
  border: 1.5px solid var(--green);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
}

.pmzh-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.pmzh-days {
  font-weight: 700;
  color: var(--green);
  font-size: 13px;
}

.pmzh-card-body strong {
  display: block;
  font-size: 13px;
  margin-bottom: 8px;
}

.progress-bar-bg {
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 6px;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #10b981, #059669);
  border-radius: 4px;
  transition: width 0.4s ease;
}

.pmzh-meta {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
}

/* Content & Tabs */
.content-area {
  padding: 12px 16px;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
  animation: fadeIn 0.25s ease-in-out;
}

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

.section-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 16px 0 10px;
}

.section-title:first-child {
  margin-top: 4px;
}

/* Cards */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 10px;
  box-shadow: var(--shadow);
}

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.card-head strong {
  font-size: 15px;
}

/* Key Value Pairs */
.kv {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  font-size: 13px;
}

.kv-lbl {
  color: var(--text-muted);
}

/* Metrics Grid */
.metrics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}

.metric-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  box-shadow: var(--shadow);
}

.metric-icon { font-size: 20px; margin-bottom: 4px; }
.metric-label { font-size: 11px; color: var(--text-muted); }
.metric-value { font-size: 16px; font-weight: 700; }
.metric-sub { font-size: 10px; color: var(--text-muted); margin-top: 2px; }

/* Deadlines */
.deadline-item {
  display: flex;
  align-items: center;
  gap: 12px;
}

.dl-date {
  background: var(--accent-light);
  color: var(--accent);
  font-weight: 800;
  font-size: 11px;
  text-align: center;
  padding: 8px 10px;
  border-radius: 8px;
  line-height: 1.2;
}

.dl-info {
  flex: 1;
}

.dl-info strong { display: block; font-size: 13px; }
.dl-info span { font-size: 11px; color: var(--text-muted); }

/* Members List */
.member-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 8px;
}

.member-item.primary {
  border-left: 4px solid var(--accent);
}

.member-name { font-weight: 700; font-size: 14px; }
.member-sub { font-size: 12px; color: var(--text-muted); }

/* Tables */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.data-table th {
  text-align: left;
  padding: 6px 4px;
  color: var(--text-muted);
  font-size: 10px;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: 8px 4px;
  border-bottom: 1px dashed var(--border);
}

/* Tasks */
.task-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 8px;
  cursor: pointer;
}

.task-item.done {
  opacity: 0.6;
  text-decoration: line-through;
}

.task-checkbox {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  border: 2px solid var(--border);
  margin-top: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
}

.task-item.done .task-checkbox {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}

/* Badges */
.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 6px;
}

.badge-green { background: var(--green-light); color: var(--green); }
.badge-orange { background: var(--orange-light); color: var(--orange); }
.badge-red { background: var(--red-light); color: var(--red); }
.badge-blue { background: var(--blue-light); color: var(--blue); }
.badge-accent { background: var(--accent-light); color: var(--accent); }

/* Color helpers */
.text-green { color: var(--green); font-weight: 600; }
.text-purple { color: var(--purple); font-weight: 600; }
.text-blue { color: var(--blue); font-weight: 600; }

/* Bottom Nav */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-width: 480px;
  margin: 0 auto;
  background: #ffffff;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-around;
  padding: 8px 0 10px;
  z-index: 200;
  box-shadow: 0 -2px 10px rgba(0,0,0,0.04);
}

.nav-item {
  background: none;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  width: 20%;
}

.nav-icon {
  font-size: 18px;
  margin-bottom: 2px;
  transition: transform 0.2s ease;
}

.nav-item.active {
  color: var(--accent);
}

.nav-item.active .nav-icon {
  transform: scale(1.15);
}
