@layer components {

    /* --- Layout & Containers --- */
    .page-container {
        @apply max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8;
    }

    .section-container {
        @apply mb-12;
    }

    /* --- Cards --- */
    .card {
        @apply bg-gray-900/60 border border-gray-700/50 rounded-xl shadow-xl backdrop-blur-sm relative overflow-hidden;
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.5), 0 2px 4px -1px rgba(0, 0, 0, 0.06), inset 0 1px 0 0 rgba(255, 255, 255, 0.05);
    }

    .card::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        height: 1px;
        background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
        pointer-events: none;
    }

    .card-hover {
        @apply transition-all duration-300 hover:border-yellow-400/50 hover:bg-gray-800/60;
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.5), 0 2px 4px -1px rgba(0, 0, 0, 0.06), inset 0 1px 0 0 rgba(255, 255, 255, 0.05);
    }

    .card-hover:hover {
        box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 10px 10px -5px rgba(0, 0, 0, 0.04), 0 0 15px rgba(251, 191, 36, 0.1), inset 0 1px 0 0 rgba(255, 255, 255, 0.1);
        transform: translateY(-2px);
    }

    .card-header {
        @apply px-6 py-4 border-b border-gray-700 flex items-center justify-between;
    }

    .card-body {
        @apply p-6;
    }

    /* --- Typography --- */
    .page-title {
        @apply text-3xl md:text-4xl font-bold text-gray-100 mb-6;
    }

    .section-title {
        @apply text-2xl font-bold text-gray-100 mb-6 flex items-center gap-2;
    }

    .text-gradient-gold {
        @apply text-transparent bg-clip-text bg-gradient-to-r from-yellow-400 to-yellow-200;
    }

    /* Shared button and badge primitives live in app/assets/tailwind/application.css. */

    /* --- Forms --- */
    .form-group {
        @apply mb-6;
    }

    .form-label {
        @apply block text-sm font-medium text-gray-300 mb-2;
    }

    .form-input {
        @apply block w-full rounded-lg bg-gray-900 border-gray-700 text-gray-100 shadow-sm focus:border-yellow-500 focus:ring-yellow-500 sm:text-sm placeholder-gray-500;
    }

    .form-select {
        @apply block w-full rounded-lg bg-gray-900 border-gray-700 text-gray-100 shadow-sm focus:border-yellow-500 focus:ring-yellow-500 sm:text-sm;
    }

    /* --- Tables --- */
    .table-container {
        @apply overflow-x-auto rounded-lg border border-gray-700;
    }

    .table-base {
        @apply min-w-full divide-y divide-gray-700;
    }

    .table-head {
        @apply bg-gray-800;
    }

    .table-th {
        @apply px-6 py-3 text-left text-xs font-medium text-gray-400 uppercase tracking-wider;
    }

    .table-body {
        @apply bg-gray-900/50 divide-y divide-gray-800;
    }

    .table-td {
        @apply px-6 py-4 whitespace-nowrap text-sm text-gray-300;
    }

    .table-row-hover {
        @apply hover:bg-gray-800/50 transition-colors;
    }

    /* --- Headers --- */
    .section-header {
        @apply text-sm font-black text-gray-400 uppercase tracking-[0.2em] mb-6 pl-4 border-l-4 border-yellow-500 bg-gray-800/40 py-2 rounded-r-lg flex items-center;
    }

    /* --- Premium Character Card (Series Page) --- */
    .character-card-premium {
        @apply relative overflow-hidden rounded-2xl bg-gray-900 border border-gray-800 shadow-2xl transition-all duration-500 group cursor-pointer;
        aspect-ratio: 4/5;
    }

    .character-card-premium:hover {
        @apply border-yellow-500 shadow-yellow-500/10 -translate-y-2;
    }

    .character-card-premium .avatar-container {
        @apply absolute inset-0 w-full h-full overflow-hidden;
    }

    .character-card-premium .avatar-image {
        @apply w-full h-full object-cover grayscale-[0.2] group-hover:grayscale-0 transition-all duration-700 group-hover:scale-105;
    }

    .character-card-premium .content-overlay {
        @apply absolute inset-x-0 bottom-0 p-5 bg-black/80 backdrop-blur-md border-t border-gray-800/50 transform translate-y-1 transition-transform duration-300 group-hover:translate-y-0;
    }

    .character-card-premium .character-name {
        @apply text-lg font-black text-white mb-0.5 group-hover:text-yellow-400 transition-colors tracking-tight uppercase leading-none;
    }

    .character-card-premium .character-level {
        @apply text-[10px] font-black text-yellow-500/80 uppercase tracking-[0.15em] flex items-center gap-1.5;
    }

    .character-card-premium .main-badge {
        @apply absolute top-4 left-4 z-20 px-3 py-1 rounded-md bg-yellow-500 text-[9px] font-black text-black uppercase tracking-widest shadow-xl border border-yellow-400/50;
    }

    /* --- Game-specific Features --- */
    .rarity-inferior {
        color: #64748b;
    }

    .rarity-common {
        color: #9ca3af;
    }

    .rarity-uncommon {
        color: #10b981;
    }

    .rarity-rare {
        color: #3b82f6;
    }

    .rarity-epic {
        color: #a855f7;
    }

    .rarity-legendary {
        color: #f59e0b;
    }


    /* System Background Utility */
    .bg-system-grid {
        background-color: #0b0d11;
        background-image:
            linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
            linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
        background-size: 40px 40px;
        background-attachment: fixed;
    }
}

/* Shimmer animation for teaser elements */
@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }

    100% {
        transform: translateX(100%);
    }
}

.animate-shimmer {
    animation: shimmer 3s ease-in-out infinite;
}
:root {
  --bg: #0b0d12;
  --surface: #13161f;
  --surface-2: #181c26;
  --card: #1a1e2a;
  --card-2: #141826;
  --border: rgba(255, 255, 255, 0.07);
  --border-mid: rgba(255, 255, 255, 0.12);
  --gold: #fbbf24;
  --text-1: #e8e9ec;
  --text-2: #8a8d9a;
  --text-3: #5a6072;
  --system-focus-border: rgba(251, 191, 36, 0.3);
  --system-focus-ring: rgba(251, 191, 36, 0.06);
  --system-option-height: 36px;
}

.system-form-shell {
  max-width: 980px;
  margin: 0 auto;
}

.system-form-page-header {
  margin-bottom: 22px;
}

.system-form-page-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
}

.system-form-page-title-row .page-title,
.system-form-page-title {
  margin: 0;
  color: var(--gold);
  font-size: 26px;
  font-weight: 700;
  line-height: 1.18;
  letter-spacing: 0;
}

.system-form-tag {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  border: 1px solid rgba(251, 191, 36, 0.18);
  border-radius: 999px;
  background: rgba(251, 191, 36, 0.07);
  color: var(--gold);
  padding: 3px 8px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  line-height: 1;
  text-transform: uppercase;
}

.system-form-page-header .page-subtitle,
.system-form-page-subtitle {
  margin-top: 6px;
  color: var(--text-3);
  font-size: 13px;
  line-height: 1.5;
}

