:root {
  --text: #111;
  --muted: #666;
  --border: #ddd;
  --primary: #4b9afa;
  --danger: #c00;
  --success: #090;
  --bg: #fff;
  --highlight: #e9e0fe;
  --next: #e6f2ff;

  /* Typography - 3 sizes */
  --font-large: 20px;
  /* Main title */
  --font-medium: 16px;
  /* Most content */
  --font-small: 13px;
  /* Minor UI elements */
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

#app {
  max-width: 900px;
  margin: 0 auto;
  padding: 20px 12px;
}

h1 {
  font-size: var(--font-large);
  font-weight: 600;
  margin: 0 0 12px;
}

.main-title {
  font-size: var(--font-large);
  font-weight: 600;
  margin: 0 0 16px 0;
  text-align: left;
}

.hidden {
  display: none !important;
}

/* Login Card */
.card {
  max-width: 320px;
  margin: 60px auto;
  padding: 24px;
}

/* Loading View */
.loading-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  text-align: center;
}

.loading-content p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}

.loading-spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--border);
  border-top: 2px solid var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

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

#pinForm label {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: -8px;
}

#pinInput {
  padding: 8px;
  border: 1px solid var(--border);
  font-size: 16px;
  border-radius: 2px;
}

#pinForm button {
  padding: 8px 16px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 2px;
  cursor: pointer;
  font-size: 14px;
}

.error {
  color: var(--danger);
  font-size: 12px;
  min-height: 1em;
}

/* Header - Minimal */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}

.header-info {
  display: flex;
  align-items: baseline;
  gap: 12px;
  font-size: var(--font-medium);
}

#memberName {
  font-weight: 600;
  font-size: var(--font-medium);
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

#standardDayLabel {
  color: var(--muted);
  font-size: var(--font-medium);
}

#defaultDaySelect {
  padding: 2px 4px;
  border: 1px solid var(--border);
  font-size: var(--font-medium);
  background: white;
  border-radius: 2px;
}

.save-btn {
  padding: 6px 12px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 2px;
  cursor: pointer;
  font-size: var(--font-small);
}

.save-btn:disabled {
  background: var(--border);
  color: var(--muted);
  cursor: default;
}


/* Next Pickup - Inline */
.next-pickup {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 16px;
  padding: 8px;
  background: var(--next);
  border-left: 3px solid var(--primary);
}

.next-label {
  font-size: var(--font-medium);
  color: var(--muted);
}

#nextPickupDate {
  font-weight: 600;
  font-size: var(--font-medium);
}

.info-line {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 16px;
  padding: 8px;
  background: #fff5f5;
  border-left: 3px solid var(--danger);
  color: #c53030;
  font-weight: 600;
  font-size: var(--font-medium);
}

/* Calendar */
.calendar-container {
  margin-top: 20px;
  overflow-x: auto;
}

.weeks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 12px;
}

/* Week Tiles */
.week-tile {
  padding: 10px;
  background: white;
  position: relative;
}

.week-tile.current {
  background: var(--highlight);
}

.week-tile.next {
  box-shadow: inset 0 0 0 2px var(--primary);
}

/* Year Tile */
.year-tile {
  padding: 10px;
  background: linear-gradient(135deg, #fbb6bf 10%, #4b9afa 100%);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 600;
  border-radius: 4px;
  min-height: 80px;
}

.week-header {
  font-size: var(--font-small);
  font-weight: 600;
  margin-bottom: 3px;
  color: var(--muted);
  text-align: center;
}

.pickup-date {
  font-size: var(--font-small);
  color: var(--muted);
  text-align: center;
  margin-bottom: 6px;
  height: 16px;
  line-height: 16px;
}

/* Toggle Buttons */
.week-toggle {
  width: 100%;
  height: 32px;
  box-sizing: border-box;
  padding: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  text-align: center;
  border-radius: 5px;
  transition: all 0.15s ease;
}

.week-toggle:hover {
  background: var(--next);
}

.week-toggle:focus {
  outline-offset: -2px;
}

.week-toggle:active {
  background: var(--next);
}


/* Toast */
.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--text);
  color: white;
  padding: 8px 12px;
  font-size: var(--font-small);
  border-radius: 2px;
}

/* Responsive */
@media (max-width: 600px) {
  #app {
    padding: 12px 8px;
  }

  .app-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .header-info {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .header-controls {
    width: 100%;
    justify-content: space-between;
  }

  .weeks-grid {
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  }
}

/* Remove unnecessary elements from view */
#defaultDayDirty,
#saveStatus,
#gotoNextBtn,
#nextPickupHint {
  display: none;
}