/* ---------- Demo page ---------- */
.demo-section {
  padding: 8px 0 80px;
  min-height: 70vh;
}

.demo-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.demo-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.btn-sm {
  padding: 8px 16px;
  font-size: 13.5px;
  border-radius: 10px;
}

.btn-outline.danger {
  color: #e53935;
  border-color: rgba(229, 57, 53, 0.5);
}

.btn-outline.danger:hover {
  background: rgba(229, 57, 53, 0.08);
}

.app-shell {
  position: relative;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
  min-height: 480px;
}

.shell-tabs {
  display: flex;
  background: #161a20;
}

.shell-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 16px 8px;
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.55);
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: all 0.2s ease;
}

.shell-tab b {
  font-size: 15px;
}

.shell-tab i {
  font-style: normal;
  font-size: 12px;
  font-weight: 400;
  opacity: 0.7;
}

.shell-tab:hover {
  color: #fff;
}

.shell-tab.on {
  color: #fff;
  border-bottom-color: var(--acc, var(--primary));
  background: rgba(255, 255, 255, 0.05);
}

.shell-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 22px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  color: var(--text-3);
}

.shell-head #moduleTitle {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

.user-list {
  padding: 18px 22px 90px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 560px;
  overflow-y: auto;
}

.user-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
  transition: box-shadow 0.2s ease;
}

.user-card:hover {
  box-shadow: var(--shadow);
}

.avatar {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 700;
  font-size: 17px;
  flex-shrink: 0;
}

.user-meta {
  flex: 1;
  min-width: 0;
}

.user-meta .uname {
  font-weight: 700;
  font-size: 15px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-meta .uname .at {
  font-weight: 400;
  font-size: 12px;
  color: var(--text-3);
}

.user-meta .udes {
  font-size: 12.5px;
  color: var(--text-3);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-value {
  text-align: right;
  margin-right: 6px;
}

.user-value .v-num {
  font-size: 18px;
  font-weight: 800;
  color: var(--acc, var(--text));
}

.user-value .v-unit {
  font-size: 12px;
  color: var(--text-3);
}

.user-ops {
  display: flex;
  align-items: center;
  gap: 8px;
}

.op-btn {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  border: none;
  cursor: pointer;
  font-size: 20px;
  font-weight: 700;
  display: grid;
  place-items: center;
  transition: transform 0.15s ease, background 0.15s ease;
}

.op-btn:active {
  transform: scale(0.92);
}

.op-add {
  background: var(--acc, var(--primary));
  color: #fff;
}

.op-sub {
  background: #fff;
  color: var(--acc, var(--primary));
  border: 1.5px solid var(--acc, var(--primary)) !important;
}

.op-more {
  background: transparent;
  color: var(--text-3);
  font-size: 18px;
  width: 32px;
  height: 38px;
}

.chance-ops {
  display: flex;
  gap: 6px;
}

.chance-op {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 8px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s ease;
}

.chance-op:hover {
  border-color: var(--acc);
  background: rgba(76, 175, 80, 0.06);
}

.chance-op b {
  font-size: 14px;
  color: var(--acc, var(--text));
}

.chance-op span {
  font-size: 11px;
  color: var(--text-3);
}

.empty-state {
  text-align: center;
  padding: 70px 20px;
  color: var(--text-3);
}

.empty-state .e-ico {
  font-size: 42px;
  margin-bottom: 12px;
}

.empty-state p {
  font-size: 14px;
}

.fab {
  position: absolute;
  right: 24px;
  bottom: 24px;
  width: 54px;
  height: 54px;
  border-radius: 16px;
  border: none;
  background: linear-gradient(135deg, #ff8a3d, #ff6700);
  color: #fff;
  font-size: 28px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 10px 26px rgba(255, 103, 0, 0.42);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  display: grid;
  place-items: center;
  line-height: 1;
}

.fab:hover {
  transform: translateY(-3px) scale(1.04);
}

.demo-hint {
  margin-top: 16px;
  font-size: 13px;
  color: var(--text-3);
  background: var(--bg-2);
  border: 1px dashed var(--line);
  border-radius: 12px;
  padding: 12px 16px;
}

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(14, 16, 20, 0.55);
  backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  width: min(420px, calc(100vw - 40px));
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
  overflow: hidden;
  transform: translateY(14px) scale(0.97);
  transition: transform 0.22s ease;
}

.modal-overlay.open .modal {
  transform: translateY(0) scale(1);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px 0;
}

.modal-head h3 {
  font-size: 18px;
  font-weight: 800;
}

.modal-close {
  background: none;
  border: none;
  font-size: 20px;
  color: var(--text-3);
  cursor: pointer;
  padding: 4px;
}

.modal-body {
  padding: 18px 22px 22px;
}

.field {
  margin-bottom: 14px;
}

.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 6px;
}

.field input {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--line);
  border-radius: 11px;
  font-size: 15px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s ease;
  background: var(--bg-2);
}

