:root {
  --bg: #101116;
  --rail: #171922;
  --panel: #1f222c;
  --panel-soft: #282c37;
  --line: #3d4350;
  --text: #f5f7fb;
  --muted: #a9b1c2;
  --pink: #e33d72;
  --gold: #d99b24;
  --cyan: #28b7e8;
  --green: #33b977;
  --violet: #8d6bff;
  --red: #ff5e68;
  --gray: #788091;
  --shadow: 0 22px 70px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(227, 61, 114, 0.14), transparent 34rem),
    radial-gradient(circle at top right, rgba(40, 183, 232, 0.10), transparent 30rem),
    var(--bg);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

.hidden {
  display: none !important;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.loading-screen,
.error-screen,
.login-screen {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
  color: var(--muted);
}

.login-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 22px;
  width: min(900px, 100%);
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(31, 34, 44, 0.97);
  box-shadow: var(--shadow);
}

.login-card h1 {
  margin: 12px 0;
}

.login-card p {
  line-height: 1.5;
}

.login-form {
  display: grid;
  gap: 12px;
  align-content: center;
}

.login-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
}

.auth-error {
  margin: 0;
  padding: 10px;
  border: 1px solid rgba(255, 94, 104, 0.45);
  border-radius: 8px;
  color: #ffc0c5;
  background: rgba(255, 94, 104, 0.12);
}

.app-shell {
  display: grid;
  grid-template-columns: 284px minmax(0, 1fr);
  min-height: 100vh;
}

.rail {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  padding: 18px;
  background: rgba(23, 25, 34, 0.98);
  border-right: 1px solid var(--line);
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
}

.brand-mark,
.profile-mark,
.gift-icon {
  display: grid;
  place-items: center;
  border-radius: 10px;
  font-weight: 900;
}

.brand-mark {
  width: 46px;
  height: 46px;
  background: linear-gradient(135deg, var(--pink), var(--cyan));
}

.brand strong,
.brand small,
.profile-button strong,
.profile-button small {
  display: block;
}

small,
.muted,
.card p,
.kicker,
.subtext {
  color: var(--muted);
}

.nav-button {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  color: #dce2ee;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 9px;
  text-align: left;
}

.nav-button:hover,
.nav-button.active {
  background: #252936;
  border-color: #464c5a;
}

.nav-dot {
  width: 11px;
  height: 11px;
  flex: 0 0 11px;
  border-radius: 999px;
  background: currentColor;
  box-shadow: 0 0 16px currentColor;
}

.rail-footer {
  margin-top: auto;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #20232d;
}

.rail-footer strong {
  display: block;
  margin: 6px 0 10px;
}

.badge {
  display: inline-flex;
  width: fit-content;
  padding: 5px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.badge.warn {
  color: #ffd17f;
  background: rgba(217, 155, 36, 0.16);
}

.badge.ok {
  color: #7be7af;
  background: rgba(51, 185, 119, 0.13);
}

.workspace {
  min-width: 0;
  padding: 18px 22px 34px;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto auto auto auto;
  gap: 12px;
  align-items: center;
  margin-bottom: 22px;
}

.search-field {
  display: grid;
  gap: 5px;
}

.search-field span,
.kicker {
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

input,
select {
  min-height: 40px;
  width: 100%;
  padding: 0 12px;
  color: var(--text);
  background: #292d38;
  border: 1px solid #4a5060;
  border-radius: 8px;
}

.profile-button,
.primary,
.secondary {
  min-height: 42px;
  border-radius: 9px;
  border: 1px solid transparent;
  font-weight: 800;
}

.profile-button {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 7px 12px;
  color: var(--text);
  background: #242833;
  border-color: var(--line);
}

.session-pill {
  display: grid;
  min-height: 42px;
  min-width: 132px;
  align-content: center;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #242833;
}

.session-pill strong {
  color: var(--text);
}

.profile-mark {
  width: 38px;
  height: 38px;
}

.primary {
  padding: 0 16px;
  color: #fff;
  background: linear-gradient(135deg, var(--pink), #c82e5e);
}

.secondary {
  padding: 0 14px;
  color: var(--text);
  background: #2b303c;
  border-color: #4a5060;
}

.secondary.danger {
  color: #ffdce0;
  background: rgba(255, 94, 104, 0.12);
  border-color: rgba(255, 94, 104, 0.5);
}

.secondary.danger:hover {
  background: rgba(255, 94, 104, 0.2);
  border-color: var(--red);
}

.page {
  display: none;
}

.page.active {
  display: block;
}

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 16px;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1,
h2,
h3 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 32px;
  line-height: 1.08;
}

h2 {
  font-size: 21px;
}

.button-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.profile-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  border-top: 3px solid var(--green);
}

.profile-creator {
  display: grid;
  gap: 14px;
  margin-bottom: 16px;
  border-top: 3px solid var(--cyan);
}

.toast-stack {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 1000;
  display: grid;
  gap: 10px;
  width: min(360px, calc(100vw - 32px));
  pointer-events: none;
}

.toast {
  display: grid;
  gap: 4px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--cyan);
  border-radius: 10px;
  background: rgba(31, 34, 44, 0.98);
  box-shadow: var(--shadow);
  animation: toast-in 180ms ease-out;
}

