:root {
  --bg-deep: #0f1210;
  --bg-panel: #171c18;
  --bg-elevated: #1f2620;
  --bg-input: #121714;
  --border: #2e3a32;
  --border-focus: #c9a227;
  --text: #e8ebe4;
  --text-muted: #8a9688;
  --accent: #d4a017;
  --accent-soft: rgba(212, 160, 23, 0.15);
  --danger: #c45c4a;
  --success: #6b9e5a;
  --sidebar-w: 240px;
  --radius: 10px;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  --font-ui: "Source Sans 3", "Segoe UI", sans-serif;
  --font-display: "Noto Serif SC", "Georgia", serif;
  --scrollbar-size: 7px;
  --scrollbar-track: rgba(18, 23, 20, 0.85);
  --scrollbar-thumb: #3d4f42;
  --scrollbar-thumb-hover: #c9a227;
  --scrollbar-thumb-active: #e0b030;
}

/* IP management uses the existing admin palette and panel controls. */
.ip-page { min-width: 0; padding-bottom: 1rem; }
.ip-page .page-header { margin-bottom: 1rem; gap: 1rem; }
.ip-page .page-header > button { flex-shrink: 0; }
.ip-rule-note { margin: 0 0 1.2rem; padding: .85rem 1rem; color: var(--text-muted); border-left: 3px solid var(--accent); background: var(--bg-panel); font-size: .9rem; }
.ip-page .panel { overflow: hidden; }
.ip-page .ip-filters { display: flex; align-items: end; flex-wrap: wrap; gap: .8rem; padding: 1rem 1.2rem; }
.ip-filters label { display: grid; gap: .3rem; color: var(--text-muted); font-size: .85rem; }
.ip-page input, .ip-page select { min-width: 0; padding: .55rem .7rem; font: inherit; color: var(--text); background: var(--bg-input); border: 1px solid var(--border); border-radius: 6px; }
.ip-page input:focus-visible, .ip-page select:focus-visible, .ip-page button:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 3px; }
.ip-search-label { flex: 1; min-width: 180px; max-width: 400px; }
.ip-table-wrap { max-width: 100%; overflow-x: auto; }
.ip-table { border-collapse: collapse; width: 100%; min-width: 1020px; font-size: .9rem; }
.ip-table th, .ip-table td { text-align: left; padding: 1rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.ip-table th { color: var(--text-muted); font-size: .8rem; background: var(--bg-elevated); font-weight: 600; white-space: nowrap; }
.ip-table th:first-child { min-width: 155px; }
.ip-table th:nth-child(2) { min-width: 180px; }
.ip-table th:nth-child(6) { min-width: 165px; }
.ip-table th:last-child { width: 110px; }
.ip-table tbody tr:hover { background: var(--accent-soft); }
.ip-table button, .ip-badge { white-space: nowrap; }
.ip-account { display: grid; gap: .2rem; min-width: 0; }
.ip-account strong, .ip-account code, .ip-address, .ip-owner { overflow-wrap: anywhere; }
.ip-table code { font: .82rem Consolas, monospace; }
.ip-account code, .ip-muted { color: var(--text-muted); }
.ip-address small, .ip-owner { display: block; margin-top: .4rem; color: var(--text-muted); font-size: .78rem; }
.ip-owner span { display: block; margin-top: .2rem; }
.ip-time { font-size: .8rem; white-space: nowrap; }
.ip-badge { display: inline-block; border: 1px solid var(--border); border-radius: 5px; padding: .18rem .48rem; font-size: .78rem; font-weight: 600; line-height: 1.5; }
.ip-occupied { color: var(--accent); background: var(--accent-soft); }
.ip-direct { color: #a6cf95; background: rgba(107, 158, 90, .12); }
.ip-free { color: var(--text-muted); background: var(--bg-elevated); }
.ip-p2p { color: #a9c8e4; background: rgba(87, 143, 191, .12); }
.ip-pagination { display: flex; flex-wrap: wrap; align-items: center; gap: .65rem; padding: .85rem 1.2rem; color: var(--text-muted); font-size: .85rem; }
.ip-pagination > span:first-child { margin-right: auto; }
.ip-pagination label { display: flex; align-items: center; gap: .4rem; }
.ip-pagination select { padding: .25rem; }
.ip-page button:disabled { cursor: default; opacity: .45; }
@media (max-width: 600px) {
  .ip-page .page-header-row { flex-wrap: wrap; }
  .ip-page .ip-filters { align-items: stretch; }
  .ip-filters label { flex-basis: 100%; max-width: none; }
  .ip-pagination > span:first-child { flex-basis: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .ip-page *, .ip-page *::before, .ip-page *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* Themed scrollbars (WebKit + Firefox) */
.app-shell,
.app-shell * {
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

.app-shell *::-webkit-scrollbar {
  width: var(--scrollbar-size);
  height: var(--scrollbar-size);
}

.app-shell *::-webkit-scrollbar-track {
  background: var(--scrollbar-track);
  border-radius: 999px;
}

.app-shell *::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #4a5f50, var(--scrollbar-thumb));
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, 0.25);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.app-shell *::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, var(--scrollbar-thumb-hover), #a87810);
}

.app-shell *::-webkit-scrollbar-thumb:active {
  background: var(--scrollbar-thumb-active);
}

.app-shell *::-webkit-scrollbar-corner {
  background: var(--scrollbar-track);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  overflow-x: hidden;
  background: var(--bg-deep);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.5;
}

body {
  background:
    radial-gradient(ellipse 80% 50% at 20% -10%, rgba(212, 160, 23, 0.08), transparent),
    radial-gradient(ellipse 60% 40% at 100% 100%, rgba(107, 158, 90, 0.06), transparent),
    var(--bg-deep);
}

.app-shell {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-panel);
  border-right: 1px solid var(--border);
  padding: 1.25rem 0.75rem;
}

.brand {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  padding: 0 0.5rem 1.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1rem;
}

.brand-icon {
  font-size: 1.75rem;
  filter: drop-shadow(0 0 8px rgba(212, 160, 23, 0.4));
}

.brand-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.brand-sub {
  margin: 0.15rem 0 0;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.platform-picker {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin: 0 0 1rem;
  padding: 0 0.85rem;
}

.platform-picker label {
  flex-shrink: 0;
  font-weight: 500;
}

.platform-picker select {
  flex: 1;
  min-width: 0;
  padding: 0.5rem;
  color: var(--text);
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 6px;
  font: inherit;
}

.platform-picker select:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}

.compose-platform {
  color: var(--accent);
  font-weight: 600;
}

.market-platform {
  display: inline-block;
  margin-bottom: 0.2rem;
  padding: 0.05rem 0.4rem;
  color: var(--accent);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 0.75rem;
}

.nav-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  flex: 1;
}

.nav-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.nav-group-title {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.5rem 0.85rem;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  text-transform: uppercase;
}

.nav-group-title .badge {
  margin-left: auto;
}

.nav-chevron {
  margin-left: auto;
  width: 0.45rem;
  height: 0.45rem;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(-45deg);
  opacity: 0.55;
  transition: transform 0.18s ease;
  flex-shrink: 0;
}

.nav-group.expanded .nav-chevron {
  transform: rotate(45deg);
}

.nav-group:not(.nav-group-disabled) .nav-group-title {
  cursor: pointer;
  border-radius: 8px;
  transition: background 0.15s, color 0.15s;
}

.nav-group:not(.nav-group-disabled) .nav-group-title:hover {
  background: var(--bg-elevated);
  color: var(--text);
}

.nav-group:not(.nav-group-disabled) .nav-group-title:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}

.nav-group.expanded:not(.nav-group-disabled) .nav-group-title {
  color: var(--text);
}

.nav-group-disabled .nav-group-title {
  opacity: 0.55;
}

.nav-sublist {
  display: none;
  flex-direction: column;
  gap: 0.2rem;
  padding-left: 0.35rem;
  margin-left: 0.85rem;
  border-left: 1px solid var(--border);
}

.nav-group.expanded .nav-sublist {
  display: flex;
}

.nav-subitem {
  display: block;
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.92rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.nav-subitem:hover {
  background: var(--bg-elevated);
  color: var(--text);
}

.nav-subitem.active {
  background: var(--accent-soft);
  border-color: rgba(212, 160, 23, 0.35);
  color: var(--accent);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  padding: 0.7rem 0.85rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.nav-item:hover:not(.disabled) {
  background: var(--bg-elevated);
  color: var(--text);
}

.nav-item.active {
  background: var(--accent-soft);
  border-color: rgba(212, 160, 23, 0.35);
  color: var(--accent);
}

.nav-item.disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.nav-icon {
  width: 1.25rem;
  text-align: center;
}

.badge {
  margin-left: auto;
  font-size: 0.65rem;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.sidebar-foot {
  padding: 0.75rem 0.5rem 0;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.sidebar-logout {
  align-self: flex-start;
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at top, rgba(224, 176, 48, 0.12), transparent 42%),
    var(--bg);
}

.login-shell {
  width: min(420px, calc(100vw - 2rem));
}

.login-card {
  padding: 1.75rem;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 1.5rem;
}

.login-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.5rem;
}

.login-subtitle {
  margin: 0.2rem 0 0;
  color: var(--text-muted);
  font-size: 0.92rem;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.login-error {
  margin: 0.25rem 0 0.5rem;
  color: var(--danger);
  font-size: 0.9rem;
}

.login-submit {
  width: 100%;
  margin-top: 0.5rem;
}

.status-dot::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 0.4rem;
  background: var(--text-muted);
  vertical-align: middle;
}

.status-dot.online::before {
  background: var(--success);
  box-shadow: 0 0 6px var(--success);
}

.status-dot.offline::before {
  background: var(--danger);
}

/* Main */
.main {
  flex: 1;
  padding: 1.75rem 2rem;
  overflow-x: hidden;
  overflow-y: auto;
  min-width: 0;
}

.main:has(.scroll-page) {
  overflow: hidden;
}

.page-header {
  margin-bottom: 1.5rem;
}

.page-header h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.65rem;
  font-weight: 700;
}

.page-header p {
  margin: 0.35rem 0 0;
  color: var(--text-muted);
}

.page-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.page-header-row h2,
.page-header-row p {
  margin-top: 0;
}

.compose-panel {
  max-width: none;
}

.scroll-page {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 3.5rem);
  max-height: calc(100vh - 3.5rem);
  min-width: 0;
  overflow: hidden;
}

.scroll-page > .page-header {
  flex-shrink: 0;
  margin-bottom: 1rem;
}

.scroll-page > .panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
}

