/* === SHARED APP NAV === */
.app-body { background: var(--bg); }

.app-nav {
  background: var(--white);
  border-bottom: 1px solid rgba(27,67,50,0.1);
  padding: 0 32px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.app-nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.app-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}
.app-logo-text {
  font-family: 'Fraunces', serif;
  font-weight: 600;
  font-size: 1rem;
  color: var(--green);
}
.app-nav-links {
  display: flex;
  align-items: center;
  gap: 24px;
}
.nav-link {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--fg-muted);
  text-decoration: none;
  padding: 4px 0;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}
.nav-link:hover, .nav-link--active {
  color: var(--green);
  border-bottom-color: var(--gold);
}
.nav-link--active { color: var(--green); font-weight: 600; }

/* === SHARED BUTTONS === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: var(--radius-sm);
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
  border: none;
}
.btn--primary {
  background: var(--green);
  color: var(--bg);
  padding: 12px 24px;
  font-size: 0.9rem;
}
.btn--primary:hover { background: var(--green-light); transform: translateY(-1px); }
.btn--primary:active { transform: translateY(0); }
.btn--outline {
  background: transparent;
  color: var(--green);
  border: 2px solid var(--green);
  padding: 10px 22px;
  font-size: 0.9rem;
}
.btn--outline:hover { background: var(--green); color: var(--bg); }
.btn--ghost {
  background: transparent;
  color: var(--fg-muted);
  border: none;
  padding: 10px 16px;
  font-size: 0.88rem;
}
.btn--ghost:hover { color: var(--fg); }
.btn--sm { padding: 8px 16px; font-size: 0.82rem; }
.btn--lg { padding: 14px 28px; font-size: 0.95rem; }
.btn--block { width: 100%; }

/* === DISCOVER HEADER === */
.discover-header {
  background: var(--bg);
  border-bottom: 1px solid rgba(27,67,50,0.08);
  padding: 56px 32px 48px;
}
.discover-header-inner {
  max-width: 1100px;
  margin: 0 auto;
}
.vertical-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(27,67,50,0.08);
  border: 1px solid rgba(27,67,50,0.15);
  color: var(--green);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 20px;
  margin-bottom: 16px;
}
.discover-title {
  font-family: 'Fraunces', serif;
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  font-weight: 700;
  color: var(--green);
  margin-bottom: 12px;
  line-height: 1.1;
}
.discover-sub {
  font-size: 1rem;
  color: var(--fg-muted);
  max-width: 560px;
  line-height: 1.7;
  margin-bottom: 28px;
}

/* === GRANTS GRID === */
.grants-main { padding: 48px 32px 64px; }
.grants-container { max-width: 1100px; margin: 0 auto; }

.grants-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 28px;
  margin-bottom: 56px;
}

.grant-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 24px;
  border: 1px solid rgba(27,67,50,0.08);
  box-shadow: 0 2px 12px rgba(27,67,50,0.06);
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: box-shadow 0.2s, transform 0.2s;
}
.grant-card:hover {
  box-shadow: 0 6px 24px rgba(27,67,50,0.12);
  transform: translateY(-2px);
}

.grant-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}
.grant-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.grant-tag {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: rgba(27,67,50,0.07);
  color: var(--green);
  padding: 3px 8px;
  border-radius: 4px;
}
.grant-deadline {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  color: var(--fg-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.grant-name {
  font-family: 'Fraunces', serif;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--fg);
  line-height: 1.3;
}
.grant-funder { font-size: 0.82rem; color: var(--fg-muted); }
.grant-award {
  font-size: 1rem;
  color: var(--green);
  font-weight: 600;
}
.grant-divider {
  height: 1px;
  background: rgba(27,67,50,0.08);
  margin: 4px 0;
}
.grant-summary { font-size: 0.88rem; color: var(--fg-muted); line-height: 1.6; }
.grant-criteria { background: rgba(27,67,50,0.04); border-radius: var(--radius-sm); padding: 12px; }
.criteria-label { font-size: 0.75rem; font-weight: 600; color: var(--green); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 6px; }
.criteria-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.criteria-list li {
  font-size: 0.8rem;
  color: var(--fg-muted);
  padding-left: 12px;
  position: relative;
  line-height: 1.5;
}
.criteria-list li::before {
  content: '•';
  position: absolute;
  left: 0;
  color: var(--gold);
  font-weight: 700;
}

/* === QUIZ CTA BAR === */
.quiz-cta-bar {
  background: var(--green);
  border-radius: var(--radius);
  padding: 36px 40px;
}
.quiz-cta-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
}
.quiz-cta-text h3 {
  font-family: 'Fraunces', serif;
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--bg);
  margin-bottom: 8px;
}
.quiz-cta-text p { font-size: 0.9rem; color: rgba(245,240,232,0.75); }
.quiz-cta-bar .btn--primary {
  background: var(--gold);
  color: var(--green);
  white-space: nowrap;
}