.toast.success {
  border-left-color: var(--green);
}

.toast.error {
  border-left-color: var(--red);
}

.toast.warning {
  border-left-color: var(--gold);
}

.toast span {
  color: var(--muted);
}

.toast.leaving {
  animation: toast-out 220ms ease-in forwards;
}

@keyframes toast-in {
  from {
    transform: translateY(-8px);
    opacity: 0;
  }
}

@keyframes toast-out {
  to {
    transform: translateX(18px);
    opacity: 0;
  }
}

.import-help {
  display: grid;
  gap: 6px;
  margin: 12px 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(40, 44, 55, 0.88);
  color: var(--muted);
}

.import-help strong {
  color: var(--text);
}

.import-help code {
  color: var(--text);
}

.hero,
.card,
.table-card,
.panel,
.profile-card,
.gift-card,
.overlay-card,
.settings-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(31, 34, 44, 0.96);
  box-shadow: var(--shadow);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: 18px;
  padding: 24px;
  border-top: 3px solid var(--pink);
}

.home-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.home-actions .primary,
.home-actions .secondary {
  min-height: 46px;
}

.hero p {
  max-width: 760px;
  line-height: 1.5;
}

.hero-stat {
  display: grid;
  place-items: center;
  align-content: center;
  min-height: 160px;
  border-radius: 12px;
  background: #292d38;
  text-align: center;
}

.hero-stat strong {
  font-size: 58px;
  color: var(--cyan);
}

.grid {
  display: grid;
  gap: 14px;
}

.grid.metrics {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 14px;
}

.metric {
  min-height: 128px;
  padding: 16px;
  border-top: 3px solid var(--gray);
}

.metric strong {
  display: block;
  margin: 9px 0;
  font-size: 22px;
}

.metric p {
  margin-bottom: 0;
}

.workflow {
  margin-top: 14px;
  padding: 16px;
}

.workflow-steps {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.workflow-step {
  min-height: 80px;
  padding: 12px;
  border-radius: 10px;
  background: #292d38;
}

.workflow-step b {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  margin-bottom: 10px;
  border-radius: 999px;
  color: #101116;
  background: var(--cyan);
}

.profile-grid,
.overlay-grid,
.settings-grid,
.connection-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.profile-card,
.overlay-card,
.settings-card,
.panel {
  padding: 16px;
}

.profile-card.active {
  border-color: var(--green);
}

.table-card {
  overflow: hidden;
  margin-bottom: 14px;
}

.event-table-scroll {
  overflow-x: auto;
}

.game-actions-table,
.synced-actions-table {
  overflow-x: auto;
}

.game-actions-table .table-row,
.synced-actions-table .table-row {
  min-width: 980px;
}

.event-rules-table .table-row {
  min-width: 1080px;
}

.event-rules-table .table-row:not(.head) span {
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  line-height: 1.35;
}

.tag-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.025);
}

