/* Building Details / Structure Details / Upgrade popups (client/panels-building.js) — dark wasteland panels, gold trim. */
.bd, .bu { display: grid; gap: 10px; padding-top: 4px; }
.bd-back { margin-right: 8px; padding: 2px 10px !important; font-size: 20px; line-height: 1.1; color: var(--pn-gold); border-color: #5a3f20; background: rgba(0,0,0,.35); }
.sheet-head:has(.bd-back) { justify-content: flex-start; } .sheet-head:has(.bd-back) > div { flex: 1; min-width: 0; }

/* picture stage */
.bd-stage { position: relative; display: grid; place-items: center; height: 156px; margin: 0 -2px; border-radius: 14px; overflow: hidden; isolation: isolate;
  background: radial-gradient(90% 70% at 50% 100%, #2c3a2a 0%, #141c16 60%, #0b100d 100%); border: 1px solid #6b4a17;
  box-shadow: inset 0 1px 0 rgba(255,220,150,.15), inset 0 -30px 40px rgba(0,0,0,.35); }
.bd-stage::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 6px; z-index: 1; opacity: .8; background: repeating-linear-gradient(-45deg, var(--pn-gold) 0 9px, #1a1206 9px 18px); }
.bd-glow { position: absolute; left: 50%; bottom: 8%; width: 70%; height: 46%; transform: translateX(-50%); z-index: -1; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255,170,70,.38), rgba(255,170,70,0)); animation: bdGlow 3s ease-in-out infinite; }
@keyframes bdGlow { 50% { opacity: .65; } }
.bd-stage .b-thumb { filter: drop-shadow(0 6px 8px rgba(0,0,0,.55)); }
.bd-stage.sm { height: auto; padding: 6px; margin: 0; }
.bd-stage.sm::after { height: 4px; }

.bd-medal { flex: none; min-width: 34px; height: 34px; padding: 0 4px; border-radius: 50%; display: inline-grid; place-items: center; font: 900 15px/1 system-ui; color: #fff;
  background: radial-gradient(circle at 35% 30%, #ff8a4a, #c2351c 70%); border: 2px solid #ffd27a; box-shadow: 0 0 0 2px #6b2a10, 0 2px 4px rgba(0,0,0,.5); text-shadow: 0 1px 0 #000; }
.bd-medal.next { background: radial-gradient(circle at 35% 30%, var(--c-good-hi), #2f8a3b 70%); box-shadow: 0 0 0 2px #1d4a20, 0 0 12px rgba(94,196,107,.45); }
.bd-name { display: flex; align-items: center; justify-content: center; gap: 8px; text-align: center; }
.bd-name b { font: 900 21px/1.15 system-ui; text-shadow: 0 2px 0 #000; min-width: 0; overflow-wrap: anywhere; }
.bd-of { color: var(--muted); font-size: 13px; font-weight: 700; }
.bd-max { padding: 2px 8px; border-radius: 7px; background: linear-gradient(var(--c-amber-hi), #e3a03a); color: #2a1a04; font: 900 12px/1.3 system-ui; }
.bd-desc { margin: -2px 4px 0; text-align: center; color: #d9cfb8; font-size: 13.5px; line-height: 1.4; }
.bd-busy { justify-self: center; padding: 5px 12px; border-radius: 999px; background: #2a1d08; border: 1px solid #8a5e1c; font-size: 13px; color: #e8d9b8; }
.bd-busy b { color: var(--pn-gold); font-family: ui-monospace, Menlo, monospace; }

/* sections */
.bd-sec { border-radius: 12px; overflow: hidden; background: #141c17; border: 1px solid var(--line); }
.bd-sec h4 { margin: 0; padding: 7px 12px; font-size: 12px; text-transform: uppercase; letter-spacing: .07em; color: var(--pn-gold); background: linear-gradient(#22301f, var(--c-panel)); border-bottom: 1px solid #3a3020; }
.bd-stat { display: grid; grid-template-columns: auto 1fr auto auto; gap: 8px; align-items: center; min-height: 38px; padding: 6px 12px; font-size: 14px; border-top: 1px solid rgba(255,255,255,.04); }
.bd-stat:nth-of-type(even) { background: rgba(255,255,255,.025); }
.bd-stat .ic { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; font-size: 15px; background: rgba(0,0,0,.35); box-shadow: inset 0 0 0 1px #3a3020; }
.bd-stat:not(:has(.ic)) { grid-template-columns: 1fr auto; }
.bd-stat .k { color: var(--muted); min-width: 0; }
.bd-stat b { font-weight: 800; text-align: right; white-space: nowrap; }
.bu-up { color: var(--good); font-weight: 800; font-size: 13px; white-space: nowrap; text-shadow: 0 0 8px rgba(94,196,107,.35); }
.bd-none { padding: 10px 12px; color: var(--muted); font-size: 13px; }

/* buttons */
.bd-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 2px; }
.bd-btns > :only-child { grid-column: 1 / -1; }
.bd-btn { min-height: 52px; display: grid; place-content: center; justify-items: center; gap: 1px; padding: 6px 8px; border-radius: 12px; font: 800 15px/1.15 system-ui; letter-spacing: .01em;
  border: 0; box-shadow: 0 4px 0 var(--sh, var(--c-ink)), inset 0 1px 0 rgba(255,255,255,.3); transition: transform .06s; }
.bd-btn:not(:disabled):active { transform: translateY(2px); box-shadow: 0 2px 0 var(--sh, var(--c-ink)), inset 0 1px 0 rgba(255,255,255,.3); }
.bd-btn small { font: 700 12px/1.1 system-ui; opacity: .9; }
.bd-btn.gold { background: linear-gradient(var(--c-amber-hi), #e3a03a); color: #2a1a04; --sh: #8a5e1c; }
.bd-btn.steel { background: linear-gradient(#3a4a3e, #24302a); color: #f3efe6; --sh: var(--c-ink); box-shadow: 0 4px 0 var(--c-ink), inset 0 0 0 1px var(--pn-gold2), inset 0 1px 0 rgba(255,255,255,.15); }
.bd-btn.ruby { background: linear-gradient(#ff7a8a, #c2304a); color: #fff; --sh: #6b1426; text-shadow: 0 1px 0 rgba(0,0,0,.4); }
.bd-btn.ruby.armed { background: linear-gradient(#ffb0ba, #e0405a); animation: buArm .5s ease-in-out infinite alternate; }
.bd-btn.ruby.poor small { color: #ffd0d6; }
@keyframes buArm { to { box-shadow: 0 4px 0 #6b1426, 0 0 0 3px rgba(255,180,190,.6); } }
.bd-btn.blue { background: linear-gradient(#7fd4ff, #2f86d8); color: #fff; --sh: #1d4f8f; text-shadow: 0 1px 0 rgba(0,0,0,.35); }
.bd-btn:disabled { filter: grayscale(.7); opacity: .55; }

/* sticky action bar at the bottom of the popup */
.bd-foot { position: sticky; bottom: -16px; z-index: 3; display: grid; gap: 8px; margin: 0 -14px -16px; padding: 12px 14px 16px;
  background: linear-gradient(rgba(27,37,32,0), var(--panel) 14px); }

/* Structure Details table */
.bl-wrap { display: grid; gap: 10px; padding-top: 4px; }
.bl-top { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: center; }
.bl-top b { font: 900 17px/1.2 system-ui; }
.bl-scroll { max-height: min(52vh, 420px); overflow: auto; border-radius: 12px; border: 1px solid var(--line); background: #0f1611; overscroll-behavior: contain; }
.bl-table { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.bl-table th { position: sticky; top: 0; z-index: 1; padding: 8px 6px; font-size: 11px; line-height: 1.15; text-transform: uppercase; letter-spacing: .04em; color: var(--pn-gold);
  background: linear-gradient(#2a2412, #1d1a0e); border-bottom: 2px solid var(--pn-gold2); text-align: right; }
.bl-table td { padding: 7px 6px; text-align: right; border-bottom: 1px solid rgba(255,255,255,.05); white-space: nowrap; }
.bl-table th:first-child, .bl-table td:first-child { text-align: center; width: 54px; }
.bl-table th:last-child, .bl-table td:last-child { padding-right: 10px; }
.bl-table tr.past td { color: #c9d4cb; }
.bl-table tr.fut td { color: var(--muted); opacity: .55; }
.bl-table tr:nth-child(even) td { background: rgba(255,255,255,.02); }
.bl-table tr.cur td { background: #3a2e12; color: #ffe7a8; font-weight: 800; border-top: 1px solid var(--pn-gold2); border-bottom: 1px solid var(--pn-gold2); }
.bl-here { display: inline-grid; place-items: center; min-width: 26px; height: 22px; padding: 0 4px; border-radius: 6px; background: linear-gradient(var(--c-amber-hi), #e3a03a); color: #2a1a04; font-weight: 900; }

/* Upgrade */
.bu-top { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: center; }
.bu-lvls { display: grid; grid-template-columns: auto 1fr auto; gap: 6px; align-items: center; min-width: 0; }
.bu-lv { display: grid; justify-items: center; gap: 3px; } .bu-lv small { font: 700 10px/1 system-ui; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.bu-lv .bd-medal { min-width: 40px; height: 40px; font-size: 17px; }
.bu-track { position: relative; height: 22px; margin-bottom: 14px; border-radius: 11px; overflow: hidden; display: grid; place-items: center; background: var(--c-ink); border: 1px solid #3a3020;
  box-shadow: inset 0 2px 4px rgba(0,0,0,.6); }
.bu-track:not(.run):not(.max) { background: repeating-linear-gradient(90deg, #1a1206 0 10px, #2a1d08 10px 20px); }
.bu-track i { position: absolute; left: 0; top: 0; bottom: 0; background: linear-gradient(var(--c-good-hi), #4fa52b); }
.bu-track b { position: relative; font: 900 13px/1 ui-monospace, Menlo, monospace; color: #fff; text-shadow: 0 1px 0 #000, 0 0 3px #000; }
.bu-track.max { margin: 0; height: 28px; background: linear-gradient(var(--c-amber-hi), #e3a03a); } .bu-track.max b { font-family: system-ui; color: #2a1a04; text-shadow: none; letter-spacing: .08em; }
.bu-lvls:has(.max) { grid-template-columns: auto 1fr; }
.bu-arrow { position: relative; color: var(--pn-gold); font-size: 14px; font-weight: 900; }
.bu-req { display: grid; grid-template-columns: 26px 1fr auto 18px 42px; gap: 8px; align-items: center; min-height: 40px; padding: 5px 10px 5px 12px; font-size: 14px; border-top: 1px solid rgba(255,255,255,.04); }
.bu-req .ic { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; font-size: 15px; background: rgba(0,0,0,.35); box-shadow: inset 0 0 0 1px #3a3020; }
.bu-req .k { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bu-req .v { color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; } .bu-req .v b { color: var(--text); }
.bu-req .mk { color: var(--good); font-weight: 900; text-align: center; }
.bu-req.short .mk { color: var(--bad); } .bu-req.short .v b { color: var(--bad); }
.bu-go { min-height: 28px; padding: 2px 0; border-radius: 8px; font: 800 12px/1 system-ui; background: linear-gradient(var(--c-good), #2f8a3b); color: #fff; border: 0; box-shadow: 0 2px 0 #1d4a20; }
.bu-time { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; border-top: 1px solid #3a3020; background: rgba(240,180,60,.06); font-size: 14px; }
.bu-time span { color: #e8d9b8; font-weight: 700; } .bu-time b { color: var(--pn-gold); font-family: ui-monospace, Menlo, monospace; font-size: 15px; }
.bu-why { padding: 7px 10px; border-radius: 10px; background: rgba(224,87,76,.12); border: 1px solid rgba(224,87,76,.45); color: #ffb3aa; font-size: 13px; text-align: center; }
.bu-wallet { text-align: center; font-size: 12px; color: var(--muted); margin-top: -2px; } .bu-wallet b { color: #ff9aa8; }
