/* ═══════════════════════════════════════════════════
   789WEB — Admin Panel Styles
   Sidebar layout · Dark theme · Mobile drawer
   ═══════════════════════════════════════════════════ */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

:root {
  --bg: #0a0e14;
  --bg-2: #0d1219;
  --panel: #131a24;
  --panel-2: #1a2230;
  --border: #232d3d;
  --border-2: #2d3a4d;
  --text: #e5e7eb;
  --muted: #8b95a5;
  --accent: #3b82f6;
  --accent-2: #60a5fa;
  --accent-hover: #2563eb;
  --success: #10b981;
  --error: #ef4444;
  --warn: #f59e0b;
  --sidebar-w: 220px;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.5);
}

html,
body {
  background: var(--bg);
  color: var(--text);
  font-family:
    system-ui,
    -apple-system,
    "Segoe UI",
    Roboto,
    sans-serif;
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
  overflow: hidden;
}

a {
  color: var(--accent);
  text-decoration: none;
}

.app {
  display: flex;
  height: 100vh;
  height: 100dvh;
}

/* ═══════════════════════════════════════════════════
   MOBILE HEADER
   ═══════════════════════════════════════════════════ */
.mobile-header {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: rgba(13, 18, 25, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  z-index: 900;
  align-items: center;
  padding: 0 16px;
  gap: 12px;
}

.mobile-header .mh-title {
  flex: 1;
  font-weight: 800;
  font-size: 15px;
  color: var(--text);
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
}

/* ═══════════════════════════════════════════════════
   OVERLAY (mobile)
   ═══════════════════════════════════════════════════ */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.3s;
}
.sidebar-overlay.active {
  display: block;
  opacity: 1;
}

/* ═══════════════════════════════════════════════════
   SIDEBAR
   ═══════════════════════════════════════════════════ */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 24px 0 0 0; /* Tinanggal ang bottom padding para dikit ang footer */
  flex-shrink: 0;
  z-index: 100;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 20px 24px;
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}

.brand-logo {
  width: 40px;
  height: auto;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.5));
}

.brand-text {
  color: #a855f7;
  font-weight: 800;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
}

.sidebar-user {
  padding: 0 20px 16px;
  margin-bottom: 8px;
}

.sidebar-user .su-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.sidebar-user .su-role {
  font-size: 12px;
  color: var(--muted);
}
.sidebar-user .su-role b {
  color: var(--accent);
}

.nav-item {
  display: flex;
  align-items: center;
  padding: 12px 20px;
  color: var(--muted);
  text-decoration: none;
  border-left: 3px solid transparent;
  transition: 0.2s;
  font-size: 13.5px;
  font-weight: 500;
  margin-bottom: 2px;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
}

.nav-item.active {
  color: var(--accent);
  border-left-color: var(--accent);
  background: rgba(59, 130, 246, 0.08);
  font-weight: 600;
}

/* ─── SIDEBAR FOOTER (LOGS & LOGOUT) ─── */
.sidebar-footer {
  margin-top: auto;
  padding: 16px 12px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: rgba(0, 0, 0, 0.2);
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════
   MAIN
   ═══════════════════════════════════════════════════ */
.main {
  flex: 1;
  overflow-y: auto;
  padding: 30px 40px 120px;
  min-width: 0;
}
.page {
  display: none;
  animation: pageIn 0.25s ease;
}
.page.active {
  display: block;
}
@keyframes pageIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.page-head {
  margin-bottom: 20px;
}
h1 {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.3px;
  margin-bottom: 4px;
}
h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 10px;
}

/* ═══════════════════════════════════════════════════
   CARDS
   ═══════════════════════════════════════════════════ */
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  margin-bottom: 18px;
  overflow: hidden;
  transition: border-color 0.2s;
}
.card:hover {
  border-color: var(--border-2);
}
.card label {
  display: block;
  margin-bottom: 6px;
  font-size: 12.5px;
  color: var(--muted);
  font-weight: 500;
}
.card label:not(:first-child) {
  margin-top: 14px;
}

