:root {
  --bg: #0a0e17;
  --surface: #111827;
  --surface2: #1a2234;
  --border: #2a3548;
  --text: #e8edf5;
  --muted: #8b9cb3;
  --accent: #3b82f6;
  --accent-glow: rgba(59, 130, 246, 0.25);
  --green: #22c55e;
  --green-dim: rgba(34, 197, 94, 0.15);
  --red: #ef4444;
  --red-dim: rgba(239, 68, 68, 0.15);
  --yellow: #f59e0b;
  --radius: 12px;
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 50% at 20% -10%, rgba(59, 130, 246, 0.12), transparent),
    radial-gradient(ellipse 60% 40% at 90% 100%, rgba(34, 197, 94, 0.08), transparent);
  pointer-events: none;
  z-index: 0;
}

.app {
  position: relative;
  z-index: 1;
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px;
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.top-bar-left {
  position: relative;
}

.hamburger-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.hamburger-btn:hover,
.hamburger-btn[aria-expanded="true"] {
  background: var(--surface2);
  border-color: var(--accent);
}

.top-bar-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  min-width: 200px;
  padding: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
}

.top-bar-menu[hidden] {
  display: none;
}

.top-bar-menu-link {
  display: block;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  white-space: nowrap;
}

.top-bar-menu-link:hover {
  background: var(--surface2);
}

.top-bar-menu-link.is-active {
  color: var(--accent);
  background: var(--accent-glow);
}

.top-bar-right {
  display: flex;
  align-items: center;
}

.top-bar-share {
  gap: 8px;
}

.header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 28px;
  width: 100%;
}

.header-body {
  flex: 1;
  min-width: 0;
}

.header-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
}

.header-badges {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: nowrap;
  gap: 10px;
  flex-shrink: 0;
  margin-left: auto;
}

.logo {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px var(--accent-glow);
}

.logo-icon {
  width: 30px;
  height: 30px;
  display: block;
}

h1 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  flex-shrink: 0;
}

.header-regime-inline,
.header-chip-inline {
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

.header-regime-inline .regime-chip,
.header-chip-inline .metric-chip {
  white-space: nowrap;
}

.badge-row {
  display: contents;
}

.header-badges .badge-row .badge {
  flex: unset;
}

.header-learning {
  margin-top: 8px;
}

.subtitle {
  color: var(--muted);
  font-size: 0.875rem;
  margin-top: 2px;
}

.contact-email {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 0.8rem;
  margin-top: 4px;
}

.contact-email-icon {
  flex-shrink: 0;
  color: var(--muted);
}

.contact-email a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

.contact-email a:hover {
  text-decoration: underline;
}

.header-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.header-regime {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: stretch;
}

.header-regime .learning-note-chip {
  display: block;
  width: 100%;
  white-space: normal;
  line-height: 1.45;
  text-align: left;
}

.header-regime .learning-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.header-regime .learning-chip-row .metric-chip {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  line-height: 1.25;
}

.header-regime:empty {
  display: none;
}

.btn {
  padding: 10px 18px;
  border-radius: 10px;
  border: none;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent);
  color: white;
  box-shadow: 0 2px 12px var(--accent-glow);
}

.btn-primary:hover:not(:disabled) {
  background: #2563eb;
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--border);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}

.btn-ghost:hover:not(:disabled) {
  color: var(--text);
  border-color: var(--muted);
}

.stats-section {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 20px;
  margin-bottom: 24px;
  width: 100%;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(155px, 1fr));
  gap: 20px;
  width: 100%;
}

.stats-row-shadow {
  grid-template-columns: 1fr;
  margin-bottom: 20px;
}

.shadow-policy-panel {
  border-style: dashed;
  border-color: rgba(59, 130, 246, 0.35);
  padding: 16px 20px;
  gap: 0;
}

.shadow-policy-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px 14px;
  width: 100%;
}