.system-form-page-header .breadcrumb-nav {
  margin-bottom: 0;
  color: var(--text-3);
  font-size: 12px;
  line-height: 1.5;
}

.system-form-page-header .breadcrumb-link {
  color: var(--text-3);
}

.system-form-page-header .breadcrumb-link:hover {
  color: var(--gold);
}

.system-form-page-header .breadcrumb-current {
  color: var(--text-2);
}

.system-form-page-header .breadcrumb-separator {
  color: rgba(90, 96, 114, 0.7);
}

.system-form {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  padding: 28px;
  box-shadow: none;
  counter-reset: system-form-card-section;
}

.system-form--embedded {
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0;
}

.system-form--inline {
  width: auto;
  min-width: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0;
  counter-reset: none;
}

.system-form > :first-child {
  margin-top: 0;
}

.system-form .card,
.system-form .manager-column,
.system-form .manager-column-side,
.system-form .manager-column-full {
  border-color: var(--border);
  background: transparent;
  box-shadow: none;
}

.system-form-section,
.system-form .form-section {
  counter-increment: system-form-card-section;
  margin-top: 28px;
  padding-top: 0;
  border-top: 0;
  display: block;
}

.system-form > .card {
  counter-increment: system-form-card-section;
}

.system-form > .card > .manager-header::before,
.system-form > .card > .manager-column-full > .manager-header::before,
.system-form > .card > .p-4 > .manager-header::before,
.system-form > .card > .p-4.sm\:p-6 > .manager-header::before {
  content: counter(system-form-card-section, decimal-leading-zero);
  margin-right: 12px;
  color: var(--gold);
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  font-weight: 600;
}

.system-form-section-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.system-form-section-kicker {
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  color: var(--gold);
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
}

.system-form-section-copy {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}

.system-form-section-copy h2 {
  margin: 0;
  color: var(--text-1);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
}

.system-form-section-copy p {
  margin: 0;
  color: var(--text-3);
  font-size: 11.5px;
  line-height: 1.35;
}

.system-form .section-header-sm,
.system-form .manager-title {
  color: var(--text-1);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}

.system-form .section-subtitle,
.system-form .text-help,
.system-form .section-description {
  color: var(--text-3);
  font-size: 11.5px;
  line-height: 1.45;
}

.system-form .template-settings-display-section + div {
  margin-top: 18px;
}

.form-label,
label.form-label,
.system-form .manager-header label,
.system-form label:not(.system-boolean-label):not(.system-custom-select-option):not([class*="cursor-pointer"]):not([class*="rounded-lg"]):not([class*="flex-1"]) {
  color: var(--text-3);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  line-height: 1.2;
  text-transform: uppercase;
}

.system-form .form-label abbr,
.system-form .required,
.system-required {
  color: var(--gold);
  text-decoration: none;
}

.form-input,
.form-select,
.form-textarea,
.manager-input,
.input,
.system-form input[type="text"],
.system-form input[type="email"],
.system-form input[type="url"],
.system-form input[type="search"],
.system-form input[type="tel"],
.system-form input[type="number"],
.system-form input[type="date"],
.system-form input[type="datetime-local"],
.system-form input[type="password"],
.system-form input[type="file"],
.system-form textarea,
.system-form select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background-color: var(--card-2);
  color: var(--text-1);
  padding: 10px 12px;
  font-size: 13.5px;
  line-height: 1.4;
  transition: border-color 150ms ease, box-shadow 150ms ease, background-color 150ms ease;
}

.system-form textarea,
.system-form .form-textarea {
  min-height: 108px;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus,
.manager-input:focus,
.input:focus,
.system-form input:focus,
.system-form textarea:focus,
.system-form select:focus {
  outline: none;
  border-color: var(--system-focus-border);
  box-shadow: 0 0 0 3px var(--system-focus-ring);
}

.system-form ::placeholder {
  color: rgba(90, 96, 114, 0.75);
}

.form-input:-webkit-autofill,
.form-input:-webkit-autofill:hover,
.form-input:-webkit-autofill:active,
.form-select:-webkit-autofill,
.form-select:-webkit-autofill:hover,
.form-select:-webkit-autofill:active,
.form-textarea:-webkit-autofill,
.form-textarea:-webkit-autofill:hover,
.form-textarea:-webkit-autofill:active,
.manager-input:-webkit-autofill,
.manager-input:-webkit-autofill:hover,
.manager-input:-webkit-autofill:active,
.input:-webkit-autofill,
.input:-webkit-autofill:hover,
.input:-webkit-autofill:active,
.system-searchable-select-input:-webkit-autofill,
.system-searchable-select-input:-webkit-autofill:hover,
.system-searchable-select-input:-webkit-autofill:active,
.system-form input:-webkit-autofill,
.system-form input:-webkit-autofill:hover,
.system-form input:-webkit-autofill:active,
.system-form textarea:-webkit-autofill,
.system-form textarea:-webkit-autofill:hover,
.system-form textarea:-webkit-autofill:active {
  border-color: var(--border) !important;
  background-color: var(--card-2) !important;
  -webkit-box-shadow: 0 0 0 1000px var(--card-2) inset !important;
  -webkit-text-fill-color: var(--text-1) !important;
  caret-color: var(--text-1) !important;
  transition: background-color 999999s ease-out, color 999999s ease-out, -webkit-text-fill-color 999999s ease-out;
}

.form-input:-webkit-autofill:focus,
.form-select:-webkit-autofill:focus,
.form-textarea:-webkit-autofill:focus,
.manager-input:-webkit-autofill:focus,
.input:-webkit-autofill:focus,
.system-searchable-select-input:-webkit-autofill:focus,
.system-form input:-webkit-autofill:focus,
.system-form textarea:-webkit-autofill:focus {
  border-color: var(--system-focus-border) !important;
  background-color: var(--card-2) !important;
  -webkit-box-shadow:
    0 0 0 1000px var(--card-2) inset,
    0 0 0 3px var(--system-focus-ring) !important;
  -webkit-text-fill-color: var(--text-1) !important;
  caret-color: var(--text-1) !important;
}

.form-input[readonly],
.form-textarea[readonly],
.manager-input[readonly],
.input[readonly],
.system-form input[readonly],
.system-form textarea[readonly] {
  color: var(--text-2);
  cursor: not-allowed;
  opacity: 0.75;
}

.system-form input[type="color"],
.form-input[type="color"],
.manager-input[type="color"] {
  min-height: 42px;
  padding: 4px;
}

.system-form input[type="radio"] {
  accent-color: var(--gold);
}

.system-form [data-sortable-item] {
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--card-2);
  cursor: grab;
  transition: background-color 150ms ease, border-color 150ms ease;
}

.system-form [data-sortable-item]:hover {
  border-color: var(--border-mid);
  background: var(--card);
}

.system-form .drag-handle {
  display: inline-grid;
  place-items: center;
  width: 12px;
  height: 16px;
  color: var(--text-3);
  cursor: grab;
}

.system-form .drag-handle:hover,
.system-form [data-sortable-item]:hover .drag-handle {
  color: var(--text-2);
}

