/* Risk Ledger — Integrity Wealth Management
   A printed report on warm paper: evergreen ink, a brass rule, oxblood for the warning.
   Fraunces carries the numerals; Instrument Sans carries the working text. */

:root {
  --paper: #F4EFE5;
  --paper-2: #ECE5D6;
  --paper-3: #E3DAC7;
  --ink: #132A24;
  --ink-2: #3E5A51;
  --muted: #7A8B84;
  --hair: rgba(19, 42, 36, 0.16);
  --hair-2: rgba(19, 42, 36, 0.32);
  --brass: #B08D3C;
  --brass-tint: rgba(176, 141, 60, 0.16);
  --oxblood: #9E3A2B;
  --oxblood-tint: rgba(158, 58, 43, 0.12);
  --sage: #4E8163;
  --sage-tint: rgba(78, 129, 99, 0.16);
  --display: "Fraunces", "Iowan Old Style", Georgia, serif;
  --text: "Instrument Sans", "Helvetica Neue", Arial, sans-serif;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: var(--text);
  font-size: 15px;
  line-height: 1.5;
  font-feature-settings: "tnum" 1, "ss01" 1;
  position: relative;
}
body::before {
  content: "";
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.08 0 0 0 0 0.16 0 0 0 0 0.14 0 0 0 0.06 0'/></filter><rect width='160' height='160' filter='url(%23n)'/></svg>");
  opacity: 0.55;
}
main, header, footer { position: relative; z-index: 1; }

a { color: inherit; }
button { font: inherit; }
h1, h2, h3 { margin: 0; font-weight: 400; }
.cap {
  font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-2);
}
.private { }

/* ---------- masthead ---------- */
.masthead {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 24px;
  padding: 18px 40px;
  border-bottom: 1px solid var(--hair-2);
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: baseline; gap: 18px; }
.brand .firm { font-size: 11px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--ink); }
.brand .tool { font-family: var(--display); font-style: italic; font-weight: 300; font-size: 24px; letter-spacing: -0.01em; white-space: nowrap; }
.brand .tool::before { content: "·"; margin-right: 18px; color: var(--brass); font-style: normal; }
.client-line { display: flex; align-items: center; gap: 18px; }
.client-line label { display: flex; align-items: baseline; gap: 10px; font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-2); }
.client-line input {
  font-family: var(--display); font-size: 18px; color: var(--ink);
  border: 0; border-bottom: 1px solid var(--hair-2); background: transparent; padding: 2px 0; width: 240px;
  outline: none; letter-spacing: 0;
}
.client-line input:focus { border-bottom-color: var(--brass); }
.client-line .date { font-size: 13px; color: var(--muted); }
.actions { display: flex; gap: 10px; }
.ghost, .solid {
  border: 1px solid var(--ink); background: transparent; color: var(--ink);
  padding: 9px 16px; border-radius: 999px; cursor: pointer; font-size: 13px; letter-spacing: 0.02em;
  transition: background 200ms var(--ease), color 200ms var(--ease), transform 200ms var(--ease);
}
.ghost:hover { background: var(--paper-3); }
.solid { background: var(--ink); color: var(--paper); }
.solid:hover { transform: translateY(-1px); }

/* ---------- the ledger plate ---------- */
main { max-width: 1240px; margin: 0 auto; padding: 36px 40px 80px; }
.ledger {
  border: 1px solid var(--ink);
  padding: 36px 40px 30px;
  background: color-mix(in srgb, var(--paper-2) 60%, transparent);
  position: relative;
  animation: rise 700ms var(--ease) both;
}
.ledger::after {
  content: ""; position: absolute; left: 12px; right: 12px; top: 12px; bottom: 12px;
  border: 1px solid var(--hair); pointer-events: none;
}
.numerals { display: grid; grid-template-columns: repeat(3, 1fr); gap: 32px; }
.numeral { display: grid; gap: 6px; padding-right: 24px; border-right: 1px solid var(--hair); }
.numeral:last-child { border-right: 0; }
.numeral .big {
  font-family: var(--display); font-weight: 300; font-size: 104px; line-height: 0.95; letter-spacing: -0.03em;
  font-variation-settings: "opsz" 144;
  color: var(--ink);
}
.numeral[data-tone="over"] .big { color: var(--oxblood); }
.numeral[data-tone="warn"] .big { color: var(--brass); }
.numeral[data-tone="ok"] .big { color: var(--sage); }
.numeral .sub { font-size: 13px; color: var(--muted); }

