/* ============================================================
   SAVIVE — Plain Language UI
   Mobile-first · Warm · Accessible
   ============================================================ */

/* ── Variables ── */
:root {
  --green:          #007A4D;
  --green-light:    #e8f7f0;
  --green-dark:     #005c3a;
  --gold:           #FFB612;
  --gold-light:     #fff8e1;
  --red:            #DE3831;
  --red-light:      #fdecea;
  --orange:         #e8850a;
  --orange-light:   #fff3e0;
  --blue:           #1a6bbf;
  --blue-light:     #e8f2ff;

  --bg:             #faf9f7;
  --bg-card:        #ffffff;
  --bg-muted:       #f3f1ee;

  --text:           #1c1c1c;
  --text-secondary: #555;
  --text-muted:     #888;
  --border:         #e8e4df;
  --border-strong:  #ccc8c2;

  --shadow-sm:  0 1px 4px rgba(0,0,0,0.07);
  --shadow-md:  0 3px 12px rgba(0,0,0,0.10);
  --shadow-lg:  0 6px 24px rgba(0,0,0,0.13);

  --radius-sm:  8px;
  --radius-md:  12px;
  --radius-lg:  18px;

  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

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

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--green); text-decoration: underline; }
a:hover { color: var(--green-dark); }

button { cursor: pointer; font-family: var(--font); border: none; background: none; }

img { max-width: 100%; }

