:root {
  --bg: #080d16;
  --bg-soft: #0d1524;
  --card: #111c2e;
  --card-hover: #16243a;
  --line: #1e2f47;
  --text: #eaf1fb;
  --muted: #8ba0bd;
  --dim: #5f7594;
  --accent: #16c2ff;
  --accent-2: #0a9fd6;
  --surf: #ff7a3d;
  --green: #35d6a0;
  --surf-color: #35d6a0;
  --train-color: #16c2ff;
  --grad: linear-gradient(135deg, #16c2ff 0%, #0a6fbf 100%);
  --shadow: 0 18px 50px rgba(0, 0, 0, .45);
  --radius: 18px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

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

/* surf = verde, treino = azul */
body.theme-surf {
  --accent: var(--surf-color);
  --accent-2: #168f6a;
  --grad: linear-gradient(135deg, #35d6a0 0%, #168f6a 100%);
}
body.theme-train {
  --accent: var(--train-color);
  --accent-2: #0a9fd6;
  --grad: linear-gradient(135deg, #16c2ff 0%, #0a6fbf 100%);
}
body.theme-surf .nav a.active { color: var(--surf-color); background: rgba(53,214,160,.12); }
body.theme-train .nav a.active { color: var(--train-color); background: rgba(22,194,255,.12); }

.container { max-width: 1180px; margin: 0 auto; padding: 0 22px; }

/* ---------- header ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  backdrop-filter: blur(14px);
  background: rgba(8, 13, 22, .78);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 64px; max-width: 1180px; margin: 0 auto; padding: 0 22px;
}
.brand { display: flex; align-items: center; gap: 11px; font-weight: 800; letter-spacing: -.02em; font-size: 19px; }
.brand .logo {
  width: 38px; height: 38px; border-radius: 11px; background: var(--grad);
  display: block; object-fit: cover; object-position: center;
  border: 1px solid rgba(255,255,255,.14);
  box-shadow: 0 6px 18px rgba(22,194,255,.35);
}
.brand small { display: block; font-size: 10px; font-weight: 600; color: var(--muted); letter-spacing: .16em; text-transform: uppercase; }
.brand { flex: 0 0 auto; }
.nav { display: flex; gap: 6px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a {
  flex: 0 0 auto; padding: 8px 12px; border-radius: 10px; font-size: 14px; font-weight: 600;
  color: var(--muted); transition: .18s; white-space: nowrap;
}
@media (max-width: 1180px) {
  .nav { gap: 2px; }
  .nav a { padding: 8px 9px; font-size: 13px; }
}
.nav a:hover, .nav a.active { color: var(--text); background: var(--card); }
.nav a.nav-logout {
  color: #ffb08a;
  border: 1px solid rgba(255,122,61,.32);
  margin-left: 4px;
}
.nav a.nav-logout:hover {
  color: #fff;
  background: rgba(255,122,61,.12);
  border-color: rgba(255,122,61,.55);
}

/* ---------- hero ---------- */
.hero { padding: 42px 0 10px; }
.hero h1 { margin: 0 0 6px; font-size: clamp(26px, 4vw, 38px); letter-spacing: -.03em; }
.hero p { margin: 0; color: var(--muted); font-size: 15px; }

.stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin: 26px 0 8px;
}
.stat {
  background: linear-gradient(160deg, var(--card), #0c1626);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px;
  position: relative; overflow: hidden;
}
.stat::after {
  content: ""; position: absolute; right: -30px; top: -30px; width: 90px; height: 90px;
  border-radius: 50%; background: radial-gradient(circle, rgba(22,194,255,.22), transparent 70%);
}
.stat .k { font-size: 11px; text-transform: uppercase; letter-spacing: .14em; color: var(--muted); font-weight: 700; }
.stat .v { font-size: 30px; font-weight: 800; letter-spacing: -.03em; margin-top: 6px; }
.stat .v span { font-size: 15px; color: var(--muted); font-weight: 600; margin-left: 3px; }

.toolbar {
  display: flex; align-items: center; justify-content: space-between;
  margin: 34px 0 16px; gap: 12px; flex-wrap: wrap;
}
.toolbar h2 { margin: 0; font-size: 19px; letter-spacing: -.02em; }
.toolbar .sub { color: var(--muted); font-size: 13px; margin-top: 3px; }
.seg { display: inline-flex; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 4px; }
.seg button {
  border: 0; background: transparent; color: var(--muted); font: inherit; font-size: 13px; font-weight: 600;
  padding: 7px 13px; border-radius: 9px; cursor: pointer; transition: .15s;
}
.seg button.active { background: var(--accent); color: #041018; }

/* ---------- session cards ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 18px; padding-bottom: 60px; }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; cursor: pointer; transition: .2s; display: flex; flex-direction: column;
  animation: rise .5s both;
}
.card:hover { transform: translateY(-3px); border-color: #2b4a6b; box-shadow: var(--shadow); background: var(--card-hover); }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.card-body { padding: 16px 18px 18px; flex: 1; display: flex; flex-direction: column; }
.card-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.card-date { font-size: 12px; color: var(--muted); font-weight: 600; letter-spacing: .04em; }
.waves-pill {
  flex: 0 0 auto; font-size: 11px; font-weight: 700; color: var(--accent);
  background: rgba(22,194,255,.1); border: 1px solid rgba(22,194,255,.28);
  border-radius: 999px; padding: 3px 9px; white-space: nowrap;
}
.card-title { font-size: 17px; font-weight: 750; margin: 3px 0 12px; letter-spacing: -.02em; display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.card-title .dist { font-size: 22px; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; white-space: nowrap; }
.card-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin-top: auto; }
.metric { background: rgba(255,255,255,.03); border: 1px solid var(--line); border-radius: 11px; padding: 9px 10px; }
.metric .mk { font-size: 10px; text-transform: uppercase; letter-spacing: .1em; color: var(--dim); font-weight: 700; }
.metric .mv { font-size: 16px; font-weight: 750; margin-top: 2px; }
.metric .mv i { font-size: 10px; color: var(--muted); font-style: normal; font-weight: 600; }

/* ---------- training logbook cards ---------- */
.training-card .card-title .dist {
  background: linear-gradient(135deg, #16c2ff 0%, #0a6fbf 100%);
  -webkit-background-clip: text; background-clip: text;
}
.training-card-tags { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; flex: 0 0 auto; }
.training-card-zones { margin-top: 12px; }
.training-card-zones .zone-bar { margin-bottom: 5px; }
.training-card-zones small { color: var(--dim); font-size: 10px; }

/* ---------- session detail ---------- */
.back { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 14px; font-weight: 600; padding: 22px 0 4px; }
.back:hover { color: var(--text); }
.detail-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin: 14px 0 22px; }
.detail-head h1 { margin: 0; font-size: clamp(24px, 4vw, 34px); letter-spacing: -.03em; }
.detail-head .loc { color: var(--muted); margin-top: 5px; font-size: 14px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 11px;
  border: 1px solid var(--line); background: var(--card); color: var(--text); font: inherit; font-size: 14px;
  font-weight: 650; cursor: pointer; transition: .15s;
}
.btn:hover { background: var(--card-hover); border-color: #2b4a6b; }
.btn.primary { background: var(--grad); border: 0; color: #041018; font-weight: 750; }
.btn.btn-surf { background: var(--surf-color); border: 0; color: #041018; font-weight: 750; }
.btn.btn-train { background: var(--train-color); border: 0; color: #041018; font-weight: 750; }
.btn.btn-surf:hover, .btn.btn-train:hover { filter: brightness(1.08); }

.detail-stats { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; margin-bottom: 20px; }
.polar-hr-stats { grid-template-columns: repeat(5, 1fr); }
#polar-hr { margin-bottom: 22px; }
#polar-hr .panel-head { margin-bottom: 14px; }
@media (max-width: 820px) {
  .polar-hr-stats { grid-template-columns: repeat(2, 1fr); }
}
.dbox { background: var(--card); border: 1px solid var(--line); border-radius: 15px; padding: 15px 16px; }
.dbox .k { font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.dbox .v { font-size: 24px; font-weight: 800; letter-spacing: -.03em; margin-top: 5px; }
.dbox .v span { font-size: 12px; color: var(--muted); font-weight: 600; }

#map { height: 440px; border-radius: var(--radius); border: 1px solid var(--line); overflow: hidden; background: #0a1422; }
.legend { display: flex; align-items: center; gap: 10px; margin-top: 12px; font-size: 12px; color: var(--muted); }
.legend .bar { flex: 1; max-width: 260px; height: 8px; border-radius: 5px; background: linear-gradient(90deg, #2b6cb0, #16c2ff, #35d6a0, #ffd166, #ff7a3d); }
.legend-track { gap: 18px; flex-wrap: wrap; }
.legend-track span { display: inline-flex; align-items: center; gap: 7px; }
.legend-track .swatch { display: inline-block; width: 22px; height: 0; border-top: 3px solid; vertical-align: middle; }
.legend-track .swatch.paddle { border-color: #aebccd; border-top-width: 2px; opacity: .7; }
.legend-track .swatch.wave { border-color: #81bff8; }
.legend-track .swatch.fast { border-color: #df1b00; border-top-width: 4px; }

.charts { display: grid; grid-template-columns: 1fr; gap: 18px; margin: 22px 0 60px; }
.chart-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px 10px; }
.chart-card h3 { margin: 0 0 4px; font-size: 15px; }
.chart-card .hint { color: var(--muted); font-size: 12px; margin-bottom: 12px; }
.chart-wrap { height: 260px; }
.series-toggles {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin: -4px 0 10px;
}
.series-toggle {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  background: var(--bg-soft); color: var(--text); border: 1px solid var(--line);
  border-radius: 999px; padding: 5px 10px; font: inherit; font-size: 12px;
  font-weight: 700; transition: opacity .15s, background .15s;
}
.series-toggle:hover { border-color: #2b4a6b; }
.series-toggle.dim { opacity: .42; background: transparent; }
.series-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.series-dot-speed { background: #8ce9c6; }
.series-dot-waves { background: #35d6a0; }
.series-dot-hr { background: #ff7a8a; }

.leaflet-container { background: #0a1422; }
.leaflet-bar a { background: var(--card); color: var(--text); border-color: var(--line); }
.pin { font-size: 22px; }

.empty { text-align: center; color: var(--muted); padding: 60px 20px; }

/* ---------- footer ---------- */
.footer { border-top: 1px solid var(--line); color: var(--dim); font-size: 12px; padding: 22px 0; text-align: center; }

@media (max-width: 820px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .detail-stats { grid-template-columns: repeat(2, 1fr); }
  #map { height: 340px; }
  .nav a { padding: 8px 10px; font-size: 13px; }
}

/* ---------- journal ---------- */
.journal { margin: 22px 0 60px; }
.journal-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 14px; margin-top: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field.full { grid-column: 1 / -1; margin-top: 14px; }
.field > span { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 700; }
.field input, .field select, .field textarea {
  background: var(--bg-soft); border: 1px solid var(--line); color: var(--text); border-radius: 11px;
  padding: 11px 13px; font: inherit; font-size: 14px; outline: none; transition: .15s; resize: vertical;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(22,194,255,.15); }
.stars { display: flex; gap: 4px; padding: 4px 0; }
.stars span { font-size: 26px; color: #2a3a52; cursor: pointer; transition: .12s; line-height: 1; }
.stars span.on { color: #ffcc4d; text-shadow: 0 0 14px rgba(255,204,77,.45); }
.stars span:hover { transform: scale(1.12); }
.journal-foot { margin-top: 12px; min-height: 16px; }

/* ---------- stats page ---------- */
.section-title { margin: 34px 0 14px; font-size: 20px; letter-spacing: -.02em; }
.section-title small { color: var(--muted); font-weight: 600; font-size: 13px; margin-left: 8px; letter-spacing: 0; }
.records { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.record {
  background: linear-gradient(160deg, var(--card), #0c1626); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px 18px; position: relative; overflow: hidden;
}
.record .rk { font-size: 11px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); font-weight: 700; }
.record .rv { font-size: 26px; font-weight: 800; letter-spacing: -.03em; margin-top: 6px; }
.record .rv span { font-size: 14px; color: var(--muted); font-weight: 600; margin-left: 3px; }
.record a { display: block; font-size: 12px; color: var(--accent); margin-top: 8px; font-weight: 600; }
.record a:hover { text-decoration: underline; }
.record .trophy { position: absolute; right: 14px; top: 12px; font-size: 20px; opacity: .8; }

.panels { display: grid; grid-template-columns: 1.2fr 1fr; gap: 18px; margin-top: 4px; }
.panels > * { min-width: 0; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.panel h3 { margin: 0 0 14px; font-size: 15px; }
.panel .wrap { height: 260px; }

/* heatmap */
#hm-summary { color: var(--muted); font-size: 13px; margin: 0 0 14px; line-height: 1.5; }
.hm-wrap { display: flex; gap: 6px; align-items: flex-start; min-width: 0; }
.hm-weekdays {
  display: grid; grid-template-rows: repeat(7, 13px); gap: 4px;
  padding-top: 18px; font-size: 9px; line-height: 13px; color: var(--dim); text-align: right;
}
.hm-scroll {
  flex: 1; min-width: 0; overflow-x: auto; padding-bottom: 8px;
  scrollbar-width: thin; scrollbar-color: #2b4a6b transparent;
}
.hm-scroll::-webkit-scrollbar { height: 8px; }
.hm-scroll::-webkit-scrollbar-thumb { background: #24415f; border-radius: 999px; }
.hm-scroll::-webkit-scrollbar-track { background: transparent; }
.hm-months {
  display: grid; grid-auto-flow: column; grid-auto-columns: 13px; gap: 4px;
  height: 14px; font-size: 9px; color: var(--dim);
}
.hm-months span { white-space: nowrap; overflow: visible; line-height: 14px; }
.heatmap { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 13px); gap: 4px; }
.hm-cell { width: 13px; height: 13px; border-radius: 3px; background: #16243a; transition: .12s; }
.hm-cell.l1 { background: #0e4a63; } .hm-cell.l2 { background: #0a7fa0; }
.hm-cell.l3 { background: #0fb0d8; } .hm-cell.l4 { background: #35d6a0; } .hm-cell.l5 { background: #ff7a3d; }
.hm-cell:hover { outline: 1px solid var(--accent); }
.hm-legend { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--dim); margin-top: 10px; }
.hm-legend .hm-cell { width: 11px; height: 11px; }

/* day of week bars */
.dow { display: grid; gap: 8px; }
.dow-row { display: grid; grid-template-columns: 42px 1fr 46px; align-items: center; gap: 10px; font-size: 13px; }
.dow-track { height: 12px; background: #16243a; border-radius: 6px; overflow: hidden; }
.dow-fill { height: 100%; background: var(--grad); border-radius: 6px; }
.dow-row .num { color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- compare ---------- */
.compare-bar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin: 8px 0 22px; }
.compare-bar select {
  background: var(--card); border: 1px solid var(--line); color: var(--text); border-radius: 11px;
  padding: 11px 13px; font: inherit; font-size: 14px; outline: none; min-width: 240px;
}
.cmp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.cmp-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.cmp-card h3 { margin: 0 0 4px; font-size: 17px; }
.cmp-card .cdate { color: var(--muted); font-size: 12px; margin-bottom: 14px; }
#cmp-map-a, #cmp-map-b { height: 240px; border-radius: 12px; overflow: hidden; margin-bottom: 14px; border: 1px solid var(--line); }
.cmp-row { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.cmp-row:last-child { border-bottom: 0; }
.cmp-row .lbl { color: var(--muted); }
.cmp-row .val { font-weight: 700; font-variant-numeric: tabular-nums; }
.cmp-row.win .val { color: var(--green); }
.chart-card.compare-chart { margin-top: 18px; }

@media (max-width: 820px) {
  .journal-grid { grid-template-columns: 1fr; }
  .records { grid-template-columns: 1fr 1fr; }
  .panels { grid-template-columns: 1fr; }
  .cmp-grid { grid-template-columns: 1fr; }
}

/* ---------- journal on cards ---------- */
.card-journal { display: flex; align-items: center; gap: 8px; margin: -4px 0 10px; min-height: 18px; }
.stars-mini { color: #ffcc4d; font-size: 13px; letter-spacing: 1px; }
.tag { font-size: 11px; font-weight: 700; color: var(--accent); background: rgba(22,194,255,.12); border: 1px solid rgba(22,194,255,.3); border-radius: 999px; padding: 2px 9px; }

/* ---------- mobile polish ---------- */
@media (max-width: 820px) {
  .topbar-inner { gap: 10px; }
  .brand { font-size: 16px; gap: 8px; }
  .brand .logo { width: 34px; height: 34px; font-size: 16px; }
  .brand small { display: none; }
  .nav { overflow-x: auto; -webkit-overflow-scrolling: touch; flex-shrink: 1; }
  .nav a { white-space: nowrap; padding: 8px 9px; font-size: 12.5px; }
  .record .rk { padding-right: 26px; }
  .record .rv { font-size: 23px; }
}

@media (max-width: 620px) {
  .topbar-inner { flex-wrap: wrap; height: auto; padding: 10px 16px; row-gap: 8px; }
  .nav { width: 100%; justify-content: flex-start; overflow-x: auto; overflow-y: hidden; gap: 2px; }
  .nav a { padding: 7px 8px; font-size: 12px; white-space: nowrap; }
}

/* ---------- dashboard (nova home) ---------- */
.hero-row {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 18px; flex-wrap: wrap;
}
.hero-row .period { margin-bottom: 4px; }

.highlights { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 14px 0 8px; }
.stat.highlight {
  background: linear-gradient(160deg, #10243a, #0b1728);
  border-color: #24415f;
}
.stat.highlight::after {
  background: radial-gradient(circle, rgba(53,214,160,.22), transparent 70%);
}
.stat .stat-link {
  display: block; margin-top: 8px; font-size: 12px; font-weight: 600;
  color: var(--accent); letter-spacing: .01em;
}
.stat .stat-link:hover { text-decoration: underline; }
.stat .stat-link.muted { color: var(--dim); font-weight: 600; }

.dashboard-grid {
  display: grid; grid-template-columns: 1.7fr 1fr; gap: 18px; margin: 18px 0 0;
  min-width: 0; align-items: start;
}
.dashboard-grid > * { min-width: 0; }
.dashboard-chart { padding-bottom: 16px; min-width: 0; overflow: hidden; }
.chart-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.chart-wrap-sm { height: 230px; margin-top: 6px; }
.chart-scroll {
  width: 100%; max-width: 100%; min-width: 0; overflow-x: auto; overflow-y: hidden;
  padding-bottom: 6px; scrollbar-width: thin; scrollbar-color: #2b4a6b transparent;
}
.chart-scroll::-webkit-scrollbar { height: 8px; }
.chart-scroll::-webkit-scrollbar-thumb { background: #24415f; border-radius: 999px; }
.chart-scroll::-webkit-scrollbar-track { background: transparent; }

.profile-strip {
  display: flex; align-items: center; gap: 12px; text-decoration: none;
  transition: .2s; min-height: 0; padding: 14px 16px;
}
.profile-strip:hover { background: var(--card-hover); border-color: #2b4a6b; transform: translateY(-2px); }
.profile-strip-info { min-width: 0; }
.profile-strip-info h3 {
  margin: 0 0 4px; font-size: 16px; letter-spacing: -.02em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.profile-strip-info .hint { margin: 0; font-size: 12px; }
.profile-strip .avatar { width: 48px; height: 48px; flex-basis: 48px; font-size: 19px; }
.avatar {
  width: 62px; height: 62px; flex: 0 0 62px; border-radius: 50%;
  background: var(--grad); color: #041018; display: grid; place-items: center;
  font-size: 24px; font-weight: 800; letter-spacing: -.02em;
  box-shadow: 0 8px 22px rgba(22,194,255,.28);
}

/* ---------- profile page ---------- */
.profile-layout {
  display: grid; grid-template-columns: 1.5fr 1fr; gap: 18px; margin: 26px 0 60px;
}
.profile-form-grid { grid-template-columns: 1fr 1fr; margin-top: 14px; }
.profile-actions { display: flex; align-items: center; gap: 14px; margin-top: 20px; flex-wrap: wrap; }
.profile-preview {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; gap: 6px; padding: 20px 18px;
}
.profile-preview .avatar { width: 68px; height: 68px; flex-basis: 68px; font-size: 26px; }
.profile-preview h3 { margin: 2px 0 0; font-size: 18px; letter-spacing: -.02em; }
.profile-preview .hint { margin: 0 0 6px; }
.profile-preview .btn { margin-top: 4px; }

@media (max-width: 820px) {
  .highlights { grid-template-columns: repeat(3, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .profile-layout { grid-template-columns: 1fr; }
  .chart-wrap-sm { height: 210px; }
}

@media (max-width: 620px) {
  .hero-row { align-items: flex-start; }
  .highlights { grid-template-columns: 1fr; }
  .profile-form-grid { grid-template-columns: 1fr; }
  .profile-strip { min-height: 0; }
}

/* ---------- dados / backup ---------- */
.toolbar-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.data-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin: 18px 0 60px; }
.data-card { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 20px 22px; }
.data-card h3 { margin: 0; font-size: 17px; }
.data-card .hint { margin: 0; line-height: 1.5; }
.data-card .btn { margin-top: 6px; }
.data-icon { font-size: 28px; line-height: 1; }
.data-note {
  margin: -30px 0 50px; padding: 14px 16px; line-height: 1.6;
  background: var(--card); border: 1px dashed var(--line); border-radius: 12px;
}
.data-note code { color: var(--accent); }
.data-card input[type="file"] {
  width: 100%; color: var(--muted); font: inherit; font-size: 13px;
  background: var(--bg-soft); border: 1px dashed var(--line); border-radius: 11px; padding: 10px;
}
.data-card input[type="file"]::file-selector-button {
  font: inherit; font-size: 12px; font-weight: 700; color: var(--text);
  background: var(--card); border: 1px solid var(--line); border-radius: 8px;
  padding: 7px 10px; margin-right: 10px; cursor: pointer;
}
@media (max-width: 820px) {
  .data-grid { grid-template-columns: 1fr; }
}

/* ---------- subnavegação (Surf / Treinos) ---------- */
.subnav { display: flex; gap: 6px; flex-wrap: wrap; margin: 18px 0 0; }
.subnav a {
  padding: 7px 12px; border-radius: 9px; font-size: 12px; font-weight: 700;
  color: var(--muted); background: var(--card); border: 1px solid var(--line); transition: .15s;
}
.subnav a:hover { color: var(--text); border-color: #2b4a6b; }
.subnav a.active { background: var(--accent); border-color: var(--accent); color: #041018; }

/* ---------- avaliação global por IA ---------- */
.global-review { margin: 20px 0 0; padding: 20px 22px; }
.review-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.review-eyebrow { font-size: 10px; letter-spacing: .16em; color: var(--accent); font-weight: 800; text-transform: uppercase; }
.review-period { font-size: 18px; font-weight: 750; letter-spacing: -.02em; margin-top: 4px; }
.review-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.review-meta .btn { padding: 8px 12px; font-size: 12px; }
.review-meta .tag { display: inline-flex; align-items: center; border-radius: 999px; padding: 3px 9px; font-size: 10px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.review-meta .tag-ok { color: var(--green); background: rgba(53,214,160,.12); border: 1px solid rgba(53,214,160,.3); }
.review-meta .tag-warn { color: #ffd166; background: rgba(255,209,102,.1); border: 1px solid rgba(255,209,102,.3); }
.review-meta .tag-bad { color: var(--surf); background: rgba(255,122,61,.12); border: 1px solid rgba(255,122,61,.3); }
.global-cards-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.global-card { background: var(--bg-soft); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; }
.global-card h3 { margin: 0 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--accent); }
.global-card .review { color: var(--muted); font-size: 13px; line-height: 1.65; }
.global-card .review p { margin: 0 0 8px; }
.global-card .review p:last-child { margin-bottom: 0; }
.global-card .review strong { color: var(--text); }
.review-foot { margin-top: 12px; min-height: 14px; }

/* avaliação individual por IA */
.ai-review-card { margin-bottom: 22px; border-color: rgba(22,194,255,.28); }
body.theme-surf .ai-review-card { border-color: rgba(53,214,160,.3); }
.ai-review-card .panel-head { margin-bottom: 4px; align-items: center; }
.ai-review-card .hint { margin: 0 0 10px; }
.ai-review-card .review { color: var(--muted); font-size: 14px; line-height: 1.7; }
.ai-review-card .review p { margin: 0 0 10px; }
.ai-review-card .review p:last-child { margin-bottom: 0; }
.ai-review-card .review strong { color: var(--text); }
.ai-review-card .empty.small { padding: 18px 8px; }
@media (max-width: 820px) {
  .global-cards-grid { grid-template-columns: 1fr; }
}

/* ---------- visão geral / treinos ---------- */
#overview-stats { grid-template-columns: repeat(6, 1fr); }
#training-stats { grid-template-columns: repeat(5, 1fr); }
.stat.cat-surf { border-top: 3px solid var(--surf-color); }
.stat.cat-train { border-top: 3px solid var(--train-color); }
.stat.cat-surf .v { color: var(--surf-color); }
.stat.cat-train .v { color: var(--train-color); }
.stat.cat-surf::after { background: radial-gradient(circle, rgba(53,214,160,.22), transparent 70%); }
.stat.cat-train::after { background: radial-gradient(circle, rgba(22,194,255,.22), transparent 70%); }
.overview-training { border-top: 3px solid var(--train-color); }
.overview-training .panel-head h3 { color: #8fd9ff; }
.stat-hint { color: var(--dim); font-size: 11px; margin-top: 4px; font-weight: 600; }

.overview-grid { display: grid; grid-template-columns: 1.35fr 1fr; gap: 18px; margin: 18px 0 0; align-items: start; }
.overview-grid > * { min-width: 0; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.panel-head h3 { margin: 0; font-size: 16px; }
.panel-link { font-size: 12px; color: var(--accent); font-weight: 700; }
.panel-link:hover { text-decoration: underline; }

.usb-card { margin-top: 18px; }
.usb-steps { margin: 12px 0 14px; padding-left: 22px; color: var(--muted); line-height: 1.8; font-size: 14px; }
.usb-steps strong { color: var(--text); }
.usb-note { margin: 10px 0 0; }
.usb-platforms { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.link-button {
  background: none; border: 0; padding: 0; color: var(--dim); font: inherit;
  font-size: 12px; cursor: pointer;
}
.link-button:hover { color: var(--text); text-decoration: underline; }

.activity-list { display: flex; flex-direction: column; gap: 4px; }
.activity-item {
  display: flex; align-items: center; gap: 6px; padding: 7px 8px 7px 10px; border-radius: 12px;
  transition: .15s; border: 1px solid transparent;
}
.activity-item:hover { background: var(--bg-soft); border-color: var(--line); }
.activity-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; color: inherit; }
.activity-icon {
  width: 36px; height: 36px; flex: 0 0 36px; border-radius: 10px; display: grid; place-items: center;
  background: var(--bg-soft); border: 1px solid var(--line); font-size: 17px;
}
.activity-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.activity-title { font-size: 14px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.activity-meta { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.activity-duration { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.activity-action {
  flex: 0 0 auto; font: inherit; font-size: 9px; font-weight: 800; text-transform: uppercase;
  letter-spacing: .05em; color: var(--muted); background: transparent;
  border: 1px solid var(--line); border-radius: 999px; padding: 4px 7px; cursor: pointer;
}
.activity-action:hover { color: var(--text); border-color: #2b4a6b; background: var(--bg-soft); }
.activity-action.linked {
  color: var(--green); border-color: rgba(53,214,160,.4); background: rgba(53,214,160,.1);
}


.link-dialog {
  width: min(560px, 92vw); border: 1px solid var(--line); border-radius: 18px;
  background: var(--card); color: var(--text); padding: 22px; box-shadow: var(--shadow);
}
.link-dialog::backdrop { background: rgba(0, 0, 0, .68); backdrop-filter: blur(3px); }
.link-dialog .panel-head { margin-bottom: 4px; align-items: center; }
.link-dialog h3 { margin: 0; font-size: 17px; }
.link-dialog .hint { margin: 0 0 8px; line-height: 1.5; }
.link-dialog .field { display: flex; flex-direction: column; gap: 6px; margin-top: 14px; }
.link-dialog .field > span { font-size: 12px; color: var(--muted); font-weight: 700; }
.link-dialog select,
.link-dialog input {
  width: 100%; background: var(--bg); border: 1px solid var(--line); color: var(--text);
  border-radius: 10px; padding: 10px 11px; font: inherit; font-size: 14px; outline: none;
}
.link-dialog select:focus,
.link-dialog input:focus { border-color: #2b6cb0; box-shadow: 0 0 0 3px rgba(22,194,255,.12); }
.link-dialog .manual-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.link-dialog .manual-duration { display: flex; align-items: center; gap: 6px; }
.link-dialog .manual-duration input { width: 72px; }
.link-dialog .manual-duration span { color: var(--muted); font-size: 12px; font-weight: 700; }
.link-dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.dialog-close {
  background: none; border: 0; color: var(--muted); font-size: 24px; line-height: 1;
  cursor: pointer; padding: 0 2px;
}
.dialog-close:hover { color: var(--text); }
@media (max-width: 620px) {
  .activity-action { font-size: 8px; padding: 3px 6px; }
  .link-dialog-actions { justify-content: stretch; }
  .link-dialog-actions .btn { flex: 1; }
  .link-dialog .manual-fields { grid-template-columns: 1fr; }
}

.recent-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.recent-col {
  min-width: 0; border-radius: 14px; padding: 10px 10px 8px;
  background: var(--bg-soft); border: 1px solid var(--line);
}
.recent-col-surf {
  border-color: rgba(53,214,160,.3);
  background: linear-gradient(180deg, rgba(53,214,160,.08), transparent 45%), var(--bg-soft);
}
.recent-col-training {
  border-color: rgba(22,194,255,.3);
  background: linear-gradient(180deg, rgba(22,194,255,.08), transparent 45%), var(--bg-soft);
}
.recent-col-title {
  margin: 0 0 8px; padding: 2px 4px 0; display: flex; align-items: center; gap: 7px;
  font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted);
}
.recent-dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 8px; }
.recent-col-surf .recent-dot { background: var(--surf-color); box-shadow: 0 0 10px rgba(53,214,160,.55); }
.recent-col-training .recent-dot { background: var(--train-color); box-shadow: 0 0 10px rgba(22,194,255,.55); }
.recent-col-surf .recent-col-title { color: #8ce9c6; }
.recent-col-training .recent-col-title { color: #8fd9ff; }
.recent-col .activity-item { padding: 8px; }
.recent-col .activity-icon { width: 32px; height: 32px; flex-basis: 32px; font-size: 15px; }
.recent-col-surf .activity-icon { background: rgba(53,214,160,.12); border-color: rgba(53,214,160,.28); }
.recent-col-training .activity-icon { background: rgba(22,194,255,.12); border-color: rgba(22,194,255,.28); }
.recent-col-surf .activity-item:hover { border-color: rgba(53,214,160,.4); background: rgba(53,214,160,.06); }
.recent-col-training .activity-item:hover { border-color: rgba(22,194,255,.4); background: rgba(22,194,255,.06); }
.recent-col-surf .activity-action:not(.linked) { color: var(--surf-color); border-color: rgba(53,214,160,.4); }
.recent-col .empty.small { padding: 18px 8px; }

.training-mini .mini-metrics {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 12px;
}
.mini-metrics > div { background: var(--bg-soft); border: 1px solid var(--line); border-radius: 11px; padding: 10px 12px; }
.mini-metrics span { display: block; font-size: 20px; font-weight: 800; letter-spacing: -.02em; }
.mini-metrics small { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .1em; font-weight: 700; }
.chart-wrap-xs { height: 170px; margin: 6px 0 12px; }

.zone-list { display: flex; flex-direction: column; gap: 10px; }
.zone-row { display: grid; grid-template-columns: 96px 1fr 108px; align-items: center; gap: 10px; font-size: 12px; }
.zone-name { color: var(--muted); display: inline-flex; align-items: center; gap: 7px; font-weight: 600; }
.zone-name i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }
.zone-track { height: 10px; background: #16243a; border-radius: 5px; overflow: hidden; }
.zone-track > span { display: block; height: 100%; border-radius: 5px; }
.zone-value { color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

.training-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin: 18px 0 0; }
.training-grid > * { min-width: 0; }
.training-list-card { margin: 18px 0 60px; }
.training-list { display: flex; flex-direction: column; }
.training-row {
  display: grid; grid-template-columns: 1.5fr 1fr 24px; gap: 16px; align-items: center;
  padding: 14px 4px; border-bottom: 1px solid var(--line); transition: .15s;
}
.training-row:last-child { border-bottom: 0; }
.training-row:hover { background: rgba(255,255,255,.02); }
.training-when { font-size: 11px; color: var(--muted); font-weight: 600; letter-spacing: .04em; }
.training-sport { font-size: 15px; font-weight: 750; margin: 2px 0 4px; letter-spacing: -.01em; }
.training-meta { display: flex; gap: 10px; flex-wrap: wrap; color: var(--muted); font-size: 12px; }
.training-source { color: var(--accent); font-weight: 700; }
.training-zones { min-width: 0; }
.zone-bar { display: flex; height: 9px; border-radius: 5px; overflow: hidden; background: #16243a; margin-bottom: 5px; }
.zone-seg { display: block; height: 100%; }
.training-zones small { color: var(--dim); font-size: 10px; }
.training-arrow { color: var(--muted); font-size: 18px; text-align: right; }
.training-details { display: flex; flex-direction: column; }

/* classificação de treinos novos */
.tag-warn { color: #ffd166; background: rgba(255,209,102,.1); border-color: rgba(255,209,102,.3); }
.classify-card { border-color: rgba(255,209,102,.35); margin-bottom: 18px; }
.classify-card .panel-head { margin-bottom: 6px; }
.classify-list { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.classify-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px 16px;
  align-items: center; padding: 12px 14px; border: 1px solid var(--line);
  border-radius: 12px; background: var(--bg-soft);
}
.classify-info { min-width: 0; }
.classify-title { font-size: 15px; font-weight: 750; margin: 2px 0 4px; letter-spacing: -.01em; }
.classify-controls { display: flex; align-items: center; gap: 8px; }
.classify-controls input,
.sport-form input {
  background: var(--bg); border: 1px solid var(--line); color: var(--text);
  border-radius: 10px; padding: 9px 11px; font: inherit; font-size: 14px;
  outline: none; min-width: 240px;
}
.classify-controls input:focus,
.sport-form input:focus { border-color: #2b6cb0; box-shadow: 0 0 0 3px rgba(22,194,255,.12); }
.classify-error { grid-column: 1 / -1; color: var(--surf); font-size: 12px; }
.training-pending {
  color: #ffd166; background: rgba(255,209,102,.1); border: 1px solid rgba(255,209,102,.35);
  border-radius: 999px; padding: 2px 7px; font-size: 10px; font-weight: 800;
  text-transform: uppercase; letter-spacing: .06em;
}
.sport-form { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.sport-form input { min-width: 280px; }
.sport-form #sport-status { margin: 0; }
@media (max-width: 720px) {
  .classify-row { grid-template-columns: 1fr; }
  .classify-controls, .sport-form { flex-wrap: wrap; }
  .classify-controls input, .sport-form input { flex: 1; min-width: 0; width: 100%; }
}

.empty.small { padding: 26px 16px; font-size: 13px; }

@media (max-width: 900px) {
  #overview-stats { grid-template-columns: repeat(3, 1fr); }
  #training-stats { grid-template-columns: repeat(3, 1fr); }
  .overview-grid, .training-grid { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
  #overview-stats, #training-stats { grid-template-columns: 1fr 1fr; }
  .recent-columns { grid-template-columns: 1fr; }
  .zone-row { grid-template-columns: 82px 1fr 92px; }
  .training-row { grid-template-columns: 1fr 24px; }
  .training-zones { grid-column: 1 / -1; }
  .training-arrow { display: none; }
}

/* ---------- conta oficial / login ---------- */
.login-grid { display: grid; grid-template-columns: 1.35fr 1fr; gap: 18px; margin: 26px 0 60px; align-items: start; }
.login-card h3 { margin: 0 0 6px; }
.login-card .field { margin-top: 14px; }
.login-card form { margin-top: 4px; }
.connected-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.connected-head h3 { margin: 0 0 3px; }
.connected-head .avatar { width: 54px; height: 54px; flex-basis: 54px; font-size: 22px; }
.login-info .steps { color: var(--muted); line-height: 1.9; font-size: 14px; padding-left: 20px; margin: 4px 0 14px; }
.login-info .security { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 12px; }
.login-info .btn { margin-top: 4px; }
.progress-wrap { margin-top: 18px; }
.progress { height: 10px; background: #16243a; border-radius: 6px; overflow: hidden; }
.progress-bar { height: 100%; width: 2%; background: var(--grad); border-radius: 6px; transition: width .3s; }
.progress-text { font-size: 12px; color: var(--muted); margin-top: 8px; line-height: 1.5; }
.import-result { margin-top: 16px; display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.result-ok { color: var(--green); font-weight: 700; }
.result-error { color: var(--surf); font-weight: 700; }
@media (max-width: 820px) {
  .login-grid { grid-template-columns: 1fr; }
}

/* ---------- autenticação / conta ---------- */
.tag-ok { color: var(--green); background: rgba(53,214,160,.12); border: 1px solid rgba(53,214,160,.3); }
.tag-warn { color: #ffd166; background: rgba(255,209,102,.1); border: 1px solid rgba(255,209,102,.3); }
body.auth-nonadmin .overview-training,
body.auth-nonadmin .recent-col-training,
body.auth-nonadmin .stat.cat-train { display: none; }
body.auth-nonadmin .recent-columns { grid-template-columns: 1fr; }
