:root {
  --bg: #f3f0e8;
  --bg-deep: #e9e3d6;
  --surface: #fffdf8;
  --surface-2: #f8f5ec;
  --surface-3: #f1ecdf;
  --ink: #252b2d;
  --ink-soft: #434b4c;
  --muted: #727977;
  --line: #dcd4c5;
  --line-strong: #c9bfa9;
  --jade: #2f6b5f;
  --jade-dark: #234f46;
  --jade-soft: #e2efe9;
  --gold: #a97824;
  --gold-soft: #f7ecd4;
  --red: #a94442;
  --red-soft: #f8e5e3;
  --blue: #3b6b9b;
  --blue-soft: #e5eef8;
  --purple: #6d5a9c;
  --purple-soft: #ece7f7;
  --shadow: 0 1px 2px rgba(45, 39, 26, 0.05), 0 8px 24px rgba(45, 39, 26, 0.05);
  --radius: 14px;
  --radius-sm: 9px;
  --font: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  min-height: 100vh;
  background:
    radial-gradient(1200px 500px at 80% -10%, rgba(47, 107, 95, 0.08), transparent 60%),
    radial-gradient(900px 400px at 0% 0%, rgba(169, 120, 36, 0.08), transparent 55%),
    var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  display: flex;
  flex-direction: column;
}

a { color: var(--jade); text-decoration: none; }
a:hover { color: var(--jade-dark); }
h1, h2, h3, h4 { margin: 0 0 8px; font-weight: 700; letter-spacing: 0.01em; }
h1 { font-size: 28px; }
h2 { font-size: 18px; }
h3 { font-size: 16px; }
p { margin: 0 0 10px; }
ul { margin: 0; padding-left: 20px; }
code { font-family: "Cascadia Code", Consolas, monospace; background: var(--surface-3); padding: 1px 5px; border-radius: 4px; }