/* ── Flag Stripe ── */
.flag-stripe {
  height: 5px;
  background: linear-gradient(90deg, #007A4D 0%, #007A4D 20%, #FFB612 20%, #FFB612 40%, #DE3831 40%, #DE3831 60%, #002395 60%, #002395 80%, #000 80%);
}

/* ── Header ── */
.app-header {
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 12px 16px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.header-inner {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 160px;
}

.header-logo-icon {
  width: 38px;
  height: 38px;
  background: var(--green);
  color: #fff;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: -0.5px;
  flex-shrink: 0;
}

.header-logo-text h1 {
  font-size: 1.15rem;
  font-weight: 900;
  color: var(--text);
  line-height: 1.1;
  letter-spacing: -0.5px;
}

.header-logo-text p {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.2;
}

.countdown-banner {
  background: var(--green);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 5px 14px;
  border-radius: 999px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  line-height: 1.3;
  max-width: 340px;
}
.countdown-icon { font-size: 0.9rem; flex-shrink: 0; }
.countdown-days {
  background: rgba(255,255,255,0.25);
  border-radius: 999px;
  padding: 1px 8px;
  font-size: 0.72rem;
  white-space: nowrap;
}

/* ── Tab Navigation ── */
.tab-nav {
  background: #fff;
  border-bottom: 2px solid var(--border);
  position: sticky;
  top: 63px;
  z-index: 90;
}

.tab-nav-inner {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
}

.tab-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 10px 6px 8px;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 3px solid transparent;
  transition: all 0.15s ease;
  white-space: nowrap;
  line-height: 1.2;
}

.tab-btn-icon { font-size: 1.3rem; line-height: 1; }
.tab-btn-label { font-size: 0.68rem; }

.tab-btn:hover { color: var(--text); background: var(--bg-muted); }

.tab-btn.active {
  color: var(--green);
  border-bottom-color: var(--green);
  background: var(--green-light);
}

@media (min-width: 480px) {
  .tab-btn { font-size: 0.78rem; padding: 12px 8px 9px; }
  .tab-btn-label { font-size: 0.76rem; }
}

@media (min-width: 640px) {
  .tab-btn { flex-direction: row; gap: 6px; padding: 14px 16px; }
  .tab-btn-icon { font-size: 1.1rem; }
  .tab-btn-label { font-size: 0.85rem; }
}

/* ── Tab Panels ── */
.tab-panel { display: none; }
.tab-panel.active { display: block; }

main {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 12px 40px;
}

@media (min-width: 640px) {
  main { padding: 0 20px 60px; }
}

/* ── Loading ── */
.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 60px 20px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

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

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

/* ── Cards ── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px;
  box-shadow: var(--shadow-sm);
}

.card + .card { margin-top: 12px; }

/* ── Section headings ── */
.section-heading {
  padding: 24px 0 10px;
}

.section-heading h2 {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.3px;
}

.section-heading p {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* ── Status Banner (big colored bar at top) ── */
.status-banner {
  border-radius: var(--radius-lg);
  padding: 20px 18px;
  margin: 16px 0;
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.status-banner.red    { background: var(--red-light);    border: 2px solid #f5c6c5; }
.status-banner.orange { background: var(--orange-light); border: 2px solid #ffd8a8; }
.status-banner.green  { background: var(--green-light);  border: 2px solid #a3d9be; }

.status-banner-icon { font-size: 2rem; line-height: 1; flex-shrink: 0; }

.status-banner-body {}

.status-banner-title {
  font-size: 1.05rem;
  font-weight: 800;
  line-height: 1.3;
  color: var(--text);
}

.status-banner.red    .status-banner-title { color: #8b1c18; }
.status-banner.orange .status-banner-title { color: #7a4000; }
.status-banner.green  .status-banner-title { color: var(--green-dark); }

.status-banner-sub {
  font-size: 0.83rem;
  color: var(--text-secondary);
  margin-top: 4px;
  line-height: 1.5;
}

/* ── Verdict Cards (traffic light) ── */
.verdict-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-bottom: 20px;
}

@media (min-width: 480px) { .verdict-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 720px) { .verdict-grid { grid-template-columns: 1fr 1fr 1fr; } }

.verdict-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  border-left: 5px solid var(--border-strong);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.verdict-card.red    { border-left-color: var(--red); }
.verdict-card.orange { border-left-color: var(--orange); }
.verdict-card.green  { border-left-color: var(--green); }

.verdict-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.verdict-value {
  font-size: 1.6rem;
  font-weight: 900;
  color: var(--text);
  line-height: 1.1;
  letter-spacing: -1px;
}

.verdict-status {
  font-size: 0.78rem;
  font-weight: 700;
  margin-top: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  display: inline-block;
}

.verdict-card.red    .verdict-status { background: var(--red-light);    color: var(--red); }
.verdict-card.orange .verdict-status { background: var(--orange-light); color: var(--orange); }
.verdict-card.green  .verdict-status { background: var(--green-light);  color: var(--green); }

.verdict-meaning {
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* ── Verdict sparklines ── */
.sparkline-wrap {
  margin: 6px 0 2px;
}
.verdict-sparkline {
  width: 100% !important;
  height: 60px !important;
  display: block;
}
.sparkline-caption {
  display: block;
  font-size: 0.65rem;
  color: var(--text-muted);
  text-align: right;
  margin-top: 2px;
  opacity: 0.8;
  line-height: 1.2;
}

/* ── Timeline ── */
.timeline { padding: 4px 0; }

.timeline-item {
  display: flex;
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.timeline-item:last-child { border-bottom: none; }

.timeline-dot-col { display: flex; flex-direction: column; align-items: center; gap: 4px; }

.timeline-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--border-strong);
  margin-top: 3px;
}

.timeline-item.past     .timeline-dot { background: var(--text-muted); }
.timeline-item.active   .timeline-dot { background: var(--red); box-shadow: 0 0 0 3px var(--red-light); }
.timeline-item.upcoming .timeline-dot { background: var(--orange); }
.timeline-item.future   .timeline-dot { background: var(--border-strong); }

.timeline-date {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-bottom: 2px;
}

.timeline-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}

.timeline-item.active .timeline-title { color: var(--red); }

.timeline-desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 2px;
  line-height: 1.4;
}

/* ── Province Selector ── */
.province-selector-wrap {
  margin-bottom: 16px;
}

.province-selector-wrap label {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.province-select {
  width: 100%;
  padding: 10px 14px;
  font-size: 0.95rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text);
  font-family: var(--font);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M0 0l6 8 6-8z' fill='%23888'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

.province-result {
  margin-top: 12px;
}

.province-stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}

@media (min-width: 480px) { .province-stat-grid { grid-template-columns: repeat(3, 1fr); } }

.province-stat {
  background: var(--bg-muted);
  border-radius: var(--radius-sm);
  padding: 12px;
  text-align: center;
}

.province-stat-val {
  font-size: 1.2rem;
  font-weight: 900;
  color: var(--text);
  letter-spacing: -0.5px;
}

.province-stat-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ── Quick Action Buttons ── */
.action-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 20px;
}

@media (min-width: 600px) { .action-grid { grid-template-columns: repeat(3, 1fr); } }

.action-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 12px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.action-btn:hover {
  border-color: var(--green);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.action-btn-icon { font-size: 1.8rem; line-height: 1; }

.action-btn-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}

.action-btn-sub {
  font-size: 0.7rem;
  color: var(--text-muted);
  line-height: 1.3;
}

/* ── Journey Steps (oil → food story) ── */
.journey-wrap {
  margin-bottom: 8px;
}

.journey-step {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.journey-step:last-child { border-bottom: none; }

.journey-icon {
  font-size: 1.8rem;
  flex-shrink: 0;
  width: 44px;
  text-align: center;
}

.journey-body {}

.journey-title {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1.2;
}

.journey-text {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-top: 3px;
  line-height: 1.5;
}

.journey-arrow {
  font-size: 1.2rem;
  color: var(--text-muted);
  text-align: center;
  padding: 2px 0;
  flex-shrink: 0;
  width: 44px;
}

/* ── Before/After Comparison ── */
.before-after {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  margin: 16px 0;
}

@media (max-width: 480px) {
  .before-after {
    grid-template-columns: 1fr;
    gap: 4px;
  }
  .bfa-arrow { display: none; }
}

.bfa-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  text-align: center;
}

.bfa-card.past     { border-top: 3px solid var(--text-muted); }
.bfa-card.now      { border-top: 3px solid var(--green); background: var(--green-light); }
.bfa-card.future   { border-top: 3px solid var(--red); background: var(--red-light); }

.bfa-period {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.bfa-amount {
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--text);
  letter-spacing: -1px;
  margin: 4px 0;
}

.bfa-card.now    .bfa-amount { color: var(--green-dark); }
.bfa-card.future .bfa-amount { color: var(--red); }

.bfa-note {
  font-size: 0.72rem;
  color: var(--text-secondary);
  line-height: 1.3;
}

.bfa-arrow { font-size: 1.5rem; color: var(--text-muted); text-align: center; }

.bfa-diff {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  display: inline-block;
  margin-top: 4px;
}

.bfa-card.now    .bfa-diff { background: #d4edda; color: var(--green-dark); }
.bfa-card.future .bfa-diff { background: var(--red-light); color: var(--red); }

/* ── Household size buttons ── */
.household-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  padding: 14px;
  background: var(--bg-muted);
  border-radius: var(--radius-md);
}

.household-row label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.household-btn {
  padding: 7px 14px;
  font-size: 0.85rem;
  font-weight: 700;
  border: 2px solid var(--border-strong);
  border-radius: 999px;
  background: var(--bg-card);
  color: var(--text-secondary);
  transition: all 0.15s;
}

.household-btn:hover { border-color: var(--green); color: var(--green); }
.household-btn.active { background: var(--green); border-color: var(--green); color: #fff; }

/* ── Grocery Item Cards ── */
.grocery-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-bottom: 20px;
}

@media (min-width: 480px) { .grocery-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 720px) { .grocery-grid { grid-template-columns: repeat(4, 1fr); } }

.grocery-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  cursor: pointer;
  transition: box-shadow 0.15s;
}

.grocery-item:hover { box-shadow: var(--shadow-md); }

.grocery-item-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.grocery-emoji { font-size: 1.5rem; }

.grocery-name {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}

.grocery-price-now {
  font-size: 1.15rem;
  font-weight: 900;
  color: var(--text);
  letter-spacing: -0.5px;
}

.grocery-qty-line {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-secondary);
  margin-top: 1px;
}

.grocery-was {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.grocery-diff {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--red);
  margin-top: 2px;
}

.grocery-detail {
  display: none;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.grocery-item.expanded .grocery-detail { display: block; }

.grocery-price-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 4px 0;
  font-size: 0.82rem;
  border-bottom: 1px solid var(--border);
}

.grocery-price-row:last-child { border-bottom: none; }
.grocery-price-row span:first-child { color: var(--text-secondary); }
.grocery-price-row span:last-child  { font-weight: 700; color: var(--text); }

.grocery-price-row.projected span:last-child { color: var(--red); }

/* ── Callout box ── */
.callout {
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
}

.callout.green  { background: var(--green-light); border: 1px solid #a3d9be; }
.callout.red    { background: var(--red-light);   border: 1px solid #f5c6c5; }
.callout.orange { background: var(--orange-light); border: 1px solid #ffd8a8; }
.callout.blue   { background: var(--blue-light);   border: 1px solid #b3d1f5; }
.callout.gold   { background: var(--gold-light);   border: 1px solid #ffe082; }

.callout-icon { font-size: 1.5rem; flex-shrink: 0; }

.callout-title {
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 3px;
}

.callout-text {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ── Chart container ── */
.chart-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 16px;
}

.chart-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.chart-toggle-row {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.chart-toggle-btn {
  padding: 5px 12px;
  font-size: 0.78rem;
  font-weight: 600;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--bg-muted);
  color: var(--text-secondary);
  transition: all 0.15s;
}

.chart-toggle-btn.active {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}

/* ── Electricity Tariff Cards ── */
.elec-stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}

@media (min-width: 480px) { .elec-stat-grid { grid-template-columns: repeat(4, 1fr); } }

.elec-stat {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  text-align: center;
}

.elec-stat-val {
  font-size: 1.3rem;
  font-weight: 900;
  color: var(--text);
  letter-spacing: -0.5px;
}

.elec-stat-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 3px;
  line-height: 1.3;
}

/* ── Survival Sub-tabs ── */
.help-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 16px 0;
}

@media (min-width: 480px) { .help-tabs { grid-template-columns: repeat(4, 1fr); } }

.help-tab-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 12px 8px;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;
  line-height: 1.2;
}

.help-tab-btn-icon { font-size: 1.5rem; }

.help-tab-btn:hover { border-color: var(--green); color: var(--green); }

.help-tab-btn.active {
  border-color: var(--green);
  background: var(--green-light);
  color: var(--green-dark);
}

/* ── Stockpile controls ── */
.stockpile-controls {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-bottom: 16px;
  padding: 14px;
  background: var(--bg-muted);
  border-radius: var(--radius-md);
}

@media (min-width: 480px) { .stockpile-controls { grid-template-columns: 1fr 1fr 1fr; } }

.stockpile-control-group label {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 5px;
}

.stockpile-control-group select {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  background: var(--bg-card);
  color: var(--text);
  font-family: var(--font);
}

.stockpile-total {
  background: var(--green);
  color: #fff;
  border-radius: var(--radius-md);
  padding: 16px 18px;
  margin-bottom: 16px;
  text-align: center;
}

.stockpile-total-amount {
  font-size: 2rem;
  font-weight: 900;
  letter-spacing: -1px;
}

.stockpile-total-label {
  font-size: 0.82rem;
  opacity: 0.85;
  margin-top: 3px;
}

.stockpile-items { display: flex; flex-direction: column; gap: 8px; }

.stockpile-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.stockpile-priority {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  font-size: 0.68rem;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #fff;
}

.stockpile-priority.p1 { background: var(--red); }
.stockpile-priority.p2 { background: var(--orange); }
.stockpile-priority.p3 { background: var(--green); }

.stockpile-info { flex: 1; min-width: 0; }
.stockpile-item-name { font-size: 0.88rem; font-weight: 700; color: var(--text); }
.stockpile-item-size { font-size: 0.73rem; color: var(--text-muted); margin-top: 2px; }

.stockpile-item-price {
  font-size: 1rem;
  font-weight: 900;
  color: var(--text);
  flex-shrink: 0;
  text-align: right;
}

.stockpile-item-qty {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 1px;
}

/* ── Strategy cards ── */
.strategy-list { display: flex; flex-direction: column; gap: 8px; }

.strategy-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.strategy-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  cursor: pointer;
  user-select: none;
}

.strategy-header:hover { background: var(--bg-muted); }

.strategy-icon { font-size: 1.3rem; flex-shrink: 0; }

.strategy-title {
  flex: 1;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
}

.strategy-saving {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--green);
  background: var(--green-light);
  padding: 3px 9px;
  border-radius: 999px;
  flex-shrink: 0;
}

.strategy-chevron {
  font-size: 0.9rem;
  color: var(--text-muted);
  transition: transform 0.2s;
  flex-shrink: 0;
}

.strategy-card.open .strategy-chevron { transform: rotate(180deg); }

.strategy-body {
  display: none;
  padding: 0 16px 16px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.6;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.strategy-card.open .strategy-body { display: block; }

.strategy-stores {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 8px;
}

.strategy-store-tag {
  font-size: 0.7rem;
  padding: 2px 8px;
  background: var(--bg-muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-muted);
}

/* ── Grant cards ── */
.grants-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}

@media (min-width: 600px) { .grants-grid { grid-template-columns: repeat(3, 1fr); } }

.grant-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  text-align: center;
}