.scale { position: relative; height: 96px; margin: 36px 8px 8px; }
.scale .rail { position: absolute; left: 0; right: 0; top: 56px; height: 2px; background: var(--ink); }
.scale .tick { position: absolute; top: 50px; width: 1px; height: 14px; background: var(--ink); }
.scale .tick span { position: absolute; top: 18px; left: 0; transform: translateX(-50%); font-size: 11px; letter-spacing: 0.1em; color: var(--ink-2); }
.scale .band {
  position: absolute; top: 44px; height: 26px; background: var(--sage-tint); border-left: 1px solid var(--sage); border-right: 1px solid var(--sage);
  left: 0; width: 0; opacity: 0; transition: left 900ms var(--ease), width 900ms var(--ease), opacity 400ms;
}
.pin {
  position: absolute; top: 0; left: 0; width: 0; height: 74px; opacity: 0;
  transition: left 900ms var(--ease), opacity 400ms var(--ease);
}
.pin .stem { position: absolute; left: -0.5px; top: 22px; width: 1px; height: 46px; background: var(--ink); }
.pin .head { position: absolute; left: -6px; top: 50px; width: 12px; height: 12px; transform: rotate(45deg); background: var(--paper); border: 1.5px solid var(--ink); }
.pin .tag { position: absolute; top: 0; left: 0; transform: translateX(-50%); white-space: nowrap; font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; }
.pin .tag b { font-family: var(--display); font-weight: 400; font-size: 15px; letter-spacing: 0; margin-left: 6px; }
.pin-pref .head { background: var(--sage); border-color: var(--sage); }
.pin-cap .head { background: var(--paper); border-color: var(--sage); }
.pin-pref .tag, .pin-cap .tag { color: var(--sage); }
.pin-port { height: 96px; }
.pin-port .stem { top: 56px; height: 40px; }
.pin-port .head { top: 50px; }
.pin-port .tag { top: 84px; }
.pin-port[data-tone="over"] .head { background: var(--oxblood); border-color: var(--oxblood); }
.pin-port[data-tone="over"] .tag, .pin-port[data-tone="over"] .stem { color: var(--oxblood); background-color: var(--oxblood); }
.pin-port[data-tone="over"] .tag { background: none; }
.pin-port[data-tone="warn"] .head { background: var(--brass); border-color: var(--brass); }
.pin-port[data-tone="warn"] .tag { color: var(--brass); }
.pin-port[data-tone="ok"] .head { background: var(--sage); border-color: var(--sage); }
.pin-port[data-tone="ok"] .tag { color: var(--sage); }
.pin.on { opacity: 1; }
.verdict {
  margin: 26px 0 0; padding-top: 18px; border-top: 1px solid var(--hair);
  font-family: var(--display); font-size: 20px; font-weight: 300; line-height: 1.35; letter-spacing: -0.005em;
}
.verdict[data-tone="over"] { color: var(--oxblood); }
.verdict[data-tone="warn"] { color: var(--brass); }
.verdict[data-tone="ok"] { color: var(--sage); }
.verdict[data-tone="muted"] { color: var(--muted); }

/* ---------- intake ---------- */
.intake { display: grid; grid-template-columns: 1.2fr 1fr 1fr; gap: 28px; margin-top: 44px; }
.step {
  border-top: 2px solid var(--ink); padding-top: 14px; min-width: 0;
  animation: rise 700ms var(--ease) both;
}
.intake .step:nth-child(1) { animation-delay: 80ms; }
.intake .step:nth-child(2) { animation-delay: 160ms; }
.intake .step:nth-child(3) { animation-delay: 240ms; }
.step h2 { display: flex; align-items: baseline; gap: 14px; font-family: var(--display); font-size: 22px; font-weight: 400; margin-bottom: 4px; }
.step h2 .n { font-style: italic; font-weight: 300; color: var(--brass); font-size: 20px; }
.step .lede { margin: 0 0 16px; color: var(--ink-2); font-size: 14px; }
.step .live { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-top: 18px; padding-top: 12px; border-top: 1px solid var(--hair); }
.step .live .big { font-family: var(--display); font-size: 40px; font-weight: 300; line-height: 1; }
.step .live .note { font-size: 12px; color: var(--muted); text-align: right; }

