﻿:root {
  --bg: #0b1323;
  --panel: #0f1f3f;
  --panel-soft: #13284f;
  --line: #2c4c80;
  --text: #e8f0ff;
  --muted: #a5b8db;
  --accent: #42d0ff;
  --legion1: #5ab2ff;
  --legion2: #ffb454;
  --danger: #ff6b6b;
  --scroll-track: rgba(15, 36, 69, 0.82);
  --scroll-thumb: linear-gradient(180deg, #4fc7ff, #2f78d8);
  --scroll-thumb-hover: linear-gradient(180deg, #71d6ff, #4690ed);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Space Grotesk", "Trebuchet MS", "Segoe UI", sans-serif;
  background: radial-gradient(circle at 15% 0%, #1a3d70 0%, var(--bg) 46%),
              radial-gradient(circle at 85% 100%, #3a2222 0%, transparent 48%);
  color: var(--text);
}

.ambient {
  position: fixed;
  inset: 0;
  background-image: linear-gradient(transparent 96%, rgba(255, 255, 255, 0.03) 100%);
  background-size: 100% 26px;
  pointer-events: none;
}

.layout {
  position: relative;
  max-width: 1280px;
  margin: 0 auto;
  padding: 20px;
}

.panel {
  background: linear-gradient(165deg, rgba(22, 47, 92, 0.88), rgba(12, 23, 45, 0.95));
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.35);
  padding: 16px;
}

.hero {
  margin-bottom: 16px;
}

.eyebrow {
  margin: 0;
  color: var(--accent);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 12px;
}

h1 {
  margin: 6px 0 8px;
  font-size: clamp(26px, 3vw, 40px);
}

.subtitle {
  margin: 0;
  color: var(--muted);
}

.status {
  margin-top: 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  padding: 10px 12px;
  font-size: 14px;
  color: #d7e7ff;
  background: rgba(7, 15, 33, 0.5);
}

.status[data-type="error"] {
  border-color: #9f3a3a;
  background: rgba(112, 22, 22, 0.28);
  color: #ffd6d6;
}

.status[data-type="success"] {
  border-color: #2f7f54;
  background: rgba(20, 88, 51, 0.28);
  color: #dcffec;
}

.grid {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 14px;
}

.grid.single-view {
  grid-template-columns: 1fr;
}

.tool-switch {
  margin-bottom: 12px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.tool-switch .btn {
  flex: 1 1 240px;
}

.tool-switch .btn.active {
  border-color: #3c95d1;
  background: linear-gradient(180deg, #33a0e4, #1f6ca5);
}

.gift-add-row {
  align-items: center;
  flex-wrap: nowrap;
}

.gift-add-row input {
  flex: 1 1 auto;
  min-width: 0;
}

.gift-add-row .btn {
  flex: 0 0 auto;
  white-space: nowrap;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.panel-head h2,
.panel-head h3 {
  margin: 0;
}

.event-head {
  flex-wrap: nowrap;
}

.event-head .btn {
  white-space: nowrap;
}

.gift-head {
  flex-wrap: nowrap;
}

.gift-head .btn {
  white-space: nowrap;
}

.registered-head {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  min-width: 0;
}

.registered-title {
  flex: 1 1 auto;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.registered-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  flex-wrap: nowrap;
  justify-content: flex-end;
}

.registered-actions .btn {
  white-space: nowrap;
}

.panel-head.compact {
  align-items: flex-start;
  flex-direction: column;
}

.event-board-meta {
  margin: 10px 0 4px;
}

.meta {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.search-meta {
  margin-top: 4px;
}

.label {
  display: block;
  margin-top: 12px;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 13px;
}

.inline-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.inline-row.right {
  justify-content: flex-end;
  margin-top: 8px;
}

.event-select-row {
  flex-wrap: nowrap;
}

.event-select-row select {
  flex: 1 1 auto;
  min-width: 0;
}

.event-select-row .btn {
  flex: 0 0 auto;
  white-space: nowrap;
}

input,
textarea,
select {
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(6, 14, 30, 0.7);
  color: var(--text);
  padding: 10px 11px;
  font: inherit;
}

textarea {
  resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
  outline: 2px solid rgba(66, 208, 255, 0.28);
}

.btn {
  border: 1px solid #3562a1;
  background: linear-gradient(180deg, #2a4f82, #1d365a);
  color: white;
  border-radius: 10px;
  padding: 9px 12px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 120ms ease, opacity 120ms ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn.primary {
  border-color: #3c95d1;
  background: linear-gradient(180deg, #33a0e4, #1f6ca5);
}

.btn.ghost {
  border-color: #4c6e9c;
  background: transparent;
}

.btn.danger {
  border-color: #a33f49;
  background: linear-gradient(180deg, #ba4754, #7e3038);
}

.btn.sm {
  padding: 7px 10px;
  font-size: 12px;
}

.btn.xs {
  padding: 5px 8px;
  font-size: 11px;
}

.split-line {
  height: 1px;
  margin: 14px 0;
  background: linear-gradient(to right, transparent, #365b95, transparent);
}

.hidden {
  display: none !important;
}

.bulk-progress {
  margin-top: 10px;
  border: 1px solid #355989;
  border-radius: 10px;
  background: rgba(6, 14, 29, 0.76);
  padding: 8px;
}

.bulk-progress-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
}

.bulk-progress-track {
  width: 100%;
  height: 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
  margin-top: 6px;
}

.bulk-progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #35c9ff, #4e9eff);
  transition: width 140ms ease;
}

.bulk-progress-detail {
  margin: 7px 0 0;
  color: #d3e4ff;
  font-size: 12px;
}

.stack {
  display: grid;
  gap: 8px;
}

.gift-code-top-list {
  margin-top: 8px;
  min-height: 44px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.gift-chip {
  appearance: none;
  border: 1px solid rgba(98, 168, 236, 0.65);
  border-radius: 999px;
  padding: 6px 10px;
  background: rgba(10, 23, 43, 0.75);
  color: #dff0ff;
  font-weight: 600;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  font-family: inherit;
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
}

.gift-chip:hover {
  transform: translateY(-1px);
  border-color: rgba(132, 201, 255, 0.82);
  background: rgba(13, 29, 54, 0.9);
}

.gift-chip:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.gift-chip:focus-visible {
  outline: 2px solid rgba(74, 199, 255, 0.5);
  outline-offset: 2px;
}

.gift-apply-code-row {
  align-items: center;
  flex-wrap: nowrap;
}

.gift-apply-code-row select {
  flex: 1 1 auto;
  min-width: 0;
}

.gift-apply-code-row .btn {
  flex: 0 0 auto;
  white-space: nowrap;
}

.gift-target-tools {
  margin-top: 8px;
  align-items: center;
}

.gift-selection-meta {
  margin-left: auto;
}

.gift-apply-actions {
  margin-top: 8px;
  justify-content: flex-end;
}

.gift-targets-list {
  margin-top: 10px;
  max-height: 360px;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 4px;
}

.gift-target-row {
  border: 1px solid #2f4f84;
  border-radius: 12px;
  padding: 8px 10px;
  background: rgba(8, 17, 34, 0.7);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.gift-target-main {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.gift-target-check {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: #42d0ff;
  flex: 0 0 auto;
}

.gift-target-info {
  min-width: 0;
}

.gift-target-title {
  font-weight: 700;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gift-target-meta {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gift-target-last {
  margin-top: 6px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
}

.gift-target-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid #436187;
  background: rgba(11, 24, 44, 0.8);
  color: #d3e5ff;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  flex: 0 0 auto;
}

.gift-target-badge.success {
  border-color: #2f7f54;
  background: rgba(20, 88, 51, 0.32);
  color: #dcffec;
}

.gift-target-badge.error {
  border-color: #9f3a3a;
  background: rgba(112, 22, 22, 0.3);
  color: #ffd6d6;
}

.gift-target-badge.info {
  border-color: #3f6ea8;
  background: rgba(27, 63, 111, 0.34);
  color: #d8ecff;
  margin-top: 6px;
}

.gift-target-last-msg {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gift-target-actions {
  flex: 0 0 auto;
}

.gift-queue-results {
  max-height: 240px;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 4px;
}

.gift-queue-row {
  border: 1px solid #2f4f84;
  border-radius: 12px;
  padding: 8px 10px;
  background: rgba(8, 17, 34, 0.72);
}

.gift-queue-row.success {
  border-color: rgba(53, 143, 92, 0.62);
}

.gift-queue-row.error {
  border-color: rgba(159, 58, 58, 0.62);
}

.gift-queue-row-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.gift-queue-row-title {
  font-weight: 700;
  font-size: 13px;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gift-queue-row-meta {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.gift-code-row-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}

.gift-code-text {
  border: 1px solid rgba(98, 168, 236, 0.65);
  border-radius: 999px;
  padding: 6px 10px;
  background: rgba(10, 23, 43, 0.75);
  color: #dff0ff;
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.02em;
  overflow-wrap: anywhere;
}

.gift-manage-title {
  margin: 0;
  font-size: 16px;
}

.gift-codes-list {
  margin-top: 8px;
  max-height: 280px;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 4px;
}

.gift-code-row {
  border: 1px solid #2f4f84;
  border-radius: 12px;
  padding: 8px 10px;
  background: rgba(8, 17, 34, 0.7);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

#unassignedList,
#legion1List,
#legion2List {
  max-height: 420px;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 4px;
}

.registered-wrap {
  margin-top: 8px;
  max-height: 420px;
  overflow: auto;
  padding-right: 4px;
}

#unassignedList,
#legion1List,
#legion2List,
#giftTargetsList,
.registered-wrap,
.gift-codes-list,
.gift-queue-results,
.modal-dialog {
  scrollbar-width: thin;
  scrollbar-color: #58c8ff var(--scroll-track);
  scrollbar-gutter: stable;
}

#unassignedList::-webkit-scrollbar,
#legion1List::-webkit-scrollbar,
#legion2List::-webkit-scrollbar,
#giftTargetsList::-webkit-scrollbar,
.registered-wrap::-webkit-scrollbar,
.gift-codes-list::-webkit-scrollbar,
.gift-queue-results::-webkit-scrollbar,
.modal-dialog::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

#unassignedList::-webkit-scrollbar-track,
#legion1List::-webkit-scrollbar-track,
#legion2List::-webkit-scrollbar-track,
#giftTargetsList::-webkit-scrollbar-track,
.registered-wrap::-webkit-scrollbar-track,
.gift-codes-list::-webkit-scrollbar-track,
.gift-queue-results::-webkit-scrollbar-track,
.modal-dialog::-webkit-scrollbar-track {
  background: var(--scroll-track);
  border-radius: 999px;
}

#unassignedList::-webkit-scrollbar-thumb,
#legion1List::-webkit-scrollbar-thumb,
#legion2List::-webkit-scrollbar-thumb,
#giftTargetsList::-webkit-scrollbar-thumb,
.registered-wrap::-webkit-scrollbar-thumb,
.gift-codes-list::-webkit-scrollbar-thumb,
.gift-queue-results::-webkit-scrollbar-thumb,
.modal-dialog::-webkit-scrollbar-thumb {
  background: var(--scroll-thumb);
  border-radius: 999px;
  border: 2px solid rgba(7, 18, 36, 0.72);
}

#unassignedList::-webkit-scrollbar-thumb:hover,
#legion1List::-webkit-scrollbar-thumb:hover,
#legion2List::-webkit-scrollbar-thumb:hover,
#giftTargetsList::-webkit-scrollbar-thumb:hover,
.registered-wrap::-webkit-scrollbar-thumb:hover,
.gift-codes-list::-webkit-scrollbar-thumb:hover,
.gift-queue-results::-webkit-scrollbar-thumb:hover,
.modal-dialog::-webkit-scrollbar-thumb:hover {
  background: var(--scroll-thumb-hover);
}

.rank-group {
  border: 1px solid #2c4a7a;
  border-radius: 14px;
  background: rgba(8, 17, 34, 0.58);
  padding: 10px;
}

.rank-group + .rank-group {
  margin-top: 8px;
}

.rank-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.rank-group-tools {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  border-radius: 999px;
  border: 1px solid rgba(235, 189, 81, 0.7);
  background: linear-gradient(180deg, rgba(255, 210, 101, 0.3), rgba(176, 121, 33, 0.35));
  color: #ffe2a4;
  font-size: 12px;
  font-weight: 800;
  padding: 4px 10px;
}

.rank-count {
  border-radius: 999px;
  border: 1px solid rgba(94, 130, 183, 0.7);
  background: rgba(10, 24, 47, 0.72);
  color: #d8e7ff;
  font-size: 12px;
  font-weight: 700;
  padding: 3px 10px;
}

.rank-group-body {
  margin-top: 8px;
}

.rank-toggle {
  width: 28px;
  min-width: 28px;
  height: 24px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.rank-toggle-chevron {
  display: block;
  color: #d8ebff;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  transform: translateY(-1px);
  transition: transform 120ms ease;
}

.rank-toggle[aria-expanded="true"] .rank-toggle-chevron {
  transform: translateY(-1px) rotate(90deg);
}

.user-row {
  border: 1px solid #2f4f84;
  border-radius: 12px;
  padding: 8px 10px;
  background: rgba(8, 17, 34, 0.7);
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  min-width: 0;
}

.user-row-main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.user-row-info {
  min-width: 0;
}

.user-row .name {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-row .meta {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-row-actions {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.rank-select {
  width: auto;
  min-width: 72px;
  border-radius: 8px;
  border: 1px solid #4c6e9c;
  background: rgba(6, 14, 30, 0.88);
  color: var(--text);
  padding: 7px 8px;
  font-size: 13px;
}

.user-row .btn {
  flex: 0 0 auto;
}

.avatar {
  position: relative;
  border-radius: 11px;
  overflow: hidden;
  border: 1px solid rgba(118, 160, 220, 0.65);
  background: linear-gradient(140deg, rgba(35, 73, 130, 0.75), rgba(20, 38, 70, 0.9));
  flex: 0 0 auto;
}

.avatar.md {
  width: 42px;
  height: 42px;
}

.avatar.sm {
  width: 34px;
  height: 34px;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.avatar-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #e8f0ff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.avatar.loaded .avatar-fallback {
  display: none;
}

.board-grid {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.column {
  border: 1px solid #2e4d80;
  background: rgba(7, 15, 31, 0.6);
  border-radius: 14px;
  padding: 10px;
  min-width: 0;
  min-height: 260px;
}

.column.legion1 {
  border-color: rgba(90, 178, 255, 0.6);
}

.column.legion2 {
  border-color: rgba(255, 180, 84, 0.65);
}

.column header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  gap: 8px;
}

.column h4 {
  margin: 0;
}

.column-tools {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.count {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.17);
  border-radius: 999px;
  padding: 2px 9px;
  font-size: 12px;
}

.member-card {
  border: 1px solid rgba(60, 98, 155, 0.72);
  border-radius: 12px;
  padding: 8px;
  background: rgba(13, 27, 51, 0.85);
}

.member-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  min-width: 0;
}

.member-text {
  min-width: 0;
}

.member-card .title {
  margin: 0;
  font-weight: 700;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.member-card .sub {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.member-card .actions {
  margin-top: 8px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.member-card .actions .btn {
  padding: 6px 8px;
  font-size: 12px;
  border-radius: 8px;
}

.empty {
  border: 1px dashed rgba(130, 160, 205, 0.35);
  color: var(--muted);
  padding: 11px;
  border-radius: 10px;
  text-align: center;
  font-size: 13px;
}

body.modal-open {
  overflow: hidden;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 16px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 8, 18, 0.68);
  backdrop-filter: blur(2px);
}

.modal-dialog {
  position: relative;
  width: min(520px, calc(100vw - 24px));
  max-height: calc(100dvh - 28px);
  overflow-y: auto;
  border-color: #2f558c;
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.45);
}

.modal-dialog .panel-head {
  margin-bottom: 8px;
}

.copy-toast {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 70;
  min-width: 180px;
  max-width: min(86vw, 360px);
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid #3f6cae;
  color: #eaf3ff;
  background: rgba(13, 30, 58, 0.92);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.35);
  font-size: 13px;
  font-weight: 600;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity 160ms ease, transform 160ms ease, visibility 160ms ease;
}

.copy-toast.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.copy-toast.success {
  border-color: #2f7f54;
  background: rgba(20, 88, 51, 0.92);
}

.copy-toast.error {
  border-color: #9f3a3a;
  background: rgba(112, 22, 22, 0.92);
}

@media (max-width: 1100px) {
  .grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 840px) {
  .gift-add-row {
    flex-wrap: wrap;
  }

  .gift-add-row .btn {
    width: 100%;
  }

  .gift-apply-code-row {
    flex-wrap: wrap;
  }

  .gift-apply-code-row .btn {
    width: 100%;
  }

  .gift-apply-actions .btn {
    width: 100%;
  }

  .gift-selection-meta {
    width: 100%;
    margin-left: 0;
  }

  .gift-target-row {
    flex-wrap: wrap;
  }

  .gift-target-main {
    flex: 1 1 100%;
  }

  .gift-target-actions {
    width: 100%;
    display: flex;
    justify-content: flex-end;
  }

  .board-grid {
    grid-template-columns: 1fr;
  }

  .column {
    min-height: 220px;
  }

  #unassignedList,
  #legion1List,
  #legion2List {
    max-height: 300px;
  }

  .user-row {
    flex-wrap: wrap;
  }

  .user-row-main {
    flex: 1 1 100%;
  }

  .user-row-actions {
    width: 100%;
    justify-content: flex-end;
  }
}