.tag-manager {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.8fr);
  gap: 14px;
  align-items: end;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(227, 61, 114, 0.045);
}

.event-tool-panel {
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.025);
}

.event-tool-panel summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  cursor: pointer;
  list-style: none;
}

.event-tool-panel summary::-webkit-details-marker {
  display: none;
}

.event-tool-panel summary::after {
  content: "Abrir";
  min-width: 56px;
  padding: 5px 9px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  color: var(--muted);
  text-align: center;
  font-size: 11px;
  font-weight: 900;
}

.event-tool-panel[open] summary::after {
  content: "Cerrar";
  color: #101116;
  background: var(--gold);
  border-color: transparent;
}

.event-tool-panel summary strong,
.event-tool-panel summary span {
  display: block;
}

.event-tool-panel summary span {
  color: var(--muted);
  font-size: 13px;
}

.event-tool-panel .tag-manager {
  border-top: 1px solid var(--line);
  border-bottom: 0;
}

.tag-manager strong,
.tag-manager span {
  display: block;
}

.tag-manager span {
  margin-top: 4px;
  color: var(--muted);
  line-height: 1.35;
}

.tag-create-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.sound-manager {
  grid-template-columns: minmax(240px, 0.72fr) minmax(360px, 1fr);
  align-items: start;
  background: rgba(143, 105, 255, 0.055);
}

.sound-create-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(150px, 1fr));
  gap: 10px;
  align-items: stretch;
}

.sound-picker,
.sound-name-field {
  display: grid;
  gap: 7px;
  min-width: 0;
  color: var(--muted);
  font-size: 13px;
}

.sound-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.sound-picker span {
  display: flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  color: var(--text);
  font-weight: 900;
  border: 1px solid rgba(48, 185, 232, 0.45);
  border-radius: 9px;
  background: rgba(48, 185, 232, 0.08);
}

.sound-picker:hover span,
.sound-picker:focus-within span {
  border-color: var(--cyan);
  background: rgba(48, 185, 232, 0.14);
}

.sound-name-field {
  grid-column: 1 / -1;
}

.sound-selection-status {
  grid-column: 1 / -1;
  min-height: 20px;
  color: var(--muted);
}

.sound-selection-status.ready {
  color: var(--green);
}

.sound-selection-status.warning {
  color: var(--gold);
}

.sound-create-form button {
  grid-column: 1 / -1;
  justify-self: start;
}

.sound-library-list {
  grid-column: 1 / -1;
  display: grid;
  gap: 8px;
}

.sound-library-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
  padding: 9px 10px;
  border: 1px solid rgba(143, 105, 255, 0.22);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.035);
}

.sound-library-item span,
.sound-library-item strong,
.sound-library-item small {
  display: block;
  min-width: 0;
}

.sound-library-item small {
  margin-top: 2px;
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sound-shared-chip {
  min-height: 30px;
  padding: 6px 9px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
}

.sound-storage-note {
  grid-column: 1 / -1;
  color: var(--muted);
}

.tag-chip,
.tag-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  font-size: 12px;
  font-weight: 900;
}

.tag-chip {
  cursor: pointer;
}

.tag-chip.active,
.tag-chip:hover {
  color: #101116;
  background: var(--gold);
  border-color: transparent;
}

.tag-pill {
  color: #ffe9ad;
  background: rgba(240, 180, 41, 0.13);
  border-color: rgba(240, 180, 41, 0.35);
}

.queue-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border: 1px solid rgba(40, 183, 232, 0.32);
  border-radius: 8px;
  color: #c8f2ff;
  background: rgba(40, 183, 232, 0.09);
  font-size: 12px;
  font-weight: 900;
}

