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

:root {
  --green-darkest:  #1B5E20;
  --green-dark:     #2E7D32;
  --green-medium:   #388E3C;
  --green-light:    #66BB6A;
  --green-lighter:  #A5D6A7;
  --green-faint:    #E8F5E9;
  --white:          #ffffff;
  --text-dark:      #1a1a1a;
  --text-mid:       #333333;
  --text-light:     #555555;
  --separator:      #2E7D32;
  --shadow:         rgba(0, 0, 0, 0.10);
}

body {
  font-family: 'Segoe UI', Arial, sans-serif;
  background-color: var(--white);
  color: var(--text-dark);
  line-height: 1.6;
}

/* ── Navbar ───────────────────────────────────────────────────────────────── */
.navbar {
  background-color: var(--green-darkest);
  padding: 0 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
  min-height: 64px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}

.nav-brand {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--white);
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.nav-brand span {
  color: var(--green-lighter);
}

.nav-items {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
}

/* Dropdown */
.health-select-wrapper {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.health-select-label {
  color: var(--white);
  font-size: 0.95rem;
  white-space: nowrap;
}

#preference_dropdown {
  appearance: none;
  background-color: var(--green-dark);
  color: var(--white);
  border: 1.5px solid var(--green-light);
  border-radius: 6px;
  padding: 0.45rem 2rem 0.45rem 0.85rem;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background-color 0.2s, border-color 0.2s;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23A5D6A7'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.65rem center;
}

#preference_dropdown:hover,
#preference_dropdown:focus {
  background-color: var(--green-medium);
  border-color: var(--green-lighter);
  outline: none;
}

#preference_dropdown option {
  background-color: var(--green-dark);
  color: var(--white);
}

/* Nav links */
.nav-link {
  color: var(--white);
  text-decoration: none;
  font-size: 1.05rem;
  font-weight: 500;
  padding: 0.3rem 0.5rem;
  border-radius: 4px;
  transition: color 0.2s, background-color 0.2s;
  white-space: nowrap;
}

.nav-link:hover {
  color: var(--green-lighter);
  background-color: rgba(255,255,255,0.08);
}

/* ── Separator ────────────────────────────────────────────────────────────── */
.separator {
  border: none;
  border-top: 3px solid var(--separator);
  margin: 0;
}

/* ── Sections ─────────────────────────────────────────────────────────────── */
.section {
  padding: 2.25rem 2rem;
  background-color: var(--white);
}

.section-title {
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--green-darkest);
  margin-bottom: 1.5rem;
  letter-spacing: 0.3px;
}

/* ── GenAI Chat Section ───────────────────────────────────────────────────── */
.chat-section {
  background-color: var(--white);
  padding: 1.5rem 2rem;
}

.chat-layout {
  display: flex;
  align-items: flex-start;
  gap: 1.5rem;
}

/* ~1 inch tall at 96 dpi */
.chat-image {
  height: 96px;
  width: auto;
  flex-shrink: 0;
  align-self: flex-start;
}

.chat-input-wrapper {
  flex: 1;
}

