/* ==========================================================================
   Liquid Glass CSS Design System for Income Management Admin Dashboard
   ========================================================================== */

:root {
  /* HSL Color Palette */
  --bg-dark: #070913;
  --panel-bg: rgba(18, 22, 46, 0.45);
  --panel-bg-hover: rgba(26, 32, 66, 0.6);
  --border-light: rgba(255, 255, 255, 0.12);
  --border-glow: rgba(108, 140, 255, 0.3);
  
  --text-main: #f1f3f9;
  --text-muted: #8b95c9;
  
  --primary-glow: #6c8cff;
  --primary-dark: #3f60e6;
  
  --success: #10b981;
  --success-glow: rgba(16, 185, 129, 0.2);
  
  --danger: #ef4444;
  --danger-glow: rgba(239, 68, 68, 0.2);
  --warning: #f59e0b;
  --table-body-bg: #080b18;
  --table-head-bg: rgba(18, 22, 46, 0.72);
  --table-row-hover-bg: #0d1124;
  --table-sticky-bg: var(--table-body-bg);
  --table-sticky-head-bg: var(--table-head-bg);
  --table-sticky-shadow: 10px 0 18px -16px rgba(0, 0, 0, 0.7);
  --table-sticky-head-shadow: 10px 0 18px -16px rgba(0, 0, 0, 0.7);
  
  /* Glassmorphism properties */
  --glass-blur: blur(20px);
  --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  --card-border: 1px solid var(--border-light);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Outfit', 'Plus Jakarta Sans', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* --- Decorative Radial Glow Blobs (Backdrop) --- */
.bg-blob {
  position: fixed;
  border-radius: 50%;
  filter: blur(140px);
  z-index: -1;
  opacity: 0.45;
  pointer-events: none;
  mix-blend-mode: screen;
}

.blob-1 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(108, 140, 255, 0.4) 0%, rgba(63, 96, 230, 0) 70%);
  top: -100px;
  right: -100px;
}

.blob-2 {
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.3) 0%, rgba(99, 102, 241, 0) 70%);
  bottom: -200px;
  left: -200px;
}

.blob-3 {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.2) 0%, rgba(20, 184, 166, 0) 70%);
  top: 40%;
  left: 30%;
}

/* --- Helper Classes --- */
.hidden {
  display: none !important;
}

/* --- Liquid Glass Component Panel --- */
.glass-panel {
  background: var(--panel-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: var(--card-border);
  box-shadow: var(--glass-shadow);
  border-radius: 24px;
  transition: all 0.35s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.glass-panel:hover {
  border-color: var(--border-glow);
  box-shadow: 0 8px 32px 0 rgba(108, 140, 255, 0.08), var(--glass-shadow);
}

/* --- Auth (Login) Screen --- */
.auth-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 20px;
  z-index: 1;
}

.auth-card {
  width: 100%;
  max-width: 440px;
  padding: 40px;
  border-color: rgba(255, 255, 255, 0.15);
}

.auth-header {
  text-align: center;
  margin-bottom: 30px;
}

.logo-glow {
  width: 70px;
  height: 70px;
  background: linear-gradient(135deg, var(--primary-glow), #a78bfa);
  border-radius: 20px;
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 0 auto 16px;
  font-size: 28px;
  color: white;
  box-shadow: 0 0 25px rgba(108, 140, 255, 0.4);
}

.auth-header h2 {
  font-size: 26px;
  font-weight: 600;
  margin-bottom: 6px;
}

.auth-header p {
  color: var(--text-muted);
  font-size: 14px;
}

/* --- Forms & Controls --- */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-weight: 500;
}

.form-group label i {
  margin-right: 4px;
}

input[type="email"],
input[type="password"],
input[type="url"],
input[type="text"],
input[type="number"],
input[type="date"],
textarea,
.glass-select {
  width: 100%;
  padding: 12px 16px;
  padding-right: 42px;
  background-color: rgba(255, 255, 255, 0.05);
  background-image: url("data:image/svg+xml,%3Csvg width='18' height='18' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M6 9L12 15L18 9' stroke='%23E8ECFF' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 18px 18px;
  border: 1px solid var(--border-light);
  border-radius: 14px;
  color: var(--text-main);
  outline: none;
  font-size: 14px;
  transition: all 0.25s ease;
  appearance: none;
  -webkit-appearance: none;
}

input:focus,
textarea:focus,
input[type="date"]:focus,
.glass-select:focus {
  background-color: rgba(255, 255, 255, 0.08);
  border-color: var(--primary-glow);
  box-shadow: 0 0 12px rgba(108, 140, 255, 0.2);
}

.glass-select option {
  background: #f8fafc;
  color: #0f172a;
}

.glass-select option:checked {
  background: #bfdbfe;
  color: #0f172a;
}

.glass-select option:disabled {
  color: #64748b;
}

.glass-select.compact {
  min-width: 190px;
  height: 44px;
  padding-top: 9px;
  padding-bottom: 9px;
  font-size: 13px;
}

.accordion-toggle {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
  margin-bottom: 12px;
}

.accordion-toggle:hover {
  color: var(--text-main);
}

.config-fields {
  background: rgba(0, 0, 0, 0.2);
  padding: 16px;
  border-radius: 16px;
  margin-bottom: 20px;
  border: 1px dashed var(--border-light);
  animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

.error-message {
  padding: 12px 16px;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
  border-radius: 12px;
  font-size: 13px;
  margin-bottom: 20px;
  animation: shake 0.3s ease-in-out;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

/* --- Buttons --- */
.glow-button {
  background: linear-gradient(135deg, var(--primary-glow), var(--primary-dark));
  border: none;
  border-radius: 14px;
  color: white;
  padding: 14px 24px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  width: 100%;
  transition: all 0.25s ease;
  box-shadow: 0 4px 15px rgba(108, 140, 255, 0.3);
}

.glow-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(108, 140, 255, 0.5);
  filter: brightness(1.1);
}

.glow-button:active {
  transform: translateY(0);
}

.glow-button.small {
  padding: 8px 16px;
  font-size: 13px;
  border-radius: 10px;
  width: auto;
}

.glass-button {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-light);
  border-radius: 14px;
  color: var(--text-main);
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  transition: all 0.25s ease;
}

.glass-button:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.3);
}