.sound-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border: 1px solid rgba(143, 105, 255, 0.34);
  border-radius: 8px;
  color: #e7ddff;
  background: rgba(143, 105, 255, 0.09);
  font-size: 12px;
  font-weight: 900;
}

.event-rule-detail,
.action-detail-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 10px;
  min-width: 1080px;
  padding: 14px 16px 18px 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  border-left: 3px solid rgba(40, 183, 232, 0.65);
  background: rgba(40, 183, 232, 0.055);
}

.action-detail-row {
  min-width: 980px;
  border-left-color: rgba(240, 180, 41, 0.7);
  background: linear-gradient(90deg, rgba(240, 180, 41, 0.09), rgba(40, 183, 232, 0.035));
}

.event-detail-title {
  grid-column: 1 / -1;
  padding: 0 0 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.event-rule-detail div,
.action-detail-row div {
  min-width: 0;
}

.event-rule-detail small,
.action-detail-row small {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.event-rule-detail strong,
.action-detail-row strong {
  display: block;
  overflow-wrap: anywhere;
  color: var(--text);
  font-weight: 700;
  line-height: 1.35;
}

.detail-tile {
  min-height: 74px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.045);
}

.detail-tile.gift {
  border-color: rgba(227, 61, 114, 0.34);
  background: rgba(227, 61, 114, 0.09);
}

.detail-tile.coins,
.detail-tile.combo,
.detail-tile.queue {
  border-color: rgba(240, 180, 41, 0.34);
  background: rgba(240, 180, 41, 0.08);
}

.detail-tile.action,
.detail-tile.match {
  border-color: rgba(40, 183, 232, 0.32);
  background: rgba(40, 183, 232, 0.075);
}

.detail-tile.tag {
  border-color: rgba(143, 105, 255, 0.34);
  background: rgba(143, 105, 255, 0.08);
}

.detail-tile.sound {
  border-color: rgba(143, 105, 255, 0.34);
  background: rgba(143, 105, 255, 0.08);
}

.detail-tile.ok {
  border-color: rgba(35, 213, 130, 0.35);
  background: rgba(35, 213, 130, 0.08);
}

.detail-tile.bad {
  border-color: rgba(255, 89, 116, 0.45);
  background: rgba(255, 89, 116, 0.1);
}

.detail-tile.code strong,
.code-cell {
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  color: #c8d2e6;
}

.main-cell {
  font-weight: 900;
}

.soft-cell {
  color: #d7deef;
  white-space: normal;
  line-height: 1.35;
}

.icon-action.edit {
  color: #101116;
  background: #f0b429;
}

.icon-action.detail {
  color: #fff;
  background: #596176;
}

.table-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.table-head input {
  max-width: 260px;
}

.table-row {
  display: grid;
  grid-template-columns: var(--columns, repeat(5, minmax(0, 1fr)));
  gap: 10px;
  min-height: 48px;
  align-items: center;
  padding: 10px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.table-row:first-child {
  border-top: 0;
}

.table-row.head {
  min-height: 38px;
  color: var(--muted);
  background: #252936;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.table-row.available {
  border-left: 3px solid rgba(35, 213, 130, 0.65);
}

.table-row.unavailable {
  border-left: 3px solid rgba(255, 89, 116, 0.85);
  background: rgba(255, 89, 116, 0.06);
}

.table-row span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.icon-action {
  display: inline-grid;
  place-items: center;
  min-width: 44px;
  height: 28px;
  padding: 0 8px;
  color: #101116;
  background: var(--cyan);
  border: 0;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 900;
}

.icon-action.play:hover {
  filter: brightness(1.15);
}

.icon-action.delete {
  color: #fff;
  background: #c83d5c;
}

.icon-action.delete:hover {
  filter: brightness(1.12);
}

.icon-action:disabled {
  cursor: not-allowed;
  color: var(--muted);
  background: #3a3f4d;
  opacity: 0.75;
}

.admin-create-panel {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(320px, 1.2fr);
  gap: 18px;
  align-items: start;
  margin-bottom: 14px;
}

.admin-user-form,
.admin-username-form,
.admin-password-form {
  display: grid;
  gap: 10px;
}

.admin-user-form {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  align-items: end;
}

.admin-username-form,
.admin-password-form {
  grid-template-columns: minmax(0, 1fr) auto;
}

.admin-user-form input,
.admin-username-form input,
.admin-password-form input {
  width: 100%;
}

.admin-message {
  grid-column: 1 / -1;
  margin: 0;
  padding: 10px 12px;
  border-radius: 10px;
}

.admin-message.ok {
  color: #bcffdd;
  background: rgba(35, 213, 130, 0.12);
  border: 1px solid rgba(35, 213, 130, 0.35);
}

.admin-message.error {
  color: #ffd0d8;
  background: rgba(255, 89, 116, 0.12);
  border: 1px solid rgba(255, 89, 116, 0.35);
}

.admin-live-panel {
  display: grid;
  gap: 14px;
  margin-bottom: 14px;
  border-top: 3px solid var(--gold);
}

.admin-live-head,
.admin-live-controls,
.admin-live-payment,
.admin-live-row {
  display: grid;
  gap: 12px;
}

.admin-live-head {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
}

.admin-live-controls {
  grid-template-columns: minmax(180px, 0.8fr) minmax(180px, 0.8fr) minmax(260px, 1fr);
  align-items: end;
}

.admin-live-controls label,
.admin-live-payment label {
  display: grid;
  gap: 7px;
  color: var(--muted);
}

.admin-live-kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.admin-live-kpis span {
  min-height: 58px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 196, 60, 0.24);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255, 196, 60, 0.07);
}

