/* ─────────────────────────────────────────────────────────────────────────────
   PulsePlay Admin — Design System (tokens espelhados do app)
   ───────────────────────────────────────────────────────────────────────── */
:root {
  --pp-bg:          #0D0D12;
  --pp-surface:     #161621;
  --pp-card:        #1E1E2E;
  --pp-card-hover:  #252538;
  --pp-border:      rgba(255,255,255,0.07);
  --pp-border-soft: rgba(255,255,255,0.06);

  --pp-primary:       #E63560;
  --pp-primary-light: #FF6B8A;
  --pp-primary-dark:  #B01F45;
  --pp-primary-bg:    rgba(230,53,96,0.12);

  --pp-blue:      #4FC3F7;  --pp-blue-bg:   rgba(79,195,247,0.1);
  --pp-green:     #4CAF50;  --pp-green-bg:  rgba(76,175,80,0.12);
  --pp-orange:    #FF9800;  --pp-orange-bg: rgba(255,152,0,0.12);
  --pp-purple:    #AB47BC;  --pp-purple-bg: rgba(171,71,188,0.14);

  --pp-text:       #FFFFFF;
  --pp-text-soft:  #B0B0C0;
  --pp-text-muted: #606070;

  --pp-gradient:      linear-gradient(135deg, #E63560, #FF6B8A);
  --pp-gradient-warm: linear-gradient(135deg, #E63560, #FF9800);
  --pp-gradient-card: linear-gradient(135deg, #1E1E2E, #161621);

  --pp-shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
  --pp-shadow:    0 8px 24px rgba(0,0,0,0.4);
  --pp-glow:      0 0 24px rgba(230,53,96,0.3);
  --pp-glow-sm:   0 0 12px rgba(230,53,96,0.2);

  --pp-radius-sm: 8px;
  --pp-radius:    16px;
  --pp-radius-lg: 24px;
  --pp-radius-full: 100px;

  --pp-surface-1: rgba(255,255,255,0.04);
  --pp-surface-2: rgba(255,255,255,0.06);
  --pp-surface-3: rgba(255,255,255,0.08);

  --sidebar-w: 248px;
}

:root[data-theme="light"] {
  --pp-bg:          #F7F7FA;
  --pp-surface:     #FFFFFF;
  --pp-card:        #FFFFFF;
  --pp-card-hover:  #F0F0F5;
  --pp-border:      rgba(0,0,0,0.08);
  --pp-border-soft: rgba(0,0,0,0.06);
  --pp-text:        #16161F;
  --pp-text-soft:   #4A4A55;
  --pp-text-muted:  #8A8A95;
  --pp-gradient-card: linear-gradient(135deg, #FFFFFF, #F0F0F5);
  --pp-shadow-sm: 0 2px 8px rgba(20,20,40,0.06);
  --pp-shadow:    0 8px 24px rgba(20,20,40,0.10);
  --pp-surface-1: rgba(0,0,0,0.04);
  --pp-surface-2: rgba(0,0,0,0.06);
  --pp-surface-3: rgba(0,0,0,0.08);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  background: var(--pp-bg);
  color: var(--pp-text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--pp-surface-3); border-radius: 3px; }

/* ─── Shell ──────────────────────────────────────────────────────────────── */
.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  background: var(--pp-surface);
  border-right: 1px solid var(--pp-border);
  padding: 20px 14px;
  position: fixed;
  inset: 0 auto 0 0;
  overflow-y: auto;
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 10px 18px;
}
.brand-logo {
  width: 38px; height: 38px; border-radius: 12px;
  background: var(--pp-gradient-warm);
  display: grid; place-items: center;
  box-shadow: var(--pp-glow-sm);
  flex: none;
}
.brand-logo svg { width: 22px; height: 22px; }
.brand-name { font-size: 17px; font-weight: 800; letter-spacing: -0.3px; }
.brand-name em { font-style: normal; background: var(--pp-gradient-warm); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.brand-tag { font-size: 10px; color: var(--pp-text-muted); font-weight: 600; letter-spacing: 1.5px; text-transform: uppercase; }

.nav-section { font-size: 10px; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase; color: var(--pp-text-muted); padding: 14px 12px 6px; }

.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px;
  border-radius: 10px;
  color: var(--pp-text-soft);
  font-weight: 600; font-size: 13.5px;
  transition: all .15s;
}
.nav-item svg { width: 18px; height: 18px; stroke: currentColor; flex: none; opacity: .85; }
.nav-item:hover { background: var(--pp-surface-1); color: var(--pp-text); }
.nav-item.is-active {
  background: var(--pp-primary-bg);
  color: var(--pp-primary-light);
  box-shadow: inset 3px 0 0 var(--pp-primary);
}
:root[data-theme="light"] .nav-item.is-active { color: var(--pp-primary); }

.main {
  flex: 1;
  margin-left: var(--sidebar-w);
  padding: 24px 28px 48px;
  min-width: 0;
}

/* ─── Topbar ─────────────────────────────────────────────────────────────── */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.topbar h1 { font-size: 24px; font-weight: 800; letter-spacing: -0.4px; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.top-user { display: flex; align-items: center; gap: 10px; background: var(--pp-card); border: 1px solid var(--pp-border); padding: 6px 12px 6px 6px; border-radius: var(--pp-radius-full); }
.top-user b { font-size: 13px; }
.top-user small { display: block; color: var(--pp-text-muted); font-size: 11px; }

.icon-btn {
  width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--pp-card); border: 1px solid var(--pp-border);
  color: var(--pp-text-soft); cursor: pointer; transition: all .15s;
}
.icon-btn:hover { color: var(--pp-text); background: var(--pp-card-hover); }
.icon-btn svg { width: 17px; height: 17px; }

/* ─── Cards / grids ──────────────────────────────────────────────────────── */
.card {
  background: var(--pp-gradient-card);
  border: 1px solid var(--pp-border);
  border-radius: var(--pp-radius);
  padding: 20px;
  box-shadow: var(--pp-shadow-sm);
}
.card + .card { margin-top: 16px; }
.card h2 { font-size: 15px; font-weight: 700; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.card h2 .hint { font-size: 12px; color: var(--pp-text-muted); font-weight: 500; margin-left: auto; }

.grid { display: grid; gap: 16px; }
.grid-kpi  { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-main { grid-template-columns: 2fr 1fr; }
@media (max-width: 1100px) { .grid-2, .grid-3, .grid-main { grid-template-columns: 1fr; } }

.kpi { position: relative; overflow: hidden; }
.kpi .kpi-label { font-size: 11.5px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase; color: var(--pp-text-muted); }
.kpi .kpi-value { font-size: 28px; font-weight: 800; letter-spacing: -0.8px; margin-top: 6px; font-variant-numeric: tabular-nums; }
.kpi .kpi-sub { font-size: 12px; color: var(--pp-text-soft); margin-top: 4px; }
.kpi .kpi-sub b { color: var(--pp-green); }
.kpi::after {
  content: ''; position: absolute; inset: 0 0 auto auto;
  width: 70px; height: 70px; border-radius: 50%;
  background: var(--kpi-accent, var(--pp-primary));
  opacity: .09; transform: translate(28%, -28%);
}

/* ─── Tabelas ────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: var(--pp-radius); border: 1px solid var(--pp-border); background: var(--pp-surface); }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 640px; }
thead th {
  text-align: left; padding: 12px 14px;
  font-size: 11px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase;
  color: var(--pp-text-muted);
  border-bottom: 1px solid var(--pp-border);
  white-space: nowrap;
}
tbody td { padding: 11px 14px; border-bottom: 1px solid var(--pp-border-soft); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background .12s; }
tbody tr:hover { background: var(--pp-surface-1); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.row-link { color: var(--pp-text); font-weight: 600; }
.row-link:hover { color: var(--pp-primary-light); }
tr.is-deleted td { opacity: .45; }

.cell-user { display: flex; align-items: center; gap: 10px; min-width: 150px; }
.cell-user small { display: block; color: var(--pp-text-muted); font-size: 11.5px; }

.avatar { border-radius: 50%; object-fit: cover; flex: none; border: 1.5px solid var(--pp-border); }
.avatar-ini {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--pp-gradient); color: #fff; font-weight: 700;
}

/* ─── Pills ──────────────────────────────────────────────────────────────── */
.pill {
  display: inline-block; padding: 3px 10px; border-radius: var(--pp-radius-full);
  font-size: 11.5px; font-weight: 700; white-space: nowrap;
}
.pill-brand  { background: var(--pp-primary-bg); color: var(--pp-primary-light); }
.pill-green  { background: var(--pp-green-bg);   color: var(--pp-green); }
.pill-blue   { background: var(--pp-blue-bg);    color: var(--pp-blue); }
.pill-orange { background: var(--pp-orange-bg);  color: var(--pp-orange); }
.pill-purple { background: var(--pp-purple-bg);  color: var(--pp-purple); }
.pill-muted  { background: var(--pp-surface-2);  color: var(--pp-text-soft); }
.pill-danger { background: rgba(244,67,54,0.15); color: #FF6B5E; }
:root[data-theme="light"] .pill-brand { color: var(--pp-primary); }

/* ─── Filtros ────────────────────────────────────────────────────────────── */
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-bottom: 16px; }
.filters .f-group { display: flex; flex-direction: column; gap: 5px; }
.filters label { font-size: 10.5px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase; color: var(--pp-text-muted); padding-left: 4px; }
.filters input, .filters select {
  background: var(--pp-card); color: var(--pp-text);
  border: 1px solid var(--pp-border); border-radius: 10px;
  padding: 9px 12px; font-size: 13px; min-width: 130px;
  outline: none; transition: border .15s;
  color-scheme: dark;
}
:root[data-theme="light"] .filters input, :root[data-theme="light"] .filters select { color-scheme: light; }
.filters input:focus, .filters select:focus { border-color: var(--pp-primary); box-shadow: var(--pp-glow-sm); }
.filters input[type="text"] { min-width: 200px; }
.filters .f-check { display: flex; align-items: center; gap: 6px; padding: 9px 4px; font-size: 13px; color: var(--pp-text-soft); }
.filters .f-check input { min-width: 0; accent-color: var(--pp-primary); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 20px; border-radius: var(--pp-radius-full);
  font-weight: 700; font-size: 13px; border: none; cursor: pointer;
  transition: all .15s; font-family: inherit;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--pp-gradient); color: #fff; box-shadow: var(--pp-glow-sm); }
.btn-primary:hover { box-shadow: var(--pp-glow); }
.btn-ghost { background: var(--pp-card); color: var(--pp-text-soft); border: 1px solid var(--pp-border); }
.btn-ghost:hover { color: var(--pp-text); }
.btn-danger { background: rgba(244,67,54,0.14); color: #FF6B5E; }
.btn-sm { padding: 6px 14px; font-size: 12px; }

/* ─── Paginação ──────────────────────────────────────────────────────────── */
.pagi { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; flex-wrap: wrap; }
.pagi-info { font-size: 12.5px; color: var(--pp-text-muted); margin-top: 8px; }
.pagi-links { display: flex; gap: 5px; }
.pagi-btn {
  min-width: 32px; height: 32px; padding: 0 8px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 9px; font-size: 13px; font-weight: 600;
  background: var(--pp-card); border: 1px solid var(--pp-border); color: var(--pp-text-soft);
}
.pagi-btn:hover { color: var(--pp-text); background: var(--pp-card-hover); }
.pagi-btn.is-active { background: var(--pp-gradient); color: #fff; border-color: transparent; }
.pagi-btn.is-disabled { opacity: .4; pointer-events: none; }

/* ─── Charts ─────────────────────────────────────────────────────────────── */
.chart { width: 100%; height: auto; display: block; }
.chart-line { min-height: 180px; }
.c-grid { stroke: var(--pp-surface-2); stroke-width: 1; }
.c-ylab, .c-xlab { fill: var(--pp-text-muted); font-size: 11px; }
.c-ylab { text-anchor: end; }
.c-xlab { text-anchor: middle; }
.c-dot { fill: var(--pp-primary-light); stroke: var(--pp-bg); stroke-width: 1.5; }
.c-donut-num { fill: var(--pp-text); font-size: 30px; font-weight: 800; text-anchor: middle; }
.c-donut-lab { fill: var(--pp-text-muted); font-size: 12px; text-anchor: middle; }
.chart-empty { color: var(--pp-text-muted); font-size: 13px; padding: 30px 0; text-align: center; }

.legend { display: flex; flex-wrap: wrap; gap: 10px 16px; margin-top: 12px; }
.legend-item { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--pp-text-soft); }
.legend-dot { width: 10px; height: 10px; border-radius: 3px; flex: none; }

.hbars { display: flex; flex-direction: column; gap: 12px; }
.hbar-top { display: flex; justify-content: space-between; font-size: 12.5px; margin-bottom: 5px; }
.hbar-label { color: var(--pp-text-soft); font-weight: 600; }
.hbar-value { color: var(--pp-text); font-weight: 700; font-variant-numeric: tabular-nums; }
.hbar-track { height: 8px; border-radius: 4px; background: var(--pp-surface-2); overflow: hidden; }
.hbar-fill { height: 100%; border-radius: 4px; transition: width .4s ease; }

/* ─── Listas compactas (dashboard) ───────────────────────────────────────── */
.mini-list { display: flex; flex-direction: column; }
.mini-item { display: flex; align-items: center; gap: 11px; padding: 9px 2px; border-bottom: 1px solid var(--pp-border-soft); }
.mini-item:last-child { border-bottom: none; }
.mini-item .mi-body { flex: 1; min-width: 0; }
.mini-item .mi-title { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-item .mi-sub { font-size: 11.5px; color: var(--pp-text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-item .mi-end { font-size: 11.5px; color: var(--pp-text-muted); text-align: right; flex: none; }

/* ─── Detalhe (usuário / treino) ─────────────────────────────────────────── */
.detail-head { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.detail-head .dh-body { flex: 1; min-width: 200px; }
.detail-head h2 { font-size: 20px; font-weight: 800; margin-bottom: 2px; }
.detail-head .dh-sub { color: var(--pp-text-muted); font-size: 13px; }
.detail-head .dh-pills { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }

.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 12px; margin-top: 16px; }
.stat { background: var(--pp-surface-1); border-radius: 12px; padding: 12px 14px; }
.stat .st-label { font-size: 10.5px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: var(--pp-text-muted); }
.stat .st-value { font-size: 18px; font-weight: 800; margin-top: 4px; font-variant-numeric: tabular-nums; }

.route-svg { width: 100%; height: auto; background: var(--pp-surface-1); border-radius: var(--pp-radius); }

.zone-bar { display: flex; height: 14px; border-radius: 7px; overflow: hidden; margin: 10px 0 14px; }
.zone-seg { height: 100%; }

.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.photo-grid img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 12px; border: 1px solid var(--pp-border); }

.track-item { display: flex; align-items: center; gap: 11px; padding: 8px 0; border-bottom: 1px solid var(--pp-border-soft); }
.track-item:last-child { border: none; }
.track-item img { width: 38px; height: 38px; border-radius: 8px; object-fit: cover; }

/* ─── Tabs ───────────────────────────────────────────────────────────────── */
.tabs { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.tab {
  padding: 8px 18px; border-radius: var(--pp-radius-full);
  font-size: 13px; font-weight: 700; color: var(--pp-text-soft);
  background: var(--pp-card); border: 1px solid var(--pp-border);
  transition: all .15s;
}
.tab:hover { color: var(--pp-text); }
.tab.is-active { background: var(--pp-gradient); color: #fff; border-color: transparent; box-shadow: var(--pp-glow-sm); }

/* ─── Flash ──────────────────────────────────────────────────────────────── */
.flash {
  padding: 12px 18px; border-radius: 12px; margin-bottom: 18px;
  font-weight: 600; font-size: 13.5px;
  animation: fadeUp .3s ease;
}
.flash-green  { background: var(--pp-green-bg); color: var(--pp-green); border: 1px solid rgba(76,175,80,.3); }
.flash-orange { background: var(--pp-orange-bg); color: var(--pp-orange); border: 1px solid rgba(255,152,0,.3); }
.flash-danger { background: rgba(244,67,54,.12); color: #FF6B5E; border: 1px solid rgba(244,67,54,.3); }

/* ─── Login ──────────────────────────────────────────────────────────────── */
.login-page {
  min-height: 100vh; display: grid; place-items: center;
  background:
    radial-gradient(600px 400px at 15% 10%, rgba(230,53,96,0.14), transparent 60%),
    radial-gradient(500px 400px at 90% 90%, rgba(255,152,0,0.1), transparent 60%),
    var(--pp-bg);
  padding: 20px;
}
.login-card {
  width: 100%; max-width: 400px;
  background: var(--pp-gradient-card);
  border: 1px solid var(--pp-border);
  border-radius: var(--pp-radius-lg);
  padding: 38px 34px;
  box-shadow: var(--pp-shadow);
  animation: fadeUp .45s ease;
}
.login-card .brand { justify-content: center; padding-bottom: 8px; }
.login-card h1 { font-size: 20px; font-weight: 800; text-align: center; margin-bottom: 4px; }
.login-card p.sub { text-align: center; color: var(--pp-text-muted); font-size: 13px; margin-bottom: 26px; }
.login-card .f-group { margin-bottom: 16px; }
.login-card label { display: block; font-size: 11px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase; color: var(--pp-text-muted); margin-bottom: 7px; }
.login-card input {
  width: 100%; background: var(--pp-surface); color: var(--pp-text);
  border: 1px solid var(--pp-border); border-radius: 12px;
  padding: 13px 15px; font-size: 14px; outline: none; transition: all .15s;
}
.login-card input:focus { border-color: var(--pp-primary); box-shadow: var(--pp-glow-sm); }
.login-card .btn { width: 100%; height: 48px; font-size: 14px; margin-top: 6px; }
.login-error {
  background: rgba(244,67,54,.12); color: #FF6B5E;
  border: 1px solid rgba(244,67,54,.3);
  padding: 11px 14px; border-radius: 12px; font-size: 13px; font-weight: 600;
  margin-bottom: 18px; text-align: center;
}

@keyframes fadeUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }

/* ─── Responsivo ─────────────────────────────────────────────────────────── */
.menu-toggle { display: none; }
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); transition: transform .25s ease; }
  .sidebar.is-open { transform: none; box-shadow: var(--pp-shadow); }
  .main { margin-left: 0; padding: 18px 16px 40px; }
  .menu-toggle { display: grid; }
  .top-user small { display: none; }
}

.empty-state { text-align: center; padding: 46px 20px; color: var(--pp-text-muted); }
.empty-state .es-emoji { font-size: 34px; margin-bottom: 10px; }