.glass-button.small {
  padding: 8px 16px;
  font-size: 13px;
  border-radius: 10px;
}

.glass-button.secondary {
  border-color: var(--border-glow);
}

.glass-button.danger {
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.2);
}

.glass-button.danger:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.4);
}

.glass-button.icon-only {
  padding: 12px;
  border-radius: 14px;
}

/* --- Dashboard Screen Layout --- */
.dashboard-container {
  max-width: 1240px;
  margin: 0 auto;
  padding: 24px 20px 80px;
}

/* Navbar */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 28px;
  margin-bottom: 28px;
  border-radius: 20px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
}

.logo i {
  color: var(--primary-glow);
  filter: drop-shadow(0 0 8px var(--primary-glow));
}

.nav-exchange-rate {
  color: var(--text-muted);
  font-size: 13px;
  margin-left: 8px;
  padding-left: 16px;
  border-left: 1px solid rgba(255, 255, 255, 0.1);
  white-space: nowrap;
}

.nav-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 12px;
}

.play-account-switcher {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 238px;
}

.play-account-switcher i {
  color: var(--primary-glow);
  flex: 0 0 auto;
}

.play-account-switcher.is-hidden {
  display: none;
}

.brand-account-switcher {
  min-width: 230px;
}

.brand-account-select {
  min-width: 230px;
  height: 48px;
  padding: 10px 44px 10px 18px;
  border-color: rgba(108, 140, 255, 0.42);
  background-color: rgba(255, 255, 255, 0.07);
  color: var(--text-primary);
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 10px 28px rgba(25, 35, 85, 0.2);
  -webkit-text-fill-color: var(--text-primary);
}

.brand-account-select:hover {
  background-color: rgba(108, 140, 255, 0.12);
  border-color: var(--primary-glow);
}

@media (max-width: 760px) {
  .navbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 14px;
  }

  .logo {
    flex-wrap: wrap;
    width: 100%;
  }

  .brand-account-switcher,
  .brand-account-select {
    min-width: min(280px, calc(100vw - 104px));
  }

  .nav-exchange-rate {
    width: 100%;
    margin-left: 0;
    padding-left: 0;
    border-left: none;
  }

  .nav-right {
    width: 100%;
    justify-content: flex-end;
  }

  .nav-right .glass-button span {
    display: none;
  }
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.is-hidden {
  display: none !important;
}

.kpi-card {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 24px;
}

.earnings-month-card {
  width: 100%;
  min-height: 106px;
  position: relative;
  overflow: hidden;
}

.earnings-kpi-info,
.earnings-month-card .kpi-icon {
  position: relative;
  z-index: 1;
}

.earnings-chart-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.kpi-icon {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 22px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-light);
}

.kpi-icon.color-blue {
  color: var(--primary-glow);
  border-color: rgba(108, 140, 255, 0.2);
  box-shadow: 0 0 15px rgba(108, 140, 255, 0.15);
}

.kpi-icon.color-green {
  color: var(--success);
  border-color: rgba(16, 185, 129, 0.2);
  box-shadow: 0 0 15px rgba(16, 185, 129, 0.15);
}