.drop {
  display: block;
  border: 1px dashed var(--hair-2); padding: 26px 20px; text-align: center; border-radius: 4px; cursor: pointer;
  transition: border-color 200ms, background 200ms;
  background: color-mix(in srgb, var(--paper-2) 40%, transparent);
}
.drop.over, .drop:hover { border-color: var(--brass); background: var(--brass-tint); }
.drop strong { display: block; font-family: var(--display); font-weight: 400; font-size: 19px; margin-bottom: 4px; }
.drop span { color: var(--ink-2); font-size: 13px; }
.drop input { display: none; }
.row-links { display: flex; justify-content: space-between; gap: 12px; margin-top: 10px; font-size: 13px; }
.row-links button { background: none; border: 0; padding: 0; color: var(--ink-2); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.row-links button:hover { color: var(--ink); }
.paste { margin-top: 12px; display: none; }
.paste.open { display: block; }
.paste textarea { width: 100%; min-height: 120px; font: 12px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; border: 1px solid var(--hair-2); background: var(--paper); color: var(--ink); padding: 8px; resize: vertical; }
.paste .row-links { justify-content: flex-end; }
.accounts { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 8px; }
.accounts li { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--hair); font-size: 14px; }
.accounts li .name { font-family: var(--display); font-size: 16px; }
.accounts li .meta { color: var(--muted); font-size: 12px; white-space: nowrap; }
.accounts li button { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 16px; line-height: 1; padding: 0 4px; }
.accounts li button:hover { color: var(--oxblood); }
.privacy { margin: 14px 0 0; font-size: 12px; color: var(--muted); line-height: 1.45; }

.q { margin: 0 0 14px; }
.q .qt { font-size: 13px; margin: 0 0 8px; color: var(--ink); }
.q .qt em { font-style: normal; color: var(--muted); }
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pill { position: relative; }
.pill input { position: absolute; opacity: 0; inset: 0; pointer-events: none; }
.pill span {
  display: inline-block; padding: 6px 11px; border: 1px solid var(--hair-2); border-radius: 999px; font-size: 12.5px; cursor: pointer;
  transition: background 160ms, color 160ms, border-color 160ms;
  background: var(--paper);
}
.pill span small { display: block; font-size: 11px; color: var(--muted); }
.pill input:checked + span { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.pill input:checked + span small { color: var(--paper-3); }
.pill input:focus-visible + span { outline: 2px solid var(--brass); outline-offset: 2px; }
.field { margin: 0 0 12px; }
.field label { display: block; font-size: 13px; margin-bottom: 6px; }
.field select {
  width: 100%; font: inherit; font-size: 13.5px; padding: 8px 10px; border: 1px solid var(--hair-2); background: var(--paper); color: var(--ink);
  border-radius: 3px;
}
.ledger-lines { margin: 10px 0 0; padding: 0; list-style: none; font-size: 12px; color: var(--ink-2); }
.ledger-lines li { display: flex; justify-content: space-between; gap: 10px; padding: 3px 0; border-bottom: 1px dotted var(--hair); }
.ledger-lines li b { font-weight: 500; color: var(--ink); }

/* ---------- report ---------- */
.report { margin-top: 56px; display: grid; gap: 44px; }
.report[hidden] { display: none; }
.block { border-top: 2px solid var(--ink); padding-top: 14px; animation: rise 600ms var(--ease) both; }
.block h2 { font-family: var(--display); font-size: 22px; font-weight: 400; margin-bottom: 6px; display: flex; align-items: baseline; gap: 14px; }
.block h2 .n { font-style: italic; font-weight: 300; color: var(--brass); font-size: 20px; }
.block .lede { margin: 0 0 18px; color: var(--ink-2); font-size: 14px; max-width: 70ch; }

.range-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 28px; align-items: end; }
.range-grid .stat { border-left: 1px solid var(--hair); padding-left: 18px; }
.range-grid .stat .big { font-family: var(--display); font-weight: 300; font-size: 44px; line-height: 1; letter-spacing: -0.02em; }
.range-grid .stat .big.neg { color: var(--oxblood); }
.range-grid .stat .big.pos { color: var(--sage); }
.range-grid .stat .sub { font-size: 13px; color: var(--muted); margin-top: 6px; }
.range-sentence { font-family: var(--display); font-size: 20px; font-weight: 300; line-height: 1.4; margin: 0 0 22px; max-width: 60ch; }
.range-sentence b { font-weight: 400; }