/* === QUIZ PAGE === */
.quiz-main { min-height: calc(100vh - 64px); padding: 56px 32px; }
.quiz-container { max-width: 640px; margin: 0 auto; }

.quiz-intro { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 20px; }
.quiz-icon { margin-bottom: 4px; }
.quiz-title {
  font-family: 'Fraunces', serif;
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  font-weight: 700;
  color: var(--green);
  line-height: 1.15;
}
.quiz-desc { font-size: 1rem; color: var(--fg-muted); line-height: 1.7; max-width: 480px; }

.quiz-steps-preview {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
  margin: 8px 0;
}
.step-preview {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--fg-muted);
  background: rgba(27,67,50,0.06);
  padding: 6px 14px;
  border-radius: 20px;
}
.step-preview-num {
  width: 20px;
  height: 20px;
  background: var(--green);
  color: var(--bg);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
}

/* Quiz Form */
.quiz-form {
  flex-direction: column;
  gap: 0;
}
.quiz-step {
  display: none;
  flex-direction: column;
  gap: 20px;
  background: var(--white);
  border-radius: var(--radius);
  padding: 36px 40px;
  border: 1px solid rgba(27,67,50,0.08);
  box-shadow: 0 2px 16px rgba(27,67,50,0.07);
}
.quiz-step.active { display: flex; }

.step-progress {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--fg-muted);
  letter-spacing: 0.05em;
}
.step-current { color: var(--green); font-family: 'Fraunces', serif; font-size: 1.1rem; }
.step-question {
  font-family: 'Fraunces', serif;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--fg);
  line-height: 1.3;
}

.step-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.step-options--3 { display: grid; grid-template-columns: repeat(3, 1fr); }
.step-options--4 { display: grid; grid-template-columns: repeat(4, 1fr); }
.step-options--2 { display: grid; grid-template-columns: repeat(2, 1fr); }
.step-select {
  width: 100%;
  padding: 12px 16px;
  font-size: 0.92rem;
  font-family: 'Plus Jakarta Sans', sans-serif;
  border: 2px solid rgba(27,67,50,0.15);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--fg);
  cursor: pointer;
  transition: border-color 0.15s;
}
.step-select:focus { outline: none; border-color: var(--green); }

/* Option Cards */
.option-card {
  display: flex;
  align-items: center;
  cursor: pointer;
}
.option-card input[type="radio"] { display: none; }
.option-card input[type="radio"] + .option-label {
  display: block;
  width: 100%;
  padding: 14px 18px;
  background: var(--bg);
  border: 2px solid rgba(27,67,50,0.12);
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--fg);
  transition: all 0.15s;
}
.option-card input[type="radio"]:checked + .option-label {
  border-color: var(--green);
  background: rgba(27,67,50,0.05);
  color: var(--green);
  font-weight: 600;
}
.option-card:hover input[type="radio"] + .option-label { border-color: var(--green-light); }

/* Loading */
.quiz-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  text-align: center;
  padding: 80px 40px;
}
.loading-spinner {
  width: 56px;
  height: 56px;
  border: 4px solid rgba(27,67,50,0.12);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-title {
  font-family: 'Fraunces', serif;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--green);
}
.loading-desc { font-size: 0.95rem; color: var(--fg-muted); max-width: 400px; }

/* Results */
.quiz-results { display: flex; flex-direction: column; gap: 24px; }
.results-header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  background: var(--white);
  border-radius: var(--radius);
  padding: 28px 32px;
  border: 1px solid rgba(27,67,50,0.08);
}
.results-title {
  font-family: 'Fraunces', serif;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--green);
  margin-bottom: 4px;
}
.results-sub { font-size: 0.85rem; color: var(--fg-muted); }