.kpi-icon.color-purple {
  color: #a78bfa;
  border-color: rgba(167, 139, 250, 0.2);
  box-shadow: 0 0 15px rgba(167, 139, 250, 0.15);
}

.kpi-icon.color-orange {
  color: var(--warning);
  border-color: rgba(245, 158, 11, 0.2);
  box-shadow: 0 0 15px rgba(245, 158, 11, 0.15);
}

.kpi-info {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.kpi-label {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 4px;
  font-weight: 500;
}

.kpi-val {
  font-size: 24px;
  font-weight: 700;
}

.kpi-val.kpi-counting {
  color: var(--success);
  text-shadow: 0 0 18px rgba(16, 185, 129, 0.28);
}

.kpi-card.kpi-live-pulse {
  animation: kpiLivePulse 760ms ease-out;
}

@keyframes kpiLivePulse {
  0% {
    border-color: rgba(16, 185, 129, 0.66);
    box-shadow: var(--glass-shadow), 0 0 0 0 rgba(16, 185, 129, 0.34);
  }
  58% {
    border-color: rgba(16, 185, 129, 0.34);
    box-shadow: var(--glass-shadow), 0 0 0 12px rgba(16, 185, 129, 0);
  }
  100% {
    border-color: var(--border-light);
    box-shadow: var(--glass-shadow), 0 0 0 0 rgba(16, 185, 129, 0);
  }
}

/* Analytics Row */
.analytics-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(260px, 1fr));
  gap: 24px;
  margin-bottom: 28px;
}

@media (max-width: 1180px) {
  .analytics-row {
    grid-template-columns: repeat(2, minmax(260px, 1fr));
  }
}

@media (max-width: 720px) {
  .analytics-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .monthly-revenue-box .panel-header,
  .top-apps-box .panel-header,
  .top-players-box .panel-header {
    flex-direction: column;
    gap: 12px;
  }

  .top-apps-controls,
  .top-apps-controls .glass-select,
  .top-players-controls,
  .top-players-controls .glass-select {
    width: 100%;
  }

  .monthly-chart-wrapper {
    height: 280px;
    min-height: 260px;
  }
}

.data-section {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.panel-header h4 {
  font-size: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-header h4 i {
  color: var(--primary-glow);
}

.chart-wrapper {
  position: relative;
  height: 320px;
  width: 100%;
}

.monthly-revenue-box,
.top-apps-box,
.top-players-box {
  padding: 24px;
  display: flex;
  flex-direction: column;
}

.monthly-revenue-box {
  min-height: 392px;
}

.top-apps-box .panel-header,
.monthly-revenue-box .panel-header,
.top-players-box .panel-header {
  align-items: flex-start;
}

.monthly-chart-wrapper {
  position: relative;
  width: 100%;
  height: 320px;
  min-height: 280px;
  flex: 1 1 auto;
}

#top-apps-sync-info {
  line-height: 1.4;
}

.top-apps-controls,
.top-players-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: nowrap;
  min-width: 132px;
  position: relative;
}

.top-apps-controls .glass-select,
.top-players-controls .glass-select {
  width: 132px;
  min-height: 40px;
  padding: 9px 38px 9px 12px;
  background-position: right 12px center;
  border-radius: 12px;
}

.glass-icon-btn {
  width: 42px;
  min-width: 42px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.glass-icon-btn:hover,
.glass-icon-btn.is-active {
  border-color: rgba(111, 143, 255, 0.78);
  background: rgba(111, 143, 255, 0.18);
  color: var(--primary-glow);
}

.range-toggle-btn i {
  font-size: 16px;
}

.custom-range-controls {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 8px;
  width: max-content;
  padding: 10px;
  border: 1px solid rgba(111, 143, 255, 0.38);
  border-radius: 16px;
  background: rgba(18, 23, 42, 0.96);
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.34), 0 0 0 1px rgba(255, 255, 255, 0.05) inset;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.custom-range-controls.hidden {
  display: none !important;
}

.glass-date {
  width: 136px;
  min-height: 40px;
  padding: 9px 10px;
  border-radius: 12px;
  color-scheme: dark;
}

.range-separator {
  color: var(--text-muted);
  font-size: 13px;
}

.range-apply-btn {
  width: 40px;
  min-width: 40px;
}

@media (max-width: 560px) {
  .top-apps-controls,
  .top-players-controls,
  .glass-date {
    width: 100%;
  }

  .top-apps-controls .glass-select,
  .top-players-controls .glass-select {
    flex: 1 1 calc(100% - 50px);
    width: auto;
  }

  .glass-icon-btn {
    flex: 0 0 42px;
  }

  .custom-range-controls {
    left: 0;
    right: 0;
    width: auto;
    flex-wrap: wrap;
    justify-content: stretch;
  }

  .custom-range-controls .glass-date {
    flex: 1 1 128px;
    width: auto;
  }

  .range-separator {
    flex: 0 0 auto;
  }

  .range-apply-btn {
    flex: 0 0 42px;
  }
}

.top-apps-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  max-height: 320px;
  padding-right: 4px;
}