.shadow-metric {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.shadow-metric-label {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.shadow-metric-value {
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.shadow-metric-value.shadow-metric-sm {
  font-size: 0.875rem;
  font-weight: 600;
  white-space: normal;
  line-height: 1.35;
}

.shadow-metric-value.positive {
  color: var(--green);
}

.shadow-metric-value.negative {
  color: var(--red);
}

.shadow-metric-value.warning {
  color: var(--yellow);
}

.shadow-metric-value.accent {
  color: #93c5fd;
}

.shadow-metric-sub {
  font-size: 0.6875rem;
  color: var(--muted);
  line-height: 1.35;
  white-space: normal;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

@media (max-width: 900px) {
  .shadow-policy-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px 12px;
  }

  .shadow-metric-value {
    font-size: 0.9rem;
    white-space: normal;
  }

  .shadow-metric-value.shadow-metric-sm {
    font-size: 0.78rem;
  }

  .shadow-metric-label {
    font-size: 0.6rem;
  }

  .shadow-metric-sub {
    font-size: 0.625rem;
    -webkit-line-clamp: 3;
  }
}

/* Vanha stats-grid (tuotanto ennen uutta HTML:ää) — 5 laatikkoa täysleveäksi */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 20px;
  width: 100%;
  margin-bottom: 24px;
}

.stats-grid .winloss-card {
  grid-column: 1 / -1;
  width: 100%;
}

.stats-grid .error-banner {
  grid-column: 1 / -1;
}

.error-banner {
  width: 100%;
  background: var(--red-dim);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fca5a5;
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 0.875rem;
}

.error-banner.hidden {
  display: none;
}

.hidden {
  display: none !important;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-card.highlight {
  background: linear-gradient(135deg, var(--surface) 0%, var(--surface2) 100%);
  border-color: rgba(59, 130, 246, 0.3);
}

.stats-page .stats-row {
  align-items: stretch;
}

.stats-page .stats-row > .stat-card {
  min-height: 6.75rem;
}

.stat-card-visits,
.stat-card-duration {
  gap: 4px;
}

.stat-card-split {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  flex: 1;
}

.stat-card-split-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.stat-card-duration .stat-card-breakdown-stack {
  flex: 1;
  justify-content: center;
}

.stat-card-breakdown-stack {
  display: flex;
  flex-direction: column;
  flex-wrap: nowrap;
  gap: 2px;
  margin-top: 0;
  padding-top: 0;
  border-top: none;
  min-width: 0;
}

.stat-card-breakdown-stack .stat-card-breakdown-item {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}

.stat-card-breakdown-stack .stat-card-breakdown-label {
  font-size: 0.6rem;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.stat-card-breakdown-stack .stat-card-breakdown-value {
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.2;
}

.stat-card-breakdown-stack .stat-card-breakdown-meta {
  font-size: 0.58rem;
  font-weight: 500;
  color: var(--muted);
}

.stat-card-duration .stat-card-breakdown-item {
  flex-wrap: nowrap;
}

.stat-card-breakdown-meta {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--muted);
}

.stat-card-breakdown {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 24px;
  margin-top: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.stat-card-breakdown-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 5rem;
}

.stat-card-breakdown-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.stat-card-breakdown-value {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}

.stat-card-next {
  min-height: 100%;
}

.stat-card-next .stat-uptime {
  margin-top: auto;
  padding-top: 12px;
  color: var(--green);
  font-weight: 600;
}

.stat-value.status-due {
  color: var(--yellow);
  font-size: 1.35rem;
}

.stat-value.status-overdue {
  color: var(--red);
  font-size: 1.25rem;
  animation: pulse-due 1.5s ease-in-out infinite;
}

@keyframes pulse-due {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.55;
  }
}

.stat-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.stat-change {
  font-size: 0.875rem;
  font-weight: 600;
}

.stat-change.stat-subline {
  font-size: 0.8125rem;
  font-weight: 500;
}

.stat-change.positive { color: var(--green); }
.stat-change.negative { color: var(--red); }
.stat-change.neutral { color: var(--muted); }

.winloss-card {
  width: 100%;
}

.winloss-note {
  margin: 0.35rem 0 0;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.4;
}

.winloss-table {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
  width: 100%;
}

.winloss-row {
  display: grid;
  grid-template-columns: minmax(6.5rem, 0.7fr) 1fr 1fr minmax(5.5rem, 0.55fr);
  column-gap: 20px;
  row-gap: 6px;
  align-items: center;
  width: 100%;
}

.winloss-row.winloss-head .winloss-win,
.winloss-row.winloss-head .winloss-loss,
.winloss-row.winloss-head .winloss-net,
.winloss-row.winloss-head .winloss-period {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  font-weight: 600;
}

.winloss-period {
  font-size: 0.8125rem;
  color: var(--muted);
}

.winloss-win {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--green);
  white-space: nowrap;
}

.winloss-loss {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--red);
  white-space: nowrap;
}

.winloss-net {
  font-size: 0.9rem;
  font-weight: 700;
  white-space: nowrap;
}

.winloss-net.up { color: var(--green); }
.winloss-net.down { color: var(--red); }
.winloss-net.even { color: var(--muted); }