/* ~1 inch tall at 96 dpi */
.chat-textarea {
  width: 100%;
  height: 96px;
  padding: 0.75rem 1rem;
  font-size: 0.95rem;
  font-family: 'Segoe UI', Arial, sans-serif;
  color: var(--text-mid);
  background-color: var(--white);
  border: 1.5px solid var(--green-light);
  border-radius: 8px;
  resize: vertical;
  line-height: 1.6;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.chat-textarea:focus {
  outline: none;
  border-color: var(--green-medium);
  box-shadow: 0 0 0 3px rgba(102, 187, 106, 0.2);
}

/* GenAI input row */
.gen-ai-input-row {
  display: flex;
  gap: 0.6rem;
  margin-top: 0.6rem;
  align-items: center;
}

.gen-ai-input {
  flex: 1;
  padding: 0.5rem 0.9rem;
  font-size: 0.95rem;
  font-family: 'Segoe UI', Arial, sans-serif;
  color: var(--text-mid);
  background-color: var(--white);
  border: 1.5px solid var(--green-light);
  border-radius: 6px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.gen-ai-input:focus {
  outline: none;
  border-color: var(--green-medium);
  box-shadow: 0 0 0 3px rgba(102, 187, 106, 0.2);
}

.gen-ai-submit-btn {
  padding: 0.5rem 1.4rem;
  background-color: var(--green-dark);
  color: var(--white);
  font-size: 0.95rem;
  font-weight: 600;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.2s;
}

.gen-ai-submit-btn:hover {
  background-color: var(--green-medium);
}

.gen-ai-submit-btn:active {
  background-color: var(--green-darkest);
}

/* Screen-reader only label */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* ── Health Measures Section ──────────────────────────────────────────────── */
#health-measures {
  background-color: var(--green-faint);
  padding: 1.5rem 1.25rem;
}

/* Main two-column layout: [left: charts+message] [vsep] [right: chat] */
.hm-layout {
  display: flex;
  align-items: stretch;
  gap: 0;
}

/* Left column */
.hm-left {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}

/* Charts area: no border, minimal space */
.charts-area {
  border: none;
  background: transparent;
  padding: 0;
  width: fit-content;
}

/* Charts grid: Chart1 tall on left, 3×2 grid of smaller charts beside it */
.charts-grid {
  display: grid;
  grid-template-columns: auto auto auto auto;
  grid-template-rows: auto auto;
  gap: 0.5rem;
  align-items: start;
}

/* Chart 1 (Overall Health) spans both rows */
.gauge-card-large {
  grid-column: 1;
  grid-row: 1 / span 2;
  align-self: start;
}

/* 6 small charts in 3×2 grid on the right */
.gauge-card:nth-of-type(2) { grid-column: 2; grid-row: 1; }  /* Chart 2: BP Systolic */
.gauge-card:nth-of-type(3) { grid-column: 3; grid-row: 1; }  /* Chart 3: BP Diastolic */
.gauge-card:nth-of-type(4) { grid-column: 4; grid-row: 1; }  /* Chart 4: Heart Rate */
.gauge-card:nth-of-type(5) { grid-column: 2; grid-row: 2; }  /* Chart 5: Blood Sugar */
.gauge-card:nth-of-type(6) { grid-column: 3; grid-row: 2; }  /* Chart 6: Sleep Duration */
.gauge-card:nth-of-type(7) { grid-column: 4; grid-row: 2; }  /* Chart 7: Daily Steps */

.gauge-card,
.gauge-card-large {
  background-color: var(--white);
  border-radius: 8px;
  padding: 0.5rem 0.65rem 0.4rem;
  box-shadow: 0 2px 8px var(--shadow);
  text-align: center;
}

.gauge-card-large {
  padding: 0.6rem 0.8rem 0.5rem;
}

.gauge-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--green-darkest);
  margin-bottom: 0.25rem;
}

.gauge-card-large .gauge-title {
  font-size: 1.1rem;
}

.gauge-avg {
  font-size: 0.72rem;
  color: var(--text-light);
  margin-top: 0.15rem;
}

/* Canvas sizing */
.gauge-card canvas {
  display: block;
  margin: 0 auto;
  width: 180px;
  height: 105px;
}

.gauge-card-large canvas {
  display: block;
  margin: 0 auto;
  width: 380px;
  height: 234px;
}

/* Message area below charts — matches charts-area width */
.charts-message {
  margin-top: 0.75rem;
  width: 100%;
}

.charts-message-textarea {
  width: 100%;
  padding: 0.6rem 0.85rem;
  font-size: 0.9rem;
  font-family: 'Segoe UI', Arial, sans-serif;
  color: var(--text-mid);
  background-color: #f0f0f0;
  border: 1.5px solid var(--green-dark);
  border-radius: 6px;
  resize: none;
  line-height: 1.55;
  height: 72px;
  cursor: default;
}

.charts-message-textarea:focus {
  outline: none;
  border-color: var(--green-dark);
}

/* ── Vertical separator ───────────────────────────────────────────────────── */
.hm-vsep {
  width: 3px;
  background-color: var(--green-dark);
  border-radius: 2px;
  flex-shrink: 0;
  align-self: stretch;
  margin: 1rem 1rem;  /* keeps line away from section top/bottom edges */
}

/* ── Gen AI Chat 2 (right column) ────────────────────────────────────────── */
.gen-ai-chat-2 {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 280px;
}