.top-revenue-section {
  margin-bottom: 28px;
}

.play-revenue-box {
  padding: 24px;
}

.play-revenue-box .panel-header {
  align-items: flex-start;
  margin-bottom: 18px;
}

.play-revenue-list {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.play-revenue-card {
  padding: 18px 0 0;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
  overflow: visible;
}

.play-app-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 0 18px 18px;
}

.play-app-identity {
  min-width: 0;
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.play-app-logo,
.play-app-fallback {
  width: 56px;
  height: 56px;
  border-radius: 8px;
  flex: 0 0 56px;
}

.play-app-logo {
  display: block;
  object-fit: cover;
}

.play-app-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(108, 140, 255, 0.14);
  border: 1px solid var(--border-light);
  color: var(--primary-glow);
  font-weight: 800;
}

.play-app-title-wrap {
  min-width: 0;
}

.play-app-title-wrap h5 {
  margin: 5px 0 6px;
  font-size: 18px;
  line-height: 1.2;
  color: var(--text-main);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.play-country-count {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 4px 9px;
  border: 1px solid rgba(105, 132, 255, 0.35);
  border-radius: 999px;
  background: rgba(105, 132, 255, 0.12);
  color: var(--primary-glow);
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

.play-app-title-wrap p {
  margin: 0;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.play-view-link {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--primary-glow);
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
  padding: 8px 0;
}

.play-view-link:hover {
  color: #ffffff;
}

.play-metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.play-metric {
  min-width: 0;
  padding: 18px;
  border-left: 1px solid rgba(255, 255, 255, 0.12);
}

.play-metric:first-child {
  border-left: 0;
}

.play-metric-label {
  position: relative;
  display: inline-flex;
  width: fit-content;
  max-width: 100%;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.3;
  border-bottom: 1px dotted rgba(217, 224, 255, 0.55);
  cursor: help;
}

.play-metric-label::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 0;
  top: calc(100% + 10px);
  z-index: 80;
  width: min(330px, calc(100vw - 48px));
  padding: 12px 14px;
  border-radius: 8px;
  background: rgba(248, 250, 252, 0.98);
  color: #1f2937;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.35);
  font-size: 13px;
  line-height: 1.45;
  white-space: normal;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.play-metric-label:hover::after,
.play-metric-label:focus-visible::after {
  opacity: 1;
  transform: translateY(0);
}

.play-metric strong {
  display: block;
  margin-top: 8px;
  color: var(--text-main);
  font-size: 24px;
  line-height: 1.1;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.play-metric-source {
  display: block;
  margin-top: 7px;
  color: rgba(166, 178, 224, 0.86);
  font-size: 11px;
  line-height: 1.35;
}

.play-metric.is-revenue strong {
  color: var(--success);
}

.play-delta {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 8px;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.35;
}

.play-delta i {
  width: 16px;
  height: 16px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
}

.play-delta.is-up {
  color: var(--success);
}

.play-delta.is-up i {
  background: rgba(16, 185, 129, 0.16);
}

.play-delta.is-down {
  color: var(--danger);
}

.play-delta.is-down i {
  background: rgba(239, 68, 68, 0.16);
}

.play-delta.is-flat i,
.play-delta.is-muted i {
  background: rgba(255, 255, 255, 0.1);
}

@media (max-width: 980px) {
  .play-metrics-grid {
    grid-template-columns: repeat(2, minmax(150px, 1fr));
  }

  .play-metric:nth-child(odd) {
    border-left: 0;
  }

  .play-metric:nth-child(n + 3) {
    border-top: 1px solid rgba(255, 255, 255, 0.12);
  }
}

@media (max-width: 560px) {
  .play-revenue-box {
    padding: 18px;
  }

  .play-revenue-card {
    padding-top: 14px;
  }

  .play-app-header {
    padding: 0 14px 14px;
    gap: 12px;
  }

  .play-app-logo,
  .play-app-fallback {
    width: 44px;
    height: 44px;
    flex-basis: 44px;
  }

  .play-app-title-wrap h5 {
    margin-top: 1px;
    font-size: 16px;
  }

  .play-country-count {
    min-height: 22px;
    padding: 4px 8px;
    font-size: 12px;
  }

  .play-app-title-wrap p {
    font-size: 12px;
  }

  .play-view-link {
    align-self: flex-start;
    width: 34px;
    height: 34px;
    justify-content: center;
    padding: 0;
    overflow: hidden;
    white-space: nowrap;
    font-size: 0;
  }

  .play-view-link i {
    margin-left: 0;
    font-size: 13px;
  }

  .play-metrics-grid {
    grid-template-columns: 1fr;
  }

  .play-metric,
  .play-metric:nth-child(odd) {
    border-left: 0;
  }

  .play-metric:nth-child(n + 2) {
    border-top: 1px solid rgba(255, 255, 255, 0.12);
  }

  .play-metric {
    padding: 14px;
  }
}

/* Top App Items */
.app-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-light);
  border-radius: 14px;
}

.app-item-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.app-badge {
  width: 32px;
  height: 32px;
  background: var(--panel-bg-hover);
  border-radius: 10px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-weight: 600;
  font-size: 13px;
  color: var(--primary-glow);
  border: 1px solid var(--border-light);
}

.top-app-logo,
.top-app-fallback {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  flex: 0 0 32px;
}

.top-app-logo {
  display: block;
  object-fit: cover;
}

.top-app-fallback {
  display: flex;
  justify-content: center;
  align-items: center;
  background: rgba(108, 140, 255, 0.14);
  border: 1px solid var(--border-light);
  color: var(--primary-glow);
  font-size: 14px;
  font-weight: 700;
}

.app-item-meta {
  min-width: 0;
}

.app-name {
  display: block;
  font-size: 14px;
  font-weight: 500;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-pkg {
  font-size: 11px;
  color: var(--text-muted);
  display: block;
}

.app-revenue {
  flex: 0 0 auto;
  font-weight: 600;
  font-size: 14px;
}

.loading-placeholder {
  text-align: center;
  padding: 40px 0;
  color: var(--text-muted);
  font-size: 14px;
}

.skeleton-line,
.skeleton-block {
  display: block;
  border-radius: 999px;
  background:
    linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.07) 0%,
      rgba(111, 143, 255, 0.2) 42%,
      rgba(255, 255, 255, 0.08) 78%
    );
  background-size: 240% 100%;
  animation: skeleton-shimmer 1.35s ease-in-out infinite;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.035);
}