.system-form .drag-handle svg {
  display: none;
}

.system-form .drag-handle::before {
  content: "";
  width: 2px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  box-shadow:
    0 4px 0 currentColor,
    0 8px 0 currentColor,
    4px 0 0 currentColor,
    4px 4px 0 currentColor,
    4px 8px 0 currentColor;
}

.system-form .card,
.system-form .rounded-xl.border,
.system-form .rounded-lg.border {
  border-color: var(--border);
}

.system-form .bg-gray-800,
.system-form .bg-gray-800\/20,
.system-form .bg-gray-800\/30,
.system-form .bg-gray-800\/40,
.system-form .bg-gray-800\/50,
.system-form .bg-gray-900,
.system-form .bg-gray-900\/30,
.system-form .bg-gray-900\/40,
.system-form .bg-gray-900\/45,
.system-form .bg-gray-900\/50,
.system-form .bg-gray-950\/35,
.system-form .bg-gray-950\/40 {
  background-color: var(--card-2);
}

.system-form [data-controller~="searchable-select"] {
  width: 100%;
}

.system-form [data-controller~="searchable-select"] [role="button"],
.system-form [data-searchable-select-target~="search"] {
  min-height: 42px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--card-2);
  color: var(--text-1);
  padding: 10px 12px;
  font-size: 13.5px;
  line-height: 1.4;
  box-shadow: none;
}

.system-form [data-searchable-select-target~="search"] {
  padding-left: 36px;
}

.system-form [data-controller~="searchable-select"] [role="button"]:focus,
.system-form [data-searchable-select-target~="search"]:focus {
  outline: none;
  border-color: var(--system-focus-border);
  box-shadow: 0 0 0 3px var(--system-focus-ring);
}

.system-form [data-searchable-select-target~="dropdown"],
.system-form [data-searchable-select-target~="optionsContainer"] {
  border: 1px solid var(--border-mid);
  border-radius: 6px;
  background: var(--surface-2);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.system-form [data-searchable-select-target~="option"] {
  border-left: 0;
  border-radius: 4px;
  color: var(--text-1);
  font-size: 13px;
}

.system-form [data-searchable-select-target~="option"]:hover {
  background: var(--card);
}

.system-form [data-controller~="image-generator"] [data-image-upload-preview-target="dropZone"] {
  border: 1px dashed var(--border-mid);
  border-radius: 8px;
  background: var(--card-2);
}

.system-form [data-controller~="image-generator"] [data-image-upload-preview-target="dropZone"]:hover {
  border-color: rgba(251, 191, 36, 0.3);
  background: var(--card);
}

.system-form [data-controller~="image-generator"] [data-mode],
.system-form [data-image-generator-target="optimizeButton"] {
  border: 1px solid var(--border-mid);
  border-radius: 6px;
  background: transparent;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 600;
  box-shadow: none;
}

.system-form [data-controller~="image-generator"] [data-mode]:hover,
.system-form [data-image-generator-target="optimizeButton"]:hover {
  border-color: rgba(255, 255, 255, 0.24);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-1);
}

.system-custom-select {
  position: relative;
  width: 100%;
}

.system-custom-select[data-state="open"],
.system-searchable-select[data-state="open"] {
  z-index: 80;
}

.system-custom-select-button {
  display: flex;
  min-height: 42px;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--card-2);
  color: var(--text-1);
  padding: 10px 12px;
  text-align: left;
  font-size: 13.5px;
  line-height: 1.4;
  transition: border-color 150ms ease, box-shadow 150ms ease, background-color 150ms ease;
}

.system-custom-select-button:focus,
.system-custom-select[data-state="open"] .system-custom-select-button {
  outline: none;
  border-color: var(--system-focus-border);
  box-shadow: 0 0 0 3px var(--system-focus-ring);
}

.system-custom-select-button:hover {
  border-color: var(--border-mid);
  background: var(--card);
}

.system-custom-select-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.system-custom-select-label {
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.system-custom-select-chevron {
  flex: 0 0 auto;
  color: var(--text-3);
  font-size: 14px;
  line-height: 1;
  transition: color 150ms ease, transform 150ms ease;
}

.system-custom-select[data-state="open"] .system-custom-select-chevron {
  color: var(--gold);
  transform: rotate(180deg);
}

.system-custom-select-menu {
  position: absolute;
  z-index: 60;
  top: calc(100% + 6px);
  left: 0;
  width: 100%;
  max-height: 280px;
  overflow-y: auto;
  border: 1px solid var(--border-mid);
  border-radius: 6px;
  background: var(--surface-2);
  padding: 4px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.system-custom-select-option {
  display: grid;
  min-height: var(--system-option-height);
  width: 100%;
  grid-template-columns: 14px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--text-1);
  padding: 8px 10px;
  text-align: left;
  font-size: 13px;
  line-height: 1.25;
}

.system-custom-select-option:hover,
.system-custom-select-option:focus {
  outline: none;
  background: var(--card);
}

.system-custom-select-option[data-selected="true"] {
  background: rgba(251, 191, 36, 0.1);
  color: var(--gold);
}

.system-custom-select-check {
  color: var(--gold);
  font-size: 12px;
  line-height: 1;
}

.system-custom-select-option-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 639px) {
  .system-custom-select[data-label-layout="wrap"] .system-custom-select-button,
  .system-custom-select[data-label-layout="wrap"] .system-custom-select-option {
    align-items: flex-start;
  }

  .system-custom-select[data-label-layout="wrap"] .system-custom-select-label,
  .system-custom-select[data-label-layout="wrap"] .system-custom-select-option-label {
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
  }

  .system-custom-select[data-label-layout="wrap"] .system-custom-select-chevron {
    margin-top: 0.2em;
  }
}

.system-searchable-select {
  position: relative;
  width: 100%;
}

.system-searchable-select-trigger,
.system-searchable-select-input {
  display: flex;
  min-height: 42px;
  width: 100%;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--card-2);
  color: var(--text-1);
  padding: 10px 36px 10px 12px;
  text-align: left;
  font-size: 13.5px;
  line-height: 1.4;
  box-shadow: none;
  transition: border-color 150ms ease, box-shadow 150ms ease, background-color 150ms ease;
}

.system-searchable-select-trigger {
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
}

.system-searchable-select-trigger--compact {
  min-height: 38px;
  padding-block: 8px;
}

.system-searchable-select-input {
  display: block;
}

.system-searchable-select .system-searchable-select-input:not(.system-searchable-select-input--embedded) {
  padding-left: 35px !important;
  padding-right: 42px !important;
}

.system-searchable-select-input--embedded {
  min-height: 36px;
  padding: 8px 10px;
  font-size: 13px;
}

.system-searchable-select-trigger:hover,
.system-searchable-select-input:hover {
  border-color: var(--border-mid);
  background: var(--card);
}

.system-searchable-select-trigger:focus,
.system-searchable-select-input:focus,
.system-searchable-select[data-state="open"] .system-searchable-select-trigger,
.system-searchable-select[data-state="open"] > .relative .system-searchable-select-input {
  outline: none;
  border-color: var(--system-focus-border);
  box-shadow: 0 0 0 3px var(--system-focus-ring);
}