.main-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.panel.wide {
  grid-column: 1 / -1;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.panel-header h2 {
  font-size: 1rem;
  font-weight: 600;
}

.panel-title-btn {
  font: inherit;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
  text-align: left;
  border-radius: 4px;
  transition: color 0.15s ease;
}

.panel-title-btn:hover,
.panel-title-btn:focus-visible {
  color: var(--accent);
  outline: none;
}

.panel-title-btn:focus-visible {
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.45);
}

.panel-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.trade-log-filters {
  display: flex;
  gap: 4px;
  padding: 3px;
  border-radius: 8px;
  background: var(--surface2);
  border: 1px solid var(--border);
}

.trade-filter-btn {
  font: inherit;
  font-size: 0.72rem;
  font-weight: 500;
  padding: 5px 10px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.trade-filter-btn:hover {
  color: var(--text);
}

.trade-filter-btn.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.trade-filter-btn[data-trade-filter="buy"].active {
  color: var(--green, #4ade80);
}

.trade-filter-btn[data-trade-filter="sell"].active {
  color: var(--red, #f87171);
}

.badge {
  font-size: 0.7rem;
  padding: 4px 10px;
  border-radius: 20px;
  background: var(--surface2);
  color: var(--muted);
  font-weight: 500;
}

.badge.ai-badge {
  background: rgba(139, 92, 246, 0.2);
  color: #a78bfa;
}

.badge.ai-badge-active {
  background: rgba(139, 92, 246, 0.35);
  color: #c4b5fd;
  box-shadow: 0 0 12px rgba(139, 92, 246, 0.25);
}

.badge.live-badge {
  background: rgba(34, 197, 94, 0.15);
  color: var(--green);
  font-size: 0.7rem;
  padding: 4px 10px;
  animation: pulse 2s infinite;
}

.badge.lang-switch {
  text-decoration: none;
  background: rgba(148, 163, 184, 0.12);
  color: var(--muted, #94a3b8);
  border: 1px solid rgba(148, 163, 184, 0.25);
  font-weight: 600;
  letter-spacing: 0.04em;
  font-size: 0.7rem;
  padding: 4px 10px;
}

.badge.lang-switch:hover {
  color: var(--text, #e2e8f0);
  border-color: rgba(148, 163, 184, 0.5);
}

.lang-flags {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 2px;
  flex-shrink: 0;
}

.lang-flag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 28px;
  border-radius: 999px;
  text-decoration: none;
  border: 1px solid transparent;
  background: rgba(148, 163, 184, 0.08);
  opacity: 0.55;
  transition: opacity 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.lang-flag:hover {
  opacity: 0.9;
  background: rgba(148, 163, 184, 0.16);
}

.lang-flag.is-active {
  opacity: 1;
  border-color: rgba(148, 163, 184, 0.45);
  background: rgba(148, 163, 184, 0.18);
}

.lang-flag-emoji {
  font-size: 1rem;
  line-height: 1;
}

.lang-flag-svg {
  width: 20px;
  height: 14px;
  display: block;
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.25);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.crypto-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  padding: 16px;
}

.panel-markets,
.panel-ai {
  max-height: 520px;
  min-height: 520px;
  display: flex;
  flex-direction: column;
}

.panel-markets {
}

.market-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px 0;
  flex-wrap: wrap;
}

.market-search {
  flex: 1;
  min-width: 180px;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  font-family: inherit;
  font-size: 0.875rem;
}

.market-search:focus {
  outline: none;
  border-color: var(--accent);
}

.market-count {
  font-size: 0.75rem;
  color: var(--muted);
  white-space: nowrap;
}

.market-list {
  overflow-y: auto;
  padding: 12px 16px 16px;
  flex: 1;
  max-height: 400px;
}

.market-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px 16px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-size: 0.85rem;
  transition: background 0.15s;
}

.market-row:hover {
  background: var(--surface2);
}

.market-row.selected {
  border-color: var(--accent);
  background: rgba(59, 130, 246, 0.08);
}

.market-row.target {
  border-color: rgba(139, 92, 246, 0.45);
  background: rgba(139, 92, 246, 0.06);
}

.market-row-badge-target {
  color: #a78bfa;
}

.market-row-id {
  font-weight: 700;
}

.market-row-pair {
  font-size: 0.7rem;
  color: var(--muted);
}

.market-row-price {
  font-weight: 600;
  text-align: right;
}

.market-row-change {
  font-size: 0.8rem;
  font-weight: 600;
  text-align: right;
  min-width: 88px;
}

.market-row-head {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  padding: 4px 12px 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}

.market-row-head:hover {
  background: transparent;
}

.market-head-price,
.market-head-change {
  text-align: right;
}

.market-change-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

.market-pct-pill {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 700;
  min-width: 64px;
  text-align: center;
}

.market-pct-pill.up {
  background: var(--green-dim);
  color: var(--green);
}

.market-pct-pill.down {
  background: var(--red-dim);
  color: var(--red);
}

.market-pct-sub {
  font-size: 0.65rem;
  color: var(--muted);
}

.market-pct-sub.up {
  color: var(--green);
}

.market-pct-sub.down {
  color: var(--red);
}

.market-pct-times {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0 2px;
  line-height: 1.35;
}

.market-pct-sep {
  color: var(--muted);
  font-weight: 400;
}

.market-row-change.up {
  color: var(--green);
}

.market-row-change.down {
  color: var(--red);
}

.market-row-badge {
  grid-column: 1 / -1;
  font-size: 0.65rem;
  color: var(--accent);
}

.holding-value {
  font-weight: 700;
}
.holding-value.up { color: var(--green); }
.holding-value.down { color: var(--red); }
.holding-value.even { color: var(--yellow); }

.holding-pnl-eur.up { color: var(--green); font-weight: 600; }
.holding-pnl-eur.down { color: var(--red); font-weight: 600; }
.holding-pnl-eur.even { color: var(--yellow); font-weight: 600; }

.crypto-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  transition: border-color 0.2s;
}

.crypto-card.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-glow);
}