/* ═══════════════════════════════════════════════════
   INPUTS
   ═══════════════════════════════════════════════════ */
.input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 15px;
  outline: none;
  font-family: inherit;
  transition: 0.15s;
  -webkit-appearance: none;
  appearance: none;
}
.input::placeholder {
  color: #4b5563;
}
.input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}
textarea.input {
  resize: vertical;
  min-height: 120px;
  font-size: 14px;
}
select.input {
  cursor: pointer;
}
.mono {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 13px;
}

input[type="file"] {
  font-size: 13px;
  color: var(--muted);
  padding: 8px;
  background: var(--bg);
  border: 1px dashed var(--border);
  border-radius: 8px;
  cursor: pointer;
}

/* ═══════════════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════════════ */
.btn {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 12px 18px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: 0.15s;
  font-family: inherit;
  -webkit-appearance: none;
  appearance: none;
  white-space: nowrap;
}
.btn:hover {
  background: #223047;
  border-color: var(--border-2);
}
.btn:active {
  transform: scale(0.98);
}
.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}
.btn.primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.35);
}
.btn.danger {
  background: var(--error);
  border-color: var(--error);
  color: white;
}
.btn.danger:hover {
  background: #dc2626;
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid transparent;
  cursor: pointer;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  transition: 0.15s;
  text-align: left;
}
.btn-ghost:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
}

/* 🔥 ITO ANG PARA SA SIDEBAR LANG (Logs & Logout) */
.sidebar-footer .btn-ghost {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 12px 16px;
  font-size: 13.5px;
  font-weight: 500;
}
.sidebar-footer .btn-ghost.logout-btn {
  color: var(--error);
}
.sidebar-footer .btn-ghost.logout-btn:hover {
  background: rgba(239, 68, 68, 0.1);
}

.btn-mini {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 5px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 11.5px;
  margin-right: 4px;
  transition: 0.15s;
  white-space: nowrap;
  font-family: inherit;
}
.btn-mini:hover {
  background: #223047;
  border-color: var(--border-2);
}
.btn-mini.danger {
  color: var(--error);
}
.btn-mini.danger:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: var(--error);
}

/* ═══════════════════════════════════════════════════
   LAYOUT HELPERS
   ═══════════════════════════════════════════════════ */
.row {
  display: flex;
  gap: 10px;
  margin-top: 12px;
  align-items: center;
  flex-wrap: wrap;
}
.row > .input {
  flex: 1;
  min-width: 180px;
}

.toolbar {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  align-items: center;
  flex-wrap: wrap;
  background: var(--panel);
  padding: 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.toolbar .input {
  flex: 1;
  min-width: 180px;
  max-width: 100%;
}

/* ═══════════════════════════════════════════════════
   TABLES
   ═══════════════════════════════════════════════════ */
.table-wrap {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 800px;
}

th,
td {
  padding: 14px 16px;
  text-align: left;
  font-size: 13.5px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

th {
  background: var(--bg-2);
  color: var(--muted);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  border-bottom: 2px solid var(--border);
}

tbody tr {
  transition: background 0.15s;
}
tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}
tbody tr:last-child td {
  border-bottom: none;
}

/* ═══════════════════════════════════════════════════
   MISC
   ═══════════════════════════════════════════════════ */
.muted {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 10px;
}
.hidden {
  display: none !important;
}

/* ═══════════════════════════════════════════════════
   LOG PANEL
   ═══════════════════════════════════════════════════ */
.log-panel {
  position: fixed;
  bottom: 0;
  left: var(--sidebar-w);
  right: 0;
  height: 260px;
  background: var(--bg-2);
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.22s ease;
  z-index: 950; /* Nasa ilalim ng sidebar (1000/1001) */
  box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.5);
}
.log-panel.open {
  transform: translateY(0);
}
.log-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: 600;
}