.system-searchable-select-value {
  min-width: 0;
  overflow: hidden;
  color: var(--text-3);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.system-searchable-select-value.text-gray-200 {
  color: var(--text-1);
}

.system-searchable-select-clear {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: transparent;
  color: var(--text-3);
  padding: 4px;
  cursor: pointer;
  transition: color 150ms ease;
}

.system-searchable-select-clear:hover,
.system-searchable-select-clear:focus {
  color: var(--text-2);
  outline: none;
}

.system-searchable-select-chevron {
  flex: 0 0 auto;
  color: var(--text-3);
  transition: color 150ms ease, transform 150ms ease;
}

.system-searchable-select[data-state="open"] .system-searchable-select-chevron {
  color: var(--gold);
  transform: rotate(180deg);
}

.system-searchable-select [data-searchable-select-target~="searchIcon"] {
  color: var(--text-3);
}

.system-searchable-select .searchable-select-input.searchable-select-selected {
  padding-left: 35px !important;
}

.system-searchable-select-menu {
  border: 1px solid var(--border-mid);
  border-radius: 6px;
  background: var(--surface-2);
  padding: 4px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.system-searchable-select-search-panel {
  margin-bottom: 4px;
  padding: 4px;
  border-bottom: 1px solid var(--border);
}

.system-searchable-select-option,
.system-searchable-select-create {
  display: block;
  min-height: var(--system-option-height);
  width: 100%;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--text-1);
  padding: 8px 10px;
  text-align: left;
  font-size: 13px;
  line-height: 1.3;
  cursor: pointer;
  transition: background-color 150ms ease, color 150ms ease;
}

.system-custom-select-option.hidden,
.system-searchable-select-option.hidden,
.system-searchable-select-create.hidden {
  display: none;
}

.system-searchable-select-option--compact {
  padding-block: 8px;
}

.system-searchable-select-option:hover,
.system-searchable-select-option[data-highlighted="true"],
.system-searchable-select-create:hover,
.system-searchable-select-create:focus {
  outline: none;
  background: var(--card);
}

.system-searchable-select-option[data-selected="true"] {
  background: rgba(251, 191, 36, 0.1);
  color: var(--gold);
}

.system-searchable-select-option[data-selected="true"] .text-gray-200 {
  color: var(--gold);
}

.system-searchable-select-option .text-gray-500 {
  color: var(--text-3);
}

.system-searchable-select [data-type-to-search],
.system-searchable-select [data-no-results],
.system-searchable-select [data-loading-results],
.system-searchable-select [data-result-limit] {
  color: var(--text-3);
}

.system-form .form-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.system-form .form-actions > div {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

.system-form .btn-secondary,
.system-form a.btn-secondary,
.system-form .btn-ghost {
  border: 1px solid var(--border-mid);
  background: transparent;
  color: var(--text-2);
  box-shadow: none;
}

.system-form .btn-secondary:hover,
.system-form a.btn-secondary:hover,
.system-form .btn-ghost:hover {
  border-color: rgba(255, 255, 255, 0.24);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-1);
}

.system-form .btn-primary,
.system-form input[type="submit"].btn-primary,
.system-form button.btn-primary {
  border: 1px solid rgba(251, 191, 36, 0.5);
  background: var(--gold);
  color: #1a1208;
  font-weight: 600;
  box-shadow: 0 0 0 3px var(--system-focus-ring);
}

.system-form .btn-primary:hover,
.system-form input[type="submit"].btn-primary:hover,
.system-form button.btn-primary:hover {
  border-color: rgba(251, 191, 36, 0.7);
  background: #facc15;
  color: #1a1208;
}

.system-boolean-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card-2);
  padding: 14px;
}

.system-boolean-row--disabled {
  opacity: 0.55;
}

.system-boolean-label {
  display: block;
  color: var(--text-1);
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.35;
  letter-spacing: 0;
  text-transform: none;
}

.system-boolean-description {
  margin: 3px 0 0;
  color: var(--text-3);
  font-size: 11.5px;
  line-height: 1.4;
}

.system-toggle {
  position: relative;
  flex: 0 0 auto;
  width: 38px;
  height: 22px;
  border: 1px solid var(--border-mid);
  border-radius: 999px;
  background: var(--card-2);
  cursor: pointer;
  transition: background-color 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}

.system-toggle[data-state="on"] {
  border-color: var(--gold);
  background: var(--gold);
  box-shadow: 0 0 0 3px var(--system-focus-ring);
}

.system-toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--text-1);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  transition: transform 150ms ease, background-color 150ms ease;
}

.system-toggle[data-state="on"] .system-toggle-thumb {
  transform: translateX(16px);
  background: #1a1208;
}

.system-toggle-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.system-toggle-column {
  min-width: 0;
}

.system-toggle-heading {
  margin: 0 0 8px;
  color: var(--text-3);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  line-height: 1.2;
  text-transform: uppercase;
}

.system-reorderable-section-title {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
}

.system-reorderable-column-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.system-reorderable-column-label {
  flex: 0 0 auto;
  color: var(--text-3);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  line-height: 1.2;
  text-transform: uppercase;
}

.system-reorderable-column-line {
  min-width: 20px;
  flex: 1 1 auto;
  border-top: 1px solid var(--border);
}

.system-reorderable-add {
  flex: 0 0 auto;
  color: var(--gold);
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
}

.system-reorderable-add:hover {
  color: #facc15;
}

.system-reorderable-row {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--card-2);
  padding: 8px 10px 8px 8px;
  cursor: grab;
  transition: background-color 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}

.system-reorderable-row:hover {
  border-color: var(--border-mid);
  background: var(--card);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
}

.system-form [data-sortable-item].system-dropdown-open-in-reorderable,
.system-form [data-sortable-item].system-dropdown-open-in-reorderable:hover,
.system-reorderable-row.system-dropdown-open-in-reorderable,
.system-reorderable-row.system-dropdown-open-in-reorderable:hover {
  position: relative;
  z-index: 90;
  transform: none;
}

.system-reorderable-row:active {
  cursor: grabbing;
}

.system-form .effect-fields[data-sortable-item],
.effect-fields.system-reorderable-row {
  align-items: flex-start;
  cursor: default;
}

.system-form .effect-fields[data-sortable-item]:hover,
.effect-fields.system-reorderable-row:hover {
  transform: none;
}

.system-form .effect-fields[data-sortable-item]:active,
.effect-fields.system-reorderable-row:active {
  cursor: default;
}

.effect-fields .form-textarea {
  resize: none;
}

.system-reorderable-fields {
  display: flex;
  min-width: 0;
  flex: 1 1 auto;
  align-items: end;
  gap: 12px;
}

.system-drag-grip {
  display: grid;
  width: 10px;
  height: 14px;
  flex: 0 0 10px;
  grid-template-columns: repeat(2, 2px);
  grid-template-rows: repeat(3, 2px);
  gap: 2px;
  color: var(--text-3);
  cursor: grab;
}

.system-drag-grip::before,
.system-drag-grip::after {
  content: "";
}

