:root {
  --bg: #e7e3dd; /* Cream */
  --text: #111111; /* Chinese Black */
  --text-muted: #6b665e; /* Muted warmth */
  --primary: #111111; /* Chinese Black */
  --primary-text: #ffffff;
  --primary-hover: #222222;
  --danger: #aa1515; /* Traffic Red */
  --card-bg: #ffffff;
  --border: #dcd7cf;
  --shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.04), 0 4px 6px -2px rgba(0, 0, 0, 0.02);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111111; /* Chinese Black */
    --text: #e7e3dd; /* Cream */
    --text-muted: #8b8882;
    --card-bg: #1a1a1a;
    --border: #262626;
    --shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.4);
    --primary: #ffffff;
    --primary-text: #111111;
    --primary-hover: #e7e3dd;
  }
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg);
  color: var(--text);
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: background-color 0.3s, color 0.3s;
  letter-spacing: -0.01em;
}

header {
  padding: 3rem 1.5rem 2rem;
  text-align: center;
}

h1 {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  margin: 0 0 0.75rem 0;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.hero-amount {
  font-size: 4rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
  letter-spacing: -0.04em;
}

.hero-sub {
  margin-top: 0.75rem;
  font-size: 0.95rem;
  color: var(--text-muted);
  font-weight: 500;
}

.currency {
  font-size: 1.25rem;
  vertical-align: super;
  color: var(--danger); /* Traffic Red Accent */
  opacity: 0.8;
  font-weight: 600;
  margin-right: 0.25rem;
}

main {
  flex: 1;
  padding: 0 1.25rem;
  max-width: 500px;
  width: 100%;
  margin: 0 auto;
}

/* Action Button */
.action-area {
  margin-bottom: 2.5rem;
  text-align: center;
}

.btn-pay {
  background-color: var(--primary);
  color: var(--primary-text);
  border: none;
  font-size: 1.05rem;
  font-weight: 600;
  padding: 1.1rem 3rem;
  border-radius: 1.25rem;
  cursor: pointer;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  transition: all 0.2s ease;
  width: 100%;
}

.btn-pay:hover:not(:disabled) {
  background-color: var(--primary-hover);
  transform: translateY(-1px);
}

.btn-pay:active:not(:disabled) {
  transform: scale(0.98);
}

.btn-pay:disabled {
  background-color: var(--text-muted);
  opacity: 0.5;
  box-shadow: none;
  cursor: not-allowed;
}

/* Stats */
.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 2.5rem;
}

.stat-card {
  background-color: var(--card-bg);
  padding: 1.25rem;
  border-radius: 1.25rem;
  text-align: left;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.stat-val {
  display: block;
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 0.25rem;
  letter-spacing: -0.02em;
}

.stat-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.05em;
}

/* Calendar Grid */
.calendar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  padding: 0 0.5rem;
}

.month-nav {
  background-color: var(--card-bg);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 1.1rem;
  cursor: pointer;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.month-nav:hover {
  background-color: var(--border);
}

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

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.6rem;
  margin-bottom: 4rem;
}

.day-header {
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 700;
  padding-bottom: 0.5rem;
}

.day-cell {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  border-radius: 0.75rem;
  font-size: 0.95rem;
  font-weight: 600;
  position: relative;
  background-color: var(--card-bg);
  cursor: pointer;
  user-select: none;
  border: 1px solid var(--border);
  transition: all 0.2s;
}

.day-val {
  font-size: 0.55rem;
  opacity: 0.5;
  margin-top: 2px;
}

/* Day States */
.day-cell.saved {
  background-color: var(--primary);
  color: var(--primary-text);
  border-color: var(--primary);
}

.day-cell.saved .day-val {
  color: var(--primary-text);
  opacity: 0.8;
}

.day-cell.overdue {
  border-color: var(--danger);
  color: var(--danger);
  background-color: rgba(170, 21, 21, 0.05); /* Tinted Traffic Red */
}

.day-cell.future {
  opacity: 0.4;
  cursor: default;
}

.day-cell.empty {
  background-color: transparent;
  border-color: transparent;
  cursor: default;
}

/* Footer */
footer {
  padding: 2.5rem 1.5rem;
  text-align: center;
  display: flex;
  justify-content: center;
  gap: 1.5rem;
}

.link-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: color 0.2s;
}

select.link-btn {
  appearance: none;
  -webkit-appearance: none;
  background-color: transparent;
  padding-right: 0.5rem;
  font-family: inherit;
  outline: none;
  color: var(--text-muted);
  cursor: pointer;
  border: none;
  font-weight: 600;
  font-size: 0.85rem;
}

/* Force colors on the dropdown menu items */
select.link-btn option {
  background-color: #111111; /* Cream */
  color: #111111; /* Black */
}

@media (prefers-color-scheme: dark) {
  select.link-btn option {
    background-color: #111111; /* Black */
    color: #e7e3dd; /* Cream */
  }
}


/* Toast */
.toast {
  position: fixed;
  bottom: 2.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background-color: var(--text);
  color: var(--bg);
  padding: 0.85rem 1.75rem;
  border-radius: 1rem;
  font-weight: 600;
  font-size: 0.95rem;
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2);
  z-index: 50;
  white-space: nowrap;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}