.admin-live-kpis strong {
  display: block;
  color: var(--gold);
  font-size: 20px;
}

.admin-live-payment {
  grid-template-columns: minmax(130px, 0.55fr) minmax(130px, 0.55fr) minmax(220px, 1fr) auto;
  align-items: end;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.025);
}

.admin-live-empty-toggle {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  width: fit-content;
  color: var(--muted);
  font-size: 13px;
}

.admin-live-empty-toggle input {
  width: 15px;
  height: 15px;
}

.admin-live-rate {
  color: var(--muted);
  font-size: 13px;
}

.admin-live-list {
  display: grid;
  gap: 8px;
}

.admin-live-row {
  grid-template-columns: 20px minmax(220px, 1fr) minmax(95px, auto) minmax(90px, auto) minmax(70px, auto) minmax(110px, auto);
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  cursor: pointer;
}

.admin-live-row:hover {
  border-color: rgba(255, 196, 60, 0.45);
}

.admin-live-row input {
  width: 16px;
  height: 16px;
}

.admin-live-main {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.admin-live-main strong,
.admin-live-main small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-live-row small {
  color: var(--muted);
}

.automation-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 14px;
}

.connection-guide {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 14px;
  margin: 14px 0;
  border-top: 3px solid var(--cyan);
}

.connection-guide pre {
  grid-column: 1 / -1;
  margin: 0;
}

.game-importer {
  display: grid;
  gap: 12px;
  margin: 14px 0;
  border-top: 3px solid var(--green);
}

.game-importer textarea {
  min-height: 220px;
  width: 100%;
  padding: 12px;
  color: var(--text);
  background: #151821;
  border: 1px solid #4a5060;
  border-radius: 10px;
  font: 13px/1.5 Consolas, "Courier New", monospace;
  resize: vertical;
}

.import-status {
  display: inline-flex;
  align-items: center;
  color: var(--muted);
}

.connector-options {
  display: grid;
  gap: 10px;
}

.connector-option {
  display: grid;
  gap: 5px;
  padding: 12px;
  border: 1px solid #4a5060;
  border-radius: 9px;
  background: #292d38;
}

.connector-option span {
  color: var(--muted);
}

.queue-line,
.connection-line {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  align-items: center;
  margin-top: 10px;
  padding: 10px;
  border-radius: 9px;
  background: #292d38;
}