/* 🔥 Ito ang mag-aayos sa Clear at X */
.log-header > div {
  display: flex;
  align-items: center;
  gap: 8px;
}
.log-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.65;
  -webkit-overflow-scrolling: touch;
}
.log-line {
  white-space: pre-wrap;
  word-break: break-word;
}
.log-line.info {
  color: #cbd5e1;
}
.log-line.success {
  color: var(--success);
}
.log-line.error {
  color: var(--error);
}
.log-line.warn {
  color: var(--warn);
}
.log-time {
  color: #4b5563;
  margin-right: 8px;
}

/* ═══════════════════════════════════════════════════
   TOAST
   ═══════════════════════════════════════════════════ */
.toast-container {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
  width: calc(100% - 32px);
  max-width: 420px;
  align-items: center;
}
.toast {
  width: 100%;
  padding: 13px 18px;
  border-radius: var(--radius);
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 13.5px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: auto;
  animation: toastIn 0.25s ease;
}
.toast.leaving {
  animation: toastOut 0.2s ease forwards;
}
.toast.success {
  border-left: 4px solid var(--success);
}
.toast.error {
  border-left: 4px solid var(--error);
}
.toast.warn {
  border-left: 4px solid var(--warn);
}
.toast.info {
  border-left: 4px solid var(--accent);
}
.toast .t-icon {
  font-size: 16px;
  flex-shrink: 0;
}
.toast .t-msg {
  flex: 1;
  word-break: break-word;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(-12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@keyframes toastOut {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(-12px);
  }
}

/* ═══════════════════════════════════════════════════
   INPUT ERROR
   ═══════════════════════════════════════════════════ */
.input.error,
.input.invalid {
  border-color: var(--error) !important;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
  animation: shake 0.3s ease;
}
.input-error-msg {
  color: var(--error);
  font-size: 12px;
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}
@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-5px);
  }
  75% {
    transform: translateX(5px);
  }
}

/* ═══════════════════════════════════════════════════
   AUTH (login) - PREMIUM DESIGN
   ═══════════════════════════════════════════════════ */
.auth-body {
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  padding: 20px;
  background:
    radial-gradient(
      circle at 15% 50%,
      rgba(59, 130, 246, 0.08),
      transparent 40%
    ),
    radial-gradient(
      circle at 85% 30%,
      rgba(168, 85, 247, 0.08),
      transparent 40%
    ),
    var(--bg);
}

.auth-wrap {
  width: 100%;
  max-width: 400px;
  animation: pageIn 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.auth-card {
  background: rgba(19, 26, 36, 0.6);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 24px;
  padding: 36px 32px;
  box-shadow:
    0 30px 60px -15px rgba(0, 0, 0, 0.7),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.auth-brand {
  text-align: center;
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.auth-logo {
  max-width: 130px;
  height: auto;
  margin-bottom: 8px;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.5))
    drop-shadow(0 0 20px rgba(255, 255, 255, 0.1));
}

.brand-sub {
  font-size: 11px;
  font-weight: 700;
  color: #a855f7;
  text-transform: uppercase;
  letter-spacing: 6px;
  margin-top: 0;
  margin-left: 6px;
}

.auth-sub {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 28px;
  font-weight: 500;
  letter-spacing: 0.5px;
}

.auth-card label {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 6px;
  margin-top: 18px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.auth-card label:first-of-type {
  margin-top: 0;
}

.auth-card .input {
  background: rgba(10, 14, 20, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 14px 16px;
  border-radius: 12px;
  transition: all 0.2s ease;
}

.auth-card .input:focus {
  background: rgba(10, 14, 20, 0.8);
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15);
}

.auth-btn {
  width: 100%;
  margin-top: 28px;
  padding: 15px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.5px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), #2563eb);
  border: none;
  box-shadow: 0 8px 24px rgba(59, 130, 246, 0.25);
  transition: all 0.2s ease;
}

.auth-btn:hover {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  box-shadow: 0 12px 28px rgba(59, 130, 246, 0.4);
  transform: translateY(-2px);
}

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

.auth-error {
  margin-top: 16px;
  padding: 12px 14px;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: #fca5a5;
  border-radius: 12px;
  font-size: 13px;
  text-align: center;
  font-weight: 500;
}

/* ═══════════════════════════════════════════════════
   MOBILE RESPONSIVE (Login)
   ═══════════════════════════════════════════════════ */
@media (max-width: 480px) {
  .auth-card {
    padding: 30px 22px;
    border-radius: 20px;
  }
  .auth-logo {
    max-width: 110px;
  }
  .brand-sub {
    font-size: 10px;
    letter-spacing: 5px;
  }
  .auth-card .input {
    padding: 12px 14px;
    font-size: 16px;
  }
  .auth-btn {
    padding: 14px;
  }
}

/* ═══════════════════════════════════════════════════
   MARBLE — GAMES
   ═══════════════════════════════════════════════════ */
.marble-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}

