/* ── Base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
  background: #f3f4f6;
  color: #111827;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  margin: 0;
}

/* ── Navbar ───────────────────────────────────────── */
.site-navbar {
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 52px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}

.site-navbar__brand {
  font-size: 17px;
  font-weight: 700;
  color: #111827;
  text-decoration: none;
  letter-spacing: -.3px;
}

.site-navbar__brand span { color: #2563eb; }

.site-navbar__links { display: flex; gap: 6px; }

.site-navbar__link {
  padding: 6px 14px;
  border-radius: 6px;
  color: #6b7280;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  transition: background .15s, color .15s;
}

.site-navbar__link:hover { background: #f3f4f6; color: #111827; text-decoration: none; }

.site-navbar__link--active {
  background: #eff6ff;
  color: #2563eb;
  font-weight: 600;
}

/* ── Hero search ──────────────────────────────────── */
.search-hero {
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  padding: 40px 24px;
  text-align: center;
}

.search-hero__title {
  font-size: 26px;
  font-weight: 800;
  color: #111827;
  margin: 0 0 6px;
}

.search-hero__subtitle {
  color: #6b7280;
  font-size: 14px;
  margin: 0 0 24px;
}

.search-bar {
  display: flex;
  max-width: 420px;
  margin: 0 auto;
}

.search-bar__input {
  flex: 1;
  padding: 11px 16px;
  border: 2px solid #e5e7eb;
  border-right: none;
  border-radius: 8px 0 0 8px;
  font-size: 15px;
  color: #111827;
  outline: none;
  transition: border-color .15s;
}

.search-bar__input:focus { border-color: #2563eb; }

.search-bar__btn {
  padding: 11px 22px;
  background: #2563eb;
  color: #fff;
  border: 2px solid #2563eb;
  border-radius: 0 8px 8px 0;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
}

.search-bar__btn:hover { background: #1d4ed8; border-color: #1d4ed8; }

/* ── Content wrapper ──────────────────────────────── */
.content-area {
  max-width: 960px;
  margin: 28px auto;
  padding: 0 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ── Section cards ────────────────────────────────── */
.section-card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  overflow: hidden;
}

.section-header {
  padding: 16px 20px 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-title {
  font-size: 15px;
  font-weight: 700;
  color: #111827;
  margin: 0;
}

.section-subtitle {
  font-size: 11px;
  color: #9ca3af;
  background: #f3f4f6;
  padding: 2px 9px;
  border-radius: 10px;
}

.section-body { padding: 14px 20px 20px; }

.section-body--centered {
  text-align: center;
  padding-top: 24px;
  padding-bottom: 28px;
}

/* ── Info (tooltip) button ────────────────────────── */
.info-btn {
  background: none;
  border: none;
  color: #9ca3af;
  font-size: 15px;
  cursor: pointer;
  padding: 0 2px;
  line-height: 1;
  transition: color .15s;
}

.info-btn:hover { color: #2563eb; }

/* ── Metric table (moat) ──────────────────────────── */
.metric-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  text-align: center;
  color: #111827;
}

.metric-table thead tr {
  background: #f9fafb;
  border-bottom: 1px solid #e5e7eb;
}

.metric-table th {
  padding: 8px 10px;
  font-weight: 500;
  color: #6b7280;
  font-size: 12px;
}

.metric-table td {
  padding: 9px 10px;
  border-bottom: 1px solid #f3f4f6;
  color: #111827;
}

.metric-table tbody tr:last-child td { border-bottom: none; }

.metric-table__row-label {
  text-align: left;
  padding-left: 14px;
  font-weight: 600;
  color: #374151;
}

/* ── Stat rows (management / market cap) ──────────── */
.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 24px;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 0;
  border-bottom: 1px solid #f3f4f6;
}

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

.stat-label { color: #6b7280; font-size: 13px; }

.stat-value {
  font-weight: 700;
  font-size: 14px;
  padding: 2px 10px;
  border-radius: 4px;
  color: #111827;
}

/* ── Value cards (margin of safety) ──────────────── */
.val-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.val-card {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 16px;
  text-align: center;
}

.val-card__label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: #9ca3af;
  margin-bottom: 8px;
}

.val-card__value {
  font-size: 24px;
  font-weight: 700;
  color: #111827;
}

/* ── Big number cards (payback time / ten cap) ────── */
.big-number {
  font-size: 48px;
  font-weight: 800;
  color: #111827;
  line-height: 1;
}

.big-number-unit {
  font-size: 13px;
  color: #9ca3af;
  margin-top: 6px;
}

/* ── Two-column grid (payback + ten cap) ──────────── */
.two-col-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* ── Company description ──────────────────────────── */
.company-description {
  color: #374151;
  font-size: 14px;
  line-height: 1.6;
  margin: 0;
}

/* ── History table ────────────────────────────────── */
.history-table-wrap { overflow-x: auto; }

.history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  text-align: center;
  color: #111827;
  white-space: nowrap;
}

.history-table th {
  padding: 8px 10px;
  background: #f9fafb;
  border-bottom: 2px solid #e5e7eb;
  font-weight: 600;
  color: #6b7280;
  font-size: 11px;
}

/* Sub-header row (1yr / 3yr / 5yr / Max) uses a lighter border */
.history-table thead tr:last-child th {
  border-bottom: 1px solid #e5e7eb;
}

.history-table td {
  padding: 8px 10px;
  border-bottom: 1px solid #f3f4f6;
  color: #111827;
}

.history-table tbody tr:hover { background: #f9fafb; }
.history-table tbody tr:last-child td { border-bottom: none; }

.history-ticker { font-weight: 700; color: #2563eb; text-decoration: none; }
.history-ticker:hover { text-decoration: underline; }

.history-name { font-size: 11px; color: #9ca3af; display: block; }

.history-time { color: #9ca3af; font-size: 11px; }

.refresh-btn {
  font-size: 11px;
  padding: 3px 10px;
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  cursor: pointer;
  color: #374151;
}

.refresh-btn:hover { background: #f3f4f6; }

/* ── Navbar divider ───────────────────────────────── */
.navbar-divider {
  width: 1px;
  height: 20px;
  background: #e5e7eb;
  margin: 0 4px;
}

/* ── Refresh All button (navbar) ──────────────────── */
.refresh-all-btn {
  font-size: 13px;
  padding: 5px 13px;
  background: #fff;
  color: #2563eb;
  border: 1.5px solid #2563eb;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: background .15s, color .15s;
}
.refresh-all-btn:hover { background: #eff6ff; }
.refresh-all-btn:disabled { opacity: 0.6; cursor: not-allowed; }

.history-empty {
  text-align: center;
  padding: 60px 20px;
  color: #9ca3af;
}

.history-empty p { font-size: 15px; margin-bottom: 12px; }

/* ── Color cells (set by search.js background-color) */
/* Also used server-side in history.html via cell-* classes */
.cell-green { background-color: #d1fae5 !important; color: #065f46 !important; }
.cell-yellow { background-color: #fef3c7 !important; color: #92400e !important; }
.cell-orange { background-color: #ffedd5 !important; color: #9a3412 !important; }
.cell-red { background-color: #fee2e2 !important; color: #991b1b !important; }

/* ── Flash error banner ───────────────────────────── */
.flash-error {
  background: #fee2e2;
  color: #991b1b;
  padding: 10px 20px;
  text-align: center;
  font-size: 13px;
}