/* Chat conversation display box */
.chat-dialog-box {
  flex: 1;
  min-height: 220px;
  max-height: 380px;
  background-color: var(--white);
  border: 1.5px solid var(--green-light);
  border-radius: 8px;
  padding: 1rem;
  overflow-y: auto;
  margin-bottom: 0.75rem;
  font-size: 0.92rem;
  color: var(--text-mid);
  line-height: 1.6;
}

/* Chat input row */
.chat-2-input-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.5rem;
}

.chat-2-input {
  flex: 1;
  padding: 0.5rem 0.9rem;
  font-size: 0.95rem;
  font-family: 'Segoe UI', Arial, sans-serif;
  color: var(--text-mid);
  background-color: var(--white);
  border: 1.5px solid var(--green-light);
  border-radius: 6px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.chat-2-input:focus {
  outline: none;
  border-color: var(--green-medium);
  box-shadow: 0 0 0 3px rgba(102, 187, 106, 0.2);
}

.chat-2-submit-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.5rem 1.1rem;
  background-color: var(--green-dark);
  color: var(--white);
  font-size: 0.92rem;
  font-weight: 600;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.2s;
}

.chat-2-submit-btn:hover  { background-color: var(--green-medium); }
.chat-2-submit-btn:active { background-color: var(--green-darkest); }

/* Health Chat title row with inline icon */
.chat-title-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Icon sized to the title's line height so it doesn't push the row taller */
.chat-title-icon {
  height: 1em;   /* matches the h2 font-size exactly */
  width: auto;
  flex-shrink: 0;
  display: block;
}

/* Disclaimer text */
.disclaimer-text {
  font-size: 0.78rem;
  color: #555;
  line-height: 1.45;
  margin-top: 0.25rem;
}

/* ── Recommendations Section ──────────────────────────────────────────────── */
#recommendations {
  background-color: var(--white);
}

.rec-header {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.rec-header .section-title {
  margin-bottom: 0;
}

.rec-status {
  font-size: 0.85rem;
  color: var(--text-light);
  font-style: italic;
}

.rec-sort {
  display: flex;
  gap: 0.4rem;
}

/* A price the listing advertised but the page never confirmed */
.rec-price--approx {
  color: var(--text-light);
  cursor: help;
}

.rec-price-checked {
  color: var(--text-light);
  font-weight: 400;
}

.rec-price-pending {
  font-size: 0.78rem;
  font-style: italic;
  color: var(--text-light);
  margin-top: 0.3rem;
}

.rec-line {
  display: flex;
  align-items: flex-start;
  gap: 1.25rem;
  margin-bottom: 1.25rem;
  padding: 1rem 1.25rem;
  background-color: var(--green-faint);
  border-radius: 8px;
  flex-wrap: wrap;
}

.rec-line:last-child {
  margin-bottom: 0;
}

/* Message subsection: 1.5 inches wide, bold, no border, top-left aligned */
.rec-message {
  width: 144px;
  min-width: 144px;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 0.92rem;
  color: var(--text-mid);
  line-height: 1.5;
  border: none;
  background: transparent;
  flex-shrink: 0;
  align-self: flex-start;
  text-align: left;
}

.rec-message-title {
  font-weight: 700;
}

.rec-message-context {
  font-weight: 400;
  font-size: 0.78rem;
  color: var(--text-light);
  line-height: 1.4;
}

/* Product card row */
.rec-products {
  display: flex;
  align-items: stretch;
  gap: 1rem;
  flex-wrap: wrap;
  flex: 1;
}

/* Individual product card */
.rec-product-card {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 190px;
  padding: 0.75rem 0.7rem 0.8rem;
  background-color: var(--white);
  border: 1px solid var(--green-lighter);
  border-radius: 8px;
  box-shadow: 0 1px 4px var(--shadow);
  transition: box-shadow 0.18s, transform 0.18s;
}

.rec-product-card:hover {
  box-shadow: 0 6px 16px rgba(0,0,0,0.15);
  transform: translateY(-2px);
}

.rec-product-link {
  display: block;
  border-radius: 6px;
  overflow: hidden;
}

/* Portrait product shots (470×950–1218px) scaled into a uniform card slot */
.rec-product-img {
  height: 200px;
  width: 100%;
  object-fit: contain;
  display: block;
  border-radius: 6px;
}

.rec-product-info {
  display: flex;
  flex-direction: column;
  gap: 0.22rem;
  margin-top: 0.6rem;
}

.rec-product-name {
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--green-darkest);
  text-decoration: none;
}