.marble-race-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.marble-race-grid:empty {
  display: none;
}
@media (max-width: 900px) {
  .marble-race-grid {
    grid-template-columns: 1fr;
  }
}
.marble-players {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
  margin-top: 10px;
}
.marble-player {
  background: var(--bg);
  border: 1px solid var(--border);
  border-left: 5px solid #888;
  border-radius: 8px;
  padding: 12px 14px;
  transition: 0.2s;
}
.marble-player .m-row1 {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  gap: 8px;
}
.marble-player .m-phone {
  font-weight: 600;
  font-size: 13.5px;
  word-break: break-all;
}
.marble-player .m-color-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  color: #000;
  white-space: nowrap;
}
.marble-player .m-user {
  font-size: 11.5px;
  color: var(--muted);
  margin-bottom: 6px;
}
.marble-player .m-status {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11.5px;
  font-weight: 500;
  background: rgba(139, 149, 165, 0.15);
  color: var(--muted);
  word-break: break-word;
}
.marble-player.status-ready .m-status {
  background: rgba(59, 130, 246, 0.15);
  color: #3b82f6;
}
.marble-player.status-betting .m-status {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
}
.marble-player.status-confirmed .m-status {
  background: rgba(59, 130, 246, 0.2);
  color: #60a5fa;
}
.marble-player.status-win {
  border-left-color: #10b981;
}
.marble-player.status-win .m-status {
  background: rgba(16, 185, 129, 0.2);
  color: #10b981;
  font-weight: 700;
}
.marble-player.status-lose {
  border-left-color: #ef4444;
  opacity: 0.75;
}
.marble-player.status-lose .m-status {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}
.marble-player.status-error {
  border-left-color: #ef4444;
}
.marble-player.status-error .m-status {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

.marble-live-status {
  margin-top: 15px;
  padding: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  color: var(--muted);
}
.marble-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.marble-summary .stat {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
}
.marble-summary .label {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.marble-summary .value {
  font-size: 17px;
  font-weight: 600;
}
.marble-summary .value.pos {
  color: var(--success);
}
.marble-summary .value.neg {
  color: var(--error);
}

.winner-marble {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 20px;
  font-weight: 600;
  font-size: 14px;
  color: #000;
  margin-left: 6px;
}
.marble-results-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 8px;
  border: 1px solid var(--border);
}
.marble-results-table {
  width: 100%;
  margin-top: 0;
  min-width: 620px;
}
.marble-results-table th {
  background: var(--panel-2);
}
.marble-results-table tr.win-row td {
  background: rgba(16, 185, 129, 0.08);
}
.marble-results-table tr.lose-row td {
  opacity: 0.75;
}
.marble-results-table .color-chip {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
  border: 1px solid #333;
}

/* ═══════════════════════════════════════════════════
   RESPONSIVE — TABLET (≤ 900px)
   ═══════════════════════════════════════════════════ */
@media (max-width: 900px) {
  .main {
    padding: 24px 24px 120px;
  }
  h1 {
    font-size: 21px;
  }
}

/* ═══════════════════════════════════════════════════
   FLOATING ACTION BAR (Mobile Selection - 2 Rows Compact)
   ═══════════════════════════════════════════════════ */
.mobile-action-bar {
  position: fixed;
  top: 72px; /* Sa ilalim ng header */
  left: 50%;
  transform: translateX(-50%) translateY(-150%);
  opacity: 0;
  width: calc(100% - 24px);
  max-width: 380px; /* Pinaliit ng konti */
  background: rgba(26, 34, 48, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-2);
  border-radius: 12px;
  padding: 10px 12px; /* Siksik na padding */
  display: flex;
  flex-direction: column; /* Para maging 2 rows */
  gap: 8px; /* Space sa pagitan ng header at buttons */
  z-index: 900;
  box-shadow:
    0 10px 30px rgba(0, 0, 0, 0.6),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.mobile-action-bar:not(.hidden) {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* Row 1: Header (Count + X) */
.mab-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 4px;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.1);
}

.mab-count {
  font-size: 13px;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: 0.5px;
}

.mab-close {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  padding: 0 4px;
  transition: 0.2s;
}
.mab-close:hover {
  color: var(--error);
}

/* Row 2 & 3: Actions Grid */
.mab-actions-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr); /* 3 columns */
  gap: 6px;
}