.scroll-page .panel-head {
  flex-shrink: 0;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.scroll-page .panel-head-actions {
  min-width: 0;
  flex-wrap: wrap;
}

.scroll-page .panel-head:has(.rank-tabs) {
  align-items: flex-start;
}

.scroll-page .panel-head:has(.rank-tabs) .panel-head-actions {
  justify-content: flex-end;
  flex: 1;
}

.scroll-page .panel-body {
  flex: 1;
  min-height: 0;
  min-width: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.scroll-page .player-search {
  min-width: 0;
  width: min(240px, 100%);
}

.compose-panel-full {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.compose-form {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.compose-grid {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 400px);
  gap: 0;
  min-height: 0;
  overflow: hidden;
  align-items: stretch;
}

.compose-main {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.5rem;
  min-height: 0;
  overflow: hidden;
  border-right: 1px solid var(--border);
}

.compose-block {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.compose-block label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

.compose-block input[type="text"],
.compose-block textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-input);
  color: var(--text);
  font: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.compose-block input:focus,
.compose-block textarea:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.compose-block-content textarea {
  min-height: 7rem;
  max-height: 10rem;
  height: 7rem;
  resize: none;
}

.compose-attachments {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 1rem 1.15rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-input);
}

.compose-attachments-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-shrink: 0;
  margin-bottom: 0.75rem;
}

.compose-attachments-head h3 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
}

.compose-attachments-hint {
  margin: 0.25rem 0 0;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.compose-attachments-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.attachment-import-label {
  display: block;
  margin-bottom: 0.4rem;
  font-size: 0.88rem;
  font-weight: 600;
}

.attachment-import-input {
  width: 100%;
  min-height: 14rem;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-input);
  color: var(--text);
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.82rem;
  line-height: 1.5;
  resize: vertical;
  box-sizing: border-box;
}

.attachment-import-input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.attachment-import-hint {
  margin: 0.55rem 0 0;
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.attachment-import-error {
  margin: 0.55rem 0 0;
  font-size: 0.82rem;
  color: var(--danger);
}

.modal-panel-wide {
  width: min(720px, calc(100vw - 2rem));
}

.attachment-table {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-panel);
  overflow: hidden;
}

.compose-search {
  width: 100%;
  padding: 0.55rem 0.75rem;
  margin-bottom: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-input);
  color: var(--text);
  font: inherit;
  font-size: 0.88rem;
  flex-shrink: 0;
}

.compose-search:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.compose-search:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.catalog-empty {
  margin: 0.35rem 0 0;
  font-size: 0.78rem;
  color: var(--text-muted);
  text-align: center;
}

.catalog-empty[hidden],
.player-card[hidden],
.attachment-chip[hidden] {
  display: none !important;
}

.attachment-table .attachment-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 4.5rem;
  column-gap: 0.5rem;
  align-items: stretch;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-panel);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
}

.attachment-table .attachment-col {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  min-width: 0;
}

.attachment-table .attachment-col-side {
  justify-content: flex-start;
}

.attachment-label-side-action {
  justify-content: flex-end;
}

.attachment-label-side-action .btn-remove-attachment {
  width: 100%;
}

.attachment-label {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  min-width: 0;
}

.attachment-label-text {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.02em;
  line-height: 1.2;
}

.attachment-label-spacer {
  visibility: hidden;
  user-select: none;
}

.attachment-label-action {
  justify-content: flex-end;
}

.attachment-action-tools {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex-wrap: nowrap;
  width: 100%;
}

.attachment-action-tools .attachment-row-icon {
  flex-shrink: 0;
}

.attachment-action-tools .attachment-row-icon.item-icon-row {
  width: 2.05rem;
  height: 2.05rem;
}

.attachment-table-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0.65rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.compose-side .compose-search {
  flex-shrink: 0;
  margin-bottom: 0.5rem;
}

.attachment-prefab-search {
  position: relative;
}

.attachment-prefab-search .attachment-prefab-input.compose-search {
  margin-bottom: 0;
  min-height: 2.05rem;
  padding-left: 2.1rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238a9688' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cline x1='16.65' y1='16.65' x2='21' y2='21'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 0.65rem center;
  background-size: 0.95rem;
}

.attachment-prefab-search .attachment-prefab-input.compose-search::-webkit-search-cancel-button {
  cursor: pointer;
}

.attachment-prefab-suggest {
  position: absolute;
  z-index: 20;
  top: calc(100% + 0.35rem);
  left: 0;
  right: 0;
  max-height: 14rem;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-panel);
  box-shadow: var(--shadow);
  padding: 0.35rem;
}

.attachment-prefab-suggest[hidden] {
  display: none !important;
}

.attachment-prefab-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  width: 100%;
  padding: 0.45rem 0.55rem;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.86rem;
  text-align: left;
  cursor: pointer;
}

