/* ---------- Navigering ---------- */
.btn-back { width: 36px; height: 36px; padding: 0; display: grid; place-items: center; margin-right: 6px; }
.btn-back svg { width: 18px; height: 18px; }
/* Lenker som ser ut som knapper (startsiden og statistikken bruker ekte lenker, så de kan åpnes i ny fane). */
a.btn-ghost, a.btn-primary { text-decoration: none; color: inherit; display: inline-flex; align-items: center; }
a.btn-primary { color: var(--accent-ink); }
a.link { color: var(--accent); font-weight: 600; text-decoration: underline; }
a.ha-card { color: inherit; text-decoration: none; }

.crumbs { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); flex-wrap: wrap; }
.crumbs a { color: var(--accent); font-weight: 600; text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }
.crumbs [aria-current] { color: var(--ink); font-weight: 600; }

/* ---------- Statistikk: oversikt ---------- */
a.stat-link { color: inherit; text-decoration: none; cursor: pointer; transition: box-shadow .15s, background .15s; }
a.stat-link:hover { background: var(--surface-2); box-shadow: 0 0 0 1px var(--accent); }
.stat-more { color: var(--accent); font-size: 13px; font-weight: 600; white-space: nowrap; }
.stat-head .spacer { flex: 1; }

.top-head { display: flex; align-items: center; gap: 10px; margin: 2px 0 8px; flex-wrap: wrap; }
.top-head h2 { margin: 0; }
.small-seg button { padding: 3px 10px; font-size: 12.5px; }
.stat-table th:nth-child(1), .stat-table .st-rank { width: 26px; }
.stat-table th:nth-child(2) { width: 50px; }
.stat-table th:nth-child(3) { width: auto; } /* tittelen får plassen som blir igjen */
.stat-table th:nth-child(4), .stat-table th:nth-child(5) { width: 76px; }
.stat-table th:nth-child(6) { width: 96px; }
.stat-table th:nth-child(7) { width: 60px; }
.st-rank { color: var(--muted); font-family: var(--display); font-weight: 700; font-size: 17px; text-align: right; padding-right: 0 !important; }
.show-more { margin-top: 10px; }

/* ---------- Statistikk for én konto ---------- */
/* Statistikken midtstilles på svært brede skjermer, så det ikke blir tomt på én side. */
.stats { width: 100%; max-width: 1760px; margin: 0 auto; }
/* Kontosiden: én kolonne som standard, to kolonner (grafer + innleggsliste) fra 1600 piksler. */
.acct-body { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; align-items: start; }
.acct-main { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.acct-side { min-width: 0; }
@media (min-width: 1600px) {
  .acct-body { grid-template-columns: minmax(0, 1fr) minmax(420px, 34%); }
  /* I den smale kolonnen: kommentarer vises i nøkkeltallene over, så kolonnen skjules her for å gi plass til titlene. */
  .acct-side .stat-table th:nth-child(6), .acct-side .stat-table td:nth-child(6) { display: none; }
  .acct-side .stat-table th:nth-child(4), .acct-side .stat-table th:nth-child(5) { width: 68px; }
  .acct-side .stat-table td { padding: 7px 6px; }
}
.acct-head { display: flex; align-items: center; gap: 14px; }
.acct-icon { width: 44px; height: 44px; flex: none; }
.acct-head h1 { margin: 0; font-family: var(--display); font-weight: 800; font-size: 38px; line-height: 1; }
.acct-head .muted { color: var(--muted); font-size: 14px; }
.acct-head a { color: var(--accent); font-weight: 600; }
.acct-tiles { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; } /* auto-fit: flisene fyller hele raden */
.acct-tiles .tile { background: var(--surface); padding: 12px 14px; }
.acct-tiles .tile-v { font-size: 32px; }

.insights { display: flex; flex-wrap: wrap; gap: 8px 28px; }
.insights p { margin: 0; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; color: var(--muted); }
.insights strong { color: var(--ink); font-weight: 600; }
.ins-k { color: var(--accent); font-weight: 700; font-size: 13px; }

.charts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.charts .chart-card:first-child { grid-column: 1 / -1; }
.chart-card { background: var(--surface); border-radius: 14px; padding: 14px 16px 10px; min-width: 0; }
.chart-h { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.chart-h h3 { margin: 0; font-family: var(--display); font-size: 20px; font-weight: 800; }
.chart-h .muted { color: var(--muted); font-size: 13px; }
.chart { width: 100%; min-height: 40px; }
.chart svg { display: block; overflow: visible; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .baseline { stroke: var(--surface-3); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 11.5px; font-family: var(--font); font-variant-numeric: tabular-nums; }
.chart .val { fill: var(--ink); font-size: 12.5px; font-weight: 700; font-family: var(--font); }
.chart .bar { fill: var(--accent); }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { fill: var(--accent); opacity: .1; }
.chart .dot { fill: var(--accent); stroke: var(--surface); stroke-width: 2; }
.chart .cross { stroke: var(--muted); stroke-width: 1; }
.chart .hit { fill: transparent; cursor: default; outline: none; }
.chart .hit.on, .chart .hit:focus-visible { fill: rgb(255 255 255 / .05); }
.chart .hit:focus-visible { stroke: var(--accent); stroke-width: 1; }

.chart-tip {
  position: fixed; z-index: 50; pointer-events: none; max-width: 280px;
  background: var(--deep); color: var(--ink); border: 1px solid var(--surface-3); border-radius: 10px;
  padding: 8px 10px; box-shadow: 0 10px 30px rgb(0 0 0 / .45); font-size: 13px;
}
.tip-title { color: var(--muted); font-size: 12.5px; margin-bottom: 4px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.tip-row { display: flex; align-items: baseline; gap: 8px; }
.tip-row strong { font-size: 15px; font-variant-numeric: tabular-nums; }
.tip-row span { color: var(--muted); }

@media (max-width: 1100px) { .charts { grid-template-columns: 1fr; } }
@media (max-width: 860px) {
  .acct-head h1 { font-size: 28px; }
  .acct-icon { width: 34px; height: 34px; }
  .acct-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-table th:nth-child(5), .stat-table td:nth-child(5), .stat-table th:nth-child(6), .stat-table td:nth-child(6) { display: none; }
}
@media (prefers-reduced-motion: reduce) { a.stat-link { transition: none; } }