.muted { color: var(--muted); }
.small { font-size: 12px; }
.eyebrow { margin: 0 0 6px; color: var(--jade); font-size: 12px; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; }
.align-right { text-align: right; }
.inline-form { display: inline; margin: 0; }
.link { font-size: 13px; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(246, 242, 233, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 10px 22px;
  display: flex;
  align-items: center;
  gap: 22px;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 800; font-size: 17px; white-space: nowrap; }
.brand:hover { color: var(--ink); }
.brand-mark {
  width: 32px; height: 32px; display: grid; place-items: center;
  background: var(--jade); color: #fff; border-radius: 9px;
  font-family: "STKaiti", "KaiTi", serif; font-size: 20px;
  box-shadow: inset 0 -2px 0 rgba(0,0,0,.18);
}
.main-nav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.nav-link { padding: 7px 11px; border-radius: 8px; color: var(--ink-soft); font-weight: 600; font-size: 13px; }
.nav-link:hover { background: var(--surface-3); color: var(--ink); }
.nav-link.active { background: var(--jade-soft); color: var(--jade-dark); }
.user-area { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.user-name { color: var(--ink-soft); font-size: 13px; }
.mini-badge { margin-left: 5px; padding: 1px 6px; border-radius: 999px; background: var(--gold-soft); color: var(--gold); font-size: 10px; font-weight: 700; }

.container { width: 100%; max-width: 1240px; margin: 0 auto; padding: 26px 22px 48px; flex: 1; }
.container-wide { width: 100%; max-width: 1600px; margin: 0 auto; padding: 22px 18px 48px; flex: 1; }
.auth-container { width: 100%; max-width: 440px; margin: 0 auto; padding: 60px 20px; flex: 1; }

.footer { border-top: 1px solid var(--line); padding: 16px 22px 26px; display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 12px; max-width: 1240px; margin: 0 auto; width: 100%; }

.flash { padding: 11px 14px; border-radius: var(--radius-sm); margin-bottom: 16px; border: 1px solid; font-weight: 600; }
.flash-ok { background: var(--jade-soft); border-color: #b9d8cb; color: var(--jade-dark); }
.flash-err { background: var(--red-soft); border-color: #e7bdb9; color: var(--red); }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { margin-bottom: 4px; }
.page-actions { display: flex; gap: 9px; flex-wrap: wrap; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 36px; padding: 7px 14px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink-soft);
  font: inherit; font-weight: 700; font-size: 13px; cursor: pointer;
  transition: .15s ease;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-3); border-color: #b7ab93; color: var(--ink); }
.btn-primary { background: var(--jade); border-color: var(--jade); color: #fff; }
.btn-primary:hover { background: var(--jade-dark); border-color: var(--jade-dark); color: #fff; }
.btn-danger { color: var(--red); border-color: #dfb9b5; background: var(--surface); }
.btn-danger:hover { background: var(--red-soft); color: var(--red); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--surface-3); }
.btn-sm { min-height: 29px; padding: 4px 9px; font-size: 12px; border-radius: 7px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-head h2 { margin: 0; }
.narrow-card { max-width: 720px; }

.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 15px 16px; box-shadow: var(--shadow); }
.stat-label { display: block; color: var(--muted); font-size: 12px; font-weight: 600; }
.stat-value { display: block; margin-top: 4px; font-size: 26px; letter-spacing: -0.02em; }

.two-col { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); gap: 16px; align-items: start; }
.two-col-wide { grid-template-columns: minmax(0, 1.25fr) minmax(0, .75fr); }

.raid-list { display: flex; flex-direction: column; }
.raid-row { display: flex; align-items: center; gap: 13px; padding: 12px 6px; border-top: 1px solid var(--line); color: var(--ink); }
.raid-row:first-child { border-top: 0; }
.raid-row:hover { background: var(--surface-2); border-radius: 9px; }
.raid-date { width: 58px; flex: 0 0 58px; text-align: center; background: var(--surface-3); border-radius: 9px; padding: 6px 4px; }
.raid-date strong { display: block; font-size: 15px; }
.raid-date span { display: block; color: var(--muted); font-size: 11px; }
.raid-main { flex: 1; min-width: 0; }
.raid-title { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.raid-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.mini-list { display: flex; flex-direction: column; }
.mini-row { display: flex; justify-content: space-between; gap: 12px; padding: 10px 4px; border-top: 1px solid var(--line); color: var(--ink); }
.mini-row:first-child { border-top: 0; }
.mini-row:hover { background: var(--surface-2); border-radius: 8px; }

.empty { padding: 22px 8px; text-align: center; color: var(--muted); }
.empty p { margin-bottom: 10px; }
.empty-page { max-width: 520px; margin: 80px auto; text-align: center; }
.empty-mark { width: 54px; height: 54px; margin: 0 auto 14px; display: grid; place-items: center; border-radius: 16px; background: var(--red-soft); color: var(--red); font-size: 28px; font-weight: 800; }

.callout { margin-top: 18px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 18px; border: 1px dashed var(--line-strong); border-radius: var(--radius); background: var(--gold-soft); }
.callout p { margin: 2px 0 0; }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .06em; padding: 8px 9px; border-bottom: 1px solid var(--line-strong); white-space: nowrap; }
.table td { padding: 9px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr:hover td { background: var(--surface-2); }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; align-items: center; }

.badge { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; background: var(--surface-3); color: var(--ink-soft); white-space: nowrap; }
.badge-open { background: var(--jade-soft); color: var(--jade-dark); }
.badge-locked { background: var(--gold-soft); color: var(--gold); }
.badge-finished { background: #ece9e3; color: var(--muted); }
.badge-cancelled, .badge-leave { background: var(--red-soft); color: var(--red); }
.badge-waitlist { background: var(--gold-soft); color: var(--gold); }
.badge-confirmed { background: var(--jade-soft); color: var(--jade-dark); }
.badge-draft { background: var(--surface-3); color: var(--muted); }
.badge-closed { background: #ece9e3; color: var(--muted); }

.role-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; padding: 2px 7px; border-radius: 6px; font-size: 11px; font-weight: 800; }
.role-t { background: var(--blue-soft); color: var(--blue); }
.role-n { background: var(--jade-soft); color: var(--jade-dark); }
.role-d { background: var(--red-soft); color: var(--red); }

.stack-form { display: flex; flex-direction: column; gap: 13px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 600; color: var(--ink-soft); }
.field > span { font-size: 12px; color: var(--muted); font-weight: 700; }
.field input, .field select, .field textarea {
  width: 100%; min-height: 38px; padding: 8px 10px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: #fffefa; color: var(--ink); font: inherit; font-weight: 400;
  outline: none; transition: .15s;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--jade); box-shadow: 0 0 0 3px rgba(47,107,95,.13); }
.field textarea { min-height: 84px; resize: vertical; }
.field input::placeholder, .field textarea::placeholder { color: #a7a097; }
.field small { font-weight: 400; }
.role-preview { min-height: 32px; display: flex; align-items: center; gap: 6px; }
.xinfa-icon { width: 18px; height: 18px; border-radius: 4px; vertical-align: -3px; margin-right: 4px; object-fit: cover; background: var(--surface-3); }
.xinfa-icon-lg { width: 24px; height: 24px; border-radius: 5px; vertical-align: -5px; margin-right: 5px; object-fit: cover; background: var(--surface-3); }
.xinfa-icon-sm { width: 16px; height: 16px; border-radius: 4px; vertical-align: -3px; margin-right: 4px; object-fit: cover; background: var(--surface-3); }
.xinfa-icon-xs { width: 14px; height: 14px; border-radius: 3px; vertical-align: -2px; margin-right: 3px; object-fit: cover; background: var(--surface-3); }

.auth-body { display: flex; flex-direction: column; }
.auth-card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); padding: 28px; }
.auth-head { text-align: center; margin-bottom: 22px; }
.auth-head h1 { margin: 10px 0 4px; }
.auth-mark { width: 52px; height: 52px; margin: 0 auto; display: grid; place-items: center; background: var(--jade); color: #fff; border-radius: 15px; font-family: "STKaiti", "KaiTi", serif; font-size: 30px; box-shadow: inset 0 -3px 0 rgba(0,0,0,.18); }
.auth-foot { text-align: center; margin: 18px 0 0; font-size: 13px; }
.auth-body .topbar-inner { max-width: 100%; }
.auth-body .footer { justify-content: center; }

/* ---------- raid page ---------- */
.raid-hero { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 16px; }
.raid-hero-top { display: flex; justify-content: space-between; gap: 18px; flex-wrap: wrap; align-items: flex-start; }
.raid-hero h1 { margin-bottom: 4px; }
.raid-meta { display: flex; gap: 14px; flex-wrap: wrap; color: var(--muted); font-size: 13px; }
.raid-meta strong { color: var(--ink-soft); }
.raid-tabs { display: flex; gap: 3px; flex-wrap: wrap; margin-top: 16px; border-top: 1px solid var(--line); padding-top: 12px; }
.raid-tab { padding: 7px 12px; border-radius: 8px; color: var(--ink-soft); font-weight: 700; font-size: 13px; }
.raid-tab:hover { background: var(--surface-3); color: var(--ink); }
.raid-tab.active { background: var(--jade-soft); color: var(--jade-dark); }

.roster-layout { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(300px, .65fr); gap: 16px; align-items: start; }
.signup-panel { position: sticky; top: 82px; }
.roster-group { margin-bottom: 12px; }
.roster-group h3 { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.roster-group h3 .badge { font-size: 10px; }
.team-select { min-height: 30px; padding: 3px 7px; border: 1px solid var(--line-strong); border-radius: 7px; background: #fffefa; font: inherit; font-size: 12px; }

/* ---------- roster grid ---------- */
.roster-card { min-width: 0; }
.roster-grid-wrap { overflow-x: auto; padding-bottom: 4px; }
.roster-grid { display: grid; gap: 8px; min-width: 850px; align-items: stretch; }
.roster-column { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.roster-column-head { display: flex; align-items: center; gap: 6px; padding: 6px 8px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; }
.roster-column-head strong { flex: 1; font-size: 13px; }
.column-menu { border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 18px; line-height: 1; padding: 0 2px; }
.column-menu:hover { color: var(--ink); }
.roster-cell { position: relative; display: flex; flex-direction: column; border: 1px solid var(--line); border-left: 4px solid var(--line-strong); border-radius: 9px; background: var(--surface); padding: 6px 8px; height: 104px; min-height: 104px; max-height: 104px; cursor: pointer; transition: .15s; overflow: hidden; }
.roster-cell.role-any { border-left-color: var(--line-strong); }
.roster-cell.role-T { border-left-color: var(--blue); }
.roster-cell.role-N { border-left-color: var(--jade); }
.roster-cell.role-dps { border-left-color: var(--red); }
.roster-cell.role-inner { border-left-color: var(--purple); }
.roster-cell.role-outer { border-left-color: var(--gold); }
.roster-cell.occupied { background: var(--surface-2); }
.roster-cell.locked { border-style: dashed; }
.roster-cell.config { outline: 1px dashed var(--jade); outline-offset: 1px; }
.roster-cell.drag-over { background: var(--jade-soft); outline: 2px solid var(--jade); }
.roster-cell-head { display: flex; align-items: center; gap: 5px; margin-bottom: 3px; }
.roster-role { font-size: 10px; font-weight: 800; padding: 1px 5px; border-radius: 4px; background: var(--surface-3); color: var(--muted); white-space: nowrap; }
.roster-role.role-T { background: var(--blue-soft); color: var(--blue); }
.roster-role.role-N { background: var(--jade-soft); color: var(--jade-dark); }
.roster-role.role-dps { background: var(--red-soft); color: var(--red); }
.roster-role.role-inner { background: var(--purple-soft); color: var(--purple); }
.roster-role.role-outer { background: var(--gold-soft); color: var(--gold); }
.slot-no { margin-left: auto; color: var(--muted); font-size: 10px; }
.roster-cell-label { color: var(--muted); font-size: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.locked-icon { color: var(--gold); font-size: 10px; }
.roster-occupant { position: relative; height: 100%; padding-right: 18px; overflow: hidden; }
.roster-occupant-top { display: flex; align-items: center; gap: 6px; flex-wrap: nowrap; min-width: 0; }
.roster-occupant-top strong { display: block; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.roster-occupant > .muted.small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.roster-note { color: var(--muted); font-size: 10px; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-x { position: absolute; right: 0; bottom: 0; border: 0; background: transparent; color: #a39b8f; cursor: pointer; font-size: 15px; line-height: 1; padding: 0 2px; }
.cell-x:hover { color: var(--red); }
.roster-drop { flex: 1; min-height: 0; overflow: hidden; }
.roster-empty { height: 100%; min-height: 42px; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 11px; }
.roster-my-list { display: flex; flex-direction: column; gap: 7px; }
.roster-char-chip { border: 1px solid var(--line); border-radius: 9px; padding: 7px 9px; background: var(--surface-2); cursor: grab; user-select: none; }
.roster-char-chip[draggable="false"] { cursor: default; opacity: .8; }
.roster-char-chip.dragging { opacity: .4; }
.roster-char-chip:hover { border-color: var(--line-strong); background: #fff; }
.roster-char-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.roster-char-foot { margin-top: 4px; }
.roster-char-list { display: flex; flex-direction: column; gap: 6px; max-height: 52vh; overflow: auto; }
.roster-pick { display: flex; flex-direction: column; gap: 3px; text-align: left; border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px; background: var(--surface-2); cursor: pointer; font: inherit; color: var(--ink); }
.roster-pick:hover:not(:disabled) { border-color: var(--jade); background: #fff; }
.roster-pick.disabled, .roster-pick:disabled { opacity: .55; cursor: not-allowed; }
.roster-pick-main { display: flex; align-items: center; gap: 6px; }
.preset-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.check-row { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-soft); }
.check-row input { width: auto; min-height: auto; }
.waitlist-block { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 10px; }
.roster-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin-top: 10px; }
.roster-legend .roster-role { font-size: 10px; }
.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 120; background: var(--ink); color: #fff; padding: 9px 16px; border-radius: 999px; font-size: 13px; box-shadow: 0 10px 30px rgba(0,0,0,.22); }
.toast[hidden] { display: none; }

/* ---------- board ---------- */
.board-shell { display: grid; grid-template-columns: 288px minmax(0, 1fr); gap: 16px; align-items: start; }
.member-pool { position: sticky; top: 76px; max-height: calc(100vh - 92px); overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.member-pool-head { padding: 13px 14px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); z-index: 2; }
.member-pool-head h2 { margin: 0 0 8px; font-size: 15px; }
.member-search { width: 100%; min-height: 33px; padding: 6px 9px; border: 1px solid var(--line-strong); border-radius: 8px; background: #fffefa; font: inherit; font-size: 13px; }
.member-group { border-bottom: 1px solid var(--line); padding: 10px 12px 12px; }
.member-group:last-child { border-bottom: 0; }
.member-group-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 7px; }
.member-group-title { font-size: 12px; font-weight: 800; color: var(--muted); letter-spacing: .04em; }
.member-list { display: flex; flex-direction: column; gap: 5px; }
.member-chip { display: flex; align-items: center; gap: 7px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); cursor: grab; user-select: none; font-size: 12px; }
.member-chip:hover { border-color: var(--line-strong); background: #fff; }
.member-chip:active { cursor: grabbing; }
.member-chip .dot { width: 7px; height: 7px; border-radius: 50%; flex: 0 0 7px; background: var(--red); }
.member-chip .dot.t { background: var(--blue); }
.member-chip .dot.n { background: var(--jade); }
.member-chip .name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member-chip .xinfa { margin-left: auto; color: var(--muted); font-size: 11px; white-space: nowrap; }
.team-drag-chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border: 1px dashed var(--gold); border-radius: 999px; background: var(--gold-soft); color: var(--gold); font-size: 11px; font-weight: 800; cursor: grab; user-select: none; }
.team-drag-chip:active { cursor: grabbing; }
.unassigned-note { color: var(--muted); font-size: 11px; }

.board-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.board-toolbar .spacer { flex: 1; }
.save-status { font-size: 12px; color: var(--muted); white-space: nowrap; }
.save-status.saving { color: var(--gold); }
.save-status.saved { color: var(--jade); }
.save-status.error { color: var(--red); }
.phase-tabs { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.phase-tab { padding: 5px 10px; border-radius: 7px; border: 1px solid transparent; background: transparent; color: var(--ink-soft); font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; }
.phase-tab:hover { background: var(--surface-3); }
.phase-tab.active { background: var(--jade); color: #fff; }
.phase-add { border: 1px dashed var(--line-strong); color: var(--muted); }
.phase-add:hover { color: var(--jade); border-color: var(--jade); }

.board-canvas { min-width: 0; }
.phase-section { margin-bottom: 22px; }
.phase-section-head { display: flex; align-items: center; gap: 10px; margin-bottom: 9px; }
.phase-section-head h2 { margin: 0; font-size: 16px; }
.phase-section-head .line { flex: 1; height: 1px; background: var(--line); }
.slot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; align-items: start; }
.slot-card { background: var(--surface); border: 1px solid var(--line); border-top: 3px solid var(--jade); border-radius: var(--radius-sm); box-shadow: var(--shadow); padding: 10px 11px 11px; min-width: 0; }
.slot-card.type-damage { border-top-color: var(--red); }
.slot-card.type-guide { border-top-color: var(--blue); }
.slot-card.type-sword { border-top-color: var(--gold); }
.slot-card.type-circle { border-top-color: var(--purple); }
.slot-card.type-custom { border-top-color: var(--muted); }
.slot-card.child { border-top-width: 2px; background: var(--surface-2); box-shadow: none; }
.slot-card.drop-active { outline: 2px dashed var(--jade); outline-offset: 2px; }
.slot-card.conflict { border-color: #d39a2e; background: #fffaf0; }
.slot-head { display: flex; align-items: center; gap: 6px; margin-bottom: 7px; }
.slot-type { font-size: 10px; font-weight: 800; padding: 2px 6px; border-radius: 5px; background: var(--jade-soft); color: var(--jade-dark); white-space: nowrap; }
.type-damage .slot-type { background: var(--red-soft); color: var(--red); }
.type-guide .slot-type { background: var(--blue-soft); color: var(--blue); }
.type-sword .slot-type { background: var(--gold-soft); color: var(--gold); }
.type-circle .slot-type { background: var(--purple-soft); color: var(--purple); }
.type-custom .slot-type { background: var(--surface-3); color: var(--muted); }
.slot-name { font-weight: 800; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slot-cap { margin-left: auto; color: var(--muted); font-size: 11px; white-space: nowrap; }
.slot-cap.over { color: var(--red); font-weight: 800; }
.slot-menu { border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 18px; line-height: 1; padding: 0 3px; }
.slot-menu:hover { color: var(--ink); }
.slot-assignees { display: flex; flex-wrap: wrap; gap: 5px; min-height: 40px; padding: 6px; border: 1px dashed var(--line-strong); border-radius: 7px; background: rgba(255,255,255,.55); align-content: flex-start; transition: .15s; }
.slot-assignees:empty::after { content: "拖团员或整队到这里"; color: #a39b8f; font-size: 11px; align-self: center; padding-left: 2px; }
.slot-assignees.drop-over { background: var(--jade-soft); border-color: var(--jade); }
.assignee-chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 7px; border-radius: 999px; background: #fff; border: 1px solid var(--line); font-size: 11px; font-weight: 700; cursor: grab; user-select: none; max-width: 100%; }
.assignee-chip.team { background: var(--gold-soft); border-color: #e4c98f; color: #7b5719; }
.assignee-chip .x { border: 0; background: transparent; color: #a39b8f; cursor: pointer; font-size: 13px; line-height: 1; padding: 0 0 0 2px; }
.assignee-chip .x:hover { color: var(--red); }
.assignee-chip .role-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--red); }
.assignee-chip .role-dot.t { background: var(--blue); }
.assignee-chip .role-dot.n { background: var(--jade); }
.assignee-chip.conflict-chip { outline: 2px solid #e0a92e; outline-offset: 1px; }
.slot-children { margin-top: 8px; padding-left: 9px; border-left: 2px solid var(--line); display: flex; flex-direction: column; gap: 7px; }
.slot-children .slot-card { padding: 8px 9px; }
.slot-empty-hint { color: var(--muted); font-size: 12px; padding: 8px 2px; }
.standalone-title { margin: 18px 0 9px; color: var(--muted); font-size: 12px; font-weight: 800; letter-spacing: .08em; }
.conflict-banner { margin-bottom: 12px; padding: 9px 12px; border: 1px solid #e3bf74; background: #fff8e6; color: #7c5a17; border-radius: 9px; font-size: 12px; }
.conflict-banner strong { color: #6b4b0e; }
.board-readonly-note { margin-bottom: 12px; padding: 9px 12px; border: 1px dashed var(--line-strong); border-radius: 9px; color: var(--muted); font-size: 12px; background: var(--surface-2); }

/* ---------- modals ---------- */
.modal-backdrop { position: fixed; inset: 0; z-index: 80; background: rgba(30, 28, 24, .42); display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal-backdrop[hidden] { display: none; }
.modal { width: 100%; max-width: 480px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 20px 60px rgba(0,0,0,.22); padding: 20px; }
.modal h2 { margin-bottom: 12px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.modal .close { float: right; border: 0; background: transparent; font-size: 20px; color: var(--muted); cursor: pointer; }
.slot-menu-popover { position: absolute; z-index: 60; background: var(--surface); border: 1px solid var(--line); border-radius: 9px; box-shadow: var(--shadow); padding: 5px; min-width: 136px; }
.slot-menu-popover button { display: block; width: 100%; text-align: left; border: 0; background: transparent; padding: 7px 9px; border-radius: 6px; font: inherit; font-size: 12px; cursor: pointer; color: var(--ink-soft); }
.slot-menu-popover button:hover { background: var(--surface-3); color: var(--ink); }
.slot-menu-popover button.danger { color: var(--red); }

.raid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; margin-bottom: 18px; }
.raid-card { display: flex; flex-direction: column; gap: 8px; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); color: var(--ink); }
.raid-card:hover { border-color: var(--line-strong); color: var(--ink); transform: translateY(-1px); }
.raid-card h3 { margin: 0; font-size: 16px; }
.raid-card-top, .raid-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.raid-card-foot { margin-top: auto; padding-top: 8px; border-top: 1px dashed var(--line); font-size: 13px; }

.position-list { display: flex; flex-direction: column; gap: 6px; }
.position-item { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-2); font-size: 13px; }
.position-item .slot-type { font-size: 10px; font-weight: 800; padding: 2px 6px; border-radius: 5px; background: var(--jade-soft); color: var(--jade-dark); }

.slot-add-child { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 7px; }
.slot-add-child .btn { min-height: 25px; padding: 2px 7px; font-size: 11px; background: transparent; border-style: dashed; }
.slot-add-child .btn:hover { background: var(--surface); }
.assignee-chip.missing { opacity: .65; border-style: dashed; }
.sortable-ghost { opacity: .35; border: 1px dashed var(--jade) !important; background: var(--jade-soft) !important; }

/* ---------- board map view ---------- */
.view-switch { display: inline-flex; gap: 2px; padding: 2px; border-radius: 9px; background: var(--surface-3); }
.view-tab { border: 0; background: transparent; padding: 5px 11px; border-radius: 7px; font: inherit; font-size: 12px; font-weight: 800; color: var(--muted); cursor: pointer; }
.view-tab:hover { color: var(--ink-soft); }
.view-tab.active { background: var(--surface); color: var(--jade-dark); box-shadow: 0 1px 3px rgba(45, 39, 26, .12); }
.view-tab[hidden] { display: none; }
.map-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.map-toolbar .spacer { flex: 1; }
.map-add-btn.active { background: var(--jade); border-color: var(--jade); color: #fff; }
.map-hint { color: var(--muted); font-size: 12px; }
.map-unplaced { max-width: 190px; min-height: 30px; font-size: 12px; }
.map-meta { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.map-meta strong { font-size: 15px; }
.map-meta span { color: var(--muted); font-size: 12px; }
.map-stage { position: relative; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: #efe6d4; box-shadow: var(--shadow); }
.map-stage.adding { outline: 3px dashed var(--jade); outline-offset: -3px; cursor: crosshair; }
.map-image { display: block; width: 100%; height: auto; user-select: none; }
.map-pins { position: absolute; inset: 0; }
.map-pin { position: absolute; transform: translate(-50%, -50%); width: 60px; height: 60px; padding: 4px; display: flex; align-items: center; justify-content: center; text-align: center; border: 2px solid var(--jade); border-radius: 50%; background: var(--jade-soft); box-shadow: 0 2px 8px rgba(45, 39, 26, .22); font: inherit; font-size: 11px; line-height: 1.15; font-weight: 800; color: var(--ink); cursor: pointer; touch-action: none; overflow: visible; }
.map-pin:hover { z-index: 3; box-shadow: 0 5px 14px rgba(45, 39, 26, .3); }
.map-pin.conflict { outline: 2px solid #e0a92e; outline-offset: 1px; background: #fff8e6; }
.map-pin.type-damage { border-color: var(--red); background: var(--red-soft); }
.map-pin.type-guide { border-color: var(--blue); background: var(--blue-soft); }
.map-pin.type-sword { border-color: var(--gold); background: var(--gold-soft); }
.map-pin.type-circle { border-color: var(--purple); background: var(--purple-soft); }
.map-pin.type-custom { border-color: var(--muted); background: var(--surface-3); }
.map-pin-label { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; max-width: 46px; word-break: break-all; }
.map-pin-count { position: absolute; right: -5px; bottom: -5px; min-width: 17px; height: 17px; padding: 0 4px; display: flex; align-items: center; justify-content: center; border: 1px solid #fff; border-radius: 999px; background: var(--jade); color: #fff; font-size: 10px; font-weight: 800; }
.map-empty-hint { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 3px; max-width: min(420px, 80%); padding: 9px 16px; text-align: center; color: var(--muted); font-size: 12px; background: rgba(255, 253, 248, .96); border: 1px dashed var(--line-strong); border-radius: 10px; box-shadow: var(--shadow); pointer-events: none; }
.map-empty-hint strong { color: var(--ink-soft); font-size: 14px; }
.map-legend { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 8px; color: var(--muted); font-size: 11px; }
.map-legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--jade); }
.legend-dot.damage { background: var(--red); }
.legend-dot.guide { background: var(--blue); }
.legend-dot.sword { background: var(--gold); }
.legend-dot.circle { background: var(--purple); }
.legend-dot.custom { background: var(--muted); }
.map-selection { margin-top: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.map-selection-head { display: flex; align-items: center; gap: 7px; margin-bottom: 7px; }
.map-selection-head .x { margin-left: auto; border: 0; background: transparent; color: var(--muted); font-size: 16px; line-height: 1; cursor: pointer; }
.map-selection-body { display: flex; flex-wrap: wrap; gap: 5px; }

.slot-assign-list { max-height: 214px; overflow: auto; padding: 6px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); }
.assign-group { padding: 4px 0 6px; border-bottom: 1px dashed var(--line); }
.assign-group:last-child { border-bottom: 0; }
.assign-group-title { padding: 4px 6px; color: var(--muted); font-size: 11px; font-weight: 800; }
.assign-row { display: flex; align-items: center; gap: 6px; padding: 4px 6px; border-radius: 6px; font-size: 12px; cursor: pointer; }
.assign-row:hover { background: #fff; }
.assign-row input { width: auto; min-height: auto; margin: 0; }
.assign-row.team-row { margin-bottom: 2px; background: var(--gold-soft); }
.assign-row .role-dot { width: 6px; height: 6px; border-radius: 50%; flex: 0 0 6px; background: var(--red); }
.assign-row .role-dot.t { background: var(--blue); }
.assign-row .role-dot.n { background: var(--jade); }
.assign-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.assign-row .muted { margin-left: auto; white-space: nowrap; }

/* ---------- roll / blackbook ---------- */
.roll-layout { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(300px, .85fr); gap: 16px; align-items: start; }
.roll-number { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
.roll-number.top { color: var(--gold); }
.roll-winner { background: var(--gold-soft); }
.roll-winner td { border-bottom-color: #e4c98f; }
.wage-big { font-size: 30px; font-weight: 800; letter-spacing: -.02em; }
.kv-list { display: flex; flex-direction: column; gap: 8px; }
.kv { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px dashed var(--line); padding-bottom: 7px; font-size: 13px; }
.kv:last-child { border-bottom: 0; padding-bottom: 0; }
.kv span { color: var(--muted); }
.kv strong { text-align: right; }
.rank-list { display: flex; flex-direction: column; gap: 5px; }
.rank-row { display: flex; align-items: center; gap: 9px; padding: 7px 8px; border-radius: 8px; background: var(--surface-2); font-size: 12px; }
.rank-row .rank { width: 22px; color: var(--muted); font-weight: 800; text-align: center; }
.rank-row .rank-name { flex: 1; font-weight: 700; }
.rank-row .rank-value { color: var(--gold); font-weight: 800; }
.rank-row.top { background: var(--gold-soft); }
.rank-row.bottom { background: var(--red-soft); }

/* ---------- tabs / misc ---------- */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.tab { padding: 8px 12px; border-bottom: 2px solid transparent; color: var(--ink-soft); font-weight: 700; font-size: 13px; }
.tab:hover { color: var(--jade); }
.tab.active { border-bottom-color: var(--jade); color: var(--jade-dark); }

.hint { padding: 10px 12px; border-radius: 9px; background: var(--surface-2); border: 1px dashed var(--line); color: var(--muted); font-size: 12px; }
.danger-zone { border-color: #e4c3bf; background: #fff9f8; }
.inline-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mb-2 { margin-bottom: 16px; }
.w-full { width: 100%; }
.text-right { text-align: right; }
.nowrap { white-space: nowrap; }

@media (max-width: 1000px) {
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .two-col, .two-col-wide, .roster-layout, .roll-layout { grid-template-columns: 1fr; }
  .signup-panel { position: static; }
  .board-shell { grid-template-columns: 1fr; }
  .member-pool { position: static; max-height: 260px; }
  .member-list { flex-direction: row; flex-wrap: wrap; }
  .member-chip { flex: 1 1 150px; }
}

@media (max-width: 640px) {
  .topbar-inner { padding: 9px 12px; gap: 10px; flex-wrap: wrap; }
  .main-nav { order: 3; width: 100%; flex: 0 0 100%; overflow-x: auto; flex-wrap: nowrap; }
  .nav-link { padding: 6px 8px; white-space: nowrap; }
  .container, .container-wide { padding: 16px 12px 34px; }
  .page-head { align-items: flex-start; }
  .page-head h1 { font-size: 23px; }
  .stat-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .stat-card { padding: 12px; }
  .stat-value { font-size: 21px; }
  .form-row { grid-template-columns: 1fr; }
  .slot-grid { grid-template-columns: 1fr; }
  .raid-side { display: none; }
  .footer { flex-direction: column; }
}