.skeleton-block {
  border-radius: 8px;
}

.skeleton-label {
  height: 13px;
}

.skeleton-value {
  height: 42px;
  max-width: 220px;
  margin-top: 5px;
}

.skeleton-subline {
  height: 12px;
  margin-top: 8px;
}

.kpi-card .skeleton-value {
  height: 29px;
  margin-top: 0;
  max-width: 160px;
}

.kpi-card .skeleton-subline {
  height: 14px;
  margin-top: 0;
}

.skeleton-title {
  height: 18px;
  max-width: 100%;
}

.skeleton-metric {
  height: 30px;
  margin-top: 10px;
}

.skeleton-cell {
  height: 14px;
  margin-left: auto;
}

.skeleton-link,
.skeleton-revenue {
  height: 18px;
}

.skeleton-logo {
  flex-shrink: 0;
}

.skeleton-badge {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  flex: 0 0 32px;
}

.skeleton-copy {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.skeleton-card {
  pointer-events: none;
}

.skeleton-table-row td {
  height: 62px;
}

.skeleton-table-row:hover td,
.skeleton-table-row:hover td:first-child {
  background: var(--table-body-bg);
}

.monthly-chart-wrapper {
  position: relative;
}

.chart-skeleton {
  position: absolute;
  inset: 0;
  z-index: 2;
  border-radius: 14px;
  background: rgba(8, 12, 28, 0.66);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: stretch;
  padding: 26px 22px 22px;
}

.chart-skeleton-bars {
  flex: 1;
  display: flex;
  align-items: flex-end;
  gap: 14px;
  min-height: 160px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.chart-skeleton-bars span {
  flex: 1;
  min-width: 18px;
  border-radius: 8px 8px 0 0;
  background:
    linear-gradient(
      180deg,
      rgba(111, 143, 255, 0.42),
      rgba(22, 163, 190, 0.16)
    );
  opacity: 0.82;
  animation: skeleton-bar-pulse 1.4s ease-in-out infinite;
}

.chart-skeleton-bars span:nth-child(2n) {
  animation-delay: 0.18s;
}

.chart-skeleton-bars span:nth-child(3n) {
  animation-delay: 0.34s;
}

@keyframes skeleton-shimmer {
  0% { background-position: 120% 0; }
  100% { background-position: -120% 0; }
}

@keyframes skeleton-bar-pulse {
  0%, 100% { opacity: 0.46; transform: scaleY(0.96); }
  50% { opacity: 0.9; transform: scaleY(1); }
}

@media (prefers-reduced-motion: reduce) {
  .skeleton-line,
  .skeleton-block,
  .chart-skeleton-bars span {
    animation: none;
  }
}

/* --- Table Card --- */
.table-card {
  padding: 24px;
}

.table-actions {
  flex-wrap: wrap;
  gap: 16px;
}

.table-title {
  display: flex;
  flex-direction: column;
}

.subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.table-filters {
  display: flex;
  gap: 12px;
}

.search-input-wrapper {
  position: relative;
  width: 200px;
}

.search-input-wrapper i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 14px;
}

.search-input-wrapper input {
  padding-left: 38px;
}

.table-wrapper {
  overflow-x: auto;
  margin-top: 10px;
  border-radius: 16px;
  border: 1px solid var(--border-light);
  background: var(--table-body-bg);
}

.table-app-cell {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 230px;
}

.table-app-logo,
.table-app-fallback {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  flex: 0 0 34px;
}

.table-app-logo {
  object-fit: cover;
  display: block;
}

.table-app-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(108, 140, 255, 0.14);
  border: 1px solid var(--border-light);
  color: var(--primary-glow);
  font-weight: 700;
  font-size: 13px;
}