.gift-layout {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr) 320px;
  gap: 14px;
  align-items: start;
}

.filter-panel,
.gift-detail {
  padding: 14px;
}

.filter-panel {
  display: grid;
  gap: 8px;
}

.filter-button {
  min-height: 36px;
  color: var(--text);
  background: #2b303c;
  border: 1px solid #4a5060;
  border-radius: 8px;
}

.filter-button.active {
  background: rgba(217, 155, 36, 0.20);
  border-color: var(--gold);
}

.gift-toolbar {
  display: grid;
  grid-template-columns: 1fr 220px;
  gap: 10px;
  margin-bottom: 12px;
}

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

.gift-card {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 82px;
  padding: 10px;
  color: var(--text);
  text-align: left;
  overflow: hidden;
}

.gift-card.active {
  border-color: var(--gold);
}

.gift-card.hidden {
  display: none;
}

.gift-icon {
  width: 48px;
  height: 48px;
  color: #1f1500;
  background: linear-gradient(135deg, #ffd37a, var(--gold));
  overflow: hidden;
  position: relative;
  z-index: 1;
  flex: 0 0 auto;
  contain: paint;
  clip-path: inset(0 round 10px);
}

.gift-icon img {
  display: block;
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
  min-width: 0;
  min-height: 0;
  object-fit: contain;
  object-position: center;
}

.gift-icon.placeholder {
  color: #fff3d1;
  background: rgba(217, 155, 36, 0.28);
  border: 1px dashed rgba(255, 211, 122, 0.7);
}

.gift-card strong,
.gift-card small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gift-preview {
  display: grid;
  place-items: center;
  width: 88px;
  height: 88px;
  margin-bottom: 16px;
  border-radius: 14px;
  background: #292d38;
  overflow: hidden;
}

.gift-preview .gift-icon {
  width: 72px;
  height: 72px;
  font-size: 32px;
}

.detail-box {
  display: grid;
  gap: 8px;
  margin: 16px 0;
  padding: 12px;
  border-radius: 10px;
  background: #292d38;
}

.overlay-preview {
  display: block;
  height: 128px;
  margin-bottom: 14px;
  border: 1px solid #4a5060;
  border-radius: 10px;
}

.module-notice {
  display: grid;
  gap: 4px;
  margin-bottom: 14px;
  padding: 12px 14px;
  border: 1px solid rgba(217, 155, 36, 0.5);
  border-radius: 10px;
  color: var(--muted);
  background: rgba(217, 155, 36, 0.08);
}

.module-notice strong {
  color: var(--gold);
}

.module-notice.success {
  border-color: rgba(72, 199, 142, 0.55);
  background: rgba(72, 199, 142, 0.1);
}

.module-notice.success strong {
  color: var(--green);
}

.tiktok-modal-card {
  width: min(680px, calc(100vw - 40px));
}

.status-chip {
  display: inline-flex;
  width: fit-content;
  margin: 0 0 8px;
  padding: 3px 8px;
  border: 1px solid rgba(217, 155, 36, 0.5);
  border-radius: 999px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.status-chip.missing {
  color: #ffd2d9;
  border-color: rgba(255, 89, 116, 0.55);
  background: rgba(255, 89, 116, 0.14);
}

.future-module {
  opacity: 0.82;
}

.overlay-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.overlay-actions button {
  min-height: 34px;
  padding: 0 10px;
  color: var(--text);
  background: #2b303c;
  border: 1px solid #4a5060;
  border-radius: 8px;
}

.overlay-actions button:disabled,
.settings-card input:disabled,
.settings-card select:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.settings-card {
  display: grid;
  gap: 12px;
}

.settings-card label {
  display: grid;
  gap: 7px;
  color: var(--muted);
}

.settings-card label.choice {
  grid-template-columns: auto 1fr;
  align-items: center;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.64);
}

.modal.hidden {
  display: none;
}

.modal-card {
  width: min(820px, calc(100vw - 40px));
  max-height: calc(100vh - 40px);
  overflow: auto;
  padding: 20px;
  border: 1px solid #565d6d;
  border-radius: 12px;
  background: #222631;
  box-shadow: var(--shadow);
}

.modal[data-builder="event"] .modal-card {
  width: min(1040px, calc(100vw - 40px));
}

.modal[data-builder="event"] .builder-grid {
  gap: 18px;
}

.modal-close {
  float: right;
  width: 34px;
  height: 34px;
  color: var(--text);
  background: #2b303c;
  border: 1px solid #4a5060;
  border-radius: 8px;
}

.builder-grid {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.builder-note {
  margin: 0;
  padding: 12px;
  border: 1px solid rgba(51, 185, 119, 0.45);
  border-radius: 9px;
  color: #dffbea;
  background: rgba(51, 185, 119, 0.12);
}

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

.check-grid label {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 10px;
  border-radius: 8px;
  background: #2b303c;
}

.option-pill.implemented {
  border: 1px solid rgba(51, 185, 119, 0.45);
  background: rgba(51, 185, 119, 0.12);
}

.option-pill.planned {
  border: 1px solid rgba(217, 155, 36, 0.5);
  background: rgba(217, 155, 36, 0.12);
}

.option-pill.future {
  border: 1px solid rgba(255, 94, 104, 0.5);
  background: rgba(255, 94, 104, 0.12);
  color: #ffc0c5;
}

.option-pill.future input {
  opacity: 0.55;
}

.option-pill em {
  padding: 3px 7px;
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.08);
  font-size: 11px;
  font-style: normal;
  font-weight: 900;
}

.option-pill.implemented em {
  color: #9ff0c3;
}

.option-pill.planned em {
  color: #ffd992;
}

.option-pill.future em {
  color: #ffb7bd;
}

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

.builder-field-hidden {
  display: none !important;
}

.sound-select-label {
  display: grid;
  gap: 7px;
}

.multi-action-label {
  display: grid;
  gap: 7px;
  grid-column: 1 / -1;
}

.multi-action-label > span {
  color: var(--muted);
}

.action-picker-add-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.action-picker-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 48px;
  padding: 10px;
  border: 1px solid #3f4658;
  border-radius: 10px;
  background: #202633;
  align-items: center;
}

