/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: #f0f2f5; color: #333; }

/* --- Login page --- */
.login-page {
  display: flex; align-items: center; justify-content: center; min-height: 100vh;
}
.login-card {
  background: #fff; padding: 40px; border-radius: 8px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.1); width: 360px; text-align: center;
}
.login-card h1 { color: #052049; margin-bottom: 4px; }
.login-card .subtitle { color: #666; font-size: 14px; margin-bottom: 24px; }
.login-card input {
  width: 100%; padding: 10px 12px; border: 1px solid #ddd;
  border-radius: 4px; font-size: 14px; margin-bottom: 12px;
}
.login-card button {
  width: 100%; padding: 10px; background: #052049; color: #fff;
  border: none; border-radius: 4px; font-size: 14px; cursor: pointer;
}
.login-card button:hover { background: #0a3060; }
.error { color: #c0392b; font-size: 13px; margin-top: 8px; }
.divider {
  margin: 16px 0; color: #999; font-size: 13px;
  display: flex; align-items: center; gap: 12px;
}
.divider::before, .divider::after {
  content: ''; flex: 1; border-top: 1px solid #ddd;
}
.okta-btn {
  display: block; width: 100%; padding: 10px; text-align: center;
  background: #fff; color: #052049; border: 2px solid #052049;
  border-radius: 4px; font-size: 14px; text-decoration: none; cursor: pointer;
}
.okta-btn:hover { background: #f0f2f5; }

/* --- Entry page --- */
.topbar {
  background: #052049; color: #fff; padding: 12px 24px;
  display: flex; justify-content: space-between; align-items: center;
}
.brand { font-weight: bold; font-size: 16px; }
.user-info { font-size: 13px; }
.user-info a { color: #4fc3f7; text-decoration: none; }

.entry-page { min-height: 100vh; }
.entry-card {
  max-width: 700px; margin: 40px auto; background: #fff;
  padding: 32px; border-radius: 8px; box-shadow: 0 1px 6px rgba(0,0,0,0.08);
}
.entry-card h2 { margin-bottom: 16px; color: #333; font-size: 18px; }
.url-row { display: flex; gap: 8px; margin-bottom: 12px; }
.url-row input { flex: 1; padding: 10px 12px; border: 1px solid #ddd; border-radius: 4px; font-size: 14px; }
.url-row button {
  padding: 10px 20px; background: #052049; color: #fff;
  border: none; border-radius: 4px; font-size: 14px; cursor: pointer; white-space: nowrap;
}
.url-row button:hover { background: #0a3060; }
.date-row { display: flex; gap: 16px; align-items: center; }
.recent { margin-top: 16px; font-size: 13px; color: #999; }
.recent a { color: #052049; text-decoration: underline; cursor: pointer; }

/* --- Overlay page --- */
.overlay-page { min-height: 100vh; background: #1a1a2e; }
.overlay-topbar {
  background: #052049; color: #fff; padding: 10px 16px;
  display: flex; justify-content: space-between; align-items: center; font-size: 13px;
}
.overlay-left { display: flex; gap: 16px; align-items: center; }
.overlay-url { color: #aaa; max-width: 400px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.overlay-right { display: flex; gap: 12px; align-items: center; }
.overlay-right a { color: #4fc3f7; text-decoration: none; }
.separator { color: #555; }

.legend {
  background: #0d1b2a; padding: 8px 16px;
  display: flex; gap: 8px; align-items: center; font-size: 12px; color: #aaa;
}
.gradient-bar {
  width: 80px; height: 10px; border-radius: 4px;
  background: linear-gradient(90deg, #3498db, #2ecc71, #f1c40f, #e67e22, #e74c3c);
}
.legend-spacer { width: 40px; }
.legend-hint { margin-left: auto; }

.error-banner {
  background: #2c1810; color: #e67e22; padding: 10px 16px;
  font-size: 13px; text-align: center;
}

.page-container {
  margin: 12px; background: #fff; border-radius: 4px;
  overflow: auto; max-height: calc(100vh - 120px);
}
.page-container .loading { padding: 40px; text-align: center; color: #999; }
.page-iframe {
  width: 100%; height: calc(100vh - 120px); border: none; display: block;
}

/* --- Tooltip --- */
.tooltip {
  position: absolute; background: #222; color: #fff;
  padding: 10px 14px; border-radius: 6px; font-size: 12px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.4); z-index: 10000;
  pointer-events: none; max-width: 360px;
}
.tooltip-name { font-weight: bold; margin-bottom: 2px; }
.tooltip-url { color: #aaa; font-size: 11px; word-break: break-all; }
.tooltip-region { color: #aaa; font-size: 11px; }
.tooltip-clicks { margin-top: 6px; }
.tooltip-clicks strong { color: #e74c3c; }

/* --- Filter controls --- */
.filters-group {
  background: #f8f9fa; border: 1px solid #e9ecef; border-radius: 6px;
  padding: 12px 14px; margin-top: 14px;
}
.filters-label {
  font-size: 11px; text-transform: uppercase; color: #999;
  font-weight: 600; letter-spacing: 0.5px; margin-bottom: 8px;
}
.filters-row {
  display: flex; gap: 12px; align-items: center; margin-bottom: 6px;
}
.filters-row label { font-size: 12px; color: #666; }
.filters-row input[type="date"] {
  padding: 4px 6px; border: 1px solid #ddd; border-radius: 3px; font-size: 12px;
}
.filter-select {
  padding: 4px 6px; border: 1px solid #ddd; border-radius: 3px;
  font-size: 12px; background: #fff;
}
.compare-row {
  display: flex; gap: 8px; align-items: center;
}
.compare-toggle {
  font-size: 12px; color: #888; white-space: nowrap; cursor: pointer;
}
.compare-row input[type="date"] {
  padding: 4px 6px; border: 1px solid #ddd; border-radius: 3px; font-size: 12px;
}
.compare-row input:disabled {
  opacity: 0.4;
}

/* --- Top pages --- */
.top-pages-card {
  max-width: 700px; margin: 16px auto 40px; background: #fff;
  padding: 24px 32px; border-radius: 8px; box-shadow: 0 1px 6px rgba(0,0,0,0.08);
}
.top-pages-title { font-size: 16px; color: #333; margin-bottom: 10px; }
.path-filter {
  width: 100%; padding: 8px 12px; border: 1px solid #ddd; border-radius: 4px;
  font-size: 13px; background: #fafafa; margin-bottom: 12px;
}
.top-pages-table {
  width: 100%; border-collapse: collapse; font-size: 13px;
}
.top-pages-table th {
  text-align: left; padding: 8px; border-bottom: 2px solid #ddd;
  font-size: 12px; color: #666; text-transform: uppercase;
}
.top-pages-table th.num, .top-pages-table td.num { text-align: right; }
.top-pages-table td { padding: 8px; border-bottom: 1px solid #eee; }
.top-pages-table tbody tr {
  cursor: pointer; transition: background 0.1s;
}
.top-pages-table tbody tr:hover { background: #f0f7ff; }
.top-pages-table .page-link { color: #052049; text-decoration: underline; }
.top-pages-table .top-element { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; color: #555; }
.top-pages-empty { font-size: 13px; color: #999; padding: 16px 0; }

/* --- Overlay device dropdown --- */
.overlay-select {
  background: #1a1a2e; color: #fff; border: 1px solid #555;
  border-radius: 4px; padding: 2px 6px; font-size: 12px;
}