.mab-actions-grid .btn-mini {
  margin: 0;
  padding: 8px 4px; /* Siksik na height */
  font-size: 11px;
  font-weight: 600;
  display: flex;
  justify-content: center;
  align-items: center;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 6px;
}

.mab-actions-grid .btn-mini:hover {
  background: var(--panel-2);
}

.mab-actions-grid .btn-mini.danger {
  color: var(--error);
  border-color: rgba(239, 68, 68, 0.3);
}

/* Hide sa PC */
@media (min-width: 701px) {
  .mobile-action-bar {
    display: none !important;
  }
}

/* ═══════════════════════════════════════════════════
   RESPONSIVE — MOBILE (≤ 700px) - COMPACT LIST
   ═══════════════════════════════════════════════════ */
@media (max-width: 700px) {
  .app {
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
  }

  /* ─── MOBILE HEADER ─── */
  .mobile-header {
    display: flex !important;
    position: fixed !important;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    z-index: 900 !important;
    background: rgba(13, 18, 25, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    align-items: center;
    padding: 0 16px;
    gap: 12px;
  }
  .mobile-header .mh-title {
    font-size: 14px;
    font-weight: 800;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 6px;
  }
  .hamburger {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--panel-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    width: 42px;
    height: 42px;
    color: #ffffff;
    font-size: 22px;
    cursor: pointer;
  }

  /* ─── SIDEBAR DRAWER ─── */
  .sidebar {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    bottom: 0 !important; /* Stretch hanggang ilalim */
    width: 270px;
    max-width: 80vw;
    background: var(--bg-2) !important;
    border-right: 1px solid var(--border);
    transform: translateX(-100%) !important;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1001 !important;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;

    /* 🚀 ITO ANG SOLUSYON: 100px safe space para sa browser bar */
    padding-bottom: 100px;
  }
  .sidebar.open {
    transform: translateX(0) !important;
    box-shadow: 8px 0 32px rgba(0, 0, 0, 0.8);
  }

  .sidebar-overlay {
    display: none;
    position: fixed !important;
    inset: 0 !important;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000 !important;
    opacity: 0;
    transition: opacity 0.3s;
  }
  .sidebar-overlay.active {
    display: block !important;
    opacity: 1;
  }

  /* ─── MAIN CONTENT AREA ─── */
  .main {
    padding: 70px 12px 80px !important;
    width: 100%;
    overflow-y: auto;
  }
  h1 {
    font-size: 22px;
    margin-bottom: 2px;
  }
  .page-head {
    margin-bottom: 12px;
  }
  .page-head p.muted {
    font-size: 12px;
    margin-bottom: 0;
  }

  /* ─── TOOLBAR ─── */
  .toolbar {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px;
    border-radius: 14px;
    background: var(--panel);
    margin-bottom: 10px;
  }
  .toolbar #search-acc {
    background: var(--bg-2);
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 16px !important;
  }
  .toolbar .row-mobile {
    display: flex;
    gap: 8px;
    width: 100%;
  }
  .toolbar .row-mobile .btn {
    flex: 1;
    padding: 10px 8px;
    font-size: 13px;
    border-radius: 8px;
    font-weight: 600;
    justify-content: center;
  }

  /* 🔥 ITAGO ANG MGA TOOLBAR ACTIONS SA MOBILE (Nasa Floating Bar na) 🔥 */
  .toolbar > .btn:not(.hidden) {
    display: none !important;
  }

  /* ─── COMPACT LIST UI (SIKSIK ANG ACCOUNTS) ─── */
  .table-wrap {
    border: none;
    background: transparent;
    box-shadow: none;
    padding: 0;
  }
  table {
    display: block;
    min-width: 100%;
  }
  thead {
    display: none;
  }
  tbody {
    display: flex;
    flex-direction: column;
    gap: 6px;
  }

  tr {
    display: grid;
    grid-template-columns: 20px 1fr auto;
    gap: 2px 8px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 8px 12px;
    align-items: center;
  }
  td {
    padding: 0;
    border: none;
    white-space: normal;
    font-size: 12.5px;
    line-height: 1.4;
  }

  td:nth-child(1) {
    grid-column: 1;
    grid-row: 1 / span 2;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  td:nth-child(2) {
    grid-column: 2;
    grid-row: 1;
    font-size: 14px;
    font-weight: 700;
    color: #fff;
  }
  td:nth-child(8) {
    grid-column: 3;
    grid-row: 1;
    display: flex;
    justify-content: flex-end;
  }
  td:nth-child(8) .btn-mini {
    padding: 3px 6px;
  }
  td:nth-child(4) {
    grid-column: 2;
    grid-row: 2;
    font-size: 11.5px;
    color: var(--muted);
  }
  td:nth-child(3) {
    grid-column: 3;
    grid-row: 2;
    text-align: right;
    font-weight: 700;
    color: var(--success);
    font-size: 12.5px;
  }
  td:nth-child(6),
  td:nth-child(7) {
    grid-row: 3;
    padding-top: 4px;
    border-top: 1px dashed rgba(255, 255, 255, 0.08);
    margin-top: 2px;
    display: flex;
    align-items: center;
  }
  td:nth-child(6) {
    grid-column: 2;
    justify-content: flex-start;
  }
  td:nth-child(7) {
    grid-column: 3;
    justify-content: flex-end;
  }
  td:nth-child(5) {
    display: none;
  }

  td[colspan="8"] {
    grid-column: 1 / span 3 !important;
    justify-content: center !important;
    text-align: center !important;
    padding: 20px 0 !important;
    border: none !important;
  }
  .badge {
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 9.5px;
    font-weight: 700;
  }

  /* ─── LOG PANEL ─── */
  .log-panel {
    left: 0 !important;
    right: 0 !important;
    height: 65vh;
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
    z-index: 950 !important;
  }

  /* iOS Zoom Fix */
  input,
  select,
  textarea {
    font-size: 16px !important;
  }
}

/* ═══════════════════════════════════════════════════
   RESPONSIVE — VERY SMALL (≤ 380px)
   ═══════════════════════════════════════════════════ */
@media (max-width: 380px) {
  .marble-summary {
    grid-template-columns: 1fr;
  }
  .main {
    padding: 72px 10px 140px !important;
  }
  h1 {
    font-size: 18px;
  }
}

/* ═══════════════════════════════════════════════════
   IMPORT / EXPORT UI
   ═══════════════════════════════════════════════════ */
.import-textarea {
  background: #0d1117 !important;
  border: 1px solid #30363d !important;
  color: #c9d1d9 !important;
  line-height: 1.6;
  padding: 16px !important;
  border-radius: 12px !important;
  font-family: ui-monospace, Menlo, Consolas, monospace !important;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}
.import-textarea:focus {
  border-color: var(--accent) !important;
}

.file-upload-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  background: var(--bg);
  border: 1px dashed var(--border-2);
  padding: 6px;
  border-radius: 8px;
}