table.holdings { width: 100%; border-collapse: collapse; font-size: 13px; }
table.holdings th { text-align: left; font-weight: 500; font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-2); padding: 8px 8px 8px 0; border-bottom: 1px solid var(--ink); white-space: nowrap; }
table.holdings td { padding: 9px 8px 9px 0; border-bottom: 1px solid var(--hair); vertical-align: middle; }
table.holdings .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
#holdingsBlock { overflow-x: auto; }
table.holdings th.num { text-align: right; }
table.holdings td.sym { font-family: var(--display); font-size: 16px; white-space: nowrap; }
table.holdings td.name { color: var(--ink-2); max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
table.holdings td.acct { color: var(--muted); font-size: 11.5px; max-width: 150px; }
.scorebar { display: inline-grid; grid-template-columns: 30px 70px; align-items: center; gap: 8px; }
.scorebar b { font-family: var(--display); font-weight: 400; font-size: 17px; text-align: right; }
.scorebar i { display: block; height: 6px; background: var(--paper-3); position: relative; }
.scorebar i::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: var(--w, 0%); background: var(--ink); }
.scorebar.over i::after { background: var(--oxblood); }
.scorebar.ok i::after { background: var(--sage); }
.unpriced { margin-top: 18px; font-size: 13px; color: var(--ink-2); }
.unpriced ul { margin: 6px 0 0; padding-left: 18px; }
.foot { font-size: 12px; color: var(--muted); margin-top: 12px; }

.traj-wrap { display: grid; grid-template-columns: 1fr 260px; gap: 28px; align-items: start; }
.traj-wrap svg { width: 100%; height: auto; display: block; }
.legend { font-size: 13px; display: grid; gap: 10px; }
.legend .k { display: flex; gap: 10px; align-items: flex-start; }
.legend .sw { width: 22px; height: 12px; flex: none; margin-top: 4px; border: 1px solid var(--hair-2); }
.legend .sw.port { background: var(--oxblood-tint); border-color: var(--oxblood); }
.legend .sw.ref { background: var(--sage-tint); border-color: var(--sage); border-style: dashed; }
.legend .vals { font-size: 12px; color: var(--ink-2); line-height: 1.5; }
.legend .vals b { font-weight: 500; color: var(--ink); }

.lookup-row { display: flex; gap: 12px; align-items: stretch; max-width: 520px; }
.lookup-row input { flex: 1; font: inherit; font-family: var(--display); font-size: 20px; padding: 8px 12px; border: 1px solid var(--hair-2); background: var(--paper); color: var(--ink); text-transform: uppercase; }
.lookup-row button { border: 1px solid var(--ink); background: var(--ink); color: var(--paper); padding: 0 18px; border-radius: 3px; cursor: pointer; }
.lookup-result { margin-top: 18px; display: none; grid-template-columns: auto 1fr; gap: 24px; align-items: center; max-width: 720px; border: 1px solid var(--hair-2); padding: 18px 22px; background: color-mix(in srgb, var(--paper-2) 50%, transparent); }
.lookup-result.on { display: grid; }
.lookup-result .big { font-family: var(--display); font-weight: 300; font-size: 72px; line-height: 0.95; letter-spacing: -0.03em; }
.lookup-result .body { font-size: 14px; color: var(--ink-2); }
.lookup-result .body b { font-family: var(--display); font-weight: 400; font-size: 18px; color: var(--ink); display: block; }

