/* Card Optimizer - single stylesheet, mobile-first, no frameworks. */
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 17px;
  line-height: 1.55;
  color: #1c2733;
  background: #f4f6f8;
}
a { color: #0b5fa5; }
a:visited { color: #0b5fa5; }
.wrap { max-width: 760px; margin: 0 auto; padding: 0 14px; }

/* Header */
.site-header { background: #12324a; color: #fff; }
.header-row {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 16px;
  padding-top: 10px; padding-bottom: 10px;
}
.brand { color: #fff; font-size: 1.3rem; font-weight: 700; text-decoration: none; }
.brand:visited { color: #fff; }
.user-nav { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 0.95rem; }
.user-nav a { color: #cfe3f2; text-decoration: none; padding: 4px 0; }
.user-nav a:hover { color: #fff; text-decoration: underline; }

/* Household dropdown (no-JS details/summary). Desktop: the panel floats
   under the Household item. Mobile: it becomes an in-flow accordion so
   it can never overflow the right edge of a narrow screen. */
.user-nav details.nav-drop { position: relative; }
.user-nav details.nav-drop > summary {
  list-style: none; cursor: pointer; color: #cfe3f2; padding: 4px 0;
  display: inline-flex; align-items: center; gap: 4px;
}
.user-nav details.nav-drop > summary::-webkit-details-marker { display: none; }
.user-nav details.nav-drop > summary:hover { color: #fff; text-decoration: underline; }
.user-nav details.nav-drop > summary .caret { font-size: 0.75em; line-height: 1; }
.nav-drop-panel {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 50;
  min-width: 200px; max-width: calc(100vw - 28px);
  background: #12324a; border: 1px solid #2a4d68; border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .35); padding: 6px 0;
}
.nav-drop-panel a { display: block; padding: 8px 14px; }
.nav-drop-panel a:hover { background: #1b4568; text-decoration: none; }

/* Main */
main.wrap { padding-top: 16px; padding-bottom: 32px; }
h1 { font-size: 1.5rem; margin: 0 0 10px; }
h2 { font-size: 1.2rem; margin: 24px 0 8px; }
h3 { font-size: 1.05rem; margin: 16px 0 6px; }
p { margin: 8px 0; }
.muted { color: #5a6b7a; font-size: 0.92rem; }
.fineprint { font-size: 0.85rem; color: #5a6b7a; }

/* Forms */
label { display: block; margin: 12px 0 4px; font-weight: 600; }
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], select, textarea {
  width: 100%; padding: 11px 10px; font-size: 1rem;
  border: 1px solid #b6c2cd; border-radius: 8px; background: #fff; color: #1c2733;
}
textarea { min-height: 70px; resize: vertical; }
input[type=checkbox] { width: 20px; height: 20px; vertical-align: middle; }
fieldset { border: 1px solid #d4dde4; border-radius: 8px; padding: 8px 12px 12px; margin: 14px 0; }
legend { font-weight: 700; padding: 0 6px; }
.radio-row { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 6px 0; }
.radio-row label { display: inline; font-weight: 400; margin: 0; }
button, .btn {
  display: inline-block; padding: 12px 20px; margin: 12px 0 0;
  font-size: 1rem; font-weight: 600; color: #fff; background: #0b5fa5;
  border: 0; border-radius: 8px; cursor: pointer; text-decoration: none;
}
button:hover, .btn:hover { background: #094e87; }
.btn-secondary { background: #5a6b7a; }
.btn-secondary:hover { background: #485763; }
.btn-danger { background: #a83226; }
.btn-danger:hover { background: #8d2a20; }
.btn-small { padding: 7px 12px; font-size: 0.9rem; margin: 4px 0; }
.form-error { color: #a83226; font-weight: 600; }
.form-ok { color: #1e6b34; font-weight: 600; }
.stacked-form { background: #fff; border: 1px solid #d4dde4; border-radius: 10px; padding: 4px 14px 16px; margin: 14px 0; }

/* Result / list cards */
.card {
  background: #fff; border: 1px solid #d4dde4; border-radius: 10px;
  padding: 12px 14px; margin: 12px 0;
}
.card.best { border: 2px solid #1e6b34; }
.card h3 { margin-top: 0; }
.best-badge {
  display: inline-block; background: #1e6b34; color: #fff;
  font-size: 0.8rem; font-weight: 700; padding: 2px 8px; border-radius: 20px;
  margin-left: 6px; vertical-align: middle;
}
.earn { font-size: 1.25rem; font-weight: 700; margin: 6px 0 2px; }
.why { margin: 2px 0; }
.perk-line { font-size: 0.92rem; color: #33506b; margin: 4px 0; }
.tag {
  display: inline-block; background: #e6eef5; color: #33506b;
  font-size: 0.8rem; padding: 2px 8px; border-radius: 20px; margin: 2px 4px 2px 0;
}
.tag.warn { background: #fdf0d5; color: #7a4d00; }
.tag.bad { background: #fbe3e0; color: #8d2a20; }
.alert {
  background: #fdf0d5; border: 1px solid #e8c87a; border-radius: 10px;
  padding: 10px 14px; margin: 14px 0;
}
.alert strong { color: #7a4d00; }
table.data { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
table.data th, table.data td { text-align: left; padding: 8px 6px; border-bottom: 1px solid #d4dde4; vertical-align: top; }
table.data th { background: #e6eef5; }
@media (max-width: 560px) {
  table.data, table.data tbody, table.data tr, table.data td { display: block; width: 100%; }
  table.data thead { display: none; }
  table.data tr { border-bottom: 2px solid #d4dde4; padding: 6px 0; }
  table.data td { border-bottom: 0; padding: 2px 0; }
  table.data td::before { content: attr(data-label) ": "; font-weight: 700; }
  /* Household dropdown: in-flow accordion instead of a floating panel. */
  .nav-drop-panel {
    position: static; min-width: 0; max-width: none; width: 100%;
    box-shadow: none; border: 0; border-top: 1px solid #2a4d68;
    border-radius: 0; padding: 4px 0 6px;
  }
}
.row-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; }
.row-actions form { margin: 0; }
.inline-form { display: inline; }
.inline-form button { margin: 0; }

/* Footer */
.site-footer { border-top: 1px solid #d4dde4; padding: 14px 0 28px; font-size: 0.88rem; color: #5a6b7a; }
.site-footer a { color: #5a6b7a; }
.site-footer a:hover { color: #1c2733; }

/* Landing page (public, anonymous visitors only). Scoped to .landing-*
   classes so the logged-in app is unaffected. */
.landing-hero {
  background: #12324a;
  color: #fff;
  margin: -16px -14px 0;
  padding: 36px 14px 34px;
}
.landing-hero h1 {
  font-size: 2rem;
  line-height: 1.2;
  margin: 0 0 12px;
  color: #fff;
}
.landing-hero-sub {
  font-size: 1.1rem;
  color: #cfe3f2;
  margin: 0 0 22px;
  max-width: 560px;
}
.landing-hero-actions {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px;
  margin: 0;
}
.landing-hero-actions .btn { margin: 0; }
.landing-hero-cta {
  background: #1e6b34;
  padding: 14px 26px;
  font-size: 1.1rem;
}
.landing-hero-cta:hover { background: #175628; }
.landing-hero-login { color: #cfe3f2; font-size: 0.95rem; }
.landing-hero-login:visited { color: #cfe3f2; }
.landing-hero-login:hover { color: #fff; }

.landing-demo { margin-top: 28px; }
.landing-demo h2, .landing-features h2, .landing-cta h2 { font-size: 1.35rem; }

.landing-features { margin-top: 28px; }
.landing-feature-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr;
}
.landing-feature {
  background: #fff;
  border: 1px solid #d4dde4;
  border-top: 4px solid #0b5fa5;
  border-radius: 10px;
  padding: 14px 16px;
}
.landing-feature:nth-child(1) { border-top-color: #12324a; }
.landing-feature:nth-child(3) { border-top-color: #1e6b34; }
.landing-feature h3 { margin: 0 0 6px; }
.landing-feature p { margin: 0; font-size: 0.95rem; }

.landing-cta {
  text-align: center;
  margin-top: 32px;
  padding: 26px 14px 8px;
  border-top: 1px solid #d4dde4;
}
.landing-cta .btn { margin: 4px 6px; }

@media (min-width: 561px) {
  .landing-hero h1 { font-size: 2.3rem; }
  .landing-feature-grid { grid-template-columns: repeat(3, 1fr); }
}
