/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-display);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-width: 430px;
  margin: 0 auto;
  position: relative;
}

#app-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding-bottom: var(--nav-height);
}

/* Screen transition */
.screen-enter {
  animation: screenIn 0.22s ease forwards;
}
@keyframes screenIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Stagger animation for child elements */
.stagger > * {
  opacity: 0;
  animation: staggerIn 0.25s ease forwards;
}
.stagger > *:nth-child(1) { animation-delay: 0s; }
.stagger > *:nth-child(2) { animation-delay: 0.05s; }
.stagger > *:nth-child(3) { animation-delay: 0.1s; }
.stagger > *:nth-child(4) { animation-delay: 0.15s; }
.stagger > *:nth-child(5) { animation-delay: 0.2s; }
.stagger > *:nth-child(6) { animation-delay: 0.25s; }
.stagger > *:nth-child(7) { animation-delay: 0.3s; }
.stagger > *:nth-child(8) { animation-delay: 0.35s; }
@keyframes staggerIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Top navigation */
.topnav {
  padding: 4px var(--content-pad) 14px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}
.back-btn {
  width: 32px;
  height: 32px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
  transition: background 0.15s;
}
.back-btn:active { background: var(--card-hi); }
.nav-title {
  flex: 1;
  font-family: var(--font-display);
  font-size: 17px;
  color: var(--text);
}

/* Section label */
.sec {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin: 14px 0 8px;
}

/* Card */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--card-radius);
  padding: 14px;
  margin-bottom: 10px;
}
.card:active { transform: scale(0.97); }

/* Pill badges */
.pill {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 3px 8px;
  border-radius: var(--pill-radius);
  text-transform: uppercase;
  display: inline-block;
}
.pill-green { background: rgba(78, 138, 90, 0.2); color: var(--green-lt); }
.pill-red   { background: rgba(168, 56, 56, 0.2); color: #E07070; }
.pill-amber { background: var(--amber-glow); color: var(--amber-lt); }
.pill-gray  { background: rgba(90, 70, 50, 0.25); color: var(--muted); }

/* CTA button */
.cta-wrap {
  padding: 14px var(--content-pad) 24px;
  flex-shrink: 0;
}
.cta-btn {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: var(--cta-radius);
  font-size: 16px;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  background: var(--amber);
  color: #0C0802;
  font-family: var(--font-display);
  cursor: pointer;
  transition: transform 0.1s;
}
.cta-btn:active { transform: scale(0.97); }
.cta-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Toggle switch */
.toggle {
  width: 40px;
  height: 24px;
  border-radius: 12px;
  background: var(--dim2);
  position: relative;
  cursor: pointer;
  transition: background 0.15s;
  flex-shrink: 0;
}
.toggle.on { background: var(--amber); }
.toggle-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background: #fff;
  border-radius: 50%;
  transition: left 0.15s;
}
.toggle.on .toggle-knob { left: 18px; }

/* Bottom nav */
.bottom-nav {
  height: var(--nav-height);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-around;
  background: var(--surface);
  flex-shrink: 0;
  padding-bottom: 10px;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
}
.nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  cursor: pointer;
  background: none;
  border: none;
}
.nav-lbl {
  font-size: 9px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  font-family: var(--font-display);
}
.nav-btn.active .nav-lbl { color: var(--amber); }

/* FAB */
.fab {
  width: 48px;
  height: 48px;
  background: var(--amber);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 18px rgba(200, 125, 16, 0.45);
  cursor: pointer;
  border: none;
  transition: transform 0.1s;
}
.fab:active { transform: scale(0.92); }

/* Input fields */
.input-field {
  width: 100%;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--input-radius);
  padding: 11px 14px;
  font-size: 14px;
  color: var(--text);
  font-family: var(--font-display);
  outline: none;
  transition: border-color 0.15s;
}
.input-field:focus { border-color: var(--amber); }
.input-field::placeholder { color: var(--muted); }

select.input-field {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%237A6040' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 30px;
}

textarea.input-field {
  resize: vertical;
  min-height: 60px;
  line-height: 1.5;
}

/* Alert banner */
.alert-banner {
  border-radius: var(--card-radius);
  padding: 13px 14px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.alert-banner.alert-red {
  background: rgba(168, 56, 56, 0.12);
  border: 1px solid rgba(168, 56, 56, 0.32);
}
.alert-banner.alert-green {
  background: rgba(78, 138, 90, 0.1);
  border: 1px solid rgba(78, 138, 90, 0.25);
}
.alert-banner.alert-teal {
  background: rgba(32, 136, 128, 0.1);
  border: 1px solid rgba(32, 136, 128, 0.3);
}
.alert-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Insight card */
.insight-card {
  border-radius: 12px;
  padding: 11px 13px;
  margin-bottom: 14px;
  display: flex;
  align-items: flex-start;
  gap: 9px;
}
.insight-card .insight-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 3px;
}

/* Progress bar */
.progress-bar {
  height: 3px;
  background: var(--dim);
  border-radius: 3px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(to right, var(--amber), var(--amber-lt));
  transition: width 0.3s ease;
}

/* Filter pills */
.filter-pills {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.filter-pills::-webkit-scrollbar { display: none; }
.filter-pill {
  padding: 6px 13px;
  border-radius: var(--pill-radius);
  font-size: 11px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--muted);
  white-space: nowrap;
  flex-shrink: 0;
  cursor: pointer;
}
.filter-pill.active {
  border-color: var(--border-hi);
  background: var(--amber-glow);
  color: var(--amber-lt);
  font-weight: 600;
}

/* Utility */
.text-center { text-align: center; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.mt-sm { margin-top: 8px; }
.mb-sm { margin-bottom: 8px; }
.mb-md { margin-bottom: 14px; }