.grant-name {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 6px;
  line-height: 1.3;
}

.grant-amount {
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--green);
  letter-spacing: -1px;
}

.grant-period {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin: 2px 0 6px;
}

.grant-eligibility {
  font-size: 0.72rem;
  color: var(--text-secondary);
  line-height: 1.4;
  border-top: 1px solid var(--border);
  padding-top: 8px;
  margin-top: 6px;
}

/* ── Grow Your Own ── */
.grow-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}

@media (min-width: 600px) { .grow-grid { grid-template-columns: repeat(4, 1fr); } }

.grow-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
}

.grow-crop {
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 6px;
}

.grow-difficulty {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  display: inline-block;
  margin-bottom: 8px;
}

.grow-difficulty.easy     { background: var(--green-light); color: var(--green); }
.grow-difficulty.moderate { background: var(--orange-light); color: var(--orange); }

.grow-stats {
  font-size: 0.75rem;
  color: var(--text-secondary);
  line-height: 1.7;
}

.grow-yield {
  font-size: 0.73rem;
  color: var(--text-muted);
  margin-top: 6px;
  line-height: 1.4;
  border-top: 1px solid var(--border);
  padding-top: 6px;
}

/* ── Guide cards ── */
.guides-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-bottom: 20px;
}

@media (min-width: 480px) { .guides-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 720px) { .guides-grid { grid-template-columns: repeat(3, 1fr); } }