.system-drag-grip {
  background-image: radial-gradient(currentColor 1px, transparent 1.2px);
  background-size: 4px 4px;
}

.system-reorderable-row:hover .system-drag-grip {
  color: var(--text-2);
}

.system-row-delete-button {
  display: inline-flex;
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--text-3);
  transition: background-color 150ms ease, color 150ms ease;
}

.system-row-delete-button:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-2);
}

.system-row-delete-button svg {
  width: 13px;
  height: 13px;
}

.codex-setup-wizard {
  width: min(100%, 1020px);
  margin: 0 auto;
  padding: 24px 16px 40px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.codex-setup-page-header {
  margin-bottom: 20px;
}

.codex-setup-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.codex-setup-title-copy {
  min-width: 0;
}

.codex-setup-title {
  margin: 0;
  color: var(--gold);
  font-size: 22px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0;
}

.codex-setup-title span {
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
}

.codex-setup-description {
  max-width: 760px;
  margin: 6px 0 0;
  color: var(--text-3);
  font-size: 12.5px;
  line-height: 1.5;
}

.codex-setup-ghost-link {
  flex: 0 0 auto;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: transparent;
  color: var(--text-2);
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  transition: border-color 150ms ease, background-color 150ms ease, color 150ms ease;
}

.codex-setup-ghost-link:hover,
.codex-setup-ghost-link:focus {
  outline: none;
  border-color: var(--border-mid);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-1);
}

.codex-setup-progress-meter {
  display: grid;
  grid-template-columns: auto minmax(90px, 1fr) auto;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
}

.codex-setup-progress-label,
.codex-setup-progress-count,
.codex-setup-panel-number,
.codex-setup-panel-status,
.codex-setup-about-card h2 {
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.codex-setup-progress-label {
  color: var(--text-3);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.14em;
  line-height: 1;
  text-transform: uppercase;
}

.codex-setup-progress-track {
  height: 2px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--card-2);
}

.codex-setup-progress-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--gold);
}

.codex-setup-progress-count {
  color: var(--gold);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}

.codex-setup-tab-strip {
  position: relative;
  display: flex;
  gap: 4px;
  margin-top: 18px;
  overflow-x: auto;
  border-bottom: 1px solid var(--border);
  scrollbar-width: thin;
}

.codex-setup-tab {
  position: relative;
  display: inline-flex;
  min-height: 38px;
  flex: 0 0 auto;
  align-items: center;
  gap: 7px;
  color: var(--text-3);
  padding: 10px 14px 12px;
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1;
  transition: color 150ms ease;
}

.codex-setup-tab-label {
  white-space: nowrap;
}

.codex-setup-tab::after {
  position: absolute;
  right: 10px;
  bottom: -1px;
  left: 10px;
  height: 2px;
  border-radius: 999px 999px 0 0;
  background: transparent;
  content: "";
}

.codex-setup-tab:hover {
  color: var(--text-2);
}

.codex-setup-tab-dot {
  display: inline-flex;
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--text-4);
  border-radius: 999px;
  color: var(--text-3);
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
}

.codex-setup-tab--complete .codex-setup-tab-dot {
  border-color: var(--gold);
  background: var(--gold);
  color: #ffffff;
}

.codex-setup-tab--current {
  color: var(--gold);
}

.codex-setup-tab--current::after {
  background: var(--gold);
}

.codex-setup-tab--current .codex-setup-tab-dot {
  border-color: var(--gold);
  color: var(--gold);
}

.codex-setup-tab--disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.codex-setup-tab--disabled:hover {
  color: var(--text-3);
}

.codex-setup-content-grid {
  display: grid;
  grid-template-columns: minmax(520px, 1fr) 240px;
  gap: 20px;
  max-width: 1020px;
}

.codex-setup-main-panel,
.codex-setup-about-rail {
  min-width: 0;
}

.codex-setup-about-rail {
  position: sticky;
  top: 16px;
  align-self: start;
}

.codex-setup-panel,
.codex-setup-about-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: none;
}

.system-form.codex-setup-panel {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}

.codex-setup-panel-header {
  display: flex;
  min-height: 48px;
  align-items: center;
  gap: 9px;
  border-bottom: 1px solid var(--border);
  border-radius: 10px 10px 0 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0)),
    var(--surface);
  padding: 14px 20px;
}

.codex-setup-panel-number {
  color: var(--gold);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}

.codex-setup-panel-header h2 {
  min-width: 0;
  flex: 1 1 auto;
  margin: 0;
  color: var(--text-1);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.25;
}

.codex-setup-panel-status {
  flex: 0 0 auto;
  border: 1px solid rgba(251, 191, 36, 0.22);
  border-radius: 999px;
  background: rgba(251, 191, 36, 0.06);
  color: var(--gold);
  padding: 4px 7px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1;
}

.codex-setup-panel-body {
  overflow: visible;
  padding: 16px 20px 20px;
}

.codex-setup-panel-description {
  max-width: 540px;
  margin: 0 0 14px;
  color: var(--text-3);
  font-size: 12.5px;
  line-height: 1.5;
}

.codex-setup-panel-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-top: 1px solid var(--border);
  border-radius: 0 0 10px 10px;
  background: var(--card-2);
  padding: 12px 20px;
}

.codex-setup-skip-step {
  flex: 0 0 auto;
  color: var(--text-3);
  font-size: 12px;
  font-weight: 500;
}

.codex-setup-skip-step:hover,
.codex-setup-skip-step:focus {
  outline: none;
  color: var(--text-2);
}

.codex-setup-footer-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.codex-setup-button {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  transition: border-color 150ms ease, background-color 150ms ease, color 150ms ease, box-shadow 150ms ease;
}

.codex-setup-button--ghost {
  border: 1px solid var(--border-mid);
  background: transparent;
  color: var(--text-2);
}

.codex-setup-button--ghost:hover,
.codex-setup-button--ghost:focus {
  outline: none;
  border-color: rgba(255, 255, 255, 0.24);
  color: var(--text-1);
}

.codex-setup-button--primary {
  border: 1px solid rgba(251, 191, 36, 0.5);
  background: var(--gold);
  color: #1a1208;
  box-shadow: 0 0 0 3px var(--system-focus-ring);
}

.codex-setup-button--primary:hover,
.codex-setup-button--primary:focus {
  outline: none;
  border-color: rgba(251, 191, 36, 0.7);
  background: #facc15;
  color: #1a1208;
}

.codex-setup-about-card {
  padding: 14px;
}

.codex-setup-about-card h2 {
  margin: 0;
  color: var(--gold);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  line-height: 1.2;
  text-transform: uppercase;
}

.codex-setup-about-card p {
  margin: 9px 0 0;
  color: var(--text-3);
  font-size: 12px;
  line-height: 1.55;
}

.codex-setup-about-card strong {
  color: var(--text-1);
  font-weight: 600;
}

.codex-setup-about-callout {
  display: none;
}

.codex-setup-table {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card-2);
  overflow: visible;
}

.codex-setup-table--select-open {
  position: relative;
  z-index: 40;
}

.codex-setup-rarity-editor {
  width: min(100%, 420px);
}