.table-app-meta {
  min-width: 0;
}

.table-app-name {
  font-weight: 700;
  color: var(--text-main);
}

.table-app-pkg {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 2px;
}

.table-app-mobile-meta-col,
.table-app-mobile-total-label {
  display: none;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  text-align: right;
  font-size: 14px;
}

th, td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-light);
  white-space: nowrap;
}

td {
  background: var(--table-body-bg);
}

th {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--table-head-bg);
}

th:first-child, td:first-child {
  text-align: left;
  position: sticky;
  left: 0;
  background: var(--table-sticky-bg);
  font-weight: 500;
  z-index: 4;
  border-right: 1px solid var(--border-light);
  background-clip: padding-box;
  box-shadow: var(--table-sticky-shadow);
}

th:first-child {
  background: var(--table-sticky-head-bg);
  z-index: 6;
  box-shadow: var(--table-sticky-head-shadow);
}

tr:hover td {
  background: var(--table-row-hover-bg);
}

.login-log-time {
  font-weight: 600;
}

.login-log-sub {
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 11px;
}

.login-log-ip {
  color: var(--primary-glow);
  background: rgba(108, 140, 255, 0.1);
  border: 1px solid rgba(108, 140, 255, 0.18);
  border-radius: 7px;
  padding: 4px 7px;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
}

.login-log-device {
  color: var(--text-muted);
}

.login-log-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 118px;
  gap: 7px;
  color: var(--text-main);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  padding: 7px 10px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
}

.login-log-status i {
  font-size: 12px;
}

.login-log-status.is-online {
  color: #34d399;
  background: rgba(16, 185, 129, 0.14);
  border-color: rgba(52, 211, 153, 0.35);
  box-shadow: 0 0 0 1px rgba(16, 185, 129, 0.08), 0 0 18px rgba(16, 185, 129, 0.08);
}

.login-log-status.is-login {
  color: #7dd3fc;
  background: rgba(14, 165, 233, 0.13);
  border-color: rgba(125, 211, 252, 0.32);
}

.login-log-status.is-reload {
  color: #fbbf24;
  background: rgba(245, 158, 11, 0.14);
  border-color: rgba(251, 191, 36, 0.34);
}

.login-log-status.is-refresh-token {
  color: #38bdf8;
  background: rgba(14, 165, 233, 0.14);
  border-color: rgba(56, 189, 248, 0.34);
}

.login-log-status.is-recent {
  color: #c4b5fd;
  background: rgba(139, 92, 246, 0.13);
  border-color: rgba(196, 181, 253, 0.3);
}

.traffic-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(135px, 1fr));
  gap: 10px;
  margin: 12px 0 18px;
}

.traffic-show-more,
.login-log-show-more,
.telegram-log-show-more {
  min-width: 132px;
  justify-content: center;
}

.traffic-metric {
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.035);
}

.traffic-metric span {
  display: block;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
}

.traffic-metric strong {
  display: block;
  margin-top: 5px;
  color: var(--text-main);
  font-size: 22px;
}

.traffic-email {
  font-weight: 600;
}

.traffic-event {
  margin-top: 2px;
  color: #7dd3fc;
  font-size: 11px;
  font-weight: 600;
}

.traffic-page,
.traffic-referrer {
  display: inline-block;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: bottom;
  white-space: nowrap;
}

.traffic-referrer {
  color: var(--text-muted);
}

body.traffic-detail-page .dashboard-container,
body.login-history-detail-page .dashboard-container,
body.telegram-detail-page .dashboard-container {
  padding-bottom: 44px;
}