.action-picker-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  padding: 7px 8px 7px 10px;
  border: 1px solid rgba(44, 190, 246, 0.45);
  border-radius: 999px;
  background: rgba(44, 190, 246, 0.12);
}

.action-picker-chip strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.action-picker-chip button {
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 999px;
  color: #07111a;
  background: var(--cyan);
  cursor: pointer;
}

.multi-action-label small {
  color: var(--muted);
}

.sound-select-label small {
  color: var(--muted);
}

.sound-select-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.gift-picker-field {
  display: grid;
  grid-column: 1 / -1;
  gap: 8px;
}

.gift-picker-field > span {
  color: var(--muted);
}

.gift-combo {
  position: relative;
}

.gift-combo-trigger,
.gift-combo-item {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  width: 100%;
  min-height: 54px;
  padding: 8px;
  color: var(--text);
  background: #2b303c;
  border: 1px solid #4a5060;
  border-radius: 9px;
  text-align: left;
  overflow: hidden;
}

.gift-combo-trigger {
  grid-template-columns: 42px minmax(0, 1fr) auto;
}

.gift-combo-trigger b {
  color: var(--muted);
  font-size: 18px;
}

.gift-combo.open .gift-combo-trigger,
.gift-combo-item.active {
  border-color: var(--gold);
  background: rgba(217, 155, 36, 0.14);
}

.gift-combo-menu {
  display: none;
  margin-top: 8px;
  padding: 8px;
  border: 1px solid #4a5060;
  border-radius: 10px;
  background: #20242e;
  box-shadow: var(--shadow);
}

.gift-combo.open .gift-combo-menu {
  display: grid;
  gap: 8px;
}