.codex-setup-stat-editor {
  width: min(100%, 520px);
}

.codex-setup-equipment-layout {
  display: grid;
  max-width: 640px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
  gap: 16px;
}

.codex-setup-equipment-group {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card-2);
  padding: 12px;
}

.codex-setup-equipment-group--bottom {
  grid-column: 1 / -1;
}

.codex-setup-equipment-list {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 72px;
  gap: 6px;
  padding-bottom: 18px;
}

.codex-setup-equipment-list--bottom {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding-bottom: 0;
}

.codex-setup-equipment-slot-row {
  display: grid;
  min-height: 32px;
  grid-template-columns: 24px minmax(0, 1fr) 24px;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.025);
  padding: 4px 6px;
}

.codex-setup-equipment-slot-row.sortable-ghost {
  opacity: 0.5;
}

.codex-setup-books-editor {
  width: min(100%, 560px);
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card-2);
  overflow: hidden;
}

.codex-setup-book-header,
.codex-setup-book-row {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) 80px 22px;
  align-items: center;
  column-gap: 10px;
}

.codex-setup-book-header {
  min-height: 28px;
  padding: 0 9px;
  color: var(--text-3);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  line-height: 1.2;
  text-transform: uppercase;
}

.codex-setup-book-row {
  min-height: 34px;
  border-top: 1px solid var(--border);
  padding: 4px 9px;
}

.codex-setup-book-row:focus-within {
  position: relative;
  z-index: 5;
}

.codex-setup-display-row {
  overflow: visible;
  align-items: flex-start;
}

.codex-setup-display-row:focus-within {
  position: relative;
  z-index: 50;
}

.codex-setup-display-row .system-custom-select[data-state="open"] {
  z-index: 100;
}

.codex-setup-display-row .system-custom-select-menu {
  z-index: 10000;
  min-width: 192px;
}

.codex-setup-display-row .system-custom-select-option {
  min-height: 30px;
  padding: 6px 10px;
  font-size: 12px;
}

.codex-setup-display-row-body {
  display: grid;
  flex: 1 1 auto;
  gap: 14px;
}

.codex-setup-display-main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 12rem 5.5rem 5.5rem 2rem;
  align-items: end;
  gap: 12px;
}

.codex-setup-display-entry-type-group {
  display: grid;
  gap: 8px;
}

.codex-setup-display-entry-type-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.codex-setup-display-entry-type-option {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.025);
  color: var(--text-2);
  padding: 5px 8px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
}

.codex-setup-display-entry-type-option input {
  width: 14px;
  height: 14px;
  accent-color: var(--gold);
}

.codex-setup-display-toggle-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.codex-setup-empty-state {
  max-width: 560px;
  border: 1px dashed var(--border-mid);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.018);
  color: var(--text-3);
  padding: 14px 16px;
  font-size: 12px;
  line-height: 1.45;
}

.codex-setup-locked-entry-type input[readonly] {
  color: var(--text-2);
}

.codex-setup-locked-entry-type-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 22px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-3);
  padding: 3px 7px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1;
  text-transform: uppercase;
}

.codex-setup-entry-type-fields {
  display: grid;
  min-width: 0;
  flex: 1 1 auto;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 10px;
}

.codex-setup-entry-type-name {
  min-width: 0;
}

.codex-setup-entry-type-action {
  justify-self: end;
}

.system-form .codex-setup-equipment-slot-input {
  width: 100%;
  min-height: 24px;
  height: 24px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--text-1);
  padding: 5px 7px;
  font-size: 13px;
  line-height: 1;
}

.system-form .codex-setup-equipment-slot-input:focus {
  outline: none;
  background: rgba(255, 255, 255, 0.035);
  box-shadow: 0 0 0 3px var(--system-focus-ring);
}

.codex-setup-table-header,
.codex-setup-table-row {
  display: grid;
  align-items: center;
  column-gap: 8px;
}

.codex-setup-rarity-grid {
  grid-template-columns: 24px minmax(0, 1fr) 42px 28px;
}

.codex-setup-stat-grid {
  grid-template-columns: 24px minmax(128px, 1fr) 116px 42px 28px;
}

.codex-setup-table-header {
  min-height: 28px;
  padding: 0 9px;
  color: var(--text-3);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  line-height: 1.2;
  text-transform: uppercase;
}

.codex-setup-table-row {
  position: relative;
  min-height: 40px;
  padding: 5px 9px;
  border-top: 1px solid var(--border);
  background: transparent;
}

.system-form .codex-setup-table-row[data-sortable-item] {
  border-right: 0;
  border-bottom: 0;
  border-left: 0;
  border-radius: 0;
  background: transparent;
  cursor: default;
}

.codex-setup-table-row:focus-within {
  z-index: 5;
}

.codex-setup-table-row:has(.system-custom-select[data-state="open"]) {
  z-index: 1000;
}

.codex-setup-table-row--select-open {
  z-index: 1000;
}

.codex-setup-drag-grip {
  display: block;
  position: relative;
  width: 24px;
  height: 28px;
  justify-self: center;
  color: rgba(90, 96, 114, 0.82);
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-drag: none;
}

.codex-setup-drag-grip::before {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 2px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  box-shadow:
    0 6px 0 currentColor,
    0 12px 0 currentColor,
    6px 0 0 currentColor,
    6px 6px 0 currentColor,
    6px 12px 0 currentColor;
  content: "";
  transform: translate(-4px, -7px);
}

.codex-setup-drag-grip:active {
  cursor: grabbing;
}

.system-form .codex-setup-drag-grip.drag-handle,
.system-form .codex-setup-equipment-slot-row .system-drag-grip.drag-handle {
  display: block;
  position: relative;
  width: 24px;
  height: 28px;
  color: rgba(90, 96, 114, 0.82);
  background-image: none;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-drag: none;
}

.system-form .codex-setup-drag-grip.drag-handle::before,
.system-form .codex-setup-equipment-slot-row .system-drag-grip.drag-handle::before {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 2px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  box-shadow:
    0 6px 0 currentColor,
    0 12px 0 currentColor,
    6px 0 0 currentColor,
    6px 6px 0 currentColor,
    6px 12px 0 currentColor;
  content: "";
  transform: translate(-4px, -7px);
}

.system-form .codex-setup-compact-input {
  width: 100%;
  min-height: 28px;
  height: 28px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background-color: rgba(255, 255, 255, 0.025);
  color: var(--text-1);
  padding: 5px 9px;
  font-size: 13px;
  line-height: 1;
  transition: border-color 150ms ease, box-shadow 150ms ease, background-color 150ms ease;
}

.system-form .codex-setup-compact-input:focus {
  outline: none;
  border-color: var(--system-focus-border);
  box-shadow: 0 0 0 3px var(--system-focus-ring);
}

.system-form .codex-setup-number-input {
  padding-right: 4px;
  padding-left: 4px;
  text-align: center;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.codex-setup-type-select {
  position: relative;
  width: 100%;
  z-index: 1;
}

.codex-setup-type-select .system-custom-select[data-state="open"] {
  z-index: 100;
}

.codex-setup-stat-row .system-custom-select-button {
  min-height: 28px;
  height: 28px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.025);
  padding: 5px 8px;
  font-size: 13px;
  line-height: 1;
}