.file-input-hidden {
  display: none;
}

.file-upload-label {
  background: var(--panel-2);
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border);
  transition: 0.2s;
  margin: 0 !important;
}
.file-upload-label:hover {
  background: var(--border-2);
}

.file-name {
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 700px) {
  .row[style*="nowrap"] {
    flex-wrap: wrap !important;
  }
  .file-upload-wrapper {
    width: 100%;
  }
}

/* ═══════════════════════════════════════════════════
   GAMES (MARBLE RACE) - PREMIUM MOBILE UI
   ═══════════════════════════════════════════════════ */
.form-group {
  margin-bottom: 20px;
}

.race-section {
  margin-bottom: 24px;
  padding-top: 16px;
  border-top: 1px dashed rgba(255, 255, 255, 0.1);
}

.race-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.race-badge {
  background: rgba(59, 130, 246, 0.15);
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 6px;
  letter-spacing: 0.5px;
}

.race-sub {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}

/* Inputs grid (PC and default) */
.marble-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* Styling the actual phone inputs */
.marble-phone {
  text-align: center;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-weight: 600;
  letter-spacing: 1px;
  background: var(--bg-2) !important;
  border: 1px solid var(--border) !important;
  transition: all 0.2s;
}

.marble-phone:focus {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15) !important;
  background: var(--bg) !important;
}

