body.profile-page,
body.app-page {
  width: 100%;
  max-width: none;
  min-height: 100vh;
  margin: 0;
  padding: 0 0 72px;
  background:
    radial-gradient(circle at 85% 5%, rgba(75, 142, 240, 0.08), transparent 32rem),
    var(--bg);
  color: var(--ink);
  font-family: var(--sans);
}

.profile-page > *,
.app-page > * { max-width: var(--shell); margin-left: auto; margin-right: auto; }

.profile-page > nav,
.profile-page > footer,
.app-page > nav,
.app-page > footer {
  width: 100%;
  max-width: none;
}

.profile-page > footer,
.app-page > footer { margin-top: 72px; }

.profile-page .profile-header-row,
.app-page .app-header-row {
  margin-top: 28px;
  min-height: 60px;
  margin-bottom: 28px;
  border-bottom: 1px solid var(--rule);
}

.app-page .app-header-title {
  margin: 0;
  padding: 14px 0 18px;
  color: var(--ink);
  font-size: clamp(28px, 4vw, 44px);
  font-weight: 600;
  letter-spacing: -0.03em;
}

.profile-page .admin-section,
.app-page .admin-section,
.app-page .controls-block {
  border: 1px solid var(--rule);
  border-radius: 0;
  background: var(--panel-gradient);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16);
}

.profile-page .admin-section,
.app-page .admin-section { padding: 28px; }

.profile-page .profile-hero-shell {
  max-width: none;
  background:
    linear-gradient(115deg, rgba(75, 142, 240, 0.11), transparent 44%),
    var(--panel-gradient);
}

.profile-page .profile-kicker {
  color: var(--accent);
  font-family: var(--mono);
}

.profile-page #profileUsername {
  color: var(--ink);
  font-family: var(--sans);
  font-size: clamp(34px, 5vw, 56px);
  letter-spacing: -0.035em;
}

.profile-page .profile-hero-summary-card,
.profile-page .profile-meta-pill,
.app-page .chart-container,
.profile-page .chart-container,
.profile-page .radar-settings-panel {
  border: 1px solid var(--rule);
  border-radius: 0;
  background: var(--bg);
  box-shadow: none;
}

.profile-page h3,
.app-page h2,
.app-page h3 { color: var(--ink); font-family: var(--sans); }

.app-page > h2 {
  margin-top: 36px;
  margin-bottom: 14px;
  font-size: 24px;
}

.profile-page .text-secondary,
.app-page .text-secondary { color: var(--ink-2); }

.profile-page input,
.app-page input[type="text"],
.app-page select {
  border: 1px solid var(--rule-mid);
  border-radius: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
}

.profile-page input:focus,
.app-page input:focus,
.app-page select:focus {
  border-color: var(--accent);
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  background: var(--bg);
}

.profile-page .tabs button,
.profile-page .season-filter button,
.app-page .tabs button,
.app-page .season-filter button,
.app-page .dropbtn {
  border: 1px solid var(--rule-mid);
  border-radius: 0;
  background: var(--bg);
  color: var(--ink-2);
  font-family: var(--sans);
}

.profile-page .tabs button.active,
.profile-page .season-filter button.active,
.app-page .tabs button.active,
.app-page .season-filter button.active {
  border-color: var(--action-border);
  background: var(--action-gradient);
  color: var(--action-text);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 2px 5px rgba(0, 0, 0, 0.24);
}

.app-page .dropbtn:hover,
.profile-page .tabs button:hover,
.app-page .tabs button:hover { border-color: var(--accent); color: var(--ink); }

.app-page #graphsControlsStack {
  max-width: var(--shell);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.app-page #graphsControlsStack .controls-block {
  padding: 18px;
  border-radius: 0;
  margin: 0;
}
.app-page #graphsControlsStack .controls-block:first-child,
.app-page #filterByUsernameSection { grid-column: 1 / -1; }

.profile-page .profile-social-link {
  border-color: var(--action-border);
  background: var(--accent-bg);
  color: var(--accent);
}

.profile-page .profile-filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
}

.profile-page .profile-filter-row select {
  min-width: 190px;
}

.profile-page .profile-filter-summary {
  margin-top: 8px;
}

.profile-page .profile-dimension-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.profile-page .profile-dimension-card {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--rule);
  background: var(--bg);
}

