/* ============ Fintrum — Nasdaq-100 fundamentals ============ */
/* Palette matched to pedramp.com (warm paper / gold). Dark is the :root base
   because the app always stamps an explicit [data-theme]; light overrides below.
   --pos / --red keep the conventional green/red for financial up/down so the
   data stays readable, while --accent (gold) drives the UI chrome. */
:root {
  --bg: #14151a; --surface: #1b1d23; --surface2: #21242c; --surface3: #282c36;
  --border: #2a2c34; --border2: #3a3d47;
  --text: #e9e6de; --text2: #b5b1a6; --text3: #7d796f;
  --accent: #d8a95e; --accent-soft: rgba(216, 169, 94, 0.14);
  --pos: #57c08d; --blue: #6ea8d8; --red: #e0728a; --amber: #d8a95e;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 16px 40px -16px rgba(0, 0, 0, 0.55);
  --grid: rgba(181, 177, 166, 0.12);
  color-scheme: dark;
}
[data-theme="light"] {
  --bg: #faf8f3; --surface: #ffffff; --surface2: #f2efe7; --surface3: #ece7db;
  --border: #e2ddd2; --border2: #cfc9ba;
  --text: #1c1b18; --text2: #4c4a44; --text3: #85817a;
  --accent: #8a5a28; --accent-soft: rgba(138, 90, 40, 0.10);
  --pos: #1f9e6a; --blue: #2f6f9f; --red: #c0435f; --amber: #8a5a28;
  --shadow: 0 3px 14px rgba(30, 45, 70, 0.08);
  --grid: rgba(76, 74, 68, 0.14);
  color-scheme: light;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font: 15px/1.5 "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

/* ---------- header ---------- */
header {
  display: flex; align-items: center; gap: 1rem;
  height: 58px; padding: 0 1.2rem;
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.logo { font-family: "Fraunces", Georgia, serif; font-weight: 600; font-size: 1.25rem;
  letter-spacing: -0.01em; white-space: nowrap; color: var(--text); }
.logo em { color: var(--accent); font-style: italic; }
.back-link { display: inline-flex; align-items: center; gap: 0.35rem; color: var(--text3);
  text-decoration: none; font-size: 0.82rem; white-space: nowrap; }
.back-link:hover { color: var(--accent); }
.tagline { color: var(--text3); font-size: 0.8rem; white-space: nowrap; }
.header-spacer { flex: 1; }
.hdr-ctl { display: flex; align-items: center; gap: 0.5rem; }
select, .btn {
  background: var(--surface2); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px;
  font: inherit; font-size: 0.85rem; padding: 0.38rem 0.6rem; cursor: pointer;
}
select:hover, .btn:hover { border-color: var(--accent); }
.btn.icon { width: 34px; height: 34px; display: inline-flex;
  align-items: center; justify-content: center; padding: 0; font-size: 1rem; }

/* ---------- shell ---------- */
.shell { display: flex; height: calc(100vh - 58px); }

/* ---------- sidebar ---------- */
aside {
  width: 292px; min-width: 292px; background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
}
.side-head { padding: 0.9rem 0.9rem 0.5rem; }
.search {
  width: 100%; padding: 0.5rem 0.7rem;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text); font: inherit; font-size: 0.85rem;
}
.search:focus { outline: none; border-color: var(--accent); }
.side-sel { padding: 0.35rem 0.9rem 0.55rem; display: flex; flex-wrap: wrap; gap: 0.32rem;
  border-bottom: 1px solid var(--border); min-height: 30px; align-items: center; }
.sel-pill {
  display: inline-flex; align-items: center; gap: 0.34rem;
  padding: 0.16rem 0.5rem; border-radius: 999px; font-size: 0.74rem; font-weight: 600;
  background: var(--surface2); border: 1px solid var(--border2); cursor: pointer;
}
.sel-pill .dot { width: 8px; height: 8px; border-radius: 50%; }
.sel-pill .x { color: var(--text3); font-weight: 400; }
.sel-pill:hover .x { color: var(--red); }
.clear-link { font-size: 0.72rem; color: var(--text3); cursor: pointer; border: 0;
  background: none; font-family: inherit; }
.clear-link:hover { color: var(--red); }
.side-list { flex: 1; overflow-y: auto; padding: 0.4rem 0 1.2rem; }
.sector-h {
  position: sticky; top: 0; z-index: 2;
  padding: 0.5rem 0.9rem 0.3rem; font-size: 0.68rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.09em; color: var(--text3);
  background: var(--surface); cursor: pointer; user-select: none;
  display: flex; justify-content: space-between;
}
.sector-h .n { color: var(--text3); font-weight: 400; }
.comp-row {
  display: flex; align-items: center; gap: 0.55rem;
  padding: 0.32rem 0.9rem; cursor: pointer; font-size: 0.85rem;
}
.comp-row:hover { background: var(--surface2); }
.comp-row.on { background: var(--accent-soft); }
.comp-row .tick { font-weight: 700; min-width: 52px;
  font-family: ui-monospace, Menlo, monospace; font-size: 0.78rem; }
.comp-row .nm { color: var(--text2); font-size: 0.78rem; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; flex: 1; }
.comp-row .cb {
  width: 15px; height: 15px; border: 1.5px solid var(--border2); border-radius: 4px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.65rem; color: #fff; flex: none;
}
.comp-row.on .cb { border-color: transparent; }

/* ---------- main ---------- */
main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.controls {
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  padding: 0.6rem 1.2rem; background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.ctl-group { display: flex; align-items: center; gap: 0.45rem; }
.ctl-label { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text3); font-weight: 700; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 8px;
  overflow: hidden; background: var(--surface2); }
.seg button {
  border: 0; background: none; color: var(--text2); font: inherit;
  font-size: 0.82rem; padding: 0.36rem 0.85rem; cursor: pointer;
}
.seg button.on { background: var(--accent); color: #04120c; font-weight: 700; }
[data-theme="light"] .seg button.on { color: #ffffff; }
.tabs {
  display: flex; gap: 0.15rem; padding: 0 1.2rem; background: var(--surface);
  border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: thin;
}
.tabs button {
  border: 0; background: none; color: var(--text2); font: inherit;
  font-size: 0.86rem; padding: 0.62rem 0.9rem; cursor: pointer; white-space: nowrap;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs button:hover { color: var(--text); }
.tabs button.on { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.content { flex: 1; overflow-y: auto; padding: 1.1rem 1.2rem 3rem; }
.hint { color: var(--text2); padding: 2.5rem 1rem; text-align: center; font-size: 0.95rem; }

/* ---------- KPI cards ---------- */
.kpi-row { display: grid; gap: 0.7rem;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); margin-bottom: 1rem; }
.kpi {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 0.75rem 0.9rem; box-shadow: var(--shadow);
}
.kpi .who { display: flex; align-items: center; gap: 0.45rem; font-weight: 700;
  font-size: 0.82rem; margin-bottom: 0.5rem; }
.kpi .who .dot { width: 9px; height: 9px; border-radius: 50%; }
.kpi .who .co { color: var(--text3); font-weight: 400; font-size: 0.74rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-price { display: flex; align-items: baseline; flex-wrap: wrap; gap: 0.5rem;
  margin-bottom: 0.55rem; padding-bottom: 0.5rem; border-bottom: 1px solid var(--border); }
.kpi-price .px { font-size: 1.35rem; font-weight: 800; letter-spacing: -0.02em;
  font-family: ui-monospace, Menlo, monospace; }
.kpi-price .chg { font-size: 0.82rem; font-weight: 700;
  font-family: ui-monospace, Menlo, monospace; }
.kpi-price .chg.up { color: var(--pos); }
.kpi-price .chg.down { color: var(--red); }
.kpi-price .px-lbl { margin-left: auto; font-size: 0.62rem; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--text3); align-self: center; }
.kpi-earn { display: flex; justify-content: space-between; align-items: center;
  margin-top: 0.55rem; padding-top: 0.5rem; border-top: 1px solid var(--border);
  font-size: 0.74rem; color: var(--text2); }
.kpi-earn .ed { font-weight: 700; color: var(--text);
  font-family: ui-monospace, Menlo, monospace; font-size: 0.76rem; }
.kpi table { width: 100%; border-collapse: collapse; font-size: 0.78rem; }
.kpi td { padding: 0.14rem 0; color: var(--text2); }
.kpi td:last-child { text-align: right; color: var(--text); font-weight: 600;
  font-family: ui-monospace, Menlo, monospace; font-size: 0.76rem; }

/* ---------- chart cards ---------- */
.grid { display: grid; gap: 0.9rem; grid-template-columns: repeat(auto-fill, minmax(430px, 1fr)); }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 0.8rem 0.9rem 0.6rem; box-shadow: var(--shadow); min-width: 0;
}
.card-head { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.4rem; }
.card-title { font-size: 0.88rem; font-weight: 700; flex: 1; }
.card-tools { display: flex; gap: 0.25rem; }
.tool-btn {
  border: 1px solid var(--border); background: var(--surface2); color: var(--text3);
  border-radius: 6px; font-size: 0.66rem; padding: 0.14rem 0.44rem; cursor: pointer;
  font-family: inherit;
}
.tool-btn.on, .tool-btn:hover { color: var(--accent); border-color: var(--accent); }
.chart-box { position: relative; height: 240px; }
.card.wide { grid-column: 1 / -1; }
.card.wide .chart-box { height: 300px; }

/* ---------- tables ---------- */
.tbl-wrap { overflow-x: auto; }
table.data { border-collapse: collapse; font-size: 0.78rem; width: 100%; }
table.data th, table.data td {
  padding: 0.34rem 0.6rem; text-align: right; white-space: nowrap;
  border-bottom: 1px solid var(--border);
  font-family: ui-monospace, Menlo, monospace; font-size: 0.74rem;
}
table.data th { color: var(--text3); font-weight: 600; background: var(--surface2);
  position: sticky; top: 0; }
table.data td:first-child, table.data th:first-child {
  text-align: left; font-family: inherit; font-size: 0.78rem;
  position: sticky; left: 0; background: var(--surface);
}
table.data th:first-child { background: var(--surface2); }
table.data tr:hover td { background: var(--surface2); }
table.data td.neg { color: var(--red); }

/* ---------- DCF ---------- */
.dcf-grid { display: grid; gap: 0.9rem; grid-template-columns: repeat(auto-fill, minmax(480px, 1fr)); }
.dcf-card { background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 1rem; box-shadow: var(--shadow); }
.dcf-inputs { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.55rem; margin: 0.7rem 0; }
.dcf-inputs label { font-size: 0.66rem; color: var(--text3); display: block;
  text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.15rem; }
.dcf-inputs input {
  width: 100%; padding: 0.34rem 0.5rem; background: var(--surface2);
  border: 1px solid var(--border); border-radius: 7px; color: var(--text);
  font-family: ui-monospace, Menlo, monospace; font-size: 0.8rem;
}
.dcf-inputs input:focus { outline: none; border-color: var(--accent); }
.dcf-out { display: flex; flex-wrap: wrap; gap: 1.4rem; margin: 0.6rem 0;
  padding: 0.65rem 0.8rem; background: var(--surface2); border-radius: 10px; }
.dcf-out .item .l { font-size: 0.66rem; color: var(--text3); text-transform: uppercase; }
.dcf-out .item .v { font-size: 1.06rem; font-weight: 700;
  font-family: ui-monospace, Menlo, monospace; }
.dcf-out .item .v.up { color: var(--pos); }
.dcf-out .item .v.down { color: var(--red); }
.sens { font-size: 0.7rem; }
.sens caption { text-align: left; color: var(--text3); font-size: 0.7rem;
  margin: 0.5rem 0 0.3rem; caption-side: top; }
.sens td, .sens th { padding: 0.22rem 0.5rem; text-align: right;
  font-family: ui-monospace, Menlo, monospace; border: 1px solid var(--border); }
.sens td.hot { background: var(--accent-soft); color: var(--accent); font-weight: 700; }

/* ---------- filings ---------- */
.fil-grid { display: grid; gap: 0.9rem; grid-template-columns: repeat(auto-fill, minmax(480px, 1fr)); }
.fil-card { background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 1rem; box-shadow: var(--shadow); }
.fil-card h3 { font-size: 0.95rem; display: flex; align-items: center; gap: 0.5rem; }
.fil-card h4 { font-size: 0.74rem; color: var(--text3); text-transform: uppercase;
  letter-spacing: 0.07em; margin: 0.9rem 0 0.35rem; }
.fil-card .desc { color: var(--text2); font-size: 0.8rem; margin-top: 0.4rem; }
.meta-row { display: flex; flex-wrap: wrap; gap: 0.4rem 1.2rem; margin-top: 0.45rem;
  font-size: 0.75rem; color: var(--text2); }
.meta-row b { color: var(--text); font-weight: 600; }
ul.hl-list { margin: 0.3rem 0 0 1.1rem; font-size: 0.82rem; color: var(--text2); }
ul.hl-list li { margin-bottom: 0.22rem; }
.fil-list { max-height: 260px; overflow-y: auto; }
.fil-list table { width: 100%; border-collapse: collapse; font-size: 0.78rem; }
.fil-list td { padding: 0.26rem 0.4rem; border-bottom: 1px solid var(--border); }
.fil-list td.frm { font-weight: 700; font-family: ui-monospace, Menlo, monospace;
  font-size: 0.72rem; }
.fil-list a { color: var(--blue); text-decoration: none; }
.fil-list a:hover { text-decoration: underline; }

footer.note {
  padding: 0.8rem 1.2rem 1.4rem; color: var(--text3); font-size: 0.72rem;
  max-width: 1100px;
}
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 6px; }
::-webkit-scrollbar-track { background: transparent; }

@media (max-width: 900px) {
  .shell { flex-direction: column; }
  aside { width: 100%; min-width: 0; max-height: 40vh; }
  body { overflow: auto; }
  .shell { height: auto; }
}
