:root {
  --bg: #0e1114;
  --card: #171c21;
  --line: #2a323a;
  --txt: #e8edf2;
  --dim: #8b98a5;
  --up: #3dcc8a;
  --dn: #f07178;
  --acc: #c9a227;
  --warn: #e6a23c;
  --high: #f07178;
  --med: #e6a23c;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font: 15px/1.45 "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--txt);
}
header {
  padding: 1.1rem 1.1rem 0.6rem;
  border-bottom: 1px solid var(--line);
}
header h1 { font-size: 1.15rem; font-weight: 650; margin: 0; letter-spacing: 0.02em; }
header p { margin: 0.25rem 0 0; color: var(--dim); font-size: 0.82rem; }
header .row { display: flex; justify-content: space-between; gap: 0.8rem; align-items: flex-start; flex-wrap: wrap; }
nav {
  display: flex; gap: 0.5rem; overflow-x: auto; padding: 0.7rem 1.1rem;
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: var(--bg); z-index: 2;
}
nav a {
  color: var(--dim); text-decoration: none; white-space: nowrap;
  font-size: 0.8rem; padding: 0.25rem 0.55rem; border: 1px solid var(--line); border-radius: 999px;
}
nav a:hover { color: var(--txt); border-color: var(--acc); }
main { padding: 1rem 1.1rem 3rem; max-width: 1400px; margin: 0 auto; }
section { margin: 1.4rem 0; }
h2 { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--acc); margin: 0 0 0.6rem; }
.grid { display: grid; gap: 0.7rem; grid-template-columns: repeat(4, 1fr); }
.grid-2 { display: grid; gap: 0.7rem; grid-template-columns: 1fr 1fr; }
@media (max-width: 900px) { .grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 640px) { .grid, .grid-2 { grid-template-columns: 1fr; } }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 0.85rem 0.95rem;
}
.card h3 { margin: 0 0 0.35rem; font-size: 0.95rem; }
.muted { color: var(--dim); font-size: 0.82rem; }
.stat { font-variant-numeric: tabular-nums; font-size: 1.35rem; font-weight: 600; }
.stat.sm { font-size: 1.05rem; }
.up { color: var(--up); }
.dn { color: var(--dn); }
.tag { font-size: 0.7rem; padding: 0.1rem 0.4rem; border-radius: 4px; background: #2a2416; color: var(--acc); }
.sev-high { background: #3a1a1e; color: var(--high); }
.sev-med { background: #3a2e16; color: var(--med); }
table { width: 100%; border-collapse: collapse; font-size: 0.82rem; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 0.42rem 0.35rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--dim); font-weight: 500; cursor: pointer; user-select: none; }
th:hover { color: var(--txt); }
td.num, th.num { text-align: right; }
tr.reduce-high { background: rgba(240, 113, 120, 0.12); }
tr.reduce-med { background: rgba(230, 162, 60, 0.10); }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; background: var(--card); }
.sugg { border-left: 3px solid var(--acc); }
.sugg h3 { font-size: 0.9rem; }
.caveat { font-size: 0.8rem; color: var(--dim); margin: 0.25rem 0; }
footer { color: var(--dim); font-size: 0.75rem; padding: 1rem 1.1rem 2rem; max-width: 1400px; margin: 0 auto; }
.bar {
  height: 6px; background: #22282e; border-radius: 3px; overflow: hidden; margin-top: 0.35rem;
}
.bar > span { display: block; height: 100%; background: var(--acc); }
.login-gate {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1.5rem;
}
.login-box { max-width: 360px; width: 100%; }
.login-box input {
  width: 100%; padding: 0.65rem 0.75rem; margin: 0.5rem 0 0.8rem;
  border: 1px solid var(--line); border-radius: 8px; background: #11161a; color: var(--txt); font: inherit;
}
.login-box button {
  width: 100%; padding: 0.65rem; border: 1px solid var(--acc); border-radius: 8px;
  background: #2a2416; color: var(--acc); font: inherit; font-weight: 600; cursor: pointer;
}
.login-box button:hover { background: #3a3220; }
.err { color: var(--dn); font-size: 0.82rem; min-height: 1.2em; }
#app[hidden], #login[hidden] { display: none !important; }

.hdr-actions { display:flex; gap:0.45rem; align-items:center; flex-wrap:wrap; }
button.btn.tag {
  cursor:pointer; font:inherit; border:1px solid var(--line);
  background:#2a2416; color:var(--acc);
}
button.btn.tag[aria-pressed="true"] {
  border-color:var(--acc); background:#3a3218;
}
body.privacy-on .privacy-money .stat,
body.privacy-on .privacy-money .stat.sm,
body.privacy-on td.privacy-col,
body.privacy-on th.privacy-col {
  filter: blur(7px);
  user-select: none;
  color: transparent !important;
  text-shadow: 0 0 12px rgba(232,237,242,0.55);
}
body.privacy-on .privacy-money::after {
  content: "hidden";
  display:block;
  font-size:0.7rem;
  color:var(--dim);
  margin-top:0.2rem;
}

body.privacy-on .privacy-inline { filter: blur(7px); user-select: none; }

.group-card { margin-bottom: 0.7rem; }
.group-card .group-head { display:flex; justify-content:space-between; gap:0.8rem; flex-wrap:wrap; align-items:flex-start; }
.group-card .group-note { color:var(--dim); font-size:0.82rem; margin:0.35rem 0 0.55rem; }
.group-metrics { display:grid; grid-template-columns:repeat(4,1fr); gap:0.5rem; margin:0.4rem 0 0.6rem; }
@media (max-width: 900px) { .group-metrics { grid-template-columns:1fr 1fr; } }
.group-metrics .m { background:#11161a; border:1px solid var(--line); border-radius:8px; padding:0.45rem 0.55rem; }
.group-metrics .m .v { font-variant-numeric:tabular-nums; font-weight:600; font-size:0.95rem; }
.group-kind { font-size:0.7rem; padding:0.1rem 0.4rem; border-radius:4px; background:#1a2430; color:#8ab4ff; }
.role-hedge { color:var(--acc); }
.role-core { color:var(--up); }
.missing-leg { opacity:0.55; font-style:italic; }

#pos-table thead th {
  position: sticky; top: 0; background: var(--card); z-index: 1;
  box-shadow: 0 1px 0 var(--line);
}
#pos-totals tr.totals-row td {
  font-weight: 700;
  border-bottom: 2px solid var(--acc);
  background: #1a2229;
  position: sticky; top: 2.1rem; z-index: 1;
}
#pos-table { font-size: 0.78rem; }