body.traffic-detail-page .traffic-detail-section,
body.login-history-detail-page .audit-detail-section,
body.telegram-detail-page .audit-detail-section {
  margin-top: 28px;
}

body.traffic-detail-page #traffic-card,
body.login-history-detail-page #login-log-card,
body.telegram-detail-page #telegram-log-card {
  min-height: calc(100vh - 180px);
}

body.traffic-detail-page .traffic-page,
body.traffic-detail-page .traffic-referrer {
  max-width: 420px;
}

.telegram-log-user {
  font-weight: 600;
}

.telegram-log-sub {
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 11px;
}

.telegram-log-chat {
  color: var(--text-muted);
}

.telegram-log-command {
  display: inline-flex;
  align-items: center;
  color: #34d399;
  background: rgba(16, 185, 129, 0.13);
  border: 1px solid rgba(52, 211, 153, 0.28);
  border-radius: 999px;
  padding: 4px 8px;
  font-weight: 700;
  white-space: nowrap;
}

.telegram-log-message {
  color: var(--text-main);
}

tr:hover td:first-child {
  background: var(--table-row-hover-bg);
}

.total-row {
  font-weight: 700;
  background: rgba(108, 140, 255, 0.05);
}

.total-row td {
  border-top: 2px solid var(--border-light);
  background: rgba(18, 22, 46, 0.8) !important;
}

@media (max-width: 980px) {
  #earnings-table .table-app-mobile-meta-col {
    display: table-cell;
    min-width: 172px;
    max-width: 172px;
    text-align: left;
  }

  #earnings-table .table-app-sticky-head,
  #earnings-table .table-app-sticky-cell {
    position: sticky;
    left: 0;
    z-index: 7;
    width: 64px;
    min-width: 64px;
    max-width: 64px;
    padding-left: 12px;
    padding-right: 12px;
    text-align: center;
    overflow: hidden;
    background: var(--table-sticky-bg) !important;
    background-clip: padding-box;
    box-shadow: var(--table-sticky-shadow);
  }

  #earnings-table .table-app-sticky-head {
    z-index: 9;
    background: var(--table-sticky-head-bg) !important;
    box-shadow: var(--table-sticky-head-shadow);
  }

  #earnings-table tr:hover .table-app-sticky-cell {
    background: var(--table-row-hover-bg) !important;
  }

  #earnings-table .table-app-sticky-head .table-app-desktop-label,
  #earnings-table .table-app-sticky-cell .table-app-meta,
  #earnings-table .table-app-sticky-cell .table-app-desktop-label {
    display: none;
  }

  #earnings-table .table-app-sticky-cell .table-app-cell {
    min-width: 0;
    justify-content: center;
    gap: 0;
  }

  #earnings-table .table-app-mobile-total-label {
    display: inline;
  }

  #earnings-table .table-app-mobile-meta-col .table-app-name,
  #earnings-table .table-app-mobile-meta-col .table-app-pkg {
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

@media (max-width: 640px) {
  #rtdn-table .rtdn-date-col {
    position: sticky;
    left: 0;
    z-index: 6;
    width: 112px;
    min-width: 112px;
    max-width: 112px;
    padding-left: 12px;
    padding-right: 10px;
    overflow: hidden;
    background: var(--table-sticky-bg) !important;
    background-clip: padding-box;
    box-shadow: none;
  }

  #rtdn-table .rtdn-app-col {
    position: sticky;
    left: 112px;
    z-index: 7;
    width: 54px;
    min-width: 54px;
    max-width: 54px;
    padding-left: 10px;
    padding-right: 10px;
    text-align: center;
    overflow: hidden;
    background: var(--table-sticky-bg) !important;
    background-clip: padding-box;
    border-right: 1px solid var(--border-light);
    box-shadow: var(--table-sticky-shadow);
  }

  #rtdn-table th.rtdn-date-col,
  #rtdn-table th.rtdn-app-col {
    z-index: 9;
    background: var(--table-sticky-head-bg) !important;
  }

  #rtdn-table th.rtdn-app-col {
    box-shadow: var(--table-sticky-head-shadow);
  }

  #rtdn-table .rtdn-app-logo,
  #rtdn-table .rtdn-app-fallback {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    margin: 0 auto;
  }

  #rtdn-table .rtdn-date-main {
    font-size: 14px;
    line-height: 1.18;
  }

  #rtdn-table .rtdn-sub {
    font-size: 10px;
  }

  #earnings-table .table-app-mobile-meta-col {
    display: table-cell;
    min-width: 172px;
    max-width: 172px;
    text-align: left;
  }

  #earnings-table .table-app-sticky-head,
  #earnings-table .table-app-sticky-cell {
    position: sticky;
    left: 0;
    z-index: 7;
    width: 64px;
    min-width: 64px;
    max-width: 64px;
    padding-left: 12px;
    padding-right: 12px;
    text-align: center;
    overflow: hidden;
    background: var(--table-sticky-bg) !important;
    background-clip: padding-box;
    box-shadow: var(--table-sticky-shadow);
  }

  #earnings-table .table-app-sticky-head {
    z-index: 9;
    background: var(--table-sticky-head-bg) !important;
    box-shadow: var(--table-sticky-head-shadow);
  }

  #earnings-table tr:hover .table-app-sticky-cell,
  #rtdn-table tr:hover .rtdn-date-col,
  #rtdn-table tr:hover .rtdn-app-col {
    background: var(--table-row-hover-bg) !important;
  }

  #earnings-table .table-app-sticky-head .table-app-desktop-label,
  #earnings-table .table-app-sticky-cell .table-app-meta,
  #earnings-table .table-app-sticky-cell .table-app-desktop-label {
    display: none;
  }

  #earnings-table .table-app-sticky-cell .table-app-cell {
    min-width: 0;
    justify-content: center;
    gap: 0;
  }

  #earnings-table .table-app-mobile-total-label {
    display: inline;
  }

  #earnings-table .table-app-mobile-meta-col .table-app-name,
  #earnings-table .table-app-mobile-meta-col .table-app-pkg {
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