details.method summary { cursor: pointer; font-family: var(--display); font-size: 22px; font-weight: 400; list-style: none; display: flex; align-items: baseline; gap: 14px; }
details.method summary::-webkit-details-marker { display: none; }
details.method summary .n { font-style: italic; font-weight: 300; color: var(--brass); font-size: 20px; }
details.method summary::after { content: "Open"; font-family: var(--text); font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); margin-left: auto; }
details.method[open] summary::after { content: "Close"; }
.method-body { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; margin-top: 16px; font-size: 13.5px; color: var(--ink-2); }
.method-body h3 { font-family: var(--display); font-size: 17px; color: var(--ink); margin-bottom: 6px; }
.method-body p { margin: 0 0 10px; }
.method-body table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.method-body td { padding: 4px 0; border-bottom: 1px dotted var(--hair); }
.method-body td:last-child { text-align: right; font-variant-numeric: tabular-nums; }

.notice { display: none; margin: 18px 0 0; padding: 12px 16px; border: 1px solid var(--oxblood); color: var(--oxblood); background: var(--oxblood-tint); font-size: 14px; }
.notice.on { display: block; }
.busy { display: none; font-size: 12px; color: var(--muted); letter-spacing: 0.1em; text-transform: uppercase; }
.busy.on { display: inline-block; animation: pulse 1.2s ease-in-out infinite; }

footer { max-width: 1240px; margin: 0 auto; padding: 0 40px 40px; font-size: 12px; color: var(--muted); display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
footer .firm { color: var(--ink-2); }

@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes pulse { 0%, 100% { opacity: 0.4; } 50% { opacity: 1; } }

/* ---------- client page: on screen (?view=client) and on paper ---------- */
body.client-view .intake, body.client-view .actions, body.client-view .lookup-block, body.client-view .row-links, body.client-view .notice { display: none !important; }
body.client-view details.method { display: block; }
body.client-view .client-line input { border-bottom-color: transparent; }
.client-only { display: none !important; }
body.client-view .client-only { display: block !important; }
body.client-view .prepared.client-only { display: flex !important; }
.prepared { border-top: 1px solid var(--hair-2); margin-top: 8px; padding-top: 14px; font-size: 13px; color: var(--ink-2); display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.prepared b { color: var(--ink); font-weight: 500; }

@media print {
  @page { margin: 14mm; }
  body { background: #fff; font-size: 12px; }
  body::before { display: none; }
  .masthead { position: static; border-bottom: 1px solid #000; padding: 0 0 10px; backdrop-filter: none; background: none; }
  .actions, .intake, .lookup-block, .row-links, .notice, .busy { display: none !important; }
  main { padding: 0; max-width: none; }
  .ledger { break-inside: avoid; padding: 20px 24px; background: none; }
  .numeral .big { font-size: 72px; }
  .report { gap: 22px; margin-top: 24px; }
  .block { break-inside: avoid; }
  details.method { display: block; }
  details.method summary::after { display: none; }
  details.method:not([open]) .method-body { display: grid; }
  .client-only { display: block !important; }
  .prepared.client-only { display: flex !important; }
  footer { padding: 0; }
  .traj-wrap { grid-template-columns: 1fr 200px; }
}

/* ---------- small screens ---------- */
@media (max-width: 1000px) {
  .intake { grid-template-columns: 1fr; }
  .numerals { gap: 18px; }
  .numeral .big { font-size: 72px; }
  .traj-wrap { grid-template-columns: 1fr; }
  .method-body { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .masthead { grid-template-columns: 1fr; gap: 10px; padding: 14px 16px; }
  .client-line { justify-content: space-between; }
  .client-line input { width: 160px; }
  main { padding: 20px 16px 60px; }
  .ledger { padding: 22px 18px 20px; }
  .numerals { grid-template-columns: 1fr; }
  .numeral { border-right: 0; border-bottom: 1px solid var(--hair); padding: 0 0 10px; }
  .numeral:last-child { border-bottom: 0; }
  .numeral .big { font-size: 64px; }
  .scale { margin: 28px 4px 4px; }
  .pin .tag { font-size: 9px; letter-spacing: 0.08em; }
  .range-grid { grid-template-columns: 1fr; }
  table.holdings td.name { display: none; }
  table.holdings th.name { display: none; }
  footer { padding: 0 16px 30px; }
}