.codex-setup-stat-row .system-custom-select-chevron {
  font-size: 11px;
}

.codex-setup-stat-row .system-custom-select-menu {
  z-index: 10000;
  min-width: 144px;
}

.codex-setup-stat-row .system-custom-select-option {
  min-height: 28px;
  padding: 5px 8px;
  font-size: 12px;
}

.system-form .codex-setup-color-swatch {
  display: inline-block;
  box-sizing: border-box;
  width: 24px;
  min-width: 24px;
  max-width: 24px;
  height: 24px;
  min-height: 24px;
  max-height: 24px;
  flex: 0 0 24px;
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid var(--border-mid);
  border-radius: 999px;
  background: transparent;
  padding: 0;
  cursor: pointer;
  overflow: hidden;
}

.system-form input[type="color"].codex-setup-color-swatch {
  min-height: 24px;
  height: 24px;
  padding: 0;
}

.system-form .codex-setup-color-swatch:focus {
  outline: none;
  border-color: var(--system-focus-border);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.12), 0 0 0 4px var(--system-focus-ring);
}

.system-form .codex-setup-color-swatch::-webkit-color-swatch-wrapper {
  padding: 0;
}

.system-form .codex-setup-color-swatch::-webkit-color-swatch {
  border: 0;
  border-radius: 999px;
}

.system-form .codex-setup-color-swatch::-moz-color-swatch {
  border: 0;
  border-radius: 999px;
}

.codex-setup-stat-controls {
  display: contents;
}

.codex-setup-stat-field {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: stretch;
}

.codex-setup-stat-field--colour {
  justify-content: center;
}

.codex-setup-stat-mobile-label {
  display: none;
}

.codex-setup-resource-color-placeholder {
  display: flex;
  min-height: 28px;
  align-items: center;
  justify-content: center;
  color: var(--text-4);
  font-size: 13px;
  line-height: 1;
}

.codex-setup-stat-field:not(.codex-setup-stat-field--empty) .codex-setup-resource-color-placeholder {
  display: none;
}

.codex-setup-stat-field--empty .codex-setup-resource-color {
  display: none;
}

.codex-setup-resource-color {
  display: flex;
  width: auto;
  min-width: 24px;
  align-items: center;
  justify-content: center;
}

.codex-setup-resource-color.hidden,
.codex-setup-resource-color-placeholder.hidden {
  display: none;
}

.codex-setup-delete-row {
  display: inline-flex;
  width: 28px;
  height: 28px;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--text-3);
  transition: background-color 150ms ease, color 150ms ease;
}

.codex-setup-delete-row:hover,
.codex-setup-delete-row:focus {
  outline: none;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-2);
}

.codex-setup-delete-row svg {
  width: 12px;
  height: 12px;
}

.codex-setup-add-row {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 12px;
  min-height: 30px;
  border: 1px dashed var(--border-mid);
  border-radius: 6px;
  background: transparent;
  color: var(--text-2);
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  transition: border-color 150ms ease, background-color 150ms ease, color 150ms ease;
}

.codex-setup-add-row:hover,
.codex-setup-add-row:focus {
  outline: none;
  border-color: rgba(251, 191, 36, 0.36);
  background: rgba(251, 191, 36, 0.06);
  color: var(--gold);
}

