:root {
  color-scheme: dark;
  --bg: #0a0f1e;
  --bg-soft: #0e1528;
  --panel: #121a2f;
  --panel-2: #17203a;
  --panel-3: #1d2947;
  --line: #263351;
  --line-strong: #36466f;
  --text: #e9eeff;
  --muted: #9aa8c9;
  --muted-2: #8394b9;
  --accent: #7f9dff;
  --accent-soft: #24335c;
  --teal: #5fe3c4;
  --amber: #ffc35c;
  --red: #ff7b86;
  --green: #6fe3a0;
  --violet: #c39bff;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 18px 50px rgba(3, 7, 18, 0.35);
  font-family: "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1100px 520px at 12% -8%, rgba(84, 112, 220, 0.24), transparent 60%),
    radial-gradient(900px 480px at 92% 0%, rgba(50, 190, 170, 0.12), transparent 55%),
    linear-gradient(180deg, #0b1224 0%, var(--bg) 45%);
  background-attachment: fixed;
  line-height: 1.55;
}
h1, h2, h3, p, dl, dd, ol, ul { margin: 0; }
h1 { font-size: clamp(1.5rem, 3.4vw, 2.15rem); line-height: 1.2; letter-spacing: 0.01em; }
h2 { font-size: 1.05rem; line-height: 1.3; }
h3 { font-size: 0.95rem; }
button, input, select { font: inherit; color: inherit; }
input::placeholder, textarea::placeholder { color: #8e9dc2; opacity: 1; }
button { cursor: pointer; }
a { color: var(--accent); }
small, .small { font-size: 0.82rem; }
.muted { color: var(--muted); }
.hint { color: var(--muted-2); font-size: 0.82rem; margin-top: 10px; }
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.72rem;
  color: var(--accent);
  margin-bottom: 6px;
}
.skip-link {
  position: absolute;
  left: -999px;
  top: 8px;
  z-index: 100;
  background: var(--accent);
  color: #07102d;
  padding: 8px 14px;
  border-radius: 8px;
}
.skip-link:focus { left: 8px; }

/* Top bar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(9, 14, 28, 0.86);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}
.bar-inner {
  width: min(1240px, calc(100% - 28px));
  margin: 0 auto;
  display: grid;
  grid-template-columns: auto auto minmax(240px, 1fr);
  align-items: center;
  gap: 18px;
  padding: 12px 0;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(145deg, #7f9dff, #4a63c8 65%, #2b3a78);
  color: #07102d;
  font-weight: 800;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 8px 20px rgba(60, 90, 210, 0.35);
}
.brand-copy { display: grid; line-height: 1.15; }
.brand-copy strong { font-size: 1rem; }
.brand-copy small { color: var(--muted-2); font-size: 0.68rem; letter-spacing: 0.16em; text-transform: uppercase; }
.guild-switch {
  display: flex;
  padding: 3px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  gap: 2px;
}
.guild-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 0.86rem;
  white-space: nowrap;
}
.guild-btn.active {
  background: linear-gradient(180deg, #2b3c6e, #223157);
  color: var(--text);
  box-shadow: inset 0 0 0 1px var(--line-strong);
}
.login-bar { display: flex; gap: 8px; justify-content: flex-end; align-items: center; }
.combo { position: relative; flex: 1; max-width: 330px; }
.combo input, .inline-form input, .filter-row input, .pipeline-form input, .pipeline-form select {
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  outline: none;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
.combo input:focus, .inline-form input:focus, .filter-row input:focus, .pipeline-form input:focus, .pipeline-form select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(127, 157, 255, 0.16);
}
.combo-options {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: 320px;
  overflow: auto;
  margin: 0;
  padding: 5px;
  list-style: none;
  background: #10182c;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  box-shadow: var(--shadow);
  z-index: 60;
}
.combo-option {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 7px;
  cursor: pointer;
  font-size: 0.9rem;
}
.combo-option small { color: var(--muted-2); }
.combo-option:hover, .combo-option.active { background: var(--accent-soft); }
.btn {
  border: 1px solid var(--line-strong);
  background: var(--panel-2);
  color: var(--text);
  padding: 9px 15px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  transition: transform 80ms ease, background 120ms ease, border-color 120ms ease;
}
.btn:hover { background: var(--panel-3); }
.btn:active { transform: translateY(1px); }
.btn.primary {
  background: linear-gradient(180deg, #8aa6ff, #6c86ee);
  color: #07102d;
  border-color: transparent;
  font-weight: 700;
}
.btn.primary:hover { background: linear-gradient(180deg, #9bb3ff, #7b93f5); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--red); border-color: rgba(255, 123, 134, 0.45); background: rgba(255, 123, 134, 0.08); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line-strong);
  background: var(--panel-2);
  color: var(--text);
  border-radius: 999px;
  padding: 7px 13px;
  font-size: 0.86rem;
  white-space: nowrap;
}
.chip::after { content: "✕"; color: var(--muted-2); font-size: 0.72rem; }
.tabs {
  width: min(1240px, calc(100% - 28px));
  margin: 0 auto;
  display: flex;
  gap: 4px;
  border-top: 1px solid rgba(38, 51, 81, 0.55);
  padding: 6px 0 8px;
}
.tab {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 8px 14px;
  border-radius: 9px;
  font-size: 0.92rem;
}
.tab:hover { color: var(--text); background: rgba(127, 157, 255, 0.08); }
.tab.active {
  color: var(--text);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px var(--line-strong);
}

/* Layout */
main {
  width: min(1240px, calc(100% - 28px));
  margin: 0 auto;
  padding: 22px 0 60px;
}
.view { display: grid; gap: 18px; }
[hidden] { display: none !important; }
.card {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.025), transparent 42%),
    var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.card-head h2 { letter-spacing: 0.01em; }