.race-actions {
  display: flex;
  gap: 10px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.race-actions .btn {
  flex: 1;
  padding: 14px;
  font-weight: 700;
  font-size: 14px;
}

/* ═══════════════════════════════════════════════════
   MOBILE FIXES PARA SA GAMES
   ═══════════════════════════════════════════════════ */
@media (max-width: 700px) {
  /* Gawing maluwag at madaling pindutin ang dropdown */
  #marble-count {
    padding: 14px;
    font-size: 15px !important;
    border-radius: 10px;
    background: var(--bg-2);
  }

  /* Gawing pill-shape at mas maganda ang inputs */
  .marble-inputs {
    gap: 8px;
  }

  .marble-phone {
    padding: 14px 8px !important;
    font-size: 14px !important; /* Saktong laki para sa phone number */
    border-radius: 8px;
  }

  /* I-full width ang buttons at gawing magkatabi */
  .race-actions {
    flex-direction: row;
  }

  .race-actions .btn {
    width: 50%;
  }

  .race-actions #btn-marble-start {
    flex: 2; /* Mas malaki ang Start Race kaysa sa Clear */
  }

  /* Result cards styling */
  .marble-player {
    padding: 10px 12px;
  }
}

/* ═══════════════════════════════════════════════════
   RETOKEN PAGE - PREMIUM UI
   ═══════════════════════════════════════════════════ */
.card-header-flex {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

/* Yung textarea para maging mukhang input console */
.retoken-textarea {
  background: #0d1117 !important;
  border: 1px solid #30363d !important;
  color: #c9d1d9 !important;
  line-height: 1.6;
  padding: 16px !important;
  border-radius: 12px !important;
  font-family: ui-monospace, Menlo, Consolas, monospace !important;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
  margin-bottom: 16px; /* Space bago ang button */
  transition: all 0.2s ease;
}

.retoken-textarea:focus {
  border-color: var(--accent) !important;
  box-shadow:
    inset 0 2px 4px rgba(0, 0, 0, 0.2),
    0 0 0 3px rgba(59, 130, 246, 0.15);
}

/* Pagandahin ang buttons */
.retoken-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 600;
  padding: 14px 24px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), #2563eb);
  border: none;
  box-shadow: 0 4px 15px rgba(59, 130, 246, 0.2);
  transition: all 0.2s ease;
}

