:root {
  /* Shadow Guild Bank palette — dark violet/shadow base, silver-violet accent,
     gold reserved for "needs attention" states (matches /runewords, /runes). */
  --bg: #110d1a;
  --bg-alt: #14101f;
  --surface: #1c1728;
  --surface-2: #241d34;
  --border: #3d3356;

  --text: #ece7f5;
  --text-dim: #a99bc7;
  --text-faint: #6f6389;

  --accent: #9d6fd8;
  --accent-strong: #7c3aed;
  --accent-strong-hover: #8b5cf6;

  --gold: #c9922a;
  --gold-light: #e8b84b;

  --red: #ff9bb0;
  --red-bg: #2f1420;
  --red-border: #8b3355;
  --green: #86e6a0;
  --green-bg: #0f2a1a;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
  display: flex; align-items: center; gap: 1rem;
  padding: 0.75rem 1.5rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.topbar .brand { font-weight: bold; font-size: 1.1rem; color: var(--gold-light); }
.topbar nav { display: flex; gap: 1rem; align-items: center; margin-left: auto; }
.topbar nav .user { color: var(--text-dim); font-size: 0.9rem; }

.nav-dropdown { position: relative; }
.nav-dropdown summary {
  cursor: pointer; list-style: none; color: var(--accent);
}
.nav-dropdown summary::-webkit-details-marker { display: none; }
.nav-dropdown summary::after { content: ' \25BE'; }
.nav-dropdown[open] summary::after { content: ' \25B4'; }
.nav-dropdown-menu {
  position: absolute; top: 100%; right: 0; margin-top: 0.5rem;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px;
  padding: 0.4rem 0; min-width: 160px; z-index: 20;
  display: flex; flex-direction: column;
}
.nav-dropdown-menu a { padding: 0.4rem 1rem; color: var(--text); }
.nav-dropdown-menu a:hover { background: var(--surface); text-decoration: none; }

.container { max-width: 960px; margin: 2rem auto; padding: 0 1.5rem; }
h1 { margin-top: 0; }
.muted { color: var(--text-dim); }
.error { color: var(--red); background: var(--red-bg); padding: 0.5rem 0.75rem; border-radius: 4px; }
.notice { color: var(--green); background: var(--green-bg); padding: 0.5rem 0.75rem; border-radius: 4px; }

.role {
  display: inline-block; padding: 0.15rem 0.5rem; border-radius: 3px;
  font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600;
}
.role-super_admin { background: #3a1f5c; color: #e0c6ff; }
.role-admin { background: #262a52; color: #c3ccff; }
.role-player { background: #1e3325; color: #a8e6b8; }

.progress { width: 100%; height: 14px; background: var(--bg-alt); border: 1px solid var(--border); border-radius: 4px; overflow: hidden; margin: 0.5rem 0; }
.progress-bar { height: 100%; background: linear-gradient(90deg, var(--accent-strong), var(--accent)); transition: width 0.3s; }

tr.done td { opacity: 0.5; }

.summary { width: auto; }
.summary th { text-align: right; padding-right: 1rem; color: var(--text-dim); }
.summary td { padding-left: 0; }

.big-question { font-size: 1.1rem; margin: 1.5rem 0 1rem; }
.confirm-buttons { display: flex; gap: 1rem; align-items: center; }
.btn.big { padding: 0.7rem 1.5rem; font-size: 1rem; }

details.level-block {
  background: var(--surface); border: 1px solid var(--border); border-radius: 6px;
  padding: 0.5rem 1rem; margin-bottom: 0.75rem;
}
details.level-block[open] { padding-bottom: 1rem; }
details.level-block > summary {
  cursor: pointer; padding: 0.5rem 0; font-size: 1rem;
  display: flex; align-items: baseline; gap: 0.5rem; flex-wrap: wrap;
  list-style: none;
}
details.level-block > summary::-webkit-details-marker { display: none; }
details.level-block > summary::before { content: "▸"; color: var(--text-dim); display: inline-block; width: 1em; transition: transform 0.15s; }
details.level-block[open] > summary::before { transform: rotate(90deg); }
.level-title { font-weight: 600; font-size: 1.05rem; }
.level-stats { margin-left: auto; color: var(--text-dim); font-size: 0.9rem; }

details.item-block {
  background: var(--bg-alt); border: 1px solid var(--border); border-radius: 4px;
  padding: 0.3rem 0.75rem; margin: 0.5rem 0 0.5rem 1.5rem;
}
details.item-block > summary {
  cursor: pointer; padding: 0.35rem 0; list-style: none;
  display: flex; align-items: baseline; gap: 0.5rem; flex-wrap: wrap;
}
details.item-block > summary::-webkit-details-marker { display: none; }
details.item-block > summary::before { content: "▸"; color: var(--text-dim); display: inline-block; width: 1em; transition: transform 0.15s; font-size: 0.85rem; }
details.item-block[open] > summary::before { transform: rotate(90deg); }
.item-title { font-weight: 600; }
.item-stats { margin-left: auto; color: var(--text-dim); font-size: 0.85rem; }

details.item-incomplete { border-left: 3px solid var(--gold-light); }
.incomplete-qty { color: var(--gold-light); font-weight: 600; }

.history-table { margin-top: 0.5rem; }
.history-table th, .history-table td { padding: 0.35rem 0.5rem; font-size: 0.9rem; }

.indent { padding-left: 1.5rem; }

.deleted-row td { text-decoration: line-through; opacity: 0.5; }
.deleted-row td:last-child { text-decoration: none; opacity: 1; }
.badge { display: inline-block; padding: 0.1rem 0.45rem; border-radius: 3px; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600; }
.badge-deleted { background: var(--red-bg); color: var(--red); }
.btn-sm { padding: 0.2rem 0.55rem; font-size: 0.8rem; }
.delete-donation-form { display: inline; margin: 0; }

.status-badge { display: inline-block; padding: 0.15rem 0.55rem; border-radius: 3px; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600; white-space: nowrap; }
.status-confirmed { background: #14331f; color: var(--green); }
.status-progress { background: #2e2352; color: #c9b3ff; }
.status-ready { background: #4a3a12; color: var(--gold-light); }
.status-empty { background: #322b3d; color: var(--text-dim); }
.status-locked { background: #221d2b; color: var(--text-faint); }

.me-row { background: rgba(157, 111, 216, 0.10); }
.me-row td { font-weight: 500; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}
.card.narrow { max-width: 400px; margin: 2rem auto; }
.card h2 { margin-top: 0; font-size: 1.1rem; }

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; }
.tile { display: block; text-decoration: none; color: inherit; transition: border-color 0.15s; }
.tile:hover { border-color: var(--accent); text-decoration: none; }
.big { font-size: 2rem; font-weight: bold; margin: 0.5rem 0; color: var(--accent); }

form label { display: block; margin-bottom: 0.75rem; }
input[type=text], input[type=password], input[type=number], select {
  width: 100%;
  padding: 0.5rem;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  font-size: 0.95rem;
}
input:focus, select:focus { outline: none; border-color: var(--accent); }

.btn {
  display: inline-block;
  padding: 0.4rem 0.9rem;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9rem;
  text-decoration: none;
}
.btn:hover { background: #302747; text-decoration: none; }
.btn.primary { background: var(--accent-strong); border-color: var(--accent-strong); color: #fff; }
.btn.primary:hover { background: var(--accent-strong-hover); }
.btn.danger { background: var(--red-bg); border-color: var(--red-border); color: var(--red); }
.btn.danger:hover { background: #451c2c; }
.btn.discord { display: block; text-align: center; background: #5865f2; border-color: #5865f2; color: #fff; }
.btn.discord:hover { background: #6f77f5; }
.or-divider { text-align: center; color: var(--text-faint); margin: 1rem 0 0.75rem; font-size: 0.85rem; }
.linklike {
  background: none; border: none; color: var(--accent); cursor: pointer;
  padding: 0; font-size: inherit; font-family: inherit;
}
.linklike:hover { text-decoration: underline; }

.row-form { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.row-form input, .row-form select { flex: 1; min-width: 150px; width: auto; }
.block-toggle-form { margin-top: 0.75rem; }

.inline { display: inline; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 0.5rem; border-bottom: 1px solid var(--border); }
th { color: var(--text-dim); font-weight: 600; font-size: 0.85rem; text-transform: uppercase; }
.actions { display: flex; gap: 0.4rem; flex-wrap: wrap; }
tfoot th { border-top: 2px solid var(--border); color: var(--text); }
