* { box-sizing: border-box; }
html { min-height: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  padding: 40px 20px;
  font-family: Arial, Helvetica, sans-serif;
  color: #f8fafc;
  background:
    radial-gradient(circle at top right, #1e3a5f 0%, transparent 35%),
    linear-gradient(135deg, #07111f 0%, #0b1b2e 50%, #08111d 100%);
}
.container {
  width: min(100%, 1120px);
  margin: 0 auto;
  padding: 32px;
  background: rgba(15, 23, 42, 0.88);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
}
.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  margin-bottom: 28px;
}
h1 {
  margin: 0 0 8px;
  font-size: clamp(30px, 5vw, 46px);
  line-height: 1.1;
}
.subtitle, .updated { color: #94a3b8; font-size: 14px; }
.updated { white-space: nowrap; }
.login {
  padding: 20px;
  margin-bottom: 24px;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 14px;
}
.login label { display: block; margin-bottom: 10px; font-weight: 700; }
.key-row { display: flex; gap: 10px; }
.login input {
  flex: 1;
  min-width: 0;
  padding: 13px 14px;
  color: #0f172a;
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  font-size: 16px;
  outline: none;
}
.login input:focus {
  border-color: #38bdf8;
  box-shadow: 0 0 0 3px rgba(56,189,248,.18);
}
button {
  padding: 12px 18px;
  color: #fff;
  background: #0284c7;
  border: 0;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}
button:hover { background: #0369a1; }
button:disabled { opacity: .65; cursor: wait; }
.status { min-height: 20px; margin-top: 12px; color: #cbd5e1; font-size: 14px; }
#dashboard { display: none; }
.toolbar {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-bottom: 14px;
}
.secondary-btn {
  padding: 9px 13px;
  color: #cbd5e1;
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.12);
}
.secondary-btn:hover { background: rgba(255,255,255,.12); }
.cards, .kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 14px;
}
.kpi-grid { grid-template-columns: repeat(5, minmax(0,1fr)); margin-bottom: 14px; }
.card, .stats-section {
  padding: 22px;
  background: rgba(255,255,255,.055);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 16px;
}
.card > div:first-child {
  color: #94a3b8;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.number { margin-top: 12px; font-size: 34px; font-weight: 800; color: #fff; }
.stats-section h2 { margin: 0 0 14px; font-size: 21px; }
.wide-section { grid-column: 1 / -1; }
.stats-list { display: grid; gap: 0; }
.stats-row {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255,255,255,.09);
  color: #cbd5e1;
}
.stats-row:last-child { border-bottom: 0; }
.stats-row span { min-width: 0; overflow-wrap: anywhere; }
.stats-row strong { flex: 0 0 auto; color: #fff; }
.stats-empty { padding: 8px 0; color: #94a3b8; }
.trend-section { margin: 0 0 14px; }
.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}
.section-head h2 { margin-bottom: 5px; }
.section-head p { margin: 0; color: #94a3b8; font-size: 13px; }
.range-tabs { display: flex; gap: 6px; }
.range-btn {
  padding: 7px 10px;
  font-size: 12px;
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.1);
}
.range-btn.active { background: #0284c7; }
.chart {
  display: flex;
  align-items: stretch;
  gap: 6px;
  height: 230px;
  margin-top: 22px;
  padding-top: 10px;
  overflow-x: auto;
}
.chart-column {
  flex: 1 0 28px;
  min-width: 28px;
  display: grid;
  grid-template-rows: 20px 1fr 24px;
  align-items: end;
  text-align: center;
}
.chart-value { color: #cbd5e1; font-size: 11px; }
.chart-bar-wrap {
  height: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.chart-bar {
  width: 72%;
  min-height: 4px;
  border-radius: 6px 6px 2px 2px;
  background: linear-gradient(180deg, #38bdf8, #0284c7);
}
.chart-label { padding-top: 6px; color: #94a3b8; font-size: 10px; }
.tracking-note {
  margin-top: 12px;
  padding: 10px 12px;
  color: #94a3b8;
  background: rgba(255,255,255,.04);
  border-radius: 10px;
  font-size: 12px;
}
.recent-wrap { width: 100%; overflow-x: auto; }
.recent-table { width: 100%; border-collapse: collapse; min-width: 900px; }
.recent-table th, .recent-table td {
  padding: 12px 10px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid rgba(255,255,255,.1);
}
.recent-table th {
  color: #94a3b8;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.recent-table td { color: #fff; font-size: 13px; }
.recent-table tbody tr:last-child td { border-bottom: 0; }
.recent-page { max-width: 300px; overflow-wrap: anywhere; }
.recent-empty { color: #94a3b8 !important; text-align: center !important; }

@media (max-width: 980px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 700px) {
  body { padding: 18px 10px; }
  .container { padding: 18px; border-radius: 14px; }
  .page-head { display: block; }
  .updated { margin-top: 10px; }
  .key-row { display: grid; }
  .cards, .kpi-grid { grid-template-columns: 1fr; }
  .wide-section { grid-column: auto; }
  .section-head { display: block; }
  .range-tabs { margin-top: 12px; }
  .toolbar { justify-content: stretch; }
  .toolbar button { flex: 1; }
}

.filter-panel{margin-bottom:14px;padding:18px;background:rgba(255,255,255,.055);border:1px solid rgba(255,255,255,.1);border-radius:16px}
.filter-head{display:flex;justify-content:space-between;gap:18px;align-items:flex-start}
.filter-head h2{margin:0 0 5px;font-size:19px}.filter-head p{margin:0;color:#94a3b8;font-size:13px}
.preset-buttons{display:flex;flex-wrap:wrap;gap:6px}.preset-btn{padding:8px 11px;background:rgba(255,255,255,.07);border:1px solid rgba(255,255,255,.1);font-size:12px}.preset-btn.active{background:#0284c7}
.date-filter{display:flex;flex-wrap:wrap;gap:10px;align-items:end;margin-top:16px}.date-filter label{display:grid;gap:6px;color:#cbd5e1;font-size:12px;font-weight:700}.date-filter input{padding:9px 10px;color:#0f172a;background:#fff;border:1px solid #cbd5e1;border-radius:9px}.period-label{margin-top:12px;color:#94a3b8;font-size:12px}
@media(max-width:700px){.filter-head{display:block}.preset-buttons{margin-top:12px}.date-filter{display:grid;grid-template-columns:1fr 1fr}.date-filter label{grid-column:1/-1}}


/* Analytics V5.1 — active filter indicator */
.preset-btn.active {
  background: #0284c7 !important;
  border-color: #38bdf8 !important;
  box-shadow: 0 0 0 2px rgba(56,189,248,.18);
}


/* Analytics V6.3 — realtime page detail */
#onlinePagesPanel {
  margin-top: 24px;
}
#onlinePagesPanel .section-heading {
  margin-bottom: 14px;
}
#onlinePagesPanel h2 {
  margin-bottom: 6px;
}
#onlinePagesPanel p {
  margin: 0;
  opacity: .72;
}
.stats-list {
  display: grid;
  gap: 10px;
}
.online-page-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 14px 16px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 14px;
  background: rgba(255,255,255,.035);
}
.online-dot {
  color: #38d996;
  font-size: 14px;
}
.online-page-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.empty-state {
  padding: 16px;
  opacity: .7;
  border: 1px dashed rgba(255,255,255,.15);
  border-radius: 14px;
}

/* Analytics V6.4 */
.auto-refresh-badge {
  display: inline-flex;
  align-items: center;
  margin-right: 10px;
  font-size: 12px;
  opacity: .8;
  white-space: nowrap;
}

/* Analytics V6.5 */
#onlineDetailsPanel{margin-top:24px}.online-details-list{display:grid;gap:10px}.online-detail-row{display:grid;grid-template-columns:auto minmax(90px,1.4fr) minmax(110px,1.2fr) minmax(80px,.8fr) minmax(80px,.8fr) minmax(90px,1fr);gap:12px;align-items:center;padding:14px 16px;border:1px solid rgba(255,255,255,.12);border-radius:14px;background:rgba(255,255,255,.035)}@media(max-width:760px){.online-detail-row{grid-template-columns:auto 1fr}.online-detail-row>*{overflow-wrap:anywhere}}