.crypto-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.crypto-symbol {
  font-weight: 700;
  font-size: 0.95rem;
}

.crypto-name {
  font-size: 0.7rem;
  color: var(--muted);
}

.crypto-price {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.crypto-change {
  font-size: 0.8rem;
  font-weight: 600;
}

.crypto-change.up { color: var(--green); }
.crypto-change.down { color: var(--red); }

.crypto-signal {
  margin-top: 8px;
  font-size: 0.7rem;
  padding: 4px 8px;
  border-radius: 6px;
  display: inline-block;
}

.signal-buy { background: var(--green-dim); color: var(--green); }
.signal-sell { background: var(--red-dim); color: var(--red); }
.signal-hold { background: rgba(139, 156, 179, 0.15); color: var(--muted); }

.ai-decision {
  padding: 16px 20px;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.panel-ai .ai-decision {
  flex: 0 0 auto;
  min-height: 0;
}

.panel-ai .ai-timeline-wrap {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.panel-ai .explanation-timeline {
  flex: 1;
  min-height: 0;
  max-height: none;
}

.ai-placeholder {
  color: var(--muted);
  font-size: 0.9rem;
}

.ai-action {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.ai-action-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

.ai-action-icon.buy { background: var(--green-dim); }
.ai-action-icon.sell { background: var(--red-dim); }
.ai-action-icon.hold { background: rgba(139, 156, 179, 0.15); }

.ai-action-text h3 {
  font-size: 1rem;
  margin-bottom: 2px;
}

.ai-action-text p {
  font-size: 0.8rem;
  color: var(--muted);
}

.ai-section {
  margin-top: 14px;
}

.ai-section-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 8px;
}

.ai-decision-item {
  background: var(--surface2);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 8px;
  border-left: 3px solid var(--border);
}

.ai-decision-item.buy { border-left-color: var(--green); }
.ai-decision-item.sell { border-left-color: var(--red); }
.ai-decision-item.hold { border-left-color: var(--muted); }
.ai-decision-item.watch { border-left-color: var(--yellow); }

.ai-decision-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.ai-decision-type {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
}

.ai-decision-type.buy { background: var(--green-dim); color: var(--green); }
.ai-decision-type.sell { background: var(--red-dim); color: var(--red); }
.ai-decision-type.hold { background: rgba(139,156,179,0.15); color: var(--muted); }
.ai-decision-type.watch { background: rgba(245,158,11,0.15); color: var(--yellow); }

.ai-decision-amount {
  margin-left: auto;
  font-size: 0.8rem;
  font-weight: 600;
}

.ai-decision-reason {
  font-size: 0.85rem;
  color: var(--text);
  line-height: 1.4;
}

.ai-decision-meta {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 4px;
}

.ai-timestamp {
  font-size: 0.7rem;
  color: var(--muted);
  margin-top: 12px;
}

.ai-event-section {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.ai-event-log {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px;
}

.ai-event-item {
  background: var(--surface2);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 8px;
  border-left: 3px solid var(--border);
}

.ai-event-item.buy { border-left-color: var(--green); }
.ai-event-item.sell { border-left-color: var(--red); }
.ai-event-item.hold { border-left-color: var(--muted); }
.ai-event-item.watch { border-left-color: var(--yellow); }
.ai-event-item.info { border-left-color: var(--accent); }

.ai-event-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.ai-event-time {
  margin-left: auto;
  font-size: 0.7rem;
  color: var(--muted);
  white-space: nowrap;
}

.explanation-timeline {
  position: relative;
  max-height: 480px;
  overflow-y: auto;
  padding: 16px 20px 20px 42px;
}

.explanation-timeline::before {
  content: "";
  position: absolute;
  left: 22px;
  top: 16px;
  bottom: 16px;
  width: 2px;
  background: var(--border);
}

.explanation-timeline .ai-event-item {
  position: relative;
}

.explanation-timeline .ai-event-item::before {
  content: "";
  position: absolute;
  left: -24px;
  top: 14px;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--border);
  border: 2px solid var(--surface);
}

.explanation-timeline .ai-event-item.buy::before { background: var(--green); }
.explanation-timeline .ai-event-item.sell::before { background: var(--red); }
.explanation-timeline .ai-event-item.hold::before { background: var(--muted); }
.explanation-timeline .ai-event-item.watch::before { background: var(--yellow); }
.explanation-timeline .ai-event-item.info::before { background: var(--accent); }

.ai-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.metric-chip {
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: 6px;
  background: var(--bg);
  border: 1px solid var(--border);
}

.metric-chip.up { color: var(--green); border-color: rgba(34, 197, 94, 0.4); }
.metric-chip.down { color: var(--red); border-color: rgba(239, 68, 68, 0.4); }
.metric-chip.neutral { color: var(--muted); }

.portfolio-table-wrap {
  overflow-x: auto;
  padding: 0 20px 16px;
}

.portfolio-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.portfolio-table th {
  text-align: left;
  padding: 12px 8px;
  color: var(--muted);
  font-weight: 500;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border);
}

.portfolio-table td {
  padding: 12px 8px;
  border-bottom: 1px solid rgba(42, 53, 72, 0.5);
}

.portfolio-table tr:last-child td {
  border-bottom: none;
}

.portfolio-pnl-stack {
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-items: flex-start;
}

.portfolio-live-pnl {
  font-size: 0.85rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 20px;
  background: var(--surface2);
}

.portfolio-live-pnl.positive {
  color: var(--green);
  background: rgba(34, 197, 94, 0.12);
}

.portfolio-live-pnl.negative {
  color: var(--red);
  background: rgba(239, 68, 68, 0.12);
}

.portfolio-live-pnl.neutral {
  color: var(--muted);
}

.portfolio-summary-row td {
  border-top: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.35);
  font-weight: 500;
}

.trade-log {
  max-height: 320px;
  overflow-y: auto;
  padding: 12px 20px 16px;
}

.empty-log {
  color: var(--muted);
  font-size: 0.9rem;
  padding: 8px 0;
}

.learning-report-panel {
  margin-top: 0;
}

.learning-report {
  padding: 16px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.learning-narrative {
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.25);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.learning-narrative-intro {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.45;
}

.learning-story-title {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  margin-bottom: 10px;
}

.learning-story-body {
  font-size: 0.9375rem;
  color: var(--text);
  line-height: 1.65;
  white-space: pre-line;
}

.learning-narrative-pending p,
.learning-narrative-error p {
  font-size: 0.875rem;
  color: var(--muted);
  line-height: 1.5;
}

.learning-narrative-error p {
  color: #fca5a5;
}

.learning-narrative-block h4 {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 4px;
}

.learning-narrative-block p {
  font-size: 0.875rem;
  color: var(--text);
  line-height: 1.5;
  white-space: pre-line;
}

.learning-narrative-block.ideas {
  border-top: 1px dashed rgba(245, 158, 11, 0.35);
  padding-top: 10px;
}

.learning-narrative-block.shadow-policy {
  border-top: 1px dashed rgba(96, 165, 250, 0.35);
  padding-top: 10px;
}

.learning-narrative-block.shadow-policy h4 {
  color: #93c5fd;
}

.learning-narrative-block.shadow-policy.ideas h4 {
  color: var(--yellow);
}

.learning-narrative-block.microstructure {
  border-top: 1px dashed rgba(52, 211, 153, 0.35);
  padding-top: 10px;
}

.learning-narrative-block.microstructure h4 {
  color: #6ee7b7;
}

.learning-narrative-block.microstructure.ideas h4 {
  color: var(--yellow);
}

.learning-narrative-block.exit-peak {
  border-top: 1px dashed rgba(251, 191, 36, 0.35);
  padding-top: 10px;
}

.learning-narrative-block.exit-peak h4 {
  color: #fcd34d;
}

.learning-narrative-block.exit-peak.ideas h4 {
  color: var(--yellow);
}

.learning-narrative-block.sell-outcomes {
  border-top: 1px dashed rgba(52, 211, 153, 0.35);
  padding-top: 10px;
}

.learning-narrative-block.sell-outcomes h4 {
  color: #6ee7b7;
}

.learning-narrative-block.regime-anticipation {
  border-top: 1px dashed rgba(96, 165, 250, 0.35);
  padding-top: 10px;
}

.learning-narrative-block.regime-anticipation h4 {
  color: #93c5fd;
}

.learning-narrative-block.bull-satellite {
  border-top: 1px dashed rgba(251, 191, 36, 0.35);
  padding-top: 10px;
}

.learning-narrative-block.bull-satellite h4 {
  color: #fcd34d;
}

.learning-narrative-block.ideas h4 {
  color: var(--yellow);
}

.learning-sections {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.learning-section {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
}

.learning-section h4 {
  font-size: 0.8rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text);
}

.learning-section ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.learning-section li {
  font-size: 0.8125rem;
  color: var(--muted);
  line-height: 1.4;
}

.learning-changes,
.learning-roadmap {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
}

.learning-changes h4,
.learning-roadmap h4 {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 8px;
}

.learning-changes ul,
.learning-roadmap ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.learning-changes li {
  font-size: 0.8125rem;
  color: var(--green);
}

.learning-roadmap li {
  font-size: 0.8125rem;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.learning-roadmap .roadmap-status-ready {
  color: var(--green);
}

.learning-roadmap .roadmap-status-soon {
  color: var(--yellow);
}

@media (max-width: 768px) {
  .learning-sections {
    grid-template-columns: 1fr;
  }
}

.trade-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(42, 53, 72, 0.5);
  font-size: 0.85rem;
}

.trade-item:last-child {
  border-bottom: none;
}

.trade-type {
  font-weight: 700;
  font-size: 0.7rem;
  padding: 4px 8px;
  border-radius: 6px;
  min-width: 48px;
  text-align: center;
}

.trade-type.buy {
  background: var(--green-dim);
  color: var(--green);
}

.trade-type.sell {
  background: var(--red-dim);
  color: var(--red);
}

.trade-type.tax {
  background: rgba(245, 158, 11, 0.15);
  color: var(--yellow);
}

.trade-details {
  flex: 1;
}

.trade-details .main {
  font-weight: 600;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.trade-pnl {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 6px;
  white-space: nowrap;
}

.trade-pnl.up {
  background: var(--green-dim);
  color: var(--green);
}

.trade-pnl.down {
  background: var(--red-dim);
  color: var(--red);
}

.trade-details .sub {
  color: var(--muted);
  font-size: 0.8rem;
  margin-top: 2px;
}

.trade-time {
  color: var(--muted);
  font-size: 0.75rem;
  white-space: nowrap;
}

.status-running {
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

@media (max-width: 900px) {
  .header-title-row {
    flex-wrap: wrap;
  }

  .header-badges {
    flex-wrap: wrap;
    margin-left: 0;
    width: 100%;
    justify-content: flex-start;
  }

  .stats-row,
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .main-grid {
    grid-template-columns: 1fr;
  }

  .crypto-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .app {
    padding: 16px 12px;
  }

  .header-title-row {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .header-badges {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    width: 100%;
  }

  .header-regime-inline,
  .header-chip-inline {
    width: 100%;
  }

  .header-regime-inline .regime-chip,
  .header-chip-inline .metric-chip {
    white-space: normal;
    display: block;
    width: 100%;
    line-height: 1.45;
    text-align: left;
  }

  .header-regime-inline .regime-chip {
    white-space: normal;
    display: block;
    width: 100%;
    line-height: 1.45;
    text-align: left;
  }

  .header-badges .badge {
    width: 100%;
    text-align: center;
  }

  .header-badges .badge-row {
    display: flex;
    gap: 8px;
  }

  .header-badges .badge-row .badge {
    flex: 1;
  }

  h1 {
    font-size: 1.25rem;
  }

  .stat-card {
    padding: 16px;
  }

  .shadow-policy-panel {
    padding: 14px 16px;
  }

  .shadow-policy-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px 14px;
  }

  .shadow-metric-value {
    font-size: 0.95rem;
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
  }

  .stat-value {
    font-size: 1.5rem;
  }

  .winloss-row.winloss-head {
    display: none;
  }

  .winloss-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 4px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
  }

  .winloss-row:last-child {
    border-bottom: none;
  }

  .winloss-period {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 2px;
  }

  .winloss-win,
  .winloss-loss,
  .winloss-net {
    white-space: normal;
    font-size: 0.8125rem;
    font-weight: 600;
  }

  .winloss-win::before {
    content: "Voitolliset: ";
    color: var(--muted);
    font-weight: 500;
  }

  .winloss-loss::before {
    content: "Tappiolliset: ";
    color: var(--muted);
    font-weight: 500;
  }

  .winloss-net::before {
    content: "Yhteensä: ";
    color: var(--muted);
    font-weight: 500;
  }
}

@media (max-width: 520px) {
  .stats-row,
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .shadow-policy-grid {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .shadow-metric {
    padding: 12px 0;
    border-bottom: 1px solid rgba(42, 53, 72, 0.45);
  }

  .shadow-metric:first-child {
    padding-top: 0;
  }

  .shadow-metric:last-child {
    border-bottom: none;
    padding-bottom: 0;
  }

  .shadow-metric-label {
    font-size: 0.625rem;
  }

  .shadow-metric-value {
    font-size: 1rem;
  }
}

body.modal-open {
  overflow: hidden;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(4px);
}

.modal-overlay.hidden {
  display: none;
}

.modal {
  width: min(960px, 100%);
  max-height: min(88vh, 820px);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.45);
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 {
  font-size: 1rem;
  font-weight: 600;
}

.modal-close {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

.modal-close:hover,
.modal-close:focus-visible {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

.modal-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.modal-toolbar input[type="search"] {
  flex: 1 1 220px;
  min-width: 0;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.25);
  color: var(--text);
  font: inherit;
  font-size: 0.875rem;
}

.modal-toolbar input[type="search"]::placeholder {
  color: var(--muted);
}

.modal-toolbar input[type="search"]:focus {
  outline: none;
  border-color: rgba(59, 130, 246, 0.55);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.modal-meta {
  font-size: 0.8125rem;
  color: var(--muted);
  white-space: nowrap;
}

.gemini-narrative-modal-body {
  display: grid;
  grid-template-columns: minmax(220px, 34%) minmax(0, 1fr);
  min-height: 0;
  flex: 1;
}

.gemini-narrative-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px;
  border-right: 1px solid var(--border);
  overflow-y: auto;
  max-height: min(68vh, 640px);
}

.gemini-narrative-list-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
}

.gemini-narrative-list-item:hover {
  background: rgba(255, 255, 255, 0.04);
}

.gemini-narrative-list-item.active {
  background: rgba(59, 130, 246, 0.12);
  border-color: rgba(59, 130, 246, 0.35);
}

.gemini-narrative-list-date {
  font-size: 0.75rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.gemini-narrative-list-preview {
  font-size: 0.8125rem;
  line-height: 1.4;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.gemini-narrative-list-empty {
  padding: 12px;
  font-size: 0.875rem;
  color: var(--muted);
  line-height: 1.5;
}

.gemini-narrative-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent);
  background: rgba(59, 130, 246, 0.15);
}

.gemini-narrative-detail {
  padding: 16px 20px;
  overflow-y: auto;
  max-height: min(68vh, 640px);
}

.gemini-narrative-detail-header {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  font-size: 0.8125rem;
  color: var(--muted);
}

.gemini-narrative-detail .learning-narrative {
  margin: 0;
}

@media (max-width: 720px) {
  .gemini-narrative-modal-body {
    grid-template-columns: 1fr;
  }

  .gemini-narrative-list {
    border-right: none;
    border-bottom: 1px solid var(--border);
    max-height: 34vh;
  }

  .gemini-narrative-detail {
    max-height: none;
  }
}

/* Kävijätilastot /stats */
.stats-page .header-title-row {
  align-items: center;
}

.stats-header-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.stats-user-label {
  font-size: 0.85rem;
  color: var(--muted);
}

.stats-back-link {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.9rem;
  white-space: nowrap;
}

.stats-back-link:hover {
  text-decoration: underline;
}

.stats-panel {
  margin-bottom: 24px;
  padding: 20px;
  overflow: visible;
}

.stats-panel .panel-title {
  margin-bottom: 16px;
  font-size: 1.05rem;
  font-weight: 600;
}

.stats-hint {
  color: var(--muted);
  font-size: 0.82rem;
  margin: -4px 0 12px;
}

.stats-country-detail-inner {
  padding-left: 20px;
}

.stats-country-day-summary {
  margin-top: 4px;
}

.stats-country-day-summary .stats-day-detail-inner {
  padding-left: 20px;
}

.stats-day-row {
  cursor: pointer;
  user-select: none;
}

.stats-day-row.is-open,
.stats-day-row:hover {
  background: rgba(255, 255, 255, 0.04);
}

.stats-day-chevron {
  display: inline-block;
  width: 1em;
  color: var(--muted);
  transition: transform 0.15s ease;
}

.stats-day-row.is-open .stats-day-chevron {
  transform: rotate(90deg);
}

.stats-day-detail td {
  padding: 0;
  background: rgba(0, 0, 0, 0.18);
  border-top: none;
}

.stats-day-detail-inner {
  padding: 8px 12px 14px 28px;
}

.stats-visit-log {
  margin: 0;
}

.stat-value-sm {
  font-size: 1.25rem !important;
}

.stats-day-table-wrap {
  overflow-x: auto;
}

.stats-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.stats-table th,
.stats-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.stats-table .stats-num {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  width: 1%;
}

.stats-table th {
  color: var(--muted);
  font-weight: 500;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stats-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.stats-table code {
  font-size: 0.8125rem;
  color: var(--text);
}

.stats-bar-col {
  width: 160px;
  max-width: 28%;
  min-width: 100px;
}

.stats-bar-track {
  height: 8px;
  background: var(--surface2);
  border-radius: 4px;
  overflow: hidden;
  max-width: 140px;
}

.stats-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #60a5fa);
  border-radius: 4px;
  min-width: 2px;
}

.stats-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 24px;
}

.stats-empty {
  color: var(--muted);
  font-size: 0.9rem;
}

.stats-footer-note {
  color: var(--muted);
  font-size: 0.8rem;
  margin-top: 8px;
  margin-bottom: 32px;
}

.stats-footer-note a {
  color: var(--accent);
  text-decoration: none;
}

.stats-footer-note a:hover {
  text-decoration: underline;
}

@media (max-width: 900px) {
  .stats-two-col {
    grid-template-columns: 1fr;
  }
}

.stats-login-page {
  max-width: 520px;
}

.stats-login-panel {
  max-width: 100%;
}

.stats-login-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.stats-login-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stats-login-input {
  font: inherit;
  font-size: 1rem;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
}

.stats-login-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.stats-login-btn {
  margin-top: 8px;
  width: 100%;
}

.stats-login-error {
  color: var(--red);
  background: var(--red-dim);
  border: 1px solid rgba(239, 68, 68, 0.35);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 16px;
  font-size: 0.9rem;
}

/* Etusivu — hakukoneille luettava kuvaus */
.site-seo-footer {
  margin-top: 32px;
  padding: 24px 0 16px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.65;
  max-width: 820px;
}

.site-seo-footer h2 {
  color: var(--text);
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 12px;
}

.site-seo-footer p {
  margin-bottom: 12px;
}

.site-seo-footer p:last-child {
  margin-bottom: 0;
}

.site-seo-footer strong {
  color: #b8c5d9;
  font-weight: 600;
}

.site-seo-footer a {
  color: var(--accent);
  text-decoration: none;
}

.site-seo-footer a:hover {
  text-decoration: underline;
}

.site-footer-links {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.site-footer-links a {
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
}

.site-footer-links a:hover {
  text-decoration: underline;
}

.site-footer-share {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
}

.share-label {
  font-size: 0.85rem;
  color: var(--muted);
}

.share-icons {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* .share-icons -esivanhempi nostaa spesifisyyden yli .site-seo-footer a:n
   (color: var(--accent)) — muuten ikonin oma valkoinen väri (SVG:n
   currentColor) hävisi footerin yleiselle linkkiväri-säännölle. */
.share-icons .share-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  color: #fff;
  text-decoration: none;
  opacity: 0.9;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.share-icon-btn:hover {
  opacity: 1;
  transform: translateY(-1px);
}

.share-icon-btn--whatsapp {
  background: #25d366;
}

.share-icon-btn--facebook {
  background: #1877f2;
}

.share-icon-btn--x {
  background: #000000;
}

.share-icon-btn--linkedin {
  background: #0a66c2;
}

/* Muutosloki /muutokset */
.changelog-page .header-title-row {
  align-items: flex-start;
}

.changelog-section {
  max-width: 720px;
  margin-top: 8px;
}

.changelog-intro {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.6;
  margin-bottom: 28px;
}

.changelog-day {
  margin-bottom: 32px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--border);
}

.changelog-day:last-of-type {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.changelog-date {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 14px;
}

.changelog-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.changelog-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-left: 14px;
  border-left: 2px solid var(--accent-dim, rgba(99, 179, 237, 0.35));
}

.changelog-item-title {
  color: var(--text);
  font-weight: 600;
  font-size: 0.95rem;
}

.changelog-item-body {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.55;
}