.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.result-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 24px;
  border: 1px solid rgba(27,67,50,0.08);
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 2px 12px rgba(27,67,50,0.06);
}
.result-card-header { display: flex; align-items: center; justify-content: space-between; }
.result-num {
  font-family: 'Fraunces', serif;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--gold);
  background: rgba(212,168,83,0.1);
  padding: 3px 10px;
  border-radius: 20px;
}
.result-score { display: flex; align-items: center; gap: 8px; font-size: 0.8rem; font-weight: 600; }
.score-bar { width: 60px; height: 5px; background: rgba(27,67,50,0.1); border-radius: 4px; overflow: hidden; }
.score-fill { height: 100%; border-radius: 4px; transition: width 0.6s ease; }
.score--high .score-fill { background: var(--green); }
.score--mid .score-fill { background: var(--gold); }
.score--low .score-fill { background: #aaa; }
.score--high { color: var(--green); }
.score--mid { color: var(--gold); }
.score--low { color: #888; }

.result-name {
  font-family: 'Fraunces', serif;
  font-size: 1rem;
  font-weight: 600;
  color: var(--fg);
  line-height: 1.3;
}
.result-funder { font-size: 0.8rem; color: var(--fg-muted); }
.result-award { font-size: 0.9rem; color: var(--green); font-weight: 600; }
.result-reason {
  font-size: 0.85rem;
  color: var(--fg-muted);
  line-height: 1.6;
  background: rgba(27,67,50,0.03);
  padding: 10px 12px;
  border-radius: 6px;
  border-left: 3px solid var(--gold);
}
.result-deadline {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.78rem;
  color: var(--fg-muted);
}
.result-apply { margin-top: 4px; }

.results-footer { text-align: center; padding-top: 8px; }

/* === FOOTER === */
.app-footer { background: var(--bg-alt); border-top: 1px solid rgba(27,67,50,0.1); padding: 32px 0; }
.app-footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.82rem;
  color: var(--fg-muted);
}
.app-footer-inner a { color: var(--green); text-decoration: none; }
.app-footer-inner a:hover { text-decoration: underline; }

/* === INDUSTRY SELECTOR === */
.discover-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 20px;
}
.industry-form {
  display: flex;
  align-items: center;
  gap: 10px;
}
.industry-label {
  font-size: 0.82rem;
  color: var(--fg-muted);
  font-weight: 500;
  white-space: nowrap;
}
.industry-select {
  padding: 8px 14px;
  font-size: 0.88rem;
  font-family: 'Plus Jakarta Sans', sans-serif;
  border: 2px solid rgba(27,67,50,0.15);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--fg);
  cursor: pointer;
  transition: border-color 0.15s;
}
.industry-select:focus { outline: none; border-color: var(--green); }

.saved-count {
  font-size: 0.82rem;
  color: var(--green);
  font-weight: 600;
  background: rgba(27,67,50,0.07);
  padding: 3px 10px;
  border-radius: 12px;
}

/* === SAVE GRANT BUTTON === */
.grant-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}
.grant-saved-badge {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--green);
  color: var(--bg);
  padding: 3px 8px;
  border-radius: 4px;
}
.grant-card--saved {
  border-color: rgba(27,67,50,0.2);
}
.grant-card-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 4px;
}
.grant-card-actions .btn--outline {
  flex: 1;
}
.grant-save-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  background: transparent;
  border: 2px solid rgba(27,67,50,0.15);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 0.82rem;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 600;
  color: var(--fg-muted);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.grant-save-btn:hover { border-color: var(--green); color: var(--green); }
.grant-save-btn.saved {
  background: rgba(27,67,50,0.07);
  border-color: var(--green);
  color: var(--green);
}

.btn--saved {
  background: rgba(27,67,50,0.07) !important;
  border-color: var(--green) !important;
  color: var(--green) !important;
}

/* === DETAIL PAGE === */
.detail-main { padding: 40px 32px 80px; }
.detail-container { max-width: 960px; margin: 0 auto; }
.detail-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--fg-muted);
  font-size: 0.88rem;
  font-weight: 500;
  text-decoration: none;
  margin-bottom: 28px;
  transition: color 0.15s;
}
.detail-back:hover { color: var(--green); }

