/* Style reference: Linear.app, Vercel dashboard, GitHub settings pages */
:root {
  --onyx: #0d0a0bff;
  --charcoal-blue: #454955ff;
  --white: #ffffffff;
  --lime-moss: #72b01dff;
  --green: #3f7d20ff;
  --muted: #6d7281;
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #f4f5f7;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  padding: 24px;
  color: var(--charcoal-blue);
}

main {
  width: min(1100px, 100%);
  background: var(--white);
  border-radius: 8px;
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  position: relative;
}

section {
  background: var(--white);
  border: 1px solid #e5e7eb;
  border-radius: 0;
  padding: 24px;
}

section:first-of-type {
  border: none;
  background: transparent;
  padding: 0;
  box-shadow: none;
}

h1 {
  margin: 0;
  font-size: 2rem;
  font-weight: 500;
}

p {
  margin: 8px 0 0;
  color: var(--muted);
  font-weight: 400;
}

form {
  display: grid;
  gap: 12px;
}

input,
textarea,
select {
  width: 100%;
  border-radius: 6px;
  border: 1px solid #d1d5db;
  padding: 10px 12px;
  font-size: 1rem;
  font-family: inherit;
  background: var(--white);
  color: var(--charcoal-blue);
}

textarea {
  resize: vertical;
  min-height: 96px;
}

button {
  font-family: inherit;
  font-weight: 600;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}

button[type='submit'] {
  background: var(--lime-moss);
  color: var(--white);
  padding: 12px 16px;
  width: fit-content;
  border: 1px solid var(--lime-moss);
}

button[type='submit']:hover {
  background: #5e960c;
  border-color: #5e960c;
}

button[type='submit']:disabled {
  background: #cbd5e1;
  border-color: #cbd5e1;
  cursor: not-allowed;
}

button.secondary {
  background: var(--white);
  color: var(--charcoal-blue);
  border: 1px solid #d1d5db;
  padding: 10px 16px;
}

button.secondary:hover {
  background: #f3f4f6;
}

button.secondary:focus-visible,
button[type='submit']:focus-visible {
  outline: 2px solid var(--lime-moss);
  outline-offset: 2px;
}

#messages {
  margin-top: 8px;
}

#calendar {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.month-section {
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 16px;
  background: var(--white);
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 200px;
}

.month-section__header {
  position: sticky;
  top: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  font-size: 1rem;
  color: var(--onyx);
  padding: 4px 0;
  background: var(--white);
  border-bottom: 1px solid #e5e7eb;
  z-index: 1;
}

.month-section__grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0;
}

.week-row {
  border: 1px solid #e5e7eb;
  padding: 16px;
  margin: 6px 0;
  cursor: pointer;
  grid-column: 1 / -1;
  border-radius: 8px;
  background: var(--white);
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 120px;
}

.week-row.selected {
  border-color: var(--lime-moss);
}

.week-row__meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  gap: 16px;
}

.week-row__count {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--lime-moss);
}

.week-row__days {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
  min-height: 58px;
}

.week-row__day {
  border-radius: 6px;
  border: 1px solid transparent;
  background: #f7fafc;
  text-align: center;
  font-size: 0.85rem;
  padding: 8px 0;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  transition: background 0.2s ease, transform 0.2s ease;
}

.week-row__day.other-month {
  opacity: 0.5;
}

.week-row__day.active {
  border-color: transparent;
  background: rgba(63, 125, 32, 0.15);
  transform: translateY(-1px);
}

.week-row__names {
  font-size: 0.75rem;
  color: var(--charcoal-blue);
  margin-top: 0;
}

.day-card {
  border-radius: 0;
  border: 1px solid #e5e7eb;
  padding: 10px;
  min-height: 100px;
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 0;
  cursor: pointer;
  transition: border-color 0.2s ease, transform 0.2s ease;
  align-items: center;
  text-align: center;
}

.day-card.other-month {
  opacity: 0.7;
}

.day-card.placeholder {
  background: transparent;
  border-color: transparent;
  pointer-events: none;
  min-height: 100px;
  box-shadow: none;
}

.day-card.today {
  border-color: var(--lime-moss);
}

.day-card:hover {
  border-color: #cbd5e1;
  transform: translateY(-1px);
}

.day-card.active {
  border-color: var(--lime-moss);
  background: rgba(114, 176, 29, 0.1);
}

.day-card .day-number {
  font-size: 1.5rem;
  font-weight: 600;
}

.day-card .initials {
  font-size: 0.9rem;
  font-weight: 400;
  color: var(--charcoal-blue);
}

.view-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border-bottom: 1px solid #e5e7eb;
}

.view-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.view-btn {
  border-radius: 6px;
  border: 1px solid #d1d5db;
  background: #fff;
  color: var(--charcoal-blue);
  padding: 6px 12px;
  font-weight: 600;
}

