@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap');

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  color: #111;
  background: #f4f4f5;
}

#app-auth {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  flex-direction: column;
  gap: 1rem;
}

#app-auth h1 { margin: 0; font-size: 1.4rem; font-weight: 600; }
#app-auth p  { margin: 0; color: #555; font-size: 0.9rem; }

#app-main { display: none; }

.wrap {
  max-width: 980px;
  margin: 0 auto;
  padding: 0 1rem 3rem;
}

/* ── Top bar ─────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: #fff;
  border-bottom: 1px solid #e4e4e7;
  padding: 0.55rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.topbar-title {
  font-weight: 600;
  font-size: 1rem;
  margin-right: auto;
}

.topbar-user {
  font-size: 0.8rem;
  color: #666;
  margin-right: 0.25rem;
}

/* ── Buttons ─────────────────────────────────────── */
.btn {
  font: inherit;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 0.85rem;
  padding: 0.38rem 0.75rem;
  border-radius: 5px;
  border: 1px solid #d4d4d8;
  background: #fff;
  color: #111;
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover { background: #f4f4f5; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-primary  { background: #111; color: #fff; border-color: #111; }
.btn-primary:hover { background: #333; }

.btn-done   { background: #16a34a; color: #fff; border-color: #16a34a; }
.btn-done:hover { background: #15803d; }

.btn-danger { color: #dc2626; border-color: #fca5a5; }
.btn-danger:hover { background: #fef2f2; }

.btn-sm { font-size: 0.78rem; padding: 0.25rem 0.55rem; }

/* ── Status ──────────────────────────────────────── */
#status {
  min-height: 1.1rem;
  font-size: 0.82rem;
  color: #555;
  padding: 0.4rem 1rem 0;
}
#status.err { color: #dc2626; }

/* ── Schedule card ───────────────────────────────── */
.schedule-card {
  margin: 0.75rem 0 1rem;
  background: #fff;
  border: 1px solid #e4e4e7;
  border-radius: 8px;
  padding: 0.85rem 1rem;
}

.schedule-card h2 {
  margin: 0 0 0.6rem;
  font-size: 0.9rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.budget-row {
  font-size: 0.8rem;
  color: #555;
  margin-bottom: 0.65rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.budget-input {
  font: inherit;
  font-size: 0.8rem;
  width: 3.5rem;
  padding: 0.15rem 0.3rem;
  border: 1px solid #d4d4d8;
  border-radius: 4px;
  text-align: center;
}

.schedule-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
@media (max-width: 640px) {
  .schedule-grid { grid-template-columns: 1fr; }
}

.pack-block h3 {
  margin: 0 0 0.4rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: #444;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.pack-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid #e4e4e7;
  border-radius: 6px;
  overflow: hidden;
  background: #fafafa;
}

.pack-list li {
  border-bottom: 1px solid #e4e4e7;
}
.pack-list li:last-child { border-bottom: none; }

.pack-btn {
  display: block;
  width: 100%;
  padding: 0.5rem 0.65rem;
  text-align: left;
  font: inherit;
  font-size: 0.85rem;
  background: transparent;
  border: none;
  cursor: pointer;
  color: #111;
}
.pack-btn:hover { background: #f0f0f1; }
.pack-btn.selected { background: #e0e7ff; }

.pack-btn.done-item { color: #777; text-decoration: line-through; }

.pack-meta { color: #777; font-size: 0.78rem; margin-left: 0.3rem; }

.pack-empty { padding: 0.5rem 0.65rem; color: #888; font-size: 0.85rem; font-style: italic; }

.proj-day { margin-bottom: 0.6rem; }
.proj-day:last-child { margin-bottom: 0; }
.proj-day-header {
  font-size: 0.8rem;
  font-weight: 600;
  color: #333;
  margin-bottom: 0.3rem;
}
.proj-day-budget { font-weight: 400; color: #666; }

/* ── Layout ──────────────────────────────────────── */
.layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  align-items: start;
}
@media (max-width: 640px) {
  .layout { grid-template-columns: 1fr; }
}

/* ── Task list ───────────────────────────────────── */
.section-card {
  background: #fff;
  border: 1px solid #e4e4e7;
  border-radius: 8px;
  padding: 0.85rem 1rem;
}

.section-card h2 {
  margin: 0 0 0.5rem;
  font-size: 0.9rem;
  font-weight: 600;
}

.task-list {
  list-style: none;
  margin: 0 0 0.75rem;
  padding: 0;
  border: 1px solid #e4e4e7;
  border-radius: 6px;
  max-height: 52vh;
  overflow-y: auto;
  background: #fafafa;
}

.task-list li { border-bottom: 1px solid #e4e4e7; }
.task-list li:last-child { border-bottom: none; }

.task-btn {
  display: block;
  width: 100%;
  padding: 0.5rem 0.65rem;
  text-align: left;
  font: inherit;
  font-size: 0.85rem;
  background: transparent;
  border: none;
  cursor: pointer;
  color: #111;
}
.task-btn:hover { background: #f0f0f1; }
.task-btn.selected { background: #e0e7ff; }

.task-meta-tag {
  font-size: 0.75rem;
  color: #888;
  margin-left: 0.35rem;
}

.streak-badge {
  display: inline-block;
  font-size: 0.7rem;
  background: #fef9c3;
  color: #854d0e;
  border-radius: 3px;
  padding: 0 0.3rem;
  margin-left: 0.3rem;
  font-weight: 500;
}

/* ── Form ────────────────────────────────────────── */
.task-form {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.form-label {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.8rem;
  font-weight: 500;
  color: #333;
}

.form-input, .form-select, .form-textarea {
  font: inherit;
  font-size: 0.85rem;
  padding: 0.38rem 0.5rem;
  border: 1px solid #d4d4d8;
  border-radius: 5px;
  background: #fff;
  color: #111;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: 2px solid #6366f1;
  outline-offset: -1px;
  border-color: transparent;
}

.form-check {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.85rem;
  color: #333;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding-top: 0.25rem;
}

.form-hint {
  font-size: 0.75rem;
  color: #888;
  margin: -0.25rem 0 0;
}

.sign-in-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.2rem;
  border: 1px solid #d4d4d8;
  border-radius: 6px;
  background: #fff;
  font: inherit;
  font-size: 0.95rem;
  cursor: pointer;
  color: #111;
}
.sign-in-btn:hover { background: #f4f4f5; }
