/* ── Cards ── */
.card {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border);
}

.card + .card { margin-top: 10px; }

/* ── Activity Card ── */
.activity-card {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border);
  border-left: 4px solid var(--color-primary);
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  cursor: pointer;
  transition: box-shadow var(--transition);
}

.activity-card:hover { box-shadow: var(--shadow-md); }
.activity-card + .activity-card { margin-top: 10px; }

.activity-card.completed {
  opacity: 0.65;
  border-left-color: var(--color-success);
}

.activity-card .card-title {
  font-weight: 600;
  font-size: 1rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.activity-card .card-title .check {
  width: 22px;
  height: 22px;
  min-width: 22px;
  border-radius: 50%;
  border: 2px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition);
  flex-shrink: 0;
}

.activity-card.completed .card-title .check {
  background: var(--color-success);
  border-color: var(--color-success);
  color: white;
}

.activity-card .card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.activity-card .card-time {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}

.activity-card .card-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 4px;
}

/* ── Chips / Badges ── */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: default;
}

.chip-member {
  background: var(--color-primary-light);
  color: var(--color-primary-dark);
}

.chip-category {
  background: var(--color-surface2);
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
}

.chip-recurring {
  background: var(--color-warning-light);
  color: var(--color-warning);
}

.chip-virtual {
  background: #FFF9C4;
  color: #F57F17;
}

.chip-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

/* Filter chip (selectable) */
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  border: 1.5px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-muted);
  transition: all var(--transition);
  white-space: nowrap;
}

.filter-chip.active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: white;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  border: none;
  min-height: 44px;
}

.btn-primary {
  background: var(--color-primary);
  color: white;
}
.btn-primary:hover { background: var(--color-primary-dark); }

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--color-border);
  color: var(--color-text);
}
.btn-outline:hover { border-color: var(--color-primary); color: var(--color-primary); }

.btn-danger {
  background: var(--color-danger-light);
  color: var(--color-danger);
}
.btn-danger:hover { background: var(--color-danger); color: white; }

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn-icon:hover { background: var(--color-surface2); color: var(--color-text); }

.btn-icon svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.btn-sm { padding: 6px 14px; font-size: 0.85rem; min-height: 34px; }

.btn-full { width: 100%; }

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fadeIn 0.15s ease;
}

.modal-overlay.center {
  align-items: center;
}

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

.modal {
  background: var(--color-surface);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  width: 100%;
  max-width: 600px;
  max-height: 92vh;
  overflow-y: auto;
  padding: 20px 20px 32px;
  animation: slideUp 0.25s ease;
}

.modal-overlay.center .modal {
  border-radius: var(--radius-lg);
  margin: 16px;
  max-height: 90vh;
}

@keyframes slideUp {
  from { transform: translateY(40px); opacity: 0; }
}

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

.modal-title {
  font-size: 1.1rem;
  font-weight: 700;
}

.modal-drag {
  width: 40px;
  height: 4px;
  background: var(--color-border);
  border-radius: 2px;
  margin: 0 auto 16px;
}

/* ── Form Group ── */
.form-group {
  margin-bottom: 16px;
}

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

.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

/* ── Member color picker ── */
.color-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.color-swatch {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  border: 3px solid transparent;
  transition: border-color var(--transition);
}

.color-swatch.selected {
  border-color: var(--color-text);
}

/* ── Member selector (chip group) ── */
.member-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.member-chip-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  border: 2px solid transparent;
  background: var(--color-surface2);
  color: var(--color-text-muted);
  transition: all var(--transition);
}

.member-chip-btn.selected {
  color: white;
}

/* ── Duration display ── */
.duration-display {
  background: var(--color-primary-light);
  color: var(--color-primary-dark);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 0.9rem;
  font-weight: 600;
  text-align: center;
}

/* ── Toggle switch ── */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
}

.toggle-label { font-weight: 600; font-size: 0.95rem; }

.toggle {
  position: relative;
  width: 48px;
  height: 26px;
}

.toggle input { display: none; }

.toggle-track {
  position: absolute;
  inset: 0;
  background: var(--color-border);
  border-radius: 13px;
  cursor: pointer;
  transition: background var(--transition);
}

.toggle input:checked + .toggle-track { background: var(--color-success); }

.toggle-track::after {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 20px; height: 20px;
  background: white;
  border-radius: 50%;
  transition: transform var(--transition);
  box-shadow: var(--shadow-sm);
}

.toggle input:checked + .toggle-track::after { transform: translateX(22px); }

/* ── Toast ── */
#toast-container {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: var(--color-text);
  color: white;
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 0.9rem;
  font-weight: 500;
  max-width: 300px;
  animation: toastIn 0.25s ease;
  box-shadow: var(--shadow-md);
}

.toast.success { background: var(--color-success); }
.toast.error { background: var(--color-danger); }
.toast.warning { background: var(--color-warning); }

@keyframes toastIn {
  from { transform: translateX(100%); opacity: 0; }
}

/* ── Settings list ── */
.settings-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.settings-item {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border);
}

.settings-item .item-color {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
}

.settings-item .item-name {
  flex: 1;
  font-weight: 600;
}

/* ── Stats ── */
.stat-card {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border);
  margin-bottom: 16px;
}

.stat-card h3 {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 16px;
}

.bar-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.bar-label {
  font-size: 0.85rem;
  font-weight: 600;
  min-width: 90px;
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-track {
  flex: 1;
  height: 12px;
  background: var(--color-bg);
  border-radius: 6px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 6px;
  transition: width 0.6s ease;
}

.bar-value {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  min-width: 40px;
  text-align: right;
}

.stat-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.stat-box {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  padding: 14px 12px;
  text-align: center;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border);
}

.stat-box .value {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--color-primary);
  line-height: 1;
}

.stat-box .label {
  font-size: 0.72rem;
  color: var(--color-text-muted);
  margin-top: 4px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Heatmap */
.heatmap {
  display: grid;
  grid-template-columns: repeat(52, 1fr);
  gap: 2px;
  overflow-x: auto;
}

.heatmap-cell {
  width: 12px;
  height: 12px;
  border-radius: 2px;
  background: var(--color-bg);
}

.heatmap-cell[data-level="1"] { background: #C5CAE9; }
.heatmap-cell[data-level="2"] { background: #7986CB; }
.heatmap-cell[data-level="3"] { background: #3949AB; }
.heatmap-cell[data-level="4"] { background: #1A237E; }

/* ── Confirm dialog ── */
.confirm-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

/* ── Month nav ── */
.month-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 8px;
}

.month-nav h2 {
  font-size: 1.1rem;
  font-weight: 700;
  min-width: 160px;
  text-align: center;
}

.month-nav button {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--color-text);
}

/* ── Filter bar ── */
.filter-bar {
  background: var(--color-surface);
  padding: 12px 16px;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.filter-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
}
.filter-row::-webkit-scrollbar { display: none; }

/* ── Recurring frequency badge ── */
.freq-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.freq-badge.daily   { background: #E3F2FD; color: #1565C0; }
.freq-badge.weekly  { background: #F3E5F5; color: #6A1B9A; }
.freq-badge.monthly { background: #E8F5E9; color: #2E7D32; }
.freq-badge.weekdays{ background: #FFF3E0; color: #E65100; }