.rec-product-name:hover {
  text-decoration: underline;
}

.rec-product-brand {
  font-size: 0.75rem;
  color: var(--text-light);
}

/* Why the chat answer named this item */
.rec-product-note {
  font-size: 0.74rem;
  line-height: 1.35;
  color: var(--text-light);
  font-style: italic;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Items with no catalog photo yet get the generic leaf tile */
.rec-product-img--placeholder {
  background-color: var(--green-faint);
  padding: 0.25rem;
}

.rec-rating {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.78rem;
  color: var(--text-light);
}

.rec-stars {
  color: #F9A825;
  font-size: 0.9rem;
  letter-spacing: 0.5px;
}

.rec-rating-value {
  font-weight: 600;
  color: var(--text-mid);
}

.rec-price {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-dark);
  margin-top: 0.15rem;
}

.rec-unit {
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--text-light);
}

.rec-delivery {
  font-size: 0.75rem;
  color: var(--green-dark);
  font-weight: 500;
  line-height: 1.35;
}

/* The other exact products behind one recommendation */
.rec-picks {
  margin-top: 0.45rem;
  padding-top: 0.4rem;
  border-top: 1px dashed var(--green-lighter);
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.rec-picks-title {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  color: var(--text-light);
}

.rec-pick {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
  text-decoration: none;
  color: inherit;
  padding: 0.22rem 0.3rem;
  border-radius: 5px;
  background-color: var(--green-faint);
}

.rec-pick:hover {
  background-color: var(--green-lighter);
}

.rec-pick-name {
  font-size: 0.74rem;
  line-height: 1.25;
  color: var(--green-darkest);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.rec-pick-meta {
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
}

.rec-pick-price {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-dark);
}

.rec-pick-store {
  font-size: 0.68rem;
  color: var(--text-light);
}

/* AD highlight: gold border + badge */
.ad-card {
  border-color: #F9A825;
  box-shadow: 0 1px 4px rgba(249, 168, 37, 0.35);
}

.ad-badge {
  position: absolute;
  top: -9px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  background-color: #F9A825;
  color: #1a1a1a;
  padding: 2px 7px;
  border-radius: 3px;
  white-space: nowrap;
  z-index: 1;
}

@media (max-width: 640px) {
  .rec-message {
    width: 100%;
    min-width: 0;
  }

  .rec-product-card {
    width: 100%;
    max-width: 240px;
  }
}

/* ── Language chooser (navbar, far right) ─────────────────────────────────── */
.language-select-wrapper {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-left: auto;
}

.language-globe {
  font-size: 1rem;
  line-height: 1;
}

#language_dropdown {
  font-family: inherit;
  font-size: 0.88rem;
  padding: 0.3rem 0.5rem;
  color: var(--text-dark);
  background-color: var(--white);
  border: 1px solid var(--green-lighter);
  border-radius: 6px;
  cursor: pointer;
}

#language_dropdown:focus-visible {
  outline: 2px solid var(--green-lighter);
  outline-offset: 1px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ── Store search panel ───────────────────────────────────────────────────── */
.rec-stores-btn {
  margin-top: 0.35rem;
  padding: 0.38rem 0.75rem;
  width: 100%;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--green-dark);
  background-color: var(--white);
  border: 1.5px solid var(--green-light);
  border-radius: 999px;
  cursor: pointer;
  transition: background-color 0.18s, color 0.18s;
}

.rec-stores-btn:hover {
  background-color: var(--green-faint);
}

.rec-stores-btn:focus-visible {
  outline: 2px solid var(--green-darkest);
  outline-offset: 2px;
}

.store-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background-color: rgba(0, 0, 0, 0.45);
}

.store-panel {
  width: min(560px, 100%);
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  background-color: var(--white);
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
  overflow: hidden;
}

.store-panel-head {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background-color: var(--green-darkest);
  color: var(--white);
}

.store-panel-title {
  font-size: 1.02rem;
  font-weight: 600;
  flex: 1;
}

.store-close {
  font-size: 1.1rem;
  line-height: 1;
  color: var(--white);
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0.25rem 0.4rem;
  border-radius: 4px;
}

.store-close:hover {
  background-color: rgba(255, 255, 255, 0.15);
}

.product-sort {
  display: flex;
  gap: 0.5rem;
  padding: 0.7rem 1.25rem 0;
}

