:root {
  --bg: #16130f; --card: #221d17; --card2: #2b241c; --line: #3a3026; --text: #eee3d2; --dim: #a39580;
  --acc: #d6a654; --acc2: #b98a3c; --good: #3f9b55; --bad: #c0463b; --warn: #c98a2b; --blue: #4b84c4;
  --r: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font: 15px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
a { color: var(--acc); text-decoration: none; }
h2, h3 { margin: 0 0 8px; font-weight: 600; }
h2 { font-size: 19px; } h3 { font-size: 15px; color: var(--acc); }
p { margin: 6px 0 12px; }
[hidden] { display: none !important; }

#top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 8px; height: 52px;
  padding: 0 12px; padding-top: env(safe-area-inset-top); background: #1c1813; border-bottom: 1px solid var(--line); }
#title { flex: 1; font-weight: 700; color: var(--acc); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.iconbtn { background: none; border: 0; color: var(--text); font-size: 22px; width: 40px; height: 40px; border-radius: 10px; cursor: pointer; }
.iconbtn:active { background: var(--card2); }

main { max-width: 860px; margin: 0 auto; padding: 12px; }
#nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; background: #1c1813;
  border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
#nav a { flex: 1; text-align: center; padding: 8px 0 9px; color: var(--dim); font-size: 12px; }
#nav a span { display: block; font-size: 20px; line-height: 24px; }
#nav a.on { color: var(--acc); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; margin-bottom: 12px; }
.card.narrow { max-width: 380px; margin: 40px auto; }
.card.warn { border-color: var(--warn); background: #2c2215; }
.card.sticky { position: sticky; top: 52px; z-index: 5; }
.center { text-align: center; padding: 30px 10px; }
.dim { color: var(--dim); } .small { font-size: 13px; } .pad { padding: 6px 4px; } .nowrap { white-space: nowrap; }
.err, .errc { color: #ec7b70; } .okc { color: #79c98b; }
.note { background: #2c2215; border: 1px solid var(--warn); border-radius: 8px; padding: 8px 10px; margin: 10px 0 4px; font-size: 13px; }

.row { display: flex; align-items: center; gap: 8px; }
.row.end { justify-content: flex-end; margin-top: 12px; }
.row.split { justify-content: space-between; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.row.btns { margin-top: 14px; } .row.btns .btn { flex: 1; }
.grow { flex: 1; min-width: 0; }

label { display: block; font-size: 13px; color: var(--dim); margin-bottom: 10px; }
input, select { display: block; width: 100%; margin-top: 4px; padding: 10px 11px; font: inherit; color: var(--text);
  background: #14110d; border: 1px solid var(--line); border-radius: 9px; }
input:focus, select:focus { outline: none; border-color: var(--acc2); }
input:disabled, select:disabled { opacity: .5; }
input[readonly] { opacity: .6; }
input[type=search] { margin: 0 0 10px; }
.card input[type=search]:last-child { margin-bottom: 0; }

.btn { display: inline-block; padding: 10px 16px; font: inherit; font-weight: 600; color: #1a140c; background: var(--acc);
  border: 0; border-radius: 9px; cursor: pointer; white-space: nowrap; }
.btn:active { filter: brightness(.9); }
.btn:disabled { opacity: .35; cursor: default; }
.btn.ghost { background: var(--card2); color: var(--text); border: 1px solid var(--line); }
.btn.good { background: var(--good); color: #fff; } .btn.danger { background: var(--bad); color: #fff; }
.btn.warnb { background: var(--warn); color: #fff; }
.btn.wide { display: block; width: 100%; margin-top: 8px; }

form.line { display: flex; align-items: flex-end; gap: 8px; }
form.line label { flex: 1; } form.line .btn { margin-bottom: 10px; }
.grid2, .grid3, .grid4 { display: grid; gap: 8px; } .grid2 { grid-template-columns: 1fr 1fr; }
.grid3 { grid-template-columns: repeat(3, 1fr); } .grid4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 480px) { .grid4 { grid-template-columns: 1fr 1fr; } }
.card form + form { margin-top: 4px; }

.state { display: flex; align-items: center; gap: 10px; font-size: 22px; font-weight: 700; margin-bottom: 12px; }
.dot { display: inline-block; width: 11px; height: 11px; border-radius: 50%; background: #666; flex: none; }
.state .dot { width: 15px; height: 15px; }
.up .dot, .dot.up { background: #4cc36a; box-shadow: 0 0 8px #4cc36a88; }
.down .dot, .dot.down { background: #6b5f52; }
.part .dot, .dot.part { background: var(--warn); }
.busy .dot { background: var(--blue); animation: pulse 1s infinite; }
.state.busy .dot { background: var(--blue); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .3; } }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; text-align: center; }
.stats div { background: var(--card2); border-radius: 9px; padding: 8px 2px; }
.stats b { display: block; font-size: 18px; } .stats span { font-size: 11px; color: var(--dim); }
div.busy { margin-top: 12px; color: #9cc3ee; }
.last { margin-top: 12px; font-size: 13px; }
pre.log { margin: 8px 0 0; max-height: 300px; overflow: auto; background: #0f0d0a; border: 1px solid var(--line); border-radius: 8px;
  padding: 8px; font: 12px/1.35 ui-monospace, Consolas, monospace; white-space: pre-wrap; word-break: break-word; color: #cfc3b0; }

.tbl { width: 100%; border-collapse: collapse; }
.tbl td, .tbl th { padding: 7px 4px; border-bottom: 1px solid var(--line); vertical-align: top; text-align: left; }
.tbl tr:last-child td, .tbl tr:last-child th { border-bottom: 0; }
.tbl.kv th { color: var(--dim); font-weight: normal; width: 34%; }
.tbl.small { font-size: 13px; } .tbl .r { text-align: right; }
.procs td:first-child { width: 22px; padding-top: 11px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip { font-size: 12px; padding: 4px 8px; border-radius: 20px; background: #2a201a; color: #b97a70; border: 1px solid #4a3029; }
.chip.on { background: #1d2a1f; color: #86cf96; border-color: #2f4a33; }

.seg { display: flex; background: #14110d; border: 1px solid var(--line); border-radius: 9px; padding: 3px; }
.seg button { flex: 1; padding: 8px; font: inherit; color: var(--dim); background: none; border: 0; border-radius: 7px; cursor: pointer; }
.seg button.on { background: var(--card2); color: var(--acc); font-weight: 600; }
.seg.sm { margin-top: 6px; }
.seg.sm button { padding: 6px 2px; font-size: 12px; white-space: nowrap; }
.seg.sm button::after { content: attr(data-arrow); }

.list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.item { display: flex; align-items: center; gap: 10px; padding: 9px 11px; background: var(--card); border: 1px solid var(--line);
  border-radius: 10px; color: var(--text); cursor: pointer; }
.item:active, .item.on { border-color: var(--acc2); background: var(--card2); }
.list.pick { max-height: 38vh; overflow: auto; margin-top: 4px; }
.lvl { font-size: 18px; font-weight: 700; color: var(--acc); min-width: 30px; text-align: right; }
.lvl small { font-size: 11px; color: var(--dim); font-weight: normal; }
.tag { display: inline-block; font-size: 11px; padding: 1px 6px; border-radius: 6px; background: #3a3026; color: var(--dim); vertical-align: 2px; }
.tag.on { background: #1d3a24; color: #86cf96; } .tag.gm { background: #3b2d12; color: var(--acc); } .tag.bad { background: #4a1f1a; color: #ff8d80; }

.ico { position: relative; flex: none; width: 36px; height: 36px; border-radius: 6px; background: #0f0d0a; border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center; color: var(--dim); overflow: hidden; }
.ico img { width: 32px; height: 32px; }
.ico i { position: absolute; font-style: normal; font-size: 10px; font-weight: 700; padding: 0 2px; background: #000a; line-height: 12px; }
.ico .amt { right: 0; bottom: 0; color: #fff; } .ico .enc { left: 0; top: 0; color: #ffd36b; }

.head h2 { margin-bottom: 2px; }
.tabs { display: flex; gap: 4px; overflow-x: auto; margin: 12px -4px 0; padding: 0 4px; scrollbar-width: none; }
.tabs a { padding: 7px 12px; border-radius: 8px; color: var(--dim); background: var(--card2); white-space: nowrap; font-size: 14px; }
.tabs a.on { background: var(--acc); color: #1a140c; font-weight: 600; }

#modal { position: fixed; inset: 0; z-index: 50; background: #000b; display: flex; align-items: flex-end; justify-content: center; }
.mbox { width: 100%; max-width: 520px; max-height: 92vh; overflow: auto; background: var(--card); border: 1px solid var(--line);
  border-radius: 16px 16px 0 0; padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); }
@media (min-width: 600px) { #modal { align-items: center; } .mbox { border-radius: 16px; } }

#toast { position: fixed; left: 12px; right: 12px; bottom: calc(76px + env(safe-area-inset-bottom)); z-index: 60; max-width: 520px; margin: 0 auto;
  padding: 12px 14px; border-radius: 10px; font-weight: 600; box-shadow: 0 6px 24px #0008; }
#toast.ok { background: #24452d; color: #c9f0d2; } #toast.err { background: #5a231d; color: #ffd6d0; }
.mt { margin-top: 12px; }

/* chat log */
label.check { display: flex; align-items: center; gap: 8px; margin: 0; color: var(--text); font-size: 14px; }
label.check input { width: auto; margin: 0; }
button.chip { cursor: pointer; font: inherit; font-size: 12px; }
.chip.ctype { background: var(--card2); color: var(--dim); border-color: var(--line); }
.chip.ctype b { font-weight: 600; margin-left: 3px; opacity: .8; }
.chip.ctype.on { background: #3a2f1c; color: var(--acc); border-color: var(--acc2); }
.chatlist { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 4px 0; margin-bottom: 12px; }
.cday { position: sticky; top: 52px; background: #1c1813; color: var(--acc); font-size: 12px; font-weight: 600; padding: 5px 12px; border-bottom: 1px solid var(--line); }
.cline { display: flex; gap: 8px; align-items: baseline; padding: 5px 12px; border-bottom: 1px solid #2a231b; font-size: 14px; line-height: 1.35; }
.cline:last-child { border-bottom: 0; }
.ct { flex: none; color: var(--dim); font: 12px ui-monospace, Consolas, monospace; }
.cb { flex: none; font-size: 11px; padding: 1px 6px; border-radius: 6px; background: #3a3026; color: var(--text); min-width: 52px; text-align: center; }
.cm { flex: 1; min-width: 0; word-break: break-word; }
.cn { color: var(--text); font-weight: 600; cursor: pointer; }
.cl { font-size: 12px; opacity: .7; }
/* client chat colours, muted */
.cb.t1, .cline.t1 .cx { color: #ff9a3c; } .cb.t1 { background: #3d2814; }
.cb.t2, .cline.t2 .cx { color: #e58cf5; } .cb.t2 { background: #36203b; }
.cb.t3, .cline.t3 .cx { color: #7fdc7f; } .cb.t3 { background: #1e3520; }
.cb.t4, .cline.t4 .cx { color: #8fb4ff; } .cb.t4 { background: #1e2a40; }
.cb.t9, .cline.t9 .cx { color: #9be89b; } .cb.t9 { background: #20381f; }
.cb.t8, .cline.t8 .cx { color: #f29ac0; } .cb.t8 { background: #3d1f2c; }
.cb.t5, .cline.t5 .cx, .cb.t10, .cline.t10 .cx { color: #ffd36b; } .cb.t5, .cb.t10 { background: #3b3014; }
.cb.t6, .cb.t7, .cline.t6 .cx, .cline.t7 .cx { color: #d8c49a; }
.chip.ctype.t1.on { color: #ff9a3c; } .chip.ctype.t2.on { color: #e58cf5; } .chip.ctype.t3.on { color: #7fdc7f; }
.chip.ctype.t4.on { color: #8fb4ff; } .chip.ctype.t9.on { color: #9be89b; } .chip.ctype.t8.on { color: #f29ac0; }

/* Players list: quick karma edit under a red character */
.prow { display: flex; flex-direction: column; gap: 4px; }
.prow .kq { display: flex; align-items: flex-end; gap: 8px; padding: 0 11px 4px 30px; }
.prow .kq label { flex: 1; font-size: 12px; color: var(--dim); }
.prow .kq input { width: 100%; }
.prow .kq .btn { padding: 8px 14px; }

/* market log (20 Oct 2026) */
.sumt { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; text-align: center; }
.sumt div { background: var(--card2); border-radius: 9px; padding: 8px 2px; }
.sumt b { display: block; font-size: 18px; } .sumt span { font-size: 11px; color: var(--dim); }
.sumt .k1 b { color: #e0b55e; } .sumt .k2 b { color: #8fb4ff; } .sumt .k3 b { color: #79c98b; } .sumt .k4 b { color: #d39af0; }
.mchip { font: inherit; font-size: 12px; padding: 5px 10px; border-radius: 20px; background: var(--card2); color: var(--dim); border: 1px solid var(--line); cursor: pointer; }
.mchip b { margin-left: 4px; opacity: .8; }
.mchip.on { background: #3a2f1c; color: var(--acc); border-color: var(--acc2); }
.fl { display: grid; grid-template-columns: 1fr 1fr 150px; gap: 8px; margin-top: 10px; }
.fl input, .fl select { margin: 0; }
@media (max-width: 520px) { .fl { grid-template-columns: 1fr 1fr; } .fl select { grid-column: 1 / -1; } }
.fl2 { display: flex; gap: 14px; align-items: center; margin-top: 10px; flex-wrap: wrap; }
.fl2 .live { margin-left: auto; color: #79c98b; }
.mlist { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); margin-bottom: 12px; overflow: hidden; }
.mday { background: #1c1813; color: var(--acc); font-size: 12px; font-weight: 600; padding: 6px 12px; border-bottom: 1px solid var(--line); }
.mrow { display: flex; gap: 10px; padding: 10px 12px; border-bottom: 1px solid #2a231b; }
.mrow:last-child { border-bottom: 0; }
.mt0 { flex: none; width: 58px; color: var(--dim); font: 12px ui-monospace, Consolas, monospace; padding-top: 3px; }
.mk { flex: none; font-size: 10px; font-weight: 700; letter-spacing: .4px; padding: 2px 0; border-radius: 6px; width: 52px; text-align: center; height: 18px; margin-top: 1px; }
.mk.craft { background: #3b2d12; color: #e0b55e; } .mk.shop { background: #1e2a40; color: #8fb4ff; }
.mk.sale { background: #1d3a24; color: #79c98b; } .mk.trade { background: #36203b; color: #d39af0; }
.mk.fail { background: #4a1f1a; color: #ff8d80; }
.mb { flex: 1; min-width: 0; }
.mh { font-size: 14px; line-height: 1.4; }
.mh .who { font-weight: 600; color: var(--text); cursor: pointer; }
.bt, .pl { font-size: 10px; padding: 0 5px; border-radius: 5px; vertical-align: 1px; margin-left: 3px; }
.bt { background: #2e2a24; color: #8f8574; } .pl { background: #1d3a24; color: #86cf96; }
.mh .arr { color: var(--acc); margin: 0 6px; font-weight: 600; }
.mk.sold { background: #3d2814; color: #ff9a3c; }
.mh .title { color: #ffd59a; font-style: italic; }
.mloc { font-size: 12px; color: var(--dim); margin-top: 4px; }
.mloc .tot b { color: #e9c46a; }
.mitems { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; }
.mit { display: flex; align-items: center; gap: 7px; background: #1a1611; border: 1px solid #332a20; border-radius: 9px; padding: 3px 9px 3px 3px; font-size: 13px; }
.mit .q { color: var(--dim); font-size: 12px; } .mit .pr { color: #e9c46a; font-size: 12px; }
.mit.big .ico { width: 42px; height: 42px; border-color: #6a5326; box-shadow: 0 0 10px #d6a65433; }
.mit.big .ico img { width: 40px; height: 40px; }
.mit.big { font-size: 14px; font-weight: 600; }
.mats { display: flex; align-items: center; gap: 5px; margin-top: 6px; font-size: 12px; color: var(--dim); flex-wrap: wrap; }
.mats .ico { width: 24px; height: 24px; border-radius: 4px; } .mats .ico img { width: 22px; height: 22px; }
.mats .m { display: inline-flex; align-items: center; gap: 4px; margin-right: 6px; }
.side { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 7px; }
.side > div { background: #1a1611; border: 1px solid #332a20; border-radius: 9px; padding: 7px; }
.side h4 { margin: 0 0 6px; font-size: 12px; color: var(--dim); font-weight: 600; }
.side .mitems { margin-top: 0; }
.slines { margin-top: 6px; }
.sline { display: flex; align-items: center; gap: 9px; padding: 5px 0; border-top: 1px dashed #332a20; font-size: 13px; }
.sline:first-child { border-top: 0; }
.sline .t { color: var(--dim); font: 12px ui-monospace, Consolas, monospace; width: 40px; flex: none; }
.sline .g { flex: 1; min-width: 0; } .sline .r { color: #e9c46a; white-space: nowrap; }
.badge { font-size: 11px; padding: 1px 7px; border-radius: 6px; font-weight: 700; }
.badge.sell { background: #1e2a40; color: #8fb4ff; } .badge.buy { background: #3d2814; color: #ff9a3c; }

/* market log: spoils (20 Oct 2026) */
.mk.sweep { background: #173638; color: #6fd6d0; }
.mrow.dimrow { opacity: .6; }
.ico.s { width: 24px; height: 24px; display: inline-flex; vertical-align: middle; margin-right: 3px; }
.ico.s img { width: 22px; height: 22px; }
.sp td { vertical-align: middle; }

/* quests (20 Oct) */
.sumt.q5 { grid-template-columns: repeat(5, 1fr); }
.sumt .k5 b { color: #ff8d80; } .sumt .k6 b { color: #e9c46a; }
.badge.one { background: #3b2d12; color: #e0b55e; } .badge.rep { background: #173638; color: #6fd6d0; }
.badge.sm { font-size: 10px; padding: 0 5px; }
.warnc { color: #e9c46a; }
.qt td { vertical-align: middle; } .qt td:first-child { line-height: 1.6; }
.qq, .qbot { cursor: pointer; color: inherit; }
.qb .qbh { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 4px; }
.qb .qbh a { font-weight: 600; color: var(--acc); }
.ql { display: flex; gap: 8px; align-items: center; padding: 6px 0; border-top: 1px dashed #332a20; font-size: 13px; }
.ql .g { flex: 1; min-width: 0; line-height: 1.5; } .ql .r { text-align: right; max-width: 48%; line-height: 1.5; }
.ql .mk { width: 64px; }
.mk.zero { background: #3d3214; color: #e9c46a; } .mk.wait { background: #2e2a24; color: #a99d88; }
#qlist .mk { width: 64px; }

/* quest rewards (20 Oct) */
.qa { color: #e9c46a; } .qe { color: #8fb4ff; } .qi { color: #d39af0; }

/* ------------------------------------------------------------------ public Bot Activity page (2026-10-21) */
body { padding-bottom: 20px; }
#top { justify-content: space-between; }
#top .brand { display: flex; align-items: baseline; gap: 10px; font-weight: 700; color: var(--acc); white-space: nowrap; overflow: hidden; }
#top .brand small { color: var(--dim); font-weight: 400; font-size: 13px; }
#top .site { flex: none; font-size: 13px; color: var(--dim); border: 1px solid var(--line); border-radius: 8px; padding: 5px 10px; }
.ptabs { display: flex; gap: 6px; max-width: 860px; margin: 12px auto 0; padding: 0 12px; }
.ptabs a { flex: 1; text-align: center; padding: 10px; border-radius: 10px; background: var(--card); border: 1px solid var(--line); color: var(--dim); font-weight: 600; }
.ptabs a span { margin-right: 6px; }
.ptabs a.on { background: #3a2f1c; color: var(--acc); border-color: var(--acc2); }
.intro { font-size: 13px; color: var(--dim); margin: 0 0 10px; }
.pfoot { text-align: center; font-size: 12px; color: var(--dim); padding: 14px; }
@media (max-width: 520px) { .sumt { grid-template-columns: repeat(2, 1fr); } .sumt.q5 { grid-template-columns: repeat(2, 1fr); } }
#mkinds, #qviews { margin-top: 12px; }

/* item type filter (22 Oct): 4 fields in the filter row */
.fl.fl4 { grid-template-columns: 1fr 1fr 150px 150px; }
@media (max-width: 620px) { .fl.fl4 { grid-template-columns: 1fr 1fr; } .fl.fl4 select { grid-column: auto; } }
