:root {
  --bg: #f6f3ee;
  --ink: #1b1a17;
  --muted: #5c574e;
  --line: #ddd6c8;
  --card: #fffdf8;
  --accent: #0b6e4f;
  --accent-ink: #fff;
  --warn: #8a3b12;
  font-family: "Inter", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Inter", sans-serif;
  line-height: 1.45;
}

.site-header, .site-footer, main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.25rem 1.5rem;
}

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  border-bottom: 1px solid var(--line);
}

.logo {
  font-weight: 700;
  font-size: 1.35rem;
  color: var(--ink);
  text-decoration: none;
}

nav a {
  margin-left: 1.25rem;
  color: var(--muted);
  text-decoration: none;
}

nav a:hover { color: var(--ink); }

h1 { font-size: 2rem; font-weight: 600; margin: 0 0 0.5rem; }
h2 { font-size: 1.2rem; margin-top: 2rem; }

.hero p, .lede, .hint, .muted, .status { color: var(--muted); }

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.5rem;
  margin: 1.5rem 0;
  padding: 1rem 1.25rem;
  background: var(--card);
  border: 1px solid var(--line);
}

.filters label, .card label {
  display: flex;
  flex-direction: column;
  font-size: 0.85rem;
  color: var(--muted);
  gap: 0.25rem;
}

.checkbox { flex-direction: row !important; align-items: center; gap: 0.5rem; }

input, select, button {
  font: inherit;
  padding: 0.35rem 0.5rem;
}

button {
  background: var(--accent);
  color: var(--accent-ink);
  border: 0;
  cursor: pointer;
}

button.linkish {
  background: none;
  color: var(--accent);
  padding: 0;
  text-decoration: underline;
}

.table-wrap { overflow-x: auto; position: relative; }

.kebab {
  position: absolute;
  top: 0.15rem;
  right: 0.15rem;
  z-index: 3;
  background: transparent;
  color: var(--ink);
  border: 0;
  padding: 0.15rem 0.45rem;
  font-size: 1.25rem;
  line-height: 1;
  letter-spacing: 0;
}

.kebab:hover { background: #f3efe6; }

.col-menu {
  position: fixed;
  top: 2rem;
  right: 0.15rem;
  z-index: 4;
  min-width: 12.5rem;
  padding: 0.7rem 0.35rem 0.45rem;
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--line);
  box-shadow: 0 10px 28px rgba(27, 26, 23, 0.14);
  font-family: "Inter", sans-serif;
}

.col-menu p {
  margin: 0 0.65rem 0.45rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--line);
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.col-menu label {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0;
  padding: 0.35rem 0.65rem;
  font-size: 0.85rem;
  color: var(--ink);
  cursor: pointer;
}

.col-menu label:hover {
  background: #f3efe6;
}

.col-menu input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 0.9rem;
  height: 0.9rem;
  margin: 0;
  padding: 0;
  flex-shrink: 0;
  border: 1px solid var(--muted);
  background: var(--card);
  border-radius: 2px;
  cursor: pointer;
}

.col-menu input[type="checkbox"]:checked {
  background: var(--ink);
  border-color: var(--ink);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'><path fill='none' stroke='%23fffdf8' stroke-width='2' d='M2.5 6.2l2.4 2.4 4.6-5'/></svg>");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 0.7rem;
}

#gilt-table.hide-col-ticker [data-col="ticker"],
#gilt-table.hide-col-name [data-col="name"],
#gilt-table.hide-col-coupon_rate [data-col="coupon_rate"],
#gilt-table.hide-col-redemption_date [data-col="redemption_date"],
#gilt-table.hide-col-years_to_maturity [data-col="years_to_maturity"],
#gilt-table.hide-col-clean_price [data-col="clean_price"],
#gilt-table.hide-col-accrued_interest [data-col="accrued_interest"],
#gilt-table.hide-col-dirty_price [data-col="dirty_price"],
#gilt-table.hide-col-gross_redemption_yield [data-col="gross_redemption_yield"],
#gilt-table.hide-col-net_annual_return [data-col="net_annual_return"],
#gilt-table.hide-col-equivalent_gross_savings_rate [data-col="equivalent_gross_savings_rate"] {
  display: none;
}

#gilt-table thead th:last-child { padding-right: 2rem; }

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
}

th, td {
  text-align: left;
  padding: 0.45rem 0.6rem;
  border-bottom: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
}

th { cursor: pointer; font-size: 0.85rem; color: var(--muted); }
th.sorted {
  color: var(--ink);
  font-weight: 600;
}
th.sorted[aria-sort="ascending"]::after { content: " \2191"; }
th.sorted[aria-sort="descending"]::after { content: " \2193"; }
th.num, td.num { text-align: right; }
td.ticker { font-weight: 600; white-space: nowrap; letter-spacing: 0.02em; }
tr:hover td { background: #f3efe6; }
a { color: var(--accent); }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  padding: 1.25rem;
  margin: 1rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem 1.5rem;
}

.metrics dt { color: var(--muted); font-size: 0.85rem; }
.metrics dd { margin: 0; font-size: 1.25rem; }

.sparkline svg { width: 100%; height: 120px; }

.email pre {
  white-space: pre-wrap;
  font-family: inherit;
}

.banner {
  padding: 0.75rem 1rem;
  border: 1px solid var(--line);
  background: var(--card);
}

.banner.ok { border-color: var(--accent); }

.banner.error {
  color: var(--warn);
  border-color: var(--warn);
}

.ingest-upload form {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 1rem;
}

.ticker-input {
  width: 7rem;
  text-transform: uppercase;
}

.ingest-actions { margin: 1rem 0; }

.site-footer { font-size: 0.85rem; border-top: 1px solid var(--line); }

.has-tip {
  cursor: help;
  text-decoration: underline dotted;
  text-underline-offset: 0.2em;
  text-decoration-color: var(--muted);
}

#tooltip-bubble {
  position: fixed;
  z-index: 50;
  max-width: 260px;
  padding: 0.55rem 0.7rem;
  background: var(--ink);
  color: var(--card);
  font-family: "Inter", sans-serif;
  font-size: 0.8rem;
  font-weight: 400;
  line-height: 1.4;
  text-align: left;
  border-radius: 4px;
  box-shadow: 0 4px 16px rgba(27, 26, 23, 0.18);
  pointer-events: none;
}