.product-sort-btn {
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.35rem 0.85rem;
  color: var(--green-dark);
  background-color: var(--white);
  border: 1.5px solid var(--green-lighter);
  border-radius: 999px;
  cursor: pointer;
  transition: background-color 0.18s, color 0.18s, border-color 0.18s;
}

.product-sort-btn:hover {
  background-color: var(--green-faint);
}

.product-sort-btn--active {
  color: var(--white);
  background-color: var(--green-medium);
  border-color: var(--green-medium);
}

.product-offer-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--green-darkest);
  text-decoration: none;
}

.product-offer-name:hover {
  text-decoration: underline;
}

.product-offer-store {
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
  flex-wrap: wrap;
  margin-top: 0.15rem;
}

.store-name-inline {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-mid);
}

.product-offer-brand {
  font-size: 0.75rem;
  color: var(--text-light);
}

.product-offer-rating {
  font-size: 0.78rem;
  color: #F9A825;
  font-weight: 600;
}

.store-panel-body {
  padding: 1rem 1.25rem 1.25rem;
  overflow-y: auto;
}

.store-searching,
.store-empty {
  font-size: 0.9rem;
  color: var(--text-light);
  padding: 1rem 0;
  text-align: center;
}

.store-list {
  list-style: none;
  counter-reset: store;
}

.store-row {
  counter-increment: store;
  position: relative;
  padding: 0.8rem 0 0.8rem 2rem;
  border-bottom: 1px solid var(--green-faint);
}

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

.store-row::before {
  content: counter(store);
  position: absolute;
  left: 0;
  top: 0.85rem;
  width: 1.4rem;
  height: 1.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--white);
  background-color: var(--green-medium);
  border-radius: 50%;
}

.store-row-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.store-name {
  font-size: 0.97rem;
  font-weight: 700;
  color: var(--green-darkest);
  text-decoration: none;
}

.store-name:hover {
  text-decoration: underline;
}

.store-badge {
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 3px;
}

.store-badge--community {
  color: var(--green-darkest);
  background-color: var(--green-lighter);
}

.store-kind {
  font-size: 0.72rem;
  color: var(--text-light);
}

.store-meta {
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
  flex-wrap: wrap;
  margin-top: 0.2rem;
}

.store-price {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-dark);
}

.store-price--unknown {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-light);
  font-style: italic;
}

.store-unit {
  font-size: 0.75rem;
  color: var(--text-light);
}

.store-ships {
  font-size: 0.75rem;
  color: var(--green-dark);
  font-weight: 500;
}

.store-note {
  font-size: 0.8rem;
  color: var(--text-light);
  line-height: 1.4;
  margin-top: 0.2rem;
}

.store-visit {
  display: inline-block;
  margin-top: 0.35rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--green-dark);
  text-decoration: none;
}

.store-visit:hover {
  text-decoration: underline;
}

.store-notice {
  margin-top: 0.9rem;
  padding-top: 0.7rem;
  border-top: 1px solid var(--green-faint);
  font-size: 0.75rem;
  font-style: italic;
  color: var(--text-light);
}

/* ── Footer Links Section ─────────────────────────────────────────────────── */
#footer-links {
  background-color: var(--green-faint);
}

.footer-links-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
}

.footer-link {
  color: var(--green-dark);
  text-decoration: underline;
  font-size: 0.95rem;
  font-weight: 500;
  padding: 0.35rem 0.75rem;
  border: none;
  transition: color 0.18s;
  white-space: nowrap;
}

.footer-link:hover {
  color: var(--green-medium);
}

/* ── Page footer ──────────────────────────────────────────────────────────── */
.page-footer {
  background-color: var(--green-darkest);
  color: var(--green-lighter);
  text-align: center;
  padding: 1rem 2rem;
  font-size: 0.82rem;
}

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .navbar { padding: 0.75rem 1rem; }
  .nav-brand { font-size: 1.4rem; }
  .section { padding: 1.5rem 1rem; }

  .hm-layout { flex-direction: column; }
  .hm-vsep {
    width: auto;
    height: 3px;
    margin: 1rem 0;
    align-self: auto;
  }

  .gauge-card-large canvas { width: 447px; height: 275px; }
  .gauge-card canvas { width: 180px; height: 104px; }
}