.attachment-prefab-option:hover,
.attachment-prefab-option:focus-visible {
  background: var(--accent-soft);
  outline: none;
}

.attachment-prefab-option-main {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
}

.attachment-prefab-option-name {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-prefab-option-code {
  font-size: 0.74rem;
  color: var(--text-muted);
  font-family: ui-monospace, Consolas, monospace;
}

.attachment-prefab-suggest-empty {
  margin: 0;
  padding: 0.65rem 0.5rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  text-align: center;
}

.attachment-table .attachment-row input[type="text"],
.attachment-table .attachment-row input[type="number"],
.attachment-table .attachment-row input[type="search"],
.attachment-table .attachment-row textarea[name="extra"] {
  width: 100%;
  min-height: 2.05rem;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-input);
  color: var(--text);
  font: inherit;
  font-size: 0.88rem;
  box-sizing: border-box;
}

.attachment-table .attachment-row textarea[name="extra"] {
  display: block;
  resize: none;
  overflow-y: hidden;
  line-height: 1.45;
  max-height: 16rem;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.8rem;
  white-space: pre-wrap;
  word-break: break-word;
}

.attachment-table .attachment-row .attachment-prefab-input.compose-search {
  border-radius: 8px;
}

.attachment-table .attachment-row input[type="text"]:focus,
.attachment-table .attachment-row input[type="number"]:focus,
.attachment-table .attachment-row input[type="search"]:focus,
.attachment-table .attachment-row textarea[name="extra"]:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.attachment-table .attachment-row input.input-error,
.attachment-table .attachment-row textarea.input-error {
  border-color: var(--danger);
  box-shadow: 0 0 0 2px rgba(196, 92, 74, 0.2);
}

.attachment-col-side input[type="number"] {
  text-align: center;
  font-variant-numeric: tabular-nums;
  padding-left: 0.35rem;
  padding-right: 0.35rem;
  -moz-appearance: textfield;
  appearance: textfield;
}

.attachment-col-side input[type="number"]::-webkit-outer-spin-button,
.attachment-col-side input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.attachment-table .attachment-row .btn-convert-extra {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  flex-shrink: 0;
  width: 5rem;
  height: 2.05rem;
  min-height: 2.05rem;
  padding: 0;
  border: 1px solid rgba(212, 160, 23, 0.5);
  border-radius: 6px;
  background: linear-gradient(180deg, rgba(224, 176, 48, 0.22), rgba(212, 160, 23, 0.14));
  color: var(--accent);
  font-weight: 700;
  font-family: ui-monospace, Consolas, monospace;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
  transition: transform 0.1s, background 0.15s, color 0.15s, border-color 0.15s, box-shadow 0.15s;
  appearance: none;
  box-sizing: border-box;
}

.attachment-table .attachment-row .btn-convert-extra .btn-convert-text {
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1.2;
  font-size: 0.88rem;
  letter-spacing: 0.01em;
  text-align: center;
  white-space: nowrap;
}

