:root {
  --bg: #14110d; --panel: #1f1a14; --panel2: #2a231a; --line: #3d3325;
  --text: #ece3d0; --muted: #9a8f7c; --gold: #e3b54a; --accent: #c8862a;
  --pos: #6fcf6f; --neg: #e06a5a; --warn: #e0a84a;
  --silver: #c9cdd3; --copper: #c7794a;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--gold); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.35rem; margin: 0 0 .8rem; color: var(--gold); }
h2 { font-size: 1.05rem; margin: 1.2rem 0 .6rem; color: var(--gold); }
h2:first-child, h1:first-child { margin-top: 0; }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: .88rem; }
.warn { color: var(--warn); }
.pos, .tile.pos b { color: var(--pos); }
.neg, .tile.neg b { color: var(--neg); }

header.top { display: flex; align-items: center; gap: 1.2rem; flex-wrap: wrap; padding: .7rem 1.4rem;
  background: linear-gradient(#2a2117, #1b160f); border-bottom: 1px solid var(--line); }
.brand { font-weight: 700; font-size: 1.15rem; color: var(--gold); letter-spacing: .02em; }
.realm { margin-left: .6rem; font-size: .8rem; font-weight: 400; color: var(--muted); }
header nav { display: flex; gap: .3rem; flex-wrap: wrap; }
header nav a { padding: .35rem .7rem; border-radius: 6px; color: var(--text); }
header nav a.on, header nav a:hover { background: var(--panel2); color: var(--gold); text-decoration: none; }
.who { margin-left: auto; display: flex; gap: .8rem; align-items: center; }
.who form { margin: 0; }

main { max-width: 1200px; margin: 0 auto; padding: 1.2rem; }
footer { text-align: center; color: var(--muted); font-size: .8rem; padding: 1.5rem; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 1.1rem 1.2rem; margin-bottom: 1.2rem; overflow-x: auto; }
.card.narrow { max-width: 560px; margin-left: auto; margin-right: auto; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 1.2rem; align-items: start; }
.grid2 > .card { margin-bottom: 0; }
.more { float: right; font-size: .85rem; font-weight: 400; }
.more a.on { color: var(--text); font-weight: 600; }

.tiles { display: flex; gap: .8rem; flex-wrap: wrap; margin-bottom: 1rem; }
.tile { flex: 1 1 160px; background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: .7rem .9rem; color: var(--text); }
a.tile:hover { text-decoration: none; border-color: var(--accent); }
.tile b { display: block; font-size: 1.25rem; color: var(--gold); }
.tile > span { font-size: .82rem; color: var(--muted); }

table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th { text-align: left; color: var(--muted); font-weight: 500; border-bottom: 1px solid var(--line); padding: .4rem .5rem; white-space: nowrap; }
td { border-bottom: 1px solid #2c2519; padding: .4rem .5rem; vertical-align: middle; }
tr:hover td { background: #241e16; }
tr.total td { font-weight: 700; border-top: 2px solid var(--line); }
tr.done td { opacity: .5; }
.r { text-align: right; white-space: nowrap; }
td.actions { white-space: nowrap; }
ul.plain { list-style: none; margin: 0; padding: 0; }
ul.plain li { padding: .3rem 0; border-bottom: 1px solid #2c2519; }

.money { white-space: nowrap; font-variant-numeric: tabular-nums; }
.money small { font-size: .72em; margin-left: 1px; }
.m-g { color: var(--gold); } .m-s { color: var(--silver); } .m-c { color: var(--copper); }

form { margin: 0; }
form.inline { display: inline; }
.stack { display: flex; flex-direction: column; gap: .7rem; margin-bottom: .8rem; }
.stack label { display: flex; flex-direction: column; gap: .25rem; font-size: .88rem; color: var(--muted); }
.row-form { display: flex; flex-wrap: wrap; gap: .6rem; align-items: flex-end; margin-bottom: .8rem; }
.row-form label { display: flex; flex-direction: column; gap: .25rem; font-size: .85rem; color: var(--muted); }
.row-form .grow { flex: 1 1 200px; }
.row-form .small, .row-form input.small { width: 90px; flex: 0 0 auto; }
.reagent { margin-bottom: .4rem; }
fieldset { border: 1px solid var(--line); border-radius: 8px; padding: .6rem .8rem; }
legend { color: var(--muted); font-size: .88rem; }
input, select, textarea, button { font: inherit; color: var(--text); background: #120f0b; border: 1px solid var(--line); border-radius: 6px; padding: .4rem .55rem; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.money-input { display: inline-flex; align-items: center; gap: .2rem; }
.money-input input { width: 4.2em; text-align: right; }
.money-input span { font-size: .8rem; margin-right: .3rem; }
button, .button { cursor: pointer; background: var(--panel2); border: 1px solid var(--line); border-radius: 6px; padding: .42rem .8rem; color: var(--text); display: inline-block; }
button:hover, .button:hover { border-color: var(--accent); text-decoration: none; }
button.primary { background: var(--accent); border-color: var(--accent); color: #1a1208; font-weight: 600; }
button.primary:hover { background: var(--gold); }
button.small { padding: .2rem .5rem; font-size: .82rem; }
button.link { background: none; border: none; padding: 0; color: var(--gold); }
button.danger, button.link.danger { color: var(--neg); }

.flash { padding: .6rem .9rem; border-radius: 8px; margin-bottom: 1rem; border: 1px solid; }
.flash.ok { border-color: #3e6b3e; background: #1b2a1b; }
.flash.error { border-color: #7a3a32; background: #2d1a17; }
.tag { display: inline-block; font-size: .75rem; padding: .05rem .45rem; border-radius: 4px; font-weight: 600; }
.tag.vend { background: #2c4a2c; color: #a9e3a9; }
.tag.achete { background: #2b3a55; color: #a9c4f0; }
.tag.wip { background: #4a3a1c; color: var(--gold); }

svg.spark { width: 100%; max-width: 640px; height: 150px; display: block; margin: .3rem 0 1rem; background: var(--panel2); border-radius: 8px; }
svg.spark polyline { fill: none; stroke: var(--gold); stroke-width: 2; }
svg.spark circle { fill: var(--accent); }

@media (max-width: 640px) {
  .grid2 { grid-template-columns: 1fr; }
  main { padding: .7rem; }
  .who { margin-left: 0; }
}