.gift-combo-list {
  display: grid;
  gap: 6px;
  max-height: min(430px, 44vh);
  overflow: auto;
}

.gift-combo-item.hidden {
  display: none;
}

.gift-combo-item .gift-icon,
.gift-combo-trigger .gift-icon {
  width: 42px;
  height: 42px;
}

.gift-combo-item strong,
.gift-combo-item small,
.gift-combo-trigger strong,
.gift-combo-trigger small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gift-combo-item small,
.gift-combo-trigger small {
  color: var(--muted);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

pre {
  overflow: auto;
  padding: 14px;
  border-radius: 10px;
  background: #0c0d12;
}

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

  .rail {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .brand,
  .rail-footer {
    grid-column: 1 / -1;
  }

  .grid.metrics,
  .profile-grid,
  .overlay-grid,
  .settings-grid,
  .connection-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .gift-layout,
  .automation-grid,
  .connection-guide {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .rail,
  .workspace {
    padding: 14px;
  }

  .rail,
  .topbar,
  .login-card,
  .hero,
  .grid.metrics,
  .workflow-steps,
  .profile-grid,
  .overlay-grid,
  .settings-grid,
  .connection-grid,
  .gift-toolbar,
  .gift-grid,
  .check-grid,
  .form-grid,
  .page-head,
  .table-head {
    grid-template-columns: 1fr;
  }

  .page-head,
  .table-head {
    display: grid;
  }

  .admin-create-panel,
  .admin-user-form,
  .admin-password-form,
  .tag-manager,
  .tag-create-form,
  .sound-create-form,
  .sound-library-item,
  .event-rule-detail,
  .action-detail-row {
    grid-template-columns: 1fr;
  }

  .event-rule-detail,
  .action-detail-row {
    min-width: 0;
    padding: 14px 16px;
  }

  .table-row,
  .queue-line,
  .connection-line {
    grid-template-columns: 1fr;
  }

  .table-row.head {
    display: none;
  }

.table-row span {
    white-space: normal;
  }

  h1 {
    font-size: 26px;
  }
}

.empty-row {
  padding: 24px 16px;
  color: var(--muted);
  text-align: center;
  background: rgba(255, 255, 255, 0.025);
}

.history-controls {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(160px, 0.7fr) minmax(140px, 0.4fr);
  gap: 14px;
  align-items: end;
  margin-bottom: 14px;
}

.history-controls label {
  display: grid;
  gap: 7px;
  color: var(--muted);
}

.history-summary {
  display: grid;
  align-content: center;
  min-height: 62px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
}

.history-summary strong {
  color: var(--cyan);
  font-size: 24px;
}

.history-summary span,
.history-item small,
.history-item time {
  color: var(--muted);
}

.history-money-summary {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  gap: 10px;
  padding-top: 4px;
}

.history-money-summary div {
  min-height: 72px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 196, 60, 0.22);
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(255, 196, 60, 0.1), rgba(48, 185, 232, 0.035));
}

.history-money-summary strong,
.history-money-summary span {
  display: block;
}

.history-money-summary strong {
  color: var(--gold);
  font-size: 22px;
}

.history-money-summary span,
.history-money-summary small {
  color: var(--muted);
}

.history-money-summary small {
  grid-column: 1 / -1;
  line-height: 1.45;
}

.history-list {
  display: grid;
  gap: 8px;
}

.history-item {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto minmax(145px, auto);
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.history-main {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.history-main strong,
.history-main small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-event-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  color: var(--cyan);
  background: rgba(40, 183, 232, 0.12);
  font-size: 10px;
  font-weight: 900;
}

@media (max-width: 760px) {
  .admin-live-head,
  .admin-live-controls,
  .admin-live-payment,
  .admin-live-row,
  .admin-live-kpis {
    grid-template-columns: 1fr;
  }

  .history-controls,
  .history-money-summary,
  .history-item {
    grid-template-columns: 1fr;
  }

  .history-item time {
    font-size: 12px;
  }
}