.guide-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.guide-card:hover { border-color: var(--green); box-shadow: var(--shadow-md); transform: translateY(-1px); }

.guide-card-icon { font-size: 1.8rem; }
.guide-card-title { font-size: 0.92rem; font-weight: 800; color: var(--text); line-height: 1.2; }
.guide-card-desc  { font-size: 0.78rem; color: var(--text-secondary); line-height: 1.4; }

.guide-card-steps {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--green);
  margin-top: auto;
}

/* ── Guide detail ── */
.guide-detail-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--green);
  margin-bottom: 16px;
  padding: 6px 0;
  cursor: pointer;
}

.guide-step {
  display: flex;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.guide-step:last-child { border-bottom: none; }

.guide-step-number {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.guide-step-title { font-size: 0.9rem; font-weight: 700; color: var(--text); }
.guide-step-desc  { font-size: 0.82rem; color: var(--text-secondary); margin-top: 3px; line-height: 1.5; }

/* ── Commodity cards ── */
.commodity-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}

@media (min-width: 600px) { .commodity-grid { grid-template-columns: repeat(4, 1fr); } }

.commodity-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  cursor: pointer;
  transition: box-shadow 0.15s;
}

.commodity-card:hover { box-shadow: var(--shadow-md); }

.commodity-name {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.commodity-price {
  font-size: 1.2rem;
  font-weight: 900;
  color: var(--text);
  letter-spacing: -0.5px;
}

.commodity-unit {
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.commodity-change {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  display: inline-block;
  margin-top: 4px;
}

.commodity-change.up   { background: var(--red-light); color: var(--red); }
.commodity-change.down { background: var(--green-light); color: var(--green); }

.commodity-sa-impact {
  display: none;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.commodity-card.expanded .commodity-sa-impact { display: block; }

/* ── Metric pill (in-sentence status) ── */
.metric-up   { color: var(--red);    font-weight: 700; }
.metric-down { color: var(--green);  font-weight: 700; }

/* ── Relatable comparison ── */
.relatable {
  display: inline-block;
  background: var(--gold-light);
  border: 1px solid #ffe082;
  border-radius: 999px;
  padding: 2px 9px;
  font-size: 0.75rem;
  font-weight: 600;
  color: #7a5800;
}

/* ── Progress bar ── */
.progress-wrap { margin-top: 8px; }

.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.progress-bar {
  height: 8px;
  background: var(--bg-muted);
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--red);
  transition: width 0.5s ease;
}

/* ── Vuln badge ── */
.badge {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  text-transform: capitalize;
}

.badge.critical { background: var(--red-light);    color: var(--red); }
.badge.high     { background: var(--orange-light); color: var(--orange); }
.badge.elevated { background: var(--gold-light);   color: #7a5800; }
.badge.normal   { background: var(--green-light);  color: var(--green); }

/* ── Utility ── */
.mb-2  { margin-bottom: 8px; }
.mb-3  { margin-bottom: 12px; }
.mb-4  { margin-bottom: 20px; }
.mb-6  { margin-bottom: 28px; }
.mt-3  { margin-top: 12px; }
.mt-4  { margin-top: 20px; }

.text-muted { color: var(--text-muted); font-size: 0.8rem; }
.text-small { font-size: 0.78rem; }
.text-red   { color: var(--red); }
.text-green { color: var(--green); }
.bold       { font-weight: 700; }

.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 20px 0;
}

.live-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: var(--green);
  border-radius: 50%;
  animation: pulse 1.8s ease-in-out infinite;
  margin-right: 4px;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.5; transform: scale(0.8); }
}

/* ── Footer ── */
.app-footer {
  background: var(--bg-muted);
  border-top: 1px solid var(--border);
  padding: 14px 16px;
  text-align: center;
}

.footer-inner {
  font-size: 0.72rem;
  color: var(--text-muted);
  max-width: 960px;
  margin: 0 auto;
}

/* ── Error notice ── */
.error-notice {
  background: var(--red-light);
  border: 1px solid #f5c6c5;
  color: #8b1c18;
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 0.85rem;
  font-weight: 600;
  margin: 16px 0;
}