.val-pos {
  color: var(--success);
}

.val-neg {
  color: var(--danger);
}

.val-zero {
  color: var(--text-muted);
  opacity: 0.4;
}

.estimate-marker {
  display: inline-block;
  padding: 2px 6px;
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: #f59e0b;
  border-radius: 6px;
  font-size: 9px;
  font-weight: 600;
  margin-left: 6px;
  vertical-align: middle;
}

.action-cell {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 10px 18px;
}

.btn-icon {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.btn-icon:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
}

.btn-icon.edit:hover {
  color: var(--primary-glow);
}

.btn-icon.delete:hover {
  color: var(--danger);
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.1);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb {
  background: var(--border-light);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--border-glow);
}

/* --- Modals --- */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(5, 7, 18, 0.8);
  backdrop-filter: blur(12px);
  z-index: 100;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.modal-card {
  width: 100%;
  max-width: 520px;
  padding: 32px;
  animation: zoomIn 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

@keyframes zoomIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.modal-header h4 {
  font-size: 18px;
  font-weight: 600;
}

.btn-close-modal {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
  transition: color 0.2s ease;
}

.btn-close-modal:hover {
  color: var(--text-main);
}

.app-select-wrapper {
  display: flex;
  gap: 10px;
}

.new-app-subform {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-light);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 20px;
}

.subform-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 28px;
}

.modal-footer .glow-button {
  width: auto;
}

/* --- Sync Loader overlay --- */
.sync-card {
  text-align: center;
  max-width: 440px;
  padding: 40px;
}

.sync-loader {
  position: relative;
  width: min(100%, 320px);
  margin: 0 auto 24px;
}

.sync-progress {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
}

.sync-progress-value {
  color: var(--primary-glow);
  font-size: 34px;
  font-weight: 800;
  line-height: 1;
  text-shadow: 0 0 18px rgba(108, 140, 255, 0.45);
}

.sync-progress-track {
  position: relative;
  width: 100%;
  height: 16px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.11);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    inset 0 -8px 18px rgba(0, 0, 0, 0.28),
    0 0 0 1px rgba(108, 140, 255, 0.08);
}

.sync-progress-fill {
  position: relative;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary-dark), var(--primary-glow), #9fb3ff);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.42),
    0 0 18px rgba(108, 140, 255, 0.65);
  transition: width 0.35s ease, background 0.2s ease;
}

.sync-progress-fill::after {
  content: "";
  position: absolute;
  inset: 2px 3px auto 3px;
  height: 4px;
  border-radius: inherit;
  background: rgba(255, 255, 255, 0.36);
  opacity: 0.7;
}

.sync-progress-fill.is-complete {
  background: linear-gradient(90deg, #22c55e, #34d399);
}

.sync-progress-fill.is-error {
  background: linear-gradient(90deg, #ef4444, #f87171);
}

.sync-logs {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 12px;
  font-family: monospace;
  font-size: 11px;
  text-align: left;
  max-height: 150px;
  overflow-y: auto;
  margin: 20px 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

#btn-close-sync-overlay {
  width: max-content;
  min-width: 96px;
  margin: 6px 0 0 auto;
}

.log-line {
  color: var(--text-muted);
  line-height: 1.4;
}

.log-line.text-blue { color: var(--primary-glow); }
.log-line.text-green { color: var(--success); }
.log-line.text-red { color: #fca5a5; }
.log-line.text-yellow { color: #fde047; }