.week-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.week-start {
  display: flex;
  flex-direction: column;
}

.week-start label {
  font-size: 0.6rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 2px;
  color: var(--muted);
}

.week-start select {
  border-radius: 6px;
  border: 1px solid #d1d5db;
  padding: 4px 8px;
  font-size: 0.75rem;
  background: #fff;
  color: var(--charcoal-blue);
}

.week-start.hidden {
  display: none;
}

.view-btn.active {
  background: var(--lime-moss);
  color: var(--white);
  border-color: var(--lime-moss);
}

#userPrompt {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#userPrompt label {
  font-weight: 600;
}

.user-hint {
  margin-top: 12px;
  font-size: 0.95rem;
  color: var(--muted);
}

.month-section__weekday-row {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px;
  padding: 6px 0;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.weekday-label {
  text-align: center;
  font-weight: 600;
}

#infoBanner, .info-banner {
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.info-banner:not(.visible) {
  display: none;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag {
  background: #f4f5f7;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 0.8rem;
  font-weight: 600;
}

.save-section {
  position: sticky;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 24px;
  background: var(--white);
  border-top: 1px solid #e5e7eb;
  z-index: 2;
}

.save-section .tag-list {
  margin-top: 0;
}

#saveAvailability {
  border-radius: 6px;
  border: 1px solid var(--lime-moss);
  background: var(--lime-moss);
  color: var(--white);
  padding: 12px 20px;
  font-size: 1rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
  cursor: pointer;
  min-width: 220px;
}

#saveAvailability:disabled {
  background: #cbd5e1;
  border-color: #cbd5e1;
  cursor: not-allowed;
  color: #fff;
}

#saveAvailability:not(:disabled):hover {
  background: var(--green);
  border-color: var(--green);
}

#saveAvailability:active:not(:disabled) {
  transform: translateY(1px);
}

#saveAvailability.success {
  background: var(--green);
  border-color: var(--green);
}

.save-tick {
  font-size: 1.25rem;
  opacity: 0;
  transform: scale(0.35);
  transition: transform 0.25s ease, opacity 0.25s ease;
}

#saveAvailability.success .save-tick {
  opacity: 1;
  transform: scale(1);
  animation: tick-pop 0.4s ease;
}

@keyframes tick-pop {
  0% {
    transform: scale(0.3);
    opacity: 0;
  }
  60% {
    transform: scale(1.1);
    opacity: 1;
  }
  100% {
    transform: scale(1);
  }
}

.stats-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 8px;
}

.stats-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.stats-list li {
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 12px 16px;
  font-size: 0.9rem;
  background: var(--white);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stats-entry {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
}

.stats-list__label {
  font-size: 1rem;
  font-weight: 600;
  color: var(--charcoal-blue);
  line-height: 1.3;
}

.stats-list__date {
  color: var(--onyx);
}

.stats-list__count {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--lime-moss);
  min-width: 80px;
  text-align: right;
}

.stats-names {
  font-size: 0.75rem;
  color: var(--charcoal-blue);
  margin-top: 2px;
}

.stats-main {
  width: min(1100px, 100%);
  margin: 0 auto;
}

.stats-hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.stats-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.stat-card {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 16px;
  background: #fff;
  min-height: 120px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
}

.stat-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}

.stat-card strong {
  font-size: 2rem;
}

.graph-card {
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 16px;
  background: #fff;
  margin-bottom: 16px;
}

.graph-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 12px;
}

.graph-card svg {
  width: 100%;
  height: 120px;
}

.stats-footer {
  padding: 10px 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.month-loader {
  border: none;
  padding: 0;
  background: transparent;
  display: flex;
  justify-content: center;
}

.month-loader button {
  width: min(280px, 100%);
}

.month-loader.hidden {
  display: none;
}

@media (max-width: 960px) {
  body {
    padding: 16px;
  }
}

@media (max-width: 720px) {
  main {
    padding: 24px;
  }

  section {
    padding: 0;
    border-color: transparent;
  }

  .month-section {
    padding: 12px;
  }

  .month-section__grid {
    gap: 6px;
  }
}

@media (max-width: 520px) {
  body {
    padding: 0;
  }

  main {
    width: 100%;
    padding: 20px;
    border-radius: 8px;
  }

  .month-section {
    border: none;
    padding: 0;
  }

  .month-section__grid {
    gap: 0;
  }

  .save-section {
    flex-direction: column;
    align-items: stretch;
    padding: 16px;
    border-radius: 0;
  }

  .save-section .tag-list {
    width: 100%;
    order: 2;
    margin-top: 12px;
    border-top: 1px solid #e5e7eb;
    padding-top: 12px;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 8px;
  }

  .save-section .tag-list .tag {
    flex: 0 0 auto;
  }

  .tag-shift {
    display: none;
  }

  .day-card {
    border-radius: 0;
  }
}