.grid { display: grid; gap: 18px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  padding: 10px 2px 0;
}
.section-head.compact { align-items: center; }
.section-title { margin: 16px 2px -4px; font-size: 1.02rem; color: #cfd9ff; }
.empty { text-align: center; padding: 34px 22px; }
.empty h1, .empty h2 { margin-bottom: 8px; }
.empty p { color: var(--muted); max-width: 620px; margin: 0 auto; }
.banner {
  border: 1px solid rgba(255, 195, 92, 0.45);
  background: rgba(255, 195, 92, 0.08);
  color: #ffe1a8;
  border-radius: 11px;
  padding: 12px 15px;
  font-size: 0.9rem;
}
.banner strong { color: #ffd88a; }

/* Chips / badges */
.badge-row { display: flex; flex-wrap: wrap; gap: 7px; justify-content: flex-end; }
.badge, .tag, .role-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 0.76rem;
  border: 1px solid var(--line-strong);
  background: var(--panel-2);
  color: var(--muted);
  white-space: nowrap;
}
.tag.ok, .badge.ok { color: var(--green); border-color: rgba(111, 227, 160, 0.35); background: rgba(111, 227, 160, 0.08); }
.tag.warn, .badge.warn { color: var(--amber); border-color: rgba(255, 195, 92, 0.35); background: rgba(255, 195, 92, 0.08); }
.tag.bad, .badge.bad { color: var(--red); border-color: rgba(255, 123, 134, 0.35); background: rgba(255, 123, 134, 0.08); }
.legend { display: flex; flex-wrap: wrap; gap: 6px; }

/* My view */
.me-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; }
.me-head h1 { margin-bottom: 4px; }
.role-picker { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.role-btn {
  border: 1px solid var(--line);
  background: var(--panel-2);
  border-radius: 10px;
  padding: 11px 6px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--muted);
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
}
.role-btn:hover { border-color: var(--line-strong); color: var(--text); }
.role-btn.selected {
  background: linear-gradient(180deg, #33477d, #26365f);
  color: #fff;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(127, 157, 255, 0.14);
}
.role-btn[data-role="弓"] { --role: #9adcff; }
.role-btn[data-role="弩"] { --role: #7ec8ff; }
.role-btn[data-role="火"] { --role: #ff9b7a; }
.role-btn[data-role="水"] { --role: #72c8ff; }
.role-btn[data-role="自"] { --role: #8fe3a1; }
.role-btn[data-role="盾"] { --role: #ffd479; }
.role-btn[data-role="枪"] { --role: #e3b0ff; }
.role-btn[data-role="剑"] { --role: #ffb0c4; }
.role-btn[data-role="锤"] { --role: #ffcf9a; }
.role-btn.selected::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--role, var(--accent));
  margin-right: 6px;
  vertical-align: 1px;
}
.subhead { margin: 18px 0 8px; color: #cfd9ff; }
.aura-editor { display: grid; gap: 8px; }
.aura-row {
  display: grid;
  grid-template-columns: minmax(96px, 1fr) auto 74px;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 9px;
}
.aura-name { font-size: 0.9rem; }
.aura-source { font-size: 0.72rem; color: var(--muted-2); }
.aura-row input {
  width: 74px;
  padding: 6px 8px;
  text-align: center;
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: 7px;
}
.switch-row { display: flex; align-items: center; gap: 10px; margin-top: 16px; font-size: 0.92rem; }
.switch-row input { width: 18px; height: 18px; accent-color: var(--accent); }
.save-state { font-size: 0.76rem; color: var(--muted-2); }
.save-state.saving { color: var(--amber); }
.save-state.saved { color: var(--green); }
.save-state.error { color: var(--red); }

/* Assignment cards */
.assignment-hero {
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  padding: 14px;
  background:
    radial-gradient(420px 220px at 95% 0%, rgba(127, 157, 255, 0.16), transparent 70%),
    var(--bg-soft);
  margin-bottom: 14px;
}
.assignment-hero h3 { font-size: 1.25rem; color: #fff; }
.assignment-hero .meta { color: var(--muted); font-size: 0.84rem; margin-top: 4px; }
.kpi-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.kpi {
  background: rgba(9, 14, 28, 0.55);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 7px 11px;
  min-width: 92px;
}
.kpi b { display: block; font-size: 1rem; }
.kpi small { color: var(--muted-2); font-size: 0.72rem; }
.skill-list { display: flex; flex-wrap: wrap; gap: 7px; }
.skill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 9px 5px 5px;
  border-radius: 999px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  font-size: 0.82rem;
  white-space: nowrap;
}
.skill-icon {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: linear-gradient(160deg, #2c3d6b, #1a2542);
  border: 1px solid var(--line-strong);
  flex: none;
}
.skill-icon svg { width: 15px; height: 15px; }
.skill-icon[data-kind="aura"] { color: var(--violet); background: linear-gradient(160deg, #3b2f63, #241d3e); }
.skill-icon[data-kind="revive"] { color: var(--green); }
.skill-icon[data-kind="insanity"] { color: var(--red); }
.skill-icon[data-kind="heal"] { color: #7ff0c0; }
.skill-icon[data-kind="fire"] { color: #ff9b7a; }
.skill-icon[data-kind="water"] { color: #72c8ff; }
.skill-icon[data-kind="nature"] { color: #8fe3a1; }
.skill-icon[data-kind="ranged"] { color: #9adcff; }
.skill-icon[data-kind="melee"] { color: #ffb0c4; }
.skill-icon[data-kind="shield"] { color: #ffd479; }
.skill small.lv { color: var(--muted-2); }
.skill .slot-index { color: var(--muted-2); font-size: 0.68rem; font-variant-numeric: tabular-nums; }
.skill.empty-slot { background: transparent; border-style: dashed; color: var(--muted-2); padding: 5px 9px; }
.loadout-list { display: grid; gap: 6px; margin-top: 10px; }
.loadout-item {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 9px;
  border-radius: 7px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  font-size: 0.82rem;
}
.loadout-item .slot { color: var(--muted-2); min-width: 44px; }
.loadout-item .plus { color: var(--amber); }

/* Tables */
.table-wrap { overflow-x: auto; border-radius: 10px; border: 1px solid var(--line); }
table.member-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
  min-width: 760px;
}
.member-table th, .member-table td {
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid rgba(38, 51, 81, 0.7);
  vertical-align: middle;
}
.member-table thead th {
  position: sticky;
  top: 0;
  background: #131c33;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.76rem;
  letter-spacing: 0.03em;
  white-space: nowrap;
}
.member-table tbody tr:hover { background: rgba(127, 157, 255, 0.05); }
.member-table tbody tr:last-child td { border-bottom: 0; }
.member-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.member-table .name { font-weight: 700; white-space: nowrap; }
.skill-cell { display: flex; gap: 4px; flex-wrap: wrap; }
.skill-cell .skill-icon { width: 22px; height: 22px; }
.skill-cell .skill { font-size: 0.72rem; padding: 2px 6px 2px 3px; gap: 4px; background: transparent; border-color: transparent; }
.skill-cell .skill:hover { background: var(--panel-2); border-color: var(--line); }
.filter-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
.filter-row input { max-width: 260px; }

/* Boss cards */
.combat-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.combat-grid > *, .life-grid > * { min-width: 0; }
.boss-card { display: flex; flex-direction: column; gap: 12px; }
.boss-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.boss-head h2 { font-size: 1.3rem; }
.boss-sub { color: var(--muted); font-size: 0.82rem; margin-top: 3px; }
.boss-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.metric {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 8px 10px;
}
.metric small { display: block; color: var(--muted-2); font-size: 0.7rem; }
.metric b { font-size: 0.98rem; }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.role-chip { font-variant-numeric: tabular-nums; }
.role-chip b { color: var(--text); }
.aura-line { display: flex; flex-wrap: wrap; gap: 6px; }
.aura-pill {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  border: 1px solid rgba(195, 155, 255, 0.3);
  background: rgba(195, 155, 255, 0.08);
  color: #e0ccff;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 0.76rem;
}

/* Life + stats */
.life-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.life-card h2 { font-size: 1.15rem; }
.roster-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 6px; margin-top: 10px; }
.roster-item {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 9px;
  font-size: 0.8rem;
}
.roster-item .wf { color: var(--teal); font-variant-numeric: tabular-nums; }
.life-summary { display: flex; flex-wrap: wrap; gap: 10px 22px; align-items: center; }
.profession-chart { display: grid; gap: 8px; }
.bar-row { display: grid; grid-template-columns: 34px minmax(0, 1fr) 42px; align-items: center; gap: 10px; font-size: 0.85rem; }
.bar-track { height: 9px; background: var(--bg-soft); border-radius: 999px; overflow: hidden; border: 1px solid var(--line); }
.bar-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, #5b74d6, #8fb0ff); }
.bar-row .count { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.sub-tabs { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 10px; }
.sub-tab {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  border-radius: 7px;
  padding: 5px 9px;
  font-size: 0.78rem;
}
.sub-tab.active { background: var(--accent-soft); color: var(--text); border-color: var(--line-strong); }
.rank-table { width: 100%; border-collapse: collapse; font-size: 0.83rem; }
.rank-table th, .rank-table td { padding: 6px 8px; border-bottom: 1px solid rgba(38, 51, 81, 0.6); text-align: left; }
.rank-table th { color: var(--muted-2); font-size: 0.72rem; font-weight: 600; }
.rank-table td.num { text-align: right; font-variant-numeric: tabular-nums; }

/* Admin */
.admin-login { max-width: 640px; }
.inline-form { display: flex; gap: 8px; margin-top: 14px; }
.inline-form input { flex: 1; }

.token-row { display: flex; gap: 8px; margin-top: 14px; }
.token-row input { flex: 1; min-width: 0; }
.error-text { color: var(--red); font-size: 0.84rem; margin-top: 8px; min-height: 1.2em; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.stat {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
}
.stat small { display: block; color: var(--muted-2); font-size: 0.72rem; }
.stat b { font-size: 0.98rem; }
.stat .sub { color: var(--muted); font-size: 0.76rem; }
.pipeline-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 12px;
  margin-top: 8px;
}
.pipeline-form label { display: grid; gap: 5px; font-size: 0.8rem; color: var(--muted); }
.pipeline-form .wide { grid-column: 1 / -1; }
.form-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.job-progress { margin-top: 16px; border: 1px solid var(--line); border-radius: 11px; padding: 14px; background: var(--bg-soft); }
.job-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.progress-track { height: 8px; background: #0b1122; border-radius: 999px; overflow: hidden; margin: 10px 0 12px; border: 1px solid var(--line); }
.progress-bar { height: 100%; width: 0; background: linear-gradient(90deg, #5fe3c4, #7f9dff); transition: width 400ms ease; }
.job-metrics { color: var(--muted); font-size: 0.8rem; margin: 0 0 10px; }
.job-log-heading { display: flex; justify-content: space-between; gap: 10px; margin-top: 12px; font-size: 0.8rem; }
.phase-list { list-style: none; padding: 0; display: grid; gap: 6px; }
.phase-list li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.84rem;
  padding: 6px 9px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: var(--panel);
}
.phase-list li.running { border-color: var(--accent); color: #dfe7ff; }
.phase-list li.done { border-color: rgba(111, 227, 160, 0.35); color: var(--green); }
.phase-list li.failed { border-color: rgba(255, 123, 134, 0.45); color: var(--red); }
.phase-list li.cancelled { color: var(--muted); }
.phase-list .phase-state { color: var(--muted-2); font-size: 0.74rem; }
.job-log {
  margin: 6px 0 0;
  max-height: 240px;
  overflow: auto;
  background: #070b15;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 10px;
  font-size: 0.72rem;
  line-height: 1.45;
  color: #b7c6e8;
  white-space: pre-wrap;
  word-break: break-word;
}
.job-history { margin-top: 14px; display: grid; gap: 6px; }
.history-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.8rem;
  padding: 7px 10px;
  border-bottom: 1px solid rgba(38, 51, 81, 0.6);
}
.history-row:last-child { border-bottom: 0; }
.diag-role-select {
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  padding: 5px 7px;
  font-size: 0.8rem;
}
.diag-exclude { accent-color: var(--red); width: 16px; height: 16px; }
.role-filters { display: flex; flex-wrap: wrap; gap: 5px; margin: 10px 0 2px; }
.role-filter {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 4px 11px;
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
}
.role-filter:hover { color: var(--text); border-color: var(--line-strong); }
.role-filter b { color: var(--text); font-weight: 600; }
.role-filter.active {
  background: var(--accent-soft);
  color: var(--text);
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(127, 157, 255, 0.14);
}
.member-link {
  border: 0;
  background: transparent;
  color: var(--accent);
  padding: 0;
  font: inherit;
  font-weight: 700;
  text-align: left;
  border-bottom: 1px dashed rgba(127, 157, 255, 0.45);
}
.member-link:hover { color: #b9c9ff; }
.member-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Snapshot dialog */
.modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 20px;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 8, 18, 0.72);
  backdrop-filter: blur(3px);
}
.modal-panel {
  position: relative;
  width: min(1080px, 100%);
  max-height: min(88vh, 900px);
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-2);
}
.modal-head h2 { font-size: 1.2rem; }
.modal-body { padding: 16px 18px 22px; overflow: auto; display: grid; gap: 14px; }
.modal-section {
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 14px;
  background: var(--bg-soft);
}
.modal-section > .subhead:first-child { margin-top: 0; }
.meta-rows { display: grid; gap: 5px; }
.meta-row {
  display: grid;
  grid-template-columns: minmax(140px, 200px) minmax(0, 1fr);
  gap: 10px;
  font-size: 0.82rem;
  padding: 5px 0;
  border-bottom: 1px dashed rgba(38, 51, 81, 0.8);
}
.meta-row:last-child { border-bottom: 0; }
.meta-label { color: var(--muted-2); }
.meta-value { word-break: break-word; }
.ok-text { color: var(--green); }
.bad-text { color: var(--red); }
.warn-text { color: var(--amber); }
.role-chip.dim { opacity: 0.55; }
.loadout-cards { display: grid; gap: 8px; }
.loadout-card {
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel);
  padding: 8px 11px;
}
.loadout-card > summary {
  display: flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  font-size: 0.85rem;
  list-style: none;
}
.loadout-card > summary::-webkit-details-marker { display: none; }
.loadout-card > summary::before { content: "▸"; color: var(--muted-2); }
.loadout-card[open] > summary::before { content: "▾"; }
.loadout-name { font-weight: 700; }
.loadout-card-body { padding: 8px 0 2px; }
.raw-snapshot-wrap { border: 1px solid var(--line); border-radius: 9px; padding: 9px 11px; background: var(--panel); }
.raw-snapshot-wrap > summary { display: flex; justify-content: space-between; gap: 10px; cursor: pointer; font-size: 0.85rem; }
.raw-snapshot { max-height: 380px; }

/* Footer, toast */
.footer {
  width: min(1240px, calc(100% - 28px));
  margin: 0 auto;
  padding: 18px 0 34px;
  border-top: 1px solid var(--line);
  color: var(--muted-2);
  font-size: 0.78rem;
}
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 90;
  background: #162039;
  border: 1px solid var(--line-strong);
  color: var(--text);
  border-radius: 10px;
  padding: 10px 16px;
  box-shadow: var(--shadow);
  font-size: 0.86rem;
  max-width: calc(100% - 32px);
}
.toast.error { border-color: rgba(255, 123, 134, 0.5); color: #ffd6da; }

/* Responsive */
@media (max-width: 1040px) {
  .bar-inner { grid-template-columns: auto 1fr; }
  .login-bar { grid-column: 1 / -1; justify-content: stretch; }
  .combo { max-width: none; }
  .combat-grid, .life-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 820px) {
  .grid.two { grid-template-columns: 1fr; }
  .me-head { flex-direction: column; }
  .badge-row { justify-content: flex-start; }
  .section-head { flex-direction: column; align-items: flex-start; }
  .boss-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 620px) {
  .brand-copy small { display: none; }
  .guild-btn { padding: 8px 10px; font-size: 0.8rem; }
  .topbar { position: static; }
  main { width: calc(100% - 20px); padding-top: 14px; }
  .bar-inner, .tabs, .footer { width: calc(100% - 20px); }
  .card { padding: 15px; border-radius: 12px; }
  .login-bar { flex-wrap: wrap; }
  .combo { flex-basis: 100%; }
  #login-btn { flex: 1; }
  .role-picker { grid-template-columns: repeat(3, 1fr); }
  .pipeline-form { grid-template-columns: 1fr; }
  .boss-metrics { grid-template-columns: 1fr 1fr; }
  .aura-row { grid-template-columns: 1fr 74px; }
  .aura-source { display: none; }
  .roster-list { grid-template-columns: 1fr 1fr; }
  .modal { padding: 0; }
  .modal-panel { max-height: 100vh; height: 100%; border-radius: 0; border: 0; }
  .meta-row { grid-template-columns: 1fr; gap: 2px; }
}
