/* dove_gem web — minimal CSS. Plotly + HTMX added per-page from CDN. */
:root {
  --navy:     #1F3864;
  --light:    #D6E4F7;
  --grey:     #6b7280;
  --dark:     #1f2937;
  --bg:       #ffffff;
  --bg-alt:   #f9fafb;
  --border:   #e5e7eb;
  --highlight:#FFF3B0;
  --green:    #166534;
  --red:      #b91c1c;
}
* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg-alt);
  color: var(--dark);
  font-size: 14px;
  line-height: 1.5;
}
a { color: var(--navy); text-decoration: none; }
a:hover { text-decoration: underline; }
code { background: #f3f4f6; padding: 0.1rem 0.4rem; border-radius: 3px; font-size: 0.92em; }

/* Header / nav */
header {
  background: var(--navy);
  color: white;
  padding: 0.7rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
header .brand {
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.02em;
}
header nav { display: flex; gap: 0.3rem; align-items: center; }
header nav a {
  color: white;
  padding: 0.35rem 0.7rem;
  border-radius: 4px;
  font-size: 0.92rem;
  opacity: 0.85;
}
header nav a:hover, header nav a.active {
  background: rgba(255,255,255,0.12);
  opacity: 1;
  text-decoration: none;
}

/* Nav dropdowns */
.dropdown { position: relative; }
.dropbtn {
  color: white; padding: 0.4rem 0.75rem; border-radius: 4px;
  font-size: 0.92rem; opacity: 0.85; cursor: default;
  display: inline-block; white-space: nowrap; user-select: none;
}
.dropdown:hover .dropbtn, .dropbtn.active { background: rgba(255,255,255,0.16); opacity: 1; }
.dropdown-content {
  display: none; position: absolute; top: 100%; left: 0;
  background: var(--navy); min-width: 190px; border-radius: 0 0 6px 6px;
  box-shadow: 0 6px 14px rgba(0,0,0,0.22); z-index: 200; padding: 0.3rem 0;
}
.dropdown:hover .dropdown-content { display: block; }
.dropdown-content a {
  display: block; color: white; padding: 0.45rem 0.95rem;
  font-size: 0.9rem; opacity: 0.9; border-radius: 0; white-space: nowrap;
}
.dropdown-content a:hover, .dropdown-content a.active {
  background: rgba(255,255,255,0.16); opacity: 1; text-decoration: none;
}
header .right { margin-left: auto; font-size: 0.78rem; opacity: 0.7; }
header .right .ver { font-family: monospace; opacity: 0.9; }

/* Main */
main {
  max-width: 1280px;
  margin: 1.5rem auto;
  padding: 0 1.5rem 3rem;
  background: var(--bg);
  border-radius: 6px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
main > h1:first-child { margin-top: 1.5rem; }
h1 { color: var(--navy); margin: 1rem 0 0.3rem; font-size: 1.55rem; }
h2 { color: var(--navy); margin: 1.5rem 0 0.5rem; font-size: 1.1rem; font-weight: 600; }
h3 { color: var(--navy); margin: 1rem 0 0.3rem; font-size: 0.95rem; font-weight: 600; }
.meta { color: var(--grey); font-size: 0.85rem; margin-bottom: 1rem; }

/* Regime banner */
.regime-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 0.7rem;
  margin: 1rem 0 1.5rem;
}
.regime-card {
  border-radius: 6px;
  padding: 0.9rem 1rem;
  color: white;
  /* Palette colors range from dark navy to light mint/grey; the shadow keeps
     white text legible on the lighter regimes (Disinflation, Mid-Cycle). */
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  min-height: 100px;
}
.regime-card .region-name { font-size: 0.78rem; opacity: 0.85; letter-spacing: 0.05em; text-transform: uppercase; }
.regime-card .regime-label { font-size: 1.05rem; font-weight: 700; }
.regime-card .stress { font-size: 0.78rem; opacity: 0.85; }
.regime-card .scores {
  display: flex; gap: 1rem;
  font-size: 0.78rem; opacity: 0.85;
  margin-top: 0.4rem;
  font-family: monospace;
}
.regime-card.error {
  background: #f3f4f6 !important;
  color: var(--grey);
  text-shadow: none;
  font-style: italic;
}

/* Indicator summary table */
.controls {
  display: flex; gap: 0.8rem; flex-wrap: wrap;
  align-items: center;
  margin: 0.8rem 0 0.5rem;
}
.controls input, .controls select {
  font: inherit; padding: 0.35rem 0.6rem; border: 1px solid var(--border);
  border-radius: 4px; background: white;
}
.controls input { min-width: 200px; }
.controls .count { color: var(--grey); font-size: 0.85rem; margin-left: auto; }

table.indicators {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
table.indicators thead th {
  background: var(--navy);
  color: white;
  padding: 0.45rem 0.6rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.82rem;
  cursor: pointer;
  user-select: none;
  position: sticky;
  top: 56px; /* below sticky header */
}
table.indicators thead th:hover { background: #2a4a85; }
table.indicators thead th .sort-indicator { color: rgba(255,255,255,0.6); font-size: 0.7rem; margin-left: 4px; }
table.indicators tbody tr.category-row td {
  background: var(--light);
  font-weight: 600;
  padding: 0.35rem 0.6rem;
  font-size: 0.82rem;
}
table.indicators tbody tr.highlight td { background: var(--highlight); font-weight: 600; }
table.indicators tbody td {
  padding: 0.35rem 0.6rem;
  border-bottom: 1px solid var(--border);
}
table.indicators tbody td.num { text-align: right; font-variant-numeric: tabular-nums; }
table.indicators tbody td.pos { color: var(--green); }
table.indicators tbody td.neg { color: var(--red); }
table.indicators tbody tr.hidden { display: none; }
table.indicators tbody td .desc { color: var(--grey); font-size: 0.78rem; }

/* Indicator reference guide */
.ref-category {
  background: var(--light);
  color: var(--navy);
  font-weight: 600;
  padding: 0.35rem 0.6rem;
  border-radius: 4px;
  margin: 1.2rem 0 0.6rem;
  font-size: 0.92rem;
}
.ref-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 0.7rem;
}
.ref-card {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.7rem 0.85rem;
  background: var(--bg-alt);
}
.ref-card .ref-title { font-weight: 700; color: var(--navy); font-size: 0.95rem; }
.ref-card .ref-meta {
  color: var(--grey); font-size: 0.76rem;
  margin: 0.1rem 0 0.45rem; font-family: monospace;
}
.ref-card .ref-body { font-size: 0.83rem; line-height: 1.45; margin: 0.25rem 0; }
.ref-card .ref-tag {
  display: inline-block; font-size: 0.66rem; font-weight: 700;
  color: white; background: var(--navy);
  padding: 0.02rem 0.32rem; border-radius: 3px;
  margin-right: 0.3rem; vertical-align: 1px;
}
.ref-card.hidden, .ref-cat-section.hidden { display: none; }

/* Portfolio transaction-entry form */
.txn-entry { margin: 0.6rem 0 1rem; }
.txn-entry summary {
  cursor: pointer; font-weight: 600; color: var(--navy);
  font-size: 0.9rem; padding: 0.3rem 0;
}
.txn-form {
  display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center;
  margin: 0.6rem 0 0.3rem;
}
.txn-form input, .txn-form select {
  font: inherit; padding: 0.35rem 0.5rem;
  border: 1px solid var(--border); border-radius: 4px; background: white;
}
.txn-form button {
  font: inherit; font-weight: 600; padding: 0.4rem 0.9rem;
  background: var(--navy); color: white; border: 0; border-radius: 4px; cursor: pointer;
}
.txn-form button:hover { background: #2a4a85; }
.banner-ok {
  margin-bottom: 0.8rem; padding: 0.5rem 0.7rem;
  background: #ecfdf5; color: var(--green);
  border: 1px solid #a7f3d0; border-radius: 4px; font-size: 0.88rem;
}
.btn-del {
  background: none; border: 0; color: var(--red); cursor: pointer;
  font-size: 0.9rem; line-height: 1; padding: 0.1rem 0.3rem; opacity: 0.6;
}
.btn-del:hover { opacity: 1; }
.btn-bf {
  background: none; border: 0; color: var(--navy); cursor: pointer;
  font-size: 0.95rem; line-height: 1; padding: 0.1rem 0.3rem; opacity: 0.6;
}
.btn-bf:hover { opacity: 1; }

/* Strategy / paper signal badges */
.sig {
  display: inline-block; font-size: 0.72rem; font-weight: 700;
  padding: 0.02rem 0.4rem; border-radius: 3px; color: white;
}
.sig-buy  { background: var(--green); }
.sig-sell { background: var(--red); }

/* AI asset thesis cards */
.thesis-card {
  border: 1px solid var(--border); border-radius: 6px;
  padding: 0.8rem 0.9rem; background: var(--bg-alt);
}
.thesis-head { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.4rem; }
.thesis-asset { font-weight: 700; color: var(--navy); font-size: 1rem; }
.thesis-body { font-size: 0.85rem; line-height: 1.5; white-space: pre-wrap; }
.thesis-points { margin: 0.4rem 0 0; padding-left: 1.1rem; font-size: 0.82rem; color: var(--dark); }
.thesis-points li { margin: 0.15rem 0; }
.stance {
  display: inline-block; font-size: 0.7rem; font-weight: 700;
  padding: 0.05rem 0.45rem; border-radius: 999px; color: white;
}
.stance-bullish { background: var(--green); }
.stance-bearish { background: var(--red); }
.stance-neutral { background: var(--grey); }

/* Chart containers */
.chart {
  width: 100%;
  margin: 0.6rem 0 1.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.4rem;
  background: white;
}
.chart-tall   { height: 380px; }
.chart-medium { height: 280px; }
.chart-short  { height: 180px; }

/* Opinion page */
.opinion-picker {
  display: flex; align-items: center; gap: 0.6rem;
  flex-wrap: wrap;
  margin: 0.2rem 0 1rem;
}
.opinion-picker label { font-size: 0.85rem; color: var(--grey); }
.opinion-picker select {
  font: inherit; padding: 0.35rem 0.6rem;
  border: 1px solid var(--border); border-radius: 4px; background: white;
}
.opinion-picker .picker-hint { font-size: 0.8rem; color: var(--grey); }
/* Labeled transaction form */
.txn-form-labeled {
  display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: flex-end;
  margin: 0.6rem 0 0.3rem;
}
.txn-form-labeled .fld { display: flex; flex-direction: column; }
.txn-form-labeled label { font-size: 0.7rem; color: var(--grey); margin-bottom: 0.15rem; }
.txn-form-labeled input, .txn-form-labeled select {
  font: inherit; padding: 0.35rem 0.5rem;
  border: 1px solid var(--border); border-radius: 4px; background: white;
}
.txn-form-labeled button {
  font: inherit; font-weight: 600; padding: 0.4rem 0.9rem;
  background: var(--navy); color: white; border: 0; border-radius: 4px; cursor: pointer;
}
.txn-form-labeled button:hover { background: #2a4a85; }

.opinion-meta {
  display: flex; gap: 1.5rem; flex-wrap: wrap;
  font-size: 0.82rem; color: var(--grey);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.6rem 1rem;
  background: var(--bg-alt);
  margin-bottom: 1rem;
}
.opinion-meta strong { color: var(--dark); }
.opinion-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-top: 1rem;
}
@media (max-width: 900px) { .opinion-cols { grid-template-columns: 1fr; } }
.opinion-col h2 {
  margin-top: 0;
  padding-bottom: 0.3rem;
  border-bottom: 2px solid var(--navy);
}
.opinion-section {
  margin-top: 1rem;
  font-weight: 600;
  color: var(--navy);
  text-transform: uppercase;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
}
.opinion-bullet {
  margin: 0.25rem 0 0.25rem 1.2rem;
  text-indent: -1.2rem;
  line-height: 1.55;
}
.watchlist-card {
  border: 1px solid var(--border);
  border-left: 4px solid var(--navy);
  border-radius: 4px;
  padding: 0.6rem 0.8rem;
  margin: 0.5rem 0;
  background: var(--bg-alt);
  font-size: 0.9rem;
}
.watchlist-card .topic { font-weight: 600; color: var(--navy); }
.watchlist-card .rationale { color: var(--dark); margin-top: 0.2rem; }

/* Login page */
.login-body {
  background: var(--bg-alt);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-card {
  background: white;
  width: 100%; max-width: 360px;
  padding: 1.8rem 2rem 2rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
  margin: 1rem;
}
.login-card h1   { color: var(--navy); margin: 0 0 0.2rem; font-size: 1.5rem; }
.login-card .meta { margin: 0 0 1.2rem; }
.login-card label { display: block; margin-bottom: 0.8rem; }
.login-card label > span {
  display: block; font-size: 0.82rem;
  color: var(--grey); margin-bottom: 0.25rem;
}
.login-card input {
  width: 100%;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  font: inherit;
}
.login-card button {
  width: 100%;
  margin-top: 0.4rem;
  padding: 0.6rem 0.8rem;
  background: var(--navy);
  color: white; font: inherit; font-weight: 600;
  border: 0; border-radius: 4px;
  cursor: pointer;
}
.login-card button:hover { background: #2a4a85; }
.login-error {
  margin-bottom: 0.8rem;
  padding: 0.5rem 0.7rem;
  background: #fef2f2;
  color: var(--red);
  border: 1px solid #fecaca;
  border-radius: 4px;
  font-size: 0.88rem;
}

/* Header logged-in tag */
header .right a { color: white; opacity: 0.85; }
header .right a:hover { opacity: 1; }
