:root {
  --bg: #121216;
  --panel: #1c1c22;
  --panel-2: #23232b;
  --row: #202027;
  --row-alt: #1a1a20;
  --line: #2f2f3a;
  --text: #e8e6e3;
  --muted: #9a98a6;
  --gold: #d4af37;
  --accent: #7a4fd6;
  --accent-2: #9b74ec;
  --danger: #e0605b;
  --ok: #46b96a;
  --warn: #e0a83a;
  --discord: #5865f2;
  --radius: 10px;
  --q-poor: #9d9d9d; --q-common: #ffffff; --q-uncommon: #1eff00; --q-rare: #0070dd; --q-epic: #a335ee; --q-legendary: #ff8000;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent-2); }
h1, h2, h3 { margin: 0 0 .4em; line-height: 1.2; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
p { margin: .3em 0 .6em; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }
.hidden { display: none !important; }

/* top bar */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 20px;
  background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 1.1rem; color: var(--text); text-decoration: none; }
.brand-mark { width: 22px; height: 22px; border-radius: 6px; background: radial-gradient(circle at 40% 55%, #e9d8ff 0 3px, transparent 4px), linear-gradient(160deg, var(--accent-2), var(--accent)); }
.nav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.top { flex-wrap: wrap; }
body { overflow-x: hidden; }
.hero > div { min-width: 0; }
.loot-rules, .meta { overflow-wrap: anywhere; }
.nav .user { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.nav img { width: 26px; height: 26px; border-radius: 50%; }

main { max-width: 1180px; margin: 0 auto; padding: 20px 20px 60px; }
main.narrow { max-width: 520px; padding-top: 60px; }
main:empty { display: none; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; }
.card > h2:first-child { margin-bottom: .7em; }
.grid2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: 16px; }
.grid2 > .card { margin-bottom: 0; }
.stack > * + * { margin-top: 10px; }

/* buttons, inputs */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 7px 14px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--text); font: inherit; font-weight: 600; cursor: pointer;
  text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: #4a4a58; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-2); }
.btn.ok { background: #2b6b40; border-color: #2b6b40; color: #fff; }
.btn.danger { color: var(--danger); }
.btn.danger.solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.discord { background: var(--discord); border-color: var(--discord); color: #fff; padding: 10px 20px; font-size: 1rem; }
.btn.sm { padding: 4px 10px; font-size: .85rem; }
.btn.active { border-color: var(--accent-2); box-shadow: inset 0 0 0 1px var(--accent-2); }
.btns { display: flex; flex-wrap: wrap; gap: 8px; }
label { display: block; font-size: .85rem; color: var(--muted); margin: 0 0 4px; }
input, select, textarea { width: 100%; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line);
  background: #15151a; color: var(--text); font: inherit; }
input:focus, select:focus, textarea:focus, .btn:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 1px; }
textarea { min-height: 70px; resize: vertical; }
.field { margin-bottom: 12px; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.check { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: .95rem; }
.check input { width: auto; }

/* pills */
.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .78rem; font-weight: 700; background: var(--panel-2);
  border: 1px solid var(--line); color: var(--muted); vertical-align: middle; }
.pill.confirmed, .pill.open { color: var(--ok); border-color: #2c5c3b; }
.pill.waitlist, .pill.locked { color: var(--warn); border-color: #6b5222; }
.pill.tentative, .pill.bench { color: #8fb4ff; border-color: #33466b; }
.pill.cancelled { color: var(--danger); border-color: #6b2c2a; }
.pill.hr { color: #ff8a80; border-color: #6b2c2a; }
.badge-restricted { display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 5px; font-size: .72rem; font-weight: 700;
  color: var(--warn); border: 1px solid #6b5222; vertical-align: 1px; }

/* hero */
.hero { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 14px; }
.hero h1 { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.meta { display: flex; flex-wrap: wrap; gap: 6px 18px; color: var(--muted); }
.meta b { color: var(--text); font-weight: 600; }
.notes { margin-top: 10px; white-space: pre-wrap; background: var(--panel-2); border-radius: 8px; padding: 8px 12px; }
.loot-rules { margin-top: 10px; }

/* roster */
.roles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.role h3 { display: flex; justify-content: space-between; }
.role ul, .others ul { list-style: none; margin: 0; padding: 0; }
.role li, .others li { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 4px 6px; border-radius: 6px; }
.role li:nth-child(odd) { background: var(--row-alt); }
.role li.me, .others li.me { box-shadow: inset 3px 0 0 var(--accent-2); }
.cname { font-weight: 700; }
.spec { color: var(--muted); font-size: .82rem; }
.who { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty { color: var(--muted); font-style: italic; padding: 4px 6px; }
.others { margin-top: 14px; display: grid; gap: 10px; }
.class-line { margin-top: 12px; color: var(--muted); font-size: .85rem; }
.lead-menu { flex: 0 0 auto; width: 26px; height: 24px; padding: 0; text-align: center; text-align-last: center; font-size: 1rem;
  background: transparent; color: var(--muted); border-color: transparent; appearance: none; -webkit-appearance: none; cursor: pointer; }
.lead-menu:hover, .lead-menu:focus { border-color: var(--line); color: var(--text); }
.lead-menu option { color: var(--text); background: var(--panel-2); text-align: left; }

/* items table (softres-style) */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 10px; }
.toolbar select { width: auto; min-width: 150px; }
.toolbar input[type=search] { flex: 1 1 220px; }
.my-res { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 6px 4px 10px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line); }
.chip button { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 1rem; line-height: 1; padding: 0 4px; }
.chip button:hover { color: var(--danger); }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; }
table.items { width: 100%; border-collapse: collapse; }
table.items th { text-align: left; font-size: .85rem; color: var(--text); background: #18181d; padding: 9px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.items td { padding: 9px 10px; border-bottom: 1px solid #26262e; vertical-align: middle; }
table.items tbody tr:nth-child(odd) { background: var(--row); }
table.items tbody tr:nth-child(even) { background: var(--row-alt); }
table.items tr.boss-row td { background: #16161b; color: var(--gold); font-weight: 700; font-size: .85rem; letter-spacing: .03em; padding: 6px 10px; }
table.items tr.mine td { box-shadow: inset 0 0 0 9999px rgba(122, 79, 214, .12); }
td.num { color: var(--muted); }
td.act { text-align: right; width: 1%; white-space: nowrap; }
.reservers { display: flex; flex-wrap: wrap; gap: 4px 10px; }
.roll { color: var(--gold); font-size: .8rem; font-weight: 700; }
.sub { display: none; color: var(--muted); font-size: .8rem; }
a.item { text-decoration: none; font-weight: 600; }
a.item:hover { text-decoration: underline; }
.q-poor { color: var(--q-poor); } .q-common { color: var(--q-common); } .q-uncommon { color: var(--q-uncommon); }
.q-rare { color: var(--q-rare); } .q-epic { color: var(--q-epic); } .q-legendary { color: var(--q-legendary); }
.q-rare { color: #3d8ff2; } /* a touch lighter than in-game blue for contrast on dark */

/* class colors */
.c-warrior { color: #c69b6d; } .c-paladin { color: #f48cba; } .c-hunter { color: #aad372; } .c-rogue { color: #fff468; }
.c-priest { color: #ffffff; } .c-shaman { color: #2b8ff6; } .c-mage { color: #3fc7eb; } .c-warlock { color: #8788ee; }
.c-druid { color: #ff7c0a; }

/* raid list */
.raid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.raid-card { display: block; text-decoration: none; color: var(--text); background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px; transition: border-color .15s; }
.raid-card:hover { border-color: var(--accent); }
.raid-card h2 { margin-bottom: 4px; }
.bar { height: 6px; border-radius: 4px; background: var(--panel-2); overflow: hidden; margin: 10px 0 6px; }
.bar > span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }

pre.macro { background: #15151a; border: 1px solid var(--line); border-radius: 8px; padding: 10px; white-space: pre-wrap; margin: 6px 0; font-size: .85rem; }
details.tool { border-top: 1px solid var(--line); padding: 12px 0; }
details.tool:first-of-type { border-top: 0; }
details.tool summary { cursor: pointer; font-weight: 700; }
details.tool[open] summary { margin-bottom: 10px; }

.login .logo-big { font-size: 2rem; font-weight: 800; margin: 6px 0; background: linear-gradient(120deg, #e9d8ff, var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); opacity: 0; pointer-events: none;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 16px; max-width: min(92vw, 520px);
  transition: opacity .2s, transform .2s; z-index: 50; box-shadow: 0 8px 30px rgba(0,0,0,.4); }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { border-color: var(--danger); }
.toast.good { border-color: var(--ok); }

@media (max-width: 860px) {
  .grid2 { grid-template-columns: 1fr; }
  .roles { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  main { padding: 14px 12px 50px; }
  .top { padding: 8px 12px; }
  .nav .user { display: none; }
  .hero h1 { font-size: 1.3rem; }
  table.items th.c-slot, table.items td.c-slot, table.items th.c-ilvl, table.items td.c-ilvl,
  table.items th.c-from, table.items td.c-from { display: none; }
  .sub { display: block; }
  .toolbar select { flex: 1 1 140px; min-width: 0; }
}