/* ── Login Modal ──────────────────────────────────────────────────────────── */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-content {
  background-color: var(--white);
  margin: 10% auto;
  padding: 2rem;
  border-radius: 12px;
  width: 90%;
  max-width: 450px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  position: relative;
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from {
    transform: translateY(-50px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.modal-content h2 {
  color: var(--green-darkest);
  margin-bottom: 1.5rem;
  font-size: 1.5rem;
}

.close {
  color: #aaa;
  position: absolute;
  right: 1.5rem;
  top: 1rem;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  transition: color 0.2s;
}

.close:hover,
.close:focus {
  color: var(--green-dark);
}

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--text-mid);
  font-weight: 600;
  font-size: 0.95rem;
}

.form-group input {
  width: 100%;
  padding: 0.75rem;
  font-size: 1rem;
  border: 1.5px solid var(--green-light);
  border-radius: 6px;
  font-family: 'Segoe UI', Arial, sans-serif;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus {
  outline: none;
  border-color: var(--green-medium);
  box-shadow: 0 0 0 3px rgba(102, 187, 106, 0.2);
}

.error-message {
  color: #D32F2F;
  font-size: 0.9rem;
  margin: 0.5rem 0;
  min-height: 1.2rem;
}

/* Auth tabs */
.auth-tabs {
  display: flex;
  border-bottom: 2px solid var(--green-light);
  margin-bottom: 1.5rem;
}

.auth-tab {
  flex: 1;
  padding: 0.65rem;
  border: none;
  background: none;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-mid);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color 0.2s, border-color 0.2s;
}

.auth-tab.active {
  color: var(--green-dark);
  border-bottom-color: var(--green-dark);
}

.auth-tab:hover { color: var(--green-dark); }

/* Forgot password / back link */
.auth-link {
  display: block;
  text-align: center;
  margin-top: 0.9rem;
  font-size: 0.9rem;
  color: var(--green-dark);
  cursor: pointer;
  text-decoration: none;
}
.auth-link:hover { text-decoration: underline; }

/* Hint text above reset forms */
.auth-panel-hint {
  font-size: 0.9rem;
  color: var(--text-mid);
  margin-bottom: 1rem;
}

/* Token display box */
.reset-token-box {
  background: #f5f5f5;
  border: 1px solid var(--green-light);
  border-radius: 6px;
  padding: 0.65rem 0.75rem;
  font-family: monospace;
  font-size: 0.8rem;
  word-break: break-all;
  margin-bottom: 1rem;
  color: var(--text-dark);
}

/* Success message */
.success-message {
  color: #2E7D32;
  font-size: 0.9rem;
  margin: 0.5rem 0;
  min-height: 1.2rem;
}

#login-form button[type="submit"],
#register-form button[type="submit"],
#forgot-form button[type="submit"],
#reset-form button[type="submit"] {
  width: 100%;
  padding: 0.75rem;
  background-color: var(--green-dark);
  color: var(--white);
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.2s;
  margin-top: 1rem;
}

#login-form button[type="submit"]:hover,
#register-form button[type="submit"]:hover,
#forgot-form button[type="submit"]:hover,
#reset-form button[type="submit"]:hover {
  background-color: var(--green-medium);
}

#login-form button[type="submit"]:active,
#register-form button[type="submit"]:active,
#forgot-form button[type="submit"]:active,
#reset-form button[type="submit"]:active {
  background-color: var(--green-darkest);
}

/* ── Gauge gray-out (no data provided) ───────────────────────────────────── */
.gauge-grayed {
  opacity: 0.35;
  filter: grayscale(1);
  transition: opacity 0.4s ease, filter 0.4s ease;
}

/* ── Chat message styles ─────────────────────────────────────────────────── */
.chat-msg {
  margin: 4px 0;
  padding: 4px 6px;
  border-radius: 4px;
  line-height: 1.45;
  font-size: 0.875rem;
}

.chat-msg--user {
  color: #1a3a1a;
  font-weight: 600;
}

.chat-msg--bot {
  color: #2E7D32;
}

.chat-msg--error {
  color: #D32F2F;
}

.chat-msg--rec-header {
  font-weight: 700;
  margin-top: 6px;
}

.chat-msg--rec {
  padding-left: 12px;
  color: #374d37;
}

