:root {
  --primary: #1d5b3b;
  --primary-hover: #143f2b;
  --primary-light: #70b77e;
  --primary-bg: #e6f3df;
  --leaf: #a7c957;
  --sun: #f0c84b;
  --surface: #fffdf6;
  --surface-strong: #ffffff;
  --bg: #edf3e8;
  --text: #142319;
  --text-secondary: #5d6f60;
  --border: #d8e4d4;
  --danger: #a33b32;
  --danger-bg: #fff0ed;
  --shadow-sm: 0 10px 28px rgba(31, 74, 45, 0.08);
  --shadow-md: 0 16px 42px rgba(31, 74, 45, 0.14);
  --shadow-lg: 0 24px 70px rgba(18, 45, 28, 0.24);
  --radius: 8px;
  --radius-sm: 8px;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html { min-height: 100%; }

body {
  min-height: 100%;
  max-width: 480px;
  margin: 0 auto;
  overflow-x: hidden;
  color: var(--text);
  font-family: Aptos, Candara, "Segoe UI", sans-serif;
  background:
    linear-gradient(135deg, rgba(255,255,255,0.72), rgba(255,255,255,0) 38%),
    radial-gradient(circle at 12% 8%, rgba(167,201,87,0.38), transparent 28%),
    linear-gradient(180deg, #f7faef 0%, var(--bg) 48%, #ddebd9 100%);
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.22;
  background-image:
    linear-gradient(30deg, rgba(29,91,59,0.12) 12%, transparent 12%, transparent 88%, rgba(29,91,59,0.12) 88%),
    linear-gradient(150deg, rgba(29,91,59,0.1) 12%, transparent 12%, transparent 88%, rgba(29,91,59,0.1) 88%);
  background-size: 34px 34px;
}

[hidden] { display: none !important; }

button,
input,
select {
  font: inherit;
}

button {
  color: inherit;
}

.view {
  min-height: 100dvh;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  isolation: isolate;
}

.header {
  color: #f9fff6;
  padding: 20px 20px 26px;
  padding-top: calc(20px + env(safe-area-inset-top, 0px));
  flex-shrink: 0;
  background:
    linear-gradient(145deg, rgba(20,63,43,0.96), rgba(47,112,69,0.96)),
    linear-gradient(90deg, rgba(240,200,75,0.24), transparent 46%);
  box-shadow: 0 18px 36px rgba(21, 67, 43, 0.16);
}

.header h1 {
  font-family: Georgia, Cambria, serif;
  font-size: 27px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0;
}

.header-sub {
  margin-top: 5px;
  color: rgba(249,255,246,0.78);
  font-size: 13px;
}

.header-row,
.brand-lockup {
  display: flex;
  align-items: center;
}

.header-row {
  justify-content: space-between;
  gap: 16px;
}

.brand-lockup {
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  color: #173823;
  font-family: Georgia, Cambria, serif;
  font-size: 24px;
  font-weight: 900;
  background:
    linear-gradient(135deg, #f7f2c7, #a7c957 58%, #5aa05e);
  border: 1px solid rgba(255,255,255,0.42);
  border-radius: 8px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.55), 0 10px 24px rgba(11, 35, 20, 0.24);
}

.icon-btn {
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #f9fff6;
  background: rgba(255,255,255,0.11);
  border: 1px solid rgba(255,255,255,0.24);
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.16s ease, background 0.16s ease;
}

.icon-btn:active {
  transform: translateY(1px) scale(0.98);
  background: rgba(255,255,255,0.2);
}

.icon-btn svg {
  width: 19px;
  height: 19px;
}

.main-body,
.setup-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.main-body {
  gap: 12px;
  padding: 18px 16px 24px;
}

.setup-body {
  gap: 16px;
  padding: 24px 18px 34px;
}

.card {
  background: rgba(255,253,246,0.94);
  border: 1px solid rgba(216,228,212,0.92);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 20px;
}

.collection-card {
  position: relative;
  overflow: hidden;
  min-height: 360px;
  text-align: center;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.8), rgba(255,253,246,0.96)),
    linear-gradient(135deg, rgba(167,201,87,0.2), transparent 52%);
}

.collection-card::before {
  content: "";
  position: absolute;
  inset: 12px 12px auto auto;
  width: 118px;
  height: 118px;
  border: 1px solid rgba(29,91,59,0.1);
  background:
    repeating-linear-gradient(45deg, rgba(29,91,59,0.08) 0 2px, transparent 2px 10px);
  clip-path: polygon(50% 0, 100% 48%, 50% 100%, 0 48%);
  opacity: 0.55;
}

.bins-row {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 14px;
  min-height: 158px;
  margin-bottom: 22px;
}