.field input:focus {
  border-color: var(--primary);
  background: #fff;
}

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

.btn-cancel {
  background: var(--bg-2);
  color: var(--text-2);
}

.btn-cancel:hover {
  background: var(--line);
}

/* keypad */
.keypad-display {
  background: var(--dark-2);
  color: #fff;
  border-radius: 14px;
  padding: 16px 18px;
  margin-bottom: 14px;
  text-align: right;
}

.keypad-display .kp-value {
  font-size: 30px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  word-break: break-all;
}

.keypad-display .kp-balance {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.55);
  margin-top: 2px;
}

.keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.kp-btn {
  padding: 14px 0;
  font-size: 20px;
  font-weight: 600;
  font-family: inherit;
  background: var(--bg-2);
  border: none;
  border-radius: 11px;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}

.kp-btn:hover {
  background: var(--line);
}

.kp-btn:active {
  transform: scale(0.95);
}

.kp-btn.act {
  background: var(--primary);
  color: #fff;
  font-size: 16px;
}

.kp-btn.subtle {
  color: var(--text-3);
}

/* chance picker */
.chance-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.chance-item {
  border: 1.5px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s ease;
  background: #fff;
}

.chance-item:hover {
  border-color: var(--chance);
  background: rgba(76, 175, 80, 0.05);
}

.chance-item.disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.chance-item .c-ico {
  font-size: 24px;
}

.chance-item .c-name {
  font-weight: 700;
  margin-top: 4px;
}

.chance-item .c-count {
  font-size: 13px;
  color: var(--text-3);
}

/* payment sheet */
.pay-info {
  background: var(--bg-2);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 16px;
}

.pay-info .row {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  padding: 3px 0;
}

.pay-info .row span {
  color: var(--text-3);
}

.pay-info .row b {
  font-variant-numeric: tabular-nums;
}

.pay-users {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 200px;
  overflow-y: auto;
}

.pay-user {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.pay-user:hover {
  border-color: var(--primary);
}

.pay-user.selected {
  border-color: var(--primary);
  background: rgba(255, 103, 0, 0.06);
}

.pay-user .pu-ava {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  flex-shrink: 0;
}

.pay-user .pu-meta {
  flex: 1;
}

.pay-user .pu-meta b {
  font-size: 14px;
  display: block;
}

.pay-user .pu-meta span {
  font-size: 12px;
  color: var(--text-3);
}

.pay-user .pu-bal {
  font-weight: 700;
  font-size: 14px;
}

.pay-empty {
  text-align: center;
  color: var(--text-3);
  font-size: 13px;
  padding: 20px;
}

/* history */
.history-filter {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.hf-chip {
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  color: var(--text-2);
  transition: all 0.15s ease;
}

.hf-chip.on {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.history-list {
  max-height: 320px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.h-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-2);
  border-radius: 11px;
  padding: 10px 12px;
  font-size: 13px;
}

.h-row .h-mod {
  width: 52px;
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  padding: 3px 0;
  border-radius: 6px;
  color: #fff;
}

.h-row .h-info {
  flex: 1;
  min-width: 0;
}

.h-row .h-info b {
  display: block;
  font-size: 13.5px;
}

.h-row .h-info span {
  color: var(--text-3);
  font-size: 11.5px;
}

.h-row .h-change {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.h-row .h-change.up { color: #2e7d32; }
.h-row .h-change.down { color: #e53935; }

.h-revoke {
  background: none;
  border: none;
  color: var(--text-3);
  cursor: pointer;
  font-size: 13px;
  padding: 4px 6px;
  border-radius: 6px;
}

.h-revoke:hover {
  color: #e53935;
  background: rgba(229, 57, 53, 0.08);
}

/* toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 34px;
  transform: translateX(-50%) translateY(16px);
  background: var(--dark-2);
  color: #fff;
  padding: 12px 22px;
  border-radius: 12px;
  font-size: 14px;
  z-index: 300;
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s ease;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.3);
  max-width: calc(100vw - 40px);
  text-align: center;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (max-width: 640px) {
  .demo-toolbar { justify-content: center; }
  .shell-tab i { display: none; }
  .user-list { padding: 14px 14px 90px; }
  .chance-ops { gap: 4px; }
  .chance-op { padding: 5px 6px; }
}
