/* the document pages: /r/<wallet>, /ledger, /how (on top of town.css) */
body.page { overflow: auto; height: auto; min-height: 100%; }
body.page .bar { grid-template-columns: auto 1fr auto; }
.crumbs { display: flex; align-items: center; gap: 9px; font: 500 13px/1 var(--f); color: var(--ink-3); }
.crumbs a { color: var(--ink-2); } .crumbs a:hover { color: var(--ink); } .crumbs b { color: var(--ink); font-weight: 600; }
.dim { color: var(--ink-3); font-weight: 400; }
.up { color: var(--green) !important; } .down { color: var(--red) !important; }
.mini { font: 500 11.5px/1 var(--f); color: var(--ink-2); padding: 5px 8px; border: 1px solid var(--line-2); border-radius: 4px; background: var(--panel); }
.mini:hover { color: var(--ink); }
.mini.share { color: #1a0f02; background: var(--amber); border-color: var(--amber); font-weight: 600; }
h2 { font: 400 11px/1 var(--px); text-transform: uppercase; letter-spacing: 0.04em; color: var(--amber); margin: 30px 0 12px; display: flex; gap: 10px; align-items: baseline; }
h2 .dim { font: 400 11.5px/1 var(--m); text-transform: none; letter-spacing: 0; }

/* ---------- resident ---------- */
.rp { display: grid; grid-template-columns: minmax(0, 1fr) 600px; min-height: calc(100vh - var(--bar)); padding-top: var(--bar); }
.rp-view { position: sticky; top: var(--bar); height: calc(100vh - var(--bar)); background: #04050b; border-right: 1px solid var(--line); }
.rp-view iframe { width: 100%; height: 100%; border: 0; display: block; }
.rp-cap { position: absolute; left: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 4px; padding: 10px 13px; background: rgba(8, 10, 21, 0.9); border: 1px solid var(--line-2); border-radius: 6px; max-width: 70%; }
.rp-cap b { font: 600 14px/1.2 var(--f); }
.rp-cap span { font: 400 12.5px/1.3 var(--f); color: var(--ink-2); }
.rp-doc { padding: 28px 34px 60px; }
.rp-hero { display: grid; grid-template-columns: 120px 1fr; gap: 20px; align-items: center; }
#pic { width: 120px; height: 150px; border-radius: 8px; border: 1px solid var(--line-2); image-rendering: pixelated; background: #080a16; }
.rp-id { display: grid; gap: 7px; min-width: 0; }
.rp-id h1 { margin: 0; font: 650 30px/1.05 var(--f); letter-spacing: -0.01em; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rp-id p { margin: 0; color: var(--ink-2); font: 400 14px/1.3 var(--f); }
.rp-addr { display: flex; align-items: center; gap: 8px; font: 400 12.5px/1 var(--m) !important; color: var(--ink-3) !important; }
.job.mayor { background: var(--gold); }
.rp-facts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; margin-top: 22px; background: var(--line); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.rp-facts div { display: grid; gap: 4px; padding: 12px 13px; background: #0a0d1c; min-width: 0; }
.rp-facts i { font: 500 11px/1 var(--f); font-style: normal; color: var(--ink-3); }
.rp-facts b { font: 600 15px/1.2 var(--f); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rp-facts em { font: 400 11.5px/1.2 var(--f); font-style: normal; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rp-traits { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.rp-traits li { padding: 14px 15px; background: #0a0d1c; border: 1px solid var(--line); border-radius: 8px; }
.rp-traits li.empty { color: var(--ink-3); }
.rp-traits .th { display: flex; justify-content: space-between; align-items: center; }
.rp-traits .tl { font: 400 11px/1 var(--px); text-transform: uppercase; color: var(--amber); }
.rp-traits .src { font: 400 11px/1 var(--m); color: var(--ink-3); }
.rp-traits p { margin: 9px 0 11px; font: 500 15px/1.4 var(--f); color: var(--ink); }
.rp-traits .nums { display: flex; flex-wrap: wrap; gap: 6px; }
.rp-traits .nums span { font: 400 12px/1 var(--m); color: var(--ink-2); padding: 6px 8px; background: #12162e; border-radius: 4px; }
.rp-traits .nums b { color: var(--ink); font-weight: 600; }
.rp-traits .proof { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 10px; }
.rp-traits .proof a { font: 500 12.5px/1 var(--f); color: var(--cyan); }
.rp-stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.rp-stats div { display: grid; gap: 5px; padding: 12px; background: #0a0d1c; min-width: 0; }
.rp-stats i { font: 500 11px/1 var(--f); font-style: normal; color: var(--ink-3); }
.rp-stats b { font: 600 15px/1.2 var(--m); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rp-mem { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.rp-mem li { font: 400 13.5px/1.4 var(--f); color: var(--ink-2); padding: 9px 12px; border-left: 2px solid var(--line-2); background: #090b18; }
.rp-card img { width: 100%; height: auto; border-radius: 8px; border: 1px solid var(--line-2); display: block; background: #080a16; }
.rp-card p { margin: 9px 0 0; font-size: 12.5px; }

/* ---------- ledger + how ---------- */
.doc { max-width: 1160px; margin: 0 auto; padding: calc(var(--bar) + 34px) 28px 70px; }
.doc-head h1 { margin: 0 0 10px; font: 650 34px/1.1 var(--f); letter-spacing: -0.015em; }
.doc-head p { margin: 0; max-width: 760px; color: var(--ink-2); font: 400 15.5px/1.5 var(--f); }
.tiles { display: grid; grid-template-columns: repeat(6, 1fr); gap: 1px; margin-top: 26px; background: var(--line); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.tiles div { display: grid; gap: 6px; padding: 16px 16px 15px; background: #0a0d1c; min-width: 0; }
.tiles i { font: 500 11.5px/1 var(--f); font-style: normal; color: var(--ink-3); }
.tiles b { font: 600 21px/1.1 var(--m); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tiles em { font: 400 11.5px/1.2 var(--f); font-style: normal; color: var(--ink-3); }
.tiles .hot b { color: var(--amber); }
.tbl { width: 100%; border-collapse: collapse; font: 400 13px/1.3 var(--f); }
.tbl th { text-align: left; font: 500 11.5px/1 var(--f); color: var(--ink-3); padding: 10px 12px; border-bottom: 1px solid var(--line-2); white-space: nowrap; }
.tbl td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl td.n { font-family: var(--m); font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.tbl th.n { text-align: right; }
.tbl a { color: var(--cyan); }
.tbl .st { display: inline-block; font: 400 10px/1 var(--px); text-transform: uppercase; padding: 4px 6px 3px; border-radius: 3px; background: #151a36; color: var(--ink-2); border: 0; min-width: 0; }
.tbl .st.burned { background: rgba(255, 176, 74, 0.16); color: var(--amber); }
.tbl .st.buying, .tbl .st.released { background: rgba(92, 242, 216, 0.12); color: var(--cyan); }
.wrap { border: 1px solid var(--line); border-radius: 8px; overflow: auto; background: #090b18; }
.empty-row { padding: 22px 14px; color: var(--ink-3); text-align: center; }
.flow { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-top: 8px; }
.flow > div { position: relative; padding: 16px; border: 1px solid var(--line); border-radius: 8px; background: #0a0d1c; }
.flow > div:not(:last-child)::after { content: "→"; position: absolute; right: -13px; top: 50%; transform: translateY(-50%); color: var(--amber); font: 600 14px/1 var(--m); }
.flow i { display: block; font: 400 10px/1 var(--px); text-transform: uppercase; color: var(--amber); margin-bottom: 9px; font-style: normal; }
.flow b { display: block; font: 600 17px/1.2 var(--m); margin-bottom: 6px; }
.flow p { margin: 0; color: var(--ink-2); font-size: 13px; line-height: 1.45; }
.rules { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.rules section { padding: 18px 20px; border: 1px solid var(--line); border-radius: 8px; background: #0a0d1c; }
.rules h3 { margin: 0 0 8px; font: 600 16px/1.2 var(--f); }
.rules p { margin: 0; color: var(--ink-2); font: 400 14px/1.55 var(--f); }
.rules p + p { margin-top: 8px; }
.tiers { display: flex; gap: 6px; margin-top: 4px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.tiers::-webkit-scrollbar { display: none; }
.tiers div { flex: var(--w) 1 0; display: grid; justify-items: center; gap: 6px; padding: 0 0 10px; border: 1px solid var(--line); border-radius: 8px; background: #0a0d1c; min-width: 0; overflow: hidden; }
.tiers canvas { image-rendering: pixelated; width: 100%; height: auto; display: block; }
.tiers b { font: 400 10px/1 var(--px); text-transform: uppercase; }
.tiers span { font: 400 11.5px/1 var(--m); color: var(--ink-3); }

@media (max-width: 1100px) {
  .rp { grid-template-columns: 1fr; }
  .rp-view { position: relative; top: 0; height: 46vh; border-right: 0; border-bottom: 1px solid var(--line); }
  .tiles { grid-template-columns: repeat(3, 1fr); }
  .flow { grid-template-columns: 1fr 1fr; }
  .rules { grid-template-columns: 1fr; }
  
}
@media (max-width: 820px) {
  body.page .crumbs { display: none; }
  .rp-doc { padding: 20px 14px 50px; }
  .rp-id h1 { font-size: 23px; }
  .rp-facts { grid-template-columns: 1fr 1fr; }
  .rp-stats { grid-template-columns: 1fr 1fr; }
  .doc { padding: calc(var(--bar) + 22px) 14px 50px; }
  .doc-head h1 { font-size: 26px; }
  .tiles { grid-template-columns: 1fr 1fr; }
  .flow { grid-template-columns: 1fr; }
  .flow > div:not(:last-child)::after { content: "↓"; right: 50%; top: auto; bottom: -13px; transform: none; }
  
}
@media (max-width: 1500px) { body.page.has-ca .links { display: none; } }
@media (max-width: 1200px) { body.page.has-ca .crumbs { display: none; } }

@media (max-width: 820px) {
  .tiers div { flex: 0 0 max(98px, calc(var(--w) * 1.3px)); }
  .tiers span { white-space: nowrap; }
  #fest th:nth-child(3), #fest td:nth-child(3), #fest th:nth-child(4), #fest td:nth-child(4), #fest th:nth-child(8), #fest td:nth-child(8), #fest th:nth-child(9), #fest td:nth-child(9),
  #rows th:nth-child(5), #rows td:nth-child(5) { display: none; }
  .tbl th, .tbl td { padding: 9px 8px; }
}

/* costs first (ledger) */
.tiles.c4 { grid-template-columns: repeat(4, 1fr); margin-top: 0; }
.hours { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 14px; margin-top: 14px; align-items: start; }
.hours-chart { position: relative; padding: 16px 16px 12px; border: 1px solid var(--line); border-radius: 8px; background: #0a0d1c; }
.hours-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 14px; }
.hours-head b { font: 600 14px/1.2 var(--f); }
.hours-head span { font: 400 12px/1.2 var(--m); color: var(--ink-3); }
.bars { display: grid; grid-template-columns: repeat(24, 1fr); gap: 2px; align-items: end; height: 150px; border-bottom: 1px solid var(--line-2); }
.bars i { display: block; height: var(--h); min-height: 0; background: var(--amber); border-radius: 4px 4px 0 0; position: relative; cursor: default; }
.bars i::after { content: ""; position: absolute; left: -1px; right: -1px; bottom: 0; height: 150px; }   /* hover target: the whole column */
.bars i:hover { background: #ffd08a; }
.bars-x { display: flex; justify-content: space-between; margin-top: 6px; font: 400 11px/1 var(--m); color: var(--ink-3); }
.tip { position: absolute; top: 44px; width: 150px; display: grid; gap: 4px; padding: 9px 10px; background: #151a33; border: 1px solid var(--line-2); border-radius: 6px; pointer-events: none; z-index: 2; }
.tip b { font: 600 12px/1.2 var(--f); }
.tip span { font: 400 12px/1.2 var(--m); color: var(--ink-2); }
.hours-tbl { max-height: 226px; }
.hours-tbl .tbl td, .hours-tbl .tbl th { padding: 8px 12px; }
@media (max-width: 1100px) { .tiles.c4 { grid-template-columns: repeat(2, 1fr); } .hours { grid-template-columns: 1fr; } }
@media (max-width: 820px) { .bars { height: 120px; } .bars i::after { height: 120px; } .hours-tbl { max-height: 260px; } }

.rule { margin: -4px 0 12px; font: 400 14px/1.4 var(--f); color: var(--ink-2); }
.bars i.nd { height: 100% !important; background: repeating-linear-gradient(135deg, rgba(120, 130, 180, 0.07) 0 3px, transparent 3px 7px); border-radius: 4px 4px 0 0; }
.hours-head { flex-wrap: wrap; }