.retoken-btn:hover {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
  transform: translateY(-1px);
}

/* ═══════════════════════════════════════════════════
   MOBILE TWEAKS PARA SA RETOKEN
   ═══════════════════════════════════════════════════ */
@media (max-width: 700px) {
  /* Gawing full width ang button sa mobile para madaling pindutin */
  .retoken-btn {
    width: 100%;
    padding: 14px;
  }

  /* Gawing mas maliit ng konti ang textarea height sa mobile */
  .retoken-textarea {
    min-height: 180px;
    font-size: 16px !important; /* iOS Zoom Fix */
  }
}

/* ═══════════════════════════════════════════════════
   DEPOSIT PAGE - PREMIUM UI
   ═══════════════════════════════════════════════════ */
.deposit-form-group {
  margin-bottom: 18px;
}
.deposit-form-group label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 8px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Single Deposit input + button alignment */
.deposit-input-wrapper {
  display: flex;
  gap: 10px;
}
.deposit-input-wrapper .input {
  flex: 1;
  font-size: 16px;
}
.deposit-input-wrapper .btn {
  padding: 0 24px;
  white-space: nowrap;
}

/* Amount Presets Grid (50, 100, 200, 500) */
.amount-presets {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.preset-btn {
  padding: 10px 0;
  font-weight: 700;
  background: var(--bg-2);
  border: 1px solid var(--border-2);
  border-radius: 8px;
  transition: 0.2s;
}
.preset-btn:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
  transform: translateY(-1px);
}

/* Bulk List Items */
.bulk-list-wrapper {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 16px;
  max-height: 250px;
  overflow-y: auto;
  padding-right: 4px;
}
.bulk-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: ui-monospace, monospace;
  font-size: 13px;
}
.bulk-item .btn-mini {
  background: rgba(239, 68, 68, 0.1);
  color: var(--error);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

/* Progress Summary Badges */
.progress-summary {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.prog-badge {
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  font-family: ui-monospace, monospace;
}
.prog-badge.success {
  background: rgba(16, 185, 129, 0.15);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.3);
}
.prog-badge.warn {
  background: rgba(245, 158, 11, 0.15);
  color: var(--warn);
  border: 1px solid rgba(245, 158, 11, 0.3);
}
.prog-badge.error {
  background: rgba(239, 68, 68, 0.15);
  color: var(--error);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.progress-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* QR Grid */
.qr-grid-wrapper {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
  margin-top: 12px;
}

/* ═══════════════════════════════════════════════════
   MOBILE TWEAKS PARA SA DEPOSIT
   ═══════════════════════════════════════════════════ */
@media (max-width: 700px) {
  .deposit-input-wrapper {
    flex-direction: column; /* I-stack ang input at button sa mobile */
  }
  .deposit-input-wrapper .btn {
    padding: 14px;
    width: 100%;
  }
  .amount-presets {
    grid-template-columns: 1fr 1fr; /* 2x2 grid sa mobile */
    gap: 10px;
  }
  .qr-grid-wrapper {
    grid-template-columns: 1fr; /* Isang QR card kada linya sa mobile */
  }
}

/* ═══════════════════════════════════════════════════
   CUSTOM CONFIRM MODAL
   ═══════════════════════════════════════════════════ */
.custom-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

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

.custom-modal {
  background: var(--panel);
  border: 1px solid var(--border-2);
  border-radius: 16px;
  padding: 24px;
  width: 90%;
  max-width: 400px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
  transform: translateY(20px) scale(0.95);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.custom-modal h3 {
  font-size: 18px;
  color: var(--text);
  margin-bottom: 8px;
  font-weight: 700;
}

.custom-modal p {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 24px;
  line-height: 1.5;
}

.custom-modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.custom-modal-actions .btn {
  padding: 10px 20px;
  font-size: 13.5px;
  font-weight: 600;
  border-radius: 8px;
  flex: 1;
}