.bin-tile {
  display: flex;
  flex: 1;
  max-width: 150px;
  flex-direction: column;
  align-items: center;
  gap: 9px;
  animation: pop-in 0.34s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.bin-png {
  width: min(29vw, 100px);
  height: auto;
  display: block;
  filter: drop-shadow(0 12px 20px rgba(31, 64, 40, 0.22));
}

.bin-name {
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.3px;
  line-height: 1.25;
  text-align: center;
  text-transform: uppercase;
}

.date-section {
  position: relative;
  z-index: 1;
  padding-top: 22px;
  border-top: 1px solid var(--border);
}

.date-day {
  color: var(--text);
  font-family: Georgia, Cambria, serif;
  font-size: clamp(34px, 11vw, 48px);
  font-weight: 900;
  line-height: 0.95;
  letter-spacing: 0;
}

.date-full {
  margin-top: 7px;
  color: var(--text-secondary);
  font-size: 15px;
}

.date-countdown {
  display: inline-flex;
  align-items: center;
  margin-top: 14px;
  min-height: 28px;
  padding: 5px 13px;
  color: #163d28;
  background: linear-gradient(135deg, #dff0cf, #f5ecc0);
  border: 1px solid rgba(29,91,59,0.14);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.date-countdown.today {
  color: #65460a;
  background: #fff0bb;
}

.date-countdown.tomorrow {
  color: #1c5a45;
  background: #d9f0e1;
}

.notify-card {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
  border: 1px solid rgba(216,228,212,0.95);
  cursor: pointer;
  color: var(--text);
  text-align: left;
  transition: transform 0.14s ease, box-shadow 0.14s ease, border-color 0.14s ease;
}

.notify-card:active {
  transform: translateY(1px) scale(0.99);
  box-shadow: none;
}

.notify-icon {
  width: 46px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--primary);
  background: linear-gradient(145deg, #e5f3d9, #fff8dc);
  border: 1px solid rgba(29,91,59,0.12);
  border-radius: 8px;
}

.notify-icon svg {
  width: 21px;
  height: 21px;
}

.notify-label {
  flex: 1;
  min-width: 0;
}

.notify-label-main {
  font-size: 15px;
  font-weight: 800;
}

.notify-label-sub {
  margin-top: 2px;
  color: var(--text-secondary);
  font-size: 12px;
}

.chevron-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: #91a391;
}

.meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 2px;
}

.meta-txt {
  min-width: 0;
  color: var(--text-secondary);
  font-size: 12px;
}

.refresh-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 10px;
  color: var(--primary);
  background: rgba(255,253,246,0.7);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.refresh-btn svg {
  width: 14px;
  height: 14px;
}

.refresh-btn.spinning svg {
  animation: spin 0.7s linear infinite;
}

.refresh-btn:disabled {
  opacity: 0.44;
  cursor: not-allowed;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.field label {
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.6px;
  text-transform: uppercase;
}

.field-optional {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}

.field input[type="text"],
.field select {
  width: 100%;
  padding: 14px 15px;
  color: var(--text);
  background: rgba(255,253,246,0.95);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  font-size: 16px;
  appearance: none;
  -webkit-appearance: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.field select {
  padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%235d6f60' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
}

.field input:focus,
.field select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(29,91,59,0.12);
  background: #fffef8;
}

.field select:disabled {
  opacity: 0.45;
}

.ac-wrap {
  position: relative;
}

.ac-list {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 60;
  max-height: 240px;
  overflow-y: auto;
  list-style: none;
  background: var(--surface-strong);
  border: 1.5px solid var(--primary);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  overscroll-behavior: contain;
}

.ac-list li {
  padding: 13px 15px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  font-size: 15px;
}

.ac-list li:last-child {
  border-bottom: none;
}

.ac-list li:hover,
.ac-list li.highlighted {
  background: var(--primary-bg);
}

.btn {
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 15px 16px;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 16px;
  font-weight: 800;
  transition: transform 0.12s ease, opacity 0.12s ease, background 0.12s ease;
}

.btn:active:not(:disabled) {
  transform: translateY(1px) scale(0.99);
}

.btn:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}

.btn-primary {
  color: white;
  background: linear-gradient(135deg, var(--primary), #2e7a4b);
  box-shadow: 0 12px 24px rgba(29,91,59,0.2);
}

.btn-primary:active:not(:disabled) {
  background: var(--primary-hover);
}

.btn-ghost {
  color: var(--text-secondary);
  background: transparent;
}

.btn-full {
  width: 100%;
}

.modal-overlay,
.sheet-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(17, 39, 25, 0.42);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  animation: fade-bg 0.2s ease;
}

.modal-overlay {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal {
  width: 100%;
  max-width: 360px;
  padding: 36px 26px 28px;
  text-align: center;
  background: var(--surface);
  border: 1px solid rgba(216,228,212,0.92);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  animation: pop-in 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-icon {
  margin-bottom: 16px;
  font-size: 48px;
  line-height: 1;
}

.modal h2,
.sheet-title {
  font-family: Georgia, Cambria, serif;
  font-weight: 900;
  letter-spacing: 0;
}

.modal h2 {
  margin-bottom: 12px;
  font-size: 24px;
}

.modal p {
  margin-bottom: 26px;
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.65;
}

.modal p strong {
  color: var(--text);
}

.sheet-overlay {
  display: flex;
  align-items: flex-end;
  z-index: 100;
}

.sheet {
  width: 100%;
  max-height: 90dvh;
  max-height: 90vh;
  overflow-y: auto;
  padding: 0 20px 22px;
  padding-bottom: calc(22px + env(safe-area-inset-bottom, 0px));
  background:
    linear-gradient(180deg, #fffffb, var(--surface));
  border-radius: 18px 18px 0 0;
  box-shadow: var(--shadow-lg);
  overscroll-behavior: contain;
  animation: slide-up 0.28s cubic-bezier(0.32, 0.72, 0, 1);
}

.sheet-drag {
  width: 38px;
  height: 4px;
  margin: 13px auto 22px;
  background: #c5d2c2;
  border-radius: 2px;
}

.sheet-title {
  margin-bottom: 8px;
  color: var(--text);
  font-size: 25px;
}

.sheet-desc {
  margin-bottom: 20px;
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.5;
}

.current-address-card {
  margin: 4px 0 14px;
  padding: 15px;
  background:
    linear-gradient(135deg, rgba(230,243,223,0.95), rgba(255,248,220,0.82));
  border: 1px solid rgba(29,91,59,0.16);
  border-radius: var(--radius);
}

.section-kicker {
  display: block;
  margin-bottom: 6px;
  color: var(--primary);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.8px;
  text-transform: uppercase;
}

.current-address-card p {
  color: var(--text);
  font-size: 16px;
  font-weight: 800;
  line-height: 1.35;
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}

.toggle-row:last-of-type {
  border-bottom: none;
}

.toggle-label {
  flex: 1;
}

.toggle-label-main {
  font-size: 15px;
  font-weight: 800;
}

.toggle-label-sub {
  margin-top: 2px;
  color: var(--text-secondary);
  font-size: 13px;
}

.time-subrow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0 12px 16px;
  border-bottom: 1px solid var(--border);
}

.time-subrow label {
  color: var(--text-secondary);
  font-size: 14px;
}

.time-subrow input[type="time"] {
  padding: 8px 12px;
  color: var(--text);
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  font-size: 15px;
}

.time-subrow input[type="time"]:focus {
  border-color: var(--primary);
}

.sheet-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 22px;
}

.toggle {
  position: relative;
  display: inline-block;
  width: 51px;
  height: 31px;
  flex-shrink: 0;
}

.toggle input {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
}

.toggle-track {
  position: absolute;
  inset: 0;
  cursor: pointer;
  background: #c8d5ce;
  border-radius: 31px;
  transition: background 0.2s ease;
}

.toggle input:checked ~ .toggle-track {
  background: var(--primary);
}

.toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 27px;
  height: 27px;
  background: white;
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(0,0,0,0.22);
  pointer-events: none;
  transition: transform 0.2s ease;
}

.toggle input:checked ~ .toggle-thumb {
  transform: translateX(20px);
}

.settings-group {
  overflow: hidden;
  margin-bottom: 14px;
  background: var(--surface-strong);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.settings-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 15px;
  color: var(--text);
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  text-align: left;
  transition: background 0.1s ease;
}

.settings-row:last-child {
  border-bottom: none;
}

.settings-row:active {
  background: var(--primary-bg);
}

.settings-row > svg:first-child {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  color: var(--primary);
}

.settings-row-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.settings-row-label {
  font-size: 15px;
  font-weight: 800;
}

.settings-row-hint {
  overflow: hidden;
  color: var(--text-secondary);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.settings-row-danger {
  color: var(--danger);
}

.settings-row-danger > svg:first-child {
  color: var(--danger);
}

.settings-row-link {
  color: var(--primary);
  text-decoration: none;
}

.settings-row-link > svg:first-child {
  color: var(--primary);
}

.state-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 42px 0;
}

.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.error-banner {
  margin-top: 4px;
  padding: 14px 15px;
  color: var(--danger);
  background: var(--danger-bg);
  border: 1px solid #f2c8c1;
  border-radius: var(--radius-sm);
  font-size: 14px;
  line-height: 1.5;
}

.error-banner a {
  color: var(--danger);
  text-decoration: underline;
}

@keyframes fade-bg {
  from {
    background: transparent;
    backdrop-filter: blur(0);
  }
}

@keyframes slide-up {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

@keyframes pop-in {
  from {
    opacity: 0;
    transform: scale(0.86);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-up {
  animation: fade-up 0.35s ease;
}

@media (min-width: 481px) {
  body {
    border-inline: 1px solid rgba(29,91,59,0.1);
  }
}