.attachment-table .attachment-row .btn-convert-extra:hover {
  background: linear-gradient(180deg, #e0b030, var(--accent));
  color: #1a1508;
  border-color: #a87810;
  box-shadow: 0 2px 6px rgba(212, 160, 23, 0.25);
}

.attachment-table .attachment-row .btn-convert-extra:active {
  transform: scale(0.97);
}

.attachment-table .attachment-row .btn-remove-attachment {
  flex-shrink: 0;
  width: 100%;
  min-height: 2.05rem;
  height: auto;
  padding: 0.42rem 0.35rem;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.2;
  border-radius: 6px;
  border-color: rgba(196, 92, 74, 0.35);
  color: var(--danger);
  background: rgba(196, 92, 74, 0.08);
  box-sizing: border-box;
}

.attachment-table .attachment-row .btn-remove-attachment:hover {
  background: rgba(196, 92, 74, 0.16);
  border-color: var(--danger);
  color: var(--danger);
}

.attachment-table .attachment-row .btn-convert-icon {
  font-size: 0.82rem;
  letter-spacing: -0.04em;
}

.attachment-empty {
  margin: 0;
  padding: 2rem 1rem;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.attachment-empty[hidden] {
  display: none;
}

.attachment-catalog,
.attachment-quick-picks {
  flex-shrink: 0;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.attachment-catalog > label,
.attachment-quick-label {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.attachment-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  max-height: 5.5rem;
  overflow-y: auto;
}

.attachment-chip {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.65rem 0.35rem 0.4rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-panel);
  color: var(--text);
  font: inherit;
  font-size: 0.78rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.attachment-chip-body {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.1rem;
  min-width: 0;
}

.attachment-chip-name {
  font-weight: 600;
  line-height: 1.2;
}

.item-icon {
  display: inline-block;
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  overflow: hidden;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background-color: rgba(0, 0, 0, 0.22);
  background-repeat: no-repeat;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.item-icon-row {
  width: 40px;
  height: 40px;
}

.item-icon-chip {
  width: 28px;
  height: 28px;
}

.item-icon-option {
  width: 24px;
  height: 24px;
  border-radius: 4px;
}

.item-icon-fallback {
  background-image:
    linear-gradient(135deg, rgba(255, 255, 255, 0.06) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.06) 50%, rgba(255, 255, 255, 0.06) 75%, transparent 75%, transparent);
  background-size: 8px 8px;
}

.chip-prefab {
  font-size: 0.68rem;
  color: var(--text-muted);
  font-family: ui-monospace, Consolas, monospace;
}

.attachment-extra {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.72rem;
  color: var(--text-muted);
  font-family: ui-monospace, Consolas, monospace;
  word-break: break-all;
}

.attachment-chip:hover {
  background: var(--accent-soft);
  border-color: rgba(212, 160, 23, 0.35);
  color: var(--accent);
}

.compose-block-grow {
  flex: 1;
  min-height: 12rem;
}

.compose-block-grow textarea {
  flex: 1;
  min-height: 12rem;
  resize: vertical;
}

.compose-side {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  height: 100%;
  padding: 1.5rem;
  background: var(--bg-elevated);
  overflow: hidden;
}

.compose-side-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
  flex-shrink: 0;
}

.compose-side-head h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.compose-all-toggle {
  margin: 0;
  font-size: 0.88rem;
}

.compose-recipient-modes {
  margin: 0 0 0.75rem;
  padding: 0;
  border: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  flex-shrink: 0;
}

.recipient-mode-option {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  cursor: pointer;
}

.recipient-mode-option:has(input:checked) {
  border-color: rgba(107, 158, 90, 0.55);
  background: rgba(107, 158, 90, 0.08);
}

.recipient-mode-option input {
  margin-top: 0.15rem;
  flex-shrink: 0;
}

.recipient-mode-body {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.recipient-mode-body strong {
  font-size: 0.88rem;
  font-weight: 600;
}

.recipient-mode-body small {
  font-size: 0.76rem;
  color: var(--text-muted);
  line-height: 1.35;
}

.compose-player-grid-disabled {
  opacity: 0.45;
  pointer-events: none;
}

.compose-expires-block {
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.compose-expires-block > label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.88rem;
  font-weight: 600;
}

.compose-expires-block .compose-schedule-input {
  width: 100%;
}

.compose-side-hint {
  margin: 0 0 0.5rem;
  flex-shrink: 0;
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.compose-side .compose-search {
  flex-shrink: 0;
  margin-bottom: 0.5rem;
}

.compose-player-grid {
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: auto;
  gap: 0.65rem;
  align-content: start;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-input);
}

.player-card {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  min-height: 4.5rem;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-input);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.player-card:hover {
  border-color: rgba(212, 160, 23, 0.35);
  background: var(--bg-panel);
}

.player-card:has(input:checked) {
  border-color: rgba(212, 160, 23, 0.5);
  background: var(--accent-soft);
}

.player-card input {
  margin-top: 0.2rem;
  accent-color: var(--accent);
}

.player-card-body {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.player-card-body strong {
  font-size: 0.92rem;
}

.compose-player-grid.disabled {
  opacity: 0.45;
  pointer-events: none;
}

.compose-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  background: var(--bg-panel);
  flex-shrink: 0;
}

.compose-footer-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.compose-schedule-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.compose-schedule-label {
  font-size: 0.82rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.compose-schedule-input {
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-input);
  color: var(--text);
  font: inherit;
  font-size: 0.85rem;
}

.compose-schedule-input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

@media (max-width: 960px) {
  .compose-grid {
    grid-template-columns: 1fr;
  }

  .compose-main {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .compose-side {
    min-height: 0;
    max-height: none;
  }

  .compose-player-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  }
}

.layout-split {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 1.25rem;
  align-items: start;
}

@media (max-width: 960px) {
  .layout-split {
    grid-template-columns: 1fr;
  }
}

.panel {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

.panel-head h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.panel-head-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.player-search {
  min-width: 240px;
}

.player-table-wrap {
  overflow-x: hidden;
  max-width: 100%;
}

.player-table {
  width: 100%;
  max-width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.player-table th:nth-child(1),
.player-table td:nth-child(1) {
  width: 22%;
}

.player-table th:nth-child(2),
.player-table td:nth-child(2) {
  width: 28%;
}

.player-table th:nth-child(3),
.player-table td:nth-child(3),
.player-table th:nth-child(4),
.player-table td:nth-child(4) {
  width: 14%;
  font-variant-numeric: tabular-nums;
}

.player-table th,
.player-table td {
  padding: 0.75rem 0.85rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  overflow-wrap: anywhere;
  word-break: break-word;
  max-width: 0;
}

.player-table th {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--bg-panel);
}

.player-table tbody tr:hover {
  background: var(--bg-elevated);
}

.player-table code {
  font-size: 0.95rem;
  color: var(--text-muted);
  word-break: break-all;
}

.player-table-actions {
  width: 220px;
  max-width: none;
  text-align: right;
  white-space: nowrap;
  overflow-wrap: normal;
  word-break: normal;
}

.player-management-wrap { overflow-x: auto; }
.player-management-table { min-width: 950px; }
.player-management-table th:nth-child(1), .player-management-table td:nth-child(1) { width: 16%; }
.player-management-table th:nth-child(2), .player-management-table td:nth-child(2) { width: 19%; }
.player-management-table th:nth-child(3), .player-management-table td:nth-child(3),
.player-management-table th:nth-child(4), .player-management-table td:nth-child(4) { width: 12%; }
.player-management-table th:nth-child(5), .player-management-table td:nth-child(5) { width: 15%; font-variant-numeric: tabular-nums; }
.player-management-table .player-table-actions { width: 260px; }
.recharge-records-list { display: grid; gap: 12px; }
.recharge-record { padding: 12px; border: 1px solid var(--border); border-radius: 8px; }
.recharge-record > div, .recharge-records-pages { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.recharge-record p, .recharge-record small { color: var(--text-muted); font-size: .85rem; }
.recharge-record small { display: block; margin-top: 6px; }
.recharge-record code { overflow-wrap: anywhere; }
.recharge-records-pages { margin-top: 16px; }

.limited-table {
  min-width: 0;
  table-layout: fixed;
}

.limited-table th,
.limited-table td {
  max-width: none;
  padding-right: 0.5rem;
  padding-left: 0.5rem;
  vertical-align: middle;
}

.limited-table th:nth-child(1),
.limited-table td:nth-child(1) {
  width: 13%;
}

.limited-table th:nth-child(2),
.limited-table td:nth-child(2) {
  width: 12%;
}

.limited-table th:nth-child(3),
.limited-table td:nth-child(3) {
  width: 6%;
}

.limited-table th:nth-child(4),
.limited-table td:nth-child(4) {
  width: 7%;
}

.limited-table th:nth-child(5),
.limited-table td:nth-child(5) {
  width: 9%;
}

.limited-table th:nth-child(6),
.limited-table td:nth-child(6) {
  width: 9%;
}

.limited-table th:nth-child(7),
.limited-table td:nth-child(7) {
  width: 6%;
  text-align: center;
}

.limited-table th:nth-child(8),
.limited-table td:nth-child(8) {
  width: 6%;
  text-align: center;
}

.limited-table th:nth-child(9),
.limited-table td:nth-child(9) {
  width: 18%;
}

.limited-table th:nth-child(10),
.limited-table td:nth-child(10) {
  width: 14%;
}

.limited-table .player-table-actions {
  white-space: normal;
}

.limited-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.limited-actions .btn {
  white-space: nowrap;
}

.limited-product-state {
  margin-top: 0.35rem;
  font-size: 0.72rem;
}

.limited-page .player-table-wrap {
  overflow-x: hidden;
}

.limited-product-name {
  display: block;
  overflow: hidden;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.limited-product-prefab {
  display: block;
  max-width: 100%;
  padding: 0.16rem 0.42rem;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.025);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.limited-number {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.limited-data-preview {
  display: block;
  padding: 0.4rem 0.55rem;
  width: 100%;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--bg-input);
  color: var(--text);
  font: 0.78rem/1.45 ui-monospace, Consolas, monospace;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  overflow-wrap: normal;
  word-break: normal;
}

.limited-header-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.modal-panel.limited-product-modal-panel {
  width: min(760px, calc(100vw - 2rem));
  max-height: min(92vh, 820px);
}

.limited-product-form {
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.limited-product-form .modal-body {
  display: grid;
  gap: 1rem;
}

.lucky-raffle-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.lucky-raffle-table { min-width: 640px; }
.lucky-raffle-table th, .lucky-raffle-table td { width: auto !important; }
.lucky-raffle-table small { display: block; margin-top: 4px; color: var(--text-muted, #8b93a7); }
.lucky-raffle-table tr[data-period-id] { cursor: pointer; }
.raffle-section-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.raffle-section-head h3, .raffle-section-head h4 { margin: 0; }
.raffle-section-head h3 .market-status { margin-left: 8px; vertical-align: middle; }
.raffle-section-head [data-action="back"] { margin-bottom: 10px; }
.raffle-period-meta { display: flex; flex-wrap: wrap; gap: 10px 24px; margin-bottom: 20px; color: var(--text-muted); font-size: 0.85rem; }
.raffle-entries-head { margin-top: 28px; }
.raffle-muted { color: var(--text-muted); font-size: 0.82rem; }
#raffle-draft-prizes .lucky-raffle-table { min-width: 0; }
#raffle-modal .modal-panel, #raffle-period-modal .modal-panel { width: min(720px, calc(100vw - 2.5rem)); }
#raffle-modal .modal-header, #raffle-modal .modal-footer,
#raffle-period-modal .modal-header, #raffle-period-modal .modal-footer { flex-shrink: 0; }
#raffle-draw-date { width: 100%; padding: 0.65rem 0.85rem; border: 1px solid var(--border); border-radius: 8px; background: var(--bg-input); color: var(--text); font: inherit; color-scheme: dark; }
#raffle-form .form-group { margin-bottom: 0; }
#raffle-form :disabled { opacity: 0.7; cursor: default; }
#raffle-form textarea {
  resize: none;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  min-height: 0;
}
#raffle-description { height: 96px; }
#raffle-extra { height: 180px; }

.limited-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem 1rem;
}

.limited-template-field {
  margin: 0;
  min-width: 0;
}

.limited-template-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.65rem;
}

.limited-template-controls select {
  min-width: 0;
}

.limited-template-controls .btn {
  white-space: nowrap;
}

.limited-form-grid .form-group {
  margin: 0;
}

.limited-product-form select {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-input);
  color: var(--text);
  font: inherit;
}

.limited-product-form input:focus,
.limited-product-form select:focus {
  outline: 2px solid var(--border-focus);
  outline-offset: 1px;
}

.limited-product-form input[readonly] {
  color: var(--text-muted);
  background: rgba(18, 23, 20, 0.72);
  cursor: default;
}

.limited-data-field {
  margin: 0;
}

.limited-data-field input {
  font: 0.82rem/1.5 ui-monospace, Consolas, monospace;
}

.limited-data-help {
  margin: 0.45rem 0 0;
  color: var(--text-muted);
  font-size: 0.78rem;
}

.limited-product-form .field-hint {
  margin: 0.4rem 0 0;
  color: var(--text-muted);
  font-size: 0.76rem;
  line-height: 1.45;
}

@media (max-width: 720px) {
  .limited-form-grid {
    grid-template-columns: 1fr;
  }
}

.shop-data-summary {
  flex-shrink: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(90deg, rgba(212, 160, 23, 0.07), transparent 32%), var(--bg-panel);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.shop-data-summary-three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.shop-data-metric {
  position: relative;
  display: grid;
  grid-template-columns: auto auto 1fr;
  align-items: baseline;
  gap: 0.35rem;
  min-width: 0;
  padding: 0.75rem 1rem;
  border-right: 1px solid var(--border);
}

.shop-data-metric:last-child {
  border-right: 0;
}

.shop-data-metric::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 2px;
  background: rgba(212, 160, 23, 0.5);
}

.shop-data-metric span {
  grid-column: 1 / -1;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.shop-data-metric strong {
  color: var(--accent);
  font-family: var(--font-display);
  font-size: 1.35rem;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.shop-data-metric small {
  color: var(--text-muted);
  font-size: 0.75rem;
}

.shop-record-table-wrap {
  overflow-x: auto;
}

.shop-record-table {
  min-width: 1080px;
}

.shop-record-table th,
.shop-record-table td {
  max-width: none;
  vertical-align: middle;
}

.shop-record-table th:nth-child(1),
.shop-record-table td:nth-child(1) { width: 25%; }
.shop-record-table th:nth-child(2),
.shop-record-table td:nth-child(2) { width: 17%; }
.shop-record-table th:nth-child(3),
.shop-record-table td:nth-child(3) { width: 9%; text-align: center; }
.shop-record-table th:nth-child(4),
.shop-record-table td:nth-child(4) { width: 13%; }
.shop-record-table th:nth-child(5),
.shop-record-table td:nth-child(5) { width: 13%; }
.shop-record-table th:nth-child(6),
.shop-record-table td:nth-child(6) { width: 23%; }

.shop-record-product {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
}

.shop-record-product strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shop-record-product > code {
  flex-shrink: 0;
  padding: 0.12rem 0.38rem;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--bg-input);
}

.player-table .shop-record-id {
  display: block;
  margin-top: 0.3rem;
  overflow: hidden;
  color: var(--text-muted);
  font-size: 0.72rem;
  text-overflow: ellipsis;
  white-space: nowrap;
  word-break: normal;
}

.shop-record-count {
  color: var(--accent);
  font-size: 1.05rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.private-shard-badge {
  display: inline-flex;
  align-items: center;
  min-width: 4.8rem;
  padding: 0.2rem 0.55rem;
  border: 1px solid rgba(212, 160, 23, 0.4);
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.private-world-browser {
  display: grid;
  grid-template-columns: minmax(240px, 300px) minmax(0, 1fr);
  padding: 0;
  overflow: hidden !important;
}

.private-world-master {
  min-width: 0;
  overflow-y: auto;
  border-right: 1px solid var(--border);
}

.private-world-option-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.55rem;
}

.private-world-option {
  width: 100%;
  min-width: 0;
  padding: 0.75rem;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.private-world-option:hover {
  background: var(--bg-elevated);
}

.private-world-option.active {
  border-color: rgba(212, 160, 23, 0.38);
  background: var(--accent-soft);
  box-shadow: inset 3px 0 0 var(--accent);
}

.private-world-option:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 1px;
}

.private-world-option-main,
.private-world-option-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  min-width: 0;
}

.private-world-option-main strong,
.private-world-option-meta code {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.private-world-option-main strong {
  text-align: right;
}

.private-world-option-meta {
  margin-top: 0.55rem;
  color: var(--text-muted);
  font-size: 0.74rem;
}

.private-world-detail {
  min-width: 0;
  padding: 1.1rem 1.25rem 1.25rem;
  overflow-y: auto;
}

.private-world-detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.private-world-detail-head > div {
  min-width: 0;
}

.private-world-detail-head h4 {
  margin: 0.55rem 0 0;
  font-size: 1.15rem;
}

.private-world-member-count {
  flex-shrink: 0;
  color: var(--text-muted);
  font-size: 0.82rem;
}

.private-world-detail-meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem 1rem;
  margin: 1rem 0 1.25rem;
}

.private-world-detail-meta div {
  min-width: 0;
}

.private-world-detail-meta dt {
  margin-bottom: 0.3rem;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 600;
}

.private-world-detail-meta dd {
  margin: 0;
  overflow: hidden;
  font-size: 0.88rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.private-world-members h4 {
  margin: 0 0 0.65rem;
  font-size: 0.86rem;
}

.private-member-detail-table th:nth-child(1),
.private-member-detail-table td:nth-child(1) { width: 28%; }
.private-member-detail-table th:nth-child(2),
.private-member-detail-table td:nth-child(2) { width: 42%; }
.private-member-detail-table th:nth-child(3),
.private-member-detail-table td:nth-child(3) { width: 30%; }

.private-world-member-empty {
  padding: 2.5rem 1rem;
  border: 1px dashed var(--border);
  border-radius: 8px;
}

@media (max-width: 760px) {
  .shop-data-summary,
  .shop-data-summary-three {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .shop-data-metric:nth-child(2n) {
    border-right: 0;
  }

  .shop-data-metric:nth-child(n + 3) {
    border-top: 1px solid var(--border);
  }

  .private-world-browser {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(150px, 34vh) minmax(0, 1fr);
  }

  .private-world-master {
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .private-world-detail-meta {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.market-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.market-table {
  min-width: 1120px;
}

.market-table-wrap,
.warehouse-table-wrap {
  overflow-x: auto;
}

.market-table th:nth-child(1),
.market-table td:nth-child(1) { width: 22%; }
.market-table th:nth-child(2),
.market-table td:nth-child(2),
.market-table th:nth-child(3),
.market-table td:nth-child(3) { width: 15%; }
.market-table th:nth-child(4),
.market-table td:nth-child(4) { width: 13%; }
.market-table th:nth-child(5),
.market-table td:nth-child(5) { width: 10%; }
.market-table th:nth-child(6),
.market-table td:nth-child(6) { width: 15%; }
.market-table th:nth-child(7),
.market-table td:nth-child(7) { width: 10%; }

.market-status {
  display: inline-flex;
  padding: 0.18rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
}

.market-status-active {
  color: var(--success);
  background: rgba(107, 158, 90, 0.12);
}

.market-status-sold {
  color: var(--accent);
  background: var(--accent-soft);
}

.market-status-cancelled {
  color: var(--text-muted);
  background: var(--bg-elevated);
}

.warehouse-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 0.8rem;
  margin-bottom: 1rem;
}

.warehouse-card {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.25rem 0.75rem;
  padding: 0.9rem 1rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-panel);
  color: var(--text);
  text-align: left;
  font: inherit;
  cursor: pointer;
  overflow: hidden;
}

.warehouse-card:hover,
.warehouse-card.active {
  border-color: var(--border-focus);
  background: var(--bg-elevated);
}

.warehouse-card span:first-child {
  display: flex;
  flex-direction: column;
}

.warehouse-card small {
  color: var(--text-muted);
}

.warehouse-usage {
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.warehouse-progress {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 4px;
  background: var(--bg-input);
}

.warehouse-progress i {
  display: block;
  height: 100%;
  background: var(--accent);
}

.warehouse-table th:nth-child(1),
.warehouse-table td:nth-child(1) { width: 30%; }
.warehouse-table th:nth-child(2),
.warehouse-table td:nth-child(2) { width: 20%; }
.warehouse-table th:nth-child(3),
.warehouse-table td:nth-child(3) { width: 10%; }
.warehouse-table th:nth-child(4),
.warehouse-table td:nth-child(4) { width: 22%; }
.warehouse-table th:nth-child(5),
.warehouse-table td:nth-child(5) { width: 18%; }

@media (max-width: 960px) {
  .panel-head {
    align-items: flex-start;
    gap: 0.8rem;
  }

  .panel-head-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .market-table {
    min-width: 980px;
  }
}

.player-count {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}

.rank-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.rank-tab {
  padding: 0.32rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.rank-tab:hover {
  color: var(--text);
  background: var(--bg-elevated);
}

.rank-tab.active {
  background: var(--accent-soft);
  border-color: rgba(212, 160, 23, 0.45);
  color: var(--accent);
}

.rank-tab:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}

.rank-table-wrap {
  overflow-x: auto;
}

.rank-table {
  min-width: 760px;
}

.rank-table th,
.rank-table td {
  max-width: none;
}

.rank-table th:nth-child(1),
.rank-table td:nth-child(1) {
  width: 4.2rem;
}

.rank-table th:nth-child(2),
.rank-table td:nth-child(2),
.rank-table th:nth-child(3),
.rank-table td:nth-child(3) {
  width: auto;
}

.rank-table .rank-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.rank-table th.rank-sortable {
  cursor: pointer;
  user-select: none;
}

.rank-table th.rank-sortable:hover {
  color: var(--text);
}

.rank-table th.rank-sortable.is-active {
  color: var(--accent);
}

.rank-table th.rank-sortable.is-active[data-order="desc"]::after {
  content: " ↓";
  font-weight: 700;
}

.rank-table th.rank-sortable.is-active[data-order="asc"]::after {
  content: " ↑";
  font-weight: 700;
}

/* 排行榜奖励：独立页面，沿用后台面板的内部滚动。 */
.rank-reward-body .rank-tab {
  font-size: 0.9rem;
}

.rank-reward-note {
  margin: 0 0 0.85rem;
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.6;
}

.rank-reward-schedules {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin: 1rem 0 1.25rem;
}

.rank-reward-schedule {
  min-width: 0;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
}

.rank-reward-schedule h4,
.rank-reward-section-head h4 {
  margin: 0;
  font-size: 1rem;
}

.rank-reward-schedule h4 span {
  display: block;
  margin-top: 0.35rem;
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 400;
}

.rank-reward-schedule dl {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.6rem 0.85rem;
  margin: 1rem 0 0;
  font-size: 0.9rem;
}

.rank-reward-schedule dt { color: var(--text-muted); }
.rank-reward-schedule dd { margin: 0; overflow-wrap: anywhere; }

.rank-reward-section-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.rank-reward-table-wrap { overflow-x: auto; }
.rank-reward-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.rank-reward-table th,
.rank-reward-table td {
  padding: 0.6rem 0.8rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
}
.rank-reward-table thead { color: var(--text-muted); }
.rank-reward-table tbody tr:hover { background: var(--bg-elevated); }
.rank-reward-items-table { table-layout: fixed; }
.rank-reward-items-table th:first-child { width: 8.5rem; }
.rank-reward-items-table tbody th { font-weight: 500; }
.rank-reward-items { display: flex; flex-wrap: wrap; gap: 0.55rem 1.5rem; }
.rank-reward-item { display: flex; flex-direction: column; gap: 0.2rem; min-width: 0; overflow-wrap: anywhere; }
.rank-reward-item strong { color: var(--accent); font-variant-numeric: tabular-nums; }
.rank-reward-item code { color: var(--text-muted); font-size: 0.78rem; }
.rank-reward-runs-table { min-width: 730px; font-variant-numeric: tabular-nums; }
.rank-reward-history-title { margin: 1.75rem 0 0.75rem; font-size: 1rem; }
.rank-reward-updated { margin: 1rem 0 0; }

@media (max-width: 900px) {
  .rank-reward-schedules { grid-template-columns: 1fr; }
}

.rank-pos {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
}

.rank-pos.rank-gold {
  color: #e0b030;
}

.rank-pos.rank-silver {
  color: #c5cdd4;
}

.rank-pos.rank-bronze {
  color: #c4844a;
}

.btn-sm {
  padding: 0.35rem 0.7rem;
  font-size: 0.82rem;
}

.player-form .form-group:last-child {
  margin-bottom: 0;
}

.player-page-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.player-currency-adjust { display: grid; grid-template-columns: 100px minmax(0, 1fr); gap: 0.65rem; }
.player-balance { margin-left: 0.65rem; font-weight: 400; }
.player-adjust-hint { color: var(--text-muted); font-size: 0.82rem; line-height: 1.65; margin: 0 0 1rem; }
.player-form-error { color: var(--danger, #df6c6c); font-size: 0.85rem; margin: 0; }

.panel-body {
  padding: 1.25rem;
}

/* Form */
.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.4rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="number"],
.player-form .form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-input);
  color: var(--text);
  font: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.form-group input[type="number"] {
  appearance: textfield;
  -moz-appearance: textfield;
}

.form-group input[type="number"]::-webkit-outer-spin-button,
.form-group input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.form-group input:focus,
.player-form .form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.form-group textarea {
  min-height: 120px;
  resize: vertical;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  cursor: pointer;
  user-select: none;
}

.checkbox-row input {
  width: 1rem;
  height: 1rem;
  accent-color: var(--accent);
}

.player-picker {
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-input);
  padding: 0.5rem;
}

.player-picker.disabled {
  opacity: 0.45;
  pointer-events: none;
}

.player-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.5rem;
  border-radius: 6px;
  cursor: pointer;
}

.player-option:hover {
  background: var(--bg-elevated);
}

.player-option input {
  accent-color: var(--accent);
}

.player-meta {
  font-size: 0.95rem;
  color: var(--text-muted);
  word-break: break-all;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.6rem 1.1rem;
  border: 1px solid transparent;
  border-radius: 8px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.1s, background 0.15s, border-color 0.15s;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: linear-gradient(180deg, #e0b030, var(--accent));
  color: #1a1508;
  border-color: #a87810;
}

.btn-primary:hover {
  filter: brightness(1.05);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  filter: none;
}

.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text-muted);
}

.btn-ghost:hover {
  background: var(--bg-elevated);
  color: var(--text);
}

.btn-danger {
  background: transparent;
  border-color: rgba(196, 92, 74, 0.5);
  color: var(--danger);
  padding: 0.35rem 0.65rem;
  font-size: 0.8rem;
}

.btn-danger:hover {
  background: rgba(196, 92, 74, 0.12);
}

.form-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

/* Mail list */
.mail-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-width: 100%;
}

.mail-item {
  border-bottom: 1px solid var(--border);
  transition: background 0.12s;
}

.mail-item:last-child {
  border-bottom: none;
}

.mail-source-filter {
  background: var(--bg-input);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px;
  font: inherit;
  cursor: pointer;
}

.mail-source-filter:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}

.mail-item.expanded {
  background: var(--bg-elevated);
}

.scroll-page .panel-body.mail-list-has-expanded {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.scroll-page .panel-body.mail-list-has-expanded > .mail-list {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.mail-list:has(.mail-item.expanded) > .mail-item:not(.expanded) {
  display: none;
}

.mail-item.expanded {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-bottom: none;
}

.mail-item.expanded .mail-item-head {
  flex-shrink: 0;
}

.mail-item.expanded .mail-detail-wrap {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.mail-item.expanded .mail-item-detail {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-bottom: 1rem;
  scroll-padding-bottom: 1rem;
}

.mail-item.expanded .mail-detail-meta {
  flex-shrink: 0;
}

.mail-item.expanded .mail-detail-section--attachments {
  flex-shrink: 0;
}

.mail-item.expanded .mail-detail-section--attachments .attachment-list,
.mail-item.expanded .mail-detail-section--attachments .empty-inline {
  overflow: visible;
}

.mail-item.expanded .mail-detail-section--claims {
  flex-shrink: 0;
  margin-bottom: 0;
}

.mail-item.expanded .mail-detail-section--claims .claim-details {
  overflow: visible;
  margin-top: 0.5rem;
}

.mail-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  min-width: 0;
  max-width: 100%;
}

.mail-item-select {
  margin: 0;
  flex-shrink: 0;
}

.mail-item-select input {
  width: 1rem;
  height: 1rem;
  accent-color: var(--accent);
}

.mail-item-selected .mail-item-head {
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}

.mail-batch-select-all {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.mail-batch-select-all input {
  width: 1rem;
  height: 1rem;
  accent-color: var(--accent);
}

#btn-batch-delete-trash:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.mail-item-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.45rem;
  flex-shrink: 0;
}

.mail-uuid {
  font-size: 0.78rem;
  font-family: ui-monospace, Consolas, monospace;
  color: var(--text-muted);
  word-break: break-all;
}

.mail-content-preview {
  margin: 0;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-input);
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.9rem;
  line-height: 1.55;
}

.confirm-delete-text {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.6;
}

.mail-item-toggle {
  flex: 1;
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  min-width: 0;
  padding: 0;
  border: none;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.mail-item-toggle:hover .mail-title {
  color: var(--accent);
}

.mail-expand-icon {
  flex-shrink: 0;
  width: 1.25rem;
  height: 1.25rem;
  margin-top: 0.1rem;
  border-radius: 6px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  position: relative;
  transition: transform 0.15s, background 0.15s;
}

.mail-expand-icon::before {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 0.35rem;
  height: 0.35rem;
  border-right: 2px solid var(--text-muted);
  border-bottom: 2px solid var(--text-muted);
  transform: rotate(-45deg) translate(-1px, -1px);
}

.mail-item.expanded .mail-expand-icon {
  transform: rotate(90deg);
}

.mail-summary {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
}

.mail-title {
  margin: 0;
  font-weight: 600;
  font-size: 0.95rem;
  transition: color 0.15s;
}

.mail-meta {
  margin-top: 0.35rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.mail-recipients {
  margin-top: 0.5rem;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.mail-detail-wrap[hidden] {
  display: none;
}

.mail-item-detail {
  padding: 0 1.25rem 1.25rem 3.15rem;
  max-width: 100%;
  overflow-x: hidden;
}

.mail-detail-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.75rem 1rem;
  margin: 0 0 1rem;
}

.mail-detail-meta div {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.mail-detail-meta dt {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.mail-detail-meta dd {
  margin: 0;
  font-size: 0.88rem;
}

.mail-detail-section {
  margin-top: 1rem;
}

.mail-detail-section h5 {
  margin: 0 0 0.5rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
}

.claim-details .claim-player {
  display: flex;
  flex-direction: row;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.45rem;
  flex: 1;
  min-width: 0;
}

.claim-details .claim-player-name {
  font-weight: 600;
  color: var(--text);
}

.claim-details .claim-player-id {
  font-size: 0.78rem;
  color: var(--text-muted);
  word-break: break-all;
}

.claim-details .claim-status-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.65rem;
}

.claim-details .empty-inline {
  justify-content: center;
  color: var(--text-muted);
}

.tag {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid rgba(212, 160, 23, 0.3);
}

.tag-all {
  background: rgba(107, 158, 90, 0.15);
  color: var(--success);
  border-color: rgba(107, 158, 90, 0.35);
}

.empty-state {
  padding: 2.5rem 1.5rem;
  text-align: center;
  color: var(--text-muted);
}

.empty-state p {
  margin: 0.5rem 0 0;
  font-size: 0.9rem;
}

.claim-details {
  list-style: none;
  margin: 0.65rem 0 0;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-input);
  font-size: 0.82rem;
}

.claim-details li {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.65rem;
  padding: 0.25rem 0;
}

.list-row-index {
  flex-shrink: 0;
  width: 1.6rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.4;
  font-variant-numeric: tabular-nums;
}

.claim-details .claim-status {
  margin-left: auto;
  flex-shrink: 0;
}

.claim-status.claimed {
  color: var(--success);
}

.claim-status.pending {
  color: var(--accent);
}

.tag-claimed {
  background: rgba(107, 158, 90, 0.15);
  color: var(--success);
  border-color: rgba(107, 158, 90, 0.35);
}

.tag-partial {
  background: rgba(212, 160, 23, 0.12);
  color: var(--accent);
  border-color: rgba(212, 160, 23, 0.35);
}

.tag-pending {
  background: rgba(138, 150, 136, 0.12);
  color: var(--text-muted);
  border-color: var(--border);
}

.attachment-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.attachment-head label {
  margin: 0;
}

.attachment-editor {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.attachment-editor .attachment-row {
  display: grid;
  grid-template-columns: 1fr 88px auto;
  gap: 0.5rem;
  align-items: center;
}

.attachment-editor .attachment-row input[type="text"],
.attachment-editor .attachment-row input[type="number"] {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-input);
  color: var(--text);
  font: inherit;
}

.attachment-editor .attachment-row .btn {
  padding: 0.55rem 0.75rem;
  font-size: 0.82rem;
}

.attachment-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.attachment-list li,
.attachment-list-item {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-input);
  font-size: 0.88rem;
}

.attachment-list-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.attachment-list-main {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}

.attachment-list-extra {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.45rem 0.55rem;
  border-radius: 6px;
  background: var(--bg-elevated);
  border: 1px dashed var(--border);
}

.attachment-extra-label {
  flex-shrink: 0;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  line-height: 1.5;
}

.attachment-extra-json {
  flex: 1;
  min-width: 0;
  font-size: 0.78rem;
  color: var(--text);
  font-family: ui-monospace, Consolas, monospace;
  word-break: break-all;
  white-space: pre-wrap;
}

.attachment-name {
  font-weight: 600;
}

.attachment-prefab {
  font-size: 0.78rem;
  color: var(--text-muted);
  background: var(--bg-elevated);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
}

.attachment-count {
  margin-left: auto;
  color: var(--accent);
  font-weight: 600;
}

/* Placeholder view */
.placeholder-view {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 320px;
  text-align: center;
  color: var(--text-muted);
}

.placeholder-view .icon {
  font-size: 3rem;
  opacity: 0.4;
  margin-bottom: 1rem;
}

/* Toast */
.toast-root {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast {
  padding: 0.75rem 1.1rem;
  border-radius: 8px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  font-size: 0.9rem;
  animation: slideIn 0.25s ease;
}

.toast.toast-with-detail {
  min-width: 220px;
  max-width: min(360px, calc(100vw - 2rem));
  padding: 0.65rem 1rem 0.75rem;
}

.toast-title {
  font-weight: 600;
  line-height: 1.35;
}

.toast-detail {
  margin-top: 0.25rem;
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--text-muted);
  word-break: break-word;
}

.toast.success {
  border-color: rgba(107, 158, 90, 0.5);
}

.toast.error {
  border-color: rgba(196, 92, 74, 0.5);
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Confirm modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
}

.modal-overlay[hidden] {
  display: none !important;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 10, 8, 0.72);
  backdrop-filter: blur(2px);
}

.modal-panel {
  position: relative;
  z-index: 1;
  width: min(560px, 100%);
  max-height: min(85vh, 720px);
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-panel);
  box-shadow: var(--shadow);
  animation: slideIn 0.18s ease-out;
}

.modal-header {
  padding: 1.15rem 1.25rem 0.85rem;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.15rem;
}

.modal-subtitle {
  margin: 0.35rem 0 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.modal-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 1rem 1.25rem;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.65rem;
  padding: 0.85rem 1.25rem 1.15rem;
  border-top: 1px solid var(--border);
}

.confirm-mail-meta {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.confirm-mail-meta > div {
  display: grid;
  gap: 0.35rem;
}

.confirm-mail-meta dt {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.confirm-mail-meta dd {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.5;
}

.confirm-mail-content {
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-input);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 10rem;
  overflow-y: auto;
}

.confirm-recipients-all {
  margin: 0;
  color: var(--accent);
  font-weight: 600;
}

.confirm-recipients-summary {
  margin: 0 0 0.45rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.confirm-recipient-list,
.confirm-attachment-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.confirm-recipient-list li,
.confirm-attachment-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.65rem;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-input);
}

.confirm-attachment-label {
  font-weight: 600;
}

.confirm-attachment-prefab,
.confirm-attachment-extra {
  font-size: 0.78rem;
  font-family: ui-monospace, Consolas, monospace;
  color: var(--text-muted);
  background: var(--bg-elevated);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
}

.confirm-attachment-count {
  margin-left: auto;
  color: var(--accent);
  font-weight: 600;
}

.confirm-attachment-extra {
  flex-basis: 100%;
  word-break: break-all;
}

.confirm-empty {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.88rem;
}

.confirm-warning {
  color: var(--danger);
}

/* 福彩延续市场的紧凑列表；只有开奖号码使用四位数字签。 */
.number-lottery-page .panel-head { flex-wrap: wrap; gap: .75rem; }
.number-lottery-page .number-lottery-table { table-layout: auto; }
.number-lottery-page .number-lottery-table th,
.number-lottery-page .number-lottery-table td { width: auto; max-width: 280px; }
.number-lottery-currencies { margin: .8rem 0 1rem; }
.number-lottery-overview { display: flex; flex-wrap: wrap; align-items: center; gap: 1.5rem; padding: 1.1rem 0 1.4rem; border-bottom: 1px solid var(--border); }
.number-lottery-overview p { margin: .5rem 0 0; }
.number-lottery-result { display: grid; gap: .7rem; min-width: 210px; }
.number-lottery-digits { display: inline-flex; gap: .4rem; }
.number-lottery-digits > span { display: grid; place-items: center; width: 44px; height: 56px; border: 1px solid var(--border); border-radius: 9px; background: var(--bg-input); color: var(--accent); font: 600 32px/1 ui-monospace, Consolas, monospace; }
.number-lottery-number { font: 600 1.1rem ui-monospace, Consolas, monospace; letter-spacing: .16em; color: var(--accent); }
.number-lottery-filter { display: flex; align-items: end; flex-wrap: wrap; gap: .6rem; margin-bottom: 1rem; }
.number-lottery-filter label { display: grid; gap: .3rem; color: var(--text-muted); font-size: .85rem; }
.number-lottery-filter input, .number-lottery-filter select, #nl-modal input[type="date"] { border: 1px solid var(--border); border-radius: 8px; background: var(--bg-input); color: var(--text); padding: .6rem .7rem; font: inherit; color-scheme: dark; }
.number-lottery-filter input { width: 140px; }
.number-lottery-filter input[name="player"] { width: 190px; }
#nl-modal .modal-panel { width: min(820px, calc(100vw - 32px)); }
#nl-modal .modal-body { display: grid; gap: 1rem; }
.number-lottery-switch { display: flex; align-items: center; gap: .65rem; font-weight: 600; }
.number-lottery-switch input { width: 18px; height: 18px; accent-color: var(--accent); }
.number-lottery-market { min-width: 0; margin: 0; padding: .8rem 1rem 1rem; border: 1px solid var(--border); border-radius: 10px; }
.number-lottery-market legend { color: var(--accent); padding: 0 .4rem; font-size: .95rem; }
.number-lottery-config-grid { display: grid; grid-template-columns: repeat(6,minmax(0,1fr)); gap: .75rem; }
.number-lottery-config-grid .form-group { grid-column: span 2; }
.number-lottery-config-grid .form-group:first-child { grid-column: span 6; }
.number-lottery-config-grid input { min-width: 0; width: 100%; }
#nl-modal input[readonly] { color: var(--text-muted); opacity: .8; }
@media(max-width: 600px) {
  .number-lottery-config-grid { grid-template-columns: 1fr; }
  .number-lottery-config-grid .form-group, .number-lottery-config-grid .form-group:first-child { grid-column: auto; }
  .number-lottery-page .panel-head-actions { flex-wrap: wrap; }
}
/* 钻石流水沿用玩家管理页面，独立列宽避免通用玩家表比例干扰。 */
.diamond-ledger-page > .diamond-ledger-filter-panel { flex: 0 0 auto; margin-bottom: 1rem; }
.diamond-ledger-page .diamond-ledger-filters { flex: none; }
.diamond-ledger-filters { display: flex; flex-wrap: wrap; gap: 14px; align-items: end; }
.diamond-ledger-filters label { display: flex; flex-direction: column; gap: 6px; }
.diamond-ledger-filters input, .diamond-ledger-filters select { min-height: 36px; max-width: 220px; padding: 8px 10px; background: var(--bg-input); color: var(--text); border: 1px solid var(--border); border-radius: 6px; font: inherit; color-scheme: dark; }
.diamond-ledger-filters input:focus, .diamond-ledger-filters select:focus { outline: 2px solid var(--border-focus); outline-offset: 1px; }
.diamond-ledger-filters input[type="number"] { width: 130px; }
.diamond-ledger-page .panel-head, .diamond-ledger-page .panel-head-actions { flex-wrap: wrap; gap: .75rem; }
.diamond-ledger-hint { flex: 0 0 auto; margin: 0; padding: .75rem 1.25rem 0; color: var(--text-muted); font-size: .85rem; }
#diamond-ledger-selection { color: var(--text-muted); font-size: .9rem; }
.diamond-ledger-table-wrap { overflow-x: auto; }
.diamond-ledger-table { width: 100%; min-width: 1180px; border-collapse: collapse; }
.diamond-ledger-table th, .diamond-ledger-table td { text-align: left; padding: 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
.diamond-ledger-table td { max-width: 300px; overflow-wrap: anywhere; }
.diamond-ledger-table small { display: block; margin-top: 5px; opacity: .75; }
.diamond-ledger-table .diamond-ledger-checkbox { width: 42px; text-align: center; }
.diamond-ledger-checkbox input { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; }
.diamond-ledger-table tr:has(input:checked) td { background: var(--accent-soft); }
.ledger-income { color: #49c791; font-weight: 600; }
.ledger-expense { color: #f38d8d; font-weight: 600; }