.profile-page .profile-dimension-card h4 {
  margin: 0 0 10px;
  color: var(--accent);
}

.profile-page .profile-table-scroll {
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.profile-page .profile-dimension-table {
  min-width: 900px;
}

.app-page .app-modal-content {
  width: min(500px, 90vw);
  padding: 24px;
  border: 1px solid var(--rule-mid);
  border-radius: 0;
  background: var(--panel-gradient);
  color: var(--ink);
}

.app-page .app-modal-content #modalTitle {
  margin: 0;
  color: var(--accent);
}

.app-page .app-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

.app-page .app-modal-content #modalInput {
  width: 100%;
  margin: 0;
  border: 1px solid var(--rule-mid);
  border-radius: 0;
  background: var(--bg);
  color: var(--ink);
}

.app-page .app-modal-actions #modalConfirm {
  border: 1px solid var(--action-border);
  border-radius: 0;
  background: var(--action-gradient);
  color: var(--action-text);
}

.app-page .app-modal-actions #modalCancel {
  border: 1px solid var(--rule-mid);
  border-radius: 0;
  background: transparent;
  color: var(--ink);
}

.profile-page .dropdown-list,
.app-page .dropdown-list {
  border-color: var(--rule-mid);
  border-radius: 0;
  background: var(--surface);
}

.profile-page .global-auth-hamburger,
.app-page .global-auth-hamburger {
  border: 1px solid var(--action-border);
  border-radius: 0;
  background: var(--action-gradient);
  color: var(--action-text);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 2px 5px rgba(0, 0, 0, 0.24);
}

@media (max-width: 700px) {
  body.profile-page,
  body.app-page { padding: 0 0 48px; }
  .profile-page > :not(nav):not(footer):not(script),
  .app-page > :not(nav):not(footer):not(script) { width: calc(100% - 28px); }
  .app-page #graphsControlsStack { grid-template-columns: 1fr; }
  .app-page #graphsControlsStack .controls-block,
  .app-page #filterByUsernameSection { grid-column: 1; }
  .profile-page .admin-section,
  .app-page .admin-section { padding: 20px; }
  .profile-page .profile-header-row,
  .app-page .app-header-row { min-height: 52px; }
  .profile-page .profile-hero-summary-grid { grid-template-columns: 1fr 1fr; }
  .profile-page .profile-dimension-grid { grid-template-columns: 1fr; }
  .profile-page .profile-filter-row {
    display: grid;
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .profile-page .profile-filter-row select { width: 100%; }
  .app-page .charts,
  .profile-page .charts { grid-template-columns: 1fr; }

  .profile-page input:not([type="checkbox"]):not([type="radio"]),
  .profile-page select,
  .app-page input:not([type="checkbox"]):not([type="radio"]),
  .app-page select {
    min-height: 44px;
    font-size: 16px;
  }

  .profile-page .dashboard-table-scroll,
  .app-page .dashboard-table-scroll,
  .profile-page .metrics-content,
  .app-page .metrics-content {
    max-width: 100%;
    overscroll-behavior-inline: contain;
    -webkit-overflow-scrolling: touch;
  }

  .app-page .app-modal-content {
    width: min(94vw, 500px);
    max-height: calc(100dvh - 24px);
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .app-page .app-modal-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .app-page .app-modal-actions .dropbtn {
    width: 100%;
    min-height: 44px;
  }
}

@media (max-width: 420px) {
  .profile-page .profile-hero-summary-grid { grid-template-columns: 1fr; }

  .profile-page .admin-section,
  .app-page .admin-section { padding: 14px; }
}

@media (max-width: 560px) {
  .profile-page .charts,
  .app-page .charts {
    display: grid;
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: min(88vw, 420px);
    gap: 10px;
    max-width: 100%;
    padding-bottom: 8px;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scroll-snap-type: inline mandatory;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
  }

  .profile-page .charts > .chart-container,
  .app-page .charts > .chart-container {
    width: 100%;
    scroll-snap-align: start;
    scroll-snap-stop: always;
  }

  .app-page #appSelectedUsers [data-remove-user],
  .app-page .app-search-wrap,
  .profile-page .profile-search-wrap {
    width: 100%;
  }
}