.chat-msg--section {
  font-weight: 600;
  color: #1B5E20;
  margin-top: 5px;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.chat-msg--disclaimer {
  color: #888;
  font-style: italic;
  font-size: 0.78rem;
  margin-top: 6px;
  border-top: 1px solid #e0e0e0;
  padding-top: 4px;
}

/* ── Safety warning / block banners in chat ──────────────────────────────── */
.chat-msg--safety-warn {
  background-color: #FFF8E1;
  border-left: 4px solid #F9A825;
  color: #5D4037;
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 0.85rem;
}

.chat-msg--safety-block {
  background-color: #FFEBEE;
  border-left: 4px solid #C62828;
  color: #B71C1C;
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 0.85rem;
}

/* ── Guardrail test section ──────────────────────────────────────────────── */
.guardrail-section {
  max-width: 900px;
  margin: 1.5rem auto;
  padding: 0 1.5rem;
}

.guardrail-header {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.guardrail-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--green-darkest);
}

.guardrail-toggle-btn {
  background: none;
  border: 1px solid var(--green-dark);
  color: var(--green-dark);
  border-radius: 4px;
  padding: 3px 12px;
  font-size: 0.8rem;
  cursor: pointer;
}

.guardrail-toggle-btn:hover { background: var(--green-faint); }

.guardrail-desc {
  font-size: 0.85rem;
  color: var(--text-light);
  margin: 0.6rem 0 1rem;
}

.guardrail-run-btn {
  background-color: var(--green-dark);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 8px 20px;
  font-size: 0.9rem;
  cursor: pointer;
}

.guardrail-run-btn:hover { background-color: var(--green-darkest); }
.guardrail-run-btn:disabled { opacity: 0.55; cursor: not-allowed; }

.guardrail-results { margin-top: 1rem; }

.guardrail-running {
  color: var(--text-light);
  font-style: italic;
  font-size: 0.85rem;
}

.guardrail-row {
  border-radius: 6px;
  padding: 10px 14px;
  margin-bottom: 8px;
  border-left: 5px solid #ccc;
  background: #fafafa;
}

.guardrail-safe    { border-left-color: #2E7D32; }
.guardrail-warn_convert { border-left-color: #F9A825; }
.guardrail-block   { border-left-color: #C62828; }
.guardrail-unknown { border-left-color: #9E9E9E; }

.guardrail-icon { margin-right: 6px; }
.guardrail-label { font-weight: 600; font-size: 0.9rem; }

.guardrail-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  border-radius: 3px;
  padding: 1px 6px;
  margin-left: 8px;
  vertical-align: middle;
}
.guardrail-badge-safe         { background: #C8E6C9; color: #1B5E20; }
.guardrail-badge-warn_convert { background: #FFF9C4; color: #827717; }
.guardrail-badge-block        { background: #FFCDD2; color: #B71C1C; }
.guardrail-badge-unknown      { background: #F5F5F5; color: #616161; }

.guardrail-warning {
  font-size: 0.8rem;
  color: #6D4C41;
  margin-top: 4px;
  padding-left: 24px;
}

.guardrail-preview {
  font-size: 0.78rem;
  color: #555;
  margin-top: 4px;
  padding-left: 24px;
  font-style: italic;
}

.guardrail-error {
  font-size: 0.78rem;
  color: #B71C1C;
  margin-top: 4px;
  padding-left: 24px;
}

/* ── Refresh Data button (navbar) ─────────────────────────────────────────── */
.nav-refresh-btn {
  background: var(--green-medium);
  color: var(--white);
  border: 2px solid var(--green-light);
  border-radius: 6px;
  padding: 0.4rem 1rem;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s, border-color 0.2s;
}
.nav-refresh-btn:hover:not(:disabled) {
  background: var(--green-dark);
  border-color: var(--white);
}
.nav-refresh-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* ── Sync progress banner ─────────────────────────────────────────────────── */
.sync-banner {
  background: var(--green-faint);
  border-bottom: 2px solid var(--green-light);
  padding: 0.5rem 2rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.9rem;
  color: var(--green-darkest);
}
.sync-progress-bar {
  flex: 1;
  height: 6px;
  background: var(--green-lighter);
  border-radius: 4px;
  overflow: hidden;
}
.sync-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--green-dark);
  border-radius: 4px;
  transition: width 0.4s ease;
  animation: sync-pulse 1.5s infinite;
}
@keyframes sync-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.6; }
}