.detail-header {
  background: var(--white);
  border-radius: var(--radius);
  padding: 36px 40px;
  border: 1px solid rgba(27,67,50,0.08);
  margin-bottom: 24px;
}
.detail-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.detail-title {
  font-family: 'Fraunces', serif;
  font-size: clamp(1.5rem, 3vw, 2.1rem);
  font-weight: 700;
  color: var(--green);
  line-height: 1.2;
  margin-bottom: 8px;
}
.detail-funder { font-size: 0.95rem; color: var(--fg-muted); margin-bottom: 16px; }
.detail-award {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 1rem;
  color: var(--fg);
  font-weight: 600;
}
.detail-award strong { color: var(--green); font-size: 1.1rem; }

.detail-actions {
  display: flex;
  gap: 12px;
  margin-bottom: 32px;
  flex-wrap: wrap;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 28px;
  align-items: start;
}

.detail-body { display: flex; flex-direction: column; gap: 32px; }

.detail-section { background: var(--white); border-radius: var(--radius); padding: 28px 32px; border: 1px solid rgba(27,67,50,0.08); }
.detail-section-title {
  font-family: 'Fraunces', serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--green);
  margin-bottom: 16px;
}
.detail-overview { font-size: 0.92rem; color: var(--fg); line-height: 1.7; }
.detail-criteria-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}
.detail-criteria-list li {
  font-size: 0.88rem;
  color: var(--fg);
  padding: 10px 14px;
  background: rgba(27,67,50,0.04);
  border-radius: 6px;
  border-left: 3px solid var(--gold);
}
.detail-meta-block { margin-top: 12px; }
.detail-meta-label { font-size: 0.78rem; font-weight: 600; color: var(--fg-muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 4px; }
.detail-meta-value { font-size: 0.88rem; color: var(--fg); }

/* Sidebar */
.detail-sidebar { display: flex; flex-direction: column; gap: 20px; }
.detail-dates-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 24px 28px;
  border: 1px solid rgba(27,67,50,0.08);
}
.dates-card-title {
  font-family: 'Fraunces', serif;
  font-size: 1rem;
  font-weight: 700;
  color: var(--green);
  margin-bottom: 20px;
}
.dates-list { display: flex; flex-direction: column; gap: 0; }
.dates-item { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; }
.dates-label { font-size: 0.78rem; font-weight: 600; color: var(--fg-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.dates-value { font-size: 0.88rem; color: var(--fg); font-weight: 500; text-align: right; }
.dates-divider { height: 1px; background: rgba(27,67,50,0.08); }

.detail-cta-card {
  background: var(--green);
  border-radius: var(--radius);
  padding: 24px 28px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.detail-cta-text { font-size: 0.9rem; color: rgba(245,240,232,0.8); font-weight: 500; }
.detail-cta-card .btn--primary { background: var(--gold); color: var(--green); }

/* 404 & Not Found */
.not-found { text-align: center; padding: 80px 40px; }
.not-found h1 { font-family: 'Fraunces', serif; font-size: 2rem; color: var(--green); margin-bottom: 12px; }
.not-found p { font-size: 1rem; color: var(--fg-muted); }
.not-found a { color: var(--green); font-weight: 600; }

/* Results empty state */
.results-empty { text-align: center; padding: 48px 32px; background: var(--white); border-radius: var(--radius); border: 1px solid rgba(27,67,50,0.08); }
.results-empty p { font-size: 0.95rem; color: var(--fg-muted); margin-bottom: 20px; }

/* === RESPONSIVE === */
@media (max-width: 900px) {
  .grants-grid { grid-template-columns: 1fr; }
  .quiz-cta-inner { flex-direction: column; text-align: center; }
  .step-options--3 { grid-template-columns: 1fr; }
  .results-grid { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .discover-header { padding: 40px 20px 32px; }
  .grants-main { padding: 32px 20px 48px; }
  .quiz-main { padding: 40px 20px; }
  .quiz-step { padding: 24px 20px; }
  .app-footer-inner { flex-direction: column; gap: 8px; text-align: center; }
}