:root {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background-color: #f5f5f5;
  color: #222;
}

body {
  margin: 0;
}

.app {
  max-width: 900px;
  margin: 0 auto;
  padding: 16px;
}

.app-header {
  margin-bottom: 12px;
}

.app-header h1 {
  margin: 0 0 4px;
  font-size: 1.7rem;
}

.subtitle {
  margin: 0;
  font-size: 0.95rem;
  color: #555;
}

.tabs {
  display: flex;
  gap: 4px;
  margin: 12px 0;
}

.tab-button {
  flex: 1;
  padding: 8px 0;
  border: 1px solid #ccc;
  background: #e9e9e9;
  cursor: pointer;
  font-size: 0.95rem;
}

.tab-button.active {
  background: #ffffff;
  border-bottom-color: #ffffff;
}

.tab-content {
  background: #ffffff;
  border: 1px solid #ccc;
  padding: 12px;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

h2 {
  margin-top: 0;
  font-size: 1.2rem;
}

.card-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.card {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.badge {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 999px;
  font-size: 0.7rem;
  border: 1px solid #ccc;
  color: #444;
}

.badge-homework {
  border-color: #c05621;
  color: #c05621;
}

.badge-study {
  border-color: #2b6cb0;
  color: #2b6cb0;
}

.badge-life {
  border-color: #2f855a;
  color: #2f855a;
}

.progress-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: #555;
}

.progress-bar {
  flex: 1;
  height: 6px;
  background: #eee;
  border-radius: 3px;
  overflow: hidden;
}

.progress-inner {
  height: 100%;
  background: #2f855a;
  width: 0;
}

.streak {
  font-size: 0.8rem;
  color: #444;
}

.streak.strong {
  color: #2f855a;
}

.today-actions {
  margin-top: 4px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

button.primary {
  padding: 4px 10px;
  border: none;
  background: #2f855a;
  color: #fff;
  border-radius: 3px;
  cursor: pointer;
  font-size: 0.85rem;
}

button.primary:disabled {
  background: #aaa;
  cursor: default;
}

.small-text {
  font-size: 0.8rem;
  color: #555;
}

.small-info {
  font-size: 0.85rem;
  color: #555;
}

.today-summary {
  font-size: 0.9rem;
  margin-bottom: 8px;
}

.today-summary strong {
  font-weight: 600;
}

.habit-form,
.inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.habit-form input,
.habit-form select,
.inline-form input {
  padding: 4px 6px;
  border: 1px solid #ccc;
  border-radius: 3px;
  font-size: 0.85rem;
}

.habit-form button,
.inline-form button {
  padding: 4px 10px;
  border: none;
  border-radius: 3px;
  background: #2b6cb0;
  color: #fff;
  cursor: pointer;
  font-size: 0.85rem;
}

.points-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.points-value {
  font-weight: 600;
}

.reward-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 4px;
}

button.secondary {
  padding: 3px 8px;
  border-radius: 3px;
  border: 1px solid #ccc;
  background: #f7f7f7;
  font-size: 0.8rem;
  cursor: pointer;
}

button.secondary.danger {
  border-color: #c53030;
  color: #c53030;
}

.danger-button {
  margin-top: 12px;
  padding: 6px 10px;
  background: #fff5f5;
  border: 1px solid #c53030;
  border-radius: 3px;
  color: #c53030;
  cursor: pointer;
  font-size: 0.85rem;
}

.week-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.week-row {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 6px 8px;
}

.week-row-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
  font-size: 0.9rem;
}

.week-grid {
  display: flex;
  gap: 4px;
}

.week-day {
  width: 20px;
  height: 20px;
  border-radius: 3px;
  border: 1px solid #ddd;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #555;
}

.week-day.done {
  background: #2f855a;
  border-color: #2f855a;
  color: #fff;
}

@media (max-width: 600px) {
  .habit-form,
  .inline-form {
    flex-direction: column;
    align-items: stretch;
  }

  .tabs {
    flex-wrap: wrap;
  }
}