@media (max-width: 900px) {
  .codex-setup-content-grid {
    grid-template-columns: 1fr;
  }

  .codex-setup-about-rail {
    position: static;
  }

  .codex-setup-equipment-layout,
  .codex-setup-equipment-list--bottom {
    grid-template-columns: 1fr;
  }

  .codex-setup-equipment-group--bottom {
    grid-column: auto;
  }

  .codex-setup-display-main-grid,
  .codex-setup-display-toggle-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .codex-setup-wizard {
    padding: 18px 12px 32px;
  }

  .codex-setup-title-row,
  .codex-setup-panel-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .codex-setup-title-row {
    align-items: flex-start;
  }

  .codex-setup-progress-meter {
    grid-template-columns: 1fr auto;
  }

  .codex-setup-progress-label {
    grid-column: 1 / -1;
  }

  .codex-setup-footer-actions {
    justify-content: stretch;
    width: 100%;
  }

  .codex-setup-button,
  .codex-setup-footer-actions input[type="submit"].codex-setup-button {
    flex: 1 1 auto;
    width: 100%;
  }

  .codex-setup-tab-strip {
    margin-right: -12px;
    margin-left: -12px;
    padding: 0 12px;
    scrollbar-width: none;
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 34px), transparent);
    mask-image: linear-gradient(to right, #000 calc(100% - 34px), transparent);
  }

  .codex-setup-tab-strip::-webkit-scrollbar {
    display: none;
  }

  .codex-setup-tab {
    min-height: 44px;
    padding: 11px 13px 13px;
  }

  .codex-setup-about-rail {
    display: none;
  }

  .codex-setup-about-callout {
    display: block;
    margin: 0 0 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.025);
  }

  .codex-setup-about-callout summary {
    display: flex;
    min-height: 42px;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    color: var(--gold);
    padding: 0 12px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.14em;
    list-style: none;
    text-transform: uppercase;
  }

  .codex-setup-about-callout summary::-webkit-details-marker {
    display: none;
  }

  .codex-setup-about-callout p {
    margin: 0;
    border-top: 1px solid var(--border);
    color: var(--text-3);
    padding: 11px 12px 12px;
    font-size: 12px;
    line-height: 1.55;
  }

  .codex-setup-about-callout strong {
    color: var(--text-1);
    font-weight: 600;
  }

  .codex-setup-panel-header {
    padding: 13px 14px;
  }

  .codex-setup-panel-body {
    padding: 14px;
  }

  .codex-setup-panel-footer {
    padding: 12px 14px;
  }

  .codex-setup-rarity-editor,
  .codex-setup-stat-editor {
    width: 100%;
  }

  .codex-setup-rarity-editor .codex-setup-table-header,
  .codex-setup-stat-editor .codex-setup-table-header {
    display: none;
  }

  .codex-setup-rarity-row.codex-setup-rarity-grid {
    grid-template-columns: 28px minmax(0, 1fr) 44px 44px;
    gap: 8px;
    min-height: 54px;
    padding: 5px 8px;
  }

  .codex-setup-rarity-row .codex-setup-drag-grip,
  .codex-setup-rarity-row .codex-setup-delete-row {
    width: 32px;
    height: 44px;
  }

  .codex-setup-rarity-row .codex-setup-drag-grip {
    width: 28px;
  }

  .codex-setup-rarity-row .codex-setup-delete-row {
    justify-self: end;
  }

  .codex-setup-rarity-row .codex-setup-compact-input {
    min-height: 44px;
    height: 44px;
  }

  .codex-setup-stat-editor {
    border: 0;
    background: transparent;
  }

  .codex-setup-stat-editor .codex-setup-table-body {
    display: grid;
    gap: 9px;
  }

  .codex-setup-stat-row.codex-setup-stat-grid {
    grid-template-columns: 28px minmax(0, 1fr) 40px;
    grid-template-areas:
      "grip name remove"
      "controls controls controls";
    align-items: center;
    row-gap: 6px;
    column-gap: 8px;
    min-height: 0;
  }

  .system-form .codex-setup-stat-row[data-sortable-item] {
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--card-2);
    padding: 8px 10px 10px;
  }

  .codex-setup-stat-row .codex-setup-drag-grip {
    grid-area: grip;
    width: 28px;
    height: 44px;
  }

  .codex-setup-stat-row input[id$="_display_name"] {
    grid-area: name;
    min-height: 44px;
    height: 44px;
    border-color: rgba(148, 163, 184, 0.16);
    background: rgba(255, 255, 255, 0.018);
    padding: 0 10px;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0;
  }

  .codex-setup-stat-row input[id$="_display_name"]::placeholder {
    color: transparent;
  }

  .codex-setup-stat-row input.codex-setup-stat-name-input--empty {
    border-color: var(--border);
    background: rgba(255, 255, 255, 0.025);
  }

  .codex-setup-stat-row input[id$="_display_name"]:focus {
    border-color: var(--system-focus-border);
    background: rgba(255, 255, 255, 0.035);
  }

  .codex-setup-stat-row .codex-setup-delete-row {
    grid-area: remove;
    width: 40px;
    height: 44px;
    justify-self: end;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--text-3);
  }

  .codex-setup-rarity-row .codex-setup-delete-row svg,
  .codex-setup-stat-row .codex-setup-delete-row svg {
    width: 16px;
    height: 16px;
  }

  .codex-setup-stat-row .codex-setup-delete-row:hover,
  .codex-setup-stat-row .codex-setup-delete-row:focus {
    background: rgba(255, 255, 255, 0.045);
    color: var(--text-1);
  }

  .codex-setup-stat-row .codex-setup-stat-controls {
    display: grid;
    grid-area: controls;
    grid-template-columns: minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    min-width: 0;
    padding-left: 36px;
    padding-right: 48px;
  }

  .codex-setup-stat-row--resource .codex-setup-stat-controls {
    grid-template-columns: minmax(0, 1fr) 40px;
    gap: 8px;
    padding-right: 0;
  }

  .codex-setup-stat-row .codex-setup-stat-field {
    display: flex;
    min-width: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
  }

  .codex-setup-stat-row .codex-setup-stat-field--type {
    width: 100%;
  }

  .codex-setup-stat-row .codex-setup-stat-field--colour {
    flex: 0 0 40px;
    width: 100%;
    align-items: center;
    justify-content: center;
  }

  .codex-setup-stat-row .codex-setup-stat-field--empty {
    display: none;
  }

  .codex-setup-stat-mobile-label {
    display: none;
    color: var(--text-3);
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: 0.12em;
    line-height: 1;
    text-transform: uppercase;
  }

  .codex-setup-stat-row .codex-setup-compact-input,
  .codex-setup-stat-row .system-custom-select-button {
    min-height: 44px;
    height: 44px;
  }

  .codex-setup-stat-row .system-custom-select-button {
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.03);
    padding-right: 10px;
    padding-left: 10px;
  }

  .codex-setup-stat-row .codex-setup-resource-color {
    min-height: 44px;
    align-items: center;
    justify-content: center;
  }

  .codex-setup-stat-row .codex-setup-resource-color-placeholder {
    display: none;
  }

  .system-form .codex-setup-entry-type-row {
    align-items: stretch;
    padding: 8px;
  }

  .codex-setup-entry-type-fields {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
  }

  .codex-setup-entry-type-label {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
    white-space: nowrap;
  }

  .codex-setup-entry-type-row .form-input {
    min-height: 40px;
    padding-top: 8px;
    padding-bottom: 8px;
  }

  .codex-setup-entry-type-row .system-row-delete-button {
    width: 40px;
    height: 40px;
    margin-top: 0;
  }

  .codex-setup-entry-type-row .codex-setup-locked-entry-type-badge {
    min-height: 32px;
    padding-right: 9px;
    padding-left: 9px;
  }

  .codex-setup-panel-body > .btn-secondary.btn-sm[data-action="click->nested-form#addItem"] {
    width: 100%;
    min-height: 40px;
  }

  .system-form {
    padding: 18px;
  }

  .system-form.system-form--embedded,
  .system-form.system-form--inline {
    padding: 0;
  }

  .system-form-page-title-row {
    align-items: flex-start;
    gap: 8px;
  }

  .system-form-page-title-row .page-title,
  .system-form-page-title {
    font-size: 24px;
  }

  .system-form-section-header {
    align-items: flex-start;
    gap: 10px;
  }

  .system-form-section-copy {
    display: block;
  }

  .system-form-section-copy p {
    margin-top: 4px;
  }

  .form-input,
  .form-select,
  .form-textarea,
  .manager-input,
  .input,
  .system-form input[type="text"],
  .system-form input[type="email"],
  .system-form input[type="url"],
  .system-form input[type="search"],
  .system-form input[type="tel"],
  .system-form input[type="number"],
  .system-form input[type="date"],
  .system-form input[type="datetime-local"],
  .system-form input[type="password"],
  .system-form textarea,
  .system-form select,
  .system-custom-select-button,
  .system-custom-select-option,
  .system-searchable-select-trigger,
  .system-searchable-select-input,
  .system-searchable-select-option {
    font-size: 16px;
  }

  .system-custom-select-option,
  .system-searchable-select-option {
    min-height: 42px;
  }

  .system-form .form-actions,
  .system-form .form-actions > div {
    align-items: stretch;
    flex-direction: column-reverse;
    width: 100%;
  }

  .system-form .form-actions .btn-primary,
  .system-form .form-actions .btn-secondary,
  .system-form .form-actions .btn-ghost,
  .system-form .form-actions input[type="submit"],
  .system-form .form-actions button {
    width: 100%;
  }

  .system-toggle-grid {
    grid-template-columns: 1fr;
  }

  .system-boolean-row {
    align-items: flex-start;
    gap: 12px;
  }

  .system-reorderable-row {
    align-items: flex-start;
    padding: 10px;
  }

  .system-reorderable-fields {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .system-drag-grip {
    width: 14px;
    height: 18px;
    flex-basis: 14px;
    margin-top: 13px;
  }

  .system-row-delete-button {
    width: 34px;
    height: 34px;
    margin-top: 4px;
  }

  .system-row-delete-button svg {
    width: 14px;
    height: 14px;
  }
}
/*
 * This is a manifest file that'll be compiled into application.css, which will include all the files
 * listed below.
 *
 * Any CSS (and SCSS, if configured) file within this directory, lib/assets/stylesheets, or any plugin's
 * vendor/assets/stylesheets directory can be referenced here using a relative path.
 *
 * You're free to add application-wide styles to this file and they'll appear at the bottom of the
 * compiled file so the styles you add here take precedence over styles defined in any other CSS
 * files in this directory. Styles in this file should be added after the last require_* statement.
 * It is generally better to create a new file per style scope.
 *


 */
